diff --git a/README_zh.md b/README_zh.md index a0fa6ce0155891ce7fee14835d7ca1cb5192512c..a9aba80ad096c69ed2d8046a69d2f603697a928a 100755 --- a/README_zh.md +++ b/README_zh.md @@ -343,9 +343,22 @@ OpenHarmony支持如下几种系统类型: } ``` -5. 测试套件编译命令。 +5. 测试套件编译命令_两种编译方式。 - 随版本编译,debug版本编译时会同步编译acts测试套件 + 方式一: + + ``` + ./test/xts/tools/lite/build.sh product=wifiiot xts=acts + ``` + + 方式二: + + ``` + hb set + 选择 设备类型 + hb build --gn-args build_xts=true + (注):若不追加--gn-args build_xts=true,不会编译acts测试套件。 + ``` >![](figures/icon-note.gif) **说明:** >acts测试套件编译中间件为静态库,最终链接到版本镜像中 。 @@ -447,7 +460,7 @@ OpenHarmony支持如下几种系统类型: sources = [ "src/TestDemo.cpp" ] - + include_dirs = [ "src", ... @@ -457,7 +470,7 @@ OpenHarmony支持如下几种系统类型: ] cflags = [ "-Wno-error" ] } - + ``` 4. acts目录下增加编译选项(BUILD.gn)样例: @@ -476,9 +489,31 @@ OpenHarmony支持如下几种系统类型: } ``` -5. 测试套件编译命令。 +5. 测试套件编译命令_两种编译方式。 + + L1_LiteOS: + + ``` + 方式一: + python3 build.py -p ipcamera_hispark_taurus@hisilicon --gn-args build_xts=true + 方式二: + hb set + 选择 设备类型 + hb build --gn-args build_xts=true + (注):若不追加--gn-args build_xts=true,不会编译acts测试套件。 + ``` + + L1_Linux: - 随版本编译,debug版本编译时会同步编译acts测试套件 + ``` + 方式一: + python3 build.py -p ipcamera_hispark_taurus_linux@hisilicon --gn-args build_xts=true + 方式二: + hb set + 选择 设备类型 + hb build --gn-args build_xts=true + (注):若不追加--gn-args build_xts=true,不会编译acts测试套件。 + ``` >![](figures/icon-note.gif) **说明:** >小型系统acts独立编译成可执行文件(bin格式), 在编译产物的suites\\acts目录下归档。 @@ -581,55 +616,91 @@ OpenHarmony支持如下几种系统类型: 用例编写语法采用 jasmine 的标准语法,格式支持ES6格式。 -1. 规范用例目录:测试用例存储到entry/src/main/js/test目录。 +**以FA 模式为例:** + +1. 规范用例目录:测试用例存储到 src/main/js/test目录。 ``` - ├── BUILD.gn - │ └──entry - │ │ └──src - │ │ │ └──main - │ │ │ │ └──js - │ │ │ │ │ └──default - │ │ │ │ │ │ └──pages - │ │ │ │ │ │ │ └──index - │ │ │ │ │ │ │ │ └──index.js # 入口文件 - │ │ │ │ │ └──test # 测试代码存放目录 - │ │ │ └── resources # hap资源存放目录 - │ │ │ └── config.json # hap配置文件 + ├── BUILD.gn + ├── Test.json # 资源依赖hap不需要Test.json文件 + ├── signature + │ └──openharmony_sx.p7b # 签名工具 + └──src + │ └──main + │ │ └──js + │ │ │ └──MainAbility + │ │ │ │ └──app.js + │ │ │ │ └──pages + │ │ │ │ │ └──index + │ │ │ │ │ │ └──index.js + │ │ │ └──test # 测试代码存放目录 + │ │ │ │ │ └──List.test.js + │ │ │ │ │ └──Ability.test.js + │ │ │ └──TestAbility # 测试框架入口模板文件,添加后无需修改 + │ │ │ │ └──app.js + │ │ │ │ └──pages + │ │ │ │ │ └──index + │ │ │ │ │ │ └──index.js + │ │ │ └──TestRunner # 测试框架入口模板文件,添加后无需修改 + │ │ │ │ └──OpenHarmonyTestRunner.js + │ └── resources # hap资源存放目录 + │ └── config.json # hap配置文件 ``` -2. index.js示例 +2. OpenHarmonyTestRunner.js 示例 + + ``` + //加载js 测试框架 + import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + + ... + + export default { + ... + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility' + + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + ... + } + }; + ``` + +3. index.js示例 ``` - // 拉起js测试框架,加载测试用例 - import {Core, ExpectExtend} from 'deccjsunit/index' - export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - }, + ... onShow() { - console.info('onShow finish') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - const configService = core.getDefaultService('config') - configService.setConfig(this) - require('../../../test/List.test') - core.execute() - }, - onReady() { + console.info('onShow finish!') }, + ... } ``` -3. 单元测试用例示例 +4. app.js示例 + + ``` + //加载测试用例 + 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) + }, + ... + }; + ``` + +5. 单元测试用例示例 ``` // Example1: 使用HJSUnit进行单元测试 @@ -643,6 +714,228 @@ OpenHarmony支持如下几种系统类型: ``` +FA_JS 模式测试模块下用例配置文件(BUILD.gn)样例: + +``` +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsDemoTest") { + hap_profile = "./src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" //签名文件 + hap_name = "ActsDemoTest" //测试套件,以Acts开头,以Test结尾,采用驼峰式命名 + part_name = "..." //部件 + subsystem_name = "..." //子系统 +} +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" +} +``` + +FA_TS 模式测试模块下用例配置文件(BUILD.gn)样例: + +``` +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsDemoTest") { + hap_profile = "./src/main/config.json" + deps = [ + ":ace_demo_ets_assets", + ":ace_demo_ets_resources", + ":ace_demo_ets_test_assets", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" //签名文件 + hap_name = "ActsDemoTest" //测试套件,以Acts开头,以Test结尾,采用驼峰式命名 + part_name = "..." //部件 + subsystem_name = "..." //子系统 +} +ohos_js_assets("ace_demo_ets_assets") { + source_dir = "./src/main/ets/MainAbility" +} +ohos_js_assets("ace_demo_ets_test_assets") { + source_dir = "./src/main/ets/TestAbility" +} +ohos_resources("ace_demo_ets_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} +``` + +FA_JS 模式适配指导请参考 + +​ [一. 标准系统FA-JS-旧框架编译Hap包指导 - Wiki - Gitee.com](https://gitee.com/openharmony/xts_acts/wikis/%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA&Stage%E6%A8%A1%E5%BC%8F%E9%80%82%E9%85%8D%E6%96%B0%E6%A1%86%E6%9E%B6%E6%8C%87%E5%AF%BC%E6%96%87%E6%A1%A3/%E4%B8%80.%20%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA-JS-%E6%97%A7%E6%A1%86%E6%9E%B6%E7%BC%96%E8%AF%91Hap%E5%8C%85%E6%8C%87%E5%AF%BC) + +​ [三. 标准系统FA-JS模式XTS-旧框架-新框架适配 - Wiki - Gitee.com](https://gitee.com/openharmony/xts_acts/wikis/%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA&Stage%E6%A8%A1%E5%BC%8F%E9%80%82%E9%85%8D%E6%96%B0%E6%A1%86%E6%9E%B6%E6%8C%87%E5%AF%BC%E6%96%87%E6%A1%A3/%E4%B8%89.%20%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA-JS%E6%A8%A1%E5%BC%8FXTS-%E6%97%A7%E6%A1%86%E6%9E%B6-%E6%96%B0%E6%A1%86%E6%9E%B6%E9%80%82%E9%85%8D) + +FA_TS 模式适配指导请参考 + +​ [二. 标准系统FA-ETS-新框架编译Hap包指导 - Wiki - Gitee.com](https://gitee.com/openharmony/xts_acts/wikis/%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA&Stage%E6%A8%A1%E5%BC%8F%E9%80%82%E9%85%8D%E6%96%B0%E6%A1%86%E6%9E%B6%E6%8C%87%E5%AF%BC%E6%96%87%E6%A1%A3/%E4%BA%8C.%20%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA-ETS-%E6%96%B0%E6%A1%86%E6%9E%B6%E7%BC%96%E8%AF%91Hap%E5%8C%85%E6%8C%87%E5%AF%BC) + +​ [四. 标准系统FA-TS模式XTS-旧框架-新框架适配 - Wiki - Gitee.com](https://gitee.com/openharmony/xts_acts/wikis/%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA&Stage%E6%A8%A1%E5%BC%8F%E9%80%82%E9%85%8D%E6%96%B0%E6%A1%86%E6%9E%B6%E6%8C%87%E5%AF%BC%E6%96%87%E6%A1%A3/%E5%9B%9B.%20%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA-TS%E6%A8%A1%E5%BC%8FXTS-%E6%97%A7%E6%A1%86%E6%9E%B6-%E6%96%B0%E6%A1%86%E6%9E%B6%E9%80%82%E9%85%8D) + +**以Stage 模式为例:** + +1. 规范用例目录:测试用例存储到 src/main/js/test目录。 + + ``` + ├── BUILD.gn # 配置文件 + ├── Test.json # 资源依赖hap不需要Test.json文件 + ├── signature + │ └──openharmony_sx.p7b # 签名工具 + ├── AppScope + │ └──resource + │ └──app.json + ├── entry + │ └──src + │ │ └──main + │ │ │ └──ets + │ │ │ │ └──test # 测试代码存放目录 + │ │ │ │ │ └──List.test.ets + │ │ │ │ │ └──Ability.test.ets + │ │ │ │ └──MainAbility + │ │ │ │ │ └──MainAbility.ts + │ │ │ │ │ └──pages + │ │ │ │ │ │ └──index + │ │ │ │ │ │ │ └──index.ets + │ │ │ │ └──TestAbility + │ │ │ │ │ └──TestAbility.ts # 测试用例启动入口 ability + │ │ │ │ │ └──pages + │ │ │ │ │ │ └──index.ets + │ │ │ │ └──Application + │ │ │ │ │ └──AbilityStage.ts + │ │ │ │ └──TestRunner # 测试框架入口模板文件,添加后无需修改 + │ │ │ │ │ └──OpenHarmonyTestRunner.js + │ │ └── resources # hap资源存放目录 + │ │ └── module.json # hap配置文件 + ``` + +2. OpenHarmonyTestRunner.ts 示例 + + 【注】在TestRunner目录下的 OpenHarmonyTestRunner.ts 文件中的 async onRun() 方法下存在拉起测试套入口xxxAbility的cmd 命令: + + 例如: + + var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + + 需与module.json中 "abilities" 下的 "name" 字段保持一致,保证拉起的是我们需要的测试入口。 + + ``` + import TestRunner from '@ohos.application.testRunner' + import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + + ... + + export default class OpenHarmonyTestRunner implements TestRunner { + ... + async onRun() { + console.log('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 + ... + } + }; + ``` + +3. index.ets示例 + + ``` + import router from '@ohos.router'; + + @Entry + @Component + struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + } + + build() { + ... + } + } + ``` + +4. app.js示例 + + ``` + //加载测试用例 + import Ability from '@ohos.application.Ability' + import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + import { Hypium } from '@ohos/hypium' + import testsuite from '../test/List.test' + + export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + ... + }; + ``` + +Stage 模式测试模块下用例配置文件(BUILD.gn)样例: + +``` +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsDemoTest") { + hap_profile = "/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":edm_js_assets", + ":edm_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" //签名文件 + hap_name = "ActsDemoTest" //测试套件,以Acts开头,以Test结尾,采用驼峰式命名 + subsystem_name = "customization" //子系统 + part_name = "enterprise_device_management" //部件 +} + +ohos_app_scope("edm_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("edm_js_assets") { + source_dir = "/src/main/ets" +} + +ohos_resources("edm_resources") { + sources = [ "/src/main/resources" ] + deps = [ ":edm_app_profile" ] + hap_profile = "/src/main/module.json" +} +``` + +Stage 模式适配指导请参考 + +​ [五. 标准系统Stage模式-ETS-旧框架编译Hap包指导 - Wiki - Gitee.com](https://gitee.com/openharmony/xts_acts/wikis/%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA&Stage%E6%A8%A1%E5%BC%8F%E9%80%82%E9%85%8D%E6%96%B0%E6%A1%86%E6%9E%B6%E6%8C%87%E5%AF%BC%E6%96%87%E6%A1%A3/%E4%BA%94.%20%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FStage%E6%A8%A1%E5%BC%8F-ETS-%E6%97%A7%E6%A1%86%E6%9E%B6%E7%BC%96%E8%AF%91Hap%E5%8C%85%E6%8C%87%E5%AF%BC) + +​ [六. 标准系统Stage模式XTS-旧框架-新框架适配 - Wiki - Gitee.com](https://gitee.com/openharmony/xts_acts/wikis/%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FFA&Stage%E6%A8%A1%E5%BC%8F%E9%80%82%E9%85%8D%E6%96%B0%E6%A1%86%E6%9E%B6%E6%8C%87%E5%AF%BC%E6%96%87%E6%A1%A3/%E5%85%AD.%20%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9FStage%E6%A8%A1%E5%BC%8FXTS-%E6%97%A7%E6%A1%86%E6%9E%B6-%E6%96%B0%E6%A1%86%E6%9E%B6%E9%80%82%E9%85%8D) + ### JS语言用例编译打包指导(适用于标准系统) hap包编译请参考 [标准系统 JS用例源码编译Hap包指导](https://gitee.com/openharmony/xts_acts/wikis/%E6%A0%87%E5%87%86%E7%B3%BB%E7%BB%9F%20JS%E7%94%A8%E4%BE%8B%E6%BA%90%E7%A0%81%E7%BC%96%E8%AF%91Hap%E5%8C%85%E6%8C%87%E5%AF%BC%20?sort_id=4427112)。 @@ -650,12 +943,32 @@ hap包编译请参考 [标准系统 JS用例源码编译Hap包指导](https://gi ### 全量编译指导(适用于标准系统) 1. 全量编译 -test/xts/acts目录下执行编译命令: - ```./build.sh suite=acts system_size=standard ``` + test/xts/acts目录下执行编译命令: - 测试用例输出目录:out/release/suites/acts/testcases + ``` + ./build.sh product_name=rk3568 system_size=standard + ``` + +2. 单个子系统编译 + + test/xts/acts目录下执行编译命令: + + ``` + ./build.sh product_name=rk3568 system_size=standard target_subsystem=×××× + ``` + +3. 单模块编译 - 测试框架&用例整体输出目录:out/release/suites/acts(编译用例时会同步编译测试套执行框架) + test/xts/acts目录下执行编译命令: + + ```./build.sh suite=acts system_size=standard target_subsystem=×××× + ./build.sh product_name=rk3568 system_size=standard suite=xxx + suite 后面添加的是BUILD.gn 中ohos_js_hap_suite模板的命名 + ``` + + 测试用例输出目录:out/rk3568/suites/acts/testcases + + 测试框架&用例整体输出目录:out/rk3568/suites/acts(编译用例时会同步编译测试套执行框架) ### 全量用例执行指导(适用于小型系统、标准系统) @@ -673,14 +986,27 @@ Windows工作台下安装python3.7及以上版本,确保工作台和测试设 用例执行 1. 在Windows工作台上,找到从Linux服务器上拷贝下来的测试套件用例目录,在Windows命令窗口进入对应目录,直接执行acts\run.bat。 + 2. 界面启动后,输入用例执行指令。 全量执行:```run acts ``` 模块执行(具体模块可以查看\acts\testcases\):```run –l ActsSamgrTest ``` + 单包执行(具体模块可以查看\acts\testcases\):(适用于OH驱动) + + ``` + run -l uitestActs -ta class:UiTestCase#testChecked + + uitestActs: 测试hap + UiTestCase: testsuite + testChecked: testcase + ``` + + ​ + 3. 查看测试报告。 -进入acts\reports\,获取当前的执行记录,打开“summary_report.html”可以获取到测试报告。 + 进入acts\reports\,获取当前的执行记录,打开“summary_report.html”可以获取到测试报告。 ## 相关仓 diff --git a/ability/ability_runtime/BUILD.gn b/ability/ability_runtime/BUILD.gn index c94523228f9517d53caaba0031c3d36b439f4987..725ab1b1fddb72e6ded42245a56c99414abc3e9a 100644 --- a/ability/ability_runtime/BUILD.gn +++ b/ability/ability_runtime/BUILD.gn @@ -21,10 +21,15 @@ group("ability_runtime") { "abilitymanager:actsabilitymanagertest", "abilitymontior:ActsAbilityMonitorTest", "abilitymultiinstance:abilitymultiinstance", + "abilitystagemonitor:abilitystagemonitor", "actsabilitydelegatorcase:ActsAbilityDelegatorCaseTest", "actsabilitymanageretstest:ActsAbilityManagerEtsTest", "actsabilityusertest:ActsAbilityuserTest", + "actsappselector:actsappselector", + "actscalldataabilitytest:ActsCallDataAbilityTest", + "actscalldataabilitytest:ActsCallDataAbilityTest", "actscalltest:actscalltest", + "actsdataabilityaccessdatasharetest:dataabilityaccessdatashare", "actsfwkdataaccessortest:dataability", "actsqueryfunctiontest:actsqueryfunctiontest", "actsserviceabilityclienttest:serviceability", diff --git a/ability/ability_runtime/aacommand/AACommand07/entry/src/main/module.json b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/module.json index 915ec9f18e47b5a526d9ecd2b7e525560307603e..47ecd360c5bdb333137654e5f9ed4640725cf7f5 100644 --- a/ability/ability_runtime/aacommand/AACommand07/entry/src/main/module.json +++ b/ability/ability_runtime/aacommand/AACommand07/entry/src/main/module.json @@ -6,8 +6,7 @@ "description": "$string:entry_test_desc", "mainElement": "MainAbility", "deviceTypes": [ - "phone", - "tablet" + "default" ], "deliveryWithInstall": true, "installationFree": false, diff --git a/ability/ability_runtime/aacommand/AACommand08/entry/src/main/module.json b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/module.json index 915ec9f18e47b5a526d9ecd2b7e525560307603e..4c8ac00a4cb2589f3569729ccdd9809fe9c94baa 100644 --- a/ability/ability_runtime/aacommand/AACommand08/entry/src/main/module.json +++ b/ability/ability_runtime/aacommand/AACommand08/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_test_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/aacommand/AACommandPrintOneTest/AppScope/app.json b/ability/ability_runtime/aacommand/AACommandPrintOneTest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..c9eab3ccb3777a3e9c37126cafe03e962c9375a3 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintOneTest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.aacommandprintonetest", + "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 + } + } +} diff --git a/ability/ability_runtime/aacommand/AACommandPrintOneTest/AppScope/resources/base/element/string.json b/ability/ability_runtime/aacommand/AACommandPrintOneTest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..7a1e60df49d818c68d318759bfab1d84ea794c50 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintOneTest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AACommandPrintSyncTest" + } + ] +} diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/aacommand/AACommandPrintOneTest/AppScope/resources/base/media/app_icon.png old mode 100755 new mode 100644 similarity index 100% rename from multimedia/medialibrary/mediaLibrary_js_standard/AppScope/resources/base/media/app_icon.png rename to ability/ability_runtime/aacommand/AACommandPrintOneTest/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/aacommand/AACommandPrintOneTest/BUILD.gn b/ability/ability_runtime/aacommand/AACommandPrintOneTest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..8aff8efd0e5ccd0c4bbedc1f073ad2ba0854ecc0 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintOneTest/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAACommandPrintOneTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":aacommandprintonetest_js_assets", + ":aacommandprintonetest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAACommandPrintOneTest" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("aacommandprintonetest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("aacommandprintonetest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("aacommandprintonetest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":aacommandprintonetest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/aacommand/AACommandPrintOneTest/Test.json b/ability/ability_runtime/aacommand/AACommandPrintOneTest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..01bf0c4589a60f2e1e32f0abf0e7c92f14963b83 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintOneTest/Test.json @@ -0,0 +1,28 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.aacommandprintonetest", + "module-name": "entry_test", + "shell-timeout": "600000" + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + " hilog -Q pidoff", + "hilog -Q domainoff", + "hilog -b D" + ] + }, + { + "test-file-name": [ + "ActsAACommandPrintOneTest.hap", + "AACommandRelyHap.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..5073f074333769e258d7b97d27aa750302f91fbe --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +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. +*/ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..4e22e378bfe8b973538c9094adfd09727be7dcca --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,184 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +async function startAbilityTest(TAG, context) { + let wantInfo = { + bundleName: "com.example.aacommandprintonetest", + abilityName: "MainAbility" + } + await context.startAbility(wantInfo).then((data) => { + console.log(TAG + "startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log(TAG + "startAbility err : " + JSON.stringify(err)); + }) +} + +export default class MainAbility extends Ability { + async onCreate(want, launchParam) { + globalThis.abilityContext = this.context; + console.log('MainAbility onCreate') + let cmd: any + let abilityDelegatorArguments: any + let abilityDelegator: any + function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); + } + + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + + cmd = 'aa test -b com.example.aacommandrelyhap -m entry_test -s class ACTS_AACommand_01_3#ACTS_AACo' + + 'mmand_print_01_0100 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_print_01_0100 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0100 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0100 stdResult = ' + data.stdResult) + globalThis.stdResult3 = data.stdResult; + console.log('ACTS_AACommand_print_01_0100 - executeShellCommand: end') + + await startAbilityTest('ACTS_AACommand_print_01_0100', this.context); + }) + + await sleep(4000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComm' + + 'and_print_01_0200 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_print_01_0200 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0200 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0200 stdResult = ' + data.stdResult) + globalThis.stdResult4 = data.stdResult; + console.log('ACTS_AACommand_print_01_0200 - executeShellCommand: end') + + await startAbilityTest('ACTS_AACommand_print_01_0200', this.context); + }) + + await sleep(4000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_' + + 'AACommand_print_01_0300 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_print_01_0300 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0300 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0300 stdResult = ' + data.stdResult) + globalThis.stdResult5 = data.stdResult; + console.log('ACTS_AACommand_print_01_0300 - executeShellCommand: end') + + await startAbilityTest('ACTS_AACommand_print_01_0300', this.context); + }) + + await sleep(4000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComma' + + 'nd_print_01_0400 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_print_01_0400 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0400 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0400 stdResult = ' + data.stdResult) + globalThis.stdResult6 = data.stdResult; + console.log('ACTS_AACommand_print_01_0400 - executeShellCommand: end') + + await startAbilityTest('ACTS_AACommand_print_01_0400', this.context); + }) + + await sleep(4000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComm' + + 'and_print_01_0500 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_print_01_0500 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0500 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0500 stdResult = ' + data.stdResult) + globalThis.stdResult7 = data.stdResult; + console.log('ACTS_AACommand_print_01_0500 - executeShellCommand: end') + + await startAbilityTest('ACTS_AACommand_print_01_0500', this.context); + }) + + await sleep(4000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AA' + + 'Command_print_01_0600 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_print_01_0600 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0600 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0600 stdResult = ' + data.stdResult) + globalThis.stdResult8 = data.stdResult; + console.log('ACTS_AACommand_print_01_0600 - executeShellCommand: end') + + await startAbilityTest('ACTS_AACommand_print_01_0600', this.context); + }) + + await sleep(4000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_print_01_0700 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_print_01_0700 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0700 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0700 stdResult = ' + data.stdResult) + globalThis.stdResult9 = data.stdResult; + console.log('ACTS_AACommand_print_01_0700 - executeShellCommand: end') + + await startAbilityTest('ACTS_AACommand_print_01_0700', this.context); + }) + + await sleep(4000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_print_01_0800 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_print_01_0800 - executeShellCommand: start ') + console.log('ACTS_AACommand_print_01_0800 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_print_01_0800 stdResult = ' + data.stdResult) + globalThis.stdResult10 = data.stdResult; + console.log('ACTS_AACommand_print_01_0800 - executeShellCommand: end') + + await startAbilityTest('ACTS_AACommand_print_01_0800', this.context); + }) + + setTimeout(() => { + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + + }, 5000) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'pages/index', null) + + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..1762cda6dd8f03996989e42dfeb364161e91c0b7 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,75 @@ +/* +* 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() + globalThis.abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.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/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..83cc6acd855717c6f038570f27469d87775999ff --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/pages/index.ets @@ -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. +*/ + +@Entry +@Component +struct Index { + @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/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..22c198f9aa18824ab770aba482fb02ca43bfb3d0 --- /dev/null +++ b/ability/ability_runtime/aacommand/AACommandPrintOneTest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,198 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +let msg: any +let msgcopy: any + +export default function abilityTest() { + describe('ActsAACommandPrinOneTest', function () { + + afterEach(async (done) => { + console.log("ActsAACommandPrinOneTest afterEach called"); + let wantInfo = { + bundleName: "com.example.aacommandprintonetest", + abilityName: "MainAbility" + } + await globalThis.abilityContext.startAbility(wantInfo).then((data) => { + console.log("ActsAACommandPrinOneTest startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("ActsAACommandPrinOneTest startAbility err : " + JSON.stringify(err)); + }) + + setTimeout(function () { + console.log("ActsAACommandPrinOneTest afterEach end"); + done(); + }, 1000); + }) + + /** + * @tc.number: ACTS_AACommand_print_0100 + * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is + * called in AsyncCallback mode. The print information includes Chinese, special characters, etc. + * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through + * the test command. + */ + it('ACTS_AACommand_print_0100', 0, async function (done) { + console.log("ACTS_AACommand_print_0100 --- start") + msg = '测试日志!@#$%^&*()_+QWE{}|?> setTimeout(resolve, ms)); +} export default function abilityTest() { describe('ACTS_AACommand_01_3', function () { /** diff --git a/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/module.json b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/module.json index 96db0c371f6341dbf2ed7025e2dcedd77b341fac..b7072fbcaba880a1c1be074a82677b0d1b9360c8 100644 --- a/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/module.json +++ b/ability/ability_runtime/aacommand/AACommandPrintSync/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_test_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/MainAbility/MainAbility.ts index 10cd64e804e29c1fdbc116ec5a9adb511a7c9bf2..744320137558c962a8671023d0db94d5fce41791 100644 --- a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -14,11 +14,90 @@ */ import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +async function startAbilityTest(TAG, context) { + let wantInfo = { + bundleName: "com.example.aacommandprintsynctest", + abilityName: "MainAbility" + } + await context.startAbility(wantInfo).then((data) => { + console.log(TAG + "startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log(TAG + "startAbility err : " + JSON.stringify(err)); + }) +} export default class MainAbility extends Ability { - onCreate(want, launchParam) { + async onCreate(want, launchParam) { globalThis.abilityContext = this.context; console.log('MainAbility onCreate') + let cmd: any + let abilityDelegatorArguments: any + let abilityDelegator: any + function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); + } + + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + + cmd = 'aa test -b com.example.aacommandprintsync -m entry_test -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_01_0100 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_printSync_01_0100 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_printSync_01_0100 stdResult = ' + data.stdResult) + globalThis.stdResult1 = data.stdResult; + console.log('ACTS_AACommand_printSync_01_0100 - executeShellCommand: end ') + + await startAbilityTest('ACTS_AACommand_printSync_01_0100', this.context); + }) + + await sleep(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_01_0200 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_printSync_01_0200 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_printSync_01_0200 stdResult = ' + data.stdResult) + globalThis.stdResult2 = data.stdResult; + console.log('ACTS_AACommand_printSync_01_0200 - executeShellCommand: end ') + + await startAbilityTest('ACTS_AACommand_printSync_01_0200', this.context); + }) + + await sleep(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_01_0300 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_printSync_01_0300 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_printSync_01_0300 stdResult = ' + data.stdResult) + globalThis.stdResult3 = data.stdResult; + console.log('ACTS_AACommand_printSync_01_0300 - executeShellCommand: end ') + + await startAbilityTest('ACTS_AACommand_printSync_01_0300', this.context); + }) + + await sleep(3000) + + cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_01_0400 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_printSync_01_0400 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_printSync_01_0400 stdResult = ' + data.stdResult) + globalThis.stdResult4 = data.stdResult; + console.log('ACTS_AACommand_printSync_01_0400 - executeShellCommand: end ') + + await startAbilityTest('ACTS_AACommand_printSync_01_0400', this.context); + }) + + setTimeout(() => { + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + + }, 5000) } onDestroy() { diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/pages/index.ets index e49699bde347b8ad3fbcd279d57f4f0eeadbba52..be49947b3cbc9c905d42e4318c9b8e53203f63ac 100644 --- a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/pages/index.ets +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/pages/index.ets @@ -13,83 +13,9 @@ * limitations under the License. */ -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from '@ohos/hypium' -import testsuite from '../test/List.test' - @Entry @Component struct Index { - aboutToAppear() { - console.info('MainAbility index aboutToAppear') - console.info('start run testcase!!!') - let cmd: any - let abilityDelegatorArguments: any - let abilityDelegator: any - - function sleep(delay) { - let start = (new Date()).getTime(); - while ((new Date()).getTime() - start < delay) { - continue; - } - } - function test(time) { - sleep(time); - } - - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - - cmd = 'aa test -b com.example.aacommandprintsync -m entry_test -s class ' + - 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_01_0100 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_printSync_01_0100 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_printSync_01_0100 stdResult = ' + data.stdResult) - globalThis.stdResult1 = data.stdResult; - console.log('ACTS_AACommand_printSync_01_0100 - executeShellCommand: end ') - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' + - 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_01_0200 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_printSync_01_0200 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_printSync_01_0200 stdResult = ' + data.stdResult) - globalThis.stdResult2 = data.stdResult; - console.log('ACTS_AACommand_printSync_01_0200 - executeShellCommand: end ') - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' + - 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_01_0300 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_printSync_01_0300 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_printSync_01_0300 stdResult = ' + data.stdResult) - globalThis.stdResult3 = data.stdResult; - console.log('ACTS_AACommand_printSync_01_0300 - executeShellCommand: end ') - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandprintsync -s class ' + - 'ACTS_AACommand_01_3#ACTS_AACommand_printSync_01_0400 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_printSync_01_0400 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_printSync_01_0400 stdResult = ' + data.stdResult) - globalThis.stdResult4 = data.stdResult; - console.log('ACTS_AACommand_printSync_01_0400 - executeShellCommand: end ') - }) - - test(3000) - - setTimeout(() => { - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - - }, 15000) - - } @State message: string = 'Hello World' build() { Row() { diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/test/Ability.test.ets index 94d2b11c1bc35f7490503e08a69ac3e83c8787ed..e65d90aeb9b0a225f9493aac580769e14fd8db76 100644 --- a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/ets/test/Ability.test.ets @@ -18,6 +18,25 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from let msg: any export default function abilityTest() { describe('ActsAbilityTest', function () { + + afterEach(async (done) => { + console.log("ActsAACommandPrintSyncTest afterEach called"); + let wantInfo = { + bundleName: "com.example.aacommandprintsynctest", + abilityName: "MainAbility" + } + await globalThis.abilityContext.startAbility(wantInfo).then((data) => { + console.log("ActsAACommandPrintSyncTest startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("ActsAACommandPrintSyncTest startAbility err : " + JSON.stringify(err)); + }) + + setTimeout(function () { + console.log("ActsAACommandPrintSyncTest afterEach end"); + done(); + }, 1000); + }) + /** * @tc.number: ACTS_AACommand_printSync_0100 * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid diff --git a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/module.json b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/module.json index 96db0c371f6341dbf2ed7025e2dcedd77b341fac..19cd72eca96fa364da0aae5c8892e0e7eb0848d0 100644 --- a/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/module.json +++ b/ability/ability_runtime/aacommand/AACommandPrintSyncTest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_test_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], @@ -21,6 +22,7 @@ "icon": "$media:icon", "label": "$string:MainAbility_label", "visible": true, + "launchType": "singleton", "skills": [ { "entities": [ diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/test/Ability.test.ets index 584d97bdba4d6a8e11e02f6a39c82851444b414e..46b9bfff16ad7538d7f2775ddfaad5c44857896d 100644 --- a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/ets/test/Ability.test.ets @@ -15,6 +15,10 @@ */ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} export default function abilityTest() { describe('ACTS_AACommand_01_3', function () { /** @@ -32,6 +36,7 @@ export default function abilityTest() { console.log("ACTS_AACommand_print_01_0100 print test end ========> callback err: "+JSON.stringify(err) ) console.log("ACTS_AACommand_print_01_0100 print test end ========> callback data: "+JSON.stringify(data)) }) + await sleep(1000); var finishmsg = 'ACTS_AACommand_print_01_0100 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then((data)=>{ console.log("ACTS_AACommand_print_01_0100 finishTest test end ========> callback " ) @@ -62,6 +67,7 @@ export default function abilityTest() { globalThis.abilityDelegator.print(msg,()=>{ console.log("print test end ========> callback " ) }) + await sleep(1000); var finishmsg = 'ACTS_AACommand_print_01_0200 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ console.log("ACTS_AACommand_print_01_0200 print test end ========> callback " ) @@ -91,6 +97,7 @@ export default function abilityTest() { globalThis.abilityDelegator.print(msg,()=>{ console.log("print test end ========> callback " ) }) + await sleep(1000); var finishmsg = 'ACTS_AACommand_print_01_0300 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ console.log("ACTS_AACommand_print_01_0300 print test end ========> callback " ) @@ -109,6 +116,7 @@ export default function abilityTest() { globalThis.abilityDelegator.print(null,()=>{ console.log("print test end ========> callback " ) }) + await sleep(1000); var finishmsg = 'ACTS_AACommand_print_01_0400 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ console.log("ACTS_AACommand_print_01_0400 print test end ========> callback " ) @@ -128,6 +136,7 @@ export default function abilityTest() { globalThis.abilityDelegator.print(msg).then(()=>{ console.log("ACTS_AACommand_print_01_0500 print test end ========> callback " ) }) + await sleep(1000); var finishmsg = 'ACTS_AACommand_print_01_0500 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ console.log("ACTS_AACommand_print_01_0500 print test end ========> callback " ) @@ -156,6 +165,7 @@ export default function abilityTest() { globalThis.abilityDelegator.print(msg).then(()=>{ console.log("ACTS_AACommand_print_01_0600 print test end ========> callback " ) }) + await sleep(1000); var finishmsg = 'ACTS_AACommand_print_01_0600 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ console.log("ACTS_AACommand_print_01_0600 2 print test end ========> callback " ) @@ -185,6 +195,7 @@ export default function abilityTest() { globalThis.abilityDelegator.print(msg).then(()=>{ console.log("ACTS_AACommand_print_01_0700 print test end ========> callback " ) }) + await sleep(1000); var finishmsg = 'ACTS_AACommand_print_01_0700 end' globalThis.abilityDelegator.finishTest(finishmsg, 1).then(()=>{ console.log("ACTS_AACommand_print_01_0700 2 print test end ========> callback " ) @@ -220,6 +231,7 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_0100', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ console.log("ACTS_AACommand_finish_01_0100 finishTest test end ========> callback " ) done() @@ -275,6 +287,7 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_0400', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ console.log("ACTS_AACommand_finish_01_0400 finishTest test end ========> callback " ) done() @@ -290,6 +303,7 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_0500', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ console.log("ACTS_AACommand_finish_01_0500 finishTest test end ========> callback " ) done() @@ -306,6 +320,7 @@ export default function abilityTest() { it('ACTS_AACommand_finish_01_0600', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ console.log("ACTS_AACommand_finish_01_0600 finishTest test end ========> callback " ) done() @@ -321,6 +336,7 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_0700', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ console.log("ACTS_AACommand_finish_01_0700 finishTest test end ========> callback " ) done() @@ -336,17 +352,12 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_0800', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?> { - console.log('ACTS_AACommand_finish_01_0800 code:'+JSON.stringify(code)) - if(code!=undefined){ - expect().assertFail(); - } - done(); - }, 3000) - var code = globalThis.abilityDelegator.finishTest(msg, 'ABCD',()=>{ + globalThis.abilityDelegator.finishTest(msg, 'ABCD',()=>{ console.log(" ACTS_AACommand_finish_01_0800 finishTest test end ========> callback " ) expect().assertFail(); }) + await sleep(2000); + done(); }) /** @@ -358,6 +369,7 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_0900', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?> { console.log("ACTS_AACommand_finish_01_0900 finishTest test end ========> callback " ) done() @@ -371,15 +383,9 @@ export default function abilityTest() { * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. */ it('ACTS_AACommand_finish_01_1000', 0, async function (done) { - var code = null - setTimeout(() => { - console.log('ACTS_AACommand_finish_01_1000 code:'+JSON.stringify(code)) - if(code!=undefined){ - expect().assertFail(); - } - done(); - }, 3000) - code = globalThis.abilityDelegator.finishTest(null, 1) + globalThis.abilityDelegator.finishTest(null, 1) + await sleep(2000); + done() }) /** @@ -389,15 +395,9 @@ export default function abilityTest() { * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. */ it('ACTS_AACommand_finish_01_1100', 0, async function (done) { - var code=null - setTimeout(() => { - console.log('ACTS_AACommand_finish_01_1100 code:'+JSON.stringify(code)) - if(code!=undefined){ - expect().assertFail(); - } - done(); - }, 3000) - code = globalThis.abilityDelegator.finishTest(undefined, 1) + globalThis.abilityDelegator.finishTest(undefined, 1) + await sleep(2000); + done() }) /** @@ -409,6 +409,7 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_1200', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ console.log("ACTS_AACommand_finish_01_1200 finishTest test end ========> callback " ) done() @@ -424,6 +425,7 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_1300', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ console.log("ACTS_AACommand_finish_01_1300 finishTest test end ========> callback " ) done() @@ -439,6 +441,7 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_1400', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ console.log("ACTS_AACommand_finish_01_1400 finishTest test end ========> callback " ) done() @@ -454,6 +457,7 @@ export default function abilityTest() { */ it('ACTS_AACommand_finish_01_1500', 0, async function (done) { var msg = '测试日志!@#$%^&*()_+QWE{}|?>{ console.log("ACTS_AACommand_finish_01_1500 finishTest test end ========> callback " ) done() diff --git a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/module.json b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/module.json index 96db0c371f6341dbf2ed7025e2dcedd77b341fac..b7072fbcaba880a1c1be074a82677b0d1b9360c8 100644 --- a/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/module.json +++ b/ability/ability_runtime/aacommand/AACommandRelyHap/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_test_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/module.json b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/module.json index 96db0c371f6341dbf2ed7025e2dcedd77b341fac..b7072fbcaba880a1c1be074a82677b0d1b9360c8 100644 --- a/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/module.json +++ b/ability/ability_runtime/aacommand/AACommandpackage/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_test_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/MainAbility.ts index 1e26ef72ee86e631df14c0d6b46b7e5b49e63c84..7d4790bc0f072477943ae5911ab2ad22bf46f6b5 100644 --- a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -14,10 +14,299 @@ */ import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +async function startAbilityTest(TAG, context) { + let wantInfo = { + bundleName: "com.example.aacommandtest", + abilityName: "MainAbility" + } + await context.startAbility(wantInfo).then((data) => { + console.log(TAG + "startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log(TAG + "startAbility err : " + JSON.stringify(err)); + }) +} export default class MainAbility extends Ability { - onCreate(want, launchParam) { + async onCreate(want, launchParam) { + globalThis.abilityContext = this.context; console.log('MainAbility onCreate') + let cmd: any + let abilityDelegatorArguments: any + let abilityDelegator: any + + function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); + } + + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0700 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_finish_01_0700 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_0700 stdResult = ' + data.stdResult) + globalThis.stdResult1 = data.stdResult; + console.log('ACTS_AACommand_finish_01_0700 - executeShellCommand: end ') + + await startAbilityTest('ACTS_AACommand_finish_01_0700', this.context); + }) + + await sleep(4000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('ACTS_AACommand_finish_01_0700 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_0700 : data : ' + JSON.stringify(data)); + globalThis.stdResult2 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_0700 end'); + }) + + await sleep(2000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0400 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_finish_01_0400 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_0400 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_0400 stdResult = ' + data.stdResult) + globalThis.stdResult11 = data.stdResult; + console.log('ACTS_AACommand_finish_01_0400 - executeShellCommand: end') + + await startAbilityTest('ACTS_AACommand_finish_01_0400', this.context); + }) + + await sleep(4000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('ACTS_AACommand_finish_01_0700 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_0700 : data : ' + JSON.stringify(data)); + globalThis.stdResult12 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_0700 end'); + }) + + await sleep(2000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0100 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_finish_01_0100 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_0100 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_0100 stdResult = ' + data.stdResult) + globalThis.stdResult13 = data.stdResult; + console.log('ACTS_AACommand_finish_01_0100 - executeShellCommand: end') + + await startAbilityTest('ACTS_AACommand_finish_01_0100', this.context); + }) + + await sleep(4000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('ACTS_AACommand_finish_01_0700 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_0700 : data : ' + JSON.stringify(data)); + globalThis.stdResult14 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_0700 end'); + }) + + await sleep(2000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' + + 'ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0500 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_finish_01_0500 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_0500 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_0500 stdResult = ' + data.stdResult) + globalThis.stdResult15 = data.stdResult; + console.log('ACTS_AACommand_finish_01_0500 - executeShellCommand: end') + + await startAbilityTest('ACTS_AACommand_finish_01_0500', this.context); + }) + + await sleep(4000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('ACTS_AACommand_finish_01_0500 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_0500 : data : ' + JSON.stringify(data)); + globalThis.stdResult16 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_0500 end'); + }) + + await sleep(2000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0600 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_finish_01_0600 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_0600 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_0600 stdResult = ' + data.stdResult) + globalThis.stdResult17 = data.stdResult; + console.log('ACTS_AACommand_finish_01_0600 - executeShellCommand: end') + + await startAbilityTest('ACTS_AACommand_finish_01_0600', this.context); + }) + + await sleep(4000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('ACTS_AACommand_finish_01_0600 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_0600 : data : ' + JSON.stringify(data)); + globalThis.stdResult18 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_0600 end'); + }) + + await sleep(2000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + + 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0900 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_finish_01_0900 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_0900 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_0900 stdResult = ' + data.stdResult) + globalThis.stdResult19 = data.stdResult; + console.log('ACTS_AACommand_finish_01_0900 - executeShellCommand: end') + + await startAbilityTest('ACTS_AACommand_finish_01_0900', this.context); + }) + + await sleep(4000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('ACTS_AACommand_finish_01_0900 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_0900 : data : ' + JSON.stringify(data)); + globalThis.stdResult20 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_0900 end'); + }) + + await sleep(2000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + + '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1300 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_finish_01_1300 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_1300 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_1300 stdResult = ' + data.stdResult) + globalThis.stdResult23 = data.stdResult; + console.log('ACTS_AACommand_finish_01_1300 - executeShellCommand: end') + + await startAbilityTest('ACTS_AACommand_finish_01_1300', this.context); + }) + + await sleep(4000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('ACTS_AACommand_finish_01_1300 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_1300 : data : ' + JSON.stringify(data)); + globalThis.stdResult24 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_1300 end'); + }) + + await sleep(2000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + + '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1400 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_finish_01_1400 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_1400 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_1400 stdResult = ' + data.stdResult) + globalThis.stdResult25 = data.stdResult; + console.log('ACTS_AACommand_finish_01_1400 - executeShellCommand: end') + + await startAbilityTest('ACTS_AACommand_finish_01_1400', this.context); + }) + + await sleep(4000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('ACTS_AACommand_finish_01_1400 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_1400 : data : ' + JSON.stringify(data)); + globalThis.stdResult26 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_1400 end'); + }) + + await sleep(2000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + + '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1500 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_finish_01_1500 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_1500 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_1500 stdResult = ' + data.stdResult) + globalThis.stdResult27 = data.stdResult; + console.log('ACTS_AACommand_finish_01_1500 - executeShellCommand: end') + + await startAbilityTest('ACTS_AACommand_finish_01_1500', this.context); + }) + + await sleep(4000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('ACTS_AACommand_finish_01_1500 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_1500 : data : ' + JSON.stringify(data)); + globalThis.stdResult28 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_1500 end'); + }) + + await sleep(2000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + + '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0300 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_finish_01_0300 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_0300 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_0300 stdResult = ' + data.stdResult) + console.log('ACTS_AACommand_finish_01_0300 - executeShellCommand: end') + + await startAbilityTest('ACTS_AACommand_finish_01_0300', this.context); + }) + + await sleep(3000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('ACTS_AACommand_finish_01_0300 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_0300 : data : ' + JSON.stringify(data)); + globalThis.stdResult30 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_0300 end'); + }) + + await sleep(2000) + + cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap' + + ' -s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1600 -s unittest OpenHarmonyTestRunner' + abilityDelegator.executeShellCommand(cmd, async (err, data) => { + console.log('ACTS_AACommand_finish_01_1600 - executeShellCommand: start ') + console.log('ACTS_AACommand_finish_01_1600 start err: ' + JSON.stringify(err)) + console.log('ACTS_AACommand_finish_01_1600 stdResult = ' + data.stdResult) + console.log('ACTS_AACommand_finish_01_1600 - executeShellCommand: end') + + await startAbilityTest('ACTS_AACommand_finish_01_1600', this.context); + }) + + await sleep(3000) + + cmd = 'aa dump -a' + abilityDelegator.executeShellCommand(cmd, (err, data) => { + console.info('ACTS_AACommand_finish_01_1600 : err : ' + JSON.stringify(err)); + console.info('ACTS_AACommand_finish_01_1600 : data : ' + JSON.stringify(data)); + globalThis.stdResult34 = data["stdResult"]; + console.info('ACTS_AACommand_finish_01_1600 end'); + }) + + setTimeout(() => { + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, 5000) } onDestroy() { @@ -27,8 +316,6 @@ export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { console.log('MainAbility onWindowStageCreate') windowStage.setUIContent(this.context, 'pages/index', null) - - globalThis.abilityContext = this.context; } onWindowStageDestroy() { diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/pages/index.ets index c8afef08de7b17c8d0c0c0eb46cdfb0fa0dc6e1e..be49947b3cbc9c905d42e4318c9b8e53203f63ac 100644 --- a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/pages/index.ets +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/pages/index.ets @@ -13,493 +13,9 @@ * limitations under the License. */ -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from '@ohos/hypium' -import testsuite from '../test/List.test' - @Entry @Component struct Index { - aboutToAppear() { - console.info('MainAbility index aboutToAppear') - console.info('start run testcase!!!') - let cmd: any - let abilityDelegatorArguments: any - let abilityDelegator: any - - function sleep(delay) { - let start = (new Date()).getTime(); - while ((new Date()).getTime() - start < delay) { - continue; - } - } - function test(time) { - sleep(time); - } - - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + - 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0700 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_finish_01_0700 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_finish_01_0700 stdResult = ' + data.stdResult) - globalThis.stdResult1 = data.stdResult; - console.log('ACTS_AACommand_finish_01_0700 - executeShellCommand: end ') - }) - - test(3000) - cmd = 'aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err, data) => { - console.info('ACTS_AACommand_finish_01_0700 : err : ' + JSON.stringify(err)); - console.info('ACTS_AACommand_finish_01_0700 : data : ' + JSON.stringify(data)); - globalThis.stdResult2 = data["stdResult"]; - console.info('ACTS_AACommand_finish_01_0700 end'); - }) - - test(3000) - - cmd = 'aa test -b com.example.aacommandrelyhap -m entry_test -s class ACTS_AACommand_01_3#ACTS_AACo' + - 'mmand_print_01_0100 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_01_0100 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_01_0100 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_print_01_0100 stdResult = ' + data.stdResult) - globalThis.stdResult3 = data.stdResult; - console.log('ACTS_AACommand_print_01_0100 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComm' + - 'and_print_01_0200 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_01_0200 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_01_0200 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_print_01_0200 stdResult = ' + data.stdResult) - globalThis.stdResult4 = data.stdResult; - console.log('ACTS_AACommand_print_01_0200 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_' + - 'AACommand_print_01_0300 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_01_0300 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_01_0300 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_print_01_0300 stdResult = ' + data.stdResult) - globalThis.stdResult5 = data.stdResult; - console.log('ACTS_AACommand_print_01_0300 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComma' + - 'nd_print_01_0400 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_01_0400 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_01_0400 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_print_01_0400 stdResult = ' + data.stdResult) - globalThis.stdResult6 = data.stdResult; - console.log('ACTS_AACommand_print_01_0400 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AAComm' + - 'and_print_01_0500 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_01_0500 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_01_0500 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_print_01_0500 stdResult = ' + data.stdResult) - globalThis.stdResult7 = data.stdResult; - console.log('ACTS_AACommand_print_01_0500 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ACTS_AACommand_01_3#ACTS_AA' + - 'Command_print_01_0600 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_01_0600 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_01_0600 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_print_01_0600 stdResult = ' + data.stdResult) - globalThis.stdResult8 = data.stdResult; - console.log('ACTS_AACommand_print_01_0600 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' + - 'ACTS_AACommand_01_3#ACTS_AACommand_print_01_0700 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_01_0700 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_01_0700 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_print_01_0700 stdResult = ' + data.stdResult) - globalThis.stdResult9 = data.stdResult; - console.log('ACTS_AACommand_print_01_0700 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + - 'class ACTS_AACommand_01_3#ACTS_AACommand_print_01_0800 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_print_01_0800 - executeShellCommand: start ') - console.log('ACTS_AACommand_print_01_0800 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_print_01_0800 stdResult = ' + data.stdResult) - globalThis.stdResult10 = data.stdResult; - console.log('ACTS_AACommand_print_01_0800 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' + - 'ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0400 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_finish_01_0400 - executeShellCommand: start ') - console.log('ACTS_AACommand_finish_01_0400 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_finish_01_0400 stdResult = ' + data.stdResult) - globalThis.stdResult11 = data.stdResult; - console.log('ACTS_AACommand_finish_01_0400 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err, data) => { - console.info('ACTS_AACommand_finish_01_0700 : err : ' + JSON.stringify(err)); - console.info('ACTS_AACommand_finish_01_0700 : data : ' + JSON.stringify(data)); - globalThis.stdResult12 = data["stdResult"]; - console.info('ACTS_AACommand_finish_01_0700 end'); - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + - 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0100 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_finish_01_0100 - executeShellCommand: start ') - console.log('ACTS_AACommand_finish_01_0100 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_finish_01_0100 stdResult = ' + data.stdResult) - globalThis.stdResult13 = data.stdResult; - console.log('ACTS_AACommand_finish_01_0100 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err, data) => { - console.info('ACTS_AACommand_finish_01_0700 : err : ' + JSON.stringify(err)); - console.info('ACTS_AACommand_finish_01_0700 : data : ' + JSON.stringify(data)); - globalThis.stdResult14 = data["stdResult"]; - console.info('ACTS_AACommand_finish_01_0700 end'); - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s class ' + - 'ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0500 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_finish_01_0500 - executeShellCommand: start ') - console.log('ACTS_AACommand_finish_01_0500 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_finish_01_0500 stdResult = ' + data.stdResult) - globalThis.stdResult15 = data.stdResult; - console.log('ACTS_AACommand_finish_01_0500 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err, data) => { - console.info('ACTS_AACommand_finish_01_0500 : err : ' + JSON.stringify(err)); - console.info('ACTS_AACommand_finish_01_0500 : data : ' + JSON.stringify(data)); - globalThis.stdResult16 = data["stdResult"]; - console.info('ACTS_AACommand_finish_01_0500 end'); - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + - 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0600 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_finish_01_0600 - executeShellCommand: start ') - console.log('ACTS_AACommand_finish_01_0600 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_finish_01_0600 stdResult = ' + data.stdResult) - globalThis.stdResult17 = data.stdResult; - console.log('ACTS_AACommand_finish_01_0600 - executeShellCommand: end') - }) - - test(3000) - cmd = 'aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err, data) => { - console.info('ACTS_AACommand_finish_01_0600 : err : ' + JSON.stringify(err)); - console.info('ACTS_AACommand_finish_01_0600 : data : ' + JSON.stringify(data)); - globalThis.stdResult18 = data["stdResult"]; - console.info('ACTS_AACommand_finish_01_0600 end'); - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + - 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0900 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_finish_01_0900 - executeShellCommand: start ') - console.log('ACTS_AACommand_finish_01_0900 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_finish_01_0900 stdResult = ' + data.stdResult) - globalThis.stdResult19 = data.stdResult; - console.log('ACTS_AACommand_finish_01_0900 - executeShellCommand: end') - }) - - - test(3000) - cmd = 'aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err, data) => { - console.info('ACTS_AACommand_finish_01_0900 : err : ' + JSON.stringify(err)); - console.info('ACTS_AACommand_finish_01_0900 : data : ' + JSON.stringify(data)); - globalThis.stdResult20 = data["stdResult"]; - console.info('ACTS_AACommand_finish_01_0900 end'); - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap' + - ' -s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1200 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_finish_01_1200 - executeShellCommand: start ') - console.log('ACTS_AACommand_finish_01_1200 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_finish_01_1200 stdResult = ' + data.stdResult) - globalThis.stdResult21 = data.stdResult; - console.log('ACTS_AACommand_finish_01_1200 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err, data) => { - console.info('ACTS_AACommand_finish_01_1200 : err : ' + JSON.stringify(err)); - console.info('ACTS_AACommand_finish_01_1200 : data : ' + JSON.stringify(data)); - globalThis.stdResult22 = data["stdResult"]; - console.info('ACTS_AACommand_finish_01_1200 end'); - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + - '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1300 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_finish_01_1300 - executeShellCommand: start ') - console.log('ACTS_AACommand_finish_01_1300 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_finish_01_1300 stdResult = ' + data.stdResult) - globalThis.stdResult23 = data.stdResult; - console.log('ACTS_AACommand_finish_01_1300 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err, data) => { - console.info('ACTS_AACommand_finish_01_1300 : err : ' + JSON.stringify(err)); - console.info('ACTS_AACommand_finish_01_1300 : data : ' + JSON.stringify(data)); - globalThis.stdResult24 = data["stdResult"]; - console.info('ACTS_AACommand_finish_01_1300 end'); - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + - '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1400 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_finish_01_1400 - executeShellCommand: start ') - console.log('ACTS_AACommand_finish_01_1400 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_finish_01_1400 stdResult = ' + data.stdResult) - globalThis.stdResult25 = data.stdResult; - console.log('ACTS_AACommand_finish_01_1400 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err, data) => { - console.info('ACTS_AACommand_finish_01_1400 : err : ' + JSON.stringify(err)); - console.info('ACTS_AACommand_finish_01_1400 : data : ' + JSON.stringify(data)); - globalThis.stdResult26 = data["stdResult"]; - console.info('ACTS_AACommand_finish_01_1400 end'); - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + - '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1500 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_finish_01_1500 - executeShellCommand: start ') - console.log('ACTS_AACommand_finish_01_1500 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_finish_01_1500 stdResult = ' + data.stdResult) - globalThis.stdResult27 = data.stdResult; - console.log('ACTS_AACommand_finish_01_1500 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err, data) => { - console.info('ACTS_AACommand_finish_01_1500 : err : ' + JSON.stringify(err)); - console.info('ACTS_AACommand_finish_01_1500 : data : ' + JSON.stringify(data)); - globalThis.stdResult28 = data["stdResult"]; - console.info('ACTS_AACommand_finish_01_1500 end'); - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + - '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0200 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_finish_01_0200 - executeShellCommand: start ') - console.log('ACTS_AACommand_finish_01_0200 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_finish_01_0200 stdResult = ' + data.stdResult) - console.log('ACTS_AACommand_finish_01_0200 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err, data) => { - console.info('ACTS_AACommand_finish_01_0200 : err : ' + JSON.stringify(err)); - console.info('ACTS_AACommand_finish_01_0200 : data : ' + JSON.stringify(data)); - globalThis.stdResult29 = data["stdResult"]; - console.info('ACTS_AACommand_finish_01_0200 end'); - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + - '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0300 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_finish_01_0300 - executeShellCommand: start ') - console.log('ACTS_AACommand_finish_01_0300 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_finish_01_0300 stdResult = ' + data.stdResult) - console.log('ACTS_AACommand_finish_01_0300 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err, data) => { - console.info('ACTS_AACommand_finish_01_0300 : err : ' + JSON.stringify(err)); - console.info('ACTS_AACommand_finish_01_0300 : data : ' + JSON.stringify(data)); - globalThis.stdResult30 = data["stdResult"]; - console.info('ACTS_AACommand_finish_01_0300 end'); - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + - 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_0800 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_finish_01_0800 - executeShellCommand: start ') - console.log('ACTS_AACommand_finish_01_0800 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_finish_01_0800 stdResult = ' + data.stdResult) - console.log('ACTS_AACommand_finish_01_0800 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err, data) => { - console.info('ACTS_AACommand_finish_01_0800 : err : ' + JSON.stringify(err)); - console.info('ACTS_AACommand_finish_01_0800 : data : ' + JSON.stringify(data)); - globalThis.stdResult31 = data["stdResult"]; - console.info('ACTS_AACommand_finish_01_0800 end'); - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap -s ' + - 'class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1000 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_finish_01_1000 - executeShellCommand: start ') - console.log('ACTS_AACommand_finish_01_1000 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_finish_01_1000 stdResult = ' + data.stdResult) - console.log('ACTS_AACommand_finish_01_1000 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err, data) => { - console.info('ACTS_AACommand_finish_01_1000 : err : ' + JSON.stringify(err)); - console.info('ACTS_AACommand_finish_01_1000 : data : ' + JSON.stringify(data)); - globalThis.stdResult32 = data["stdResult"]; - console.info('ACTS_AACommand_finish_01_1000 end'); - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap ' + - '-s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1100 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_finish_01_1100 - executeShellCommand: start ') - console.log('ACTS_AACommand_finish_01_1100 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_finish_01_1100 stdResult = ' + data.stdResult) - console.log('ACTS_AACommand_finish_01_1100 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err, data) => { - console.info('ACTS_AACommand_finish_01_1100 : err : ' + JSON.stringify(err)); - console.info('ACTS_AACommand_finish_01_1100 : data : ' + JSON.stringify(data)); - globalThis.stdResult33 = data["stdResult"]; - console.info('ACTS_AACommand_finish_01_1100 end'); - }) - - test(3000) - - cmd = 'aa test -m entry_test -b com.example.aacommandrelyhap' + - ' -s class ACTS_AACommand_01_3#ACTS_AACommand_finish_01_1600 -s unittest OpenHarmonyTestRunner' - globalThis.abilityDelegator.executeShellCommand(cmd, (err, data) => { - console.log('ACTS_AACommand_finish_01_1600 - executeShellCommand: start ') - console.log('ACTS_AACommand_finish_01_1600 start err: ' + JSON.stringify(err)) - console.log('ACTS_AACommand_finish_01_1600 stdResult = ' + data.stdResult) - console.log('ACTS_AACommand_finish_01_1600 - executeShellCommand: end') - }) - - test(3000) - - cmd = 'aa dump -a' - abilityDelegator.executeShellCommand(cmd, - (err, data) => { - console.info('ACTS_AACommand_finish_01_1600 : err : ' + JSON.stringify(err)); - console.info('ACTS_AACommand_finish_01_1600 : data : ' + JSON.stringify(data)); - globalThis.stdResult34 = data["stdResult"]; - console.info('ACTS_AACommand_finish_01_1600 end'); - }) - - test(3000) - - setTimeout(() => { - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - }, 12000) - - } @State message: string = 'Hello World' build() { Row() { diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/test/Ability.test.ets index 126f4f69765a423d326c7727f42e3c0505653482..31c9938468c142925deb6dad9d312a1e43a9a107 100644 --- a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/ets/test/Ability.test.ets @@ -22,6 +22,24 @@ let finishmsg1: any export default function abilityTest() { describe('ACTS_AACommand_Test', function () { + afterEach(async (done) => { + console.log("ActsAACommandTest afterEach called"); + let wantInfo = { + bundleName: "com.example.aacommandtest", + abilityName: "MainAbility" + } + await globalThis.abilityContext.startAbility(wantInfo).then((data) => { + console.log("ActsAACommandTest startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("ActsAACommandTest startAbility err : " + JSON.stringify(err)); + }) + + setTimeout(function () { + console.log("ActsAACommandTest afterEach end"); + done(); + }, 1000); + }) + /** * @tc.number: ACTS_AACommand_0100 * @tc.name: -b, -s unittest, -p, -s class, -s level, -s size, -s testType, -s timeout, @@ -202,165 +220,6 @@ export default function abilityTest() { }) }) - /** - * @tc.number: ACTS_AACommand_print_0100 - * @tc.name: The -b, -p, -s, -w and other parameters of the test command are valid, and the print interface is - * called in AsyncCallback mode. The print information includes Chinese, special characters, etc. - * @tc.desc: Verify that the test framework can be started normally and the logs can be output normally through - * the test command. - */ - it('ACTS_AACommand_print_0100', 0, async function (done) { - console.log("ACTS_AACommand_print_0100 --- start") - msg = '测试日志!@#$%^&*()_+QWE{}|?>= 0).assertTrue() - done() - }) - /** * @tc.number: ACTS_AACommand_finishTest_0300 * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in @@ -551,43 +374,6 @@ export default function abilityTest() { done() }) - /** - * @tc.number: ACTS_AACommand_finishTest_0800 - * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in - * AsyncCallback - * mode. The msg parameter is invalid(including Chinese and special characters) and the - * code parameter is valid (“ABCD”) - * @tc.desc: Verify that the process of the test framework is not stopped by calling this interface. - */ - it('ACTS_AACommand_finishTest_0800', 0, async function (done) { - console.log("ACTS_AACommand_finishTest_0800 --- start") - expect(globalThis.stdResult31.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() - done() - }) - - /** - * @tc.number: ACTS_AACommand_finishTest_1000 - * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise - * mode. The msg parameter is invalid(null) and the code parameter is valid (1) - * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. - */ - it('ACTS_AACommand_finishTest_1000', 0, async function (done) { - console.log("ACTS_AACommand_finishTest_1000 --- start") - expect(globalThis.stdResult32.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() - done() - }) - - /** - * @tc.number: ACTS_AACommand_finishTest_1100 - * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in Promise - * mode. The msg parameter is invalid(undefined) and the code parameter is valid (1) - * @tc.desc: Verify that the process of the test framework can be stopped by calling this interface. - */ - it('ACTS_AACommand_finishTest_1100', 0, async function (done) { - console.log("ACTS_AACommand_finishTest_1100 --- start") - expect(globalThis.stdResult33.indexOf("com.example.aacommandrelyhap") >= 0).assertTrue() - done() - }) /** * @tc.number: ACTS_AACommand_finishTest_1600 * @tc.name: The parameters of the test command are valid, and the finishTest interface is called in diff --git a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/module.json b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/module.json index 96db0c371f6341dbf2ed7025e2dcedd77b341fac..19cd72eca96fa364da0aae5c8892e0e7eb0848d0 100644 --- a/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/module.json +++ b/ability/ability_runtime/aacommand/AACommandtest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_test_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], @@ -21,6 +22,7 @@ "icon": "$media:icon", "label": "$string:MainAbility_label", "visible": true, + "launchType": "singleton", "skills": [ { "entities": [ diff --git a/ability/ability_runtime/aacommand/BUILD.gn b/ability/ability_runtime/aacommand/BUILD.gn index 644135d438f8c8576e8d3f2fb9fd9a3256bb1283..64fec3878c9d1d9ce98532fb68b91dffbb1cfcc1 100644 --- a/ability/ability_runtime/aacommand/BUILD.gn +++ b/ability/ability_runtime/aacommand/BUILD.gn @@ -19,6 +19,7 @@ group("aacommand") { deps = [ "AACommand07:AACommand07", "AACommand08:AACommand08", + "AACommandPrintOneTest:ActsAACommandPrintOneTest", "AACommandPrintSync:AACommandPrintSync", "AACommandPrintSyncTest:ActsAACommandPrintSyncTest", "AACommandRelyHap:AACommandRelyHap", diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/config.json index 92e6a35a32b5b6d328ef13185401ab8e305defcc..e68dd4067e1d3d1a2d249e7ff4e48e716027a94e 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfifthscene/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/config.json index 08626438965d52dad65503a4dad984dc99774724..98b5a3ac6a31d61a11bc69961f4a3eab3c7816e8 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfirstscene/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/config.json index 4d0fbdc896090ed05980b57b4463d9c989a8dbe8..c13a28be2b4c8702f3ec2ae3eeb4115104c6dd67 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamscallbackfourthscene/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/config.json index 42a625c57bf984e35fdee29967f8cc87d362fb25..e6b6b649761ccdb21a70964c73dd6856530bccfd 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamscallbacksecondscene/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/config.json index 98f7d882be177dd78143aa3c4f7575f5c458b4a5..75d5900a2019ef12df78165d534d13842c7e6650 100644 --- a/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamscallbackthirdscene/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/config.json index 84a1ef48066bb38570eb16606ff13a12e44c5063..c2b7d9418c177863be212483c4283cdcf0eb8e00 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamstestfifthscene/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/config.json index 89355be858387a8e59792bf9fbf9e0be39814cdd..0ee07351d8c166702544d07a6a2d00ecda507ab5 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamstestfirstscene/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/config.json index 76e63afa3d5607148d98d956f8ebf4466bc5d539..78cb23d926127618280a31b2dd9f24643cae7881 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamstestfourthscene/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/config.json index c28a0df5fa67a140fd34de540d64271526a055a7..56d9adbc0f51e479d148a1856212c0dc66a7a8b3 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamstestsecondscene/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/config.json b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/config.json index 4885d8a231c4551314be3bc456edd44afd201bfc..89e35043d00c179ac285b3eb92a8441e6aeaa9e3 100644 --- a/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/actsamstestthirdscene/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/config.json b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/config.json index de20a4362f25370f1e4cfccc2e5469d102ede3d5..c78ab63a3c993aaef684b3b8cf9f89e36c2300b6 100644 --- a/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/sceneProject/simulateEAbility/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.simulateeability", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/config.json b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/config.json index b5b8e428c62b3cdbc61c2d65cdbfe3ac45c516a3..e7ad9a86fb7ab3b398fb26195de20b50e290043d 100644 --- a/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilityFir/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.simulatefabilityfir", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/config.json b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/config.json index 52cca5948ec80701f2972868ea59f9c17ea02b9a..c2f3e47b6d636d1d9a06a2de0a2a8789deb79de9 100644 --- a/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/sceneProject/simulateFAbilitySed/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.simulatefabilitysed", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/config.json b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/config.json index 367fbe56ff60319a84ec93f1b4685f959931ed23..8c82d1fcef030581bba3da2cd1b7e36fe053f9dd 100644 --- a/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/sceneProject/verifyAAbility/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.verifyaability", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/config.json b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/config.json index 82b3340659f1fa47a1ed9e3651f0760f261a3219..42fc6c622a090f0ae9773463008570cd03a76446 100644 --- a/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/config.json +++ b/ability/ability_runtime/abilitymanager/sceneProject/verifyIAbility/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.verifyiability", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/abilitymontior/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/abilitymontior/entry/src/main/ets/test/Ability.test.ets index 37cbf1f99eb45f18ed24e7e79b360cbb2872bbdd..9b3273043183ca68cf2b29f66291b87c1aaa532e 100644 --- a/ability/ability_runtime/abilitymontior/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/abilitymontior/entry/src/main/ets/test/Ability.test.ets @@ -109,7 +109,10 @@ export default function abilityTest() { data.addAbilityMonitor( { abilityName: 'MainAbility2', - onAbilityForeground: onAbilityForeground + onAbilityForeground: onAbilityForeground, + onWindowStageRestore:(Ability)=>{ + console.info("===>onWindowStageRestore"); + } }, (async (err) => { console.debug("====>ACTS_AddAbilityMonitor_0200 success====>" + err.code); await globalThis.abilitydelegator.startAbility( diff --git a/ability/ability_runtime/abilitymontior/entry/src/main/module.json b/ability/ability_runtime/abilitymontior/entry/src/main/module.json index f5cda5bfa8510fc7353208936a4191a2bb79f29e..3d6e72c4cb3194bbd8746295d68afddd6e3bb1ea 100644 --- a/ability/ability_runtime/abilitymontior/entry/src/main/module.json +++ b/ability/ability_runtime/abilitymontior/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -58,6 +59,12 @@ "visible": true, "launchType": "singleton" } + ], + "reqPermissions": [ + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + } ] } } \ No newline at end of file diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/module.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/module.json index 2eb330f80879cf5576e42523fd33c776b7c5cb98..f23724b5b11b5d4ee49c433a7a835f2818ec1ce3 100644 --- a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/module.json +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappa/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -74,6 +75,10 @@ { "name":"ohos.permission.CLEAN_APPLICATION_DATA", "reason":"need use ohos.permission.CLEAN_APPLICATION_DATA" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ] } diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/module.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/module.json index 59947d2cd26bc6812931955346af8c9d7171f76f..eb64059ad8bb44d87ef639af6a917e76f0ada5c0 100644 --- a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/module.json +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappb/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -74,6 +75,10 @@ { "name":"ohos.permission.CLEAN_APPLICATION_DATA", "reason":"need use ohos.permission.CLEAN_APPLICATION_DATA" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ] } diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/module.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/module.json index cc9c505c9ec155b96ff3cb20f89d2b8baffeffec..1ac01030cac5fa90199bd4dff131195655ac2b25 100644 --- a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/module.json +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappc/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -74,6 +75,10 @@ { "name":"ohos.permission.CLEAN_APPLICATION_DATA", "reason":"need use ohos.permission.CLEAN_APPLICATION_DATA" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ] } diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/module.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/module.json index 14d28d9b42e2ec310f2a1f3382183bc6b4183cd2..980d4d28b712f00348fb7ffa27f4e7a41c36f4dd 100644 --- a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/module.json +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappd/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -114,6 +115,10 @@ { "name":"ohos.permission.CLEAN_APPLICATION_DATA", "reason":"need use ohos.permission.CLEAN_APPLICATION_DATA" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ] } diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/config.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/config.json index 7aefa80545212cec61c3b43e96ccae313ecaab5b..9c0f79b26fe4512bea5abb961089d563a9a7f75a 100644 --- a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/config.json +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstanceappe/src/main/config.json @@ -21,6 +21,7 @@ "package": "com.example.amsabilitymultiinstanceappe", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { @@ -77,6 +78,10 @@ { "name": "ohos.permission.LISTEN_BUNDLE_CHANGE", "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ], "js": [ diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts index 6d4dc7c06648df436d0c1b7fd7683f5e66b6f030..a7588ad77f5f08bc17b9b26c76461798cca2d735 100644 --- a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -13,12 +13,23 @@ * limitations under the License. */ import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' export default class MainAbility extends Ability { onCreate(want,launchParam){ // Ability is creating, initialize resources for this ability console.log("AbilityMultiInstanceTest onCreate") globalThis.abilityWant = want; + + globalThis.abilityContext = this.context + let abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + let abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } onDestroy() { @@ -29,7 +40,7 @@ export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { // Main window is created, set main page for this ability console.log("AbilityMultiInstanceTest onWindowStageCreate") - globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) console.log("AbilityMultiInstanceTest onWindowStageCreate finish") } diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index/index.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index/index.ets index 8104a9e406943f5c5320809295495863e5ec128e..88f0dd53fa9780e4262830d1922a633c8fc1fd88 100644 --- a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index/index.ets +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/pages/index/index.ets @@ -13,20 +13,11 @@ * limitations under the License. */ -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from '@ohos/hypium' -import testsuite from '../../test/List.test' @Entry @Component struct Index { aboutToAppear(){ - let abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - let abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } build() { diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/Ability.test.ets index 8b530adededf7147f149694a410055b5b55f0cac..c13edd358fd36710b9247a9c50a67ce8afd77d9c 100644 --- a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/ets/test/Ability.test.ets @@ -91,6 +91,25 @@ async function startAbilityProcess(abilityContext, parameters) { export default function abilityTest(abilityContext) { describe('ActsAbilityTest', function () { + let TAG1 = "ACTS_AbilityMultiInstance_Single == "; + afterEach(async (done) => { + console.log(TAG1 + "afterEach called"); + let wantInfo = { + bundleName: "com.example.abilitymultiinstance", + abilityName: "com.example.abilitymultiinstance.MainAbility" + } + await abilityContext.startAbility(wantInfo).then((data) => { + console.log(TAG1 + "startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log(TAG1 + "startAbility err : " + JSON.stringify(err)); + }) + + setTimeout(function () { + console.log(TAG1 + "afterEach end"); + done(); + }, 500); + }) + /* * @tc.number: ACTS_AbilityMultiInstance_Multi_0100 * @tc.name: Connects a service ability, which is used to start a cloned page ability. diff --git a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/module.json b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/module.json index 8938ebbbcead80c8831f3ebcbf00154338442246..0156baf35e7675c7c13e4ee3370c373bf7ee4453 100644 --- a/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/module.json +++ b/ability/ability_runtime/abilitymultiinstance/amsabilitymultiinstancetest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -74,6 +75,10 @@ { "name":"ohos.permission.CLEAN_APPLICATION_DATA", "reason":"need use ohos.permission.CLEAN_APPLICATION_DATA" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ] } diff --git a/ability/ability_runtime/abilitystagemonitor/BUILD.gn b/ability/ability_runtime/abilitystagemonitor/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c62db0ce5753f5e760fa45d10cc27b1351abdda5 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/BUILD.gn @@ -0,0 +1,30 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +group("abilitystagemonitor") { + testonly = true + if (is_standard_system) { + deps = [ + "abilitystagemonitorassista:AbilityStageMonitorAssistA", + "abilitystagemonitorassistc:AbilityStageMonitorAssistC", + "abilitystagemonitorassistd:AbilityStageMonitorAssistD", + "abilitystagemonitorassiste:AbilityStageMonitorAssistE", + "abilitystagemonitorassistf:AbilityStageMonitorAssistF", + "abilitystagemonitorassistg:AbilityStageMonitorAssistG", + "abilitystagemonitorassisth:AbilityStageMonitorAssistH", + "abilitystagemonitortest:ActsAbilityStageMonitorTest", + ] + } +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/AppScope/app.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a921834bca84e37cf76efb5d0a4921c279cafa63 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.abilitystagemonitortest", + "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 + } + } +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ec48a8748ea2b8c0babde132baba30c5503a0918 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityStageMonitor" + } + ] +} diff --git a/multimedia/camera/cameraDepthOffield/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/AppScope/resources/base/media/app_icon.png similarity index 100% rename from multimedia/camera/cameraDepthOffield/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/BUILD.gn b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..b9cede19023aa0737cac207eb3b630ea1d14f12a --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("AbilityStageMonitorAssistA") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":abilitystagemonitorassista_js_assets", + ":abilitystagemonitorassista_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "AbilityStageMonitorAssistA" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("abilitystagemonitorassista_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("abilitystagemonitorassista_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("abilitystagemonitorassista_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":abilitystagemonitorassista_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/ets/Application/MyAbilityStage.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e51ff9632d6371ef35f5b56c7af455e3b8687949 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/ets/Application/MyAbilityStage.ts @@ -0,0 +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. +*/ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info("MyAbilityStageMonitor onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..1c0b9c74e71d497764f791d25187cd511ca8d64a --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.info('MainAbilityMonitor onCreate') + } + + onDestroy() { + console.info('MainAbilityMonitor onDestroy') + } + + onWindowStageCreate(windowStage) { + console.info('MainAbilityMonitor onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.info('MainAbilityMonitor onWindowStageDestroy') + } + + onForeground() { + console.info('MainAbilityMonitor onForeground') + } + + onBackground() { + console.info('MainAbilityMonitor onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..2061615571be9e4e28c4f2c1ea5b231b4a063681 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + console.info('start run testcase!!!') + } + + @State message: string = 'MainAbility Hello' + 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/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/module.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..e9c2e405452a71c68db0b60e163585b366891e0c --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "feature_assista", + "type": "feature", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..127ea0d94555366c6888ac530babae4bf4cc1299 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "assista" + }, + { + "name": "app_name", + "value": "AACommandtest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/multimedia/camera/cameraExceedWideAngle/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/resources/base/media/icon.png similarity index 100% rename from multimedia/camera/cameraExceedWideAngle/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..951f0a2b8d54f94311cb88cbedae68c9d56fcb49 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} \ No newline at end of file diff --git a/request/RequestTest_ets/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/signature/openharmony_sx.p7b old mode 100755 new mode 100644 similarity index 100% rename from request/RequestTest_ets/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassista/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/AppScope/app.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a921834bca84e37cf76efb5d0a4921c279cafa63 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.abilitystagemonitortest", + "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 + } + } +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ec48a8748ea2b8c0babde132baba30c5503a0918 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityStageMonitor" + } + ] +} diff --git a/multimedia/camera/cameraLongFocus/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/AppScope/resources/base/media/app_icon.png similarity index 100% rename from multimedia/camera/cameraLongFocus/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/BUILD.gn b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..8b29ea6397bcb51b7a82007bfbca358be1979b0e --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("AbilityStageMonitorAssistC") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":abilitystagemonitorassistc_js_assets", + ":abilitystagemonitorassistc_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "AbilityStageMonitorAssistC" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("abilitystagemonitorassistc_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("abilitystagemonitorassistc_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("abilitystagemonitorassistc_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":abilitystagemonitorassistc_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/ets/Application/MyAbilityStage.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e51ff9632d6371ef35f5b56c7af455e3b8687949 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/ets/Application/MyAbilityStage.ts @@ -0,0 +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. +*/ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info("MyAbilityStageMonitor onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..54fb016cfb5876920e658414ee16d35ba6869df9 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.info('MainAbilityMonitor onCreate') + } + + + onDestroy() { + console.info('MainAbilityMonitor onDestroy') + } + + onWindowStageCreate(windowStage) { + console.info('MainAbilityMonitor onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.info('MainAbilityMonitor onWindowStageDestroy') + } + + onForeground() { + console.info('MainAbilityMonitor onForeground') + } + + onBackground() { + console.info('MainAbilityMonitor onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e23418836be1e36fc7823c36138cc343029122f --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + console.info('start run testcase!!!') + } + + @State message: string = 'MainAbility2 Hello' + 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/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/module.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..2dc69255f983edb8593e020b6fcc73a225d1d31f --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "feature_assistc", + "type": "feature", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility2", + "deviceTypes": [ + "default", + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility2", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..164db31071950c97cb9a00f325391560598c9d08 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "assistc" + }, + { + "name": "app_name", + "value": "AACommandtest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/multimedia/camera/cameraUnspc/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/resources/base/media/icon.png similarity index 100% rename from multimedia/camera/cameraUnspc/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..951f0a2b8d54f94311cb88cbedae68c9d56fcb49 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} \ No newline at end of file diff --git a/time/TimeTest_js/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/signature/openharmony_sx.p7b similarity index 100% rename from time/TimeTest_js/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistc/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/AppScope/app.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a921834bca84e37cf76efb5d0a4921c279cafa63 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.abilitystagemonitortest", + "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 + } + } +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ec48a8748ea2b8c0babde132baba30c5503a0918 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityStageMonitor" + } + ] +} diff --git a/multimedia/camera/cameraWideAngle/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/AppScope/resources/base/media/app_icon.png similarity index 100% rename from multimedia/camera/cameraWideAngle/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/BUILD.gn b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..baeca91f57855eec19490cdfb4b74f927adbd3ae --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("AbilityStageMonitorAssistD") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":abilitystagemonitorassistd_js_assets", + ":abilitystagemonitorassistd_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "AbilityStageMonitorAssistD" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("abilitystagemonitorassistd_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("abilitystagemonitorassistd_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("abilitystagemonitorassistd_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":abilitystagemonitorassistd_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/ets/Application/MyAbilityStage.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e51ff9632d6371ef35f5b56c7af455e3b8687949 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/ets/Application/MyAbilityStage.ts @@ -0,0 +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. +*/ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info("MyAbilityStageMonitor onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..54fb016cfb5876920e658414ee16d35ba6869df9 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.info('MainAbilityMonitor onCreate') + } + + + onDestroy() { + console.info('MainAbilityMonitor onDestroy') + } + + onWindowStageCreate(windowStage) { + console.info('MainAbilityMonitor onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.info('MainAbilityMonitor onWindowStageDestroy') + } + + onForeground() { + console.info('MainAbilityMonitor onForeground') + } + + onBackground() { + console.info('MainAbilityMonitor onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..46cbf8478ea057c90ac54be87cc5db177cbe3277 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + console.info('start run testcase!!!') + } + + @State message: string = 'MainAbility3 Hello' + 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/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/module.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..1ab7e76239d8938364fcbe5f83157302d3e00425 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "feature_assistd", + "type": "feature", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility3", + "deviceTypes": [ + "default", + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility3", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d43bdd43148a9f58f156952ae728af724fc08507 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "assistd" + }, + { + "name": "app_name", + "value": "AACommandtest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngleRK/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/resources/base/media/icon.png similarity index 100% rename from multimedia/camera/cameraWideAngleRK/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..951f0a2b8d54f94311cb88cbedae68c9d56fcb49 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} \ No newline at end of file diff --git a/time/TimerTest_js/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/signature/openharmony_sx.p7b similarity index 100% rename from time/TimerTest_js/signature/openharmony_sx.p7b rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistd/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/AppScope/app.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a921834bca84e37cf76efb5d0a4921c279cafa63 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.abilitystagemonitortest", + "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 + } + } +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ec48a8748ea2b8c0babde132baba30c5503a0918 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityStageMonitor" + } + ] +} diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/AppScope/resources/base/media/app_icon.png similarity index 100% rename from multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/BUILD.gn b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..cfe38a642640a6d7ee45e5d454d335b4b5f66d5e --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("AbilityStageMonitorAssistE") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":abilitystagemonitorassiste_js_assets", + ":abilitystagemonitorassiste_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "AbilityStageMonitorAssistE" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("abilitystagemonitorassiste_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("abilitystagemonitorassiste_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("abilitystagemonitorassiste_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":abilitystagemonitorassiste_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/ets/Application/MyAbilityStage.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e51ff9632d6371ef35f5b56c7af455e3b8687949 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/ets/Application/MyAbilityStage.ts @@ -0,0 +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. +*/ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info("MyAbilityStageMonitor onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..54fb016cfb5876920e658414ee16d35ba6869df9 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.info('MainAbilityMonitor onCreate') + } + + + onDestroy() { + console.info('MainAbilityMonitor onDestroy') + } + + onWindowStageCreate(windowStage) { + console.info('MainAbilityMonitor onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.info('MainAbilityMonitor onWindowStageDestroy') + } + + onForeground() { + console.info('MainAbilityMonitor onForeground') + } + + onBackground() { + console.info('MainAbilityMonitor onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c1c0f2c9122aa6dcf2ae920ad25df61d783654ea --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + console.info('start run testcase!!!') + } + + @State message: string = 'MainAbility4 Hello' + 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/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/module.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..ba8c50bb286d033861ce929d3ff32047aca40522 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "feature_assiste", + "type": "feature", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility4", + "deviceTypes": [ + "default", + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility4", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..4590c7b559ea45c68c440646e0057ea2785737e9 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "assiste" + }, + { + "name": "app_name", + "value": "AACommandtest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 similarity index 100% rename from multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..951f0a2b8d54f94311cb88cbedae68c9d56fcb49 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassiste/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/AppScope/app.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a921834bca84e37cf76efb5d0a4921c279cafa63 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.abilitystagemonitortest", + "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 + } + } +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ec48a8748ea2b8c0babde132baba30c5503a0918 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityStageMonitor" + } + ] +} diff --git a/notification/ans_standard/actsansnotificationcancel/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/actsansnotificationcancel/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/BUILD.gn b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..43c41360dbf985790a8398db2a3c7724ccdbb4ba --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("AbilityStageMonitorAssistF") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":abilitystagemonitorassistf_js_assets", + ":abilitystagemonitorassistf_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "AbilityStageMonitorAssistF" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("abilitystagemonitorassistf_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("abilitystagemonitorassistf_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("abilitystagemonitorassistf_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":abilitystagemonitorassistf_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/ets/Application/MyAbilityStage.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e51ff9632d6371ef35f5b56c7af455e3b8687949 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/ets/Application/MyAbilityStage.ts @@ -0,0 +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. +*/ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info("MyAbilityStageMonitor onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..54fb016cfb5876920e658414ee16d35ba6869df9 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.info('MainAbilityMonitor onCreate') + } + + + onDestroy() { + console.info('MainAbilityMonitor onDestroy') + } + + onWindowStageCreate(windowStage) { + console.info('MainAbilityMonitor onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.info('MainAbilityMonitor onWindowStageDestroy') + } + + onForeground() { + console.info('MainAbilityMonitor onForeground') + } + + onBackground() { + console.info('MainAbilityMonitor onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..cfe56a48a83be655cb302d0fdc1abb6c2d28587b --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + console.info('start run testcase!!!') + } + + @State message: string = 'MainAbilityf5 Hello' + 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/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/module.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..14299d215f1fb8c4f9cf87a00c4915cfa2ecdb8e --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "feature_assistf", + "type": "feature", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbilityf5", + "deviceTypes": [ + "default", + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbilityf5", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..917bbd6315734ee7f1795e4dcb90b91a2a92a4a3 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "assistf" + }, + { + "name": "app_name", + "value": "AACommandtest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/actsansnotificationremove/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/actsansnotificationremove/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..951f0a2b8d54f94311cb88cbedae68c9d56fcb49 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistf/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/AppScope/app.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a921834bca84e37cf76efb5d0a4921c279cafa63 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.abilitystagemonitortest", + "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 + } + } +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ec48a8748ea2b8c0babde132baba30c5503a0918 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityStageMonitor" + } + ] +} diff --git a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/BUILD.gn b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..e2c7c7007078605e459a4dea05160507135c5980 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("AbilityStageMonitorAssistG") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":abilitystagemonitorassistg_js_assets", + ":abilitystagemonitorassistg_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "AbilityStageMonitorAssistG" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("abilitystagemonitorassistg_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("abilitystagemonitorassistg_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("abilitystagemonitorassistg_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":abilitystagemonitorassistg_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/ets/Application/MyAbilityStage.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e51ff9632d6371ef35f5b56c7af455e3b8687949 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/ets/Application/MyAbilityStage.ts @@ -0,0 +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. +*/ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info("MyAbilityStageMonitor onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..54fb016cfb5876920e658414ee16d35ba6869df9 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.info('MainAbilityMonitor onCreate') + } + + + onDestroy() { + console.info('MainAbilityMonitor onDestroy') + } + + onWindowStageCreate(windowStage) { + console.info('MainAbilityMonitor onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.info('MainAbilityMonitor onWindowStageDestroy') + } + + onForeground() { + console.info('MainAbilityMonitor onForeground') + } + + onBackground() { + console.info('MainAbilityMonitor onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..0aeb88ca7ed660425c541ce8b0ede058251520c6 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + console.info('start run testcase!!!') + } + + @State message: string = 'MainAbility6 Hello' + 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/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/module.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..d17f8659db601fc0d0ede59773a66a56cd4dc1cf --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "feature_assistg", + "type": "feature", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility6", + "deviceTypes": [ + "default", + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility6", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d256cdf5bc0751684f2a4f8ef597249ed07d3327 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "assistg" + }, + { + "name": "app_name", + "value": "AACommandtest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..951f0a2b8d54f94311cb88cbedae68c9d56fcb49 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassistg/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/AppScope/app.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a921834bca84e37cf76efb5d0a4921c279cafa63 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.abilitystagemonitortest", + "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 + } + } +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ec48a8748ea2b8c0babde132baba30c5503a0918 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityStageMonitor" + } + ] +} diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/BUILD.gn b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..86b710629d25f9fae7c89d39f317c2bdf84b10cf --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("AbilityStageMonitorAssistH") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":abilitystagemonitorassisth_js_assets", + ":abilitystagemonitorassisth_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "AbilityStageMonitorAssistH" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("abilitystagemonitorassisth_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("abilitystagemonitorassisth_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("abilitystagemonitorassisth_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":abilitystagemonitorassisth_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/ets/Application/MyAbilityStage.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e51ff9632d6371ef35f5b56c7af455e3b8687949 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/ets/Application/MyAbilityStage.ts @@ -0,0 +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. +*/ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info("MyAbilityStageMonitor onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..54fb016cfb5876920e658414ee16d35ba6869df9 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.info('MainAbilityMonitor onCreate') + } + + + onDestroy() { + console.info('MainAbilityMonitor onDestroy') + } + + onWindowStageCreate(windowStage) { + console.info('MainAbilityMonitor onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.info('MainAbilityMonitor onWindowStageDestroy') + } + + onForeground() { + console.info('MainAbilityMonitor onForeground') + } + + onBackground() { + console.info('MainAbilityMonitor onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..f156d9ceff6824421a7bd4ce79522ac64b61f1c0 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + console.info('start run testcase!!!') + } + + @State message: string = 'MainAbility7 Hello' + 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/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/module.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..af9885f310f2f6c6f2c08fee63c4f9c40aed967c --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "feature_assistg", + "type": "feature", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility7", + "deviceTypes": [ + "default", + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility7", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b5cafcc1c21c8e487c4b840c9506186455d87ed1 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "assisth" + }, + { + "name": "app_name", + "value": "AACommandtest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..951f0a2b8d54f94311cb88cbedae68c9d56fcb49 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitorassisth/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/AppScope/app.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a921834bca84e37cf76efb5d0a4921c279cafa63 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.abilitystagemonitortest", + "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 + } + } +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/AppScope/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ec48a8748ea2b8c0babde132baba30c5503a0918 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityStageMonitor" + } + ] +} diff --git a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/BUILD.gn b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..90f1d5de6f3f4f36024e8b05f4e48aa18036b4ee --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAbilityStageMonitorTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":abilitystagemonitor_js_assets", + ":abilitystagemonitor_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAbilityStageMonitorTest" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("abilitystagemonitor_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("abilitystagemonitor_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("abilitystagemonitor_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":abilitystagemonitor_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/Test.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..9812e158e9648a33f32e8a27baefae42c62dd510 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/Test.json @@ -0,0 +1,28 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.abilitystagemonitortest", + "module-name": "entry_test", + "shell-timeout": "600000", + "testcase-timeout": "15000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAbilityStageMonitorTest.hap", + "AbilityStageMonitorAssistA.hap", + "AbilityStageMonitorAssistC.hap", + "AbilityStageMonitorAssistD.hap", + "AbilityStageMonitorAssistE.hap", + "AbilityStageMonitorAssistF.hap", + "AbilityStageMonitorAssistG.hap", + "AbilityStageMonitorAssistH.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} + diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/Application/TestAbilityStage.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/Application/TestAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e51ff9632d6371ef35f5b56c7af455e3b8687949 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/Application/TestAbilityStage.ts @@ -0,0 +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. +*/ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info("MyAbilityStageMonitor onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/TestAbility/TestAbility.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..d1317f99b914d3bc27274c9ade6bc4a8b62a47fd --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + globalThis.abilityContext = this.context; + console.info('TestAbility onCreate') + let abilityDelegatorArguments: any + let abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'TestAbility/pages/index', null) + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/TestAbility/pages/index.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c6e79e8ce9ce787c085cf32507c73a4d2a63a42c --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + @State message: string = 'TestAbility Hello' + 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/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..e9555725ac68e84cbe76bdac9294719a0ecfc3f4 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,75 @@ +/* +* 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' + +let abilityDelegator = undefined +let 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() + globalThis.abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + let testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + let cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + 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/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/test/AbilityStageMonitor.test.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/test/AbilityStageMonitor.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8bdca59c2a7c62bfe7a7fcb79402f79f27328341 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/test/AbilityStageMonitor.test.ets @@ -0,0 +1,546 @@ +/* + * 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, it, expect, afterEach } from '@ohos/hypium' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +let moduleName1: any +let monitor: any +let want: any +let timeout = 3000; +let addMonitor = false; +let removeMonitor = false; + +function sleep(delay) { + let start = (new Date()).getTime(); + while ((new Date()).getTime() - start < delay) { + continue; + } +} +function test(time) { + sleep(time); +} + +export default function abilityStageMonitorTest() { + describe('ActsAbilityTest', function () { + + afterEach(async (done) => { + console.log("SUB_AA_AbilityStageMonitor afterEach called"); + let wantInfo = { + bundleName: "com.example.abilitystagemonitortest", + abilityName: "TestAbility" + } + await globalThis.abilityContext.startAbility(wantInfo).then((data) => { + console.log("SUB_AA_AbilityStageMonitor startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("SUB_AA_AbilityStageMonitor startAbility err : " + JSON.stringify(err)); + }) + + setTimeout(function () { + console.log("SUB_AA_AbilityStageMonitor afterEach called"); + done(); + }, 1000); + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_0100 + * @tc.name: Call waitAbilityStageMonitor in the form of callback, and enter the monitor + * @tc.desc: Verify that the callback form of waitAbilityStageMonitor can get the abilityStage instance + * @tc.level: 1 + */ + it('SUB_AA_AbilityStageMonitor_0100', 0, async function (done) { + console.info("SUB_AA_AbilityStage_0100 begin") + + monitor = { + moduleName: "feature_assista", + srcEntrance: "./ets/Application/MyAbilityStage.ts", + } + + try { + console.info("SUB_AA_AbilityStage_0100 wait abilityStage"); + abilityDelegator.waitAbilityStageMonitor(monitor, (err, data) => { + console.log("SUB_AA_AbilityStage_0100 waitAbilityStageMonitor callback " + + "err = " + err + ", data = " + JSON.stringify(data)); + moduleName1 = data.context.currentHapModuleInfo.name; + expect(moduleName1).assertEqual(monitor.moduleName) + done(); + }); + } catch (error) { + console.info("SUB_AA_AbilityStage_0100 waitAbilityStageMonitor callback err: " + JSON.stringify(error)); + expect().assertFail() + done() + } + + console.info("SUB_AA_AbilityStage_0100 start ability"); + + want = { + bundleName: "com.example.abilitystagemonitortest", + abilityName: "MainAbility" + }; + + try { + abilityDelegator.startAbility(want, (err, data) => { + console.info("SUB_AA_AbilityStage_0100 startAbility callback err: " + JSON.stringify(err) + "data: " + JSON.stringify(data)); + }); + } catch (error) { + console.info("SUB_AA_AbilityStage_0100 startAbility callback err: " + JSON.stringify(error)); + expect().assertFail() + done() + } + + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_0200 + * @tc.name: Call waitAbilityStageMonitor in the form of a promise, and enter the monitor + * @tc.desc: Verify that the promise form of waitAbilityStageMonitor can get the abilityStage instance + * @tc.level: 3 + */ + it('SUB_AA_AbilityStageMonitor_0200', 0, async function (done) { + console.log("SUB_AA_AbilityStage_0100 begin") + + monitor = { + moduleName: "feature_assistd", + srcEntrance: "./ets/Application/MyAbilityStage.ts", + } + + console.log("SUB_AA_AbilityStageMonitor_0200 wait abilityStage"); + + abilityDelegator.waitAbilityStageMonitor(monitor).then((abilityStage) => { + console.log("SUB_AA_AbilityStageMonitor_0200 waitAbilityStageMonitor promise " + + "abilityStage: " + JSON.stringify(abilityStage)); + moduleName1 = abilityStage.context.currentHapModuleInfo.name; + expect(moduleName1).assertEqual(monitor.moduleName) + done(); + }).catch((err) => { + console.log("SUB_AA_AbilityStageMonitor_0200 waitAbilityStageMonitor err: " + JSON.stringify(err)); + expect().assertFail() + done() + }) + + console.log("SUB_AA_AbilityStageMonitor_0200 start ability"); + + want = { + bundleName: "com.example.abilitystagemonitortest", + abilityName: "MainAbility3" + }; + + try { + abilityDelegator.startAbility(want, (err, data) => { + console.log("SUB_AA_AbilityStageMonitor_0200 startAbility callback err: " + + JSON.stringify(err) + "data: " + JSON.stringify(data)); + }); + } catch (error) { + console.log("SUB_AA_AbilityStageMonitor_0200 startAbility callback err: " + JSON.stringify(error)); + expect().assertFail() + done() + } + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_0300 + * @tc.name: Call waitAbilityStageMonitor in the form of callBack, enter the monitor, timeout + * @tc.desc: Verify that the callback form of waitAbilityStageMonitor can get the abilityStage instance + * @tc.level: 3 + */ + it('SUB_AA_AbilityStageMonitor_0300', 0, async function (done) { + console.info("SUB_AA_AbilityStageMonitor_0300 begin") + + monitor = { + moduleName: "feature_assistf", + srcEntrance: "./ets/Application/MyAbilityStage.ts", + } + + try { + console.info("SUB_AA_AbilityStageMonitor_0300 wait abilityStage"); + abilityDelegator.waitAbilityStageMonitor(monitor, timeout, (err, data) => { + moduleName1 = data.context.currentHapModuleInfo.name; + console.info("SUB_AA_AbilityStageMonitor_0300 waitAbilityStageMonitor callback, err: " + + err + ", data =" + JSON.stringify(data)); + expect(moduleName1).assertEqual(monitor.moduleName) + done(); + }); + } catch (error) { + console.info("SUB_AA_AbilityStageMonitor_0300 waitAbilityStageMonitor callback err: " + JSON.stringify(error)); + expect().assertFail() + done() + } + + console.info("SUB_AA_AbilityStageMonitor_0300 start ability"); + + want = { + bundleName: "com.example.abilitystagemonitortest", + abilityName: "MainAbilityf5" + }; + + try { + abilityDelegator.startAbility(want, (err, data) => { + console.info("SUB_AA_AbilityStageMonitor_0300 startAbility callback err: " + + JSON.stringify(err) + "data: " + JSON.stringify(data)); + }); + } catch (error) { + console.info("SUB_AA_AbilityStageMonitor_0300 startAbility callback err: " + JSON.stringify(error)); + expect().assertFail() + done() + } + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_0400 + * @tc.name: Call waitAbilityStageMonitor in the form of promise, input monitor, timeout + * @tc.desc: Verify that the promise form of waitAbilityStageMonitor can get the abilityStage instance + * @tc.level: 3 + */ + it('SUB_AA_AbilityStageMonitor_0400', 0, async function (done) { + console.info("SUB_AA_AbilityStageMonitor_0400 begin") + + monitor = { + moduleName: "feature_assistc", + srcEntrance: "./ets/Application/MyAbilityStage.ts", + } + + console.info("SUB_AA_AbilityStageMonitor_0400 wait abilityStage"); + + abilityDelegator.waitAbilityStageMonitor(monitor, timeout).then((abilityStage) => { + moduleName1 = abilityStage.context.currentHapModuleInfo.name; + console.info("stageMonitor waitAbilityStageMonitor callback, abilityStage: " + + JSON.stringify(abilityStage)); + expect(moduleName1).assertEqual(monitor.moduleName) + done(); + }).catch((err) => { + console.info("SUB_AA_AbilityStageMonitor_0400 waitAbilityStageMonitor err: " + JSON.stringify(err)); + expect().assertFail() + done() + }) + + console.info("SUB_AA_AbilityStageMonitor_0400 start ability"); + + test(1000) + + want = { + bundleName: "com.example.abilitystagemonitortest", + abilityName: "MainAbility2" + }; + + try { + abilityDelegator.startAbility(want, (err, data) => { + console.info("SUB_AA_AbilityStageMonitor_0400 startAbility callback err: " + + JSON.stringify(err) + "data: " + JSON.stringify(data)); + }); + } catch (error) { + console.info("SUB_AA_AbilityStageMonitor_0400 startAbility callback err: " + JSON.stringify(error)); + expect().assertFail() + done() + } + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_0500 + * @tc.name: Call waitAbilityStageMonitor, the moduleName in the parameter monitor does not exist + * @tc.desc: Verify that the moduleName passed in by waitAbilityStageMonitor + * does not exist and throw an exception + * @tc.level: 3 + */ + it('SUB_AA_AbilityStageMonitor_0500', 0, async function (done) { + console.info("SUB_AA_AbilityStageMonitor_0500 begin") + + monitor = { + moduleName: "feature_as1", + srcEntrance: "./ets/Application/MyAbilityStage.ts", + } + + console.info("SUB_AA_AbilityStageMonitor_0500 wait abilityStage"); + + await abilityDelegator.waitAbilityStageMonitor(monitor).then((abilityStage) => { + console.info("stageMonitor waitAbilityStageMonitor callback, abilityStage = " + JSON.stringify(abilityStage)); + expect().assertFail() + done() + }).catch((err) => { + console.info("SUB_AA_AbilityStageMonitor_0500 waitAbilityStageMonitor err: " + JSON.stringify(err)); + expect(err.code).assertEqual(-1) + done() + }) + + console.info("SUB_AA_AbilityStageMonitor_0500 start ability"); + + want = { + bundleName: "com.example.abilitystagemonitortest", + abilityName: "MainAbility4" + }; + + try { + abilityDelegator.startAbility(want, (err, data) => { + console.info("SUB_AA_AbilityStageMonitor_0500 startAbility callback err: " + + JSON.stringify(err) + "data: " + JSON.stringify(data)); + }); + } catch (error) { + console.info("SUB_AA_AbilityStageMonitor_0500 startAbility callback err: " + JSON.stringify(error)); + expect().assertFail() + done() + } + + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_0600 + * @tc.name: Call waitAbilityStageMonitor, the srcEntrance in the parameter monitor does not exist + * @tc.desc: Verify that the srcEntrance passed in by waitAbilityStageMonitor + * does not exist and throw an exception + * @tc.level: 3 + */ + it('SUB_AA_AbilityStageMonitor_0600', 0, async function (done) { + console.info("SUB_AA_AbilityStageMonitor_0600 begin") + + monitor = { + moduleName: "feature_assistg", + srcEntrance: "./ets/Application/AbilityStageA.ts", + } + + console.info("SUB_AA_AbilityStageMonitor_0600 wait abilityStage"); + + await abilityDelegator.waitAbilityStageMonitor(monitor).then((abilityStage) => { + console.info("stageMonitor waitAbilityStageMonitor callback, abilityStage: " + JSON.stringify(abilityStage)); + }).catch((err) => { + console.info("SUB_AA_AbilityStageMonitor_0600 waitAbilityStageMonitor err: " + JSON.stringify(err)); + expect(err.code).assertEqual(-1) + done() + }) + + console.info("SUB_AA_AbilityStageMonitor_0600 start ability"); + + want = { + bundleName: "com.example.abilitystagemonitortest", + abilityName: "MainAbility6" + }; + + try { + abilityDelegator.startAbility(want, (err, data) => { + console.info("SUB_AA_AbilityStageMonitor_0600 startAbility callback err: " + + JSON.stringify(err) + "data: " + JSON.stringify(data)); + }); + } catch (error) { + console.info("SUB_AA_AbilityStageMonitor_0600 startAbility callback err: " + JSON.stringify(error)); + expect().assertFail() + done() + } + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_0700 + * @tc.name: Call the promise form of addAbilityStageMonitor to add monitoring, + * and call the promise form of removeAbilityStageMonitor to cancel monitoring + * @tc.desc: Verify that addAbilityStageMonitor can add monitoring, + * verify that removeAbilityStageMonitor can cancel monitoring + * @tc.level: 3 + */ + it('SUB_AA_AbilityStageMonitor_0700', 0, async function (done) { + console.info("SUB_AA_AbilityStageMonitor_0700 begin") + + addMonitor = false; + removeMonitor = false; + monitor = { + moduleName: "feature_assisth", + srcEntrance: "./ets/Application/MyAbilityStage.ts", + } + + console.info("SUB_AA_AbilityStageMonitor_0700 wait abilityStage"); + + await abilityDelegator.addAbilityStageMonitor(monitor).then((data) => { + console.info("stageMonitor addAbilityStageMonitor promise, data = " + data); + addMonitor = true; + }).catch((err) => { + console.info("SUB_AA_AbilityStageMonitor_0700 addAbilityStageMonitor err: " + JSON.stringify(err)); + expect().assertFail() + done() + }); + + await abilityDelegator.waitAbilityStageMonitor(monitor).then((abilityStage) => { + console.info("stageMonitor waitAbilityStageMonitor callback, abilityStage: " + JSON.stringify(abilityStage)); + }).catch((err) => { + console.info("SUB_AA_AbilityStageMonitor_0600 waitAbilityStageMonitor err: " + JSON.stringify(err)); + expect(err.code).assertEqual(-1) + }) + + console.info("SUB_AA_AbilityStageMonitor_0700 removeAbilityStageMonitor"); + + await abilityDelegator.removeAbilityStageMonitor(monitor).then((data) => { + console.info("stageMonitor addAbilityStageMonitor promise, data = " + data); + removeMonitor = true; + }).catch((err) => { + console.info("SUB_AA_AbilityStageMonitor_0700 removeAbilityStageMonitor err: " + JSON.stringify(err)); + expect().assertFail() + done() + }); + expect(addMonitor).assertTrue(); + expect(removeMonitor).assertTrue(); + done() + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_0800 + * @tc.name: Call the callback form of addAbilityStageMonitor to add monitoring, + * and call the callback form of removeAbilityStageMonitor to cancel monitoring + * @tc.desc: Verify that addAbilityStageMonitor can add monitoring, + * verify that removeAbilityStageMonitor can cancel monitoring + * @tc.level: 3 + */ + it('SUB_AA_AbilityStageMonitor_0800', 0, async function (done) { + console.info("SUB_AA_AbilityStageMonitor_0800 begin") + + addMonitor = false; + removeMonitor = false; + monitor = { + moduleName: "feature_assisti", + srcEntrance: "./ets/Application/AbilityStage.ts", + } + + console.info("SUB_AA_AbilityStageMonitor_0800 wait abilityStage"); + + try { + abilityDelegator.addAbilityStageMonitor(monitor, (err, data) => { + console.info("SUB_AA_AbilityStageMonitor_0800 addAbilityStageMonitor callback, data = " + data + + "err: " + err); + addMonitor = true; + }) + } catch (error) { + console.log("SUB_AA_AbilityStageMonitor_0800 addAbilityStageMonitor callback err: " + error); + expect().assertFail() + done() + } + + await abilityDelegator.waitAbilityStageMonitor(monitor).then((abilityStage) => { + console.info("stageMonitor waitAbilityStageMonitor callback, abilityStage: " + JSON.stringify(abilityStage)); + }).catch((err) => { + console.info("SUB_AA_AbilityStageMonitor_0600 waitAbilityStageMonitor err: " + JSON.stringify(err)); + expect(err.code).assertEqual(-1) + }) + + try { + console.info("SUB_AA_AbilityStageMonitor_0800 removeAbilityStageMonitor"); + abilityDelegator.removeAbilityStageMonitor(monitor, (err, data) => { + console.info("SUB_AA_AbilityStageMonitor_0800 removeAbilityStageMonitor callback, data = " + + data + "err: " + err); + removeMonitor = true; + }) + } catch (error) { + console.log("SUB_AA_AbilityStageMonitor_0800 removeAbilityStageMonitor callback err: " + error); + expect().assertFail() + done() + } + + setTimeout(() => { + expect(addMonitor).assertTrue() + expect(removeMonitor).assertTrue() + done() + }, 3000); + + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_0900 + * @tc.name: Call waitAbilityStageMonitor, input monitor, timeout is 3 seconds + * @tc.desc: Verify that waitAbilityStageMonitor is + * created after listening for less than 3 seconds + * @tc.level: 3 + */ + it('SUB_AA_AbilityStageMonitor_0900', 0, async function (done) { + console.info("SUB_AA_AbilityStageMonitor_0900 begin") + + monitor = { + moduleName: "feature_assisth", + srcEntrance: "./ets/Application/MyAbilityStage.ts", + } + + console.info("SUB_AA_AbilityStageMonitor_0900 wait abilityStage"); + + await abilityDelegator.waitAbilityStageMonitor(monitor, timeout).then((abilityStage) => { + console.info("SUB_AA_AbilityStageMonitor_0900 waitAbilityStageMonitor promise, abilityStage: " + + JSON.stringify(abilityStage)); + expect().assertFail() + done(); + }).catch((err) => { + console.info("stageMonitor waitAbilityStageMonitor err = " + JSON.stringify(err)); + expect(err.code).assertEqual(-1) + done(); + }) + + test(3000) + + console.info("SUB_AA_AbilityStageMonitor_0900 start ability"); + + want = { + bundleName: "com.example.abilitystagemonitortest", + abilityName: "MainAbility7" + }; + + try { + abilityDelegator.startAbility(want, (err, data) => { + console.info("SUB_AA_AbilityStageMonitor_0900 startAbility callback err: " + + JSON.stringify(err) + "data: " + JSON.stringify(data)); + }); + } catch (error) { + console.info("SUB_AA_AbilityStageMonitor_0900 startAbility callback err: " + JSON.stringify(error)); + expect().assertFail() + done() + } + }) + + /** + * @tc.number: SUB_AA_AbilityStageMonitor_1000 + * @tc.name: Call the promise form of addAbilityStageMonitor to add monitoring, + * call the promise form of removeAbilityStageMonitor to cancel monitoring, + * and the moduleName in the parameter monitor does not exist + * @tc.desc: Verify that addAbilityStageMonitor can add monitoring, + * verify that removeAbilityStageMonitor can cancel monitoring + * @tc.level: 3 + */ + it('SUB_AA_AbilityStageMonitor_1000', 0, async function (done) { + console.info("SUB_AA_AbilityStageMonitor_1000 begin") + + addMonitor = false; + removeMonitor = false; + monitor = { + moduleName: "feature_assa", + srcEntrance: "./ets/Application/MyAbilityStage.ts", + } + + console.info("SUB_AA_AbilityStageMonitor_1000 wait abilityStage"); + + await abilityDelegator.addAbilityStageMonitor(monitor).then((data) => { + console.info("SUB_AA_AbilityStageMonitor_1000 addAbilityStageMonitor promise, data = " + data); + addMonitor = true; + }).catch((err) => { + console.info("SUB_AA_AbilityStageMonitor_1000 removeAbilityStageMonitor err: " + JSON.stringify(err)); + expect().assertFail() + done() + }); + + console.info("stageMonitor removeAbilityStageMonitor"); + + await abilityDelegator.removeAbilityStageMonitor(monitor).then((data) => { + console.info("SUB_AA_AbilityStageMonitor_1000 addAbilityStageMonitor promise, data = " + data); + removeMonitor = true; + }).catch((err) => { + console.info("SUB_AA_AbilityStageMonitor_1000 removeAbilityStageMonitor err: " + JSON.stringify(err)); + expect().assertFail() + done() + }); + expect(addMonitor).assertTrue(); + expect(removeMonitor).assertTrue(); + done() + }) + }) +}; \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3943e83bbd25fed4bfb15abdf49c48404d1e0c50 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* 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 abilityStageMonitorTest from './AbilityStageMonitor.test' + +export default function testsuite() { + abilityStageMonitorTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/module.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..1868c97065974161717a459761cb8a21bdb77f8a --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "entry_test", + "type": "entry", + "srcEntrance": "./ets/Application/TestAbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "default", + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "TestAbility", + "srcEntrance": "./ets/TestAbility/TestAbility.ts", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..994bf08e00f269257844e6b9ecb091ea785de23c --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "app_name", + "value": "AACommandtest" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/resources/base/media/icon.png b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/resources/base/media/icon.png rename to ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..f1395d5d9958beba9c08629a18e47e4d10de9f49 --- /dev/null +++ b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "TestAbility/pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/signature/openharmony_sx.p7b b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/abilitystagemonitor/abilitystagemonitortest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/config.json b/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/config.json index c88e2c7465606e5a41db76d90738f2ed40fc4627..cce709b00ba46b3b1948e9d8968061b5f334c10f 100644 --- a/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/config.json +++ b/ability/ability_runtime/actsabilitydelegatorcase/entry/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.amsst.actsabilitydelegatorcasetest", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/config.json b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/config.json index c41d04caf7d0887c48afbdddd94df9cbd315b655..c2fa25973e1c4a0759314d89c05ddab989fd2033 100644 --- a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/config.json +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/config.json @@ -19,7 +19,8 @@ "srcPath": "", "mainAbility": "com.ohos.acecollaboration.MainAbility", "deviceType": [ - "phone" + "default", + "default" ], "reqPermissions": [ { diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAbilityInfoJsunit.test.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAbilityInfoJsunit.test.ets index 59b0a7ff11990489f9611c0c8c4f3673a0444536..e74925b2006b532dfa226ffdcaa4d410856ccdca 100644 --- a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAbilityInfoJsunit.test.ets +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getAbilityInfoJsunit.test.ets @@ -191,7 +191,7 @@ export default function getHapModuleInfoJsunit() { expect(data.type).assertEqual(1); expect(data.orientation).assertEqual(0); expect(data.launchMode).assertEqual(1); - expect(data.deviceTypes[0]).assertEqual("phone"); + expect(data.deviceTypes[0]).assertEqual("default"); expect(data.readPermission).assertEqual(""); expect(data.writePermission).assertEqual(""); checkApplicationInfo(msg, data.applicationInfo); diff --git a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getHapModuleInfoJsunit.test.ets b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getHapModuleInfoJsunit.test.ets index 2f3c5606755e9f430a9cf8816966d6684035a0d8..3703d15b1f64c00c3bb288b5eb853d9d207aaf43 100644 --- a/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getHapModuleInfoJsunit.test.ets +++ b/ability/ability_runtime/actsabilitymanageretstest/entry/src/main/ets/test/getHapModuleInfoJsunit.test.ets @@ -125,7 +125,7 @@ export default function getHapModuleInfoJsunit() { expect(data.iconId).assertEqual(16777229); expect(data.backgroundImg).assertEqual(""); expect(data.supportedModes).assertEqual(0); - expect(data.deviceTypes[0]).assertEqual("phone"); + expect(data.deviceTypes[0]).assertEqual("default"); console.info(msg + ' data.abilityInfo.length ' + data.abilityInfo.length) checkAbilityInfo(msg, data.abilityInfo[0]); expect(data.moduleName).assertEqual("entry") @@ -219,7 +219,7 @@ export default function getHapModuleInfoJsunit() { expect(data.type).assertEqual(1); expect(data.orientation).assertEqual(0); expect(data.launchMode).assertEqual(1); - expect(data.deviceTypes[0]).assertEqual("phone"); + expect(data.deviceTypes[0]).assertEqual("default"); expect(data.readPermission).assertEqual(""); expect(data.writePermission).assertEqual(""); expect(data.formEntity).assertEqual(0); diff --git a/ability/ability_runtime/actsabilityusertest/entry/src/main/module.json b/ability/ability_runtime/actsabilityusertest/entry/src/main/module.json index 4085e71d212cab75c38a50307aad7f60cc424e45..ddc5a77fe4142cce29b00266ab032da4aa910cba 100644 --- a/ability/ability_runtime/actsabilityusertest/entry/src/main/module.json +++ b/ability/ability_runtime/actsabilityusertest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], @@ -46,6 +47,16 @@ "icon": "$media:icon", "label": "$string:MainAbility3_label" } + ], + "requestPermissions": [ + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" + } ] } } \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/BUILD.gn b/ability/ability_runtime/actsappselector/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..94cec912f856013afd4333a39e63ecf1891d6cd1 --- /dev/null +++ b/ability/ability_runtime/actsappselector/BUILD.gn @@ -0,0 +1,52 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +group("actsappselector") { + testonly = true + if (is_standard_system) { + deps = [ + "actsappselectorpctest:ActsAppSelectorPCTest", + "actsappselectorrelyhap:ActsAppSelectorRelyHap", + "actsappselectortest:ActsAppSelectorTest", + "actsimageaentryrelyhap:ActsImageAEntryRelyHap", + "actsimageafeaturerelyhap:ActsImageAFeatureRelyHap", + "actsimagebentryrelyhap:ActsImageBEntryRelyHap", + "actsimagebfeaturerelyhap:ActsImageBFeatureRelyHap", + "actsimagecentryrelyhap:ActsImageCEntryRelyHap", + "actsimagecfeaturerelyhap:ActsImageCFeatureRelyHap", + "actsimagedrelyhap:ActsImageDRelyHap", + "actsimageerelyhap:ActsImageERelyHap", + "actsimagefrelyhap:ActsImageFRelyHap", + "actsimagegrelyhap:ActsImageGRelyHap", + "actsimagehrelyhap:ActsImageHRelyHap", + "actsimageirelyhap:ActsImageIRelyHap", + "actsimagejrelyhap:ActsImageJRelyHap", + "actsimagekrelyhap:ActsImageKRelyHap", + "actsserviceabilityarelyhap:ActsServiceAbilityARelyHap", + "actsserviceabilitybrelyhap:ActsServiceAbilityBRelyHap", + "actstextarelyhap:ActstextARelyHap", + "actstextbrelyhap:ActstextBRelyHap", + "actstextcrelyhap:ActstextCRelyHap", + "actstextdrelyhap:ActstextDRelyHap", + "actstexterelyhap:ActstextERelyHap", + "actstextfrelyhap:ActstextFRelyHap", + "actstextgrelyhap:ActstextGRelyHap", + "actstexthrelyhap:ActstextHRelyHap", + "actstextirelyhap:ActstextIRelyHap", + "actstextjrelyhap:ActstextJRelyHap", + "actstextkrelyhap:ActstextKRelyHap", + ] + } +} diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/AppScope/app.json b/ability/ability_runtime/actsappselector/actsappselectorpctest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..a393ee0a845dfaf49ef5623216dc0eff22aab6ac --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.appselectorpctest", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsappselectorpctest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..983cb0514901934e3003f407acba6c78fa97b868 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AppSelectorTest" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsappselectorpctest/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsappselectorpctest/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/BUILD.gn b/ability/ability_runtime/actsappselector/actsappselectorpctest/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..050f6a8c2fee394a874d5ef305b5b539d1cd98ec --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAppSelectorPCTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsappselectorpctest_js_assets", + ":actsappselectorpctest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAppSelectorPCTest" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsappselectorpctest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsappselectorpctest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsappselectorpctest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsappselectorpctest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/Test.json b/ability/ability_runtime/actsappselector/actsappselectorpctest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..2545f010722811a683933cd24bdc0d25db9a55c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/Test.json @@ -0,0 +1,65 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.appselectorpctest", + "module-name": "entry", + "shell-timeout": "600000", + "testcase-timeout":"100000" + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + "setenforce 0", + "power-shell setmode 602", + "param set persist.ace.testmode.enabled 1", + "hilog -Q pidoff", + "hilog -Q domainoff", + "hilog -b D" + ] + }, + { + "test-file-name": [ + "ActsAppSelectorPCTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "PushKit", + "push": [ + "ActsAppSelectorRelyHap.hap->/data/ActsAppSelectorRelyHap.hap", + "ActsServiceAbilityARelyHap.hap->/data/ActsServiceAbilityARelyHap.hap", + "ActsServiceAbilityBRelyHap.hap->/data/ActsServiceAbilityBRelyHap.hap", + "ActsImageAEntryRelyHap.hap->/data/ActsImageAEntryRelyHap.hap", + "ActsImageAFeatureRelyHap.hap->/data/ActsImageAFeatureRelyHap.hap", + "ActsImageBEntryRelyHap.hap->/data/ActsImageBEntryRelyHap.hap", + "ActsImageBFeatureRelyHap.hap->/data/ActsImageBFeatureRelyHap.hap", + "ActsImageCEntryRelyHap.hap->/data/ActsImageCEntryRelyHap.hap", + "ActsImageCFeatureRelyHap.hap->/data/ActsImageCFeatureRelyHap.hap", + "ActsImageDRelyHap.hap->/data/ActsImageDRelyHap.hap", + "ActsImageERelyHap.hap->/data/ActsImageERelyHap.hap", + "ActsImageFRelyHap.hap->/data/ActsImageFRelyHap.hap", + "ActsImageGRelyHap.hap->/data/ActsImageGRelyHap.hap", + "ActsImageHRelyHap.hap->/data/ActsImageHRelyHap.hap", + "ActsImageIRelyHap.hap->/data/ActsImageIRelyHap.hap", + "ActsImageJRelyHap.hap->/data/ActsImageJRelyHap.hap", + "ActsImageKRelyHap.hap->/data/ActsImageKRelyHap.hap", + "ActstextARelyHap.hap->/data/ActstextARelyHap.hap", + "ActstextBRelyHap.hap->/data/ActstextBRelyHap.hap", + "ActstextCRelyHap.hap->/data/ActstextCRelyHap.hap", + "ActstextDRelyHap.hap->/data/ActstextDRelyHap.hap", + "ActstextERelyHap.hap->/data/ActstextERelyHap.hap", + "ActstextFRelyHap.hap->/data/ActstextFRelyHap.hap", + "ActstextGRelyHap.hap->/data/ActstextGRelyHap.hap", + "ActstextHRelyHap.hap->/data/ActstextHRelyHap.hap", + "ActstextIRelyHap.hap->/data/ActstextIRelyHap.hap", + "ActstextJRelyHap.hap->/data/ActstextJRelyHap.hap", + "ActstextKRelyHap.hap->/data/ActstextKRelyHap.hap" + ] + } + ] +} + diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..41c2c986f8d126bc9fa12b16119184a13fca63d9 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + globalThis.abilityWant = want; + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } + +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..1b4c5782a516e02419cea30fcbeb81283cb3f2cd --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,72 @@ +/* + * 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' + ]) + 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 MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.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/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..1b6cdc6216cb015082cf70111d41384b3be07f0e --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/pages/index.ets @@ -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. + */ + @Entry +@Component +struct Index { + @State message: string = 'AppSelectorPC' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1ccd6043655e8f16aa8a0bcc7de5c98b7b849562 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,444 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import commonEvent from '@ohos.commonEvent' +import { BY, UiDriver, UiComponent, MatchPattern } from '@ohos.uitest' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined; +var driver; +var cmdInstall +var cmdUninstall; +var subscriberInfo = { + events: ['AppSelector'] +}; + +function sleep(time) { + return new Promise < void> ((resolve, reject) => { + setTimeout(() => { + resolve(); + }, time) + }) +} + +export default function abilityTest() { + describe('ActsAppSelectorPCTest', function () { + beforeAll(async (done) => { + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + driver = await UiDriver.create() + await sleep(2000); + done(); + }) + + afterEach(async (done) => { + abilityDelegator.executeShellCommand(cmdUninstall, + async (err: any, d: any) => { + console.log('ACTS_AppSelectorTest cmdUninstall executeShellCommand : err : ' + JSON.stringify(err)); + console.log('ACTS_AppSelectorTest cmdUninstall executeShellCommand : stdResult : ' + d.stdResult); + console.log('ACTS_AppSelectorTest cmdUninstall executeShellCommand : exitCode : ' + d.exitCode); + await sleep(4000); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1100 + * @tc.name: Install one image type matching app + * @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_1100', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1100 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActstextARelyHap.hap'; + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n textarelyhap.com.example"; + + console.log('ACTS_AppSelectorTest_1100 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.debug("ACTS_AppSelectorTest_1100 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_1100 startAbility end"); + }) + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_1100 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_1100 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_1100 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_1100 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_1100 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagearelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_1100 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1200 + * @tc.name: Install one image type matching app + * @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_1200', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1200 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + + 'bm install -p /data/ActstextARelyHap.hap'; + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" + + "bm uninstall -n textarelyhap.com.example"; + + console.log('ACTS_AppSelectorTest_1200 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + + console.debug("ACTS_AppSelectorTest_1200 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_1200 startAbility end"); + + commonEvent.subscribe(subscriber, SubscribeCallBack) + + await sleep(2000); + console.log("ACTS_AppSelectorTest_1200 findComponent"); + let button = await driver.findComponent(BY.text('imagearelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_1200 button " + JSON.stringify(button)); + await button.click(); + }) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_1200 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_1200 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_1200 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_1200 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_1200 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagearelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_1200 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1300 + * @tc.name: Install one image type matching app + * @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_1300', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1300 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + + 'bm install -p /data/ActsImageCEntryRelyHap.hap;bm install -p /data/ActsImageDRelyHap.hap;' + + 'bm install -p /data/ActstextARelyHap.hap'; + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" + + "bm uninstall -n imagecrelyhap;bm uninstall -n imagedrelyhap;" + + "bm uninstall -n textarelyhap.com.example" + + console.log('ACTS_AppSelectorTest_1300 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_1300 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_1300 startAbility end"); + + commonEvent.subscribe(subscriber, SubscribeCallBack) + + await sleep(2000); + console.log("ACTS_AppSelectorTest_1300 findComponent"); + let button = await driver.findComponent(BY.text('imagearelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_1300 button " + JSON.stringify(button)); + await button.click(); + }) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_1300 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_1300 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_1300 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_1300 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_1300 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagearelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_1300 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1400 + * @tc.name: Install one image type matching app + * @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_1400', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1400 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + + 'bm install -p /data/ActsImageCEntryRelyHap.hap;bm install -p /data/ActsImageDRelyHap.hap;' + + 'bm install -p /data/ActsImageERelyHap.hap;bm install -p /data/ActsImageGRelyHap.hap;' + + 'bm install -p /data/ActsImageHRelyHap.hap;bm install -p /data/ActsImageIRelyHap.hap;' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;bm uninstall -n imagecrelyhap;" + + "bm uninstall -n imagedrelyhap;bm uninstall -n imageerelyhap;bm uninstall -n imagegrelyhap;" + + "bm uninstall -n imagehrelyhap;bm uninstall -n imageirelyhap;" + + console.log('ACTS_AppSelectorTest_1400 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_1400 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_1400 startAbility end"); + + await sleep(2000); + let component = await driver.findComponent(BY.text("imagedrelyhap")) + let rectSerial = await component.getBounds() + component = await driver.findComponent(BY.text("imagearelyhap")) + let rectAlias = await component.getBounds() + console.log("ACTS_AppSelectorTest_1400 rectSerial " + JSON.stringify(rectSerial)); + console.log("ACTS_AppSelectorTest_1400 rectAlias " + JSON.stringify(rectAlias)); + + await driver.swipe(rectSerial.leftX, rectSerial.topY, rectAlias.leftX, rectAlias.topY) + await sleep(3000); + console.log("ACTS_AppSelectorTest_1400 findComponent"); + let button = await driver.findComponent(BY.text('imagegrelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_1400 button " + JSON.stringify(button)); + await button.click(); + commonEvent.subscribe(subscriber, SubscribeCallBack) + }) + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_1400 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_1400 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_1400 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_1400 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_1400 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagegrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_1400 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1500 + * @tc.name: Install one image type matching app + * @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_1500', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1500 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" + + console.log('ACTS_AppSelectorTest_1500 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_1500 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_1500 startAbility end"); + await sleep(2000); + commonEvent.subscribe(subscriber, SubscribeCallBack) + let component1 = await driver.findComponent(BY.text("使用以下方式打开")) + let text = await component1.getBounds() + console.log("ACTS_AppSelectorTest_1500 rectSerial " + JSON.stringify(text)); + + + let component2 = await driver.findComponent(BY.text("imagebrelyhap")) + let button = await component2.getBounds() + console.log("ACTS_AppSelectorTest_1500 rectSerial " + JSON.stringify(button)); + + await sleep(2000); + await driver.click(text.leftX, text.topY); + await sleep(2000); + await driver.click(button.leftX, button.topY); + }) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_1500 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_1500 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_1500 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_1500 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_1500 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility1"); + expect(data.parameters.bundleName).assertEqual("imagebrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_1500 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1600 + * @tc.name: Install one image type matching app + * @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_1600', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1600 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" + + console.log('ACTS_AppSelectorTest_1600 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_1600 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_1600 startAbility end"); + + await sleep(2000); + console.log("ACTS_AppSelectorTest_1600 findComponent"); + let button = await driver.findComponent(BY.text('取消').enabled(true)) + console.log("ACTS_AppSelectorTest_1600 button " + JSON.stringify(button)); + await button.click(); + + try { + await sleep(2000); + let close = await driver.findComponent(BY.text('取消').enabled(true)) + console.log("ACTS_AppSelectorTest_1600 close " + JSON.stringify(close)); + expect(close == null).assertTrue(); + done(); + } catch (err) { + console.debug("ACTS_AppSelectorTest_1600 catch err: " + JSON.stringify(err)); + console.debug("ACTS_AppSelectorTest_1600 catch err: " + err); + expect(err.code).assertEqual("INTERNAL_ERROR"); + done(); + } + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1700 + * @tc.name: Do not install matching apps + * @tc.desc: Do not install matching apps,"can't open this file" popup + */ + it('ACTS_AppSelectorTest_1700', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1700 --- start") + await sleep(2000); + cmdInstall = 'bm install -p /data/ActsImageJRelyHap.hap' + cmdUninstall = "bm uninstall -n imagejrelyhap"; + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_1700 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_1700 startAbility end"); + + try { + await sleep(2000); + console.log("ACTS_AppSelectorTest_1700 findComponent"); + let cantOpen1 = await driver.findComponent(BY.text('无法打开此文件').enabled(true)) + console.log("ACTS_AppSelectorTest_1700 cantOpen1 " + JSON.stringify(cantOpen1)); + expect(cantOpen1 != null).assertTrue(); + let button = await driver.findComponent(BY.text('知道了').enabled(true)) + console.debug("ACTS_AppSelectorTest_1700 button: " + JSON.stringify(button)) + await button.click(); + + await sleep(1000); + console.debug("ACTS_AppSelectorTest_1700 findComponent"); + let cantOpen2 = await driver.findComponent(BY.text('无法打开此文件').enabled(true)) + console.log("ACTS_AppSelectorTest_1700 cantOpen2 " + JSON.stringify(cantOpen2)); + expect(cantOpen2 == null).assertTrue(); + done(); + } catch (err) { + console.debug("ACTS_AppSelectorTest_1700 catch err: " + JSON.stringify(err)); + console.debug("ACTS_AppSelectorTest_1700 catch err: " + err); + expect(err.code).assertEqual("INTERNAL_ERROR"); + done(); + } + }) + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8828f3c461f6224c1f8532e6e299c7b1facc2824 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * 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 abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..d4759b77fa44488ac09e4ce59469ef7f0367c8f9 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2b8c72be1fb5a552cd53c1fbc08aec477819ea5a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "MainAbility2_desc", + "value": "description" + }, + { + "name": "MainAbility2_label", + "value": "label" + }, + { + "name": "MainAbility3_desc", + "value": "description" + }, + { + "name": "MainAbility3_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorpctest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorpctest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsappselectorpctest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsappselectorpctest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..8043b5a0cc673dddfa054f7bae0c8e555fc543ef --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.appselectorrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..62800de69e1b240ca8f3a77234cbb12682a38ad2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "actsstartrunnertest" + } + ] +} diff --git a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsappselectorrelyhap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..11839cba8c55a2f7ca8ea7a7df40860c5f37aa28 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/BUILD.gn @@ -0,0 +1,45 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsAppSelectorRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsAppSelectorRelyHap" + + testonly = true + deps = [ + ":actsappselectorrelyhap_js_assets", + ":actsappselectorrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsappselectorrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsappselectorrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsappselectorrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsappselectorrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..633ebb3f2e880b9c86212fd2c378d5e7a14feadc --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", 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") + globalThis.abilityContext = this.context; + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.log("ACTS_AppSelectorTest_3700 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..f65697aec97cd488048ce4ecc3917b541631c0eb --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/ets/pages/index.ets @@ -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. + */ + @Entry +@Component +struct Index { + @State message: string = 'Hello World1' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..d4759b77fa44488ac09e4ce59469ef7f0367c8f9 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2b8c72be1fb5a552cd53c1fbc08aec477819ea5a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "MainAbility2_desc", + "value": "description" + }, + { + "name": "MainAbility2_label", + "value": "label" + }, + { + "name": "MainAbility3_desc", + "value": "description" + }, + { + "name": "MainAbility3_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectorrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsappselectorrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/AppScope/app.json b/ability/ability_runtime/actsappselector/actsappselectortest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..6ebe8e35024953ae383bdef858249de07e5dce44 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.appselectortest", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsappselectortest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..983cb0514901934e3003f407acba6c78fa97b868 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AppSelectorTest" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsappselectortest/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/publish_test/activebtn/activebutton/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsappselectortest/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/BUILD.gn b/ability/ability_runtime/actsappselector/actsappselectortest/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..08278d994257a88b101bdf868ad26507726bc5fa --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAppSelectorTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":actsappselectortest_js_assets", + ":actsappselectortest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAppSelectorTest" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsappselectortest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsappselectortest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsappselectortest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsappselectortest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/Test.json b/ability/ability_runtime/actsappselector/actsappselectortest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..dcac3574879dbac24ab26e74088dd2305ebfc6b3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/Test.json @@ -0,0 +1,65 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.appselectortest", + "module-name": "entry", + "shell-timeout": "600000", + "testcase-timeout":"300000" + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + "setenforce 0", + "power-shell setmode 602", + "param set persist.ace.testmode.enabled 1", + "hilog -Q pidoff", + "hilog -Q domainoff", + "hilog -b D" + ] + }, + { + "test-file-name": [ + "ActsAppSelectorTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "PushKit", + "push": [ + "ActsAppSelectorRelyHap.hap->/data/ActsAppSelectorRelyHap.hap", + "ActsServiceAbilityARelyHap.hap->/data/ActsServiceAbilityARelyHap.hap", + "ActsServiceAbilityBRelyHap.hap->/data/ActsServiceAbilityBRelyHap.hap", + "ActsImageAEntryRelyHap.hap->/data/ActsImageAEntryRelyHap.hap", + "ActsImageAFeatureRelyHap.hap->/data/ActsImageAFeatureRelyHap.hap", + "ActsImageBEntryRelyHap.hap->/data/ActsImageBEntryRelyHap.hap", + "ActsImageBFeatureRelyHap.hap->/data/ActsImageBFeatureRelyHap.hap", + "ActsImageCEntryRelyHap.hap->/data/ActsImageCEntryRelyHap.hap", + "ActsImageCFeatureRelyHap.hap->/data/ActsImageCFeatureRelyHap.hap", + "ActsImageDRelyHap.hap->/data/ActsImageDRelyHap.hap", + "ActsImageERelyHap.hap->/data/ActsImageERelyHap.hap", + "ActsImageFRelyHap.hap->/data/ActsImageFRelyHap.hap", + "ActsImageGRelyHap.hap->/data/ActsImageGRelyHap.hap", + "ActsImageHRelyHap.hap->/data/ActsImageHRelyHap.hap", + "ActsImageIRelyHap.hap->/data/ActsImageIRelyHap.hap", + "ActsImageJRelyHap.hap->/data/ActsImageJRelyHap.hap", + "ActsImageKRelyHap.hap->/data/ActsImageKRelyHap.hap", + "ActstextARelyHap.hap->/data/ActstextARelyHap.hap", + "ActstextBRelyHap.hap->/data/ActstextBRelyHap.hap", + "ActstextCRelyHap.hap->/data/ActstextCRelyHap.hap", + "ActstextDRelyHap.hap->/data/ActstextDRelyHap.hap", + "ActstextERelyHap.hap->/data/ActstextERelyHap.hap", + "ActstextFRelyHap.hap->/data/ActstextFRelyHap.hap", + "ActstextGRelyHap.hap->/data/ActstextGRelyHap.hap", + "ActstextHRelyHap.hap->/data/ActstextHRelyHap.hap", + "ActstextIRelyHap.hap->/data/ActstextIRelyHap.hap", + "ActstextJRelyHap.hap->/data/ActstextJRelyHap.hap", + "ActstextKRelyHap.hap->/data/ActstextKRelyHap.hap" + ] + } + ] +} + diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c546e58c88a3a4ba91d9388cce5752a38cc4069b --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + globalThis.abilityWant = want; + globalThis.abilityContext = this.context; + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } + +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..1b4c5782a516e02419cea30fcbeb81283cb3f2cd --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,72 @@ +/* + * 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' + ]) + 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 MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.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/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b136fb5291be2733cdd073b53d6deecb33545f7c --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/pages/index.ets @@ -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. + */ +@Entry +@Component +struct Index { + @State message: string = 'AppSelector' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fa2c8ed3ad3af124347705258e21d3ec403ba7d6 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,1494 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import commonEvent from '@ohos.commonEvent' +import { BY, UiDriver, UiComponent, MatchPattern } from '@ohos.uitest' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined; +var driver; +var cmdInstall +var cmdUninstall; +var subscriberInfo = { + events: ['AppSelector'] +}; + +let paConnect = { + onConnect: function (elementName, proxy) { + console.info("AppSelector Service onConnect called."); + }, + onDisconnect: function (elementName) { + console.info("AppSelector Service onDisconnect"); + }, + onFailed: function (code) { + console.info("AppSelector Service onFailed"); + } +}; + +function sleep(time) { + return new Promise < void> ((resolve, reject) => { + setTimeout(() => { + resolve(); + }, time) + }) +} + + +export default function abilityTest() { + describe('ActsAppSelectorTest', function () { + beforeAll(async (done) => { + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + driver = await UiDriver.create() + await sleep(1000); + done(); + }) + + afterEach(async (done) => { + abilityDelegator.executeShellCommand(cmdUninstall, + async (err: any, d: any) => { + console.info('ACTS_AppSelectorTest cmdUninstall executeShellCommand : err : ' + JSON.stringify(err)); + console.info('ACTS_AppSelectorTest cmdUninstall executeShellCommand : data : ' + d.stdResult); + console.info('ACTS_AppSelectorTest cmdUninstall executeShellCommand : data : ' + d.exitCode); + await sleep(6000); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_3200 + * @tc.name: Multi-hap application with action and type configured in feature + * @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature + */ + it('ACTS_AppSelectorTest_3200', 0, async function (done) { + console.log("ACTS_AppSelectorTest_3200 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + + 'bm install -p /data/ActsImageJRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;bm uninstall -n imagejrelyhap" + + console.log('ACTS_AppSelectorTest_3200 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_3200 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_3200 startAbility end"); + + let component = await driver.findComponent(BY.text('imagearelyhap')) + let button = await component.getBounds() + console.log("ACTS_AppSelectorTest_3200 button " + JSON.stringify(button)); + + await sleep(1000); + globalThis.abilityContext.startAbility( + { + bundleName: "imagejrelyhap", + abilityName: "MainAbility", + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_3200 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_3200 startAbility end"); + + await sleep(5000); + commonEvent.subscribe(subscriber, SubscribeCallBack) + await driver.click(button.leftX, button.topY); + }) + }) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_3200 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_3200 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_3200 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_3200 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_3200 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagearelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_3200 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_0100 + * @tc.name: Install one image type matching app + * @tc.desc: Install one image type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_0100', 0, async function (done) { + console.log("ACTS_AppSelectorTest_0100 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageJRelyHap.hap;' + + 'bm install -p /data/ActstextARelyHap.hap'; + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagejrelyhap;" + + "bm uninstall -n textarelyhap.com.example"; + + console.log('ACTS_AppSelectorTest_0100 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.log("ACTS_AppSelectorTest_0100 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.log("ACTS_AppSelectorTest_0100 startAbility end"); + }) + + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_0100 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_0100 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_0100 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_0100 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_0100 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagearelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_0100 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_0200 + * @tc.name: Install one text type matching app + * @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_0200', 0, async function (done) { + console.log("ACTS_AppSelectorTest_0200 --- start") + cmdInstall = 'bm install -p /data/ActstextARelyHap.hap;bm install -p /data/ActstextJRelyHap.hap;' + + 'bm install -p /data/ActsImageAEntryRelyHap.hap '; + cmdUninstall = "bm uninstall -n textarelyhap.com.example;bm uninstall -n textjrelyhap.com.example;" + + "bm uninstall -n imagearelyhap"; + + console.log('ACTS_AppSelectorTest_0200 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "text/txt", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.debug("ACTS_AppSelectorTest_0200 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_0200 startAbility end"); + }) + + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_0200 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_0200 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_0200 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_0200 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_0200 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("com.example.entry.MainAbility"); + expect(data.parameters.bundleName).assertEqual("textarelyhap.com.example"); + expect(data.parameters.type).assertEqual("text/txt"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_0200 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_0300 + * @tc.name: Install one text type matching app + * @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_0300', 0, async function (done) { + console.log("ACTS_AppSelectorTest_0300 --- start") + let subscriber; + cmdInstall = 'bm install -p /data/ActstextARelyHap.hap;bm install -p /data/ActstextBRelyHap.hap;' + + 'bm install -p /data/ActstextJRelyHap.hap;bm install -p /data/ActsImageAEntryRelyHap.hap '; + cmdUninstall = "bm uninstall -n textarelyhap.com.example;bm uninstall -n textbrelyhap.com.example;" + + "bm uninstall -n textjrelyhap.com.example;bm uninstall -n imagearelyhap"; + + console.log('ACTS_AppSelectorTest_0300 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "text/txt", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_0300 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_0300 startAbility end"); + }) + await sleep(2000); + console.log("ACTS_AppSelectorTest_0300 findComponent"); + let button = await driver.findComponent(BY.text('textbrelyhap.com.example').enabled(true)) + console.log("ACTS_AppSelectorTest_0300 button " + JSON.stringify(button)); + subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + await button.click(); + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_0300 SubscribeCallBack'); + console.log('ACTS_AppSelectorTest_0300 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_0300 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_0300 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_0300 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_0300 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("com.example.entry.MainAbility"); + expect(data.parameters.bundleName).assertEqual("textbrelyhap.com.example"); + expect(data.parameters.type).assertEqual("text/txt"); + expect(data.parameters.uri).assertEqual("filePath"); + + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_0300 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_0400 + * @tc.name: Install one text type matching app + * @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_0400', 0, async function (done) { + console.log("ACTS_AppSelectorTest_0400 --- start") + let subscriber; + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + + 'bm install -p /data/ActsImageCEntryRelyHap.hap;bm install -p /data/ActsImageDRelyHap.hap;' + + 'bm install -p /data/ActsImageJRelyHap.hap;bm install -p /data/ActstextARelyHap.hap'; + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" + + "bm uninstall -n imagecrelyhap;bm uninstall -n imagedrelyhap;" + + "bm uninstall -n imagejrelyhap;bm uninstall -n textarelyhap.com.example" + + console.log('ACTS_AppSelectorTest_0400 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_0400 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_0400 startAbility end"); + + subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + await sleep(1000); + console.log("ACTS_AppSelectorTest_0400 findComponent"); + let button = await driver.findComponent(BY.text('imagebrelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_0400 button " + JSON.stringify(button)); + await button.click(); + }) + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_0400 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_0400 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_0400 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_0400 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_0400 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility1"); + expect(data.parameters.bundleName).assertEqual("imagebrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_0400 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_0500 + * @tc.name: Install one text type matching app + * @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_0500', 0, async function (done) { + console.log("ACTS_AppSelectorTest_0500 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + + 'bm install -p /data/ActsImageCEntryRelyHap.hap;bm install -p /data/ActsImageDRelyHap.hap;' + + 'bm install -p /data/ActsImageERelyHap.hap;bm install -p /data/ActsImageGRelyHap.hap;' + + 'bm install -p /data/ActsImageHRelyHap.hap;bm install -p /data/ActsImageIRelyHap.hap;' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;bm uninstall -n imagecrelyhap;" + + "bm uninstall -n imagedrelyhap;bm uninstall -n imageerelyhap;bm uninstall -n imagegrelyhap;" + + "bm uninstall -n imagehrelyhap;bm uninstall -n imageirelyhap;" + + console.log('ACTS_AppSelectorTest_0500 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_0500 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_0500 startAbility end"); + + commonEvent.subscribe(subscriber, SubscribeCallBack) + await sleep(1000); + console.log("ACTS_AppSelectorTest_0500 findComponent"); + let button = await driver.findComponent(BY.text('imagegrelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_0500 button " + JSON.stringify(button)); + await button.click(); + }) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_0500 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_0500 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_0500 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_0500 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_0500 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagegrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_0500 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_0600 + * @tc.name: Install one text type matching app + * @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_0600', 0, async function (done) { + console.log("ACTS_AppSelectorTest_0600 --- start") + cmdInstall = 'bm install -p /data/ActstextARelyHap.hap;bm install -p /data/ActstextBRelyHap.hap;' + + 'bm install -p /data/ActstextCRelyHap.hap;bm install -p /data/ActstextDRelyHap.hap;' + + 'bm install -p /data/ActstextERelyHap.hap;bm install -p /data/ActstextFRelyHap.hap;' + + 'bm install -p /data/ActstextGRelyHap.hap;bm install -p /data/ActstextHRelyHap.hap;' + + 'bm install -p /data/ActstextIRelyHap.hap;' + cmdUninstall = "bm uninstall -n textarelyhap.com.example;bm uninstall -n textbrelyhap.com.example;" + + "bm uninstall -n textcrelyhap.com.example;bm uninstall -n textdrelyhap.com.example;" + + "bm uninstall -n texterelyhap.com.example;bm uninstall -n textfrelyhap.com.example;" + + "bm uninstall -n textgrelyhap.com.example;bm uninstall -n texthrelyhap.com.example;" + + "bm uninstall -n textirelyhap.com.example;" + + console.log('ACTS_AppSelectorTest_0600 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "text/txt", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_0600 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_0600 startAbility end"); + + commonEvent.subscribe(subscriber, SubscribeCallBack) + await sleep(2000); + let component = await driver.findComponent(BY.text("texthrelyhap.com.example")) + let rectSerial = await component.getBounds() + component = await driver.findComponent(BY.text("texterelyhap.com.example")) + let rectAlias = await component.getBounds() + console.log("ACTS_AppSelectorTest_0600 rectSerial " + JSON.stringify(rectSerial)); + console.log("ACTS_AppSelectorTest_0600 rectAlias " + JSON.stringify(rectAlias)); + + await driver.swipe(rectSerial.leftX, rectSerial.topY, rectAlias.leftX, rectAlias.topY) + console.log("ACTS_AppSelectorTest_0600 findComponent"); + let button = await driver.findComponent(BY.text('textirelyhap.com.example').enabled(true)) + console.log("ACTS_AppSelectorTest_0600 button " + JSON.stringify(button)); + await button.click(); + }) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_0600 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_0600 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_0600 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_0600 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_0600 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("com.example.entry.MainAbility"); + expect(data.parameters.bundleName).assertEqual("textirelyhap.com.example"); + expect(data.parameters.type).assertEqual("text/txt"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_0600 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_0700 + * @tc.name: Install one text type matching app + * @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_0700', 0, async function (done) { + console.log("ACTS_AppSelectorTest_0700 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" + + console.log('ACTS_AppSelectorTest_0700 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_0700 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_0700 startAbility end"); + await sleep(2000); + let button = await driver.findComponent(BY.text('imagebrelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_0700 button " + JSON.stringify(button)); + let component = await driver.findComponent(BY.text("使用以下方式打开")) + let rectSerial = await component.getBounds() + console.log("ACTS_AppSelectorTest_0700 rectSerial " + JSON.stringify(rectSerial)); + await driver.click(rectSerial.leftX, rectSerial.topY); + await sleep(2000); + console.log("ACTS_AppSelectorTest_0700 findComponent"); + + await button.click(); + commonEvent.subscribe(subscriber, SubscribeCallBack) + }) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_0700 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_0700 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_0700 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_0700 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_0700 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility1"); + expect(data.parameters.bundleName).assertEqual("imagebrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_0700 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_0800 + * @tc.name: Install one text type matching app + * @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_0800', 0, async function (done) { + console.log("ACTS_AppSelectorTest_0800 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" + + console.log('ACTS_AppSelectorTest_0800 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_0800 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_0800 startAbility end"); + await sleep(2000); + console.log("ACTS_AppSelectorTest_0800 findComponent"); + let button = await driver.findComponent(BY.text('取消').enabled(true)) + console.log("ACTS_AppSelectorTest_0800 button " + JSON.stringify(button)); + await button.click(); + done(); + + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_0900 + * @tc.name: Install one text type matching app + * @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_0900', 0, async function (done) { + console.log("ACTS_AppSelectorTest_0900 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + + 'bm install -p /data/ActstextARelyHap.hap;bm install -p /data/ActstextBRelyHap.hap;' + + 'bm install -p /data/ActsServiceAbilityARelyHap.hap;' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" + + "bm uninstall -n textarelyhap.com.example;bm uninstall -n textbrelyhap.com.example;" + + "bm uninstall -n aserviceabilityrelyhap;" + + console.log('ACTS_AppSelectorTest_0900 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + + console.info("ACTS_AppSelectorTest_0900 Service servStart"); + let connectionId; + let want = { + "bundleName": "aserviceabilityrelyhap", + "abilityName": "ServiceAbility" + }; + + connectionId = globalThis.abilityContext.connectAbility(want, paConnect) + console.info('ACTS_AppSelectorTest_0900 Service connectionId ' + connectionId); + + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + await sleep(2000); + console.log("ACTS_AppSelectorTest_0900 findComponent"); + let button = await driver.findComponent(BY.text('textbrelyhap.com.example').enabled(true)) + console.log("ACTS_AppSelectorTest_0900 button " + JSON.stringify(button)); + await button.click(); + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_0900 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_0900 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_0900 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_0900 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_0900 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("com.example.entry.MainAbility"); + expect(data.parameters.bundleName).assertEqual("textbrelyhap.com.example"); + expect(data.parameters.type).assertEqual("text/txt"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_0900 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1000 + * @tc.name: Install one text type matching app + * @tc.desc: Install one text type matching app,no application selection box pops up, the app is pulled up + */ + it('ACTS_AppSelectorTest_1000', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1000 --- start") + cmdInstall = 'bm install -p /data/ActstextARelyHap.hap;bm install -p /data/ActstextBRelyHap.hap;' + cmdUninstall = "bm uninstall -n textarelyhap.com.example;bm uninstall -n textbrelyhap.com.example;" + + console.log('ACTS_AppSelectorTest_1000 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbilityForResult( + { + action: "ohos.want.action.viewData", + type: "text/txt", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.log("ACTS_AppSelectorTest_1000 startAbilityForResult " + + JSON.stringify(error) + "," + JSON.stringify(data)); + }) + await sleep(2000); + console.log("ACTS_AppSelectorTest_1000 findComponent"); + let button = await driver.findComponent(BY.text('textbrelyhap.com.example').enabled(true)) + console.log("ACTS_AppSelectorTest_1000 button " + JSON.stringify(button)); + await button.click(); + commonEvent.subscribe(subscriber, SubscribeCallBack) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_1000 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_1000 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_1000 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_1000 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_1000 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("com.example.entry.MainAbility"); + expect(data.parameters.bundleName).assertEqual("textbrelyhap.com.example"); + expect(data.parameters.type).assertEqual("text/txt"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + async function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_1000 UnSubscribeCallBack"); + try { + let close = await driver.findComponent(BY.text('取消').enabled(true)) + console.log("ACTS_AppSelectorTest_1000 cantOpen2 " + JSON.stringify(close)); + expect(close == null).assertTrue(); + done(); + } catch (err) { + console.debug("ACTS_AppSelectorTest_1000 catch err: " + JSON.stringify(err)); + console.debug("ACTS_AppSelectorTest_1000 catch err: " + err); + expect("").assertFail(); + done(); + } + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1800 + * @tc.name: Install action matches but type does not match app + * @tc.desc: Install action matches but type does not match app,"can't open this file" popup + */ + it('ACTS_AppSelectorTest_1800', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1800 --- start") + cmdInstall = 'bm install -p /data/ActstextARelyHap.hap' + cmdUninstall = "bm uninstall -n textarelyhap.com.example" + + console.log('ACTS_AppSelectorTest_1800 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_1800 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_1800 startAbility end"); + + + await sleep(2000); + console.log("ACTS_AppSelectorTest_1800 findComponent"); + let cantOpen1 = await driver.findComponent(BY.text('无法打开此文件').enabled(true)) + console.log("ACTS_AppSelectorTest_1800 cantOpen1 " + JSON.stringify(cantOpen1)); + expect(cantOpen1 != null).assertTrue(); + let button = await driver.findComponent(BY.text('知道了').enabled(true)) + console.debug("ACTS_ANROptimization_1800 button: " + JSON.stringify(button)) + await button.click(); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_1900 + * @tc.name: Install action does not match but type matches app + * @tc.desc: Install action does not match but type matches app,"can't open this file" popup + */ + it('ACTS_AppSelectorTest_1900', 0, async function (done) { + console.log("ACTS_AppSelectorTest_1900 --- start") + cmdInstall = 'bm install -p /data/ActstextKRelyHap.hap' + cmdUninstall = "bm uninstall -n textkrelyhap.com.example" + + console.log('ACTS_AppSelectorTest_1900 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "text/txt", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_1900 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_1900 startAbility end"); + await sleep(2000); + console.log("ACTS_AppSelectorTest_1900 findComponent"); + let cantOpen1 = await driver.findComponent(BY.text('无法打开此文件').enabled(true)) + console.log("ACTS_AppSelectorTest_1900 cantOpen1 " + JSON.stringify(cantOpen1)); + expect(cantOpen1 != null).assertTrue(); + let button = await driver.findComponent(BY.text('知道了').enabled(true)) + console.debug("ACTS_AppSelectorTest_1900 button: " + JSON.stringify(button)) + await button.click(); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_2000 + * @tc.name: Implicitly start the interface action and pass in an empty string + * @tc.desc: Implicitly start the interface action and pass in an empty string,return success + */ + it('ACTS_AppSelectorTest_2000', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2000 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap" + + console.log('ACTS_AppSelectorTest_2000 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + globalThis.abilityContext.startAbility( + { + action: "", + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.log("ACTS_AppSelectorTest_2000 startAbility " + JSON.stringify(error)); + expect(error.code).assertEqual(0); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_2100 + * @tc.name: Implicitly start the interface action and pass in null + * @tc.desc: Implicitly start the interface action and pass in null,return failure + */ + it('ACTS_AppSelectorTest_2100', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2100 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap" + + console.log('ACTS_AppSelectorTest_2100 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + globalThis.abilityContext.startAbility( + { + action: null, + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.log("ACTS_AppSelectorTest_2100 startAbility " + JSON.stringify(error)); + expect(error.code).assertEqual(0); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelector_2200 + * @tc.name: Implicitly start the interface action and pass in undefined + * @tc.desc: Implicitly start the interface action and pass in undefined,return success + */ + it('ACTS_AppSelectorTest_2200', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2200 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap" + + console.log('ACTS_AppSelectorTest_2200 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: undefined, + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.log("ACTS_AppSelectorTest_2200 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + expect(error.code).assertEqual(0); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_2300 + * @tc.name: Implicitly start the interface type and pass in an empty string + * @tc.desc: Implicitly start the interface type and pass in an empty string,return failure + */ + it('ACTS_AppSelectorTest_2300', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2300 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap" + + console.log('ACTS_AppSelectorTest_2300 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.log("ACTS_AppSelectorTest_2300 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + expect(error.code).assertEqual(1); + await sleep(2000); + let button = await driver.findComponent(BY.text('知道了').enabled(true)) + console.debug("ACTS_AppSelectorTest_2300 button: " + JSON.stringify(button)) + console.debug("ACTS_AppSelectorTest_2300 click"); + await button.click(); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_2400 + * @tc.name: Implicitly start the interface type and pass in null + * @tc.desc: Implicitly start the interface type and pass in null,return failure + */ + it('ACTS_AppSelectorTest_2400', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2400 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap" + + console.log('ACTS_AppSelectorTest_2400 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: null, + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.log("ACTS_AppSelectorTest_2400 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + expect(error.code).assertEqual(1); + await sleep(2000); + let button = await driver.findComponent(BY.text('知道了').enabled(true)) + console.debug("ACTS_AppSelectorTest_2400 button: " + JSON.stringify(button)) + console.debug("ACTS_AppSelectorTest_2400 click"); + await button.click(); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_2500 + * @tc.name: Implicitly start the interface type and pass in undefined + * @tc.desc: Implicitly start the interface type and pass in undefined,return failure + */ + it('ACTS_AppSelectorTest_2500', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2500 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap" + + console.log('ACTS_AppSelectorTest_2500 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: undefined, + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.log("ACTS_AppSelectorTest_2500 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + expect(error.code).assertEqual(1); + await sleep(2000); + let button = await driver.findComponent(BY.text('知道了').enabled(true)) + console.debug("ACTS_AppSelectorTest_2500 button: " + JSON.stringify(button)) + console.debug("ACTS_AppSelectorTest_2500 click"); + await button.click(); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_2600 + * @tc.name: Multi-hap application with action and type configured in entry + * @tc.desc: Multi-hap application with action and type configured in entry,MainAbility is pulled up in entry + */ + it('ACTS_AppSelectorTest_2600', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2600 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageAFeatureRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap" + + console.log('ACTS_AppSelectorTest_2600 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.debug("ACTS_AppSelectorTest_2600 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_2600 startAbility end"); + }) + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_2600 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_2600 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_2600 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_2600 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_2600 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagearelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_2600 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_2700 + * @tc.name: Multi-hap application with action and type configured in feature + * @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature + */ + it('ACTS_AppSelectorTest_2700', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2700 --- start") + cmdInstall = 'bm install -p /data/ActsImageBFeatureRelyHap.hap;bm install -p /data/ActsImageBEntryRelyHap.hap' + cmdUninstall = "bm uninstall -n imagebrelyhap" + + console.log('ACTS_AppSelectorTest_2700 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.debug("ACTS_AppSelectorTest_2700 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_2700 startAbility end"); + }) + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_2700 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_2700 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_2700 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_2700 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_2700 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility1"); + expect(data.parameters.bundleName).assertEqual("imagebrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_2700 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_2800 + * @tc.name: Multi-hap application with action and type configured in feature + * @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature + */ + it('ACTS_AppSelectorTest_2800', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2800 --- start") + cmdInstall = 'bm install -p /data/ActsImageCEntryRelyHap.hap;bm install -p /data/ActsImageCFeatureRelyHap.hap' + cmdUninstall = "bm uninstall -n imagecrelyhap" + + console.log('ACTS_AppSelectorTest_2800 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_2800 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_2800 startAbility end"); + await sleep(2000); + console.log("ACTS_AppSelectorTest_2800 findComponent"); + let button = await driver.findComponent(BY.text('imagecrelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_2800 button " + JSON.stringify(button)); + await button.click(); + commonEvent.subscribe(subscriber, SubscribeCallBack) + }) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_2800 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_2800 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_2800 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_2800 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_2800 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagecrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_2800 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_2900 + * @tc.name: MainAbility configures multi-ability applications of actions and types + * @tc.desc: MainAbility configures multi-ability applications of actions and types,mainAbility is pulled up + */ + it('ACTS_AppSelectorTest_2900', 0, async function (done) { + console.log("ACTS_AppSelectorTest_2900 --- start") + cmdInstall = 'bm install -p /data/ActsImageDRelyHap.hap' + cmdUninstall = "bm uninstall -n imagedrelyhap" + + console.log('ACTS_AppSelectorTest_2900 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.debug("ACTS_AppSelectorTest_2900 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_2900 startAbility end"); + }) + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_2900 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_2900 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_2900 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_2900 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_2900 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagedrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_2900 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_3000 + * @tc.name: SecondAbility configures multi-ability applications of actions and types + * @tc.desc: SecondAbility configures multi-ability applications of actions and types,secondAbility is pulled up + */ + it('ACTS_AppSelectorTest_3000', 0, async function (done) { + console.log("ACTS_AppSelectorTest_3000 --- start") + cmdInstall = 'bm install -p /data/ActsImageERelyHap.hap' + cmdUninstall = "bm uninstall -n imageerelyhap" + + console.log('ACTS_AppSelectorTest_3000 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.debug("ACTS_AppSelectorTest_3000 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_3000 startAbility end"); + }) + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_3000 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_3000 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_3000 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_3000 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_3000 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("SecondAbility"); + expect(data.parameters.bundleName).assertEqual("imageerelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_3000 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_3100 + * @tc.name: Multi-hap application with action and type configured in feature + * @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature + */ + it('ACTS_AppSelectorTest_3100', 0, async function (done) { + console.log("ACTS_AppSelectorTest_3100 --- start") + cmdInstall = 'bm install -p /data/ActsImageFRelyHap.hap' + cmdUninstall = "bm uninstall -n imagefrelyhap" + + console.log('ACTS_AppSelectorTest_3100 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.debug("ACTS_AppSelectorTest_3100 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.debug("ACTS_AppSelectorTest_3100 startAbility end"); + await sleep(2000); + console.log("ACTS_AppSelectorTest_3100 findComponent"); + let button = await driver.findComponent(BY.text('imagefrelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_3100 button " + JSON.stringify(button)); + await button.click(); + commonEvent.subscribe(subscriber, SubscribeCallBack) + }) + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_3100 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_3100 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_3100 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_3100 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_3100 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagefrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_3100 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_3400 + * @tc.name: Multi-hap application with action and type configured in feature + * @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature + */ + it('ACTS_AppSelectorTest_3400', 0, async function (done) { + console.log("ACTS_AppSelectorTest_3400 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap" + + console.log('ACTS_AppSelectorTest_3400 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + globalThis.abilityContext.startAbilityWithAccount( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, 100, (error, data) => { + console.log("ACTS_AppSelectorManual startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + }) + await sleep(2000); + console.log("ACTS_AppSelectorTest_3400 findComponent"); + let button = await driver.findComponent(BY.text('imagearelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_3400 button " + JSON.stringify(button)); + await button.click(); + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_3400 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_3400 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_3400 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_3400 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_3400 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagearelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_3400 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_3500 + * @tc.name: Multi-hap application with action and type configured in feature + * @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature + */ + it('ACTS_AppSelectorTest_3500', 0, async function (done) { + console.log("ACTS_AppSelectorTest_3500 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap" + + console.log('ACTS_AppSelectorTest_3500 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + globalThis.abilityContext.startAbilityForResultWithAccount( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, 100, (error, data) => { + console.log("ACTS_AppSelectorManual startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + }) + await sleep(2000); + console.log("ACTS_AppSelectorTest_3500 findComponent"); + let button = await driver.findComponent(BY.text('imagebrelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_3500 button " + JSON.stringify(button)); + await button.click(); + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_3500 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_3500 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_3500 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_3500 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_3500 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility1"); + expect(data.parameters.bundleName).assertEqual("imagebrelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_3500 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_3600 + * @tc.name: Multi-hap application with action and type configured in feature + * @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature + */ + it('ACTS_AppSelectorTest_3600', 0, async function (done) { + console.log("ACTS_AppSelectorTest_3600 --- start") + cmdInstall = 'bm install -p /data/ActsServiceAbilityBRelyHap.hap;bm install -p /data/ActsImageKRelyHap.hap' + cmdUninstall = "bm uninstall -n bserviceabilityrelyhap;bm uninstall -n imagekrelyhap" + + console.log('ACTS_AppSelectorTest_3600 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + let subscriber = await commonEvent.createSubscriber(subscriberInfo); + commonEvent.subscribe(subscriber, SubscribeCallBack) + console.log("ACTS_AppSelectorTest_3600 connectservice") + + let connectionId; + let want = { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + }, + }; + + connectionId = globalThis.abilityContext.connectAbility(want, paConnect) + console.info('ACTS_AppSelectorTest_3600 Service connectionId ' + connectionId); + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_3600 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_3600 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_3600 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_3600 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_3600 event = ' + data.event); + console.log('ACTS_AppSelectorTest_3600 startByService = ' + data.parameters.startByService); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.startByService).assertEqual(true); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + } + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_3600 UnSubscribeCallBack"); + done(); + } + }) + + /* + * @tc.number: ACTS_AppSelectorTest_3700 + * @tc.name: Multi-hap application with action and type configured in feature + * @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature + */ + it('ACTS_AppSelectorTest_3700', 0, async function (done) { + console.log("ACTS_AppSelectorTest_3700 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap;' + + 'bm install -p /data/ActsAppSelectorRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap;" + + "bm uninstall -n com.example.appselectorrelyhap" + + console.log('ACTS_AppSelectorTest_3700 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(1000); + globalThis.abilityContext.startAbility( + { + bundleName: "com.example.appselectorrelyhap", + abilityName: "MainAbility", + }, (error, data) => { + console.log("ACTS_AppSelectorTest_3700 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + }) + await sleep(2000); + let component = await driver.findComponent(BY.text('imagearelyhap')) + let button = await component.getBounds() + console.log("ACTS_AppSelectorTest_3700 button " + JSON.stringify(button)); + + var cmd = 'bm uninstall -n com.example.appselectorrelyhap '; + console.log('ACTS_AppSelectorTest_3700 cmd = ' + cmd); + abilityDelegator.executeShellCommand(cmd, + async (err: any, d: any) => { + console.info('ACTS_AppSelectorTest_3700 executeShellCommand : err : ' + JSON.stringify(err)); + console.info('ACTS_AppSelectorTest_3700 executeShellCommand : stdResult : ' + d.stdResult); + console.info('ACTS_AppSelectorTest_3700 executeShellCommand : exitCode : ' + d.exitCode); + await sleep(2000); + await driver.click(button.leftX, button.topY); + done(); + }) + }) + + /* + * @tc.number: ACTS_AppSelectorTest_3300 + * @tc.name: Multi-hap application with action and type configured in feature + * @tc.desc: Multi-hap application with action and type configured in feature,mainAbility is pulled up in feature + */ + it('ACTS_AppSelectorTest_3300', 0, async function (done) { + console.log("ACTS_AppSelectorTest_3300 --- start") + cmdInstall = 'bm install -p /data/ActsImageAEntryRelyHap.hap;bm install -p /data/ActsImageBFeatureRelyHap.hap' + cmdUninstall = "bm uninstall -n imagearelyhap;bm uninstall -n imagebrelyhap" + let subscriber; + console.log('ACTS_AppSelectorTest_3300 cmd = ' + cmdInstall); + await abilityDelegator.executeShellCommand(cmdInstall); + await sleep(2000); + + for (var i = 0; i < 10; i++) { + await sleep(2000); + subscriber = await commonEvent.createSubscriber(subscriberInfo); + globalThis.abilityContext.startAbility( + { + action: "ohos.want.action.viewData", + type: "image/png", + parameters: { + uri: "filePath" + } + }, async (error, data) => { + console.log("ACTS_AppSelectorTest_3300 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + }) + + commonEvent.subscribe(subscriber, SubscribeCallBack); + await sleep(3000); + console.log("ACTS_AppSelectorTest_3300 findComponent"); + let button = await driver.findComponent(BY.text('imagearelyhap').enabled(true)) + console.log("ACTS_AppSelectorTest_3300 button " + JSON.stringify(button)); + await button.click(); + + async function SubscribeCallBack(err, data) { + console.log('ACTS_AppSelectorTest_3300 bundleName = ' + data.parameters.bundleName); + console.log('ACTS_AppSelectorTest_3300 abilityName = ' + data.parameters.abilityName); + console.log('ACTS_AppSelectorTest_3300 type = ' + data.parameters.type); + console.log('ACTS_AppSelectorTest_3300 uri = ' + data.parameters.uri); + console.log('ACTS_AppSelectorTest_3300 event = ' + data.event); + expect(data.event).assertEqual("AppSelector"); + expect(data.parameters.abilityName).assertEqual("MainAbility"); + expect(data.parameters.bundleName).assertEqual("imagearelyhap"); + expect(data.parameters.type).assertEqual("image/png"); + expect(data.parameters.uri).assertEqual("filePath"); + } + } + await sleep(2000); + commonEvent.unsubscribe(subscriber, UnSubscribeCallBack) + + function UnSubscribeCallBack() { + console.log("ACTS_AppSelectorTest_3300 UnSubscribeCallBack"); + done(); + } + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8828f3c461f6224c1f8532e6e299c7b1facc2824 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * 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 abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..63433eb8d6b9487794cb12a568e2b0f733abdad3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/module.json @@ -0,0 +1,36 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..a042229a98e83f0fecd6510b9240aa0e6b18e3d6 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "AppSelectorTest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsappselectortest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsappselectortest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsappselectortest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsappselectortest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..acb9d83ec9c7c15b36d1656d0f67135832ee207d --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagearelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f5a41012f62766f497f607db33d0a34c69f32dd3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageARelyHap" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimageaentryrelyhap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..d82bab124d4f2306b6fa81810fdf3b75924453bd --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/BUILD.gn @@ -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. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsImageAEntryRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageAEntryRelyHap" + + testonly = true + deps = [ + ":actsimageaentryrelyhap_js_assets", + ":actsimageaentryrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimageaentryrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimageaentryrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimageaentryrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimageaentryrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..76c42708a682982115e9e63459c1e5157eaefe59 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", 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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b821e0762b0ce1f49b14c6af2d2ef24927e5ec39 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageAEntryRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..9f0588e2b01de5e7be32dfad152eee0c3097c594 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..dddf9123aec0b6c9500eeacf289ac1bc58ff7a6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimageaentryrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..acb9d83ec9c7c15b36d1656d0f67135832ee207d --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagearelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f5a41012f62766f497f607db33d0a34c69f32dd3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageARelyHap" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/publish_test/actsansdistributedtest/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..f7f1783bffade24d6d73f90b6000de457e6bcf1b --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/BUILD.gn @@ -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. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsImageAFeatureRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageAFeatureRelyHap" + + testonly = true + deps = [ + ":actsimageafeaturerelyhap_js_assets", + ":actsimageafeaturerelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimageafeaturerelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimageafeaturerelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimageafeaturerelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimageafeaturerelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/ets/MainAbility1/MainAbility1.ts b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/ets/MainAbility1/MainAbility1.ts new file mode 100644 index 0000000000000000000000000000000000000000..76c42708a682982115e9e63459c1e5157eaefe59 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/ets/MainAbility1/MainAbility1.ts @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", 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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..5156aee2af84b888660cd3cc28d333098c0ded6e --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageAFeatureRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..cdf0c7dd43e3f837aa98eef7aaca99a153efe00f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "feature", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:feature_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility1", + "srcEntrance": "./ets/MainAbility1/MainAbility1.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..4d1ba2b5ec9e5f5215bbb05f4b2eda6660424843 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "feature_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsansgetallactive/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/actsansgetallactive/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimageafeaturerelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..3756872988b7a78687c16d798c72fb8048659288 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagebrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2a5a20b619bd79751438a2ca9f2ab3e9392745b9 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageBRelyHap" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagebentryrelyhap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..2944cbcf208f0496714a2f69a5c2f906d3fcecf4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/BUILD.gn @@ -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. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsImageBEntryRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageBEntryRelyHap" + + testonly = true + deps = [ + ":actsimagebentryrelyhap_js_assets", + ":actsimagebentryrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagebentryrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagebentryrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagebentryrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagebentryrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c96f3dd3cedffdd357d535fb84eb81e5cf7a4341 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", 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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagebrelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>ACTS_AppSelectorTest imagebrelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9b0661e21deae5ad7dd4088becd0c8259a2747ce --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageBEntryRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..d4759b77fa44488ac09e4ce59469ef7f0367c8f9 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..dddf9123aec0b6c9500eeacf289ac1bc58ff7a6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/actsanspublishconversation/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagebentryrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..3756872988b7a78687c16d798c72fb8048659288 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagebrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2a5a20b619bd79751438a2ca9f2ab3e9392745b9 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageBRelyHap" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/publish_test/ansactscancelgroup/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..6708e0097b9e78a250def0dc9c5f674b506ce953 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/BUILD.gn @@ -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. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsImageBFeatureRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageBFeatureRelyHap" + + testonly = true + deps = [ + ":actsimagebfeaturerelyhap_js_assets", + ":actsimagebfeaturerelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagebfeaturerelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagebfeaturerelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagebfeaturerelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagebfeaturerelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/ets/MainAbility1/MainAbility1.ts b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/ets/MainAbility1/MainAbility1.ts new file mode 100644 index 0000000000000000000000000000000000000000..c96f3dd3cedffdd357d535fb84eb81e5cf7a4341 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/ets/MainAbility1/MainAbility1.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", 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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagebrelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>ACTS_AppSelectorTest imagebrelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..a674f001c62661447573261aa7bd2c9841b2f675 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageBFeatureRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..9c5991c31d2ebedc37f3df222ee647e4e17ce60f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "feature", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:feature_desc", + "mainElement": "MainAbility1", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility1", + "srcEntrance": "./ets/MainAbility1/MainAbility1.ts", + "description": "$string:MainAbility1_desc", + "icon": "$media:icon", + "label": "$string:MainAbility1_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f9bf22447345a31bb6c59261fb1e4408ee9ed80f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "feature_desc", + "value": "description" + }, + { + "name": "MainAbility1_desc", + "value": "description" + }, + { + "name": "MainAbility1_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/ansactsremovegroup/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagebfeaturerelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..03c6abdacceab3ebe42a6b273981630443234a12 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagecrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c9a066960309d4f715524a76b860f773d69204d5 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageCRelyHap" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagecentryrelyhap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..6223a6db9574fb6559dff36ce8c41f62fd1f4e27 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/BUILD.gn @@ -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. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsImageCEntryRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageCEntryRelyHap" + + testonly = true + deps = [ + ":actsimagecentryrelyhap_js_assets", + ":actsimagecentryrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagecentryrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagecentryrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagecentryrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagecentryrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c082a6aec43c79c11fc4377e3c9c8cb5b92c7186 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", 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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..7290324cec34b10c9c16b1627996902c767b61a3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageCEntryRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..9f0588e2b01de5e7be32dfad152eee0c3097c594 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..dddf9123aec0b6c9500eeacf289ac1bc58ff7a6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagecentryrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..03c6abdacceab3ebe42a6b273981630443234a12 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagecrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c9a066960309d4f715524a76b860f773d69204d5 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageCRelyHap" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/donotdisturbmode/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/publish_test/donotdisturbmode/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..439aed5911aca9909a6db1f2dc8fd3393df2d15d --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/BUILD.gn @@ -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. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsImageCFeatureRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageCFeatureRelyHap" + + testonly = true + deps = [ + ":actsimagecfeaturerelyhap_js_assets", + ":actsimagecfeaturerelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagecfeaturerelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagecfeaturerelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagecfeaturerelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagecfeaturerelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/ets/MainAbility1/MainAbility1.ts b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/ets/MainAbility1/MainAbility1.ts new file mode 100644 index 0000000000000000000000000000000000000000..c082a6aec43c79c11fc4377e3c9c8cb5b92c7186 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/ets/MainAbility1/MainAbility1.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", 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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b23af53b55141998878348ccef5af0069dea1651 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageCFeatureRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..9c5991c31d2ebedc37f3df222ee647e4e17ce60f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "feature", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:feature_desc", + "mainElement": "MainAbility1", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility1", + "srcEntrance": "./ets/MainAbility1/MainAbility1.ts", + "description": "$string:MainAbility1_desc", + "icon": "$media:icon", + "label": "$string:MainAbility1_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f9bf22447345a31bb6c59261fb1e4408ee9ed80f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "feature_desc", + "value": "description" + }, + { + "name": "MainAbility1_desc", + "value": "description" + }, + { + "name": "MainAbility1_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagecfeaturerelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagedrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..da43eefaab4029493a13cac52cf45bb6ec81a03f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagedrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagedrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..31f2f8582d9dc30cae94c460cddeb40c4b6f48e3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageDRelyHap" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagedrelyhap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagedrelyhap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagedrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..8dcad72e371dbc361565edc3e0a787e84bc7ec6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/BUILD.gn @@ -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. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsImageDRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageDRelyHap" + + testonly = true + deps = [ + ":actsimagedrelyhap_js_assets", + ":actsimagedrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagedrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagedrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagedrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagedrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c082a6aec43c79c11fc4377e3c9c8cb5b92c7186 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", 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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..8b0e4d5690e998c9672c7ff9cab09a0dadfe596a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class SecondAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", 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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..13ab1f39b0dd02c4b7c0cbc1faed42c67b9df424 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageDRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..813610967ecfbd698d1bbf0bc8b4d29c18904262 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/module.json @@ -0,0 +1,57 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + }, + { + "name": "SecondAbility", + "srcEntrance": "./ets/SecondAbility/SecondAbility.ts", + "description": "$string:SecondAbility_desc", + "icon": "$media:icon", + "label": "$string:SecondAbility_label", + "visible": true, + "skills": [ + { + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..61009f0568889992994409f98d5fe3964976a381 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "SecondAbility_desc", + "value": "description" + }, + { + "name": "SecondAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagedrelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagedrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagedrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagedrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimageerelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..4489cddd78fca4c8d9fffc8be1222295a239c01e --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imageerelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimageerelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0878ae980505e0a7d84fe04f75e4321b45cc47aa --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageERelyHap" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimageerelyhap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimageerelyhap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimageerelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..d15a05756ae5a2c90cff97bcdc11aabc0fa39330 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/BUILD.gn @@ -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. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsImageERelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageERelyHap" + + testonly = true + deps = [ + ":actsimageerelyhap_js_assets", + ":actsimageerelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimageerelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimageerelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimageerelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimageerelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c082a6aec43c79c11fc4377e3c9c8cb5b92c7186 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", 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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..650c7d6d0ac41b1f69e0973cfe540e36cb723481 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class SecondAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] SecondAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] SecondAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] SecondAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] SecondAbility onWindowStageDestroy") + + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] SecondAbility onForeground") + console.log("[Demo] SecondAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imageerelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imageerelyhap SecondAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] SecondAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..2bf5dfc120e669e90836f59e59f15aec8c7e2492 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageERelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..08f74bf6254b16c01eeee6416d6958022d828e1c --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/module.json @@ -0,0 +1,57 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + }, + { + "name": "SecondAbility", + "srcEntrance": "./ets/SecondAbility/SecondAbility.ts", + "description": "$string:SecondAbility_desc", + "icon": "$media:icon", + "visible": true, + "label": "$string:SecondAbility_label", + "skills": [ + { + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..61009f0568889992994409f98d5fe3964976a381 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "SecondAbility_desc", + "value": "description" + }, + { + "name": "SecondAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageerelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageerelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimageerelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimageerelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagefrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..daf090d19e0073910c3fb9a90d11e21bddddaa69 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagefrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagefrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..bf92305ade6d8307163cdcfc15ce4145a8a14281 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageFRelyHap" + } + ] +} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagefrelyhap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/publish_test/getwantagentinfo/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagefrelyhap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagefrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..9eb9d019f758a95f451e526418c67d3a9a098970 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/BUILD.gn @@ -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. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsImageFRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageFRelyHap" + + testonly = true + deps = [ + ":actsimagefrelyhap_js_assets", + ":actsimagefrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagefrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagefrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagefrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagefrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c082a6aec43c79c11fc4377e3c9c8cb5b92c7186 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", 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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..b92beea4500936fc2b1121af5b5677c0b705b002 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/SecondAbility/SecondAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class SecondAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", 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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..1f19a1da4cd8fe10ba7ce872f6138fc5bcf520ee --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageFRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..8c94ac7bfb74af1d6c878b86df1bd7be99b49992 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/module.json @@ -0,0 +1,62 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + }, + { + "name": "SecondAbility", + "srcEntrance": "./ets/SecondAbility/SecondAbility.ts", + "description": "$string:SecondAbility_desc", + "icon": "$media:icon", + "label": "$string:SecondAbility_label", + "visible": true, + "skills": [ + { + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..61009f0568889992994409f98d5fe3964976a381 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "SecondAbility_desc", + "value": "description" + }, + { + "name": "SecondAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publish/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/publish/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagefrelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagefrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagefrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagefrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagegrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..8cd8e57fb555c6c35432eff0367f3e04355ad412 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagegrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagegrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1e32c2ed17093310924304748a2eba36391f4c83 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageGRelyHap" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagegrelyhap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagegrelyhap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagegrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..6743221be79cbb9563c3e82c74b1152f74dcb59c --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/BUILD.gn @@ -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. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsImageGRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageGRelyHap" + + testonly = true + deps = [ + ":actsimagegrelyhap_js_assets", + ":actsimagegrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagegrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagegrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagegrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagegrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c082a6aec43c79c11fc4377e3c9c8cb5b92c7186 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", 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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..184d752c47544da3d049cfc5811251a5ec0a2350 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,51 @@ +/* + * 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 router from '@system.router'; +import file from '@system.file'; +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + + @State message: string = 'MainAbility' + + 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/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3ef538001795a4630d04727ca36007f19b1ffdcb --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageGRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..9f0588e2b01de5e7be32dfad152eee0c3097c594 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..dddf9123aec0b6c9500eeacf289ac1bc58ff7a6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagegrelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagegrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagegrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagegrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagehrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..e16e3c3d3b8fab173c092ba7aa82a3fea108ee5b --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagehrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagehrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f2c355baaa7bd6052f161bd6d2dccfe258e740ac --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageHRelyHap" + } + ] +} diff --git a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagehrelyhap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/publish_test/publishremovalwantagent/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagehrelyhap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagehrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..134c1c11e33cdbe7fe7695dc3b126e147047a215 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/BUILD.gn @@ -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. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsImageHRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageHRelyHap" + + testonly = true + deps = [ + ":actsimagehrelyhap_js_assets", + ":actsimagehrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagehrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagehrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagehrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagehrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c082a6aec43c79c11fc4377e3c9c8cb5b92c7186 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", 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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..184d752c47544da3d049cfc5811251a5ec0a2350 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,51 @@ +/* + * 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 router from '@system.router'; +import file from '@system.file'; +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + + @State message: string = 'MainAbility' + + 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/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..cf55418401cd0d4397d281037b90a7758321b005 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageHRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..9f0588e2b01de5e7be32dfad152eee0c3097c594 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..dddf9123aec0b6c9500eeacf289ac1bc58ff7a6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishsound/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/publishsound/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagehrelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagehrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagehrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagehrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimageirelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..2d2d77b8d712dd2a7d0729dfb26384de19912da1 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imageirelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimageirelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..90d258ec6679699ca1dd21aca46459848b95a15f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageIRelyHap" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishvibra/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimageirelyhap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/publish_test/publishvibra/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimageirelyhap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimageirelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..413afe705c35a288c4d4ba94ec6475f1bda9744f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/BUILD.gn @@ -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. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsImageIRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageIRelyHap" + + testonly = true + deps = [ + ":actsimageirelyhap_js_assets", + ":actsimageirelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimageirelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimageirelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimageirelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimageirelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c082a6aec43c79c11fc4377e3c9c8cb5b92c7186 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", 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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagearelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagearelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..184d752c47544da3d049cfc5811251a5ec0a2350 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,51 @@ +/* + * 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 router from '@system.router'; +import file from '@system.file'; +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + + @State message: string = 'MainAbility' + + 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/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..e904e3bb73f7f95a6dc0dccada2c614908c616be --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageIRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..9f0588e2b01de5e7be32dfad152eee0c3097c594 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..dddf9123aec0b6c9500eeacf289ac1bc58ff7a6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/sub/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/sub/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimageirelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimageirelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimageirelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimageirelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagejrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..4b6ade9e393a72acfd04c1ba8283bfa666da7a8a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagejrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagejrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d9bd9cdbd32547c15bb8b57444b4cf8be0e54927 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageJRelyHap" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagejrelyhap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagejrelyhap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagejrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..2a8343798d525211b72dc8f74cab7a1acabc6e5d --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsImageJRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageJRelyHap" + + deps = [ + ":actsimagejrelyhap_js_assets", + ":actsimagejrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagejrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagejrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagejrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagejrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..5eccf4c7828dd8d34e6a327910ee1358a56c5833 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + // windowStage.setUIContent(this.context, "pages/index", 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") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..184d752c47544da3d049cfc5811251a5ec0a2350 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,51 @@ +/* + * 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 router from '@system.router'; +import file from '@system.file'; +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('MainAbility index aboutToAppear') + } + + @State message: string = 'MainAbility' + + 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/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..30c9b862cdb3b656d310d90614387b6f5928bef5 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageJRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..d6d2ca5d59ade7344363c49384aeda2e12280916 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/jpeg" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..dddf9123aec0b6c9500eeacf289ac1bc58ff7a6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/subscribe/subscribe/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagejrelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagejrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagejrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagejrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsimagekrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..70d6774d44f0b1d3e13dc9a07d181ce50c44d419 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "imagekrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagekrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..71e244d1382c49873d6d6b031bd47ce57abc1d75 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "imageKRelyHap" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/unsubscribe/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagekrelyhap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/publish_test/unsubscribe/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagekrelyhap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsimagekrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..78c47bd116ccd106e4953f9646c05d09f42561b1 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/BUILD.gn @@ -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. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsImageKRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsImageKRelyHap" + + testonly = true + deps = [ + ":actsimagekrelyhap_js_assets", + ":actsimagekrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsimagekrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsimagekrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsimagekrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsimagekrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..48603c3f1882e3fee65d6e0967ec1aac963ff8ef --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent' +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + if (want.parameters.startByService) { + AppStorage.SetOrCreate('startByService', want.parameters.startByService); + } + + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "pages/index", 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") + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(globalThis.abilityWant)) + let commonEventData = { + code: 0, + data: 'imagekrelyhap', + parameters: { + abilityName: globalThis.abilityWant.abilityName, + bundleName: globalThis.abilityWant.bundleName, + type: globalThis.abilityWant.type, + uri: globalThis.abilityWant.parameters.uri, + startByService:globalThis.abilityWant.parameters.startByService + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>imagekrelyhap MainAbility published<======') + }) + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..f1865cb187f944195a866cd23584a5b165a54bf3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageKRelyHap' + @StorageLink('startByService') startByService: boolean = false; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + + Text("startByService: " + this.startByService) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..647f63e74c2c3445054c8860ac412a796f89ae0e --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageKRelyHap' + @StorageLink('startByService') startByService: boolean = false; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + + Text("startByService: " + this.startByService) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..d4759b77fa44488ac09e4ce59469ef7f0367c8f9 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/module.json @@ -0,0 +1,37 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..dddf9123aec0b6c9500eeacf289ac1bc58ff7a6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsimagekrelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsimagekrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsimagekrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsimagekrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..c3256a90083abadcdf7244149dc5c7898d255130 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "aserviceabilityrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..6683e32c2794d4749b23c82d7fe673f83c1066d1 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "actsserviceabilityarelyhap" + } + ] +} diff --git a/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..c55e4970cdb7822329aca1a97c7e6b5fe7eaeba3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/BUILD.gn @@ -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. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsServiceAbilityARelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsServiceAbilityARelyHap" + + testonly = true + deps = [ + ":actsserviceabilityarelyhap_js_assets", + ":actsserviceabilityarelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsserviceabilityarelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsserviceabilityarelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsserviceabilityarelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsserviceabilityarelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..260e7891fe9921853f1d5fdf6640818e4f636d41 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + globalThis.abilityWant = want; + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c40096dc19e6372101d540684b500456f5f739c3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageAEntryRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..210dc7900f7a34e309d9e6eac96191206e624fdf --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,49 @@ +/* + * 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import rpc from "@ohos.rpc"; +import Want from '@ohos.application.Want'; + +export default class ServiceAbility extends ServiceExtensionAbility { + onCreate(want) { + console.log('AppSelector ServiceAbility onCreate, want: ' + want.abilityName); + } + + onConnect(want: Want) { + console.log('AppSelector ServiceAbility onConnect, want:' + want.abilityName); + this.context.startAbility( + { + action: "ohos.want.action.viewData", + type: "text/txt", + parameters: { + uri: "filePath" + } + }, (error, data) => { + console.info("ACTS_AppSelector_0900 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.info("ACTS_AppSelector_0900 startAbility end"); + }) + return new rpc.RemoteObject('connect'); + } + + onDisconnect(want) { + console.log('AppSelector ServiceAbility onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility onDestroy'); + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/ServiceAbility/service.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f18a61d57fe4cc71cd70bae4d9378d284df0e2c --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/ServiceAbility/service.ts @@ -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 { + onStart() { + console.info('ServiceAbility onStart'); + }, + onStop() { + console.info('ServiceAbility onStop'); + }, + onCommand(want, startId) { + console.info('ServiceAbility onCommand'); + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b821e0762b0ce1f49b14c6af2d2ef24927e5ec39 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageAEntryRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..d5ff071453789a78c54e1b90a1d323294996502b --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/module.json @@ -0,0 +1,46 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "name": "ServiceAbility", + "srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts", + "label": "$string:service_ServiceAbility_desc", + "description": "$string:service_ServiceAbility_desc", + "type": "service|dataShare", + "visible": true + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..24e76e8b8cf82af6c7c52c48bbf354c2c5b35173 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsserviceabilityarelyhap" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "service_ServiceAbility_desc", + "value": "service_description" + }, + { + "name": "service_ServiceAbility_label", + "value": "service_label" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/wantagent/wantagent1/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsserviceabilityarelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/AppScope/app.json b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..38b25d33adb4e6c768412172077803e704df9c52 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "bserviceabilityrelyhap", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/AppScope/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..6792c02963a3e29c0f34e365874200241b0f72c7 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "actsserviceabilitybrelyhap" + } + ] +} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/AppScope/resources/base/media/app_icon.png similarity index 100% rename from notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/AppScope/resources/base/media/app_icon.png diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..ddbe2a0f7c6010a71d9a68301c258ca04c7aebd4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/BUILD.gn @@ -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. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsServiceAbilityBRelyHap") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + hap_name = "ActsServiceAbilityBRelyHap" + + testonly = true + deps = [ + ":actsserviceabilitybrelyhap_js_assets", + ":actsserviceabilitybrelyhap_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsserviceabilitybrelyhap_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsserviceabilitybrelyhap_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsserviceabilitybrelyhap_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsserviceabilitybrelyhap_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..0190fb0606f5b60fafe51d094ef1b3c8d69d1da4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..d22a1bf6db6d710e0e88072be63c9b519414d31f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log('MainAbility onCreate') + globalThis.abilityWant = want; + globalThis.abilityContext = this.context; + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'MainAbility/pages/index', null) + + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..ffa2c85dbe70cacfc662ba9cc0c346e7f6034707 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,66 @@ +/* + * 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 ServiceExtensionAbility from '@ohos.application.ServiceExtensionAbility' +import rpc from "@ohos.rpc"; +import Want from '@ohos.application.Want'; +// import commonEvent from '@ohos.commonEvent' + +export default class ServiceAbility extends ServiceExtensionAbility { + onCreate(want) { + console.log('AppSelector ServiceAbility onCreate, want: ' + want.abilityName); + } + + onConnect(want: Want) { + console.log('AppSelector ServiceAbility onConnect, want:' + want.abilityName); + this.context.startAbility( + { + "bundleName": "imagekrelyhap", + "abilityName": "MainAbility", + parameters: { + startByService: true + } + }, (error, data) => { + console.info("ACTS_AppSelector_3600 startAbility " + + JSON.stringify(error) + "," + JSON.stringify(data)); + console.info("ACTS_AppSelector_3600 startAbility end"); + }) + // console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + // let commonEventData = { + // code: 0, + // data: 'imagekrelyhap', + // parameters: { + // abilityName: want.abilityName, + // bundleName: want.bundleName, + // type: want.type, + // uri: want.parameters.uri, + // startByService:want.parameters.startByService + // } + // } + // commonEvent.publish('AppSelector', commonEventData, (err) => { + // console.log('======>imagekrelyhap MainAbility published<======') + // }) + + return new rpc.RemoteObject('connect'); + } + + onDisconnect(want) { + console.log('AppSelector ServiceAbility onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility onDestroy'); + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/ServiceAbility/service.ts new file mode 100644 index 0000000000000000000000000000000000000000..8f18a61d57fe4cc71cd70bae4d9378d284df0e2c --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/ServiceAbility/service.ts @@ -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 { + onStart() { + console.info('ServiceAbility onStart'); + }, + onStop() { + console.info('ServiceAbility onStop'); + }, + onCommand(want, startId) { + console.info('ServiceAbility onCommand'); + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b821e0762b0ce1f49b14c6af2d2ef24927e5ec39 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + @State message: string = 'imageAEntryRelyHap' + @StorageLink('bundleName') bundleName: string = null; + @StorageLink('abilityName') abilityName: string = null; + @StorageLink('type') type: string = null; + @StorageLink('uri') uri: string = null; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/module.json b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..96165322cba1e22a7cff03ceee3c96d83099f0c4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/module.json @@ -0,0 +1,58 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "name": "ServiceAbility", + "srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts", + "label": "$string:service_ServiceAbility_label", + "description": "$string:service_ServiceAbility_desc", + "type": "service|dataShare", + "visible": true, + "skills": [ + { + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "image/png" + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8c7ec91f5a16fe583414ee4fea0c5e1e2316bc5e --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsserviceabilitybrelyhap" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "service_ServiceAbility_desc", + "value": "service_description" + }, + { + "name": "service_ServiceAbility_label", + "value": "service_label" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/wantagent/wantagent2/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actsserviceabilitybrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstextarelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstextarelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..2f129f022f222699c3560180c4e9155683691d11 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextarelyhap/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextARelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextARelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..66926bfc494ab0189e6b0454ff3cd8ef72c4ae5b --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "textarelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..451daa2fe41cc40b0bf6a9be4ef9f168956b3504 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,60 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + var want; + console.info('Application onCreate') + + try{ + featureAbility.getWant((err, data) => { + want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'textarelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>textarelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b9b91905974490cf08585eef34ac6a0675f2085a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textARelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..655a94a9ab09856c1bc6c1849cd0666967a32f2d --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actstextarelyhap" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actstextarelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actstextarelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstextarelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextarelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstextbrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstextbrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..e6f561f8416e77edc4bcc45a1da5a5b610e2d7cc --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextbrelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextBRelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextBRelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..3ebcb6f57be19a4c62316c673c38d5dea29854e8 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "textbrelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e13f77c871ddc8b35be79f4eb78def7c05d2cea --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,58 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'textbrelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>textbrelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..76560040dc7d3887599a9d96b06988dbbe6c3608 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textBRelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..863d57a2f5c6975f36734e5e2331bbed32ff09b2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/wantagent/wantagent3/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actstextbrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actstextbrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstextbrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextbrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstextcrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstextcrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..cbe03c77df9ef29efea652d39fd7a33f59f22e01 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextcrelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextCRelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextCRelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..36ef410d47779a929811b346e1577e79ca9bf391 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "textcrelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..83427442c5d81beec585d422c5aa320922fd4296 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,58 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'textcrelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>textcrelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c012201e82452697bd99e0f55fcf92f879c11a34 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textCRelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..863d57a2f5c6975f36734e5e2331bbed32ff09b2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actstextcrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actstextcrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstextcrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextcrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstextdrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstextdrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..7e5520c648653b836c1459bf38c83eaf1e902472 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextdrelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextDRelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextDRelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..a498525b79d1143cae6ff154b57786b740851f3a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "textdrelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..64bfc183bf50af03cd43910909a9a563416f88f2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,58 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'textdrelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>textdrelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..8bc776ed3ebb8f39735a21ebb42a7deb5b063392 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textDRelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..863d57a2f5c6975f36734e5e2331bbed32ff09b2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/wantagent/wantagent4/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actstextdrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actstextdrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstextdrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextdrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstexterelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstexterelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..83376d2cd74b881abd4fd171ad2d14fc21978550 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexterelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextERelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextERelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..0972283a3ac4c14935f38555fd8c0790f42d20c6 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "texterelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..95daf966045a694f936a1de7cd5874c1606f2d85 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,58 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'texterelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>texterelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..8cebb723863a85d1abe2f4eb618dfa0979271817 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textERelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..863d57a2f5c6975f36734e5e2331bbed32ff09b2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actstexterelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actstexterelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstexterelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstexterelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstextfrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstextfrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..08ba99bb2f589969b0eb3c1001ff788acc1f124b --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextfrelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextFRelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextFRelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..189a522070726cce363635438b6d7bbd05613b5a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "textfrelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..1a21fb5443dc7f3fb21819568aa988da80308cae --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,58 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'textfrelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>textfrelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..76d6ac147b0f2509b1685ddaa3db90ff3b03da17 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textFRelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..863d57a2f5c6975f36734e5e2331bbed32ff09b2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/wantagent/wantagent5/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actstextfrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actstextfrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstextfrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextfrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstextgrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstextgrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..1fba8dbe9aa828e46bda739a0b0ed77f21226724 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextgrelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextGRelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextGRelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..d0dafedf8ddd0cd680f92767f23668249b0dc3f3 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "textgrelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..92fed374e5d5a2c5cfb64662fd3f85f9aea56ab8 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,58 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'textgrelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>textgrelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3e385b74990affd8e27f6067a7d7d6e828464c6f --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textGRelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..863d57a2f5c6975f36734e5e2331bbed32ff09b2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actstextgrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actstextgrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstextgrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextgrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstexthrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstexthrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..fdc6f6595207c7d5289059c40053f5df2c31a5d1 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexthrelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextHRelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextHRelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..aa060703b712204544fbc467b9c83e6226a2a961 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "texthrelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..723dfab3fce9064772189d623fe10fc01e7d1711 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,58 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'texthrelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>texthrelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d2c9e3502b1938592fe171de0e589db191cab6a --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textHRelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..863d57a2f5c6975f36734e5e2331bbed32ff09b2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actstexthrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actstexthrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstexthrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstexthrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstextirelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstextirelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..40414a02c2a00198e20b8944d7722bcaef3ae6b8 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextirelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextIRelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextIRelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..7dfa59339f0cb0128e1bae3b688a537058a568a6 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "textirelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..697c9217409692a5c4e108a830cce9bbd7219ce2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,58 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'textirelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>textirelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..03705059201f9ae73b90dfbb6632100be8d829b4 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textIRelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..863d57a2f5c6975f36734e5e2331bbed32ff09b2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/settingsdata/settings_ets/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from settingsdata/settings_ets/entry/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actstextirelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actstextirelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstextirelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextirelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstextjrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstextjrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..d940b30119fd72a14b5c10e67bb288ef5a013965 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextjrelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextJRelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextJRelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..b68cd0930f90833c134f1247167afa69f3d0eca1 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "textjrelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.viewData" + ], + "uris": [ + { + "type": "text/md" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..487fafac7cc9fa524b919b440eb1244df9a6732d --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,59 @@ +/** + * 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. + */ +// @ts-nocheck +import featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'textarelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>textarelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..bcfc2c61bc6969a4d19365aa7f21643697dd0067 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textJRelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..863d57a2f5c6975f36734e5e2331bbed32ff09b2 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "actsstartrunnertest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/startup/startup_standard/systemparamter/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from startup/startup_standard/systemparamter/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actstextjrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actstextjrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstextjrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextjrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsappselector/actstextkrelyhap/BUILD.gn b/ability/ability_runtime/actsappselector/actstextkrelyhap/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..f34f30ad8eb2548e02d5f23439cc3c272b3f2674 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextkrelyhap/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActstextKRelyHap") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActstextKRelyHap" + js_build_mode = "debug" + testonly = true + subsystem_name = "ability" + part_name = "ability_runtime" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..57885f72d00f6cd1f32f49f8b694cd21a80bd10e --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "vendor": "example", + "bundleName": "textkrelyhap.com.example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "phone", + "tablet" + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "ohos.want.action.getData" + ], + "uris": [ + { + "type": "text/txt" + } + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "com.example.entry", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..a877ff7a9af570e2e6dec2ea7377f0a036c0bd74 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,58 @@ +/** + * 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 featureAbility from "@ohos.ability.featureAbility" +import commonEvent from '@ohos.commonEvent' +export default { + onCreate() { + console.info('Application onCreate') + try{ + featureAbility.getWant((err, data) => { + var want = data; + try{ + console.log("[Demo] MainAbility onForeground want: " + JSON.stringify(want)) + let commonEventData = { + code: 0, + data: 'textkrelyhap', + parameters: { + abilityName: want.abilityName, + bundleName: want.bundleName, + type: want.type, + uri:want.parameters.uri + } + } + commonEvent.publish('AppSelector', commonEventData, (err) => { + console.log('======>textkrelyhap MainAbility published<======') + }) + + AppStorage.SetOrCreate('bundleName', want.bundleName); + AppStorage.SetOrCreate('abilityName', want.abilityName); + AppStorage.SetOrCreate('type', want.type); + AppStorage.SetOrCreate('uri', want.parameters.uri); + }catch(error) + { + console.info('Application onCreate error ='+ error); + AppStorage.SetOrCreate('err1', error.message); + } + }); + }catch(err) + { + console.info('Application onCreate err ='+ err); + AppStorage.SetOrCreate('err2', err.message); + } + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..06647c0ca6bbd594796c1a89ec68f00a7b3507e9 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,48 @@ +/** + * 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. + */ + +@Entry +@Component +struct Index { + @State message: string = 'textKRelyHap' + @StorageLink('bundleName') bundleName: string = ""; + @StorageLink('abilityName') abilityName: string = ""; + @StorageLink('type') type: string = ""; + @StorageLink('uri') uri: string = ""; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text("bundleName: " + this.bundleName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("abilityName: " + this.abilityName) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("type: " + this.type) + .fontSize(25) + .fontWeight(FontWeight.Bold) + Text("uri: " + this.uri) + .fontSize(25) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..df18caae3bd9df85b56116a0e5e39c02dc9ef250 --- /dev/null +++ b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "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/time/TimeTest_js/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/resources/base/media/icon.png similarity index 100% rename from time/TimeTest_js/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actsappselector/actstextkrelyhap/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actsappselector/actstextkrelyhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsappselector/actstextkrelyhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actsappselector/actstextkrelyhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actscalldataabilitytest/BUILD.gn b/ability/ability_runtime/actscalldataabilitytest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..da3fc144cdd030cc89abdaf8cdc8582bef81a0b9 --- /dev/null +++ b/ability/ability_runtime/actscalldataabilitytest/BUILD.gn @@ -0,0 +1,34 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsCallDataAbilityTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":actscalldataabilitytest_ets_assets", + ":actscalldataabilitytest_ets_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsCallDataAbilityTest" +} +ohos_js_assets("actscalldataabilitytest_ets_assets") { + source_dir = "./entry/src/main/ets" + hap_profile = "entry/src/main/config.json" + ets2abc = true +} +ohos_resources("actscalldataabilitytest_ets_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ability/ability_runtime/actscalldataabilitytest/Test.json b/ability/ability_runtime/actscalldataabilitytest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..3b870295fefc32b94e8a96c0cfd16b52af303a5a --- /dev/null +++ b/ability/ability_runtime/actscalldataabilitytest/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for ActsCallDataAbilityTest Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "300000", + "bundle-name": "ohos.acts.aafwk.test.fasupplement", + "package-name": "ohos.acts.aafwk.test.fasupplement", + "shell-timeout": "600000", + "testcase-timeout": "10000" + }, + "kits": [ + { + "test-file-name": [ + "ActsCallDataAbilityTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/ability/ability_runtime/actscalldataabilitytest/entry/src/main/config.json b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..51cbf607724d208bec808bc3ac0a7bfae59efcc6 --- /dev/null +++ b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/config.json @@ -0,0 +1,114 @@ +{ + "app": { + "vendor": "example", + "bundleName": "ohos.acts.aafwk.test.fasupplement", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 8, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "mainAbility": ".MainAbility", + "deviceType": [ + "default" + ], + "reqPermissions": [ + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO" + }, + { + "name": "ohos.permission.READ_CONTACTS" + }, + { + "name": "ohos.permission.WRITE_CONTACTS" + } + ], + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:MainAbility_desc", + "formsEnabled": false, + "label": "$string:MainAbility_label", + "type": "page", + "launchType": "singleton" + }, + { + "name": ".DataAbility", + "srcLanguage": "ets", + "srcPath": "DataAbility", + "icon": "$media:icon", + "description": "$string:DataAbility_desc", + "type": "data", + "uri": "dataability://ohos.acts.aafwk.test.fasupplement.DataAbility" + } + ], + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "ohos.acts.aafwk.test.fasupplement", + "srcPath": "", + "name": ".entry", + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility2", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ], + "defPermissions": [ + { + "name": "ohos.acts.aafwk.test.fasupplement.DataAbilityShellProvider.PROVIDER" + } + ] + } +} diff --git a/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/DataAbility/data.ts b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/DataAbility/data.ts new file mode 100644 index 0000000000000000000000000000000000000000..4e3f90dbb321b579784ae66dcda33198dbc7ec80 --- /dev/null +++ b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/DataAbility/data.ts @@ -0,0 +1,50 @@ +/** + * 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 commonEvent from '@ohos.commonEvent'; +var publishOptions = { + parameters: { + "assertData": "{\"group_name\":{\"data\":\"test1\",\"type\":10}," + +"\"ringtone_modify_time\":{\"data\":\"28wTypeToString\",\"type\":9}}" + } +}; + +function PublishCallBack(err) { + if (err.code) { + console.error("callTest publish failed " + JSON.stringify(err)); + } else { + console.info("callTest publish success!!!"); + } +} + +export default { + onInitialized(abilityInfo) { + console.info('DataAbility onInitialized'); + }, + call(method, arg, extras) { + console.info('DataAbility call test000'); + console.info('call succeeded data111 ' + JSON.stringify(extras)); + var temp = JSON.stringify(extras); + if(temp == "\"{\\\"group_name\\\":{\\\"data\\\":\\\"test1\\\",\\\"type\\\":10}," + + "\\\"ringtone_modify_time\\\":{\\\"data\\\":\\\"28wTypeToString\\\",\\\"type\\\":9}}\"") + { + console.info('call commonEvent.publish start!!!!'); + commonEvent.publish("call_event", publishOptions, PublishCallBack); + }else { + console.info('call not commonEvent.publish!!!'); + } + return extras; + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..c9b470c5e030646dc074678531eec7ca122a98cc --- /dev/null +++ b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,35 @@ +/** + * 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('onCreate'); + }, + onDestroy() { + console.info('onDestroy'); + }, + onActive() { + console.info('onActive'); + }, + onInactive() { + console.info('onInactive'); + }, + onShow() { + console.info('onShow'); + }, + onHide() { + console.info('onHide'); + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..22bb82767483c2cad8397d386cd47c9eeedb3a8c --- /dev/null +++ b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,46 @@ +// @ts-nocheck +/** + * 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"; + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + aboutToAppear() { + console.info("aboutToAppear start!!!!") + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..24619881faa373aa2cdb6c3716e3a8020209b53e --- /dev/null +++ b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,20 @@ +/** + * 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 callTest from "./callTest.test"; + +export default function testsuite() { + callTest(); + +} \ No newline at end of file diff --git a/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/MainAbility/test/Utils.ets b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/MainAbility/test/Utils.ets new file mode 100644 index 0000000000000000000000000000000000000000..78a775bc36e3828f6bb4292a2effa58fd940d9f1 --- /dev/null +++ b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/MainAbility/test/Utils.ets @@ -0,0 +1,47 @@ +/** + * 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 class Utils { + static sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve(reject) + }, time) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + static getNowTime() { + return new Date().getTime(); + } + + /** + * 接口调用时间 + * @param startTime 接口调用开始时间 + * @param endTime 接口调用结束时间 + */ + static getDurationTime(msg, startTime, endTime) { + console.info(msg + 'Get Interface startTime: ' + startTime); + console.info(msg + 'Get Interface endTime: ' + endTime); + var duration = (endTime - startTime) + console.info(msg + 'Get Interface Duration: ' + duration); + return duration; + } +} + + + + diff --git a/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/MainAbility/test/callTest.test.ets b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/MainAbility/test/callTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ea9106e1ff5e6cf13469231b001d94ee221910ed --- /dev/null +++ b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/MainAbility/test/callTest.test.ets @@ -0,0 +1,91 @@ +// @ts-nocheck + + +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import featureAbility from "@ohos.ability.featureAbility"; +import commonEvent from '@ohos.commonEvent'; +import Utils from './Utils'; + +export default function callTest() { + let TAG = ""; + const URI_TEST = 'dataability:///ohos.acts.aafwk.test.fasupplement.DataAbility'; + let dataAbilityHelper = featureAbility.acquireDataAbilityHelper(URI_TEST); + let pacMap = { + 'group_name': 'test1', + 'ringtone_modify_time': 28 + }; + var dataAssert = ""; + var subscriber; + var subscribeInfo = { + events: ["call_event"] + }; + + function SubscribeCallBack(err, data) { + if (err.code) { + console.error("commonEvent subscribe failed " + JSON.stringify(err)); + } else { + console.info("commonEvent subscribe service " + JSON.stringify(data)); + for (var key in data.parameters) { + if (data.parameters[key]) { + dataAssert = data.parameters[key] + console.info("callTest dataAssert is : " + dataAssert); + } + } + } + } + + function CreateSubscriberCallBack(err, commonEventSubscriber) { + if (err.code) { + console.error("commonEvent createSubscriber failed " + JSON.stringify(err)); + } else { + console.info("----commonEvent createSubscriber------"); + subscriber = commonEventSubscriber; + commonEvent.subscribe(subscriber, SubscribeCallBack); + } + } + + describe('callTest', function () { + /* + * @tc.number CallTest_0100 + * @tc.name The deviceid passed in is null, so the installation free process is implemented + * @tc.desc Function test + * @tc.level 0 + */ + it("CallTest_0100", 0, async function (done) { + console.info("------------start CallTest_0100-------------"); + console.info("CallTest_0100 commonEvent.createSubscriber start!!!"); + commonEvent.createSubscriber(subscribeInfo, CreateSubscriberCallBack); + await Utils.sleep(2000); + TAG = "CallTest_0100"; + let details; + dataAbilityHelper.call(URI_TEST, 'insert', '', pacMap).then((data) => { + console.info(TAG + ' call succeeded, data: ' + JSON.stringify(data)); + details = data; + }).catch((error) => { + console.error(TAG + ' call failed, error: ' + JSON.stringify(error)); + }); + await Utils.sleep(2000); + expect(details.result).assertEqual("{\"group_name\":{\"data\":\"test1\",\"type\":10}," + + "\"ringtone_modify_time\":{\"data\":\"28wTypeToString\",\"type\":9}}"); + expect(dataAssert).assertEqual("{\"group_name\":{\"data\":\"test1\",\"type\":10}" + + ",\"ringtone_modify_time\":{\"data\":\"28wTypeToString\",\"type\":9}}"); + console.info("------------end CallTest_0100-------------"); + done(); + }); + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..1a4f0a7ebdd1edda79fae1ca7c5eb84881d08fc3 --- /dev/null +++ b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,69 @@ +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 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() +} + +async function onAbilityCreateCallback() { + console.info('onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + } + + onRun() { + console.info('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility' + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + 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 call abilityDelegator.getAppContext') + var context = abilityDelegator.getAppContext() + console.info('getAppContext : ' + JSON.stringify(context)) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actscalldataabilitytest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b404f7231b36547b1d28897502630b90c19772fd --- /dev/null +++ b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,44 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "FaSupplement" + }, + { + "name": "MainAbility2_desc", + "value": "description" + }, + { + "name": "MainAbility2_label", + "value": "label" + }, + { + "name": "MainAbility3_desc", + "value": "description" + }, + { + "name": "MainAbility3_label", + "value": "label" + }, + { + "name": "PageAbility_desc", + "value": "description" + }, + { + "name": "PageAbility_label", + "value": "label" + }, + { + "name": "DataAbility_desc", + "value": "hap sample empty provider" + } + ] +} \ No newline at end of file diff --git a/time/TimerTest_js/src/main/resources/base/media/icon.png b/ability/ability_runtime/actscalldataabilitytest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from time/TimerTest_js/src/main/resources/base/media/icon.png rename to ability/ability_runtime/actscalldataabilitytest/entry/src/main/resources/base/media/icon.png diff --git a/ability/ability_runtime/actscalldataabilitytest/signature/openharmony_sx.p7b b/ability/ability_runtime/actscalldataabilitytest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actscalldataabilitytest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/module.json b/ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/module.json index 9ed9f1a6e2d1563f3673e75e5b4b0d4c5435b44b..08d39cbe20e884c67e8ce274a2c5cf78d115c8bd 100644 --- a/ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/module.json +++ b/ability/ability_runtime/actscalltest/systemappcalleea/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/module.json b/ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/module.json index 144073f33a52bb84f5223ecbaab5a0f38912ef68..7c2ee6b7d60e5e3fb3866148b32b423afca79702 100644 --- a/ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/module.json +++ b/ability/ability_runtime/actscalltest/systemappcallera/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/module.json b/ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/module.json index 9e2cdcdde294ecd7c9b4614e2db14ac003e5033f..fcdb1221b07ed6e22ff8c52c3220b63805b4f190 100644 --- a/ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/module.json +++ b/ability/ability_runtime/actscalltest/systemappcallerb/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/module.json b/ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/module.json index 85761ba82b64477adeb23f18ac44b9cf05c5b601..b27d0f0d803b0e5f89a5aeb3509aefbd19d0c8f7 100644 --- a/ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/module.json +++ b/ability/ability_runtime/actscalltest/systemappcallerc/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/test/Ability.test.ets index 1f0330a2bf120509340ddda2c47770a1f6337c40..e96e52c308d0978bb956e8c78d6b0c1daf1f1e39 100644 --- a/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/ets/test/Ability.test.ets @@ -170,80 +170,20 @@ export default function abilityTest() { */ it('ACTS_CommonComponent_Call_0100', 0, async function (done) { console.log('ACTS_CommonComponent_Call_0100 begin'); - - function unSubscribeCallBack() { - console.log('ACTS_CommonComponent_Call_0100 unSubscribeCallBack') - subscriber = null; - done(); - } - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_0100 releaseCallBack' + data); - commonEvent.unsubscribe(subscriber, unSubscribeCallBack); - } - - function subscribeCallBack(err, data) { - console.log('ACTS_CommonComponent_Call_0100 subscribeCallBack data:' + JSON.stringify(data)) - expect(data.data).assertEqual('calleeCheckCallParam'); - expect(data.parameters.num).assertEqual(100); - expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_0100'); - expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_0100processed'); - console.log('AMS_CallTest_0100 do release'); - caller.release(); - } - - subscriber = await commonEvent.createSubscriber(subscriberInfo); - commonEvent.subscribe(subscriber, subscribeCallBack); - let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({ + let want = { bundleName: sysABundleName, abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(100, "ACTS_CommonComponent_Call_0100", 'default'); - caller.call('testCall', param).then(() => { - console.log('ACTS_CommonComponent_Call_0100 call success'); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_0100 call exception' + err); - expect().assertFail(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_0200 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_0200', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_0200 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_0200 releaseCallBack' + data); - done(); } - - let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(200, "ACTS_CommonComponent_Call_0200", 'default'); - caller.callWithResult('testCallWithResult', param).then((data) => { - console.log('ACTS_CommonComponent_Call_0200 call success'); - var result = new MySequenceable(0, '', ''); - data.readSequenceable(result); - expect(result.num).assertEqual(200); - expect(result.str).assertEqual('ACTS_CommonComponent_Call_0200'); - expect(result.result).assertEqual('ACTS_CommonComponent_Call_0200processed'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_0200 call exception' + err); - expect().assertFail(); - caller.release(); - }) + globalThis.abilityContext.startAbilityByCall(want) + .then(data => { + console.info(`ACTS_CommonComponent_Call_0100 startAbilityByCall SUCCESS`); + expect().assertFail(); + done(); + }) + .catch(error => { + console.info(`ACTS_CommonComponent_Call_0100 startAbilityByCall Catch`); + done(); + }); }) /** @@ -665,89 +605,6 @@ export default function abilityTest() { done(); }) - /** - * @tc.number: ACTS_CommonComponent_Call_1900 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_1900', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_1900 begin'); - var callBackCnt = 0; - - function checkFinish() { - if (callBackCnt >= 3) { - console.log('ACTS_CommonComponent_Call_1900 finish release') - caller.release(); - } - } - - function unSubscribeCallBack() { - console.log('ACTS_CommonComponent_Call_1900 unSubscribeCallBack') - subscriber = null; - done(); - } - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_1900 releaseCallBack' + data); - commonEvent.unsubscribe(subscriber, unSubscribeCallBack); - } - - function subscribeCallBack(err, data) { - console.log('ACTS_CommonComponent_Call_1900 subscribeCallBack data:' + JSON.stringify(data)) - if (data.data == 'calleeCheckCallParam') { - expect(data.parameters.num).assertEqual(1900); - expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_1900'); - expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_1900processed'); - callBackCnt++; - checkFinish(); - } else if (data.data == 'calleeCheckCall2Param') { - expect(data.parameters.num).assertEqual(1900); - expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_1900'); - expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_1900processed2'); - callBackCnt++; - checkFinish(); - } - } - - subscriber = await commonEvent.createSubscriber(subscriberInfo); - commonEvent.subscribe(subscriber, subscribeCallBack); - let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(1900, "ACTS_CommonComponent_Call_1900", 'default'); - caller.call('testCall', param).then(() => { - console.log('ACTS_CommonComponent_Call_1900 call success'); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_1900 call exception' + err); - expect().assertFail(); - }) - caller.call('testCall2', param).then(() => { - console.log('ACTS_CommonComponent_Call_1900 call2 success'); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_1900 call2 exception' + err); - expect().assertFail(); - }) - - caller.callWithResult('testCallWithResult', param).then((data) => { - console.log('ACTS_CommonComponent_Call_1900 call success'); - var result = new MySequenceable(0, '', ''); - data.readSequenceable(result); - expect(result.num).assertEqual(1900); - expect(result.str).assertEqual('ACTS_CommonComponent_Call_1900'); - expect(result.result).assertEqual('ACTS_CommonComponent_Call_1900processed'); - callBackCnt++; - checkFinish(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_1900 call exception' + err); - expect().assertFail(); - caller.release(); - }) - }) - /** * @tc.number: ACTS_CommonComponent_Call_2000 * @tc.name: The callee exits abnormally after the caller requests the call to be called successfully. @@ -783,404 +640,121 @@ export default function abilityTest() { }) /** - * @tc.number: ACTS_CommonComponent_Call_2300 - * @tc.name: Callee is in standalone process AbilityStage of the same app. - * @tc.desc: Verify Callee is in standalone process AbilityStage of the same app. + * @tc.number: ACTS_CommonComponent_Call_3100 + * @tc.name: The parameter method of the Callee.on function is an empty string. + * @tc.desc: Verify that the parameter method of the Callee.on function is an empty string. */ - it('ACTS_CommonComponent_Call_2300', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_2300 begin'); - - let bundleNameCallee = "com.example.systemcalltest"; - let abilityNameCallee = "com.example.second.MainAbility"; - - function releaseCallback(data) { - console.log('ACTS_CommonComponent_Call_2300 releaseCallBack:' + data); - expect(data).assertEqual("release"); - done(); - } + it('ACTS_CommonComponent_Call_3100', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_3100 begin'); - let want = { - bundleName: bundleNameCallee, - abilityName: abilityNameCallee, - } - let caller = await globalThis.globalThis.abilityContext.startAbilityByCall(want); - if (typeof caller !== "object" || caller == null) { - console.log('ACTS_CommonComponent_Call_2300 startAbilityByCall fail'); - expect().assertFail(); - done(); + function onTest(data) { + console.log('ACTS_CommonComponent_Call_3100 onTest'); } + let finishFlag = 0; try { - caller.onRelease(releaseCallback); - } catch (e) { - console.log('ACTS_CommonComponent_Call_2300 Caller onRelease fail ' + e); - expect().assertFail(); - done(); + globalThis.callee.on('', onTest); + } catch (err) { + console.log('ACTS_CommonComponent_Call_3100 callee.on err' + err); + expect(err.message).assertEqual("function input parameter error"); + finishFlag = 1; } - let param = new MySequenceable(2300, "case2300", 'default'); - caller.callWithResult('test2300', param).then((data) => { - console.log('ACTS_CommonComponent_Call_2300 callWithResult ' + JSON.stringify(data)); - let result = new MySequenceable(0, '', ''); - data.readSequenceable(result); - expect(result.str).assertEqual("onCreateonBackground"); - expect(result.num).assertEqual(0); - }); - try { - caller.release(); - } catch (e) { - console.log('ACTS_CommonComponent_Call_2300 Caller Release fail:' + e); - expect().assertFail(); - done(); - } + expect(finishFlag).assertEqual(1); + done(); }) /** - * @tc.number: ACTS_CommonComponent_Call_2400 - * @tc.name: The service party cannot provide the corresponding service after calling Callee.off. - * @tc.desc: The verification service party cannot provide the corresponding service after calling Callee.off. + * @tc.number: ACTS_CommonComponent_Call_3200 + * @tc.name: The parameter method of the Callee.on function is null. + * @tc.desc: Verify that the parameter method of the Callee.on function is null. */ - it('ACTS_CommonComponent_Call_2400', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_2400 begin'); + it('ACTS_CommonComponent_Call_3200', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_3200 begin'); - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_2400 releaseCallBack ' + data); - done(); + function onTest(data) { + console.log('ACTS_CommonComponent_Call_3200 onTest'); } - let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(2400, "case2400", 'default'); - let beforeOff = 0; - let afterOff = 0; - await caller.call('testOff', param).then(() => { - console.log('ACTS_CommonComponent_Call_2400 call success'); - beforeOff = 1; - }).catch(err => { - beforeOff = 2; - }) - - globalThis.secondCallee.off('testOff'); - - await caller.call('testOff', param).then(() => { - console.log('ACTS_CommonComponent_Call_2400 call success'); - afterOff = 1; - }).catch(err => { - afterOff = 2; - }) + let finishFlag = 0; + try { + globalThis.callee.on(null, onTest); + } catch (err) { + console.log('ACTS_CommonComponent_Call_3200 callee.on err' + err); + expect(err.message).assertEqual("function input parameter error"); + finishFlag = 1; + } - expect(beforeOff).assertEqual(1); - expect(afterOff).assertEqual(2); - caller.release(); + expect(finishFlag).assertEqual(1); + done(); }) /** - * @tc.number: ACTS_CommonComponent_Call_2500 - * @tc.name: The parameter "method" of the Caller.call function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.call function is an empty string. + * @tc.number: ACTS_CommonComponent_Call_3300 + * @tc.name: The parameter method of the Caller.callWithResult function is undefined. + * @tc.desc: Verify that the parameter method of the Caller.callWithResult function is undefined. */ - it('ACTS_CommonComponent_Call_2500', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_2500 begin'); + it('ACTS_CommonComponent_Call_3300', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_3300 begin'); - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_2500 releaseCallBack' + data); - done(); + function onTest(data) { + console.log('ACTS_CommonComponent_Call_3300 onTest'); } - let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(2500, "case2500", 'default'); - caller.call('', param).then(() => { - console.log('ACTS_CommonComponent_Call_2500 call success'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_2500 call exception' + err); + let finishFlag = 0; + try { + globalThis.callee.on(undefined, onTest); + } catch (err) { + console.log('ACTS_CommonComponent_Call_3300 callee.on err' + err); expect(err.message).assertEqual("function input parameter error"); - caller.release(); - }) + finishFlag = 1; + } + + expect(finishFlag).assertEqual(1); + done(); }) /** - * @tc.number: ACTS_CommonComponent_Call_2600 - * @tc.name: The parameter "method" of the Caller.call function is null. - * @tc.desc: Verify that the parameter "method" of the Caller.call function is null. + * @tc.number: ACTS_CommonComponent_Call_3400 + * @tc.name: The parameter "method" of the Callee.off function is an empty string. + * @tc.desc: Verify that the parameter "method" of the Callee.off function is an empty string. */ - it('ACTS_CommonComponent_Call_2600', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_2600 begin'); + it('ACTS_CommonComponent_Call_3400', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_3400 begin'); - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_2600 releaseCallBack' + data); - done(); + let finishFlag = 0; + try { + globalThis.callee.off(''); + } catch (err) { + console.log('ACTS_CommonComponent_Call_3400 callee.off err' + err); + expect(err.message).assertEqual("function input parameter error"); + finishFlag = 1; } - let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(2600, "case2600", 'default'); - caller.call(null, param).then(() => { - console.log('ACTS_CommonComponent_Call_2600 call success'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_2600 call exception' + err); - expect(err.message).assertEqual("function input parameter error"); - caller.release(); - }) + expect(finishFlag).assertEqual(1); + done(); }) /** - * @tc.number: ACTS_CommonComponent_Call_2700 - * @tc.name: The parameter "method" of the Caller.call function is undefined. - * @tc.desc: Verify that the parameter "method" of the Caller.call function is undefined. + * @tc.number: ACTS_CommonComponent_Call_3500 + * @tc.name: The parameter "method" of the Callee.off function is null. + * @tc.desc: Verify that the parameter "method" of the Callee.off function is null. */ - it('ACTS_CommonComponent_Call_2700', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_2700 begin'); + it('ACTS_CommonComponent_Call_3500', 0, async function (done) { + console.log('ACTS_CommonComponent_Call_3500 begin'); - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_2700 releaseCallBack' + data); - done(); + let finishFlag = 0; + try { + globalThis.callee.off(null); + } catch (err) { + console.log('ACTS_CommonComponent_Call_3500 callee.off err' + err); + expect(err.message).assertEqual("function input parameter error"); + finishFlag = 1; } - let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(2700, "case2700", 'default'); - caller.call(undefined, param).then(() => { - console.log('ACTS_CommonComponent_Call_2700 call success'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_2700 call exception' + err); - expect(err.message).assertEqual("function input parameter error"); - caller.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_2800 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_2800', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_2800 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_2800 releaseCallBack' + data); - done(); - } - - let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(2800, "case2800", 'default'); - caller.callWithResult('', param).then((data) => { - console.log('ACTS_CommonComponent_Call_2800 callWithResult success'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_2800 callWithResult exception' + err); - expect(err.message).assertEqual("function input parameter error"); - caller.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_2900 - * @tc.name: The parameter "method" of the Caller.callWithResult function is null. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is null. - */ - it('ACTS_CommonComponent_Call_2900', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_2900 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_2900 releaseCallBack' + data); - done(); - } - - let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(2900, "case2900", 'default'); - caller.callWithResult(null, param).then((data) => { - console.log('ACTS_CommonComponent_Call_2900 callWithResult success'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_2900 callWithResult exception' + err); - expect(err.message).assertEqual("function input parameter error"); - caller.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_3000 - * @tc.name: The parameter "method" of the Caller.callWithResult function is undefined. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is undefined. - */ - it('ACTS_CommonComponent_Call_3000', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3000 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_3000 releaseCallBack' + data); - done(); - } - - let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(3000, "case3000", 'default'); - caller.callWithResult(undefined, param).then((data) => { - console.log('ACTS_CommonComponent_Call_3000 call success'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_3000 catch exception' + err); - expect(err.message).assertEqual("function input parameter error"); - caller.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_3100 - * @tc.name: The parameter method of the Callee.on function is an empty string. - * @tc.desc: Verify that the parameter method of the Callee.on function is an empty string. - */ - it('ACTS_CommonComponent_Call_3100', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3100 begin'); - - function onTest(data) { - console.log('ACTS_CommonComponent_Call_3100 onTest'); - } - - let finishFlag = 0; - try { - globalThis.callee.on('', onTest); - } catch (err) { - console.log('ACTS_CommonComponent_Call_3100 callee.on err' + err); - expect(err.message).assertEqual("function input parameter error"); - finishFlag = 1; - } - - expect(finishFlag).assertEqual(1); - done(); - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_3200 - * @tc.name: The parameter method of the Callee.on function is null. - * @tc.desc: Verify that the parameter method of the Callee.on function is null. - */ - it('ACTS_CommonComponent_Call_3200', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3200 begin'); - - function onTest(data) { - console.log('ACTS_CommonComponent_Call_3200 onTest'); - } - - let finishFlag = 0; - try { - globalThis.callee.on(null, onTest); - } catch (err) { - console.log('ACTS_CommonComponent_Call_3200 callee.on err' + err); - expect(err.message).assertEqual("function input parameter error"); - finishFlag = 1; - } - - expect(finishFlag).assertEqual(1); - done(); - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_3300 - * @tc.name: The parameter method of the Caller.callWithResult function is undefined. - * @tc.desc: Verify that the parameter method of the Caller.callWithResult function is undefined. - */ - it('ACTS_CommonComponent_Call_3300', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3300 begin'); - - function onTest(data) { - console.log('ACTS_CommonComponent_Call_3300 onTest'); - } - - let finishFlag = 0; - try { - globalThis.callee.on(undefined, onTest); - } catch (err) { - console.log('ACTS_CommonComponent_Call_3300 callee.on err' + err); - expect(err.message).assertEqual("function input parameter error"); - finishFlag = 1; - } - - expect(finishFlag).assertEqual(1); - done(); - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_3400 - * @tc.name: The parameter "method" of the Callee.off function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Callee.off function is an empty string. - */ - it('ACTS_CommonComponent_Call_3400', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3400 begin'); - - let finishFlag = 0; - try { - globalThis.callee.off(''); - } catch (err) { - console.log('ACTS_CommonComponent_Call_3400 callee.off err' + err); - expect(err.message).assertEqual("function input parameter error"); - finishFlag = 1; - } - - expect(finishFlag).assertEqual(1); - done(); - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_3500 - * @tc.name: The parameter "method" of the Callee.off function is null. - * @tc.desc: Verify that the parameter "method" of the Callee.off function is null. - */ - it('ACTS_CommonComponent_Call_3500', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3500 begin'); - - let finishFlag = 0; - try { - globalThis.callee.off(null); - } catch (err) { - console.log('ACTS_CommonComponent_Call_3500 callee.off err' + err); - expect(err.message).assertEqual("function input parameter error"); - finishFlag = 1; - } - - expect(finishFlag).assertEqual(1); - done(); - }) + expect(finishFlag).assertEqual(1); + done(); + }) /** * @tc.number: ACTS_CommonComponent_Call_3600 @@ -1203,201 +777,6 @@ export default function abilityTest() { done(); }) - /* - * @tc.number: ACTS_CommonComponent_Call_3700 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_3700', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3700 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_3700 releaseCallBack' + data); - done(); - } - - let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - console.log('ACTS_CommonComponent_Call_3700 before onRelease') - caller.onRelease(releaseCallback); - console.log('ACTS_CommonComponent_Call_3700 before call') - caller.call('testCall', "").then(() => { - console.log('ACTS_CommonComponent_Call_3700 call success'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_3700 catch exception' + err); - expect(err.message).assertEqual("function input parameter error"); - caller.release(); - }) - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_3800 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_3800', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3800 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_3800 releaseCallBack' + data); - done(); - } - - let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - console.log('ACTS_CommonComponent_Call_3800 before onRelease') - caller.onRelease(releaseCallback); - console.log('ACTS_CommonComponent_Call_3800 before call') - caller.call('testCall', null).then(() => { - console.log('ACTS_CommonComponent_Call_3800 call success'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_3800 catch exception' + err); - expect(err.message).assertEqual("function input parameter error"); - caller.release(); - }) - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_3900 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_3900', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_3900 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_3900 releaseCallBack' + data); - done(); - } - - let caller = await globalThis.globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }); - - console.log('ACTS_CommonComponent_Call_3900 before onRelease') - caller.onRelease(releaseCallback); - console.log('ACTS_CommonComponent_Call_3900 before call') - caller.call('testCall', undefined).then(() => { - console.log('ACTS_CommonComponent_Call_3900 call success'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_3900 catch exception' + err); - expect(err.message).assertEqual("function input parameter error"); - caller.release(); - }) - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_4000 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_4000', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_4000 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_4000 release CallBack' + data); - done(); - } - - globalThis.globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }).then((data) => { - let caller = data; - console.log('ACTS_CommonComponent_Call_4000 before onRelease') - caller.onRelease(releaseCallback); - console.log('ACTS_CommonComponent_Call_4000 before call') - caller.callWithResult('testCallWithResult', "").then((data) => { - console.log('ACTS_CommonComponent_Call_4000 call success'); - expect(data).assertEqual(undefined); - caller.release(); - }).catch((e) => { - console.log('ACTS_CommonComponent_Call_4000 call err' + e); - caller.release(); - }); - }) - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_4100 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_4100', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_4100 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_4100 release CallBack' + data); - done(); - } - - globalThis.globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }).then((data) => { - let caller = data; - console.log('ACTS_CommonComponent_Call_4100 before onRelease') - caller.onRelease(releaseCallback); - console.log('ACTS_CommonComponent_Call_4100 before call') - caller.callWithResult('testCallWithResult', null).then((data) => { - console.log('ACTS_CommonComponent_Call_4100 call success'); - expect(data).assertEqual(undefined); - caller.release(); - }).catch((e) => { - console.log('ACTS_CommonComponent_Call_4100 call err' + e); - caller.release(); - }); - }) - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_4200 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_4200', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_4200 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_4200 release CallBack' + data); - done(); - } - - globalThis.globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }).then((data) => { - let caller = data; - console.log('ACTS_CommonComponent_Call_4200 before onRelease') - caller.onRelease(releaseCallback); - console.log('ACTS_CommonComponent_Call_4200 before call') - caller.callWithResult('testCallWithResult', undefined).then((data) => { - console.log('ACTS_CommonComponent_Call_4200 call success'); - expect(data).assertEqual(undefined); - caller.release(); - }).catch((e) => { - console.log('ACTS_CommonComponent_Call_4200 call err' + e); - caller.release(); - }); - }) - }) - /* * @tc.number: ACTS_CommonComponent_Call_4300 * @tc.name: Connects a service ability, which is used to start a cloned page ability. @@ -1458,102 +837,6 @@ export default function abilityTest() { done(); }) - /** - * @tc.number: ACTS_CommonComponent_Call_4800 - * @tc.name: Callee is in standalone process AbilityStage of the same app. - * @tc.desc: Verify Callee is in standalone process AbilityStage of the same app. - */ - it('ACTS_CommonComponent_Call_4800', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_4800 begin'); - - let bundleNameCallee = "com.example.systemcalltest"; - let abilityNameCallee = "com.example.second.MainAbility"; - - function releaseCallback(data) { - console.log('ACTS_CommonComponent_Call_4800 releaseCallBack:' + data); - expect(data).assertEqual("release"); - done(); - } - - let want = { - bundleName: bundleNameCallee, - abilityName: abilityNameCallee, - } - let caller = await globalThis.globalThis.abilityContext.startAbilityByCall(want); - if (typeof caller !== "object" || caller == null) { - console.log('ACTS_CommonComponent_Call_4800 startAbilityByCall fail'); - expect().assertFail(); - done(); - } - - try { - caller.onRelease(releaseCallback); - } catch (e) { - console.log('ACTS_CommonComponent_Call_4800 Caller onRelease fail ' + e); - expect().assertFail(); - done(); - } - let param = new MySequenceable(4600, "case4600", 'default'); - caller.callWithResult('test4600', param).then((data) => { - let result = new MySequenceable(0, '', ''); - data.readSequenceable(result); - expect(result.str).assertEqual("onCreateonBackground"); - expect(result.num).assertEqual(0); - }); - - try { - caller.release(); - } catch (e) { - console.log('ACTS_CommonComponent_Call_4800 Caller Release fail:' + e); - expect().assertFail(); - done(); - } - }) - - /* - * @tc.number: ACTS_CommonComponent_Call_4900 - * @tc.name: Connects a service ability, which is used to start a cloned page ability. - * @tc.desc: Check the event data of executor page ability publishes - */ - it('ACTS_CommonComponent_Call_4900', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_4900 begin'); - let caller; - let sequenceable = new MySequenceable(1, 'ACTS_CommonComponent_Call_4900', 'default'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_4900 releaseCallBack ' + data); - caller.call('testCall', sequenceable).then(() => { - console.log('ACTS_CommonComponent_Call_4900 call2 success'); - expect().assertFail(); - done(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_4900 call2 err ' + err); - expect(err.message).assertEqual("function inner object error"); - done(); - }) - } - - globalThis.globalThis.abilityContext.startAbilityByCall({ - bundleName: sysABundleName, - abilityName: sysASecondAbilityName, - }).then((data) => { - caller = data; - console.log('ACTS_CommonComponent_Call_4900 before onRelease') - caller.onRelease(releaseCallback); - console.log('ACTS_CommonComponent_Call_4900 before call') - delay(100); - caller.call('testCall', sequenceable).then(() => { - console.log('ACTS_CommonComponent_Call_4900 call1 success'); - caller.release(); - }).catch((e) => { - console.log('ACTS_CommonComponent_Call_4900 call err' + e); - expect().assertFail(); - done(); - }); - }) - }) - /* * @tc.number: ACTS_CommonComponent_Call_5000 * @tc.name: Connects a service ability, which is used to start a cloned page ability. @@ -1695,109 +978,5 @@ export default function abilityTest() { expect(exceptionFlag).assertEqual(true); done(); }) - - /** - * @tc.number: ACTS_CommonComponent_Call_5700 - * @tc.name: The mission of callee is not in recent list when startAbilityByCall only. - * @tc.desc: Verify the mission of callee is not in recent list when startAbilityByCall only. - */ - it('ACTS_CommonComponent_Call_5700', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_5700 begin'); - - let bundleNameCallee = "com.example.systemcalltest"; - let abilityNameCallee = "com.example.systemcalltest.SecondAbility"; - let want = { - bundleName: bundleNameCallee, - abilityName: abilityNameCallee, - } - let caller = await globalThis.globalThis.abilityContext.startAbilityByCall(want); - if (typeof caller !== "object" || caller == null) { - console.log('ACTS_CommonComponent_Call_5700 startAbilityByCall fail'); - expect().assertFail(); - done(); - } - - async function releaseCallback(data) { - console.log('ACTS_CommonComponent_Call_5700 releaseCallBack:' + data); - expect(data).assertEqual("release"); - - let missionId = await getMissionId(abilityNameCallee, 0); - expect(missionId == -1).assertTrue(); - done(); - } - - try { - caller.onRelease(releaseCallback); - } catch (e) { - console.log('ACTS_CommonComponent_Call_5700 Caller onRelease fail ' + e); - expect().assertFail(); - done(); - } - - try { - caller.release(); - } catch (e) { - console.log('ACTS_CommonComponent_Call_5700 Caller Release fail:' + e); - expect().assertFail(); - done(); - } - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_5800 - * @tc.name: The mission of callee is in recent list when startAbilityByCall then startAbility. - * @tc.desc: Verify the mission of callee is in recent list when startAbilityByCall then startAbility. - */ - it('ACTS_CommonComponent_Call_5800', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_5800 begin'); - - let bundleNameCallee = "com.example.systemcalltest"; - let abilityNameCallee = "com.example.systemcalltest.SecondAbility"; - let want = { - bundleName: bundleNameCallee, - abilityName: abilityNameCallee, - } - let caller = await globalThis.globalThis.abilityContext.startAbilityByCall(want); - if (typeof caller !== "object" || caller == null) { - console.log('ACTS_CommonComponent_Call_5800 startAbilityByCall fail'); - expect().assertFail(); - done(); - } - - function startAbilityCallback(err) { - console.log('ACTS_CommonComponent_Call_5800 startAbilityCallback'); - if (err.code != 0) { - expect().assertFail(); - done(); - } - } - await sleep(1000); - - await globalThis.globalThis.abilityContext.startAbility(want, startAbilityCallback); - - async function releaseCallback(data) { - console.log('ACTS_CommonComponent_Call_5800 releaseCallBack:' + data); - expect(data).assertEqual("release"); - - let missionId = await getMissionId(abilityNameCallee, 0); - expect(missionId != -1).assertTrue(); - done(); - } - try { - caller.onRelease(releaseCallback); - } catch (e) { - console.log('ACTS_CommonComponent_Call_5800 Caller onRelease fail ' + e); - expect().assertFail(); - done(); - } - - try { - caller.release(); - } catch (e) { - console.log('ACTS_CommonComponent_Call_5800 Caller Release fail:' + e); - expect().assertFail(); - done(); - } - }) }) } \ No newline at end of file diff --git a/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/module.json b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/module.json index c351dcc66e2d84cad05ac16d426b11cda07e4b22..5bb1810f319a58f65b650a2236fac45b5cf25d25 100644 --- a/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/module.json +++ b/ability/ability_runtime/actscalltest/systemcallentrytest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -80,6 +81,18 @@ { "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" + }, + { + "name":"ohos.permission.ABILITY_BACKGROUND_COMMUNICATION", + "reason":"need use ohos.permission.ABILITY_BACKGROUND_COMMUNICATION" } ] } diff --git a/ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/module.json b/ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/module.json index 857565bb1d04e52b26be210b38136e0644f08eaf..c93183b1bbb8a523964513703307259da2aaf564 100644 --- a/ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/module.json +++ b/ability/ability_runtime/actscalltest/systemcallfeature/entry/src/main/module.json @@ -7,6 +7,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/actscalltest/thirdappa/entry/src/main/module.json b/ability/ability_runtime/actscalltest/thirdappa/entry/src/main/module.json index c8fd2c246308f250ceb430c070fcf32eae40b475..afbf5b68756a617f65fdf70fc750f1add2fcd3a7 100644 --- a/ability/ability_runtime/actscalltest/thirdappa/entry/src/main/module.json +++ b/ability/ability_runtime/actscalltest/thirdappa/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/test/Ability.test.ets index b9dd1a51347385aaa08e83cf15e8b5d0d7402731..528878d0d7055a1d00e4b52a2fdd0b61816cf7c6 100644 --- a/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/ets/test/Ability.test.ets @@ -93,201 +93,20 @@ export default function abilityTest() { */ it('ACTS_CommonComponent_Call_1100', 0, async function (done) { console.log('ACTS_CommonComponent_Call_1100 begin'); - var subscriber; - - function unSubscribeCallBack() { - console.log('ACTS_CommonComponent_Call_1100 unSubscribeCallBack') - setTimeout(()=>{done();}, 100) - } - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_1100 releaseCallBack' + data); - commonEvent.unsubscribe(subscriber, unSubscribeCallBack); - } - - function subscribeCallBack(err, data) { - console.log('ACTS_CommonComponent_Call_1100 subscribeCallBack data:' + JSON.stringify(data)) - expect(data.data).assertEqual('calleeCheckCallParam'); - expect(data.parameters.num).assertEqual(1100); - expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_1100'); - expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_1100processed'); - console.log('AMS_CallTest_0100 do release'); - caller.release(); - } - - subscriber = await commonEvent.createSubscriber(subscriberInfo); - commonEvent.subscribe(subscriber, subscribeCallBack); - let caller = await globalThis.abilityContext.startAbilityByCall({ + let want = { bundleName: thirdCallTestBundleName, abilityName: thirdCallTestForthAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(1100, "ACTS_CommonComponent_Call_1100", 'default'); - caller.call('testCall', param).then(() => { - console.log('ACTS_CommonComponent_Call_1100 call success'); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_1100 call exception' + err); - expect().assertFail(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_1200 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_1200', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_1200 begin'); - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_1200 releaseCallBack' + data); - setTimeout(()=>{done();}, 100) } - - let caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: thirdCallTestBundleName, - abilityName: thirdCallTestFifthAbilityName, - }); - - caller.onRelease(releaseCallback); - let param = new MySequenceable(1200, "ACTS_CommonComponent_Call_1200", 'default'); - caller.callWithResult('testCallWithResult', param).then((data) => { - console.log('ACTS_CommonComponent_Call_1200 call success'); - var result = new MySequenceable(0, '', ''); - data.readSequenceable(result); - expect(result.num).assertEqual(1200); - expect(result.str).assertEqual('ACTS_CommonComponent_Call_1200'); - expect(result.result).assertEqual('ACTS_CommonComponent_Call_1200processed'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_1200 call exception' + err); - expect().assertFail(); - caller.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_1300 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_1300', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_1300 begin'); - var subscriber; - var caller - - function unSubscribeCallBack() { - console.log('ACTS_CommonComponent_Call_1300 unSubscribeCallBack') - setTimeout(()=>{done();}, 100) - } - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_1300 releaseCallBack' + data); - commonEvent.unsubscribe(subscriber, unSubscribeCallBack); - } - - function releaseCallback1(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_1300 releaseCallBack1' + data); - setTimeout(() => { - globalThis.abilityContext.startAbilityByCall({ - bundleName: thirdCallTestBundleName, - abilityName: thirdCallTestSecondAbilityName, - }).then(data => { - caller = data; - console.log('ACTS_CommonComponent_Call_1300 caller get') - caller.onRelease(releaseCallback); - let param = new MySequenceable(1300, "ACTS_CommonComponent_Call_1300", 'default'); - caller.call('testCall', param).then(() => { - console.log('ACTS_CommonComponent_Call_1300 call success'); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_1300 call exception' + err); - expect().assertFail(); - }) - }) - },100); - } - - function subscribeCallBack(err, data) { - console.log('ACTS_CommonComponent_Call_1300 subscribeCallBack data:' + JSON.stringify(data)) - expect(data.data).assertEqual('calleeCheckCallParam'); - expect(data.parameters.num).assertEqual(1300); - expect(data.parameters.str).assertEqual('ACTS_CommonComponent_Call_1300'); - expect(data.parameters.result).assertEqual('ACTS_CommonComponent_Call_1300processed'); - console.log('ACTS_CommonComponent_Call_1300 do release'); - caller.release(); - } - - subscriber = await commonEvent.createSubscriber(subscriberInfo); - commonEvent.subscribe(subscriber, subscribeCallBack); - - globalThis.abilityContext.startAbilityByCall({ - bundleName: thirdCallTestBundleName, - abilityName: thirdCallTestSecondAbilityName, - }).then(data => { - caller = data; - console.log('ACTS_CommonComponent_Call_1300 caller get') - caller.onRelease(releaseCallback1); - caller.release(); - }) - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_1400 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_1400', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_1400 begin'); - var caller - - function releaseCallback(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_1400 releaseCallBack' + data); - setTimeout(()=>{done();}, 100) - } - - function releaseCallback1(data) { - expect(data).assertEqual('release'); - console.log('ACTS_CommonComponent_Call_1400 releaseCallBack' + data); - setTimeout(() => { - globalThis.abilityContext.startAbilityByCall({ - bundleName: thirdCallTestBundleName, - abilityName: thirdCallTestSecondAbilityName, - }).then(data => { - caller = data; - caller.onRelease(releaseCallback); - let param = new MySequenceable(1400, "ACTS_CommonComponent_Call_1400", 'default'); - caller.callWithResult('testCallWithResult', param).then((data) => { - console.log('ACTS_CommonComponent_Call_1400 call success'); - var result = new MySequenceable(0, '', ''); - data.readSequenceable(result); - expect(result.num).assertEqual(1400); - expect(result.str).assertEqual('ACTS_CommonComponent_Call_1400'); - expect(result.result).assertEqual('ACTS_CommonComponent_Call_1400processed'); - caller.release(); - }).catch(err => { - console.log('ACTS_CommonComponent_Call_1400 call exception' + err); - expect().assertFail(); - caller.release(); - }) - }); - },100); - } - - globalThis.abilityContext.startAbilityByCall({ - bundleName: thirdCallTestBundleName, - abilityName: thirdCallTestSecondAbilityName, - }).then(data => { - caller = data; - console.log('ACTS_CommonComponent_Call_1400 caller get') - caller.onRelease(releaseCallback1); - caller.release(); - }) + globalThis.abilityContext.startAbilityByCall(want) + .then(data => { + console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall SUCCESS`); + expect().assertFail(); + done(); + }) + .catch(error => { + console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall Catch`); + done(); + }); }) /** @@ -297,17 +116,20 @@ export default function abilityTest() { */ it('ACTS_CommonComponent_Call_1500', 0, async function (done) { console.log('ACTS_CommonComponent_Call_1500 begin'); - var caller; - try{ - caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: systemAppCalleeABundleName, - abilityName: systemAppCalleeAMainAbilityName, - }); - }catch(error){ - console.log('ACTS_CommonComponent_Call_1500 start err'+error); - expect(error=="Error: function request remote error").assertTrue(); - done(); + let want = { + bundleName: systemAppCalleeABundleName, + abilityName: systemAppCalleeAMainAbilityName, } + globalThis.abilityContext.startAbilityByCall(want) + .then(data => { + console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall SUCCESS`); + expect().assertFail(); + done(); + }) + .catch(error => { + console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall Catch`); + done(); + }); }) /** @@ -317,49 +139,20 @@ export default function abilityTest() { */ it('ACTS_CommonComponent_Call_1600', 0, async function (done) { console.log('ACTS_CommonComponent_Call_1600 begin'); - let caller; - let exceptionFlag = false; - - try { - caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: thirdAppABundleName, - abilityName: thirdAppAMainAbilityName, - }); - console.log('ACTS_CommonComponent_Call_1600 startAbilityByCall' + JSON.stringify(caller)) - } catch(err) { - console.log('ACTS_CommonComponent_Call_1600 exception' + err); - exceptionFlag = true; - expect(err.message).assertEqual("function request remote error"); + let want = { + bundleName: thirdAppABundleName, + abilityName: thirdAppAMainAbilityName, } - - expect(exceptionFlag).assertEqual(true); - done(); - }) - - /** - * @tc.number: ACTS_CommonComponent_Call_1800 - * @tc.name: The parameter "method" of the Caller.callWithResult function is an empty string. - * @tc.desc: Verify that the parameter "method" of the Caller.callWithResult function is an empty string. - */ - it('ACTS_CommonComponent_Call_1800', 0, async function (done) { - console.log('ACTS_CommonComponent_Call_1800 begin'); - let caller; - let exceptionFlag = false; - - try { - caller = await globalThis.abilityContext.startAbilityByCall({ - bundleName: thirdCallTestBundleName, - abilityName: thirdCallTestThirdAbilityName, + globalThis.abilityContext.startAbilityByCall(want) + .then(data => { + console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall SUCCESS`); + expect().assertFail(); + done(); + }) + .catch(error => { + console.info(`ACTS_CommonComponent_Call_1100 startAbilityByCall Catch`); + done(); }); - console.log('ACTS_CommonComponent_Call_1800 startAbilityByCall' + JSON.stringify(caller)) - } catch(err) { - console.log('ACTS_CommonComponent_Call_1800 exception' + err); - exceptionFlag = true; - expect(err.message).assertEqual("function request remote error"); - } - - expect(exceptionFlag).assertEqual(true); - done(); }) }) } \ No newline at end of file diff --git a/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/module.json b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/module.json index d6fcdb48b904426b645cc82adacdb54668e8bc89..9d72e996bfc19073ff977c0c333f3a238995136c 100644 --- a/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/module.json +++ b/ability/ability_runtime/actscalltest/thirdcalltest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/actsdataabilityaccessdatasharetest/BUILD.gn b/ability/ability_runtime/actsdataabilityaccessdatasharetest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..36dbc7c62c12d71672c4047a09b4a4fe7fa4db55 --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/BUILD.gn @@ -0,0 +1,24 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +group("dataabilityaccessdatashare") { + testonly = true + if (is_standard_system) { + deps = [ + "actsdataabilityaccessdatasharetest:ActsDataAbilityAccessDataShareTest", + "datashareserverhap:DataShareServerHap", + ] + } +} diff --git a/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/BUILD.gn b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..d522afc61be34630a4cf9435dbe5e6336f656a3d --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/BUILD.gn @@ -0,0 +1,36 @@ +# 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("ActsDataAbilityAccessDataShareTest") { + hap_profile = "./src/main/config.json" + hap_name = "ActsDataAbilityAccessDataShareTest" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + + subsystem_name = "ability" + part_name = "ability_runtime" +} +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/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/Test.json b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..fb2d778715571b36ef6cb7b319a414fb5e61648e --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "180000", + "shell-timeout": "180000", + "bundle-name": "com.amsst.dataabilityaccessdatashare", + "package-name": "com.amsst.dataabilityaccessdatashare" + }, + "kits": [ + { + "test-file-name": [ + "ActsDataAbilityAccessDataShareTest.hap", + "DataShareServerHap.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/distributedschedule/dmsfwk/continuationmanagertest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/signature/openharmony_sx.p7b similarity index 100% rename from distributedschedule/dmsfwk/continuationmanagertest/signature/openharmony_sx.p7b rename to ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/signature/openharmony_sx.p7b diff --git a/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/config.json b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..1a8073b9a927759a51af1784dfa5e6f5238eec30 --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/config.json @@ -0,0 +1,95 @@ +{ + "app": { + "bundleName": "com.amsst.dataabilityaccessdatashare", + "vendor": "amsst", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 9, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.amsst.dataabilityaccessdatashare", + "name": ".entry", + "deviceType": [ + "default", + "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": "" + } +} diff --git a/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/MainAbility/app.js b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/MainAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..5ab30d89d09c11d290f2c64a14b4b27afa5c8a36 --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/MainAbility/app.js @@ -0,0 +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'); + } +}; diff --git a/multimodalinput/input_js_standard/src/main/js/default/i18n/en-US.json b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from multimodalinput/input_js_standard/src/main/js/default/i18n/en-US.json rename to ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/MainAbility/i18n/en-US.json diff --git a/multimodalinput/input_js_standard/src/main/js/default/i18n/zh-CN.json b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from multimodalinput/input_js_standard/src/main/js/default/i18n/zh-CN.json rename to ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/MainAbility/pages/index/index.css b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6724ec055a554cf3f9c7be83780c30df2274875b --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,12 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} +.titleST { + font-size: 32px; +} \ No newline at end of file diff --git a/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/MainAbility/pages/index/index.hml b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..4f779dcdff4fa69413976fe7032ca3656758793a --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,8 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + + + STDataAbility + +
diff --git a/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/MainAbility/pages/index/index.js b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..dd962694ee71f8605150daad4626edbb069b3a05 --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,30 @@ +/* + * 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' +import app from '@system.app' + +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/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/TestAbility/app.js b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/TestAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..d5ee271df29e516d1c8929054283e5f2bf5c981c --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/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/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/TestAbility/i18n/en-US.json b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/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/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/TestAbility/i18n/zh-CN.json b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/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/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/TestAbility/pages/index/index.css b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b21c92c6290ea747bd891e2ab673721afc5521ed --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/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/startup/startup_standard/systemparamter/src/main/js/MainAbility/pages/index/index.hml b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/TestAbility/pages/index/index.hml similarity index 100% rename from startup/startup_standard/systemparamter/src/main/js/MainAbility/pages/index/index.hml rename to ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/TestAbility/pages/index/index.hml diff --git a/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/TestAbility/pages/index/index.js b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d94b75c085fa1c16a0b2721609b18c57a7295476 --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/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/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 0000000000000000000000000000000000000000..b9e78ce7cf73f1ade6ba52a408a44e33f5430f0d --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/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/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/test/DataAbilityHelperJsSt.test.js b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/test/DataAbilityHelperJsSt.test.js new file mode 100644 index 0000000000000000000000000000000000000000..bbff5f02637b972a113d2c51c230619144b0de13 --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/actsdataabilityaccessdatasharetest/src/main/js/test/DataAbilityHelperJsSt.test.js @@ -0,0 +1,764 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import ohosDataAbility from '@ohos.data.dataAbility' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +export default function ActsDataAbilityHelperTest() { +describe('ActsDataAbilityHelperTest', function () { + let dataAbilityUri = ("dataability:///com.example.dataabilityserver_fa.DataAbility"); + let dataShareUri = ("datashare:///com.example.dataabilityserver_fa.DataAbility"); + let columns = ['id', 'name', 'introduction'] + let DAHelper; + let gSetTimeout = 500; + let TAG = '' + + function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } + } + + beforeAll(async (done) => { + console.debug('= ACTS_beforeAll ==== ' + DAHelper + " ,JSON. " + JSON.stringify(DAHelper)); + if(DAHelper == null){ + console.debug('ACTS_beforeAll DAHelper ====> DAHelper == null'); + return; + } + } catch (err) { + console.error('=ACTS_beforeAll acquireDataAbilityHelper catch(err)====>' + err); + } + sleep(500); + console.debug('= ACTS_beforeAll ==== { + console.debug('= ACTS_afterAll ==== { + console.log(TAG + ' insert err, data====>' + + 'json err [ ' + JSON.stringify(err) + ' ], json data [ ' + JSON.stringify(data) + ' ]'); + expect(data).assertEqual(1); + console.log(TAG + '====' + err); + expect(false).assertTrue(); + } + console.log(TAG + '====' + + 'json data [ ' + JSON.stringify(data) + ' ]'); + expect(data).assertEqual(2); + console.log(TAG + '====' + + 'json err [ ' + JSON.stringify(err) + ' ]'); + expect(false).assertTrue(); + console.log(TAG + '====' + err); + expect(false).assertTrue(); + console.log(TAG + '==== { + console.log(TAG + ' query err, data====>' + + 'json err [ ' + JSON.stringify(err) + ' ], json data [ ' + JSON.stringify(data) + ' ]'); + expect(typeof (data)).assertEqual("object"); + console.log(TAG + '====' + err); + console.log(TAG + '====' + + 'json queryPromise [ ' + JSON.stringify(queryPromise) + ' ]'); + expect(typeof (queryPromise)).assertEqual("object"); + console.log(TAG + '====' + err); + console.log(TAG + '==== { + console.log(TAG + ' update err, data====>' + + 'json err [ ' + JSON.stringify(err) + ' ], json data [ ' + JSON.stringify(data) + ' ]'); + expect(data).assertEqual(1); + console.log(TAG + '====' + err); + console.log(TAG + '==== { + console.log(TAG + ' then data====>' + + 'json data [ ' + JSON.stringify(data) + ' ]'); + expect(data).assertEqual(1); + console.log(TAG + '==== { + console.log(TAG + ' catch err ====>' + + 'json err [ ' + JSON.stringify(err) + ' ]'); + console.log(TAG + '====' + err); + console.log(TAG + '==== { + console.log(TAG + ' delete err, data====>' + + 'json err [ ' + JSON.stringify(err) + ' ], json data [ ' + JSON.stringify(data) + ' ]'); + expect(data).assertEqual(1); + console.log(TAG + '====' + err); + console.log(TAG + '==== { + console.log(TAG + ' then data====>' + + 'json data [ ' + JSON.stringify(data) + ' ]'); + expect(data).assertEqual(1); + console.log(TAG + '==== { + console.log(TAG + ' catch err ====>' + + 'json err [ ' + JSON.stringify(err) + ' ]'); + console.log(TAG + '====' + err); + console.log(TAG + '==== { + console.log(TAG +' batchInsert err, data====>' + + 'json err [ ' + JSON.stringify(err) + ' ], json data [ ' + JSON.stringify(data) + ' ]'); + expect(data).assertEqual(3); + console.log(TAG +'====' + err); + console.log(TAG +'==== { + console.log(TAG + ' then data====>' + + 'json data [ ' + JSON.stringify(data) + ' ]'); + expect(data).assertEqual(3); + console.log(TAG + '==== { + console.log(TAG + ' catch err ====>' + + 'json err [ ' + JSON.stringify(err) + ' ]'); + console.log(TAG + '====' + err); + console.log(TAG + '==== { + console.log(TAG + ' err=======>' + + 'err [ ' + JSON.stringify(err) + ' ]'); + expect(err.code).assertEqual(0); + } + ); + } + } catch (err) { + console.error(TAG + ' catch(err)====>' + err); + expect(false).assertTrue(); + console.log(TAG + '===='); + expect(false).assertTrue(); + clearTimeout(currentAlertTimeout); + console.log(TAG + '==== { + if (err.code != 0) { + console.log(TAG + ' err=======>' + + 'err [ ' + JSON.stringify(err) + ' ]'); + expect(false).assertTrue(); + console.log(TAG + '==== { + expect(err.code).assertEqual(0); + console.log(TAG + '====' + err); + expect(false).assertTrue(); + console.log(TAG + '==== { + console.debug(TAG + ' getType err,data=======>' + + 'json err [ ' + JSON.stringify(err) + ' ], json data [ ' + JSON.stringify(data) + ' ]'); + expect(data).assertEqual(mimeType); + console.log(TAG + '====' + err); + console.log(TAG + '==== { + console.log(TAG + ' then data====>' + + 'json data [ ' + JSON.stringify(data) + ' ]'); + expect(data).assertEqual(mimeType); + console.log(TAG + '==== { + console.log(TAG + ' catch err ====>' + + 'json err [ ' + JSON.stringify(err) + ' ]'); + console.log(TAG + '====' + promise) + } catch (err) { + console.error(TAG + ' getType AsyncCallback catch(err)====>' + err); + console.log(TAG + '==== { + console.log(TAG + ' getFileTypes err,data=======>' + + 'json err [ ' + JSON.stringify(err) + ' ], json data [ ' + JSON.stringify(data) + ' ]'); + console.log(TAG + ' data.length ====>' + data.length); + expect(data.length).assertEqual(3); + for (let i = 0; i < data.length; i++) { + expect(typeof (data[i])).assertEqual("string"); + console.log(TAG + ' for data ====>' + err.code + + ' data[' + i + ']: ' + data[i]); + if (i == 0) { + expect(data[i]).assertEqual("type01"); + } else if (i == 1) { + expect(data[i]).assertEqual("type00"); + } else if (i == 2) { + expect(data[i]).assertEqual("type03"); + } + } + console.log(TAG + '====' + err); + console.log(TAG + '==== { + console.log(TAG + ' then data====>' + + 'json data [ ' + JSON.stringify(data) + ' ]'); + console.log(TAG + ' getFileTypes data.length ====>' + data.length); + expect(data.length).assertEqual(3); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i])).assertEqual("string"); + console.log(TAG + ' for data[' + i + '] ====>' + data[i]) + if (i == 0) { + expect(data[i]).assertEqual("type01"); + } else if (i == 1) { + expect(data[i]).assertEqual("type00"); + } else if (i == 2) { + expect(data[i]).assertEqual("type03"); + } + } + console.log(TAG + '==== { + console.log(TAG + ' getFileTypes catch err ====>' + + 'json err [ ' + JSON.stringify(err) + ' ]'); + console.log(TAG + '====: ' + promise) + } catch (err) { + console.error(TAG + ' getFileTypes AsyncCallback catch(err)====>' + err); + console.log(TAG + '==== { + console.log(TAG + ' err,data=======>' + + 'json err [ ' + JSON.stringify(err) + ' ], json data [ ' + JSON.stringify(data) + ' ]'); + expect(typeof (data)).assertEqual("string"); + expect(data).assertEqual(dataShareUri); + console.log(TAG + '====' + err); + console.log(TAG + '==== { + console.log(TAG + ' then data====>' + + 'json data [ ' + JSON.stringify(data) + ' ]'); + expect(data).assertEqual(dataShareUri); + console.log(TAG + '==== { + console.log(TAG + ' catch err ====>' + + 'json err [ ' + JSON.stringify(err) + ' ]'); + console.log(TAG + '====' + err); + console.log(TAG + '==== { + console.log(TAG + ' err,data=======>' + + 'json err [ ' + JSON.stringify(err) + ' ], json data [ ' + JSON.stringify(data) + ' ]'); + expect(data).assertEqual(dataShareUri); + console.log(TAG + '====' + err); + console.log(TAG + '==== { + console.log(TAG +' then data====>' + + 'json data [ ' + JSON.stringify(data) + ' ]'); + expect(data).assertEqual(dataShareUri); + console.log(TAG +'==== { + console.log(TAG +' catch err ====>' + + 'json err [ ' + JSON.stringify(err) + ' ]'); + console.log(TAG +'====' + err); + console.log(TAG +'==== + setTimeout(resolve,time) + ) } async function output() { + let out = await sleep(1000); + console.log('1'); + return out; +} + +export default class DataShareExtAbility extends Extension { + async onCreate(want, callback) { + console.log('[DataShareServer]: DataShareExtAbility onCreate, want:' + want.abilityName); + console.log('[DataShareServer]: DataShareExtAbility onCreate this.context.databaseDir:' + this.context.databaseDir); + // @ts-ignore + rdbStore = await rdb.getRdbStore(this.context, { name: DB_NAME }, 1); + console.log('[DataShareServer]: DataShareExtAbility getRdbStore done'); + await rdbStore.executeSql(DDL_TBL_CREATE, []); + console.log('[DataShareServer]: DataShareExtAbility executeSql done'); + let err = {"code":0}; + callback(err); + console.log('[DataShareServer]: DataShareExtAbility onCreate end'); + } + + async getFileTypes(uri: string, mimeTypeFilter: string, callback) { + console.log('[DataShareServer]: [getFileTypes] enter'); + let ret = new Array("type01", "type00", "type03"); + console.log('[DataShareServer]: [getFileTypes] leave, ret:' + ret); + let err = {"code":0}; + await callback(err,ret); + return ret; + } + + async openFile(uri: string, mode: string, callback) { + console.log('[DataShareServer]: [openFile] enter'); + let ret = 1; + let err = {"code":0}; + await callback(err,ret); + console.log('[DataShareServer]: [openFile] leave, ret:' + ret); + } + + async insert(uri, value, callback) { + console.log('[DataShareServer]: [insert] enter'); + if (value == null) { + console.error('[DataShareServer]: [insert] invalid valueBuckets'); + return; + } + console.log('[DataShareServer]: [insert] value = ' + value); + console.log('[DataShareServer]: [insert] value = ' + JSON.stringify(value)); + await rdbStore.insert(TBL_NAME, value, function (err, ret) { + console.log('[DataShareServer]: <> [insert] callback ret:' + ret); + if (callback != undefined) { + callback(err, ret); + } + }); + console.log('[DataShareServer]: [insert] leave'); + } + + async update(uri, predicates, value, callback) { + console.log('[DataShareServer]: [update] enter'); + if (predicates == null || predicates == undefined) { + console.error('[DataShareServer]: <> [update] invalid predicates'); + return; + } + console.log('[DataShareServer]: [update] values = ' + value); + console.log('[DataShareServer]: [update] values = ' + JSON.stringify(value)); + console.log('[DataShareServer]: [update] predicates = ' + predicates); + console.log('[DataShareServer]: [update] predicates = ' + JSON.stringify(predicates)); + try { + await rdbStore.update(TBL_NAME, value, predicates, function (err, ret) { + console.log('[DataShareServer]: [update] callback ret:' + ret); + console.log('[DataShareServer]: [update] callback err:' + err); + if (callback != undefined) { + callback(err, ret); + } + }); + } catch (err) { + console.error('[DataShareServer]: [update] error' + err); + } + sleep(1); + console.log('[DataShareServer]: [update] leave'); + } + + async delete(uri, predicates, callback) { + console.log('[DataShareServer]: [delete] enter'); + if (predicates == null || predicates == undefined) { + console.error('[DataShareServer]: [delete] invalid predicates'); + return; + } + console.log('[DataShareServer]: [delete] predicates = ' + predicates); + console.log('[DataShareServer]: [delete] predicates = ' + JSON.stringify(predicates)); + try { + await rdbStore.delete(TBL_NAME, predicates, function (err, ret) { + console.log('[DataShareServer]: [delete] ret:' + ret); + if (callback != undefined) { + callback(err, ret); + } + }); + } catch (err) { + console.error('[DataShareServer]: [delete] error' + err); + } + console.log('[DataShareServer]: [delete] leave'); + } + + async query(uri, predicates, columns, callback) { + console.log('[DataShareServer]: [query] enter'); + if (predicates == null || predicates == undefined) { + console.error('[DataShareServer]: [query] invalid predicates'); + } + console.log('[DataShareServer]: [query] values = ' + columns); + console.log('[DataShareServer]: [query] values = ' + JSON.stringify(columns)); + console.log('[DataShareServer]: [query] predicates = ' + predicates); + console.log('[DataShareServer]: [query] predicates = ' + JSON.stringify(predicates)); + try { + await rdbStore.query(TBL_NAME, predicates, columns, function (err, resultSet) { + console.log('[DataShareServer]: [query] ret: ' + resultSet); + if (resultSet != undefined) { + console.log('[DataShareServer]: [query] resultSet.rowCount: ' + resultSet.rowCount); + } + if (callback != undefined) { + callback(err, resultSet); + } + }); + } catch (err) { + console.error('[DataShareServer]: [query] error' + err); + } + + console.log('[DataShareServer]: [query] leave'); + } + + async getType(uri: string, callback) { + console.log('[DataShareServer]: [getType] enter'); + let ret = "image"; + console.log('[DataShareServer]: [getType] leave, ret:' + ret); + let err = {"code":0}; + await callback(err,ret); + return ret; + } + + async batchInsert(uri: string, valueBuckets, callback) { + console.log('[DataShareServer]: [batchInsert] enter'); + if (valueBuckets == null || valueBuckets.length == undefined) { + console.error('[DataShareServer]: <> [batchInsert] invalid valueBuckets'); + return; + } + console.log('[DataShareServer]: [batchInsert] valueBuckets.length:' + valueBuckets.length); + let resultNum = valueBuckets.length + await valueBuckets.forEach(vb => { + console.log('[DataShareServer]: [batchInsert] vb:' + JSON.stringify(vb)); + rdbStore.insert(TBL_NAME, vb, function (err, ret) { + console.log('[DataShareServer]: [batchInsert] callback ret:' + ret); + if (callback != undefined) { + callback(err, resultNum); + } + }); + }); + console.log('[DataShareServer]: [batchInsert] leave'); + } + + async normalizeUri(uri: string, callback) { + console.log('[DataShareServer]: [normalizeUri] enter'); + let ret = uri; + let err = {"code":0}; + await callback(err, ret); + console.log('[DataShareServer]: [normalizeUri] leave, ret:' + ret); + } + + async denormalizeUri(uri: string, callback) { + console.log('[DataShareServer]: [denormalizeUri] enter'); + let ret = uri; + let err = {"code":0}; + await callback(err, ret); + console.log('[DataShareServer]: [denormalizeUri] leave, ret:' + ret); + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..618bcd06d8ce579fd5cc66bbf8303dcc6a404e49 --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[DataShareServer]: MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[DataShareServer]: MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[DataShareServer]: MainAbility onWindowStageCreate") + + windowStage.loadContent("pages/index", (err, data) => { + if (err.code) { + console.error("[DataShareServer]: Failed to load the content. Cause: " + JSON.stringify(err)); + return; + } + console.log("[DataShareServer]: Succeeded in loading the content. Data: " + JSON.stringify(data)) + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[DataShareServer]: MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[DataShareServer]: MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[DataShareServer]: MainAbility onBackground") + } +}; diff --git a/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..fb89f1e578a2315b78248ba65edf9f921773d319 --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/ets/pages/index.ets @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct Index { + @State message: string = 'stagemode: datashare server' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/module.json b/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..465ba09da3eccecf8fa98f74631226acc7aa8a43 --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/module.json @@ -0,0 +1,50 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:white", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "srcEntrance": "./ets/DataShareExtAbility/DataShareExtAbility.ts", + "name": "DataShareExtAbility", + "icon": "$media:icon", + "description": "$string:DataShareExtAbility_desc", + "type": "dataShare", + "uri": "datashare://com.example.dataabilityserver_fa.DataAbility", + "visible": true + } + ] + } +} diff --git a/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/resources/base/element/color.json b/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..1bbc9aa9617e97c45440e1d3d66afc1154837012 --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8c7cb2aa4611048f2274a70ae34c675ab8522d87 --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "DataShareExtAbility_desc", + "value": "description" + }, + { + "name": "DataShareExtAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/resources/base/profile/form_config.json b/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/resources/base/profile/form_config.json new file mode 100644 index 0000000000000000000000000000000000000000..b672a6f28aa83a8f8044e696c3c3eee89f9cd258 --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/resources/base/profile/form_config.json @@ -0,0 +1,40 @@ +{ + "forms": [ + { + "name": "widget", + "description": "This is a service widget.", + "src": "./js/widget/pages/index/index", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "colorMode": "auto", + "isDefault": true, + "updateEnabled": true, + "scheduledUpdateTime": "10:30", + "updateDuration": 1, + "defaultDimension": "2*2", + "supportDimensions": [ + "2*2" + ] + }, + { + "name": "widget", + "description": "This is a service widget.", + "src": "./js/widget/pages/index/index", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "colorMode": "auto", + "isDefault": true, + "updateEnabled": true, + "scheduledUpdateTime": "10:30", + "updateDuration": 1, + "defaultDimension": "2*2", + "supportDimensions": [ + "2*2" + ] + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..feec276e105eeb8d621c20aaf838f318b0a94150 --- /dev/null +++ b/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} diff --git a/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/signature/openharmony_sx.p7b b/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..1bc7370912ff0914f3ccbcf639788d441f8d2dcc Binary files /dev/null and b/ability/ability_runtime/actsdataabilityaccessdatasharetest/datashareserverhap/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsfwkdataaccessortest/BUILD.gn b/ability/ability_runtime/actsfwkdataaccessortest/BUILD.gn index 1c6bcd4b946192377fa618ac7672cdeae9f887ed..8a0cb63e2257253be6570f26257eea4c35eb5db0 100644 --- a/ability/ability_runtime/actsfwkdataaccessortest/BUILD.gn +++ b/ability/ability_runtime/actsfwkdataaccessortest/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/BUILD.gn b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/BUILD.gn index 9652cd443e559021d1edb39bddcfea3b29025f77..45c4a6a0dbbf2b2c4e4d5eb5cf36f224ea4edbfe 100644 --- a/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/BUILD.gn +++ b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/config.json index 32e59a4bf17b9e3633802259f02a69431bae741c..51f1b4e73aa66b3efe133332d0e00db4aca68aa3 100644 --- a/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/config.json +++ b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/config.json @@ -18,6 +18,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { @@ -69,6 +70,18 @@ "type": "data", "visible": true, "uri": "dataability://com.example.myapplication.DataAbility2" + }, + { + "srcPath": "TestDataAbility3", + "name": ".TestDataAbility3", + "icon": "$media:icon", + "srcLanguage": "ets", + "description": "$string:description_testdataability", + "type": "data", + "visible": true, + "uri": "dataability://com.example.myapplication.DataAbility3", + "readPermission": "ohos.permission.READ_CONTACTS", + "writePermission": "ohos.permission.WRITE_CONTACTS" } ], "js": [ diff --git a/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility/data.ts b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility/data.ts index 1a20eee46467aae73e076eb589ac0d4f36a1e61f..622c50ba44e2bf3fee88052461df2f40cb618619 100644 --- a/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility/data.ts +++ b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility/data.ts @@ -12,8 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import dataAbility from '@ohos.data.dataAbility' import featureAbility from '@ohos.ability.featureAbility' +import dataAbility from '@ohos.data.dataAbility' import fileio from '@ohos.fileio' import dataRdb from '@ohos.data.rdb' @@ -251,4 +251,4 @@ export default { } callback("success", uri); } -}; \ No newline at end of file +}; diff --git a/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility2/data.ts b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility2/data.ts index f84642cbb8dcc82295cb720eaf2affb061edee4a..4906d9e3927e85556786e154b69b3d6a46148db0 100644 --- a/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility2/data.ts +++ b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility2/data.ts @@ -12,8 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import dataAbility from '@ohos.data.dataAbility' import featureAbility from '@ohos.ability.featureAbility' +import dataAbility from '@ohos.data.dataAbility' import fileio from '@ohos.fileio' import dataRdb from '@ohos.data.rdb' @@ -251,4 +251,4 @@ export default { } callback("success", uri); } -}; \ No newline at end of file +}; diff --git a/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility3/data.ts b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility3/data.ts new file mode 100644 index 0000000000000000000000000000000000000000..e6a8ac729d8c71ef8e16472a363c767472ffd27d --- /dev/null +++ b/ability/ability_runtime/actsfwkdataaccessortest/actsdataabilityrelyhap/entry/src/main/ets/TestDataAbility3/data.ts @@ -0,0 +1,216 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import dataAbility from '@ohos.data.dataAbility' +import fileio from '@ohos.fileio' +import dataRdb from '@ohos.data.rdb' + +const TABLE_NAME = 'book' +const STORE_CONFIG = {name: 'book.db'} +const SQL_CREATE_TABLE = 'CREATE TABLE IF NOT EXISTS book' + + '(id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, age INTEGER, introduction TEXT NOT NULL)' +let rdbStore: any = undefined +const TAG = 'ACTS_ DataAbility.data' +const context = featureAbility.getContext() + +let defaultReturn = 1; +let returnError = 0; +let returnError1 = -1; +let returnError2 = -2; +let returnError3 = -3; +let dataAbilityUri = ("dataability:///com.example.myapplication.DataAbility3"); + +export default { + + onInitialized(abilityInfo) { + console.debug('ACTS_ DataAbility onInitialized,abilityInfo=' + abilityInfo.bundleName) + dataRdb.getRdbStore(context, STORE_CONFIG, 1, (err, store) => { + console.debug('ACTS_ [data]getRdbStoreThen') + store.executeSql(SQL_CREATE_TABLE, []) + rdbStore = store + }); + }, + + insert(uri, valueBucket, callback) { + console.debug(TAG + ' insert start 1121') + console.debug(TAG + ' valueBucket json=>' + JSON.stringify(valueBucket)) + + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + + console.debug(TAG + ' valueBucket.age =>' + valueBucket.age) + console.debug(TAG + ' valueBucket.name =>' + valueBucket.name) + console.debug(TAG + ' valueBucket.salary =>' + valueBucket.salary) + if (valueBucket.age != 24) { + err = "Error age" + callback(err, returnError2); + } + if (valueBucket.name != "ActsDataAbilityHelperPermissionTest") { + err = "Error name" + callback(err, returnError2); + } + if (valueBucket.salary != 2024.20) { + err = "Error salary" + callback(err, returnError2); + } + + err = "Error insert" + console.debug(TAG + ' rdbStore.insert ') + rdbStore.insert(TABLE_NAME, valueBucket, function (err, resultSet) { + console.log(TAG + "insert callback resultSet:" + resultSet + + " ,json=" + JSON.stringify(resultSet) + ' ,err' + err) + callback(err, defaultReturn); + }) + }, + + query(uri, columns, predicates, callback) { + console.debug(TAG + ' query start') + + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + + let rdbPredicates = dataAbility.createRdbPredicates(TABLE_NAME, predicates) + rdbStore.query(rdbPredicates, columns, callback) + }, + + update(uri, valueBucket, predicates, callback) { + console.debug(TAG + 'update start') + + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + + console.debug(TAG + ' valueBucket.age =>' + valueBucket.age) + console.debug(TAG + ' valueBucket.name =>' + valueBucket.name) + console.debug(TAG + ' valueBucket.salary =>' + valueBucket.salary) + if (valueBucket.age != 24) { + err = "Error age" + callback(err, returnError2); + } + if (valueBucket.name != "ActsDataAbilityHelperPermissionTest") { + err = "Error name" + callback(err, returnError2); + } + if (valueBucket.salary != 2024.20) { + err = "Error salary" + callback(err, returnError2); + } + + err = "Error update" + let rdbPredicates = dataAbility.createRdbPredicates(TABLE_NAME, predicates) + rdbStore.update(valueBucket, rdbPredicates, function (err, resultSet) { + console.log(TAG + "insert callback resultSet:" + resultSet + + " ,json=" + JSON.stringify(resultSet) + ' ,err' + err) + callback(err, defaultReturn); + }) + }, + + delete(uri, predicates, callback) { + console.debug(TAG + 'delete start') + + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + + let rdbPredicates = dataAbility.createRdbPredicates(TABLE_NAME, predicates) + rdbStore.delete(rdbPredicates, function (err, resultSet) { + console.log(TAG + "insert callback resultSet:" + resultSet + + " ,json=" + JSON.stringify(resultSet) + ' ,err' + err) + callback(err, defaultReturn); + }) + }, + call(uri, method, arg, extras, callback) { + console.debug(TAG + 'call start') + console.debug(TAG + 'uri---->' + uri) + console.debug(TAG + 'method---->' + uri) + }, + + batchInsert(uri, values, callback) { + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + + for (var j = 0; j < values.length; j++) { + rdbStore.insert("EMPLOYEE", values[j], function (err, ret) { + console.log(TAG + "batchInsert callback ret:" + JSON.stringify(ret)) + }) + } + console.log(TAG + "batchInsert values.length:" + values.length + ' ,json=' + JSON.stringify(values.length)) + callback(err, values.length); + }, + + openFile(uri, mode, callback) { + console.info(TAG + '==================== DataAbility test interface by openFile ================'); + let defaultReturn = 1; + let returnError1 = -1; + + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, returnError1); + } + if (!(mode == ("r") || mode == ("w") || mode == ("wt") || mode == ("wa") || + mode == ("rw") || mode == ("rwt"))) { + if (mode == ("A1@k#4%$,.<>)(oioiu*((*&(&*giIGT^%&^Ug;sdfk;losd*7873iug8%&^$&%]ERFUy&^%&&R7")) { + defaultReturn = returnError2; + } else + defaultReturn = returnError3; + } + console.info(TAG + " path = /data/test "); + let path = "/data/test" + fileio.stat(path).then(function (stat) { + console.info(TAG + "openFile getFileInfo successfully callback ret:" + JSON.stringify(stat)); + }).catch(function (err) { + console.info(TAG + "openFile getFileInfo failed with error callback ret:" + err); + defaultReturn = returnError1; + }); + console.info(TAG + " path ==>" + path); + callback("success", defaultReturn); + }, + + normalizeUri(uri, callback) { + console.info(TAG + '==================== DataAbility test interface by normalizeUri ================'); + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, ""); + } + callback("success", uri); + }, + + denormalizeUri(uri, callback) { + console.info(TAG + '==================== DataAbility test interface by denormalizeUri ================'); + console.info(TAG + "denormalizeUri uri:" + JSON.stringify(uri)); + + let err = "Error Uri" + if (uri != dataAbilityUri) { + console.debug(TAG + ' uri != dataAbilityUri') + callback(err, ""); + } + callback("success", uri); + } +}; diff --git a/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/BUILD.gn b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/BUILD.gn index 35a7ed52eadd1032107918470073a5a50f6b000c..1361cce02480f34a0374c8efd964dbf83d96c204 100644 --- a/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/BUILD.gn +++ b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/src/main/config.json b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/src/main/config.json index ce2f9da5d496fd6773569b37047c519e6cc0920b..2021dc4739be0667797d6fa59b0c89ac16363bc9 100644 --- a/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/src/main/config.json +++ b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.amsst.fwkdataaccessor", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { @@ -91,4 +92,4 @@ "mainAbility": ".MainAbility", "srcPath": "" } -} \ No newline at end of file +} diff --git a/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/src/main/js/test/DataAbilityHelperJsSt.test.js b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/src/main/js/test/DataAbilityHelperJsSt.test.js index a5da7a0645c2bcedee40b768e38ee9dd08e4ce10..62743701b9df32cd87d8ce237b9a394dbf807578 100644 --- a/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/src/main/js/test/DataAbilityHelperJsSt.test.js +++ b/ability/ability_runtime/actsfwkdataaccessortest/actsfwkdataaccessortest/src/main/js/test/DataAbilityHelperJsSt.test.js @@ -41,6 +41,7 @@ describe('ActsDataAbilityHelperTest', function () { } catch (err) { console.error('=ACTS_beforeAll acquireDataAbilityHelper catch(err)====>:' + err); } + sleep(300); console.debug('= ACTS_beforeAll ==== delay) { + break; + } + } + } + /* * @tc.number: ACTS_AcquireDataAbilityHelper_0100 * @tc.name: GetDataAbilityHelper : Connects an ability to a Service ability @@ -59,13 +69,13 @@ describe('ActsDataAbilityHelperTest', function () { console.log('ACTS_AcquireDataAbilityHelper_0100====" + dataAbilityUri) try { - var abilityHelper = featureAbility.acquireDataAbilityHelper(dataAbilityUri) - console.log('ACTS_AcquireDataAbilityHelper_0100 abilityHelper ====>: ' - + abilityHelper + " ,JSON. " + JSON.stringify(abilityHelper)) if(DAHelper == null){ + var abilityHelper = featureAbility.acquireDataAbilityHelper(dataAbilityUri) + console.log('ACTS_AcquireDataAbilityHelper_0100 abilityHelper ====>: ' + + abilityHelper + " ,JSON. " + JSON.stringify(abilityHelper)) DAHelper = abilityHelper; } - expect(typeof (abilityHelper)).assertEqual("object"); + expect(typeof (DAHelper)).assertEqual("object"); } catch (err) { console.error('=ACTS_GetDataAbilityHelper_0100 acquireDataAbilityHelper catch(err)====>:' + err); expect(false).assertTrue(); @@ -8317,146 +8327,4 @@ describe('ActsDataAbilityHelperTest', function () { done(); } }) - - /* - * @tc.number: ACTS_Release_0100 - * @tc.name: Releases the client resource of the Data ability. - * @tc.desc: Check the return value of the interface (by promise) - */ - it('ACTS_Release_0100', 0, async function (done) { - console.log('ACTS_Release_0100====: ' + rDAHelper + " ,JSON. " + JSON.stringify(rDAHelper)); - expect(typeof (rDAHelper)).assertEqual("object"); - rDAHelper.release().then((data) => { - console.debug("=ACTS_Release_0100 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data); - expect(data).assertEqual(true); - console.log('ACTS_Release_0100==== { - console.debug("=ACTS_Release_0100 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.log('ACTS_Release_0100====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Release_0100====: ' + rDAHelper + " ,JSON. " + JSON.stringify(rDAHelper)); - expect(typeof (rDAHelper)).assertEqual("object"); - rDAHelper.release((err, data) => { - console.debug("=ACTS_Release_0200 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - console.log('featureAbility getDataAbilityHelper ACTS_Release_0200 data: ' + data) - expect(data).assertEqual(true); - console.log('ACTS_Release_0200====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Release_0200====: ' + rDAHelper + " ,JSON. " + JSON.stringify(rDAHelper)); - expect(typeof (rDAHelper)).assertEqual("object"); - rDAHelper.release().then((data) => { - console.debug("=ACTS_Release_0300 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data); - expect(data).assertEqual(true); - rDAHelper.release().then((data) => { - console.debug("=ACTS_Release_0300 then data====>" - + ("json data 【") + JSON.stringify(data) + (" 】") + " , " + data); - expect(data).assertEqual(false); - console.log('ACTS_Release_0300==== { - console.debug("=ACTS_Release_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.log('ACTS_Release_0300==== { - console.debug("=ACTS_Release_0300 catch err ====>" - + ("json err 【") + JSON.stringify(err) + (" 】 ")); - expect(false).assertTrue(); - console.log('ACTS_Release_0300====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Release_0300====: ' + rDAHelper + " ,JSON. " + JSON.stringify(rDAHelper)); - expect(typeof (rDAHelper)).assertEqual("object"); - rDAHelper.release((err, data) => { - console.debug("=ACTS_Release_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" 】json data【") + JSON.stringify(data) + (" 】;")); - console.log('featureAbility getDataAbilityHelper ACTS_Release_0400 data: ' + data) - expect(data).assertEqual(true); - rDAHelper.release((err, data) => { - console.debug("=ACTS_Release_0400 err,data=======>" - + ("json err【") + JSON.stringify(err) + (" ,") + JSON.stringify(data) + (" 】;")); - console.log('featureAbility getDataAbilityHelper ACTS_Release_0400 data: ' + data) - expect(data).assertEqual(false); - console.log('ACTS_Release_0400====:' + err); - expect(false).assertTrue(); - console.log('ACTS_Release_0400==== { + console.debug('= ACTS_beforeAll ====: ' + DAHelper + " ,JSON. " + JSON.stringify(DAHelper)); + if(DAHelper == null){ + console.debug('ACTS_beforeAll DAHelper ====>: DAHelper == null'); + } + } catch (err) { + console.error('=ACTS_beforeAll acquireDataAbilityHelper catch(err)====>:' + err); + } + console.debug('= ACTS_beforeAll ==== { + console.debug('= ACTS_afterAll ====" + dataAbilityUri) + try { + if(DAHelper == null){ + var abilityHelper = featureAbility.acquireDataAbilityHelper(dataAbilityUri) + console.log('ACTS_AcquireDataAbilityHelper_0100 abilityHelper ====>: ' + + abilityHelper + " ,JSON. " + JSON.stringify(abilityHelper)) + DAHelper = abilityHelper; + } + expect(typeof (DAHelper)).assertEqual("object"); + } catch (err) { + console.error('=ACTS_GetDataAbilityHelper_0100 acquireDataAbilityHelper catch(err)====>:' + err); + expect(false).assertTrue(); + } + expect(true).assertTrue(); + console.log('ACTS_AcquireDataAbilityHelper_0100====: ' + DAHelper) + let valueBucketM; + try { + DAHelper.insert(dataAbilityUri, valueBucketM) + .then(function (data) { + console.debug("=ACTS_Insert_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(JSON.stringify(data)).assertEqual("-1") + console.log('ACTS_Insert_0100====" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.log('ACTS_Insert_0100====:' + err); + expect(false).assertTrue(); + console.log('ACTS_Insert_0100====: ' + DAHelper) + var valueBucketM; + try { + DAHelper.batchInsert( + dataAbilityUri, + valueBucketM + ).then((data) => { + console.debug("=ACTS_BatchInsert_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】; ====>")); + expect(JSON.stringify(data)).assertEqual("-1") + console.log('ACTS_BatchInsert_0100==== { + console.debug("=ACTS_BatchInsert_0100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_BatchInsert_0100====:' + err); + console.log('ACTS_BatchInsert_0100==== { + console.debug("=ACTS_Query_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data).assertEqual(null); + console.log('ACTS_Query_0100==== { + console.debug("=ACTS_Query_0100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_Query_0100====:' + err); + console.log('ACTS_Query_0100====: ' + DAHelper) + try { + let valueBucketNull = {}; + let predicates = new ohosDataAbility.DataAbilityPredicates(); + console.debug("=ACTS_Update_0100 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.update( + dataAbilityUri, + valueBucketNull, + predicates + ).then((data) => { + console.debug("=ACTS_Update_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(JSON.stringify(data)).assertEqual("-1") + console.log('ACTS_Update_0100==== { + console.debug("=ACTS_Update_0100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.log('ACTS_Update_0100====:' + err); + expect(false).assertTrue(); + console.log('ACTS_Update_0100====: ' + DAHelper); + try { + let predicates = new ohosDataAbility.DataAbilityPredicates(); + console.debug("=ACTS_Delete_0100 predicates====>" + + ("json predicates 【") + JSON.stringify(predicates) + (" 】") + " , " + predicates); + DAHelper.delete( + dataAbilityUri, + predicates + ).then((data) => { + console.debug("=ACTS_Delete_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(JSON.stringify(data)).assertEqual("-1") + console.log('ACTS_Delete_0100==== { + console.debug("=ACTS_Delete_0100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + console.log('ACTS_Delete_0100====:' + err); + expect(false).assertTrue(); + console.log('ACTS_Delete_0100==== { + console.debug("=ACTS_OpenFile_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(JSON.stringify(data)).assertEqual("-1") + done(); + }).catch(err => { + console.debug("=ACTS_OpenFile_0100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + expect(false).assertTrue(); + done(); + }); + } catch (err) { + console.error('=ACTS_OpenFile_0100 getType catch(err)====>:' + err); + expect(false).assertTrue(); + done(); + } + }) + + /* + * @tc.number: ACTS_NormalizeUri_0100 + * @tc.name: Converts the given uri that refer to the Data ability into a normalized URI. + * @tc.desc: Check the return value of the interface (by promise) + */ + it('ACTS_NormalizeUri_0100', 0, async function (done) { + console.log('ACTS_NormalizeUri_0100====: ' + DAHelper); + try { + DAHelper.normalizeUri( + dataAbilityUri, + ).then((data) => { + console.debug("=ACTS_NormalizeUri_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data.length).assertEqual(0); + console.log('ACTS_NormalizeUri_0100==== { + console.debug("=ACTS_NormalizeUri_0100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_NormalizeUri_0100====:' + err); + console.log('ACTS_NormalizeUri_0100====: ' + DAHelper); + try { + DAHelper.denormalizeUri( + dataAbilityUri, + ).then((data) => { + console.debug("=ACTS_DenormalizeUri_0100 then data====>" + + ("json data 【") + JSON.stringify(data) + (" 】")); + expect(data.length).assertEqual(0); + console.log('ACTS_DenormalizeUri_0100==== { + console.debug("=ACTS_DenormalizeUri_0100 catch err ====>" + + ("json err 【") + JSON.stringify(err) + (" 】 ")); + console.log('ACTS_DenormalizeUri_0100====:' + err); + console.log('ACTS_DenormalizeUri_0100====ACTS_GetAbilityState_0300 state:" + state); expect(state).assertEqual(AbilityDelegatorRegistry.AbilityLifecycleState.FOREGROUND); + expect(state != AbilityDelegatorRegistry.AbilityLifecycleState.CREATE).assertTrue() + expect(state != AbilityDelegatorRegistry.AbilityLifecycleState.DESTROY).assertTrue() abilityDelegator.doAbilityBackground(ability, (err, isBackground)=>{ console.debug("====>doAbilityBackground_0300 data:" + JSON.stringify(isBackground)); expect(isBackground).assertTrue(); diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/module.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/module.json index a8779c99a35f86d0fe682bebc3f05922edee2ce3..ef30793d100bdfe17f02713a68a762aa0ff15bab 100644 --- a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/module.json +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], @@ -53,6 +54,16 @@ "icon": "$media:icon", "label": "$string:MainAbility4_label" } + ], + "requestPermissions": [ + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" + } ] } } \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/module.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/module.json index 4130395f9b9fb4787e299ae0ee0e3d9bc58c41fd..0dbcd3cba07228d4a8b161c954c9f0ed6974ac46 100644 --- a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/module.json +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstageatest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], @@ -41,6 +42,16 @@ "visible": true, "launchType": "singleton" } + ], + "requestPermissions": [ + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" + } ] } } \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/module.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/module.json index 4130395f9b9fb4787e299ae0ee0e3d9bc58c41fd..0dbcd3cba07228d4a8b161c954c9f0ed6974ac46 100644 --- a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/module.json +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontextstagebtest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], @@ -41,6 +42,16 @@ "visible": true, "launchType": "singleton" } + ], + "requestPermissions": [ + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" + } ] } } \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/module.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/module.json index 4130395f9b9fb4787e299ae0ee0e3d9bc58c41fd..0dbcd3cba07228d4a8b161c954c9f0ed6974ac46 100644 --- a/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/module.json +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetappcontexttest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], @@ -41,6 +42,16 @@ "visible": true, "launchType": "singleton" } + ], + "requestPermissions": [ + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" + } ] } } \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/module.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/module.json index fe9e3ab7c2cf97d85eab89937b7663c227d3eb34..1a6fa9151a78d2690410cbb3c15ddb9caddd1917 100644 --- a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/module.json +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystageatest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], @@ -46,6 +47,16 @@ "icon": "$media:icon", "label": "$string:Ability2_label" } + ], + "requestPermissions": [ + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" + } ] } } \ No newline at end of file diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/module.json b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/module.json index fe9e3ab7c2cf97d85eab89937b7663c227d3eb34..1a6fa9151a78d2690410cbb3c15ddb9caddd1917 100644 --- a/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/module.json +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetcurrenttopabilitystagebtest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], @@ -46,6 +47,16 @@ "icon": "$media:icon", "label": "$string:Ability2_label" } + ], + "requestPermissions": [ + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" + } ] } } \ No newline at end of file diff --git a/ability/ability_runtime/actsserviceabilityclienttest/BUILD.gn b/ability/ability_runtime/actsserviceabilityclienttest/BUILD.gn index f1fdbde7189be1310a8a681410275073a6ea864e..00cc7dcb1444be838e228dc7f851dc56076cbf32 100644 --- a/ability/ability_runtime/actsserviceabilityclienttest/BUILD.gn +++ b/ability/ability_runtime/actsserviceabilityclienttest/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/BUILD.gn b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/BUILD.gn index adb077d8ae9ba2966202ca4b2e1f1472d5a769a2..6fd401246613abe853f6c9a79e7fd6397a939a47 100644 --- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/BUILD.gn +++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/config.json b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/config.json index c8779ae95cecb444f31bb20fa6d8f8c2a2e6fdc1..15d5a27d063781a24281822e9a2bcdca1ba2da1a 100644 --- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/config.json +++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/test/StServiceAbilityClient.test.js b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/test/StServiceAbilityClient.test.js index 51c02cccfac200139fc1681267318dbad61b4bc6..245ff215008a8839d17196af02aca0a58f6e08d5 100644 --- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/test/StServiceAbilityClient.test.js +++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityclienttest/src/main/js/test/StServiceAbilityClient.test.js @@ -15,842 +15,813 @@ import featureAbility from '@ohos.ability.featureAbility' import commonEvent from '@ohos.commonEvent' -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import { describe, afterEach, it, expect } from '@ohos/hypium' export default function ActsStServiceAbilityTest() { -describe('ActsStServiceAbilityTest', function () { - let bundleName = "com.amsst.stserviceabilityserver"; - let abilityName = "com.amsst.stserviceabilityserver.ServiceAbility"; + describe('ActsStServiceAbilityTest', function () { + let bundleName = "com.amsst.stserviceabilityserver"; + let abilityName = "com.amsst.stserviceabilityserver.ServiceAbility"; - var subscriber0100; - var CommonEventSubscribeInfo0100 = { - events: ["ACTS_SerivceAbilityServer_onCommand_PageStartService_0100", - ], - }; - var subscriber0200; - var CommonEventSubscribeInfo0200 = { - events: ["ACTS_SerivceAbilityServer_onCommand_PageStartService_0200", - ], - }; - var subscriber0300; - var CommonEventSubscribeInfo0300 = { - events: ["ACTS_SerivceAbilityServer_onCommand_PageStartService_0300", + let subscriber0100; + let CommonEventSubscribeInfo0100 = { + events: ["ACTS_SerivceAbilityServer_onCommand_PageStartService_0100", + ], + }; + let subscriber0200; + let CommonEventSubscribeInfo0200 = { + events: ["ACTS_SerivceAbilityServer_onCommand_PageStartService_0200", + ], + }; + let subscriber0300; + let CommonEventSubscribeInfo0300 = { + events: ["ACTS_SerivceAbilityServer_onCommand_PageStartService_0300", "ACTS_SerivceAbilityServer_onCommand_PageStartService_0301", - ], - }; - var subscriber0400; - var CommonEventSubscribeInfo0400 = { - events: ["ACTS_SerivceAbilityServer_onCommand_PageStartService_0400", + ], + }; + let subscriber0400; + let CommonEventSubscribeInfo0400 = { + events: ["ACTS_SerivceAbilityServer_onCommand_PageStartService_0400", "ACTS_SerivceAbilityServer_onCommand_PageStartService_0401", - ], - }; - var subscriber0500; - var CommonEventSubscribeInfo0500 = { - events: ["ACTS_SerivceAbilityServer_onConnect_PageConnectService_0500", - "ACTS_SerivceAbilityServer_onDisConnect", - ], - }; - var subscriber0600; - var CommonEventSubscribeInfo0600 = { - events: ["ACTS_SerivceAbilityServer_onConnect_PageConnectService_0600", - "ACTS_SerivceAbilityServer_onDisConnect", - ], - }; - var subscriber0900; - var CommonEventSubscribeInfo0900 = { - events: ["ACTS_SerivceAbilityServerSecond_onCommand_ServiceStartService_0900", - ], - }; - var subscriber1000; - var CommonEventSubscribeInfo1000 = { - events: ["ACTS_SerivceAbilityServerSecond_onCommand_ServiceStartService_1000", - ], - }; - var subscriber1300; - var CommonEventSubscribeInfo1300 = { - events: ["ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1300", - "ACTS_SerivceAbilityServerSecond_onDisConnect", - ], - }; - var subscriber1400; - var CommonEventSubscribeInfo1400 = { - events: ["ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1400", - "ACTS_SerivceAbilityServerSecond_onDisConnect", - ], - }; - var subscriber1500; - var CommonEventSubscribeInfo1500 = { - events: ["ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1500", - "ACTS_SerivceAbilityServer_onDisConnect", - ], - }; + ], + }; + let subscriber0500; + let CommonEventSubscribeInfo0500 = { + events: ["ACTS_SerivceAbilityServer_onConnect_PageConnectService_0500", + "ACTS_SerivceAbilityServer_onDisConnect_PageConnectService_0500", + ], + }; + let subscriber0600; + let CommonEventSubscribeInfo0600 = { + events: ["ACTS_SerivceAbilityServer_onConnect_PageConnectService_0600", + "ACTS_SerivceAbilityServer_onDisConnect_PageConnectService_0600", + ], + }; + let subscriber0900; + let CommonEventSubscribeInfo0900 = { + events: ["ACTS_SerivceAbilityServerSecond_onCommand_ServiceStartService_0900", + ], + }; + let subscriber1000; + let CommonEventSubscribeInfo1000 = { + events: ["ACTS_SerivceAbilityServerSecond_onCommand_ServiceStartService_1000", + ], + }; + let subscriber1300; + let CommonEventSubscribeInfo1300 = { + events: ["ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1300", + "ACTS_SerivceAbilityServerSecond_onDisConnect_ServiceConnectService_1300", + ], + }; + let subscriber1400; + let CommonEventSubscribeInfo1400 = { + events: ["ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1400", + "ACTS_SerivceAbilityServerSecond_onDisConnect_ServiceConnectService_1400", + ], + }; + let subscriber1500; + let CommonEventSubscribeInfo1500 = { + events: ["ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1500", + "ACTS_SerivceAbilityServer_onDisConnect_ServiceConnectService_1500", + ], + }; - function unsubscribe(caller, subscriber) { - commonEvent.unsubscribe(subscriber, (err, data) => { - console.debug("=ACTS_unsubscribe (err,data)=======>" + function unsubscribe(caller, subscriber) { + commonEvent.unsubscribe(subscriber, (err, data) => { + console.debug("=ACTS_unsubscribe (err,data)=======>" + (caller) + (" , json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") + " ,err=" + err + " ,data=" + data); - }); - } - let gSetTimeout = 1000 - beforeAll(async (done) => { - console.debug('= ACTS_beforeAll ==== { - setTimeout(function () { - done(); - }, gSetTimeout); - }) - afterEach(async (done) => { - setTimeout(function () { - done(); - }, gSetTimeout); - }) - afterAll((done) => { - console.debug('= ACTS_afterAll ==== setTimeout(resolve, ms)); + } + let gSetTimeout = 2000 + afterEach(async (done) => { + setTimeout(function () { + done(); + }, gSetTimeout); + }) - /* - * @tc.number: ACTS_JsServiceAbility_0100 - * @tc.name: featureAbility.startAbility : Use page to test startAbiltiy service. - * @tc.desc: Check the return value of the interface (by Promise) - */ - it('ACTS_JsServiceAbility_0100', 0, async function (done) { - console.debug('ACTS_JsServiceAbility_0100==== { - console.debug("=ACTS_JsServiceAbility_0100 createSubscriber .then(data)=======>" + /* + * @tc.number: ACTS_JsServiceAbility_0100 + * @tc.name: featureAbility.startAbility : Use page to test startAbiltiy service. + * @tc.desc: Check the return value of the interface (by Promise) + */ + it('ACTS_JsServiceAbility_0100', 0, async function (done) { + console.debug('ACTS_JsServiceAbility_0100==== { + console.debug("=ACTS_JsServiceAbility_0100 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); - subscriber0100 = data; - await commonEvent.subscribe(subscriber0100, async (err, data) => { - console.debug("=ACTS_JsServiceAbility_0100 subscribe (err,data)=======>" + subscriber0100 = data; + commonEvent.subscribe(subscriber0100, (err, data) => { + console.debug("=ACTS_JsServiceAbility_0100 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") + " ,err=" + err + " ,data=" + data); - expect("ACTS_SerivceAbilityServer_onCommand_PageStartService_0100").assertEqual( - data.event); - unsubscribe("ACTS_JsServiceAbility_0100_unsubscribe", subscriber0100); - console.debug('ACTS_JsServiceAbility_0100==== { - console.debug("=ACTS_JsServiceAbility_0100 .then(data)=======>" + want: + { + bundleName: bundleName, + abilityName: abilityName, + action: "PageStartService_0100", + }, + } + ).then(data => { + console.debug("=ACTS_JsServiceAbility_0100 .then(data)=======>" + ("abilityStartSetting json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); - }).catch(err => { - expect(".catch").assertEqual(err); - console.debug('ACTS_JsServiceAbility_0100==== { + expect(".catch").assertEqual(err); + console.debug('ACTS_JsServiceAbility_0100==== { - console.debug("=ACTS_JsServiceAbility_0200 createSubscriber .then(data)=======>" + /* + * @tc.number: ACTS_JsServiceAbility_0200 + * @tc.name: featureAbility.startAbility : Use page to test startAbiltiy service. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + */ + it('ACTS_JsServiceAbility_0200', 0, async function (done) { + console.debug('ACTS_JsServiceAbility_0200==== { + console.debug("=ACTS_JsServiceAbility_0200 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); - subscriber0200 = data; - await commonEvent.subscribe(subscriber0200, async (err, data) => { - console.debug("=ACTS_JsServiceAbility_0200 subscribe (err,data)=======>" + subscriber0200 = data; + commonEvent.subscribe(subscriber0200, (err, data) => { + console.debug("=ACTS_JsServiceAbility_0200 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") + " ,err=" + err + " ,data=" + data); - expect("ACTS_SerivceAbilityServer_onCommand_PageStartService_0200").assertEqual( - data.event); - unsubscribe("ACTS_JsServiceAbility_0200_unsubscribe", subscriber0200); - console.debug('ACTS_JsServiceAbility_0200==== { + want: + { + bundleName: bundleName, + abilityName: abilityName, + action: "PageStartService_0200", + }, + }, (err, data) => { console.debug("=ACTS_JsServiceAbility_0200 startAbility (err,data)=======>" - + ("abilityStartSetting json err【") + JSON.stringify(err) + (" 】") - + ("json data【") + JSON.stringify(data) + (" 】") - + " ,err=" + err + " ,data=" + data); + + ("abilityStartSetting json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); } - ) - } catch (err) { - expect("catch").assertEqual(err); - console.debug('ACTS_JsServiceAbility_0200==== { - console.debug("=ACTS_JsServiceAbility_0300 createSubscriber .then(data)=======>" + /* + * @tc.number: ACTS_JsServiceAbility_0300 + * @tc.name: featureAbility.startAbility : Use page to test startAbiltiy service. + * @tc.desc: Check the return value of the interface (by Promise) + */ + it('ACTS_JsServiceAbility_0300', 0, async function (done) { + console.debug('ACTS_JsServiceAbility_0300==== { + console.debug("=ACTS_JsServiceAbility_0300 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); - subscriber0300 = data; - await commonEvent.subscribe(subscriber0300, async (err, data) => { - console.debug("=ACTS_JsServiceAbility_0300 subscribe (err,data)=======>" + subscriber0300 = data; + commonEvent.subscribe(subscriber0300, (err, data) => { + console.debug("=ACTS_JsServiceAbility_0300 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") + " ,err=" + err + " ,data=" + data); - if (data.event == "ACTS_SerivceAbilityServer_onCommand_PageStartService_0300") { - expect("ACTS_SerivceAbilityServer_onCommand_PageStartService_0300").assertEqual( - data.event); - featureAbility.startAbility( - { - want: + if (data.event == "ACTS_SerivceAbilityServer_onCommand_PageStartService_0300") { + expect("ACTS_SerivceAbilityServer_onCommand_PageStartService_0300").assertEqual( + data.event); + featureAbility.startAbility( { - bundleName: bundleName, - abilityName: abilityName, - action: "PageStartService_0301", - }, - } - ).then(data => { - console.debug("=ACTS_JsServiceAbility_0300 .then(data) 2=======>" + want: + { + bundleName: bundleName, + abilityName: abilityName, + action: "PageStartService_0301", + }, + } + ).then(data => { + console.debug("=ACTS_JsServiceAbility_0300 .then(data) 2=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); - }).catch(err => { - expect(".catch").assertEqual(err); - console.debug('ACTS_JsServiceAbility_0300==== { + expect().assertFail() + console.debug('ACTS_JsServiceAbility_0300==== err: ' + JSON.stringify(err)); + done(); + }) + } else { + expect("ACTS_SerivceAbilityServer_onCommand_PageStartService_0301").assertEqual( + data.event); + unsubscribe("ACTS_JsServiceAbility_0300_unsubscribe", subscriber0300); + console.debug('ACTS_JsServiceAbility_0300==== { - console.debug("=ACTS_JsServiceAbility_0300 .then(data) 1=======>" + want: + { + bundleName: bundleName, + abilityName: abilityName, + action: "PageStartService_0300", + }, + } + ).then(data => { + console.debug("=ACTS_JsServiceAbility_0300 .then(data) 1=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); - }).catch(err => { - expect(".catch").assertEqual(err); - console.debug('ACTS_JsServiceAbility_0300==== { + expect(".catch").assertEqual(err); + console.debug('ACTS_JsServiceAbility_0300==== { - console.debug("=ACTS_JsServiceAbility_0400 createSubscriber .then(data)=======>" + /* + * @tc.number: ACTS_JsServiceAbility_0400 + * @tc.name: featureAbility.startAbility : Use page to test startAbiltiy service. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + */ + it('ACTS_JsServiceAbility_0400', 0, async function (done) { + console.debug('ACTS_JsServiceAbility_0400==== { + console.debug("=ACTS_JsServiceAbility_0400 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); - subscriber0400 = data; - await commonEvent.subscribe(subscriber0400, async (err, data) => { - console.debug("=ACTS_JsServiceAbility_0400 subscribe (err,data)=======>" + subscriber0400 = data; + commonEvent.subscribe(subscriber0400, (err, data) => { + console.debug("=ACTS_JsServiceAbility_0400 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") + " ,err=" + err + " ,data=" + data); - if (data.event == "ACTS_SerivceAbilityServer_onCommand_PageStartService_0400") { - expect("ACTS_SerivceAbilityServer_onCommand_PageStartService_0400").assertEqual( - data.event); - featureAbility.startAbility( - { - want: + if (data.event == "ACTS_SerivceAbilityServer_onCommand_PageStartService_0400") { + expect("ACTS_SerivceAbilityServer_onCommand_PageStartService_0400").assertEqual( + data.event); + featureAbility.startAbility( { - bundleName: bundleName, - abilityName: abilityName, - action: "PageStartService_0401", - }, - }, (err, data) => { + want: + { + bundleName: bundleName, + abilityName: abilityName, + action: "PageStartService_0401", + }, + }, (err, data) => { console.debug("=ACTS_JsServiceAbility_0400 startAbility (err,data) 2=======>" - + ("json err【") + JSON.stringify(err) + (" 】") - + ("json data【") + JSON.stringify(data) + (" 】") - + " ,err=" + err + " ,data=" + data); + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); } - ) - } else { - expect("ACTS_SerivceAbilityServer_onCommand_PageStartService_0401").assertEqual( - data.event); - unsubscribe("ACTS_JsServiceAbility_0400_unsubscribe", subscriber0400); - console.debug('ACTS_JsServiceAbility_0400==== { + want: + { + bundleName: bundleName, + abilityName: abilityName, + action: "PageStartService_0400", + }, + }, (err, data) => { console.debug("=ACTS_JsServiceAbility_0400 startAbility (err,data) 1=======>" - + ("json err【") + JSON.stringify(err) + (" 】") - + ("json data【") + JSON.stringify(data) + (" 】") - + " ,err=" + err + " ,data=" + data); + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); } - ) - } catch (err) { - expect("catch").assertEqual(err); - console.debug('ACTS_JsServiceAbility_0400==== { - console.debug("=ACTS_JsServiceAbility_0500 createSubscriber .then(data)=======>" + /* + * @tc.number: ACTS_JsServiceAbility_0500 + * @tc.name: featureAbility.ConnectAbility : Connects an ability to a Service ability. + * @tc.desc: Check the return value of the interface (by Promise) + */ + it('ACTS_JsServiceAbility_0500', 0, async function (done) { + console.log('ACTS_JsServiceAbility_0500==== { + console.debug("=ACTS_JsServiceAbility_0500 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); - subscriber0500 = data; - await commonEvent.subscribe(subscriber0500, async (err, data) => { - console.debug("=ACTS_JsServiceAbility_0500 subscribe (err,data)=======>" + subscriber0500 = data; + commonEvent.subscribe(subscriber0500, (err, data) => { + console.debug("=ACTS_JsServiceAbility_0500 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") + " ,err=" + err + " ,data=" + data); - if (data.event != "ACTS_SerivceAbilityServer_onDisConnect") { - expect("ACTS_SerivceAbilityServer_onConnect_PageConnectService_0500").assertEqual( - data.event); - featureAbility.disconnectAbility(mConnIdJsPromise).then(() => { - }).catch(err => { - expect(".catch").assertEqual(err); - console.debug('ACTS_JsServiceAbility_0500==== { + console.debug("=ACTS_JsServiceAbility_0500 disconnectAbility err====>" + + ("json err=") + JSON.stringify(err)); + }).catch(err => { + expect().assertFail() + console.debug('ACTS_JsServiceAbility_0500==== err: ' + JSON.stringify(err)); + done() + }) + } else { + expect("ACTS_SerivceAbilityServer_onDisConnect_PageConnectService_0500") + .assertEqual(data.event); + unsubscribe("ACTS_JsServiceAbility_0500_unsubscribe", subscriber0500); + console.debug('ACTS_JsServiceAbility_0500==== mConnIdJsPromise=' + } + }); + }) + function onConnectCallback(element, remote) { + console.debug('ACTS_JsServiceAbility_0500_onConnectCallback ====> mConnIdJsPromise=' + JSON.stringify(mConnIdJsPromise) + " , " + mConnIdJsPromise); - console.debug('ACTS_JsServiceAbility_0500_onConnectCallback ====> element=' + console.debug('ACTS_JsServiceAbility_0500_onConnectCallback ====> element=' + JSON.stringify(element) + " , " + element); - console.debug('ACTS_JsServiceAbility_0500_onConnectCallback ====> remote=' + console.debug('ACTS_JsServiceAbility_0500_onConnectCallback ====> remote=' + JSON.stringify(remote) + " , " + remote); - console.debug('ACTS_JsServiceAbility_0500_onConnectCallback ====> remote is proxy:' + console.debug('ACTS_JsServiceAbility_0500_onConnectCallback ====> remote is proxy:' + (remote instanceof rpc.RemoteProxy)); - } + } - function onDisconnectCallback(element) { - console.debug('ACTS_JsServiceAbility_0500_onDisconnectCallback ====> element=' + function onDisconnectCallback(element) { + console.debug('ACTS_JsServiceAbility_0500_onDisconnectCallback ====> element=' + JSON.stringify(element) + " , " + element); - } + } - function onFailedCallback(code) { - console.debug('ACTS_JsServiceAbility_0500_onFailedCallback ====> code=' + function onFailedCallback(code) { + console.debug('ACTS_JsServiceAbility_0500_onFailedCallback ====> code=' + JSON.stringify(code) + " , " + code) - } + } - mConnIdJsPromise = featureAbility.connectAbility( - { - bundleName: bundleName, - abilityName: abilityName, - action: "PageConnectService_0500", - }, - { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback, - }, - ) - } catch (err) { - expect("catch").assertEqual(err); - console.log('ACTS_JsServiceAbility_0500==== { - console.debug("=ACTS_JsServiceAbility_0600 createSubscriber .then(data)=======>" + /* + * @tc.number: ACTS_JsServiceAbility_0600 + * @tc.name: featureAbility.ConnectAbility : Connects an ability to a Service ability. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + */ + it('ACTS_JsServiceAbility_0600', 0, async function (done) { + console.log('ACTS_JsServiceAbility_0600==== { + console.debug("=ACTS_JsServiceAbility_0600 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); - subscriber0600 = data; - await commonEvent.subscribe(subscriber0600, async (err, data) => { - console.debug("=ACTS_JsServiceAbility_0600 subscribe (err,data)=======>" + subscriber0600 = data; + commonEvent.subscribe(subscriber0600, (err, data) => { + console.debug("=ACTS_JsServiceAbility_0600 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") + " ,err=" + err + " ,data=" + data); - if (data.event != "ACTS_SerivceAbilityServer_onDisConnect") { - expect("ACTS_SerivceAbilityServer_onConnect_PageConnectService_0600").assertEqual( - data.event); - featureAbility.disconnectAbility(mConnIdJsAsyncCallback, (err) => { - console.debug("=ACTS_JsServiceAbility_0600 disconnectAbility err====>" + if (data.event == "ACTS_SerivceAbilityServer_onConnect_PageConnectService_0600") { + featureAbility.disconnectAbility(mConnIdJsAsyncCallback, (err) => { + console.debug("=ACTS_JsServiceAbility_0600 disconnectAbility err====>" + ("json err=") + JSON.stringify(err)); - }) - currentAlertTimeout = setTimeout(() => { - console.log('ACTS_JsServiceAbility_0600==== mConnIdJsAsyncCallback=' + } + }); + }) + function onConnectCallback(element, remote) { + console.debug('ACTS_JsServiceAbility_0600_onConnectCallback ====> mConnIdJsAsyncCallback=' + JSON.stringify(mConnIdJsAsyncCallback) + " , " + mConnIdJsAsyncCallback); - console.debug('ACTS_JsServiceAbility_0600_onConnectCallback ====> element=' + console.debug('ACTS_JsServiceAbility_0600_onConnectCallback ====> element=' + JSON.stringify(element) + " , " + element); - console.debug('ACTS_JsServiceAbility_0600_onConnectCallback ====> remote=' + console.debug('ACTS_JsServiceAbility_0600_onConnectCallback ====> remote=' + JSON.stringify(remote) + " , " + remote); - console.debug('ACTS_JsServiceAbility_0600_onConnectCallback ====> remote is proxy:' + console.debug('ACTS_JsServiceAbility_0600_onConnectCallback ====> remote is proxy:' + (remote instanceof rpc.RemoteProxy)); - } + } - function onDisconnectCallback(element) { - console.debug('ACTS_JsServiceAbility_0600_onDisconnectCallback ====> element=' + function onDisconnectCallback(element) { + console.debug('ACTS_JsServiceAbility_0600_onDisconnectCallback ====> element=' + JSON.stringify(element) + " , " + element); - } + } - function onFailedCallback(code) { - console.debug('ACTS_JsServiceAbility_0600_onFailedCallback ====> code=' + function onFailedCallback(code) { + console.debug('ACTS_JsServiceAbility_0600_onFailedCallback ====> code=' + JSON.stringify(code) + " , " + code) - expect(code==featureAbility.ErrorCode.ABILITY_NOT_FOUND - || (code!=featureAbility.ErrorCode.NO_ERROR - || code!=featureAbility.ErrorCode.INVALID_PARAMETER - || code!=featureAbility.ErrorCode.PERMISSION_DENY + expect(code == featureAbility.ErrorCode.ABILITY_NOT_FOUND + || (code != featureAbility.ErrorCode.NO_ERROR + || code != featureAbility.ErrorCode.INVALID_PARAMETER + || code != featureAbility.ErrorCode.PERMISSION_DENY )).assertTrue(); - } + } - mConnIdJsAsyncCallback = featureAbility.connectAbility( - { - bundleName: bundleName, - abilityName: abilityName, - action: "PageConnectService_0600", - }, - { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback, - }, - ) - } catch (err) { - expect("catch").assertEqual(err); - console.log('ACTS_JsServiceAbility_0600==== { - console.debug("=ACTS_JsServiceAbility_0900 createSubscriber .then(data)=======>" + /* + * @tc.number: ACTS_JsServiceAbility_0900 + * @tc.name: particleability.startAbility : Use page to test startAbiltiy service. + * @tc.desc: Check the return value of the interface (by Promise) + */ + it('ACTS_JsServiceAbility_0900', 0, async function (done) { + console.debug('ACTS_JsServiceAbility_0900==== { + console.debug("=ACTS_JsServiceAbility_0900 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); - subscriber0900 = data; - await commonEvent.subscribe(subscriber0900, async (err, data) => { - console.debug("=ACTS_JsServiceAbility_0900 subscribe (err,data)=======>" + subscriber0900 = data; + commonEvent.subscribe(subscriber0900, (err, data) => { + console.debug("=ACTS_JsServiceAbility_0900 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") + " ,err=" + err + " ,data=" + data); - expect("ACTS_SerivceAbilityServerSecond_onCommand_ServiceStartService_0900").assertEqual( - data.event); - unsubscribe("ACTS_JsServiceAbility_0900_unsubscribe", subscriber0900); - console.debug('ACTS_JsServiceAbility_0900==== { - console.debug("=ACTS_JsServiceAbility_0900 .then(data)=======>" + want: + { + bundleName: bundleName, + abilityName: abilityName, + action: "ServiceStartService_0900", + }, + } + ).then(data => { + console.debug("=ACTS_JsServiceAbility_0900 .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); - }).catch(err => { - expect(".catch").assertEqual(err); - console.debug('ACTS_JsServiceAbility_0900==== { + expect(".catch").assertEqual(err); + console.debug('ACTS_JsServiceAbility_0900==== { - console.debug("=ACTS_JsServiceAbility_1000 createSubscriber .then(data)=======>" + /* + * @tc.number: ACTS_JsServiceAbility_1000 + * @tc.name: particleability.startAbility : Use page to test startAbiltiy service. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + */ + it('ACTS_JsServiceAbility_1000', 0, async function (done) { + console.debug('ACTS_JsServiceAbility_1000==== { + console.debug("=ACTS_JsServiceAbility_1000 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); - subscriber1000 = data; - await commonEvent.subscribe(subscriber1000, async (err, data) => { - console.debug("=ACTS_JsServiceAbility_1000 subscribe (err,data)=======>" + subscriber1000 = data; + commonEvent.subscribe(subscriber1000, (err, data) => { + console.debug("=ACTS_JsServiceAbility_1000 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") + " ,err=" + err + " ,data=" + data); - expect("ACTS_SerivceAbilityServerSecond_onCommand_ServiceStartService_1000").assertEqual( - data.event); - unsubscribe("ACTS_JsServiceAbility_1000_unsubscribe", subscriber1000); - console.debug('ACTS_JsServiceAbility_1000==== { + want: + { + bundleName: bundleName, + abilityName: abilityName, + action: "ServiceStartService_1000", + }, + }, (err, data) => { console.debug("=ACTS_JsServiceAbility_1000 startAbility (err,data)=======>" - + ("json err【") + JSON.stringify(err) + (" 】") - + ("json data【") + JSON.stringify(data) + (" 】") - + " ,err=" + err + " ,data=" + data); + + ("json err【") + JSON.stringify(err) + (" 】") + + ("json data【") + JSON.stringify(data) + (" 】") + + " ,err=" + err + " ,data=" + data); } - ) - } catch (err) { - expect("catch").assertEqual(err); - console.debug('ACTS_JsServiceAbility_1000==== { - console.debug("=ACTS_JsServiceAbility_1300 createSubscriber .then(data)=======>" + /* + * @tc.number: ACTS_JsServiceAbility_1300 + * @tc.name: particleability.ConnectAbility : Connects an ability to a Service ability. + * @tc.desc: Check the return value of the interface (by Promise) + */ + it('ACTS_JsServiceAbility_1300', 0, async function (done) { + console.log('ACTS_JsServiceAbility_1300==== { + console.debug("=ACTS_JsServiceAbility_1300 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); - subscriber1300 = data; - await commonEvent.subscribe(subscriber1300, async (err, data) => { - console.debug("=ACTS_JsServiceAbility_1300 subscribe (err,data)=======>" + subscriber1300 = data; + commonEvent.subscribe(subscriber1300, (err, data) => { + console.debug("=ACTS_JsServiceAbility_1300 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") + " ,err=" + err + " ,data=" + data); - if (data.event != "ACTS_SerivceAbilityServerSecond_onDisConnect") { - expect("ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1300" - ).assertEqual(data.event); - featureAbility.disconnectAbility(mConnIdJsPromise).then((err) => { - console.debug("=ACTS_JsServiceAbility_1300 disconnectAbility err====>" + if (data.event == "ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1300") { + featureAbility.disconnectAbility(mConnIdJsPromise).then((err) => { + console.debug("=ACTS_JsServiceAbility_1300 disconnectAbility err====>" + ("json err=") + JSON.stringify(err)); - }) - } else { - expect("ACTS_SerivceAbilityServerSecond_onDisConnect").assertEqual( - data.event); - unsubscribe("ACTS_JsServiceAbility_1300_unsubscribe", subscriber1300); - console.log('ACTS_JsServiceAbility_1300==== mConnIdJsPromise=' + }) + } + else { + expect("ACTS_SerivceAbilityServerSecond_onDisConnect_ServiceConnectService_1300") + .assertEqual(data.event); + unsubscribe("ACTS_JsServiceAbility_1300_unsubscribe", subscriber1300); + console.log('ACTS_JsServiceAbility_1300==== mConnIdJsPromise=' + JSON.stringify(mConnIdJsPromise) + " , " + mConnIdJsPromise); - console.debug('ACTS_JsServiceAbility_1300_onConnectCallback ====> element=' + console.debug('ACTS_JsServiceAbility_1300_onConnectCallback ====> element=' + JSON.stringify(element) + " , " + element); - console.debug('ACTS_JsServiceAbility_1300_onConnectCallback ====> remote=' + console.debug('ACTS_JsServiceAbility_1300_onConnectCallback ====> remote=' + JSON.stringify(remote) + " , " + remote); - console.debug('ACTS_JsServiceAbility_1300_onConnectCallback ====> remote is proxy:' + console.debug('ACTS_JsServiceAbility_1300_onConnectCallback ====> remote is proxy:' + (remote instanceof rpc.RemoteProxy)); - } + } - function onDisconnectCallback(element) { - console.debug('ACTS_JsServiceAbility_1300_onDisconnectCallback ====> element=' + function onDisconnectCallback(element) { + console.debug('ACTS_JsServiceAbility_1300_onDisconnectCallback ====> element=' + JSON.stringify(element) + " , " + element); - unsubscribe("ACTS_JsServiceAbility_1300_unsubscribe", subscriber1300); - console.log('ACTS_JsServiceAbility_1300==== code=' + function onFailedCallback(code) { + console.debug('ACTS_JsServiceAbility_1300_onFailedCallback ====> code=' + JSON.stringify(code) + " , " + code) - } + } - mConnIdJsPromise = featureAbility.connectAbility( - { - bundleName: bundleName, - abilityName: abilityName, - action: "ServiceConnectService_1300", - }, - { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback, - }, - ) - } catch (err) { - expect("catch").assertEqual(err); - console.log('ACTS_JsServiceAbility_1300==== { - console.debug("=ACTS_JsServiceAbility_1400 createSubscriber .then(data)=======>" + /* + * @tc.number: ACTS_JsServiceAbility_1400 + * @tc.name: particleability.ConnectAbility : Connects an ability to a Service ability. + * @tc.desc: Check the return value of the interface (by AsyncCallback) + */ + it('ACTS_JsServiceAbility_1400', 0, async function (done) { + console.log('ACTS_JsServiceAbility_1400==== { + console.debug("=ACTS_JsServiceAbility_1400 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); - subscriber1400 = data; - await commonEvent.subscribe(subscriber1400, async (err, data) => { - console.debug("=ACTS_JsServiceAbility_1400 subscribe (err,data)=======>" + subscriber1400 = data; + commonEvent.subscribe(subscriber1400, (err, data) => { + console.debug("=ACTS_JsServiceAbility_1400 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") + " ,err=" + err + " ,data=" + data); - if (data.event != "ACTS_SerivceAbilityServerSecond_onDisConnect") { - expect("ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1400" - ).assertEqual(data.event); - featureAbility.disconnectAbility(mConnIdJsAsyncCallback, (err) => { - console.debug("=ACTS_JsServiceAbility_1400 disconnectAbility err====>" + if (data.event == "ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1400") { + featureAbility.disconnectAbility(mConnIdJsAsyncCallback, (err) => { + console.debug("=ACTS_JsServiceAbility_1400 disconnectAbility err====>" + ("json err=") + JSON.stringify(err)); - }) - currentAlertTimeout = setTimeout(() => { - console.log('ACTS_JsServiceAbility_1400==== mConnIdJsAsyncCallback=' + } + }); + }) + function onConnectCallback(element, remote) { + console.debug('ACTS_JsServiceAbility_1400_onConnectCallback ====> mConnIdJsAsyncCallback=' + JSON.stringify(mConnIdJsAsyncCallback) + " , " + mConnIdJsAsyncCallback); - console.debug('ACTS_JsServiceAbility_1400_onConnectCallback ====> element=' + console.debug('ACTS_JsServiceAbility_1400_onConnectCallback ====> element=' + JSON.stringify(element) + " , " + element); - console.debug('ACTS_JsServiceAbility_1400_onConnectCallback ====> remote=' + console.debug('ACTS_JsServiceAbility_1400_onConnectCallback ====> remote=' + JSON.stringify(remote) + " , " + remote); - console.debug('ACTS_JsServiceAbility_1400_onConnectCallback ====> remote is proxy:' + console.debug('ACTS_JsServiceAbility_1400_onConnectCallback ====> remote is proxy:' + (remote instanceof rpc.RemoteProxy)); - } + } - function onDisconnectCallback(element) { - console.debug('ACTS_JsServiceAbility_1400_onDisconnectCallback ====> element=' + function onDisconnectCallback(element) { + console.debug('ACTS_JsServiceAbility_1400_onDisconnectCallback ====> element=' + JSON.stringify(element) + " , " + element); - } + } - function onFailedCallback(code) { - console.debug('ACTS_JsServiceAbility_1400_onFailedCallback ====> code=' + function onFailedCallback(code) { + console.debug('ACTS_JsServiceAbility_1400_onFailedCallback ====> code=' + JSON.stringify(code) + " , " + code) - } + } - mConnIdJsAsyncCallback = featureAbility.connectAbility( - { - bundleName: bundleName, - abilityName: abilityName, - action: "ServiceConnectService_1400", - }, - { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback, - }, - ) - } catch (err) { - expect("catch").assertEqual(err); - console.log('ACTS_JsServiceAbility_1400==== { - console.debug("=ACTS_JsServiceAbility_1500 createSubscriber .then(data)=======>" + /* + * @tc.number: ACTS_JsServiceAbility_1500 + * @tc.name: particleability.ConnectAbility : Connects an ability to a Service ability. + * @tc.desc: Check the return value of the interface (by Promise) + */ + it('ACTS_JsServiceAbility_1500', 0, async function (done) { + console.log('ACTS_JsServiceAbility_1500==== { + console.debug("=ACTS_JsServiceAbility_1500 createSubscriber .then(data)=======>" + ("json data【") + JSON.stringify(data) + (" 】") + " ,data=" + data); - subscriber1500 = data; - await commonEvent.subscribe(subscriber1500, async (err, data) => { - console.debug("=ACTS_JsServiceAbility_1500 subscribe (err,data)=======>" + subscriber1500 = data; + commonEvent.subscribe(subscriber1500, (err, data) => { + console.debug("=ACTS_JsServiceAbility_1500 subscribe (err,data)=======>" + ("json err【") + JSON.stringify(err) + (" 】") + ("json data【") + JSON.stringify(data) + (" 】") + " ,err=" + err + " ,data=" + data); - if (data.event != "ACTS_SerivceAbilityServer_onDisConnect") { - expect("ACTS_SerivceAbilityServerSecond_onConnect_ServiceConnectService_1500").assertEqual( - data.event); - featureAbility.disconnectAbility(mConnIdJsPromise).then(() => { - }).catch(err => { - expect(".catch").assertEqual(err); - console.debug('ACTS_JsServiceAbility_1500==== { + console.debug('ACTS_JsServiceAbility_1500===disconnectAbility data:' + + JSON.stringify(err)); + }).catch(err => { + expect().assertFail() + console.debug('ACTS_JsServiceAbility_1500==== err: ' + JSON.stringify(err)); + done(); + }) + } else { + expect("ACTS_SerivceAbilityServer_onDisConnect_ServiceConnectService_1500") + .assertEqual(data.event); + unsubscribe("ACTS_JsServiceAbility_1500_unsubscribe", subscriber1500); + console.log('ACTS_JsServiceAbility_1500==== mConnIdJsPromise=' + } + }); + }) + function onConnectCallback(element, remote) { + console.debug('ACTS_JsServiceAbility_1500_onConnectCallback ====> mConnIdJsPromise=' + JSON.stringify(mConnIdJsPromise) + " , " + mConnIdJsPromise); - console.debug('ACTS_JsServiceAbility_1500_onConnectCallback ====> element=' + console.debug('ACTS_JsServiceAbility_1500_onConnectCallback ====> element=' + JSON.stringify(element) + " , " + element); - console.debug('ACTS_JsServiceAbility_1500_onConnectCallback ====> remote=' + console.debug('ACTS_JsServiceAbility_1500_onConnectCallback ====> remote=' + JSON.stringify(remote) + " , " + remote); - } + } - function onDisconnectCallback(element) { - console.debug('ACTS_JsServiceAbility_1500_onDisconnectCallback ====> element=' + function onDisconnectCallback(element) { + console.debug('ACTS_JsServiceAbility_1500_onDisconnectCallback ====> element=' + JSON.stringify(element) + " , " + element); - unsubscribe("ACTS_JsServiceAbility_1500_unsubscribe", subscriber1500); - console.log('ACTS_JsServiceAbility_1500==== code=' + function onFailedCallback(code) { + console.debug('ACTS_JsServiceAbility_1500_onFailedCallback ====> code=' + JSON.stringify(code) + " , " + code) - } + } - mConnIdJsPromise = featureAbility.connectAbility( - { - bundleName: bundleName, - abilityName: abilityName, - action: "ServiceConnectService_1500", - }, - { - onConnect: onConnectCallback, - onDisconnect: onDisconnectCallback, - onFailed: onFailedCallback, - }, - ) - } catch (err) { - expect("catch").assertEqual(err); - console.log('ACTS_JsServiceAbility_1500==== delay) { + break; + } + } +} + export default { onStart(want) { console.debug('ACTS_SerivceAbilityServer 0425 ====>onStart .ts 0851 =' - + want + " , JSON." + JSON.stringify(want)); + + want + " , JSON." + JSON.stringify(want)); commonEvent.publish("ACTS_SerivceAbilityServer_onStart", (err) => { }); }, onStop() { console.debug('ACTS_SerivceAbilityServer ==== { }); - particleAbility.terminateSelf().then((data) => { - console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data)); - }).catch((error) => { - console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error)); - }); }, onCommand(want, restart, startId) { console.debug('ACTS_SerivceAbilityServer ====>onCommand=' - + "JSON(want)=" + JSON.stringify(want) - + " ,restart=" + restart + " ,startId=" + startId); + + "JSON(want)=" + JSON.stringify(want) + + " ,restart=" + restart + " ,startId=" + startId); if (want.action == 'ServiceStartService_0900') { particleAbility.startAbility( { @@ -79,11 +83,7 @@ export default { }, } ); - particleAbility.terminateSelf().then((data) => { - console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data)); - }).catch((error) => { - console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error)); - }); + sleep(600) } else if (want.action == 'ServiceStartService_1000') { particleAbility.startAbility( { @@ -94,27 +94,17 @@ export default { action: "ServiceStartService_1000", }, }, (err, data) => { - console.debug('ACTS_SerivceAbilityServer start Ability 1000 callback=====' - + err + ', data= ' + data + " , JSON." + JSON.stringify(data)); - particleAbility.terminateSelf().then((data) => { - console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data)); - }).catch((error) => { - console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error)); - }); - } + console.debug('ACTS_SerivceAbilityServer start Ability 1000 callback=====' + + err + ', data= ' + data + " , JSON." + JSON.stringify(data)); + } ); } else { commonEvent.publish("ACTS_SerivceAbilityServer_onCommand" + "_" + want.action, (err) => { if (!err.code) { if (want.action == 'PageStartService_0100' || want.action == 'PageStartService_0200' - || want.action == 'PageStartService_0301' || want.action == 'PageStartService_0401') { - console.debug('ACTS_SerivceAbilityServer_onCommand 100 200 301 401.terminateSelf()=====>' - + want.action); - particleAbility.terminateSelf().then((data) => { - console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data)); - }).catch((error) => { - console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error)); - }); + || want.action == 'PageStartService_0301' || want.action == 'PageStartService_0401') { + console.debug('ACTS_SerivceAbilityServer_onCommand 100 200 301 401.=====>' + + want.action); } } else { console.debug('ACTS_SerivceAbilityServer_onCommand publish err=====>' + err); @@ -126,25 +116,26 @@ export default { console.info('ACTS_SerivceAbilityServer ====< onConnect'); try { console.debug('ACTS_SerivceAbilityServer ====>onConnect=' - + want + " , JSON." + JSON.stringify(want)); + + want + " , JSON." + JSON.stringify(want)); + commonEvent.publish("ACTS_SerivceAbilityServer_onConnect" + "_" + want.action, (err) => { }); function onConnectCallback(element, remote) { console.debug('ACTS_SerivceAbilityServer_onConnectCallback ====> mConnIdJs=' - + JSON.stringify(mConnIdJs) + " , " + mConnIdJs); + + JSON.stringify(mConnIdJs) + " , " + mConnIdJs); console.debug('ACTS_SerivceAbilityServer_onConnectCallback ====> element=' - + JSON.stringify(element) + " , " + element); + + JSON.stringify(element) + " , " + element); console.debug('ACTS_SerivceAbilityServer_onConnectCallback ====> remote=' - + JSON.stringify(remote) + " , " + remote); + + JSON.stringify(remote) + " , " + remote); } function onDisconnectCallback(element) { console.debug('ACTS_SerivceAbilityServer_onDisconnectCallback ====> element=' - + JSON.stringify(element) + " , " + element); + + JSON.stringify(element) + " , " + element); } function onFailedCallback(code) { console.debug('ACTS_SerivceAbilityServer_onFailedCallback ====> code=' - + JSON.stringify(code) + " , " + code) + + JSON.stringify(code) + " , " + code) } if (want.action == 'ServiceConnectService_1300' || want.action == 'ServiceConnectService_1400' - || want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1600') { + || want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1600') { mConnIdJs = particleAbility.connectAbility( { bundleName: serversecond_bundleName, @@ -157,8 +148,6 @@ export default { onFailed: onFailedCallback, }, ) - } else { - commonEvent.publish("ACTS_SerivceAbilityServer_onConnect" + "_" + want.action, (err) => { }); } } catch (err) { console.log("ACTS_SerivceAbilityServer ====< error:" + err) @@ -168,44 +157,34 @@ export default { }, onDisconnect(want) { console.debug('ACTS_SerivceAbilityServer ====>onDisConnect=' - + want + " , JSON." + JSON.stringify(want)); - commonEvent.publish("ACTS_SerivceAbilityServer_onDisConnect", (err) => { - if (err.code) { - console.debug('ACTS_SerivceAbilityServer_onDisConnect publish err=====>' + err); - } else { - console.debug('ACTS_SerivceAbilityServer_onDisConnect featureAbility.terminateSelf()=====<' - + want.action); - if (want.action == 'ServiceConnectService_1300' || want.action == 'ServiceConnectService_1400' - || want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1501' - || want.action == 'ServiceConnectService_1600' || want.action == 'ServiceConnectService_1601' - ) { - particleAbility.disconnectAbility(mConnIdJs, (err) => { - console.debug("=ACTS_SerivceAbilityServer_onDisConnect 13 14 15 16 err====>" - + ("json err=") + JSON.stringify(err) + " , " + want.action); - }) - } - particleAbility.terminateSelf().then((data) => { - console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data)); - }).catch((error) => { - console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error)); - }); - } + + want + " , JSON." + JSON.stringify(want)); + commonEvent.publish("ACTS_SerivceAbilityServer_onDisConnect_" + want.action, (err) => { + console.debug('ACTS_SerivceAbilityServer_onDisConnect ===' + want.action); }); + if (want.action == 'ServiceConnectService_1300' || want.action == 'ServiceConnectService_1400' + || want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1501' + || want.action == 'ServiceConnectService_1600' || want.action == 'ServiceConnectService_1601' + ) { + particleAbility.disconnectAbility(mConnIdJs, (err) => { + console.debug("=ACTS_SerivceAbilityServer_onDisConnect 13 14 15 16 err====>" + + ("json err=") + JSON.stringify(err) + " , " + want.action); + }) + } }, onReady() { console.debug('ACTS_SerivceAbilityServer ====onReconnect=' - + want + " , JSON." + JSON.stringify(want)); + + want + " , JSON." + JSON.stringify(want)); commonEvent.publish("ACTS_SerivceAbilityServer_onReconnect" + "_" + want.action, (err) => { }); }, OnAbilityConnectDone(element, remoteObject, resultCode) { console.debug('ACTS_SerivceAbilityServer ====>OnAbilityConnectDone=' - + element + " , JSON." + JSON.stringify(element) - + remoteObject + " , JSON." + JSON.stringify(remoteObject) - + resultCode + " , JSON." + JSON.stringify(resultCode) + + element + " , JSON." + JSON.stringify(element) + + remoteObject + " , JSON." + JSON.stringify(remoteObject) + + resultCode + " , JSON." + JSON.stringify(resultCode) ); commonEvent.publish("ACTS_SerivceAbilityServer_OnAbilityConnectDone", (err) => { }); }, -}; \ No newline at end of file +}; diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/BUILD.gn b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/BUILD.gn index 7621ad6341985b6681f5d2aeee1328b5a8bea2b4..dbe9959e2c05a20f3edfec6288204ccdce2f32ea 100644 --- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/BUILD.gn +++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/config.json b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/config.json index 7f51b6e226c3e39f401d6970cf0f9bdd59f1188b..103ef286afb1ac1b5d44fed56dc7ac3ca2eb7948 100644 --- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/config.json +++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/config.json @@ -18,6 +18,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/ServiceAbility/service.ts index 80a93e559c71aed05ec6bcd2e94152428f02022a..519bd96b39d3f2747cd4b917801bd4f36cd0dc7d 100644 --- a/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/ServiceAbility/service.ts +++ b/ability/ability_runtime/actsserviceabilityclienttest/actsserviceabilityserversecondrelyhap/entry/src/main/ets/ServiceAbility/service.ts @@ -49,44 +49,41 @@ class StubTest extends rpc.RemoteObject { } } +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} export default { onStart(want) { console.debug('ACTS_SerivceAbilityServerSecond ====>onStart=' - + want + " , JSON." + JSON.stringify(want)); + + want + " , JSON." + JSON.stringify(want)); commonEvent.publish("ACTS_SerivceAbilityServerSecond_onStart", (err) => { }); }, onStop() { console.debug('ACTS_SerivceAbilityServerSecond ==== { }); - particleAbility.terminateSelf().then((data) => { - console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data)); - }).catch((error) => { - console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error)); - }); }, onCommand(want, restart, startId) { console.debug('ACTS_SerivceAbilityServerSecond ====>onCommand=' - + "JSON(want)=" + JSON.stringify(want) - + " ,restart=" + restart + " ,startId=" + startId); - commonEvent.publish("ACTS_SerivceAbilityServerSecond_onCommand" + "_" + want.action, (err) => { }); - particleAbility.terminateSelf().then((data) => { - console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data)); - }).catch((error) => { - console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error)); - }); + + "JSON(want)=" + JSON.stringify(want) + + " ,restart=" + restart + " ,startId=" + startId); + commonEvent.publish("ACTS_SerivceAbilityServerSecond_onCommand" + "_" + want.action, (err) => { + console.debug("ACTS_SerivceAbilityServerSecond_onCommand" + "_" + want.action + + "err: " + JSON.stringify(err)) + }); + sleep(500) }, onConnect(want) { console.info('ACTS_SerivceAbilityServerSecond ====< onConnect'); try { console.debug('ACTS_SerivceAbilityServerSecond ====>onConnect=' - + want + " , JSON." + JSON.stringify(want)); + + want + " , JSON." + JSON.stringify(want)); function onConnectCallback(element, remote) { console.debug('ACTS_SerivceAbilityServerSecond_onConnectCallback ====> want.action=' - + JSON.stringify(want.action) + " , " + want.action); + + JSON.stringify(want.action) + " , " + want.action); console.debug('ACTS_SerivceAbilityServerSecond_onConnectCallback ====> element=' - + JSON.stringify(element) + " , " + element); + + JSON.stringify(element) + " , " + element); console.debug('ACTS_SerivceAbilityServerSecond_onConnectCallback ====> remote=' - + JSON.stringify(remote) + " , " + remote); + + JSON.stringify(remote) + " , " + remote); if (want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1600') { commonEvent.publish("ACTS_SerivceAbilityServerSecond_onConnect" + "_" + want.action, (err) => { console.debug("publish = ACTS_SerivceAbilityServerSecond_onConnect" + "_" + want.action); @@ -96,12 +93,12 @@ export default { function onDisconnectCallback(element) { console.debug('ACTS_SerivceAbilityServerSecond_onDisconnectCallback ====> element=' - + JSON.stringify(element) + " , " + element); + + JSON.stringify(element) + " , " + element); } function onFailedCallback(code) { console.debug('ACTS_SerivceAbilityServerSecond_onFailedCallback ====> code=' - + JSON.stringify(code) + " , " + code) + + JSON.stringify(code) + " , " + code) } if (want.action == 'ServiceConnectService_1500') { mConnIdJs = particleAbility.connectAbility( @@ -153,26 +150,21 @@ export default { }, onDisconnect(want) { console.debug('ACTS_SerivceAbilityServerSecond ====>onDisConnect=' - + want + " , JSON." + JSON.stringify(want)); - commonEvent.publish("ACTS_SerivceAbilityServerSecond_onDisConnect", (err) => { + + want + " , JSON." + JSON.stringify(want)); + commonEvent.publish("ACTS_SerivceAbilityServerSecond_onDisConnect_" + want.action, (err) => { if (err.code) { console.debug('ACTS_SerivceAbilityServerSecond_onDisConnect publish err=====>' + err); } else { - console.debug('ACTS_SerivceAbilityServerSecond_onDisConnect featureAbility.terminateSelf()=====<' - + want.action); + console.debug('ACTS_SerivceAbilityServerSecond_onDisConnect =====<' + + want.action); if (want.action == 'ServiceConnectService_1500' || want.action == 'ServiceConnectService_1501' - || want.action == 'ServiceConnectService_1600' || want.action == 'ServiceConnectService_1601' - || want.action == 'ServiceConnectService_1590') { + || want.action == 'ServiceConnectService_1600' || want.action == 'ServiceConnectService_1601' + || want.action == 'ServiceConnectService_1590') { particleAbility.disconnectAbility(mConnIdJs, (err) => { console.debug("=ACTS_SerivceAbilityServerSecond_onDisConnect err====>" - + ("json err=") + JSON.stringify(err) + " , " + want.action); + + ("json err=") + JSON.stringify(err) + " , " + want.action); }) } - particleAbility.terminateSelf().then((data) => { - console.log('ACTS_SerivceAbilityServer terminateSelf data:' + JSON.stringify(data)); - }).catch((error) => { - console.log('ACTS_SerivceAbilityServer terminateSelf error:' + JSON.stringify(error)); - }); } }); }, @@ -181,13 +173,13 @@ export default { }, onReconnect(want) { console.debug('ACTS_SerivceAbilityServerSecond ====>onReconnect=' - + want + " , JSON." + JSON.stringify(want)); + + want + " , JSON." + JSON.stringify(want)); }, OnAbilityConnectDone(element, remoteObject, resultCode) { console.debug('ACTS_SerivceAbilityServerSecond ====>OnAbilityConnectDone=' - + element + " , JSON." + JSON.stringify(element) - + remoteObject + " , JSON." + JSON.stringify(remoteObject) - + resultCode + " , JSON." + JSON.stringify(resultCode) + + element + " , JSON." + JSON.stringify(element) + + remoteObject + " , JSON." + JSON.stringify(remoteObject) + + resultCode + " , JSON." + JSON.stringify(resultCode) ); commonEvent.publish("ACTS_SerivceAbilityServerSecond_OnAbilityConnectDone", (err) => { }); }, diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/module.json b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/module.json index 63433eb8d6b9487794cb12a568e2b0f733abdad3..62daa989b086556ef166f17c87ebb9d02b57088d 100644 --- a/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/module.json +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ActskillProcessWithAccountCloseTest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/module.json b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/module.json index 63433eb8d6b9487794cb12a568e2b0f733abdad3..62daa989b086556ef166f17c87ebb9d02b57088d 100644 --- a/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/module.json +++ b/ability/ability_runtime/actsshellcommandfunctionalitytest/ExecuteShellCommand/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/actsstartrunnertest/entry/src/main/module.json b/ability/ability_runtime/actsstartrunnertest/entry/src/main/module.json index cb34980fee3963211cde784db3c8f95bd49a82ee..628fdcbca8d16feaf0c4f7390573077da0a4c36c 100644 --- a/ability/ability_runtime/actsstartrunnertest/entry/src/main/module.json +++ b/ability/ability_runtime/actsstartrunnertest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/config.json b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/config.json index da803ed692c2f99e99039294f6204ab21eea2b70..7839de72adab3d3bdd961cefebd008b67790e59c 100644 --- a/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/config.json +++ b/ability/ability_runtime/actsstserviceabilityclientcase/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".entry", "mainAbility": "com.amsst.actsstserviceabilityclientcasetest.MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/actssupportfunction/BUILD.gn b/ability/ability_runtime/actssupportfunction/BUILD.gn index 8d8ea0da68d3387ab50dc01a321dd8ecd4f0d5f0..b79c4e83021b10af79dc6b3bc102c2d51674e996 100644 --- a/ability/ability_runtime/actssupportfunction/BUILD.gn +++ b/ability/ability_runtime/actssupportfunction/BUILD.gn @@ -17,6 +17,7 @@ group("actssupportfunction") { testonly = true if (is_standard_system) { deps = [ + "actsonandoffscreentest:ActsOnAndOffScreenTest", "actssupportfunctiontest:ActsSupportFunctionTest", "faonandoffscreen:FaOnAndOffScreen", "fasupportfunction:fasupportfunction", diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/AppScope/app.json b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..0e1b95a94f8f01c5febab78595e5295d1f3be0b7 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.actsonandoffscreentest", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "debug": false, + "icon": "$media:app_icon", + "label": "$string:app_name", + "description" : "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive" : true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/AppScope/resources/base/element/string.json b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d0dc3a93dbce6bd228a2968ecd9885fc364e9dcf --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ActsOnAndOffScreenTest" + } + ] +} diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/BUILD.gn b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3fe950e9b1ebd17bd036c168914acb514a33e23e --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/BUILD.gn @@ -0,0 +1,42 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsOnAndOffScreenTest") { + hap_profile = "entry/src/main/module.json" + deps = [ + ":actsonandoffscreentest_js_assets", + ":actsonandoffscreentest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsOnAndOffScreenTest" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("actsonandoffscreentest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("actsonandoffscreentest_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("actsonandoffscreentest_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":actsonandoffscreentest_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/Test.json b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4553d0904aa1784824061c0793aa049d7cbc5aa2 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/Test.json @@ -0,0 +1,23 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.actsonandoffscreentest", + "module-name": "entry", + "shell-timeout": "600000", + "testcase-timeout":"30000" + }, + "kits": [ + { + "test-file-name": [ + "ActsOnAndOffScreenTest.hap", + "FaOnAndOffScreen.hap", + "StageOnAndOffScreen.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} + diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/Application/MyAbilityStage.ts b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..8d3ffd1340628c7919ecdc7cb5dd81d37c483445 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/Application/MyAbilityStage.ts @@ -0,0 +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. + */ +import AbilityStage from "@ohos.application.AbilityStage"; + +var TAG0 = 'ActsOnAndOffScreenTest:MyAbilityStage:'; +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log(TAG0 + "onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..8e765bf1f7f376c6871a5a1a4b0d35164d256de8 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../test/List.test'; + +var TAG1 = 'ActsOnAndOffScreenTest:MainAbility:'; +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log(TAG1 + 'onCreate'); + + globalThis.abilityTestContext = this.context; + globalThis.abilityWant = want; + globalThis.abilityWant.parameters.timeout = 15000; + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.log('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log(TAG1 + 'onDestroy'); + } + + onWindowStageCreate(windowStage) { + console.log(TAG1 + 'onWindowStageCreate'); + + windowStage.loadContent("pages/index", (err, data) => { + if (err.code) { + console.log(TAG1 + 'Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.log(TAG1 + 'Succeeded in loading the content. Data: ' + JSON.stringify(data)); + }); + } + + onWindowStageDestroy() { + console.log(TAG1 + 'onWindowStageDestroy'); + } + + onForeground() { + console.log(TAG1 + 'onForeground'); + } + + onBackground() { + console.log(TAG1 + 'onBackground'); + } +}; diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..7977b1e28cfa0007b46f0df33b5290187ab81553 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import TestRunner from '@ohos.application.testRunner'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined +var TAG = "ActsOnAndOffScreenTest == " +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}` + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log(TAG + "onAbilityCreateCallback"); +} + +async function addAbilityMonitorCallback(err: any) { + console.log(TAG + "addAbilityMonitorCallback : " + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.log(TAG + "OpenHarmonyTestRunner OnPrepare ") + } + + async onRun() { + console.log(TAG + 'OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + globalThis.abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = 'MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.log(TAG + 'cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.log(TAG + 'executeShellCommand : err : ' + JSON.stringify(err)); + console.log(TAG + 'executeShellCommand : data : ' + d.stdResult); + console.log(TAG + 'executeShellCommand : data : ' + d.exitCode); + }) + console.log(TAG + 'OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..05c74b67a7f5d3318febb5f2c1cc22506bdf5679 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct Index { + aboutToAppear() { + console.log('ActsOnAndOffScreenTest MainAbility index aboutToAppear') + } + + @State message: string = 'Hello World ActsOnAndOffScreenTest 1' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d711f4be534262ffd210c8a392852a2297f5f27 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * 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 onAndOffScreenTest from './OnAndOffScreenTest.test'; + +export default function testsuite() { + onAndOffScreenTest(); +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f83fcea06c81abbf49173ba5bcdd3d0a5345aada --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets @@ -0,0 +1,637 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import { BY,UiDriver,UiComponent } from '@ohos.uitest'; +import commonEvent from '@ohos.commonEvent'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; +import power from '@ohos.power'; +import backgroundTaskManager from '@ohos.backgroundTaskManager'; + +export default function OnAndOffScreenTest() { + + describe('OnAndOffScreenTest', function () { + + let TAG = ""; + let TAG1 = "SUB_AA_OpenHarmony == OnAndOffScreenTest : "; + let sleepTimeOne = 1000; + let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + let id = undefined; + beforeAll(async (done) => { + console.log(TAG1 + "beforeAll called"); + let myReason = 'test FaShowOnLockTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log(TAG1 + "Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log(TAG1 + "requestId is : " + id); + setTimeout(function () { + console.log(TAG1 + "beforeAll end"); + done(); + }, sleepTimeOne); + }) + + afterAll(async (done) => { + console.log(TAG1 + "afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log(TAG1 + "afterAll end"); + done(); + }, sleepTimeOne); + }) + + async function slideScreen(TAG) { + console.log(TAG + "slideScreen start"); + var driver = UiDriver.create(); + await driver.swipe(1000, 3000, 1000, 500, 1200).then((data) => { + console.log(TAG + "swipe : " + JSON.stringify(data)); + }).catch((error) => { + console.log(TAG + "swipe error = " + JSON.stringify(error)); + }) + console.log(TAG + "slideScreen end"); + } + + async function executeShellCommand(cmd, TAG) { + console.log(TAG + "executeShellCommand start : " + JSON.stringify(cmd)); + await abilityDelegator.executeShellCommand(cmd).then((data) => { + console.log(TAG + "executeShellCommand : data : " + data.stdResult); + console.log(TAG + "executeShellCommand : data : " + data.exitCode); + }).catch((error) => { + console.log(TAG + "executeShellCommand error : " + JSON.stringify(error)); + }) + } + + beforeEach(async (done) => { + console.log(TAG1 + "beforeEach called"); + let status = undefined; + await power.isScreenOn().then((data) => { + console.log(TAG1 + "isScreenOn data = " + JSON.stringify(data)); + status = data; + }).catch((error) => { + console.log(TAG1 + "isScreenOn error = " + JSON.stringify(error)); + }) + + if (!status) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG1); + await slideScreen(TAG1); + } + + setTimeout(() => { + console.log(TAG1 + "beforeEach end"); + done(); + }, sleepTimeOne); + }) + + afterEach(async (done) => { + console.log(TAG1 + "afterEach called"); + let cmd1 = "aa force-stop ohos.acts.aafwk.test.faonandoffscreen"; + await executeShellCommand(cmd1, TAG1); + let cmd2 = "aa force-stop ohos.acts.aafwk.test.stageonandoffscreen"; + await executeShellCommand(cmd2, TAG1); + + setTimeout(() => { + console.log(TAG1 + "afterEach end"); + done(); + }, sleepTimeOne); + }) + + /* + * @tc.number : SUB_AA_OpenHarmony_OnAndOffScreen_0100 + * @tc.name : Verify the life cycle of on / off screen ability + * @tc.desc : FA model is applied in the foreground, and the device is locked. + */ + it('SUB_AA_OpenHarmony_OnAndOffScreen_0100', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_OnAndOffScreen_0100 == '; + console.log(TAG + "begin"); + + let status1 = undefined; + let lifeList = []; + let listCheck = ["onCreate", "onActive", "onInactive", "onHide"]; + let onActive = "FaOnAndOffScreen_MainAbility_onActive"; + let onHide = "FaOnAndOffScreen_MainAbility_onHide"; + + var subscriber; + var subscribeInfo = { + events: [onActive, onHide] + } + await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); + subscriber = data; + + commonEvent.subscribe(subscriber, async (err, data) => { + console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); + + if (data.event == onActive) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG); + } + + if (data.event == onHide) { + lifeList = data.parameters.lifeList; + setTimeout(async () => { + commonEvent.unsubscribe(subscriber, async (err, data) => { + console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); + expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck)); + expect(status1).assertTrue(); + done(); + }); + }, sleepTimeOne); + } + }); + }).catch((error) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + await power.isScreenOn().then((data) => { + console.log(TAG + "isScreenOn status1 data = " + JSON.stringify(data)); + status1 = data; + }).catch((error) => { + console.log(TAG + "isScreenOn status1 error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + let wantNum = { + bundleName: "ohos.acts.aafwk.test.faonandoffscreen", + abilityName: "ohos.acts.aafwk.test.faonandoffscreen.MainAbility" + } + await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { + console.log(TAG + "startAbility data = " + JSON.stringify(data)); + }).catch((error) => { + console.log(TAG + "startAbility error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + }) + + /* + * @tc.number : SUB_AA_OpenHarmony_OnAndOffScreen_0200 + * @tc.name : Verify the life cycle of on / off screen ability + * @tc.desc : FA model is applied in the foreground, the device locks the screen, and then unlocks. + */ + it('SUB_AA_OpenHarmony_OnAndOffScreen_0200', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_OnAndOffScreen_0200 == '; + console.log(TAG + "begin"); + + let status1 = undefined; + let lifeList = []; + let listCheck = ["onCreate", "onActive", "onInactive", "onHide", "onShow"]; + let onActive = "FaOnAndOffScreen_MainAbility_onActive"; + let onHide = "FaOnAndOffScreen_MainAbility_onHide"; + let onShow = "FaOnAndOffScreen_MainAbility_onShow"; + + var subscriber; + var subscribeInfo = { + events: [onActive, onHide, onShow] + } + await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); + subscriber = data; + + commonEvent.subscribe(subscriber, async (err, data) => { + console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); + + if (data.event == onActive) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG); + } + + if (data.event == onHide) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG); + await slideScreen(TAG); + } + + if (data.event == onShow) { + lifeList = data.parameters.lifeList; + setTimeout(async () => { + commonEvent.unsubscribe(subscriber, async (err, data) => { + console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); + expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck)); + expect(status1).assertTrue(); + done(); + }); + }, sleepTimeOne); + } + }); + }).catch((error) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + await power.isScreenOn().then((data) => { + console.log(TAG + "isScreenOn status1 data = " + JSON.stringify(data)); + status1 = data; + }).catch((error) => { + console.log(TAG + "isScreenOn status1 error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + let wantNum = { + bundleName: "ohos.acts.aafwk.test.faonandoffscreen", + abilityName: "ohos.acts.aafwk.test.faonandoffscreen.MainAbility" + } + await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { + console.log(TAG + "startAbility data = " + JSON.stringify(data)); + }).catch((error) => { + console.log(TAG + "startAbility error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + }) + + /* + * @tc.number : SUB_AA_OpenHarmony_OnAndOffScreen_0300 + * @tc.name : Verify the life cycle of on / off screen ability + * @tc.desc : Stage model is applied in the foreground, and the device locks the screen. + */ + it('SUB_AA_OpenHarmony_OnAndOffScreen_0300', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_OnAndOffScreen_0300 == '; + console.log(TAG + "begin"); + + let status1 = undefined; + let lifeList = []; + let listCheck = ["onCreate", "onForeground", "onBackground"]; + let onForeground = "StageOnAndOffScreen_MainAbility_onForeground"; + let onBackground = "StageOnAndOffScreen_MainAbility_onBackground"; + + var subscriber; + var subscribeInfo = { + events: [onForeground, onBackground] + } + await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); + subscriber = data; + + commonEvent.subscribe(subscriber, async (err, data) => { + console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); + + if (data.event == onForeground) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG); + } + + if (data.event == onBackground) { + lifeList = data.parameters.lifeList; + setTimeout(async () => { + commonEvent.unsubscribe(subscriber, async (err, data) => { + console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); + expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck)); + expect(status1).assertTrue(); + done(); + }); + }, sleepTimeOne); + } + }); + }).catch((error) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + await power.isScreenOn().then((data) => { + console.log(TAG + "isScreenOn status1 data = " + JSON.stringify(data)); + status1 = data; + }).catch((error) => { + console.log(TAG + "isScreenOn status1 error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + let wantNum = { + bundleName: "ohos.acts.aafwk.test.stageonandoffscreen", + abilityName: "MainAbility" + } + await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { + console.log(TAG + "startAbility data = " + JSON.stringify(data)); + }).catch((error) => { + console.log(TAG + "startAbility error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + }) + + /* + * @tc.number : SUB_AA_OpenHarmony_OnAndOffScreen_0400 + * @tc.name : Verify the life cycle of on / off screen ability + * @tc.desc : The stage model is applied in the foreground, the device locks the screen, and then unlocks. + */ + it('SUB_AA_OpenHarmony_OnAndOffScreen_0400', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_OnAndOffScreen_0400 == '; + console.log(TAG + "begin"); + + let flag = false; + let status1 = undefined; + let lifeList = []; + let listCheck = ["onCreate", "onForeground", "onBackground", "onForeground"]; + let onForeground = "StageOnAndOffScreen_MainAbility_onForeground"; + let onBackground = "StageOnAndOffScreen_MainAbility_onBackground"; + + var subscriber; + var subscribeInfo = { + events: [onForeground, onBackground] + } + await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); + subscriber = data; + + commonEvent.subscribe(subscriber, async (err, data) => { + console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); + + if (data.event == onForeground && !flag) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG); + flag = true; + } else if (data.event == onForeground && flag) { + lifeList = data.parameters.lifeList; + setTimeout(async () => { + commonEvent.unsubscribe(subscriber, async (err, data) => { + console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); + expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck)); + expect(status1).assertTrue(); + done(); + }); + }, sleepTimeOne); + } + + if (data.event == onBackground) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG); + await slideScreen(TAG); + } + }); + }).catch((error) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + await power.isScreenOn().then((data) => { + console.log(TAG + "isScreenOn status1 data = " + JSON.stringify(data)); + status1 = data; + }).catch((error) => { + console.log(TAG + "isScreenOn status1 error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + let wantNum = { + bundleName: "ohos.acts.aafwk.test.stageonandoffscreen", + abilityName: "MainAbility" + } + await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { + console.log(TAG + "startAbility data = " + JSON.stringify(data)); + }).catch((error) => { + console.log(TAG + "startAbility error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + }) + + /* + * @tc.number : SUB_AA_OpenHarmony_OnAndOffScreen_0500 + * @tc.name : Verify the life cycle of on / off screen ability + * @tc.desc : Application in the background, device lock screen. + */ + it('SUB_AA_OpenHarmony_OnAndOffScreen_0500', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_OnAndOffScreen_0500 == '; + console.log(TAG + "begin"); + + let status1 = undefined; + let lifeList = []; + let listCheck = ["onCreate", "onWindowStageCreate", "onForeground", "onBackground"]; + let onCreate = "StageOnAndOffScreen_MainAbility2_onCreate"; + let onWindowStageCreate = "StageOnAndOffScreen_MainAbility2_onWindowStageCreate"; + let onForeground = "StageOnAndOffScreen_MainAbility2_onForeground"; + let onBackground = "StageOnAndOffScreen_MainAbility2_onBackground"; + let onWindowStageDestroy = "StageOnAndOffScreen_MainAbility2_onWindowStageDestroy"; + let onDestroy = "StageOnAndOffScreen_MainAbility2_onDestroy"; + let onForeground2 = "StageOnAndOffScreen_MainAbility3_onForeground"; + let onBackground2 = "StageOnAndOffScreen_MainAbility3_onBackground"; + + var subscriber; + var subscribeInfo = { + events: [onCreate, onWindowStageCreate, onForeground, onBackground, onWindowStageDestroy, onDestroy, + onForeground2, onBackground2] + } + await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); + subscriber = data; + + commonEvent.subscribe(subscriber, async (err, data) => { + console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); + + if (data.event == onCreate) { + lifeList.push("onCreate"); + } + + if (data.event == onWindowStageCreate) { + lifeList.push("onWindowStageCreate"); + } + + if (data.event == onForeground) { + lifeList.push("onForeground"); + } + + if (data.event == onBackground) { + lifeList.push("onBackground"); + } + + if (data.event == onWindowStageDestroy) { + lifeList.push("onWindowStageDestroy"); + } + + if (data.event == onDestroy) { + lifeList.push("onDestroy"); + } + + if (data.event == onForeground2) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG); + } + + if (data.event == onBackground2) { + setTimeout(async () => { + commonEvent.unsubscribe(subscriber, async (err, data) => { + console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); + expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck)); + expect(status1).assertTrue(); + done(); + }); + }, sleepTimeOne); + } + }); + }).catch((error) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + await power.isScreenOn().then((data) => { + console.log(TAG + "isScreenOn status1 data = " + JSON.stringify(data)); + status1 = data; + }).catch((error) => { + console.log(TAG + "isScreenOn status1 error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + let wantNum = { + bundleName: "ohos.acts.aafwk.test.stageonandoffscreen", + abilityName: "MainAbility2" + } + await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { + console.log(TAG + "startAbility data = " + JSON.stringify(data)); + }).catch((error) => { + console.log(TAG + "startAbility error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + }) + + /* + * @tc.number : SUB_AA_OpenHarmony_OnAndOffScreen_0600 + * @tc.name : Verify the life cycle of on / off screen ability + * @tc.desc : Application in the background, device lock screen. + */ + it('SUB_AA_OpenHarmony_OnAndOffScreen_0600', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_OnAndOffScreen_0600 == '; + console.log(TAG + "begin"); + + let flag = false; + let status1 = undefined; + let lifeList = []; + let listCheck = ["onCreate", "onWindowStageCreate", "onForeground", "onBackground"]; + let onCreate = "StageOnAndOffScreen_MainAbility2_onCreate"; + let onWindowStageCreate = "StageOnAndOffScreen_MainAbility2_onWindowStageCreate"; + let onForeground = "StageOnAndOffScreen_MainAbility2_onForeground"; + let onBackground = "StageOnAndOffScreen_MainAbility2_onBackground"; + let onWindowStageDestroy = "StageOnAndOffScreen_MainAbility2_onWindowStageDestroy"; + let onDestroy = "StageOnAndOffScreen_MainAbility2_onDestroy"; + let onForeground2 = "StageOnAndOffScreen_MainAbility3_onForeground"; + let onBackground2 = "StageOnAndOffScreen_MainAbility3_onBackground"; + + var subscriber; + var subscribeInfo = { + events: [onCreate, onWindowStageCreate, onForeground, onBackground, onWindowStageDestroy, onDestroy, + onForeground2, onBackground2] + } + await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); + subscriber = data; + + commonEvent.subscribe(subscriber, async (err, data) => { + console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); + + if (data.event == onCreate) { + lifeList.push("onCreate"); + } + + if (data.event == onWindowStageCreate) { + lifeList.push("onWindowStageCreate"); + } + + if (data.event == onForeground) { + lifeList.push("onForeground"); + } + + if (data.event == onBackground) { + lifeList.push("onBackground"); + } + + if (data.event == onWindowStageDestroy) { + lifeList.push("onWindowStageDestroy"); + } + + if (data.event == onDestroy) { + lifeList.push("onDestroy"); + } + + if (data.event == onForeground2 && !flag) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG); + flag = true; + } else if (data.event == onForeground2 && flag) { + setTimeout(async () => { + commonEvent.unsubscribe(subscriber, async (err, data) => { + console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); + expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck)); + expect(status1).assertTrue(); + done(); + }); + }, sleepTimeOne); + } + + if (data.event == onBackground2) { + let cmd = "uinput -K -d 18 -u 18"; + await executeShellCommand(cmd, TAG); + await slideScreen(TAG); + } + }); + }).catch((error) => { + console.log(TAG + "createSubscriber data : " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + await power.isScreenOn().then((data) => { + console.log(TAG + "isScreenOn status1 data = " + JSON.stringify(data)); + status1 = data; + }).catch((error) => { + console.log(TAG + "isScreenOn status1 error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + + let wantNum = { + bundleName: "ohos.acts.aafwk.test.stageonandoffscreen", + abilityName: "MainAbility2" + } + await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { + console.log(TAG + "startAbility data = " + JSON.stringify(data)); + }).catch((error) => { + console.log(TAG + "startAbility error = " + JSON.stringify(error)); + expect().assertFail(); + done(); + }) + }) + + /* + * @tc.number : SUB_AA_OpenHarmony_Share_1000 + * @tc.name : Verify the ability implicit start + * @tc.desc : Verify that the capability is started implicitly, and the input parameter is a nonexistent action. + */ + it('SUB_AA_OpenHarmony_Share_1000', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_Share_1000 == '; + console.log(TAG + "begin"); + + let wantNum = { + action: "ohos.acts.aafwk.aafwk.aafwk", + } + await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { + console.log(TAG + "startAbility data = " + JSON.stringify(data)); + expect().assertFail(); + done(); + }).catch((error) => { + console.log(TAG + "startAbility error = " + JSON.stringify(error)); + done(); + }) + }) + }) +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/module.json b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..0199106a56cb36899900f7a88bec678653b7565d --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/module.json @@ -0,0 +1,50 @@ +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:white", + "visible": true, + "launchType": "singleton", + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/element/color.json b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..1bbc9aa9617e97c45440e1d3d66afc1154837012 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..917ecd4da54d99cac4cea51deef18431f433d742 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "ActsOnAndOffScreenTest" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..feec276e105eeb8d621c20aaf838f318b0a94150 --- /dev/null +++ b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} diff --git a/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/signature/openharmony_sx.p7b b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/actssupportfunction/actsonandoffscreentest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/Test.json b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/Test.json index 64f2b975d4e00e7b66493bb0990c565dc3b0200c..43943c705dbd0648f1ae9d0a88188ac6fd8125d5 100644 --- a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/Test.json +++ b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/Test.json @@ -15,9 +15,7 @@ "FaSupportFunction.hap", "FaSupportFunctionTwo.hap", "FaSupportFunctionThree.hap", - "StageSupportFunction.hap", - "FaOnAndOffScreen.hap", - "StageOnAndOffScreen.hap" + "StageSupportFunction.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaSetDisplayOrientation.test.ets b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaSetDisplayOrientation.test.ets index ee6a8cd3aca8a465ebc319f06b847a29232ec060..c4ca0cb700844fa2cbcb8f9cb3ccf5e8f82f722e 100644 --- a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaSetDisplayOrientation.test.ets +++ b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaSetDisplayOrientation.test.ets @@ -22,13 +22,23 @@ export default function FaSetDisplayOrientationTest() { describe('FaSetDisplayOrientationTest', function () { let TAG = ""; - let TAG1 = "SUB_AA_OpenHarmony == "; + let TAG1 = "SUB_AA_OpenHarmony == FaSetDisplayOrientationTest : "; let sleepTimeOne = 1000; let sleepTimeTwo = 2000; let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); afterEach(async (done) => { console.log(TAG1 + "afterEach called"); + let wantInfo = { + bundleName: "com.example.supportfunctionhaptest", + abilityName: "MainAbility" + } + await globalThis.abilityTestContext.startAbility(wantInfo).then((data) => { + console.log(TAG1 + "startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log(TAG1 + "startAbility err : " + JSON.stringify(err)); + }) + let cmd1 = "aa force-stop ohos.acts.aafwk.test.fasupportfunction"; let cmd2 = "aa force-stop ohos.acts.aafwk.test.fasupportfunctionthree"; @@ -67,12 +77,12 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0200 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0500 * @tc.name : Verify getDisplayOrientation and setDisplayOrientation interfaces * @tc.desc : Set the horizontal and vertical screen status of ability to UNSPECIFIED. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_0200', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0200 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_0500', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0500 == '; console.log(TAG + "begin"); let displayOrientationBefore = undefined; @@ -131,12 +141,12 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0300 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0600 * @tc.name : Verify getDisplayOrientation and setDisplayOrientation interfaces * @tc.desc : Set the horizontal and vertical screen status of ability to LANDSCAPE. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_0300', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0300 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_0600', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0600 == '; console.log(TAG + "begin"); let displayOrientationBefore = undefined; @@ -198,12 +208,12 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0400 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0700 * @tc.name : Verify getDisplayOrientation and setDisplayOrientation interfaces * @tc.desc : Set the horizontal and vertical screen status of ability to PORTRAIT. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_0400', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0400 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_0700', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0700 == '; console.log(TAG + "begin"); let displayOrientationBefore = undefined; @@ -265,13 +275,13 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0500 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0800 * @tc.name : Verify getDisplayOrientation and setDisplayOrientation interfaces * @tc.desc : The same applies to setting ability1 to LANDSCAPE, and ability1 starts ability2 and sets the status of ability2 to FOLLOW_RECENT. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_0500', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0500 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_0800', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0800 == '; console.log(TAG + "begin"); let displayOrientationBefore1 = undefined; @@ -349,13 +359,13 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0600 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0900 * @tc.name : Verify getDisplayOrientation and setDisplayOrientation interfaces * @tc.desc : The same applies to setting ability1 to PORTRAIT, and ability1 starts ability2 and sets the status of ability2 to FOLLOW_RECENT. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_0600', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0600 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_0900', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0900 == '; console.log(TAG + "begin"); let displayOrientationBefore1 = undefined; @@ -433,13 +443,13 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0700 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1000 * @tc.name : Verify getDisplayOrientation and setDisplayOrientation interfaces * @tc.desc : Different haps set ability1 to LANDSCAPE, and ability1 starts ability2 and sets the status of ability2 to FOLLOW_RECENT. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_0700', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0700 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1000', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1000 == '; console.log(TAG + "begin"); let displayOrientationBefore1 = undefined; @@ -517,13 +527,13 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0800 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1100 * @tc.name : Verify getDisplayOrientation and setDisplayOrientation interfaces * @tc.desc : Different haps set ability1 to PORTRAIT, and ability1 starts ability2 and sets the status of ability2 to FOLLOW_RECENT. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_0800', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0800 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1100', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1100 == '; console.log(TAG + "begin"); let displayOrientationBefore1 = undefined; @@ -601,13 +611,13 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_0900 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1200 * @tc.name : Verify getDisplayOrientation and setDisplayOrientation interfaces * @tc.desc : Different applications set ability1 to LANDSCAPE, and ability1 starts ability2 and sets the status of ability2 to FOLLOW_RECENT. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_0900', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_0900 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1200', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1200 == '; console.log(TAG + "begin"); let displayOrientationBefore1 = undefined; @@ -685,13 +695,13 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1000 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1300 * @tc.name : Verify getDisplayOrientation and setDisplayOrientation interfaces * @tc.desc : Different applications set ability1 to PORTRAIT, and ability1 starts ability2 and sets the status of ability2 to FOLLOW_RECENT. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_1000', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1000 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1300', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1300 == '; console.log(TAG + "begin"); let displayOrientationBefore1 = undefined; @@ -773,12 +783,12 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1100 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1400 * @tc.name : Verify setDisplayOrientation interfaces * @tc.desc : SetDisplayOrientation input parameter is undefined. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_1100', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1100 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1400', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1400 == '; console.log(TAG + "begin"); let status1 = undefined; @@ -837,12 +847,12 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1200 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1500 * @tc.name : Verify setDisplayOrientation interfaces * @tc.desc : SetDisplayOrientation input parameter is -1. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_1200', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1200 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1500', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1500 == '; console.log(TAG + "begin"); let status1 = undefined; @@ -901,12 +911,12 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1300 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1600 * @tc.name : Verify setDisplayOrientation interfaces * @tc.desc : SetDisplayOrientation input parameter is a nonexistent enumeration value. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_1300', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1300 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1600', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1600 == '; console.log(TAG + "begin"); let status1 = undefined; @@ -965,12 +975,12 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1400 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1700 * @tc.name : Verify setDisplayOrientation interfaces * @tc.desc : SetDisplayOrientation input parameter is a value of string type. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_1400', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1400 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1700', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1700 == '; console.log(TAG + "begin"); let status1 = undefined; @@ -1029,12 +1039,12 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1500 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1800 * @tc.name : Verify setDisplayOrientation interfaces * @tc.desc : SetDisplayOrientation input parameter is of type array. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_1500', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1500 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1800', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1800 == '; console.log(TAG + "begin"); let status1 = undefined; @@ -1093,12 +1103,12 @@ export default function FaSetDisplayOrientationTest() { }) /* - * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1600 + * @tc.number : SUB_AA_OpenHarmony_DisplayOrientation_1900 * @tc.name : Verify setDisplayOrientation interfaces * @tc.desc : SetDisplayOrientation input parameter is of type json. */ - it('SUB_AA_OpenHarmony_DisplayOrientation_1600', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1600 == '; + it('SUB_AA_OpenHarmony_DisplayOrientation_1900', 0, async function (done) { + TAG = 'SUB_AA_OpenHarmony_DisplayOrientation_1900 == '; console.log(TAG + "begin"); let status1 = undefined; diff --git a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaShowOnLock.test.ets b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaShowOnLock.test.ets index ddc89ff2a4d415771544ae7e5a8a4f44b293a0d5..ca61879ab195fc366be1bb330c6d17c6c19d9daf 100644 --- a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaShowOnLock.test.ets +++ b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/FaShowOnLock.test.ets @@ -16,16 +16,41 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; import commonEvent from '@ohos.commonEvent'; import power from '@ohos.power'; +import backgroundTaskManager from '@ohos.backgroundTaskManager'; export default function FaShowOnLockTest() { describe('FaShowOnLockTest', function () { let TAG = ""; - let TAG1 = "SUB_AA_OpenHarmony == "; + let TAG1 = "SUB_AA_OpenHarmony == FaShowOnLockTest : "; let sleepTimeOne = 1000; let sleepTimeTwo = 2000; let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + let id = undefined; + beforeAll(async (done) => { + console.log(TAG1 + "beforeAll called"); + let myReason = 'test FaShowOnLockTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log(TAG1 + "Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log(TAG1 + "requestId is : " + id); + setTimeout(function () { + console.log(TAG1 + "beforeAll end"); + done(); + }, sleepTimeOne); + }) + + afterAll(async (done) => { + console.log(TAG1 + "afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log(TAG1 + "afterAll end"); + done(); + }, sleepTimeOne); + }) + beforeEach(async (done) => { console.log(TAG1 + "beforeEach called"); let status = undefined; diff --git a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/List.test.ets index 9408471b7130dd978a58be567d5ec53b4f2d5ba5..151b8b2773a7b7093d1663ebc3a2bbaea1309575 100644 --- a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/List.test.ets +++ b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/List.test.ets @@ -15,11 +15,9 @@ import abilityIsTerminatingTest from './AbilityIsTerminating.test'; import faSetDisplayOrientation from './FaSetDisplayOrientation.test'; import faShowOnLock from './FaShowOnLock.test'; -import onAndOffScreenTest from './OnAndOffScreenTest.test'; export default function testsuite() { abilityIsTerminatingTest(); faSetDisplayOrientation(); faShowOnLock(); - onAndOffScreenTest(); } \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets deleted file mode 100644 index a47a5d44d81e63ebc5c8bbda82f53bd74588d069..0000000000000000000000000000000000000000 --- a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/OnAndOffScreenTest.test.ets +++ /dev/null @@ -1,610 +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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; -import { BY,UiDriver,UiComponent } from '@ohos.uitest'; -import commonEvent from '@ohos.commonEvent'; -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; -import power from '@ohos.power'; - -export default function OnAndOffScreenTest() { - - describe('OnAndOffScreenTest', function () { - - let TAG = ""; - let TAG1 = "SUB_AA_OpenHarmony == "; - let sleepTimeOne = 1000; - let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); - - async function slideScreen(TAG) { - console.log(TAG + "slideScreen start"); - var driver = UiDriver.create(); - await driver.swipe(100, 100, 500, 500); - driver.delayMs(500); - console.log(TAG + "slideScreen end"); - } - - async function executeShellCommand(cmd, TAG) { - console.log(TAG + "executeShellCommand start : " + JSON.stringify(cmd)); - await abilityDelegator.executeShellCommand(cmd).then((data) => { - console.log(TAG + "executeShellCommand : data : " + data.stdResult); - console.log(TAG + "executeShellCommand : data : " + data.exitCode); - }).catch((error) => { - console.log(TAG + "executeShellCommand error : " + JSON.stringify(error)); - }) - } - - beforeEach(async (done) => { - console.log(TAG1 + "beforeEach called"); - let status = undefined; - await power.isScreenOn().then((data) => { - console.log(TAG1 + "isScreenOn data = " + JSON.stringify(data)); - status = data; - }).catch((error) => { - console.log(TAG1 + "isScreenOn error = " + JSON.stringify(error)); - }) - - if (!status) { - let cmd = "uinput -K -d 18 -u 18"; - await executeShellCommand(cmd, TAG1); - await slideScreen(TAG1); - } - - setTimeout(() => { - console.log(TAG1 + "beforeEach end"); - done(); - }, sleepTimeOne); - }) - - afterEach(async (done) => { - console.log(TAG1 + "afterEach called"); - let cmd1 = "aa force-stop ohos.acts.aafwk.test.faonandoffscreen"; - await executeShellCommand(cmd1, TAG); - let cmd2 = "aa force-stop ohos.acts.aafwk.test.stageonandoffscreen"; - await executeShellCommand(cmd2, TAG); - - setTimeout(() => { - console.log(TAG1 + "afterEach end"); - done(); - }, sleepTimeOne); - }) - - /* - * @tc.number : SUB_AA_OpenHarmony_OnAndOffScreen_0100 - * @tc.name : Verify the life cycle of on / off screen ability - * @tc.desc : FA model is applied in the foreground, and the device is locked. - */ - it('SUB_AA_OpenHarmony_OnAndOffScreen_0100', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_OnAndOffScreen_0100 == '; - console.log(TAG + "begin"); - - let status1 = undefined; - let lifeList = []; - let listCheck = ["onCreate", "onActive", "onInactive", "onHide"]; - let onActive = "FaOnAndOffScreen_MainAbility_onActive"; - let onHide = "FaOnAndOffScreen_MainAbility_onHide"; - - var subscriber; - var subscribeInfo = { - events: [onActive, onHide] - } - await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { - console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); - subscriber = data; - - commonEvent.subscribe(subscriber, async (err, data) => { - console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); - - if (data.event == onActive) { - let cmd = "uinput -K -d 18 -u 18"; - await executeShellCommand(cmd, TAG); - } - - if (data.event == onHide) { - lifeList = data.parameters.lifeList; - setTimeout(async () => { - commonEvent.unsubscribe(subscriber, async (err, data) => { - console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); - expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck)); - expect(status1).assertTrue(); - done(); - }); - }, sleepTimeOne); - } - }); - }).catch((error) => { - console.log(TAG + "createSubscriber data : " + JSON.stringify(error)); - expect().assertFail(); - done(); - }) - - await power.isScreenOn().then((data) => { - console.log(TAG + "isScreenOn status1 data = " + JSON.stringify(data)); - status1 = data; - }).catch((error) => { - console.log(TAG + "isScreenOn status1 error = " + JSON.stringify(error)); - expect().assertFail(); - done(); - }) - - let wantNum = { - bundleName: "ohos.acts.aafwk.test.faonandoffscreen", - abilityName: "ohos.acts.aafwk.test.faonandoffscreen.MainAbility" - } - await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { - console.log(TAG + "startAbility data = " + JSON.stringify(data)); - }).catch((error) => { - console.log(TAG + "startAbility error = " + JSON.stringify(error)); - expect().assertFail(); - done(); - }) - }) - - /* - * @tc.number : SUB_AA_OpenHarmony_OnAndOffScreen_0200 - * @tc.name : Verify the life cycle of on / off screen ability - * @tc.desc : FA model is applied in the foreground, the device locks the screen, and then unlocks. - */ - it('SUB_AA_OpenHarmony_OnAndOffScreen_0200', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_OnAndOffScreen_0200 == '; - console.log(TAG + "begin"); - - let status1 = undefined; - let lifeList = []; - let listCheck = ["onCreate", "onActive", "onInactive", "onHide", "onShow"]; - let onActive = "FaOnAndOffScreen_MainAbility_onActive"; - let onHide = "FaOnAndOffScreen_MainAbility_onHide"; - let onShow = "FaOnAndOffScreen_MainAbility_onShow"; - - var subscriber; - var subscribeInfo = { - events: [onActive, onHide, onShow] - } - await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { - console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); - subscriber = data; - - commonEvent.subscribe(subscriber, async (err, data) => { - console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); - - if (data.event == onActive) { - let cmd = "uinput -K -d 18 -u 18"; - await executeShellCommand(cmd, TAG); - } - - if (data.event == onHide) { - let cmd = "uinput -K -d 18 -u 18"; - await executeShellCommand(cmd, TAG); - await slideScreen(TAG); - } - - if (data.event == onShow) { - lifeList = data.parameters.lifeList; - setTimeout(async () => { - commonEvent.unsubscribe(subscriber, async (err, data) => { - console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); - expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck)); - expect(status1).assertTrue(); - done(); - }); - }, sleepTimeOne); - } - }); - }).catch((error) => { - console.log(TAG + "createSubscriber data : " + JSON.stringify(error)); - expect().assertFail(); - done(); - }) - - await power.isScreenOn().then((data) => { - console.log(TAG + "isScreenOn status1 data = " + JSON.stringify(data)); - status1 = data; - }).catch((error) => { - console.log(TAG + "isScreenOn status1 error = " + JSON.stringify(error)); - expect().assertFail(); - done(); - }) - - let wantNum = { - bundleName: "ohos.acts.aafwk.test.faonandoffscreen", - abilityName: "ohos.acts.aafwk.test.faonandoffscreen.MainAbility" - } - await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { - console.log(TAG + "startAbility data = " + JSON.stringify(data)); - }).catch((error) => { - console.log(TAG + "startAbility error = " + JSON.stringify(error)); - expect().assertFail(); - done(); - }) - }) - - /* - * @tc.number : SUB_AA_OpenHarmony_OnAndOffScreen_0300 - * @tc.name : Verify the life cycle of on / off screen ability - * @tc.desc : Stage model is applied in the foreground, and the device locks the screen. - */ - it('SUB_AA_OpenHarmony_OnAndOffScreen_0300', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_OnAndOffScreen_0300 == '; - console.log(TAG + "begin"); - - let status1 = undefined; - let lifeList = []; - let listCheck = ["onCreate", "onForeground", "onBackground"]; - let onForeground = "StageOnAndOffScreen_MainAbility_onForeground"; - let onBackground = "StageOnAndOffScreen_MainAbility_onBackground"; - - var subscriber; - var subscribeInfo = { - events: [onForeground, onBackground] - } - await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { - console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); - subscriber = data; - - commonEvent.subscribe(subscriber, async (err, data) => { - console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); - - if (data.event == onForeground) { - let cmd = "uinput -K -d 18 -u 18"; - await executeShellCommand(cmd, TAG); - } - - if (data.event == onBackground) { - lifeList = data.parameters.lifeList; - setTimeout(async () => { - commonEvent.unsubscribe(subscriber, async (err, data) => { - console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); - expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck)); - expect(status1).assertTrue(); - done(); - }); - }, sleepTimeOne); - } - }); - }).catch((error) => { - console.log(TAG + "createSubscriber data : " + JSON.stringify(error)); - expect().assertFail(); - done(); - }) - - await power.isScreenOn().then((data) => { - console.log(TAG + "isScreenOn status1 data = " + JSON.stringify(data)); - status1 = data; - }).catch((error) => { - console.log(TAG + "isScreenOn status1 error = " + JSON.stringify(error)); - expect().assertFail(); - done(); - }) - - let wantNum = { - bundleName: "ohos.acts.aafwk.test.stageonandoffscreen", - abilityName: "MainAbility" - } - await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { - console.log(TAG + "startAbility data = " + JSON.stringify(data)); - }).catch((error) => { - console.log(TAG + "startAbility error = " + JSON.stringify(error)); - expect().assertFail(); - done(); - }) - }) - - /* - * @tc.number : SUB_AA_OpenHarmony_OnAndOffScreen_0400 - * @tc.name : Verify the life cycle of on / off screen ability - * @tc.desc : The stage model is applied in the foreground, the device locks the screen, and then unlocks. - */ - it('SUB_AA_OpenHarmony_OnAndOffScreen_0400', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_OnAndOffScreen_0400 == '; - console.log(TAG + "begin"); - - let flag = false; - let status1 = undefined; - let lifeList = []; - let listCheck = ["onCreate", "onForeground", "onBackground", "onForeground"]; - let onForeground = "StageOnAndOffScreen_MainAbility_onForeground"; - let onBackground = "StageOnAndOffScreen_MainAbility_onBackground"; - - var subscriber; - var subscribeInfo = { - events: [onForeground, onBackground] - } - await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { - console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); - subscriber = data; - - commonEvent.subscribe(subscriber, async (err, data) => { - console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); - - if (data.event == onForeground && !flag) { - let cmd = "uinput -K -d 18 -u 18"; - await executeShellCommand(cmd, TAG); - flag = true; - } else if (data.event == onForeground && flag) { - lifeList = data.parameters.lifeList; - setTimeout(async () => { - commonEvent.unsubscribe(subscriber, async (err, data) => { - console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); - expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck)); - expect(status1).assertTrue(); - done(); - }); - }, sleepTimeOne); - } - - if (data.event == onBackground) { - let cmd = "uinput -K -d 18 -u 18"; - await executeShellCommand(cmd, TAG); - await slideScreen(TAG); - } - }); - }).catch((error) => { - console.log(TAG + "createSubscriber data : " + JSON.stringify(error)); - expect().assertFail(); - done(); - }) - - await power.isScreenOn().then((data) => { - console.log(TAG + "isScreenOn status1 data = " + JSON.stringify(data)); - status1 = data; - }).catch((error) => { - console.log(TAG + "isScreenOn status1 error = " + JSON.stringify(error)); - expect().assertFail(); - done(); - }) - - let wantNum = { - bundleName: "ohos.acts.aafwk.test.stageonandoffscreen", - abilityName: "MainAbility" - } - await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { - console.log(TAG + "startAbility data = " + JSON.stringify(data)); - }).catch((error) => { - console.log(TAG + "startAbility error = " + JSON.stringify(error)); - expect().assertFail(); - done(); - }) - }) - - /* - * @tc.number : SUB_AA_OpenHarmony_OnAndOffScreen_0500 - * @tc.name : Verify the life cycle of on / off screen ability - * @tc.desc : Application in the background, device lock screen. - */ - it('SUB_AA_OpenHarmony_OnAndOffScreen_0500', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_OnAndOffScreen_0500 == '; - console.log(TAG + "begin"); - - let status1 = undefined; - let lifeList = []; - let listCheck = ["onCreate", "onWindowStageCreate", "onForeground", "onBackground"]; - let onCreate = "StageOnAndOffScreen_MainAbility2_onCreate"; - let onWindowStageCreate = "StageOnAndOffScreen_MainAbility2_onWindowStageCreate"; - let onForeground = "StageOnAndOffScreen_MainAbility2_onForeground"; - let onBackground = "StageOnAndOffScreen_MainAbility2_onBackground"; - let onWindowStageDestroy = "StageOnAndOffScreen_MainAbility2_onWindowStageDestroy"; - let onDestroy = "StageOnAndOffScreen_MainAbility2_onDestroy"; - let onForeground2 = "StageOnAndOffScreen_MainAbility3_onForeground"; - let onBackground2 = "StageOnAndOffScreen_MainAbility3_onBackground"; - - var subscriber; - var subscribeInfo = { - events: [onCreate, onWindowStageCreate, onForeground, onBackground, onWindowStageDestroy, onDestroy, - onForeground2, onBackground2] - } - await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { - console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); - subscriber = data; - - commonEvent.subscribe(subscriber, async (err, data) => { - console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); - - if (data.event == onCreate) { - lifeList.push("onCreate"); - } - - if (data.event == onWindowStageCreate) { - lifeList.push("onWindowStageCreate"); - } - - if (data.event == onForeground) { - lifeList.push("onForeground"); - } - - if (data.event == onBackground) { - lifeList.push("onBackground"); - } - - if (data.event == onWindowStageDestroy) { - lifeList.push("onWindowStageDestroy"); - } - - if (data.event == onDestroy) { - lifeList.push("onDestroy"); - } - - if (data.event == onForeground2) { - let cmd = "uinput -K -d 18 -u 18"; - await executeShellCommand(cmd, TAG); - } - - if (data.event == onBackground2) { - setTimeout(async () => { - commonEvent.unsubscribe(subscriber, async (err, data) => { - console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); - expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck)); - expect(status1).assertTrue(); - done(); - }); - }, sleepTimeOne); - } - }); - }).catch((error) => { - console.log(TAG + "createSubscriber data : " + JSON.stringify(error)); - expect().assertFail(); - done(); - }) - - await power.isScreenOn().then((data) => { - console.log(TAG + "isScreenOn status1 data = " + JSON.stringify(data)); - status1 = data; - }).catch((error) => { - console.log(TAG + "isScreenOn status1 error = " + JSON.stringify(error)); - expect().assertFail(); - done(); - }) - - let wantNum = { - bundleName: "ohos.acts.aafwk.test.stageonandoffscreen", - abilityName: "MainAbility2" - } - await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { - console.log(TAG + "startAbility data = " + JSON.stringify(data)); - }).catch((error) => { - console.log(TAG + "startAbility error = " + JSON.stringify(error)); - expect().assertFail(); - done(); - }) - }) - - /* - * @tc.number : SUB_AA_OpenHarmony_OnAndOffScreen_0600 - * @tc.name : Verify the life cycle of on / off screen ability - * @tc.desc : Application in the background, device lock screen. - */ - it('SUB_AA_OpenHarmony_OnAndOffScreen_0600', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_OnAndOffScreen_0600 == '; - console.log(TAG + "begin"); - - let flag = false; - let status1 = undefined; - let lifeList = []; - let listCheck = ["onCreate", "onWindowStageCreate", "onForeground", "onBackground"]; - let onCreate = "StageOnAndOffScreen_MainAbility2_onCreate"; - let onWindowStageCreate = "StageOnAndOffScreen_MainAbility2_onWindowStageCreate"; - let onForeground = "StageOnAndOffScreen_MainAbility2_onForeground"; - let onBackground = "StageOnAndOffScreen_MainAbility2_onBackground"; - let onWindowStageDestroy = "StageOnAndOffScreen_MainAbility2_onWindowStageDestroy"; - let onDestroy = "StageOnAndOffScreen_MainAbility2_onDestroy"; - let onForeground2 = "StageOnAndOffScreen_MainAbility3_onForeground"; - let onBackground2 = "StageOnAndOffScreen_MainAbility3_onBackground"; - - var subscriber; - var subscribeInfo = { - events: [onCreate, onWindowStageCreate, onForeground, onBackground, onWindowStageDestroy, onDestroy, - onForeground2, onBackground2] - } - await commonEvent.createSubscriber(subscribeInfo).then(async (data) => { - console.log(TAG + "createSubscriber data : " + JSON.stringify(data)); - subscriber = data; - - commonEvent.subscribe(subscriber, async (err, data) => { - console.log(TAG + "SubscribeInfoCallback : " + JSON.stringify(data)); - - if (data.event == onCreate) { - lifeList.push("onCreate"); - } - - if (data.event == onWindowStageCreate) { - lifeList.push("onWindowStageCreate"); - } - - if (data.event == onForeground) { - lifeList.push("onForeground"); - } - - if (data.event == onBackground) { - lifeList.push("onBackground"); - } - - if (data.event == onWindowStageDestroy) { - lifeList.push("onWindowStageDestroy"); - } - - if (data.event == onDestroy) { - lifeList.push("onDestroy"); - } - - if (data.event == onForeground2 && !flag) { - let cmd = "uinput -K -d 18 -u 18"; - await executeShellCommand(cmd, TAG); - flag = true; - } else if (data.event == onForeground2 && flag) { - setTimeout(async () => { - commonEvent.unsubscribe(subscriber, async (err, data) => { - console.log(TAG + "UnSubscribeInfoCallback : " + JSON.stringify(data)); - expect(JSON.stringify(lifeList)).assertEqual(JSON.stringify(listCheck)); - expect(status1).assertTrue(); - done(); - }); - }, sleepTimeOne); - } - - if (data.event == onBackground2) { - let cmd = "uinput -K -d 18 -u 18"; - await executeShellCommand(cmd, TAG); - await slideScreen(TAG); - } - }); - }).catch((error) => { - console.log(TAG + "createSubscriber data : " + JSON.stringify(error)); - expect().assertFail(); - done(); - }) - - await power.isScreenOn().then((data) => { - console.log(TAG + "isScreenOn status1 data = " + JSON.stringify(data)); - status1 = data; - }).catch((error) => { - console.log(TAG + "isScreenOn status1 error = " + JSON.stringify(error)); - expect().assertFail(); - done(); - }) - - let wantNum = { - bundleName: "ohos.acts.aafwk.test.stageonandoffscreen", - abilityName: "MainAbility2" - } - await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { - console.log(TAG + "startAbility data = " + JSON.stringify(data)); - }).catch((error) => { - console.log(TAG + "startAbility error = " + JSON.stringify(error)); - expect().assertFail(); - done(); - }) - }) - - /* - * @tc.number : SUB_AA_OpenHarmony_Share_1000 - * @tc.name : Verify the ability implicit start - * @tc.desc : Verify that the capability is started implicitly, and the input parameter is a nonexistent action. - */ - it('SUB_AA_OpenHarmony_Share_1000', 0, async function (done) { - TAG = 'SUB_AA_OpenHarmony_Share_1000 == '; - console.log(TAG + "begin"); - - let wantNum = { - action: "ohos.acts.aafwk.aafwk.aafwk", - } - await globalThis.abilityTestContext.startAbility(wantNum).then((data) => { - console.log(TAG + "startAbility data = " + JSON.stringify(data)); - expect().assertFail(); - done(); - }).catch((error) => { - console.log(TAG + "startAbility error = " + JSON.stringify(error)); - done(); - }) - }) - }) -} \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/module.json b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/module.json index f81b1543a04f1b750c63ed035fc6e161102f855b..0199106a56cb36899900f7a88bec678653b7565d 100644 --- a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/module.json +++ b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -22,6 +23,7 @@ "startWindowIcon": "$media:icon", "startWindowBackground": "$color:white", "visible": true, + "launchType": "singleton", "skills": [ { "entities": [ @@ -33,6 +35,16 @@ } ] } + ], + "requestPermissions": [ + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" + } ] } } \ No newline at end of file diff --git a/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/config.json b/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/config.json index c12007742965d221626122995ecb284c6dc2b0f2..f4ceb1a2582fdb5403bb91be4eb8a52e933df412 100644 --- a/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/config.json +++ b/ability/ability_runtime/actssupportfunction/faonandoffscreen/entry/src/main/config.json @@ -17,6 +17,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/config.json b/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/config.json index a4daf622f8157c47202b0aea34e46ecb214d2150..5fc9c11391f98c496c86e71cf6a09dc49c31942f 100644 --- a/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/config.json +++ b/ability/ability_runtime/actssupportfunction/fasupportfunction/entry/src/main/config.json @@ -17,6 +17,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/actssupportfunction/fasupportfunction/fasupportfunctiontwo/src/main/config.json b/ability/ability_runtime/actssupportfunction/fasupportfunction/fasupportfunctiontwo/src/main/config.json index c719b946dd9df4e8ff12c3ca12fee2fc273d6329..c7a107d402dbcd334f8b833de6b1f4eeb553e96b 100644 --- a/ability/ability_runtime/actssupportfunction/fasupportfunction/fasupportfunctiontwo/src/main/config.json +++ b/ability/ability_runtime/actssupportfunction/fasupportfunction/fasupportfunctiontwo/src/main/config.json @@ -17,6 +17,7 @@ "name": ".fasupportfunctiontwo", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/actssupportfunction/fasupportfunctionthree/entry/src/main/config.json b/ability/ability_runtime/actssupportfunction/fasupportfunctionthree/entry/src/main/config.json index 111d354fc3af39d023ada8235ff0b9b650c892c4..9b7734d2ec2ee177de90b8e2d1c51c88a35f562d 100644 --- a/ability/ability_runtime/actssupportfunction/fasupportfunctionthree/entry/src/main/config.json +++ b/ability/ability_runtime/actssupportfunction/fasupportfunctionthree/entry/src/main/config.json @@ -17,6 +17,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/module.json b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/module.json index 21fad3b21d24ad38b0d5b80defdb8b450361ba7a..f99e1263411f8b35fd0c56dad06f5c7a151937d4 100644 --- a/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/module.json +++ b/ability/ability_runtime/actssupportfunction/stageonandoffscreen/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/actssupportfunction/stagesupportfunction/entry/src/main/module.json b/ability/ability_runtime/actssupportfunction/stagesupportfunction/entry/src/main/module.json index 193fbe2729a6be135477bc3e72d8c0956373d952..be8af7585da85bc779d10f3fe26c56a37236a9a4 100644 --- a/ability/ability_runtime/actssupportfunction/stagesupportfunction/entry/src/main/module.json +++ b/ability/ability_runtime/actssupportfunction/stagesupportfunction/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/config.json b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/config.json index b6296a1c98d879e07803c83b459e7d105fca42e1..e428f5e935d5085c5ad9149a157ad737504601e7 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/config.json +++ b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/config.json @@ -18,6 +18,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/ServiceAbility/service.ts index 1f59e0610a8e2d81c31b546dedcd9824ae876628..2dacb6574be66d2f68efc846b3037f365a781aca 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/ServiceAbility/service.ts +++ b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/ServiceAbility/service.ts @@ -13,13 +13,13 @@ * limitations under the License. */ import commonEvent from "@ohos.commonEvent" -import featureAbility from '@ohos.ability.featureAbility' +import particleAbility from '@ohos.ability.particleAbility' export default { onStart() { console.info('ServiceAbility onStart'); commonEvent.publish("ACTS_InterfaceMultiUsers_0100_Start_CommonEvent", () => { console.log(" Publish ACTS_InterfaceMultiUsersExtension_CommonEvent callback") - featureAbility.terminateSelf().then(() => { + particleAbility.terminateSelf().then(() => { console.log('terminateSelf promise'); commonEvent.publish("ACTS_TerminateSelf_CommonEvent", () => { console.log(" Publish ACTS_TerminateSelf_CommonEvent callback") diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/module.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/module.json index 7c50780a282fac6917578612e8e8870070b881a8..0708ef68311b7a5cd563f9fcd008298b8aff8962 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/module.json +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppA/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/module.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/module.json index 99b6752f5e1704f1a5d4da4837ddbf71452b2376..57dd4170d26022f09453024b8562412d4b9093ba 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/module.json +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppB/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/module.json b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/module.json index 933db7e827ece3a4db232a4e3620b2df9e6acb15..67a16160585a8717a86fefb797ef8a32e0fd6b12 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/module.json +++ b/ability/ability_runtime/actsusers/ActsAmsUsersKillProcessAppC/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/Ability.test.ets index 2f92b8b0047c723e9a21906ebff8cb523c1be9e6..c532c04c7d9322a2dd1f04af9eabc89285e0571b 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/Ability.test.ets @@ -16,6 +16,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from " import commonEvent from '@ohos.commonEvent' import appManager from '@ohos.application.appManager' import osaccount from '@ohos.account.osAccount' +import backgroundTaskManager from '@ohos.backgroundTaskManager'; var subscriberInfo_MainAbility = { events: ["ACTS_InterfaceMultiUsers_0100_Start_CommonEvent","ACTS_TerminateSelf_CommonEvent"] @@ -39,6 +40,38 @@ export default function abilityTest() { // }) // }) // }) + + let id = undefined; + beforeAll(async (done) => { + console.log("ACTS_InterfaceMultiUsers beforeAll called"); + let myReason = 'test FaShowOnLockTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log("ACTS_InterfaceMultiUsers Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log("ACTS_InterfaceMultiUsers requestId is : " + id); + setTimeout(function () { + console.log("ACTS_InterfaceMultiUsers beforeAll end"); + done(); + }, 1000); + }) + + afterAll(async (done) => { + console.log("ACTS_InterfaceMultiUsers afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log("ACTS_InterfaceMultiUsers afterAll end"); + done(); + }, 1000); + }) + + afterEach(async (done) => { + console.error("ACTS_InterfaceMultiUsers afterEach called"); + setTimeout(function() { + done(); + }, 500); + }) + console.debug("====>in ACTS_InterfaceMultiUsers====>"); /* * @tc.number : ACTS_startAbility_0100 @@ -46,24 +79,25 @@ export default function abilityTest() { * @tc.desc : Start an ability with the parameter startability with options succeeded.(promise) */ it('ACTS_StartAbility_0100', 0, async function (done) { + let TAG = 'ACTS_StartAbility_0100' let Subscriber var flag = true var startresult = false function SubscribeCallBack (err, data) { expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent" || data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); if(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"){ startresult = true } commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.actsinterfacemultiuserstest', @@ -71,14 +105,14 @@ export default function abilityTest() { }, { windowMode:0 }).then((data)=>{ - console.debug("====>startAbility end====>"); - console.debug("====>data is====>" + JSON.stringify(data)); + console.debug(TAG + "====>startAbility end====>"); + console.debug(TAG + "====>data is====>" + JSON.stringify(data)); }) }) }) function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(true); done(); @@ -87,7 +121,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_startAbility_0100 - timeout'); + console.debug(TAG + 'ACTS_startAbility_0100 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -101,20 +135,21 @@ export default function abilityTest() { * @tc.desc : Start an ability with the parameter startability with options failed.(promise) */ it('ACTS_StartAbility_0200', 0, async function (done) { + let TAG = 'ACTS_StartAbility_0200' let Subscriber function SubscribeCallBack (err, data) { expect().assertFail(); - console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.error', @@ -122,18 +157,18 @@ export default function abilityTest() { }, { windowMode:0 }).then(()=>{ - console.debug("====>startAbility end====>"); + console.debug(TAG + "====>startAbility end====>"); }) }) }) function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); done(); } function timeout() { - console.debug('ACTS_startAbility_0200 - timeout'); + console.debug(TAG + 'ACTS_startAbility_0200 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } @@ -146,12 +181,13 @@ export default function abilityTest() { * @tc.desc : Start an ability with the parameter startability with options succeeded.(callback) */ it('ACTS_StartAbility_0300', 0, async function (done) { + let TAG = 'ACTS_StartAbility_0300' let Subscriber var flag = true var startresult = false function SubscribeCallBack (err, data) { expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent" || data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); if(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"){ startresult = true } @@ -159,12 +195,12 @@ export default function abilityTest() { } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); globalThis.abilityContext.startAbility( { bundleName: 'com.acts.actsinterfacemultiuserstest', @@ -172,14 +208,14 @@ export default function abilityTest() { }, { windowMode:0 },() => { - console.debug("====>startAbility end====>" ); + console.debug(TAG + "====>startAbility end====>" ); }) }) }) function UnSubscribeCallback() { flag = false - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); expect(startresult).assertEqual(true); done(); } @@ -187,7 +223,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_startAbility_0300 - timeout'); + console.debug(TAG + 'ACTS_startAbility_0300 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -202,21 +238,22 @@ export default function abilityTest() { * @tc.desc : Start an ability with the parameter startability with options failed.(callback) */ it('ACTS_StartAbility_0400', 0, async function (done) { + let TAG = 'ACTS_StartAbility_0400' let Subscriber function SubscribeCallBack (err, data) { expect().assertFail(); - console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); }) - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.error', @@ -224,17 +261,17 @@ export default function abilityTest() { }, { windowMode:0 },() => { - console.debug("====>startAbility end====>" ); + console.debug(TAG + "====>startAbility end====>" ); }) }) function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); done(); } function timeout() { - console.debug('ACTS_startAbility_0400 - timeout'); + console.debug(TAG + 'ACTS_startAbility_0400 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } @@ -248,37 +285,38 @@ export default function abilityTest() { * @tc.desc : Starting mainability2 with startability succeeded.(promise) */ it('ACTS_StartAbility_0500', 0, async function (done) { + let TAG = 'ACTS_StartAbility_0500' let Subscriber var flag = true var startresult = false function SubscribeCallBack (err, data) { expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent" || data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); if(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"){ startresult = true } commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.actsinterfacemultiuserstest', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2' }).then((data)=>{ - console.debug("====>startAbility end====>"); - console.debug("====>data is====>" + JSON.stringify(data)); + console.debug(TAG + "====>startAbility end====>"); + console.debug(TAG + "====>data is====>" + JSON.stringify(data)); }) }) }) function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(true); done(); @@ -287,7 +325,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_startAbility_0100 - timeout'); + console.debug(TAG + 'ACTS_startAbility_0100 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -301,12 +339,13 @@ export default function abilityTest() { * @tc.desc : Starting mainability2 with startability succeeded.(callback) */ it('ACTS_StartAbility_0700', 0, async function (done) { + let TAG = 'ACTS_StartAbility_0700' let Subscriber var flag = true var startresult = false function SubscribeCallBack (err, data) { expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent" || data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); if(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"){ startresult = true } @@ -314,25 +353,25 @@ export default function abilityTest() { } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); globalThis.abilityContext.startAbility( { bundleName: 'com.acts.actsinterfacemultiuserstest', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2' },() => { - console.debug("====>startAbility end====>" ); + console.debug(TAG + "====>startAbility end====>" ); }) }) }) function UnSubscribeCallback() { flag = false - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); expect(startresult).assertEqual(true); done(); } @@ -340,7 +379,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_startAbility_0300 - timeout'); + console.debug(TAG + 'ACTS_startAbility_0300 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -355,36 +394,37 @@ export default function abilityTest() { * @tc.desc : Start an ability with the parameter startability with options succeeded.(promise) */ it('ACTS_StartAbility_0900', 0, async function (done) { + let TAG = 'ACTS_StartAbility_0900' let Subscriber var flag = true var startresult = false function SubscribeCallBack (err, data) { expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent" || data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); if(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"){ startresult = true } commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.example.userservicesystemapi7', abilityName: 'com.example.userservicesystemapi7.ServiceAbility' }).then(()=>{ - console.debug("====>startAbility end====>"); + console.debug(TAG + "====>startAbility end====>"); }) }) }) function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(true); done(); @@ -393,7 +433,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_startAbility_0900 - timeout'); + console.debug(TAG + 'ACTS_startAbility_0900 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -406,36 +446,37 @@ export default function abilityTest() { * @tc.desc : Start an ability with the parameter startability with options succeeded.(promise) */ it('ACTS_startAbility_1000', 0, async function (done) { + let TAG = 'ACTS_startAbility_1000' let Subscriber var flag = true var startresult = false function SubscribeCallBack (err, data) { expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent" || data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); if(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"){ startresult = true } commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.example.userservicesystemapi7', abilityName: 'com.example.userservicesystemapi7.ServiceAbility' },()=>{ - console.debug("====>startAbility end====>"); + console.debug(TAG + "====>startAbility end====>"); }) }) }) function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(true); done(); @@ -444,7 +485,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_startAbility_1000 - timeout'); + console.debug(TAG + 'ACTS_startAbility_1000 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -458,16 +499,17 @@ export default function abilityTest() { * @tc.desc : Starting mainability3 with startAbilityForResult succeeded.(promise) */ it('ACTS_StartAbilityForResult_0100', 0, async function (done) { + let TAG = 'ACTS_StartAbilityForResult_0100' var flag = true function timeout() { if(flag == true) { expect().assertFail(); - console.debug('AMS_startAbilityForResult_0100 - timeout'); + console.debug(TAG + 'AMS_startAbilityForResult_0100 - timeout'); done(); } } setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); + console.debug(TAG + "====>start startAbilityForResult====>"); await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.actsinterfacemultiuserstest', @@ -475,9 +517,9 @@ export default function abilityTest() { }, { windowMode:0 }).then((data)=>{ - console.debug("====>startAbilityForResult end====>"); + console.debug(TAG + "====>startAbilityForResult end====>"); flag = false - console.debug("====>data.resultCode is====>"+JSON); + console.debug(TAG + "====>data.resultCode is====>"+JSON); expect(data.resultCode).assertEqual(1) expect(data.want.action).assertEqual('ACTION') done(); @@ -490,12 +532,13 @@ export default function abilityTest() { * @tc.desc : Starting mainability3 with startAbilityForResult failed.(promise) */ it('ACTS_StartAbilityForResult_0200', 0, async function (done) { + let TAG = 'ACTS_StartAbilityForResult_0200' function timeout() { - console.debug('ACTS_startAbilityForResult_0200 - timeout'); + console.debug(TAG + 'ACTS_startAbilityForResult_0200 - timeout'); done(); } setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); + console.debug(TAG + "====>start startAbilityForResult====>"); await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.error', @@ -503,7 +546,7 @@ export default function abilityTest() { }, { windowMode:0 }).then((data)=>{ - console.debug("====>startAbilityForResult end====>"); + console.debug(TAG + "====>startAbilityForResult end====>"); expect().assertFail(); expect(data.resultCode).assertEqual(1) expect(data.want.action).assertEqual('ACTION') @@ -517,16 +560,17 @@ export default function abilityTest() { * @tc.desc : Starting mainability3 with startAbilityForResult succeeded.(callback) */ it('ACTS_StartAbilityForResult_0300', 0, async function (done) { + let TAG = 'ACTS_StartAbilityForResult_0300' var flag = true function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_startAbilityForResult_0300 - timeout'); + console.debug(TAG + 'ACTS_startAbilityForResult_0300 - timeout'); done(); } } setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); + console.debug(TAG + "====>start startAbilityForResult====>"); await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.actsinterfacemultiuserstest', @@ -534,7 +578,7 @@ export default function abilityTest() { },{ windowMode : 0 },(err,data)=>{ - console.debug("====>startAbilityForResult end====>"); + console.debug(TAG + "====>startAbilityForResult end====>"); flag = false expect(data.resultCode).assertEqual(1) expect(data.want.action).assertEqual('ACTION') @@ -548,12 +592,13 @@ export default function abilityTest() { * @tc.desc : Starting mainability3 with startAbilityForResult failed.(callback) */ it('ACTS_StartAbilityForResult_0400', 0, async function (done) { + let TAG = 'ACTS_StartAbilityForResult_0400' function timeout() { - console.debug('ACTS_startAbilityForResult_0400 - timeout'); + console.debug(TAG + 'ACTS_startAbilityForResult_0400 - timeout'); done(); } setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); + console.debug(TAG + "====>start startAbilityForResult====>"); await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.error', @@ -562,7 +607,7 @@ export default function abilityTest() { windowMode:0 },(err,data)=>{ expect().assertFail(); - console.debug("====>startAbilityForResult end====>"); + console.debug(TAG + "====>startAbilityForResult end====>"); expect(data.resultCode).assertEqual(1) expect(data.want.action).assertEqual('ACTION') done(); @@ -575,24 +620,25 @@ export default function abilityTest() { * @tc.desc : Starting mainability3 with startAbilityForResult succeeded.(promise) */ it('ACTS_StartAbilityForResult_0500', 0, async function (done) { + let TAG = 'ACTS_StartAbilityForResult_0500' var flag = true function timeout() { if(flag == true) { expect().assertFail(); - console.debug('AMS_startAbilityForResult_0500 - timeout'); + console.debug(TAG + 'AMS_startAbilityForResult_0500 - timeout'); done(); } } setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); + console.debug(TAG + "====>start startAbilityForResult====>"); await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.actsinterfacemultiuserstest', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3', }).then((data)=>{ - console.debug("====>startAbilityForResult end====>"); + console.debug(TAG + "====>startAbilityForResult end====>"); flag = false - console.debug("====>data.resultCode is====>"+JSON); + console.debug(TAG + "====>data.resultCode is====>"+JSON); expect(data.resultCode).assertEqual(1) expect(data.want.action).assertEqual('ACTION') done(); @@ -605,22 +651,23 @@ export default function abilityTest() { * @tc.desc : Starting mainability3 with startAbilityForResult succeeded.(callback) */ it('ACTS_StartAbilityForResult_0700', 0, async function (done) { + let TAG = 'ACTS_StartAbilityForResult_0700' var flag = true function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_startAbilityForResult_0700 - timeout'); + console.debug(TAG + 'ACTS_startAbilityForResult_0700 - timeout'); done(); } } setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); + console.debug(TAG + "====>start startAbilityForResult====>"); await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.actsinterfacemultiuserstest', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3', },(err,data)=>{ - console.debug("====>startAbilityForResult end====>"); + console.debug(TAG + "====>startAbilityForResult end====>"); flag = false expect(data.resultCode).assertEqual(1) expect(data.want.action).assertEqual('ACTION') @@ -634,38 +681,39 @@ export default function abilityTest() { * @tc.desc : Starting mainability2 with startAbility then terminateself ability succeeded.(promise) */ it('ACTS_TerminateSelf_0100', 0, async function (done) { + let TAG = 'ACTS_TerminateSelf_0100' let Subscriber var flag = true var terminateresult = false function SubscribeCallBack (err, data) { expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent" || data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); if(data.event == "ACTS_TerminateSelf_CommonEvent"){ terminateresult = true - console.debug("====>terminateresult is:====>" + JSON.stringify(terminateresult)); + console.debug(TAG + "====>terminateresult is:====>" + JSON.stringify(terminateresult)); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.actsinterfacemultiuserstest', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2' }).then(()=>{ - console.debug("====>startAbility end====>"); + console.debug(TAG + "====>startAbility end====>"); }) }) }) function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); flag = false expect(terminateresult).assertEqual(true); done(); @@ -674,7 +722,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_TerminateSelf_0100 - timeout'); + console.debug(TAG + 'ACTS_TerminateSelf_0100 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -689,12 +737,13 @@ export default function abilityTest() { * @tc.desc : Starting mainability2 with startAbility then terminateself ability succeeded.(callback) */ it('ACTS_TerminateSelf_0300', 0, async function (done) { + let TAG = 'ACTS_TerminateSelf_0300' let Subscriber var flag = true var terminateresult = false function SubscribeCallBack (err, data) { expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent" || data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); if(data.event == "ACTS_TerminateSelf_CommonEvent"){ terminateresult = true commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); @@ -703,25 +752,25 @@ export default function abilityTest() { } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async(SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); globalThis.abilityContext.startAbility( { bundleName: 'com.acts.actsinterfacemultiuserstest', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2' },() => { - console.debug("====>startAbility end====>" ); + console.debug(TAG + "====>startAbility end====>" ); }) }) }) function UnSubscribeCallback() { flag = false - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); expect(terminateresult).assertEqual(true); done(); } @@ -729,7 +778,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_TerminateSelf_0300 - timeout'); + console.debug(TAG + 'ACTS_TerminateSelf_0300 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -745,24 +794,25 @@ export default function abilityTest() { * then terminateself ability and return result succeeded.(promise) */ it('ACTS_TerminateSelfWithResult_0100', 0, async function (done) { + let TAG = 'ACTS_TerminateSelfWithResult_0100' var flag = true function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_TerminateSelfWithResult_0100 - timeout'); + console.debug(TAG + 'ACTS_TerminateSelfWithResult_0100 - timeout'); done(); } } setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); + console.debug(TAG + "====>start startAbilityForResult====>"); await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.actsinterfacemultiuserstest', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3', }).then((data)=>{ - console.debug("====>startAbilityForResult end====>"); + console.debug(TAG + "====>startAbilityForResult end====>"); flag = false - console.debug("====>data.resultCode is====>"+JSON); + console.debug(TAG + "====>data.resultCode is====>"+JSON); expect(data.resultCode).assertEqual(1) expect(data.want.action).assertEqual('ACTION') done(); @@ -776,23 +826,24 @@ export default function abilityTest() { * then terminateself ability and return result succeeded.(callback) */ it('ACTS_TerminateSelfWithResult_0300', 0, async function (done) { + let TAG = 'ACTS_TerminateSelfWithResult_0300' var flag = true function timeout() { if (flag == true) { expect().assertFail(); - console.debug('ACTS_TerminateSelfWithResult_0300 - timeout'); + console.debug(TAG + 'ACTS_TerminateSelfWithResult_0300 - timeout'); done(); } } setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); + console.debug(TAG + "====>start startAbilityForResult====>"); await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.actsinterfacemultiuserstest', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3', },(err,data)=>{ flag = false - console.debug("====>startAbilityForResult end====>"); + console.debug(TAG + "====>startAbilityForResult end====>"); expect(data.resultCode).assertEqual(1) expect(data.want.action).assertEqual('ACTION') done(); @@ -806,28 +857,29 @@ export default function abilityTest() { * then terminateself ability and return result failed.(promise) */ it('ACTS_KillProcess_0100', 0, async function (done) { + let TAG = 'ACTS_KillProcess_0100' var Subscriber var flag = true function SubscribeCallBack (err, data) { expect(data.event == "ACTS_KillProcess").assertTrue(); - console.debug("====>ACTS_KillProcess_0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>ACTS_KillProcess_0100 Subscribe CallBack data:====>" + JSON.stringify(data)); appManager.getProcessRunningInfos().then((data)=> { - console.info('====>ACTS_KillProcess_0100 getProcessRunningInfos=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0100 getProcessRunningInfos=====>' + JSON.stringify(data)) for(var i = 0; ihas com.acts.killprocesshap=====>') + console.info(TAG + '====>has com.acts.killprocesshap=====>') break } } - console.log('====>i is:====>' + JSON.stringify(i)) + console.log(TAG + '====>i is:====>' + JSON.stringify(i)) if(i==data.length && data[i].processName!='com.acts.killprocesshap'){ expect().assertFail() } appManager.killProcessesByBundleName('com.acts.killprocesshap').then((data)=>{ - console.info('====>ACTS_KillProcess_0100 killProcessesByBundleName=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0100 killProcessesByBundleName=====>' + JSON.stringify(data)) setTimeout(()=>{ appManager.getProcessRunningInfos().then((data)=> { - console.info('====>ACTS_KillProcess_0100 getProcessRunningInfos2=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0100 getProcessRunningInfos2=====>' + JSON.stringify(data)) for(var i = 0; i { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.killprocesshap', abilityName: 'com.acts.killprocesshap.MainAbility' }).then((data)=>{ - console.debug("====>startAbility end====>"); - console.debug("====>data is====>" + JSON.stringify(data)); + console.debug(TAG + "====>startAbility end====>"); + console.debug(TAG + "====>data is====>" + JSON.stringify(data)); }) }) }) function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); flag = false done(); } @@ -866,7 +918,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_KillProcess_0100 - timeout'); + console.debug(TAG + 'ACTS_KillProcess_0100 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -881,28 +933,29 @@ export default function abilityTest() { * then terminateself ability and return result failed.(callback) */ it('ACTS_KillProcess_0200', 0, async function (done) { + let TAG = 'ACTS_KillProcess_0200' var Subscriber var flag = true function SubscribeCallBack (err, data) { expect(data.event == "ACTS_KillProcess").assertTrue(); - console.debug("====>ACTS_KillProcess_0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>ACTS_KillProcess_0200 Subscribe CallBack data:====>" + JSON.stringify(data)); appManager.getProcessRunningInfos().then((data)=> { - console.info('====>ACTS_KillProcess_0200 getProcessRunningInfos=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0200 getProcessRunningInfos=====>' + JSON.stringify(data)) for(var i = 0; ihas com.acts.killprocesshap=====>') + console.info(TAG + '====>has com.acts.killprocesshap=====>') break } } - console.log('====>i is:====>' + JSON.stringify(i)) + console.log(TAG + '====>i is:====>' + JSON.stringify(i)) if(i==data.length && data[i].processName!='com.acts.killprocesshap'){ expect().assertFail() } appManager.killProcessesByBundleName('com.acts.killprocesshap',(data)=>{ - console.info('====>ACTS_KillProcess_0200 killProcessesByBundleName=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0200 killProcessesByBundleName=====>' + JSON.stringify(data)) setTimeout(()=> { appManager.getProcessRunningInfos().then((data) => { - console.info('====>ACTS_KillProcess_0200 getProcessRunningInfos2=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0200 getProcessRunningInfos2=====>' + JSON.stringify(data)) for (var i = 0; i < data.length; i++) { if (data[i].processName == 'com.acts.killprocesshap') { expect().assertFail() @@ -916,24 +969,24 @@ export default function abilityTest() { }) } commonEvent.createSubscriber(subscriberInfo_killprocess).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.killprocesshap', abilityName: 'com.acts.killprocesshap.MainAbility' }).then((data)=>{ - console.debug("====>startAbility end====>"); - console.debug("====>data is====>" + JSON.stringify(data)); + console.debug(TAG + "====>startAbility end====>"); + console.debug(TAG + "====>data is====>" + JSON.stringify(data)); }) }) }) function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); flag = false done(); } @@ -941,7 +994,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_KillProcess_0200 - timeout'); + console.debug(TAG + 'ACTS_KillProcess_0200 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -956,24 +1009,25 @@ export default function abilityTest() { * then terminateself ability and return result failed.(promise) */ it('ACTS_ThirdPartyKillProcess_0100', 0, async function (done) { - console.debug("====>start startAbility====>"); + let TAG = 'ACTS_ThirdPartyKillProcess_0100' + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.killprocessthirdhap', abilityName: 'com.acts.killprocessthirdhap.MainAbility' }).then(()=>{ - console.debug("====>startAbility end====>"); + console.debug(TAG + "====>startAbility end====>"); }) setTimeout(()=>{ appManager.getProcessRunningInfos().then((data)=> { - console.info('====>ACTS_KillProcess_0100 getProcessRunningInfos=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0100 getProcessRunningInfos=====>' + JSON.stringify(data)) for(var i = 0; ihas com.acts.killprocessthirdhap=====>') + console.info(TAG + '====>has com.acts.killprocessthirdhap=====>') break } } - console.log('====>i is:====>' + JSON.stringify(i)) + console.log(TAG + '====>i is:====>' + JSON.stringify(i)) if(i==data.length && data[i].processName!='com.acts.killprocessthirdhap'){ expect().assertFail() } @@ -981,13 +1035,13 @@ export default function abilityTest() { },1000) setTimeout(()=> { appManager.getProcessRunningInfos().then((data) => { - console.info('====>ACTS_KillProcess_0100 getProcessRunningInfos2=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0100 getProcessRunningInfos2=====>' + JSON.stringify(data)) for (var i = 0; i < data.length; i++) { if (data[i].processName == 'com.acts.killprocessthirdhap') { break } } - console.log('====>i2 is:====>' + JSON.stringify(i)) + console.log(TAG + '====>i2 is:====>' + JSON.stringify(i)) if(i==data.length && data[i].processName!='com.acts.killprocessthirdhap'){ expect().assertFail() } @@ -1003,24 +1057,25 @@ export default function abilityTest() { * then terminateself ability and return result failed.(callback) */ it('ACTS_ThirdPartyKillProcess_0200', 0, async function (done) { - console.debug("====>start startAbility====>"); + let TAG = 'ACTS_ThirdPartyKillProcess_0200' + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.killprocessthirdhap2', abilityName: 'com.acts.killprocessthirdhap2.MainAbility' }).then(() => { - console.debug("====>startAbility end====>"); + console.debug(TAG + "====>startAbility end====>"); }) setTimeout(() => { appManager.getProcessRunningInfos().then((data) => { - console.info('====>ACTS_KillProcess_0100 getProcessRunningInfos=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0100 getProcessRunningInfos=====>' + JSON.stringify(data)) for (var i = 0; i < data.length; i++) { if (data[i].processName == 'com.acts.killprocessthirdhap2') { console.info('====>has com.acts.killprocessthirdhap2=====>') break } } - console.log('====>i is:====>' + JSON.stringify(i)) + console.log(TAG + '====>i is:====>' + JSON.stringify(i)) if (i == data.length && data[i].processName != 'com.acts.killprocessthirdhap2') { expect().assertFail() } @@ -1028,13 +1083,13 @@ export default function abilityTest() { },1000) setTimeout(() => { appManager.getProcessRunningInfos().then((data) => { - console.info('====>ACTS_KillProcess_0100 getProcessRunningInfos2=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0100 getProcessRunningInfos2=====>' + JSON.stringify(data)) for (var i = 0; i < data.length; i++) { if (data[i].processName == 'com.acts.killprocessthirdhap2') { break } } - console.log('====>i2 is:====>' + JSON.stringify(i)) + console.log(TAG + '====>i2 is:====>' + JSON.stringify(i)) if(i==data.length && data[i].processName!='com.acts.killprocessthirdhap'){ expect().assertFail() } diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/module.json b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/module.json index 9cae7b176dd182c1624e18a2f26b48dda690717f..91307c774d4ef37fb65e8664e8cb7abcd919b3d8 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/module.json +++ b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -114,6 +115,14 @@ { "name": "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION", "reason": "need use ohos.permission.MANAGE_LOCAL_ACCOUNTS" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" } ] } diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/module.json index 5688c398db78ea3bb5d87d96a86246331f88710d..c0ea26177cbd32c7bb33eacda520677fdc1ceb98 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/module.json +++ b/ability/ability_runtime/amscontextualinforquery/actsamsextensionmodulehap/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/module.json index f9b841630cfded042ceeff3689be922bcc26e06b..4a7e8aec7292460fb269b36d0cc607c2e540b391 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/module.json +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticabilitystagecontexttest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "com.example.staticabilitystagecontext.MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/module.json index d9a51d0c364eb8e882e2fdcd58d464992fc42a8e..ba61d981c74230179f42dddf1f052249ad33d4cb 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/module.json +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfohap/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "com.example.staticextensioninfotest.MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/test/Ability.test.ets index d777a901cf67d23211504698eea008ed5c737c42..fddd62c18ce956f23b5ab449aa22d2136f8d2d3f 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/ets/test/Ability.test.ets @@ -376,7 +376,7 @@ export default function abilityTest() { expect(data.labelId.length).assertLarger(0); expect(data.icon).assertEqual("$media:icon"); expect(data.iconId.length).assertLarger(0); - expect(data.process).assertEqual("com.example.staticextensioninfo"); + expect(data.process).assertEqual("com.example.staticextensioninfotest"); expect(data.supportedModes).assertEqual(0); expect(data.moduleSourceDirs.length).assertEqual(1); expect(data.moduleSourceDirs[0]).assertEqual("/data/app/el1/bundle/public/" + diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/module.json index 93021963968c39cb1354f3d4514fc88c556a59a3..36fa006e12125f5f90e48d1314409b48a8a64bc6 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/module.json +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticextensioninfotest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "com.example.staticextensioninfo.MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/module.json index 29f9d54c2740fd91397020f76ef336885cfdffac..dc941e9c361802fdce346514c6cc3348d090b1fc 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/module.json +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapa/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/module.json index ad3c7f20097ee1d14dffcb6bd1d5077753757723..f149ec893a65903b70233b26ad323b82f8ea721f 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/module.json +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstatichapb/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/module.json index ac0e4ad2be8ba1dee339b5c10b40c7625b45d382..b9efba8332df03de1983000d0aa7ab6e703e00b3 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/module.json +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinfomationquerytest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "com.example.staticinfomationquery.MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/module.json index e43f7f15e3df7c678a1a48f6cba6aba7c2cf89ef..3049f74f498315ed78c6d19346adf77be1edcf92 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/module.json +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultipletest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/module.json index becb94d1a5146a0fe2fef38f27542b2955e9cf09..879ce108400f6dd391bda1fceebba31a45b965ea 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/module.json +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticinformationmultitest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/module.json b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/module.json index b5a08e893aaa08480222c9cbd7c9d7e0580da5ae..e2379153ad01d1b90f7ed3ff46d1300e7477de86 100644 --- a/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/module.json +++ b/ability/ability_runtime/amscontextualinforquery/actsamsstaticquerytesttwohap/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/amsdatauriutils/BUILD.gn b/ability/ability_runtime/amsdatauriutils/BUILD.gn index e5e4332eded15b417998331d23e94db49d666125..2b34603978fabd888994753b3029f44857d18340 100644 --- a/ability/ability_runtime/amsdatauriutils/BUILD.gn +++ b/ability/ability_runtime/amsdatauriutils/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ability/ability_runtime/amsdatauriutils/src/main/config.json b/ability/ability_runtime/amsdatauriutils/src/main/config.json index e84e34c950cbadbe8a675d95ac57c84a48ae2402..04102ca091d759d76738a4e5fbddc13a57702f9c 100644 --- a/ability/ability_runtime/amsdatauriutils/src/main/config.json +++ b/ability/ability_runtime/amsdatauriutils/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.amsst.amsdatauriutils", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { @@ -113,4 +114,4 @@ "mainAbility": ".MainAbility", "srcPath": "" } -} \ No newline at end of file +} diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/module.json b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/module.json index 7fc559d0628b0b6a53f6b450e3d917db28e803c7..bbc0605a6981989ccc9d0adbe999b17843503b63 100644 --- a/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/module.json +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsspecifytesthap/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility2/MainAbility2.ts index c47793cc75426eb2dd74eeb659dd757468ac50ab..e67d5ef1ae1362462abe3dbf080e06930cb6a064 100644 --- a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility2/MainAbility2.ts +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -16,12 +16,12 @@ import Ability from '@ohos.application.Ability' import commonEvent from '@ohos.commonEvent' async function onShowProcess() { - var abilityWant = globalThis.abilityWant; + var abilityWant = globalThis.abilityWant2; var commonEventPublishData = { parameters: { - displayId: globalThis.abilityWant.parameters['ohos.aafwk.param.displayId'], - windowMode: globalThis.abilityWant.parameters['ohos.aafwk.param.windowMode'], + displayId: abilityWant.parameters['ohos.aafwk.param.displayId'], + windowMode: abilityWant.parameters['ohos.aafwk.param.windowMode'], } }; @@ -29,7 +29,7 @@ async function onShowProcess() { commonEvent.publish("ACTS_TerminateSelf_CommonEvent", commonEventPublishData, () => { console.log('============>querytestsecond success==========>>') - globalThis.abilityContext.terminateSelf(); + globalThis.abilityContext2.terminateSelf(); }); } @@ -38,8 +38,8 @@ export default class MainAbility extends Ability { onCreate(want, launchParam) { // Ability is creating, initialize resources for this ability console.log("MainAbility2 onCreate") - globalThis.abilityWant = want; - console.log("AbilityMultiInstanceAppA abilityWant = " + JSON.stringify( globalThis.abilityWant)); + globalThis.abilityWant2 = want; + console.log("AbilityMultiInstanceAppA abilityWant = " + JSON.stringify( globalThis.abilityWant2)); } onDestroy() { @@ -50,7 +50,7 @@ export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { // Main window is created, set main page for this ability console.log("MainAbility2 onWindowStageCreate") - globalThis.abilityContext = this.context + globalThis.abilityContext2 = this.context windowStage.setUIContent(this.context, "MainAbility/pages/second/second", null) } diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts index 025b140b8c7979a68f2cedceec293ce6683fe0f2..8b29a6c2db891cca32cee4c3d736d081586950af 100644 --- a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -38,7 +38,7 @@ export default class ServiceAbility extends ServiceExtension { abilityName: 'com.example.startabilityforresult.MainAbility2' }, { - windowMode: 2, + windowMode: 0, displayId: 10, }).then(() => { console.log("====>end startAbility====>success!") diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/test/Ability.test.ets index 6b0bb23c9d513aff487f19f028cfea3681f47cc8..dcdfe4b665ce0596f6c487d33828c64d1640029a 100644 --- a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/ets/test/Ability.test.ets @@ -225,7 +225,7 @@ export default function abilityTest() { if (data.event == "ACTS_TerminateSelf_CommonEvent") { clearTimeout(id); expect(data.parameters['displayId']).assertEqual(10); - expect(data.parameters['windowMode']).assertEqual(2); + expect(data.parameters['windowMode']).assertEqual(0); commonEvent.unsubscribe(subscriber, unSubscribeCallback) expect(data.event).assertEqual("ACTS_TerminateSelf_CommonEvent"); diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/module.json b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/module.json index e03188518a858b3cda3905fd65cc2bc754384a4f..3d001509c85b17818a56915a49c688690ee4c31d 100644 --- a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/module.json +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilityforresulttest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -92,6 +93,14 @@ { "name": "ohos.permission.GET_RUNNING_INFO", "reason": "need use ohos.permission.GET_RUNNING_INFO" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" } ] } diff --git a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/module.json b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/module.json index ccdf974f472223c915e5236d94b4ddffa488bb04..74bec329ee1b7e0fe6d3462197056b2cbc60ffe0 100644 --- a/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/module.json +++ b/ability/ability_runtime/amsdisplayIdtest/actsamsstartabilitytest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -73,6 +74,14 @@ { "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES", "reason": "need use ohos.permission.GET_RUNNING_INFO" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" } ] } diff --git a/ability/ability_runtime/amsgetabilityprocessinfo/BUILD.gn b/ability/ability_runtime/amsgetabilityprocessinfo/BUILD.gn index 3a95dd1cfc419dd28663f3f32599617cc7eff46e..109ef2f9055e8e5830664e199167496293581f49 100644 --- a/ability/ability_runtime/amsgetabilityprocessinfo/BUILD.gn +++ b/ability/ability_runtime/amsgetabilityprocessinfo/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/BUILD.gn b/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/BUILD.gn index ed78cabf6ea490b5dd198aeece0623e03a947cc0..d814b04db06b6affae125963c16a2796a98e152e 100644 --- a/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/BUILD.gn +++ b/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/src/main/config.json b/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/src/main/config.json index ead649de33874627ae88674db6eb0f6f5eef11bf..3c1ef301afbc0ab5b790a861d83edf8801ebdee4 100644 --- a/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/src/main/config.json +++ b/ability/ability_runtime/amsgetabilityprocessinfo/actsgetabilityprocessinfotest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.abilityrunninginfostest", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { @@ -137,4 +138,4 @@ "mainAbility": ".MainAbility", "srcPath": "" } -} \ No newline at end of file +} diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/CreateFormAbility/CreateFormAbility.ts b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/CreateFormAbility/CreateFormAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..481070a0daa9da861c7451a088c1e43afe74414a --- /dev/null +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/CreateFormAbility/CreateFormAbility.ts @@ -0,0 +1,50 @@ +/* + * 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 Ability from '@ohos.application.Ability' +export default class CreateFormAbility extends Ability { + + onCreate(want, launchParam) { + console.log("[Demo] CreateFormAbility onCreate") + globalThis.abilityWant = want; + globalThis.applicationContext = this.context.getApplicationContext(); + globalThis.isCreateForm = want.parameters["createForm"]; + } + + onDestroy() { + console.log("[Demo] CreateFormAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] CreateFormAbility onWindowStageCreate") + globalThis.abilityContext = this.context; + windowStage.setUIContent(this.context, "CreateFormAbility/pages/MainAbility_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] CreateFormAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] CreateFormAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] SecondAbility onBackground") + } +}; diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/CreateFormAbility/pages/MainAbility_pages.ets b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/CreateFormAbility/pages/MainAbility_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..56d5f67e613ad670d5eaf335e5304b0bdbed6f35 --- /dev/null +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/CreateFormAbility/pages/MainAbility_pages.ets @@ -0,0 +1,66 @@ +// @ts-nocheck +/* + * 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 router from '@ohos.router'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../../test/List.test' + +@Entry +@Component +struct Index { + @State message: string = 'CreateFormAbility' + @State isShowing: boolean = true; + + @State formId: number = 0; + @State bundle: string = "com.example.apicoverhaptest"; + @State ability: string = "FormAbility"; + @State moduleName: string = "phone"; + @State name: string = "form1"; + private dimension: FormDimension = FormDimension.Dimension_2_2; + private temporary = false; + + aboutToAppear() { + this.isShowing = globalThis.isCreateForm + } + + build() { + Row() { + Column() { + if (this.isShowing) { + FormComponent({ + id: this.formId, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: this.temporary, + }) + .allowUpdate(this.allowUpate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.log("[FormComponent.host] get form, form id:" + form.id); + }) + } + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/FormAbility/FormAbility.ts b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/FormAbility/FormAbility.ts index 7c6ef8300e32e9aa59af887de858e1882850ed0b..e07c8d2677a609954848949db2d116b99e7ffbe9 100644 --- a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/FormAbility/FormAbility.ts +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/FormAbility/FormAbility.ts @@ -16,13 +16,27 @@ import FormExtension from '@ohos.application.FormExtension'; import formBindingData from '@ohos.application.formBindingData'; import formInfo from '@ohos.application.formInfo'; +import commonEvent from '@ohos.commonEvent'; -var extensionInfo_config_direction export default class FormAbility extends FormExtension { onCreate(want) { // Called to return a FormBindingData object. - let formData = {}; console.info("FormAbility onCreate") + let formData = { + temperature: "11°", + time: "11:00", + area: "Shenyang" + }; + console.info("FormAbility onCreate===StarAbility=== ") + this.context.startAbility({ + bundleName:"com.example.apicoverhaptest", + abilityName:"SecondAbility" + }).then((data)=>{ + console.info("FormAbility startAbility success") + }).catch((err)=>{ + console.info("FormAbility startAbility failed " + err.code) + }) + console.info("FormAbility onCreate===end=== ") return formBindingData.createFormBindingData(formData); } @@ -49,6 +63,7 @@ export default class FormAbility extends FormExtension { onAcquireFormState(want) { // Called to return a {@link FormState} object. + console.info("FormAbility want success" + JSON.stringify(want.parameters)) return formInfo.FormState.READY; } }; \ No newline at end of file diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/FormHostAbility/FormHostAbility.ts b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/FormHostAbility/FormHostAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..b87146f0022cc25140be23f512b2d30bd407cb49 --- /dev/null +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/FormHostAbility/FormHostAbility.ts @@ -0,0 +1,50 @@ +/* + * 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 Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + + onCreate(want, launchParam) { + console.log("[Demo] FormHostAbility onCreate") + globalThis.abilityWant = want; + globalThis.applicationContext = this.context.getApplicationContext(); + } + + onDestroy() { + console.log("[Demo] FormHostAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] FormHostAbility onWindowStageCreate") + globalThis.abilityContext = this.context; + windowStage.setUIContent(this.context, "FormHostAbility/pages/MainAbility_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] FormHostAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] FormHostAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] FormHostAbility onBackground") + } +}; diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/FormHostAbility/pages/MainAbility_pages.ets b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/FormHostAbility/pages/MainAbility_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..6d8586760af62b7b8de76f1d383acb97d319ae42 --- /dev/null +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/FormHostAbility/pages/MainAbility_pages.ets @@ -0,0 +1,62 @@ +// @ts-nocheck +/* + * 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 router from '@ohos.router'; + +@Entry +@Component +struct Index { + @State message: string = 'FormHostAbility' + @State isShowing: boolean = true; + + @State formId: number = 0; + @State bundle: string = "com.example.apicoverhaptest"; + @State ability: string = "FormAbility"; + @State moduleName: string = "phone"; + @State name: string = "widget"; + private dimension: FormDimension = FormDimension.Dimension_2_1; + private temporary = false; + + build() { + Row() { + Column() { + FormComponent({ + id: this.formId, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: this.temporary, + }) + .allowUpdate(this.allowUpate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onAcquired((form) => { + console.log("[FormComponent.FormHostAbility] get form, form id:" + form.id); + globalThis.formId21 = form.id + }) + .onError((error) => { + console.log("[FormComponent.FormHostAbility] error code:" + error.errcode); + console.log("[FormComponent.FormHostAbility] error msg:" + error.msg); + }) + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/SecondAbility/SecondAbility.ts b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/SecondAbility/SecondAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..5a2b21198a7510b760d93a98d453e998258aa43c --- /dev/null +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/SecondAbility/SecondAbility.ts @@ -0,0 +1,58 @@ +/* + * 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 Ability from '@ohos.application.Ability' +import commonEvent from '@ohos.commonEvent'; +export default class SecondAbility extends Ability { + + onCreate(want, launchParam) { + console.log("[Demo] SecondAbility onCreate") + globalThis.abilityWant = want; + globalThis.applicationContext = this.context.getApplicationContext(); + } + + onDestroy() { + console.log("[Demo] SecondAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] SecondAbility onWindowStageCreate") + globalThis.abilityContext = this.context; + windowStage.setUIContent(this.context, "SecondAbility/pages/MainAbility_pages", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] SecondAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] SecondAbility onForeground") + var CommonEventPublishData = { + parameters: { + "Life": "onForeground" + } + } + commonEvent.publish("Form_StartAbility", CommonEventPublishData, (err) => { + console.info("Form_StartAbility onCreate"); + }); + } + + onBackground() { + // Ability has back to background + console.log("[Demo] SecondAbility onBackground") + } +}; diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/SecondAbility/pages/MainAbility_pages.ets b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/SecondAbility/pages/MainAbility_pages.ets new file mode 100644 index 0000000000000000000000000000000000000000..351e255f16e266ff4d6e6252b1541f1f06aaaf52 --- /dev/null +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/SecondAbility/pages/MainAbility_pages.ets @@ -0,0 +1,37 @@ +// @ts-nocheck +/* + * 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 router from '@ohos.router'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../../test/List.test' + +@Entry +@Component +struct Index { + @State message: string = 'MainAbility' + @State create: string = 'MainAbility' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..21e5a3e438d15227342a49dcb2778470a2f518ee --- /dev/null +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -0,0 +1,64 @@ +/* + * 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 ServiceExtension from '@ohos.application.ServiceExtensionAbility' +import commonEvent from "@ohos.commonEvent"; +import Want from '@ohos.application.Want'; +import rpc from '@ohos.rpc'; +export default class ServiceAbility extends ServiceExtension { + onCreate(want:Want) { + globalThis.abilityWant = want; + globalThis.serviceContext = this.context + let direction = this.context.config.direction + let pointerDervice = this.context.config.hasPointerDevice + let AbilityInfo = this.context.extensionAbilityInfo.bundleName + console.log('ServiceAbility onCreate, want: ' + want.abilityName); + var CommonEventPublishData = { + parameters: { + "config": direction, + "poniterDevices": pointerDervice, + "AbilityInfo":AbilityInfo + } + } + commonEvent.publish("ExtensionConext_StartAbility", CommonEventPublishData, (err) => { + console.info("ExtensionConext_StartAbility onCreate"); + }); + } + + onRequest(want, startId) { + console.log('ServiceAbility onRequest, want: ' + want.abilityName + ', startId: ' + startId); + console.log('ServiceAbility registerApplicationStateObserver begin'); + setTimeout(()=>{ + this.context.terminateSelf().then((data) => { + console.info("terminateSelf data = " + JSON.stringify(data)); + }).catch((err) => { + console.info("terminateSelf err = " + JSON.stringify(err)); + }); + }, 3000) + } + + onConnect(want) { + console.log('ServiceAbility onConnect, want:' + want.abilityName); + return null; + } + + onDisconnect(want) { + console.log('ServiceAbility onDisconnect, want:' + want.abilityName); + } + + onDestroy() { + console.log('ServiceAbility onDestroy'); + } +} \ No newline at end of file diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets index 7d18d34f735b4bf48847b4f75a7b563366aea7e9..df792a6398148298604cefced127f968584418a7 100644 --- a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets @@ -17,6 +17,14 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from import formProvider from '@ohos.application.formProvider'; import FormInfo from '@ohos.application.formInfo'; import formError from '@ohos.application.formError'; +import formHost from '@ohos.application.formHost'; +import errorManager from '@ohos.application.errorManager'; +import abilityConstant from '@ohos.application.AbilityConstant' +import appManager from '@ohos.application.appManager' +import applicationContext from '@ohos.application.context' +import commonEvent from '@ohos.commonEvent'; +import ability from '@ohos.ability.ability' +FormDimension var EXTENSION_INFO_ERR = 2097152 var USERID_ERR = 2097177 var trueInfo; @@ -24,8 +32,14 @@ var array = new Array(); function sleep(time) { return new Promise((resolve)=>setTimeout(resolve,time)); } + export default function ApiCoverTest() { describe('ApiCoverTestTest', function () { + afterEach(async (done) => { + setTimeout(function () { + done(); + }, 2500); + }) /* * @tc.number SUB_AA_ABILITY_Extension_API_001 @@ -227,19 +241,21 @@ export default function ApiCoverTest() { expect("/data/storage/el1/bundle").assertEqual(globalThis.abilityContext.bundleCodeDir) expect("/data/storage/el2/distributedfiles").assertEqual(globalThis.abilityContext.distributedFilesDir) expect(1).assertEqual(globalThis.abilityContext.area) - let moduleContext = globalThis.abilityContext.createModuleContext("module1") + let moduleContext = globalThis.abilityContext.createModuleContext("module1") expect("/data/storage/el2/base/cache").assertEqual(moduleContext.cacheDir) - globalThis.abilityContext.resourceManager.getConfiguration((err, data) => { - if(err == undefined){ + globalThis.abilityContext.area = 0 + expect(0).assertEqual(globalThis.abilityContext.area) + globalThis.abilityContext.resourceManager.getConfiguration((err, data) => { + if(err == undefined){ console.log(`Ability: getConfiguration success: ${JSON.stringify(data)}`); - console.log(`Ability: getConfiguration success: JSON.stringify(data.direction)`); + console.log(`Ability: getConfiguration success: JSON.stringify(data.direction)`); expect(0).assertEqual(data.direction) done() - }else{ - expect().assertFail() + }else{ + expect().assertFail() done() - } - }) + } + }) }) /* @@ -312,15 +328,335 @@ export default function ApiCoverTest() { expect("ohos.extra.param.key.form_dimension").assertEqual(FormInfo.FormParam.DIMENSION_KEY) expect("ohos.extra.param.key.form_height").assertEqual(FormInfo.FormParam.HEIGHT_KEY) expect("ohos.extra.param.key.module_name").assertEqual(FormInfo.FormParam.MODULE_NAME_KEY) + expect("ohos.extra.param.key.form_width").assertEqual(FormInfo.FormParam.WIDTH_KEY) expect("ohos.extra.param.key.form_name").assertEqual(FormInfo.FormParam.NAME_KEY) expect("ohos.extra.param.key.form_temporary").assertEqual(FormInfo.FormParam.TEMPORARY_KEY) - expect("ohos.extra.param.key.form_width").assertEqual(FormInfo.FormParam.WIDTH_KEY) + expect("ohos.extra.param.key.form_identity").assertEqual(FormInfo.FormParam.IDENTITY_KEY) + expect("ohos.extra.param.key.bundle_name").assertEqual(FormInfo.FormParam.BUNDLE_NAME_KEY) + expect("ohos.extra.param.key.ability_name").assertEqual(FormInfo.FormParam.ABILITY_NAME_KEY) expect(0).assertEqual(FormInfo.FormState.DEFAULT) expect(1).assertEqual(FormInfo.FormState.READY) expect(-1).assertEqual(FormInfo.FormState.UNKNOWN) expect(0).assertEqual(FormInfo.ColorMode.MODE_DARK) expect(1).assertEqual(FormInfo.ColorMode.MODE_LIGHT) + console.info("SUB_AA_Form_provider_TestFormInfo_0100:" + FormInfo.FormDimension.Dimension_2_1); + expect(1).assertEqual(FormInfo.FormDimension.Dimension_1_2) + expect(2).assertEqual(FormInfo.FormDimension.Dimension_2_2) + expect(3).assertEqual(FormInfo.FormDimension.Dimension_2_4) + expect(4).assertEqual(FormInfo.FormDimension.Dimension_4_4) + expect(5).assertEqual(FormInfo.FormDimension.Dimension_2_1) done(); }); + + /* + * @tc.number SUB_AA_ReisterErrorObserver_0100 + * @tc.name Test ReisterErrorObserver. + * @tc.desc Function test + * @tc.level 3 + */ + it('SUB_AA_ReisterErrorObserver_0100', 0, async function (done) { + let errorObserver:errorManager.ErrorObserver; + errorObserver = { + onUnhandledException:(errMessage) => { + console.info("SUB_AA_ReisterErrorObserver_0100" + JSON.stringify(errMessage)); + } + } + let errCodeId = errorManager.registerErrorObserver(errorObserver) + expect(errCodeId).assertEqual(0) + errorManager.unregisterErrorObserver(errCodeId).then((data)=>{ + expect(data).assertEqual(undefined) + done(); + }).catch((err)=>{ + expect().assertFail() + done(); + }) + }); + + /* + * @tc.number SUB_AA_ReisterErrorObserver_0200 + * @tc.name Test unregisterErrorObserver with error number. + * @tc.desc Function test + * @tc.level 3 + */ + it('SUB_AA_ReisterErrorObserver_0200', 0, async function (done) { + errorManager.unregisterErrorObserver(-1, (err, data)=>{ + console.info("SUB_AA_ReisterErrorObserver_0200:" + JSON.stringify(err) + " " + JSON.stringify(data)); + console.info("SUB_AA_ReisterErrorObserver_0200:" + typeof(err.code)); + if(err.code != 0){ + expect(err.code).assertEqual(-2) + done() + }else{ + expect().assertFail() + done(); + } + }) + }); + + /* + * @tc.number SUB_AA_Test_AbilityConstant_0100 + * @tc.name Test abilityConstant. + * @tc.desc Function test + * @tc.level 3 + */ + it('SUB_AA_Test_AbilityConstant_0100', 0, async function (done) { + expect(1).assertEqual(abilityConstant.LaunchReason.START_ABILITY) + expect(1).assertEqual(abilityConstant.LastExitReason.ABILITY_NOT_RESPONDING) + expect(2).assertEqual(abilityConstant.LastExitReason.NORMAL) + expect(0).assertEqual(abilityConstant.MemoryLevel.MEMORY_LEVEL_MODERATE) + expect(1).assertEqual(abilityConstant.MemoryLevel.MEMORY_LEVEL_LOW) + expect(2).assertEqual(abilityConstant.MemoryLevel.MEMORY_LEVEL_CRITICAL) + done() + }); + + /* + * @tc.number SUB_AA_Test_ProcessRunningInformation_0100 + * @tc.name Test getProcessRunningInformation in appManager. + * @tc.desc Function test + * @tc.level 3 + */ + it('SUB_AA_Test_ProcessRunningInformation_0100', 0, async function (done) { + let processRunningInformation:appManager.ProcessRunningInformation; + let process; + appManager.getProcessRunningInformation().then((processRunningInformations)=>{ + console.info("SUB_AA_Test_ProcessRunningInformation_0100:" + JSON.stringify(processRunningInformations)); + for(let i = 0; i < processRunningInformations.length; i++){ + console.info("SUB_AA_Test_ProcessRunningInformation_0100:" + JSON.stringify(processRunningInformations[i])); + expect(processRunningInformations[i].pid).assertLarger(0) + expect(processRunningInformations[i].uid).assertLarger(0) + if(processRunningInformations[i].processName == "com.example.apicoverhaptest"){ + process = processRunningInformations[i] + } + } + expect(process.bundleNames[0]).assertEqual("com.example.apicoverhaptest") + done() + }).catch((error)=>{ + console.info("SUB_AA_Test_ProcessRunningInformation_0100:" + JSON.stringify(error)); + expect().assertFail() + done() + }) + }); + + /* + * @tc.number SUB_AA_Test_ProcessRunningInformation_0200 + * @tc.name Test getProcessRunningInformation by callback in appManager. + * @tc.desc Function test + * @tc.level 3 + */ + it('SUB_AA_Test_ProcessRunningInformation_0200', 0, async function (done) { + let process; + appManager.getProcessRunningInformation((error, processRunningInformations)=>{ + if(error.code == 0){ + console.info("SUB_AA_Test_ProcessRunningInformation_0100:" + JSON.stringify(processRunningInformations)); + for(let i = 0; i < processRunningInformations.length; i++){ + console.info("SUB_AA_Test_ProcessRunningInformation_0100:" + JSON.stringify(processRunningInformations[i])); + expect(processRunningInformations[i].pid).assertLarger(0) + expect(processRunningInformations[i].uid).assertLarger(0) + if(processRunningInformations[i].processName == "com.example.apicoverhaptest"){ + process = processRunningInformations[i] + } + } + expect(process.bundleNames[0]).assertEqual("com.example.apicoverhaptest") + done() + }else{ + console.info("SUB_AA_Test_ProcessRunningInformation_0100:" + JSON.stringify(error)); + expect().assertFail() + done() + } + }) + }); + + /* + * @tc.number SUB_AA_FMS_AbilityStage_0100 + * @tc.name Start AbilityStage and get config. + * @tc.desc Function test + * @tc.level 3 + */ + it('SUB_AA_FMS_AbilityStage_0100', 0, async function (done) { + console.info("SUB_AA_FMS_AbilityStage_0100===AbilityStage===" + JSON.stringify(globalThis.stageContext)) + console.info("SUB_AA_FMS_AbilityStage_0100===AbilityStage===" + JSON.stringify(globalThis.stageContext.config)) + let directions = globalThis.stageContext.config.direction + let subscriber = null + let subscribeInfo = { + events: ["AbilityStage_StartAbility"] + } + function UnSubscribeInfoCallback(err, data) { + console.info("SUB_AA_FMS_AbilityStage_0100===UnSubscribeInfoCallback===") + done() + } + async function SubscribeInfoCallback(err, data) { + console.info("SUB_AA_FMS_AbilityStage_0100===SubscribeInfoCallback===" + JSON.stringify(data)) + expect(data.parameters["config"]).assertEqual(-1) + expect(data.parameters["config"]).assertEqual(directions) + commonEvent.unsubscribe(subscriber, UnSubscribeInfoCallback) + await sleep(4000) + done() + } + commonEvent.createSubscriber(subscribeInfo, (err, data) => { + console.info("SUB_AA_FMS_AbilityStage_0100===CreateSubscriberCallback===") + subscriber = data + commonEvent.subscribe(subscriber, SubscribeInfoCallback) + }) + let formWant ={ + deviceId:"", + bundleName:"ohos.acts.aafwk.test.stagesupplement", + abilityName:"MainAbility3", + } + globalThis.abilityContext.startAbility(formWant, (err, data)=>{ + if(err.code == 0){ + console.info("SUB_AA_FMS_AbilityStage_0100===CreateSubscriberCallback===") + }else{ + console.info("SUB_AA_FMS_AbilityStage_0100===failed===") + expect().assertFail() + done() + } + }) + }) + + /* + * @tc.number SUB_AA_FMS_AbilityStage_0200 + * @tc.name Start Service and get config. + * @tc.desc Function test + * @tc.level 3 + */ + it('SUB_AA_FMS_AbilityStage_0200', 0, async function (done) { + let subscriber = null + let subscribeInfo = { + events: ["ExtensionConext_StartAbility"] + } + function UnSubscribeInfoCallback(err, data) { + console.info("SUB_AA_FMS_AbilityStage_0200===UnSubscribeInfoCallback===") + } + async function SubscribeInfoCallback(err, data) { + console.info("SUB_AA_FMS_AbilityStage_0200===SubscribeInfoCallback===" + JSON.stringify(data)) + console.info("SUB_AA_FMS_AbilityStage_0200===serviceContext===" + JSON.stringify(globalThis.serviceContext)) + console.info("SUB_AA_FMS_AbilityStage_0200===config===" + JSON.stringify(globalThis.serviceContext.config)) + expect(data.parameters["config"]).assertLess(2) + expect(data.parameters["poniterDevices"]).assertFalse() + expect(data.parameters["AbilityInfo"]).assertEqual("com.example.apicoverhaptest") + let direction = globalThis.serviceContext.config.direction + let pointerDervice = globalThis.serviceContext.config.hasPointerDevice + let AbilityInfo = globalThis.serviceContext.extensionAbilityInfo.bundleName + expect(direction).assertLess(2) + expect(pointerDervice).assertFalse() + expect(AbilityInfo).assertEqual("com.example.apicoverhaptest") + commonEvent.unsubscribe(subscriber, UnSubscribeInfoCallback) + await sleep(4000) + done() + } + commonEvent.createSubscriber(subscribeInfo, (err, data) => { + console.info("SUB_AA_FMS_AbilityStage_0200===CreateSubscriberCallback===") + subscriber = data + commonEvent.subscribe(subscriber, SubscribeInfoCallback) + }) + let formWant ={ + deviceId:"", + bundleName:"com.example.apicoverhaptest", + abilityName:"ServiceAbility", + } + globalThis.abilityContext.startAbility(formWant, (err, data)=>{ + if(err.code == 0){ + console.info("SUB_AA_FMS_AbilityStage_0200===abilityContext startAbility success===") + }else{ + expect().assertFail() + done() + } + }) + }) + + /* + * @tc.number SUB_AA_FMS_AcquireForm_0100 + * @tc.name Test startAbility in FormExtensionContext. + * @tc.desc Function test + * @tc.level 3 + */ + it('SUB_AA_FMS_AcquireForm_0100', 0, async function (done) { + let subscriber = null + let formExtensionContext:applicationContext.FormExtensionContext + let pacMap:ability.PacMap + let subscribeInfo = { + events: ["Form_StartAbility"] + } + function UnSubscribeInfoCallback(err, data) { + console.info("SUB_AA_FMS_AcquireForm_0100 ===UnSubscribeInfoCallback===") + } + function SubscribeInfoCallback(err, data) { + console.info("SUB_AA_FMS_AcquireForm_0100 ===SubscribeInfoCallback===" + JSON.stringify(data)) + expect(data.parameters["Life"]).assertEqual("onForeground") + commonEvent.unsubscribe(subscriber, UnSubscribeInfoCallback) + done() + } + commonEvent.createSubscriber(subscribeInfo, (err, data) => { + console.info("SUB_AA_FMS_AcquireForm_0100 ===CreateSubscriberCallback===") + subscriber = data + commonEvent.subscribe(subscriber, SubscribeInfoCallback) + }) + let formWant ={ + deviceId:"", + bundleName:"com.example.apicoverhaptest", + abilityName:"CreateFormAbility", + parameters:{ + "createForm": true + } + } + globalThis.abilityContext.startAbility(formWant, (err, data)=>{ + if(err.code == 0){ + console.info("SUB_AA_FMS_AcquireForm_0100 ===acquireFormState=== " + JSON.stringify(data)) + }else{ + expect().assertFail() + done() + } + }) + }) + + /* + * @tc.number SUB_AA_FormDisplaySpecifications_0100 + * @tc.name Create a form and delete. + * @tc.desc Function test + * @tc.level 3 + */ + it('SUB_AA_FormDisplaySpecifications_0100', 0, async function (done) { + let formWant ={ + deviceId:"", + bundleName:"com.example.apicoverhaptest", + abilityName:"FormHostAbility", + } + globalThis.abilityContext.startAbility(formWant, (err, data)=>{ + if(err.code == 0){ + console.info("SUB_AA_FormDisplaySpecifications_0100===abilityContext startAbility success===") + }else{ + expect().assertFail() + done() + } + }) + await sleep(2000) + console.info("SUB_AA_FormDisplaySpecifications_0100===globalThis.formId21 success===" + globalThis.formId21) + expect(globalThis.formId21 != undefined).assertTrue() + formHost.deleteForm(globalThis.formId21).then((data)=>{ + console.info("SUB_AA_FormDisplaySpecifications_0100===deleteForm success===") + done() + }).catch((err)=>{ + console.info("SUB_AA_FormDisplaySpecifications_0100===deleteForm failed===") + expect().assertFail() + done() + }) + }) + + /* + * @tc.number SUB_AA_FormDisplaySpecifications_0200 + * @tc.name get the form info. + * @tc.desc Function test + * @tc.level 3 + */ + it('SUB_AA_FormDisplaySpecifications_0200', 0, async function (done) { + await formHost.getFormsInfo("com.example.apicoverhaptest", "phone").then((data)=>{ + console.info("SUB_AA_FormDisplaySpecifications_0200===deleteForm success===" + JSON.stringify(data)) + expect(5).assertEqual(data[0].defaultDimension) + done() + }).catch((err)=>{ + console.info("SUB_AA_FormDisplaySpecifications_0200===deleteForm failed===" + JSON.stringify(err)) + expect().assertFail() + done() + }) + }) }) -} \ No newline at end of file +} diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ContextEnvironmentTest.test.ets b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ContextEnvironmentTest.test.ets index 66112e138880c05906d4733024887320ade74377..fb64c64e7e3b53e93cf76ee93c39e49563f8e85c 100644 --- a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ContextEnvironmentTest.test.ets +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ContextEnvironmentTest.test.ets @@ -67,7 +67,7 @@ export default function ContextEnvironmentTest(applicationContext) { var code = undefined console.info(TAG + "callbackId = " + callbackId + " callNum = " + callNum) - await sleep(1000) + await sleep(700) // unregisterEnvironmentCallback applicationContext.unregisterEnvironmentCallback(callbackId, (error, data) => { console.info(TAG + "unregisterEnvironmentCallback first err is : " + JSON.stringify(error) + ", data is : " + JSON.stringify(data)) @@ -75,7 +75,7 @@ export default function ContextEnvironmentTest(applicationContext) { }) - await sleep(1000) + await sleep(700) expect(callbackId).assertEqual(callNum) expect(code).assertEqual(0) callNum++; diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/List.test.ets index 23781d4adba7617a15f63682a4d9bfffab4ef4a7..38a460a83beb6ff912abe6f8f49b7477fdb1f3db 100644 --- a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/List.test.ets +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/List.test.ets @@ -24,4 +24,4 @@ export default function List() { verificationTest() wantAgentCover() contextEnvironmentTest(globalThis.applicationContext) -} \ No newline at end of file +} diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/module.json b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/module.json index 0fa974e61afec84e6edbecafe79e606dcafff7dd..98ba6b8eb10b4ea9727b5f3c149020a5ac00c19e 100644 --- a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/module.json +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -33,6 +34,39 @@ ] } ] + }, + { + "name": "SecondAbility", + "srcEntrance": "./ets/SecondAbility/SecondAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:white", + "visible": true, + "launchType": "singleton" + }, + { + "name": "CreateFormAbility", + "srcEntrance": "./ets/CreateFormAbility/CreateFormAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:white", + "visible": true, + "launchType": "singleton" + }, + { + "name": "FormHostAbility", + "srcEntrance": "./ets/FormHostAbility/FormHostAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:white", + "visible": true, + "launchType": "singleton" } ], "extensionAbilities": [ @@ -48,7 +82,32 @@ "resource": "$profile:form_config" } ] + }, + { + "name": "ServiceAbility", + "srcEntrance": "./ets/ServiceAbility/ServiceAbility.ts", + "label": "$string:MainAbility_label", + "description": "$string:MainAbility_desc", + "type": "service", + "visible": true + } + ], + "requestPermissions":[ + { + "name":"ohos.permission.GET_RUNNING_INFO" + }, + { + "name":"ohos.permission.REQUIRE_FORM" + }, + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY" } ] } - } \ No newline at end of file + } diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/resources/base/profile/form_config.json b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/resources/base/profile/form_config.json index 146fbe1c6da88e46886838ba746afb29e69cc190..e2b5e0aaabb7f175f1f32532dd50a31bfc9ec2a4 100644 --- a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/resources/base/profile/form_config.json +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/resources/base/profile/form_config.json @@ -4,7 +4,7 @@ "isDefault": true, "src": "./js/widget/pages/index/index", "scheduledUpdateTime": "10:30", - "defaultDimension": "2*2", + "defaultDimension": "2*1", "name": "widget", "description": "This is a service widget.", "colorMode": "auto", @@ -13,6 +13,25 @@ "autoDesignWidth": true }, "formConfigAbility": "ability://xxxxx", + "supportDimensions": [ + "2*1" + ], + "updateEnabled": true, + "updateDuration": 1 + }, + { + "isDefault": false, + "src": "./js/widget/pages/index/index", + "scheduledUpdateTime": "10:30", + "defaultDimension": "2*2", + "name": "form1", + "description": "This is a service widget.", + "colorMode": "auto", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "formConfigAbility": "ability://xxxxx", "supportDimensions": [ "2*2" ], diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/resources/base/profile/main_pages.json index 81691245bb98976d7d8966dd406a9abd5140ef39..c8f90d45cd159400c5f4f8088715066225b9b91f 100644 --- a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/resources/base/profile/main_pages.json +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/resources/base/profile/main_pages.json @@ -1,5 +1,8 @@ { "src": [ - "MainAbility/pages/MainAbility_pages" + "MainAbility/pages/MainAbility_pages", + "SecondAbility/pages/MainAbility_pages", + "CreateFormAbility/pages/MainAbility_pages", + "FormHostAbility/pages/MainAbility_pages" ] } \ No newline at end of file diff --git a/ability/ability_runtime/apicover/apicoverhaptest/signature/openharmony_sx.p7b b/ability/ability_runtime/apicover/apicoverhaptest/signature/openharmony_sx.p7b index 66b4457a8a81fb8d3356cf46d67226c850944858..6c7c8e29e3c4a1f8d0419932ebc28f665e4ae974 100644 Binary files a/ability/ability_runtime/apicover/apicoverhaptest/signature/openharmony_sx.p7b and b/ability/ability_runtime/apicover/apicoverhaptest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/apicover/fasupplement/entry/src/main/config.json b/ability/ability_runtime/apicover/fasupplement/entry/src/main/config.json index f6a8619c1fb69e60eead2ac7cb113628a8a2dbb2..33a1c2ad616740876b7974505655df1f993e8106 100644 --- a/ability/ability_runtime/apicover/fasupplement/entry/src/main/config.json +++ b/ability/ability_runtime/apicover/fasupplement/entry/src/main/config.json @@ -15,6 +15,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "abilities": [ diff --git a/ability/ability_runtime/apicover/formmodule/entry/src/main/ets/FormAbility/FormAbility.ts b/ability/ability_runtime/apicover/formmodule/entry/src/main/ets/FormAbility/FormAbility.ts index d29f2942dbf56b979a920147b58852bb7a9e58fa..22f718baed7541652ed99894fbc0e018f152be53 100644 --- a/ability/ability_runtime/apicover/formmodule/entry/src/main/ets/FormAbility/FormAbility.ts +++ b/ability/ability_runtime/apicover/formmodule/entry/src/main/ets/FormAbility/FormAbility.ts @@ -5,7 +5,9 @@ import formInfo from '@ohos.application.formInfo'; export default class FormModuleAbility extends FormExtension { onCreate(want) { // Called to return a FormBindingData object. - let formData = {}; + console.info("FormAbility onCreate") + let formData = { + }; return formBindingData.createFormBindingData(formData); } diff --git a/ability/ability_runtime/apicover/formmodule/entry/src/main/module.json b/ability/ability_runtime/apicover/formmodule/entry/src/main/module.json index 0f4f9038601384276a81fcb000cf54c49d2b9394..71ed0df91b00fe3610e97bccdc50a0502eceb360 100644 --- a/ability/ability_runtime/apicover/formmodule/entry/src/main/module.json +++ b/ability/ability_runtime/apicover/formmodule/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:module1_desc", "mainElement": "ModuleAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -36,7 +37,7 @@ ], "extensionAbilities": [ { - "name": "FormAbility", + "name": "FormAbility2", "srcEntrance": "./ets/FormAbility/FormAbility.ts", "label": "$string:form_FormAbility_label", "description": "$string:form_FormAbility_desc", diff --git a/ability/ability_runtime/apicover/stagesupplement/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/apicover/stagesupplement/entry/src/main/ets/Application/AbilityStage.ts index 45aaf28a4ff72e191b47bf46a421ab11a1cc4d05..d8f2468920ab67540f4c3adad5b50bb982c39bb4 100644 --- a/ability/ability_runtime/apicover/stagesupplement/entry/src/main/ets/Application/AbilityStage.ts +++ b/ability/ability_runtime/apicover/stagesupplement/entry/src/main/ets/Application/AbilityStage.ts @@ -1,7 +1,16 @@ import AbilityStage from "@ohos.application.AbilityStage" - +import commonEvent from '@ohos.commonEvent'; export default class MyAbilityStage extends AbilityStage { onCreate() { console.info("[Demo] MyAbilityStage onCreate") + let directions = this.context.config.direction + var CommonEventPublishData = { + parameters: { + "config": directions + } + } + commonEvent.publish("AbilityStage_StartAbility", CommonEventPublishData, (err) => { + console.info("AbilityStage_StartAbility onCreate"); + }); } } \ No newline at end of file diff --git a/ability/ability_runtime/apicover/stagesupplement/entry/src/main/module.json b/ability/ability_runtime/apicover/stagesupplement/entry/src/main/module.json index 08e99a06afd00a0edd7174f180304a5718f7c882..a73bebfec0cc42174e20c62d1ac6609d19f3bb17 100644 --- a/ability/ability_runtime/apicover/stagesupplement/entry/src/main/module.json +++ b/ability/ability_runtime/apicover/stagesupplement/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/apitest/entry/src/main/ets/MainAbility2/MainAbility2.ts b/ability/ability_runtime/apitest/entry/src/main/ets/MainAbility2/MainAbility2.ts index a8a08f6192e94a154c7880cf9a00de826c52da52..f182429412cd553f67162311b079a60ff71d902c 100644 --- a/ability/ability_runtime/apitest/entry/src/main/ets/MainAbility2/MainAbility2.ts +++ b/ability/ability_runtime/apitest/entry/src/main/ets/MainAbility2/MainAbility2.ts @@ -17,14 +17,14 @@ import commonEvent from '@ohos.commonEvent' function PublishCallBackOne() { console.debug("====>Publish CallBack ACTS_DoAbilityForeground_0100_Event====>"); setTimeout(()=>{ - globalThis.abilityContext.terminateSelf(); + globalThis.abilityContextMainAbility2.terminateSelf(); console.debug("====>MainAbility2 terminateSelf succese====>") - },2000) + },5000) } export default class MainAbility2 extends Ability { onCreate(want, launchParam) { console.log("[Demo] MainAbility2 onCreate") - globalThis.abilityContext = this.context + globalThis.abilityContextMainAbility2 = this.context } onDestroy() { @@ -36,6 +36,13 @@ export default class MainAbility2 extends Ability { console.log("[Demo] MainAbility2 onWindowStageCreate") windowStage.setUIContent(this.context, "pages/index", null) + windowStage.on('windowStageEvent', (data)=>{ + if(data == 2){ + setTimeout(()=>{ + commonEvent.publish("ACTS_DoAbility_Event", PublishCallBackOne); + }, 2000) + } + }) } onWindowStageDestroy() { @@ -46,7 +53,6 @@ export default class MainAbility2 extends Ability { onForeground() { // Ability has brought to foreground console.log("[Demo] MainAbility2 onForeground") - commonEvent.publish("ACTS_DoAbility_Event", PublishCallBackOne); } onBackground() { diff --git a/ability/ability_runtime/apitest/entry/src/main/ets/MainAbility3/MainAbility3.ts b/ability/ability_runtime/apitest/entry/src/main/ets/MainAbility3/MainAbility3.ts index 5860a5aa56a834c2869091efe1b12d085c09bea8..077b6fa9ef84bc8c243e47d99f2fde6eccc2657b 100644 --- a/ability/ability_runtime/apitest/entry/src/main/ets/MainAbility3/MainAbility3.ts +++ b/ability/ability_runtime/apitest/entry/src/main/ets/MainAbility3/MainAbility3.ts @@ -16,14 +16,14 @@ import Ability from '@ohos.application.Ability' import commonEvent from '@ohos.commonEvent' function PublishCallBackOne() { console.debug("====>Publish CallBack ACTS_DoAbilityForeground_0300_Event====>"); - globalThis.abilityContext.terminateSelf().then(()=>{ + globalThis.abilityContextMainAbility3.terminateSelf().then(()=>{ console.debug("====>MainAbility3 terminateSelf====>"); }); } export default class MainAbility3 extends Ability { onCreate(want, launchParam) { console.log("[Demo] MainAbility3 onCreate") - globalThis.abilityContext = this.context + globalThis.abilityContextMainAbility3 = this.context } onDestroy() { diff --git a/ability/ability_runtime/apitest/entry/src/main/ets/MainAbility5/MainAbility5.ts b/ability/ability_runtime/apitest/entry/src/main/ets/MainAbility5/MainAbility5.ts index d95cbac070cd2a39eae21723f745664627a6b8b9..e199b01c89d907714dad64910e9876b058266679 100644 --- a/ability/ability_runtime/apitest/entry/src/main/ets/MainAbility5/MainAbility5.ts +++ b/ability/ability_runtime/apitest/entry/src/main/ets/MainAbility5/MainAbility5.ts @@ -20,7 +20,7 @@ function PublishCallBackOne() { export default class MainAbility5 extends Ability { onCreate(want, launchParam) { console.log("[Demo] MainAbility5 onCreate") - globalThis.abilityContext = this.context + globalThis.abilityContextMainAility5 = this.context setTimeout(()=> { commonEvent.publish("ACTS_DoAbility_Event", PublishCallBackOne); }, 500) diff --git a/ability/ability_runtime/apitest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/apitest/entry/src/main/ets/test/Ability.test.ets index 56cbdcd7e7ba8142de8d5b1accd1fc4b8d6658b2..90f359d406d5d30ef813b41526a40ca407bfab01 100644 --- a/ability/ability_runtime/apitest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/apitest/entry/src/main/ets/test/Ability.test.ets @@ -19,7 +19,7 @@ var subscriberInfo_MainAbility = { events: ["ACTS_DoAbility_Event"] }; var mainability -const START_ABILITY_TIMEOUT = 4000; +const START_ABILITY_TIMEOUT = 10000; const START_ABILITY_TIMEOUT_TWO_THOUSAND = 2000; const START_ABILITY_TIMEOUT_THOUSAND = 1000; export default function abilityTest() { diff --git a/ability/ability_runtime/apitest/entry/src/main/module.json b/ability/ability_runtime/apitest/entry/src/main/module.json index 6bae42d73033f74fe59824f0bdec3bd6e92d8486..60910719a2b1c50de5de954bbd271351aa480476 100644 --- a/ability/ability_runtime/apitest/entry/src/main/module.json +++ b/ability/ability_runtime/apitest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -61,6 +62,12 @@ "icon": "$media:icon", "label": "$string:MainAbility5_label" } + ], + "requestPermissions": [ + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + } ] } } \ No newline at end of file diff --git a/ability/ability_runtime/context/BUILD.gn b/ability/ability_runtime/context/BUILD.gn index 5c1dee281f9c533274abe3c18d6baaa2b4789119..6c4935d9fc2bfcbbd1def7eefce08624a0fa63d9 100644 --- a/ability/ability_runtime/context/BUILD.gn +++ b/ability/ability_runtime/context/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") @@ -18,6 +18,9 @@ group("context") { if (is_standard_system) { deps = [ "actscontexttest:ActsContextTest", + "actscreatemodulecontextassist:ActsCreateModuleContextAssist", + "actscreatemodulecontextassistone:ActsCreateModuleContextAssistOne", + "actscreatemodulecontexttest:ActsCreateModuleContextTest", "scene/defpermission:DefPermission", ] } diff --git a/ability/ability_runtime/context/actscontexttest/BUILD.gn b/ability/ability_runtime/context/actscontexttest/BUILD.gn index bc20877b258d188317605657eb2bcaf015fdb560..030c902a77fc35a9f985fe362722dbe840e9d751 100644 --- a/ability/ability_runtime/context/actscontexttest/BUILD.gn +++ b/ability/ability_runtime/context/actscontexttest/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ability/ability_runtime/context/actscontexttest/src/main/config.json b/ability/ability_runtime/context/actscontexttest/src/main/config.json index 217133b3dc795dfc44a6e0647d56a4c6ee09ccb4..8fbe3749cea0210d4a57f947762c85e178b9d5af 100644 --- a/ability/ability_runtime/context/actscontexttest/src/main/config.json +++ b/ability/ability_runtime/context/actscontexttest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actscontext", "name": ".entry", "deviceType": [ + "default", "phone" ], "reqPermissions": [ diff --git a/ability/ability_runtime/context/actscontexttest/src/main/js/test/ContextJsunit.test.js b/ability/ability_runtime/context/actscontexttest/src/main/js/test/ContextJsunit.test.js index 91dc94f500d64acb7b2456558741a9147572120a..9bf9d107f548de3b5ca2e2e1a931808c3287ee8e 100644 --- a/ability/ability_runtime/context/actscontexttest/src/main/js/test/ContextJsunit.test.js +++ b/ability/ability_runtime/context/actscontexttest/src/main/js/test/ContextJsunit.test.js @@ -57,7 +57,6 @@ describe('ActsContextTest', function () { var context = featureAbility.getContext(); var info = context.getBundleName( (err, data) => { - expect(err.code).assertEqual(0); expect(data).assertEqual('com.example.actscontext'); ret = true done(); diff --git a/ability/ability_runtime/context/actscreatemodulecontextassist/AppScope/app.json b/ability/ability_runtime/context/actscreatemodulecontextassist/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..fdb2973d57fa29e7ac012eaf58685358bddb02fa --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontextassist/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.createmodulecontexttest", + "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 + } + } +} diff --git a/ability/ability_runtime/context/actscreatemodulecontextassist/AppScope/resources/base/element/string.json b/ability/ability_runtime/context/actscreatemodulecontextassist/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..7a1e60df49d818c68d318759bfab1d84ea794c50 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontextassist/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AACommandPrintSyncTest" + } + ] +} diff --git a/ability/ability_runtime/context/actscreatemodulecontextassist/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/context/actscreatemodulecontextassist/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/context/actscreatemodulecontextassist/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/context/actscreatemodulecontextassist/BUILD.gn b/ability/ability_runtime/context/actscreatemodulecontextassist/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..f03025b0897b89a17fb64ef7f5570d821e0b4849 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontextassist/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsCreateModuleContextAssist") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":createmodulecontext_js_assets", + ":createmodulecontext_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsCreateModuleContextAssist" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("createmodulecontext_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("createmodulecontext_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("createmodulecontext_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":createmodulecontext_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..5073f074333769e258d7b97d27aa750302f91fbe --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +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. +*/ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..2f1389c76e39a641715b88eb6163d50366ceb508 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + async onCreate(want, launchParam) { + globalThis.abilityContext = this.context; + console.log('MainAbility onCreate') + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'pages/index', null) + + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..83cc6acd855717c6f038570f27469d87775999ff --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/ets/pages/index.ets @@ -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. +*/ + +@Entry +@Component +struct Index { + @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/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/module.json b/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..bf04793757bacffca561c517bc3fb7cd56c8d628 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "feature", + "type": "feature", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..a3b7f1a4253e2cbc68577cdc1f00e891f82ac432 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "AACommandPrintSyncTest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontextassist/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actscreatemodulecontextassist/signature/openharmony_sx.p7b b/ability/ability_runtime/context/actscreatemodulecontextassist/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/context/actscreatemodulecontextassist/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/context/actscreatemodulecontextassistone/AppScope/app.json b/ability/ability_runtime/context/actscreatemodulecontextassistone/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..c89708540211aeb93bdccca563d594b1123c6fe8 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontextassistone/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.createmodulecontextassistone", + "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 + } + } +} diff --git a/ability/ability_runtime/context/actscreatemodulecontextassistone/AppScope/resources/base/element/string.json b/ability/ability_runtime/context/actscreatemodulecontextassistone/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..7a1e60df49d818c68d318759bfab1d84ea794c50 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontextassistone/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AACommandPrintSyncTest" + } + ] +} diff --git a/ability/ability_runtime/context/actscreatemodulecontextassistone/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/context/actscreatemodulecontextassistone/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/context/actscreatemodulecontextassistone/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/context/actscreatemodulecontextassistone/BUILD.gn b/ability/ability_runtime/context/actscreatemodulecontextassistone/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..beeb1fadb1fda63d6106ac1f1fd54587adf0dfea --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontextassistone/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("ActsCreateModuleContextAssistOne") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":createmodulecontext_js_assets", + ":createmodulecontext_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsCreateModuleContextAssistOne" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("createmodulecontext_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("createmodulecontext_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("createmodulecontext_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":createmodulecontext_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..5073f074333769e258d7b97d27aa750302f91fbe --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +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. +*/ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..2f1389c76e39a641715b88eb6163d50366ceb508 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,45 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + async onCreate(want, launchParam) { + globalThis.abilityContext = this.context; + console.log('MainAbility onCreate') + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'pages/index', null) + + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..83cc6acd855717c6f038570f27469d87775999ff --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/ets/pages/index.ets @@ -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. +*/ + +@Entry +@Component +struct Index { + @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/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/module.json b/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..4cf1d5c2386db1b13131232f1cb58e87a83ac01f --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "entry_assist", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..a3b7f1a4253e2cbc68577cdc1f00e891f82ac432 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "AACommandPrintSyncTest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontextassistone/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actscreatemodulecontextassistone/signature/openharmony_sx.p7b b/ability/ability_runtime/context/actscreatemodulecontextassistone/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/context/actscreatemodulecontextassistone/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/context/actscreatemodulecontexttest/AppScope/app.json b/ability/ability_runtime/context/actscreatemodulecontexttest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..fdb2973d57fa29e7ac012eaf58685358bddb02fa --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontexttest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.createmodulecontexttest", + "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 + } + } +} diff --git a/ability/ability_runtime/context/actscreatemodulecontexttest/AppScope/resources/base/element/string.json b/ability/ability_runtime/context/actscreatemodulecontexttest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..7a1e60df49d818c68d318759bfab1d84ea794c50 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontexttest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AACommandPrintSyncTest" + } + ] +} diff --git a/ability/ability_runtime/context/actscreatemodulecontexttest/AppScope/resources/base/media/app_icon.png b/ability/ability_runtime/context/actscreatemodulecontexttest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/context/actscreatemodulecontexttest/AppScope/resources/base/media/app_icon.png differ diff --git a/ability/ability_runtime/context/actscreatemodulecontexttest/BUILD.gn b/ability/ability_runtime/context/actscreatemodulecontexttest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..e244c407cf93e4840649bdc95132601ec6a27a28 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontexttest/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsCreateModuleContextTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":createmodulecontext_js_assets", + ":createmodulecontext_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsCreateModuleContextTest" + subsystem_name = "ability" + part_name = "ability_runtime" +} + +ohos_app_scope("createmodulecontext_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("createmodulecontext_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("createmodulecontext_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":createmodulecontext_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/ability/ability_runtime/context/actscreatemodulecontexttest/Test.json b/ability/ability_runtime/context/actscreatemodulecontexttest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..d6f74daa1268a2b46bdac93bdff79a7770882d94 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontexttest/Test.json @@ -0,0 +1,21 @@ +{ + "description": "Configuration for aceceshi Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.createmodulecontexttest", + "module-name": "entry_test", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsCreateModuleContextTest.hap", + "ActsCreateModuleContextAssist.hap", + "ActsCreateModuleContextAssistOne.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/ets/Application/AbilityStage.ts b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..2b1035b73f5f61109e5ce372b42bebd105bb68d3 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + globalThis.abilityStageContext = this.context + } +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..07eefcc2c8f98aa12043bb97840478e7f980b9c8 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2022 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default class MainAbility extends Ability { + async onCreate(want, launchParam) { + globalThis.abilityContext = this.context; + console.log('MainAbility onCreate') + let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + let abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('MainAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('MainAbility onWindowStageCreate') + windowStage.setUIContent(this.context, 'pages/index', null) + + } + + onWindowStageDestroy() { + console.log('MainAbility onWindowStageDestroy') + } + + onForeground() { + console.log('MainAbility onForeground') + } + + onBackground() { + console.log('MainAbility onBackground') + } +}; \ No newline at end of file diff --git a/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..1762cda6dd8f03996989e42dfeb364161e91c0b7 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,75 @@ +/* +* 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() + globalThis.abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.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/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/ets/pages/index.ets b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..83cc6acd855717c6f038570f27469d87775999ff --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/ets/pages/index.ets @@ -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. +*/ + +@Entry +@Component +struct Index { + @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/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/ets/test/CreateModuleContext.test.ets b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/ets/test/CreateModuleContext.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c7fdf38b3b58e230bcd111147d48b35590a6b4fa --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/ets/test/CreateModuleContext.test.ets @@ -0,0 +1,197 @@ +/* + * 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, it, expect } from "@ohos/hypium"; + +let createModuleContext: any; +let bundleName: any; + +export default function actsCreateModuleContextTest() { + describe("CreateModuleContext", function () { + /** + * @tc.number: SUB_AA_CreateModuleContext_0100 + * @tc.name: AbilityContext calls createModuleContext, passing in the moduleName of + * the current application hap1 + * @tc.desc: Verify that the context of the application can be obtained + * @tc.level: 1 + */ + it("SUB_AA_CreateModuleContext_0100", 0, async function (done) { + console.info("SUB_AA_AbilityStage_0100 begin"); + + createModuleContext = + globalThis.abilityContext.createModuleContext("entry_test"); + + bundleName = createModuleContext.applicationInfo.name; + + expect(bundleName).assertEqual("com.example.createmodulecontexttest"); + done(); + }); + + /** + * @tc.number: SUB_AA_CreateModuleContext_0200 + * @tc.name: AbilityContext calls createModuleContext, passing in the moduleName of + * the current application hap2 + * @tc.desc: Verify that the context of the application can be obtained + * @tc.level: 3 + */ + it("SUB_AA_CreateModuleContext_0200", 0, async function (done) { + console.log("SUB_AA_AbilityStage_0100 begin"); + + createModuleContext = + globalThis.abilityContext.createModuleContext("feature"); + + bundleName = createModuleContext.applicationInfo.name; + + expect(bundleName).assertEqual("com.example.createmodulecontexttest"); + done(); + }); + + /** + * @tc.number: SUB_AA_CreateModuleContext_0300 + * @tc.name: AbilityContext calls createModuleContext, passing in the moduleName of + * the cross-application hap1 + * @tc.desc: Verify that the context of the application can not be obtained + * @tc.level: 3 + */ + it("SUB_AA_CreateModuleContext_0300", 0, async function (done) { + console.info("SUB_AA_CreateModuleContext_0300 begin"); + + createModuleContext = + globalThis.abilityContext.createModuleContext("entry_assist"); + + expect(createModuleContext).assertUndefined(); + done(); + }); + + /** + * @tc.number: SUB_AA_CreateModuleContext_0400 + * @tc.name: AbilityContext calls createModuleContext, passing in a non-existing moduleName + * @tc.desc: Verify that the context of the application can not be obtained + * @tc.level: 3 + */ + it("SUB_AA_CreateModuleContext_0400", 0, async function (done) { + console.info("SUB_AA_CreateModuleContext_0400 begin"); + + createModuleContext = + globalThis.abilityContext.createModuleContext("abc"); + + expect(createModuleContext).assertUndefined(); + done(); + }); + + /** + * @tc.number: SUB_AA_CreateModuleContext_0500 + * @tc.name: AbilityContext calls createModuleContext, and the incoming moduleName is undefined + * @tc.desc: Verify that the context of the application can not be obtained + * @tc.level: 3 + */ + it("SUB_AA_CreateModuleContext_0500", 0, async function (done) { + console.info("SUB_AA_CreateModuleContext_0500 begin"); + + createModuleContext = + globalThis.abilityContext.createModuleContext(undefined); + + expect(createModuleContext).assertUndefined(); + done(); + }); + + /** + * @tc.number: SUB_AA_CreateModuleContext_0600 + * @tc.name: AbilityStageContext calls createModuleContext, passing in the moduleName of + * the current application hap1 + * @tc.desc: Verify that the context of the application can be obtained + * @tc.level: 3 + */ + it("SUB_AA_CreateModuleContext_0600", 0, async function (done) { + console.info("SUB_AA_CreateModuleContext_0600 begin"); + + createModuleContext = + globalThis.abilityStageContext.createModuleContext("entry_test"); + + bundleName = createModuleContext.applicationInfo.name; + + expect(bundleName).assertEqual("com.example.createmodulecontexttest"); + done(); + }); + + /** + * @tc.number: SUB_AA_CreateModuleContext_0700 + * @tc.name: AbilityStageContext calls createModuleContext, passing in the moduleName of + * the current application hap2 + * @tc.desc: Verify that the context of the application can be obtained + * @tc.level: 3 + */ + it("SUB_AA_CreateModuleContext_0700", 0, async function (done) { + console.info("SUB_AA_CreateModuleContext_0700 begin"); + + createModuleContext = + globalThis.abilityStageContext.createModuleContext("feature"); + + bundleName = createModuleContext.applicationInfo.name; + + expect(bundleName).assertEqual("com.example.createmodulecontexttest"); + done(); + }); + + /** + * @tc.number: SUB_AA_CreateModuleContext_0800 + * @tc.name: AbilityStageContext calls createModuleContext, passing in the moduleName of + * the cross-application hap1 + * @tc.desc: Verify that the context of the application can not be obtained + * @tc.level: 3 + */ + it("SUB_AA_CreateModuleContext_0800", 0, async function (done) { + console.info("SUB_AA_CreateModuleContext_0800 begin"); + + createModuleContext = + globalThis.abilityContext.createModuleContext("entry_assist"); + + expect(createModuleContext).assertUndefined(); + done(); + }); + + /** + * @tc.number: SUB_AA_CreateModuleContext_0900 + * @tc.name: AbilityStageContext calls createModuleContext, passing in a non-existing moduleName + * @tc.desc: Verify that the context of the application can not be obtained + * @tc.level: 3 + */ + it("SUB_AA_CreateModuleContext_0900", 0, async function (done) { + console.info("SUB_AA_CreateModuleContext_0900 begin"); + + createModuleContext = + globalThis.abilityContext.createModuleContext("createmodue"); + + expect(createModuleContext).assertUndefined(); + done(); + }); + + /** + * @tc.number: SUB_AA_CreateModuleContext_1000 + * @tc.name: AbilityStageContext calls createModuleContext, and the incoming moduleName is undefined + * @tc.desc: Verify that the context of the application can not be obtained + * @tc.level: 3 + */ + it("SUB_AA_CreateModuleContext_1000", 0, async function (done) { + console.info("SUB_AA_CreateModuleContext_1000 begin"); + + createModuleContext = + globalThis.abilityStageContext.createModuleContext(undefined); + + expect(createModuleContext).assertUndefined(); + done(); + }); + }); +} diff --git a/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/ets/test/List.test.ets b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ffe188ed88a460e4448caa363b820cddaac19c60 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* +* 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 actsCreateModuleContextTest from './CreateModuleContext.test' + +export default function testsuite() { + actsCreateModuleContextTest() +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/module.json b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..95e1457d4fe3581d6061986bb18322d9884e053d --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/module.json @@ -0,0 +1,38 @@ +{ + "module": { + "name": "entry_test", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_test_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/resources/base/element/string.json b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..a3b7f1a4253e2cbc68577cdc1f00e891f82ac432 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_test_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "label" + }, + { + "name": "app_name", + "value": "AACommandPrintSyncTest" + }, + { + "name": "description_application", + "value": "demo for test" + } + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/resources/base/media/icon.png b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/resources/base/media/icon.png differ diff --git a/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/resources/base/profile/main_pages.json b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e291133c8b3c329611da5af30c299ec10589c7c2 --- /dev/null +++ b/ability/ability_runtime/context/actscreatemodulecontexttest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} \ No newline at end of file diff --git a/ability/ability_runtime/context/actscreatemodulecontexttest/signature/openharmony_sx.p7b b/ability/ability_runtime/context/actscreatemodulecontexttest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/ability/ability_runtime/context/actscreatemodulecontexttest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/context/scene/defpermission/src/main/config.json b/ability/ability_runtime/context/scene/defpermission/src/main/config.json index ae380a7bb5683516aea308784e6e1e3e7f743bca..39b19be80835156388491ee336f13eab40facbad 100644 --- a/ability/ability_runtime/context/scene/defpermission/src/main/config.json +++ b/ability/ability_runtime/context/scene/defpermission/src/main/config.json @@ -29,6 +29,7 @@ } ], "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/fa/BUILD.gn b/ability/ability_runtime/fa/BUILD.gn index b3f1f376060514f0d63acf506fc81dabb13dc444..f75ceef5a8bad76dae0eb4baf6e2884c612ae364 100644 --- a/ability/ability_runtime/fa/BUILD.gn +++ b/ability/ability_runtime/fa/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ability/ability_runtime/fa/faapplicationinfo/BUILD.gn b/ability/ability_runtime/fa/faapplicationinfo/BUILD.gn index 739455fe5b35678a3438eb5282d56c1b44c04010..c1baca59d063f934138d39808d99cc702cae41f7 100644 --- a/ability/ability_runtime/fa/faapplicationinfo/BUILD.gn +++ b/ability/ability_runtime/fa/faapplicationinfo/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ability/ability_runtime/fa/faapplicationinfo/src/main/config.json b/ability/ability_runtime/fa/faapplicationinfo/src/main/config.json index ca9fcbc92d5e990c2e928fa02f0903b37fd0d01a..9e2475886573b77c339f00b3f05117e5219a5142 100644 --- a/ability/ability_runtime/fa/faapplicationinfo/src/main/config.json +++ b/ability/ability_runtime/fa/faapplicationinfo/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { @@ -112,6 +113,12 @@ "testRunner": { "name": "OpenHarmonyTestRunner", "srcPath": "TestRunner" - } + }, + "reqPermissions": [ + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + } + ] } } \ No newline at end of file diff --git a/ability/ability_runtime/fa/faconfigurationconstant/BUILD.gn b/ability/ability_runtime/fa/faconfigurationconstant/BUILD.gn index bc41908a05078a7cd46c4cfd78b1cb252b1c5b99..a23eabb6f211d4ff3175b6a1d558705806dd0737 100644 --- a/ability/ability_runtime/fa/faconfigurationconstant/BUILD.gn +++ b/ability/ability_runtime/fa/faconfigurationconstant/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ability/ability_runtime/fa/faconfigurationconstant/src/main/config.json b/ability/ability_runtime/fa/faconfigurationconstant/src/main/config.json index cdb4103c7fa80444e170cac2e9664a5867d9a829..8e835a50d0efd712d04722f5be2338991df70518 100644 --- a/ability/ability_runtime/fa/faconfigurationconstant/src/main/config.json +++ b/ability/ability_runtime/fa/faconfigurationconstant/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/fa/facoverapi/BUILD.gn b/ability/ability_runtime/fa/facoverapi/BUILD.gn index 14be9fb81f15f0f222ef5fe36f0de87db7901335..d7db8319fe6aed2285dd4263e51255377a2b6377 100644 --- a/ability/ability_runtime/fa/facoverapi/BUILD.gn +++ b/ability/ability_runtime/fa/facoverapi/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ability/ability_runtime/fa/facoverapi/src/main/config.json b/ability/ability_runtime/fa/facoverapi/src/main/config.json index 75024e946ddf9c48258ff2a6a34989029d6cb36e..ec09e45c5cdccae19caaa08734958dac57cc2a75 100644 --- a/ability/ability_runtime/fa/facoverapi/src/main/config.json +++ b/ability/ability_runtime/fa/facoverapi/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.coverapi", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/fa/faequeryabilitybywant/BUILD.gn b/ability/ability_runtime/fa/faequeryabilitybywant/BUILD.gn index bbbb3349132ef2f4ec96f07cab45fd5909532548..de29af9b022c59d27c51d8712122184058084902 100644 --- a/ability/ability_runtime/fa/faequeryabilitybywant/BUILD.gn +++ b/ability/ability_runtime/fa/faequeryabilitybywant/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ability/ability_runtime/fa/faequeryabilitybywant/src/main/config.json b/ability/ability_runtime/fa/faequeryabilitybywant/src/main/config.json index 76a9cc02fc16ef84e7b4113156645d902f539d3a..86d4a969a41025e84b08be14c1cf6296af9213cf 100644 --- a/ability/ability_runtime/fa/faequeryabilitybywant/src/main/config.json +++ b/ability/ability_runtime/fa/faequeryabilitybywant/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/faapicover/faapicoverhaptest/Test.json b/ability/ability_runtime/faapicover/faapicoverhaptest/Test.json index 3f38dd44604ebb86e9efc93093b255bd9faea90f..feb6433a3bd1105801c729df316ac922466f81a3 100644 --- a/ability/ability_runtime/faapicover/faapicoverhaptest/Test.json +++ b/ability/ability_runtime/faapicover/faapicoverhaptest/Test.json @@ -5,7 +5,8 @@ "test-timeout": "600000", "bundle-name": "com.example.faapicoverhaptest", "package-name": "com.example.faapicoverhaptest", - "shell-timeout": "600000" + "shell-timeout": "600000", + "testcase-timeout": 70000 }, "kits": [ { diff --git a/ability/ability_runtime/faapicover/faapicoverhaptest/entry/src/main/config.json b/ability/ability_runtime/faapicover/faapicoverhaptest/entry/src/main/config.json index 378a138d5e422f7d931eac414e418db8a4aab215..46f6b42787ae26ec132afd4f3bc27cdc04805ed2 100644 --- a/ability/ability_runtime/faapicover/faapicoverhaptest/entry/src/main/config.json +++ b/ability/ability_runtime/faapicover/faapicoverhaptest/entry/src/main/config.json @@ -15,6 +15,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "default", "tablet" ], diff --git a/ability/ability_runtime/faapicover/faapicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets b/ability/ability_runtime/faapicover/faapicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets index e3a6d8b9279a3da0c22072032e3d9d1536e2cedb..2c6af00e3fbbbdd16f00a1b32c38931fb76d967e 100644 --- a/ability/ability_runtime/faapicover/faapicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets +++ b/ability/ability_runtime/faapicover/faapicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets @@ -16,6 +16,7 @@ import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from " import FormInfo from '@ohos.application.formInfo'; import formError from '@ohos.application.formError'; +import featureAbility from '@ohos.ability.featureAbility' export default function ApiCoverTest() { describe('ApiCoverTestTest', function () { @@ -75,5 +76,40 @@ export default function ApiCoverTest() { expect(1).assertEqual(FormInfo.FormState.READY) done(); }); + /* + * @tc.number SUB_AA_OpenHarmony_CoverApiContext_0100 + * @tc.name Test getExternalCacheDir by callback. + * @tc.desc Function test + * @tc.level 0 + */ + it('SUB_AA_OpenHarmony_CoverApiContext_0100', 0, async function (done) { + console.log("------------start SUB_AA_OpenHarmony_CoverApi_0500-------------"); + let appContext = featureAbility.getContext() + appContext.getExternalCacheDir((err, data) => { + console.info('SUB_AA_OpenHarmony_CoverApiContext_0100 successful. data: ' + JSON.stringify(data)); + expect(true).assertTrue() + done() + }) + }) + + /* + * @tc.number SUB_AA_OpenHarmony_CoverApiContext_0200 + * @tc.name Test getExternalCacheDir by promise. + * @tc.desc Function test + * @tc.level 0 + */ + it('SUB_AA_OpenHarmony_CoverApiContext_0200', 0, async function (done) { + console.log("------------start SUB_AA_OpenHarmony_CoverApi_0500-------------"); + let appContext = featureAbility.getContext() + appContext.getExternalCacheDir().then((data)=>{ + console.info('SUB_AA_OpenHarmony_CoverApiContext_0200 successful. data: ' + JSON.stringify(data)); + expect(true).assertTrue() + done() + }).catch((err)=>{ + expect().assertFalse(); + done() + }) + }) + }) } \ No newline at end of file diff --git a/ability/ability_runtime/faapicover/faapicoverhaptest/entry/src/main/ets/test/VerificationTest.ets b/ability/ability_runtime/faapicover/faapicoverhaptest/entry/src/main/ets/test/VerificationTest.ets index 3250494c2423e7bab5a5c77495019b5032f8bb71..efe1453e24f9a0843279945da528366c1e877115 100644 --- a/ability/ability_runtime/faapicover/faapicoverhaptest/entry/src/main/ets/test/VerificationTest.ets +++ b/ability/ability_runtime/faapicover/faapicoverhaptest/entry/src/main/ets/test/VerificationTest.ets @@ -134,35 +134,26 @@ export default function verificationTest(){ try { let list1 = [] - let list2 = ["Fa_Auxiliary_MainAbility4_onDestroy", "Fa_Auxiliary_MainAbility5_onDestroy"] + let list2 = ["Fa_Auxiliary_MainAbility4_onDestroy"] let number1 = undefined - let number2 = undefined let number3 = undefined let code1 = 536870912 let code2 = 2048 let subscriber = null let subscribeInfo = { - events: ["Fa_Auxiliary_MainAbility4_onCreate", "Fa_Auxiliary_MainAbility4_onDestroy", - "Fa_Auxiliary_MainAbility5_onCreate", "Fa_Auxiliary_MainAbility5_onDestroy"] + events: ["Fa_Auxiliary_MainAbility4_onCreate", "Fa_Auxiliary_MainAbility4_onDestroy"] } function SubscribeInfoCallback(err, data) { console.info(TAG + "===SubscribeInfoCallback===" + JSON.stringify(data)) if (data.event == "Fa_Auxiliary_MainAbility4_onCreate") { number1 = data.parameters.flags } - if (data.event == "Fa_Auxiliary_MainAbility5_onCreate") { - number2 = data.parameters.flags - } if (data.event == "Fa_Auxiliary_MainAbility4_onDestroy") { list1[0] = "Fa_Auxiliary_MainAbility4_onDestroy" } - if (data.event == "Fa_Auxiliary_MainAbility5_onDestroy") { - list1[1] = "Fa_Auxiliary_MainAbility5_onDestroy" - } if (JSON.stringify(list1) == JSON.stringify(list2)) { expect(number3).assertEqual(1); expect(number1).assertEqual(code1); - expect(number2).assertEqual(code2); commonEvent.unsubscribe(subscriber, UnSubscribeInfoCallback) } } @@ -204,21 +195,6 @@ export default function verificationTest(){ expect().assertFail(); done(); }); - - let wantNum3 = { - want: { - bundleName: 'ohos.acts.aafwk.test.faauxiliary', - abilityName: 'ohos.acts.aafwk.test.faauxiliary.MainAbility5', - flags: wantConstant.Flags.FLAG_INSTALL_ON_DEMAND - } - } - await ability_featureAbility.startAbility(wantNum3).then((data) => { - console.info(TAG + "startAbility data = " + JSON.stringify(data)); - }).catch((err) => { - console.info(TAG + "startAbility err = " + JSON.stringify(err)); - expect().assertFail(); - done(); - }); } catch (err) { console.info(TAG + "catch err = " + JSON.stringify(err)); expect().assertFail(); diff --git a/ability/ability_runtime/faapicover/faauxiliary/entry/src/main/config.json b/ability/ability_runtime/faapicover/faauxiliary/entry/src/main/config.json index ee0129cff641bbfdcefeb1a24b80061bfc421311..793985417879ac6042b70a25589582aea5d1701b 100644 --- a/ability/ability_runtime/faapicover/faauxiliary/entry/src/main/config.json +++ b/ability/ability_runtime/faapicover/faauxiliary/entry/src/main/config.json @@ -15,6 +15,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "default", "tablet" ], diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/config.json b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/config.json index 78165bae4c2699d1e89d4e9b13517a2d1c034094..f90fa76aa4db5609959884ac1d19638e9b6d2c66 100644 --- a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/config.json +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/config.json @@ -22,7 +22,8 @@ "name": ".MyApplication", "mainAbility": "com.example.actsfeatureabilitytest.MainAbility", "deviceType": [ - "phone" + "default", + "default" ], "distro": { "deliveryWithInstall": true, @@ -121,6 +122,10 @@ { "name": "ohos.permission.ACCELEROMETER", "reason":"need use ohos.permission.ACCELEROMETER" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ], "js": [ diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js index 6563e4db5fd25b16160e17808d8ad7ff17fa48b8..67affdfdb61ce75865a235fe940a385123e8a354 100644 --- a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/FeatureAbilityJsunit.test.js @@ -84,7 +84,7 @@ describe('ActsFeatureAbilityTest', function () { console.info('beforeEach called') }) - afterEach(function() { + afterEach(async function(done) { /* * @tc.teardown: teardown invoked after each testcases @@ -94,6 +94,22 @@ describe('ActsFeatureAbilityTest', function () { setTimeout(() => {}, 500); backgroundTaskManager.stopBackgroundRunning(featureAbility.getContext()); setTimeout(() => {}, 500); + + let wantInfo = { + want: { + bundleName: "com.example.actsfeatureabilitytest", + abilityName: "com.example.actsfeatureabilitytest.TestAbility" + } + } + await featureAbility.startAbility(wantInfo).then((data) => { + console.log("ACTS_wantConstant startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("ACTS_wantConstant startAbility err : " + JSON.stringify(err)); + }) + setTimeout(function () { + console.log("ACTS_wantConstant afterEach end"); + done(); + }, 500); }) /** @@ -167,8 +183,7 @@ describe('ActsFeatureAbilityTest', function () { it('ACTS_HasWindowFocus_0300', 0, async function (done) { let result = featureAbility.hasWindowFocus( (err, data) => { - console.info("hasWindowFocus asyncCallback code: " + err.code + " data: " + data); - expect(err.code).assertEqual(0); + console.info("hasWindowFocus asyncCallback code data: " + data); expect(data).assertTrue(); done() } @@ -1111,7 +1126,7 @@ describe('ActsFeatureAbilityTest', function () { expect(data.launchMode).assertEqual(0); expect(data.permissions[0]).assertEqual("ohos.permission.ACCELEROMETER"); - expect(data.deviceTypes[0]).assertEqual("phone"); + expect(data.deviceTypes[0]).assertEqual("default"); expect(data.deviceCapabilities[0]).assertEqual("SystemCapability.Ability.AbilityBase"); expect(data.readPermission).assertEqual(""); @@ -1194,7 +1209,7 @@ describe('ActsFeatureAbilityTest', function () { expect(data.supportedModes).assertEqual(0); expect(data.reqCapabilities[0]).assertEqual("reqCapabilitiesTest1"); expect(data.reqCapabilities[1]).assertEqual("reqCapabilitiesTest2"); - expect(data.deviceTypes[0]).assertEqual("phone"); + expect(data.deviceTypes[0]).assertEqual("default"); expect(data.moduleName).assertEqual("entry") expect(data.mainAbilityName).assertEqual("com.example.actsfeatureabilitytest.MainAbility"); expect(data.installationFree).assertEqual(false); diff --git a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js index 1d63d39b02c28ab660b8d4a64c9b7fb510974f62..e420df97c8342fc2166d92cc5007f9d7e7a10f89 100644 --- a/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js +++ b/ability/ability_runtime/featureability/actsfeatureabilitytest/entry/src/main/js/test/StartAbilityJsunit.test.js @@ -23,6 +23,24 @@ const errCode1 = 202; export default function startAbilityTest() { describe('StartAbilityTest', function () { + afterEach(async function(done) { + let wantInfo = { + want: { + bundleName: "com.example.actsfeatureabilitytest", + abilityName: "com.example.actsfeatureabilitytest.TestAbility" + } + } + await featureAbility.startAbility(wantInfo).then((data) => { + console.log("SUB_AA_JsApi_StartAbility startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("SUB_AA_JsApi_StartAbility startAbility err : " + JSON.stringify(err)); + }) + setTimeout(function () { + console.log("SUB_AA_JsApi_StartAbility afterEach end"); + done(); + }, 500); + }) + /* * @tc.number: SUB_AA_JsApi_StartAbility_0100 * @tc.name: testAbility0100. @@ -141,48 +159,6 @@ describe('StartAbilityTest', function () { }) }) - /* - * @tc.number: SUB_AA_JsApi_Ability_0700 - * @tc.name: testAblity0700. - * @tc.desc: startAbility-want-configuration action+entities-entities is configured as a string.(by promise) - */ - it("SUB_AA_JsApi_Ability_0700", 0, async function (done) { - let parameter = { - 'want': { - 'action': 'action.ohos.acts.aafwk.jsapi.MainAbility', - 'entities': 'abc123' - } - } - await featureAbility.startAbility(parameter).then((data) => { - console.log('testAblity0700 data: ' + JSON.stringify(data)) - expect().assertFail() - }).catch((error) => { - console.log('testAblity0700 error: ' + JSON.stringify(error)) - expect(errCode).assertEqual(error.code) - }) - done() - }) - - /* - * @tc.number: SUB_AA_JsApi_Ability_0800 - * @tc.name: testAblity0800. - * @tc.desc: startAbility-want-configuration action+entities-entities is configured as a string.(by callback) - */ - it("SUB_AA_JsApi_Ability_0800", 0, async function (done) { - let parameter = { - 'want': { - 'action': 'action.ohos.acts.aafwk.jsapi.MainAbility', - 'entities': 'abc123' - } - } - featureAbility.startAbility((parameter), (error, data) => { - console.log('testAblity0800 data: ' + JSON.stringify(data)) - console.log('testAblity0800 error: ' + JSON.stringify(error)) - expect(errCode).assertEqual(error.code) - done() - }) - }) - /* * @tc.number: SUB_AA_JsApi_Ability_0900 * @tc.name: testAblity0900. diff --git a/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/config.json b/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/config.json index d33f3b33537d87cd94dbbb1390f0453f59c601f9..ff10f1ef588983dafe785d47cd395353a43b0f1f 100644 --- a/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/config.json +++ b/ability/ability_runtime/featureability/sceneproject/finishwithresultemptytest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.finishwithresultemptytest", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/config.json b/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/config.json index d73ca01765ceeb3bc463e390c5927e89ffd84da6..fcaed56ed5ddeb1e230a9c4f952ca3590bedd406 100644 --- a/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/config.json +++ b/ability/ability_runtime/featureability/sceneproject/finishwithresultpromiseparameterstest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.finishwithresultpromiseparameterstest", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/config.json b/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/config.json index 9ec733d3c2e52da6d7caff688d1e9b605d4ae53c..8ade1e80b3bcd41f34f07ed9d3ff9734f600f4b1 100644 --- a/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/config.json +++ b/ability/ability_runtime/featureability/sceneproject/finishwithresulttest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.finishwithresulttest", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/config.json b/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/config.json index 0026c7409fda38d24d5aaf38bb231425d3a1061c..d72c688f659b47780acf9ed2e7d2da79b1f85e02 100644 --- a/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/config.json +++ b/ability/ability_runtime/featureability/sceneproject/getcallingbundletest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.getcallingbundlepromisetest", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/featureability/sceneproject/startability/src/main/config.json b/ability/ability_runtime/featureability/sceneproject/startability/src/main/config.json index b5540465fd8d6fe532b962cb4ed6dcdabdad756c..3fd7272e146996db21b823c7af13f1a2996eaab7 100644 --- a/ability/ability_runtime/featureability/sceneproject/startability/src/main/config.json +++ b/ability/ability_runtime/featureability/sceneproject/startability/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.startability", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/config.json b/ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/config.json index 0002e785b61a24cb1c34f1afd17ad886538d5474..6ae9094cd4bb5e764423f8e48f61e813987cc318 100644 --- a/ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/config.json +++ b/ability/ability_runtime/featureability/sceneproject/startabilityforresult/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.startabilityforresult", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/config.json b/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/config.json index a0da9e7ac355982f3345754d6b75c71417ea9179..d542b37ff0826ba7fffc57666c6d14f9a6905dff 100644 --- a/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/config.json +++ b/ability/ability_runtime/featureability/sceneproject/terminateabilitytest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.terminateabilitytest", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/config.json index c8690b4bb2ca91777e273bed44741e75fef71a74..d7622a4aba3b3784343f982a9c11367b7418fbc5 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStHostApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/ets/MainAbility/pages/index.ets index 54eeee8755a15da27ec0ddc4df67305983859383..c4f389eba0d54fbb616b45322aaf957d5fdc3cc2 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/ets/MainAbility/pages/index.ets +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhost/entry/src/main/ets/MainAbility/pages/index.ets @@ -46,22 +46,22 @@ struct Index { events: ["FMS_FormDelete_commonEvent"], }; - private publishOnErrorCallBack() { + private publishOnErrorCallBack = () => { this.canCreateForm = false; console.debug("====>formOnErrorEvent Publish CallBack ====>"); } - private publishOnAcquiredCallBack() { + private publishOnAcquiredCallBack = () => { console.debug("====>formOnAcquiredEvent Publish CallBack ====>"); } - private publishCastCallBack() { + private publishCastCallBack = () => { console.debug("====>formCastEvent Publish CallBack ====>"); } - private publishOnUninstallCallBack() { + private publishOnUninstallCallBack = () => { console.debug("====>formOnUninstallEvent Publish CallBack ====>"); } - private deleteCallBack(err, data) { + private deleteCallBack = (err, data) => { console.info("!!!====>formsystemhost deleteCallBack start:====>" + JSON.stringify(data)); if (data.bundleName && data.bundleName != "com.ohos.st.formsystemhost") { return; diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/config.json index fc12ed37e598a5d27fb345bd23869c165dbf9426..ed27d691ebff0ceee75d40ecaafc43ccc32649bf 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStHostAppB", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/ets/MainAbility/pages/index.ets index 010c8e164b692d160c4511f2f113d55d43712b7d..767c0ff7fb9ba067241ad67673d155a99db9310b 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/ets/MainAbility/pages/index.ets +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostb/entry/src/main/ets/MainAbility/pages/index.ets @@ -46,17 +46,17 @@ struct Index { }; private subscriberDle; - private publishOnErrorCallBack() { + private publishOnErrorCallBack = () => { this.canCreateForm = false; console.debug("====>formOnErrorEvent Publish CallBack ====>"); } - private publishOnAcquiredCallBack() { + private publishOnAcquiredCallBack = () => { console.debug("====>formOnAcquiredEvent Publish CallBack ====>"); } - private publishCastCallBack() { + private publishCastCallBack = () => { console.debug("====>formCastEvent Publish CallBack ====>"); } - private deleteCallBack(err, data) { + private deleteCallBack = (err, data) => { console.info("!!!====>formsystemhost deleteCallBack start:====>" + JSON.stringify(data)); if(data.bundleName && data.bundleName != "com.ohos.st.formsystemhostb") { return; diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/config.json index f07e7e2fa9031ba48a6fd0d4fe3d575bf8a34ae9..0c1e0afe32e77f52c8925418d9ed95ec73ed592e 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStHostAppC", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/ets/MainAbility/pages/index.ets index 969c4c1bdade76fd48a6870ac3a622aefd99b4bf..5ba286fc463638c6143c5adb1c81b210eeb8eb63 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/ets/MainAbility/pages/index.ets +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostc/entry/src/main/ets/MainAbility/pages/index.ets @@ -57,26 +57,26 @@ struct Index { events: ["FMS_TimeChange_commonEvent"], }; - private publishOnErrorCallBack() { + private publishOnErrorCallBack = () => { this.canCreateForm = false; console.debug("====>formsystemhostc formOnErrorEventCallBack ====>"); } - private publishOnDeletedCallBack() { + private publishOnDeletedCallBack = () => { this.canCreateForm = false; console.debug("====>formsystemhostc publishOnDeletedCallBack ====>"); } - private publishOnReleasedCallBack() { + private publishOnReleasedCallBack = () => { this.canCreateForm = false; console.debug("====>formsystemhostc publishOnReleasedCallBackk ====>"); } - private publishOnAcquiredCallBack() { + private publishOnAcquiredCallBack = () => { console.debug("====>formsystemhostc formOnAcquiredEventCallBack ====>"); } - private publishCastCallBack() { + private publishCastCallBack = () => { console.debug("====>formsystemhostc formCastEventCallBack ====>"); } - private deleteCallBack(err, data) { + private deleteCallBack = (err, data) => { console.info("!!!====>[FormComponent] deleteCallBack start:====>" + JSON.stringify(data)); if(data.bundleName && data.bundleName != "com.ohos.st.formsystemhostc") { return; @@ -90,7 +90,7 @@ struct Index { console.info("!!!====>[FormComponent] deleteCallBack end ====>"); } - private timeChangeCallBack(err, data) { + private timeChangeCallBack = (err, data) => { console.info("!!!====>[FormComponent] timeChangeCallBack start:====>" + JSON.stringify(data)); if(data.bundleName && data.bundleName != "com.ohos.st.formsystemhostc") { return; diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/config.json index bc91c029913894eafde7158fa1f7b5e4e49b205f..2acd7863a3011f9ba30d317eeab3003c983687da 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStHostAppD", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/ets/MainAbility/pages/index.ets index 2668b47ef158158999edb38e16d6243cdbadd8d7..32f4a3bf7940a4ce16314165791467191ddab680 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/ets/MainAbility/pages/index.ets +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostd/entry/src/main/ets/MainAbility/pages/index.ets @@ -50,26 +50,26 @@ struct Index { events: ["FMS_FormDelete_commonEvent"], }; - private publishOnErrorCallBack() { + private publishOnErrorCallBack = () => { this.canCreateForm = false; console.debug("====>formsystemhostc formOnErrorEventCallBack ====>"); } - private publishOnDeletedCallBack() { + private publishOnDeletedCallBack = () => { this.canCreateForm = false; console.debug("====>formsystemhostc publishOnDeletedCallBack ====>"); } - private publishOnReleasedCallBack() { + private publishOnReleasedCallBack = () => { this.canCreateForm = false; console.debug("====>formsystemhostc publishOnReleasedCallBackk ====>"); } - private publishOnAcquiredCallBack() { + private publishOnAcquiredCallBack = () => { console.debug("====>formsystemhostc formOnAcquiredEventCallBack ====>"); } - private publishCastCallBack() { + private publishCastCallBack = () => { console.debug("====>formsystemhostc formCastEventCallBack ====>"); } - private deleteCallBack(err, data) { + private deleteCallBack = (err, data) => { console.info("!!!====>formsystemhost deleteCallBack start:====>" + JSON.stringify(data)); if(data.bundleName && data.bundleName != "com.ohos.st.formsystemhostd") { return; diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/config.json index 52d6a204a3d6bb1152e3e23f34ac84834db0e37e..112c1d49b2e258097f023c9fe449a2de6fe21db6 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStHostAppE", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/ets/MainAbility/pages/index.ets index 8eaf42ac8b3e569d536a781b0e92e7b15ac346b5..6303a481a96b5e47ccf632e473290b514c8e5813 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/ets/MainAbility/pages/index.ets +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhoste/entry/src/main/ets/MainAbility/pages/index.ets @@ -55,27 +55,27 @@ struct Index { events: ["FMS_FormDelete_commonEvent"], }; - private publishOnErrorCallBack() { + private publishOnErrorCallBack = () => { this.canCreateForm = false; console.debug("====>formsystemhostc formOnErrorEventCallBack ====>"); } - private publishOnDeletedCallBack() { + private publishOnDeletedCallBack = () => { this.canCreateForm = false; console.debug("====>formsystemhostc publishOnDeletedCallBack ====>"); } - private formOnDynamicRefreshCallBack() { + private formOnDynamicRefreshCallBack = () => { this.canCreateForm = false; console.debug("====>formsystemhostc formOnDynamicRefreshEventk ====>"); } - private formOnRequestCallBack() { + private formOnRequestCallBack = () => { this.canCreateForm = false; console.debug("====>formsystemhostc formOnRequestCallBack ====>"); } - private publishOnAcquiredCallBack() { + private publishOnAcquiredCallBack = () => { console.debug("====>formsystemhostc formOnAcquiredEventCallBack ====>"); } - private deleteCallBack(err, data) { + private deleteCallBack = (err, data) => { console.info("!!!====>formsystemhost deleteCallBack start:====>" + JSON.stringify(data)); if (data.bundleName && data.bundleName != "com.ohos.st.formsystemhost") { return; diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/config.json index 9665ee652052437c69e227b5cee8984e1537e888..2ac6615f091099c073f2459045a4ceaa80f34caa 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStHostAppF", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/ets/MainAbility/pages/index.ets index 2b576e3c1c8fd2ac95832e110cf3e7a1b70c5860..6794ecc980b1c0e82313b5fb6f1531087c6c1eda 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/ets/MainAbility/pages/index.ets +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostf/entry/src/main/ets/MainAbility/pages/index.ets @@ -57,26 +57,26 @@ struct Index { events: ["FMS_FormDelete_commonEvent"], }; - private publishOnErrorCallBack() { + private publishOnErrorCallBack = () => { this.canCreateForm = false; console.debug("====>formsystemhostc formOnErrorEventCallBack ====>"); } - private publishOnDeletedCallBack() { + private publishOnDeletedCallBack = () => { this.canCreateForm = false; console.debug("====>formsystemhostc publishOnDeletedCallBack ====>"); } - private publishOnReleasedCallBack() { + private publishOnReleasedCallBack = () => { this.canCreateForm = false; console.debug("====>formsystemhostc publishOnReleasedCallBackk ====>"); } - private publishOnAcquiredCallBack() { + private publishOnAcquiredCallBack = () => { console.debug("====>formsystemhostc formOnAcquiredEventCallBack ====>"); } - private publishOnUpdatedCallBack() { + private publishOnUpdatedCallBack = () => { this.canCreateForm = false; console.debug("====>formsystemhostc publishOnUpdatedCallBack ====>"); } - private deleteCallBack(err, data) { + private deleteCallBack = (err, data) => { console.info("!!!====>formsystemhost deleteCallBack start:====>" + JSON.stringify(data)); if(data.bundleName && data.bundleName != "com.ohos.st.formsystemhostf") { return; diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/config.json index 1ef54c5fa2d9aa2c3b7eb7276b8e84628994fcce..075b857bc3ce01abfb203f728632dfca3b7977d9 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStHostAppG", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/ets/MainAbility/pages/index.ets index e037471b283e4bfed89a387b6d3f24cdb9df772a..89d9c29a46595e8b58d215e0512e5f5b748d468d 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/ets/MainAbility/pages/index.ets +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostg/entry/src/main/ets/MainAbility/pages/index.ets @@ -49,22 +49,22 @@ struct Index { events: ["FMS_FormDelete_commonEvent"], }; - private publishOnErrorCallBack() { + private publishOnErrorCallBack = () => { this.canCreateForm = false; console.debug("====>[FormComponent.host] formOnErrorEventCallBack ====>"); } - private publishOnDeletedCallBack() { + private publishOnDeletedCallBack = () => { this.canCreateForm = false; console.debug("====>[FormComponent.host] publishOnDeletedCallBack ====>"); } - private publishOnStateCallBack() { + private publishOnStateCallBack = () => { this.canCreateForm = false; console.debug("====>[FormComponent.host] publishOnStateCallBack ====>"); } - private publishOnAcquiredCallBack() { + private publishOnAcquiredCallBack = () => { console.debug("====>[FormComponent.host] formOnAcquiredEventCallBack ====>"); } - private deleteCallBack(err, data) { + private deleteCallBack = (err, data) => { console.info("!!!====>[FormComponent.host] deleteCallBack start:====>" + JSON.stringify(data)); if(data.bundleName && data.bundleName != "com.ohos.st.formsystemhostg") { return; diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/config.json index ff59a977b1677c584508c4a3b96d51512e6361b9..fb7f83992e333b62dbaa4d18e5731361f8061361 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStHostAppI", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/ets/MainAbility/pages/index.ets index 732bbe9e396cfb0b15ace9d91a050d0bf90c2cb3..7d7588e3a1f288fa5549fc454721e95c1f1c1243 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/ets/MainAbility/pages/index.ets +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosti/entry/src/main/ets/MainAbility/pages/index.ets @@ -45,18 +45,18 @@ struct Index { events: ["FMS_FormDelete_commonEvent"], }; - private publishOnErrorCallBack() { + private publishOnErrorCallBack = () => { this.canCreateForm = false; console.info("====>formOnErrorEvent Publish CallBack ====>"); } - private publishOnAcquiredCallBack() { + private publishOnAcquiredCallBack = () => { console.info("====>formOnAcquiredEvent Publish CallBack ====>"); } - private publishCastCallBack() { + private publishCastCallBack = () => { console.info("====>formCastEvent Publish CallBack ====>"); } - private deleteCallBack(err, data) { + private deleteCallBack = (err, data) => { console.info("!!!====>formsystemhost deleteCallBack start:====>" + JSON.stringify(data)); if (data.bundleName && data.bundleName != "com.ohos.st.formsystemhost") { return; diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/config.json index 2248ed3dcd62c3e02c74dd5e30e83a6afc9c596b..945f15352d6d7bbc935d07d3ad38cd77ea6de6cd 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStHostApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/ets/MainAbility/pages/index.ets index f86495a3e4b1953adef5d3b64c2a9dfcbc5200e3..5199fd1785a6d621e258ef0f90908ffdd1206f6a 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/ets/MainAbility/pages/index.ets +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostj/entry/src/main/ets/MainAbility/pages/index.ets @@ -45,18 +45,18 @@ struct Index { events: ["FMS_FormDelete_commonEvent"], }; - private publishOnErrorCallBack() { + private publishOnErrorCallBack = () => { this.canCreateForm = false; console.debug("====>formOnErrorEvent Publish CallBack ====>"); } - private publishOnAcquiredCallBack() { + private publishOnAcquiredCallBack = () => { console.debug("====>formOnAcquiredEvent Publish CallBack ====>"); } - private publishCastCallBack() { + private publishCastCallBack = () => { console.debug("====>formCastEvent Publish CallBack ====>"); } - private deleteCallBack(err, data) { + private deleteCallBack = (err, data) => { console.info("!!!====>formsystemhostj deleteCallBack start:====>" + JSON.stringify(data)); if(data.bundleName && data.bundleName != "com.ohos.st.formsystemhostj") { return; diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/config.json index 4b25e4f0371b28e28bf2ee65f10eef061ee68adc..b8a4957ba773ee72cafcec39d7240e0583b5b0ac 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStHostAppK", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/ets/MainAbility/pages/index.ets index c970518070b5892e9160114c7f6ea6a1cb588ea6..12d7ad236b2e6617e40c492dc340f24c8a6e27fa 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/ets/MainAbility/pages/index.ets +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostk/entry/src/main/ets/MainAbility/pages/index.ets @@ -67,19 +67,19 @@ struct Index { private formOnDeletedEvent = "FMS_FormOnDeleted_commonEvent"; private formOnReleasedEvent = "FMS_FormOnReleased_commonEvent"; - private onAcquiredCallback() { + private onAcquiredCallback = () => { console.info(`${this.TAG} onAcquiredCallback`); } - private onRequestCallback() { + private onRequestCallback = () => { console.info(`====>${this.TAG} onRequestCallback====>`); } - private onDeletedCallback() { + private onDeletedCallback = () => { console.info(`${this.TAG} onDeletedCallback`); } - private onReleasedCallback() { + private onReleasedCallback = () => { console.info(`====>${this.TAG} onReleasedCallback====>`); } diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/config.json index d184b9ec9f1f96282caf4286da00d6438216cbb0..11155c1bda766d7a5c58561ed68b6233355fbea6 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStHostAppL", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/ets/MainAbility/pages/index.ets index c900acdf69687d0e5cbc835fc4c87757e23fbc1e..279ca31580b4e1a1b097b29a78450ae40109fb42 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/ets/MainAbility/pages/index.ets +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostl/entry/src/main/ets/MainAbility/pages/index.ets @@ -42,11 +42,11 @@ struct Index { private formOnRequestEvent = `FMS_FormOnRequest_commonEvent`; private formOnDeletedEvent = "FMS_FormOnDeleted_commonEvent"; - private onAcquiredCallback() { + private onAcquiredCallback = () => { console.info(`====>${this.TAG} onAcquiredCallback====>`); } - private onRequestCallback() { + private onRequestCallback = () => { console.info(`====>${this.TAG} onRequestCallback====>`); } diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/config.json index 6dca4226ce5e71a950efe771eb11b49d887eac72..530cf66d86a52d66e5db063389f52a305c66fb39 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostn/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStHostAppN", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/config.json index 3e8c6d744837a0d161d8d31e1d59c37bbd2cbb07..478ab8725d557e950c94eaa66b693d81c0f52292 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStHostAppNoPerm", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/ets/MainAbility/pages/index.ets index 891b96832546dc14795b7b3afe11d329f6c3ae7e..7727fd57e45571f58206ea9668702be5e142ac62 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/ets/MainAbility/pages/index.ets +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostnoperm/entry/src/main/ets/MainAbility/pages/index.ets @@ -48,7 +48,7 @@ struct Index { private formOnRequestEvent = "FMS_FormOnRequest_commonEvent"; private formOnStateEvent = "FMS_FormOnState_commonEvent"; - private publishCallBack() { + private publishCallBack = () => { console.debug("====>formOnErrorEvent Publish CallBack ====>"); } diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/config.json index 6e442bee365d947a8f258d108b44fa6f39ad1005..df6ad4771b801cb25c7b62b3cc1bbdda847e17c7 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhosto/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStHostAppO", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/config.json index 90f1833b1bc8fd3dc1fe168f92f574f968b1f524..83186cf50073fa929ab6fb40e8f361182fb6cc46 100644 --- a/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formhostst_ets/formsystemhostp/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStHostAppP", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/config.json index 5d19bdb474422ecbb2e85cedbf305f9b68826497..0165ca2b9f479636e522e332ce625cec9858407e 100644 --- a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationA/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/config.json index 3ee65354333d9eaad62e2a8827aafdf7e7310789..15274d76cfbdc5aab09f10f8ca8127e90648a3ec 100644 --- a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationB/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/config.json index 29fc8bf65033356a845a8b912d3145eed9cc4a85..8e0e5e408fbf46ba9b0743617129bb2693ab3b29 100644 --- a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationC/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/config.json index 514dc4b0f78107e6cc8f791ec3fa6a42b1e2410e..5900f22d84887f42c02ca46ddbb8f3561cf43589 100644 --- a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationD/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/config.json index 650456f8ef9c200ad401f881eec72d77d476c0f0..4d878c851bd25547093c49f7081517854211c434 100644 --- a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationE/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/config.json index 2e2e549336e2ec8de3461a96300a3bfb1f727e59..d4eb21880410b2473eed4fcdae139c63d830c346 100644 --- a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationF/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/config.json index 389435140fe597cbad596896cb387e94536dced8..d7b259e3caf61d774c2b531b5482be82707ac3f0 100644 --- a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationG/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/config.json index 734f57ff8a2ca909697e995d9b4b94e50351a038..62979bb7e8634e26ca13dc6b29b18b135a9d0eb8 100644 --- a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationH/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/config.json index 20d6ca20267b58c21a4fdf073cf3edd911c06aee..eb22f83f954362f3250378038a61bbe547101a1a 100644 --- a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsupplyapplicationNotSysApp/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/config.json index ad2fd2f88454ab6b77ae4bc964466dc514a470f3..e8097cca484cbea6e51c8c8ce9ca1fc33a5a9e3d 100644 --- a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemprovidera/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/config.json index 162e5064dda116f79541231c61c2d1686f51aa32..95f8b8d4b063be1ce46d2d8ad09605fcfe73622a 100644 --- a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderb/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/config.json index 9e0dc9dd6e4809b3b7e0ae2f8beafde7cc57f7d6..b8b993c94b427ff2e912d3c1ac096e7080e9175a 100644 --- a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderc/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/config.json index d4e41013420a2ab58a815f697b1a815b1e6eda46..6d42150787b0b7abece298186c66ea07b75253d4 100644 --- a/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formproviderst_ets/formsystemproviderd/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/config.json index c1e01e845cd806c5fb6d427c6268b5f5b8fe809d..867c551289372768f10196c8a96166552afa5531 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormAcquireSTApp", "mainAbility": "com.ohos.st.formacquiretest.MainAbility", "deviceType": [ + "default", "phone" ], "distro": { @@ -133,6 +134,10 @@ { "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ], "js": [ diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/test/FmsAcquireForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/test/FmsAcquireForm.test.ets index cb718c637486144af0d2aefc788dec26c7440b57..e20ede1bbea2a817efd2e358689a13a052631948 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/test/FmsAcquireForm.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest/entry/src/main/ets/test/FmsAcquireForm.test.ets @@ -57,6 +57,18 @@ export default function test() { commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); commonEvent.unsubscribe(subscriberCast, () => unsubscribeCallback("afterEach unsubscribe subscriberCast")); commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + + let wantInfo = { + want: { + bundleName: "com.ohos.st.formacquiretest", + abilityName: "com.ohos.st.formacquiretest.TestAbility" + } + } + await featureAbility.startAbility(wantInfo).then((data) => { + console.log("FMS_acquireForm startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("FMS_acquireForm startAbility err : " + JSON.stringify(err)); + }) await sleep(1000); }) @@ -1552,7 +1564,7 @@ export default function test() { function onCastCallBack(_, data) { console.info("!!!====>FMS_acquireForm_2600 onCastCallBack data:====>" + JSON.stringify(data)); expect(data.event).assertEqual("FMS_FormCast_commonEvent"); - expect(data.data).assertEqual("undefined"); + expect(data.data).assertEqual("0"); commonEvent.unsubscribe(subscriberCast, () => unsubscribeOnCastCallback("FMS_acquireForm_2600")) formId1 = data.parameters.formId; console.info("!!!====>FMS_acquireForm_2600 formId1 " + formId1 + " formId2 " + formId2); diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/config.json index f5fd8a283edf4229155e935fa38613a8cf812164..cca586d2916f698c588c8af26de4a952efe78d25 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormAcquire2STApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { @@ -132,6 +133,10 @@ { "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ], "js": [ diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/test/FmsAcquireForm2.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/test/FmsAcquireForm2.test.ets index 0eb17e84a984fd4246ae47a760f8f45b8176c4f8..04066271e9c56a3ca09920a536ad2d8d9e5c3e4e 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/test/FmsAcquireForm2.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formacquiretest2/entry/src/main/ets/test/FmsAcquireForm2.test.ets @@ -60,6 +60,18 @@ export default function test() { commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); commonEvent.unsubscribe(subscriberCast, () => unsubscribeCallback("afterEach unsubscribe subscriberCast")); commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + + let wantInfo = { + want: { + bundleName: "com.ohos.st.formacquiretest2", + abilityName: "com.ohos.st.formacquiretest2.TestAbility" + } + } + await featureAbility.startAbility(wantInfo).then((data) => { + console.log("FMS_acquireForm2 startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("FMS_acquireForm2 startAbility err : " + JSON.stringify(err)); + }) await sleep(1000); }) diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/config.json index 6f8538908a163152a2a766919f633bf853d20282..491be01687d3dbd71eb189b95099bc6d8d67d609 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormDeleteSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { @@ -154,6 +155,10 @@ { "name": "ohos.permission.SET_TIME", "reason": "need use ohos.permission.SET_TIME" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ], "js": [ diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/test/FmsDeleteForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/test/FmsDeleteForm.test.ets index 151d24e4dc983d02670595f24a2bc6128f5f9ffa..3cedbffb31f86a9cd303bb2c8686dba9acc96d36 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/test/FmsDeleteForm.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdeletetest/entry/src/main/ets/test/FmsDeleteForm.test.ets @@ -16,7 +16,8 @@ import featureAbility from '@ohos.ability.featureAbility'; import commonEvent from '@ohos.commonEvent'; import systemTime from '@ohos.systemTime'; -import { beforeEach, afterEach, describe, expect, it } from '@ohos/hypium' +import { beforeAll, afterAll, beforeEach, afterEach, describe, expect, it } from '@ohos/hypium' +import backgroundTaskManager from '@ohos.backgroundTaskManager'; const onAcquiredForm_Event = { events: ["FMS_FormOnAcquired_commonEvent"], @@ -45,6 +46,30 @@ let subscriberSupply; export default function test() { describe(`FmsDeleteFormTest`, () => { + let id = undefined; + beforeAll(async (done) => { + console.log("FMS_deleteForm beforeAll called"); + let myReason = 'test FaShowOnLockTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log("FMS_deleteForm Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log("FMS_deleteForm requestId is : " + id); + setTimeout(function () { + console.log("FMS_deleteForm beforeAll end"); + done(); + }, 1000); + }) + + afterAll(async (done) => { + console.log("FMS_deleteForm afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log("FMS_deleteForm afterAll end"); + done(); + }, 1000); + }) + beforeEach(async () => { subscriberOnAcquired = await commonEvent.createSubscriber(onAcquiredForm_Event); subscriberOnReleased = await commonEvent.createSubscriber(onReleasedFormEvent); diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/config.json index 32026dbd99926b0556ea4fddb503813e63270b52..7867a43beef8d98d8850ac59aedb5bf24ec6e485 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormDynamicSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { @@ -131,6 +132,10 @@ { "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ], "js": [ diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/test/FmsDynamicRefreshForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/test/FmsDynamicRefreshForm.test.ets index 09ee65d6bbb73ad412e0a563beeb7a806e643dd7..14374575c40ba8a0e9095819a293f13e8101aa20 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/test/FmsDynamicRefreshForm.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formdynamicrefreshtest/entry/src/main/ets/test/FmsDynamicRefreshForm.test.ets @@ -60,6 +60,18 @@ export default function test() { commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeCallback("afterEach unsubscribe subscriberOnDeleted")); commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeCallback("afterEach unsubscribe subscriberOnRefresh")); commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + + let wantInfo = { + want: { + bundleName: "com.ohos.st.formdynamicrefreshtest", + abilityName: "com.ohos.st.formdynamicrefreshtest.TestAbility" + } + } + await featureAbility.startAbility(wantInfo).then((data) => { + console.log("FMS_timedRefresh startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("FMS_timedRefresh startAbility err : " + JSON.stringify(err)); + }) await sleep(1000); }) diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/config.json index 8543a6e915322cd9f88c97724000226440c2eeab..fcc584b7d290f58a4de45b58a5a5b9bb8b12f4d8 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormFuzzSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/GetFormsInfoFuzz.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/GetFormsInfoFuzz.test.ets index 7870950c2f224e462b107a950d784b0a4ebaac6d..c8d058de57b2c1cc43d4e4078f3a1bc02885e4c9 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/GetFormsInfoFuzz.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/GetFormsInfoFuzz.test.ets @@ -43,7 +43,7 @@ export const getFormsInfoFuzzTest = (describeName, filterParameter) => { formHost.getFormsInfo(bundleName, (error, data) => { console.log(`FMS_fuzzTest_getinfobundle ${tcNumber} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); expect(data).assertUndefined(); - if (`STRING` === dataType) { + if (`string` === typeof bundleName) { expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); } else { @@ -79,7 +79,7 @@ export const getFormsInfoFuzzTest = (describeName, filterParameter) => { expect().assertFail(); } catch (error) { console.log(`FMS_fuzzTest_getinfobundle ${tcNumber} exception caught: ${JSON.stringify(error)}`); - if (`STRING` === dataType) { + if (`string` === typeof bundleName) { expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); } else { @@ -108,7 +108,7 @@ export const getFormsInfoFuzzTest = (describeName, filterParameter) => { formHost.getFormsInfo(bundleName, moduleName, (error, data) => { console.log(`${callbackName} ${tcNumber} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); expect(data).assertUndefined(); - if (`STRING` === dataType) { + if (`string` === typeof bundleName) { expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); } else { @@ -146,7 +146,7 @@ export const getFormsInfoFuzzTest = (describeName, filterParameter) => { expect().assertFail(); } catch (error) { console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - if (`STRING` === dataType) { + if (`string` === typeof bundleName) { expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); } else { @@ -175,7 +175,7 @@ export const getFormsInfoFuzzTest = (describeName, filterParameter) => { formHost.getFormsInfo(bundleName, moduleName, (error, data) => { console.log(`${callbackName} ${tcNumber} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); expect(data).assertUndefined(); - if (`STRING` === dataType) { + if (`string` === typeof moduleName) { expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); } else { @@ -212,7 +212,7 @@ export const getFormsInfoFuzzTest = (describeName, filterParameter) => { expect().assertFail(); } catch (error) { console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - if (`STRING` === dataType) { + if (`string` === typeof moduleName) { expect(error.code).assertEqual(ERR_GET_BUNDLE_FAILED_CODE); expect(error.message).assertEqual(ERR_GET_BUNDLE_FAILED); } else { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/ReleaseFormFuzz.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/ReleaseFormFuzz.test.ets index 0dc146dba93b773d41c0babe10c55ead09a73f4d..a5c4ddfe781c75cba27f0d19c4da6d4b19bdea47 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/ReleaseFormFuzz.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/ReleaseFormFuzz.test.ets @@ -76,7 +76,7 @@ export const releaseFormFuzzTest = (describeName, filterParameter) => { expect().assertFail(); } catch (error) { console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - if (`STRING` === dataType) { + if (`string` === typeof formId) { expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); } else { @@ -137,7 +137,7 @@ export const releaseFormFuzzTest = (describeName, filterParameter) => { expect().assertFail(); } catch (error) { console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - if (`STRING` === dataType) { + if (`string` === typeof formId) { expect(error.code).assertEqual(ERR_ADD_INVALID_PARAM_CODE); expect(error.message).assertEqual(ERR_ADD_INVALID_PARAM); } else { @@ -166,7 +166,7 @@ export const releaseFormFuzzTest = (describeName, filterParameter) => { formHost.releaseForm(formId, isReleaseCache, (error, data) => { console.log(`${callbackName} ${tcNumber} releaseForm data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); expect(data).assertUndefined(); - if (`BOOLEAN` === dataType) { + if (`boolean` === typeof isReleaseCache) { expect(error.code).assertEqual(ERR_NOT_EXIST_ID_CODE); expect(error.message).assertEqual(ERR_NOT_EXIST_ID); } else { @@ -203,7 +203,7 @@ export const releaseFormFuzzTest = (describeName, filterParameter) => { expect().assertFail(); } catch (error) { console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - if (`BOOLEAN` === dataType) { + if (`boolean` === typeof isReleaseCache) { expect(error.code).assertEqual(ERR_NOT_EXIST_ID_CODE); expect(error.message).assertEqual(ERR_NOT_EXIST_ID); } else { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/SetFormNextRefreshTimeFuzz.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/SetFormNextRefreshTimeFuzz.test.ets index 4d030380aa50610615aaf7b07dcaa68999bfaa2c..70c2eb0ca30b6295ed75c7e63a881d3cc211bf89 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/SetFormNextRefreshTimeFuzz.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/SetFormNextRefreshTimeFuzz.test.ets @@ -104,7 +104,7 @@ export const setFormNextRefreshTimeFuzzTest = (describeName, filterParameter) => formProvider.setFormNextRefreshTime(formId, nextTime, (error, data) => { console.log(`${callbackName} ${tcNumber} setFormNextRefreshTime data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); expect(data).assertUndefined(); - if (`NUMBER` === dataType) { + if (`number` === typeof nextTime) { if (ERR_NOT_EXIST_ID_CODE === error.code) { expect(error.message).assertEqual(ERR_NOT_EXIST_ID); } else if (ERR_ADD_INVALID_PARAM_CODE === error.code) { @@ -147,7 +147,7 @@ export const setFormNextRefreshTimeFuzzTest = (describeName, filterParameter) => expect().assertFail(); } catch (error) { console.log(`${promiseName} ${tcNumber} exception caught: ${JSON.stringify(error)}`); - if (`NUMBER` === dataType) { + if (`number` === typeof nextTime) { if (ERR_NOT_EXIST_ID_CODE === error.code) { expect(error.message).assertEqual(ERR_NOT_EXIST_ID); } else if (ERR_ADD_INVALID_PARAM_CODE === error.code) { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/getParam.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/getParam.ets index 29c726720f932d52c1ccedb7d9c1bae3a394c412..f4cf0821260244921a28156973d46ff277e6541b 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/getParam.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formfuzztest/entry/src/main/ets/test/getParam.ets @@ -148,7 +148,13 @@ const functionTest = function () { const getFuzzData = (datatype: string) => { switch (datatype) { case 'ARRAY': - return arrayTest(); + let array1 = arrayTest(); + let array2 = array1 + if (isNaN(Number(array1.join("")))) { + return array2; + } else { + getFuzzData(DATA_TYPE_LIST[0]); + } case 'BOOLEAN': return booleanTest(); case 'FUNCTION': diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/config.json index a15daad37c5acd5a06b3f4d7be668393c3bf6c82..7e0badee1c023ed8004e11df0a1076279b1b8d45 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/test/GetAllFormsInfo.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/test/GetAllFormsInfo.test.ets index 58a8d0ae908af324d343bc47ea6dc31ab5981455..e6ec15d892e372e7e8d8c47b9f5b8be999bae2da 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/test/GetAllFormsInfo.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/test/GetAllFormsInfo.test.ets @@ -61,7 +61,6 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { tempDataB = dataB[0]; tempDataC = dataC[0]; expect(error.code).assertEqual(ERR_OK_CODE); - expect(error.message).assertEqual(ERR_OK); }); await sleep(2000) checkDataB(tempDataB) diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/test/GetFormsInfo.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/test/GetFormsInfo.test.ets index 8e3403f80e26e061735f4b5366602e6d90c0d4a8..302ef8ac02cea568e3ef93f868c60aa5de6df506 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/test/GetFormsInfo.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandonetest/entry/src/main/ets/test/GetFormsInfo.test.ets @@ -178,7 +178,6 @@ export const getFormsInfoTest = (describeName, filterParameter) => { expect(dataB.length).assertEqual(1); tempDataB = dataB[0] expect(error.code).assertEqual(ERR_OK_CODE); - expect(error.message).assertEqual(ERR_OK); console.log(`==========${callbackName2} ${describeName} end==========`); }); await sleep(2000) @@ -400,7 +399,6 @@ export const getFormsInfoTest = (describeName, filterParameter) => { console.log(`${callbackName6} getFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); expect(JSON.stringify(data)).assertEqual(`[]`); expect(error.code).assertEqual(ERR_OK_CODE); - expect(error.message).assertEqual(ERR_OK); done(); console.log(`==========${callbackName6} ${describeName} end==========`); }); @@ -456,7 +454,6 @@ export const getFormsInfoTest = (describeName, filterParameter) => { expect(data.length).assertEqual(1); expect(dataC.length).assertEqual(1); expect(error.code).assertEqual(ERR_OK_CODE); - expect(error.message).assertEqual(ERR_OK); console.log(`==========${callbackName7} ${describeName} end==========`); }); await sleep(2000) diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/config.json index 0183f81e01ab174e87ed93c2d81974532e691642..87b9f7db29c94e09c38376f63144b3cc5e519843 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/test/GetAllFormsInfo.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/test/GetAllFormsInfo.test.ets index fd1fe68cfb7fcd8e7b361d695a55d64cc5f10ac6..023ba9611c5b65f5f083a725b086233d51360632 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/test/GetAllFormsInfo.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandtwotest/entry/src/main/ets/test/GetAllFormsInfo.test.ets @@ -62,7 +62,6 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { tempDataA2 = dataA[1] tempDataB = dataB[0] expect(error.code).assertEqual(ERR_OK_CODE); - expect(error.message).assertEqual(ERR_OK); console.log(`==========${callbackName} ${describeName} end==========`); }); await sleep(2000) diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/config.json index 739668a77e2b5c7081568b1a35c3ceba3c6ee7ba..5f7a98a6bdc9b0a1cf9c90ff139e442058f1d85e 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/test/GetAllFormsInfo.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/test/GetAllFormsInfo.test.ets index 169f3825aa1e4accf97b6d436a2e883c43b5b01f..e4a2abc7d81f49a19ea29e5c4443a2dabc957662 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/test/GetAllFormsInfo.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formsoneandzerotest/entry/src/main/ets/test/GetAllFormsInfo.test.ets @@ -58,7 +58,6 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { tempDataB = dataB[0] expect(JSON.stringify(dataD)).assertEqual(`[]`); expect(error.code).assertEqual(ERR_OK_CODE); - expect(error.message).assertEqual(ERR_OK); console.log(`==========${callbackName} ${describeName} end==========`); }); await sleep(2000) diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/config.json index 9a7fb1603e47fd6194d237dbddaddabb390edfad..aaec29db555a13bffffa983760de7df6adec8838 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/test/GetAllFormsInfo.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/test/GetAllFormsInfo.test.ets index 5d91f12ae3a21c20f9f334d562f7c7adde4ecc20..f38f9e7cb52e3a4d3a932134072146acc6aacaea 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/test/GetAllFormsInfo.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formswithoutpermtest/entry/src/main/ets/test/GetAllFormsInfo.test.ets @@ -37,7 +37,6 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { console.log(`${callbackName} getAllFormsInfo data: ${JSON.stringify(data)} error: ${JSON.stringify(error)}`); expect(JSON.stringify(data)).assertEqual(`[]`); expect(error.code).assertEqual(ERR_OK_CODE); - expect(error.message).assertEqual(ERR_OK); done(); console.log(`==========${callbackName} ${describeName} end==========`); }); diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/config.json index e55f5685b64ebab1c69132342aeb368fd31e0a96..75396a3a28f777be8e26f77ed3da9de15bcf2511 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/test/GetAllFormsInfo.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/test/GetAllFormsInfo.test.ets index 78bcac9763e65b37720bd1223d6a52eca6fbcb37..4350c2f8051f51840727811f73d0ab5ec91fb168 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/test/GetAllFormsInfo.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formgetformsinfotest/formszerotest/entry/src/main/ets/test/GetAllFormsInfo.test.ets @@ -44,7 +44,6 @@ export const getAllFormsInfoTest = (describeName, filterParameter) => { expect(dataD.length).assertEqual(0); expect(JSON.stringify(dataD)).assertEqual(`[]`); expect(error.code).assertEqual(ERR_OK_CODE); - expect(error.message).assertEqual(ERR_OK); done(); console.log(`==========${callbackName} ${describeName} end==========`); }); diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/config.json index f38d28074d0921c1a28be01a42432fc666ebc03f..84313c183f489a061a6021b5abdca1ca3332530f 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formhostdeathrecipienttest/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormHostDeathRecipientSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/config.json index 4125e2667315915d341ff54b6a645abcffe3d106..60458105ad97daf58c59edb64806240fc15db534 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formperformancetest/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormPerformanceSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/config.json index 867cbe0e16c6ad70a992d4238cd7a466ee11a704..467b44dc360e34a76b73a04b6337247177b3e4ab 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormReleaseSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { @@ -139,6 +140,10 @@ { "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ], "js": [ diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/test/FmsReleaseForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/test/FmsReleaseForm.test.ets index bef74bca0e9e49878bf3fb8c1c0e6c4ed39b4941..98f9179159dd6764a1998a989bfba2484c12866f 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/test/FmsReleaseForm.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formreleasetest/entry/src/main/ets/test/FmsReleaseForm.test.ets @@ -56,6 +56,18 @@ export default function test() { commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeCallback("afterEach unsubscribe subscriberOnDeleted")); commonEvent.unsubscribe(subscriberOnReleased, () => unsubscribeCallback("afterEach unsubscribe subscriberOnReleased")); + + let wantInfo = { + want: { + bundleName: "com.ohos.st.formreleasetest", + abilityName: "com.ohos.st.formreleasetest.TestAbility" + } + } + await featureAbility.startAbility(wantInfo).then((data) => { + console.log("FMS_releaseForm startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("FMS_releaseForm startAbility err : " + JSON.stringify(err)); + }) await sleep(1000); }) diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/config.json index f12ebbf7cab84a87b66419ccc9e95bbea78adedd..8040926bfc6d554edff883a1d3d3030caecd1916 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStateSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { @@ -141,6 +142,10 @@ { "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ], "js": [ diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/test/FmsFormStateDisable.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/test/FmsFormStateDisable.test.ets index 793cff053aacea7e6fe55865d12eafa7d918000c..33e7f385c0384bcc8444ff956ede02bfb535753e 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/test/FmsFormStateDisable.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_disable/entry/src/main/ets/test/FmsFormStateDisable.test.ets @@ -15,7 +15,8 @@ import featureAbility from "@ohos.ability.featureAbility"; import commonEvent from '@ohos.commonEvent'; -import { beforeAll, beforeEach, afterEach, describe, expect, it } from '@ohos/hypium' +import { beforeAll, afterAll, beforeEach, afterEach, describe, expect, it } from '@ohos/hypium' +import backgroundTaskManager from '@ohos.backgroundTaskManager'; var onAcquiredForm_Event = { events: ["FMS_FormOnAcquired_commonEvent"], @@ -47,8 +48,28 @@ var subscriberSupply; export default function test() { describe(`FmsStateFormTest`, () => { + let id = undefined; beforeAll(async (done) => { - done(); + console.log("FMS_disableFormsUpdate beforeAll called"); + let myReason = 'test FaShowOnLockTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log("FMS_disableFormsUpdate Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log("FMS_disableFormsUpdate requestId is : " + id); + setTimeout(function () { + console.log("FMS_disableFormsUpdate beforeAll end"); + done(); + }, 1000); + }) + + afterAll(async (done) => { + console.log("FMS_disableFormsUpdate afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log("FMS_disableFormsUpdate afterAll end"); + done(); + }, 1000); }) beforeEach(async () => { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/config.json index cbb125b936eca69883eb4292f58ad6827b4bbb2d..1ee904b08db0a4a415df445fd7f98540db0a7555 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStateSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { @@ -141,6 +142,10 @@ { "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ], "js": [ diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/test/FmsFormStateEnable.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/test/FmsFormStateEnable.test.ets index e412b411248bd8f72052713898d8728bab9a8d4e..205120afe381f18eedac2f3cee9482e2b3c1c92f 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/test/FmsFormStateEnable.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_enable/entry/src/main/ets/test/FmsFormStateEnable.test.ets @@ -15,7 +15,8 @@ import featureAbility from "@ohos.ability.featureAbility"; import commonEvent from '@ohos.commonEvent'; -import { beforeAll, beforeEach, afterEach, describe, expect, it } from '@ohos/hypium' +import { beforeAll, afterAll, beforeEach, afterEach, describe, expect, it } from '@ohos/hypium' +import backgroundTaskManager from '@ohos.backgroundTaskManager'; var onAcquiredForm_Event = { events: ["FMS_FormOnAcquired_commonEvent"], @@ -47,8 +48,28 @@ var subscriberSupply; export default function test() { describe(`FmsStateFormTest`, () => { + let id = undefined; beforeAll(async (done) => { - done(); + console.log("FMS_enableFormsUpdate beforeAll called"); + let myReason = 'test FaShowOnLockTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log("FMS_enableFormsUpdate Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log("FMS_enableFormsUpdate requestId is : " + id); + setTimeout(function () { + console.log("FMS_enableFormsUpdate beforeAll end"); + done(); + }, 1000); + }) + + afterAll(async (done) => { + console.log("FMS_enableFormsUpdate afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log("FMS_enableFormsUpdate afterAll end"); + done(); + }, 1000); }) beforeEach(async () => { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/config.json index 8d6fef062e42d8489b70503fe37c02f8f6d89153..58d83feef3a5f366f4155a97279c706c193d2e70 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStateSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { @@ -141,6 +142,10 @@ { "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ], "js": [ diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/test/FmsFormStateNotifyInvisible.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/test/FmsFormStateNotifyInvisible.test.ets index 3fc87b2f5f905356ba6a29ff22910c06958ee026..d1e1fdea513f42d0ee64fd001bf40d893be35e58 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/test/FmsFormStateNotifyInvisible.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible/entry/src/main/ets/test/FmsFormStateNotifyInvisible.test.ets @@ -60,6 +60,18 @@ export default function test() { commonEvent.unsubscribe(subscriberDel, () => unsubscribeCallback("afterEach unsubscribe subscriberDel")); commonEvent.unsubscribe(subscriberOnState, () => unsubscribeCallback("afterEach unsubscribe subscriberOnState")); commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + + let wantInfo = { + want: { + bundleName: "com.ohos.st.formstatenotifyinvisibletest", + abilityName: "com.ohos.st.formstatenotifyinvisibletest.TestAbility" + } + } + await featureAbility.startAbility(wantInfo).then((data) => { + console.log("FMS_notifyInvisibleForms startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("FMS_notifyInvisibleForms startAbility err : " + JSON.stringify(err)); + }) await sleep(1000); }) /** diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/config.json index 9bcb03ea97ebb7f111f17dbb6de7a674ba06acad..c8e3a5b4e2a07439983ddd879b13df584ddd2c97 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStateSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { @@ -141,6 +142,14 @@ { "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" } ], "js": [ diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/test/FmsFormStateNotifyInvisible2.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/test/FmsFormStateNotifyInvisible2.test.ets index 84d1c284602236796f1efe13be40f322e81da042..6dd14fbb13b53216e190fdf36de9a66fd5977627 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/test/FmsFormStateNotifyInvisible2.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyinvisible2/entry/src/main/ets/test/FmsFormStateNotifyInvisible2.test.ets @@ -54,6 +54,18 @@ export default function test() { commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); commonEvent.unsubscribe(subscriberOnState, () => unsubscribeCallback("afterEach unsubscribe subscriberOnState")); commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + + let wantInfo = { + want: { + bundleName: "com.ohos.st.formstatenotifyinvisibletest2", + abilityName: "com.ohos.st.formstatenotifyinvisibletest2.TestAbility" + } + } + await featureAbility.startAbility(wantInfo).then((data) => { + console.log("FMS_notifyInvisibleForms2 startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("FMS_notifyInvisibleForms2 startAbility err : " + JSON.stringify(err)); + }) await sleep(1000); }) /** diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/config.json index cdf7831de6083f70651f501bd33bd104e3dbbb38..8101fc1eff78e87796c5aaf1027b8df58db52c7b 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStateSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { @@ -141,6 +142,10 @@ { "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ], "js": [ diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/test/FmsFormStateNotifyVisible.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/test/FmsFormStateNotifyVisible.test.ets index 9458578b86097e315be87c59333d4632f88dd423..ffd33691ea972b305ee93931f7b257e1409b9fda 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/test/FmsFormStateNotifyVisible.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstatetest_notifyvisible/entry/src/main/ets/test/FmsFormStateNotifyVisible.test.ets @@ -57,6 +57,18 @@ export default function test() { commonEvent.unsubscribe(subscriberOnAcquired, () => unsubscribeCallback("afterEach unsubscribe subscriberOnAcquired")); commonEvent.unsubscribe(subscriberOnState, () => unsubscribeCallback("afterEach unsubscribe subscriberOnState")); commonEvent.unsubscribe(subscriberSupply, () => unsubscribeCallback("afterEach unsubscribe subscriberSupply")); + + let wantInfo = { + want: { + bundleName: "com.ohos.st.formstatenotifyvisibletest", + abilityName: "com.ohos.st.formstatenotifyvisibletest.TestAbility" + } + } + await featureAbility.startAbility(wantInfo).then((data) => { + console.log("FMS_notifyVisibleForms startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("FMS_notifyVisibleForms startAbility err : " + JSON.stringify(err)); + }) await sleep(1000); }) /** diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/config.json index 5637e0cc11ceecc54d14d329e91be306afe28ad7..4c72406e07c399c63113fb886d6ac8d03622dfa7 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormStressSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { @@ -160,6 +161,10 @@ }, { "name": "ohos.permission.CLEAN_APPLICATION_DATA" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ], "js": [ diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/test/FmsStress.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/test/FmsStress.test.ets index e23601167a51d1998aa7155c8f3962308f502e07..371a116803bf0aad3401409221e6da622d44d7d4 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/test/FmsStress.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formstresstest/entry/src/main/ets/test/FmsStress.test.ets @@ -68,7 +68,17 @@ export default function test() { commonEvent.unsubscribe(onDeletedEventSubscriber, () => unsubscribeCallback("afterEach unsubscribe onDeletedEventSubscriber")); commonEvent.unsubscribe(onAcquiredEventSubscriber, () => unsubscribeCallback("afterEach unsubscribe onAcquiredEventSubscriber")); commonEvent.unsubscribe(onSupplyEventSubscriber, () => unsubscribeCallback("afterEach unsubscribe onSupplyEventSubscriber")); - await sleep(1000); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formstresstest", + abilityName: "com.ohos.st.formstresstest.MainAbility" + } + }).then((data) => { + console.log("FmsStressTest startAbility data: " + JSON.stringify(data)); + }).catch((err) => { + console.log("FmsStressTest startAbility err: " + JSON.stringify(err)); + }) + await sleep(2000); }) const subscribeDeletedEvent = (tcNumber, expectedDeletedFormAmount, done) => { diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/config.json b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/config.json index 72b3d879e6c3f39ef41b943f45783d1be018daec..4598051105ae30aacc3b746e148d09d6611a61cf 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/config.json +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".FormUpdateSTApp", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { @@ -150,6 +151,10 @@ { "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ], "js": [ diff --git a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/test/FmsUpdateRefreshForm.test.ets b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/test/FmsUpdateRefreshForm.test.ets index 270b019595b664cd8d8b7abfced7f272a757bef1..9d84b65cab527595a82b8b76cadefc9137a5b839 100644 --- a/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/test/FmsUpdateRefreshForm.test.ets +++ b/ability/ability_runtime/formmanager/fa/formsystemtest_ets/formupdatefreshtest/entry/src/main/ets/test/FmsUpdateRefreshForm.test.ets @@ -65,7 +65,17 @@ export default function test() { commonEvent.unsubscribe(subscriberOnDeleted, () => unsubscribeCallback("afterEach unsubscribe subscriberOnDeleted")); commonEvent.unsubscribe(subscriberOnRefresh, () => unsubscribeCallback("afterEach unsubscribe subscriberOnRefresh")); commonEvent.unsubscribe(subscriberOnRequest, () => unsubscribeCallback("afterEach unsubscribe subscriberOnRequest")); - await sleep(1000); + await featureAbility.startAbility({ + want: { + bundleName: "com.ohos.st.formupdaterefreshtest", + abilityName: "com.ohos.st.formupdaterefreshtest.MainAbility" + } + }).then((data) => { + console.log("FmsUpdateRefreshFormTest startAbility data: " + JSON.stringify(data)); + }).catch((err) => { + console.log("FmsUpdateRefreshFormTest startAbility err: " + JSON.stringify(err)); + }) + await sleep(2000); }) /** * @tc.number: FMS_updateForm_0100 diff --git a/ability/ability_runtime/formmanager/stage/actsformprovidergetformsinfo/entry/src/main/module.json b/ability/ability_runtime/formmanager/stage/actsformprovidergetformsinfo/entry/src/main/module.json index 4e4edfed85bdc47418e18ccd4d35b889376248cb..3be9582522234c01c2c91f3e439defc726360091 100644 --- a/ability/ability_runtime/formmanager/stage/actsformprovidergetformsinfo/entry/src/main/module.json +++ b/ability/ability_runtime/formmanager/stage/actsformprovidergetformsinfo/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "tablet" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/formmanager/stage/actsformprovidergetformsinfo/module1/src/main/module.json b/ability/ability_runtime/formmanager/stage/actsformprovidergetformsinfo/module1/src/main/module.json index eff67c9014c6839a115b47acac8826b8c3b1a6a3..ac065dbf50e15df3f3c26f3820dd05abaab0798d 100644 --- a/ability/ability_runtime/formmanager/stage/actsformprovidergetformsinfo/module1/src/main/module.json +++ b/ability/ability_runtime/formmanager/stage/actsformprovidergetformsinfo/module1/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:module1_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "tablet" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/formmanager/stage/actsformprovidergetformsinfo/module2/src/main/module.json b/ability/ability_runtime/formmanager/stage/actsformprovidergetformsinfo/module2/src/main/module.json index 00feac3a5bc2cc319eea8cf86f4482579260e78b..5cf7620fb80dd3f6b3d0ab9abc4d9033ac07464e 100644 --- a/ability/ability_runtime/formmanager/stage/actsformprovidergetformsinfo/module2/src/main/module.json +++ b/ability/ability_runtime/formmanager/stage/actsformprovidergetformsinfo/module2/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:module2_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "tablet" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/config.json index 02cfb86b4cd2bb7b361e1c31ad714abf28e85576..a8de7e0415412832a0f557038c0f5d73d5b5a667 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/config.json @@ -16,6 +16,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest.ets b/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest.ets index 5bed498301ee1ac25541bd2748182d46a5e09bb0..3d26b03273556a59ca9c9caa3ae2a53775cd2a30 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest.ets +++ b/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest.ets @@ -25,611 +25,488 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry export default function ConnectAbilityTest() { - var TAG = ""; - var Tempassert = ""; - var abilityDelegator = undefined + var TAG = ""; + var Tempassert = ""; + var abilityDelegator = undefined - function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)) + function sleep(time) { + return new Promise((resolve) => setTimeout(resolve, time)) + } + + describe('FreeInstall_FA_ConnectAbility', function () { + beforeAll(async function (done) { + console.info("FreeInstall_FA_ConnectAbility before all called"); + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var cmd = "bm install -p data/test/MockService.hap"; + console.info("cmd : " + cmd) + console.info(TAG + " abilityDelegator : " + JSON.stringify(abilityDelegator)); + abilityDelegator.executeShellCommand(cmd, (err: any, d: any) => { + console.info("executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + await sleep(500); + var cmd1 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry"; + abilityDelegator.executeShellCommand(cmd1, (err: any, d: any) => { + console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + await sleep(500); + var cmd2 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; + abilityDelegator.executeShellCommand(cmd2, (err: any, d: any) => { + console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + done(); + }) + }); + + afterEach(async (done) => { + console.info("FreeInstall_FA_ConnectAbility after each called"); + Tempassert = "" + if ("FreeInstall_FA_ConnectAbility_2000" === TAG) { + var cmd14 = "bm uninstall -n com.ohos.hag.famanager"; + abilityDelegator.executeShellCommand(cmd14, (err: any, d: any) => { + console.info("executeShellCommand14 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + } + done(); + }); + + function tips(msg) { + Prompt.showToast({ + message: msg, + duration: 2000, + bottom: '150px' + }); + } + + async function connectabillity(msg, request) { + console.info(msg + "START"); + let options = { + onConnect: function (element, proxy) { + console.info("FreeInstall_FA_ConnectAbility onConnect success!!!") + console.info(msg + " onConnect success!!! "); + console.info(msg + " onConnect: " + JSON.stringify(element)); + console.info(msg + " onConnect: " + JSON.stringify(proxy)); + if (proxy == null) { + console.error("FreeInstall_FA_ConnectAbility proxy null"); + return; + } + let option = new rpc.MessageOption(); + let data = new rpc.MessageParcel(); + let reply = new rpc.MessageParcel(); + data.writeInterfaceToken("ohos.appexecfwk.IApplicationStateObserver"); + proxy.sendRequest(0, data, reply, option); + Tempassert = "onConnect"; + tips("连接成功"); + }, + onDisconnect: function (element) { + console.info("FreeInstall_FA_ConnectAbility onDisconnect success!!!") + console.info(msg + " onDisconnect success!!!"); + console.info(msg + " onDisconnect: " + JSON.stringify(element)); + Tempassert = "onDisconnect"; + tips("连接断开"); + }, + onFailed: function (code) { + console.info("FreeInstall_FA_ConnectAbility onFailed!!!") + console.info(msg + " onFailed!!! "); + console.info(msg + " onFailed: " + JSON.stringify(code)); + Tempassert = "onFailed"; + tips("连接失败"); + } + } + let connection = await featureAbility.connectAbility(request, options); + console.info(msg + "request:" + JSON.stringify(request)); + console.info(msg + "options:" + JSON.stringify(options)); + console.info(msg + "connection=" + JSON.stringify(connection)); + console.info(msg + "END"); } - describe('FreeInstall_FA_ConnectAbility', function () { - beforeAll(async function (done) { - console.info("FreeInstall_FA_ConnectAbility before all called"); - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var cmd = "bm install -p data/test/MockService.hap"; - console.info("cmd : " + cmd) - console.info(TAG + " abilityDelegator : " + JSON.stringify(abilityDelegator)); - abilityDelegator.executeShellCommand(cmd, (err: any, d: any) => { - console.info("executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - var cmd1 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry"; - abilityDelegator.executeShellCommand(cmd1, (err: any, d: any) => { - console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - var cmd2 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; - abilityDelegator.executeShellCommand(cmd2, (err: any, d: any) => { - console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - done(); - }) - }); - - afterEach(async function (done) { - console.info("FreeInstall_FA_ConnectAbility after each called"); - Tempassert = "" - await sleep(1000); - if ("FreeInstall_FA_ConnectAbility_2000" === TAG) { - var cmd14 = "bm uninstall -n com.ohos.hag.famanager"; - abilityDelegator.executeShellCommand(cmd14, (err: any, d: any) => { - console.info("executeShellCommand14 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - } - await sleep(500); - done(); - }); - - function tips(msg) { - Prompt.showToast({ - message: msg, - duration: 2000, - bottom: '150px' - }); + /* + * @tc.number FreeInstall_FA_ConnectAbility_0100 + * @tc.name Pass in the local deviceid,atomic service does not exist locally + * @tc.desc Function test + * @tc.level 0 + */ + it("FreeInstall_FA_ConnectAbility_0100", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_0100-------------"); + TAG = "FreeInstall_FA_ConnectAbility_0100"; + var cmd4 = "cp data/test/ConnectFaMyApplication6.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps" + + "/entry/files"; + abilityDelegator.executeShellCommand(cmd4, (err: any, d: any) => { + console.info(TAG + " executeShellCommand4 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + + setTimeout(async () => { + var deviceid = "0"; + await abilityManager.getTopAbility((err, data) => { + console.log(TAG + 'getTopAbility result: ' + JSON.stringify(data) + " , err: " + JSON.stringify(err)); + console.log(TAG + 'getTopAbility result deviceid:' + JSON.stringify(data.deviceId)); + deviceid = data.deviceId; + }) + var request1 = { + "deviceId": deviceid, + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication6.ServiceAbility", + "moduleName": "myapplication6", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, } + connectabillity(TAG, request1); + setTimeout(() => { + expect(Tempassert).assertEqual("onConnect"); + }, 500) + }, 2000); + console.log("------------end FreeInstall_FA_ConnectAbility_0100-------------"); + done(); + }); - async function connectabillity(msg, request) { - console.info(msg + "START"); - let options = { - onConnect: function (element, proxy) { - console.info("FreeInstall_FA_ConnectAbility onConnect success!!!") - console.info(msg + " onConnect success!!! "); - console.info(msg + " onConnect: " + JSON.stringify(element)); - console.info(msg + " onConnect: " + JSON.stringify(proxy)); - if (proxy == null) { - console.error("FreeInstall_FA_ConnectAbility proxy null"); - return; - } - let option = new rpc.MessageOption(); - let data = new rpc.MessageParcel(); - let reply = new rpc.MessageParcel(); - data.writeInterfaceToken("ohos.appexecfwk.IApplicationStateObserver"); - proxy.sendRequest(0, data, reply, option); - Tempassert = "onConnect"; - tips("连接成功"); - }, - onDisconnect: function (element) { - console.info("FreeInstall_FA_ConnectAbility onDisconnect success!!!") - console.info(msg + " onDisconnect success!!!"); - console.info(msg + " onDisconnect: " + JSON.stringify(element)); - Tempassert = "onDisconnect"; - tips("连接断开"); - }, - onFailed: function (code) { - console.info("FreeInstall_FA_ConnectAbility onFailed!!!") - console.info(msg + " onFailed!!! "); - console.info(msg + " onFailed: " + JSON.stringify(code)); - Tempassert = "onFailed"; - tips("连接失败"); - } - } - let connection = await featureAbility.connectAbility(request, options); - console.info(msg + "request:" + JSON.stringify(request)); - console.info(msg + "options:" + JSON.stringify(options)); - console.info(msg + "connection=" + JSON.stringify(connection)); - console.info(msg + "END"); + /* + * @tc.number FreeInstall_FA_ConnectAbility_0200 + * @tc.name Pass in the local deviceid,atomic service exists locally + * @tc.desc Function test + * @tc.level 0 + */ + it("FreeInstall_FA_ConnectAbility_0200", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_0200-------------"); + TAG = "FreeInstall_FA_ConnectAbility_0200"; + var cmdapp10 = "bm install -p data/test/ConnectFaMyApplication10.hap"; + abilityDelegator.executeShellCommand(cmdapp10, (err: any, d: any) => { + console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + setTimeout(async () => { + var deviceid = "0"; + await abilityManager.getTopAbility((err, data) => { + console.log(TAG + 'getTopAbility result: ' + JSON.stringify(data) + " , err: " + JSON.stringify(err)); + console.log(TAG + 'getTopAbility result deviceid:' + JSON.stringify(data.deviceId)); + deviceid = data.deviceId; + }) + var request2 = { + "deviceId": deviceid, + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication10.ServiceAbility", + "moduleName": "myapplication10", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, } + connectabillity(TAG, request2); + setTimeout(() => { + expect(Tempassert).assertEqual("onConnect"); + }, 500) + }, 2500); + console.log("------------end FreeInstall_FA_ConnectAbility_0200-------------"); + done(); + }); - /* - * @tc.number FreeInstall_FA_ConnectAbility_0100 - * @tc.name Pass in the local deviceid,atomic service does not exist locally - * @tc.desc Function test - * @tc.level 0 - */ - it("FreeInstall_FA_ConnectAbility_0100", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_0100-------------"); - TAG = "FreeInstall_FA_ConnectAbility_0100"; - var cmd4 = "cp data/test/ConnectFaMyApplication6.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps" + - "/entry/files"; - abilityDelegator.executeShellCommand(cmd4, (err: any, d: any) => { - console.info(TAG + " executeShellCommand4 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - var deviceid = "0"; - abilityManager.getTopAbility((err, data) => { - console.log(TAG + 'getTopAbility result: ' + JSON.stringify(data) + " , err: " + JSON.stringify(err)); - console.log(TAG + 'getTopAbility result deviceid:' + JSON.stringify(data.deviceId)); - deviceid = data.deviceId; - }) - await sleep(500); - var request1 = { - "deviceId": deviceid, - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication6.ServiceAbility", - "moduleName": "myapplication6", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - connectabillity(TAG, request1); - setTimeout(function () { - expect(Tempassert).assertEqual("onConnect"); - console.log("------------end FreeInstall_FA_ConnectAbility_0100-------------"); - done(); - }, 3000); - }); - - /* - * @tc.number FreeInstall_FA_ConnectAbility_0200 - * @tc.name Pass in the local deviceid,atomic service exists locally - * @tc.desc Function test - * @tc.level 0 - */ - it("FreeInstall_FA_ConnectAbility_0200", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_0200-------------"); - TAG = "FreeInstall_FA_ConnectAbility_0200"; - var cmdapp10 = "bm install -p data/test/ConnectFaMyApplication10.hap"; - abilityDelegator.executeShellCommand(cmdapp10, (err: any, d: any) => { - console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - var deviceid = "0"; - abilityManager.getTopAbility((err, data) => { - console.log(TAG + 'getTopAbility result: ' + JSON.stringify(data) + " , err: " + JSON.stringify(err)); - console.log(TAG + 'getTopAbility result deviceid:' + JSON.stringify(data.deviceId)); - deviceid = data.deviceId; - }) - await sleep(500); - var request2 = { - "deviceId": deviceid, - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication10.ServiceAbility", - "moduleName": "myapplication10", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - connectabillity(TAG, request2); - setTimeout(function () { - expect(Tempassert).assertEqual("onConnect"); - console.log("------------end FreeInstall_FA_ConnectAbility_0200-------------"); - done(); - }, 3000); - }); - - /* - * @tc.number FreeInstall_FA_ConnectAbility_0300 - * @tc.name Deviceid is empty,atomic service does not exist locally - * @tc.desc Function test - * @tc.level 0 - */ - it("FreeInstall_FA_ConnectAbility_0300", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_0300-------------"); - TAG = "FreeInstall_FA_ConnectAbility_0300"; - var cmd3 = "cp data/test/ConnectFaMyApplication1.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; - abilityDelegator.executeShellCommand(cmd3, (err: any, d: any) => { - console.info("executeShellCommand3 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - var request3 = { - "deviceId": "", - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication1.ServiceAbility_feature", - "moduleName": "myapplication1", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - connectabillity(TAG, request3); - setTimeout(function () { - expect(Tempassert).assertEqual("onConnect"); - console.log("------------end FreeInstall_FA_ConnectAbility_0300-------------"); - done(); - }, 3000); - }); - - /* - * @tc.number FreeInstall_FA_ConnectAbility_0400 - * @tc.name Deviceid is empty,atomic service exists locally - * @tc.desc Function test - * @tc.level 0 - */ - it("FreeInstall_FA_ConnectAbility_0400", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_0400-------------"); - TAG = "FreeInstall_FA_ConnectAbility_0400"; - var cmdapp11 = "bm install -p data/test/ConnectFaMyApplication11.hap"; - abilityDelegator.executeShellCommand(cmdapp11, (err: any, d: any) => { - console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - var request4 = { - "deviceId": "", - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication11.ServiceAbility", - "moduleName": "myapplication11", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - connectabillity(TAG, request4); - setTimeout(function () { - expect(Tempassert).assertEqual("onConnect"); - console.log("------------end FreeInstall_FA_ConnectAbility_0400-------------"); - done(); - }, 3000); - }); - - /* - * @tc.number FreeInstall_FA_ConnectAbility_0500 - * @tc.name The bundleName passed in is different from the local - * @tc.desc Function test - * @tc.level 1 - */ - it("FreeInstall_FA_ConnectAbility_0500", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_0500-------------"); - TAG = "FreeInstall_FA_ConnectAbility_0500"; - var request5 = { - "bundleName": "com.example.different.hmservice", - "abilityName": "com.example.different.ServiceAbility", - "moduleName": "entry", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - connectabillity(TAG, request5); - setTimeout(function () { - expect(Tempassert).assertEqual("onFailed"); - console.log("------------end FreeInstall_FA_ConnectAbility_0500-------------"); - done(); - }, 2000); - }); - - /* - * @tc.number FreeInstall_FA_ConnectAbility_0600 - * @tc.name Pass in an empty bundleName - * @tc.desc Function test - * @tc.level 1 - */ - it("FreeInstall_FA_ConnectAbility_0600", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_0600-------------"); - TAG = "FreeInstall_FA_ConnectAbility_0600"; - var request6 = { - "bundleName": "", - "abilityName": "com.example.myapplication1.ServiceAbility_feature", - "moduleName": "myapplication1", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - connectabillity(TAG, request6); - setTimeout(function () { - expect(Tempassert).assertEqual("onFailed"); - console.log("------------end FreeInstall_FA_ConnectAbility_0600-------------"); - done(); - }, 2000); - }); - - /* - * @tc.number FreeInstall_FA_ConnectAbility_0700 - * @tc.name Pass in an empty abilityName - * @tc.desc Function test - * @tc.level 1 - */ - it("FreeInstall_FA_ConnectAbility_0700", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_0700-------------"); - TAG = "FreeInstall_FA_ConnectAbility_0700"; - var request7 = { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "", - "moduleName": "myapplication1", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - connectabillity(TAG, request7); - setTimeout(function () { - expect(Tempassert).assertEqual("onFailed"); - console.log("------------end FreeInstall_FA_ConnectAbility_0700-------------"); - done(); - }, 2000); - }); - - /* - * @tc.number FreeInstall_FA_ConnectAbility_0800 - * @tc.name Incorrect deviceid passed in - * @tc.desc Function test - * @tc.level 1 - */ - it("FreeInstall_FA_ConnectAbility_0800", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_0800-------------"); - TAG = "FreeInstall_FA_ConnectAbility_0800"; - var request8 = { - "deviceId": "xxxxxx", - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication2.ServiceAbility", - "moduleName": "myapplication2", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - connectabillity(TAG, request8); - setTimeout(function () { - expect(Tempassert).assertEqual("onFailed"); - console.log("------------end FreeInstall_FA_ConnectAbility_0800-------------"); - done(); - }, 2000); - }); - - /* - * @tc.number FreeInstall_FA_ConnectAbility_0900 - * @tc.name Incorrect bundleName passed in - * @tc.desc Function test - * @tc.level 1 - */ - it("FreeInstall_FA_ConnectAbility_0900", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_0900-------------"); - TAG = "FreeInstall_FA_ConnectAbility_0900"; - var request9 = { - "bundleName": "com.example.xxx.hmservice", - "abilityName": "com.example.myapplication2.ServiceAbility", - "moduleName": "myapplication2", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - connectabillity(TAG, request9); - setTimeout(function () { - expect(Tempassert).assertEqual("onFailed"); - console.log("------------end FreeInstall_FA_ConnectAbility_0900-------------"); - done(); - }, 2000); - }); - - /* - * @tc.number FreeInstall_FA_ConnectAbility_1000 - * @tc.name Incorrect flags passed in,atomic service does not exist locally - * @tc.desc Function test - * @tc.level 1 - */ - it("FreeInstall_FA_ConnectAbility_1000", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_1000-------------"); - TAG = "FreeInstall_FA_ConnectAbility_1000"; - var request10 = { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication2.ServiceAbility", - "moduleName": "myapplication2", - "flags": 1111111, - } - connectabillity(TAG, request10); - setTimeout(function () { - expect(Tempassert).assertEqual("onFailed"); - console.log("------------end FreeInstall_FA_ConnectAbility_1000-------------"); - done(); - }, 2000); - }); - - /* - * @tc.number FreeInstall_FA_ConnectAbility_1100 - * @tc.name Incorrect flags passed in,atomic service exists locally - * @tc.desc Function test - * @tc.level 0 - */ - it("FreeInstall_FA_ConnectAbility_1100", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_1100-------------"); - TAG = "FreeInstall_FA_ConnectAbility_1100"; - var cmdapp2 = "bm install -p data/test/ConnectFaMyApplication2.hap"; - abilityDelegator.executeShellCommand(cmdapp2, (err: any, d: any) => { - console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(1000); - var request11 = { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication2.ServiceAbility", - "moduleName": "myapplication2", - "flags": "11", - } - connectabillity(TAG, request11); - setTimeout(function () { - expect(Tempassert).assertEqual("onConnect"); - console.log("------------end FreeInstall_FA_ConnectAbility_1000-------------"); - done(); - }, 3000); - }); - - /* - * @tc.number FreeInstall_FA_ConnectAbility_1200 - * @tc.name No atomic service under path - * @tc.desc Function test - * @tc.level 1 - */ - it("FreeInstall_FA_ConnectAbility_1200", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_1200-------------"); - TAG = "FreeInstall_FA_ConnectAbility_1200"; - var cmdrm = "rm -r /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files/*"; - abilityDelegator.executeShellCommand(cmdrm, (err: any, d: any) => { - console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - var request12 = { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication1.ServiceAbility_feature", - "moduleName": "myapplication3", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - connectabillity(TAG, request12); - setTimeout(function () { - expect(Tempassert).assertEqual("onFailed"); - console.log("------------end FreeInstall_FA_ConnectAbility_1200-------------"); - done(); - }, 2000); - }); - - /* - * @tc.number FreeInstall_FA_ConnectAbility_1300 - * @tc.name The application is not in the foreground [start MainAbility2 first, then connect] - * @tc.desc Function test - * @tc.level 1 - */ - it("FreeInstall_FA_ConnectAbility_1300", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_1300-------------"); - TAG = "FreeInstall_FA_ConnectAbility_1300"; - var str = { - "want": { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication.MainAbility2", - } - } - console.info(TAG + " startmainability2 str: " + JSON.stringify(str)); - featureAbility.startAbility(str) - .then((data) => { - console.info(TAG + " startmainability2 successful. Data: " + JSON.stringify(data)) - }).catch((error) => { - console.error(TAG + " startmainability2 failed. Cause: " + JSON.stringify(error)); - }) - await sleep(1500); - var request13 = { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication1.ServiceAbility_feature", - "moduleName": "myapplication3", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - connectabillity(TAG, request13); - setTimeout(function () { - expect(Tempassert).assertEqual("onFailed"); - console.log("------------end FreeInstall_FA_ConnectAbility_1300-------------"); - done(); - }, 1500); - }); - - /* - * @tc.number FreeInstall_FA_ConnectAbility_1400 - * @tc.name The application is not in the foreground [start myapp2 first, then connect] - * @tc.desc Function test - * @tc.level 1 - */ - it("FreeInstall_FA_ConnectAbility_1400", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_1400-------------"); - TAG = "FreeInstall_FA_ConnectAbility_1400"; - var str = { - "want": { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication2.MainAbility", - } - } - console.info(TAG + " startmyapp2 str: " + JSON.stringify(str)); - featureAbility.startAbility(str) - .then((data) => { - console.info(TAG + " startmyapp2 successful. Data: " + JSON.stringify(data)) - }).catch((error) => { - console.error(TAG + " startmyapp2 failed. Cause: " + JSON.stringify(error)); - }) - await sleep(1500); - var request14 = { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication1.ServiceAbility_feature", - "moduleName": "myapplication3", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - connectabillity(TAG, request14); - setTimeout(function () { - expect(Tempassert).assertEqual("onFailed"); - console.log("------------end FreeInstall_FA_ConnectAbility_1400-------------"); - done(); - }, 1500); - }); - - /* - * @tc.number FreeInstall_FA_ConnectAbility_1700 - * @tc.name Do not pass flags, connect to the service of another project - * @tc.desc Function test - * @tc.level 0 - */ - it("FreeInstall_FA_ConnectAbility_1700", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_1700-------------"); - TAG = "FreeInstall_FA_ConnectAbility_1700"; - var cmddif = "bm install -p data/test/ConnectDifferentApplication.hap"; - abilityDelegator.executeShellCommand(cmddif, (err: any, d: any) => { - console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(1000); - var request17 = { - "bundleName": "com.example.different.hmservice", - "abilityName": "com.example.different.ServiceAbility", - "moduleName": "entry", - } - connectabillity(TAG, request17); - setTimeout(function () { - expect(Tempassert).assertEqual("onConnect"); - console.log("------------end FreeInstall_FA_ConnectAbility_1700-------------"); - done(); - }, 2000); - }); - - /* - * @tc.number FreeInstall_FA_ConnectAbility_1800 - * @tc.name Incorrect moduleName passed in - * @tc.desc Function test - * @tc.level 1 - */ - it("FreeInstall_FA_ConnectAbility_1800", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_1800-------------"); - TAG = "FreeInstall_FA_ConnectAbility_1800"; - var request18 = { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication1.ServiceAbility_feature", - "moduleName": "xxxxx", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - connectabillity(TAG, request18); - setTimeout(function () { - expect(Tempassert).assertEqual("onFailed"); - console.log("------------end FreeInstall_FA_ConnectAbility_1800-------------"); - done(); - }, 2000); - }); - - /* - * @tc.number FreeInstall_FA_ConnectAbility_1900 - * @tc.name The target is atomized as hapA, and hapB is placed under the path - * @tc.desc Function test - * @tc.level 1 - */ - it("FreeInstall_FA_ConnectAbility_1900", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_1900-------------"); - TAG = "FreeInstall_FA_ConnectAbility_1900"; - var cmdmyapp5 = "cp data/test/ConnectFaMyApplication5.hap /data/app/el2/100/base/com.ohos.hag.famanager/" + - "haps/entry/files"; - abilityDelegator.executeShellCommand(cmdmyapp5, (err: any, d: any) => { - console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(1000); - var request19 = { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication1.ServiceAbility_feature", - "moduleName": "myapplication3", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - connectabillity(TAG, request19); - setTimeout(function () { - expect(Tempassert).assertEqual("onFailed"); - console.log("------------end FreeInstall_FA_ConnectAbility_1900-------------"); - done(); - }, 2000); - }); - - /* - * @tc.number FreeInstall_FA_ConnectAbility_2000 - * @tc.name Pass in parameters - * @tc.desc Function test - * @tc.level 0 - */ - it("FreeInstall_FA_ConnectAbility_2000", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_2000-------------"); - TAG = "FreeInstall_FA_ConnectAbility_2000"; - var cmdmyapp5 = "cp data/test/ConnectFaMyApplication5.hap /data/app/el2/100/base/com.ohos.hag.famanager/" + - "haps/entry/files"; - abilityDelegator.executeShellCommand(cmdmyapp5, (err: any, d: any) => { - console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(1000); - var request20 = { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication5.ServiceAbility5", - "moduleName": "myapplication5", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - "parameters": { - "name": 1111, "key1": "value1", "site": "nice to meet you!" - }, - } - connectabillity(TAG, request20); - setTimeout(function () { - expect(Tempassert).assertEqual("onConnect"); - console.log("------------end FreeInstall_FA_ConnectAbility_2000-------------"); - done(); - }, 2000); - }); - } - ) + /* + * @tc.number FreeInstall_FA_ConnectAbility_0300 + * @tc.name Deviceid is empty,atomic service does not exist locally + * @tc.desc Function test + * @tc.level 0 + */ + it("FreeInstall_FA_ConnectAbility_0300", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_0300-------------"); + TAG = "FreeInstall_FA_ConnectAbility_0300"; + var cmd3 = "cp data/test/ConnectFaMyApplication1.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; + abilityDelegator.executeShellCommand(cmd3, (err: any, d: any) => { + console.info("executeShellCommand3 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + + setTimeout(async () => { + var request3 = { + "deviceId": "", + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication1.ServiceAbility_feature", + "moduleName": "myapplication1", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + connectabillity(TAG, request3); + setTimeout(() => { + expect(Tempassert).assertEqual("onConnect"); + }, 500) + }, 2000); + console.log("------------end FreeInstall_FA_ConnectAbility_0300-------------"); + done(); + }); + + /* + * @tc.number FreeInstall_FA_ConnectAbility_0400 + * @tc.name Deviceid is empty,atomic service exists locally + * @tc.desc Function test + * @tc.level 0 + */ + it("FreeInstall_FA_ConnectAbility_0400", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_0400-------------"); + TAG = "FreeInstall_FA_ConnectAbility_0400"; + var cmdapp11 = "bm install -p data/test/ConnectFaMyApplication11.hap"; + abilityDelegator.executeShellCommand(cmdapp11, (err: any, d: any) => { + console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + setTimeout(async () => { + var request4 = { + "deviceId": "", + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication11.ServiceAbility", + "moduleName": "myapplication11", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + connectabillity(TAG, request4); + setTimeout(() => { + expect(Tempassert).assertEqual("onConnect"); + }, 500) + }, 2000); + console.log("------------end FreeInstall_FA_ConnectAbility_0400-------------"); + done(); + }); + + /* + * @tc.number FreeInstall_FA_ConnectAbility_0500 + * @tc.name The bundleName passed in is different from the local + * @tc.desc Function test + * @tc.level 1 + */ + it("FreeInstall_FA_ConnectAbility_0500", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_0500-------------"); + TAG = "FreeInstall_FA_ConnectAbility_0500"; + + setTimeout(async () => { + var request5 = { + "bundleName": "com.example.different.hmservice", + "abilityName": "com.example.different.ServiceAbility", + "moduleName": "entry", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + connectabillity(TAG, request5); + setTimeout(() => { + expect(Tempassert).assertEqual("onFailed"); + }, 500) + }, 2000); + console.log("------------end FreeInstall_FA_ConnectAbility_0500-------------"); + done(); + }); + + /* + * @tc.number FreeInstall_FA_ConnectAbility_0600 + * @tc.name Pass in an empty bundleName + * @tc.desc Function test + * @tc.level 1 + */ + it("FreeInstall_FA_ConnectAbility_0600", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_0600-------------"); + TAG = "FreeInstall_FA_ConnectAbility_0600"; + + setTimeout(async () => { + var request6 = { + "bundleName": "", + "abilityName": "com.example.myapplication1.ServiceAbility_feature", + "moduleName": "myapplication1", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + connectabillity(TAG, request6); + setTimeout(() => { + expect(Tempassert).assertEqual("onFailed"); + }, 500) + }, 2000); + console.log("------------end FreeInstall_FA_ConnectAbility_0600-------------"); + done(); + }); + + /* + * @tc.number FreeInstall_FA_ConnectAbility_0700 + * @tc.name Pass in an empty abilityName + * @tc.desc Function test + * @tc.level 1 + */ + it("FreeInstall_FA_ConnectAbility_0700", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_0700-------------"); + TAG = "FreeInstall_FA_ConnectAbility_0700"; + + setTimeout(async () => { + var request7 = { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "", + "moduleName": "myapplication1", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + connectabillity(TAG, request7); + setTimeout(() => { + expect(Tempassert).assertEqual("onFailed"); + }, 500) + }, 2000); + console.log("------------end FreeInstall_FA_ConnectAbility_0700-------------"); + done(); + }); + + /* + * @tc.number FreeInstall_FA_ConnectAbility_0800 + * @tc.name Incorrect deviceid passed in + * @tc.desc Function test + * @tc.level 1 + */ + it("FreeInstall_FA_ConnectAbility_0800", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_0800-------------"); + TAG = "FreeInstall_FA_ConnectAbility_0800"; + + setTimeout(async () => { + var request8 = { + "deviceId": "xxxxxx", + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication2.ServiceAbility", + "moduleName": "myapplication2", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + connectabillity(TAG, request8); + setTimeout(() => { + expect(Tempassert).assertEqual("onFailed"); + }, 500) + }, 2000); + console.log("------------end FreeInstall_FA_ConnectAbility_0800-------------"); + done(); + }); + + /* + * @tc.number FreeInstall_FA_ConnectAbility_0900 + * @tc.name Incorrect bundleName passed in + * @tc.desc Function test + * @tc.level 1 + */ + it("FreeInstall_FA_ConnectAbility_0900", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_0900-------------"); + TAG = "FreeInstall_FA_ConnectAbility_0900"; + + setTimeout(async () => { + var request9 = { + "bundleName": "com.example.xxx.hmservice", + "abilityName": "com.example.myapplication2.ServiceAbility", + "moduleName": "myapplication2", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + connectabillity(TAG, request9); + setTimeout(() => { + expect(Tempassert).assertEqual("onFailed"); + }, 500) + }, 2000); + console.log("------------end FreeInstall_FA_ConnectAbility_0900-------------"); + done(); + }); + + /* + * @tc.number FreeInstall_FA_ConnectAbility_1000 + * @tc.name Incorrect flags passed in,atomic service does not exist locally + * @tc.desc Function test + * @tc.level 1 + */ + it("FreeInstall_FA_ConnectAbility_1000", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_1000-------------"); + TAG = "FreeInstall_FA_ConnectAbility_1000"; + + setTimeout(async () => { + var request10 = { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication2.ServiceAbility", + "moduleName": "myapplication2", + "flags": 1111111, + } + connectabillity(TAG, request10); + setTimeout(() => { + expect(Tempassert).assertEqual("onFailed"); + }, 500) + }, 2000); + console.log("------------end FreeInstall_FA_ConnectAbility_1000-------------"); + done(); + }); + + /* + * @tc.number FreeInstall_FA_ConnectAbility_1100 + * @tc.name Incorrect flags passed in,atomic service exists locally + * @tc.desc Function test + * @tc.level 0 + */ + it("FreeInstall_FA_ConnectAbility_1100", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_1100-------------"); + TAG = "FreeInstall_FA_ConnectAbility_1100"; + var cmdapp2 = "bm install -p data/test/ConnectFaMyApplication2.hap"; + abilityDelegator.executeShellCommand(cmdapp2, (err: any, d: any) => { + console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + + setTimeout(async () => { + var request11 = { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication2.ServiceAbility", + "moduleName": "myapplication2", + "flags": "11", + } + connectabillity(TAG, request11); + setTimeout(() => { + expect(Tempassert).assertEqual("onConnect"); + }, 500) + }, 2000); + console.log("------------end FreeInstall_FA_ConnectAbility_1000-------------"); + done(); + }); + + /* + * @tc.number FreeInstall_FA_ConnectAbility_1200 + * @tc.name No atomic service under path + * @tc.desc Function test + * @tc.level 1 + */ + it("FreeInstall_FA_ConnectAbility_1200", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_1200-------------"); + TAG = "FreeInstall_FA_ConnectAbility_1200"; + var cmdrm = "rm -r /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files/*"; + abilityDelegator.executeShellCommand(cmdrm, (err: any, d: any) => { + console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + setTimeout(async () => { + var request12 = { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication1.ServiceAbility_feature", + "moduleName": "myapplication3", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + connectabillity(TAG, request12); + setTimeout(() => { + expect(Tempassert).assertEqual("onFailed"); + }, 500) + }, 2000); + console.log("------------end FreeInstall_FA_ConnectAbility_1200-------------"); + done(); + }); + + /* + * @tc.number FreeInstall_FA_ConnectAbility_1300 + * @tc.name The application is not in the foreground [start MainAbility2 first, then connect] + * @tc.desc Function test + * @tc.level 1 + */ + it("FreeInstall_FA_ConnectAbility_1300", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_1300-------------"); + TAG = "FreeInstall_FA_ConnectAbility_1300"; + var str = { + "want": { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication.MainAbility2", + } + } + console.info(TAG + " startmainability2 str: " + JSON.stringify(str)); + featureAbility.startAbility(str) + .then((data) => { + console.info(TAG + " startmainability2 successful. Data: " + JSON.stringify(data)) + }).catch((error) => { + console.error(TAG + " startmainability2 failed. Cause: " + JSON.stringify(error)); + }) + + setTimeout(async () => { + var request13 = { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication1.ServiceAbility_feature", + "moduleName": "myapplication3", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + connectabillity(TAG, request13); + setTimeout(() => { + expect(Tempassert).assertEqual("onFailed"); + }, 500) + }, 2000); + console.log("------------end FreeInstall_FA_ConnectAbility_1300-------------"); + done(); + }); + + }) } \ No newline at end of file diff --git a/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest1.ets b/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest1.ets index e565491bc46ce2e45a13ebee915798feb705af83..38282979cc69d511a3088c9a27d335706456b0a2 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest1.ets +++ b/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/ConnectAbilityTest1.ets @@ -24,186 +24,338 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry export default function ConnectAbilityTest1() { - var TAG = ""; - var Tempassert = ""; - var abilityDelegator = undefined + var TAG = ""; + var Tempassert = ""; + var abilityDelegator = undefined - function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)) - } + function sleep(time) { + return new Promise((resolve) => setTimeout(resolve, time)) + } - describe('FreeInstall_FA_ConnectAbility', function () { - beforeAll(async function (done) { - console.info("FreeInstall_FA_ConnectAbility before all called"); - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var cmd = "bm install -p data/test/MockService.hap"; - console.info("cmd : " + cmd) - console.info(TAG + " abilityDelegator : " + JSON.stringify(abilityDelegator)); - abilityDelegator.executeShellCommand(cmd, (err: any, d: any) => { - console.info("executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - var cmd1 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry"; - abilityDelegator.executeShellCommand(cmd1, (err: any, d: any) => { - console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - var cmd2 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; - abilityDelegator.executeShellCommand(cmd2, (err: any, d: any) => { - console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - done(); - }) - }); - - afterEach(async function (done) { - console.info("FreeInstall_FA_ConnectAbility after each called"); - Tempassert = "" - await sleep(1000); - if ("FreeInstall_FA_ConnectAbility_1600" === TAG) { - var cmd14 = "bm uninstall -n com.ohos.hag.famanager"; - abilityDelegator.executeShellCommand(cmd14, (err: any, d: any) => { - console.info("executeShellCommand14 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - } - await sleep(500); + describe('FreeInstall_FA_ConnectAbilityOne', function () { + beforeAll(async function (done) { + console.info("FreeInstall_FA_ConnectAbility before all called"); + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var cmd = "bm install -p data/test/MockService.hap"; + console.info("cmd : " + cmd) + console.info(TAG + " abilityDelegator : " + JSON.stringify(abilityDelegator)); + abilityDelegator.executeShellCommand(cmd, (err: any, d: any) => { + console.info("executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + var cmd1 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry"; + abilityDelegator.executeShellCommand(cmd1, (err: any, d: any) => { + console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + var cmd2 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; + abilityDelegator.executeShellCommand(cmd2, (err: any, d: any) => { + console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); done(); - }); - - function tips(msg) { - Prompt.showToast({ - message: msg, - duration: 2000, - bottom: '150px' - }); + }) + }); + + afterEach(async function (done) { + console.info("FreeInstall_FA_ConnectAbility after each called"); + Tempassert = "" + if ("FreeInstall_FA_ConnectAbility_1600" === TAG) { + var cmd14 = "bm uninstall -n com.ohos.hag.famanager"; + abilityDelegator.executeShellCommand(cmd14, (err: any, d: any) => { + console.info("executeShellCommand14 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + } + done(); + }); + + function tips(msg) { + Prompt.showToast({ + message: msg, + duration: 2000, + bottom: '150px' + }); + } + + async function connectabillity(msg, request) { + console.info(msg + "START"); + let options = { + onConnect: function (element, proxy) { + console.info("FreeInstall_FA_ConnectAbility onConnect success!!!") + console.info(msg + " onConnect success!!! "); + console.info(msg + " onConnect: " + JSON.stringify(element)); + console.info(msg + " onConnect: " + JSON.stringify(proxy)); + if (proxy == null) { + console.error("FreeInstall_FA_ConnectAbility proxy null"); + return; + } + let option = new rpc.MessageOption(); + let data = new rpc.MessageParcel(); + let reply = new rpc.MessageParcel(); + data.writeInterfaceToken("ohos.appexecfwk.IApplicationStateObserver"); + proxy.sendRequest(0, data, reply, option); + Tempassert = "onConnect"; + tips("连接成功"); + }, + onDisconnect: function (element) { + console.info("FreeInstall_FA_ConnectAbility onDisconnect success!!!") + console.info(msg + " onDisconnect success!!!"); + console.info(msg + " onDisconnect: " + JSON.stringify(element)); + Tempassert = "onDisconnect"; + tips("连接断开"); + }, + onFailed: function (code) { + console.info("FreeInstall_FA_ConnectAbility onFailed!!!") + console.info(msg + " onFailed!!! "); + console.info(msg + " onFailed: " + JSON.stringify(code)); + Tempassert = "onFailed"; + tips("连接失败"); } + } + let connection = await featureAbility.connectAbility(request, options); + console.info(msg + "request:" + JSON.stringify(request)); + console.info(msg + "options:" + JSON.stringify(options)); + console.info(msg + "connection=" + JSON.stringify(connection)); + console.info(msg + "END"); + } - async function connectabillity(msg, request) { - console.info(msg + "START"); - let options = { - onConnect: function (element, proxy) { - console.info("FreeInstall_FA_ConnectAbility onConnect success!!!") - console.info(msg + " onConnect success!!! "); - console.info(msg + " onConnect: " + JSON.stringify(element)); - console.info(msg + " onConnect: " + JSON.stringify(proxy)); - if (proxy == null) { - console.error("FreeInstall_FA_ConnectAbility proxy null"); - return; - } - let option = new rpc.MessageOption(); - let data = new rpc.MessageParcel(); - let reply = new rpc.MessageParcel(); - data.writeInterfaceToken("ohos.appexecfwk.IApplicationStateObserver"); - proxy.sendRequest(0, data, reply, option); - Tempassert = "onConnect"; - tips("连接成功"); - }, - onDisconnect: function (element) { - console.info("FreeInstall_FA_ConnectAbility onDisconnect success!!!") - console.info(msg + " onDisconnect success!!!"); - console.info(msg + " onDisconnect: " + JSON.stringify(element)); - Tempassert = "onDisconnect"; - tips("连接断开"); - }, - onFailed: function (code) { - console.info("FreeInstall_FA_ConnectAbility onFailed!!!") - console.info(msg + " onFailed!!! "); - console.info(msg + " onFailed: " + JSON.stringify(code)); - Tempassert = "onFailed"; - tips("连接失败"); - } - } - let connection = await featureAbility.connectAbility(request, options); - console.info(msg + "request:" + JSON.stringify(request)); - console.info(msg + "options:" + JSON.stringify(options)); - console.info(msg + "connection=" + JSON.stringify(connection)); - console.info(msg + "END"); + + + /* + * @tc.number FreeInstall_FA_ConnectAbility_1500 + * @tc.name The application is not in the foreground, + [start another project first, then connect,atomic service does not exist locally] + * @tc.desc Function test + * @tc.level 1 + */ + it("FreeInstall_FA_ConnectAbility_1500", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_1500-------------"); + TAG = "FreeInstall_FA_ConnectAbility_1500"; + var cmddif = "bm install -p data/test/ConnectDifferentApplication.hap"; + abilityDelegator.executeShellCommand(cmddif, (err: any, d: any) => { + console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + var str = { + "want": { + "bundleName": "com.example.different.hmservice", + "abilityName": "MainAbility", + } + }; + featureAbility.startAbility(str) + .then((data) => { + console.info(TAG + " startother successful. Data: " + JSON.stringify(data)) + }).catch((error) => { + console.error(TAG + " startother failed. Cause: " + JSON.stringify(error)); + }) + setTimeout(async () => { + var request15 = { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication5.ServiceAbility5", + "moduleName": "myapplication5", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, } + connectabillity(TAG, request15); + setTimeout(() => { + expect(Tempassert).assertEqual("onFailed"); + }, 500) + }, 2000); + console.log("------------end FreeInstall_FA_ConnectAbility_1500-------------"); + done(); + }); + /* + * @tc.number FreeInstall_FA_ConnectAbility_1600 + * @tc.name The application is not in the foreground, + [start another project first, then connect,atomic service exists locally] + * @tc.desc Function test + * @tc.level 1 + */ + it("FreeInstall_FA_ConnectAbility_1600", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_1600-------------"); + TAG = "FreeInstall_FA_ConnectAbility_1600"; + var cmdmyapp4 = "bm install -p data/test/ConnectFaMyApplication4.hap"; + abilityDelegator.executeShellCommand(cmdmyapp4, (err: any, d: any) => { + console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + var str = { + "want": { + "bundleName": "com.example.different.hmservice", + "abilityName": "MainAbility", + } + }; + featureAbility.startAbility(str) + .then((data) => { + console.info(TAG + " startother successful. Data: " + JSON.stringify(data)) + }).catch((error) => { + console.error(TAG + " startother failed. Cause: " + JSON.stringify(error)); + }) + setTimeout(function () { + var request16 = { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication4.ServiceAbility4", + "moduleName": "myapplication4", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + connectabillity(TAG, request16); + setTimeout(() => { + expect(Tempassert).assertEqual("onConnect"); + }, 500) + }, 2000); + console.log("------------end FreeInstall_FA_ConnectAbility_1600-------------"); + done(); + }); - /* - * @tc.number FreeInstall_FA_ConnectAbility_1500 - * @tc.name The application is not in the foreground, - [start another project first, then connect,atomic service does not exist locally] - * @tc.desc Function test - * @tc.level 1 - */ - it("FreeInstall_FA_ConnectAbility_1500", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_1500-------------"); - TAG = "FreeInstall_FA_ConnectAbility_1500"; - var cmddif = "bm install -p data/test/ConnectDifferentApplication.hap"; - abilityDelegator.executeShellCommand(cmddif, (err: any, d: any) => { - console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(1000); - var str = { - "want": { - "bundleName": "com.example.different.hmservice", - "abilityName": "MainAbility", - } - }; - featureAbility.startAbility(str) - .then((data) => { - console.info(TAG + " startother successful. Data: " + JSON.stringify(data)) - }).catch((error) => { - console.error(TAG + " startother failed. Cause: " + JSON.stringify(error)); - }) - await sleep(1500); - var request15 = { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication5.ServiceAbility5", - "moduleName": "myapplication5", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - connectabillity(TAG, request15); - setTimeout(function () { - expect(Tempassert).assertEqual("onFailed"); - console.log("------------end FreeInstall_FA_ConnectAbility_1500-------------"); - done(); - }, 1500); - }); - - /* - * @tc.number FreeInstall_FA_ConnectAbility_1600 - * @tc.name The application is not in the foreground, - [start another project first, then connect,atomic service exists locally] - * @tc.desc Function test - * @tc.level 1 - */ - it("FreeInstall_FA_ConnectAbility_1600", 0, async function (done) { - console.log("------------start FreeInstall_FA_ConnectAbility_1600-------------"); - TAG = "FreeInstall_FA_ConnectAbility_1600"; - var cmdmyapp4 = "bm install -p data/test/ConnectFaMyApplication4.hap"; - abilityDelegator.executeShellCommand(cmdmyapp4, (err: any, d: any) => { - console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(1000); - var str = { - "want": { - "bundleName": "com.example.different.hmservice", - "abilityName": "MainAbility", - } - }; - featureAbility.startAbility(str) - .then((data) => { - console.info(TAG + " startother successful. Data: " + JSON.stringify(data)) - }).catch((error) => { - console.error(TAG + " startother failed. Cause: " + JSON.stringify(error)); - }) - await sleep(1500); - var request16 = { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication4.ServiceAbility4", - "moduleName": "myapplication4", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - connectabillity(TAG, request16); - setTimeout(function () { - expect(Tempassert).assertEqual("onConnect"); - console.log("------------end FreeInstall_FA_ConnectAbility_1600-------------"); - done(); - }, 1500); - }); - } - ) + /* + * @tc.number FreeInstall_FA_ConnectAbility_1400 + * @tc.name The application is not in the foreground [start myapp2 first, then connect] + * @tc.desc Function test + * @tc.level 1 + */ + it("FreeInstall_FA_ConnectAbility_1400", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_1400-------------"); + TAG = "FreeInstall_FA_ConnectAbility_1400"; + var str = { + "want": { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication2.MainAbility", + } + } + console.info(TAG + " startmyapp2 str: " + JSON.stringify(str)); + featureAbility.startAbility(str) + .then((data) => { + console.info(TAG + " startmyapp2 successful. Data: " + JSON.stringify(data)) + }).catch((error) => { + console.error(TAG + " startmyapp2 failed. Cause: " + JSON.stringify(error)); + }) + setTimeout(() => { + var request14 = { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication1.ServiceAbility_feature", + "moduleName": "myapplication3", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + connectabillity(TAG, request14); + setTimeout(async () => { + expect(Tempassert).assertEqual("onFailed"); + }, 500); + }, 2000) + done(); + console.log("------------end FreeInstall_FA_ConnectAbility_1400-------------"); + }); + + /* + * @tc.number FreeInstall_FA_ConnectAbility_1700 + * @tc.name Do not pass flags, connect to the service of another project + * @tc.desc Function test + * @tc.level 0 + */ + it("FreeInstall_FA_ConnectAbility_1700", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_1700-------------"); + TAG = "FreeInstall_FA_ConnectAbility_1700"; + var cmddif = "bm install -p data/test/ConnectDifferentApplication.hap"; + await abilityDelegator.executeShellCommand(cmddif, (err: any, d: any) => { + console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + setTimeout(() => { + var request17 = { + "bundleName": "com.example.different.hmservice", + "abilityName": "com.example.different.ServiceAbility", + "moduleName": "entry", + } + connectabillity(TAG, request17); + setTimeout(() => { + expect(Tempassert).assertEqual("onConnect"); + }, 500); + }, 2000) + console.log("------------end FreeInstall_FA_ConnectAbility_1700-------------"); + done(); + }); + + /* + * @tc.number FreeInstall_FA_ConnectAbility_1800 + * @tc.name Incorrect moduleName passed in + * @tc.desc Function test + * @tc.level 1 + */ + it("FreeInstall_FA_ConnectAbility_1800", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_1800-------------"); + TAG = "FreeInstall_FA_ConnectAbility_1800"; + + setTimeout(async () => { + var request18 = { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication1.ServiceAbility_feature", + "moduleName": "xxxxx", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + connectabillity(TAG, request18); + setTimeout(() => { + expect(Tempassert).assertEqual("onFailed"); + }, 500) + }, 2000); + console.log("------------end FreeInstall_FA_ConnectAbility_1800-------------"); + done(); + }); + + /* + * @tc.number FreeInstall_FA_ConnectAbility_1900 + * @tc.name The target is atomized as hapA, and hapB is placed under the path + * @tc.desc Function test + * @tc.level 1 + */ + it("FreeInstall_FA_ConnectAbility_1900", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_1900-------------"); + TAG = "FreeInstall_FA_ConnectAbility_1900"; + var cmdmyapp5 = "cp data/test/ConnectFaMyApplication5.hap /data/app/el2/100/base/com.ohos.hag.famanager/" + + "haps/entry/files"; + await abilityDelegator.executeShellCommand(cmdmyapp5, (err: any, d: any) => { + console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + setTimeout(async () => { + var request19 = { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication1.ServiceAbility_feature", + "moduleName": "myapplication3", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + connectabillity(TAG, request19); + setTimeout(() => { + expect(Tempassert).assertEqual("onFailed"); + }, 500) + }, 2000); + console.log("------------end FreeInstall_FA_ConnectAbility_1900-------------"); + done(); + }); + + /* + * @tc.number FreeInstall_FA_ConnectAbility_2000 + * @tc.name Pass in parameters + * @tc.desc Function test + * @tc.level 0 + */ + it("FreeInstall_FA_ConnectAbility_2000", 0, async function (done) { + console.log("------------start FreeInstall_FA_ConnectAbility_2000-------------"); + TAG = "FreeInstall_FA_ConnectAbility_2000"; + var cmdmyapp5 = "cp data/test/ConnectFaMyApplication5.hap /data/app/el2/100/base/com.ohos.hag.famanager/" + + "haps/entry/files"; + abilityDelegator.executeShellCommand(cmdmyapp5, (err: any, d: any) => { + console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + setTimeout(async () => { + var request20 = { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication5.ServiceAbility5", + "moduleName": "myapplication5", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + "parameters": { + "name": 1111, "key1": "value1", "site": "nice to meet you!" + }, + } + connectabillity(TAG, request20); + setTimeout(() => { + expect(Tempassert).assertEqual("onConnect"); + }, 500) + }, 4000) + done(); + console.log("------------end FreeInstall_FA_ConnectAbility_2000-------------"); + }); + } + ) } \ No newline at end of file diff --git a/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/List.test.ets b/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/List.test.ets index f2b84b5796ddac70ace6d58750429150c694a266..aa2458c2368fb48ec5d92f50100d62318764c5bb 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/List.test.ets +++ b/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/List.test.ets @@ -12,13 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import ConnectAbilityTest1 from './ConnectAbilityTest1' -import ConnectAbilityTest from './ConnectAbilityTest' import connectAbilityTest_PA from './connectAbilityTest_PA' +import ConnectAbilityTest from './ConnectAbilityTest' +import ConnectAbilityTest1 from './ConnectAbilityTest1' -export default function testsuite() { - ConnectAbilityTest1(); - ConnectAbilityTest(); - connectAbilityTest_PA(); -} \ No newline at end of file +export default function testsuite() { + connectAbilityTest_PA(); + ConnectAbilityTest(); + ConnectAbilityTest1(); +} diff --git a/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/connectAbilityTest_PA.ets b/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/connectAbilityTest_PA.ets index 4299794aa59c635b3c6da78178c9863b26e89c9e..eb881f329b0e0e150018be662d788eb9fae51037 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/connectAbilityTest_PA.ets +++ b/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility/test/connectAbilityTest_PA.ets @@ -26,7 +26,7 @@ export default function connectAbilityTest_PA() { var subscriber; var subscribeInfo = { events: ["service_event", "service2_event", "service3_event", "service4_event", "service5_event", - "service6_event", "service7_event", "service8_event", "service9_event", "service10_event", "service11_event"] + "service6_event", "service7_event", "service8_event", "service9_event", "service10_event", "service11_event"] }; function sleep(time) { @@ -39,8 +39,8 @@ export default function connectAbilityTest_PA() { .then((data) => { console.info(msg + ' startService successful. Data: ' + JSON.stringify(data)); }).catch((error) => { - console.error(msg + ' startService failed. Cause: ' + JSON.stringify(error)); - }) + console.error(msg + ' startService failed. Cause: ' + JSON.stringify(error)); + }) } function checkParameters(msg1, data) { @@ -144,14 +144,14 @@ export default function connectAbilityTest_PA() { dataAssert = "" await sleep(1000); if ("FreeInstall_FA_ConnectAbility_PA_1100" === TAG) { - var cmd14 = "bm uninstall -n com.ohos.hag.famanager"; - abilityDelegator.executeShellCommand(cmd14, (err: any, d: any) => { - console.info("executeShellCommand14 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - } - await sleep(500); - done(); - }); + var cmd14 = "bm uninstall -n com.ohos.hag.famanager"; + abilityDelegator.executeShellCommand(cmd14, (err: any, d: any) => { + console.info("executeShellCommand14 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + } + await sleep(500); + done(); + }); /* * @tc.number FreeInstall_FA_ConnectAbility_PA_0100 @@ -163,24 +163,23 @@ export default function connectAbilityTest_PA() { console.log("------------start FreeInstall_FA_ConnectAbility_PA_0100-------------"); TAG = "FreeInstall_FA_ConnectAbility_PA_0100"; var cmdmyapp7 = "cp data/test/ConnectFaMyApplication7.hap /data/app/el2/100/base/com.ohos.hag.famanager/" + - "haps/entry/files"; + "haps/entry/files"; abilityDelegator.executeShellCommand(cmdmyapp7, (err: any, d: any) => { console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) - await sleep(500); - var str1 = { - "want": { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication.ServiceAbility", - } - }; - startService(TAG, str1); - setTimeout(function () { + setTimeout(async () => { + var str1 = { + "want": { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication.ServiceAbility", + } + }; + startService(TAG, str1); console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert)); expect(dataAssert).assertEqual("onConnect"); console.log("------------end FreeInstall_FA_ConnectAbility_PA_0100-------------"); - done(); }, 4000); + done(); }); /* @@ -196,20 +195,19 @@ export default function connectAbilityTest_PA() { abilityDelegator.executeShellCommand(cmdapp9, (err: any, d: any) => { console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) - await sleep(500); - var str2 = { - "want": { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication.ServiceAbility2", - } - }; - startService(TAG, str2); - setTimeout(function () { + setTimeout(async () => { + var str2 = { + "want": { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication.ServiceAbility2", + } + }; + startService(TAG, str2); console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert)); expect(dataAssert).assertEqual("onConnect"); console.log("------------end FreeInstall_FA_ConnectAbility_PA_0200-------------"); - done(); }, 4000); + done(); }); /* @@ -221,19 +219,19 @@ export default function connectAbilityTest_PA() { it("FreeInstall_FA_ConnectAbility_PA_0300", 0, async function (done) { console.log("------------start FreeInstall_FA_ConnectAbility_PA_0300-------------"); TAG = "FreeInstall_FA_ConnectAbility_PA_0300"; - var str3 = { - "want": { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication.ServiceAbility3", - } - }; - startService(TAG, str3); - setTimeout(function () { + setTimeout(async () => { + var str3 = { + "want": { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication.ServiceAbility3", + } + }; + startService(TAG, str3); console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert)); expect(dataAssert).assertEqual("onFailed"); console.log("------------end FreeInstall_FA_ConnectAbility_PA_0300-------------"); - done(); }, 4000); + done(); }); /* @@ -244,20 +242,20 @@ export default function connectAbilityTest_PA() { */ it("FreeInstall_FA_ConnectAbility_PA_0400", 0, async function (done) { console.log("------------start FreeInstall_FA_ConnectAbility_PA_0400-------------"); - TAG = "FreeInstall_FA_ConnectAbility_PA_0400"; - var str4 = { - "want": { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication.ServiceAbility4", - } - }; - startService(TAG, str4); - setTimeout(function () { + setTimeout(async () => { + TAG = "FreeInstall_FA_ConnectAbility_PA_0400"; + var str4 = { + "want": { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication.ServiceAbility4", + } + }; + startService(TAG, str4); console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert)); expect(dataAssert).assertEqual("onFailed"); console.log("------------end FreeInstall_FA_ConnectAbility_PA_0400-------------"); - done(); }, 4000); + done(); }); /* @@ -273,20 +271,19 @@ export default function connectAbilityTest_PA() { abilityDelegator.executeShellCommand(cmdin, (err: any, d: any) => { console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) - await sleep(500); - var str5 = { - "want": { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication.ServiceAbility5", - } - }; - startService(TAG, str5); - setTimeout(function () { + setTimeout(async () => { + var str5 = { + "want": { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication.ServiceAbility5", + } + }; + startService(TAG, str5); console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert)); expect(dataAssert).assertEqual("onConnect"); console.log("------------end FreeInstall_FA_ConnectAbility_PA_0500-------------"); - done(); }, 4000); + done(); }); /* @@ -298,19 +295,19 @@ export default function connectAbilityTest_PA() { it("FreeInstall_FA_ConnectAbility_PA_0600", 0, async function (done) { console.log("------------start FreeInstall_FA_ConnectAbility_PA_0600-------------"); TAG = "FreeInstall_FA_ConnectAbility_PA_0600"; - var str6 = { - "want": { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication.ServiceAbility6", - } - }; - startService(TAG, str6); - setTimeout(function () { + setTimeout(async () => { + var str6 = { + "want": { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication.ServiceAbility6", + } + }; + startService(TAG, str6); console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert)); expect(dataAssert).assertEqual("onFailed"); console.log("------------end FreeInstall_FA_ConnectAbility_PA_0600-------------"); - done(); }, 4000); + done(); }); /* @@ -322,19 +319,20 @@ export default function connectAbilityTest_PA() { it("FreeInstall_FA_ConnectAbility_PA_0700", 0, async function (done) { console.log("------------start FreeInstall_FA_ConnectAbility_PA_0700-------------"); TAG = "FreeInstall_FA_ConnectAbility_PA_0700"; - var str7 = { - "want": { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication.ServiceAbility7", - } - }; - startService(TAG, str7); - setTimeout(function () { + + setTimeout(async () => { + var str7 = { + "want": { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication.ServiceAbility7", + } + }; + startService(TAG, str7); console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert)); expect(dataAssert).assertEqual("onFailed"); console.log("------------end FreeInstall_FA_ConnectAbility_PA_0700-------------"); - done(); }, 4000); + done(); }); /* @@ -346,19 +344,20 @@ export default function connectAbilityTest_PA() { it("FreeInstall_FA_ConnectAbility_PA_0800", 0, async function (done) { console.log("------------start FreeInstall_FA_ConnectAbility_PA_0800-------------"); TAG = "FreeInstall_FA_ConnectAbility_PA_0800"; - var str8 = { - "want": { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication.ServiceAbility8", - } - }; - startService(TAG, str8); - setTimeout(function () { + + setTimeout(async () => { + var str8 = { + "want": { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication.ServiceAbility8", + } + }; + startService(TAG, str8); console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert)); expect(dataAssert).assertEqual("onFailed"); console.log("------------end FreeInstall_FA_ConnectAbility_PA_0800-------------"); - done(); }, 4000); + done(); }); /* @@ -374,20 +373,21 @@ export default function connectAbilityTest_PA() { abilityDelegator.executeShellCommand(cmdrm, (err: any, d: any) => { console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) - await sleep(500); - var str9 = { - "want": { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication.ServiceAbility9", - } - }; - startService(TAG, str9); - setTimeout(function () { + + setTimeout(async () => { + await sleep(500); + var str9 = { + "want": { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication.ServiceAbility9", + } + }; + startService(TAG, str9); console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert)); expect(dataAssert).assertEqual("onFailed"); console.log("------------end FreeInstall_FA_ConnectAbility_PA_0900-------------"); - done(); }, 4000); + done(); }); /* @@ -399,19 +399,20 @@ export default function connectAbilityTest_PA() { it("FreeInstall_FA_ConnectAbility_PA_1000", 0, async function (done) { console.log("------------start FreeInstall_FA_ConnectAbility_PA_1000-------------"); TAG = "FreeInstall_FA_ConnectAbility_PA_1000"; - var str10 = { - "want": { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication.ServiceAbility10", - } - }; - startService(TAG, str10); - setTimeout(function () { + + setTimeout(async () => { + var str10 = { + "want": { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication.ServiceAbility10", + } + }; + startService(TAG, str10); console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert)); expect(dataAssert).assertEqual("onFailed"); console.log("------------end FreeInstall_FA_ConnectAbility_PA_1000-------------"); - done(); }, 4000); + done(); }); /* @@ -424,24 +425,24 @@ export default function connectAbilityTest_PA() { console.log("------------start FreeInstall_FA_ConnectAbility_PA_1100-------------"); TAG = "FreeInstall_FA_ConnectAbility_PA_1100"; var cmdmyapp8 = "cp data/test/ConnectFaMyApplication8.hap /data/app/el2/100/base/com.ohos.hag.famanager/" + - "haps/entry/files"; + "haps/entry/files"; abilityDelegator.executeShellCommand(cmdmyapp8, (err: any, d: any) => { console.info(TAG + " executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) - await sleep(1000); - var str11 = { - "want": { - "bundleName": "com.example.myapplication.hmservice", - "abilityName": "com.example.myapplication.ServiceAbility11", - } - }; - startService(TAG, str11); - setTimeout(function () { + + setTimeout(async () => { + var str11 = { + "want": { + "bundleName": "com.example.myapplication.hmservice", + "abilityName": "com.example.myapplication.ServiceAbility11", + } + }; + startService(TAG, str11); console.info(TAG + " SubscribeCallBack data: " + JSON.stringify(dataAssert)); expect(dataAssert).assertEqual("onConnect"); console.log("------------end FreeInstall_FA_ConnectAbility_PA_1100-------------"); - done(); }, 4000); + done(); }); } ) diff --git a/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility2/app.ets b/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility2/app.ets index aa1409851eb7fb28004f07317e1dfda41bba854e..e8365db76032242ed94923794cb515d0e0e77555 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility2/app.ets +++ b/ability/ability_runtime/freeinstalltest/connectabilityfatest/actsfreeinstallconnectabilityfatest/entry/src/main/ets/MainAbility2/app.ets @@ -17,7 +17,7 @@ import featureAbility from '@ohos.ability.featureAbility'; export default { onCreate() { console.info('Application onCreate') - setTimeout(function () { + setTimeout(()=> { featureAbility.terminateSelf() .then((data) => { console.info('[Demo] MainAbility2 terminateself succeeded: ' + data); diff --git a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectdifferentapplication/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectdifferentapplication/entry/src/main/module.json index 8f91deeb5036e3c086c8cf2dd76f7cc48db8bbd9..a44ae73f28adf7a47dbf4173dbf6f558b3894485 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectdifferentapplication/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectdifferentapplication/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication1/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication1/entry/src/main/config.json index 703f0577eae146eaa0b690c75865e82df32afe55..72d22a6dabe6a140ff5c3ff7f5ab8ff8efa89002 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication1/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication1/entry/src/main/config.json @@ -16,6 +16,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication10/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication10/entry/src/main/config.json index c9c5fcbc8c1809937dd4ad3233f736d4d53af693..7142d1ac2e1f44d85e03e785afad711cd71ca9f8 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication10/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication10/entry/src/main/config.json @@ -16,6 +16,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication11/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication11/entry/src/main/config.json index 479a7ba322aa1f377769d0e16b288179fcab7d56..08da3726530de9713e7b7af3735b84668c5e4a1e 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication11/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication11/entry/src/main/config.json @@ -16,6 +16,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication2/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication2/entry/src/main/config.json index 7f010dcdae4e669ff6d6f705646d921cbed6f850..0aa213f4efd9f8cf1d47e7c8b160b462ddd66345 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication2/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication2/entry/src/main/config.json @@ -16,6 +16,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication4/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication4/entry/src/main/config.json index d1f33c1f4ebdb047fa85ae995612dddcd86100e4..62552e6ef1d8daa4c186ddbf35456d8fd1a659a4 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication4/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication4/entry/src/main/config.json @@ -16,6 +16,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication5/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication5/entry/src/main/config.json index 7a109ddf89c5462ed09dcd56abac2e780b08fceb..b4aff27cf1b30a96ffeb662468bbc3492b802cc0 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication5/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication5/entry/src/main/config.json @@ -16,6 +16,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication6/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication6/entry/src/main/config.json index 6d5e2c816058156690c09c387696e3be51590203..c8d4f645ff73d94728bd8a11165cdfcabc5260da 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication6/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication6/entry/src/main/config.json @@ -16,6 +16,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication7/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication7/entry/src/main/config.json index d9aa6532c25b50ebafc085db7afd2e7b04b9c810..911a5f7486df757bcc1cefe02860b7f3fe0e4b19 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication7/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication7/entry/src/main/config.json @@ -16,6 +16,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication8/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication8/entry/src/main/config.json index bc9ea9babe948f2c9e1179f0227ee3a07d5662c1..6e36e87bfaf0459c8503e4c9f3ff84ac72506fa7 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication8/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication8/entry/src/main/config.json @@ -16,6 +16,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication9/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication9/entry/src/main/config.json index 757fd90f50233b0c623bb58343119bbf2b1e4484..842927fc82bb3043c919bd46a311c2d8fa6da9e7 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication9/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/connectabilityfatest/connectfamyapplication9/entry/src/main/config.json @@ -16,6 +16,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/actsfreeinstallconnectabilitystagetest/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/actsfreeinstallconnectabilitystagetest/entry/src/main/module.json index 47f0bca2d9956d38a116df21d565011472d37045..119d4f70cb81bbf3d0a5d160f753ea5ea9238a33 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/actsfreeinstallconnectabilitystagetest/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/actsfreeinstallconnectabilitystagetest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], @@ -127,6 +128,12 @@ }, { "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY" } ] } diff --git a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication0/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication0/entry/src/main/module.json index 1a3c2e9173298878d9b23c8d7f8513008841980d..75fe4e0258090ac2a915c927b612300a8354577f 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication0/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication0/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:myapplication_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication1/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication1/entry/src/main/module.json index 8b9c287be9a857cd7cd1087b3a8b54f85ede0bca..609fcefb22c536b15b2d806d36c270fbd590a095 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication1/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication1/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:myapplication1_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication2/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication2/entry/src/main/module.json index fce091ee5fccedbeeb5274cd179b889ff3a61335..0753984bb59be5c95cae46bdb14d7601ab8cd1db 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication2/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication2/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:myapplication2_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication3/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication3/entry/src/main/module.json index 25a7ed0e2a6651ba7c28063e01ca3d750f0bb973..cafff6f8341b79e912473480a3d6a0ec69a438fb 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication3/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication3/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:myapplication3_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication4/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication4/entry/src/main/module.json index cb1a0efba3f82c9b46cfe215035f6346a1d8eebd..e0844712b1be4a9c4a5cd01bc4ffb9e82065eb75 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication4/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication4/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:myapplication4_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication5/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication5/entry/src/main/module.json index 6f03fd45fe31968ae3335059a02807e055b44f00..232318e7dc97ac97f5735f84f848b49b7fb1e2a9 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication5/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication5/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:myapplication5_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication6/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication6/entry/src/main/module.json index c13e1b937c97b9cd294b1ce7ac6027b5235e30bf..7e0b93abd1c4c8791949554dbb5ce90f66284538 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication6/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication6/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:myapplication6_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication7/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication7/entry/src/main/module.json index 67b9e978b8350ebb6c81a513711d84171d362027..6744f7fc629030589a367c33dc39dcbc15977298 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication7/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication7/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:myapplication7_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication8/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication8/entry/src/main/module.json index 1fdc3aa1c43acaf76c27107539cc3f0cbe0470a1..478e6066b8bb697d139d09f01e67e0960643ba5b 100644 --- a/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication8/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/connectabilitystagetest/connectstagemyapplication8/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:myapplication8_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/mockservice/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/mockservice/entry/src/main/module.json index a004f10a8b3aca76970352096e3bb3f8f2323bdf..cd3297539c7ca54522e1ff0772576beee51e0a5d 100644 --- a/ability/ability_runtime/freeinstalltest/mockservice/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/mockservice/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "requestPermissions": [ {"name": "ohos.permission.INSTALL_BUNDLE"}], diff --git a/ability/ability_runtime/freeinstalltest/mockservicetimeout/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/mockservicetimeout/entry/src/main/module.json index a004f10a8b3aca76970352096e3bb3f8f2323bdf..cd3297539c7ca54522e1ff0772576beee51e0a5d 100644 --- a/ability/ability_runtime/freeinstalltest/mockservicetimeout/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/mockservicetimeout/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "requestPermissions": [ {"name": "ohos.permission.INSTALL_BUNDLE"}], diff --git a/ability/ability_runtime/freeinstalltest/startabilityfatest/actsfreeinstallstartabilityfatest/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/startabilityfatest/actsfreeinstallstartabilityfatest/entry/src/main/config.json index 97395cdbcdb1ab33a3816a1f542469fc0397a015..22e9f23d20f69da208b361df93a323035c33fe65 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityfatest/actsfreeinstallstartabilityfatest/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/startabilityfatest/actsfreeinstallstartabilityfatest/entry/src/main/config.json @@ -19,6 +19,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone", "tablet" ], @@ -133,6 +134,14 @@ { "reason": "need use ohos.permission.LISTEN_BUNDLE_CHANGE", "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" } ] } diff --git a/ability/ability_runtime/freeinstalltest/startabilityfatest/actsfreeinstallstartabilityfatest/entry/src/main/ets/MainAbility/test/StartAbility.test2.ets b/ability/ability_runtime/freeinstalltest/startabilityfatest/actsfreeinstallstartabilityfatest/entry/src/main/ets/MainAbility/test/StartAbility.test2.ets index 5520cafb598681e15e1865a692ab3625e1010040..fdb535cd8c0e5211210e681105fe2bf335e008a3 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityfatest/actsfreeinstallstartabilityfatest/entry/src/main/ets/MainAbility/test/StartAbility.test2.ets +++ b/ability/ability_runtime/freeinstalltest/startabilityfatest/actsfreeinstallstartabilityfatest/entry/src/main/ets/MainAbility/test/StartAbility.test2.ets @@ -23,214 +23,211 @@ import commonEvent from '@ohos.commonEvent'; export default function startAbilityTest2() { - describe('startAbilityTest2', function () { + describe('startAbilityTest2', function () { - var TAG = ""; + var TAG = ""; - var delegator = AbilityDelegatorRegistry.getAbilityDelegator(); + var delegator = AbilityDelegatorRegistry.getAbilityDelegator(); - function sleep(time) { - return new Promise((resolve) => setTimeout(resolve, time)) - } + function sleep(time) { + return new Promise((resolve) => setTimeout(resolve, time)) + } - beforeAll(async function (done) { - console.info("StartAbilityForResult before all called"); - var cmd = "bm install -p data/test/MockService.hap"; - console.info("cmd : " + cmd) - delegator.executeShellCommand(cmd, (err: any, d: any) => { - console.info("executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - var cmd1 = "mkdir -p /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry"; - delegator.executeShellCommand(cmd1, (err: any, d: any) => { - console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - var cmd2 = "mkdir -p /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; - delegator.executeShellCommand(cmd2, (err: any, d: any) => { - console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - var cmd3 = "cp data/test/AtomizationFaEntry.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/" + - "entry/files"; - delegator.executeShellCommand(cmd3, (err: any, d: any) => { - console.info("executeShellCommand3 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - done(); - }) - }); + beforeAll(async function (done) { + console.info("StartAbilityForResult before all called"); + var cmd = "bm install -p data/test/MockService.hap"; + console.info("cmd : " + cmd) + delegator.executeShellCommand(cmd, (err: any, d: any) => { + console.info("executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + await sleep(500); + var cmd1 = "mkdir -p /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry"; + delegator.executeShellCommand(cmd1, (err: any, d: any) => { + console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + await sleep(500); + var cmd2 = "mkdir -p /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; + delegator.executeShellCommand(cmd2, (err: any, d: any) => { + console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + await sleep(500); + var cmd3 = "cp data/test/AtomizationFaEntry.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/" + + "entry/files"; + delegator.executeShellCommand(cmd3, (err: any, d: any) => { + console.info("executeShellCommand3 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + done(); + }) + }); - afterEach(async function (done) { - console.info("StartAbilityTest after each called"); - if ("FreeInstall_FA_Local_StartAbility_2000" === TAG) { - var cmd4 = "bm uninstall -n com.example.qianyiyingyong.hmservice"; - delegator.executeShellCommand(cmd4, (err: any, d: any) => { - console.info("executeShellCommand4 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - } + afterEach(async function (done) { + console.info("StartAbilityTest after each called"); + if ("FreeInstall_FA_Local_StartAbility_2000" === TAG) { + var cmd4 = "bm uninstall -n com.example.qianyiyingyong.hmservice"; + delegator.executeShellCommand(cmd4, (err: any, d: any) => { + console.info("executeShellCommand4 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + await sleep(500); + } - if ("FreeInstall_FA_Local_StartAbility_2500" === TAG) { - var cmd5 = "bm uninstall -n com.ohos.hag.famanager"; - delegator.executeShellCommand(cmd5, (err: any, d: any) => { - console.info("executeShellCommand5 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - } - await sleep(500); - done(); - }); + if ("FreeInstall_FA_Local_StartAbility_2500" === TAG) { + var cmd5 = "bm uninstall -n com.ohos.hag.famanager"; + delegator.executeShellCommand(cmd5, (err: any, d: any) => { + console.info("executeShellCommand5 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + } + await sleep(500); + done(); + }); - /* - * @tc.number FreeInstall_FA_Local_StartAbility_1900 - * @tc.name The current service is not in the foreground. Page a jumps to page B first. - There are HAP packages that need not be installed under the specified path - * @tc.desc Function test - * @tc.level 0 - */ - it("FreeInstall_FA_Local_StartAbility_1900", 0, async function (done) { - console.info("------------start FreeInstall_FA_Local_StartAbility_1900-------------"); - TAG = "FreeInstall_FA_Local_StartAbility_1900"; - let wrong; - var str1 = { - 'want': { - "bundleName": "com.open.harmony.startAbility", - "abilityName": "com.open.harmony.startAbility.PageAbility", - "moduleName": "entry", - } - } - featureAbility.startAbility(str1) - .then((data) => { - console.info(TAG + ' StartAbility successful. Promise Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbility failed. error: ' + JSON.stringify(error)); - }) - await sleep(3000); - var str = { - 'want': { - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.qianyiyingyong.MainAbility", - "moduleName": "entry", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND - } - } - await featureAbility.startAbility(str).then((data) => { - console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); - }).catch((error) => { - wrong = error; - console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error)); - }); - await sleep(2000); - expect(wrong.code).assertEqual(13); - console.info("------------end FreeInstall_FA_Local_StartAbility_1900-------------"); - done(); + /* + * @tc.number FreeInstall_FA_Local_StartAbility_1900 + * @tc.name The current service is not in the foreground. Page a jumps to page B first. + There are HAP packages that need not be installed under the specified path + * @tc.desc Function test + * @tc.level 0 + */ + it("FreeInstall_FA_Local_StartAbility_1900", 0, async function (done) { + console.info("------------start FreeInstall_FA_Local_StartAbility_1900-------------"); + TAG = "FreeInstall_FA_Local_StartAbility_1900"; + let wrong; + var str1 = { + 'want': { + "bundleName": "com.open.harmony.startAbility", + "abilityName": "com.open.harmony.startAbility.PageAbility", + "moduleName": "entry", + } + } + featureAbility.startAbility(str1) + .then((data) => { + console.info(TAG + ' StartAbility successful. Promise Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbility failed. error: ' + JSON.stringify(error)); + }) + setTimeout(async () => { + var str = { + 'want': { + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.qianyiyingyong.MainAbility", + "moduleName": "entry", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND + } + } + await featureAbility.startAbility(str).then((data) => { + console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); + }).catch((error) => { + wrong = error; + console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error)); }); + expect(wrong.code).assertEqual(13); + }, 2000) + console.info("------------end FreeInstall_FA_Local_StartAbility_1900-------------"); + done(); + }); - /* - * @tc.number FreeInstall_FA_Local_StartAbility_2000 - * @tc.name The current service is not in the foreground. Page a jumps to page B first. - The atomized HAP package has been installed - * @tc.desc Function test - * @tc.level 0 - */ - it("FreeInstall_FA_Local_StartAbility_2000", 0, async function (done) { - console.info("------------start FreeInstall_FA_Local_StartAbility_2000-------------"); - TAG = "FreeInstall_FA_Local_StartAbility_2000"; - var cmd2000 = "bm install -p data/test/AtomizationFaEntry.hap"; - delegator.executeShellCommand(cmd2000, (err: any, d: any) => { - console.info("executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - let wrong; - var str1 = { - 'want': { - "bundleName": "com.open.harmony.startAbility", - "abilityName": "com.open.harmony.startAbility.PageAbility", - "moduleName": "entry", - } - } - featureAbility.startAbility(str1) - .then((data) => { - console.info(TAG + ' StartAbility successful. Promise Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbility failed. error: ' + JSON.stringify(error)); - }) - await sleep(3000); - var str = { - 'want': { - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.qianyiyingyong.MainAbility", - "moduleName": "entry", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND - } - } - await featureAbility.startAbility(str).then((data) => { - console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); - }).catch((error) => { - wrong = error; - console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error)); - }); - await sleep(2000); - expect(wrong.code).assertEqual(13); - console.info("------------end FreeInstall_FA_Local_StartAbility_2000-------------"); - await sleep(2000); - done(); + /* + * @tc.number FreeInstall_FA_Local_StartAbility_2000 + * @tc.name The current service is not in the foreground. Page a jumps to page B first. + The atomized HAP package has been installed + * @tc.desc Function test + * @tc.level 0 + */ + it("FreeInstall_FA_Local_StartAbility_2000", 0, async function (done) { + console.info("------------start FreeInstall_FA_Local_StartAbility_2000-------------"); + TAG = "FreeInstall_FA_Local_StartAbility_2000"; + var cmd2000 = "bm install -p data/test/AtomizationFaEntry.hap"; + delegator.executeShellCommand(cmd2000, (err: any, d: any) => { + console.info("executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + await sleep(500); + let wrong; + var str1 = { + 'want': { + "bundleName": "com.open.harmony.startAbility", + "abilityName": "com.open.harmony.startAbility.PageAbility", + "moduleName": "entry", + } + } + featureAbility.startAbility(str1) + .then((data) => { + console.info(TAG + ' StartAbility successful. Promise Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbility failed. error: ' + JSON.stringify(error)); + }) + setTimeout(async () => { + var str = { + 'want': { + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.qianyiyingyong.MainAbility", + "moduleName": "entry", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND + } + } + await featureAbility.startAbility(str).then((data) => { + console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); + }).catch((error) => { + wrong = error; + console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error)); }); + await sleep(2000); + expect(wrong.code).assertEqual(13); + }, 2000) + console.info("------------end FreeInstall_FA_Local_StartAbility_2000-------------"); + done(); + }); - /* - * @tc.number FreeInstall_FA_Local_StartAbility_2500 - * @tc.name FA Service Center installation free timeout - * @tc.desc Function test - * @tc.level 0 - */ - it("FreeInstall_FA_Local_StartAbility_2500", 0, async function (done) { - console.info("------------start FreeInstall_FA_Local_StartAbility_2500-------------"); - TAG = "FreeInstall_FA_Local_StartAbility_2500"; - var cmd2500 = "bm uninstall -n com.ohos.hag.famanager"; - delegator.executeShellCommand(cmd2500, (err: any, d: any) => { - console.info("executeShellCommand2500 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - var cmd2501 = "bm install -p data/test/MockServiceTimeout.hap"; - delegator.executeShellCommand(cmd2501, (err: any, d: any) => { - console.info("executeShellCommand2501 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - var cmd2502 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry"; - delegator.executeShellCommand(cmd2502, (err: any, d: any) => { - console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - var cmd2503 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; - delegator.executeShellCommand(cmd2503, (err: any, d: any) => { - console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - var cmd2504 = "cp data/test/AtomizationFaEntry.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps" + - "/entry/files"; - delegator.executeShellCommand(cmd2504, (err: any, d: any) => { - console.info("executeShellCommand3 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await sleep(500); - let wrong; - var str = { - 'want': { - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.qianyiyingyong.MainAbility", - "moduleName": "entry", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - } - featureAbility.startAbility(str).then((data) => { - console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); - }).catch((error) => { - wrong = error; - console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error)); - }); - await sleep(35000); - expect(wrong.code).assertEqual(3); - console.info("------------end FreeInstall_FA_Local_StartAbility_2500-------------"); - done(); + /* + * @tc.number FreeInstall_FA_Local_StartAbility_2500 + * @tc.name FA Service Center installation free timeout + * @tc.desc Function test + * @tc.level 0 + */ + it("FreeInstall_FA_Local_StartAbility_2500", 0, async function (done) { + console.info("------------start FreeInstall_FA_Local_StartAbility_2500-------------"); + TAG = "FreeInstall_FA_Local_StartAbility_2500"; + var cmd2500 = "bm uninstall -n com.ohos.hag.famanager"; + delegator.executeShellCommand(cmd2500, (err: any, d: any) => { + console.info("executeShellCommand2500 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + var cmd2501 = "bm install -p data/test/MockServiceTimeout.hap"; + delegator.executeShellCommand(cmd2501, (err: any, d: any) => { + console.info("executeShellCommand2501 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + var cmd2502 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry"; + delegator.executeShellCommand(cmd2502, (err: any, d: any) => { + console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + var cmd2503 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; + delegator.executeShellCommand(cmd2503, (err: any, d: any) => { + console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + var cmd2504 = "cp data/test/AtomizationFaEntry.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps" + + "/entry/files"; + delegator.executeShellCommand(cmd2504, (err: any, d: any) => { + console.info("executeShellCommand3 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + setTimeout(async () => { + let wrong; + var str = { + 'want': { + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.qianyiyingyong.MainAbility", + "moduleName": "entry", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + } + featureAbility.startAbility(str).then((data) => { + console.log(TAG + ": startAbility success. data: " + JSON.stringify(data)); + }).catch((error) => { + wrong = error; + console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error)); }); + await sleep(35000); + expect(wrong.code).assertEqual(3); + }, 2000) + console.info("------------end FreeInstall_FA_Local_StartAbility_2500-------------"); + done(); + }); - console.info("-------------FA model--> startAbilityXTS Test end----------------") - }) + console.info("-------------FA model--> startAbilityXTS Test end----------------") + }) } \ No newline at end of file diff --git a/ability/ability_runtime/freeinstalltest/startabilityfatest/actsstartabilitynotargetbundlelistfatest/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/startabilityfatest/actsstartabilitynotargetbundlelistfatest/entry/src/main/config.json index 9e0d55cc184ebced325cd195b9331128a6eaa16a..e2a3d25c2b71227c182bf28786b744189281b29e 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityfatest/actsstartabilitynotargetbundlelistfatest/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/startabilityfatest/actsstartabilitynotargetbundlelistfatest/entry/src/main/config.json @@ -16,6 +16,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/startabilityfatest/actsstartabilitynotargetbundlelistfatest/entry/src/main/ets/MainAbility/test/StartAbility.test.ets b/ability/ability_runtime/freeinstalltest/startabilityfatest/actsstartabilitynotargetbundlelistfatest/entry/src/main/ets/MainAbility/test/StartAbility.test.ets index 7b12f12ab40b4f04131c8bd4f025a4284131e11a..06e87987a486a82d5ae429e650e32d0829d8d4f1 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityfatest/actsstartabilitynotargetbundlelistfatest/entry/src/main/ets/MainAbility/test/StartAbility.test.ets +++ b/ability/ability_runtime/freeinstalltest/startabilityfatest/actsstartabilitynotargetbundlelistfatest/entry/src/main/ets/MainAbility/test/StartAbility.test.ets @@ -22,189 +22,191 @@ import wantConstant from '@ohos.ability.wantConstant'; import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' export default function StartAbilityTest() { - var TAG = ""; + var TAG = ""; - describe('StartAbilityTest', function () { - var delegator = AbilityDelegatorRegistry.getAbilityDelegator(); - beforeAll(async function (done) { - console.info("StartAbilityTest before all called"); - var cmd = "bm install -p data/test/MockService.hap"; - console.info("cmd : " + cmd) - delegator.executeShellCommand(cmd, (err: any, d: any) => { - console.info("executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await Utils.sleep(500); - var cmd1 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry"; - delegator.executeShellCommand(cmd1, (err: any, d: any) => { - console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await Utils.sleep(500); - var cmd2 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; - delegator.executeShellCommand(cmd2, (err: any, d: any) => { - console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await Utils.sleep(500); - var cmd3 = "cp data/test/AtomizationFaEntry.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/" + - "entry/files"; - delegator.executeShellCommand(cmd3, (err: any, d: any) => { - console.info("executeShellCommand3 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - done(); - }) - }); + describe('StartAbilityTest', function () { + var delegator = AbilityDelegatorRegistry.getAbilityDelegator(); + beforeAll(async function (done) { + console.info("StartAbilityTest before all called"); + var cmd = "bm install -p data/test/MockService.hap"; + console.info("cmd : " + cmd) + delegator.executeShellCommand(cmd, (err: any, d: any) => { + console.info("executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + await Utils.sleep(500); + var cmd1 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry"; + delegator.executeShellCommand(cmd1, (err: any, d: any) => { + console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + await Utils.sleep(500); + var cmd2 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; + delegator.executeShellCommand(cmd2, (err: any, d: any) => { + console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + await Utils.sleep(500); + var cmd3 = "cp data/test/AtomizationFaEntry.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/" + + "entry/files"; + delegator.executeShellCommand(cmd3, (err: any, d: any) => { + console.info("executeShellCommand3 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + done(); + }) + }); - afterEach(async function (done) { - console.info("StartAbilityTest after each called"); - if ("FreeInstall_FA_StartAbility_2800" === TAG || "FreeInstall_FA_StartAbility_3900") { - var cmd5 = "bm uninstall -n com.example.qianyiyingyong.hmservice"; - delegator.executeShellCommand(cmd5, (err: any, d: any) => { - console.info("executeShellCommand5: err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - } - await Utils.sleep(500); - if ("FreeInstall_FA_StartAbility_3900" === TAG) { - var cmd4 = "bm uninstall -n com.ohos.hag.famanager"; - delegator.executeShellCommand(cmd4, (err: any, d: any) => { - console.info("executeShellCommand4: err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - } - await Utils.sleep(500); - done(); - }); + afterEach(async function (done) { + console.info("StartAbilityTest after each called"); + if ("FreeInstall_FA_StartAbility_2800" === TAG || "FreeInstall_FA_StartAbility_3900") { + var cmd5 = "bm uninstall -n com.example.qianyiyingyong.hmservice"; + delegator.executeShellCommand(cmd5, (err: any, d: any) => { + console.info("executeShellCommand5: err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + } + await Utils.sleep(500); + if ("FreeInstall_FA_StartAbility_3900" === TAG) { + var cmd4 = "bm uninstall -n com.ohos.hag.famanager"; + delegator.executeShellCommand(cmd4, (err: any, d: any) => { + console.info("executeShellCommand4: err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + } + await Utils.sleep(500); + done(); + }); - /* - * @tc.number: FreeInstall_FA_StartAbility_2600 - * @tc.name: startAbility: NoTargetBundleList,free install successfully. - * @tc.desc: Function test - * @tc.level 0 - */ - it("FreeInstall_FA_StartAbility_2600", 0, async function (done) { - console.log("------------start FreeInstall_FA_StartAbility_2600-------------"); - TAG = "FreeInstall_FA_StartAbility_2600"; - let details; - var str = { - 'want': { - "deviceId": "", - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.qianyiyingyong.MainAbility", - "moduleName": "entry", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - } - await featureAbility.startAbility(str).then((data) => { - details = data; - console.info(TAG + ' StartAbility successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbility failed. error: ' + JSON.stringify(error)); - }) - await Utils.sleep(2000); - expect(details).assertEqual(0); - done(); - }); + /* + * @tc.number: FreeInstall_FA_StartAbility_2600 + * @tc.name: startAbility: NoTargetBundleList,free install successfully. + * @tc.desc: Function test + * @tc.level 0 + */ + it("FreeInstall_FA_StartAbility_2600", 0, async function (done) { + console.log("------------start FreeInstall_FA_StartAbility_2600-------------"); + TAG = "FreeInstall_FA_StartAbility_2600"; + setTimeout(async () => { + let details; + var str = { + 'want': { + "deviceId": "", + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.qianyiyingyong.MainAbility", + "moduleName": "entry", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + } + await featureAbility.startAbility(str).then((data) => { + details = data; + console.info(TAG + ' StartAbility successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbility failed. error: ' + JSON.stringify(error)); + }) + expect(details).assertEqual(0); + }, 2000) + done(); + }); - /* - * @tc.number: FreeInstall_FA_StartAbility_2700 - * @tc.name: startAbility: NoTargetBundleList and yuanzihua already installed,startAbility successfully. - * @tc.desc: Function test - * @tc.level 0 - */ - it("FreeInstall_FA_StartAbility_2700", 0, async function (done) { - console.log("------------start FreeInstall_FA_StartAbility_2700-------------"); - TAG = "FreeInstall_FA_StartAbility_2700"; - var cmd6 = "bm install -p data/test/AtomizationFaEntry.hap"; - delegator.executeShellCommand(cmd6, (err: any, d: any) => { - console.info("executeShellCommand6: err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await Utils.sleep(500); - let details; - var str = { - 'want': { - "deviceId": "", - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.qianyiyingyong.MainAbility", - "moduleName": "entry", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - } - await featureAbility.startAbility(str).then((data) => { - details = data; - console.info(TAG + ' StartAbility successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbility failed. error: ' + JSON.stringify(error)); - }) - await Utils.sleep(2000); - expect(details).assertEqual(0); - done(); - }); + /* + * @tc.number: FreeInstall_FA_StartAbility_2700 + * @tc.name: startAbility: NoTargetBundleList and yuanzihua already installed,startAbility successfully. + * @tc.desc: Function test + * @tc.level 0 + */ + it("FreeInstall_FA_StartAbility_2700", 0, async function (done) { + console.log("------------start FreeInstall_FA_StartAbility_2700-------------"); + TAG = "FreeInstall_FA_StartAbility_2700"; + var cmd6 = "bm install -p data/test/AtomizationFaEntry.hap"; + delegator.executeShellCommand(cmd6, (err: any, d: any) => { + console.info("executeShellCommand6: err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + setTimeout(async () => { + let details; + var str = { + 'want': { + "deviceId": "", + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.qianyiyingyong.MainAbility", + "moduleName": "entry", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + } + await featureAbility.startAbility(str).then((data) => { + details = data; + console.info(TAG + ' StartAbility2700 successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbility2700 failed. error: ' + JSON.stringify(error)); + }) + expect(details).assertEqual(0); + }, 2000) + done(); + }); - /* - * @tc.number: FreeInstall_FA_StartAbility_2800 - * @tc.name: startAbility: The same application does not need to check targetbundlelist, - start feature hap successfully. - * @tc.desc: Function test - * @tc.level 0 - */ - it("FreeInstall_FA_StartAbility_2800", 0, async function (done) { - console.log("------------start FreeInstall_FA_StartAbility_2800-------------"); - TAG = "FreeInstall_FA_StartAbility_2800"; - var cmd7 = "rm /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files/AtomizationFaEntry.hap"; - delegator.executeShellCommand(cmd7, (err: any, d: any) => { - console.info("executeShellCommand7 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await Utils.sleep(500); - var cmd8 = "cp data/test/FaMyApplication1.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/" + - "entry/files"; - delegator.executeShellCommand(cmd8, (err: any, d: any) => { - console.info("executeShellCommand8 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - await Utils.sleep(500); - let details; - var str = { - 'want': { - "bundleName": "com.open.harmony.startAbility", - "abilityName": "com.example.myapplication1.MainAbility1", - "moduleName": "myapplication1", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - } - await featureAbility.startAbility(str).then((data) => { - details = data; - console.info(TAG + ' StartAbility successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbility failed. error: ' + JSON.stringify(error)); - }) - await Utils.sleep(2000); - expect(details).assertEqual(0); - done(); - }); + /* + * @tc.number: FreeInstall_FA_StartAbility_2800 + * @tc.name: startAbility: The same application does not need to check targetbundlelist, + start feature hap successfully. + * @tc.desc: Function test + * @tc.level 0 + */ + it("FreeInstall_FA_StartAbility_2800", 0, async function (done) { + console.log("------------start FreeInstall_FA_StartAbility_2800-------------"); + TAG = "FreeInstall_FA_StartAbility_2800"; + var cmd7 = "rm /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files/AtomizationFaEntry.hap"; + delegator.executeShellCommand(cmd7, (err: any, d: any) => { + console.info("executeShellCommand7 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + await Utils.sleep(500); + var cmd8 = "cp data/test/FaMyApplication1.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/" + + "entry/files"; + delegator.executeShellCommand(cmd8, (err: any, d: any) => { + console.info("executeShellCommand8 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + setTimeout(async () => { + let details; + var str = { + 'want': { + "bundleName": "com.open.harmony.startAbility", + "abilityName": "com.example.myapplication1.MainAbility1", + "moduleName": "myapplication1", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + } + await featureAbility.startAbility(str).then((data) => { + details = data; + console.info(TAG + ' StartAbility successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbility failed. error: ' + JSON.stringify(error)); + }) + expect(details).assertEqual(0); + }, 2000) + done(); + }); - /* - * @tc.number: FreeInstall_FA_StartAbility_3900 - * @tc.name: startAbility: The same application does not need to check targetbundlelist,add BACKGROUND flags - start feature hap successfully. - * @tc.desc: Function test - * @tc.level 0 - */ - it("FreeInstall_FA_StartAbility_3900", 0, async function (done) { - console.log("------------start FreeInstall_FA_StartAbility_3900-------------"); - TAG = "FreeInstall_FA_StartAbility_3900"; - let details; - var str = { - 'want': { - "bundleName": "com.open.harmony.startAbility", - "abilityName": "com.example.myapplication1.MainAbility1", - "moduleName": "myapplication1", - "flags": wantConstant.Flags.FLAG_INSTALL_WITH_BACKGROUND_MODE|wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - } - await featureAbility.startAbility(str).then((data) => { - details = data; - console.info(TAG + ' StartAbility successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbility failed. error: ' + JSON.stringify(error)); - }) - await Utils.sleep(2000); - expect(details).assertEqual(0); - done(); - }); - }) + /* + * @tc.number: FreeInstall_FA_StartAbility_3900 + * @tc.name: startAbility: The same application does not need to check targetbundlelist,add BACKGROUND flags + start feature hap successfully. + * @tc.desc: Function test + * @tc.level 0 + */ + it("FreeInstall_FA_StartAbility_3900", 0, async function (done) { + console.log("------------start FreeInstall_FA_StartAbility_3900-------------"); + TAG = "FreeInstall_FA_StartAbility_3900"; + setTimeout(async () => { + let details; + var str = { + 'want': { + "bundleName": "com.open.harmony.startAbility", + "abilityName": "com.example.myapplication1.MainAbility1", + "moduleName": "myapplication1", + "flags": wantConstant.Flags.FLAG_INSTALL_WITH_BACKGROUND_MODE | wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + } + await featureAbility.startAbility(str).then((data) => { + details = data; + console.info(TAG + ' StartAbility successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbility failed. error: ' + JSON.stringify(error)); + }) + expect(details).assertEqual(0); + }, 2000); + done(); + }); + }) } \ No newline at end of file diff --git a/ability/ability_runtime/freeinstalltest/startabilityfatest/atomizationfaentry/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/startabilityfatest/atomizationfaentry/entry/src/main/config.json index 5f34d6beac8cc14c6252a9727f1e6ebd5268069b..f82162213ed91525c777e48f0a32b9a3ab7085c9 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityfatest/atomizationfaentry/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/startabilityfatest/atomizationfaentry/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".MyApplication", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/freeinstalltest/startabilityfatest/atomizationfahm2/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/startabilityfatest/atomizationfahm2/entry/src/main/config.json index 955bdfd3893ca836c467e7197348a0d757360d28..73338153dad2dd3c3ca4bc4b88c1658981e32e58 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityfatest/atomizationfahm2/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/startabilityfatest/atomizationfahm2/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/freeinstalltest/startabilityfatest/atomizationfahm4/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/startabilityfatest/atomizationfahm4/entry/src/main/config.json index 196f92b9e193372f7559658e8c75810258051cc1..3e52e38ff495c675067f1f285016766991187f55 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityfatest/atomizationfahm4/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/startabilityfatest/atomizationfahm4/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/freeinstalltest/startabilityfatest/famyapplication1/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/startabilityfatest/famyapplication1/entry/src/main/config.json index 55e61015dc7ce7a49ebf939e46b0f2b1091d3839..88c725016b67225f518daa2507c351507818a68a 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityfatest/famyapplication1/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/startabilityfatest/famyapplication1/entry/src/main/config.json @@ -16,6 +16,7 @@ "module": { "mainAbility": ".MainAbility1", "deviceType": [ + "default", "phone" ], "abilities": [ diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/BUILD.gn b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/BUILD.gn index ab193bea006822e479a426cd5dca1fcb9da44556..6eaaef710dd27d7eed72c0b6e82764b521acfbdb 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/BUILD.gn +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/BUILD.gn @@ -26,7 +26,9 @@ ohos_js_hap_suite("ActsFreeInstallStartAbilityForResultFaTest") { part_name = "ability_runtime" } ohos_js_assets("actsfreeinstallstartabilityforresultfatest_ets_assets") { - source_dir = "./entry/src/main/ets/MainAbility" + source_dir = "./entry/src/main/ets" + hap_profile = "entry/src/main/config.json" + ets2abc = true } ohos_resources("actsfreeinstallstartabilityforresultfatest_ets_resources") { sources = [ "./entry/src/main/resources" ] diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/Test.json b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/Test.json index b7ed08ebb5437bc1b8398a30442d82f9da3e71a1..2759e09a7ec5a27835991f2441f4f2c4290e35c7 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/Test.json +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/Test.json @@ -20,6 +20,7 @@ "type": "ShellKit", "run-command": [ "remount", + "param set persist.sys.suspend_manager_enabled 0", "mkdir /data/test/" ] }, diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/config.json index acdffda30fa4546cc034ff80b0364f472fecb598..35447c5a7b873d87c7d03928a753ef4dc5298b05 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/config.json @@ -19,6 +19,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone", "tablet" ], @@ -44,7 +45,7 @@ "formsEnabled": false, "label": "$string:MainAbility_label", "type": "page", - "launchType": "standard" + "launchType": "singleton" }, { "orientation": "unspecified", diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/app.ets index e50dc2a8943d97888deef5b4b36106f52663efc1..b29c8974fa850c06194f75c059dcc8bff64ee553 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/app.ets +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/app.ets @@ -12,10 +12,19 @@ * 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('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) }, onDestroy() { console.info('Application onDestroy') diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/pages/index.ets b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/pages/index.ets index 2fb0fdf90bd41c7ded1e7b863c96947703d0d297..ccab691e36398896206b6b9fee6da9960897da57 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/pages/index.ets +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/pages/index.ets @@ -38,12 +38,6 @@ async function routePage() { struct Index { aboutToAppear() { console.info("aboutToAppear start!!!!") - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } build() { diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/test/StartAbilityForResult.test.ets b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/test/StartAbilityForResult.test.ets index 721bc3f77cff4306e122ac3430c1b0b34ca75b5c..f4cab635c44f8785fa1d827d0cac1fdee7107283 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/test/StartAbilityForResult.test.ets +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/test/StartAbilityForResult.test.ets @@ -74,6 +74,18 @@ export default function StartAbilityForResult() { console.info("executeShellCommand4: err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) await Utils.sleep(500); + var str = { + 'want': { + "bundleName": "com.open.harmony.startAbilityForResult", + "abilityName": "com.open.harmony.startAbilityForResult.MainAbility", + } + } + await featureAbility.startAbility(str).then((data) => { + console.info(' StartAbilityPromise successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(' StartAbilityPromise failed. Cause: ' + JSON.stringify(error)); + }) + await Utils.sleep(500); } if ("FreeInstall_FA_StartAbilityForResult_3200" === TAG) { diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/test/StartAbilityForResult2.test.ets b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/test/StartAbilityForResult2.test.ets index 589c442c1c8d16eecb5bae91517d674d417383d9..7f45dc03b683c337e60e13f41cb0d79d286fb5ee 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/test/StartAbilityForResult2.test.ets +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/MainAbility/test/StartAbilityForResult2.test.ets @@ -46,7 +46,7 @@ export default function StartAbilityForResult2() { }) await Utils.sleep(500); var cmd3 = "cp data/test/AtomizationResultFaEntry.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/" + - "entry/files"; + "entry/files"; delegator.executeShellCommand(cmd3, (err: any, d: any) => { console.info("executeShellCommand3 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); done(); @@ -92,10 +92,10 @@ export default function StartAbilityForResult2() { } featureAbility.startAbilityForResult(str1) .then((data) => { - console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) + console.info(TAG + ' StartAbilityForResultPromise2200 successful. Data: ' + JSON.stringify(data)) }).catch((error) => { - console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); - }) + console.info(TAG + ' StartAbilityForResultPromise2200 failed. Cause: ' + JSON.stringify(error)); + }) await Utils.sleep(3000); let wrong; var str = { @@ -108,10 +108,10 @@ export default function StartAbilityForResult2() { } await featureAbility.startAbilityForResult(str) .then((data) => { - console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) + console.info(TAG + ' StartAbilityForResultPromise2200 successful. Data: ' + JSON.stringify(data)) }).catch((error) => { wrong = error; - console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); + console.info(TAG + ' StartAbilityForResultPromise2200 failed. Cause: ' + JSON.stringify(error)); }) await Utils.sleep(2000); expect(wrong.code).assertEqual(13); @@ -128,7 +128,8 @@ export default function StartAbilityForResult2() { it("FreeInstall_FA_StartAbilityForResult_2300", 0, async function (done) { console.log("------------start FreeInstall_FA_StartAbilityForResult_2300-------------"); TAG = "FreeInstall_FA_StartAbilityForResult_2300"; - var cmd19 = "bm install -p data/test/AtomizationResultFaEntry.hap"; + var cmd19 = "bm install -rp /data/test/AtomizationResultFaEntry.hap"; + console.log("------------start FreeInstall_FA_StartAbilityForResult_2300------install-------"); delegator.executeShellCommand(cmd19, (err: any, d: any) => { console.info("executeShellCommand19: err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) @@ -142,29 +143,30 @@ export default function StartAbilityForResult2() { } featureAbility.startAbilityForResult(str1) .then((data) => { - console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) + console.info(TAG + ' StartAbilityForResultPromise2300 successful. Data1: ' + JSON.stringify(data)) }).catch((error) => { - console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); - }) - await Utils.sleep(3000); - let wrong; - var str = { - 'want': { - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.qianyiyingyong.MainAbility", - "moduleName": "entry", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - } - await featureAbility.startAbilityForResult(str) - .then((data) => { - console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - wrong = error; - console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); + console.info(TAG + ' StartAbilityForResultPromise2300 failed. Cause1: ' + JSON.stringify(error)); }) - await Utils.sleep(2000); - expect(wrong.code).assertEqual(13); + await Utils.sleep(1000); + setTimeout(async () => { + var wrong; + var str = { + 'want': { + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.qianyiyingyong.MainAbility", + "moduleName": "entry", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + } + await featureAbility.startAbilityForResult(str) + .then((data) => { + console.info(TAG + ' StartAbilityForResultPromise2300 successful. 1Data: ' + JSON.stringify(data)) + }).catch((error) => { + wrong = error; + console.info(TAG + ' StartAbilityForResultPromise2300 failed. 1Cause: ' + JSON.stringify(error)); + }) + expect(wrong.code).assertEqual(13); + }, 2000) done(); }); @@ -181,47 +183,45 @@ export default function StartAbilityForResult2() { delegator.executeShellCommand(cmd20, (err: any, d: any) => { console.info("executeShellCommand20: err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) - await Utils.sleep(500); var cmd21 = "bm install -p data/test/MockServiceTimeout.hap"; delegator.executeShellCommand(cmd21, (err: any, d: any) => { console.info("executeShellCommand21: err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) - await Utils.sleep(500); var cmd1 = "mkdir -p /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry"; delegator.executeShellCommand(cmd1, (err: any, d: any) => { - console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + console.info("executeShellCommand11 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) - await Utils.sleep(500); var cmd2 = "mkdir -p /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; delegator.executeShellCommand(cmd2, (err: any, d: any) => { - console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + console.info("executeShellCommand21 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) - await Utils.sleep(500); var cmd3 = "cp data/test/AtomizationResultFaEntry.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/" + - "entry/files"; + "entry/files"; delegator.executeShellCommand(cmd3, (err: any, d: any) => { - console.info("executeShellCommand3 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + console.info("executeShellCommand31 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) - await Utils.sleep(500); - let wrong; - var str = { - 'want': { - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.qianyiyingyong.MainAbility", - "moduleName": "entry", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + + setTimeout(async () => { + var wrong; + var str = { + 'want': { + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.qianyiyingyong.MainAbility", + "moduleName": "entry", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } } - } - featureAbility.startAbilityForResult(str) - .then((data) => { - console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - wrong = error; - console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); - }) - await Utils.sleep(35000); - expect(wrong.code).assertEqual(13); + await featureAbility.startAbilityForResult(str) + .then((data) => { + console.info(TAG + ' StartAbilityForResultPromise2600 successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + wrong = error; + console.info(TAG + ' StartAbilityForResultPromise2600 failed. Cause: ' + JSON.stringify(error)); + }) + expect(wrong.code).assertEqual(3) + }, 20000) done(); }); + }) -} \ No newline at end of file +} diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/PageAbility/app.ets b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/PageAbility/app.ets index f7a6eb27919fa676345d20369d39aa6ef9b0b87f..6e34a29cfb28013273b59fb90ffcb15f2bcdc7b9 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/PageAbility/app.ets +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsfreeinstallstartabilityforresultfatest/entry/src/main/ets/PageAbility/app.ets @@ -16,19 +16,19 @@ import featureAbility from '@ohos.ability.featureAbility'; export default { - onCreate() { - console.info('Application onCreate') - setTimeout(function () { - featureAbility.terminateSelf() - .then((data) => { - console.info('PageAbility terminateself succeeded: ' + data); - }).catch((error) => { - console.error('PageAbility terminateself failed. Cause: ' + error); - }) - }, 8000); - }, + onCreate() { + console.info('Applicationfa onCreate') + setTimeout(async () => { + await featureAbility.terminateSelf() + .then((data) => { + console.info('PageAbilityfa terminateself succeeded: ' + data); + }).catch((error) => { + console.error('PageAbilityfa terminateself failed. Cause: ' + error); + }) + }, 8000); + }, - onDestroy() { - console.info('Application onDestroy') - }, + onDestroy() { + console.info('Application onDestroy') + }, } \ No newline at end of file diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsstartabilityforresultnotargetfatest/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsstartabilityforresultnotargetfatest/entry/src/main/config.json index c9018fcfd254b06ce0a6c57a9ba8bca7433cb4af..74248c803da3dee50446036a300692ee35ed62f2 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsstartabilityforresultnotargetfatest/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsstartabilityforresultnotargetfatest/entry/src/main/config.json @@ -16,6 +16,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsstartabilityforresultnotargetfatest/entry/src/main/ets/MainAbility/test/StartAbilityForResult.test.ets b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsstartabilityforresultnotargetfatest/entry/src/main/ets/MainAbility/test/StartAbilityForResult.test.ets index 22fcd645c35315ad3119043d6a210c14f7a1c7fe..62743ea45b6d88a160dce83e9cb4fde774378304 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsstartabilityforresultnotargetfatest/entry/src/main/ets/MainAbility/test/StartAbilityForResult.test.ets +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/actsstartabilityforresultnotargetfatest/entry/src/main/ets/MainAbility/test/StartAbilityForResult.test.ets @@ -45,7 +45,7 @@ export default function StartAbilityForResult() { }) await Utils.sleep(500); var cmd3 = "cp data/test/AtomizationResultFaEntry.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/" + - "files"; + "files"; delegator.executeShellCommand(cmd3, (err: any, d: any) => { console.info("executeShellCommand3 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); done(); @@ -88,16 +88,17 @@ export default function StartAbilityForResult() { "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, } } - await featureAbility.startAbilityForResult(str) - .then((data) => { - details = data; - console.info(TAG + ' StartAbilityForResult successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbilityForResult failed. error: ' + JSON.stringify(error)); - }) - await Utils.sleep(1000); - console.log(TAG + " resultCode: " + details.resultCode); - expect(details.resultCode).assertEqual(1); + setTimeout(async () => { + await featureAbility.startAbilityForResult(str) + .then((data) => { + details = data; + console.info(TAG + ' StartAbilityForResult successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbilityForResult failed. error: ' + JSON.stringify(error)); + }) + console.log(TAG + " resultCode: " + details.resultCode); + expect(details.resultCode).assertEqual(1); + },2000); done(); }); @@ -114,7 +115,6 @@ export default function StartAbilityForResult() { delegator.executeShellCommand(cmd6, (err: any, d: any) => { console.info("executeShellCommand6: err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) - await Utils.sleep(500); let details; var str = { 'want': { @@ -125,16 +125,17 @@ export default function StartAbilityForResult() { "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, } } - await featureAbility.startAbilityForResult(str) + setTimeout(async ()=>{ + await featureAbility.startAbilityForResult(str) .then((data) => { details = data; console.info(TAG + ' StartAbilityForResult successful. Data: ' + JSON.stringify(data)) }).catch((error) => { console.info(TAG + ' StartAbilityForResult failed. error: ' + JSON.stringify(error)); }) - await Utils.sleep(1000); console.log(TAG + " resultCode: " + details.resultCode); expect(details.resultCode).assertEqual(1); + },2000); done(); }); @@ -154,30 +155,30 @@ export default function StartAbilityForResult() { }) await Utils.sleep(500); var cmd8 = "cp data/test/FaResultMyApplication1.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/" + - "entry/files"; + "entry/files"; delegator.executeShellCommand(cmd8, (err: any, d: any) => { console.info("executeShellCommand8: err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) - await Utils.sleep(500); - let details; - var str = { - 'want': { - "bundleName": "com.open.harmony.startAbilityForResult", - "abilityName": "com.example.myapplication1.MainAbility1", - "moduleName": "myapplication1", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + setTimeout(async ()=>{ + let details; + var str = { + 'want': { + "bundleName": "com.open.harmony.startAbilityForResult", + "abilityName": "com.example.myapplication1.MainAbility1", + "moduleName": "myapplication1", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } } - } - await featureAbility.startAbilityForResult(str) - .then((data) => { - details = data; - console.info(TAG + ' StartAbilityForResult successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbilityForResult failed. error: ' + JSON.stringify(error)); - }) - await Utils.sleep(2000); - console.log(TAG + " resultCode: " + details.resultCode); - expect(details.resultCode).assertEqual(1); + await featureAbility.startAbilityForResult(str) + .then((data) => { + details = data; + console.info(TAG + ' StartAbilityForResult successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbilityForResult failed. error: ' + JSON.stringify(error)); + }) + console.log(TAG + " resultCode: " + details.resultCode); + expect(details.resultCode).assertEqual(1); + },2000); done(); }); }) diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresulta/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresulta/entry/src/main/config.json index 05f73cce051b1b6a832891a2a107525bb7cd4e6d..410ec6177992754ac6b30b665fc42479f0459ec0 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresulta/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresulta/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfaentry/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfaentry/entry/src/main/config.json index ceaaeed30ef39694f4ef451d016a3e8130cc1339..bf2c4bdd8f7d0e761f94bf37154811d60b3d89ba 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfaentry/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfaentry/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfaentry/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfaentry/entry/src/main/ets/MainAbility/app.ets index c3a2854faa2a78073ca79b7e4801ea1ba870ba84..d779e6c276a31e1412c0d654c2c8719eef0aefad 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfaentry/entry/src/main/ets/MainAbility/app.ets +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfaentry/entry/src/main/ets/MainAbility/app.ets @@ -40,7 +40,6 @@ export default { }, } ); - featureAbility.terminateSelf(); console.info('fAStartAbilityForResultPromise terminateSelfWithResult END'); }, 1000); }, diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfahm1/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfahm1/entry/src/main/config.json index 1befc4efe23c420b3d387e25d08419cb70faa2af..98cb3fa6087f83a95df813a4a4b452390c4354eb 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfahm1/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfahm1/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfahm1/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfahm1/entry/src/main/ets/MainAbility/app.ets index 881d9152e264e8415299fdcab1052e1f68f9ce73..f9c7aa4179805e4010f742aa28fcef016eed746b 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfahm1/entry/src/main/ets/MainAbility/app.ets +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfahm1/entry/src/main/ets/MainAbility/app.ets @@ -33,7 +33,6 @@ export default { }, } ); - featureAbility.terminateSelf(); console.info('fAStartAbilityForResultPromise terminateSelfWithResult END'); }, 1000); }, diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfahm2/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfahm2/entry/src/main/config.json index 225b1a21bb7dd12153bde34267da643de1377398..ba68362c3ee51da950503666fa32b179f0e1f96c 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfahm2/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfahm2/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfahm2/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfahm2/entry/src/main/ets/MainAbility/app.ets index 881d9152e264e8415299fdcab1052e1f68f9ce73..f9c7aa4179805e4010f742aa28fcef016eed746b 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfahm2/entry/src/main/ets/MainAbility/app.ets +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/atomizationresultfahm2/entry/src/main/ets/MainAbility/app.ets @@ -33,7 +33,6 @@ export default { }, } ); - featureAbility.terminateSelf(); console.info('fAStartAbilityForResultPromise terminateSelfWithResult END'); }, 1000); }, diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/faresultmyapplication1/entry/src/main/config.json b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/faresultmyapplication1/entry/src/main/config.json index 2f51d1544830ffc0a58e73c23885676e0a2a3e75..72cb78a7a42902feb2f17d95420be6901851f930 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/faresultmyapplication1/entry/src/main/config.json +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/faresultmyapplication1/entry/src/main/config.json @@ -16,6 +16,7 @@ "module": { "mainAbility": ".MainAbility1", "deviceType": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/faresultmyapplication1/entry/src/main/ets/MainAbility/app.ets b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/faresultmyapplication1/entry/src/main/ets/MainAbility/app.ets index 15d6b37d6a7f89f4e76db0180c838725ab29467d..fa0bfa0402f95f35798bb282e4f210fe8a4d1774 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/faresultmyapplication1/entry/src/main/ets/MainAbility/app.ets +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultfatest/faresultmyapplication1/entry/src/main/ets/MainAbility/app.ets @@ -34,7 +34,6 @@ export default { }, } ); - featureAbility.terminateSelf(); console.info('fAStartAbilityForResultPromise terminateSelfWithResult END'); }, 1000); }, diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/actsfreeinstallstartabilityforresultstagetest/entry/src/main/ets/test/StartAbilityForResult.ets b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/actsfreeinstallstartabilityforresultstagetest/entry/src/main/ets/test/StartAbilityForResult.ets index bab8df845a87af42654e5e5668861a7ab3ab4548..526581a8ffb2acc39328ec1020299cdb9fb19c82 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/actsfreeinstallstartabilityforresultstagetest/entry/src/main/ets/test/StartAbilityForResult.ets +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/actsfreeinstallstartabilityforresultstagetest/entry/src/main/ets/test/StartAbilityForResult.ets @@ -34,21 +34,24 @@ export default function StartAbilityForResult(abilityContext) { beforeAll(async function (done) { console.info("StartAbilityForResult before all called"); var cmd = "bm install -p data/test/MockService.hap"; - console.info("cmd : "+cmd) + console.info("cmd : " + cmd) globalThis.delegator.executeShellCommand(cmd, (err: any, d: any) => { - console.info("executeShellCommand : err : " + JSON.stringify(err)," data : " + JSON.stringify(d));}) + console.info("executeShellCommand : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) await sleep(500); var cmd1 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry"; globalThis.delegator.executeShellCommand(cmd1, (err: any, d: any) => { - console.info("executeShellCommand1 : err : " + JSON.stringify(err)," data : " + JSON.stringify(d));}) + console.info("executeShellCommand1 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) await sleep(500); var cmd2 = "mkdir /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; globalThis.delegator.executeShellCommand(cmd2, (err: any, d: any) => { - console.info("executeShellCommand2 : err : " + JSON.stringify(err)," data : " + JSON.stringify(d));}) + console.info("executeShellCommand2 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) await sleep(500); - var cmd3 ="cp data/test/AtomizationResultStageEntry.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; + var cmd3 = "cp data/test/AtomizationResultStageEntry.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/entry/files"; globalThis.delegator.executeShellCommand(cmd3, (err: any, d: any) => { - console.info("executeShellCommand3 : err : " + JSON.stringify(err)," data : " + JSON.stringify(d)); + console.info("executeShellCommand3 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); done(); }) }); @@ -56,8 +59,8 @@ export default function StartAbilityForResult(abilityContext) { afterEach(async function (done) { console.info("StartAbilityForResult after each called"); if ("FreeInstall_Stage_StartAbilityForResult_0100" === TAG || - "FreeInstall_Stage_StartAbilityForResult_0500" === TAG || - "FreeInstall_Stage_StartAbilityForResult_2800" === TAG) { + "FreeInstall_Stage_StartAbilityForResult_0500" === TAG || + "FreeInstall_Stage_StartAbilityForResult_2800" === TAG) { var cmd4 = "bm uninstall -n com.example.qianyiyingyong.hmservice"; globalThis.delegator.executeShellCommand(cmd4, (err: any, d: any) => { console.info("executeShellCommand4 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); @@ -71,18 +74,18 @@ export default function StartAbilityForResult(abilityContext) { }) await sleep(500); var cmd6 = "cp data/test/AtomizationResultStageEntry.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/" + - "entry/files"; + "entry/files"; globalThis.delegator.executeShellCommand(cmd6, (err: any, d: any) => { console.info("executeShellCommand6 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) await sleep(500); } - if ("FreeInstall_Stage_StartAbilityForResult_2600" === TAG) { - var cmd14 = "bm uninstall -n com.ohos.hag.famanager"; - globalThis.delegator.executeShellCommand(cmd14, (err: any, d: any) => { - console.info("executeShellCommand14 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); - }) - } + if ("FreeInstall_Stage_StartAbilityForResult_2600" === TAG) { + var cmd14 = "bm uninstall -n com.ohos.hag.famanager"; + globalThis.delegator.executeShellCommand(cmd14, (err: any, d: any) => { + console.info("executeShellCommand14 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); + }) + } await sleep(500); done(); }); @@ -96,24 +99,25 @@ export default function StartAbilityForResult(abilityContext) { it("FreeInstall_Stage_StartAbilityForResult_0100", 0, async function (done) { console.log("------------start FreeInstall_Stage_StartAbilityForResult_0100-------------"); TAG = "FreeInstall_Stage_StartAbilityForResult_0100"; - let details; - var str = { - "deviceId": "", - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.qianyiyingyong.MainAbility", - "moduleName": "entry", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - await globalThis.abilityContext.startAbilityForResult(str) - .then((data) => { - details = data; - console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); - }) - await sleep(2000); - console.log(TAG + " resultCode: " + details.resultCode); - expect(details.resultCode).assertEqual(1); + setTimeout(async () => { + let details; + var str = { + "deviceId": "", + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.qianyiyingyong.MainAbility", + "moduleName": "entry", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + await globalThis.abilityContext.startAbilityForResult(str) + .then((data) => { + details = data; + console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); + }) + console.log(TAG + " resultCode: " + details.resultCode); + expect(details.resultCode).assertEqual(1); + }, 2000) done(); }); @@ -126,26 +130,27 @@ export default function StartAbilityForResult(abilityContext) { it("FreeInstall_Stage_StartAbilityForResult_0400", 0, async function (done) { console.log("------------start FreeInstall_Stage_StartAbilityForResult_0400-------------"); TAG = "FreeInstall_Stage_StartAbilityForResult_0400"; - let details; - var str = { - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.qianyiyingyong.MainAbility", - "moduleName": "entry", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - var options = { - "windowMode": 0, "displayId": 2 - } - await globalThis.abilityContext.startAbilityForResult(str, options) - .then((data) => { - details = data; - console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); - }) - await sleep(2000); - console.log(TAG + " resultCode: " + details.resultCode); - expect(details.resultCode).assertEqual(1); + setTimeout(async () => { + let details; + var str = { + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.qianyiyingyong.MainAbility", + "moduleName": "entry", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + var options = { + "windowMode": 0, "displayId": 2 + } + await globalThis.abilityContext.startAbilityForResult(str, options) + .then((data) => { + details = data; + console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); + }) + console.log(TAG + " resultCode: " + details.resultCode); + expect(details.resultCode).assertEqual(1); + }, 2000) done(); }); @@ -158,23 +163,24 @@ export default function StartAbilityForResult(abilityContext) { it("FreeInstall_Stage_StartAbilityForResult_0500", 0, async function (done) { console.log("------------start FreeInstall_Stage_StartAbilityForResult_0500-------------"); TAG = "FreeInstall_Stage_StartAbilityForResult_0500"; - let details; - var str = { - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.qianyiyingyong.MainAbility", - "moduleName": "entry", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - await globalThis.abilityContext.startAbilityForResult(str) - .then((data) => { - details = data; - console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); - }) - await sleep(2000); - console.log(TAG + " resultCode: " + details.resultCode); - expect(details.resultCode).assertEqual(1); + setTimeout(async () => { + let details; + var str = { + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.qianyiyingyong.MainAbility", + "moduleName": "entry", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + await globalThis.abilityContext.startAbilityForResult(str) + .then((data) => { + details = data; + console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); + }) + console.log(TAG + " resultCode: " + details.resultCode); + expect(details.resultCode).assertEqual(1); + }, 2000) done(); }); @@ -197,24 +203,25 @@ export default function StartAbilityForResult(abilityContext) { }); console.log(" checkAbilityInfo deviceId : " + details1.ability.deviceId); DeviceId = details1.ability.deviceId; - await sleep(500); - var str = { - "deviceId": DeviceId, - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.qianyiyingyong.MainAbility", - "moduleName": "entry", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - await globalThis.abilityContext.startAbilityForResult(str) - .then((data) => { - details2 = data; - console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); - }) - await sleep(2000); - console.log(TAG + " resultCode: " + details2.resultCode); - expect(details2.resultCode).assertEqual(1); + setTimeout(async () => { + var str = { + "deviceId": DeviceId, + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.qianyiyingyong.MainAbility", + "moduleName": "entry", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + await globalThis.abilityContext.startAbilityForResult(str) + .then((data) => { + details2 = data; + console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); + }) + await sleep(2000); + console.log(TAG + " resultCode: " + details2.resultCode); + expect(details2.resultCode).assertEqual(1); + }, 2000) done(); }); @@ -236,24 +243,25 @@ export default function StartAbilityForResult(abilityContext) { globalThis.delegator.executeShellCommand(cmd8, (err: any, d: any) => { console.info("executeShellCommand8: err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) - await sleep(500); - let details; - var str = { - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.hm2.MainAbility", - "moduleName": "hnm2", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - await globalThis.abilityContext.startAbilityForResult(str) - .then((data) => { - details = data; - console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); - }) - await sleep(2000); - console.log(TAG + " resultCode: " + details.resultCode); - expect(details.resultCode).assertEqual(1); + setTimeout(async () => { + let details; + var str = { + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.hm2.MainAbility", + "moduleName": "hnm2", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + await globalThis.abilityContext.startAbilityForResult(str) + .then((data) => { + details = data; + console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); + }) + await sleep(2000); + console.log(TAG + " resultCode: " + details.resultCode); + expect(details.resultCode).assertEqual(1); + }, 2000) done(); }); @@ -266,24 +274,25 @@ export default function StartAbilityForResult(abilityContext) { it("FreeInstall_Stage_StartAbilityForResult_0800", 0, async function (done) { console.log("------------start FreeInstall_Stage_StartAbilityForResult_0800-------------"); TAG = "FreeInstall_Stage_StartAbilityForResult_0800"; - let details; - var str = { - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.qianyiyingyong.MainAbility", - "moduleName": "entry", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - var options = { - "windowMode": 0, "displayId": 2 - } - await globalThis.abilityContext.startAbilityForResult(str, options, (err, data) => { - console.log(TAG + ": StartAbilityForResultCallBack success, err: " + JSON.stringify(err) + - ",data: " + JSON.stringify(data)); - details = data; - }) - await sleep(2000); - console.log(TAG + " resultCode: " + details.resultCode); - expect(details.resultCode).assertEqual(1); + setTimeout(async () => { + let details; + var str = { + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.qianyiyingyong.MainAbility", + "moduleName": "entry", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + var options = { + "windowMode": 0, "displayId": 2 + } + await globalThis.abilityContext.startAbilityForResult(str, options, (err, data) => { + console.log(TAG + ": StartAbilityForResultCallBack success, err: " + JSON.stringify(err) + + ",data: " + JSON.stringify(data)); + details = data; + }) + console.log(TAG + " resultCode: " + details.resultCode); + expect(details.resultCode).assertEqual(1); + }, 2000) done(); }); @@ -296,23 +305,24 @@ export default function StartAbilityForResult(abilityContext) { it("FreeInstall_Stage_StartAbilityForResult_1200", 0, async function (done) { console.log("------------start FreeInstall_Stage_StartAbilityForResult_1200-------------"); TAG = "FreeInstall_Stage_StartAbilityForResult_1200"; - let details; - var str = { - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.qianyiyingyong.MainAbility", - "moduleName": "entry", - 'flags': '11' - } - await globalThis.abilityContext.startAbilityForResult(str) - .then((data) => { - details = data; - console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); - }) - await sleep(2000); - console.log(TAG + " resultCode: " + details.resultCode); - expect(details.resultCode).assertEqual(1); + setTimeout(async () => { + let details; + var str = { + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.qianyiyingyong.MainAbility", + "moduleName": "entry", + 'flags': '11' + } + await globalThis.abilityContext.startAbilityForResult(str) + .then((data) => { + details = data; + console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); + }) + console.log(TAG + " resultCode: " + details.resultCode); + expect(details.resultCode).assertEqual(1); + }, 2000) done(); }); @@ -325,26 +335,28 @@ export default function StartAbilityForResult(abilityContext) { it("FreeInstall_Stage_StartAbilityForResult_1400", 0, async function (done) { console.log("------------start FreeInstall_Stage_StartAbilityForResult_1400-------------"); TAG = "FreeInstall_Stage_StartAbilityForResult_1400"; - let details; - var str = { - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.qianyiyingyong.MainAbility", - "moduleName": "entry", - 'flags': '11' - } - var options = { - "windowMode": 0, "displayId": 2 - } - await globalThis.abilityContext.startAbilityForResult(str, options) - .then((data) => { - details = data; - console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); - }) - await sleep(2000); - console.log(TAG + " resultCode: " + details.resultCode); - expect(details.resultCode).assertEqual(1); + setTimeout(async () => { + let details; + var str = { + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.qianyiyingyong.MainAbility", + "moduleName": "entry", + 'flags': '11' + } + var options = { + "windowMode": 0, "displayId": 2 + } + await globalThis.abilityContext.startAbilityForResult(str, options) + .then((data) => { + details = data; + console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); + }) + await sleep(2000); + console.log(TAG + " resultCode: " + details.resultCode); + expect(details.resultCode).assertEqual(1); + }, 2000) done(); }); @@ -357,23 +369,24 @@ export default function StartAbilityForResult(abilityContext) { it("FreeInstall_Stage_StartAbilityForResult_1600", 0, async function (done) { console.log("------------start FreeInstall_Stage_StartAbilityForResult_1600-------------"); TAG = "FreeInstall_Stage_StartAbilityForResult_1600"; - let details; - var str = { - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.qianyiyingyong.MainAbility", - "moduleName": "entry", - 'flags': '' - } - await globalThis.abilityContext.startAbilityForResult(str) - .then((data) => { - details = data; - console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); - }) - await sleep(2000); - console.log(TAG + " resultCode: " + details.resultCode); - expect(details.resultCode).assertEqual(1); + setTimeout(async () => { + let details; + var str = { + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.qianyiyingyong.MainAbility", + "moduleName": "entry", + 'flags': '' + } + await globalThis.abilityContext.startAbilityForResult(str) + .then((data) => { + details = data; + console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); + }) + console.log(TAG + " resultCode: " + details.resultCode); + expect(details.resultCode).assertEqual(1); + }, 2000) done(); }); @@ -386,26 +399,27 @@ export default function StartAbilityForResult(abilityContext) { it("FreeInstall_Stage_StartAbilityForResult_1800", 0, async function (done) { console.log("------------start FreeInstall_Stage_StartAbilityForResult_1800-------------"); TAG = "FreeInstall_Stage_StartAbilityForResult_1800"; - let details; - var str = { - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.qianyiyingyong.MainAbility", - "moduleName": "entry", - 'flags': '' - } - var options = { - "windowMode": 0, "displayId": 2 - } - await globalThis.abilityContext.startAbilityForResult(str, options) - .then((data) => { - details = data; - console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); - }) - await sleep(2000); - console.log(TAG + " resultCode: " + details.resultCode); - expect(details.resultCode).assertEqual(1); + setTimeout(async () => { + let details; + var str = { + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.qianyiyingyong.MainAbility", + "moduleName": "entry", + 'flags': '' + } + var options = { + "windowMode": 0, "displayId": 2 + } + await globalThis.abilityContext.startAbilityForResult(str, options) + .then((data) => { + details = data; + console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); + }) + console.log(TAG + " resultCode: " + details.resultCode); + expect(details.resultCode).assertEqual(1); + }, 2000) done(); }); @@ -422,24 +436,25 @@ export default function StartAbilityForResult(abilityContext) { globalThis.delegator.executeShellCommand(cmd9, (err: any, d: any) => { console.info("executeShellCommand9: err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) - await sleep(500); - let details; - var str = { - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.qianyiyingyong.MainAbility", - "moduleName": "hnm2", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - await globalThis.abilityContext.startAbilityForResult(str) - .then((data) => { - details = data; - console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); - }) - await sleep(2000); - console.log(TAG + " resultCode: " + details.resultCode); - expect(details.resultCode).assertEqual(1); + setTimeout(async () => { + let details; + var str = { + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.qianyiyingyong.MainAbility", + "moduleName": "hnm2", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + await globalThis.abilityContext.startAbilityForResult(str) + .then((data) => { + details = data; + console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); + }) + await sleep(2000); + console.log(TAG + " resultCode: " + details.resultCode); + expect(details.resultCode).assertEqual(1); + }, 2000) done(); }); @@ -458,30 +473,31 @@ export default function StartAbilityForResult(abilityContext) { }) await sleep(500); var cmd11 = "cp data/test/AtomizationResultStageEntry.hap /data/app/el2/100/base/com.ohos.hag.famanager/" + - "haps/entry/files"; + "haps/entry/files"; globalThis.delegator.executeShellCommand(cmd11, (err: any, d: any) => { console.info("executeShellCommand11 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) - await sleep(500); - let details; - var str = { - 'deviceId': '', - "bundleName": "com.example.qianyiyingyong.hmservice", - "abilityName": "com.example.qianyiyingyong.MainAbility", - "moduleName": "entry", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - 'parameters': {"name": "1111", "Ext2": "ExtValue2","site":"很开心看到你!"} - } - await globalThis.abilityContext.startAbilityForResult(str) - .then((data) => { - details = data; - console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); - }) - await sleep(2000); - console.log(TAG + " resultCode: " + details.resultCode); - expect(details.resultCode).assertEqual(1); + setTimeout(async () => { + let details; + var str = { + 'deviceId': '', + "bundleName": "com.example.qianyiyingyong.hmservice", + "abilityName": "com.example.qianyiyingyong.MainAbility", + "moduleName": "entry", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + 'parameters': { "name": "1111", "Ext2": "ExtValue2", "site": "很开心看到你!" } + } + await globalThis.abilityContext.startAbilityForResult(str) + .then((data) => { + details = data; + console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); + }) + await sleep(2000); + console.log(TAG + " resultCode: " + details.resultCode); + expect(details.resultCode).assertEqual(1); + }, 2000) done(); }); @@ -500,29 +516,30 @@ export default function StartAbilityForResult(abilityContext) { }) await sleep(500); var cmd13 = "cp data/test/StageResultMyApplication1.hap /data/app/el2/100/base/com.ohos.hag.famanager/haps/" + - "entry/files"; + "entry/files"; globalThis.delegator.executeShellCommand(cmd13, (err: any, d: any) => { console.info("executeShellCommand13 : err : " + JSON.stringify(err), " data : " + JSON.stringify(d)); }) - await sleep(500); - let details; - var str = { - "deviceId": "", - "bundleName": "com.example.startAbilityForResult.hmservice", - "abilityName": "MainAbility1", - "moduleName": "myapplication1", - "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, - } - await globalThis.abilityContext.startAbilityForResult(str) - .then((data) => { - details = data; - console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) - }).catch((error) => { - console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); - }) - await sleep(2000); - console.log(TAG + " resultCode: " + details.resultCode); - expect(details.resultCode).assertEqual(1); + setTimeout(async () => { + let details; + var str = { + "deviceId": "", + "bundleName": "com.example.startAbilityForResult.hmservice", + "abilityName": "MainAbility1", + "moduleName": "myapplication1", + "flags": wantConstant.Flags.FLAG_INSTALL_ON_DEMAND, + } + await globalThis.abilityContext.startAbilityForResult(str) + .then((data) => { + details = data; + console.info(TAG + ' StartAbilityForResultPromise successful. Data: ' + JSON.stringify(data)) + }).catch((error) => { + console.info(TAG + ' StartAbilityForResultPromise failed. Cause: ' + JSON.stringify(error)); + }) + await sleep(2000); + console.log(TAG + " resultCode: " + details.resultCode); + expect(details.resultCode).assertEqual(1); + }, 2000) done(); }); }) diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/actsfreeinstallstartabilityforresultstagetest/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/actsfreeinstallstartabilityforresultstagetest/entry/src/main/module.json index f1ba526b0e06b898cfd8cdc6e67ed5d4bd584985..af04d14f6f4ac6b6ef5ff0526733d6bd42f8625b 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/actsfreeinstallstartabilityforresultstagetest/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/actsfreeinstallstartabilityforresultstagetest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/actsstartabilityforresultnotargetbundleliststagetest/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/actsstartabilityforresultnotargetbundleliststagetest/entry/src/main/module.json index f1ba526b0e06b898cfd8cdc6e67ed5d4bd584985..af04d14f6f4ac6b6ef5ff0526733d6bd42f8625b 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/actsstartabilityforresultnotargetbundleliststagetest/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/actsstartabilityforresultnotargetbundleliststagetest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstageentry/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstageentry/entry/src/main/ets/MainAbility/MainAbility.ts index fb41b82036e4a81e2dfee7464b6a0a139bec45d4..6a7c9df682d496822f9dc34ea86969f0d9dad119 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstageentry/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstageentry/entry/src/main/ets/MainAbility/MainAbility.ts @@ -52,7 +52,6 @@ export default class MainAbility extends Ability { }, } ); - globalThis.abilityContext.terminateSelf(); console.info('fAStartAbilityForResultPromise terminateSelfWithResult END'); }, 1000); } diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstageentry/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstageentry/entry/src/main/module.json index 2f4cd628c66961230f25795be61b8c448743d45d..3ecd447eccee6a2fc1419efb3f4394e1f052c5e3 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstageentry/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstageentry/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstagehm2/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstagehm2/entry/src/main/ets/MainAbility/MainAbility.ts index 1d022ce9f570c68679325688e05cfe14ad39a6c7..4efeca31a9e028332c29370a1f1c5d0e738f6af2 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstagehm2/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstagehm2/entry/src/main/ets/MainAbility/MainAbility.ts @@ -52,7 +52,6 @@ export default class MainAbility extends Ability { }, } ); - globalThis.abilityContext.terminateSelf(); console.info('fAStartAbilityForResultPromise terminateSelfWithResult END'); }, 1000); } diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstagehm2/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstagehm2/entry/src/main/module.json index 12ecea716d57ff14c14c72866175e9521ac9d0db..f22c3e8febec8666b3e7c77773acf18c0609d52e 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstagehm2/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstagehm2/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:hnm2_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstagehnm2/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstagehnm2/entry/src/main/ets/MainAbility/MainAbility.ts index 1d022ce9f570c68679325688e05cfe14ad39a6c7..4efeca31a9e028332c29370a1f1c5d0e738f6af2 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstagehnm2/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstagehnm2/entry/src/main/ets/MainAbility/MainAbility.ts @@ -52,7 +52,6 @@ export default class MainAbility extends Ability { }, } ); - globalThis.abilityContext.terminateSelf(); console.info('fAStartAbilityForResultPromise terminateSelfWithResult END'); }, 1000); } diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstagehnm2/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstagehnm2/entry/src/main/module.json index 14ecbbe576f2cf026f8c4a7b7737dee204ab13b3..1569ee82ba65465e72c4b6e7102713e8757b726d 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstagehnm2/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/atomizationresultstagehnm2/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:hnm2_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/stageresultmyapplication1/entry/src/main/ets/MainAbility1/MainAbility1.ts b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/stageresultmyapplication1/entry/src/main/ets/MainAbility1/MainAbility1.ts index af7509fe368a0f12f5f634bd87f37cdff85dd3f0..1031a55f562925339bd4cdf6cec4e74ad14060ad 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/stageresultmyapplication1/entry/src/main/ets/MainAbility1/MainAbility1.ts +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/stageresultmyapplication1/entry/src/main/ets/MainAbility1/MainAbility1.ts @@ -52,7 +52,6 @@ export default class MainAbility1 extends Ability { }, } ); - globalThis.abilityContext.terminateSelf(); console.info('fAStartAbilityForResultPromise terminateSelfWithResult END'); }, 1000); } diff --git a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/stageresultmyapplication1/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/stageresultmyapplication1/entry/src/main/module.json index 418fe1a5343885817705a3967670e4d56b45e542..88c6c58c2f8e6a8dbb3d1fa4dd81d6312f34580d 100644 --- a/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/stageresultmyapplication1/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/startabilityforresultstagetest/stageresultmyapplication1/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:myapplication1_desc", "mainElement": "MainAbility1", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/startabilitystagetest/actsfreeinstallstartabilitystagetest/entry/src/main/ets/test/StartAbilityTest.ets b/ability/ability_runtime/freeinstalltest/startabilitystagetest/actsfreeinstallstartabilitystagetest/entry/src/main/ets/test/StartAbilityTest.ets index 94642e7d33b4313a1cf07b4226dc598f285ad340..cdbfb219fc2285ed0ebe799c2e390360628e081d 100644 --- a/ability/ability_runtime/freeinstalltest/startabilitystagetest/actsfreeinstallstartabilitystagetest/entry/src/main/ets/test/StartAbilityTest.ets +++ b/ability/ability_runtime/freeinstalltest/startabilitystagetest/actsfreeinstallstartabilitystagetest/entry/src/main/ets/test/StartAbilityTest.ets @@ -820,7 +820,7 @@ export default function startAbilityTest(abilityContext) { abilityForeground(TAG); await sleep(1000); abilityBackground(TAG); - await sleep(5000); + await sleep(2000); var str = { "bundleName": "com.example.qianyiyingyong.hmservice", "abilityName": "com.example.qianyiyingyong.MainAbility", @@ -855,7 +855,7 @@ export default function startAbilityTest(abilityContext) { abilityForeground(TAG); await sleep(1000); abilityBackground(TAG); - await sleep(5000); + await sleep(2000); var str = { "bundleName": "com.example.qianyiyingyong.hmservice", "abilityName": "com.example.qianyiyingyong.MainAbility", @@ -916,7 +916,7 @@ export default function startAbilityTest(abilityContext) { console.log(TAG + ": startAbility fail. err: " + JSON.stringify(error)); expect(error.code == 3).assertTrue(); }); - await sleep(35000); + await sleep(2000); console.info("------------end FreeInstall_Stage_Local_StartAbility_2500-------------"); done(); }); @@ -1168,7 +1168,7 @@ export default function startAbilityTest(abilityContext) { }).catch((error) => { console.log(TAG + ": Mainability2 startAbility fail. err: " + JSON.stringify(error)); }); - await sleep(5000); + await sleep(2000); abilityBackground(TAG); await sleep(1000); var str2 = { @@ -1215,7 +1215,7 @@ export default function startAbilityTest(abilityContext) { }).catch((error) => { console.log(TAG + ": Mainability2 startAbility fail. err: " + JSON.stringify(error)); }); - await sleep(5000); + await sleep(2000); abilityBackground(TAG); await sleep(1000); var str2 = { diff --git a/ability/ability_runtime/freeinstalltest/startabilitystagetest/actsfreeinstallstartabilitystagetest/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/startabilitystagetest/actsfreeinstallstartabilitystagetest/entry/src/main/module.json index 07b378b1f951143a31af615e8069c8d28e4697bc..e4c26cd0c21c7104f549af8582039ef54ae0f101 100644 --- a/ability/ability_runtime/freeinstalltest/startabilitystagetest/actsfreeinstallstartabilitystagetest/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/startabilitystagetest/actsfreeinstallstartabilitystagetest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], @@ -52,6 +53,12 @@ }, { "name": "ohos.permission.DISTRIBUTED_DATASYNC" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY" } ], "extensionAbilities": [ diff --git a/ability/ability_runtime/freeinstalltest/startabilitystagetest/actsstartabilitynotargetbundleliststagetest/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/startabilitystagetest/actsstartabilitynotargetbundleliststagetest/entry/src/main/module.json index 93a744ea7a2a64d1d1f115e06cad1e79ab8677b8..2050df38be0c0c93f3e9ea30375fc817d9db3b17 100644 --- a/ability/ability_runtime/freeinstalltest/startabilitystagetest/actsstartabilitynotargetbundleliststagetest/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/startabilitystagetest/actsstartabilitynotargetbundleliststagetest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/startabilitystagetest/atomizationstageentry/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/startabilitystagetest/atomizationstageentry/entry/src/main/module.json index 8d4674b1563b9b3b0df355d5ba11c3458b5cb6a2..a9bc619bd0130884826a3c9eb4b6ec5617957936 100644 --- a/ability/ability_runtime/freeinstalltest/startabilitystagetest/atomizationstageentry/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/startabilitystagetest/atomizationstageentry/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/startabilitystagetest/atomizationstagehm2/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/startabilitystagetest/atomizationstagehm2/entry/src/main/module.json index 752f06755763e5fcbc77016cb5bf2222165e8b6a..ae8721b06bcf0c38e5f048dfe92baa1f1770c864 100644 --- a/ability/ability_runtime/freeinstalltest/startabilitystagetest/atomizationstagehm2/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/startabilitystagetest/atomizationstagehm2/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:hnm2_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/startabilitystagetest/atomizationstagehm4/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/startabilitystagetest/atomizationstagehm4/entry/src/main/module.json index 02755db069282541460533e8f38a8b58fb0eae78..9321c9b2513d0e06576920ef6e742d21c7a00e04 100644 --- a/ability/ability_runtime/freeinstalltest/startabilitystagetest/atomizationstagehm4/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/startabilitystagetest/atomizationstagehm4/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:hm4_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/freeinstalltest/startabilitystagetest/stagemyapplication1/entry/src/main/module.json b/ability/ability_runtime/freeinstalltest/startabilitystagetest/stagemyapplication1/entry/src/main/module.json index 85af6ede85105ff19afa4698bdef7b07fdd4a3a2..973365f5d3512e35b86b60c807395d69af2f3229 100644 --- a/ability/ability_runtime/freeinstalltest/startabilitystagetest/stagemyapplication1/entry/src/main/module.json +++ b/ability/ability_runtime/freeinstalltest/startabilitystagetest/stagemyapplication1/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:myapplication1_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/module.json b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/module.json index 6bcf8cc50e5744c28ddbecff85eff36c52292f62..d64acbeb232bb9ca36d3d886fcb714dec6f2b040 100644 --- a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/module.json +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountRelyHap/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/MainAbility.ts index 553641481ef812ee7fe5997aed5239dfa725310b..717657a0c8f0bf4ccfb444169ff61435adc644aa 100644 --- a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -13,6 +13,9 @@ * limitations under the License. */ import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' export default class MainAbility extends Ability { @@ -20,6 +23,14 @@ export default class MainAbility extends Ability { // Ability is creating, initialize resources for this ability console.log("MainAbility onCreate") globalThis.abilityWant = want; + globalThis.abilityContext = this.context + console.info("start run testcase!!!!") + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } onDestroy() { @@ -30,7 +41,7 @@ export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { // Main window is created, set main page for this ability console.log("MainAbility onWindowStageCreate") - globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null) } diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/pages/index/index.ets b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/pages/index/index.ets index 18591878efec8e048ce0aca66617cd847c5e6617..d10df7d7f9eaf60fa1082f1767a352ce5bb9a9ab 100644 --- a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/pages/index/index.ets +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -13,20 +13,10 @@ * limitations under the License. */ import router from '@ohos.router'; -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from '@ohos/hypium' -import testsuite from '../../../test/List.test' @Entry @Component struct Index { aboutToAppear() { - console.info("start run testcase!!!!") - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/Ability.test.ets index fdfab03ef658f7c572dd10cf99bc13cbb716b05f..daf5122ee552106eeb4e9d079466e4a9e2957ae5 100644 --- a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/ets/test/Ability.test.ets @@ -42,6 +42,22 @@ export default function killProcessWithAccountTest() { }) }) + afterEach(async (done) => { + console.log("ACTS_KillProcessWithAccount afterEach called"); + let wantInfo = { + bundleName: "com.acts.killprocesswithaccount", + abilityName: "com.acts.killprocesswithaccount.MainAbility" + } + await globalThis.abilityContext.startAbility(wantInfo).then((data) => { + console.log("ACTS_KillProcessWithAccount startAbility data : " + JSON.stringify(data)); + }).catch((err) => { + console.log("ACTS_KillProcessWithAccount startAbility err : " + JSON.stringify(err)); + }) + setTimeout(function () { + console.log("ACTS_KillProcessWithAccount afterEach end"); + done(); + }, 500); + }) beforeEach(async (done) => { console.log('======>beforeEach killProcessWithAccountTest<=======' + flag); diff --git a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/module.json b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/module.json index cf635c27fcebe0b370f622173adb8a542a22492b..ee7c929a84a5d0a5fceff42e847b912698042cd0 100644 --- a/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/module.json +++ b/ability/ability_runtime/killprocesswithaccountstage/ActsKillProcessWithAccountTest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -21,6 +22,7 @@ "label": "$string:entry_label", "visible": true, "orientation": "portrait", + "launchType": "singleton", "skills": [ { "actions": [ @@ -34,7 +36,7 @@ } ], "requestPermissions": [ - { + { "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" }, @@ -69,6 +71,14 @@ { "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", "reason":"need use ohos.permission.GET_RUNNING_INFO" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" } ] } diff --git a/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/config.json b/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/config.json index 2b2738b6e0a640428d6ed6b37945c1148058a32e..8f852119ca050d04352c54a134ac0db9c1ef3ee8 100644 --- a/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/config.json +++ b/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.newwanthapapi7", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { @@ -69,6 +70,10 @@ { "name":"ohos.permission.INSTALL_BUNDLE", "reason":"need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ], "js": [ diff --git a/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/pages/index/index.js b/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/pages/index/index.js index 2b9f6f6691f15f6773cd981d6de18614c57f1cd8..c0fc27e25b690f0c5292f9ab5cd70b9da8877b9a 100644 --- a/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/pages/index/index.js +++ b/ability/ability_runtime/newwant/actsnewwantapi7relyhap/entry/src/main/js/default/pages/index/index.js @@ -22,6 +22,15 @@ import featureAbility from '@ohos.ability.featureAbility' const injectRef = Object.getPrototypeOf(global) || global injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') +function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } +} + export default { data: { title: "" @@ -38,7 +47,7 @@ export default { }, async onShow() { console.info('ACTS_NewWant Api7 onShow'); - + sleep(1000) await featureAbility.startAbility( { want: 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/actsnewwantarelyhap/entry/src/main/module.json b/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/module.json index 7dd56920a8940087dea3f74f42c759d80a4bafae..90b1bea00b96035d87d8f967804c26e8349f3173 100644 --- a/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/module.json +++ b/ability/ability_runtime/newwant/actsnewwantarelyhap/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -58,6 +59,10 @@ { "name":"ohos.permission.INSTALL_BUNDLE", "reason":"need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ] 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/actsnewwantbrelyhap/entry/src/main/module.json b/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/module.json index 3b33503efa2e175ab55e125347b936b82e92839a..053048272a8840737cae5c7b6d99bd39321cb9b1 100644 --- a/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/module.json +++ b/ability/ability_runtime/newwant/actsnewwantbrelyhap/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -58,6 +59,10 @@ { "name":"ohos.permission.INSTALL_BUNDLE", "reason":"need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ] 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/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts index b1c64a7122966536fc31b8745f021a08888f1052..213d8a9b8b8c9edbf692aa94ab21dbc540496f9e 100644 --- a/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -17,6 +17,15 @@ import ServiceExtension from '@ohos.application.ServiceExtensionAbility'; import Want from '@ohos.application.Want'; import rpc from "@ohos.rpc"; +function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } +} + export default class ServiceAbility extends ServiceExtension { onCreate(want: Want) { globalThis.abilityWant = want; @@ -28,6 +37,7 @@ export default class ServiceAbility extends ServiceExtension { } onConnect(want) { + sleep(1000) var connId; console.log('ACTS_NewWant ServiceAbility onConnect, want:' + want.abilityName); globalThis.extensionContext = this.context diff --git a/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/module.json b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/module.json index 1c9da0c5dd6ab3a761929c0504118abf35d16c1f..f226b824474f572604ee4622cf19e7388f5ad0bf 100644 --- a/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/module.json +++ b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -79,6 +80,10 @@ { "name":"ohos.permission.INSTALL_BUNDLE", "reason":"need use ohos.permission.INSTALL_BUNDLE" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ] diff --git a/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/MainAbility/MainAbility.ts index 2e7d00667eda224bc5e25c2eab34ad1987b1aa56..f59e7275010954155d0cf84c42d690d9cb308f88 100644 --- a/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -14,6 +14,9 @@ */ import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' export default class MainAbility extends Ability { @@ -21,6 +24,15 @@ export default class MainAbility extends Ability { // Ability is creating, initialize resources for this ability console.log("MainAbility onCreate") globalThis.abilityWant = want; + + globalThis.abilityContext = this.context + console.info("start run testcase!!!!") + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } onDestroy() { @@ -31,7 +43,7 @@ export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { // Main window is created, set main page for this ability console.log("MainAbility onWindowStageCreate") - globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null) } diff --git a/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/MainAbility/pages/index/index.ets b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/MainAbility/pages/index/index.ets index b2438dfdf6b68001495268bff1bc2cdb5ab6c01d..bc18d0e15e33ca45d70f69187330e712eba1d974 100644 --- a/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/MainAbility/pages/index/index.ets +++ b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -14,23 +14,13 @@ */ import router from '@ohos.router'; -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from '@ohos/hypium' -import testsuite from '../../../test/List.test' @Entry @Component struct Index { - aboutToAppear(){ - console.info("start run testcase!!!!") - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + aboutToAppear(){ } build() { diff --git a/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/test/Ability.test.ets index 5cc6c752a544020ebf4a6219ae2e9c5a955330dd..fcec00efd9314b4d6d3d5db9ab62ee95a40b91e8 100644 --- a/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/test/Ability.test.ets @@ -15,6 +15,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" import commonEvent from '@ohos.commonEvent' +import backgroundTaskManager from '@ohos.backgroundTaskManager'; let subscriberInfo = { events: ['onCreateMain_To_Test_CommonEvent', @@ -38,6 +39,31 @@ let flagNewWant = false; export default function abilityTest() { describe('ActsNewWantTest', function () { + let TAG1 = 'ACTS_NewWant_Test : ' + let id = undefined; + beforeAll(async (done) => { + console.log(TAG1 + "beforeAll called"); + let myReason = 'test ActsNewWantTest'; + let delayInfo = backgroundTaskManager.requestSuspendDelay(myReason, () => { + console.log(TAG1 + "Request suspension delay will time out."); + }) + id = delayInfo.requestId; + console.log(TAG1 + "requestId is : " + id); + setTimeout(function () { + console.log(TAG1 + "beforeAll end"); + done(); + }, 1000); + }) + + afterAll(async (done) => { + console.log(TAG1 + "afterAll called"); + backgroundTaskManager.cancelSuspendDelay(id); + setTimeout(function () { + console.log(TAG1 + "afterAll end"); + done(); + }, 1000); + }) + /** * @tc.number: ACTS_NewWant_Test_0100 * @tc.name: Starting standard Ability for the first time does not trigger onNewWant. @@ -562,7 +588,7 @@ export default function abilityTest() { + JSON.stringify(error) + ", " + JSON.stringify(data)) }) - + function SubscribeCallBack(err, data) { console.debug("ACTS_NewWant_Test_0800====>Subscribe CallBack data:====>" diff --git a/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/module.json b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/module.json index 3ecfc06f7d7dabe7f0b63024032048553cc03d25..fad375b738d49b02aba8f87ad8346ad8a5cf7d86 100644 --- a/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/module.json +++ b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -21,6 +22,7 @@ "label": "$string:entry_label", "visible": true, "orientation": "portrait", + "launchType": "singleton", "skills": [ { "actions": [ @@ -73,6 +75,10 @@ { "name":"ohos.permission.CLEAN_APPLICATION_DATA", "reason":"need use ohos.permission.CLEAN_APPLICATION_DATA" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ] diff --git a/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/module.json b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/module.json index c8dcd29a0f33491db39c44ba7f883c19cc8d8434..7d0bbbc30d0798a2cd4c0c01a4e091b13668cf3f 100644 --- a/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/module.json +++ b/ability/ability_runtime/non_concurrent/acts_systemappa_test/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -115,7 +116,15 @@ { "name":"ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS", "reason":"need use ohos.permission.GET_RUNNING_INFO" - } + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" + } ] } } diff --git a/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/module.json b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/module.json index 620defb9517f2064e42340b499e501a5bb0495b6..d6e32dc293ce5b3b316c745983a7df9c467e4c4e 100644 --- a/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/module.json +++ b/ability/ability_runtime/non_concurrent/acts_systemappone_rely_test/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/module.json index 1089647e9fb653e300e0171eec1bfeb6f0f948bc..05b2fb1fd043de0022f35a02a50c6364d1f772e3 100644 --- a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/module.json +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapaarelyhap/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/module.json index 7e3387923982544d81cdb08dd8d4b42847cb1abc..d72dfee719aea74a6915acca4a0c61976109633d 100644 --- a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/module.json +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapabrelyhap/entry/src/main/module.json @@ -7,6 +7,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/module.json index 73bdcb7f6e2337ee4f47bb0bf8e68b4b9e70d6cf..7cf6ec52373110f66bd8d3aaaaec9fb69aea0a9a 100644 --- a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/module.json +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbarelyhap/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/module.json index 9d46fa80fb140233ed4123ccac174955be6e7c18..ac8458c673a70377beab2b2d912cf955dca9b8e6 100644 --- a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/module.json +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbbrelyhap/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/module.json index e14379235d134cb582c13ee15d79b7c8a4ddd7c1..815f276fbff0db6c968e5496f9e51bae8ee2a9f4 100644 --- a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/module.json +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbcrelyhap/entry/src/main/module.json @@ -7,6 +7,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/module.json index ead67d4bb61501de77df770112d8cf5eb9c1e4e9..2e6a60ec78e4e703aeaa81568c924b8a7468b5bc 100644 --- a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/module.json +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbdrelyhap/entry/src/main/module.json @@ -7,6 +7,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/module.json index 527f67cd10dce15b822d892de226fe979b6a20c6..0ed216baf25de7d793ef17bb73be2577779d83c9 100644 --- a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/module.json +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapberelyhap/entry/src/main/module.json @@ -7,6 +7,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/module.json index d9eb79683ad4de3182dbc17e6ff3faa1a1205042..405388a616a8be18f7ad0b088407e08d9977bb21 100644 --- a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/module.json +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancehapbfrelyhap/entry/src/main/module.json @@ -7,6 +7,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts index 5d9cb94eb1b16f32da7f1ba0b9896c87323bca11..03bed122d3c2e0b39d8aaff168f1b14e030d01ed 100644 --- a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -13,12 +13,24 @@ * limitations under the License. */ import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' export default class MainAbility extends Ability { onCreate(want,launchParam){ // Ability is creating, initialize resources for this ability console.log("MainAbility onCreate") globalThis.abilityWant = want; + + globalThis.abilityContext = this.context + console.info("start run testcase!!!!") + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } onDestroy() { @@ -29,7 +41,7 @@ export default class MainAbility extends Ability { onWindowStageCreate(windowStage) { // Main window is created, set main page for this ability console.log("MainAbility onWindowStageCreate") - globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null) } diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/pages/index/index.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/pages/index/index.ets index bebda07c2cf21dccd43f7cc4b980205ca56a6168..acd879f64b9dada49873347dd652cda4ea9fb2ea 100644 --- a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/pages/index/index.ets +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -13,9 +13,6 @@ * limitations under the License. */ import router from '@ohos.router'; -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from '@ohos/hypium' -import testsuite from '../../../test/List.test' @Entry @@ -23,13 +20,6 @@ import testsuite from '../../../test/List.test' struct Index { aboutToAppear(){ - console.info("start run testcase!!!!") - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } build() { diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/Ability.test.ets index 860b27faba41b3ff9a5cf999a46bc3747eb62b18..93b1791ecefaeef9eac44898534ddb9e73d7fd53 100644 --- a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/ets/test/Ability.test.ets @@ -16,7 +16,6 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from import commonEvent from '@ohos.commonEvent' import abilityManager from '@ohos.application.abilityManager'; import appManager from '@ohos.application.appManager' -import missionManager from '@ohos.application.missionManager' const TIMEOUT = 1000; var subscriberInfo = { @@ -35,6 +34,9 @@ var processNameA = "com.example.multiinstancehapa"; var processNameB = "com.example.multiinstancehapb"; var processNameC = "com.example.multiinstancehapc"; +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} export default function abilityTest() { describe('ActsProcessMultiInstanceTest', function () { @@ -43,7 +45,20 @@ export default function abilityTest() { await appManager.killProcessesByBundleName("com.example.multiinstancehapa"); await appManager.killProcessesByBundleName("com.example.multiinstancehapb"); - done(); + let wantInfo = { + bundleName: "com.example.processmultiinstance", + abilityName: "com.example.processmultiinstance.MainAbility" + } + await globalThis.abilityContext.startAbility(wantInfo).then((data) => { + console.log("ACTS_Process_MultiInstance startAbility data: " + JSON.stringify(data)); + }).catch((err) => { + console.log("ACTS_Process_MultiInstance startAbility err: " + JSON.stringify(err)); + }) + + setTimeout(function () { + console.log("ACTS_Process_MultiInstance afterEach end"); + done(); + }, 500); }) /** @@ -138,6 +153,7 @@ export default function abilityTest() { done(); } } + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapba.MainAbility", @@ -145,6 +161,7 @@ export default function abilityTest() { console.log('ACTS_Process_MultiInstance_0100 - startAbilityhapba: ' + JSON.stringify(err) + ", " + JSON.stringify(data)) }) + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapbb.MainAbility", @@ -247,6 +264,7 @@ export default function abilityTest() { done(); } } + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapbc.MainAbility", @@ -254,6 +272,7 @@ export default function abilityTest() { console.log('ACTS_Process_MultiInstance_0200 - startAbilityhapbc: ' + JSON.stringify(err) + ", " + JSON.stringify(data)) }) + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapbd.MainAbility", @@ -361,6 +380,7 @@ export default function abilityTest() { done(); } } + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapbd.MainAbility", @@ -368,6 +388,7 @@ export default function abilityTest() { console.log('ACTS_Process_MultiInstance_0300 - startAbilityhapbd: ' + JSON.stringify(err) + ", " + JSON.stringify(data)) }) + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapbe.MainAbility", @@ -472,6 +493,7 @@ export default function abilityTest() { done(); } } + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapba.MainAbility", @@ -479,6 +501,7 @@ export default function abilityTest() { console.log('ACTS_Process_MultiInstance_0400 - startAbilityhapba: ' + JSON.stringify(err) + ", " + JSON.stringify(data)) }) + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapbf.MainAbility", @@ -583,6 +606,7 @@ export default function abilityTest() { done(); } } + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapa", abilityName: "com.example.multiinstancehapaa.MainAbility", @@ -590,6 +614,7 @@ export default function abilityTest() { console.log('ACTS_Process_MultiInstance_0500 - startAbilityhapaa: ' + JSON.stringify(err) + ", " + JSON.stringify(data)) }) + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapbe.MainAbility", @@ -697,6 +722,7 @@ export default function abilityTest() { done(); } } + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapa", abilityName: "com.example.multiinstancehapaa.MainAbility", @@ -704,6 +730,7 @@ export default function abilityTest() { console.log('ACTS_Process_MultiInstance_0600 - startAbilityhapaa: ' + JSON.stringify(err) + ", " + JSON.stringify(data)) }) + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapbf.MainAbility", @@ -810,6 +837,7 @@ export default function abilityTest() { done(); } } + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapa", abilityName: "com.example.multiinstancehapab.MainAbility", @@ -817,6 +845,7 @@ export default function abilityTest() { console.log('ACTS_Process_MultiInstance_0700 - startAbilityhapab: ' + JSON.stringify(err) + ", " + JSON.stringify(data)) }) + await sleep(500) globalThis.abilityContext.startAbility({ bundleName: "com.example.multiinstancehapb", abilityName: "com.example.multiinstancehapbc.MainAbility", diff --git a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/module.json b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/module.json index 0152946dc4cd7e2cd788feae646b840fcd02f670..ec10420819e7778998bd2d1615ba15490e38381f 100644 --- a/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/module.json +++ b/ability/ability_runtime/processmultiinstance/actsamsprocessmultiinstancetest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -21,6 +22,7 @@ "label": "$string:entry_label", "visible": true, "orientation": "portrait", + "launchType": "singleton", "skills": [ { "actions": [ @@ -73,6 +75,10 @@ { "name":"ohos.permission.CLEAN_APPLICATION_DATA", "reason":"need use ohos.permission.CLEAN_APPLICATION_DATA" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" } ] } diff --git a/ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/module.json b/ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/module.json index 9f1792371629b9a9fec9279715236ac9ba85fe8a..f2c1d762c17fed734dab46759222bfd5348d3fd6 100644 --- a/ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/module.json +++ b/ability/ability_runtime/stage/actslifecyclemultihap2/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:hap2_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/stage/actslifecyclemultihap3/entry/src/main/module.json b/ability/ability_runtime/stage/actslifecyclemultihap3/entry/src/main/module.json index 52dbb626fe4faa2b956997a1f1bcc7a086ef7819..5165038ad82fcb5326ae499150a04f62c8ef3eda 100644 --- a/ability/ability_runtime/stage/actslifecyclemultihap3/entry/src/main/module.json +++ b/ability/ability_runtime/stage/actslifecyclemultihap3/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:hap3_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/module.json b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/module.json index b2a1749da88ed99a65c7bd6e56f29745c8b45176..564159e9f0a917ad1c614f8037333a87d52dedd6 100644 --- a/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/module.json +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -100,6 +101,12 @@ }, { "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY" } ] } diff --git a/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/module.json b/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/module.json index 3bac8ff18e11056201cbf3171df82893faaedd94..3c9d185aca7a80a84837ee82da4f4bf711e8be91 100644 --- a/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/module.json +++ b/ability/ability_runtime/stage/actslifecyclemultihaptest/hap4/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:hap4_desc", "mainElement": "Hap4MainAbility1", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets index d1dd39f8f60df31efc4ffa1995941c7bb984cd0e..1e84d94fb59d475842e3cb523c92dcadfc5ac5a3 100644 --- a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets @@ -483,26 +483,33 @@ export default function lifecycleTest() { console.log(TAG + " callbackid1 : " + JSON.stringify(globalThis.callbackid1)); var strtemp = ""; var listtemp = []; + var listtemp2 = []; for (var i = 0; i < globalThis.list1.length; i++) { strtemp = globalThis.list1[i].substring(0, 12); - if (strtemp == "MainAbility5" || strtemp == "MainAbility2") { - listtemp.push(globalThis.list1[i]); + if (strtemp == "MainAbility2") { + listtemp.push(globalThis.list1[i]); + } else if (strtemp == "MainAbility5") { + listtemp2.push(globalThis.list1[i]); } } console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); + console.log(TAG + " listtemp2 is :" + JSON.stringify(listtemp2)); let exlist = listtemp; - expect(exlist[0]).assertEqual("MainAbility5 onAbilityCreate"); - expect(exlist[1]).assertEqual("MainAbility5 onWindowStageCreate"); - expect(exlist[2]).assertEqual("MainAbility5 onAbilityForeground"); - expect(exlist[3]).assertEqual("MainAbility5 onAbilityBackground"); - expect(exlist[4]).assertEqual("MainAbility5 onWindowStageDestroy"); - expect(exlist[5]).assertEqual("MainAbility5 onAbilityDestroy"); - expect(exlist[6]).assertEqual("MainAbility2 onAbilityCreate"); - expect(exlist[7]).assertEqual("MainAbility2 onWindowStageCreate"); - expect(exlist[8]).assertEqual("MainAbility2 onAbilityForeground"); - expect(exlist[9]).assertEqual("MainAbility2 onAbilityBackground"); - expect(exlist[10]).assertEqual("MainAbility2 onWindowStageDestroy"); - expect(exlist[11]).assertEqual("MainAbility2 onAbilityDestroy"); + let exlist2 = listtemp2; + expect(exlist[0]).assertEqual("MainAbility2 onAbilityCreate"); + expect(exlist[1]).assertEqual("MainAbility2 onWindowStageCreate"); + expect(exlist[2]).assertEqual("MainAbility2 onAbilityForeground"); + expect(exlist[3]).assertEqual("MainAbility2 onAbilityBackground"); + expect(exlist[4]).assertEqual("MainAbility2 onWindowStageDestroy"); + expect(exlist[5]).assertEqual("MainAbility2 onAbilityDestroy"); + + expect(exlist2[0]).assertEqual("MainAbility5 onAbilityCreate"); + expect(exlist2[1]).assertEqual("MainAbility5 onWindowStageCreate"); + expect(exlist2[2]).assertEqual("MainAbility5 onAbilityForeground"); + expect(exlist2[3]).assertEqual("MainAbility5 onAbilityBackground"); + expect(exlist2[4]).assertEqual("MainAbility5 onWindowStageDestroy"); + expect(exlist2[5]).assertEqual("MainAbility5 onAbilityDestroy"); + globalThis.applicationContext1 .unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => { console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/module.json b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/module.json index 52411d94f2f676054edf3ae4be231530026e943c..0e9c03ada5357df552a006ee37a6aeb3e67b3264 100644 --- a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/module.json +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], @@ -132,6 +133,16 @@ "description": "$string:MainAbility12_desc", "icon": "$media:icon", "label": "$string:MainAbility12_label" - }] + }], + "requestPermissions": [ + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" + } + ] } } diff --git a/ability/ability_runtime/stage/actswindowstagelifecyclemultihaptest/entry/src/main/ets/test/LifecycleTest.ets b/ability/ability_runtime/stage/actswindowstagelifecyclemultihaptest/entry/src/main/ets/test/LifecycleTest.ets index e11d1fccb80bb3c2b15517a50424c80e1e818c82..f235c47d5b9615c41f6e6c26edfbd8ce4693af87 100755 --- a/ability/ability_runtime/stage/actswindowstagelifecyclemultihaptest/entry/src/main/ets/test/LifecycleTest.ets +++ b/ability/ability_runtime/stage/actswindowstagelifecyclemultihaptest/entry/src/main/ets/test/LifecycleTest.ets @@ -66,6 +66,7 @@ export default function abilityTest() { console.info("---------------Multihap_WindowStageLifecycleTest_001 is start---------------") TAG = "Multihap_WindowStageLifecycleTest_001"; listKeyTemp = []; + var transferStr0 = ""; globalThis.abilityContext.startAbility({ bundleName: "com.example.lifecycletest", @@ -87,14 +88,15 @@ export default function abilityTest() { for (var i = 0;i < globalThis.mainAbility4ListKey.length; i++) { if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility3") { listKeyTemp.push(globalThis.mainAbility4ListKey[i]); + transferStr0 += globalThis.mainAbility4ListKey[i]; } } console.log(TAG + "listKeyTemp is :" + listKeyTemp); console.log(TAG + "globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId); - expect(listKeyTemp[0]).assertEqual("Hap2MainAbility3 onWindowStageCreate"); - expect(listKeyTemp[1]).assertEqual("Hap2MainAbility3 onWindowStageActive"); - expect(listKeyTemp[2]).assertEqual("Hap2MainAbility3 onWindowStageInactive"); - expect(listKeyTemp[3]).assertEqual("Hap2MainAbility3 onWindowStageDestroy"); + expect(transferStr0.indexOf("Hap2MainAbility3 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility3 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility3 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility3 onWindowStageDestroy")!=-1).assertTrue(); console.info(TAG + "globalThis.ApplicationContext4 is :" + JSON.stringify(globalThis.ApplicationContext4)); globalThis.ApplicationContext4 .unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => { @@ -118,6 +120,7 @@ export default function abilityTest() { console.log("------------Multihap_WindowStageLifecycleTest_002 start-------------"); TAG = "Multihap_WindowStageLifecycleTest_002"; listKeyTemp = []; + var transferStr0 = ""; globalThis.abilityContext.startAbility({ bundleName: "com.example.lifecycletest", @@ -149,15 +152,15 @@ export default function abilityTest() { for (var i = 0; i < globalThis.mainAbility4ListKey.length; i++) { if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility4") { listKeyTemp.push(globalThis.mainAbility4ListKey[i]); + transferStr0 += globalThis.mainAbility4ListKey[i]; } } console.log(TAG + "listKeyTemp is :" + listKeyTemp); console.log(TAG + "globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId); - expect(listKeyTemp[0]).assertEqual("Hap2MainAbility4 onWindowStageCreate"); - expect(listKeyTemp[1]).assertEqual("Hap2MainAbility4 onWindowStageActive"); - expect(listKeyTemp[2]).assertEqual("Hap2MainAbility4 onWindowStageInactive"); - expect(listKeyTemp[3]).assertEqual("Hap2MainAbility4 onWindowStageInactive"); - expect(listKeyTemp[4]).assertEqual("Hap2MainAbility4 onWindowStageDestroy"); + expect(transferStr0.indexOf("Hap2MainAbility4 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility4 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility4 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility4 onWindowStageDestroy")!=-1).assertTrue(); globalThis.ApplicationContext4 .unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => { console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + @@ -180,6 +183,7 @@ export default function abilityTest() { console.log("------------Multihap_WindowStageLifecycleTest_003 start-------------"); TAG = "Multihap_WindowStageLifecycleTest_003"; listKeyTemp = []; + var transferStr0 = ""; globalThis.abilityContext.startAbility({ bundleName: "com.example.lifecycletest", @@ -211,19 +215,19 @@ export default function abilityTest() { for (var i = 0;i < globalThis.mainAbility4ListKey.length; i++) { if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility5") { listKeyTemp.push(globalThis.mainAbility4ListKey[i]); + transferStr0 += globalThis.mainAbility4ListKey[i]; } } console.log(TAG + "listKeyTemp is :" + listKeyTemp); console.log(TAG + "globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId); - expect(listKeyTemp[0]).assertEqual("Hap2MainAbility5 onWindowStageCreate"); - expect(listKeyTemp[1]).assertEqual("Hap2MainAbility5 onWindowStageActive"); - expect(listKeyTemp[2]).assertEqual("Hap2MainAbility5 onWindowStageCreate"); - var transferStr0 = listKeyTemp[3] + listKeyTemp[4]; + expect(transferStr0.indexOf("Hap2MainAbility5 onWindowStageCreate")!=-1).assertTrue(); expect(transferStr0.indexOf("Hap2MainAbility5 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility5 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility5 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility5 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility5 onWindowStageDestroy")!=-1).assertTrue(); expect(transferStr0.indexOf("Hap2MainAbility5 onWindowStageInactive")!=-1).assertTrue(); - expect(listKeyTemp[5]).assertEqual("Hap2MainAbility5 onWindowStageDestroy"); - expect(listKeyTemp[6]).assertEqual("Hap2MainAbility5 onWindowStageInactive"); - expect(listKeyTemp[7]).assertEqual("Hap2MainAbility5 onWindowStageDestroy"); + expect(transferStr0.indexOf("Hap2MainAbility5 onWindowStageDestroy")!=-1).assertTrue(); globalThis.ApplicationContext4 .unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => { console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + @@ -247,6 +251,8 @@ export default function abilityTest() { TAG = "Multihap_WindowStageLifecycleTest_004"; listKeyTemp = []; listKeyTemp1 = []; + var transferStr0 = ""; + var transferStr1 = ""; globalThis.abilityContext.startAbility({ bundleName: "com.example.lifecycletest", @@ -278,23 +284,24 @@ export default function abilityTest() { for (var i = 0;i < globalThis.mainAbility4ListKey.length; i++) { if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility6") { listKeyTemp.push(globalThis.mainAbility4ListKey[i]); + transferStr0 += globalThis.mainAbility4ListKey[i]; } else if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap3MainAbility2") { listKeyTemp1.push(globalThis.mainAbility4ListKey[i]); + transferStr1 += globalThis.mainAbility4ListKey[i]; } } console.log(TAG + "listKeyTemp is :" + listKeyTemp); console.log(TAG + "listKeyTemp1 is :" + listKeyTemp1); console.log(TAG + "globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId); - expect(listKeyTemp[0]).assertEqual("Hap2MainAbility6 onWindowStageCreate"); - expect(listKeyTemp[1]).assertEqual("Hap2MainAbility6 onWindowStageActive"); - expect(listKeyTemp[2]).assertEqual("Hap2MainAbility6 onWindowStageInactive"); - expect(listKeyTemp[3]).assertEqual("Hap2MainAbility6 onWindowStageDestroy"); - - expect(listKeyTemp1[0]).assertEqual("Hap3MainAbility2 onWindowStageCreate"); - expect(listKeyTemp1[1]).assertEqual("Hap3MainAbility2 onWindowStageActive"); - expect(listKeyTemp1[2]).assertEqual("Hap3MainAbility2 onWindowStageInactive"); - expect(listKeyTemp1[3]).assertEqual("Hap3MainAbility2 onWindowStageDestroy"); - + expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageDestroy")!=-1).assertTrue(); + + expect(transferStr1.indexOf("Hap3MainAbility2 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr1.indexOf("Hap3MainAbility2 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr1.indexOf("Hap3MainAbility2 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr1.indexOf("Hap3MainAbility2 onWindowStageDestroy")!=-1).assertTrue(); globalThis.ApplicationContext4 .unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => { console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + @@ -318,6 +325,8 @@ export default function abilityTest() { TAG = "Multihap_WindowStageLifecycleTest_005"; listKeyTemp = []; listKeyTemp1 = []; + var transferStr0 = ""; + var transferStr1 = ""; globalThis.abilityContext.startAbility({ bundleName: "com.example.lifecycletest", @@ -349,22 +358,24 @@ export default function abilityTest() { for (var i = 0;i < globalThis.mainAbility4ListKey.length; i++) { if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility6") { listKeyTemp.push(globalThis.mainAbility4ListKey[i]); + transferStr0 += globalThis.mainAbility4ListKey[i]; } else if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility7") { listKeyTemp1.push(globalThis.mainAbility4ListKey[i]); + transferStr1 += globalThis.mainAbility4ListKey[i]; } } console.log(TAG + "listKeyTemp is :" + listKeyTemp); console.log(TAG + "listKeyTemp1 is :" + listKeyTemp1); console.log(TAG + "globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId); - expect(listKeyTemp[0]).assertEqual("Hap2MainAbility6 onWindowStageCreate"); - expect(listKeyTemp[1]).assertEqual("Hap2MainAbility6 onWindowStageActive"); - expect(listKeyTemp[2]).assertEqual("Hap2MainAbility6 onWindowStageInactive"); - expect(listKeyTemp[3]).assertEqual("Hap2MainAbility6 onWindowStageDestroy"); + expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageDestroy")!=-1).assertTrue(); - expect(listKeyTemp1[0]).assertEqual("Hap2MainAbility7 onWindowStageCreate"); - expect(listKeyTemp1[1]).assertEqual("Hap2MainAbility7 onWindowStageActive"); - expect(listKeyTemp1[2]).assertEqual("Hap2MainAbility7 onWindowStageInactive"); - expect(listKeyTemp1[3]).assertEqual("Hap2MainAbility7 onWindowStageDestroy"); + expect(transferStr1.indexOf("Hap2MainAbility7 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr1.indexOf("Hap2MainAbility7 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr1.indexOf("Hap2MainAbility7 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr1.indexOf("Hap2MainAbility7 onWindowStageDestroy")!=-1).assertTrue(); globalThis.ApplicationContext4 .unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => { @@ -471,6 +482,8 @@ export default function abilityTest() { TAG = "Multihap_WindowStageLifecycleTest_007"; listKeyTemp = []; listKeyTemp1 = []; + var transferStr0 = ""; + var transferStr1 = ""; var callBackId1; var callBackId2; var flag; @@ -495,17 +508,17 @@ export default function abilityTest() { for (var i = 0;i < globalThis.mainAbility6ListKey.length; i++) { if (globalThis.mainAbility6ListKey[i].substring(0, 16) == "Hap2MainAbility9") { listKeyTemp.push(globalThis.mainAbility6ListKey[i]); + transferStr0 += globalThis.mainAbility6ListKey[i]; } } console.log(TAG + "listKeyTemp is :" + listKeyTemp); console.log(TAG + "first globalThis.mainAbility6CallBackId is :" + globalThis.mainAbility6CallBackId); callBackId1 = globalThis.mainAbility6CallBackId console.log(TAG + "callBackId1 is :" + callBackId1); - expect(listKeyTemp[0]).assertEqual("Hap2MainAbility9 onWindowStageCreate"); - expect(listKeyTemp[1]).assertEqual("Hap2MainAbility9 onWindowStageActive"); - expect(listKeyTemp[2]).assertEqual("Hap2MainAbility9 onWindowStageInactive"); - expect(listKeyTemp[3]).assertEqual("Hap2MainAbility9 onWindowStageDestroy"); - + expect(transferStr0.indexOf("Hap2MainAbility9 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility9 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility9 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility9 onWindowStageDestroy")!=-1).assertTrue(); globalThis.ApplicationContext6 .unregisterAbilityLifecycleCallback(globalThis.mainAbility6CallBackId, (error, data) => { console.log(TAG + ": first unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + @@ -543,6 +556,7 @@ export default function abilityTest() { for (var i = 0;i < globalThis.mainAbility6ListKey.length; i++) { if (globalThis.mainAbility6ListKey[i].substring(0, 16) == "Hap2MainAbility9") { listKeyTemp1.push(globalThis.mainAbility6ListKey[i]); + transferStr1 += globalThis.mainAbility6ListKey[i]; } } console.log(TAG + "listKeyTemp1 is :" + listKeyTemp1); @@ -550,11 +564,10 @@ export default function abilityTest() { callBackId2 = globalThis.mainAbility6CallBackId console.log(TAG + "callBackId2 is :" + callBackId2); expect(callBackId2).assertEqual(callBackId1 + 1) - expect(listKeyTemp1[0]).assertEqual("Hap2MainAbility9 onWindowStageCreate"); - expect(listKeyTemp1[1]).assertEqual("Hap2MainAbility9 onWindowStageActive"); - expect(listKeyTemp1[2]).assertEqual("Hap2MainAbility9 onWindowStageInactive"); - expect(listKeyTemp1[3]).assertEqual("Hap2MainAbility9 onWindowStageDestroy"); - + expect(transferStr1.indexOf("Hap2MainAbility9 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr1.indexOf("Hap2MainAbility9 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr1.indexOf("Hap2MainAbility9 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr1.indexOf("Hap2MainAbility9 onWindowStageDestroy")!=-1).assertTrue(); globalThis.ApplicationContext6 .unregisterAbilityLifecycleCallback(globalThis.mainAbility6CallBackId, (error, data) => { console.log(TAG + ": second unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + @@ -582,6 +595,7 @@ export default function abilityTest() { console.log("------------Multihap_WindowStageLifecycleTest_008 start-------------"); TAG = "Multihap_WindowStageLifecycleTest_008"; listKeyTemp = []; + var transferStr0 = ""; globalThis.abilityContext.startAbility({ bundleName: "com.example.lifecycletest", @@ -604,15 +618,15 @@ export default function abilityTest() { for (var i = 0;i < globalThis.mainAbility4ListKey.length; i++) { if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap2MainAbility6") { listKeyTemp.push(globalThis.mainAbility4ListKey[i]); + transferStr0 += globalThis.mainAbility4ListKey[i]; } } console.log(TAG + "listKeyTemp is :" + listKeyTemp); console.log(TAG + "globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId); - expect(listKeyTemp[0]).assertEqual("Hap2MainAbility6 onWindowStageCreate"); - expect(listKeyTemp[1]).assertEqual("Hap2MainAbility6 onWindowStageActive"); - expect(listKeyTemp[2]).assertEqual("Hap2MainAbility6 onWindowStageInactive"); - expect(listKeyTemp[3]).assertEqual("Hap2MainAbility6 onWindowStageDestroy"); - + expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility6 onWindowStageDestroy")!=-1).assertTrue(); globalThis.ApplicationContext4 .unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => { console.log(TAG + ": first unregisterAbilityLifecycleCallback, err: " + JSON.stringify(error) + @@ -642,6 +656,8 @@ export default function abilityTest() { TAG = "Multihap_WindowStageLifecycleTest_009"; listKeyTemp = []; listKeyTemp1 = []; + var transferStr0 = ""; + var transferStr1 = ""; globalThis.abilityContext.startAbility({ bundleName: "com.example.lifecycletest", @@ -710,29 +726,30 @@ export default function abilityTest() { for (var i = 0;i < globalThis.mainAbility4ListKey.length; i++) { if (globalThis.mainAbility4ListKey[i].substring(0, 17) == "Hap2MainAbility10") { listKeyTemp.push(globalThis.mainAbility4ListKey[i]); + transferStr0 += globalThis.mainAbility4ListKey[i]; } else if (globalThis.mainAbility4ListKey[i].substring(0, 16) == "Hap3MainAbility3") { listKeyTemp1.push(globalThis.mainAbility4ListKey[i]); + transferStr1 += globalThis.mainAbility4ListKey[i]; } } console.log(TAG + " listKeyTemp is :" + listKeyTemp); console.log(TAG + " listKeyTemp1 is :" + listKeyTemp1); console.log(TAG + " globalThis.mainAbility4CallBackId is :" + globalThis.mainAbility4CallBackId); - expect(listKeyTemp[0]).assertEqual("Hap2MainAbility10 onWindowStageCreate"); - expect(listKeyTemp[1]).assertEqual("Hap2MainAbility10 onWindowStageActive"); - expect(listKeyTemp[2]).assertEqual("Hap2MainAbility10 onWindowStageInactive"); - expect(listKeyTemp[3]).assertEqual("Hap2MainAbility10 onWindowStageActive"); - expect(listKeyTemp[4]).assertEqual("Hap2MainAbility10 onWindowStageInactive"); - expect(listKeyTemp[5]).assertEqual("Hap2MainAbility10 onWindowStageActive"); - expect(listKeyTemp[6]).assertEqual("Hap2MainAbility10 onWindowStageInactive"); - - expect(listKeyTemp1[0]).assertEqual("Hap3MainAbility3 onWindowStageCreate"); - expect(listKeyTemp1[1]).assertEqual("Hap3MainAbility3 onWindowStageActive"); - expect(listKeyTemp1[2]).assertEqual("Hap3MainAbility3 onWindowStageInactive"); - expect(listKeyTemp1[3]).assertEqual("Hap3MainAbility3 onWindowStageActive"); - expect(listKeyTemp1[4]).assertEqual("Hap3MainAbility3 onWindowStageInactive"); - expect(listKeyTemp1[5]).assertEqual("Hap3MainAbility3 onWindowStageActive"); - + expect(transferStr0.indexOf("Hap2MainAbility10 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility10 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility10 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility10 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility10 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility10 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap2MainAbility10 onWindowStageInactive")!=-1).assertTrue(); + + expect(transferStr1.indexOf("Hap3MainAbility3 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr1.indexOf("Hap3MainAbility3 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr1.indexOf("Hap3MainAbility3 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr1.indexOf("Hap3MainAbility3 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr1.indexOf("Hap3MainAbility3 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr1.indexOf("Hap3MainAbility3 onWindowStageActive")!=-1).assertTrue(); globalThis.ApplicationContext4 .unregisterAbilityLifecycleCallback(globalThis.mainAbility4CallBackId, (error, data) => { console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + @@ -796,4 +813,4 @@ export default function abilityTest() { console.info("---------------Multihap_WindowStageLifecycleTest_010 is end---------------") }) }) -} \ No newline at end of file +} diff --git a/ability/ability_runtime/stage/actswindowstagelifecyclemultihaptest/entry/src/main/module.json b/ability/ability_runtime/stage/actswindowstagelifecyclemultihaptest/entry/src/main/module.json index b2a1749da88ed99a65c7bd6e56f29745c8b45176..564159e9f0a917ad1c614f8037333a87d52dedd6 100755 --- a/ability/ability_runtime/stage/actswindowstagelifecyclemultihaptest/entry/src/main/module.json +++ b/ability/ability_runtime/stage/actswindowstagelifecyclemultihaptest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, @@ -100,6 +101,12 @@ }, { "name": "ohos.permission.LISTEN_BUNDLE_CHANGE" + }, + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY" } ] } diff --git a/ability/ability_runtime/stage/actswindowstagelifecyclemultihaptest/hap4/src/main/module.json b/ability/ability_runtime/stage/actswindowstagelifecyclemultihaptest/hap4/src/main/module.json index 3bac8ff18e11056201cbf3171df82893faaedd94..3c9d185aca7a80a84837ee82da4f4bf711e8be91 100755 --- a/ability/ability_runtime/stage/actswindowstagelifecyclemultihaptest/hap4/src/main/module.json +++ b/ability/ability_runtime/stage/actswindowstagelifecyclemultihaptest/hap4/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:hap4_desc", "mainElement": "Hap4MainAbility1", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/stage/actswindowstagelifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets b/ability/ability_runtime/stage/actswindowstagelifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets index 5676654b5911ae3bdfcec0f427d1713e6bd89d64..52691b5b223b131c5eeb2b4b2780999f307da019 100755 --- a/ability/ability_runtime/stage/actswindowstagelifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets +++ b/ability/ability_runtime/stage/actswindowstagelifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets @@ -96,14 +96,15 @@ export default function lifecycleTest() { console.log(TAG + " registerAbilityLifecycleCallback tempCallbackId : " + JSON.stringify(tempCallbackId)); var strtemp = ""; var listtemp = []; + var transferStr0 = ""; for (var i = 0; i < globalThis.list.length; i++) { strtemp = globalThis.list[i].substring(0, 12); if (strtemp === "MainAbility2") { listtemp.push(globalThis.list[i]); + transferStr0 += globalThis.list[i]; } } console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); - let exlist = listtemp; globalThis.applicationContext .unregisterAbilityLifecycleCallback(tempCallbackId, (error, data) => { console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + @@ -111,10 +112,10 @@ export default function lifecycleTest() { code = error.code; }); setTimeout(function () { - expect(exlist[0]).assertEqual("MainAbility2 onWindowStageCreate"); - expect(exlist[1]).assertEqual("MainAbility2 onWindowStageActive"); - expect(exlist[2]).assertEqual("MainAbility2 onWindowStageInactive"); - expect(exlist[3]).assertEqual("MainAbility2 onWindowStageDestroy"); + expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue(); expect(code).assertEqual(0); console.log("------------Singlehap_WindowStageLifeCycleTest_0100 END-------------"); done(); @@ -159,14 +160,15 @@ export default function lifecycleTest() { console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1)); var strtemp = ""; var listtemp = []; + var transferStr0 = ""; for (var i = 0; i < globalThis.list1.length; i++) { strtemp = globalThis.list1[i].substring(0, 12); if (strtemp === "MainAbility1" || strtemp === "MainAbility2") { listtemp.push(globalThis.list1[i]); + transferStr0 += globalThis.list1[i]; } } console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); - let exlist = listtemp; globalThis.applicationContext1 .unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => { console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + @@ -174,16 +176,14 @@ export default function lifecycleTest() { code = error.code; }) setTimeout(function () { - expect(exlist[0]).assertEqual("MainAbility1 onWindowStageCreate"); - expect(exlist[1]).assertEqual("MainAbility1 onWindowStageActive"); - expect(exlist[2]).assertEqual("MainAbility2 onWindowStageCreate"); - var transferStr0 = exlist[3] + exlist[4]; + expect(transferStr0.indexOf("MainAbility1 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility1 onWindowStageInactive")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue(); - var transferStr1 = exlist[5] + exlist[6]; - expect(transferStr1.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue(); - expect(transferStr1.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue(); - expect(exlist[7]).assertEqual("MainAbility2 onWindowStageDestroy"); + expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue(); expect(code).assertEqual(0); console.log("------------Singlehap_WindowStageLifeCycleTest_0200 END-------------"); done(); @@ -228,14 +228,15 @@ export default function lifecycleTest() { console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1)); var strtemp = ""; var listtemp = []; + var transferStr0 = ""; for (var i = 0; i < globalThis.list1.length; i++) { strtemp = globalThis.list1[i].substring(0, 12); if (strtemp === "MainAbility1" || strtemp === "MainAbility2") { listtemp.push(globalThis.list1[i]); + transferStr0 += globalThis.list1[i]; } } console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); - let exlist = listtemp; globalThis.applicationContext1 .unregisterAbilityLifecycleCallback(globalThis.callbackid1) .then((data) => { @@ -254,16 +255,14 @@ export default function lifecycleTest() { }) }, 500); setTimeout(function () { - expect(exlist[0]).assertEqual("MainAbility1 onWindowStageCreate"); - expect(exlist[1]).assertEqual("MainAbility1 onWindowStageActive"); - expect(exlist[2]).assertEqual("MainAbility2 onWindowStageCreate"); - var transferStr0 = exlist[3] + exlist[4]; + expect(transferStr0.indexOf("MainAbility1 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility1 onWindowStageInactive")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue(); - var transferStr0 = exlist[5] + exlist[6]; expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue(); - expect(exlist[7]).assertEqual("MainAbility2 onWindowStageDestroy"); + expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue(); expect(code).assertEqual(1); console.log("------------Singlehap_WindowStageLifeCycleTest_0300 END-------------"); done(); @@ -308,10 +307,12 @@ export default function lifecycleTest() { console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid3)); var strtemp = ""; var listtemp = []; + var transferStr0 = ""; for (var i = 0; i < globalThis.list3.length; i++) { strtemp = globalThis.list3[i].substring(0, 12); if (strtemp === "MainAbility3" || strtemp === "MainAbility2") { listtemp.push(globalThis.list3[i]); + transferStr0 += globalThis.list3[i]; } } console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); @@ -339,16 +340,14 @@ export default function lifecycleTest() { }) }, 500); setTimeout(function () { - expect(exlist[0]).assertEqual("MainAbility3 onWindowStageCreate"); - expect(exlist[1]).assertEqual("MainAbility3 onWindowStageActive"); - expect(exlist[2]).assertEqual("MainAbility2 onWindowStageCreate"); - var transferStr0 = exlist[3] + exlist[4]; + expect(transferStr0.indexOf("MainAbility3 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility3 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility3 onWindowStageInactive")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue(); - var transferStr0 = exlist[5] + exlist[6]; expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility3 onWindowStageActive")!=-1).assertTrue(); - expect(exlist[7]).assertEqual("MainAbility2 onWindowStageDestroy"); + expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue(); expect(code).assertEqual(0); console.log("------------Singlehap_WindowStageLifeCycleTest_0400 END-------------"); done(); @@ -404,23 +403,23 @@ export default function lifecycleTest() { console.log(TAG + " callbackid1 : " + JSON.stringify(globalThis.callbackid1)); var strtemp = ""; var listtemp = []; + var transferStr0 = ""; for (var i = 0; i < globalThis.list1.length; i++) { strtemp = globalThis.list1[i].substring(0, 12); if (strtemp == "MainAbility5" || strtemp == "MainAbility2") { listtemp.push(globalThis.list1[i]); + transferStr0 += globalThis.list1[i]; } } console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); - let exlist = listtemp; - expect(exlist[0]).assertEqual("MainAbility5 onWindowStageCreate"); - expect(exlist[1]).assertEqual("MainAbility5 onWindowStageActive"); - expect(exlist[2]).assertEqual("MainAbility2 onWindowStageCreate"); - var transferStr0 = exlist[3] + exlist[4]; + expect(transferStr0.indexOf("MainAbility5 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility5 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility5 onWindowStageInactive")!=-1).assertTrue(); - expect(exlist[5]).assertEqual("MainAbility5 onWindowStageDestroy"); - expect(exlist[6]).assertEqual("MainAbility2 onWindowStageInactive"); - expect(exlist[7]).assertEqual("MainAbility2 onWindowStageDestroy"); + expect(transferStr0.indexOf("MainAbility5 onWindowStageDestroy")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue(); globalThis.applicationContext1 .unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => { console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + @@ -428,7 +427,7 @@ export default function lifecycleTest() { console.log("------------Singlehap_WindowStageLifeCycleTest_0500 END-------------"); done(); }) - }, 4200); + }, 3800); }); /* @@ -493,34 +492,30 @@ export default function lifecycleTest() { console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1)); var strtemp = ""; var listtemp = []; + var transferStr0 = ""; for (var i = 0; i < globalThis.list1.length; i++) { strtemp = globalThis.list1[i].substring(0, 12); if (strtemp === "MainAbility1" || strtemp === "MainAbility2") { listtemp.push(globalThis.list1[i]); + transferStr0 += globalThis.list1[i]; } } console.log(TAG + " listtemp is :" + listtemp); - let exlist = listtemp; - expect(exlist[0]).assertEqual("MainAbility1 onWindowStageCreate"); - expect(exlist[1]).assertEqual("MainAbility1 onWindowStageActive"); - expect(exlist[2]).assertEqual("MainAbility2 onWindowStageCreate"); - var transferStr0 = exlist[3] + exlist[4]; + expect(transferStr0.indexOf("MainAbility1 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility1 onWindowStageInactive")!=-1).assertTrue(); - var transferStr0 = exlist[5] + exlist[6]; expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue(); - expect(exlist[7]).assertEqual("MainAbility2 onWindowStageDestroy"); - expect(exlist[8]).assertEqual("MainAbility2 onWindowStageCreate"); - var transferStr0 = exlist[9] + exlist[10]; + expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility1 onWindowStageInactive")!=-1).assertTrue(); - var transferStr0 = exlist[11] + exlist[12]; expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue(); - expect(exlist[13]).assertEqual("MainAbility2 onWindowStageDestroy"); - expect(exlist[14]).assertEqual("MainAbility2 onWindowStageCreate"); - var transferStr0 = exlist[15] + exlist[16]; + expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility1 onWindowStageInactive")!=-1).assertTrue(); globalThis.applicationContext1 @@ -581,32 +576,29 @@ export default function lifecycleTest() { console.log(TAG + " registerAbilityLifecycleCallback callbackid : " + JSON.stringify(globalThis.callbackid1)); var strtemp = ""; var listtemp = []; + var transferStr0 = ""; for (var i = 0; i < globalThis.list1.length; i++) { strtemp = globalThis.list1[i].substring(0, 12); if (strtemp === "MainAbility1" || strtemp === "MainAbility2") { listtemp.push(globalThis.list1[i]); + transferStr0 += globalThis.list1[i]; } } console.log(TAG + " listtemp is :" + listtemp); - let exlist = listtemp; - expect(exlist[0]).assertEqual("MainAbility1 onWindowStageCreate"); - expect(exlist[1]).assertEqual("MainAbility1 onWindowStageActive"); - expect(exlist[2]).assertEqual("MainAbility2 onWindowStageCreate"); - var transferStr0 = exlist[3] + exlist[4]; + expect(transferStr0.indexOf("MainAbility1 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility1 onWindowStageInactive")!=-1).assertTrue(); - var transferStr0 = exlist[5] + exlist[6]; expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue(); - expect(exlist[7]).assertEqual("MainAbility2 onWindowStageDestroy"); - expect(exlist[8]).assertEqual("MainAbility2 onWindowStageCreate"); - var transferStr0 = exlist[9] + exlist[10]; + expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility1 onWindowStageInactive")!=-1).assertTrue(); - var transferStr0 = exlist[11] + exlist[12]; expect(transferStr0.indexOf("MainAbility1 onWindowStageActive")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue(); - expect(exlist[13]).assertEqual("MainAbility2 onWindowStageDestroy"); + expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue(); globalThis.applicationContext1 .unregisterAbilityLifecycleCallback(globalThis.callbackid1, (error, data) => { console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + @@ -680,6 +672,7 @@ export default function lifecycleTest() { console.log("------------Singlehap_WindowStageLifeCycleTest_0900 start-------------"); TAG = "Singlehap_WindowStageLifeCycleTest_0900"; listKeyTemp = []; + var transferStr0 = ""; globalThis.abilityContext.startAbility({ bundleName: "com.example.windowstagelifecycle_xts", abilityName: "MainAbility9" @@ -706,15 +699,15 @@ export default function lifecycleTest() { for (var i = 0; i < globalThis.mainAbility9ListKey.length; i++) { if (globalThis.mainAbility9ListKey[i].substring(0, 16) == "Hap1MainAbility1") { listKeyTemp.push(globalThis.mainAbility9ListKey[i]); + transferStr0 += globalThis.mainAbility9ListKey[i]; } } console.log(TAG + "listKeyTemp is :" + listKeyTemp); console.log(TAG + "globalThis.mainAbility9CallBackId is :" + globalThis.mainAbility9CallBackId); - expect(listKeyTemp[0]).assertEqual("Hap1MainAbility1 onWindowStageCreate"); - expect(listKeyTemp[1]).assertEqual("Hap1MainAbility1 onWindowStageActive"); - expect(listKeyTemp[2]).assertEqual("Hap1MainAbility1 onWindowStageInactive"); - expect(listKeyTemp[3]).assertEqual("Hap1MainAbility1 onWindowStageInactive"); - expect(listKeyTemp[4]).assertEqual("Hap1MainAbility1 onWindowStageDestroy"); + expect(transferStr0.indexOf("Hap1MainAbility1 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap1MainAbility1 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap1MainAbility1 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap1MainAbility1 onWindowStageDestroy")!=-1).assertTrue(); globalThis.applicationContext9 .unregisterAbilityLifecycleCallback(globalThis.mainAbility9CallBackId, (error, data) => { console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + @@ -736,6 +729,7 @@ export default function lifecycleTest() { console.log("------------Singlehap_WindowStageLifeCycleTest_1000 start-------------"); TAG = "Singlehap_WindowStageLifeCycleTest_1000"; listKeyTemp = []; + var transferStr0 = ""; globalThis.abilityContext.startAbility({ bundleName: "com.example.windowstagelifecycle_xts", abilityName: "MainAbility9" @@ -762,19 +756,19 @@ export default function lifecycleTest() { for (var i = 0;i < globalThis.mainAbility9ListKey.length; i++) { if (globalThis.mainAbility9ListKey[i].substring(0, 16) == "Hap1MainAbility2") { listKeyTemp.push(globalThis.mainAbility9ListKey[i]); + transferStr0 += globalThis.mainAbility9ListKey[i]; } } console.log(TAG + "listKeyTemp is :" + listKeyTemp); console.log(TAG + "globalThis.mainAbility9CallBackId is :" + globalThis.mainAbility9CallBackId); - expect(listKeyTemp[0]).assertEqual("Hap1MainAbility2 onWindowStageCreate"); - expect(listKeyTemp[1]).assertEqual("Hap1MainAbility2 onWindowStageActive"); - expect(listKeyTemp[2]).assertEqual("Hap1MainAbility2 onWindowStageCreate"); - var transferStr0 = listKeyTemp[3] + listKeyTemp[4]; + expect(transferStr0.indexOf("Hap1MainAbility2 onWindowStageCreate")!=-1).assertTrue(); expect(transferStr0.indexOf("Hap1MainAbility2 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap1MainAbility2 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap1MainAbility2 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap1MainAbility2 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr0.indexOf("Hap1MainAbility2 onWindowStageDestroy")!=-1).assertTrue(); expect(transferStr0.indexOf("Hap1MainAbility2 onWindowStageInactive")!=-1).assertTrue(); - expect(listKeyTemp[5]).assertEqual("Hap1MainAbility2 onWindowStageDestroy"); - expect(listKeyTemp[6]).assertEqual("Hap1MainAbility2 onWindowStageInactive"); - expect(listKeyTemp[7]).assertEqual("Hap1MainAbility2 onWindowStageDestroy"); + expect(transferStr0.indexOf("Hap1MainAbility2 onWindowStageDestroy")!=-1).assertTrue(); globalThis.applicationContext9 .unregisterAbilityLifecycleCallback(globalThis.mainAbility9CallBackId, (error, data) => { console.log(TAG + ": unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error) + @@ -853,18 +847,19 @@ export default function lifecycleTest() { console.log(TAG + " secondCallback id : " + JSON.stringify(id2)); var strtemp = ""; var listtemp = []; + var transferStr0 = ""; for (var i = 0; i < globalThis.list11.length; i++) { strtemp = globalThis.list11[i].substring(0, 12); if (strtemp == "MainAbility2") { listtemp.push(globalThis.list11[i]); + transferStr0 += globalThis.list11[i]; } } console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); - let exlist = listtemp; - expect(exlist[0]).assertEqual("MainAbility2 onWindowStageCreate"); - expect(exlist[1]).assertEqual("MainAbility2 onWindowStageActive"); - expect(exlist[2]).assertEqual("MainAbility2 onWindowStageInactive"); - expect(exlist[3]).assertEqual("MainAbility2 onWindowStageDestroy"); + expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue(); expect(id1 + 1).assertEqual(id2); globalThis.applicationContext11 .unregisterAbilityLifecycleCallback(globalThis.callbackid11, (error, data) => { @@ -960,18 +955,19 @@ export default function lifecycleTest() { console.log(TAG + " secondCallback id : " + JSON.stringify(id2)); var strtemp = ""; var listtemp = []; + var transferStr0 = ""; for (var i = 0; i < globalThis.list12.length; i++) { strtemp = globalThis.list12[i].substring(0, 12); if (strtemp == "MainAbility2") { listtemp.push(globalThis.list12[i]); + transferStr0 += globalThis.list12[i]; } } console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); - let exlist = listtemp; - expect(exlist[0]).assertEqual("MainAbility2 onWindowStageCreate"); - expect(exlist[1]).assertEqual("MainAbility2 onWindowStageActive"); - expect(exlist[2]).assertEqual("MainAbility2 onWindowStageInactive"); - expect(exlist[3]).assertEqual("MainAbility2 onWindowStageDestroy"); + expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue(); expect(id1 + 1).assertEqual(id2); globalThis.applicationContext12 .unregisterAbilityLifecycleCallback(id2, (error, data) => { @@ -1122,40 +1118,39 @@ export default function lifecycleTest() { console.log(TAG + " secondCallback id12 : " + JSON.stringify(id4)); var strtemp = ""; var listtemp = []; + var transferStr0 = ""; for (var i = 0; i < templist1.length; i++) { strtemp = templist1[i].substring(0, 13); if (strtemp === "MainAbility2 " || strtemp === "MainAbility12") { listtemp.push(templist1[i]); + transferStr0 += templist1[i]; } } console.log(TAG + " listtemp is :" + JSON.stringify(listtemp)); setTimeout(function () { var strtemp1 = ""; var listtemp1 = []; + var transferStr1 = ""; for (var j = 0; j < templist2.length; j++) { strtemp1 = templist2[j].substring(0, 12); if (strtemp1 === "MainAbility2") { listtemp1.push(templist2[j]); + transferStr1 += templist2[j]; } } console.log(TAG + " listtemp1 is :" + JSON.stringify(listtemp1)); - let exlist = listtemp; - let exlist1 = listtemp1; - expect(exlist[0]).assertEqual("MainAbility12 onWindowStageCreate"); - expect(exlist[1]).assertEqual("MainAbility12 onWindowStageActive"); - expect(exlist[2]).assertEqual("MainAbility2 onWindowStageCreate"); - var transferStr0 = exlist[3] + exlist[4]; + expect(transferStr0.indexOf("MainAbility12 onWindowStageCreate")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility12 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr0.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility12 onWindowStageInactive")!=-1).assertTrue(); - var transferStr0 = exlist[5] + exlist[6]; expect(transferStr0.indexOf("MainAbility12 onWindowStageActive")!=-1).assertTrue(); expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue(); - expect(exlist[7]).assertEqual("MainAbility2 onWindowStageDestroy"); - expect(exlist1[0]).assertEqual("MainAbility2 onWindowStageCreate"); - var transferStr0 = exlist1[1] + exlist1[2]; - expect(transferStr0.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue(); - expect(transferStr0.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue(); - expect(exlist1[3]).assertEqual("MainAbility2 onWindowStageDestroy"); + expect(transferStr0.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue(); + expect(transferStr1.indexOf("MainAbility2 onWindowStageCreate")!=-1).assertTrue();; + expect(transferStr1.indexOf("MainAbility2 onWindowStageActive")!=-1).assertTrue(); + expect(transferStr1.indexOf("MainAbility2 onWindowStageInactive")!=-1).assertTrue(); + expect(transferStr1.indexOf("MainAbility2 onWindowStageDestroy")!=-1).assertTrue(); expect(id1 + 1).assertEqual(id2); expect(id3 + 1).assertEqual(id4); globalThis.applicationContext12 diff --git a/ability/ability_runtime/stage/actswindowstagelifecyclesinglehaptest/entry/src/main/module.json b/ability/ability_runtime/stage/actswindowstagelifecyclesinglehaptest/entry/src/main/module.json index acbdfcd9d999e14c2c802796fa8d5426daa67a8d..dec743967831396c2c80db96b9ad9b95211f9a38 100755 --- a/ability/ability_runtime/stage/actswindowstagelifecyclesinglehaptest/entry/src/main/module.json +++ b/ability/ability_runtime/stage/actswindowstagelifecyclesinglehaptest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone", "tablet" ], @@ -132,6 +133,16 @@ "description": "$string:MainAbility12_desc", "icon": "$media:icon", "label": "$string:MainAbility12_label" - }] + }], + "requestPermissions": [ + { + "name":"ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "reason":"need use ohos.permission.START_ABILITIES_FROM_BACKGROUND" + }, + { + "name":"ohos.permission.START_INVISIBLE_ABILITY", + "reason":"need use ohos.permission.START_INVISIBLE_ABILITY" + } + ] } } diff --git a/ability/ability_runtime/want/BUILD.gn b/ability/ability_runtime/want/BUILD.gn index 815bea294b3aacd103f1a4ffea3117225f5dc0e8..fe2d26693b0b09e1ff0692fcb2e86a18608d5e31 100644 --- a/ability/ability_runtime/want/BUILD.gn +++ b/ability/ability_runtime/want/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ability/ability_runtime/want/actsgetwantalltest/BUILD.gn b/ability/ability_runtime/want/actsgetwantalltest/BUILD.gn index 3214ed3b1b76c65d1c8725cd6f31b0691d0bd874..660ff523df966d781a82dc8b2a4ffad84e80695d 100644 --- a/ability/ability_runtime/want/actsgetwantalltest/BUILD.gn +++ b/ability/ability_runtime/want/actsgetwantalltest/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ability/ability_runtime/want/actsgetwantalltest/src/main/config.json b/ability/ability_runtime/want/actsgetwantalltest/src/main/config.json index efa31c7362fe6bbf13d3b4893aa1ea545a2238c6..2f2347ebd9415044f3b42d1720d7fb36f7dbf918 100644 --- a/ability/ability_runtime/want/actsgetwantalltest/src/main/config.json +++ b/ability/ability_runtime/want/actsgetwantalltest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsgetwantalltest", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/config.json b/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/config.json index cee293b11598b0b884db050de54cbf9b935ae6bd..f8546baa5a399f59a14089f26580b2f7438490de 100644 --- a/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/config.json +++ b/ability/ability_runtime/want/sceneProject/actsgetwantalltesthap/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsgetwantallhap", "name": "com.example.actsgetwantalltesthap.MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/ability_runtime/workercontextcover/workercontexttest/entry/src/main/module.json b/ability/ability_runtime/workercontextcover/workercontexttest/entry/src/main/module.json index 3cc8a78ba369000de6357c5414e3f2fd9c0e55ec..c49dee47dee5b74a9f7a10e2370cdb3bc467475a 100644 --- a/ability/ability_runtime/workercontextcover/workercontexttest/entry/src/main/module.json +++ b/ability/ability_runtime/workercontextcover/workercontexttest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/module.json b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/module.json index 831fb3d8118747dad4cfed307da30e4f1de0575a..a914a1a8a94f1e8c9113311eb067961fc9f96cf4 100644 --- a/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/module.json +++ b/ability/ability_runtime/zidltest/actsamszidlclienttest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/module.json b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/module.json index a30b037489b5d261b7405e566bc6352014518367..64a6a860fa96bae7530531b40e450c6eb2af64d9 100644 --- a/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/module.json +++ b/ability/ability_runtime/zidltest/actsamszidlservice/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/ability/dmsfwk/continuationmanagertest/BUILD.gn b/ability/dmsfwk/continuationmanagertest/BUILD.gn index b3d2e5dff1cfdb6ac2581eb54670da32c3727399..6709681f47cb8f02942d359d6114ac3126a1f199 100644 --- a/ability/dmsfwk/continuationmanagertest/BUILD.gn +++ b/ability/dmsfwk/continuationmanagertest/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/ability/dmsfwk/continuationmanagertest/src/main/config.json b/ability/dmsfwk/continuationmanagertest/src/main/config.json index 73664228baca03b9cd85ed6d2e4a22fcfcae8b9e..d8366edba49748e546a6d4c52903a3a710c316b4 100644 --- a/ability/dmsfwk/continuationmanagertest/src/main/config.json +++ b/ability/dmsfwk/continuationmanagertest/src/main/config.json @@ -17,6 +17,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/ability/dmsfwk/continuationmanagertest/src/main/js/test/ContinuationManagerJsunit.test.js b/ability/dmsfwk/continuationmanagertest/src/main/js/test/ContinuationManagerJsunit.test.js index b2d4b262e1a69f5935df6f55c19308c25ccc330f..65b1f395e4f76ff2513e626a93adbaef6642e39b 100644 --- a/ability/dmsfwk/continuationmanagertest/src/main/js/test/ContinuationManagerJsunit.test.js +++ b/ability/dmsfwk/continuationmanagertest/src/main/js/test/ContinuationManagerJsunit.test.js @@ -80,6 +80,7 @@ describe('continuationManagerTest', function() { try { let continuationExtraParams = { deviceType: [], + targetBundle: "", description: "", filter: "", continuationMode: null, @@ -106,6 +107,7 @@ describe('continuationManagerTest', function() { try { let continuationExtraParams = { deviceType: ["00E"], + targetBundle: "ohos.example.test", description: "description", filter: {"name": "authInfo","length": 8}, continuationMode: 10, @@ -132,6 +134,7 @@ describe('continuationManagerTest', function() { try { let continuationExtraParams = { deviceType: ["00E"], + targetBundle: "ohos.example.test", description: "description", filter: {"name": "authInfo","length": 8}, continuationMode: continuationManager.ContinuationMode.COLLABORATION_MULTIPLE, @@ -159,6 +162,7 @@ describe('continuationManagerTest', function() { try { let continuationExtraParams = { deviceType: ["00E"], + targetBundle: "ohos.example.test", description: "description", filter: {"name": "authInfo","length": 8}, continuationMode: continuationManager.ContinuationMode.COLLABORATION_SINGLE, @@ -185,6 +189,7 @@ describe('continuationManagerTest', function() { try { let continuationExtraParams = { deviceType: ["00E"], + targetBundle: "ohos.example.test", description: "description", filter: {"name": "authInfo","length": 8}, continuationMode: continuationManager.ContinuationMode.COLLABORATION_SINGLE, diff --git a/ability_lite/ability_posix/BUILD.gn b/ability_lite/ability_posix/BUILD.gn index fbcdb8dce899d9cfcd99d184cf46e70e21c2b57c..b44a16ec7da3dee30e22b8142c92bf2288395e62 100755 --- a/ability_lite/ability_posix/BUILD.gn +++ b/ability_lite/ability_posix/BUILD.gn @@ -53,7 +53,7 @@ hcpptest_suite("ActsAbilityMgrTest") { "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/samgr", "//third_party/bounds_checking_function/include", "//third_party/cJSON", - "//utils/native/lite/include", + "//commonlibrary/utils_lite/include", "${appexecfwk_lite_path}/interfaces/innerkits/bundlemgr_lite", "//foundation/graphic/ui/interfaces/kits", "//foundation/graphic/utils/interfaces/innerkits", diff --git a/ability_lite/ability_posix/Test.json b/ability_lite/ability_posix/Test.json index 26a46f4f094bba48706456936c44bb8b99321eb0..790edb7618ee877452d1b495d26b4f471aa6255d 100755 --- a/ability_lite/ability_posix/Test.json +++ b/ability_lite/ability_posix/Test.json @@ -12,7 +12,7 @@ "server": "NfsServer", "mount": [ { - "source": "testcases/aafwk", + "source": "testcases/ability", "target": "/test_root/aafwk" },{ "source": "resource/aafwk", diff --git a/account/OsAccountTest_js/src/main/config.json b/account/OsAccountTest_js/src/main/config.json index 2ed8950e0d75e5997286b43a59bf1f94b888a755..fd7e2fd62b1434e72b956a90bca72172dddb67f6 100644 --- a/account/OsAccountTest_js/src/main/config.json +++ b/account/OsAccountTest_js/src/main/config.json @@ -18,6 +18,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/account/appaccount/BUILD.gn b/account/appaccount/BUILD.gn index f1f890f6e43ea15eafb224c4f53afc1881da0d01..c5a5c0d20fcb1ab04ab69bee51dd9a30833d7a76 100644 --- a/account/appaccount/BUILD.gn +++ b/account/appaccount/BUILD.gn @@ -18,6 +18,7 @@ group("appaccount_hap") { if (is_standard_system) { deps = [ "actsaccounttest:ActsAccountTest", + "actsaccounttstest:ActsAccountTsTest", "actsgetallaccounts:ActsGetAllAccountsTest", "actssetchecksyncenable:ActsSetCheckSyncEnableTest", "getallaccessibleaccounts:accessibleaccounts", diff --git a/account/appaccount/actsaccounttest/src/main/config.json b/account/appaccount/actsaccounttest/src/main/config.json index e47e0d633e3b22fa3b1f853a4dd6822a91edd311..666c83c70540443e228bda9a0d32be658e59a8cd 100644 --- a/account/appaccount/actsaccounttest/src/main/config.json +++ b/account/appaccount/actsaccounttest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsaccounttest", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/account/appaccount/actsaccounttest/src/main/js/test/AssociatedData.test.js b/account/appaccount/actsaccounttest/src/main/js/test/AssociatedData.test.js index 1cc7a8081cc16d955f357c84396a025d81de737c..226cd16e5df5a482f1cd2a7676d00ebb303f6d79 100755 --- a/account/appaccount/actsaccounttest/src/main/js/test/AssociatedData.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/AssociatedData.test.js @@ -1161,5 +1161,35 @@ export default function ActsAccountAssociatedData() { } } }) + + + /* + * @tc.number : ActsAccountAssociatedData_3100 + * @tc.name : The correct calls setAssociatedData and getAssociatedData get the value + * @tc.desc : The setAssociatedData setting valueis called when the forwarding parameters + * are correct, and then getAssociatedData is called for the value(callback) + */ + it('ActsAccountAssociatedData_3100', 0, async function (done) { + console.debug("====>ActsAccountAssociatedData_3100 start===="); + var appAccountManager = account.createAppAccountManager(); + console.debug("====>creat finish===="); + appAccountManager.addAccount("account_name_3100",(err)=>{ + console.debug("====>add ActsAccountAssociatedData_3100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + appAccountManager.setAssociatedData("account_name_3100", "key31", "value31", (err)=>{ + console.debug("====>setAssociatedData ActsAccountAssociatedData_3100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + var result = appAccountManager.getAssociatedDataSync("account_name_3100", "key31") + console.debug("====>getAssociatedData ActsAccountAssociatedData_3100 result:" + JSON.stringify(result)); + expect(result).assertEqual("value31"); + appAccountManager.deleteAccount("account_name_3100", (err)=>{ + console.debug("====>delete Account 0100 err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsAccountAssociatedData_3100 end===="); + done(); + }); + }); + }); + }); }) } \ No newline at end of file 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/actsaccounttest/src/main/js/test/NoPermission.test.js b/account/appaccount/actsaccounttest/src/main/js/test/NoPermission.test.js index 5fa9b267b0661f4f3294200b79946ee095e65d08..b901cce6d59a1e1fcb63e2ebd6f279ae07d3c406 100755 --- a/account/appaccount/actsaccounttest/src/main/js/test/NoPermission.test.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/NoPermission.test.js @@ -198,7 +198,8 @@ export default function ActsAccountNoPermission() { expect(err).assertEqual(null); appAccountManager.getAllAccounts(selfBundle, (err, data)=>{ console.debug("====>getAllAccounts 0700 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(account.ResultCode.ERROR_PERMISSION_DENIED); + expect(err).assertEqual(null); + expect(data.length>0).assertEqual(true); appAccountManager.deleteAccount("getAll_callback_nopermission", (err)=>{ console.debug("====>delete account 0700 err:" + JSON.stringify(err)); expect(err).assertEqual(null); diff --git a/account/appaccount/actsaccounttest/src/main/js/test/OnOff.js b/account/appaccount/actsaccounttest/src/main/js/test/OnOff.js index b66091f139c02bdb9f70d2ac3515937e4900bcf7..c5020391e75ab38b21de17027fe8c9ba2fae3a4c 100644 --- a/account/appaccount/actsaccounttest/src/main/js/test/OnOff.js +++ b/account/appaccount/actsaccounttest/src/main/js/test/OnOff.js @@ -30,7 +30,11 @@ export default function ActsAccountChangeOnOff() { console.info(`sleep #{time} over ...`) }) } - beforeAll(async function (done) { + beforeAll(async function (done) { + done(); + }); + + async function testInit(){ console.debug("====>startAbility start===="); await featureAbility.startAbility( { @@ -46,8 +50,7 @@ export default function ActsAccountChangeOnOff() { }, ); await sleep(TIMEOUT); - done(); - }); + } /* * @tc.number : ActsAccountChangeOnOff_0100 @@ -56,6 +59,7 @@ export default function ActsAccountChangeOnOff() { * the additional information */ it('ActsAccountChangeOnOff_0100', 0, async function (done) { + testInit(); console.debug("====>ActsAccountChangeOnOff_0100 start===="); var appAccountManager = account.createAppAccountManager(); console.debug("====>creat appAccountManager finish"); @@ -124,6 +128,7 @@ export default function ActsAccountChangeOnOff() { * the associatal data */ it('ActsAccountChangeOnOff_0200', 0, async function (done) { + testInit(); console.debug("====>ActsAccountChangeOnOff_0200 start===="); var appAccountManager = account.createAppAccountManager(); console.debug("====>creat appAccountManager finish"); @@ -187,6 +192,7 @@ export default function ActsAccountChangeOnOff() { * the credential */ it('ActsAccountChangeOnOff_0300', 0, async function (done) { + testInit(); console.debug("====>ActsAccountChangeOnOff_0300 start===="); var appAccountManager = account.createAppAccountManager(); console.debug("====>creat appAccountManager finish"); @@ -250,6 +256,7 @@ export default function ActsAccountChangeOnOff() { * authorized account */ it('ActsAccountChangeOnOff_0400', 0, async function (done) { + testInit(); console.debug("====>ActsAccountChangeOnOff_0400 start===="); var appAccountManager = account.createAppAccountManager(); console.debug("====>creat appAccountManager finish"); @@ -317,6 +324,7 @@ export default function ActsAccountChangeOnOff() { * the only authorized account */ it('ActsAccountChangeOnOff_0500', 0, async function (done) { + testInit(); console.debug("====>ActsAccountChangeOnOff_0500 start===="); var appAccountManager = account.createAppAccountManager(); console.debug("====>creat appAccountManager finish"); @@ -325,7 +333,7 @@ export default function ActsAccountChangeOnOff() { console.debug("====>enableAppAccess ActsAccountChangeOnOff_0500 start"); await appAccountManager.enableAppAccess("onoff_delete", "com.example.actsaccountsceneonoff"); function unSubscriberCallback(err){ - console.debug("====>unsubscribe 0500 err:" + JSON.stringify(err)); + console.debug("====>unsubscribe 0500 err:" + JSON.stringify(err)); } function subscriberCallback(err, data){ console.debug("====>subscriberCallback 0500 data:" + JSON.stringify(data)); @@ -375,6 +383,7 @@ export default function ActsAccountChangeOnOff() { * authorized account */ it('ActsAccountChangeOnOff_0600', 0, async function (done) { + testInit(); console.debug("====>ActsAccountChangeOnOff_0600 start===="); var appAccountManager = account.createAppAccountManager(); console.debug("====>creat appAccountManager finish"); @@ -446,6 +455,7 @@ export default function ActsAccountChangeOnOff() { * the only authorized account */ it('ActsAccountChangeOnOff_0700', 0, async function (done) { + testInit(); console.debug("====>ActsAccountChangeOnOff_0700 start===="); var appAccountManager = account.createAppAccountManager(); console.debug("====>creat appAccountManager finish"); diff --git a/account/appaccount/actsaccounttstest/AppScope/app.json b/account/appaccount/actsaccounttstest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..ea1d2221fe937e340d83cd80336a8c8a4b3090ff --- /dev/null +++ b/account/appaccount/actsaccounttstest/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.accounttstest", + "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 + } + } +} diff --git a/account/appaccount/actsaccounttstest/AppScope/resources/base/element/string.json b/account/appaccount/actsaccounttstest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ee69f9a861d9dc269ed6638735d52674583498e1 --- /dev/null +++ b/account/appaccount/actsaccounttstest/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/account/appaccount/actsaccounttstest/AppScope/resources/base/media/app_icon.png b/account/appaccount/actsaccounttstest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/account/appaccount/actsaccounttstest/AppScope/resources/base/media/app_icon.png differ diff --git a/account/appaccount/actsaccounttstest/BUILD.gn b/account/appaccount/actsaccounttstest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..15f72696b6c2359c50d7e64bcbc34941b2c411c6 --- /dev/null +++ b/account/appaccount/actsaccounttstest/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAccountTsTest") { + hap_profile = "./entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accounttstest_js_assets", + ":accounttstest_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAccountTsTest" + part_name = "accessibility" + subsystem_name = "barrierfree" +} + +ohos_app_scope("accounttstest_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accounttstest_js_assets") { + source_dir = "./entry/src/main/ets" +} + +ohos_resources("accounttstest_resources") { + sources = [ "./entry/src/main/resources" ] + deps = [ ":accounttstest_app_profile" ] + hap_profile = "./entry/src/main/module.json" +} diff --git a/account/appaccount/actsaccounttstest/Test.json b/account/appaccount/actsaccounttstest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..c264c134bdd33a66b58453487b9fa9b75aae83ce --- /dev/null +++ b/account/appaccount/actsaccounttstest/Test.json @@ -0,0 +1,26 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "180000", + "bundle-name": "com.example.accounttstest", + "module-name": "phone", + "shell-timeout": "180000", + "testcase-timeout": 70000 + }, + "kits": [ + { + "test-file-name": [ + "ActsAccountTsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "teardown-command":[ + "bm uninstall -n com.example.accounttstest" + ] + } + ] +} diff --git a/account/appaccount/actsaccounttstest/entry/src/main/ets/Application/AbilityStage.ts b/account/appaccount/actsaccounttstest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..32dfe93ccff0375201857794de902cec4d239442 --- /dev/null +++ b/account/appaccount/actsaccounttstest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,7 @@ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/account/appaccount/actsaccounttstest/entry/src/main/ets/MainAbility/MainAbility.ts b/account/appaccount/actsaccounttstest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..cd47e022551551b3c393359b8cccafb7462c600a --- /dev/null +++ b/account/appaccount/actsaccounttstest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +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; + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + 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.abilityStorage = this.storage + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "MainAbility/pages/index/index", 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") + } +}; \ No newline at end of file diff --git a/account/appaccount/actsaccounttstest/entry/src/main/ets/MainAbility/pages/index/index.ets b/account/appaccount/actsaccounttstest/entry/src/main/ets/MainAbility/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..83a21e8ff3279e5e8588a6d30cab940c15968c2b --- /dev/null +++ b/account/appaccount/actsaccounttstest/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -0,0 +1,37 @@ +/* + * 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 router from '@ohos.router'; + +@Entry +@Component +struct Index { + @State message: string = 'accessibilityEvent For Gesture'; + + aboutToAppear(){ + console.info("start run testcase!!!!"); + } + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/account/appaccount/actsaccounttstest/entry/src/main/ets/TestAbility/TestAbility.ts b/account/appaccount/actsaccounttstest/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..89a84730505783ba229175ab4b55d37f91a16266 --- /dev/null +++ b/account/appaccount/actsaccounttstest/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.loadContent("TestAbility/pages/index", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) + }); + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/account/appaccount/actsaccounttstest/entry/src/main/ets/TestAbility/pages/index.ets b/account/appaccount/actsaccounttstest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b93567f962921124b282f78c8ef123965d1460c9 --- /dev/null +++ b/account/appaccount/actsaccounttstest/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,48 @@ +/* + * 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 router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('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/account/appaccount/actsaccounttstest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/account/appaccount/actsaccounttstest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..9a67c520cc1abcae08847f4eb729f564fd34df03 --- /dev/null +++ b/account/appaccount/actsaccounttstest/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.accounttstest.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/account/appaccount/actsaccounttstest/entry/src/main/ets/test/List.test.ets b/account/appaccount/actsaccounttstest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..484485f4d827531fb876d0acecb48cc1808bb1d2 --- /dev/null +++ b/account/appaccount/actsaccounttstest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * 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 oauthTokenInfoTest from './OAuthTokenInfoTest.test.ets' + +export default function testsuite() { + oauthTokenInfoTest() +} \ No newline at end of file diff --git a/account/appaccount/actsaccounttstest/entry/src/main/ets/test/OAuthTokenInfoTest.test.ets b/account/appaccount/actsaccounttstest/entry/src/main/ets/test/OAuthTokenInfoTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6c778f6d83cc391ed34121fa62e8b6d05fd25261 --- /dev/null +++ b/account/appaccount/actsaccounttstest/entry/src/main/ets/test/OAuthTokenInfoTest.test.ets @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import appAccount from "@ohos.account.appAccount" + +export default function oauthTokenInfoTest() { + describe('OAuthTokenInfoTest', function () { + beforeAll(async function (done) { + console.info('AccountTsTest: beforeAll'); + done(); + }) + + afterAll(async function (done) { + console.info('AccountTsTest: afterAll'); + done(); + }) + + beforeEach(async function (done) { + console.info('AccountTsTest: beforeEach'); + done(); + }) + + afterEach(async function (done) { + console.info('AccountTsTest: afterEach'); + done(); + }) + + /* + * @tc.number OAuthTokenInfoTest_0100 + * @tc.name OAuthTokenInfoTest_0100 + * @tc.desc OAuthTokenInfo without account. + * @tc.size SmallTest + * @tc.type User + */ + it('OAuthTokenInfoTest_0100', 0, async function (done) { + let info : appAccount.OAuthTokenInfo = { + authType: "getSocialData", + token: "xxxxx" + } + console.log("OAuthTokenInfoTest_0100 info: " + JSON.stringify(info)); + expect(info.hasOwnProperty("accounts")).assertEqual(false) + expect(info.hasOwnProperty("account")).assertEqual(false) + done() + }) + + /* + * @tc.number OAuthTokenInfoTest_0200 + * @tc.name OAuthTokenInfoTest_0200 + * @tc.desc OAuthTokenInfo with account. + * @tc.size SmallTest + * @tc.type User + */ + it('OAuthTokenInfoTest_0200', 0, async function (done) { + let info : appAccount.OAuthTokenInfo = { + authType: "getSocialData", + token: "xxxxx", + account: { + name: "zhangsan", + owner: "com.ohos.testapp" + } + } + console.log("OAuthTokenInfoTest_0200 info: " + JSON.stringify(info)) + expect(info.hasOwnProperty("accounts")).assertEqual(false) + expect(info.hasOwnProperty("account")).assertEqual(true) + expect(info.account.owner).assertEqual("com.ohos.testapp") + done(); + }) + }) +} diff --git a/account/appaccount/actsaccounttstest/entry/src/main/module.json b/account/appaccount/actsaccounttstest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..b21a851e79f97f1a6120f5d741ab056e837cf798 --- /dev/null +++ b/account/appaccount/actsaccounttstest/entry/src/main/module.json @@ -0,0 +1,34 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [{ + "name": "com.example.accounttstest.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" + ] + }] + }] + } +} \ No newline at end of file diff --git a/account/appaccount/actsaccounttstest/entry/src/main/resources/base/element/string.json b/account/appaccount/actsaccounttstest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0f52cffe3fbc6dc1639e0f6348c3027884d08d7a --- /dev/null +++ b/account/appaccount/actsaccounttstest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "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": "AccountTsTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "serviceability_description", + "value": "my whether" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" + }, + { + "name": "AccountTsTest_desc", + "value": "AccountTsTest_description" + }, + { + "name": "AccountTsTest_label", + "value": "AccountTsTest" + } + ] +} \ No newline at end of file diff --git a/account/appaccount/actsaccounttstest/entry/src/main/resources/base/media/icon.png b/account/appaccount/actsaccounttstest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/account/appaccount/actsaccounttstest/entry/src/main/resources/base/media/icon.png differ diff --git a/account/appaccount/actsaccounttstest/entry/src/main/resources/base/profile/accessibility_config.json b/account/appaccount/actsaccounttstest/entry/src/main/resources/base/profile/accessibility_config.json new file mode 100644 index 0000000000000000000000000000000000000000..c3562ab303d502e6d285bf9daae51fad0f07367a --- /dev/null +++ b/account/appaccount/actsaccounttstest/entry/src/main/resources/base/profile/accessibility_config.json @@ -0,0 +1,9 @@ +{ + "accessibilityCapabilities": [ + "retrieve", + "touchGuide", + "gesture" + ], + "accessibilityCapabilityRationale": "a11y_rationale", + "settingsAbility": "com.accessibility.voiceaid.voiceAidSetting" +} \ No newline at end of file diff --git a/account/appaccount/actsaccounttstest/entry/src/main/resources/base/profile/main_pages.json b/account/appaccount/actsaccounttstest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..a99e380b1101058975a15da3ddab9efc0f72972a --- /dev/null +++ b/account/appaccount/actsaccounttstest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index/index" + ] +} diff --git a/account/appaccount/actsaccounttstest/signature/openharmony_sx.p7b b/account/appaccount/actsaccounttstest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/account/appaccount/actsaccounttstest/signature/openharmony_sx.p7b differ diff --git a/account/appaccount/actsgetallaccounts/src/main/config.json b/account/appaccount/actsgetallaccounts/src/main/config.json index 96bc2a2bb660c048e17515080ba1c2cb6fc372c5..0e0a22a317aa16eaa530d48032a053279a7cb43a 100644 --- a/account/appaccount/actsgetallaccounts/src/main/config.json +++ b/account/appaccount/actsgetallaccounts/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/account/appaccount/actsgetallaccounts/src/main/js/test/Getallaccounts.test.js b/account/appaccount/actsgetallaccounts/src/main/js/test/Getallaccounts.test.js index 34ad23ba284f04bdd6b6e70aa6b1d0d29700d440..dace9ca6566eb97e56234f66ee0d055877d46259 100755 --- a/account/appaccount/actsgetallaccounts/src/main/js/test/Getallaccounts.test.js +++ b/account/appaccount/actsgetallaccounts/src/main/js/test/Getallaccounts.test.js @@ -459,6 +459,8 @@ export default function ActsGetAllAccounts() { var nonexistentBundle = "com.example.actsgetallaccountsnonexistent"; try{ var data = await appAccountManager.getAllAccounts(nonexistentBundle); + expect().assertFail(); + done(); } catch(err){ console.debug("====>getAllAccounts 1400 err:" + JSON.stringify(err)); diff --git a/account/appaccount/actssetchecksyncenable/src/main/config.json b/account/appaccount/actssetchecksyncenable/src/main/config.json index b0165606aae85d240e2eafa83def35d3283edd77..2a8a8e31b1f04e5dcf049ec2ed522aab3fe783f5 100644 --- a/account/appaccount/actssetchecksyncenable/src/main/config.json +++ b/account/appaccount/actssetchecksyncenable/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/config.json b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/config.json index ab9f8fb4255b8f2077c367f9c199b9dff3e07e7a..4e1fb96ac5ed6626f8d2db079a234de1d8b52253 100644 --- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/config.json +++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessibleaccounts/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/config.json b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/config.json index ae92671ab59bf880e98bde100618bfac61ba5ec0..bc0e5918556d7fb87261b73c7926df60467fcf14 100644 --- a/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/config.json +++ b/account/appaccount/getallaccessibleaccounts/actsgetallaccessiblemultiple/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/account/appaccount/sceneProject/actsaccountaccessibleFirst/entry/src/main/config.json b/account/appaccount/sceneProject/actsaccountaccessibleFirst/entry/src/main/config.json index c5f83a58a6558d522aacf6910d5cacdf72755b7f..76f00100dda7bf00bbf12a92ea147b532e083019 100755 --- a/account/appaccount/sceneProject/actsaccountaccessibleFirst/entry/src/main/config.json +++ b/account/appaccount/sceneProject/actsaccountaccessibleFirst/entry/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsaccountaccessiblefirst", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/account/appaccount/sceneProject/actsaccountaccessibleSecond/entry/src/main/config.json b/account/appaccount/sceneProject/actsaccountaccessibleSecond/entry/src/main/config.json index 3b381d659f71c7893bb9a3c7250db5369480c7ed..17605cbf06fb531dee3e484224f9011f951a593c 100755 --- a/account/appaccount/sceneProject/actsaccountaccessibleSecond/entry/src/main/config.json +++ b/account/appaccount/sceneProject/actsaccountaccessibleSecond/entry/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsaccountaccessiblesecond", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/config.json b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/config.json index dd3a529063f3022a8dff5982d44d325e1970ed2f..522ea39becee3f1dee844936da2e5bbbe40973d3 100644 --- a/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/config.json +++ b/account/appaccount/sceneProject/actsaccountauthenticator/entry/src/main/config.json @@ -15,6 +15,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "default", "tablet" ], @@ -33,7 +34,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/account/appaccount/sceneProject/actsaccountoauthtoken/entry/src/main/config.json b/account/appaccount/sceneProject/actsaccountoauthtoken/entry/src/main/config.json index d1aa1804079485ff6ba21e6d05711f35e54dd647..ad8171ba799f944c2d9f02d652c95498c502fe8f 100644 --- a/account/appaccount/sceneProject/actsaccountoauthtoken/entry/src/main/config.json +++ b/account/appaccount/sceneProject/actsaccountoauthtoken/entry/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsaccountOauthtoken", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/account/appaccount/sceneProject/actsaccountsceneaccessible/entry/src/main/config.json b/account/appaccount/sceneProject/actsaccountsceneaccessible/entry/src/main/config.json index 65b0eb38c5358a4bf5625e30efa35f7988f3c8b4..83c6627e58f2f1262b18f5c155b948ba9b8624e8 100755 --- a/account/appaccount/sceneProject/actsaccountsceneaccessible/entry/src/main/config.json +++ b/account/appaccount/sceneProject/actsaccountsceneaccessible/entry/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsaccountsceneaccessible", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/account/appaccount/sceneProject/actsaccountsceneappaccess/entry/src/main/config.json b/account/appaccount/sceneProject/actsaccountsceneappaccess/entry/src/main/config.json index f0465cae8823a8cdd54b493e92ba4548c45d9b80..4b8cfeaf9297fa1a6e3ee2a2b0e325e63e9c1ee0 100755 --- a/account/appaccount/sceneProject/actsaccountsceneappaccess/entry/src/main/config.json +++ b/account/appaccount/sceneProject/actsaccountsceneappaccess/entry/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsaccountsceneappaccess", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/account/appaccount/sceneProject/actsaccountsceneonoff/entry/src/main/config.json b/account/appaccount/sceneProject/actsaccountsceneonoff/entry/src/main/config.json index afe851d9e2dbae23256e3382566e6035bb136dc5..c75955f35fd29408b7ef9b04d8368860a4c0ad00 100755 --- a/account/appaccount/sceneProject/actsaccountsceneonoff/entry/src/main/config.json +++ b/account/appaccount/sceneProject/actsaccountsceneonoff/entry/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsaccountsceneonoff", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/account/appaccount/sceneProject/actsaccountsceneonoff/entry/src/main/js/default/pages/index/index.js b/account/appaccount/sceneProject/actsaccountsceneonoff/entry/src/main/js/default/pages/index/index.js index 2a4d51d25c03f6a122eeb69bebeb447e563bb658..769e6af03e548a0331c45a68555e52220fdc23a9 100755 --- a/account/appaccount/sceneProject/actsaccountsceneonoff/entry/src/main/js/default/pages/index/index.js +++ b/account/appaccount/sceneProject/actsaccountsceneonoff/entry/src/main/js/default/pages/index/index.js @@ -14,6 +14,7 @@ */ import account from '@ohos.account.appAccount' import commonevent from '@ohos.commonEvent' +import featureAbility from '@ohos.ability.featureAbility' const ACCOUNT_TEST_ONOFF_EXTRA = 1 const ACCOUNT_TEST_ONOFF_ASSOCIATEDDATA = 2 @@ -46,6 +47,7 @@ export default { appAccountManager.off('change', function (){ console.debug("====>scene off finish===="); }); + featureAbility.terminateSelf() } // Subscribe to the callback of account information changes, verify the received account information, and send @@ -247,7 +249,7 @@ export default { default: console.debug("====>receive event enter default===="); break; - } + } } var subscriber commonevent.createSubscriber(commonEventSubscribeInfo).then(function (data){ diff --git a/account/appaccount/sceneProject/actsscenegetallaccounts/entry/src/main/config.json b/account/appaccount/sceneProject/actsscenegetallaccounts/entry/src/main/config.json index 96089241228b621b8aa29ebe88db2891a7b296f4..ed3690be367ec99432658c4ae34b0ff51ba53b93 100755 --- a/account/appaccount/sceneProject/actsscenegetallaccounts/entry/src/main/config.json +++ b/account/appaccount/sceneProject/actsscenegetallaccounts/entry/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsscenegetallaccounts", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/account/appaccount/sceneProject/actsscenegetallaccounts/entry/src/main/js/default/pages/index/index.js b/account/appaccount/sceneProject/actsscenegetallaccounts/entry/src/main/js/default/pages/index/index.js index 080d2bb3a37e3ec7fa3d30b373404c94887f5dd4..172e91fc0d5b23990a6cc0340b722b9373f3d719 100755 --- a/account/appaccount/sceneProject/actsscenegetallaccounts/entry/src/main/js/default/pages/index/index.js +++ b/account/appaccount/sceneProject/actsscenegetallaccounts/entry/src/main/js/default/pages/index/index.js @@ -13,6 +13,7 @@ * limitations under the License. */ import account from '@ohos.account.appAccount' +import featureAbility from '@ohos.ability.featureAbility' const injectRef = Object.getPrototypeOf(global) || global injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') @@ -33,6 +34,7 @@ export default { console.debug("====>add account scene err:" + JSON.stringify(err)); appAccountManager.enableAppAccess("account_name_scene_single", enableBundle, (err)=>{ console.debug("====>enableAppAccess scene err:" + JSON.stringify(err)); + featureAbility.terminateSelf() }); }); }, diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/config.json b/account/osaccount/actsosaccountthirdpartytest/src/main/config.json index 5a0e9c58625b0ffd5f5b9f2978d6ac152807e29e..a4bab43b508003a8f9c61091ff8f2a8165797ff0 100755 --- a/account/osaccount/actsosaccountthirdpartytest/src/main/config.json +++ b/account/osaccount/actsosaccountthirdpartytest/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js old mode 100755 new mode 100644 index d14f497fd9b6cc1bb08386b9019e2e0e3cc73617..dd89d0c57749377fc175bffdcfd69e9e45bfca65 --- a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js +++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountGet.test.js @@ -235,7 +235,7 @@ export default function ActsOsAccountThirdPartyTest_third_2() { var osAccountManager = osaccount.getAccountManager(); var testLocalId = await osAccountManager.getOsAccountLocalIdFromProcess(); console.debug("====>get AccountManager finish===="); - osAccountManager.getSerialNumberByOsAccountLocalId(100, (err, serialNumber)=>{ + osAccountManager.getSerialNumberByOsAccountLocalId(testLocalId, (err, serialNumber)=>{ console.debug("====>ger serialNumber err:" + JSON.stringify(err)); console.debug("====>get serialNumber:" + serialNumber + " by localId: 100" ); expect(err).assertEqual(null); @@ -349,6 +349,12 @@ export default function ActsOsAccountThirdPartyTest_third_2() { expect(data.isVerified).assertEqual(false); expect(data.distributedInfo.name != null).assertEqual(true); expect(data.domainInfo.domain == "").assertEqual(true); + expect(data.photo == "").assertEqual(true); + expect(data.createTime != "").assertEqual(true); + expect(data.lastLoginTime>=0).assertEqual(true); + expect(data.serialNumber.toString().length == 16).assertEqual(true); + expect(data.isActived).assertEqual(false); + expect(data.isCreateCompleted).assertEqual(true) localId = data.localId; osAccountManager.getSerialNumberByOsAccountLocalId(localId, (err, serialNumber)=>{ console.debug("====>queryOsAccountById err:" + JSON.stringify(err)); @@ -487,5 +493,192 @@ export default function ActsOsAccountThirdPartyTest_third_2() { console.debug("====>ActsOsAccountGetCount_0200 end===="); done(); }) + + /* + * @tc.number : ActsOsAccountQueryActivedOsAccountIds_0100 + * @tc.name : queryActivatedOsAccountIds callback + * @tc.desc : query activated osAccount Ids + */ + it('ActsOsAccountQueryActivedOsAccountIds_0100', 0, async function (done) { + console.debug("====>ActsOsAccountQueryActivedOsAccountIds_0100 start===="); + var osAccountManager = osaccount.getAccountManager(); + osAccountManager.queryActivatedOsAccountIds((err,dataArray)=>{ + console.info("====>ActsOsAccountGQueryActicedOsAccountIds_0100 err :" + JSON.stringify(err)); + expect(err).assertEqual(null) + console.info("====>ActsOsAccountGQueryActicedOsAccountIds_0100 dataArray" + dataArray.length); + done(); + }) + }) + + /* + * @tc.number : ActsOsAccountQueryActivedOsAccountIds_0200 + * @tc.name : queryActivatedOsAccountIds promise + * @tc.desc : query activated osAccount Ids + */ + it('ActsOsAccountQueryActivedOsAccountIds_0200', 0, async function (done) { + console.debug("====>ActsOsAccountQueryActivedOsAccountIds_0200 start===="); + var osAccountManager = osaccount.getAccountManager(); + osAccountManager.queryActivatedOsAccountIds().then((data)=>{ + console.debug("====>ActsOsAccountQueryActivedOsAccountIds_0200 data" + JSON.stringify(data)) + done(); + }).catch((err)=>{ + console.info("====>ActsOsAccountQueryActivedOsAccountIds_0200 err " + JSON.stringify(err)); + expect(err).assertEqual(null) + done(); + }); + }) + + + /* + * @tc.number : ActsOsAccountConstraints_0300 + * @tc.name : Constraints callback + * @tc.desc : get 0 local user all constraints + */ + it('ActsOsAccountConstraints_3100', 0, async function(done){ + console.debug("====>ActsOsAccountConstraints_3100 start===="); + var AccountManager = osaccount.getAccountManager(); + console.debug("====>get AccountManager finish===="); + AccountManager.getOsAccountAllConstraints(0, (err, constraints)=>{ + console.debug("====>getOsAccountAllConstraints err:" + JSON.stringify(err)); + console.debug("====>getOsAccountAllConstraints:" + JSON.stringify(constraints)); + expect(err).assertEqual(null); + expect(constraints.length).assertEqual(0); + console.debug("====>ActsOsAccountConstraints_3100 end===="); + done(); + }) + }) + + /* + * @tc.number : ActsOsAccountConstraints_0400 + * @tc.name : Constraints promise + * @tc.desc : get 0 local user all constraints + */ + it('ActsOsAccountConstraints_3200', 0, async function(done){ + console.debug("====>ActsOsAccountConstraints_3200 start===="); + var AccountManager = osaccount.getAccountManager(); + console.debug("get AccountManager finish===="); + AccountManager.getOsAccountAllConstraints(0).then((data)=>{ + console.debug("====>ActsOsAccountConstraints_3200 getOsAccountAllConstraints data:" + data); + done(); + }).catch((err)=>{ + console.debug("====>ActsOsAccountConstraints_3200 getOsAccountAllConstraints err:" + JSON.stringify(err)); + expect().assertFalse() + done(); + }) + }) + + /** + * @tc.number ActsAccountDomainTest_0300 + * @tc.name Test createOsAccountForDomain getOsAccountLocalIdFromDomain callback + * @tc.desc Test createOsAccountForDomain getOsAccountLocalIdFromDomain API functionality + */ + it('ActsOsAccountDomainTest_0300', 0, async function (done) { + console.debug("====>ActsOsAccountDomainTest_0100 start===="); + var osAccountManager = osaccount.getAccountManager(); + osAccountManager.getOsAccountLocalIdFromDomain({domain: "", accountName: ""}, (err)=>{ + console.debug("====>ActsOsAccountDomainTest_0300 err:" + JSON.stringify(err)); + expect(err.code != 0).assertEqual(true) + console.debug("====>ActsOsAccountDomainTest_0300 end===="); + done(); + }) + }); + + /** + * @tc.number ActsAccountDomainTest_0400 + * @tc.name Test createOsAccountForDomain getOsAccountLocalIdFromDomain pormise + * @tc.desc Test createOsAccountForDomain getOsAccountLocalIdFromDomain API functionality + */ + it('ActsOsAccountDomainTest_0400', 0, async function (done) { + console.debug("====>ActsOsAccountDomainTest_0400 start===="); + var osAccountManager = osaccount.getAccountManager(); + osAccountManager.getOsAccountLocalIdFromDomain({domain: "", accountName: ""}).then((accountID)=>{ + console.debug("ActsOsAccountDomainTest_0400 accountID:" + JSON.stringify(accountID)) + done(); + }).catch((err)=>{ + console.debug("ActsOsAccountDomainTest_0400 err:" + JSON.stringify(err)) + expect(err.code != 0).assertEqual(true) + done(); + }) + }); + + /* + * @tc.number : ActsOsAccountQuery_1700 + * @tc.name : queryCurrentOsAccount callback + * @tc.desc : Get the os account information to which the application belongs + */ + it('ActsOsAccountQuery_2100', 0, async function(done){ + console.debug("====>ActsOsAccountQuery_2100 start===="); + var AccountManager = osaccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + AccountManager.queryCurrentOsAccount((err, data)=>{ + console.debug("====>queryCurrentOsAccount err:" + JSON.stringify(err)); + console.debug("====>queryCurrentOsAccount data:" + JSON.stringify(data)); + expect(err).assertEqual(null); + console.debug("====>ActsOsAccountQuery_2100 end===="); + done(); + }) + }) + + /* + * @tc.number : ActsOsAccountQuery_1800 + * @tc.name : queryCurrentOsAccount promise + * @tc.desc : Get the os account information to which the application belongs + */ + it('ActsOsAccountQuery_2200', 0, async function(done){ + console.debug("====>ActsOsAccountQuery_2200 start===="); + var AccountManager = osaccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + var data = await AccountManager.queryCurrentOsAccount(); + console.debug("====>queryCurrentOsAccount data:" + JSON.stringify(data)); + expect(data.localId).assertEqual(100); + expect(data.type.ADMIN).assertEqual(0); + var serialNumberStr = data.serialNumber.toString(); + var serialIntercept = serialNumberStr.substring(8); + console.debug("====>truncate the last eight characters: " + serialIntercept); + expect(serialIntercept).assertEqual("00000001"); + expect(data.isCreateCompleted).assertTrue(); + console.debug("====>ActsOsAccountQuery_2200 end===="); + done(); + }) + + + /* + * @tc.number : ActsOsAccountPermission_3300 + * @tc.name : isOsAccountConstraintEnable callback + * @tc.desc : the application call interface does not meet the permissions + */ + it('ActsOsAccountConstraints_3300', 0, async function(done){ + console.debug("====>ActsOsAccountConstraints_3300 start===="); + var AccountManager = osaccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + AccountManager.isOsAccountConstraintEnable(100, "constraint.bluetooth", (err, result)=>{ + console.debug("====>isOsAccountConstraintEnable err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + expect(result).assertTrue(); + console.debug("====>ActsOsAccountConstraints_3300 end===="); + done(); + }) + }) + + /* + * @tc.number : ActsOsAccountPermission_3400 + * @tc.name : isOsAccountConstraintEnable promise + * @tc.desc : the application call interface does not meet the permissions + */ + it('ActsOsAccountConstraints_3400', 0, async function(done){ + console.debug("====>ActsOsAccountConstraints_3400 start===="); + var AccountManager = osaccount.getAccountManager(); + console.debug("====>get os AccountManager finish===="); + try{ + await AccountManager.isOsAccountConstraintEnable(100, "constraint.bluetooth"); + done(); + } + catch(err){ + console.debug("====>isOsAccountConstraintEnable err:" + JSON.stringify(err)); + expect(err).assertEqual(null); + console.debug("====>ActsOsAccountConstraints_3400 end===="); + done(); + } + }) }) } \ No newline at end of file diff --git a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js index b2f55d16a6bd94c3477339c0e724513664513671..1cebbcce23078fcd682492d0c4dab2f433075873 100755 --- a/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js +++ b/account/osaccount/actsosaccountthirdpartytest/src/main/js/test/OsAccountIs.test.js @@ -499,5 +499,7 @@ export default function ActsOsAccountThirdPartyTest_third_1() { console.debug("====>ActsOsAccountIsTest_0200 end===="); done(); }) + + }) } \ No newline at end of file diff --git a/ai_lite/ai_engine_posix/base/BUILD.gn b/ai_lite/ai_engine_posix/base/BUILD.gn index be3e0c8c6e780be0fc0853e1d03aa15e418025d8..648eec53f5fc383acaa7899c0a5159c521fb5869 100644 --- a/ai_lite/ai_engine_posix/base/BUILD.gn +++ b/ai_lite/ai_engine_posix/base/BUILD.gn @@ -44,7 +44,7 @@ hcpptest_suite("ActsAiEngineTest") { "//foundation/ai/engine/services/algorithmsdk", "//foundation/ai/engine/services/server/plugin", "//third_party/bounds_checking_function/include", - "//utils/native/lite/include", + "//commonlibrary/utils_lite/include", "//kernel/liteos-a/kernel/include", "//kernel/liteos-a/kernel/common", "//foundation/systemabilitymgr/samgr_lite/interfaces/innerkits/registry", diff --git a/appexecfwk_lite/appexecfwk_hal/src/bundle_mgr_test.c b/appexecfwk_lite/appexecfwk_hal/src/bundle_mgr_test.c index ae9256903db003be8fedbfd3ae9480feb6d6e736..dff1b21e013beb44127432cd3b9330e932986e80 100755 --- a/appexecfwk_lite/appexecfwk_hal/src/bundle_mgr_test.c +++ b/appexecfwk_lite/appexecfwk_hal/src/bundle_mgr_test.c @@ -53,8 +53,13 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearAbilityInfoLegal, Function | MediumT AbilityInfo abilityInfo; int result = memset_s(&abilityInfo, sizeof(abilityInfo), 0, sizeof(abilityInfo)); TEST_ASSERT_TRUE(result == 0); - abilityInfo.bundleName = "com.openharmony.testjsdemo"; - TEST_ASSERT_EQUAL_STRING(abilityInfo.bundleName, "com.openharmony.testjsdemo"); + char *name = "com.openharmony.testjsdemo"; + size_t len = strlen(name); + abilityInfo.bundleName = (char *)malloc(len + 1); + TEST_ASSERT_NOT_NULL(abilityInfo.bundleName); + errno_t err = strncpy_s(abilityInfo.bundleName, len + 1, name, len); + TEST_ASSERT_EQUAL(err, EOK); + TEST_ASSERT_EQUAL_STRING(abilityInfo.bundleName, name); ClearAbilityInfo(&abilityInfo); TEST_ASSERT_EQUAL_STRING(abilityInfo.bundleName, NULL); printf("------end testClearAbilityInfo------\n"); @@ -71,9 +76,14 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearAbilityInfoIllegal, Function | Mediu AbilityInfo abilityInfo = { 0 }; int result = memset_s(&abilityInfo, sizeof(abilityInfo), 0, sizeof(abilityInfo)); TEST_ASSERT_TRUE(result == 0); - abilityInfo.bundleName = "com.openharmony.testjsdemo"; + char *name = "com.openharmony.testjsdemo"; + size_t len = strlen(name); + abilityInfo.bundleName = (char *)malloc(len + 1); + TEST_ASSERT_NOT_NULL(abilityInfo.bundleName); + errno_t err = strncpy_s(abilityInfo.bundleName, len + 1, name, len); + TEST_ASSERT_EQUAL(err, EOK); ClearAbilityInfo(NULL); - TEST_ASSERT_EQUAL_STRING(abilityInfo.bundleName, "com.openharmony.testjsdemo"); + TEST_ASSERT_EQUAL_STRING(abilityInfo.bundleName, name); printf("------end testClearAbilityInfoIllegal------\n"); } @@ -88,8 +98,13 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearBundleInfoLegal, Function | MediumTe BundleInfo bundleInfo = { 0 }; int result = memset_s(&bundleInfo, sizeof(bundleInfo), 0, sizeof(bundleInfo)); TEST_ASSERT_TRUE(result == 0); - bundleInfo.bundleName = "com.openharmony.testjsdemo"; - TEST_ASSERT_EQUAL_STRING(bundleInfo.bundleName, "com.openharmony.testjsdemo"); + char *name = "com.openharmony.testjsdemo"; + size_t len = strlen(name); + bundleInfo.bundleName = (char *)malloc(len + 1); + TEST_ASSERT_NOT_NULL(bundleInfo.bundleName); + errno_t err = strncpy_s(bundleInfo.bundleName, len + 1, name, len); + TEST_ASSERT_EQUAL(err, EOK); + TEST_ASSERT_EQUAL_STRING(bundleInfo.bundleName, name); ClearBundleInfo(&bundleInfo); TEST_ASSERT_EQUAL_STRING(bundleInfo.bundleName, NULL); printf("------end testClearBundleInfo------\n"); @@ -106,9 +121,14 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearBundleInfoIllegal, Function | Medium BundleInfo bundleInfo; int result = memset_s(&bundleInfo, sizeof(bundleInfo), 0, sizeof(bundleInfo)); TEST_ASSERT_TRUE(result == 0); - bundleInfo.bundleName = "com.openharmony.testjsdemo"; + char *name = "com.openharmony.testjsdemo"; + size_t len = strlen(name); + bundleInfo.bundleName = (char *)malloc(len + 1); + TEST_ASSERT_NOT_NULL(bundleInfo.bundleName); + errno_t err = strncpy_s(bundleInfo.bundleName, len + 1, name, len); + TEST_ASSERT_EQUAL(err, EOK); ClearBundleInfo(NULL); - TEST_ASSERT_EQUAL_STRING(bundleInfo.bundleName, "com.openharmony.testjsdemo"); + TEST_ASSERT_EQUAL_STRING(bundleInfo.bundleName, name); printf("------end testClearBundleInfoIllegal------\n"); } @@ -123,8 +143,13 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearModuleInfoLegal, Function | MediumTe ModuleInfo moduleInfo = { 0 }; int result = memset_s(&moduleInfo, sizeof(moduleInfo), 0, sizeof(moduleInfo)); TEST_ASSERT_TRUE(result == 0); - moduleInfo.moduleName = "test"; - TEST_ASSERT_EQUAL_STRING(moduleInfo.moduleName, "test"); + char *name = "test"; + size_t len = strlen(name); + moduleInfo.moduleName = (char *)malloc(len + 1); + TEST_ASSERT_NOT_NULL(moduleInfo.moduleName); + errno_t err = strncpy_s(moduleInfo.moduleName, len + 1, name, len); + TEST_ASSERT_EQUAL(err, EOK); + TEST_ASSERT_EQUAL_STRING(moduleInfo.moduleName, name); ClearModuleInfo(&moduleInfo); TEST_ASSERT_EQUAL_STRING(moduleInfo.moduleName, NULL); printf("------end testClearModuleInfo------\n"); @@ -141,9 +166,14 @@ LITE_TEST_CASE(BundleMgrTestSuite, testClearModuleInfoIllegal, Function | Medium ModuleInfo moduleInfo = { 0 }; int result = memset_s(&moduleInfo, sizeof(moduleInfo), 0, sizeof(moduleInfo)); TEST_ASSERT_TRUE(result == 0); - moduleInfo.moduleName = "test"; + char *name = "test"; + size_t len = strlen(name); + moduleInfo.moduleName = (char *)malloc(len + 1); + TEST_ASSERT_NOT_NULL(moduleInfo.moduleName); + errno_t err = strncpy_s(moduleInfo.moduleName, len + 1, name, len); + TEST_ASSERT_EQUAL(err, EOK); ClearModuleInfo(NULL); - TEST_ASSERT_EQUAL_STRING(moduleInfo.moduleName, "test"); + TEST_ASSERT_EQUAL_STRING(moduleInfo.moduleName, name); printf("------end testClearModuleInfoIllegal------\n"); } diff --git a/appexecfwk_lite/appexecfwk_posix/BUILD.gn b/appexecfwk_lite/appexecfwk_posix/BUILD.gn index dc03af3c07a4d3c2d5cf7c57de20fd187db028d9..a83149246bbf6da6145254c5d919131e49e4aad9 100755 --- a/appexecfwk_lite/appexecfwk_posix/BUILD.gn +++ b/appexecfwk_lite/appexecfwk_posix/BUILD.gn @@ -29,7 +29,7 @@ hcpptest_suite("ActsBundleMgrTest") { "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/samgr", "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/registry", "//third_party/googletest/googletest/include", - "//utils/native/lite/include", + "//commonlibrary/utils_lite/include", "${aafwk_lite_path}/interfaces/innerkits/intent_lite", "//third_party/cJSON", ] diff --git a/applications/BUILD.gn b/applications/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c11d1209e10c48b5e9af49f49abf844158b6865a --- /dev/null +++ b/applications/BUILD.gn @@ -0,0 +1,17 @@ +# 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. + +group("applications") { + testonly = true + deps = [ "settingsdata:settingsdata" ] +} diff --git a/applications/kitframework/BUILD.gn b/applications/kitframework/BUILD.gn index 482ad489f11c33896e93ddd926d6b5b8cac13fab..1c98b65b95b3b46c224aa7e1c39bc82441a4bc91 100644 --- a/applications/kitframework/BUILD.gn +++ b/applications/kitframework/BUILD.gn @@ -21,7 +21,7 @@ hctest_suite("ActsKitFwkApiTest") { include_dirs = [ "//test/xts/tools/lite/hctest/include", "//third_party/unity/src", - "//utils/native/lite/include", + "//commonlibrary/utils_lite/include", "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/samgr", "//third_party/bounds_checking_function/include/", "//third_party/mbedtls/include/", diff --git a/applications/settingsdata/BUILD.gn b/applications/settingsdata/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..dd277e22ba19016fa144657b6d83270cd6165690 --- /dev/null +++ b/applications/settingsdata/BUILD.gn @@ -0,0 +1,17 @@ +# 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. + +group("settingsdata") { + testonly = true + deps = [ "settings_ets:SettingsEtsTest" ] +} diff --git a/applications/settingsdata/settings_ets/BUILD.gn b/applications/settingsdata/settings_ets/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..7a002f2bc1df61adf8b0e14856126642b7b4d659 --- /dev/null +++ b/applications/settingsdata/settings_ets/BUILD.gn @@ -0,0 +1,36 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("SettingsEtsTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":settings_ets_assets", + ":settings_ets_resources", + ":settings_ets_test_assets", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsSettingsEtsTest" +} +ohos_js_assets("settings_ets_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_js_assets("settings_ets_test_assets") { + source_dir = "./entry/src/main/ets/TestAbility" +} +ohos_resources("settings_ets_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/applications/settingsdata/settings_ets/Test.json b/applications/settingsdata/settings_ets/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..648902a808fa7fad7758022a3c136c511b5d4a34 --- /dev/null +++ b/applications/settingsdata/settings_ets/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for settings Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.open.harmony.settings", + "package-name": "com.open.harmony.settings", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsSettingsEtsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/applications/settingsdata/settings_ets/entry/src/main/config.json b/applications/settingsdata/settings_ets/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..59bda1d473c84dc8eb71384020045e6f8f6516fb --- /dev/null +++ b/applications/settingsdata/settings_ets/entry/src/main/config.json @@ -0,0 +1,106 @@ +{ + "app": { + "bundleName": "com.open.harmony.settings", + "vendor": "open", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.open.harmony.settings", + "name": ".MyApplication", + "mainAbility": "com.open.harmony.settings.MainAbility", + "srcPath": "", + "deviceType": [ + "default", + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "orientation": "unspecified", + "visible": true, + "srcPath": "TestAbility", + "name": ".TestAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "formsEnabled": false, + "label": "$string:TestAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "reqPermissions": [ + { + "name":"ohos.permission.MANAGE_SECURE_SETTINGS", + "reason":"need use ohos.permission.,MANAGE_SECURE_SETTINGS" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} diff --git a/applications/settingsdata/settings_ets/entry/src/main/ets/MainAbility/app.ets b/applications/settingsdata/settings_ets/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..fc86a0485f5fa3d43dc0d7a7d858e3f41ed87304 --- /dev/null +++ b/applications/settingsdata/settings_ets/entry/src/main/ets/MainAbility/app.ets @@ -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('Application onCreate') + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/applications/settingsdata/settings_ets/entry/src/main/ets/MainAbility/pages/index.ets b/applications/settingsdata/settings_ets/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..5e23de1ad4a2900759944907b90d5324c7054dcb --- /dev/null +++ b/applications/settingsdata/settings_ets/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,37 @@ +// @ts-nocheck +/** + * 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. + */ + +@Entry +@Component +struct MyComponent { + aboutToAppear() { + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('Settings ETS TEST') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/applications/settingsdata/settings_ets/entry/src/main/ets/TestAbility/app.ets b/applications/settingsdata/settings_ets/entry/src/main/ets/TestAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..1405dd359f629939894b86e2b285cb2cc1b37aa6 --- /dev/null +++ b/applications/settingsdata/settings_ets/entry/src/main/ets/TestAbility/app.ets @@ -0,0 +1,32 @@ +/* + * 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 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/applications/settingsdata/settings_ets/entry/src/main/ets/TestAbility/pages/index.ets b/applications/settingsdata/settings_ets/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..52663437cb619d4598126cf403d3689cb31ba131 --- /dev/null +++ b/applications/settingsdata/settings_ets/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,49 @@ +/* + * 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 router from '@system.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('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/applications/settingsdata/settings_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/applications/settingsdata/settings_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..14e78a653e030645860bcc3e7eb6c600b098127b --- /dev/null +++ b/applications/settingsdata/settings_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,77 @@ +/* + * 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 itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + 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') + } + + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + 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 call abilityDelegator.getAppContext') + var context = abilityDelegator.getAppContext() + console.info('getAppContext : ' + JSON.stringify(context)) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/applications/settingsdata/settings_ets/entry/src/main/ets/test/List.test.ets b/applications/settingsdata/settings_ets/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..de54e5512c7bd01eb0eb724945bbde56334b81b5 --- /dev/null +++ b/applications/settingsdata/settings_ets/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 settingUiJsunit from './SettingUiJsunit.test.ets'; + +export default function testsuite() { + settingUiJsunit(); +} \ No newline at end of file diff --git a/applications/settingsdata/settings_ets/entry/src/main/ets/test/SettingUiJsunit.test.ets b/applications/settingsdata/settings_ets/entry/src/main/ets/test/SettingUiJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..15c3b907422d8bf0f2e94caa64d2094da29b148e --- /dev/null +++ b/applications/settingsdata/settings_ets/entry/src/main/ets/test/SettingUiJsunit.test.ets @@ -0,0 +1,1257 @@ +// @ts-nocheck +/** + * 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 "hypium/index"; +import settings from '@ohos.settings' +import featureAbility from '@ohos.ability.featureAbility'; + +export default function settingUiJsunit() { + describe('appInfoTest', function () { + console.log("************* settings Test start*************"); + it('settings_uri_test_001', 0,async function (done) { + var name = 'settings.screen.test'; + var uri = settings.getUriSync(name); + console.info("[settings_uri_test_001] uri is: " + uri); + var uri2 = settings.getUriSync(name); + console.info("[settings_uri_test_001] uri2 is: " + uri2); + expect(uri).assertEqual(uri2); + done(); + }); + + it('settings_uri_test_002', 0, async function (done) { + var name = ''; + var uri = settings.getUriSync(name); + console.info("[settings_uri_test_002] uri is: " + uri); + expect(uri).assertEqual('dataability:///com.ohos.settingsdata.DataAbility') + done(); + }); + + it('settings_uri_test_003', 0, async function (done) { + var name = 122.00; + try { + var uri = settings.getUriSync(name); + console.info("[settings_uri_test_003] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_uri_test_003] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + done(); + }); + + it('settings_uri_test_004', 0, async function (done) { + var name = 'settings.screen.brightness'; + var uri = settings.getUriSync(name); + console.info("[settings_uri_test_004] uri is: " + uri); + expect(uri).assertEqual('dataability:///com.ohos.settingsdata.DataAbility/settings.screen.brightness') + done(); + }); + + it('settings_get_value_005', 0, async function (done) { + var name = 'settings.screen.brightness20'; + var uri = settings.getUriSync(name); + var helper = featureAbility.acquireDataAbilityHelper(uri); + let value = settings.getValueSync(helper, name, "test getValueSync"); + console.info("[settings_get_value_005] value is: " + value); + expect(value).assertEqual("test getValueSync"); + done(); + }); + + it('settings_get_value_006', 0, async function (done) { + var name = 'settings.screen.brightness2'; + var uri = settings.getUriSync(name); + console.info("[settings_get_value_006] uri is: " + uri); + var helper = featureAbility.acquireDataAbilityHelper(uri); + let obj = { + aa: "aa" + } + try { + let value = settings.getValueSync(helper, name, obj); + console.info("[settings_get_value_006] value is: " + value); + expect(value).assertEqual("test getValueSync"); + } catch (err) { + console.error("[settings_get_value_006] error = " + err); + expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument[2] type. String expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_007', 0, async function (done) { + var name = 'settings.screen.brightness3'; + var uri = settings.getUriSync(name); + console.info("[settings_get_value_007] uri is: " + uri); + var helper = featureAbility.acquireDataAbilityHelper(uri); + let obj = ''; + try { + let value = settings.getValueSync(helper, name, obj); + console.info("[settings_get_value_007] value is: " + value); + expect(value).assertEqual(''); + } catch (err) { + console.error("[settings_get_value_007] error = " + err); + expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_008', 0, async function (done) { + var name = 'settings.screen.brightness4'; + var uri = settings.getUriSync(name); + console.info("[settings_get_value_008] uri is: " + uri); + var helper = featureAbility.acquireDataAbilityHelper(uri); + let obj = null; + try { + let value = settings.getValueSync(helper, name, obj); + console.info("[settings_get_value_008] value is: " + value); + } catch (err) { + console.error("[settings_get_value_008] error = " + err); + expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument[2] type. String expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_009', 0, async function (done) { + var name = 'settings.screen.brightness5'; + var uri = settings.getUriSync(name); + console.info("[settings_get_value_009] uri is: " + uri); + var helper = "helper"; + try { + let value = settings.getValueSync(helper, name, "test getValueSync"); + console.info("[settings_get_value_009] value is: " + value); + } catch (err) { + console.error("[settings_get_value_009] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_010', 0, async function (done) { + var name = 'settings.screen.brightness6'; + var uri = settings.getUriSync(name); + console.info("[settings_get_value_010] uri is: " + uri); + var helper = null; + try { + let value = settings.getValueSync(helper, name, "test getValueSync"); + console.info("[settings_get_value_010] value is: " + value); + } catch (err) { + console.error("[settings_get_value_010] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_0011', 0, async function (done) { + var name = 'settings.screen.brightness7'; + var uri = settings.getUriSync(name); + console.info("[settings_get_value_0011] uri is: " + uri); + var helper = "helper"; + let obj = 121; + try { + let value = settings.getValueSync(helper, name, obj); + console.info("[settings_get_value_0011] value is: " + value); + } catch (err) { + console.error("[settings_get_value_0011] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_0012', 0, async function (done) { + var name = 'settings.screen.brightness8'; + var uri = settings.getUriSync(name); + console.info("[settings_get_value_0012] uri is: " + uri); + var helper = null; + let obj = null; + try { + let value = settings.getValueSync(helper, name, obj); + console.info("[settings_get_value_0012] value is: " + value); + } catch (err) { + console.error("[settings_get_value_0012] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_013', 0, async function (done) { + var name = 1322.00; + try { + var uri = settings.getUriSync(name); + console.info("[settings_get_value_013] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_get_value_013] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = featureAbility.acquireDataAbilityHelper(uri); + try { + let value = settings.getValueSync(helper, name, "test getValueSync"); + console.info("[settings_get_value_013] value is: " + value); + } catch (err) { + console.error("[settings_get_value_013] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_014', 0, async function (done) { + let name = null; + try { + var uri = settings.getUriSync(name); + console.info("[settings_get_value_014] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_get_value_014] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = featureAbility.acquireDataAbilityHelper(uri); + try { + let value = settings.getValueSync(helper, name, "test getValueSync"); + console.info("[settings_get_value_014] value is: " + value); + } catch (err) { + console.error("[settings_get_value_014] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_0015', 0, async function (done) { + let name = 1332; + try { + var uri = settings.getUriSync(name); + console.info("[settings_get_value_0015] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_get_value_0015] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = featureAbility.acquireDataAbilityHelper(uri); + let obj = 22223; + try { + let value = settings.getValueSync(helper, name, obj); + console.info("[settings_get_value_0015] value is: " + value); + } catch (err) { + console.error("[settings_get_value_0015] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_0016', 0, async function (done) { + let name = 1332; + try { + var uri = settings.getUriSync(name); + console.info("[settings_get_value_0016] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_get_value_0016] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = "helper"; + try { + let value = settings.getValueSync(helper, name, "test getValueSync"); + console.info("[settings_get_value_0016] value is: " + value); + } catch (err) { + console.error("[settings_get_value_0016] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_0017', 0, async function (done) { + let name = 1332; + try { + var uri = settings.getUriSync(name); + console.info("[settings_get_value_0017] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_get_value_0017] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = "helper"; + let obj = 221323; + try { + let value = settings.getValueSync(helper, name, obj); + console.info("[settings_get_value_0017] value is: " + value); + } catch (err) { + console.error("[settings_get_value_0017] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_018', 0, async function (done) { + let name = 'settings.screen.brightness10'; + var uri = settings.getUriSync(name); + var helper = featureAbility.acquireDataAbilityHelper(uri); + let value = settings.setValueSync(helper, name, "test getValueSync"); + expect(value).assertEqual(true); + done(); + }); + + it('settings_set_value_019', 0, async function (done) { + let name = 'settings.screen.brightness11'; + var uri = settings.getUriSync(name); + var helper = featureAbility.acquireDataAbilityHelper(uri); + let obj = 32344.00; + try { + let value = settings.setValueSync(helper, name, obj); + console.info("[settings_set_value_019] value is: " + value); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_019] error = " + err); + expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument[2] type. String expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_020', 0, async function (done) { + let name = 'settings.screen.brightness12'; + var uri = settings.getUriSync(name); + var helper = featureAbility.acquireDataAbilityHelper(uri); + let obj = null; + try { + let value = settings.setValueSync(helper, name, obj); + console.info("[settings_set_value_020] value is: " + value); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_020] error = " + err); + expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument[2] type. String expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_021', 0, async function (done) { + let name = 'settings.screen.brightness13'; + var helper = "helper"; + try { + let value = settings.setValueSync(helper, name, "test getValueSync"); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_021] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_022', 0, async function (done) { + let name = 'settings.screen.brightness13'; + var helper = null; + try { + let value = settings.setValueSync(helper, name, "test getValueSync"); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_022] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_023', 0, async function (done) { + let name = 'settings.screen.brightness14'; + var helper = "helper"; + let obj = 343434.00; + try { + let value = settings.setValueSync(helper, name, obj); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_023] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_024', 0, async function (done) { + let name = 'settings.screen.brightness14'; + var helper = "helper"; + let obj = null; + try { + let value = settings.setValueSync(helper, name, obj); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_024] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_025', 0, async function (done) { + let name = 'settings.screen.brightness14'; + var helper = null; + let obj = 2323.00; + try { + let value = settings.setValueSync(helper, name, obj); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_025] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_026', 0, async function (done) { + let name = 1332; + try { + var uri = settings.getUriSync(name); + console.info("[settings_set_value_026] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_set_value_026] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = featureAbility.acquireDataAbilityHelper(uri); + try { + let value = settings.setValueSync(helper, name, "test getValueSync"); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_026] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_027', 0, async function (done) { + let name = null; + try { + var uri = settings.getUriSync(name); + console.info("[settings_set_value_027] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_set_value_027] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = featureAbility.acquireDataAbilityHelper(uri); + try { + let value = settings.setValueSync(helper, name, "test getValueSync"); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_027] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_028', 0, async function (done) { + let name = 2323; + try { + var uri = settings.getUriSync(name); + console.info("[settings_set_value_028] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_set_value_028] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = featureAbility.acquireDataAbilityHelper(uri); + let obj = 232.00; + try { + let value = settings.setValueSync(helper, name, obj); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_028] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_029', 0, async function (done) { + let name = 2323; + try { + var uri = settings.getUriSync(name); + console.info("[settings_set_value_029] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_set_value_029] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = featureAbility.acquireDataAbilityHelper(uri); + let obj = null; + try { + let value = settings.setValueSync(helper, name, obj); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_029] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_030', 0, async function (done) { + let name = 2323; + try { + var uri = settings.getUriSync(name); + console.info("[settings_set_value_030] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_set_value_030] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = "helper"; + try { + let value = settings.setValueSync(helper, name, "text value"); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_030] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_031', 0, async function (done) { + let name = 2323; + try { + var uri = settings.getUriSync(name); + console.info("[settings_set_value_031] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_set_value_031] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = null; + try { + let value = settings.setValueSync(helper, name, "text value"); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_031] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_set_value_032', 0, async function (done) { + let name = 2323; + try { + var uri = settings.getUriSync(name); + console.info("[settings_set_value_032] uri is: " + uri); + } catch (err) { + let errMsg = err; + console.error("[settings_set_value_032] error = " + errMsg); + expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") + .assertTrue(); + } + var helper = "helper"; + let obj = 2323; + try { + let value = settings.setValueSync(helper, name, obj); + expect(value).assertEqual(true); + } catch (err) { + console.error("[settings_set_value_032] error = " + err); + expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") + .assertTrue(); + } + done(); + }); + + it('settings_get_value_033', 0, async function (done){ + let uri = 'dataability:///com.ohos.settingsdata.DataAbility'; + let helper = featureAbility.acquireDataAbilityHelper(uri); + + let name = 'settings.screen.brightness33'; + let value = 'brightness33' + try{ + settings.setValueSync(helper, name, value); + settings.getValue(helper, name, ret =>{ + console.info("[settings_get_value_033] value is: " + ret); + expect(ret).assertEqual(value); + done(); + }) + } catch(err){ + console.info("[settings_get_value_033] error is: " + toString(error)); + expect(true).assertTrue(); + done(); + return; + } + }); + + it('settings_get_value_034', 0, async function (done){ + let uri = 'dataability:///com.ohos.settingsdata.DataAbility'; + let helper = featureAbility.acquireDataAbilityHelper(uri); + + let name = 'settings.screen.brightness34'; + let value = 'brightness34' + + try{ + settings.setValueSync(helper, name, value); + settings.getValue(helper, name).then(ret =>{ + console.info("[settings_get_value_034] value is: " + ret); + expect(ret).assertEqual(value); + done(); + }) + } catch(err){ + console.info("[settings_get_value_034] error is: " + toString(error)); + expect(true).assertTrue(); + done(); + return; + } + }); + + it('settings_get_value_035', 0, async function (done){ + var name = 'settings.screen.brightness35'; + let uriPrefix = 'dataability:///com.ohos.settingsdata.DataAbility' + let expectValue = uriPrefix + '/' + name; + try{ + settings.getURI(name).then(data => { + console.info("[settings_get_uri_035] uri is: " + data); + expect(data).assertEqual(expectValue); + done(); + }) + } catch(err){ + console.info("[settings_get_uri_035] error is: " + toString(error)); + expect(true).assertTrue(); + done(); + return; + } + }); + + it('settings_get_value_036', 0, async function (done){ + var name = 'settings.screen.brightness36'; + let uriPrefix = 'dataability:///com.ohos.settingsdata.DataAbility' + let expectValue = uriPrefix + '/' + name; + try{ + settings.getURI(name, (data) =>{ + console.info("[settings_get_uri_036] uri is: " + data); + expect(data).assertEqual(expectValue); + done(); + }) + }catch(err){ + console.info("[settings_get_uri_036] error is: " + toString(error)); + expect(true).assertTrue(); + done(); + return; + } + }); + + it('settings_get_value_037',0,async function (done) { + var str ="settings.date.date_format" + expect(str).assertEqual(settings.date.DATE_FORMAT); + done(); + }); + + it('settings_get_value_038',0,async function (done) { + var str ="settings.date.time_format" + expect(str).assertEqual(settings.date.TIME_FORMAT); + done(); + }); + + it('settings_get_value_039',0,async function (done) { + var str ="settings.date.auto_gain_time" + expect(str).assertEqual(settings.date.AUTO_GAIN_TIME); + done(); + }); + + it('settings_get_value_040',0,async function (done) { + var str ="settings.date.auto_gain_time_zone" + expect(str).assertEqual(settings.date.AUTO_GAIN_TIME_ZONE); + done(); + }); + + it('settings_get_value_041',0,async function (done) { + var str ="settings.display.font_scale" + expect(str).assertEqual(settings.display.FONT_SCALE); + done(); + }); + + it('settings_get_value_042',0,async function (done) { + var str ="settings.display.screen_brightness_status" + expect(str).assertEqual(settings.display.SCREEN_BRIGHTNESS_STATUS); + done(); + }); + + it('settings_get_value_043',0,async function (done) { + var str ="settings.display.auto_screen_brightness" + expect(str).assertEqual(settings.display.AUTO_SCREEN_BRIGHTNESS); + done(); + }); + + it('settings_get_value_044',0,async function (done) { + var int = 1 + expect(int).assertEqual(settings.display.AUTO_SCREEN_BRIGHTNESS_MODE); + done(); + }); + + it('settings_get_value_045',0,async function (done) { + var int = 0 + expect(int).assertEqual(settings.display.MANUAL_SCREEN_BRIGHTNESS_MODE); + done(); + }); + + it('settings_get_value_046',0,async function (done) { + var str ="settings.display.screen_off_timeout" + expect(str).assertEqual(settings.display.SCREEN_OFF_TIMEOUT); + done(); + }); + + it('settings_get_value_047',0,async function (done) { + var str ="settings.display.default_screen_rotation" + expect(str).assertEqual(settings.display.DEFAULT_SCREEN_ROTATION); + done(); + }); + + it('settings_get_value_048',0,async function (done) { + var str ="settings.display.animator_duration_scale" + expect(str).assertEqual(settings.display.ANIMATOR_DURATION_SCALE); + done(); + }); + + it('settings_get_value_049',0,async function (done) { + var str ="settings.display.transition_animation_scale" + expect(str).assertEqual(settings.display.TRANSITION_ANIMATION_SCALE); + done(); + }); + + it('settings_get_value_050',0,async function (done) { + var str ="settings.display.window_animation_scale" + expect(str).assertEqual(settings.display.WINDOW_ANIMATION_SCALE); + done(); + }); + + it('settings_get_value_051',0,async function (done) { + var str = "settings.display.display_inversion_status" + expect(str).assertEqual(settings.display.DISPLAY_INVERSION_STATUS); + done(); + }); + + it('settings_get_value_052',0,async function (done) { + var str = "settings.general.setup_wizard_finished" + expect(str).assertEqual(settings.general.SETUP_WIZARD_FINISHED); + done(); + }); + + it('settings_get_value_053',0,async function (done) { + var str = "settings.general.end_button_action" + expect(str).assertEqual(settings.general.END_BUTTON_ACTION); + done(); + }); + + it('settings_get_value_054',0,async function (done) { + var str = "settings.general.airplane_mode_status" + expect(str).assertEqual(settings.general.AIRPLANE_MODE_STATUS); + done(); + }); + + it('settings_get_value_055',0,async function (done) { + var str = "settings.general.accelerometer_rotation_status" + expect(str).assertEqual(settings.general.ACCELEROMETER_ROTATION_STATUS); + done(); + }); + + it('settings_get_value_056',0,async function (done) { + var str = "settings.general.device_provision_status" + expect(str).assertEqual(settings.general.DEVICE_PROVISION_STATUS); + done(); + }); + + it('settings_get_value_057',0,async function (done) { + var str = "settings.general.hdc_status" + expect(str).assertEqual(settings.general.HDC_STATUS); + done(); + }); + + + + it('settings_get_value_058',0,async function (done) { + var str = "settings.general.boot_counting" + expect(str).assertEqual(settings.general.BOOT_COUNTING); + done(); + }); + + it('settings_get_value_059',0,async function (done) { + var str = "settings.general.contact_metadata_sync_status" + expect(str).assertEqual(settings.general.CONTACT_METADATA_SYNC_STATUS); + done(); + }); + + it('settings_get_value_060',0,async function (done) { + var str = "settings.general.development_settings_status" + expect(str).assertEqual(settings.general.DEVELOPMENT_SETTINGS_STATUS); + done(); + }); + + it('settings_get_value_061',0,async function (done) { + var str = "settings.general.device_name" + expect(str).assertEqual(settings.general.DEVICE_NAME); + done(); + }); + + it('settings_get_value_062',0,async function (done) { + var str = "settings.general.usb_storage_status" + expect(str).assertEqual(settings.general.USB_STORAGE_STATUS); + done(); + }); + + it('settings_get_value_063',0,async function (done) { + var str = "settings.general.debugger_waiting" + expect(str).assertEqual(settings.general.DEBUGGER_WAITING); + done(); + }); + + it('settings_get_value_064',0,async function (done) { + var str = "settings.general.debug_app_package" + expect(str).assertEqual(settings.general.DEBUG_APP_PACKAGE); + done(); + }); + + it('settings_get_value_065',0,async function (done) { + var str = "settings.general.accessibility_status" + expect(str).assertEqual(settings.general.ACCESSIBILITY_STATUS); + done(); + }); + + it('settings_get_value_066',0,async function (done) { + var str = "settings.general.activated_accessibility_services" + expect(str).assertEqual(settings.general.ACTIVATED_ACCESSIBILITY_SERVICES); + done(); + }); + + it('settings_get_value_067',0,async function (done) { + var str = "settings.general.geolocation_origins_allowed" + expect(str).assertEqual(settings.general.GEOLOCATION_ORIGINS_ALLOWED); + done(); + }); + + it('settings_get_value_068',0,async function (done) { + var str = "settings.general.skip_use_hints" + expect(str).assertEqual(settings.general.SKIP_USE_HINTS); + done(); + }); + + it('settings_get_value_069',0,async function (done) { + var str = "settings.general.touch_exploration_status" + expect(str).assertEqual(settings.general.TOUCH_EXPLORATION_STATUS); + done(); + }); + + it('settings_get_value_070',0,async function (done) { + var str = "settings.input.default_input_method" + expect(str).assertEqual(settings.input.DEFAULT_INPUT_METHOD); + done(); + }); + + it('settings_get_value_071',0,async function (done){ + var str = "settings.input.activated_input_method_submode" + let expectValue:string=settings.input.ACTIVATED_INPUT_METHOD_SUB_MODE; + expect(str).assertEqual(expectValue); + done(); + }); + + + it('settings_get_value_072',0,async function (done){ + var str = "settings.input.activated_input_methods" + expect(str).assertEqual(settings.input.ACTIVATED_INPUT_METHODS); + done(); + }); + + + it('settings_get_value_073',0,async function (done){ + var str = "settings.input.selector_visibility_for_input_method" + expect(str).assertEqual(settings.input.SELECTOR_VISIBILITY_FOR_INPUT_METHOD); + done(); + }); + + + it('settings_get_value_074',0,async function (done){ + var str = "settings.input.auto_caps_text_input" + expect(str).assertEqual(settings.input.AUTO_CAPS_TEXT_INPUT); + done(); + }); + + + it('settings_get_value_075',0,async function (done){ + var str = "settings.input.auto_punctuate_text_input" + expect(str).assertEqual(settings.input.AUTO_PUNCTUATE_TEXT_INPUT); + done(); + }); + + + it('settings_get_value_076',0,async function (done){ + var str = "settings.input.auto_replace_text_input" + expect(str).assertEqual(settings.input.AUTO_REPLACE_TEXT_INPUT); + done(); + }); + + + it('settings_get_value_077',0,async function (done){ + var str = "settings.input.show_password_text_input" + expect(str).assertEqual(settings.input.SHOW_PASSWORD_TEXT_INPUT); + done(); + }); + + + it('settings_get_value_078',0,async function (done){ + var str = "settings.network.data_roaming_status" + expect(str).assertEqual(settings.network.DATA_ROAMING_STATUS); + done(); + }); + + + it('settings_get_value_079',0,async function (done){ + var str = "settings.network.http_proxy_cfg" + expect(str).assertEqual(settings.network.HTTP_PROXY_CFG); + done(); + }); + + + it('settings_get_value_080',0,async function (done){ + var str = "settings.network.network_preference_usage" + expect(str).assertEqual(settings.network.NETWORK_PREFERENCE_USAGE); + done(); + }); + + + it('settings_get_value_081',0,async function (done){ + var str = "settings.phone.rtt_calling_status" + expect(str).assertEqual(settings.phone.RTT_CALLING_STATUS); + done(); + }); + + + it('settings_get_value_082',0,async function (done){ + var str = "settings.sound.vibrate_while_ringing" + expect(str).assertEqual(settings.sound.VIBRATE_WHILE_RINGING); + done(); + }); + + + it('settings_get_value_083',0,async function (done){ + var str = "settings.sound.default_alarm_alert" + expect(str).assertEqual(settings.sound.DEFAULT_ALARM_ALERT); + done(); + }); + + + it('settings_get_value_084',0,async function (done){ + var str = "settings.sound.dtmf_tone_type_while_dialing" + expect(str).assertEqual(settings.sound.DTMF_TONE_TYPE_WHILE_DIALING); + done(); + }); + + + it('settings_get_value_085',0,async function (done){ + var str = "settings.sound.dtmf_tone_while_dialing" + expect(str).assertEqual(settings.sound.DTMF_TONE_WHILE_DIALING); + done(); + }); + + + it('settings_get_value_086',0,async function (done){ + var str = "settings.sound.haptic_feedback_status" + expect(str).assertEqual(settings.sound.HAPTIC_FEEDBACK_STATUS); + done(); + }); + + + it('settings_get_value_087',0,async function (done){ + var str = "settings.sound.affected_mode_ringer_streams" + expect(str).assertEqual(settings.sound.AFFECTED_MODE_RINGER_STREAMS); + done(); + }); + + + it('settings_get_value_088',0,async function (done){ + var str = "settings.sound.affected_mute_streams" + expect(str).assertEqual(settings.sound.AFFECTED_MUTE_STREAMS); + done(); + }); + + + it('settings_get_value_089',0,async function (done){ + var str = "settings.sound.default_notification_sound" + expect(str).assertEqual(settings.sound.DEFAULT_NOTIFICATION_SOUND); + done(); + }); + + + it('settings_get_value_090',0,async function (done){ + var str = "settings.sound.default_ringtone" + expect(str).assertEqual(settings.sound.DEFAULT_RINGTONE); + done(); + }); + + it('settings_get_value_091',0,async function (done) { + var str ="settings.sound.sound_effects_status" + expect(str).assertEqual(settings.sound.SOUND_EFFECTS_STATUS); + done(); + }); + + it('settings_get_value_092',0,async function (done) { + var str ="settings.sound.vibrate_status" + expect(str).assertEqual(settings.sound.VIBRATE_STATUS); + done(); + }); + + it('settings_get_value_093',0,async function (done) { + var str ="settings.tts.default_tts_pitch" + expect(str).assertEqual(settings.tts.DEFAULT_TTS_PITCH); + done(); + }); + + it('settings_get_value_094',0,async function (done) { + var str ="settings.tts.default_tts_rate" + expect(str).assertEqual(settings.tts.DEFAULT_TTS_RATE); + done(); + }); + + it('settings_get_value_095',0,async function (done) { + var str ="settings.tts.default_tts_synth" + expect(str).assertEqual(settings.tts.DEFAULT_TTS_SYNTH); + done(); + }); + + it('settings_get_value_096',0,async function (done) { + var str ="settings.tts.enabled_tts_plugins" + expect(str).assertEqual(settings.tts.ENABLED_TTS_PLUGINS); + done(); + }); + + it('settings_get_value_097',0,async function (done) { + var str ="settings.wireless.bluetooth_radio" + expect(str).assertEqual(settings.wireless.BLUETOOTH_RADIO); + done(); + }); + + it('settings_get_value_098',0,async function (done) { + var str ="settings.wireless.cell_radio" + expect(str).assertEqual(settings.wireless.CELL_RADIO); + done(); + }); + + it('settings_get_value_099',0,async function (done) { + var str ="settings.wireless.nfc_radio" + expect(str).assertEqual(settings.wireless.NFC_RADIO); + done(); + }); + + it('settings_get_value_100',0,async function (done) { + var str ="settings.wireless.airplane_mode_radios" + expect(str).assertEqual(settings.wireless.AIRPLANE_MODE_RADIOS); + done(); + }); + + it('settings_get_value_101',0,async function (done) { + var str ="settings.wireless.bluetooth_status" + expect(str).assertEqual(settings.wireless.BLUETOOTH_STATUS); + done(); + }); + + it('settings_get_value_102',0,async function (done) { + var str ="settings.wireless.bluetooth_discoverability_status" + expect(str).assertEqual(settings.wireless.BLUETOOTH_DISCOVER_ABILITY_STATUS); + done(); + }); + + it('settings_get_value_103',0,async function (done) { + var str ="settings.wireless.bluetooth_discover_timeout" + expect(str).assertEqual(settings.wireless.BLUETOOTH_DISCOVER_TIMEOUT); + done(); + }); + + it('settings_get_value_104',0,async function (done) { + var str ="settings.wireless.wifi_dhcp_max_retry_count" + expect(str).assertEqual(settings.wireless.WIFI_DHCP_MAX_RETRY_COUNT); + done(); + }); + + it('settings_get_value_105',0,async function (done) { + var str ="settings.wireless.wifi_to_mobile_data_awake_timeout" + expect(str).assertEqual(settings.wireless.WIFI_TO_MOBILE_DATA_AWAKE_TIMEOUT); + done(); + }); + + it('settings_get_value_106',0,async function (done) { + var str ="settings.wireless.wifi_status" + expect(str).assertEqual(settings.wireless.WIFI_STATUS); + done(); + }); + + it('settings_get_value_107',0,async function (done) { + var str ="settings.wireless.wifi_watchdog_status" + expect(str).assertEqual(settings.wireless.WIFI_WATCHDOG_STATUS); + done(); + }); + + it('settings_get_value_108',0,async function (done) { + var str ="settings.wireless.wifi_radio" + expect(str).assertEqual(settings.wireless.WIFI_RADIO); + done(); + }); + + it('settings_get_value_109',0,async function (done) { + var str ="settings.wireless.owner_lockdown_wifi_cfg" + expect(str).assertEqual(settings.wireless.OWNER_LOCKDOWN_WIFI_CFG); + done(); + }); + + it('settings_get_value_110',0,async function (done) { + var str ="settings.wireless.owner_lockdown_wifi_cfg" + expect(str).assertEqual(settings.wireless.OWNER_LOCKDOWN_WIFI_CFG); + done(); + }); + + it('settings_get_value_111',0,async function (done) { + let uri = 'dataability:///com.ohos.settingsdata.DataAbility'; + let helper = featureAbility.acquireDataAbilityHelper(uri); + let name = 'settings.screen.brightness111';//关键字 + let value = 'brightness111'//值 + try{ + settings.setValue(helper, name, value,(data)=>{ + console.info("[settings_get_value_111] value is:" + data); + settings.getValue(helper, name).then(ret => { + console.info("[settings_get_value_111] value is:" + ret); + expect(ret).assertEqual(value); + done(); + }) + }); + }catch(err){ + console.info("[settings_get_value_111] error is:" + toString(error)); + expect(true).assertTrue(); + done(); + return; + } + }); + + it('settings_get_value_112',0,async function (done) { + let uri = 'dataability:///com.ohos.settingsdata.DataAbility'; + let helper = featureAbility.acquireDataAbilityHelper(uri); + let name = 'settings.screen.brightness112';//关键字 + let value = 'brightness112'//值 + try{ + settings.setValue(helper, name, value) + .then((data)=>{ + console.info("[settings_get_value_112] value is:" + data); + settings.getValue(helper, name).then(ret => { + console.info("[settings_get_value_112] value is:" + ret); + expect(ret).assertEqual(value); + done(); + }) + }) + .catch((err)=>{ + console.info("[settings_get_value_112] error is:" + toString(error)); + expect(true).assertTrue(); + done(); + return; + }) + }catch(err){ + console.info("[settings_get_value_112] error is:" + toString(error)); + expect(true).assertTrue(); + done(); + return; + } + }); + + it('settings_get_value_113',0,async function(done){ + try{console.info('test settings_get_value_113 start'); + settings.enableAirplaneMode(false,(err,data)=>{console.info('settings test enableAirplaneMode callback ssss'); + console.info('settings test enableAirplaneMode callback err'+JSON.stringify(err.code)); + expect(JSON.stringify(err.code)).assertEqual("801"); + done(); + }) + }catch(err){console.info('settings test enableAirplaneMode try catch err'); + expect(true).assertTrue(); + done(); + return; + } + }); + + it('settings_get_value_114',0,async function(done){ + try{ + settings.enableAirplaneMode(false).then((data)=>{ + console.info('settings test enableAirplaneMode promise data'+JSON.stringify(data)); + expect(false).assertTrue(); + done(); + }).catch((err)=>{ + console.info('settings test enableAirplaneMode promise err'+JSON.stringify(err.code)); + expect(JSON.stringify(err.code)).assertEqual("801"); + done(); + return; + }) + }catch(err){ + console.info('settings test enableAirplaneMode try catch err'+JSON.stringify(err)); + expect(true).assertTrue(); + done(); + return; + } + }); + + it('settings_get_value_115',0,async function (done) { + try{ + settings.canShowFloating((err,data)=>{ + console.info('settings test canShowFloating promise err'+JSON.stringify(err.code)); + expect(JSON.stringify(err.code)).assertEqual("801"); + done(); + }) + }catch(err){ + console.info('settings test canShowFloating promise err'+toString(err)); + expect(true).assertTrue(); + done(); + return; + } + }); + + it('settings_get_value_116',0,async function (done) { + try{ + let str = {"code":801}; + settings.canShowFloating().then((data)=>{ + console.info('settings test canShowFloating promise err'+toString(data)); + expect(toString(err)).assertEqual(str); + done(); + }).catch((err)=>{ + console.info('settings test canShowFloating promise err'+JSON.stringify(err.code)); + expect(JSON.stringify(err.code)).assertEqual("801"); + done(); + return; + }) + }catch(err){ + console.info('settings test canShowFloating promise err'+toString(err)); + expect(true).assertTrue(); + done(); + return; + } + }); + }) +} diff --git a/applications/settingsdata/settings_ets/entry/src/main/resources/base/element/string.json b/applications/settingsdata/settings_ets/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..498677efbde065c36668727190d3613cbf278bfc --- /dev/null +++ b/applications/settingsdata/settings_ets/entry/src/main/resources/base/element/string.json @@ -0,0 +1,20 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/applications/settingsdata/settings_ets/entry/src/main/resources/base/media/icon.png b/applications/settingsdata/settings_ets/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/applications/settingsdata/settings_ets/entry/src/main/resources/base/media/icon.png differ diff --git a/applications/settingsdata/settings_ets/signature/openharmony_sx.p7b b/applications/settingsdata/settings_ets/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..5111110cf2b932e65f2e898499e8a6f1fd81c93a Binary files /dev/null and b/applications/settingsdata/settings_ets/signature/openharmony_sx.p7b differ diff --git a/arkXtest/uitest/src/main/config.json b/arkXtest/uitest/src/main/config.json index 3dcbc4e08dd3cd552cb289e819cdc4475caec0d6..cffd5b6786c2e53d8cf3d10aa925aadbfb1bfbde 100644 --- a/arkXtest/uitest/src/main/config.json +++ b/arkXtest/uitest/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "MainAbility", "deviceType": [ + "default", "phone" ], "distro": { @@ -49,7 +50,7 @@ "formsEnabled": false, "label": "$string:entry_MainAbility", "type": "page", - "launchType": "standard" + "launchType": "singleton" }, { "orientation": "unspecified", @@ -62,7 +63,7 @@ "description": "$string:TestAbility_desc", "label": "$string:TestAbility_label", "type": "page", - "launchType": "standard" + "launchType": "singleton" } ], "js": [ diff --git a/arkXtest/uitest/src/main/ets/test/uitest.test.ets b/arkXtest/uitest/src/main/ets/test/uitest.test.ets index 6520fcc95ab41cb12afd39265aae1639c3cb418a..6e884b202fc4054d02c5a3c0f5f88b904d7e294a 100644 --- a/arkXtest/uitest/src/main/ets/test/uitest.test.ets +++ b/arkXtest/uitest/src/main/ets/test/uitest.test.ets @@ -658,6 +658,7 @@ export default function UiTest() { await driver.delayMs(waitUiReadyMs) let button = await driver.findComponent(BY.text('jump')) await button.click() + await driver.delayMs(waitUiReadyMs) let image1 = await driver.findComponent(BY.type('Image')) let bounds1 = await image1.getBounds() await image1.pinchIn(0.5); @@ -684,6 +685,7 @@ export default function UiTest() { await driver.delayMs(waitUiReadyMs) let button = await driver.findComponent(BY.text('jump')) await button.click() + await driver.delayMs(waitUiReadyMs) let image1 = await driver.findComponent(BY.type('Image')) let bounds1 = await image1.getBounds() let pointer = PointerMatrix.create(2,11) @@ -735,6 +737,8 @@ export default function UiTest() { let window2 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) let mode2 = await window2.getWindowMode() expect(mode2 == WindowMode.FLOATING).assertTrue() + expect(mode2 != WindowMode.SECONDARY).assertTrue() + expect(mode2 != WindowMode.PRIMARY).assertTrue() await stopApplication('com.uitestScene.acts') } catch (err) { @@ -897,17 +901,19 @@ export default function UiTest() { /* * @tc.number: uiTest_4400 - * @tc.name: testWindowFocus + * @tc.name: testWindowAttr * @tc.desc: set the focused status of this UiWindow. */ - it('testWindowFocus', 0, async function () { + it('testWindowAttr', 0, async function () { await startAbility('com.uitestScene.acts', 'com.uitestScene.acts.MainAbility') let driver = UiDriver.create() await driver.delayMs(waitUiReadyMs) - let window = await driver.findWindow({bundleName:'com.uitestScene.acts',focused:true,actived:true}) + let window = await driver.findWindow({bundleName:'com.uitestScene.acts',focused:true,actived:true,title:''}) await window.focus() let isFocused = await window.isFocused() + let isActived = await window.isActived() expect(isFocused == true).assertTrue() + expect(isActived == true).assertTrue() await stopApplication('com.uitestScene.acts') }) @@ -1113,5 +1119,75 @@ export default function UiTest() { expect(idled = true).assertTrue() await stopApplication('com.uitestScene.acts') }) + + /* + * @tc.number: uiTest_5600 + * @tc.name: testDrag + * @tc.desc: drag on the screen between the specified points. + */ + it('testDrag', 0, async function () { + await startAbility('com.uitestScene.acts', 'com.uitestScene.acts.MainAbility') + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.text('jump')) + await button.longClick() + await driver.delayMs(waitUiReadyMs) + let text1 = await driver.findComponent(BY.text('orange')) + let text2 = await driver.findComponent(BY.text('one')) + let point1 = await text1.getBoundsCenter() + let point2 = await text2.getBoundsCenter() + await driver.drag(point1.X, point1.Y, point2.X, point2.Y) + await driver.delayMs(waitUiReadyMs) + let text = await driver.findComponent(BY.text('four')) + expect(text == null).assertTrue() + await stopApplication('com.uitestScene.acts') + }) + + /* + * @tc.number: uiTest_5700 + * @tc.name: testDragTos + * @tc.desc: drag this UiComponent to the bounds rect of target UiComponent. + */ + it('testDragTo', 0, async function () { + await startAbility('com.uitestScene.acts', 'com.uitestScene.acts.MainAbility') + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let button = await driver.findComponent(BY.text('jump')) + await button.longClick() + await driver.delayMs(waitUiReadyMs) + let text1 = await driver.findComponent(BY.text('orange')) + let text2 = await driver.findComponent(BY.text('one')) + await text1.dragTo(text2) + await driver.delayMs(waitUiReadyMs) + let text = await driver.findComponent(BY.text('four')) + expect(text == null).assertTrue() + await stopApplication('com.uitestScene.acts') + }) + + /* + * @tc.number: uiTest_5800 + * @tc.name: testSplit + * @tc.desc: change this UiWindow into split screen mode. + */ + it('testSplit', 0, async function () { + await startAbility('com.uitestScene.acts', 'com.uitestScene.acts.MainAbility') + let driver = UiDriver.create() + await driver.delayMs(waitUiReadyMs) + let window1 = await driver.findWindow({bundleName:'com.uitestScene.acts'}) + try { + await window1.split() + await driver.delayMs(waitUiReadyMs) + let window2 = await driver.findWindow({bundleName:'com.ohos.systemui'}) + expect(window2 == null).assertTrue() + } + catch (err) { + if (err.message == 'this device can not support this action') { + expect(window1 != null).assertTrue() + } else { + expect(false).assertTrue() + } + } + await stopApplication('com.uitestScene.acts') + }) }) } \ No newline at end of file diff --git a/arkXtest/uitestScene/src/main/config.json b/arkXtest/uitestScene/src/main/config.json index eda00378bc047b58ca90d30e6d287620c9f4692c..7df9b84f09a5de3eb3a09bdf3cc63de9182a8e22 100644 --- a/arkXtest/uitestScene/src/main/config.json +++ b/arkXtest/uitestScene/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "MainAbility", "deviceType": [ + "default", "phone" ], "distro": { @@ -49,7 +50,7 @@ "formsEnabled": false, "label": "$string:entry_MainAbility", "type": "page", - "launchType": "standard" + "launchType": "singleton" } ], "js": [ @@ -63,7 +64,8 @@ "pages/second", "pages/third", "pages/fourth", - "pages/screen" + "pages/screen", + "pages/drag" ], "name": ".MainAbility", "window": { diff --git a/arkXtest/uitestScene/src/main/ets/MainAbility/pages/drag.ets b/arkXtest/uitestScene/src/main/ets/MainAbility/pages/drag.ets new file mode 100644 index 0000000000000000000000000000000000000000..4cc5dbbcec59dbab8f5039d30ea2631a14fb1ef7 --- /dev/null +++ b/arkXtest/uitestScene/src/main/ets/MainAbility/pages/drag.ets @@ -0,0 +1,118 @@ +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct DragExample { + @State numbers: string[] = ['one', 'two', 'three', 'four', 'five', 'six'] + @State text: string = '' + @State bool: boolean = false + @State bool1: boolean = false + @State appleVisible: Visibility = Visibility.Visible + @State orangeVisible: Visibility = Visibility.Visible + @State bananaVisible: Visibility = Visibility.Visible + @State select: number = 0 + + @Builder pixelMapBuilder() { + Column() { + Text(this.text) + .width('50%').height(60).fontSize(16).borderRadius(10) + .textAlign(TextAlign.Center).backgroundColor(Color.Yellow) + } + } + + build() { + Column() { + Text('There are three Text elements here') + .fontSize(12).fontColor(0xCCCCCC).width('90%') + .textAlign(TextAlign.Start).margin(5) + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceAround }) { + Text('apple').width('25%').height(35).fontSize(16) + .textAlign(TextAlign.Center).backgroundColor(0xAFEEEE) + .visibility(this.appleVisible) + .onDragStart(() => { + this.bool = true + this.text = 'apple' + this.appleVisible = Visibility.Hidden + return this.pixelMapBuilder + }) + Text('orange').width('25%').height(35).fontSize(16) + .textAlign(TextAlign.Center).backgroundColor(0xAFEEEE) + .visibility(this.orangeVisible) + .onDragStart(() => { + this.bool = true + this.text = 'orange' + this.orangeVisible = Visibility.Hidden + return this.pixelMapBuilder + }) + Text('banana').width('25%').height(35).fontSize(16) + .textAlign(TextAlign.Center).backgroundColor(0xAFEEEE) + .visibility(this.bananaVisible) + .onDragStart((event: DragEvent, extraParams: string) => { + console.log('Text onDragStarts, ' + extraParams) + this.bool = true + this.text = 'banana' + this.bananaVisible = Visibility.Hidden + return this.pixelMapBuilder + }) + }.border({ width: 1 }).width('90%').padding({ top: 10, bottom: 10 }).margin(10) + + Text('This is a List element').fontSize(12) + .fontColor(0xCCCCCC).width('90%') + .textAlign(TextAlign.Start).margin(15) + List({ space: 20, initialIndex: 0 }) { + ForEach(this.numbers, (item) => { + ListItem() { + Text('' + item) + .width('100%').height(80).fontSize(16).borderRadius(10) + .textAlign(TextAlign.Center).backgroundColor(0xAFEEEE) + } + .onDragStart((event: DragEvent, extraParams: string) => { + console.log('ListItem onDragStarts, ' + extraParams) + var jsonString = JSON.parse(extraParams) + this.bool1 = true + this.text = this.numbers[jsonString.selectedIndex] + this.select = jsonString.selectedIndex + return this.pixelMapBuilder + }) + }, item => item) + } + .editMode(true) + .height('50%').width('90%').border({ width: 1 }) + .divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) + .onDragEnter((event: DragEvent, extraParams: string) => { + console.log('List onDragEnter, ' + extraParams) + }) + .onDragMove((event: DragEvent, extraParams: string) => { + console.log('List onDragMove, ' + extraParams) + }) + .onDragLeave((event: DragEvent, extraParams: string) => { + console.log('List onDragLeave, ' + extraParams) + }) + .onDrop((event: DragEvent, extraParams: string) => { + var jsonString = JSON.parse(extraParams) + if (this.bool) { + this.numbers.splice(jsonString.insertIndex, 0, this.text) + this.bool = false + } else if (this.bool1) { + this.numbers.splice(jsonString.selectedIndex, 1) + this.numbers.splice(jsonString.insertIndex, 0, this.text) + this.bool = false + this.bool1 = false + } + }) + }.width('100%').height('100%').padding({ top: 20 }).margin({ top: 20 }) + } +} \ No newline at end of file diff --git a/arkXtest/uitestScene/src/main/ets/MainAbility/pages/index.ets b/arkXtest/uitestScene/src/main/ets/MainAbility/pages/index.ets index 30ad95ebd61572ae6eac5e65a404413c8ae20b1c..b8609d4003cf5d22f8cd8789793f1761c4f8d23a 100644 --- a/arkXtest/uitestScene/src/main/ets/MainAbility/pages/index.ets +++ b/arkXtest/uitestScene/src/main/ets/MainAbility/pages/index.ets @@ -69,6 +69,12 @@ struct ScrollExample { .onClick(() => { router.push({ uri: 'pages/screen' }) }) + .gesture( + LongPressGesture({ repeat: false }) + .onAction((event: GestureEvent) => { + router.push({ uri: 'pages/drag' }) + }) + ) Checkbox({ name: 'hi' }) .size({ width: 30, height: 30 }) TextInput({ placeholder: 'welcome', text: 'Hello World' }) diff --git a/arkui/BUILD.gn b/arkui/BUILD.gn index 9ea27f67ca26aca3c49dfa4ce299214e7183814e..32f916b04e97c443ba6ea74cbc61265143fd71bf 100644 --- a/arkui/BUILD.gn +++ b/arkui/BUILD.gn @@ -15,6 +15,9 @@ group("arkui") { testonly = true deps = [ "ace_ets_component:ActsAceEtsComponentTest", + + # "ace_ets_component_apilack:ActsAceEtsApiLackTest", + # "ace_ets_component_attrlack:ActsAceEtsAttrLackTest", "ace_ets_component_five:ActsAceEtsComponentFiveTest", "ace_ets_component_four:ActsAceEtsComponentFourTest", "ace_ets_component_three:ActsAceEtsComponentThreeTest", @@ -24,7 +27,9 @@ 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", "ace_standard:ActsAceStandardTest", "ace_standard_video:ActsAceStandardVideoTest", diff --git a/arkui/ace_ets_component/entry/src/main/config.json b/arkui/ace_ets_component/entry/src/main/config.json index f363e993fa0899ff8eb6778cd8f55ade9da6c081..bb926decd72612989659f64a6a9546d3d0cb7d08 100644 --- a/arkui/ace_ets_component/entry/src/main/config.json +++ b/arkui/ace_ets_component/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".MyApplication", "mainAbility": "com.open.harmony.acetest.MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/appear.ets b/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/appear.ets index 56a265e1bfbad12a08c680d3cc20d99e7860ebec..73c6e8b1206dcc98099e8e5ddc763c39485d946c 100644 --- a/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/appear.ets +++ b/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/appear.ets @@ -22,7 +22,7 @@ import prompt from '@system.prompt' @Component struct AppearExample { @State isShow: boolean = true - @State appearFlag: boolean = false + @State appearFlag: string = "appearStatusOff" @State disAppearFlag: boolean = false private changeAppear: string = 'Hide Text' private myText: string = 'Text for onAppear' @@ -52,26 +52,41 @@ struct AppearExample { .key('appear') .onClick(() => { this.isShow = !this.isShow + try { + var backData = { + data: { + "ACTION": this.isShow, + } + } + var backEvent = { + eventId: 58, + priority: events_emitter.EventPriority.LOW + } + console.info("appearFlag start to emit action state") + events_emitter.emit(backEvent, backData) + } catch { + console.info("appearFlag emit action state err: " + JSON.stringify(err.message)) + } }).margin(3).backgroundColor(0x2788D9) if (this.isShow) { Text(this.myText) .onAppear(() => { - this.appearFlag = true + this.appearFlag = "appearStatusOn" this.changeAppear = 'Show Text' console.info('appearFlag current action state is: ' + this.appearFlag); prompt.showToast({ message: 'The text is shown', duration: 2000 }) try { - var backData = { + var backData2 = { data: { - "ACTION": this.appearFlag, + "APPEAR": this.appearFlag, } } - var backEvent = { + var backEvent2 = { eventId: 59, priority: events_emitter.EventPriority.LOW } console.info("appearFlag start to emit action state") - events_emitter.emit(backEvent, backData) + events_emitter.emit(backEvent2, backData2) } catch { console.info("appearFlag emit action state err: " + JSON.stringify(err.message)) } @@ -82,17 +97,17 @@ struct AppearExample { console.info('disAppearFlag current action state is: ' + this.disAppearFlag); prompt.showToast({ message: 'The text is hidden', duration: 2000 }) try { - var backData = { + var backData1 = { data: { "ACTION": this.disAppearFlag, } } - var backEvent = { + var backEvent1 = { eventId: 60, priority: events_emitter.EventPriority.LOW } console.info("disAppearFlag start to emit action state") - events_emitter.emit(backEvent, backData) + events_emitter.emit(backEvent1, backData1) } catch { console.info("disAppearFlag emit action state err: " + JSON.stringify(err.message)) } diff --git a/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/areaChange.ets b/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/areaChange.ets index d10d1b0b37eccb934850cea206e8af0e8f0c4f41..1aa54fa0ae8d336a717d7537b12a20380ff19b1f 100644 --- a/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/areaChange.ets +++ b/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/areaChange.ets @@ -54,17 +54,17 @@ struct AreaExample { this.onActionCalled = true; console.info('onAreaChange current action state is: ' + this.onActionCalled); try { - var backData = { + var backData1 = { data: { "ACTION": this.onActionCalled, } } - var backEvent = { + var backEvent1 = { eventId: 62, priority: events_emitter.EventPriority.LOW } console.info("onAreaChange start to emit action state") - events_emitter.emit(backEvent, backData) + events_emitter.emit(backEvent1, backData1) } catch (err) { console.info("onAreaChange emit action state err: " + JSON.stringify(err.message)) } diff --git a/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/global.ets b/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/global.ets index 55b4ab91431cb94fb2c186969a7e8e5b4829b8e4..1b4a677937b94b92f00f9634b914c58390b83da4 100644 --- a/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/global.ets +++ b/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/global.ets @@ -21,6 +21,7 @@ struct GlobalExample { private settings: RenderingContextSettings = new RenderingContextSettings (true) private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(300, 300, this.settings); + private img: ImageBitmap = new ImageBitmap("/images/bg.jpg") onPageShow() { console.info("global page called") @@ -35,50 +36,33 @@ struct GlobalExample { Canvas(this.context) .width('100%').height('40%').backgroundColor('#00ffff') .onReady(() => { - this.context.imageSmoothingEnabled = false + this.offContext.imageSmoothingEnabled = false this.testImageBitmapSize(); this.testOffscreenCanvas(); this.testImageData(); - this.testImage(); }) }.width('100%').height('100%') } testImageBitmapSize() { - let img = new ImageBitmap("/images/bg.jpg"); - let width = img.width; - let height = img.height; - this.context.imageSmoothingEnabled = false; - this.context.drawImage(img, 30, 950, 160, 100); + let width = this.img.width; + let height = this.img.height; + this.offContext.imageSmoothingEnabled = false; + this.offContext.drawImage(this.img, 30, 950, 160, 100); console.log("imagebitmap_width=" + width); console.log("imagebitmap_height=" + height); } testOffscreenCanvas() { - var offCanvas2 = this.offContext.getContext("2d"); - var img = new Image(); - img.src = "/images/bg.jpg"; - offCanvas2.drawImage(img, 0, 0, 100, 100); - - var bitmap = offscreen.transferToImageBitmap(); - this.ctx.transferFromImageBitmap(bitmap); + this.offContext.drawImage(this.img, 0, 0, 100, 100); + var bitmap = this.offContext.transferToImageBitmap(); + this.context.transferFromImageBitmap(bitmap); } testImageData() { - var offCanvas2 = this.offContext.getContext("2d"); - var imageData = offCanvas2.createImageData(100, 100); + var imageData = this.offContext.createImageData(100, 100); var imgData = imageData.data; console.log("imageData_width=" + imageData.width); console.log("imageData_height=" + imageData.height); } - - testImage() { - var img = new Image("/images/bg.jpg", 100, 100) - .onload(() => { - }) - .onerror(() => { - }); - console.log("img_width=" + img.width); - console.log("img_height=" + img.height); - } } \ No newline at end of file diff --git a/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/swiper.ets b/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/swiper.ets index 47a6761c1c5805aeb7619f251de0eaa2e69a19bb..285f05337f9167adf4b5c33597c6bd3883374974 100644 --- a/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/swiper.ets +++ b/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/swiper.ets @@ -210,7 +210,7 @@ struct SwiperExample { this.loop = eventData.data.loop; } if (eventData.data.duration != null) { - this.duration = parseInt(eventData.data.duration); + this.duration = eventData.data.duration; } if (eventData.data.vertical != null) { this.vertical = eventData.data.vertical; diff --git a/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/touchAble.ets b/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/touchAble.ets index b9c1e90260c42b10fe2f101c6b25ef0d19167830..7efd3aeeb82f4195c41a6197c865913a8605a9bf 100644 --- a/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/touchAble.ets +++ b/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/touchAble.ets @@ -22,25 +22,6 @@ import events_emitter from '@ohos.events.emitter'; struct TouchAbleExample { @State text1: string = ''; @State text2: string = ''; - @State touchableValue: boolean = false; - private stateChangCallBack = (eventData) => { - console.info("[TouchAble] page stateChangCallBack"); - if (eventData != null) { - console.info("[TouchAble] page state change called:" + JSON.stringify(eventData)); - if (eventData.data.touchableValue != null) { - this.touchableValue = eventData.data.touchableValue; - } - } - } - - onPageShow() { - console.info('[TouchAble] page show called'); - var stateChangeEvent = { - eventId: 44, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(stateChangeEvent, this.stateChangCallBack); - } build() { Stack() { @@ -52,6 +33,7 @@ struct TouchAbleExample { console.info(this.text1 = 'Rect Clicked') }) .overlay(this.text1, { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) + Ellipse() .fill(Color.Pink) .width(150) diff --git a/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/visibility.ets b/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/visibility.ets index 3f75b0047c18065ed5ef7bf8ed4972ba783d1a87..3af4e73de7ff6705ba618ee732b62a9cc34f7da7 100644 --- a/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/visibility.ets +++ b/arkui/ace_ets_component/entry/src/main/ets/MainAbility/pages/visibility.ets @@ -38,7 +38,7 @@ struct VisibilityExample { eventId: 1116, priority: events_emitter.EventPriority.LOW } - events_emitter.on(stateChangeEvent2, this.stateChangCallBack); + events_emitter.on(stateChangeEvent2, this.hiddenChangCallBack); } private hiddenChangCallBack = (eventData) => { diff --git a/arkui/ace_ets_component/entry/src/main/ets/test/AppearJsunit.test.ets b/arkui/ace_ets_component/entry/src/main/ets/test/AppearJsunit.test.ets index af956d80da41c4cf0f7a63719956c35725ae00f2..f5979dedf63c7bd8287eef81f02e0f1b7caa300d 100644 --- a/arkui/ace_ets_component/entry/src/main/ets/test/AppearJsunit.test.ets +++ b/arkui/ace_ets_component/entry/src/main/ets/test/AppearJsunit.test.ets @@ -51,45 +51,29 @@ export default function appearJsunit() { console.info('[testAppear01] START'); await Utils.sleep(1000); try { - let callBackAppear = (backData) => { - console.info("testAppear01 get appearEvent result is: " + JSON.stringify(appearEvent)); - expect(backData.data.ACTION).assertEqual(true); + let callBackAppear1 = (backData) => { + console.info("testAppear01 get appearEvent result is: " + JSON.stringify(backData)); + expect(backData.data.ACTION).assertEqual(false); + done(); } - var appearEvent = { + var appearEvent1 = { eventId: 58, priority: events_emitter.EventPriority.LOW } - events_emitter.on(appearEvent, callBackAppear); + events_emitter.on(appearEvent1, callBackAppear1); } catch (err) { console.info("testAppear01 on appearEvent err : " + JSON.stringify(err)); } console.info("testAppear01 click result is: " + JSON.stringify(sendEventByKey('appear', 10, ""))); console.info('[testAppear01] END'); - done(); - }); - it('testAppear02', 0, async function (done) { console.info('[testAppear02] START'); - await Utils.sleep(1000); - try { - let callBackAppear = (backData) => { - console.info("testAppear02 get appearEvent result is: " + JSON.stringify(appearEvent)); - expect(backData.data.ACTION).assertEqual(true); - } - var appearEvent = { - eventId: 59, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(appearEvent, callBackAppear); - } catch (err) { - console.info("testAppear02 on appearEvent err : " + JSON.stringify(err)); - } - console.info("testAppear02 appearEvent click result is: " + JSON.stringify(sendEventByKey('appear', 10, ""))); - try { - let callBackDisAppear = (backData) => { - console.info("testAppear02 get disAppearEvent result is: " + JSON.stringify(disAppearEvent)); - expect(backData.data.ACTION).assertEqual(true); + let callBackDisAppear = (backData1) => { + console.info("testAppear02 get disAppearEvent result is: " + JSON.stringify(backData1)); + console.info("testAppear02 get backData1.data.ACTION result is: " + backData1.data.ACTION); + expect(backData1.data.ACTION).assertEqual(true); + done(); } var disAppearEvent = { eventId: 60, @@ -99,10 +83,25 @@ export default function appearJsunit() { } catch (err) { console.info("testAppear02 on disAppearEvent err : " + JSON.stringify(err)); } - console.info("testAppear02 disAppearEvent click result is: " + JSON.stringify(sendEventByKey('appear', 10, ""))); - console.info('[testAppear02] END'); - done(); - }); + await Utils.sleep(1000); + console.info('[testAppear03] START'); + let callBackAppear2 = (backData2) => { + console.info("testAppear03 get appearEvent result is: " + JSON.stringify(backData2)); + console.info("testAppear03 get backData2.data.APPEAR: " + backData2.data.APPEAR); + expect(backData2.data.APPEAR).assertEqual("appearStatusOn"); + done(); + } + var appearEvent2 = { + eventId: 59, + priority: events_emitter.EventPriority.LOW + } + try { + console.info("testAppear03 appearEvent click result is: " + JSON.stringify(sendEventByKey('appear', 10, ""))); + events_emitter.on(appearEvent2, callBackAppear2); + } catch (err) { + console.info("testAppear03 on appearEvent err : " + JSON.stringify(err)); + } + }); }) } diff --git a/arkui/ace_ets_component/entry/src/main/ets/test/AreaChangeJsunit.test.ets b/arkui/ace_ets_component/entry/src/main/ets/test/AreaChangeJsunit.test.ets index 03b855c1e7bf728ab31ed2cfe5a8b32b1cedbcaa..de746a9537cc6725d81bcf91c2c28e80f8d65bb5 100644 --- a/arkui/ace_ets_component/entry/src/main/ets/test/AreaChangeJsunit.test.ets +++ b/arkui/ace_ets_component/entry/src/main/ets/test/AreaChangeJsunit.test.ets @@ -48,9 +48,10 @@ export default function areaChangeJsunit() { it('areaChangeTest_0300', 0, async function (done) { console.info('areaChangeTest_0300 START'); await Utils.sleep(1000); - let callback = (indexEvent) => { - console.info("areaChangeTest_0300 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.value).assertEqual('TextText'); + let callback = (backData) => { + console.info("areaChangeTest_0300 get state result is: " + JSON.stringify(backData)); + expect(backData.data.value).assertEqual('TextText'); + done(); } let indexEvent = { eventId: 61, @@ -61,44 +62,24 @@ export default function areaChangeJsunit() { } catch (err) { console.info("areaChangeTest_0300 on events_emitter err : " + JSON.stringify(err)); } - console.info("areaChangeTest_0300 click result is: " + JSON.stringify(sendEventByKey('text1', 10, ""))); - var innerEventOne = { - eventId: 62, - priority: events_emitter.EventPriority.LOW - } - await Utils.sleep(1500); - var callback1 = (eventData) => { - console.info("areaChangeTest_0300 get event state result is: " + JSON.stringify(eventData)); - expect(eventData.data.ACTION).assertEqual(true); - } - try { - events_emitter.on(innerEventOne, callback1); - } catch (err) { - console.info("areaChangeTest_0300 on events_emitter err : " + JSON.stringify(err)); - } - console.info('areaChangeTest_0300 END'); - done(); - }); - it('areaChangeTest_0400', 0, async function (done) { console.info('areaChangeTest_0400 START'); await Utils.sleep(1000); - let callback = (indexEvent) => { - console.info("areaChangeTest_0400 get state result is: " + JSON.stringify(indexEvent)); - expect(indexEvent.data.value).assertEqual('TextTextText'); + let callback1 = (eventData) => { + console.info("areaChangeTest_0400 get state result is: " + JSON.stringify(eventData)); + expect(eventData.data.ACTION).assertEqual(true); + done(); } - let indexEvent = { + let indexEvent1 = { eventId: 62, priority: events_emitter.EventPriority.LOW } try { - events_emitter.on(indexEvent, callback); + events_emitter.on(indexEvent1, callback1); } catch (err) { console.info("areaChangeTest_0400 on events_emitter err : " + JSON.stringify(err)); } - console.info("areaChangeTest_0400 click result is: " + JSON.stringify(sendEventByKey('text1', 10, ""))); - console.info('areaChangeTest_0400 END'); - done(); + console.info("areaChangeTest_0300 click result is: " + JSON.stringify(sendEventByKey('text1', 10, ""))); }); }) } diff --git a/arkui/ace_ets_component/entry/src/main/ets/test/ImageEffectsJsunit.test.ets b/arkui/ace_ets_component/entry/src/main/ets/test/ImageEffectsJsunit.test.ets index bfc2c388e2c94f43f3ba1dc3806e9288c34b45f0..d143fe13227dd667dcec532ac2092a32e346734f 100644 --- a/arkui/ace_ets_component/entry/src/main/ets/test/ImageEffectsJsunit.test.ets +++ b/arkui/ace_ets_component/entry/src/main/ets/test/ImageEffectsJsunit.test.ets @@ -405,7 +405,7 @@ export default function imageEffectsJsunit() { let strJsonNew = getInspectorByKey('centerRow5'); let objNew = JSON.parse(strJsonNew); console.info("[testImageEffects015] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.brightness).assertEqual(0.0000019999999949504854); + expect(objNew.$attrs.brightness).assertEqual(0); done(); }); @@ -520,7 +520,7 @@ export default function imageEffectsJsunit() { let strJsonNew = getInspectorByKey('centerRow6'); let objNew = JSON.parse(strJsonNew); console.info("[testImageEffects020] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.saturate).assertEqual(0.0000019999999949504854); + expect(objNew.$attrs.saturate).assertEqual(0); done(); }); @@ -634,7 +634,7 @@ export default function imageEffectsJsunit() { let strJsonNew = getInspectorByKey('centerRow7'); let objNew = JSON.parse(strJsonNew); console.info("[testImageEffects025] component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.contrast).assertEqual(0.0000019999999949504854); + expect(objNew.$attrs.contrast).assertEqual(0); done(); }); diff --git a/arkui/ace_ets_component/entry/src/main/ets/test/MarqueeJsunit.test.ets b/arkui/ace_ets_component/entry/src/main/ets/test/MarqueeJsunit.test.ets index 2afff72531b3adbcab8d60eac26d874ace197055..05e5295167fb06666c25834a9c72e57b6ff85f77 100644 --- a/arkui/ace_ets_component/entry/src/main/ets/test/MarqueeJsunit.test.ets +++ b/arkui/ace_ets_component/entry/src/main/ets/test/MarqueeJsunit.test.ets @@ -52,6 +52,7 @@ export default function marqueeJsunit() { let callback = (indexEvent) => { console.info("testMarquee_0100 get state result is: " + JSON.stringify(indexEvent)); expect(indexEvent.data.start).assertEqual(true); + done(); } let indexEvent = { eventId: 130, @@ -67,6 +68,7 @@ export default function marqueeJsunit() { var callback1 = (eventData) => { console.info("testMarquee_0100 get event state result is: " + JSON.stringify(eventData)); expect(eventData.data.fontColor).assertEqual(Color.Blue); + done(); } var innerEventOne = { eventId: 127, @@ -78,7 +80,6 @@ export default function marqueeJsunit() { console.info("testMarquee_0100 on events_emitter err : " + JSON.stringify(err)); } console.info('testMarquee_0100 END'); - done(); }); it('testMarquee_0200', 0, async function (done) { @@ -87,6 +88,7 @@ export default function marqueeJsunit() { let callback = (indexEvent) => { console.info("testMarquee_0200 get state result is: " + JSON.stringify(indexEvent)); expect(indexEvent.data.start).assertEqual(true); + done(); } let indexEvent = { eventId: 130, @@ -102,6 +104,7 @@ export default function marqueeJsunit() { var callback1 = (eventData) => { console.info("testMarquee_0200 get event state result is: " + JSON.stringify(eventData)); expect(eventData.data.fontSize).assertEqual(50); + done(); } var innerEventOne = { eventId: 128, @@ -113,7 +116,6 @@ export default function marqueeJsunit() { console.info("testMarquee_0200 on events_emitter err : " + JSON.stringify(err)); } console.info('testMarquee_0200 END'); - done(); }); it('testMarquee_0300', 0, async function (done) { @@ -122,6 +124,7 @@ export default function marqueeJsunit() { let callback = (indexEvent) => { console.info("testMarquee_0300 get state result is: " + JSON.stringify(indexEvent)); expect(indexEvent.data.start).assertEqual(true); + done(); } let indexEvent = { eventId: 130, @@ -137,6 +140,7 @@ export default function marqueeJsunit() { var callback1 = (eventData) => { console.info("testMarquee_0300 get event state result is: " + JSON.stringify(eventData)); expect(eventData.data.ACTION).assertEqual(true); + done(); } var innerEventOne = { eventId: 129, @@ -148,7 +152,6 @@ export default function marqueeJsunit() { console.info("testMarquee_0300 on events_emitter err : " + JSON.stringify(err)); } console.info('testMarquee_0300 END'); - done(); }); }) } \ No newline at end of file diff --git a/arkui/ace_ets_component/entry/src/main/ets/test/SwiperJsunit.test.ets b/arkui/ace_ets_component/entry/src/main/ets/test/SwiperJsunit.test.ets index 6ba651339cad3115a62fa2fb2ca4761803aaca2d..84c213f762a9d675bc6547698225ffd28db33254 100644 --- a/arkui/ace_ets_component/entry/src/main/ets/test/SwiperJsunit.test.ets +++ b/arkui/ace_ets_component/entry/src/main/ets/test/SwiperJsunit.test.ets @@ -164,6 +164,7 @@ export default function swiperJsunit() { let callback = (indexEvent) => { console.info("swiperTest_0800 get state result is: " + JSON.stringify(indexEvent)); expect(indexEvent.data.ACTION).assertEqual(true); + done(); } let indexEvent = { eventId: 205, @@ -177,7 +178,6 @@ export default function swiperJsunit() { console.info("swiperTest_0800 click result is: " + JSON.stringify(sendEventByKey('button1', 10, ""))); await Utils.sleep(1000); console.info('swiperTest_0800 END'); - done(); }); it('swiperTest_0900', 0, async function (done) { @@ -186,6 +186,7 @@ export default function swiperJsunit() { let callback = (indexEvent) => { console.info("swiperTest_0900 get state result is: " + JSON.stringify(indexEvent)); expect(indexEvent.data.ACTION).assertEqual(true); + done(); } let indexEvent = { eventId: 206, @@ -199,7 +200,6 @@ export default function swiperJsunit() { console.info("swiperTest_0900 click result is: " + JSON.stringify(sendEventByKey('button2', 10, ""))); await Utils.sleep(1000); console.info('swiperTest_0900 END'); - done(); }); it('swiperTest_1000', 0, async function (done) { @@ -208,6 +208,7 @@ export default function swiperJsunit() { let callbackOne = (indexEventOne) => { console.info("swiperTest_1000 get state result is: " + JSON.stringify(indexEventOne)); expect(indexEventOne.data.ACTION).assertEqual(true); + done(); } let indexEventOne = { eventId: 206, @@ -223,6 +224,7 @@ export default function swiperJsunit() { let callback = (indexEvent) => { console.info("swiperTest_1000 get state result is: " + JSON.stringify(indexEvent)); expect(indexEvent.data.ACTION).assertEqual(true); + done(); } let indexEvent = { eventId: 204, @@ -234,7 +236,6 @@ export default function swiperJsunit() { console.info("swiperTest_1000 on events_emitter err : " + JSON.stringify(err)); } console.info('swiperTest_1000 END'); - done(); }); it('swiperTest_1100', 0, async function (done) { @@ -450,7 +451,7 @@ export default function swiperJsunit() { try { let eventData = { data: { - "duration": "nan" + "duration": "0" } } let indexEvent = { @@ -466,7 +467,7 @@ export default function swiperJsunit() { let strJsonNew = getInspectorByKey('swiper'); let objNew = JSON.parse(strJsonNew); console.info("swiperTest_1900 component objNew is: " + JSON.stringify(objNew)); - expect(objNew.$attrs.duration).assertEqual('nan'); + expect(objNew.$attrs.duration).assertEqual('0.000000'); console.info('swiperTest_1900 END'); done(); }); diff --git a/arkui/ace_ets_component/entry/src/main/ets/test/TouchAbleJsunit.test.ets b/arkui/ace_ets_component/entry/src/main/ets/test/TouchAbleJsunit.test.ets index 6e0e2cbe0b29f901c0ab529f0f38570e1f6f2072..6ca13464c02c0faaa04c9ffff87196eba3e42eb6 100644 --- a/arkui/ace_ets_component/entry/src/main/ets/test/TouchAbleJsunit.test.ets +++ b/arkui/ace_ets_component/entry/src/main/ets/test/TouchAbleJsunit.test.ets @@ -60,6 +60,8 @@ export default function touchAbleJsunit() { var callbackTwo = (eventData) => { console.info("[testTouchAble002] get event state result is: " + JSON.stringify(eventData)); expect(eventData.data.ACTION).assertEqual('Ellipse Clicked') + console.info('[testTouchAble002] END'); + done(); } var innerEventTwo = { eventId: 237, @@ -70,10 +72,7 @@ export default function touchAbleJsunit() { } catch (err) { console.info("[testTouchAble002] on events_emitter err : " + JSON.stringify(err)); } - console.info('[testClickEvent001] sendEventByKey ' + JSON.stringify(sendEventByKey('ellipse', 10, ""))); - await Utils.sleep(1000) - console.info('[testTouchAble002] END'); - done(); + console.info("testClickEvent002 click result is: " + JSON.stringify(sendEventByKey('ellipse', 10, ""))); }); }) } \ No newline at end of file diff --git a/arkui/ace_ets_component/entry/src/main/ets/test/TouchJsunit.test.ets b/arkui/ace_ets_component/entry/src/main/ets/test/TouchJsunit.test.ets index 8819f9e3b394a2de014fb9d43166b26a04441cbf..8b1bc86b9f746ce7582fd97afebed74b4547ced5 100644 --- a/arkui/ace_ets_component/entry/src/main/ets/test/TouchJsunit.test.ets +++ b/arkui/ace_ets_component/entry/src/main/ets/test/TouchJsunit.test.ets @@ -55,6 +55,7 @@ export default function touchJsunit() { console.info("testTouch01 get backEvent result is: " + JSON.stringify(backEvent)); console.info("testTouch01 get flag result is: " + JSON.stringify(backData.data.ACTION)); expect(backData.data.ACTION).assertEqual(true); + done(); } var backEvent = { eventId: 43, @@ -66,7 +67,6 @@ export default function touchJsunit() { } console.info("testTouch01 click result is: " + JSON.stringify(sendEventByKey('touch', 10, ""))); console.info('[testTouch01] END'); - done(); }); }) } diff --git a/arkui/ace_ets_component/entry/src/main/ets/test/VisibilityJsunit.test.ets b/arkui/ace_ets_component/entry/src/main/ets/test/VisibilityJsunit.test.ets index 8ee65d56a153792b68bc5e89346ad1f5b5f59da2..87a981ad4908357170d5293e797ed807f1b570ea 100644 --- a/arkui/ace_ets_component/entry/src/main/ets/test/VisibilityJsunit.test.ets +++ b/arkui/ace_ets_component/entry/src/main/ets/test/VisibilityJsunit.test.ets @@ -130,7 +130,7 @@ export default function visibilityJsunit() { let strJson = getInspectorByKey('box'); let obj = JSON.parse(strJson); console.info("[testVisibility04] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.visibility).assertEqual('Visibility.None'); + expect(obj.$attrs.visibility).assertEqual('Visibility.Visible'); console.info('[testVisibility04] END'); done(); }); @@ -156,7 +156,7 @@ export default function visibilityJsunit() { let strJson = getInspectorByKey('box'); let obj = JSON.parse(strJson); console.info("[testVisibility05] obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.visibility).assertEqual('Visibility.None'); + expect(obj.$attrs.visibility).assertEqual('Visibility.Visible'); console.info('[testVisibility05] END'); done(); }); diff --git a/arkui/ace_ets_component_apilack/BUILD.gn b/arkui/ace_ets_component_apilack/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..b10a77056f2aa80a93d65f71b3536a37cf110e31 --- /dev/null +++ b/arkui/ace_ets_component_apilack/BUILD.gn @@ -0,0 +1,38 @@ +# 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("ActsAceEtsApiLackTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":ace_ets_assets", + ":ace_ets_resources", + ":ace_ets_test_assets", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAceEtsApiLackTest" + subsystem_name = "arkui" + part_name = "ace_engine" +} +ohos_js_assets("ace_ets_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_js_assets("ace_ets_test_assets") { + source_dir = "./entry/src/main/ets/TestAbility" +} +ohos_resources("ace_ets_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/arkui/ace_ets_component_apilack/Test.json b/arkui/ace_ets_component_apilack/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..0ef09c69cd641ca5e16e67a8c79796bb903203c6 --- /dev/null +++ b/arkui/ace_ets_component_apilack/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for aceEtsApiLack Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.open.harmony.aceEtsApiLack", + "package-name": "com.open.harmony.aceEtsApiLack", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAceEtsApiLackTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/config.json b/arkui/ace_ets_component_apilack/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..f960a814e09795ba0312d613045a2d6564634906 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/config.json @@ -0,0 +1,155 @@ +{ + "app": { + "bundleName": "com.open.harmony.aceEtsApiLack", + "vendor": "open", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.open.harmony.aceEtsApiLack", + "name": ".MyApplication", + "mainAbility": "com.open.harmony.aceEtsApiLack.MainAbility", + "deviceType": [ + "default", + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "orientation": "unspecified", + "visible": true, + "srcPath": "TestAbility", + "name": ".TestAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "formsEnabled": false, + "label": "$string:TestAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index", + "pages/abilityComponent", + "pages/alphabetIndexer", + "pages/checkBoxGroup", + "pages/circle", + "pages/common", + "pages/common_ts_ets_api", + "pages/curves", + "pages/dom", + "pages/ellipse", + "pages/featureAbility", + "pages/focusControl", + "pages/form_component", + "pages/gauge", + "pages/global", + "pages/grid", + "pages/grid_col", + "pages/grid_row", + "pages/gridItem", + "pages/image", + "pages/inspector", + "pages/lazyForEach", + "pages/line", + "pages/list", + "pages/list_item", + "pages/mediaQuery", + "pages/navigator", + "pages/onVisibleAreaChange", + "pages/page1", + "pages/pageRoute", + "pages/page_transition", + "pages/panel", + "pages/path", + "pages/pluginComponent", + "pages/polygon", + "pages/polyLine", + "pages/progress", + "pages/prompt", + "pages/rect", + "pages/router", + "pages/scroll", + "pages/search", + "pages/select", + "pages/shape", + "pages/sideBar", + "pages/stack", + "pages/stateManagement", + "pages/swiper", + "pages/tabs", + "pages/text", + "pages/textArea", + "pages/textInput", + "pages/textPicker", + "pages/uiAppearance", + "pages/video", + "pages/web", + "pages/xcomponent" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/app.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..07722b56d3d02df5fb59b51789007b844b43e63c --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,33 @@ +/** + * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/common/Log.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/common/Log.ets new file mode 100644 index 0000000000000000000000000000000000000000..f4526b3304e19ee408543fbfca9f4d6a626f5008 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/common/Log.ets @@ -0,0 +1,52 @@ +/** + * 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. + */ + +const TAG = 'ets_apiLack_add'; + +/** + * Basic log class + */ +export default class Log { + + /** + * print info level log + * + * @param {string} tag - Page or class tag + * @param {string} log - Log needs to be printed + */ + static showInfo(tag, log) { + console.info(`${TAG} tag: ${tag} --> ${log}`); + } + + /** + * print debug level log + * + * @param {string} tag - Page or class tag + * @param {string} log - Log needs to be printed + */ + static showDebug(tag, log) { + console.debug(`${TAG} tag: ${tag} --> ${log}`); + } + + /** + * print error level log + * + * @param {string} tag - Page or class tag + * @param {string} log - Log needs to be printed + */ + static showError(tag, log) { + console.error(`${TAG} tag: ${tag} --> ${log}`); + } +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/common/plugin_component.js b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/common/plugin_component.js new file mode 100644 index 0000000000000000000000000000000000000000..6a3b4ed6c92a847bc0c1a8421cefc8a5b8b52d1c --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/common/plugin_component.js @@ -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 pluginComponentManager from '@ohos.pluginComponent' + +function onPushListener(source, template, data, extraData) { + console.log("onPushListener template.source=" + template.source) + var jsonObject = JSON.parse(data.componentTemplate.source) + console.log("request_callback1:source json object" + jsonObject) + var jsonArry = jsonObject.ExternalComponent + for (var i in jsonArry) { + console.log(jsonArry[i]) + } + console.log("onPushListener:source json object" + jsonObject) + console.log("onPushListener:source json string" + JSON.stringify(jsonObject)) + console.log("onPushListener template.ability=" + template.ability) + console.log("onPushListener data=" + JSON.stringify(data)) + console.log("onPushListener extraData=" + JSON.stringify(extraData)) +} + +function onRequestListener(source, name, data) +{ + console.log("onRequestListener name=" + name); + console.log("onRequestListener data=" + JSON.stringify(data)); + return {template:"plugintemplate", data:data}; +} + +export default { + //register listener + onListener() { + pluginComponentManager.on("push", onPushListener) + pluginComponentManager.on("request", onRequestListener) + }, + Push() { + // 组件提供方主动发送事件 + pluginComponentManager.push( + { + want: { + bundleName: "com.example.myapplication", + abilityName: "com.example.myapplication.MainAbility", + }, + name: "plugintemplate", + data: { + "key_1": "plugin component test", + "key_2": 34234 + }, + extraData: { + "extra_str": "this is push event" + }, + jsonPath: "", + }, + (err, data) => { + console.log("push_callback: push ok!"); + } + ) + }, + Request() { + // 组件使用方主动发送事件 + pluginComponentManager.request({ + want: { + bundleName: "com.example.myapplication", + abilityName: "com.example.myapplication.MainAbility", + }, + name: "plugintemplate", + data: { + "key_1": "plugin component test", + "key_2": 34234 + }, + jsonPath: "", + }, + (err, data) => { + console.log("request_callback: componentTemplate.ability=" + data.componentTemplate.ability) + console.log("request_callback: componentTemplate.source=" + data.componentTemplate.source) + var jsonObject = JSON.parse(data.componentTemplate.source) + console.log("request_callback:source json object" + jsonObject) + var jsonArry = jsonObject.ExternalComponent + for (var i in jsonArry) { + console.log(jsonArry[i]) + } + console.log("request_callback:source json string" + JSON.stringify(jsonObject)) + console.log("request_callback: data=" + JSON.stringify(data.data)) + console.log("request_callback: extraData=" + JSON.stringify(data.extraData)) + } + ) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/PluginProviderExample.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/PluginProviderExample.ets new file mode 100644 index 0000000000000000000000000000000000000000..6a97a6fb48d2fd1961f1b88bee8ebc0e5f2bde06 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/PluginProviderExample.ets @@ -0,0 +1,51 @@ +/** + * 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 plugin from "plugin_component.js" + +@Entry +@Component +struct PluginProviderExample { + @State message: string = 'no click!' + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Register Push Listener') + .fontSize(30) + .width(400) + .height(100) + .margin({top:20}) + .onClick(()=>{ + plugin.onListener() + console.log("Button('Register Push Listener')") + }) + Button('Push') + .fontSize(30) + .width(400) + .height(100) + .margin({top:20}) + .onClick(()=>{ + plugin.Push() + this.message = "Button('Push')" + console.log("Button('Push')") + }) + Text(this.message) + .height(150) + .fontSize(30) + .padding(5) + .margin(5) + }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 }) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/abilityComponent.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/abilityComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..cb697d6f4c9f62ede9bb05b09b9aa66051d37163 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/abilityComponent.ets @@ -0,0 +1,50 @@ +/** + * 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 prompt from '@ohos.prompt' +import events_emitter from '@ohos.events.emitter'; +const TAG = 'ets_apiLack_add'; + + +@Entry +@Component +struct MyComponent { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear AbilityComponent start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear AbilityComponent end`) + } + + build() { + Column() { + AbilityComponent({ + want: { + bundleName: '', + abilityName: '' + }, + }) + .onConnect(() => { + console.log('AbilityComponent connect'); + }) + .onDisconnect(() => { + console.log('AbilityComponent disconnect'); + }) + } + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/alphabetIndexer.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/alphabetIndexer.ets new file mode 100644 index 0000000000000000000000000000000000000000..8eeeba40826894f296e43153c7934eb58fd4af7d --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/alphabetIndexer.ets @@ -0,0 +1,113 @@ +/** + * 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 prompt from '@ohos.prompt' +import events_emitter from '@ohos.events.emitter'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct AlphabetIndexerOnSelect { + private value: string[] = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N'] + private content: string = "AlphabetIndexer Page" + @State onSelectStatus: boolean = false; + @State onRequestPopupDataStatus: boolean = false; + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear AlphabetIndexerOnSelect start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear AlphabetIndexerOnSelect end`) + } + + showToast(message) { + prompt.showToast({ + message: message, + duration: 2000 + }); + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + Text(`${this.content}`) + .fontSize(20) + .align(Alignment.Center) + .fontWeight(FontWeight.Bold) + AlphabetIndexer({ arrayValue: this.value, selected: 0 }) + .color('#FFFF0000') + .selectedColor(0xffffff) + .key('alphabetIndexer') + .popupColor('#FF48D1CC') + .selectedBackgroundColor('#FF0000E6') + .popupBackground('#FF00DDDD') + .usingPopup(true) + .selectedFont({ size: 16, weight: FontWeight.Regular }) + .popupFont({ size: 30, weight: FontWeight.Bolder, style: FontStyle.Normal }) + .itemSize(28) + .width(100) + .height(300) + .alignStyle(IndexerAlign.Left) + .onSelect((index: number) => { + console.info(this.value[index] + 'on onSelect') + this.showToast("onSelect() " + index) + this.onSelectStatus = true; + try { + var backData = { + data: { + "STATUS": this.onSelectStatus + } + } + let backEvent = { + eventId: 60201, + 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.message)) + } + }) + .onPopupSelect((index: number) => { + console.info(this.value[index] + 'on onPopupSelect') + this.showToast("onPopupSelect() " + index) + }) + .onRequestPopupData((index: number) => { + console.info(this.value[index] + 'on onRequestPopupData') + this.showToast("onRequestPopupData() " + index) + this.onRequestPopupDataStatus = true + try { + var backData = { + data: { + "STATUS": this.onRequestPopupDataStatus + } + } + let backEvent = { + eventId: 60202, + priority: events_emitter.EventPriority.LOW + } + console.info("onRequestPopupData start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("onRequestPopupData emit action state err: " + JSON.stringify(err.message)) + } + return ['1', '2', '3', '4', '5'] + + }) + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/checkBoxGroup.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/checkBoxGroup.ets new file mode 100644 index 0000000000000000000000000000000000000000..daded4fbea872129b4248c0636957ffab425441f --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/checkBoxGroup.ets @@ -0,0 +1,111 @@ +/** + * 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 prompt from '@ohos.prompt' +import events_emitter from '@ohos.events.emitter'; +import Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct CheckBoxGroupSelectAll { + @State isSelect: boolean = true; + + onPageShow() { + console.info('[CheckBoxGroup] page show called'); + var stateChangeEvent = { + eventId: 60203, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(stateChangeEvent, this.stateChangCallBack); + } + + private stateChangCallBack = (eventData) => { + console.info("[CheckBoxGroup] page stateChangCallBack"); + if (eventData != null) { + console.info("[CheckBoxGroup] page state change called:" + JSON.stringify(eventData)); + if (eventData.data.isSelect != null) { + this.isSelect = eventData.data.isSelect; + } + } + } + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear CheckBoxGroupSelectAll start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear CheckBoxGroupSelectAll end`) + } + + showToast(message) { + prompt.showToast({ + message: message, + duration: 2000 + }); + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("checkBoxGroup-SelectAll") + .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("selectAllText") + + Scroll() { + Column() { + CheckboxGroup({group : 'checkboxGroup'}) + .selectedColor(0xed6f21) + .key('CheckboxGroup') + .selectAll(this.isSelect) + .onChange((itemName:CheckboxGroupResult) => { + console.info("TextPicker::dialogResult is" + JSON.stringify(itemName)) + this.showToast(itemName.status.valueOf() == 0 ? "selectAll true" : "selectAll false"); + }) + Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) + .selectedColor(0x39a2db) + .key("CheckboxOne") + .onChange((value: boolean) => { + console.info('Checkbox1 change is' + value) + }) + Checkbox({ name: 'checkbox2', group: 'checkboxGroup' }) + .selectedColor(0x39a2db) + .onChange((value: boolean) => { + console.info('Checkbox2 change is' + value) + }) + Checkbox({ name: 'checkbox3', group: 'checkboxGroup' }) + .selectedColor(0x39a2db) + .onChange((value: boolean) => { + console.info('Checkbox3 change is' + value) + }) + } + } + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/circle.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/circle.ets new file mode 100644 index 0000000000000000000000000000000000000000..78d0d36e54a23383149119e53f33401885ed4387 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/circle.ets @@ -0,0 +1,63 @@ +/** + * 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 CircleNe { + @State w: string = "100px"; + @State h: string = "100px"; + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear CircleNew start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear CircleNew end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("circle-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") + + Circle() + .width(`${this.w}`) + .height(`${this.h}`) + .key('circle') + + Image($rawfile('test.png')) + .mask(new Circle({ width: '150px', height: '150px' }).fill(Color.Gray)) + .width('500px').height('280px') + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/common.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/common.ets new file mode 100644 index 0000000000000000000000000000000000000000..d25aa5d921a18abf47e0512c4f555cef32654cb1 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/common.ets @@ -0,0 +1,320 @@ +/** + * 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 inputEventClient from '@ohos.multimodalInput.inputEventClient'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct CommonBackgroundBlurStyle { + @State value: string = '' + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear CommonBackgroundBlurStyle start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear CommonBackgroundBlurStyle end`) + } + + onPageHide(): void { + Log.showInfo(TAG, `onPageHide CommonBackgroundBlurStyle start`) + } + + onBackPress(): void { + Log.showInfo(TAG, `onBackPress CommonBackgroundBlurStyle start`) + } + + @Styles pressedStyles() { + .backgroundColor('red') + .opacity(1) + } + + buttonTab(){ + let keyEventDown = { + isPressed: true, + keyCode: 2049, + keyDownDuration: 0, + isIntercepted: false + } + let res1 = inputEventClient.injectEvent({KeyEvent: keyEventDown}); + + let keyEventUp = { + isPressed: false, + keyCode: 2049, + keyDownDuration: 0, + isIntercepted: false + } + let res2 = inputEventClient.injectEvent({KeyEvent: keyEventUp}); + } + + buttonOnKey(){ + let keyEventDown = { + isPressed: true, + keyCode: 2054, + keyDownDuration: 0, + isIntercepted: false + } + let res3 = inputEventClient.injectEvent({KeyEvent: keyEventDown}); + + let keyEventUp = { + isPressed: false, + keyCode: 2054, + keyDownDuration: 0, + isIntercepted: false + } + let res4 = inputEventClient.injectEvent({KeyEvent: keyEventUp}); + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("common-BackgroundBlurStyle") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("backgroundBlurStyleText") + .backgroundBlurStyle(BlurStyle.Thick) + + Text("common-BorderImage") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("borderImageText") + .borderImage({ + source: { + angle: 90, + direction: GradientDirection.Left, + colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]] + }, + slice: { top: 10, bottom: 10, left: 10, right: 10 }, + width: { top: "10px", bottom: "10px", left: "10px", right: "10px" }, + repeat: RepeatMode.Stretch, + fill: false + }) + + Text("common-HoverEffectHighlight") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("hoverEffectText") + .hoverEffect(HoverEffect.Highlight) + + Text("common-HoverEffectScale") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("hoverEffectScaleText") + .hoverEffect(HoverEffect.Scale) + + Text("common-OnKeyEvent") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("onKeyEventText") + + Button('common-OnKeyEvent') + .onClick(()=>{ + this.buttonTab() + this.buttonOnKey() + }) + .key("onKeyEventButton") + .onKeyEvent((event: KeyEvent) => { + if (event.keyCode === 2054) { + console.info("onKeyEvent 2054 inject Success "); + } + if (event.type === KeyType.Down) { + Log.showInfo(TAG, `Down`) + } + if (event.type === KeyType.Up) { + Log.showInfo(TAG, `Up`) + } + Log.showInfo(TAG, 'KeyType:' + event.type + ';keyCode:' + event.keyCode + ';keyText:' + event.keyText) + }) + + Text("common-TabIndex") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("tabIndexText") + .tabIndex(1) + + Text("common-ParallelGesture" + '\n' + this.value) + .width(320) + .height(100) + .fontSize(12) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(15) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("parallelGestureText") + .parallelGesture(TapGesture().onAction(() => { + // 并行手势 + this.value = 'gesture onAction' + })) + + Text("common-Sepia") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("sepiaText") + .backgroundColor('#E78282') + .sepia(1) + + Button('Button 1') + .id('target') + + Text("common-AlignRules") + .width(260) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("alignRulesText") + .alignRules({ + top: { anchor: 'target', align: VerticalAlign.Bottom }, + right: { anchor: "target", align: HorizontalAlign.Center } + }) + + Text("common-StateStyles") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("stateStylesText") + .stateStyles({ + pressed: this.pressedStyles + }) + + Text("common-OnVisibleAreaChange") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("onVisibleAreaChangeText") + + Text("common-OnPageHide") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("onPageHideText") + + Text("common-OnBackPress") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("onBackPressText") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/common_ts_ets_api.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/common_ts_ets_api.ets new file mode 100644 index 0000000000000000000000000000000000000000..4ad9aa342f7673d7834fc9f5607595e89f5091e9 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/common_ts_ets_api.ets @@ -0,0 +1,145 @@ +/** + * 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'; + +let varA = AppStorage.Link('varA') + +//Environment.EnvProp("accessibilityEnabled", "default") +PersistentStorage.PersistProp("highScore", 0) +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct Common_ts_ets_apiStaticClear { + @StorageLink('varA') varA: number = 2 + private label: string = 'count' + @StorageLink('highScore') highScore: number = 0 + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear Common_ts_ets_apiStaticClear start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear Common_ts_ets_apiStaticClear end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text(`${this.label}: ${this.varA}`) + .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("labelA") + .onClick(() => { + AppStorage.Set('varA', AppStorage.Get('varA') + 1) + }) + + Text("common_ts_ets_api-StaticClear") + .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("staticClearText") + .onClick(() => { + AppStorage.staticClear() + }) + + Text("common_ts_ets_api-EnvProp") + .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("EnvPropText") + .onClick(() => { + var enable = AppStorage.Get("accessibilityEnabled"); + try { + var backData = { + data: { + "Result": (enable != null) + } + } + let backEvent = { + eventId: 60231, + priority: events_emitter.EventPriority.LOW + } + console.info("PersistProp start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("PersistProp emit action state err: " + JSON.stringify(err.message)) + } + + }) + + Text(`common_ts_ets_api-PersistProp : ${this.highScore}`) + .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("PersistPropText") + .onClick(() => { + this.highScore = this.highScore + 1 + try { + var backData = { + data: { + "Score": "Score" + } + } + let backEvent = { + eventId: 60230, + priority: events_emitter.EventPriority.LOW + } + console.info("PersistProp start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("PersistProp emit action state err: " + JSON.stringify(err.message)) + } + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/curves.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/curves.ets new file mode 100644 index 0000000000000000000000000000000000000000..ff120314467a52aa92b4282f80cc6a2995f4b358 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/curves.ets @@ -0,0 +1,81 @@ +/** + * 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'; +import Curves from '@ohos.curves' +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct CurvesSteps { + @State curveApi:string = "success" + @State curve1:ICurve = Curves.springMotion(0.40, 0.99, 0) + @State curve2:ICurve = Curves.responsiveSpringMotion(0.40, 0.99, 0); + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear CurvesSteps start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear CurvesSteps end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text("curves-Steps") + .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("stepsText") + .onClick(() => { + try{ + let curve = Curves.steps(1, true) + console.info("curve is" + curve) + this.curveApi = "callBackSuccess" + }catch(err){ + console.info("curve onClick err: " + JSON.stringify(err.message)) + this.curveApi = "callBackFail" + } + try { + var backData = { + data: { + "curveApi": this.curveApi, + "curveSpringMotion": this.curve1, + "curveResSpringMotion": this.curve2 + } + } + let backEvent = { + eventId: 60229, + priority: events_emitter.EventPriority.LOW + } + console.info("curveApi onClick start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("curveApi onClick emit action state err: " + JSON.stringify(err.message)) + } + }) + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/dom.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/dom.ets new file mode 100644 index 0000000000000000000000000000000000000000..61eeaa5aa4cbe09a0244014e4154af5862038310 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/dom.ets @@ -0,0 +1,53 @@ +/** + * 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 DomCreateElement { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear DomCreateElement start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear DomCreateElement end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("dom-CreateElement") + .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("createElementText") + .onClick(() => { +// dom.createElement('div') + }) + + }.width("100%").height("100%") + } +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/ellipse.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/ellipse.ets new file mode 100644 index 0000000000000000000000000000000000000000..ab5d5e0aecafb7a0f0fb480d66c0985bdba5521c --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/ellipse.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 EllipseNe { + @State w: string = "300.00px"; + @State h: string = "300.00px"; + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear EllipseNe start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear EllipseNe end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("ellipse-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") + + Image($rawfile('test.png')) + .mask(new Ellipse({ width: '150px', height: '150px' }).fill(Color.Gray)) + .width('500px').height('280px') + + Ellipse().width(`${this.w}`).height(`${this.h}`).key('ellipse') + }.width('100%').height('100%') + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/featureAbility.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/featureAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..750d4e41feb3c6e6010bf9690c14dc58ae07a919 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/featureAbility.ets @@ -0,0 +1,266 @@ +/** + * 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 FeatureAbilityStartAbility { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear FeatureAbilityStartAbility start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear FeatureAbilityStartAbility end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("featureAbility-StartAbility") + .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("startAbilityText") + .onClick(() => { + FeatureAbility.startAbility({ + bundleName: "com.example.testapp", + abilityName: "com.example.testApp.MainAbility" + }) + }) + + Text("featureAbility-StartAbilityForResult") + .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("startAbilityForResultText") + .onClick(() => { + FeatureAbility.startAbilityForResult({ + bundleName: "com.example.testapp", + abilityName: "com.example.testApp.MainAbility" }) + }) + + Text("featureAbility-FinishWithResult") + .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("finishWithResultText") + .onClick(() => { + FeatureAbility.finishWithResult({ code: 200, result: null }) + }) + + Text("featureAbility-GetDeviceList") + .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("getDeviceListText") + .onClick(() => { + FeatureAbility.getDeviceList(1) + }) + + Text("featureAbility-CallAbility") + .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("callAbilityText") + .onClick(() => { + FeatureAbility.callAbility({ + bundleName: "com.example.testapp", + abilityName: "com.example.testApp.MainAbility", + messageCode: 200, + abilityType: 1 + }) + }) + + Text("featureAbility-ContinueAbility") + .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("continueAbilityText") + .onClick(() => { + FeatureAbility.continueAbility() + }) + + Text("featureAbility-SubscribeAbilityEvent") + .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("subscribeAbilityEventText") + .onClick(() => { + FeatureAbility.subscribeAbilityEvent({ + bundleName: "com.example.testapp", + abilityName: "com.example.testApp.MainAbility", + messageCode: 200, + abilityType: 1 + }, () => { + }) + }) + + Text("featureAbility-UnsubscribeAbilityEvent") + .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("unsubscribeAbilityEventText") + .onClick(() => { + FeatureAbility.unsubscribeAbilityEvent({ + bundleName: "com.example.testapp", + abilityName: "com.example.testApp.MainAbility", + messageCode: 200, + abilityType: 1 + }) + }) + + Text("featureAbility-SendMsg") + .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("sendMsgText") + .onClick(() => { + FeatureAbility.sendMsg({ + deviceId: '1001', + bundleName: "com.example.testapp", + abilityName: "com.example.testApp.MainAbility", + message: 'success', + success: () => { + Log.showInfo(TAG, `FeatureAbility.sendMsg success`) + }, + fail: (data, code) => { + Log.showInfo(TAG, `FeatureAbility.sendMsg fail: data: ${data},code: ${code}`) + }, + complete: () => { + Log.showInfo(TAG, `FeatureAbility.sendMsg complete`) + } + }) + }) + + Text("featureAbility-SubscribeMsg") + .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("subscribeMsgText") + .onClick(() => { + FeatureAbility.subscribeMsg({ + success: (data) => { + Log.showInfo(TAG, `FeatureAbility.subscribeMsg success: data: ${JSON.stringify(data)}`) + }, + fail: (data, code) => { + Log.showInfo(TAG, `FeatureAbility.subscribeMsg fail: data: ${data},code: ${code}`) + } + }) + }) + + Text("featureAbility-UnsubscribeMsg") + .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("unsubscribeMsgText") + .onClick(() => { + FeatureAbility.unsubscribeMsg() + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/focusControl.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/focusControl.ets new file mode 100644 index 0000000000000000000000000000000000000000..1fbe15140fe6844b86875686773d66ff66f7dbb8 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/focusControl.ets @@ -0,0 +1,277 @@ +/** + * 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'; + +@Entry +@Component +struct FocusControlExample { + @State inputValue: string = '' + @State touchOnFocusName: string = 'OnTouchGrpBtn' + @State touchOnFocusName1: string = 'OnTouchBtn1' + @State touchOnFocusName2: string = 'OnTouchBtn2' + @State touchOnFocusName3: string = 'OnTouchBtn3' + @State touchOnFocusName4: string = 'OnTouchBtn4' + + build() { + Scroll() { + Row({ space: 20 }) { + Column({ space: 20 }) { + Column({ space: 5 }) { + Button(this.touchOnFocusName) + .width(165) + .height(40) + .key('OnTouchGrpBtn') + .fontColor(Color.White) + .focusable(true) + .onFocus(() => { + try { + this.touchOnFocusName = 'Focus' + this.touchOnFocusName + console.info("onFocus value changed " + this.touchOnFocusName) + var eventData = { + data: { + "value": this.touchOnFocusName, + } + } + var event = { + eventId: 60232, + priority: events_emitter.EventPriority.LOW + } + console.info("OnTouchGrpBtn start to emit action state") + events_emitter.emit(event, eventData) + } catch (err) { + console.info("OnTouchGrpBtn emit action state err: " + JSON.stringify(err.message)) + } + }) + .focusOnTouch(true) //该Button组件点击后可获焦 + Row({ space: 5 }) { + Button(this.touchOnFocusName1) + .width(80) + .height(40) + .key('OnTouchBtn1') + .fontColor(Color.White) + .focusable(true) + .onFocus(() => { + try { + this.touchOnFocusName1 = 'Focus' + this.touchOnFocusName1 + console.info("onFocus value changed " + this.touchOnFocusName1) + var eventData = { + data: { + "value": this.touchOnFocusName1, + } + } + var event = { + eventId: 60233, + priority: events_emitter.EventPriority.LOW + } + console.info("OnTouchBtn1 start to emit action state") + events_emitter.emit(event, eventData) + } catch (err) { + console.info("OnTouchBtn1 emit action state err: " + JSON.stringify(err.message)) + } + }) + .focusOnTouch(true) + Button(this.touchOnFocusName2) + .width(80) + .height(40) + .key('OnTouchBtn2') + .fontColor(Color.White) + .focusable(true) + .onFocus(() => { + try { + this.touchOnFocusName2 = 'Focus' + this.touchOnFocusName2 + console.info("onFocus value changed " + this.touchOnFocusName2) + var eventData = { + data: { + "value": this.touchOnFocusName2, + } + } + var event = { + eventId: 60234, + priority: events_emitter.EventPriority.LOW + } + console.info("OnTouchBtn2 start to emit action state") + events_emitter.emit(event, eventData) + } catch (err) { + console.info("OnTouchBtn2 emit action state err: " + JSON.stringify(err.message)) + } + }) + .focusOnTouch(true) //该Button组件点击后可获焦 + } + Row({ space: 5 }) { + Button(this.touchOnFocusName3) + .width(80) + .height(40) + .key('OnTouchBtn3') + .fontColor(Color.White) + .focusable(true) + .onFocus(() => { + this.touchOnFocusName3 = 'Focus' + this.touchOnFocusName3 + console.info("onFocus value changed " + this.touchOnFocusName3) + }) + .onClick(() => { + try { + var eventData = { + data: { + "value": this.touchOnFocusName3, + } + } + var event = { + eventId: 60235, + priority: events_emitter.EventPriority.LOW + } + console.info("OnTouchBtn3 start to emit action state") + events_emitter.emit(event, eventData) + } catch (err) { + console.info("OnTouchBtn3 emit action state err: " + JSON.stringify(err.message)) + } + }) + + Button(this.touchOnFocusName4) + .width(80) + .height(40) + .key('OnTouchBtn4') + .fontColor(Color.White) + .focusable(true) + .onFocus(() => { + this.touchOnFocusName4 = 'Focus' + this.touchOnFocusName4 + console.info("onFocus value changed " + this.touchOnFocusName4) + }) + .onClick(() => { + try { + console.info("onClick event " + this.touchOnFocusName4) + var eventData = { + data: { + "value": this.touchOnFocusName4, + } + } + var event = { + eventId: 60236, + priority: events_emitter.EventPriority.LOW + } + console.info("OnTouchBtn4 start to emit action state") + events_emitter.emit(event, eventData) + } catch (err) { + console.info("OnTouchBtn4 emit action state err: " + JSON.stringify(err.message)) + } + }) + } + }.borderWidth(2).borderColor(Color.Red).borderStyle(BorderStyle.Dashed) + .tabIndex(1) //该Column组件为按TAB键走焦的第一个获焦的组件 + Column({ space: 5 }) { + Button('Group2') + .width(165) + .height(40) + .fontColor(Color.White) + Row({ space: 5 }) { + Button() + .width(80) + .height(40) + .fontColor(Color.White) + Button() + .width(80) + .height(40) + .fontColor(Color.White) + .groupDefaultFocus(true) //该Button组件上级Column组件获焦时获焦 + } + Row({ space: 5 }) { + Button() + .width(80) + .height(40) + .fontColor(Color.White) + Button() + .width(80) + .height(40) + .fontColor(Color.White) + } + }.borderWidth(2).borderColor(Color.Green).borderStyle(BorderStyle.Dashed) + .tabIndex(2) //该Column组件为按TAB键走焦的第二个获焦的组件 + } + Column({ space: 5 }) { + TextInput({placeholder: 'input', text: this.inputValue}) + .onChange((value: string) => { + this.inputValue = value + }) + .fontColor(Color.Blue) + .focusable(true) + .key('defaultFocusText') + .onFocus(() => { + try { + this.inputValue = 'defaultFocus' + console.info("onFocus value changed " + this.inputValue) + var eventData = { + data: { + "value": this.inputValue, + } + } + var event = { + eventId: 60237, + priority: events_emitter.EventPriority.LOW + } + console.info("defaultFocus test start to emit action start") + events_emitter.emit(event, eventData) + } catch (err) { + console.info("defaultFocus test emit action state err: " + JSON.stringify(err.message)) + } + }) + .defaultFocus(true) //该TextInput组件为页面的初始默认焦点 + Button('Group3') + .width(165) + .height(40) + .fontColor(Color.White) + Row({ space: 5 }) { + Button() + .width(80) + .height(40) + .fontColor(Color.White) + Button() + .width(80) + .height(40) + .fontColor(Color.White) + } + Button() + .width(165) + .height(40) + .fontColor(Color.White) + Row({ space: 5 }) { + Button() + .width(80) + .height(40) + .fontColor(Color.White) + Button() + .width(80) + .height(40) + .fontColor(Color.White) + } + Button() + .width(165) + .height(40) + .fontColor(Color.White) + Row({ space: 5 }) { + Button() + .width(80) + .height(40) + .fontColor(Color.White) + Button() + .width(80) + .height(40) + .fontColor(Color.White) + } + }.borderWidth(2).borderColor(Color.Orange).borderStyle(BorderStyle.Dashed) + .tabIndex(3) //该Column组件为按TAB键走焦的第三个获焦的组件 + }.alignItems(VerticalAlign.Top) + } + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/form_component.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/form_component.ets new file mode 100644 index 0000000000000000000000000000000000000000..6b9b0a166f4f0defab64d79db1b48489650efdd6 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/form_component.ets @@ -0,0 +1,63 @@ +/* + * 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. + */ + +@Entry +@Component +struct Index { + @State formId: number = 0; + @State bundle: string = "com.form.formsystemtestservicea.hmservice"; + @State ability: string = "com.form.formsystemtestservicea.hmservice.MainAbility"; + @State moduleName: string = "entry"; + @State name: string = "Form_Js001"; + @State allowUpate: boolean = true; + @State isShowing: boolean = true; + + private dimension: FormDimension = FormDimension.Dimension_1_2; + + private deleteForm = false; + private deleteId = "-1"; + private temporaryId="-1"; + private temporary = false; + private castForm = false; + + build() { + Column() { + Text('form component test begin') + Column() { + FormComponent({ + id: this.formId, + name: this.name, + bundle: this.bundle, + ability: this.ability, + module: this.moduleName, + dimension: this.dimension, + temporary: this.temporary, + }) + .allowUpdate(this.allowUpate) + .visibility(this.isShowing ? Visibility.Visible : Visibility.Hidden) + .onUninstall((info) => { + console.log("[FormComponent] onUninstall:" + JSON.stringify(info)); + }) + .onError((error) => { + console.log("[FormComponent.host] error code:" + error.errcode); + console.log("[FormComponent.host] error msg:" + error.msg); + }) + } + .backgroundColor(Color.White) + Text('form component test end') + } + .backgroundColor(Color.White) + } +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/gauge.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/gauge.ets new file mode 100644 index 0000000000000000000000000000000000000000..244635ab655655e166661fda0b84131f30b3a48b --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/gauge.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 GaugeColors { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear GaugeColors start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear GaugeColors end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("gauge-Colors") + .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("colorsText") + Gauge({ value: 50, min: 0, max: 100 }) + .startAngle(210).endAngle(150) + .colors([[0x317AF7, 1], [0x5BA854, 1], [0xE08C3A, 1], [0x9C554B, 1], [0xD94838, 1]]) + .strokeWidth(20) + .width(200).height(200) + .key("Gauge") + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/gesture.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/gesture.ets new file mode 100644 index 0000000000000000000000000000000000000000..88b5ebdb228f85521b5eb9eb338a5e6fcac246e1 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/gesture.ets @@ -0,0 +1,180 @@ +/** + * 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 GestureSetDirection { + @State offsetX: number = 10 + @State offsetY: number = 10 + @State directionV: PanDirection = PanDirection.Vertical + @State directionH: PanDirection = PanDirection.Horizontal + @State numberDistance: number = 5.0 + @State numberFingers: number = 1 + @State panDirection: PanDirection = PanDirection.Horizontal + panGesture: PanGestureOptions = new PanGestureOptions({direction:this.directionV, distance:10}) + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear GestureSetDirection start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear GestureSetDirection end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("gesture-SetDirection") + .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 }) + .gesture( + PanGesture({options: PanGestureOptions=> { + }}) + .key('setDirectionPanGesture') + .onClick(()=>{ + this.panDirection = PanDirection.Vertical + options.setDirection(this.panDirection) + try { + var backData = { + data: { + "STATUS": this.panDirection + } + } + let backEvent = { + eventId: 60204, + priority: events_emitter.EventPriority.LOW + } + console.info("setDirectionPanGesture onClick start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("setDirectionPanGesture onClick emit action state err: " + JSON.stringify(err.message)) + } + }) + ) + .key("setDirectionText") + + Text("gesture-SetDistance") + .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 }) + .gesture( + PanGesture({options: PanGestureOptions=> { + }}) + .key('setDistancePanGesture') + .onClick(()=>{ + this.numberDistance = 4.0 + options.setDistance(this.numberDistance) + try { + var backData = { + data: { + "STATUS": this.numberDistance + } + } + let backEvent = { + eventId: 60205, + priority: events_emitter.EventPriority.LOW + } + console.info("onClick start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("onClick emit action state err: " + JSON.stringify(err.message)) + } + }) + ) + .key("setDistanceText") + + Text("gesture-SetFingers") + .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 }) + .gesture( + PanGesture({options: PanGestureOptions=> { + }}) + .key('setFingersPanGesture') + .onClick(()=>{ + this.numberFingers = 2 + options.setFingers(this.numberFingers) + try { + var backData = { + data: { + "STATUS": this.numberFingers + } + } + let backEvent = { + eventId: 60206, + priority: events_emitter.EventPriority.LOW + } + console.info("onClick start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("onClick emit action state err: " + JSON.stringify(err.message)) + } + }) + ) + .key("setFingersText") + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { + Text('PanGesture offset:\nX: ' + this.offsetX + '\n' + 'Y: ' + this.offsetY) + } + .key('panDirection').height(100).width(200).padding(20).border({ width: 1 }).margin(80) + .translate({ x: this.offsetX, y: this.offsetY, z: 5 }) + .gesture( + PanGesture(this.panGesture) + .onActionStart((event: GestureEvent) => { + console.info('Pan start') + }) + .onActionUpdate((event: GestureEvent) => { + this.offsetX = event.offsetX + this.offsetY = event.offsetY + }) + .onActionEnd(() => { + console.info('Pan end') + this.panGesture.setDistance(10) + this.panGesture.setDirection(this.directionH) + this.panGesture.setFingers(1) + }) + ) + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/global.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/global.ets new file mode 100644 index 0000000000000000000000000000000000000000..ea6537e9e02501f52bd996fafcf74b06dbf3d007 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/global.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 +struct GlobalLack { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear GlobalLack start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear GlobalLack end`) + } + + build() { + Column() { + Button("Click2").fontSize(50) + .onClick(() => { + console.info("Click2" + JSON.stringify(sendEventByKey("Del", 10, ""))); + }).key("Click2") + List({space:10}) { + ListItem() { + Text("Hello world") { + } + .width('100%') + .height(100) + .fontSize(16) + .textAlign(TextAlign.Center) + .borderRadius(10) + .backgroundColor(0xFFFFFF) + } + .key("ListItem") + .sticky(Sticky.None) + .selectable(false) + .editable(true) + } + } + .padding(10) + .backgroundColor(0xDCDCDC) + .width('100%') + .height('100%') + } +} \ No newline at end of file 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..bbbfd5e4fc06f48510fe28ed101cc2457f314a33 --- /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: 60207, + 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/grid_col.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/grid_col.ets new file mode 100644 index 0000000000000000000000000000000000000000..a0abac00e2aa9c30b13196a1308128688cfd319c --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/grid_col.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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct Grid_colSpan { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear Grid_colSpan start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear Grid_colSpan end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("grid_col-Span") + .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("spanText") + + Text("grid_col-Order") + .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("orderText") + + GridCol({span: 10, offset:50, order: 10}){ + } + .width(100) + .height(100) + .backgroundColor(0x308014) + .backgroundColor(0xf1f3f5) + .margin({ top: 10 }) + .key('gridContainer') + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/grid_row.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/grid_row.ets new file mode 100644 index 0000000000000000000000000000000000000000..f472d6cf88bbcb58fa29ca469708d6144b822421 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/grid_row.ets @@ -0,0 +1,64 @@ +/** + * 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 Grid_rowOnBreakpointChange { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear Grid_rowOnBreakpointChange start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear Grid_rowOnBreakpointChange end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("grid_row-OnBreakpointChange") + .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("onBreakpointChangeText") + + GridContainer({ sizeType: SizeType.SM }) { + GridRow({gutter: 10, columns:50, direction: GridRowDirection.Row}){ + } + .key("GridRow") + .width(100) + .height(100) + .backgroundColor(0xFF0000) + .onBreakpointChange((breakpoints: string) => { + console.info("onBreakpointChange=" + breakpoints) + }) + } + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/image.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/image.ets new file mode 100644 index 0000000000000000000000000000000000000000..fc877f9decc374f41c3d385625a05bf0fa497ff8 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/image.ets @@ -0,0 +1,36 @@ +/** + * 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 ImageExample { + build() { + Column() { + Column() { + Column() { + Image($rawfile('test.png')) + .width(240).height(240) + .colorFilter([1,2,3]) + .overlay('colorFilter', { align: Alignment.Bottom, offset: { x: 0, y: -15 } }) + }.border({ color: Color.Black, width: 2 }) + }.width('100%') + }.padding({ top: 20 }) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/index.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..dacc1f3a5f8b033fbc33ba34afe0b354df16a45b --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,37 @@ +/** + * 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'; + +@Entry +@Component +struct MyComponent { + aboutToAppear() { + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('ace ApiLack ets test') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file 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..906244a7dab816c8473d22629ee7d0a3ceb78cb0 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/inspector.ets @@ -0,0 +1,159 @@ + +/** + * 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: 60211, + 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: 60208, + 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(()=> { + try { + let i = JSON.parse(JSON.stringify(getInspectorNodes()))["inspectors"][0]["id"] + let getInspectorNodeByIdObj = JSON.stringify(getInspectorNodeById(parseInt(i))) + console.info("getInspectorNodeByIdObj is " + getInspectorNodeByIdObj) + var backData1 = { + data: { + "result": "success", + } + } + let backEvent1 = { + eventId: 60209, + 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: 60210, + 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..3bd6d00859b6557f44423b5e9c256aaabd7a27b2 --- /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: 60212, + 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: 60213, + 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: 60214, + 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: 60215, + 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/line.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/line.ets new file mode 100644 index 0000000000000000000000000000000000000000..0f29bf5f99cd068d1638564caa7e2c6580656bf4 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/line.ets @@ -0,0 +1,54 @@ +/** + * 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'; +let my_line = new Line() + +@Entry +@Component +export default +struct LineNe { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear LineNe start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear LineNe end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("line-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") + Line({ width: 50, height: 100 }).startPoint([0, 0]).endPoint([50, 100]).key("line1") + Line().width(200).height(200).startPoint([50, 50]).endPoint([150, 400]).key("line2") + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list.ets new file mode 100644 index 0000000000000000000000000000000000000000..f33a87cfdd26751f645982bb905c3939a37ff6da --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list.ets @@ -0,0 +1,163 @@ +/** + * 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 ListLanes { + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + @State listPosition: number = 0 // 0代表滚动到List顶部,1代表中间值,2代表滚动到List底 + private scroller: Scroller = new Scroller() + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear ListLanes start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear ListLanes end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("list-Lanes") + .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("lanesText") + + Text("list-AlignListItem") + .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("alignListItemText") + + Text("list-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") + + Stack({ alignContent: Alignment.TopStart }) { + Scroll(this.scroller) { + List({ space: 20, initialIndex: 0 }) { + ForEach(this.arr, (item) => { + ListItem() { + Text('' + item) + .width('100%') + .height(100) + .fontSize(18) + + } + .border({ width: 2, color: Color.Green }) + }, item => item) + } + .key("list1") + .height(300) + .width("90%") + .editMode(true) + .alignListItem(ListItemAlign.Start) + .border({ width: 3, color: Color.Red }) + .lanes({ minLength: 40, maxLength: 60 }) + .onScrollBegin((dx: number, dy: number) => { + if ((this.listPosition == 0 && dy >= 0) || (this.listPosition == 2 && dy <= 0)) { + this.scroller.scrollBy(0, -dy) + return { dxRemain: dx, dyRemain: 0 } + } + this.listPosition = 1; + return { dxRemain: dx, dyRemain: dy } + + try { + var backData = { + data: { + "result":"success" + } + } + let backEvent = { + eventId: 60216, + priority: events_emitter.EventPriority.LOW + } + console.info("onScrollBegin onClick start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("onScrollBegin onClick emit action state err: " + JSON.stringify(err.message)) + } + }) + } + .scrollable(ScrollDirection.Vertical) + .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') + }) + + Button('scroll 100') + + .onClick(() => { // 点击后下滑100.0距离 + this.scroller.scrollTo({ xOffset: 0, yOffset: this.scroller.currentOffset().yOffset + 100 }) + }) + .margin({ top: 10, left: 20 }) + Button('back top') + .onClick(() => { // 点击后回到顶部 + this.scroller.scrollEdge(Edge.Top) + }) + .margin({ top: 60, left: 20 }) + Button('next page') + .key("onScrollBegin") + .onClick(() => { // 点击后下滑到底部 + this.scroller.scrollPage({ next: true }) + }) + .margin({ top: 110, left: 20 }) + }.width('100%').height('100%').backgroundColor(0xDCDCDC) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list_item.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list_item.ets new file mode 100644 index 0000000000000000000000000000000000000000..e6c3fc94a0039f83736dcda0f072a2612705a67c --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list_item.ets @@ -0,0 +1,69 @@ +/** + * 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 List_itemOnSelect { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear List_itemOnSelect start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear List_itemOnSelect end`) + } + + @Builder itemEnd() { + Row () { + Button("Del").margin("4vp").key("Del") + Button("Set").margin("4vp").key("Set") + }.padding("4vp").justifyContent(FlexAlign.SpaceEvenly) + } + + build() { + Column() { + Button("Click2").fontSize(50) + .onClick(() => { + console.info("Click2" + JSON.stringify(sendEventByKey("Del", 10, ""))); + }).key("Click2") + List({space:10}) { + ListItem() { + Text("Hello world") { + } + .width('100%') + .height(100) + .fontSize(16) + .textAlign(TextAlign.Center) + .borderRadius(10) + .backgroundColor(0xFFFFFF) + } + .key("ListItem") + .sticky(Sticky.None) + .selectable(false) + .editable(true) + .swipeAction({ end:this.itemEnd}) + } + } + .padding(10) + .backgroundColor(0xDCDCDC) + .width('100%') + .height('100%') + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/mediaQuery.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/mediaQuery.ets new file mode 100644 index 0000000000000000000000000000000000000000..f05a02d0f56a0cd2c5ad3910beea58ce19d7324d --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/mediaQuery.ets @@ -0,0 +1,137 @@ +/** + * 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'; +import mediaquery from '@ohos.mediaquery' +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct MediaQueryOff { + @State color: string = '#000' + @State text: string = 'Test' + listener = mediaquery.matchMediaSync('(orientation: landscape)') + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear MediaQueryOff start`) + this.listener.on('change', (mediaQueryResult) => { + if (mediaQueryResult.matches) { + this.color = '#FFD700' + this.text = 'Landscape' + } else { + this.color = '#DB7093' + this.text = 'Portrait' + } + }) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear MediaQueryOff end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + + Text("mediaQuery-Off") + .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("offText") + .onClick(() => { + this.listener.off('change', (mediaQueryResult) => { + console.log(JSON.stringify(mediaQueryResult)) + var result=true + try { + var backData = { + data: { + "STATUS": result + } + } + let backEvent = { + eventId: 60218, + 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.message)) + } + }) + }) + + Text("mediaQuery-MatchMediaSync") + .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("matchMediaSyncText") + .onClick(() => { + console.log('mediaQuery-MatchMediaSync: ' + JSON.stringify(this.listener)) + var result=(this.listener!=null) + try { + var backData = { + data: { + "STATUS": result + } + } + let backEvent = { + eventId: 60219, + 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.message)) + } + + }) + + Text(this.text) + .fontSize(50) + .fontColor(this.color) + // .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("offText") + + }.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/onVisibleAreaChange.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/onVisibleAreaChange.ets new file mode 100644 index 0000000000000000000000000000000000000000..0dfdcd6ccc8ed12a0aaa8518fa4c0b3ccdba1952 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/onVisibleAreaChange.ets @@ -0,0 +1,109 @@ +/** + * 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. + */ + +@Entry +@Component +struct ScrollExample { + scroller: Scroller = new Scroller() + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + @State testTextStr: string = "test" + @State testRowStr: string = "test" + + build() { + Column() { + Column() { + Text(this.testTextStr) + .fontSize(20) + + Text(this.testRowStr) + .fontSize(20) + } + .height(100) + .backgroundColor(Color.Gray) + .opacity(0.3) + + Scroll(this.scroller) { + Column() { + Text("Test Text Visible Change") + .fontSize(20) + .height(200) + .margin({ top: 50, bottom: 20 }) + .backgroundColor(Color.Green) + // 通过设置ratios为[0.0, 1.0],实现当组件完全显示或完全消失在屏幕中时触发回调 + .onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => { + console.info("Test Text isVisible: " + isVisible + ", currentRatio:" + currentRatio) + if (isVisible && currentRatio >= 1.0) { + console.info("Test Text is fully visible. currentRatio:" + currentRatio) + this.testTextStr = "Test Text is fully visible" + } + + if (!isVisible && currentRatio <= 0.0) { + console.info("Test Text is completely invisible.") + this.testTextStr = "Test Text is completely invisible" + } + }) + + Row() { + Text("Test Row Visible Change") + .fontSize(20) + .margin({ bottom: 20 }) + + } + .height(200) + .backgroundColor(Color.Yellow) + .onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => { + console.info("Test Row isVisible:" + isVisible + ", currentRatio:" + currentRatio) + if (isVisible && currentRatio >= 1.0) { + console.info("Test Row is fully visible.") + this.testRowStr = "Test Row is fully visible" + } + + if (!isVisible && currentRatio <= 0.0) { + console.info("Test Row is is completely invisible.") + this.testRowStr = "Test Row is is completely invisible" + } + }) + + 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%') + } + .backgroundColor(0x317aff) + .scrollable(ScrollDirection.Vertical) + .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') + }) + + }.width('100%').height('100%').backgroundColor(0xDCDCDC) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/page1.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/page1.ets new file mode 100644 index 0000000000000000000000000000000000000000..99bf8452dfb3b8f11e759a755ec58628b0590f05 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/page1.ets @@ -0,0 +1,42 @@ +/** + * 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. + */ + +@Entry +@Component +struct AExample { + @State scale2: number = 1 + @State opacity2: number = 1 + + build() { + Column() { + Navigator({ target: 'pages/page_transition' ,type: NavigationType.Push}) { + Image($r('app.media.icon')).width("100%").height("100%") + } + }.height("100%").width("100%").scale({ x: this.scale2 }).opacity(this.opacity2) + } + // 自定义方式1:完全自定义转场过程的效果 + pageTransition() { + PageTransitionEnter({ duration: 1200, curve: Curve.Linear }) + .onEnter((type: RouteType, progress: number) => { + this.scale2 = 1 + this.opacity2 = progress + }) // 进场过程中会逐帧触发onEnter回调,入参为动效的归一化进度(0% -- 100%) + PageTransitionExit({ duration: 1500, curve: Curve.Ease }) + .onExit((type: RouteType, progress: number) => { + this.scale2 = 1 - progress + this.opacity2 = 1 + }) // 退场过程中会逐帧触发onExit回调,入参为动效的归一化进度(0% -- 100%) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/pageRoute.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/pageRoute.ets new file mode 100644 index 0000000000000000000000000000000000000000..50200e32378ead284ad1f941c84e0feb37883da0 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/pageRoute.ets @@ -0,0 +1,94 @@ +/** + * 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'; + +@Entry +@Component +struct PageRouteExample { + @State private angle:number = 1; + @State private imageSize:number = 2; + @State private speed:number = 5; + @State private interval:number = 0; + @State private state:string = ''; + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) + { + Image($rawfile('test.png')) + .width(100).height(100).objectFit(ImageFit.Contain) + .margin({top:50,bottom:150,right:10}) + .rotate({ x: 0, y: 0, z: 2, angle:this.angle}) // 组件以(1,1,1)为旋转轴,中心点顺时针旋转 300度 + .scale({ x: this.imageSize, y: this.imageSize }) + Text('speed '+ this.speed) + .fontSize(20).fontWeight(FontWeight.Bold) + Slider({ + value: this.speed, + min: 1, + max: 50, + step: 1, + style: SliderStyle.OutSet + }) + .blockColor(Color.Orange) + .onChange((value: number) => { + this.speed = value + }) + Button('Next', { type: ButtonType.Capsule, stateEffect: true }) + .backgroundColor(0x317aff) + .width(90) + .key('next') + .onClick(() => { + console.info('to next page') + router.push({ + uri:'pages/index' + }) + }) + } + .width('100%') + .height('100%') + } + speedChange(){ + var that = this + this.interval = setInterval(function(){ + that.angle += that.speed + },15) + } + + onPageHide() { + console.info('current page will be hidden, value changed') + this.state = 'onPageHide' + try { + var eventData = { + data: { + "value": this.state, + } + } + var event = { + eventId: 10, + priority: events_emitter.EventPriority.LOW + } + console.info("page start to emit action state") + events_emitter.emit(event, eventData) + } catch(err) { + console.info("page emit action state err: " + JSON.stringify(err.message)) + } + } + + onPageShow(){ + this.speedChange() + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/page_transition.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/page_transition.ets new file mode 100644 index 0000000000000000000000000000000000000000..052cbf8eaf38ee477e94737ffe37d6afc14540c3 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/page_transition.ets @@ -0,0 +1,43 @@ +/** + * 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. + */ + +@Entry +@Component +struct PageTransitionExample1 { + @State scale1: number = 1 + @State opacity1: number = 1 + + build() { + Column() { + Navigator({ target: 'pages/page1', type: NavigationType.Push }) { + Image($r('app.media.icon')).width("100%").height("100%") + } + }.scale({ x: this.scale1 }).opacity(this.opacity1) + } + + pageTransition() { + PageTransitionEnter({ duration: 1200, curve: Curve.Linear }) + .onEnter((type: RouteType, progress: number) => { + this.scale1 = 1 + this.opacity1 = progress + }) + PageTransitionExit({ duration: 1500, curve: Curve.Ease }) + .onExit((type: RouteType, progress: number) => { + this.scale1 = 1 - progress + this.opacity1 = 1 + }) + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/panel.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/panel.ets new file mode 100644 index 0000000000000000000000000000000000000000..4aeb79f585041843fcd5bae2b53144541a6c8033 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/panel.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 events_emitter from '@ohos.events.emitter'; +import Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct PanelBackgroundMask { + @State mode: PanelMode = PanelMode.Full + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear PanelBackgroundMask start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear PanelBackgroundMask end`) + } + + build() { + Column() { + + Text("panel-OnHeightChange") + .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("onHeightChangeText") + .onClick(() => { + this.mode = PanelMode.Half + }) + + Panel(true) { + Column() { + Text("panel-BackgroundMask").fontSize(30) + } + } + .key("panel") + .mode(this.mode) + .backgroundColor('green') + .type(PanelType.Foldable) + .dragBar(false) + .halfHeight(300) + .onChange((width: number, height: number, mode: PanelMode) => { + Log.showInfo(TAG, `width:${width},height:${height},mode:${mode}`) + }) + .backgroundMask('red') + .onHeightChange((value: number) => { + Log.showInfo(TAG, 'onHeightChange: ' + value) + try { + var backData = { + data: { + "result":"success" + } + } + let backEvent = { + eventId: 10111, + priority: events_emitter.EventPriority.LOW + } + console.info("onHeightChange start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("testpanelOnHeightChange0002 emit action state err: " + JSON.stringify(err.message)) + } + }) + + }.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..2282bc2c1bab80fe8b63e1a4cc87104da1575494 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/path.ets @@ -0,0 +1,63 @@ +/** + * 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("100px").height("100px").commands('M150 0 L300 300 L0 300 Z') + .key("Path") + + Image($rawfile('test.png')) + .mask(new Path({ width: '150px', height: '150px' }).fill(Color.Gray)) + .width('500px').height('280px') + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/pluginComponent.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/pluginComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..e1310d6f783df35ccad68be0204f2764013ac9d6 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/pluginComponent.ets @@ -0,0 +1,66 @@ +/** + * 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 plugin from "../common/plugin_component.js" + +@Entry +@Component +struct PluginUserExample { + @StorageLink("plugincount") plugincount: Object[] = [ + { source: 'plugincomponent1', ability: 'com.example.plugin' }, + { source: 'plugintemplate', ability: 'com.example.myapplication' }, + { source: 'plugintemplate', ability: 'com.example.myapplication' }] + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button('Register Request Listener') + .fontSize(30) + .width(400) + .height(100) + .margin({top:20}) + .onClick(()=>{ + plugin.onListener() + console.log("Button('Register Request Listener')") + }) + Button('Request') + .fontSize(50) + .width(400) + .height(100) + .margin({ top: 20 }) + .onClick(() => { + plugin.Request() + console.log("Button('Request')") + }) + ForEach(this.plugincount, item => { + PluginComponent({ + template: { source: 'plugincomponent1', ability: 'com.example.plugin' }, + data: { 'countDownStartValue': 'new countDownStartValue' } + }).size({ width: 500, height: 100 }) + .onComplete(() => { + console.log("onComplete") + }) + .onError(({errcode, msg}) => { + console.log("onComplete" + errcode + ":" + msg) + }) + }) + } + .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..db719f67eddf09465b666047c84ad8d082f27bd4 --- /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("100px").height("100px").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..f0beb3aba6e3e691c89cf252dbc76a6285ae1268 --- /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: "100px", height: "100px" }).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/prompt.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/prompt.ets new file mode 100644 index 0000000000000000000000000000000000000000..e54b80ab6c2fb1ea661ae0c8fd88aa13fef96ffc --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/prompt.ets @@ -0,0 +1,100 @@ +/** + * 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 prompt from '@ohos.prompt' +import Log from '../common/Log.ets'; +import events_emitter from '@ohos.events.emitter'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct PromptShowDialog { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear PromptShowDialog start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear PromptShowDialog end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("prompt-ShowDialog") + .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("showDialogText") + .onClick(() => { + try { + var backData = { + data: { + "STATUS": true + } + } + let backEvent = { + eventId: 60220, + priority: events_emitter.EventPriority.LOW + } + console.info("showDialog start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("showDialog emit action state err: " + JSON.stringify(err.message)) + } + }) + + Text("prompt-ShowActionMenu") + .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("showActionMenuText") + .onClick(() => { + try { + var backData1 = { + data: { + "STATUS": true + } + } + let backEvent1 = { + eventId: 60221, + priority: events_emitter.EventPriority.LOW + } + console.info("showActionMenu start to emit action state") + events_emitter.emit(backEvent1, backData1) + } catch (err) { + console.info("showActionMenu emit action state err: " + JSON.stringify(err.message)) + } + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/promptApi.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/promptApi.ets new file mode 100644 index 0000000000000000000000000000000000000000..6326cb1218d942d3e012a56ccd1dbdb44b0b6fdb --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/promptApi.ets @@ -0,0 +1,92 @@ +/** + * 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 prompt from '@ohos.prompt' +import Log from '../common/Log.ets'; +import events_emitter from '@ohos.events.emitter'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct PromptShowDialog { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear PromptShowDialog start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear PromptShowDialog end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("prompt-ShowDialog") + .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 }) + .onClick(() => { + prompt.showDialog({ + title: 'Title Info', + message: 'Message Info', + buttons: [ + { text: 'button1', color: 'red' }, + { text: 'button2', color: 'blue' } + ] + }).then(data => { + console.info('showDialog success, click button: ' + data.index) + }).catch(err => { + console.info('showDialog error: ' + err) + }) + }) + + Text("prompt-ShowActionMenu") + .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 }) + .onClick(() => { + prompt.showActionMenu({ + title: 'Title Info', + buttons: [ + { text: 'item1', color: '#666666' }, + { text: 'item2', color: '#000000' } + ] + }).then(data => { + var result=true + console.info('showDialog success, click button: ' + data.index) + }).catch(err => { + console.info('showDialog error: ' + err) + }) + }) + + }.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..714e1765c8591458752ca63c649024a424303788 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/rect.ets @@ -0,0 +1,64 @@ +/** + * 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: "50px" }).radiusHeight(20).radiusWidth(20) + .key("Rect") + + Image($rawfile('test.png')) + .mask(new Rect({ width: '150px', height: '150px' }).fill(Color.Gray)) + .width('500px').height('280px') + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/router.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/router.ets new file mode 100644 index 0000000000000000000000000000000000000000..dbde00df9c1df3c54ed475e240a9a1816d42ef83 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/router.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'; +import router1 from '@ohos.router' +import router2 from '@system.router' +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct RouterEnableAlertBeforeBackPage { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear RouterEnableAlertBeforeBackPage start`) + + router1.enableAlertBeforeBackPage({ + message: 'Message Info' + }) + + router2.enableAlertBeforeBackPage({ + message: 'Message Info', + success: function () { + console.log('success') + }, + cancel: function () { + console.log('fail') + }, + }) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear RouterEnableAlertBeforeBackPage end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("ohos-router-EnableAlertBeforeBackPage") + .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("enableAlertBeforeBackPageText") + .onClick(() => { + router1.back() + }) + + Text("router-DisableAlertBeforeBackPage") + .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("disableAlertBeforeBackPageText") + .onClick(() => { + router1.disableAlertBeforeBackPage() + }) + + Text("router-EnableAlertBeforeBackPage") + .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("enableAlertBeforeBackPageText1") + .onClick(() => { + router2.back() + }) + + Text("router-DisableAlertBeforeBackPage") + .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("disableAlertBeforeBackPageText") + .onClick(() => { + router2.disableAlertBeforeBackPage() + }) + + }.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..e2a8045741bba287449289db4037d9483fe095ca --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/search.ets @@ -0,0 +1,104 @@ +/** + * 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 }) + .key("CopyOption") + + }.width("100%").height("100%") + } +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/select.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/select.ets new file mode 100644 index 0000000000000000000000000000000000000000..56acfb074570b795801454fbd6af6be5f622a282 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/select.ets @@ -0,0 +1,70 @@ +/** + * 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 SelectOnSelect { + @State selectIndex:number = 1 + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear SelectOnSelect start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear SelectOnSelect end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + Column() { + Select([{value:'aaa',icon: "/common/1.png"}, + {value:'bbb',icon: "/common/2.png"}, + {value:'ccc',icon: "/common/3.png"}, + {value:'ddd',icon: "/common/4.png"}]) + .key("Select") + .selected(2) + .value('TTT') + .font({size: 30, weight:400, family: 'serif', style: FontStyle.Normal }) + .selectedOptionFont({size: 40, weight: 500, family: 'serif', style: FontStyle.Normal }) + .optionFont({size: 30, weight: 400, family: 'serif', style: FontStyle.Normal }) + .onSelect((index:number)=>{ + console.info("Select:" + index) + this.selectIndex = index + try { + var backData = { + data: { + "selectIndex": this.selectIndex + } + } + let backEvent = { + eventId: 60222, + priority: events_emitter.EventPriority.LOW + } + console.info("SelectOnSelect start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("SelectOnSelect emit action state err: " + JSON.stringify(err.message)) + } + }) + } + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/shape.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/shape.ets new file mode 100644 index 0000000000000000000000000000000000000000..52e516025c1c19020e37f77047b1493b2d366c01 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/shape.ets @@ -0,0 +1,62 @@ +/** + * 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'; +let my_shape = new Shape() +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct ShapeNe { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear ShapeNe start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear ShapeNe end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("shape-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") + + Shape() { + Path().width(300).height(10).commands('M0 0 L900 0') + } + .viewPort({ x: 0, y: -5, width: 300, height: 20 }) + .stroke(0xEE8443).strokeWidth(10).strokeDashArray([20]).strokeDashOffset(10) + + Shape() { + Path().width(300).height(10).commands('M0 0 L900 0') + }.viewPort({ x: 0, y: -5, width: 300, height: 20 }).stroke(0xEE8443).strokeWidth(10).strokeOpacity(0.5) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/sideBar.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/sideBar.ets new file mode 100644 index 0000000000000000000000000000000000000000..10fb672b2d215452cbb39f6bbfaad774228cc9d5 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/sideBar.ets @@ -0,0 +1,76 @@ +/** + * 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 SideBarShowSideBar { + normalIcon : Resource = $r("app.media.user") + selectedIcon: Resource = $r("app.media.userFull") + @State arr: number[] = [1, 2, 3] + @State current: number = 1 + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear SideBarShowSideBar start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear SideBarShowSideBar end`) + } + + build() { + SideBarContainer(SideBarContainerType.Embed) + { + Column() { + ForEach(this.arr, (item, index) => { + Column({ space: 5 }) { + Image(this.current === item ? this.selectedIcon : this.normalIcon).width(64).height(64) + Text("Index0" + item) + .fontSize(25) + .fontColor(this.current === item ? '#0A59F7' : '#999') + .fontFamily('source-sans-pro,cursive,sans-serif') + } + .onClick(() => { + this.current = item + }) + }, item => item) + }.width('100%') + .justifyContent(FlexAlign.SpaceEvenly) + .backgroundColor('#19000000') + RowSplit() { + Column(){ + Text('Split page one').fontSize(30) + }.justifyContent(FlexAlign.Center) + Column(){ + Text('Split page two').fontSize(30) + }.justifyContent(FlexAlign.Center) + }.width('100%') + } + .key("SideBarContainer") + .showSideBar(true) + .autoHide(false) + .sideBarWidth(240) + .sideBarPosition(SideBarPosition.End) + .minSideBarWidth(210) + .maxSideBarWidth(260) + .onChange((value: boolean) => { + console.info('status:' + value) + }) + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/stack.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/stack.ets new file mode 100644 index 0000000000000000000000000000000000000000..bfe6cdef09caa5b798c1382691b45bdd93c793cf --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/stack.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 StackAlignContent { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear StackAlignContent start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear StackAlignContent end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("stack-AlignContent") + .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("alignContentText") + + + Stack({ alignContent: Alignment.Bottom }) { + Text('First child, show in bottom') + .width('95%') + .width('90%') + .height('100%') + .backgroundColor(0xd2cab3) + .align(Alignment.Top) + Text('Second child, show in top') + .width('70%') + .height('60%') + .backgroundColor(0xc1cbac) + .align(Alignment.Top) + }.key("Stack") + .width('100%').height(150).margin({ top: 5 }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/stateManagement.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/stateManagement.ets new file mode 100644 index 0000000000000000000000000000000000000000..1c1a29d6434186aaf6394f91c4ee0a2e5635d777 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/stateManagement.ets @@ -0,0 +1,138 @@ +/** + * 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'; + +let storage1 = LocalStorage.GetShared() +let storage2 = new LocalStorage({"PropA":47}); + +@Entry(storage1) +@Component +export default +struct StateManagementGetShared { + @LocalStorageLink("storageSimpleProp") simpleVarName: number = 0 + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear StateManagementGetShared start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear StateManagementGetShared end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text(`Parent from LocalStorage ${ this.simpleVarName }`) + .key("GetSharedText") + .onClick(()=>{ + try { + var backDataOne = { + data: { + "Result": (storage1 != null) + } + } + let backEventOne = { + eventId: 60223, + priority: events_emitter.EventPriority.LOW + } + console.info("GetShared start to emit action state") + events_emitter.emit(backEventOne, backDataOne) + } catch (err) { + console.info("GetShared emit action state err: " + JSON.stringify(err.message)) + } + }) + + Text(`Parent from LocalStorage ${ this.simpleVarName }`) + .key("setAndLinkText") + .onClick(()=>{ + try { + var backDataTwo = { + data: { + "Result": "callback2" + } + } + let backEventTwo = { + eventId: 60224, + priority: events_emitter.EventPriority.LOW + } + console.info("setAndLink start to emit action state") + events_emitter.emit(backEventTwo, backDataTwo) + } catch (err) { + console.info("setAndLink emit action state err: " + JSON.stringify(err.message)) + } + storage1.setAndLink("storageSimpleProp",48) + console.log("storage1.setAndLink('PropA',48) :" + this.simpleVarName ) + }) + + Text(`Parent from LocalStorage ${ this.simpleVarName }`) + .key("setOrCreateText") + .onClick(()=>{ + try { + var backDataThree = { + data: { + "Result": "callback3" + } + } + let backEventThree = { + eventId: 60225, + priority: events_emitter.EventPriority.LOW + } + console.info("setOrCreate start to emit action state") + events_emitter.emit(backEventThree, backDataThree) + } catch (err) { + console.info("setOrCreate emit action state err: " + JSON.stringify(err.message)) + } + storage1.setOrCreate("storageSimpleProp",47) + console.log("storageSimpleProp setOrCreate is : " + this.simpleVarName) + }) + + Text(`Parent from LocalStorage ${ this.simpleVarName }`) + .key("setAndPropText") + .onClick(()=>{ + try { + var backDataFour = { + data: { + "Result": "callback4" + } + } + let backEventFour = { + eventId: 60226, + priority: events_emitter.EventPriority.LOW + } + console.info("setAndProp start to emit action state") + events_emitter.emit(backEventFour, backDataFour) + } catch (err) { + console.info("setAndProp emit action state err: " + JSON.stringify(err.message)) + } + + storage1.setAndProp("storageSimpleProp",49) + console.log("storageSimpleProp setAndProp is : " + this.simpleVarName) + }) + + }.width("100%").height("100%") + } +} + +@Component +struct Child{ + @LocalStorageLink("PropA") storLink: number = 1; + build() { + Text(`Parent from LocalStorage ${ this.storLink }`) + .onClick(()=>this.storLink+=1) + } +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/storage.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/storage.ets new file mode 100644 index 0000000000000000000000000000000000000000..0ff3d695aa4abfee1a69fdde33b6d073279a8b72 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/storage.ets @@ -0,0 +1,40 @@ +/** + * 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 Ability from '@ohos.application.Ability' +export default class MainAbility extends Ability { + storage : LocalStorage + onCreate(want) { + this.storage = new LocalStorage(); + this.storage.setOrCreate("storageSimpleProp",121); + console.log("[Demo MainAbility onCreate]"); + globalThis.abilityWant = want; + } + onDestroy() { + console.log("[Demo MainAbility onDestroy]") + } + onWindowStageCreate(windowStage) { + windowStage.setUIContent(this.context,"pages/index",this.storage) + } + onWindowStageDestroy() { + console.log("[Demo] MainAbility onWindoeStageDestroy") + } + onForeground() { + console.log("[Demo] MainAbility onForeground") + } + onBackground() { + console.log("[Demo] MainAbility onBackground") + } +} \ No newline at end of file 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..4d295994a9ef8d5f11c699b4ef853d7ea57ede4e --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/swiper.ets @@ -0,0 +1,122 @@ +/** + * 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) + } + .key("swiper") + .cachedCount(2) + .index(1) + .autoPlay(true) + .interval(4000) + .indicator(true) // 默认开启指示点 + .loop(false) // 默认开启循环播放 + .duration(1000) + .vertical(false) // 默认横向切换 + .itemSpace("0px") + .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..35d3af266a23e61e4bd6e4f5ef4309b75f754597 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/tabs.ets @@ -0,0 +1,73 @@ +/** + * 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') + + } + .key("barPositionTabs") + .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..a071527ccc6be1eb414936c782eb52eef5bdbf47 --- /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("textAreaCopyOptionText") + + }.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..9103407baf777469c59a9a3700fb3f91e3b0749f --- /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("textInputCopyOptionText") + + 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/uiAppearance.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/uiAppearance.ets new file mode 100644 index 0000000000000000000000000000000000000000..83ac98b2ae28fdb864609984a5df4cda53a8184f --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/uiAppearance.ets @@ -0,0 +1,91 @@ +/** + * 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 uiAppearance from '@ohos.uiAppearance' +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct uiAppearanceSetDarkMode { + xcomponentController: XComponentController = new XComponentController() + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear uiAppearanceSetDarkMode start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear uiAppearanceSetDarkMode end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("uiAppearance-setDarkMode1") + .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("uiAppearance-setDarkMode1Text") + .onClick(() => { + uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK, (err) => { + console.info(`uiAppearance.setDarkMode: ${err}`); + }) + }) + + Text("uiAppearance-getDarkMode") + .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("uiAppearance-getDarkModeText") + .onClick(() => { + console.log('uiAppearance.getDarkMode: ' + JSON.stringify(uiAppearance.getDarkMode())) + }) + + Text("uiAppearance-setDarkMode2") + .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("uiAppearance-setDarkMode2Text") + .onClick(() => { + uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK) + }) + + }.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..d6790351bef7a39571d556ce07da1814d19d4ec0 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/video.ets @@ -0,0 +1,122 @@ +/** + * 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'; +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') + try{ + var backData = { + data: { + "result": "success" + } + } + let backEvent = { + eventId: 60227, + priority: events_emitter.EventPriority.LOW + } + console.info("video_101 onClick start to emit action state") + events_emitter.emit(backEvent, backData) + } catch(err) { + console.info("video_101 onClick emit action state err: " + JSON.stringify(err.message)) + } + }) + .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") + .key("fullScreen") + .onClick(() => { + this.controller.requestFullscreen(true) + }); + + Button("ExitFullScreen") + .key("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/MainAbility/pages/web.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/web.ets new file mode 100644 index 0000000000000000000000000000000000000000..4a4c1638b2a324e7db705f455262f54a42a11c41 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/web.ets @@ -0,0 +1,187 @@ +/* + * 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 Log from '../common/Log.ets'; + +@Entry +@Component +struct WebComponent { + @State progress: number = 0; + @State hideProgress: boolean = true; + fileAccess: boolean = true; + // 定义Web组件的控制器controller + controller: WebController = new WebController(); + webResourceResponse: WebResourceResponse = new WebResourceResponse(); + build() { + Column() { + Text('Hello world!') + .fontSize(20) + Progress({value: this.progress, total: 100}) + .color('#0000ff') + .visibility(this.hideProgress ? Visibility.None : Visibility.Visible) + // 初始化Web组件,并绑定controller + Web({ src: $rawfile('index.html'), controller: this.controller }) + .key("getTitleText") + .fileAccess(this.fileAccess) + .javaScriptAccess(true) + .height(500) + .padding(20) + .blur(2) + .userAgent("Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36") + .fileFromUrlAccess(true) + .initialScale(2) + .webDebuggingAccess(true) + .onPrompt((event) => { + console.info('onPrompt url: ', event.url); + console.info('onPrompt message: ', event.message); + console.info('onPrompt result: ', event.result); + console.info('onPrompt handlePromptConfirm: ', event.result.handlePromptConfirm("confirm")); + return true; + }) + .onShowFileSelector((event) => { + console.info('onShowFileSelector getAcceptType: ', event.fileSelector.getAcceptType()); + console.info('onShowFileSelector getTitle: ', event.fileSelector.getTitle()); + console.info('onShowFileSelector getMode: ', event.fileSelector.getMode()); + console.info('onShowFileSelector isCapture: ', event.fileSelector.isCapture()); + event.result.handleFileList(["D:\DevEcoStudioProjects","D:\DevEcoStudioProjects"]) + return true; + }) + .onRenderExited((event) => { + console.info('onRenderExited getAcceptType: ', event.renderExitReason); + }) + .onProgressChange(e => { + this.progress = e.newProgress; + if (this.progress === 100) { + this.hideProgress = true; + } else { + this.hideProgress = false; + } + }) + .onResourceLoad((event) => { + console.info('onResourceLoad url: ', event.url); + return true; + }) + .onPageEnd(e => { + // test()在index.html中定义 + this.controller.runJavaScript({ script: 'test()' }); + console.info('url: ', e.url); + }) + .onHttpAuthRequest((event) => { + console.info('onHttpAuthRequest host: ', event.host); + console.info('onHttpAuthRequest realm: ', event.realm); + console.info('onHttpAuthRequest isHttpAuthInfoSaved: ', event.handler.isHttpAuthInfoSaved()); + let result = event.handler; + return true; + }) + .onInterceptRequest((event) => { + console.info('onInterceptRequest getRequestUrl: ', event.request.getRequestUrl()); + console.info('onInterceptRequest isMainFrame: ', event.request.isMainFrame()); + console.info('onInterceptRequest isRedirect: ', event.request.isRedirect()); + console.info('onInterceptRequest isRequestGesture: ', event.request.isRequestGesture()); + let result = event.request.getRequestHeader(); + console.log('The request header result size is ' + result.length); + for (let i of result) { + console.log('The request header key is : ' + i.headerKey + ' , value is : ' + i.headerValue); + } + return this.webResourceResponse; + }) +// .onContextMenuShow((event) => { +// console.info("x coord = " + event.param.x()); +// console.info("y coord = " + event.param.y()); +// console.info("link url = " + event.param.getLinkUrl()); +// console.info("unfilterendLinkUrl = " + event.param.getUnfilterendLinkUrl()); +// console.info("sourceUrl = " + event.param.getSourceUrl()); +// console.info("existsImageContents = " + event.param.existsImageContents()); +// console.info("closeContextMenu = " + event.result.closeContextMenu()); +// console.info("copyImage = " + event.result.copyImage()); +// }) +// .onPermissionRequest((event) => { +// AlertDialog.show({ +// title: 'title', +// message: 'text', +// confirm: { +// value: 'onConfirm', +// action: () => { +// event.request.grant(event.request.getAccessibleResource()); +// console.info('onPermissionRequest getAccessibleResource: ', event.request.getAccessibleResource()); +// console.info('onPermissionRequest getOrigin: ', event.request.getOrigin()); +// } +// }, +// cancel: () => { +// event.request.deny(); +// } +// }) +// }) + .onScaleChange((event) => { + console.info('onScaleChange oldScale: ', event.oldScale); + console.info('onScaleChange newScale: ', event.newScale); + }) + .onHttpErrorReceive((event) => { + console.log('url:' + event.request.getRequestUrl()); + console.log('isMainFrame:' + event.request.isMainFrame()); + console.log('isRedirect:' + event.request.isRedirect()); + console.log('isRequestGesture:' + event.request.isRequestGesture()); + console.log('getResponseData:' + event.response.getResponseData()); + console.log('getResponseEncoding:' + event.response.getResponseEncoding()); + console.log('getResponseMimeType:' + event.response.getResponseMimeType()); + console.log('getResponseCode:' + event.response.getResponseCode()); + console.log('getReasonMessage:' + event.response.getReasonMessage()); + console.log('setResponseData:' + event.response.setResponseData("ResponseData")); + console.log('setReasonMessage:' + event.response.setReasonMessage("success")); + console.log('setResponseCode:' + event.response.setResponseCode(200)); + console.log('setResponseEncoding:' + event.response.setResponseEncoding("UTF-8")); + console.log('setResponseMimeType:' + event.response.setResponseMimeType("application/json")); + console.log('setResponseHeader:' + event.response.setResponseHeader([])); + console.log('web getExtra:' + this.controller.getHitTestValue().getExtra()); + console.log('web getType:' + this.controller.getHitTestValue().getType()); + console.log('web getCookieManager:' + this.controller.getCookieManager()); + console.log('web getCookie:' + this.controller.getCookieManager().getCookie("www.baidu.com")); + console.log('web existCookie:' + this.controller.getCookieManager().existCookie()); + console.log('web deleteEntireCookie:' + this.controller.getCookieManager().deleteEntireCookie()); + console.log('web deleteExpiredCookie:' + this.controller.getCookieManager().deleteExpiredCookie()); + console.log('web deleteSessionCookie:' + this.controller.getCookieManager().deleteSessionCookie()); + console.log('web isCookieAllowed:' + this.controller.getCookieManager().isCookieAllowed()); + console.log('web isFileURICookieAllowed:' + this.controller.getCookieManager().isFileURICookieAllowed()); + console.log('web isThirdPartyCookieAllowed:' + this.controller.getCookieManager().isThirdPartyCookieAllowed()); + console.log('web putAcceptCookieEnabled:' + this.controller.getCookieManager().putAcceptCookieEnabled(true)); + console.log('web putAcceptFileURICookieEnabled:' + this.controller.getCookieManager().putAcceptFileURICookieEnabled(true)); + console.log('web putAcceptThirdPartyCookieEnabled:' + this.controller.getCookieManager().putAcceptThirdPartyCookieEnabled(true)); + console.log('web saveCookieSync:' + this.controller.getCookieManager().saveCookieSync()); + console.log('web zoomIn:' + this.controller.zoomIn()); + console.log('web zoomOut:' + this.controller.zoomOut()); + console.log('web zoom:' + this.controller.zoom(2)); + console.log('web getWebId:' + this.controller.getWebId()); + console.log('web getDefaultUserAgent:' + this.controller.getDefaultUserAgent()); + console.log('web getTitle:' + this.controller.getTitle()); + console.log('web getPageHeight:' + this.controller.getPageHeight()); + console.log('web backOrForward:' + this.controller.backOrForward(2)); + + + let result = event.request.getRequestHeader(); + console.log('The request header result size is ' + result.length); + for (let i of result) { + console.log('The request header key is : ' + i.headerKey + ' , value is : ' + i.headerValue); + } + let resph = event.response.getResponseHeader(); + console.log('The response header result size is ' + resph.length); + for (let i of resph) { + console.log('The response header key is : ' + i.headerKey + ' , value is : ' + i.headerValue); + } + }) + Text('End') + .fontSize(20) + } + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/xcomponent.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/xcomponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..55db887769128f45259f8e642399897829f802ae --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/xcomponent.ets @@ -0,0 +1,91 @@ +/** + * 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'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct XcomponentGetXComponentContext { + xcomponentController: XComponentController = new XComponentController() + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear XcomponentGetXComponentContext start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear XcomponentGetXComponentContext end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("xcomponent-GetXComponentContext") + .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("getXComponentContextText") + .onClick(() => { + try { + Log.showInfo(TAG, 'xcomponentController.getXComponentContext' + JSON.stringify(this.xcomponentController.getXComponentContext())) + var result = (this.xcomponentController.getXComponentContext() != null) + var backData = { + data: { + "STATUS": "callBackSuccess" + } + } + let backEvent = { + eventId: 60228, + priority: events_emitter.EventPriority.LOW + } + console.info("xcomponentController start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("xcomponentController emit action state err: " + JSON.stringify(err.message)) + } + }) + + Text("xcomponent-SetXComponentSurfaceSize") + .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("setXComponentSurfaceSizeText") + .onClick(() => { + this.xcomponentController.setXComponentSurfaceSize({ + surfaceWidth: 200, + surfaceHeight: 200 + }) + }) + + }.width("100%").height("100%") + } +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/TestAbility/app.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/TestAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..6b29cb8048a4edbca5f8fbc6197c0fb227c00f64 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/TestAbility/app.ets @@ -0,0 +1,33 @@ +// @ts-nocheck +/** + * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/TestAbility/pages/index.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d0efe0a85177331cccf9524a7cd747c966dcbe5 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,50 @@ +// @ts-nocheck +/** + * 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 router from '@system.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('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/arkui/ace_ets_component_apilack/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/arkui/ace_ets_component_apilack/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..07cb0b784984c6c4cc6d911c3c82643bff9df263 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +// @ts-nocheck +/** + * 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 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 itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + 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') + } + + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility' + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + 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 call abilityDelegator.getAppContext') + var context = abilityDelegator.getAppContext() + console.info('getAppContext : ' + JSON.stringify(context)) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/FocusControlJsunit.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/FocusControlJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..cc24bb089574b838dc00a3635034bf487863c6c6 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/FocusControlJsunit.test.ets @@ -0,0 +1,186 @@ +/** + * 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 "hypium/index" +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter' +import Utils from './Utils'; + +export default function focusControlJsunit() { + describe('focusControlTest', function () { + beforeEach(async function (done) { + console.info("focusControlTest beforeEach start"); + let options = { + uri: 'pages/focusControl', + } + let result; + try { + router.clear(); + let pages = router.getState(); + console.info("get focus state pages: " + JSON.stringify(pages)); + if (!("focusControl" == pages.name)) { + console.info("get focus state pages.name: " + JSON.stringify(pages.name)); + result = await router.push(options); + await Utils.sleep(2000); + console.info("push focus page result: " + JSON.stringify(result)); + } + } catch (err) { + console.error("push focus page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("focus after each called"); + }) + + it('testFocusOnTouch01', 0, async function (done) { + console.info('[testFocusOnTouch01] START'); + await Utils.sleep(1000); + var callback = (eventData) => { + if (eventData != null) { + console.info("[testFocusOnTouch01] get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.value).assertEqual('FocusOnTouchGrpBtn') + done() + } + } + var innerEvent = { + eventId: 60232, + priority: events_emitter.EventPriority.LOW + } + try { + console.info("testFocusOnTouch01 click result is: " + JSON.stringify(sendEventByKey('OnTouchGrpBtn', 10, ""))); + events_emitter.on(innerEvent, callback) + } catch (err) { + console.info("[testFocusOnTouch01] on events_emitter err : " + JSON.stringify(err)); + } + console.info('[testFocusOnTouch01] testSendTouchEvent END'); + }); + + it('testFocusOnTouch02', 0, async function (done) { + console.info('[testFocusOnTouch02] START'); + await Utils.sleep(1000); + var callback = (eventData) => { + if (eventData != null) { + console.info("[testFocusOnTouch02] get event state result is: " + JSON.stringify(eventData)) + expect(eventData.data.value).assertEqual('FocusOnTouchBtn1') + done() + } + } + var innerEvent = { + eventId: 60233, + priority: events_emitter.EventPriority.LOW + } + try { + console.info("testFocusOnTouch02 click result is: " + JSON.stringify(sendEventByKey('OnTouchBtn1', 10, ""))); + events_emitter.on(innerEvent, callback) + } catch (err) { + console.info("[testFocusOnTouch02] on events_emitter err : " + JSON.stringify(err)); + } + console.info('[testFocusOnTouch02] testSendTouchEvent END'); + }); + + it('testFocusOnTouch03', 0, async function (done) { + console.info('[testFocusOnTouch03] START'); + await Utils.sleep(1000); + var callback = (eventData) => { + if (eventData != null) { + console.info("[testFocusOnTouch03] get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.value).assertEqual('FocusOnTouchBtn2') + done() + } + } + var innerEvent = { + eventId: 60234, + priority: events_emitter.EventPriority.LOW + } + try { + console.info("testFocusOnTouch03 click result is: " + JSON.stringify(sendEventByKey('OnTouchBtn2', 10, ""))); + events_emitter.on(innerEvent, callback) + } catch (err) { + console.info("[testFocusOnTouch03] on events_emitter err : " + JSON.stringify(err)); + } + console.info('[testFocusOnTouch03] testSendTouchEvent END'); + }); + + it('testFocusOnTouch04', 0, async function (done) { + console.info('[testFocusOnTouch04] START'); + await Utils.sleep(1000); + var callback = (eventData) => { + if (eventData != null) { + console.info("[testFocusOnTouch04] get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.value).assertEqual('OnTouchBtn3') + done() + } + } + var innerEvent = { + eventId: 60235, + priority: events_emitter.EventPriority.LOW + } + try { + console.info("testFocusOnTouch04 click result is: " + JSON.stringify(sendEventByKey('OnTouchBtn3', 10, ""))); + events_emitter.on(innerEvent, callback) + } catch (err) { + console.info("[testFocusOnTouch04] on events_emitter err : " + JSON.stringify(err)); + } + console.info('[testFocusOnTouch04] testSendTouchEvent END'); + }); + + it('testFocusOnTouch05', 0, async function (done) { + console.info('[testFocusOnTouch05] START'); + await Utils.sleep(1000); + var callback = (eventData) => { + if (eventData != null) { + console.info("[testFocusOnTouch05] get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.value).assertEqual('OnTouchBtn4') + done() + } + } + var innerEvent = { + eventId: 60236, + priority: events_emitter.EventPriority.LOW + } + try { + console.info("testFocusOnTouch05 click result is: " + JSON.stringify(sendEventByKey('OnTouchBtn4', 10, ""))); + events_emitter.on(innerEvent, callback) + } catch (err) { + console.info("[testFocusOnTouch05] on events_emitter err : " + JSON.stringify(err)); + } + console.info('[testFocusOnTouch05] testSendTouchEvent END'); + }); + + it('testDefaultFocus06', 0, async function (done) { + console.info('[testDefaultFocus06] START'); + await Utils.sleep(1000); + var callback = (eventData) => { + if (eventData != null) { + console.info("[testDefaultFocus06] get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.value).assertEqual('defaultFocus') + done() + } + } + var innerEvent = { + eventId: 60237, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(innerEvent, callback) + } catch (err) { + console.info("[testDefaultFocus06] on events_emitter err : " + JSON.stringify(err)); + } + console.info('[testDefaultFocus06] END'); + }); + }) +} \ No newline at end of file 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 new file mode 100644 index 0000000000000000000000000000000000000000..ead1df032237f27f1495b033b71e891db91813bf --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,107 @@ +/** + * 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 alphabetIndexerOnSelectJsunit from './alphabetIndexer.test.ets'; +import checkBoxGroupSelectAllJsunit from './checkBoxGroup.test.ets'; +import circleNewJsunit from './circle.test.ets'; +import curvesStepsJsunit from './curves.test.ets'; +import commonBackgroundBlurStyleJsunit from './common.test.ets'; +import common_ts_ets_apiStaticClearJsunit from './common_ts_ets_api.test.ets'; +import ellipseNeJsunit from './ellipse.test.ets'; +import featureAbilityStartAbilityJsunit from './featureAbility.test.ets'; +import focusControlJsunit from './FocusControlJsunit.test.ets' +import gaugeColorsJsunit from './gauge.test.ets'; +import gestureSetDirectionJsunit from './gesture.test.ets'; +import globalJsunit from './global.test.ets'; +import gridMaxCountJsunit from './grid.test.ets'; +import gridItemOnSelectJsunit from './gridItem.test.ets'; +import grid_colSpanJsunit from './grid_col.test.ets'; +import grid_rowOnBreakpointChangeJsunit from './grid_row.test.ets'; +import inspectorJsunit from './inspector.test.ets' +import lazyForEachOnDataAddJsunit from './lazyForEach.test.ets'; +import lineNeJsunit from './line.test.ets'; +import listNewJsunit from './listTest.test.ets'; +import list_itemOnSelectJsunit from './list_item.test.ets'; +import mediaQueryOffJsunit from './mediaQuery.test.ets'; +import navigatorTargetJsunit from './navigator.test.ets' +import pageRouteTest from './pageRoute.test.ets' +import panelBackgroundMaskJsunit from './panel.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 promptShowDialogJsunit from './prompt.test.ets'; +import rectNeJsunit from './rect.test.ets'; +import scrollOnScrollBeginJsunit from './scroll.test.ets'; +import searchOnCutJsunit from './search.test.ets' +import selectOnSelectJsunit from './select.test.ets'; +import sideBarShowSideBarJsunit from './sideBar.test.ets'; +import stackAlignContentJsunit from './stack.test.ets'; +import stateManagementGetSharedJsunit from './stateManagement.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'; +import webGetTitleJsunit from './web.test.ets'; +import xcomponentGetXComponentContextJsunit from './xcomponent.test.ets'; + +export default function testsuite() { + lazyForEachOnDataAddJsunit() + alphabetIndexerOnSelectJsunit() + checkBoxGroupSelectAllJsunit() + circleNewJsunit() + curvesStepsJsunit() + common_ts_ets_apiStaticClearJsunit() + commonBackgroundBlurStyleJsunit() + ellipseNeJsunit() + featureAbilityStartAbilityJsunit() + gaugeColorsJsunit() + gestureSetDirectionJsunit() + globalJsunit() + gridMaxCountJsunit() + gridItemOnSelectJsunit() + inspectorJsunit() + lineNeJsunit() + listNewJsunit() + list_itemOnSelectJsunit() + mediaQueryOffJsunit() + navigatorTargetJsunit() + pageRouteTest() + panelBackgroundMaskJsunit() + pathNewTest() + polygonNewJsunit() + polyLineNeJsunit() + progressScaleCountJsunit() + promptShowDialogJsunit() + rectNeJsunit() + scrollOnScrollBeginJsunit() + searchOnCutJsunit() + selectOnSelectJsunit() + sideBarShowSideBarJsunit() + stackAlignContentJsunit() + stateManagementGetSharedJsunit() + swiperCurveJsunit() + tabsBarPositionJsunit() + textMinFontSizeJsunit() + textAreaOnCutJsunit() + textInputOnEditChangeJsunit() + textPickerDefaultPickerItemHeightJsunit() + videoOnFullscreenChangeJsunit() + webGetTitleJsunit() + xcomponentGetXComponentContextJsunit() +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/Utils.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/Utils.ets new file mode 100644 index 0000000000000000000000000000000000000000..aa94fe4f7e0a3a0c066b9141e118b2229c839a96 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/Utils.ets @@ -0,0 +1,118 @@ +// @ts-nocheck +/** + * 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 class Utils { + static rect_left; + static rect_top; + static rect_right; + static rect_bottom; + static rect_value; + + static sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, time) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + static getComponentRect(key) { + let strJson = getInspectorByKey(key); + let obj = JSON.parse(strJson); + console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj)); + let rectInfo = JSON.parse('[' + obj.$rect + ']') + console.info("[getInspectorByKey] rectInfo is: " + rectInfo); + this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0] + this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1] + this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0] + this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1] + return this.rect_value = { + "left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom + } + } + + static async swipe(downX, downY, upX, upY, steps) { + console.info('start to swipe') + this.drags(downX, downY, upX, upY, steps, false) + } + + static async drag(downX, downY, upX, upY, steps) { + console.info('start to drag') + this.drags(downX, downY, upX, upY, steps, true) + } + + static async drags(downX, downY, upX, upY, steps, drag) { + var xStep; + var yStep; + var swipeSteps; + var ret; + xStep = 0; + yStep = 0; + ret = false; + swipeSteps = steps; + if (swipeSteps == 0) { + swipeSteps = 1; + } + xStep = (upX - downX) / swipeSteps; + yStep = (upY - downY) / swipeSteps; + console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep) + var downPonit: TouchObject = { + id: 1, + x: downX, + y: downY, + type: TouchType.Down, + } + console.info('down touch started: ' + JSON.stringify(downPonit)) + sendTouchEvent(downPonit); + console.info('start to move') + if (drag) { + await this.sleep(500) + } + for (var i = 1;i <= swipeSteps; i++) { + var movePoint: TouchObject = { + id: 1, + x: downX + (xStep * i), + y: downY + (yStep * i), + type: TouchType.Move + } + console.info('move touch started: ' + JSON.stringify(movePoint)) + ret = sendTouchEvent(movePoint) + if (ret == false) { + break; + } + await this.sleep(5) + } + console.info('start to up') + if (drag) { + await this.sleep(100) + } + var upPoint: TouchObject = { + id: 1, + x: upX, + y: upY, + type: TouchType.Up, + } + console.info('up touch started: ' + JSON.stringify(upPoint)) + sendTouchEvent(upPoint) + await this.sleep(500) + } +} + + + + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/alphabetIndexer.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/alphabetIndexer.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..896dea30e7d5b8c31af09e9bcdee8702748d5495 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/alphabetIndexer.test.ets @@ -0,0 +1,262 @@ +/** + * 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 alphabetIndexerOnSelectJsunit() { + describe('alphabetIndexerOnSelectTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/alphabetIndexer', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get alphabetIndexer state success " + JSON.stringify(pages)); + if (!("alphabetIndexer" == pages.name)) { + console.info("get alphabetIndexer state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push alphabetIndexer page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push alphabetIndexer page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("alphabetIndexerOnSelect after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testalphabetIndexer0001 + * @tc.desic acealphabetIndexerEtsTest0001 + */ + it('testalphabetIndexerWidth0001', 0, async function (done) { + console.info('alphabetIndexerWidth testalphabetIndexerWidth0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerWidth0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testalphabetIndexerWidth0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testalphabetIndexer0002 + * @tc.desic acealphabetIndexerEtsTest0002 + */ + it('testalphabetIndexerHeight0002', 0, async function (done) { + console.info('alphabetIndexerHeight testalphabetIndexerHeight0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerHeight0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.height).assertEqual("300.00vp"); + console.info("[testalphabetIndexerHeight0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testalphabetIndexer0003 + * @tc.desic acealphabetIndexerEtsTest0003 + */ + it('testalphabetIndexerColor0003', 0, async function (done) { + console.info('alphabetIndexerColor testalphabetIndexerColor0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerColor0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.color).assertEqual(undefined); + console.info("[testalphabetIndexerColor0003] color value :" + obj.$attrs.color); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testalphabetIndexer0004 + * @tc.desic acealphabetIndexerEtsTest0004 + */ + it('testalphabetIndexerSelectedColor0004', 0, async function (done) { + console.info('alphabetIndexerSelectedColor testalphabetIndexerSelectedColor0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerOnSelect0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.selectedColor).assertEqual("#FFFFFFFF"); + console.info("[testalphabetIndexerSelectedColor0004] selectedColor value :" + obj.$attrs.selectedColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testalphabetIndexer0005 + * @tc.desic acealphabetIndexerEtsTest0005 + */ + it('testalphabetIndexerPopupColor0005', 0, async function (done) { + console.info('alphabetIndexerPopupColor testalphabetIndexerPopupColor0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerPopupColor0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.popupColor).assertEqual("#FF48D1CC"); + console.info("[testalphabetIndexerPopupColor0005] popupColor value :" + obj.$attrs.popupColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testalphabetIndexer0006 + * @tc.desic acealphabetIndexerEtsTest0006 + */ + it('testalphabetIndexerSelectedBackgroundColor0006', 0, async function (done) { + console.info('alphabetIndexerSelectedBackgroundColor testalphabetIndexerSelectedBackgroundColor0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerSelectedBackgroundColor0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.selectedBackgroundColor).assertEqual("#FF0000E6"); + console.info("[testalphabetIndexerSelectedBackgroundColor0006] selectedBackgroundColor value :" + obj.$attrs.selectedBackgroundColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testalphabetIndexer0007 + * @tc.desic acealphabetIndexerEtsTest0007 + */ + it('testalphabetIndexerPopupBackground0007', 0, async function (done) { + console.info('alphabetIndexerPopupBackground testalphabetIndexerPopupBackground0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerPopupBackground0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.popupBackground).assertEqual("#E500DDDD"); + console.info("[testalphabetIndexerPopupBackground0007] popupBackground value :" + obj.$attrs.popupBackground); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testalphabetIndexer0009 + * @tc.desic acealphabetIndexerEtsTest0009 + */ + it('testalphabetIndexerUsingPopup0009', 0, async function (done) { + console.info('alphabetIndexerUsingPopup testalphabetIndexerUsingPopup009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerUsingPopup0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.usingPopup).assertEqual(true); + console.info("[testalphabetIndexerUsingPopup0009] usingPopup value :" + obj.$attrs.usingPopup); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testalphabetIndexer0010 + * @tc.desic acealphabetIndexerEtsTest0010 + */ + it('testalphabetIndexerItemSize0010', 0, async function (done) { + console.info('alphabetIndexerItemSize testalphabetIndexerItemSize0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerItemSize0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.itemSize).assertEqual("28.000000"); + console.info("[testalphabetIndexerItemSize0010] itemSize value :" + obj.$attrs.itemSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testalphabetIndexer0011 + * @tc.desic acealphabetIndexerEtsTest0011 + */ + it('testalphabetIndexerAlignStyle0011', 0, async function (done) { + console.info('alphabetIndexerAlignStyle testalphabetIndexerAlignStyle0011 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('alphabetIndexer'); + console.info("[testalphabetIndexerAlignStyle0011] component strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('AlphabetIndexer'); + expect(obj.$attrs.alignStyle).assertEqual("AlignStyle.Left"); + console.info("[testalphabetIndexerItemSize0010] alignStyle value :" + obj.$attrs.alignStyle); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0012 + * @tc.name testalphabetIndexerOnSelect0012 + * @tc.desic acealphabetIndexerOnSelectEtsTest0012 + */ + it('testalphabetIndexerOnSelect0012', 0, async function (done) { + console.info('alphabetIndexerOnSelect testalphabetIndexerOnSelect0011 START'); + await Utils.sleep(2000); + try{ + let callback = (indexEvent) => { + console.info("onSelect_0012 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.STATUS).assertEqual(true); + } + let indexEvent = { + eventId: 60201, + priority: events_emitter.EventPriority.LOW + } + sendEventByKey('alphabetIndexer', 10, "") + events_emitter.on(indexEvent, callback); + }catch(err){ + console.info("onSelect_0012 on events_emitter err : " + JSON.stringify(err)); + } + + await Utils.sleep(2000); + try { + var innerEventOne = { + eventId: 60202, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("onRequestPopupData_0012 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + } + console.info("onSelect_0012 click result is: " + JSON.stringify(sendEventByKey('alphabetIndexer', 10, ""))); + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("onRequestPopupData_0012 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testalphabetIndexerOnSelect0012 END'); + done(); + + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/checkBoxGroup.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/checkBoxGroup.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a5dafdaaaaa17c6273d18c0feaacd43ceaafb909 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/checkBoxGroup.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 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 checkBoxGroupSelectAllJsunit() { + describe('checkBoxGroupSelectAllTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/checkBoxGroup', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get checkBoxGroup state success " + JSON.stringify(pages)); + if (!("checkBoxGroup" == pages.name)) { + console.info("get checkBoxGroup state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push checkBoxGroup page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push checkBoxGroup page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("checkBoxGroupSelectAll after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testcheckBoxGroupSelectAll0001 + * @tc.desic acecheckBoxGroupSelectAllEtsTest0001 + */ + it('testcheckBoxGroupSelectAll0001', 0, async function (done) { + console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('CheckboxGroup'); + console.info("[testcheckBoxGroupSelectAll0001] component selectedColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('CheckboxGroup'); + expect(obj.$attrs.selectedColor).assertEqual("#FFED6F21"); + console.info("[testcheckBoxGroupSelectAll0001] selectedColor value :" + obj.$attrs.selectedColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testcheckBoxGroupSelectAll0002 + * @tc.desic acecheckBoxGroupSelectAllEtsTest0002 + */ + it('testcheckBoxGroupSelectAll0002', 0, async function (done) { + console.info('checkBoxGroupSelectAll testcheckBoxGroupSelectAll0002 START'); + try { + var eventData = { + data: { + "isSelect": false + } + } + var innerEvent = { + eventId: 60203, + priority: events_emitter.EventPriority.LOW + } + console.info("[testcheckBoxGroupSelectAll0002] start to publish emit"); + events_emitter.emit(innerEvent, eventData); + } catch (err) { + console.log("[testcheckBoxGroupSelectAll0002] change component data error: " + err.message); + } + await Utils.sleep(2000); + + let strJson = getInspectorByKey('CheckboxOne'); + let obj = JSON.parse(strJson); + console.info("[testcheckBoxGroupSelectAll0002] obj is: " + JSON.stringify(obj)); + expect(obj.$attrs.selectedColor).assertEqual("#FF39A2DB"); + console.info("[testcheckBoxGroupSelectAll0002] selectedColor value :" + obj.$attrs.selectedColor); + console.info('testcheckBoxGroupSelectAll0002 END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/circle.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/circle.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8103bd827ba1ad14121dfb88edc8957dc26c99d9 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/circle.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 circleNewJsunit() { + describe('circleNewTest', function () { + beforeAll(async function (done) { + console.info("circle beforeEach start"); + let options = { + uri: 'pages/circle', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get circle state success " + JSON.stringify(pages)); + if (!("circle" == pages.name)) { + console.info("get circle state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push circle page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push circle page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("circleNew after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_001 + * @tc.name testcircleNew001 + * @tc.desic acecircleNewEtsTest001 + */ + it('testcircleNew001', 0, async function (done) { + console.info('circleNew testcircleNew0011 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('circle'); + console.info("[testcircleNew001] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.width).assertEqual("100.00px"); + console.info("[testcircleNew001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_002 + * @tc.name testcircleNew002 + * @tc.desic acecircleNewEtsTest002 + */ + it('testcircleNew002', 0, async function (done) { + console.info('circleNew testcircleNew002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('circle'); + console.info("[testcircleNew002] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.height).assertEqual("100.00px"); + console.info("[testcircleNew002] width value :" + obj.$attrs.width); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/common.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/common.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..71a6d9ac64b0fbad1f47e35e5a8cf56776e4be65 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/common.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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "hypium/index" +import Utils from './Utils.ets' + +export default function commonBackgroundBlurStyleJsunit() { + describe('commonBackgroundBlurStyleTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/common', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get common state success " + JSON.stringify(pages)); + if (!("common" == pages.name)) { + console.info("get common state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push common page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push common page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("commonBackgroundBlurStyle after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_001 + * @tc.name testcommonBackgroundBlurStyle001 + * @tc.desic acecommonBackgroundBlurStyleEtsTest001 + */ + it('testcommonBackgroundBlurStyle001', 0, async function (done) { + console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('borderImageText'); + console.info("[testcommonBackgroundBlurStyle001] component borderImage strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + + let targetValue = { + source: { + angle: 90, + direction: GradientDirection.Left, + colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]] + }, + slice: { + top: 10, bottom: 10, left: 10, right: 10 + }, + width: { + top: "10px", bottom: "10px", left: "10px", right: "10px" + }, + repeat: RepeatMode.Stretch, + fill: false + }; + expect(obj.$attrs.borderImage).assertEqual(undefined); + console.info("[testcommonBackgroundBlurStyle001] borderImage value :" + JSON.stringify(obj.$attrs.borderImage)); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_002 + * @tc.name testcommonBackgroundBlurStyle002 + * @tc.desic acecommonBackgroundBlurStyleEtsTest002 + */ + it('testcommonBackgroundBlurStyle002', 0, async function (done) { + console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('tabIndexText'); + console.info("[testcommonBackgroundBlurStyle002] component tabIndex strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.tabIndex).assertEqual(undefined); + console.info("[testcommonBackgroundBlurStyle002] tabIndex value :" + obj.$attrs.textAlign); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_003 + * @tc.name testcommonBackgroundBlurStyle003 + * @tc.desic acecommonBackgroundBlurStyleEtsTest003 + */ + it('testcommonBackgroundBlurStyle003', 0, async function (done) { + console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('sepiaText'); + console.info("[testcommonBackgroundBlurStyle003] component sepia strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.sepia).assertEqual(1); + console.info("[testcommonBackgroundBlurStyle003] sepia value :" + obj.$attrs.sepia); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_004 + * @tc.name testcommonBackgroundBlurStyle004 + * @tc.desic acecommonBackgroundBlurStyleEtsTest004 + */ + it('testcommonBackgroundBlurStyle004', 0, async function (done) { + console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('alignRulesText'); + console.info("[testcommonBackgroundBlurStyle004] component alignRules strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + let targetValue = { + top: { + anchor: 'target', align: VerticalAlign.Bottom + }, + right: { + anchor: "target", align: HorizontalAlign.Center + } + }; + expect(obj.$attrs.alignRules).assertEqual(undefined); + console.info("[testcommonBackgroundBlurStyle004] alignRules value :" + JSON.stringify(obj.$attrs.alignRules)); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_005 + * @tc.name testcommonBackgroundBlurStyle005 + * @tc.desic acecommonBackgroundBlurStyleEtsTest005 + */ + it('testcommonBackgroundBlurStyle005', 0, async function (done) { + console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('backgroundBlurStyleText'); + console.info("[testcommonBackgroundBlurStyle005] component backgroundBlurStyle strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$attrs.backgroundBlurStyle).assertEqual(undefined); + console.info("[testcommonBackgroundBlurStyle005] backgroundBlurStyle value :" + obj.$attrs.backgroundBlurStyle); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_006 + * @tc.name testcommonBackgroundBlurStyle006 + * @tc.desic acecommonBackgroundBlurStyleEtsTest006 + */ + it('testcommonBackgroundBlurStyle006', 0, async function (done) { + console.info('commonBackgroundBlurStyle testcommonBackgroundBlurStyle006 START'); + console.info("common onKeyEvent click result is: " + JSON.stringify(sendEventByKey('onKeyEventButton', 10, ""))); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testcommonHoverEffectHighlight0006 + * @tc.desic acecommonHoverEffectHighlightEtsTest0006 + */ + it('testcommonHoverEffectHighlight0001', 0, async function (done) { + console.info('commonHoverEffectHighlight testcommonHoverEffectHighlight0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('hoverEffectText'); + console.info("[testcommonHoverEffectHighlight0001] component hoverEffect strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$attrs.hoverEffect).assertEqual(undefined); + console.info("[testcommonHoverEffectHighlight0001] hoverEffect value :" + obj.$attrs.hoverEffect); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testcommonHoverEffectScale0007 + * @tc.desic acecommonHoverEffectScaleEtsTest0007 + */ + it('testcommonHoverEffectScale0001', 0, async function (done) { + console.info('commonHoverEffectScale testcommonHoverEffectScale0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('hoverEffectScaleText'); + console.info("[testcommonHoverEffectScale0001] component hoverEffect strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$attrs.hoverEffect).assertEqual(undefined); + console.info("[testcommonHoverEffectScale0001] hoverEffect value :" + obj.$attrs.hoverEffect); + done(); + }); + + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/common_ts_ets_api.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/common_ts_ets_api.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0f3b42d3c4370f5f178c8050f42f24dcfd57578c --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/common_ts_ets_api.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 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 common_ts_ets_apiStaticClearJsunit() { + describe('common_ts_ets_apiStaticClearTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/common_ts_ets_api', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get common_ts_ets_api state success " + JSON.stringify(pages)); + if (!("common_ts_ets_api" == pages.name)) { + console.info("get common_ts_ets_api state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push common_ts_ets_api page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push common_ts_ets_api page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("common_ts_ets_apiStaticClear after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testcommon_ts_ets_apiPersistProp0001 + * @tc.desic acecommon_ts_ets_apiPersistPropEtsTest0001 + */ + it('testcommon_ts_ets_apiPersistProp0001', 0, async function (done) { + console.info('common_ts_ets_apiPersistProp testcommon_ts_ets_apiPersistProp0001 START'); + await Utils.sleep(2000); + try { + var innerEvent = { + eventId: 60230, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("common_ts_ets_apiPersistProp0001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.Score).assertEqual("Score"); + done() + } + console.info("PersistProp0001 click result is: " + JSON.stringify(sendEventByKey('PersistPropText', 10, ""))); + events_emitter.on(innerEvent, callback); + } catch (err) { + console.info("common_ts_ets_apiPersistProp0001 on events_emitter err : " + JSON.stringify(err)); + } + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testcommon_ts_ets_apiEnvProp0001 + * @tc.desic acecommon_ts_ets_apiEnvPropEtsTest0001 + */ + it('testcommon_ts_ets_apiEnvProp0001', 0, async function (done) { + console.info('common_ts_ets_apiEnvProp testcommon_ts_ets_apiEnvProp0001 START'); + await Utils.sleep(2000); + try { + var innerEvent = { + eventId: 60231, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("common_ts_ets_apiEnvProp0001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.Result).assertEqual(false); + done() + } + console.info("EnvProp0001 click result is: " + JSON.stringify(sendEventByKey('EnvPropText', 10, ""))); + events_emitter.on(innerEvent, callback); + } catch (err) { + console.info("common_ts_ets_apiEnvProp0001 on events_emitter err : " + JSON.stringify(err)); + } + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/curves.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/curves.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b88e91194994842e54df01ecec234eff0aa5666b --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/curves.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 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 curvesStepsJsunit() { + describe('curvesStepsTest', function () { + + /** + * run before testcase + */ + beforeAll(async function (done) { + console.info('[curvesStepsTest] before each called') + + let result; + let options = { + uri: 'pages/curves' + } + try { + result = router.push(options) + console.info("push curves page success " + JSON.stringify(result)); + } catch (err) { + console.error("push curves page error " + JSON.stringify(result)); + } + await Utils.sleep(4000) + done() + }); + + /** + * run after testcase + */ + afterAll(async function () { + console.info('[curvesStepsTest] after each called') + await Utils.sleep(1000) + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testcurvesSteps0001 + * @tc.desic acecurvesStepsEtsTest0001 + */ + it('testcurvesSteps0001', 0, async function (done) { + console.info('curvesSteps testcurvesSteps0001 START'); + var innerEvent = { + eventId: 60229, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + try{ + console.info("callback success" ); + console.info("curveApi eventData.data.curveApi result is: " + eventData.data.curveApi); + expect(eventData.data.curveApi).assertEqual("callBackSuccess"); + console.info("curveApi end"); + }catch(err){ + console.info("curveApi on events_emitter err : " + JSON.stringify(err)); + } + done(); + } + try{ + console.info("curveApi click result is: " + JSON.stringify(sendEventByKey('stepsText', 10, ""))); + events_emitter.on(innerEvent, callback); + }catch(err){ + console.info("curveApi on events_emitter err : " + JSON.stringify(err)); + } + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/ellipse.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/ellipse.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e0ec74a398c381554af21da2acf80478d6f98616 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/ellipse.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 ellipseNeJsunit() { + describe('ellipseNeTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/ellipse', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get ellipse state success " + JSON.stringify(pages)); + if (!("ellipse" == pages.name)) { + console.info("get ellipse state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push ellipse page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push ellipse page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("ellipseNe after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testellipseNe0001 + * @tc.desic aceellipseNeEtsTest0001 + */ + it('testellipseNe0001', 0, async function (done) { + console.info('ellipseNe testellipseNe0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ellipse'); + console.info("[testellipseNe0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.width).assertEqual("300.00px"); + console.info("[testellipseNe0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testellipseNe0002 + * @tc.desic aceellipseNeEtsTest0002 + */ + it('testellipseNe0002', 0, async function (done) { + console.info('ellipseNe testellipseNe0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ellipse'); + console.info("[testellipseNe0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.height).assertEqual("300.00px"); + console.info("[testellipseNe0002] height value :" + obj.$attrs.height); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/featureAbility.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/featureAbility.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f62604e03f4e86c095c7153b659433aac35ff0ac --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/featureAbility.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 featureAbilityStartAbilityJsunit() { + describe('featureAbilityStartAbilityTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/featureAbility', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get featureAbility state success " + JSON.stringify(pages)); + if (!("featureAbility" == pages.name)) { + console.info("get featureAbility state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push featureAbility page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push featureAbility page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("featureAbilityStartAbility after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testfeatureAbilityStartAbility0001 + * @tc.desic acefeatureAbilityStartAbilityEtsTest0001 + */ + it('testfeatureAbilityStartAbility0001', 0, async function (done) { + console.info('featureAbilityStartAbility testfeatureAbilityStartAbility0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('startAbilityText'); + console.info("[testfeatureAbilityStartAbility0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("320.00vp"); + console.info("[testfeatureAbilityStartAbility0001] width value :" + obj.$attrs.width); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/gauge.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/gauge.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d536a37a54b6d2b2de62e596863b58ca83d7675 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/gauge.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 gaugeColorsJsunit() { + describe('gaugeColorsTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/gauge', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get gauge state success " + JSON.stringify(pages)); + if (!("gauge" == pages.name)) { + console.info("get gauge state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push gauge page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push gauge page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("gaugeColors after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testgaugeColors0001 + * @tc.desic acegaugeColorsEtsTest0001 + */ + it('testgaugeColors0001', 0, async function (done) { + console.info('gaugeColors testgaugeColors0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Gauge'); + console.info("[testgaugeColors0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Gauge'); + expect(obj.$attrs.width).assertEqual("200.00vp"); + console.info("[testgaugeColors0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testgaugeColors0002 + * @tc.desic acegaugeColorsEtsTest0002 + */ + it('testgaugeColors0002', 0, async function (done) { + console.info('gaugeColors testgaugeColors0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Gauge'); + console.info("[testgaugeColors0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Gauge'); + expect(obj.$attrs.height).assertEqual("200.00vp"); + console.info("[testgaugeColors0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testgaugeColors0003 + * @tc.desic acegaugeColorsEtsTest0003 + */ + it('testgaugeColors0003', 0, async function (done) { + console.info('gaugeColors testgaugeColors0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Gauge'); + console.info("[testgaugeColors0003] component startAngle strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Gauge'); + expect(obj.$attrs.startAngle).assertEqual("210.00"); + console.info("[testgaugeColors0003] startAngle value :" + obj.$attrs.startAngle); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testgaugeColors0004 + * @tc.desic acegaugeColorsEtsTest0004 + */ + it('testgaugeColors0004', 0, async function (done) { + console.info('gaugeColors testgaugeColors0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Gauge'); + console.info("[testgaugeColors0004] component endAngle strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Gauge'); + expect(obj.$attrs.endAngle).assertEqual("150.00"); + console.info("[testgaugeColors0004] endAngle value :" + obj.$attrs.endAngle); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testgaugeColors0005 + * @tc.desic acegaugeColorsEtsTest0005 + */ + it('testgaugeColors0005', 0, async function (done) { + console.info('gaugeColors testgaugeColors0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Gauge'); + console.info("[testgaugeColors0005] component strokeWidth strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Gauge'); + expect(obj.$attrs.strokeWidth).assertEqual("20.00vp"); + console.info("[testgaugeColors0005] strokeWidth value :" + obj.$attrs.strokeWidth); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testgaugeColors0006 + * @tc.desic acegaugeColorsEtsTest0006 + */ + it('testgaugeColors0006', 0, async function (done) { + console.info('gaugeColors testgaugeColors0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Gauge'); + console.info("[testgaugeColors0006] component colors strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Gauge'); + expect(obj.$attrs.colors).assertEqual('["#FF317AF7","#FF5BA854","#FFE08C3A","#FF9C554B","#FFD94838"]'); + console.info("[testgaugeColors0006] colors value :" + obj.$attrs.colors); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/gesture.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/gesture.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b5859c8793b8d35a775a2581e4f840dbace13fbe --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/gesture.test.ets @@ -0,0 +1,128 @@ +/** + * 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 gestureSetDirectionJsunit() { + describe('gestureSetDirectionTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/gesture', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get gesture state success " + JSON.stringify(pages)); + if (!("gesture" == pages.name)) { + console.info("get gesture state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push gesture page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push gesture page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("gestureSetDirection after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testgestureSetDirection0001 + * @tc.desic acegestureSetDirectionEtsTest0001 + */ + it('testgestureSetDirection0001', 0, async function (done) { + console.info('gestureSetDirection testgestureSetDirection0001 START'); + await Utils.sleep(2000); + try{ + let callback = (indexEvent) => { + console.info("onClick_0001 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.STATUS).assertEqual(PanDirection.Vertical); + } + let indexEvent = { + eventId: 60204, + priority: events_emitter.EventPriority.LOW + } + sendEventByKey('setDirectionPanGesture', 10, "") + events_emitter.on(indexEvent, callback); + }catch(err){ + console.info("onClick_0001 on events_emitter err : " + JSON.stringify(err)); + } + console.info('gestureSetDirection testgestureSetDirection0002 END') + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testgestureSetDistance0002 + * @tc.desic acegestureSetDistanceEtsTest0002 + */ + it('testgestureSetDistance0002', 0, async function (done) { + console.info('gestureSetDistance testgestureSetDistance0002 START'); + await Utils.sleep(2000); + try{ + let callback = (indexEvent) => { + console.info("onClick_0002 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.STATUS).assertEqual(4.0); + } + let indexEvent = { + eventId: 60205, + priority: events_emitter.EventPriority.LOW + } + sendEventByKey('setDistancePanGesture', 10, "") + events_emitter.on(indexEvent, callback); + }catch(err){ + console.info("onClick_0002 on events_emitter err : " + JSON.stringify(err)); + } + console.info('gestureSetDistance testgestureSetDistance0002 END'); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testgestureSetFingers0003 + * @tc.desic acegestureSetFingersEtsTest0003 + */ + it('testgestureSetFingers0003', 0, async function (done) { + console.info('gestureSetFingers testgestureSetFingers0003 START'); + await Utils.sleep(2000); + try{ + let callback = (indexEvent) => { + console.info("onClick_0003 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.STATUS).assertEqual(true); + } + let indexEvent = { + eventId: 60206, + priority: events_emitter.EventPriority.LOW + } + sendEventByKey('setFingersPanGesture', 10, "") + events_emitter.on(indexEvent, callback); + }catch(err){ + console.info("onClick_0003 on events_emitter err : " + JSON.stringify(err)); + } + console.info('gestureSetFingers testgestureSetFingers0003 END'); + done(); + }); + + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/global.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/global.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5e2cbde4c685427a7f37c5f6407fdb88136fb1c0 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/global.test.ets @@ -0,0 +1,93 @@ +/** + * 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 globalJsunit() { + describe('globalJsunit', function () { + beforeEach(async function (done) { + console.info("global beforeEach start"); + let options = { + uri: 'pages/global', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get global state pages:" + JSON.stringify(pages)); + if (!("global" == pages.name)) { + console.info("get global state pages.name:" + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push global page result:" + JSON.stringify(result)); + } + } catch (err) { + console.error("push global page error:" + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testglobal_getInspectorTree0001 + * @tc.desic aceGlobal_getInspectorTree0001 + */ + it('testglobal_getInspectorTree0001', 0, async function (done) { + console.info('testglobal_getInspectorTree0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorTree(); + console.info("[testglobal_getInspectorTree0001] strJson:" + strJson); + expect(strJson !== null).assertTrue(); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testglobal_sendKeyEvent0002 + * @tc.desic aceGlobal_sendKeyEvent0002 + */ + it('testglobal_sendKeyEvent0002', 0, async function (done) { + console.info('testglobal_sendKeyEvent0002 START'); + await Utils.sleep(2000); + let KeyEvent = {type:1,keyCode:2027,keyText:"Unknown",keySource:4,deviceId:7,metaKey:0,timestamp:5284417765376}; + let result = sendKeyEvent(KeyEvent); + console.info("[testglobal_sendKeyEvent0002] result:" + result); + expect(JSON.stringify(result)).assertEqual("true"); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testglobal_sendMouseEvent0003 + * @tc.desic aceGlobal_sendMouseEvent0003 + */ + it('testglobal_sendMouseEvent0003', 0, async function (done) { + console.info('testglobal_sendMouseEvent0003 START'); + await Utils.sleep(2000); + let mouseEvent = {button:0,action:3,screenX:202.66666666666666,screenY:102.66666666666667,x:34,y:34,timestamp:8261302454000,source:1, + target:{area:{position:{x:158.66666666666666,y:58.666666666666664},globalPosition:{x:168.66666666666666,y:68.66666666666666},width:142.66666666666666,height:58.666666666666664}}}; + let result = sendMouseEvent(mouseEvent); + console.info("[testglobal_sendMouseEvent0003] result:" + result); + expect(JSON.stringify(result)).assertEqual("true"); + done(); + }); + }) +} \ 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..62ea6348b9b60b90400d38c2152ecbe26488703e --- /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: 60207, + 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/grid_col.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/grid_col.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..13bbd28b904957798da51e9508a1aeaf94f3abb4 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/grid_col.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 grid_colSpanJsunit() { + describe('grid_colSpanTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/grid_col', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get grid_col state success " + JSON.stringify(pages)); + if (!("grid_col" == pages.name)) { + console.info("get grid_col state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push grid_col page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push grid_col page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("grid_colSpan after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testgrid_colSpan0001 + * @tc.desic acegrid_colSpanEtsTest0001 + */ + it('testgrid_colSpan0001', 0, async function (done) { + console.info('grid_rowOnBreakpointChange testgrid_colSpan0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('gridContainer'); + console.info("[testgrid_colSpan0001] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('GridCol'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testgrid_colSpan0001] width value :" + obj.$attrs.width); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/grid_row.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/grid_row.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..26ce142740b502d35bde75e70285f52a53e268b2 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/grid_row.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 grid_rowOnBreakpointChangeJsunit() { + describe('grid_rowOnBreakpointChangeTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/grid_row', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get grid_row state success " + JSON.stringify(pages)); + if (!("grid_row" == pages.name)) { + console.info("get grid_row state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push grid_row page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push grid_row page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("grid_rowOnBreakpointChange after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_001 + * @tc.name testgrid_rowOnBreakpointChange001 + * @tc.desic acegrid_rowOnBreakpointChangeEtsTest001 + */ + it('testgrid_rowOnBreakpointChange001', 0, async function (done) { + console.info('grid_rowOnBreakpointChange testgrid_rowOnBreakpointChange001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('GridRow'); + console.info("[testgrid_rowOnBreakpointChange001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('GridRow'); + expect(obj.$attrs.width).assertEqual("100vp"); + console.info("[testgrid_rowOnBreakpointChange001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_002 + * @tc.name testgrid_rowOnBreakpointChange002 + * @tc.desic acegrid_rowOnBreakpointChangeEtsTest002 + */ + it('testgrid_rowOnBreakpointChange002', 0, async function (done) { + console.info('grid_rowOnBreakpointChange testgrid_rowOnBreakpointChange002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('GridRow'); + console.info("[testgrid_rowOnBreakpointChange002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('GridRow'); + expect(obj.$attrs.height).assertEqual("100vp"); + console.info("[testgrid_rowOnBreakpointChange002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_003 + * @tc.name testgrid_rowOnBreakpointChange003 + * @tc.desic acegrid_rowOnBreakpointChangeEtsTest003 + */ + it('testgrid_rowOnBreakpointChange003', 0, async function (done) { + console.info('grid_rowOnBreakpointChange testgrid_rowOnBreakpointChange003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('GridRow'); + console.info("[testgrid_rowOnBreakpointChange003] component backgroundColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('GridRow'); + expect(obj.$attrs.backgroundColor).assertEqual("0xFF0000"); + console.info("[testgrid_rowOnBreakpointChange003] backgroundColor value :" + obj.$attrs.backgroundColor); + 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..7e069eeed4342bf4795a7bd31d74464b14698e2c --- /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: 60208, + 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: 60209, + 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: 60211, + 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: 60210, + priority: events_emitter.EventPriority.LOW + } + var callback3 = (eventData) => { + try{ + console.info("callback3 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..b7843c5e44f2cb038e08470d3e069dcef9edf08d --- /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: 60212, + 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: 60213, + 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: 60214, + 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: 60215, + 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/line.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/line.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a97b85248d8dac9093a3ae28a56a8642941268e7 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/line.test.ets @@ -0,0 +1,116 @@ +/** + * 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 lineNeJsunit() { + describe('lineNeTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/line', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get line state success " + JSON.stringify(pages)); + if (!("line" == pages.name)) { + console.info("get line state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push line page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push line page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("lineNe after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testlineNe0001 + * @tc.desic acelineNeEtsTest0001 + */ + it('testlineNe0001', 0, async function (done) { + console.info('lineNe testlineNe0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('line1'); + console.info("[testlineNe0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.width).assertEqual("75.00px"); + console.info("[testlineNe0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testlineNe0002 + * @tc.desic acelineNeEtsTest0002 + */ + it('testlineNe0002', 0, async function (done) { + console.info('lineNe testlineNe0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('line1'); + console.info("[testlineNe0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.height).assertEqual("150.00px"); + console.info("[testlineNe0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testlineNe0005 + * @tc.desic acelineNeEtsTest0005 + */ + it('testlineNe0005', 0, async function (done) { + console.info('lineNe testlineNe0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('line2'); + console.info("[testlineNe0005] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.width).assertEqual("300.00px"); + console.info("[testlineNe0005] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testlineNe0006 + * @tc.desic acelineNeEtsTest0006 + */ + it('testlineNe0006', 0, async function (done) { + console.info('lineNe testlineNe0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('line2'); + console.info("[testlineNe0006] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Shape'); + expect(obj.$attrs.height).assertEqual("300.00px"); + console.info("[testlineNe0006] height value :" + obj.$attrs.height); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/listTest.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/listTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..83a3668e78ebb7c00baa571a1113a9ae9d2f5621 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/listTest.test.ets @@ -0,0 +1,181 @@ +/** + * 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 listNewJsunit() { + describe('listNewJsunit', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/list', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get list state success " + JSON.stringify(pages)); + if (!("list" == pages.name)) { + console.info("get list state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push list page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push list page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("listNe after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testListNew0001 + * @tc.desic acelistNewEtsTest0001 + */ + it('testListNew0001', 0, async function (done) { + console.info('listNe testListNew0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('list1'); + console.info("[testListNew0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('List'); + expect(obj.$attrs.width).assertEqual("90.00%"); + console.info("[testListNew0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testListNe0002 + * @tc.desic acelistNeEtsTest0002 + */ + it('testListNe0002', 0, async function (done) { + console.info('listNe testListNe0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('list1'); + console.info("[testListNe0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('List'); + expect(obj.$attrs.height).assertEqual("300.00vp"); + console.info("[testListNe0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testListNe0003 + * @tc.desic acelistNeEtsTest0003 + */ + it('testListNe0003', 0, async function (done) { + console.info('listNe testListNe0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('list1'); + console.info("[testListNe0003] component editMode strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('List'); + expect(obj.$attrs.editMode).assertEqual("true"); + console.info("[testListNe0003] editMode value :" + obj.$attrs.editMode); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testListNe0004 + * @tc.desic acelistNeEtsTest0004 + */ + it('testListNe0004', 0, async function (done) { + console.info('listNe testListNe0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('list1'); + console.info("[testListNe0004] component alignListItem strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('List'); + expect(obj.$attrs.alignListItem).assertEqual(undefined); + console.info("[testListNe0004] alignListItem value :" + obj.$attrs.alignListItem); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testListNe0006 + * @tc.desic acelistNeEtsTest0006 + */ + it('testListNe0006', 0, async function (done) { + console.info('listNe testListNe0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('list1'); + console.info("[testListNe0006] component lanes strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('List'); + expect(obj.$attrs.lanes).assertEqual(undefined); + console.info("[testListNe0006] lanes value :" + obj.$attrs.lanes); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testListNe0006 + * @tc.desic acelistNeEtsTest0006 + */ + it('testListNe0006', 0, async function (done) { + console.info('listNe testListNe0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('list1'); + console.info("[testListNe0006] component lanes strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('List'); + expect(obj.$attrs.lanes).assertEqual(undefined); + console.info("[testListNe0006] lanes value :" + obj.$attrs.lanes); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testListNe0007 + * @tc.desic acelistNeEtsTest0007 + */ + it('testListNe0007', 0, async function (done) { + console.info('listNe testListNe0007 START'); + var innerEvent = { + eventId: 60216, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + try{ + console.info("callback success" ); + console.info("testListNe0007 eventData.data.result result is: " + eventData.data.result); + expect(eventData.data.result).assertEqual("success"); + console.info("testListNe0007 end"); + }catch(err){ + console.info("testListNe0007 on events_emitter err : " + JSON.stringify(err)); + } + } + try{ + console.info("testListNe0007 click result is: " + JSON.stringify(sendEventByKey('onScrollBegin', 10, ""))); + events_emitter.on(innerEvent, callback); + }catch(err){ + console.info("testListNe0007 on events_emitter err : " + JSON.stringify(err)); + } + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/list_item.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/list_item.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f10dc1c67a892377be8877d287b0da08a02e8d7f --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/list_item.test.ets @@ -0,0 +1,113 @@ +/** + * 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 list_itemOnSelectJsunit() { + describe('list_itemOnSelectTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/list_item', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get list_item state success " + JSON.stringify(pages)); + if (!("list_item" == pages.name)) { + console.info("get list_item state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push list_item page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push list_item page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("list_itemOnSelect after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testlist_itemOnSelect0001 + * @tc.desic acelist_itemOnSelectEtsTest0001 + */ + it('testlist_itemOnSelect0001', 0, async function (done) { + console.info('selectOnSelect testlist_itemOnSelect0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ListItem'); + console.info("[testlist_itemOnSelect0001] component border strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('ListItem'); + expect(obj.$attrs.editable).assertEqual("true"); + console.info("[testlist_itemOnSelect0001] editable value :" + obj.$attrs.editable); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testlist_itemOnSelect0002 + * @tc.desic acelist_itemOnSelectEtsTest0002 + */ + it('testlist_itemOnSelect0002', 0, async function (done) { + console.info('selectOnSelect testlist_itemOnSelect0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ListItem'); + console.info("[testlist_itemOnSelect0002] component border strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('ListItem'); + expect(obj.$attrs.selectable).assertEqual(undefined); + console.info("[testlist_itemOnSelect0002] selectable value :" + obj.$attrs.selectable); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testlist_itemOnSelect0003 + * @tc.desic acelist_itemOnSelectEtsTest0002 + */ + it('testlist_itemOnSelect0003', 0, async function (done) { + console.info('selectOnSelect testlist_itemOnSelect0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ListItem'); + console.info("[testlist_itemOnSelect0003] component border strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('ListItem'); + expect(obj.$attrs.sticky).assertEqual("Sticky.None"); + console.info("[testlist_itemOnSelect0003] sticky value :" + obj.$attrs.sticky); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testlist_itemSwipeAction0004 + * @tc.desic acelist_itemSwipeActionEtsTest0004 + */ + it('testlist_itemSwipeAction0004', 0, async function (done) { + console.info('selectOnSelect testlist_itemSwipeAction0004 START'); + await Utils.sleep(2000); + let obj = JSON.stringify(sendEventByKey('Del', 10, "")) + expect(obj).assertEqual('false'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/mediaQuery.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/mediaQuery.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4db15026871176dcea7f84edbd896b8c7a4c46e --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/mediaQuery.test.ets @@ -0,0 +1,257 @@ +/** + * 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 mediaQueryOffJsunit() { + describe('mediaQueryOffTest', function () { + + /** + * run before testcase + */ + beforeAll(async function (done) { + console.info('[mediaQueryOffTest] before each called') + + let result; + let options = { + uri: 'pages/mediaQuery' + } + try { + result = router.push(options) + console.info("push mediaQuery page success " + JSON.stringify(result)); + } catch (err) { + console.error("push mediaQuery page error " + JSON.stringify(result)); + } + await Utils.sleep(4000) + done() + }); + + /** + * run after testcase + */ + afterAll(async function () { + console.info('[mediaQueryOffTest] after each called') + await Utils.sleep(1000) + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testmediaQueryOff0001 + * @tc.desic acemediaQueryOffEtsTest0001 + */ + it('testmediaQueryOff0001', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testmediaQueryOff0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testmediaQueryOff0002 + * @tc.desic acemediaQueryOffEtsTest0002 + */ + it('testmediaQueryOff0002', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testmediaQueryOff0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testmediaQueryOff0003 + * @tc.desic acemediaQueryOffEtsTest0003 + */ + it('testmediaQueryOff0003', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testmediaQueryOff0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testmediaQueryOff0004 + * @tc.desic acemediaQueryOffEtsTest0004 + */ + it('testmediaQueryOff0004', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testmediaQueryOff0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testmediaQueryOff0005 + * @tc.desic acemediaQueryOffEtsTest0005 + */ + it('testmediaQueryOff0005', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testmediaQueryOff0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testmediaQueryOff0006 + * @tc.desic acemediaQueryOffEtsTest0006 + */ + it('testmediaQueryOff0006', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testmediaQueryOff0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testmediaQueryOff0007 + * @tc.desic acemediaQueryOffEtsTest0007 + */ + it('testmediaQueryOff0007', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testmediaQueryOff0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testmediaQueryOff0009 + * @tc.desic acemediaQueryOffEtsTest0009 + */ + it('testmediaQueryOff0009', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testmediaQueryOff0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testmediaQueryOff0010 + * @tc.desic acemediaQueryOffEtsTest0010 + */ + it('testmediaQueryOff0010', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testmediaQueryOff0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0011 + * @tc.name testmediaQueryOff0011 + * @tc.desic acemediaQueryOffEtsTest0011 + */ + it('testmediaQueryOff0011', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff0011 START'); + await Utils.sleep(2000); + try { + var innerEventOne = { + eventId: 60218, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("onRequestPopupData_0012 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + } + console.info("onSelect_0012 click result is: " + JSON.stringify(sendEventByKey('offText', 10, ""))); + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("onRequestPopupData_0012 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testmediaQueryOff0011 END'); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testmatchMediaSync0001 + * @tc.desic acetestmatchMediaSyncEtsTest0001 + */ + it('testmatchMediaSync0001', 0, async function (done) { + console.info('matchMediaSync testmatchMediaSync0001 START'); + await Utils.sleep(2000); + try { + var innerEventOne = { + eventId: 60219, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("onRequestPopupData_0012 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + } + console.info("onSelect_0012 click result is: " + JSON.stringify(sendEventByKey('matchMediaSyncText', 10, ""))); + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("onRequestPopupData_0012 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testmatchMediaSync0001 END'); + done(); + }); + }) +} 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/pageRoute.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/pageRoute.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..fac4fc55c035f646fafff3627baef2740edb0cc8 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/pageRoute.test.ets @@ -0,0 +1,70 @@ +/** + * 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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import router from '@system.router'; +import events_emitter from '@ohos.events.emitter' +import Utils from './Utils' + +export default function pageRouteTest() { + describe('pageRouteTest', function () { + beforeEach(async function (done) { + console.info("pageRouteTest beforeEach start"); + let options = { + uri: 'pages/pageRoute', + } + let result; + try { + router.clear(); + let pages = router.getState(); + console.info("get pageRouteTest pages: " + JSON.stringify(pages)); + if (!("pageRoute" == pages.name)) { + console.info("get pageRouteTest pages.name: " + JSON.stringify(pages.name)); + result = await router.push(options); + await Utils.sleep(2000); + console.info("pageRouteTest page result: " + JSON.stringify(result)); + } + } catch (err) { + console.error("pageRouteTest page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("pageRouteTest after each called"); + }) + + it('testOnPageHide01', 0, async function (done) { + console.info('[testOnPageHide01] START'); + var callback = (eventData) => { + console.info("[testOnPageHide01] get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.value).assertEqual('onPageHide') + done(); + } + var innerEvent = { + eventId: 10, + priority: events_emitter.EventPriority.LOW + } + try { + events_emitter.on(innerEvent, callback) + console.info("testOnPageHide01 click result is: " + JSON.stringify(sendEventByKey('next', 10, ""))); + } catch (err) { + console.info("[testOnPageHide01] on events_emitter err : " + JSON.stringify(err)); + } + console.info('[testOnPageHide01] testSendTouchEvent END'); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/panel.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/panel.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..07d434e17712d6c5d0703b7af9c1b368ee92fd27 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/panel.test.ets @@ -0,0 +1,97 @@ +/** + * 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 panelBackgroundMaskJsunit() { + describe('panelBackgroundMaskTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/panel', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get panel state success " + JSON.stringify(pages)); + if (!("panel" == pages.name)) { + console.info("get panel state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push panel page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push panel page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("panelBackgroundMask after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testpanelBackgroundMask0001 + * @tc.desic acepanelBackgroundMaskEtsTest0001 + */ + it('testpanelBackgroundMask0001', 0, async function (done) { + console.info('panelBackgroundMask testpanelBackgroundMask0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('panel'); + let obj = JSON.parse(strJson); + console.info("get inspector value is: " + JSON.stringify(obj)); + console.log(JSON.stringify(obj.$type)) + expect(obj.$type).assertEqual('Panel') + console.log('Panel‘s backgroundMask is ' + JSON.stringify(obj.$attrs.backgroundMask)) + expect(obj.$attrs.backgroundMask).assertEqual('#FFFF0000'); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testpanelOnHeightChange0002 + * @tc.desic acepanelBackgroundMaskEtsTest0002 + */ + it('testpanelOnHeightChange0002', 0, async function (done) { + console.info('panelBackgroundMask testpanelOnHeightChange0002 START'); + var panelOnHeightChangeEvent = { + eventId: 10111, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (backData) => { + console.info("testpanelOnHeightChange0002 backData.data.result is: " + backData.data.result); + try{ + console.info("testpanelOnHeightChange0002 callback1 success" ); + expect(backData.data.result).assertEqual("success"); + done(); + }catch(err){ + console.info("testpanelOnHeightChange0002 on events_emitter err : " + JSON.stringify(err)); + } + } + try { + console.info("testpanelOnHeightChange0002 click result is: " + JSON.stringify(sendEventByKey('onHeightChangeText', 10, ""))); + events_emitter.on(panelOnHeightChangeEvent, callback1); + } catch (err) { + console.info("testpanelOnHeightChange0002 on events_emitter err : " + JSON.stringify(err)); + } + }); + + }) +} 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..53d8c756b002df03d66d5b886ae26d137f618e08 --- /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("100.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("100.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..1f871bf4713138bb3cb70684378ddfe13f8f0c9c --- /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("100.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("100.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..24d6c478f48d7cf54d67271e5eee6dc85cc9f055 --- /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("100.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("100.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/prompt.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/prompt.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..459ef283f67d03cce873afa1605f66f1a0c1be12 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/prompt.test.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 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 promptShowDialogJsunit() { + describe('promptShowDialogTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/prompt', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get prompt state success " + JSON.stringify(pages)); + if (!("prompt" == pages.name)) { + console.info("get prompt state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push prompt page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push prompt page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("promptShowDialog after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_001 + * @tc.name testpromptShowDialog001 + * @tc.desic acepromptShowDialogEtsTest001 + */ + it('testpromptShowDialog001', 0, async function (done) { + console.info('promptShowDialog testpromptShowDialog001 START'); + await Utils.sleep(1000); + try { + var innerEventOne = { + eventId: 60220, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testpromptShowDialog001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + done(); + } + console.info("onSelect_001 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, ""))); + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("testpromptShowDialog001 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testpromptShowDialog001 END'); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_002 + * @tc.name testshowActionMenu0001 + * @tc.desic aceshowActionMenuEtsTest0001 + */ + it('testshowActionMenu0001', 0, async function (done) { + console.info('promptShowDialog testshowActionMenu0001 START'); + await Utils.sleep(1000); + try { + var innerEventTwo = { + eventId: 60221, + priority: events_emitter.EventPriority.LOW + } + var callback2 = (backData1) => { + console.info("onRequestPopupData_0011 get event state result is: " + JSON.stringify(backData1)); + expect(backData1.data.STATUS).assertEqual(true); + done(); + } + console.info("onSelect_002 click result is: " + JSON.stringify(sendEventByKey('showActionMenuText', 10, ""))); + events_emitter.on(innerEventTwo, callback2); + } catch (err) { + console.info("onRequestPopupData_0011 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testshowActionMenu0001 END'); + }); + }) +} 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..10604cdf8e57a4256924de2e4762fcabe2b217cf --- /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("50.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/select.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/select.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bbefe189d4fc7e9672cc7b5c1db22b77cffd6d5e --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/select.test.ets @@ -0,0 +1,83 @@ +/** + * 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 selectOnSelectJsunit() { + describe('selectOnSelectTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/select', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get select state success " + JSON.stringify(pages)); + if (!("select" == pages.name)) { + console.info("get select state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push select page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push select page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("selectOnSelect after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testselectOnSelect0001 + * @tc.desic aceselectOnSelectEtsTest0001 + */ + it('testselectOnSelect0001', 0, async function (done) { + console.info('selectOnSelect testselectOnSelect0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Select'); + console.info("[testselectOnSelect0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Select'); + expect(obj.$attrs.selected).assertEqual("2"); + console.info("[testselectOnSelect0001] selected value :" + obj.$attrs.selected); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testselectOnSelect0002 + * @tc.desic aceselectOnSelectEtsTest0002 + */ + it('testselectOnSelect0002', 0, async function (done) { + console.info('selectOnSelect testselectOnSelect0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Select'); + console.info("[testselectOnSelect0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Select'); + expect(obj.$attrs.value).assertEqual("TTT"); + console.info("[testselectOnSelect0002] height value :" + obj.$attrs.height); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/sideBar.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/sideBar.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..991bec94f35e9ed7c7bba74be637a966c82063c2 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/sideBar.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 sideBarShowSideBarJsunit() { + describe('sideBarShowSideBarTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/sideBar', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get sideBar state success " + JSON.stringify(pages)); + if (!("sideBar" == pages.name)) { + console.info("get sideBar state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push sideBar page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push sideBar page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("sideBarShowSideBar after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testsideBarShowSideBar0001 + * @tc.desic acesideBarShowSideBarEtsTest0001 + */ + it('testsideBarShowSideBar0001', 0, async function (done) { + console.info('sideBarShowSideBar testsideBarShowSideBar0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('SideBarContainer'); + console.info("[testsideBarShowSideBar0001] component showSideBar strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('SideBarContainer'); + expect(obj.$attrs.showSideBar).assertEqual("true"); + console.info("[testsideBarShowSideBar0001] showSideBar value :" + obj.$attrs.showSideBar); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testsideBarShowSideBar0002 + * @tc.desic acesideBarShowSideBarEtsTest0002 + */ + it('testsideBarShowSideBar0002', 0, async function (done) { + console.info('sideBarShowSideBar testsideBarShowSideBar0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('SideBarContainer'); + console.info("[testsideBarShowSideBar0002] component autoHide strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('SideBarContainer'); + expect(obj.$attrs.autoHide).assertEqual(undefined); + console.info("[testsideBarShowSideBar0002] autoHide value :" + obj.$attrs.autoHide); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testsideBarShowSideBar0003 + * @tc.desic acesideBarShowSideBarEtsTest0003 + */ + it('testsideBarShowSideBar0003', 0, async function (done) { + console.info('sideBarShowSideBar testsideBarShowSideBar0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('SideBarContainer'); + console.info("[testsideBarShowSideBar0003] component autoHide strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('SideBarContainer'); + expect(obj.$attrs.sideBarPosition).assertEqual(undefined); + console.info("[testsideBarShowSideBar0003] autoHide value :" + obj.$attrs.autoHide); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/stack.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/stack.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b3e2c91c61ad7dd62dd94b6f186f3ee43d3285cf --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/stack.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 stackAlignContentJsunit() { + describe('stackAlignContentTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/stack', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get stack state success " + JSON.stringify(pages)); + if (!("stack" == pages.name)) { + console.info("get stack state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push stack page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push stack page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("stackAlignContent after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name teststackAlignContent0001 + * @tc.desic acestackAlignContentEtsTest0001 + */ + it('teststackAlignContent0001', 0, async function (done) { + console.info('stackAlignContent teststackAlignContent0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Stack'); + console.info("[teststackAlignContent0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Stack'); + expect(obj.$attrs.width).assertEqual("100.00%"); + console.info("[teststackAlignContent0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name teststackAlignContent0002 + * @tc.desic acestackAlignContentEtsTest0002 + */ + it('teststackAlignContent0002', 0, async function (done) { + console.info('stackAlignContent teststackAlignContent0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Stack'); + console.info("[teststackAlignContent0002] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Stack'); + expect(obj.$attrs.height).assertEqual("150.00vp"); + console.info("[teststackAlignContent0002] width value :" + obj.$attrs.width); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/stateManagement.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/stateManagement.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ad3f342453523aea2e0fdc8ce774679d0072c473 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/stateManagement.test.ets @@ -0,0 +1,154 @@ +/** + * 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 stateManagementGetSharedJsunit() { + describe('stateManagementGetSharedTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/stateManagement', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get stateManagement state success " + JSON.stringify(pages)); + if (!("stateManagement" == pages.name)) { + console.info("get stateManagement state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push stateManagement page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push stateManagement page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("stateManagementGetShared after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name teststateManagementGetShared0001 + * @tc.desic acestateManagementGetSharedEtsTest0001 + */ + it('teststateManagementGetShared0001', 0, async function (done) { + console.info('stateManagementGetShared teststateManagementGetShared0001 START'); + await Utils.sleep(2000); + try { + var EventOne = { + eventId: 60223, + priority: events_emitter.EventPriority.LOW + } + var callbackOne = (eventData) => { + console.info("teststateManagementGetShared_0001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.Result).assertEqual(false); + done(); + } + console.info("GetShared_0001 click result is: " + JSON.stringify(sendEventByKey('GetSharedText', 10, ""))); + events_emitter.on(EventOne, callbackOne); + } catch (err) { + console.info("stateManagementGetShared0001 on events_emitter err : " + JSON.stringify(err)); + } + console.info('teststateManagementGetShared0001 END'); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name teststateManagementsetAndLink0001 + * @tc.desic acestateManagementsetAndLinkEtsTest0001 + */ + it('teststateManagementsetAndLink0001', 0, async function (done) { + console.info('stateManagementsetAndLink teststateManagementsetAndLink0001 START'); + await Utils.sleep(1000); + try { + var EventTwo = { + eventId: 60224, + priority: events_emitter.EventPriority.LOW + } + var callbackTwo = (eventData) => { + console.info("teststateManagementsetAndLink_0001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.Result).assertEqual("callback2"); + done(); + } + console.info("setAndLink_0001 click result is: " + JSON.stringify(sendEventByKey('setAndLinkText', 10, ""))); + events_emitter.on(EventTwo, callbackTwo); + } catch (err) { + console.info("stateManagementsetAndLink0001 on events_emitter err : " + JSON.stringify(err)); + } + console.info('teststateManagementsetAndLink0001 END'); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name teststateManagementsetOrCreate0001 + * @tc.desic acestateManagementsetOrCreateEtsTest0001 + */ + it('teststateManagementsetOrCreate0001', 0, async function (done) { + console.info('stateManagementsetOrCreate teststateManagementsetOrCreate0001 START'); + await Utils.sleep(1000); + try { + var EventThree = { + eventId: 60225, + priority: events_emitter.EventPriority.LOW + } + var callbackThree = (eventData) => { + console.info("teststateManagementsetOrCreate_0001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.Result).assertEqual("callback3"); + done(); + } + console.info("setOrCreate_0001 click result is: " + JSON.stringify(sendEventByKey('setOrCreateText', 10, ""))); + events_emitter.on(EventThree, callbackThree); + } catch (err) { + console.info("stateManagementsetOrCreate0001 on events_emitter err : " + JSON.stringify(err)); + } + console.info('teststateManagementsetOrCreate0001 END'); + + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name teststateManagementsetAndProp0001 + * @tc.desic acestateManagementsetAndPropEtsTest0001 + */ + it('teststateManagementsetAndProp0001', 0, async function (done) { + console.info('stateManagementsetAndProp teststateManagementsetAndProp0001 START'); + await Utils.sleep(1000); + try { + var EventFour = { + eventId: 60226, + priority: events_emitter.EventPriority.LOW + } + var callbackFour = (eventData) => { + console.info("teststateManagementsetAndProp_0001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.Result).assertEqual("callback4"); + done(); + } + console.info("setAndProp_0001 click result is: " + JSON.stringify(sendEventByKey('setAndPropText', 10, ""))); + events_emitter.on(EventFour, callbackFour); + } catch (err) { + console.info("stateManagementsetAndProp0001 on events_emitter err : " + JSON.stringify(err)); + } + console.info('teststateManagementsetAndProp0001 END'); + }); + }) +} 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..5d80ac2efcba8c9a9c652474777cdc96a9add0f4 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/swiper.test.ets @@ -0,0 +1,240 @@ +/** + * 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('swiper'); + console.info("[testswiperCurve0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Swiper'); + expect(obj.$attrs.curve).assertEqual("Curves.Linear"); + console.info("[testswiperCurve0001] curve value :" + obj.$attrs.curve); + 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('swiper'); + console.info("[testswiperCurve0002] component cachedCount strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Swiper'); + expect(obj.$attrs.cachedCount).assertEqual("2"); + console.info("[testswiperCurve0002] cachedCount value :" + obj.$attrs.cachedCount); + 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('swiper'); + console.info("[testswiperCurve0003] component index strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Swiper'); + expect(obj.$attrs.index).assertEqual("3"); + console.info("[testswiperCurve0003] index value :" + obj.$attrs.index); + 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('swiper'); + console.info("[testswiperCurve0004] component autoPlay strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Swiper'); + expect(obj.$attrs.autoPlay).assertEqual("true"); + console.info("[testswiperCurve0004] autoPlay value :" + obj.$attrs.autoPlay); + 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('swiper'); + console.info("[testswiperCurve0005] component interval strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Swiper'); + expect(obj.$attrs.interval).assertEqual("4000"); + console.info("[testswiperCurve0005] interval value :" + obj.$attrs.interval); + 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('swiper'); + console.info("[testswiperCurve0006] component indicator strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Swiper'); + expect(obj.$attrs.indicator).assertEqual("true"); + console.info("[testswiperCurve0006] indicator value :" + obj.$attrs.indicator); + 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('swiper'); + console.info("[testswiperCurve0007] component loop strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Swiper'); + expect(obj.$attrs.loop).assertEqual("false"); + console.info("[testswiperCurve0007] loop value :" + obj.$attrs.loop); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0008 + * @tc.name testswiperCurve0008 + * @tc.desic aceswiperCurveEtsTest0008 + */ + it('testswiperCurve0008', 0, async function (done) { + console.info('swiperCurve testswiperCurve0008 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('swiper'); + console.info("[testswiperCurve0008] component duration strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Swiper'); + expect(obj.$attrs.duration).assertEqual("1000.000000"); + console.info("[testswiperCurve0008] duration value :" + obj.$attrs.duration); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testswiperCurve0009 + * @tc.desic aceswiperCurveEtsTest0009 + */ + it('testswiperCurve0009', 0, async function (done) { + console.info('swiperCurve testswiperCurve0009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('swiper'); + console.info("[testswiperCurve0009] component vertical strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Swiper'); + expect(obj.$attrs.vertical).assertEqual("false"); + console.info("[testswiperCurve0009] vertical value :" + obj.$attrs.vertical); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testswiperCurve0010 + * @tc.desic aceswiperCurveEtsTest0010 + */ + it('testswiperCurve00010', 0, async function (done) { + console.info('swiperCurve testswiperCurve00010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('swiper'); + console.info("[testswiperCurve00010] component itemSpace strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Swiper'); + expect(obj.$attrs.itemSpace).assertEqual("0.00px"); + console.info("[testswiperCurve00010] itemSpace value :" + obj.$attrs.itemSpace); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0011 + * @tc.name testswiperCurve0011 + * @tc.desic aceswiperCurveEtsTest0011 + */ + /***有问题***/ + it('testswiperCurve00011', 0, async function (done) { + console.info('swiperCurve testswiperCurve00011 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('swiper'); + console.info("[testswiperCurve00011] component onChange strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Swiper'); + try { + obj.$attrs.isOn = !obj.$attrs.isOn //尝试用isOn的改变来触发Onchange()事件 + } catch(err) { + console.info("testswiperCurve00011 on event err : " + JSON.stringify(err)); + } + console.info("[testswiperCurve00011] onChange value :" + obj.$attrs.onChange); + 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..c73b2403af693e5b1501072b746a50e633c5b201 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/tabs.test.ets @@ -0,0 +1,218 @@ +/** + * 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(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0011 + * @tc.name testtabsBarPosition0011 + * @tc.desic acetabsBarPositionEtsTest0011 + */ + it('testtabsBarPosition0011', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition0011 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionTabs'); + console.info("[testtabsBarPosition0011] component barPosition strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Tabs'); + expect(obj.$attrs.barPosition).assertEqual("BarPosition.Start"); + console.info("[testtabsBarPosition0011] barPosition value :" + obj.$attrs.barPosition); + 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..2e0706dd05482641d5123ede0d0cb5b380b2f775 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/text.test.ets @@ -0,0 +1,226 @@ +/** + * 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(); + }); + + it('testtextMinFontSize0011', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize0011 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0011] component minFontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.minFontSize).assertEqual(undefined); + console.info("[testtextMinFontSize0011] minFontSize value :" + obj.$attrs.minFontSize); + done(); + }); + + it('testtextCopyOptionText0001', 0, async function (done) { + console.info('textMinFontSize testtextCopyOptionText0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('copyOptionText'); + console.info("[testtextCopyOptionText0001] component copyOption strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.copyOption).assertEqual(undefined); + console.info("[testtextCopyOptionText0001] copyOption value :" + obj.$attrs.copyOption); + 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..d109dcb851f57e3a50c6fddc55dfb13afc70c65d --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textArea.test.ets @@ -0,0 +1,220 @@ +/** + * 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(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0011 + * @tc.name testtextAreaOnCut0011 + * @tc.desic acetextAreaOnCutEtsTest0011 + */ + it('testtextAreaCopyOption0011', 0, async function (done) { + console.info('textAreaCopyOption testtextAreaCopyOption0011 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('textAreaCopyOptionText'); + console.info("[testtextAreaCopyOption0011] component copyOption strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.copyOption).assertEqual(undefined); + console.info("[testtextAreaCopyOption0011] copyOption value :" + obj.$attrs.copyOption); + 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..a5225f0775f78bde9e27497563b8dc506a6b5021 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textInput.test.ets @@ -0,0 +1,225 @@ +/** + * 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(); + }); + + it('testtextInputCopyOption0001', 0, async function (done) { + console.info('textInputCopyOption testtextInputCopyOption0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('textInputCopyOptionText'); + console.info("[testtextInputCopyOption0001] component copyOption strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.copyOption).assertEqual(undefined); + console.info("[testtextInputCopyOption0001] copyOption value :" + obj.$attrs.copyOption); + done(); + }); + + it('testtextInputShowPasswordIcon0001', 0, async function (done) { + console.info('textInputShowPasswordIcon testtextInputShowPasswordIcon0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('showPasswordIconText'); + console.info("[testtextInputShowPasswordIcon0001] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.showPasswordIcon).assertEqual(undefined); + console.info("[testtextInputShowPasswordIcon0001] showPasswordIcon value :" + obj.$attrs.showPasswordIcon); + 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..2c48faf0096ac00e2a0e81ee37968b3aa80323b0 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textPicker.test.ets @@ -0,0 +1,218 @@ +/** + * 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(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0011 + * @tc.name testtextPickerDefaultPickerItemHeight0011 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0011 + */ + it('testtextPickerDefaultPickerItemHeight0011', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight0011 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0011] component defaultPickerItemHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.defaultPickerItemHeight).assertEqual("80.00px"); + console.info("[testtextPickerDefaultPickerItemHeight0011] defaultPickerItemHeight value :" + obj.$attrs.defaultPickerItemHeight); + 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..7ae83e2f61e12de10375abbd70bf39a29126f4f9 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/video.test.ets @@ -0,0 +1,227 @@ +/** + * 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 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(); + }); + + it('testvideoOnFullscreenChange0011', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange0011 START'); + var innerEvent = { + eventId: 60227, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + try{ + console.info("callback success" ); + console.info("eventData.data.result result is: " + eventData.data.result); + expect(eventData.data.result).assertEqual("success"); + console.info("video_101 end: "); + }catch(err){ + console.info("video_101 on events_emitter err : " + JSON.stringify(err)); + } + done(); + } + try { + events_emitter.on(innerEvent, callback); + console.info("video_101 click result is: " + JSON.stringify(sendEventByKey('fullScreen', 10, ""))); + } catch (err) { + console.info("video_101 on events_emitter err : " + JSON.stringify(err)); + } + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/web.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/web.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c135bf9a0ef13962269ced88bf18f3b4ed6d949b --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/web.test.ets @@ -0,0 +1,161 @@ +/** + * 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 webGetTitleJsunit() { + describe('webGetTitleTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/web', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get web state success " + JSON.stringify(pages)); + if (!("web" == pages.name)) { + console.info("get web state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push web page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push web page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("webGetTitle after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testwebGetTitle0002 + * @tc.desic acewebGetTitleEtsTest0002 + */ + it('testwebGetTitle0001', 0, async function (done) { + console.info('webGetTitle testwebGetTitle0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('getTitleText'); + console.info("[testwebGetTitle0001] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Web'); + expect(obj.$attrs.height).assertEqual("500.00vp"); + console.info("[testwebGetTitle0001] height value :" + obj.$attrs.height); + done(); + }); + + it('testwebGetTitle0002', 0, async function (done) { + console.info('webGetTitle testwebGetTitle0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('getTitleText'); + console.info("[testwebGetTitle0002] component fileAccess strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Web'); + expect(obj.$attrs.fileAccess).assertEqual(undefined); + console.info("[testwebGetTitle0002] fileAccess value :" + obj.$attrs.fileAccess); + done(); + }); + + it('testwebGetTitle0003', 0, async function (done) { + console.info('webGetTitle testwebGetTitle0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('getTitleText'); + console.info("[testwebGetTitle0003] component javaScriptAccess strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Web'); + expect(obj.$attrs.javaScriptAccess).assertEqual(undefined); + console.info("[testwebGetTitle0003] javaScriptAccess value :" + obj.$attrs.javaScriptAccess); + done(); + }); + + it('testwebGetTitle0004', 0, async function (done) { + console.info('webGetTitle testwebGetTitle0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('getTitleText'); + console.info("[testwebGetTitle0004] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Web'); + expect(obj.$attrs.padding).assertEqual("20.00vp"); + console.info("[testwebGetTitle0004] padding value :" + obj.$attrs.padding); + done(); + }); + + it('testwebGetTitle0005', 0, async function (done) { + console.info('webGetTitle testwebGetTitle0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('getTitleText'); + console.info("[testwebGetTitle0005] component blur strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Web'); + expect(obj.$attrs.blur).assertEqual(2); + console.info("[testwebGetTitle0005] blur value :" + obj.$attrs.blur); + done(); + }); + + it('testwebGetTitle0006', 0, async function (done) { + console.info('webGetTitle testwebGetTitle0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('getTitleText'); + console.info("[testwebGetTitle0006] component userAgent strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Web'); + expect(obj.$attrs.userAgent).assertEqual(undefined); + console.info("[testwebGetTitle0006] userAgent value :" + obj.$attrs.userAgent); + done(); + }); + + it('testwebGetTitle0007', 0, async function (done) { + console.info('webGetTitle testwebGetTitle0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('getTitleText'); + console.info("[testwebGetTitle0007] component fileFromUrlAccess strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Web'); + expect(obj.$attrs.fileFromUrlAccess).assertEqual(undefined); + console.info("[testwebGetTitle0007] fileFromUrlAccess value :" + obj.$attrs.fileFromUrlAccess); + done(); + }); + + it('testwebGetTitle0008', 0, async function (done) { + console.info('webGetTitle testwebGetTitle0008 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('getTitleText'); + console.info("[testwebGetTitle0008] component initialScale strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Web'); + expect(obj.$attrs.initialScale).assertEqual(undefined); + console.info("[testwebGetTitle0008] initialScale value :" + obj.$attrs.initialScale); + done(); + }); + + it('testwebGetTitle0009', 0, async function (done) { + console.info('webGetTitle testwebGetTitle0009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('getTitleText'); + console.info("[testwebGetTitle0009] component webDebuggingAccess strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Web'); + expect(obj.$attrs.webDebuggingAccess).assertEqual(undefined); + console.info("[testwebGetTitle0009] webDebuggingAccess value :" + obj.$attrs.webDebuggingAccess); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/xcomponent.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/xcomponent.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..aa6fa0580c21415b2493e2730beefa4b522da9ae --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/xcomponent.test.ets @@ -0,0 +1,111 @@ +/** + * 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 xcomponentGetXComponentContextJsunit() { + describe('xcomponentGetXComponentContextTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/xcomponent', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get xcomponent state success " + JSON.stringify(pages)); + if (!("xcomponent" == pages.name)) { + console.info("get xcomponent state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push xcomponent page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push xcomponent page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("xcomponentGetXComponentContext after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testxcomponentGetXComponentContext0010 + * @tc.desic acexcomponentGetXComponentContextEtsTest0010 + */ + it('testxcomponentGetXComponentContext0010', 0, async function (done) { + console.info('xcomponentGetXComponentContext testxcomponentGetXComponentContext0010 START'); + await Utils.sleep(1000); + try { + var innerEventOne = { + eventId: 60228, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("onRequestPopupData_0010 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual("callBackSuccess"); + done(); + } + console.info("onSelect_0012 click result is: " + JSON.stringify(sendEventByKey('getXComponentContextText', 10, ""))); + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("onRequestPopupData_0010 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testxcomponentGetXComponentContext0010 END'); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testxcomponentSetXComponentSurfaceSize0001 + * @tc.desic acexcomponentSetXComponentSurfaceSizeEtsTest0001 + */ + it('testxcomponentSetXComponentSurfaceSize0001', 0, async function (done) { + console.info('xcomponentSetXComponentContext testxcomponentSetXComponentSurfaceSize0001 START'); + await Utils.sleep(2000); + console.info("setXComponentSurfaceSize0001 click result is: " + JSON.stringify(sendEventByKey('setXComponentSurfaceSizeText', 10, ""))) + let strJson = getInspectorByKey('setXComponentSurfaceSizeText'); + //console + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual("Text"); + expect(obj.$attrs.surfaceWidth).assertEqual(undefined); + console.info('testxcomponentSetXComponentSurfaceSize0001 END'); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testxcomponentSetXComponentSurfaceSize0002 + * @tc.desic acexcomponentSetXComponentSurfaceSizeEtsTest0002 + */ + it('testxcomponentSetXComponentSurfaceSize0002', 0, async function (done) { + console.info('xcomponentSetXComponentContext testxcomponentSetXComponentSurfaceSize0002 START'); + await Utils.sleep(2000); + console.info("testxcomponentSetXComponentSurfaceSize0002 click result is: " + JSON.stringify(sendEventByKey('setXComponentSurfaceSizeText', 10, ""))) + let strJson = getInspectorByKey('setXComponentSurfaceSizeText'); + //console + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual("Text"); + expect(obj.$attrs.surfaceHeight).assertEqual(undefined); + console.info('testxcomponentSetXComponentSurfaceSize0002 END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/resources/base/element/color.json b/arkui/ace_ets_component_apilack/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..68f8331ba0fbe3404fe8ab5ede5ecb98a0a76d80 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/resources/base/element/color.json @@ -0,0 +1,12 @@ +{ + "color": [ + { + "name": "color_hello", + "value": "#ffff0000" + }, + { + "name": "color_world", + "value": "#ff0000ff" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/resources/base/element/float.json b/arkui/ace_ets_component_apilack/entry/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..f26020ff03a653a81ecc6fa8fdef0d9a3b067f96 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/resources/base/element/float.json @@ -0,0 +1,12 @@ +{ + "float":[ + { + "name":"font_hello", + "value":"28.0fp" + }, + { + "name":"font_world", + "value":"20.0fp" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/resources/base/element/string.json b/arkui/ace_ets_component_apilack/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ea42b011821112702135f8fa17059eec183ef638 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + }, + { + "name":"string_hello", + "value":"Hello" + }, + { + "name":"string_world", + "value":"World" + }, + { + "name":"message_arrive", + "value":"We will arrive at %s." + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/resources/base/media/icon.png b/arkui/ace_ets_component_apilack/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_ets_component_apilack/entry/src/main/resources/base/media/icon.png differ diff --git a/arkui/ace_ets_component_apilack/entry/src/main/resources/base/media/user.png b/arkui/ace_ets_component_apilack/entry/src/main/resources/base/media/user.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_ets_component_apilack/entry/src/main/resources/base/media/user.png differ diff --git a/arkui/ace_ets_component_apilack/entry/src/main/resources/base/media/userFull.png b/arkui/ace_ets_component_apilack/entry/src/main/resources/base/media/userFull.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_ets_component_apilack/entry/src/main/resources/base/media/userFull.png differ diff --git a/arkui/ace_ets_component_apilack/entry/src/main/resources/rawfile/test.png b/arkui/ace_ets_component_apilack/entry/src/main/resources/rawfile/test.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_ets_component_apilack/entry/src/main/resources/rawfile/test.png differ diff --git a/arkui/ace_ets_component_apilack/entry/src/main/resources/rawfile/videoTest.mp4 b/arkui/ace_ets_component_apilack/entry/src/main/resources/rawfile/videoTest.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..e01d970ffb78c5b2ab2fc20b60ea2cf3b1829cb3 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/resources/rawfile/videoTest.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5717f7f3d650e3bce5d159a013fd8a5d62cdde02ec76945cb473406e64f38203 +size 6301943 diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/signature/openharmony_sx.p7b b/arkui/ace_ets_component_apilack/signature/openharmony_sx.p7b similarity index 100% rename from notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/signature/openharmony_sx.p7b rename to arkui/ace_ets_component_apilack/signature/openharmony_sx.p7b diff --git a/arkui/ace_ets_component_attrlack/BUILD.gn b/arkui/ace_ets_component_attrlack/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..afada8b8fbb59d885f37f9ff3b48eddceee06925 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/BUILD.gn @@ -0,0 +1,36 @@ +# 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("ActsAceEtsAttrLackTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":ace_ets_dev_assets", + ":ace_ets_dev_resources", + ":ace_ets_dev_test_assets", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAceEtsAttrLackTest" +} +ohos_js_assets("ace_ets_dev_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_js_assets("ace_ets_dev_test_assets") { + source_dir = "./entry/src/main/ets/TestAbility" +} +ohos_resources("ace_ets_dev_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/arkui/ace_ets_component_attrlack/Test.json b/arkui/ace_ets_component_attrlack/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..7a568e735eb08f4683506d00b2f34d20cf18e3d4 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for aceEtsAttrLack Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.open.harmony.aceEtsAttrLack", + "package-name": "com.open.harmony.aceEtsAttrLack", + "shell-timeout": "600000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAceEtsAttrLackTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/config.json b/arkui/ace_ets_component_attrlack/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..10dd537aa5f3062ea7060f42a857b7f7b04b270a --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/config.json @@ -0,0 +1,142 @@ +{ + "app": { + "bundleName": "com.open.harmony.aceEtsAttrLack", + "vendor": "open", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.open.harmony.aceEtsAttrLack", + "name": ".MyApplication", + "mainAbility": "com.open.harmony.aceEtsAttrLack.MainAbility", + "deviceType": [ + "default", + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "orientation": "unspecified", + "visible": true, + "srcPath": "TestAbility", + "name": ".TestAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "formsEnabled": false, + "label": "$string:TestAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index", + "pages/page1", + "pages/page2", + "pages/alertDialog", + "pages/animate_play_mode", + "pages/animator", + "pages/app", + "pages/attr_animate", + "pages/canvas", + "pages/checkBox", + "pages/checkBoxGroup", + "pages/common", + "pages/curves", + "pages/datePicker", + "pages/edgeEffect", + "pages/enums", + "pages/featureAbility", + "pages/fill_mode", + "pages/gesture", + "pages/gridCol", + "pages/gridRow", + "pages/listtest", + "pages/list_item_group", + "pages/loadingProgress", + "pages/pluginComponent", + "pages/progress", + "pages/radio", + "pages/refresh", + "pages/remoteWindow", + "pages/router", + "pages/scroll_edge", + "pages/sidebar", + "pages/slider", + "pages/stateManagement", + "pages/stepperItem", + "pages/swiper", + "pages/text_input", + "pages/units", + "pages/web", + "pages/copyOption", + "pages/responseType", + "pages/hoverEffect", + "pages/hitTestMode", + "pages/color" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/app.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..07722b56d3d02df5fb59b51789007b844b43e63c --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,33 @@ +/** + * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/Log.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/Log.ets new file mode 100644 index 0000000000000000000000000000000000000000..018658e2911600fe489bd6a8430e8879be2b78eb --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/Log.ets @@ -0,0 +1,53 @@ +/** + * 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. + */ + + +const TAG = 'ets_apiLack_add'; + +/** + * Basic log class + */ +export default class Log { + + /** + * print info level log + * + * @param {string} tag - Page or class tag + * @param {string} log - Log needs to be printed + */ + static showInfo(tag, log) { + console.info(`${TAG} tag: ${tag} --> ${log}`); + } + + /** + * print debug level log + * + * @param {string} tag - Page or class tag + * @param {string} log - Log needs to be printed + */ + static showDebug(tag, log) { + console.debug(`${TAG} tag: ${tag} --> ${log}`); + } + + /** + * print error level log + * + * @param {string} tag - Page or class tag + * @param {string} log - Log needs to be printed + */ + static showError(tag, log) { + console.error(`${TAG} tag: ${tag} --> ${log}`); + } +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/Utils.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/Utils.ets new file mode 100644 index 0000000000000000000000000000000000000000..9ca8c904c5373019759b101f63fe919e1fab5658 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/Utils.ets @@ -0,0 +1,118 @@ +// @ts-nocheck +/** + * 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 class Utils { + static rect_left; + static rect_top; + static rect_right; + static rect_bottom; + static rect_value; + + static sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, time) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + static getComponentRect(key) { + let strJson = getInspectorByKey(key); + let obj = JSON.parse(strJson); + console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj)); + let rectInfo = JSON.parse('[' + obj.$rect + ']') + console.info("[getInspectorByKey] rectInfo is: " + rectInfo); + this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0] + this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1] + this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0] + this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1] + return this.rect_value = { + "left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom + } + } + + static async swipe(downX, downY, upX, upY, steps) { + console.info('start to swipe') + this.drags(downX, downY, upX, upY, steps, false) + } + + static async drag(downX, downY, upX, upY, steps) { + console.info('start to drag') + this.drags(downX, downY, upX, upY, steps, true) + } + + static async drags(downX, downY, upX, upY, steps, drag) { + var xStep; + var yStep; + var swipeSteps; + var ret; + xStep = 0; + yStep = 0; + ret = false; + swipeSteps = steps; + if (swipeSteps == 0) { + swipeSteps = 1; + } + xStep = (upX - downX) / swipeSteps; + yStep = (upY - downY) / swipeSteps; + console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep) + var downPoint: TouchObject = { + id: 1, + x: downX, + y: downY, + type: TouchType.Down, + } + console.info('down touch started: ' + JSON.stringify(downPonit)) + sendTouchEvent(downPoint); + console.info('start to move') + if (drag) { + await this.sleep(500) + } + for (var i = 1;i <= swipeSteps; i++) { + var movePoint: TouchObject = { + id: 1, + x: downX + (xStep * i), + y: downY + (yStep * i), + type: TouchType.Move + } + console.info('move touch started: ' + JSON.stringify(movePoint)) + ret = sendTouchEvent(movePoint) + if (ret == false) { + break; + } + await this.sleep(5) + } + console.info('start to up') + if (drag) { + await this.sleep(100) + } + var upPoint: TouchObject = { + id: 1, + x: upX, + y: upY, + type: TouchType.Up, + } + console.info('up touch started: ' + JSON.stringify(upPoint)) + sendTouchEvent(upPoint) + await this.sleep(500) + } +} + + + + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/bg1.png b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/bg1.png new file mode 100644 index 0000000000000000000000000000000000000000..f97eae0b4cd0f7b3b2ef8c4db1af68ce861181e9 Binary files /dev/null and b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/bg1.png differ diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/bg2.png b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/bg2.png new file mode 100644 index 0000000000000000000000000000000000000000..187dad546d1c335de78e8469c1ad0dd06e20a045 Binary files /dev/null and b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/bg2.png differ diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/plugin_component.js b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/plugin_component.js new file mode 100644 index 0000000000000000000000000000000000000000..b0d7eea42d114f3d45dce42d90176137d8f410a0 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/common/plugin_component.js @@ -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 pluginComponentManager from '@ohos.pluginComponent' + +function onPushListener(source, template, data, extraData) { + console.log("onPushListener template.source=" + template.source) + var jsonObject = JSON.parse(data.componentTemplate.source) + console.log("request_callback1:source json object" + jsonObject) + var jsonArry = jsonObject.ExternalComponent + for (var i in jsonArry) { + console.log(jsonArry[i]) + } + console.log("onPushListener:source json object" + jsonObject) + console.log("onPushListener:source json string" + JSON.stringify(jsonObject)) + console.log("onPushListener template.ability=" + template.ability) + console.log("onPushListener data=" + JSON.stringify(data)) + console.log("onPushListener extraData=" + JSON.stringify(extraData)) +} + +function onRequestListener(source, name, data) +{ + console.log("onRequestListener name=" + name); + console.log("onRequestListener data=" + JSON.stringify(data)); + return {template:"plugintemplate", data:data}; +} + +export default { + //register listener + onListener() { + pluginComponentManager.on("push", onPushListener) + pluginComponentManager.on("request", onRequestListener) + }, + Push() { + // 组件提供方主动发送事件 + pluginComponentManager.push( + { + want: { + bundleName: "com.example.myapplication", + abilityName: "com.example.myapplication.MainAbility", + "parameters": { + DIMENSION_KEY: FormDimension.Dimension_1_2 + } + }, + name: "plugintemplate", + data: { + "key_1": "plugin component test", + "key_2": 34234 + }, + extraData: { + "extra_str": "this is push event" + }, + jsonPath: "", + }, + (err, data) => { + console.log("push_callback: push ok!"); + } + ) + }, + Request() { + // 组件使用方主动发送事件 + pluginComponentManager.request({ + want: { + bundleName: "com.example.myapplication", + abilityName: "com.example.myapplication.MainAbility", + }, + name: "plugintemplate", + data: { + "key_1": "plugin component test", + "key_2": 34234 + }, + jsonPath: "", + }, + (err, data) => { + console.log("request_callback: componentTemplate.ability=" + data.componentTemplate.ability) + console.log("request_callback: componentTemplate.source=" + data.componentTemplate.source) + var jsonObject = JSON.parse(data.componentTemplate.source) + console.log("request_callback:source json object" + jsonObject) + var jsonArry = jsonObject.ExternalComponent + for (var i in jsonArry) { + console.log(jsonArry[i]) + } + console.log("request_callback:source json string" + JSON.stringify(jsonObject)) + console.log("request_callback: data=" + JSON.stringify(data.data)) + console.log("request_callback: extraData=" + JSON.stringify(data.extraData)) + } + ) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/PluginProviderExample.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/PluginProviderExample.ets new file mode 100644 index 0000000000000000000000000000000000000000..aad3c88d5f177af57db81cac083cb9ddd05e209c --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/PluginProviderExample.ets @@ -0,0 +1,51 @@ +/** + * 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 plugin from "../common/plugin_component.js" + +@Entry +@Component +struct PluginProviderExample { + @State message: string = 'no click!' + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Button('Register Push Listener') + .fontSize(30) + .width(400) + .height(100) + .margin({top:20}) + .onClick(()=>{ + plugin.onListener() + console.log("Button('Register Push Listener')") + }) + Button('Push') + .fontSize(30) + .width(400) + .height(100) + .margin({top:20}) + .onClick(()=>{ + plugin.Push() + this.message = "Button('Push')" + console.log("Button('Push')") + }) + Text(this.message) + .height(150) + .fontSize(30) + .padding(5) + .margin(5) + }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 }) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/alertDialog.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/alertDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..56667c8963b12bd1b54045fc29c9b43ea8d0f7c6 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/alertDialog.ets @@ -0,0 +1,146 @@ +/** + * 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'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct AlertDialogCenterStart { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear AlertDialogCenterStart start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear AlertDialogCenterStart end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("alertDialog-CenterStart") + .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("CenterStartText") + + Text("alertDialog-CenterEnd") + .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("CenterEndText") + + Button('one button dialog') + .key("CenterStartButton") + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + confirm: { + value: 'button', + action: () => { + console.info('Button-clicking callback') + } + }, + cancel: () => { + console.info('Closed callbacks') + }, + alignment:DialogAlignment.CenterStart + } + ) + try { + var backData = { + data: { + "Result": true + } + } + let backEvent = { + eventId: 81601, + priority: events_emitter.EventPriority.LOW + } + console.info("CenterStart start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("CenterStart emit action state err: " + JSON.stringify(err.message)) + } + }) + .backgroundColor(0x317aff) + + Button('two button dialog') + .key("CenterEndButton") + .onClick(() => { + AlertDialog.show( + { + title: 'title', + message: 'text', + primaryButton: { + value: 'cancel', + action: () => { + console.info('Callback when the first button is clicked') + } + }, + secondaryButton: { + value: 'ok', + action: () => { + console.info('Callback when the second button is clicked') + } + }, + cancel: () => { + console.info('Closed callbacks') + }, + alignment:DialogAlignment.CenterEnd + } + ) + try { + var backData = { + data: { + "Result": true + } + } + let backEvent = { + eventId: 81602, + priority: events_emitter.EventPriority.LOW + } + console.info("CenterEnd start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("CenterEnd emit action state err: " + JSON.stringify(err.message)) + } + }).backgroundColor(0x317aff) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/animate_play_mode.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/animate_play_mode.ets new file mode 100644 index 0000000000000000000000000000000000000000..fb499e08453ac1aa9ba0ee94c90371ee52d290d0 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/animate_play_mode.ets @@ -0,0 +1,125 @@ +/** + * 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct AttrAnimationExample { + @State widthSize: number = 200 + @State heightSize: number = 100 + @State flag: boolean = true + + @State widthSizeAlternate: number = 200 + @State heightSizeAlternate: number = 100 + @State flagAlternate: boolean = true + @State widthSizeNormal: number = 200 + @State heightSizeNormal: number = 100 + @State flagNormal: boolean = true + + @State widthSizeAlternateReverse: number = 200 + @State heightSizeAlternateReverse: number = 100 + @State flagAlternateReverse: boolean = true + + build() { + Column() { + Button('PlayMode.Reverse') + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 200 + this.heightSize = 100 + } + this.flag = !this.flag + }) + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .key("Reverse") + .animation({ + duration: 3000, // 动画时长 + curve: Curve.EaseOut, // 动画曲线 + delay: 1000, // 动画延迟 + iterations: 1, // 播放次数 + playMode: PlayMode.Reverse // 动画模式 + }) // 对Button组件的宽高属性进行动画配置 + + Button('PlayMode.Alternate') + .onClick((event: ClickEvent) => { + if (this.flagAlternate) { + this.widthSizeAlternate = 100 + this.heightSizeAlternate = 50 + } else { + this.widthSizeAlternate = 200 + this.heightSizeAlternate = 100 + } + this.flagAlternate = !this.flagAlternate + }) + .width(this.widthSizeAlternate).height(this.heightSizeAlternate).backgroundColor(0x317aff) + .key("Alternate") + .animation({ + duration: 3000, + curve: Curve.EaseOut, + delay: 1000, + iterations: 1, + playMode: PlayMode.Alternate + }) + + Button('PlayMode.Normal') + .onClick((event: ClickEvent) => { + if (this.flagNormal) { + this.widthSizeNormal = 100 + this.heightSizeNormal = 50 + } else { + this.widthSizeNormal = 200 + this.heightSizeNormal = 100 + } + this.flagNormal = !this.flagNormal + }) + .width(this.widthSizeNormal).height(this.heightSizeNormal).backgroundColor(0x317aff) + .key("Normal") + .animation({ + duration: 3000, + curve: Curve.EaseOut, + delay: 1000, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('PlayMode.AlternateReverse') + .onClick((event: ClickEvent) => { + if (this.flagAlternateReverse) { + this.widthSizeAlternateReverse = 100 + this.heightSizeAlternateReverse = 50 + } else { + this.widthSizeAlternateReverse = 200 + this.heightSizeAlternateReverse = 100 + } + this.flagAlternateReverse = !this.flagAlternateReverse + }) + .width(this.widthSizeAlternateReverse).height(this.heightSizeAlternateReverse).backgroundColor(0x317aff) + .key("AlternateReverse") + .animation({ + duration: 3000, + curve: Curve.EaseOut, + delay: 1000, + iterations: 1, + playMode: PlayMode.AlternateReverse + }) + }.width('100%').margin({ top: 5 }) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/animator.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/animator.ets new file mode 100644 index 0000000000000000000000000000000000000000..7bb0c726ad120268e713e303fce85504369e6abb --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/animator.ets @@ -0,0 +1,53 @@ +/** + * 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 AnimatorOnframe { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear AnimatorOnframe start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear AnimatorOnframe end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("animator-Onframe") + .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("onframeText") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/app.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..48ea7769373274c8e64d77a2e7a9629beb595409 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/app.ets @@ -0,0 +1,73 @@ +/** + * 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 app from '@system.app'; +import events_emitter from '@ohos.events.emitter'; + +import Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct AppVersionCode { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear AppVersionCode start:`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear AppVersionCode end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("app-VersionCode") + .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("versionCodeText") + .onClick(()=>{ + app.getInfo().versionCode = 1 + try { + var backData = { + data: { + "Code": app.getInfo().versionCode + } + } + let backEvent = { + eventId: 60302, + priority: events_emitter.EventPriority.LOW + } + console.info("versionCode start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("versionCode emit action state err: " + JSON.stringify(err.message)) + } + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/attr_animate.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/attr_animate.ets new file mode 100644 index 0000000000000000000000000000000000000000..c1a2014a7efd7631a6f99029b85133cd5cb619b9 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/attr_animate.ets @@ -0,0 +1,267 @@ +/** + * 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct AttrAnimationExample { + @State widthSize: number = 200 + @State heightSize: number = 80 + @State flag: boolean = true + + @State widthSizeEaseOut: number = 200 + @State heightSizeEaseOut: number = 80 + @State flagEaseOut: boolean = true + + @State widthSizeFastOutSlowIn: number = 200 + @State heightSizeFastOutSlowIn: number = 80 + @State flagFastOutSlowIn: boolean = true + + @State widthSizeLinearOutSlowIn: number = 200 + @State heightSizeLinearOutSlowIn: number = 80 + @State flagLinearOutSlowIn: boolean = true + + @State widthSizeFastOutLinearIn: number = 200 + @State heightSizeFastOutLinearIn: number = 80 + @State flagFastOutLinearIn: boolean = true + + @State widthSizeExtremeDeceleration: number = 200 + @State heightSizeExtremeDeceleration: number = 80 + @State flagExtremeDeceleration: boolean = true + + @State widthSizeSharp: number = 200 + @State heightSizeSharp: number = 80 + @State flagSharp: boolean = true + + @State widthSizeRhythm: number = 200 + @State heightSizeRhythm: number = 80 + @State flagRhythm: boolean = true + + @State widthSizeSmooth: number = 200 + @State heightSizeSmooth: number = 80 + @State flagSmooth: boolean = true + + @State widthSizeFriction: number = 200 + @State heightSizeFriction: number = 80 + @State flagFriction: boolean = true + + build() { + Column() { + Button('EaseInOut') + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 200 + this.heightSize = 80 + } + this.flag = !this.flag + }) + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 2000, // 动画时长 + curve: Curve.EaseInOut, // 动画曲线 + delay: 500, // 动画延迟 + iterations: 1, // 播放次数 + playMode: PlayMode.Normal // 动画模式 + }) + + Button('Curve.EaseOut') + .onClick((event: ClickEvent) => { + if (this.flagEaseOut) { + this.widthSizeEaseOut = 100 + this.heightSizeEaseOut = 50 + } else { + this.widthSizeEaseOut = 200 + this.heightSizeEaseOut = 80 + } + this.flagEaseOut = !this.flagEaseOut + }) + .width(this.widthSizeEaseOut).height(this.heightSizeEaseOut).backgroundColor(0x317aff) + .animation({ + duration: 2000, + curve: Curve.EaseOut, + delay: 500, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('FastOutSlowIn') + .onClick((event: ClickEvent) => { + if (this.flagFastOutSlowIn) { + this.widthSizeFastOutSlowIn = 100 + this.heightSizeFastOutSlowIn = 50 + } else { + this.widthSizeFastOutSlowIn = 200 + this.heightSizeFastOutSlowIn = 80 + } + this.flagFastOutSlowIn = !this.flagFastOutSlowIn + }) + .width(this.widthSizeFastOutSlowIn).height(this.heightSizeFastOutSlowIn).backgroundColor(0x317aff) + .animation({ + duration: 2000, + curve: Curve.FastOutSlowIn, + delay: 500, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('LinearOutSlowIn') + .onClick((event: ClickEvent) => { + if (this.flagLinearOutSlowIn) { + this.widthSizeLinearOutSlowIn = 100 + this.heightSizeLinearOutSlowIn = 50 + } else { + this.widthSizeLinearOutSlowIn = 200 + this.heightSizeLinearOutSlowIn = 80 + } + this.flagLinearOutSlowIn = !this.flagLinearOutSlowIn + }) + .width(this.widthSizeLinearOutSlowIn).height(this.heightSizeLinearOutSlowIn).backgroundColor(0x317aff) + .animation({ + duration: 2000, + curve: Curve.LinearOutSlowIn, + delay: 500, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('FastOutLinearIn') + .onClick((event: ClickEvent) => { + if (this.flagFastOutLinearIn) { + this.widthSizeFastOutLinearIn = 100 + this.heightSizeFastOutLinearIn = 50 + } else { + this.widthSizeFastOutLinearIn = 200 + this.heightSizeFastOutLinearIn = 80 + } + this.flagFastOutLinearIn = !this.flagFastOutLinearIn + }) + .width(this.widthSizeFastOutLinearIn).height(this.heightSizeFastOutLinearIn).backgroundColor(0x317aff) + .animation({ + duration: 2000, + curve: Curve.FastOutLinearIn, + delay: 500, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('ExtremeDeceleration') + .onClick((event: ClickEvent) => { + if (this.flagExtremeDeceleration) { + this.widthSizeExtremeDeceleration = 100 + this.heightSizeExtremeDeceleration = 50 + } else { + this.widthSizeExtremeDeceleration = 200 + this.heightSizeExtremeDeceleration = 80 + } + this.flagExtremeDeceleration = !this.flagExtremeDeceleration + }) + .width(this.widthSizeExtremeDeceleration).height(this.heightSizeExtremeDeceleration).backgroundColor(0x317aff) + .animation({ + duration: 2000, + curve: Curve.ExtremeDeceleration, + delay: 500, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('Sharp') + .onClick((event: ClickEvent) => { + if (this.flagSharp) { + this.widthSizeSharp = 100 + this.heightSizeSharp = 50 + } else { + this.widthSizeSharp = 200 + this.heightSizeSharp = 80 + } + this.flagSharp = !this.flagSharp + }) + .width(this.widthSizeSharp).height(this.heightSizeSharp).backgroundColor(0x317aff) + .animation({ + duration: 2000, + curve: Curve.Sharp, + delay: 500, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('Rhythm') + .onClick((event: ClickEvent) => { + if (this.flagRhythm) { + this.widthSizeRhythm = 100 + this.heightSizeRhythm = 50 + } else { + this.widthSizeRhythm = 200 + this.heightSizeRhythm = 80 + } + this.flagRhythm = !this.flagRhythm + }) + .width(this.widthSizeRhythm).height(this.heightSizeRhythm).backgroundColor(0x317aff) + .animation({ + duration: 2000, + curve: Curve.Rhythm, + delay: 500, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('Smooth') + .onClick((event: ClickEvent) => { + if (this.flagSmooth) { + this.widthSizeSmooth = 100 + this.heightSizeSmooth = 50 + } else { + this.widthSizeSmooth = 200 + this.heightSizeSmooth = 80 + } + this.flagSmooth = !this.flagSmooth + }) + .width(this.widthSizeSmooth).height(this.heightSizeSmooth).backgroundColor(0x317aff) + .animation({ + duration: 2000, + curve: Curve.Smooth, + delay: 500, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('Friction') + .onClick((event: ClickEvent) => { + if (this.flagFriction) { + this.widthSizeFriction = 100 + this.heightSizeFriction = 50 + } else { + this.widthSizeFriction = 200 + this.heightSizeFriction = 80 + } + this.flagFriction = !this.flagFriction + }) + .width(this.widthSizeFriction).height(this.heightSizeFriction).backgroundColor(0x317aff) + .animation({ + duration: 2000, + curve: Curve.Friction, + delay: 500, + iterations: 1, + playMode: PlayMode.Normal + }) + + }.width('100%').margin({ top: 5 }) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/calendar.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/calendar.ets new file mode 100644 index 0000000000000000000000000000000000000000..7be4f5545d0b194f859f2a6baa7c4125c5bfec01 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/calendar.ets @@ -0,0 +1,91 @@ +/* + * 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct calendar { + @State curMonth: MonthData = { year: 0, month: 0, data: [] }; + @State preMonth: MonthData = { year: 0, month: 0, data: [] }; + @State nextMonth: MonthData = { year: 0, month: 0, data: [] } + @State year: number = 0 + @State month: number = 0 + Controller: CalendarController = new CalendarController(); + private lunarMonthDays: string[] = [ + '初一', '初二', '初三', '初四', '初五', '初六', '初七', '初八', '初九', '初十', + '十一', '十二', '十三', '十四', '十五', '十六', '十七', '十八', '十九', '二十', + '廿一', '廿二', '廿三', '廿四', '廿五', '廿六', '廿七', '廿八', '廿九', '三十'] + private lunarMonthNames: string[] = ['正月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '冬月', '腊月'] + + build() { + Calendar({ + date: { year: 2021, month: 8, day: 35 }, + currentData: this.curMonth, + preData: this.preMonth, + nextData: this.nextMonth, + controller: this.Controller + }) + .showLunar(true) + .showHoliday(true) + .needSlide(true) + .offDays(Week.Fri | Week.Sat | Week.Mon | Week.Thur) + .startOfWeek(Week.Sun) + .direction(Axis.Horizontal) + .currentDayStyle({ + dayColor: Color.Black, + lunarColor: Color.Gray, + markLunarColor: Color.Black, + dayFontSize: 15, + lunarDayFontSize: 10, + boundaryColOffset: 10, + }) + .nonCurrentDayStyle({ + nonCurrentMonthDayColor: Color.Black, + nonCurrentMonthLunarColor: Color.Gray, + nonCurrentMonthWorkDayMarkColor: Color.Green, + nonCurrentMonthOffDayMarkColor: Color.Brown, + }) + .todayStyle({ + focusedDayColor: Color.Red, + focusedLunarColor: Color.Orange, + focusedAreaBackgroundColor: Color.Blue, + focusedAreaRadius: 20 + }) + .weekStyle({ + weekColor: Color.Black, + weekendDayColor: Color.Orange, + weekendLunarColor: Color.Blue, + weekFontSize: 20, + weekHeight: 5, + weekWidth: 48, + }) + .workStateStyle({ + workDayMarkColor: Color.Red, + offDayMarkColor: Color.Orange, + workDayMarkSize: 10, + offDayMarkSize: 2, + workStateWidth: 12, + workStateHorizontalMovingDistance: 0, + workStateVerticalMovingDistance: 12, + }) + .onSelectChange((request) => { + this.year = request.year; + this.month = request.month; + console.info('On Select change: ' + this.year + '/' + this.month) + }) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/canvas.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/canvas.ets new file mode 100644 index 0000000000000000000000000000000000000000..68eb1ed29b6b272dc327979e9be5f85b301da6d4 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/canvas.ets @@ -0,0 +1,69 @@ +/** + * 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 CanvasActualBoundingBoxAscent { + + private settings: RenderingContextSettings = new RenderingContextSettings(true)//antialias:boolean + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear CanvasActualBoundingBoxAscent start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear CanvasActualBoundingBoxAscent end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Canvas(this.context) + .key('Canvas') + .width('100%') + .height('100%') + .backgroundColor('#ffff00') + .position({x:3,y:5}) + .align(Alignment.Center) + .onReady(() =>{ + this.context.font = '50px sans-serif' + this.context.fillText("Hello World!", 20, 100) + this.context.textBaseline = 'top' + this.context.fillText("width:" + this.context.measureText("Hello World!").width, 20, 150) + this.context.fillText("actualBoundingBoxAscent:" + this.context.measureText("Hello World!").actualBoundingBoxAscent, 20, 200) + this.context.fillText("actualBoundingBoxDescent:" + this.context.measureText("Hello World!").actualBoundingBoxDescent, 20, 250) + this.context.fillText("actualBoundingBoxLeft:" + this.context.measureText("Hello World!").actualBoundingBoxLeft, 20, 300) + this.context.fillText("actualBoundingBoxRight:" + this.context.measureText("Hello World!").actualBoundingBoxRight, 20, 350) + this.context.fillText("alphabeticBaseline:" + this.context.measureText("Hello World!").alphabeticBaseline, 20, 400) + this.context.fillText("emHeightAscent:" + this.context.measureText("Hello World!").emHeightAscent, 20, 450) + this.context.fillText("emHeightDescent:" + this.context.measureText("Hello World!").emHeightDescent, 20, 500) + this.context.fillText("fontBoundingBoxAscent:" + this.context.measureText("Hello World!").fontBoundingBoxAscent, 20, 550) + this.context.fillText("fontBoundingBoxDescent:" + this.context.measureText("Hello World!").fontBoundingBoxDescent, 20, 600) + this.context.fillText("hangingBaseline:" + this.context.measureText("Hello World!").hangingBaseline, 20, 650) + this.context.fillText("ideographicBaseline" + this.context.measureText("Hello World!").ideographicBaseline, 20, 700) +// this.context.fillText("antialias" + this.context.measureText("Hello World!").antialias, 20, 700) + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/checkBox.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/checkBox.ets new file mode 100644 index 0000000000000000000000000000000000000000..a5e30c37435814541ade95cac85dab10c9bdf12f --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/checkBox.ets @@ -0,0 +1,76 @@ +/** + * 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 CheckBoxGroup { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear CheckBoxGroup start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear CheckBoxGroup end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("checkBox-Group") + .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("groupText") + + Row() { + CheckboxGroup({group : 'checkboxGroup'}) + .selectedColor(0xed6f21) + .key('CheckboxGroup') + .onChange((itemName:CheckboxGroupResult) => { + console.info("TextPicker::dialogResult is" + JSON.stringify(itemName)) + }) + Text('select all').fontSize(20) + Checkbox({name: 'checkbox1', group: 'checkboxGroup'}) + .key('Checkbox1') + .select(true) + .selectedColor(0xed6f21) + .onChange((value: boolean) => { + console.info('Checkbox1 change is'+ value) + }) + Checkbox({name: 'checkbox2', group: 'checkboxGroup'}) + .key('Checkbox2') + .select(false) + .selectedColor(0x39a2db) + .onChange((value: boolean) => { + console.info('Checkbox2 change is'+ value) + }) + } + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/checkBoxGroup.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/checkBoxGroup.ets new file mode 100644 index 0000000000000000000000000000000000000000..59c3785e25d392190ae2ed36dabca17d61a69c7a --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/checkBoxGroup.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'; +import events_emitter from '@ohos.events.emitter'; +import Utils from '../../test/Utils.ets' +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct CheckBoxGroupPart { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear CheckBoxGroupPart start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear CheckBoxGroupPart end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("checkBoxGroup-Part") + .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("PartText") + + Text("checkBoxGroup-Group") + .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("groupText") + + CheckboxGroup({group : 'checkboxGroup'}) + .key('CheckboxGroup') + .selectedColor(0xed6f21) + .onChange((itemName:CheckboxGroupResult) => { + console.info("TextPicker::dialogResult is" + JSON.stringify(itemName)) + console.info("TextPicker::dialogResult is" + JSON.stringify(itemName.status)) + try { + var backData = { + data: { + "STATUS": itemName.status + } + } + let backEvent = { + eventId: 60301, + priority: events_emitter.EventPriority.LOW + } + console.info("Part start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("Part emit action state err: " + JSON.stringify(err.message)) + } + Utils.sleep(1000); + if(itemName.status === SelectStatus.Part){ + console.info("CheckboxGroup SelectStatus.Part") + } + }) + Text('select all').fontSize(20) + Checkbox({name: 'checkbox1', group: 'checkboxGroup'}) + .key('Checkbox1') + .select(true) + .selectedColor(0xed6f21) + .onChange((value: boolean) => { + console.info('Checkbox1 change is'+ value) + }) + Checkbox({name: 'checkbox2', group: 'checkboxGroup'}) + .key('Checkbox2') + .select(false) + .selectedColor(0x39a2db) + .onChange((value: boolean) => { + console.info('Checkbox2 change is'+ value) + }) + + + }.width("100%").height("100%") + + + + + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/color.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/color.ets new file mode 100644 index 0000000000000000000000000000000000000000..4afa006f0d6b60229e546a5b665e4be4f3bf1650 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/color.ets @@ -0,0 +1,39 @@ +/** + * 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 ColorEnum { + build() { + Column() { + Text('Transparent') + .fontColor(Color.Transparent) + .backgroundColor(Color.Yellow) + .fontSize(50) + .key('Transparent') + .onClick(() => { + let strJson = getInspectorByKey('Transparent'); + let obj = JSON.parse(strJson); + console.info("testTransparent fontColor is" + obj.$attrs.fontColor); + }) + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/common.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/common.ets new file mode 100644 index 0000000000000000000000000000000000000000..d5e9b6245e5b7ab86f800a8b9a6d38ea771d9ec3 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/common.ets @@ -0,0 +1,634 @@ +/** + * 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'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct CommonColorMode { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear CommonColorMode start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear CommonColorMode end`) + } + + @Styles normalStyles() { + .backgroundColor("#0A59F7") + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("common-FontScale") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("fontScaleText") + + Text("common-OnFinish") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("onFinishText") + .animation({ + onFinish: () => { + Log.showInfo(TAG, 'animation onFinish success') + } + }) + + Text("common-MotionPath") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("motionPathText") + .sharedTransition('motionPathText', { + motionPath: { + path: '' + } + }) + + Text("common-Middle") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("middleText") + .alignRules({ + middle: { anchor: 'string', align: HorizontalAlign.Center } + }) + + Text("common-Area") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("areaText") + .onClick((event) => { + Log.showInfo(TAG, 'JSON.stringify area : ' + JSON.stringify(event.target.area)) + const area = JSON.stringify(event.target.area) + console.info("area value1 is: " + area) + console.info("area value3 is: " + JSON.parse(JSON.stringify(event.target.area))["width"]) + let value = JSON.parse(JSON.stringify(event.target.area))["width"] + try { + var backData = { + data: { + "STATUS": value + } + } + let backEvent = { + eventId: 60312, + priority: events_emitter.EventPriority.LOW + } + console.info("areaValue start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("areaValue emit action state err: " + JSON.stringify(err.message)) + } + }) + Text("common-Repeat") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("RepeatText") + .borderImage({ + source: { angle: 90, + direction: GradientDirection.Left, + colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]] + }, + slice: { top: 10, bottom: 10, left: 10, right: 10 }, + width: { top: "10px", bottom: "10px", left: "10px", right: "10px" }, + repeat: RepeatMode.Repeat, + fill: false + }); + + Text("common-Space") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("SpaceText") + .borderImage({ + source: { angle: 90, + direction: GradientDirection.Left, + colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]] + }, + slice: { top: 10, bottom: 10, left: 10, right: 10 }, + width: { top: "10px", bottom: "10px", left: "10px", right: "10px" }, + repeat: RepeatMode.Space, + fill: false + }); + + Text("common-Thin") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ThinText") + .backgroundBlurStyle(BlurStyle.Thin) + + Text("common-Thick") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ThickText") + .backgroundBlurStyle(BlurStyle.Thick) + + Text("common-Slice") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("sliceText") + .borderImage({ + source: { angle: 90, + direction: GradientDirection.Left, + colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]] + }, + slice: { top: 10, bottom: 10, left: 10, right: 10 }, + width: { top: "10px", bottom: "10px", left: "10px", right: "10px" }, + repeat: RepeatMode.Stretch, + fill: false + }); + + Text("common-Outset") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("outsetText") + .borderImage({ + source: { angle: 90, + direction: GradientDirection.Left, + colors: [[0xAEE1E1, 0.0], [0xD3E0DC, 0.3], [0xFCD1D1, 1.0]] + }, + slice: { top: 10, bottom: 10, left: 10, right: 10 }, + width: { top: "10px", bottom: "10px", left: "10px", right: "10px" }, + repeat: RepeatMode.Stretch, + fill: false, + outset: 2 + }); + + + Text("common-Touches") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("touchesText") + .onTouch((event) => { + Log.showInfo(TAG, 'touches: ' + JSON.stringify(event.touches)) + const touchesValue = JSON.stringify(event.touches) + console.info("touches value1 is: " + touchesValue) + console.info("touches value3 is: " + JSON.stringify(event.touches)[0]["type"]) + let value = JSON.stringify(event.touches)[0]["type"] + try { + var backData1 = { + data: { + "STATUS": value + } + } + let backEvent1 = { + eventId: 60313, + priority: events_emitter.EventPriority.LOW + } + console.info("touchesValue start to emit action state") + events_emitter.emit(backEvent1, backData1) + } catch (err) { + console.info("touchesValue emit action state err: " + JSON.stringify(err.message)) + } + }) + + Text("common-ChangedTouches") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("changedTouchesText") + .onTouch((event) => { + Log.showInfo(TAG, 'changedTouches: ' + JSON.stringify(event.changedTouches)) + const changedTouchesValue = JSON.stringify(event.changedTouches) + console.info("changedTouchesValue value1 is: " + changedTouchesValue) + console.info("changedTouchesValue value3 is: " + changedTouchesValue[0]["type"]) + let value = changedTouchesValue[0]["type"] + try { + var backData2 = { + data: { + "STATUS": value + } + } + let backEvent2 = { + eventId: 60314, + priority: events_emitter.EventPriority.LOW + } + console.info("touchesValue start to emit action state") + events_emitter.emit(backEvent2, backData2) + } catch (err) { + console.info("touchesValue emit action state err: " + JSON.stringify(err.message)) + } + }) + + Text("common-KeyCode") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("keyCodeText") + .onKeyEvent((event) => { + Log.showInfo(TAG, 'keyCode: ' + event.keyCode) + }) + + Text("common-KeyText") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("keyTextText") + .onKeyEvent((event) => { + Log.showInfo(TAG, 'keyText: ' + event.keyText) + }) + + Text("common-KeySource") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("keySourceText") + .onKeyEvent((event) => { + Log.showInfo(TAG, 'keySource: ' + event.keySource) + }) + + Text("common-DeviceId") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("deviceIdText") + .onKeyEvent((event) => { + Log.showInfo(TAG, 'deviceId: ' + event.deviceId) + }) + + Text("common-MetaKey") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("metaKeyText") + .onKeyEvent((event) => { + Log.showInfo(TAG, 'metaKey: ' + event.metaKey) + }) + + Text("common-Normal") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("normalText") + .stateStyles({ normal: this.normalStyles }) + + Text("common-Pressed") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("pressedText") + .stateStyles({ pressed: this.normalStyles }) + + Text("common-Focused") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("focusedText") + .stateStyles({ focused: this.normalStyles }) + + Text("common-Clicked") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("clickedText") + .stateStyles({ clicked: this.normalStyles }) + + }.width("100%").height("100%") + } +} + +@Preview({ + locale: 'locale' +}) +@Component +struct PreviewParamsLocale { + build() { + Flex() { + Text("common-locale") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("LocaleText") + } + } +} + +@Preview({ + colorMode: 'red', +}) +@Component +struct PreviewParamsColorMode { + build() { + Flex() { + Text("common-colorMode") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ColorModeText") + } + } +} + +@Preview({ + deviceType: 'phone' +}) +@Component +struct PreviewParamsDeviceType { + build() { + Flex() { + Text("common-deviceType") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("DeviceTypeText") + } + } +} + +@Preview({ + dpi: 160 +}) +@Component +struct PreviewParamsDpi { + build() { + Flex() { + Text("common-dpi") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("DpiText") + } + } +} + +@Preview({ + orientation: '' +}) +@Component +struct PreviewParamsOrientation { + build() { + Flex() { + Text("common-orientation") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("OrientationText") + } + } +} + +@Preview({ + roundScreen: true +}) +@Component +struct PreviewParamsRoundScreen { + build() { + Flex() { + Text("common-roundScreen") + .width(320) + .height(40) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("RoundScreenText") + } + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/copyOption.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/copyOption.ets new file mode 100644 index 0000000000000000000000000000000000000000..45d9185f2dd57dd13ebc2dc0a0d3380b62dee6e4 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/copyOption.ets @@ -0,0 +1,69 @@ +/** + * 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 CopyOption { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear CopyOption start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear CopyOption end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + Text("copyOption-InApp") + .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("InAppText") +// .copyOption(CopyOption.InApp) + .visibility(Visibility.None) + + Text("copyOption-LocalDevice") + .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("LocalDeviceText") +// .copyOption(CopyOption.LocalDevice) + .visibility(Visibility.None) + + }.width("100%").height("100%") + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/curves.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/curves.ets new file mode 100644 index 0000000000000000000000000000000000000000..234d01e3ec45155bc8677943cc80aeaa56545cc0 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/curves.ets @@ -0,0 +1,262 @@ +/** + * 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 CurvesEaseOut { + @State widthSize: number = 400 + @State heightSize: number = 200 + @State flag: boolean = true + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear CurvesEaseOut start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear CurvesEaseOut end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("EaseOutText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, // 动画时长 + curve: Curve.EaseOut, // 动画曲线:以低速结束 + delay: 100, // 动画延迟 + iterations: 1, // 播放次数 + playMode: PlayMode.Normal // 动画模式 + }) // 对Button组件的宽高属性进行动画配置 + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("EaseInOutText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, + curve: Curve.EaseInOut, //以低速开始和结束 + delay: 100, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("FastOutSlowInText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, + curve: Curve.FastOutSlowIn, //标准曲线 + delay: 100, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("LinearOutSlowInText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, + curve: Curve.LinearOutSlowIn, //减速曲线 + delay: 100, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("FastOutLinearInText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, + curve: Curve.FastOutLinearIn, //加速曲线 + delay: 100, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("ExtremeDecelerationText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, + curve: Curve.ExtremeDeceleration, //急缓曲线 + delay: 100, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("SharpText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, + curve: Curve.Sharp, //锐利曲线 + delay: 100, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("RhythmText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, + curve: Curve.Rhythm, //节奏曲线 + delay: 100, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("SmoothText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, + curve: Curve.Smooth, //平滑曲线 + delay: 100, + iterations: 1, + playMode: PlayMode.Normal + }) + + Button('click me') + .align(Alignment.Center) + .onClick((event: ClickEvent) => { + if (this.flag) { + this.widthSize = 100 + this.heightSize = 50 + } else { + this.widthSize = 400 + this.heightSize = 200 + } + this.flag = !this.flag + }) + .key("FrictionText") + .width(this.widthSize).height(this.heightSize).backgroundColor(0x317aff) + .animation({ + duration: 1000, + curve: Curve.Friction, //阻尼曲线 + delay: 100, + iterations: 1, + playMode: PlayMode.Normal + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/datePicker.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/datePicker.ets new file mode 100644 index 0000000000000000000000000000000000000000..558b73166c484a252e8963d6c50b240ad480a15a --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/datePicker.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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct DatePickerLunar { + private selectedDate: Date = new Date('2021-08-08') + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear DatePickerLunar start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear DatePickerLunar end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("datePicker-Lunar") + .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("lunarText") + + DatePicker({ + start: new Date('1970-1-1'), + end: new Date('2100-1-1'), + selected: this.selectedDate, + }) + .key("DatePicker") + .lunar(true) + .onChange((date: DatePickerResult) => { + Log.showInfo(TAG, 'select current date is: ' + JSON.stringify(date)) + }) + + DatePicker({ + start: new Date('1970-1-1'), + end: new Date('2100-1-1'), + selected: this.selectedDate, + }) + .lunar(false) + .onChange((date: DatePickerResult) => { + Log.showInfo(TAG, 'select current date is: ' + JSON.stringify(date)) + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/edgeEffect.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/edgeEffect.ets new file mode 100644 index 0000000000000000000000000000000000000000..6f5db39807d791c938aa184e7f61c75d86a97d38 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/edgeEffect.ets @@ -0,0 +1,59 @@ +/** + * 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct ListExample { + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + @State edgeEffect: EdgeEffect = EdgeEffect.Fade + + build() { + Stack({ alignContent: Alignment.TopStart }) { + Column() { + List({ space: 20, initialIndex: 0 }) { + ForEach(this.arr, (item) => { + ListItem() { + Text('' + item) + .width('100%').height(100).fontSize(16) + .textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xFFFFFF) + }.editable(true) + }, item => item) + } + .key('list') + .listDirection(Axis.Vertical) // 排列方向 + .divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) // 每行之间的分界线 + .edgeEffect(this.edgeEffect) // 滑动到边缘无效果 + .chainAnimation(false) // 联动特效关闭 + .onScrollIndex((firstIndex: number, lastIndex: number) => { + console.info('first' + firstIndex) + console.info('last' + lastIndex) + }) + .onItemDelete((index: number) => { + console.info(this.arr[index] + 'Delete') + this.arr.splice(index, 1) + console.info(JSON.stringify(this.arr)) + return true + }).width('90%') + }.width('100%') + + }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 }) + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/enums.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/enums.ets new file mode 100644 index 0000000000000000000000000000000000000000..8a658286538e07ee855ae2c970eb7b4e86321441 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/enums.ets @@ -0,0 +1,623 @@ +/** + * 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 EnumsCancel { + + @State widthSize: number = 200 + @State heightSize: number = 100 + @State flag: boolean = true + + @State state: AnimationStatus = AnimationStatus.Initial + @State reverse: boolean = false + @State iterations: number = 1 + + @State value: string = '' + @State text: string = '' + @State eventType: string = '' + + @State mouseText: string = 'MouseText' + + @Styles pressedStyles() { + .backgroundColor('red') + .opacity(1) + } + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear EnumsCancel start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear EnumsCancel end`) + } + + @State responseTypeClick: ResponseType = ResponseType.RightClick; + @State responseTypePress: ResponseType = ResponseType.LongPress; + @Builder ContextMenuBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('text3') + .fontSize(20) + .width(100) + .height(50) + .textAlign(TextAlign.Center) + Divider().height(10) + } + } + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("enums-Cancel") + .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("CancelText") + .visibility(Visibility.None) + + Text("enums-Middle") + .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("MiddleText") + .visibility(Visibility.None) + + Text("enums-Forward") + .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("ForwardText") + .visibility(Visibility.None) + + Text("enums-Press") + .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("PressText") + .visibility(Visibility.None) + + Text("enums-EaseOut") + .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("EaseOutText") + .visibility(Visibility.None) + + Text("enums-EaseInOut") + .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("EaseInOutText") + .visibility(Visibility.None) + + Text("enums-FastOutSlowIn") + .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("FastOutSlowInText") + .visibility(Visibility.None) + + Text("enums-LinearOutSlowIn") + .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("LinearOutSlowInText") + .visibility(Visibility.None) + + Text("enums-FastOutLinearIn") + .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("FastOutLinearInText") + .visibility(Visibility.None) + + Text("enums-ExtremeDeceleration") + .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("ExtremeDecelerationText") + .visibility(Visibility.None) + + Text("enums-Sharp") + .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("SharpText") + .visibility(Visibility.None) + + Text("enums-Rhythm") + .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("RhythmText") + .visibility(Visibility.None) + + Text("enums-Smooth") + .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("SmoothText") + .visibility(Visibility.None) + + Text("enums-Friction") + .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("FrictionText") + .visibility(Visibility.None) + + Text("enums-Forwards") + .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("ForwardsText") + .visibility(Visibility.None) + + Text("enums-Reverse") + .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("ReverseText") + .visibility(Visibility.None) + + Text("enums-Alternate") + .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("AlternateText") + .visibility(Visibility.None) + + Text("enums-Keyboard") + .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("KeyboardText") + .visibility(Visibility.None) + + Text("enums-Middle") + .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("MiddleText") + .visibility(Visibility.None) + + Text("enums-Mon") + .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("MonText") + .visibility(Visibility.None) + + Text("enums-Thur") + .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("ThurText") + .visibility(Visibility.None) + + Text("enums-Fri") + .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("FriText") + .visibility(Visibility.None) + + Text("enums-Sat") + .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("SatText") + .visibility(Visibility.None) + + Text("enums-Fade") + .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("FadeText") + .visibility(Visibility.None) + + Text("enums-FILL") + .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("FILLText") + .visibility(Visibility.None) + + Text("enums-FIT") + .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("FITText") + .visibility(Visibility.None) + + Text("enums-RightClick") + .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("RightClickText") + .bindContextMenu(this.ContextMenuBuilder(), this.responseTypeClick) + .visibility(Visibility.None) + + Text("enums-LongPress") + .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("LongPressText") + .bindContextMenu(this.ContextMenuBuilder(), this.responseTypePress) + .visibility(Visibility.None) + + Text("enums-Scale") + .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("ScaleText") + .hoverEffect(HoverEffect.Scale) + .visibility(Visibility.None) + + Text("enums-Highlight") + .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("HighlightText") + .hoverEffect(HoverEffect.Highlight) + .visibility(Visibility.None) + + Text("enums-InApp") + .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("InAppText") + .copyOption(CopyOptions.InApp) + .visibility(Visibility.None) + + Text("enums-LocalDevice") + .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("LocalDeviceText") + .copyOption(CopyOptions.LocalDevice) + .visibility(Visibility.None) + Text("enums-CrossDevice") + .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("CrossDeviceText") +// .copyOption(CopyOptions.CrossDevice) + .visibility(Visibility.None) + + Button('Touch').backgroundColor(0x2788D9).height(40).width(80) + .onTouch((event: TouchEvent) => { + if (event.type === TouchType.Down) { + this.eventType = 'Down' + } + if (event.type === TouchType.Up) { + this.eventType = 'Up' + } + if (event.type === TouchType.Move) { + this.eventType = 'Move' + } + if (event.type === TouchType.Cancel) { + this.eventType = 'Cancel' + } + console.info(this.text = 'TouchType:' + this.eventType + '\nDistance between touch point and touch element:\nx: ' + + event.touches[0].x + '\n' + 'y: ' + event.touches[0].y + '\ncomponent globalPos:(' + + event.target.area.globalPosition.x + ',' + event.target.area.globalPosition.y + ')\nwidth:' + + event.target.area.width + '\nheight:' + event.target.area.height) + }) + Text(this.text) + + Button(this.mouseText) + .onMouse((event: MouseEvent) => { + if (MouseAction.Press || MouseButton.Middle) { + console.log(this.mouseText = 'onMouse:\nButton = ' + event.button + + '\nAction = ' + event.action + '\nlocalXY=(' + event.x + ',' + event.y + ')' + + '\nscreenXY=(' + event.screenX + ',' + event.screenY + ')') + } + else if (MouseAction.Press && MouseButton.Forward) { + console.log(this.mouseText = 'onMouse:\nButton = ' + event.button + + '\nAction = ' + event.action + '\nlocalXY=(' + event.x + ',' + event.y + ')' + + '\nscreenXY=(' + event.screenX + ',' + event.screenY + ')') + } + else if (MouseAction.Press) { + console.info("pressed") + } + }) + + Text("enums-FillMode") + .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("FillModeText") + .visibility(Visibility.None) + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/featureAbility.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/featureAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..f8c72d5fc13bbcf0075c450a36d218d66a037efb --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/featureAbility.ets @@ -0,0 +1,402 @@ +/** + * 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 FeatureAbilityAbilityName { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear FeatureAbilityAbilityName start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear FeatureAbilityAbilityName end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("featureAbility-SubscribeMessageResponse-DeviceId") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("subscribeMessageResponseDeviceIdText") + .onClick(() => { + FeatureAbility.subscribeMsg({ + success: (data) => { + console.log(`deviceId: ${data.deviceId}`) + }, + fail: (data, code) => { + console.log(`data: ${data} code: ${code}`) + } + }) + }) + + Text("featureAbility-SubscribeMessageResponse-AbilityName") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("subscribeMessageResponseAbilityNameText") + .onClick(() => { + FeatureAbility.subscribeMsg({ + success: (data) => { + console.log(`deviceId: ${data.abilityName}`) + }, + fail: (data, code) => { + console.log(`data: ${data} code: ${code}`) + } + }) + }) + + Text("featureAbility-CallAbilityParam-AbilityName") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("callAbilityParamAbilityNameText") + .onClick(() => { + FeatureAbility.callAbility({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + messageCode: 1001, + data: { + firstNum: 1024, + secondNum: 2048 + }, + abilityType: 0, + syncOption: 0 + }) + }) + + Text("featureAbility-CallAbilityParam-MessageCode") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("callAbilityParamMessageCodeText") + .onClick(() => { + FeatureAbility.callAbility({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + messageCode: 1001, + data: { + firstNum: 1024, + secondNum: 2048 + }, + abilityType: 0, + syncOption: 0 + }) + }) + + Text("featureAbility-CallAbilityParam-AbilityType") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("callAbilityParamAbilityTypeText") + .onClick(() => { + FeatureAbility.callAbility({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + messageCode: 1001, + data: { + firstNum: 1024, + secondNum: 2048 + }, + abilityType: 0, + syncOption: 0 + }) + }) + + Text("featureAbility-CallAbilityParam-SyncOption") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("callAbilityParamSyncOptionText") + .onClick(() => { + FeatureAbility.callAbility({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + messageCode: 1001, + data: { + firstNum: 1024, + secondNum: 2048 + }, + abilityType: 0, + syncOption: 0 + }) + }) + + Text("featureAbility-SubscribeAbilityEventParam-AbilityName") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("subscribeAbilityEventParamAbilityNameText") + .onClick(() => { + FeatureAbility.subscribeAbilityEvent({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + messageCode: 1005, + abilityType: 0, + syncOption: 0 + }, (callbackData) => { + var callbackJson = JSON.parse(callbackData); + console.info('eventData is: ' + JSON.stringify(callbackJson.data)); + }) + }) + + Text("featureAbility-SubscribeAbilityEventParam-MessageCode") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("subscribeAbilityEventParammessageCodeText") + .onClick(() => { + FeatureAbility.subscribeAbilityEvent({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + messageCode: 1005, + abilityType: 0, + syncOption: 0 + }, (callbackData) => { + var callbackJson = JSON.parse(callbackData); + console.info('eventData is: ' + JSON.stringify(callbackJson.data)); + }) + }) + + Text("featureAbility-SubscribeAbilityEventParam-AbilityType") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("subscribeAbilityEventParamAbilityTypeText") + .onClick(() => { + FeatureAbility.subscribeAbilityEvent({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + messageCode: 1005, + abilityType: 0, + syncOption: 0 + }, (callbackData) => { + var callbackJson = JSON.parse(callbackData); + console.info('eventData is: ' + JSON.stringify(callbackJson.data)); + }) + }) + + Text("featureAbility-SubscribeAbilityEventParam-SyncOption") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("subscribeAbilityEventParamSyncOptionText") + .onClick(() => { + FeatureAbility.subscribeAbilityEvent({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + messageCode: 1005, + abilityType: 0, + syncOption: 0 + }, (callbackData) => { + var callbackJson = JSON.parse(callbackData); + console.info('eventData is: ' + JSON.stringify(callbackJson.data)); + }) + }) + + + Text("featureAbility-SendMessageOptions-DeviceId") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("sendMessageOptionsDeviceIdText") + .onClick(() => { + FeatureAbility.sendMsg({ + deviceId: '1001', + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility' + }) + }) + + Text("featureAbility-SendMessageOptions-AbilityName") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("sendMessageOptionsAbilityNameText") + .onClick(() => { + FeatureAbility.sendMsg({ + deviceId: '1001', + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility' + }) + }) + + Text("featureAbility-RequestParams-AbilityName") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("requestParamsAbilityNameText") + .onClick(() => { + FeatureAbility.startAbility({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility' + }) + }) + + Text("featureAbility-Entities") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("entitiesText") + .onClick(() => { + FeatureAbility.startAbility({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + entities: ["this is a test"] + }) + }) + + Text("featureAbility-DeviceType") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("deviceTypeText") + .onClick(() => { + FeatureAbility.startAbility({ + bundleName: 'com.example.hiaceservice', + abilityName: 'com.example.hiaceservice.ComputeServiceAbility', + deviceType: 1001 + }) + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/fill_mode.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/fill_mode.ets new file mode 100644 index 0000000000000000000000000000000000000000..57eb7a70fe83ea7156a4e2123d271fb4328eb83a --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/fill_mode.ets @@ -0,0 +1,111 @@ +/** + * 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct ImageAnimatorExample { + @State state: AnimationStatus = AnimationStatus.Initial + @State reverse: boolean = false + @State iterations: number = 1 + + build() { + Column({ space:5 }) { + ImageAnimator() + .images([ + { + src: '/comment/bg1.png', + duration: 500, + width: 325, + height: 200, + top: 0, + left: 0 + }, + { + src: '/comment/bg2.png', + duration: 500, + width: 325, + height: 200, + top: 0, + left: 0 + }, + { + src: $rawfile('bg3.png'), + duration: 500, + width: 325, + height: 200, + top: 0, + left: 0 + }, + { + src: $rawfile('bg4.png'), + duration: 500, + width: 325, + height: 200, + top: 0, + left: 0 + } + ]) + .key("ImageAnimator") + .state(this.state).reverse(this.reverse).fixedSize(false).preDecode(2) + .fillMode(FillMode.Forwards) + .iterations(this.iterations) + .width(325) + .height(210) + .margin({top:100}) + .onStart(() => { // 当帧动画开始播放后触发 + console.info('Start') + }) + .onPause(() => { + console.info('Pause') + }) + .onRepeat(() => { + console.info('Repeat') + }) + .onCancel(() => { + console.info('Cancel') + }) + .onFinish(() => { // 当帧动画播放完成后触发 + this.state = AnimationStatus.Stopped + console.info('Finish') + }) + Row() { + Button('start').width(100).padding(5).onClick(() => { + this.state = AnimationStatus.Running + }) + Button('pause').width(100).padding(5).onClick(() => { + this.state = AnimationStatus.Paused + }) + Button('stop').width(100).padding(5).onClick(() => { + this.state = AnimationStatus.Stopped + }) + } + Row() { + Button('reverse').width(100).padding(5).onClick(() => { + this.reverse = !this.reverse + }) + Button('once').width(100).padding(5).onClick(() => { + this.iterations = 1 + }) + Button('iteration').width(100).padding(5).onClick(() => { + this.iterations = -1 + }) + } + }.width('100%').height('100%').backgroundColor(0xF1F3F5) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gesture.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gesture.ets new file mode 100644 index 0000000000000000000000000000000000000000..b9a951d76a3f39c623b4d91a6cc25428bab5697b --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gesture.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 GestureParallel { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear GestureParallel start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear GestureParallel end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("gesture-Parallel") + .width(320) + .height(120) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("ParallelText") + .gesture( + GestureGroup(GestureMode.Parallel, + LongPressGesture({ repeat: true }) + .onAction((event: GestureEvent) => { + Log.showInfo(TAG, `LongPress onAction`) + }) + .onActionEnd(() => { + Log.showInfo(TAG, `LongPress end`) + }), + PanGesture({}) + .onActionStart(() => { + Log.showInfo(TAG, `onActionStart`) + }) + .onActionUpdate((event: GestureEvent) => { + Log.showInfo(TAG, `onActionUpdate`) + }) + ) + ) + + Text("gesture-Exclusive") + .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("ExclusiveText") + .gesture( + GestureGroup(GestureMode.Exclusive, + LongPressGesture({ repeat: true }) + .onAction((event: GestureEvent) => { + Log.showInfo(TAG, `LongPress onAction`) + }) + .onActionEnd(() => { + Log.showInfo(TAG, `LongPress end`) + }), + PanGesture({}) + .onActionStart(() => { + Log.showInfo(TAG, `onActionStart`) + }) + .onActionUpdate((event: GestureEvent) => { + Log.showInfo(TAG, `onActionUpdate`) + }) + ) + ) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gridCol.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gridCol.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d949160c18b711c61c61d7e4a916ed052961342 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gridCol.ets @@ -0,0 +1,96 @@ +/** + * 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 GridColXl { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear GridColXl start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear GridColXl end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + GridRow(){ + GridCol({ span: { xl: 2 } }){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol({ span: { xl: 2 } }){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("xlText") + + GridRow(){ + GridCol({ span: { xxl: 2 } }){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol({ span: { xxl: 2 } }){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("xxlText") + + GridRow(){ + GridCol({ span: { xl: 2 } }){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .key("GridCol") + .order({xl: 10}) + .backgroundColor(Color.Green) + GridCol({ span: { xl: 2 } }){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .order(10) + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("orderText") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gridRow.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gridRow.ets new file mode 100644 index 0000000000000000000000000000000000000000..95ca6fdfff9a6a4c6ff8b87e5939b26a01a9af53 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/gridRow.ets @@ -0,0 +1,186 @@ +/** + * 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 GridRowXl { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear GridRowXl start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear GridRowXl end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + + GridRow({columns: {xl: 2}}){ + GridCol(){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol(){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + } + .backgroundColor(Color.Red) + .key("GridRowColumnOption——xl") + + GridRow({columns: {xxl: 2}}){ + GridCol(){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol(){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("GridRowColumnOption——xxl") + + GridRow({gutter:{x: {xl: 2}}}){ + GridCol(){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol(){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("GridRowSizeOption——xl") + + GridRow({gutter:{x: {xxl: 2}}}){ + GridCol(){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol(){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("GridRowSizeOption——xxl") + + GridRow({breakpoints: { reference: BreakpointsReference.WindowSize }}){ + GridCol(){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol(){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("WindowSizeText") + + GridRow({breakpoints: { reference: BreakpointsReference.ComponentSize }}){ + GridCol(){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol(){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("ComponentSizeText") + + GridRow({breakpoints: { reference: BreakpointsReference.ComponentSize }}){ + GridCol(){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol(){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("referenceText") + + GridRow({breakpoints: { reference: BreakpointsReference.ComponentSize }}){ + GridCol(){ + Text('Hello') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Green) + GridCol(){ + Text('World') + .width(100) + .height(70) + .align(Alignment.Center) + } + .backgroundColor(Color.Blue) + }.backgroundColor(Color.Red) + .key("breakpointsText") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/hitTestMode.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/hitTestMode.ets new file mode 100644 index 0000000000000000000000000000000000000000..c883c70f477c9eae4a7cc027130a9c222c9c0801 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/hitTestMode.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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct HitTestMode { + build() { + Column() { + // outer stack 1 + Stack() { + Button('outer button') + .onTouch((event) => { + console.info('HitTestMode outer button touched type: ' + event.type) + }) + // inner stack + Stack() { + Button('inner button') + .key("innnerButton") + .onTouch((event) => { + console.info('HitTestMode inner button touched type: ' + event.type) + }) + } + .key("Block") + .width("100%") + .height("100%") +// .hitTestBehavior(HitTestMode.Block) + .onTouch((event) => { + console.info('HitTestMode inner stack touched type: ' + event.type) + }) + + Text('Transparent') + .key("Transparent") +// .hitTestBehavior(HitTestMode.Transparent) + .width("100%") + .height("50%") + .onTouch((event) => { + console.info('HitTestMode text touched type: ' + event.type) + let strJson = getInspectorByKey('Transparent'); + let obj = JSON.parse(strJson); + console.info("HitTestMode hitTestBehavior is " + obj.$attrs.hitTestBehavior); + let strJson2 = getInspectorByKey('Block'); + let obj2 = JSON.parse(strJson2); + console.info("HitTestMode hitTestBehavior is " + obj2.$attrs.hitTestBehavior); + }) + }.width(300).height(300).backgroundColor(Color.Gray) + }.width('100%').height('100%') + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/hoverEffect.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/hoverEffect.ets new file mode 100644 index 0000000000000000000000000000000000000000..28aec9fabce9ad5b8b24d2c43e1c07731f301683 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/hoverEffect.ets @@ -0,0 +1,70 @@ +//@ts-nocheck +/** + * 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 HoverEffect { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear HoverEffect start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear HoverEffect end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + Text("hoverEffect-Scale") + .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("ScaleText") + .hoverEffect(HoverEffect.Scale) + .visibility(Visibility.None) + + Text("hoverEffect-Highlight") + .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("HighlightText") + .hoverEffect(HoverEffect.Highlight) + .visibility(Visibility.None) + + }.width("100%").height("100%") + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/index.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3a6b007e1fd812f435b9a4df440d690df9524363 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,39 @@ +/** + * 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 +struct MyComponent { + aboutToAppear() { + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('ace AttrLack ets test') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/keysource.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/keysource.ets new file mode 100644 index 0000000000000000000000000000000000000000..fe91c2bb2cdb3b7c76d12949f5229ad33648cdff --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/keysource.ets @@ -0,0 +1,42 @@ +/** + * 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct KeyEventExample { + @State text: string = '' + @State eventType: string = '' + + build() { + Column() { + Button('KeyEvent').backgroundColor(0x2788D9) + .onKeyEvent((event: KeyEvent) => { + if (event.type === KeyType.Down) { + this.eventType = 'Down' + } + if (event.type === KeyType.Up) { + this.eventType = 'Up' + } + console.info(this.text = 'KeyType:' + this.eventType + '\nkeyCode:' + event.keyCode + '\nkeyText:' + event.keyText + + '\nKeyboard:' + event.keySource.Keyboard) + }) + Text(this.text).padding(15) + }.height(300).width('100%').padding(35) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/list_item_group.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/list_item_group.ets new file mode 100644 index 0000000000000000000000000000000000000000..c589dd3e9f52d16b872acc5e4f2b18d046566f73 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/list_item_group.ets @@ -0,0 +1,85 @@ +/** + * 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'; + +function itemHeadBuilder(text: string) { + @Builder function itemHead() { + Text(text) + .fontSize(20) + .backgroundColor(0xAABBCC) + .width("100%") + .padding(10) + } + return itemHead +} + +function itemFootBuilder(num: number) { + @Builder function itemFoot() { + Text('共' + num + "节课") + .fontSize(16) + .backgroundColor(0xAABBCC) + .width("100%") + .padding(5) + } + return itemFoot +} + +@Entry +@Component +struct ListItemGroupExample { + private timetable: any = [ + { + title:'Mon', + projects:['语文', '数学', '英语'] + }, + { + title:'Tues', + projects:['物理', '化学', '生物'] + }, + { + title:'Wens', + projects:['历史', '地理', '政治'] + }, + { + title:'Thur', + projects:['美术', '音乐', '体育'] + } + ] + + build() { + Column() { + List({ space: 20 }) { + ForEach(this.timetable, (item) => { + ListItemGroup({ header:itemHeadBuilder(item.title), footer:itemFootBuilder(item.projects.length) }) { + ForEach(item.projects, (project) => { + ListItem() { + Text(project) + .width("100%").height(100).fontSize(20) + .textAlign(TextAlign.Center).backgroundColor(0xFFFFFF) + } + }, item => item) + } + .key(item) + .borderRadius(20) + .divider({ strokeWidth: 1, color: Color.Blue}) // 每行之间的分界线 + }) + } + .width('90%') + .sticky(StickyStyle.Header | StickyStyle.Footer) + }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 }) + } + } \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/listtest.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/listtest.ets new file mode 100644 index 0000000000000000000000000000000000000000..058bb23a538f2738d820568d6a4751df24f55fbd --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/listtest.ets @@ -0,0 +1,151 @@ +/** + * 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'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct ListIdle { + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + @State editFlag: boolean = false + private scroller: Scroller = new Scroller() + @State onScroll: boolean = false + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear ListIdle start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear ListIdle end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("list-Idle") + .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("IdleText") + + Text("list-Scroll") + .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("ScrollText") + + Text("list-Fling") + .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("FlingText") + + Stack({ alignContent: Alignment.TopStart }) { + Scroll(this.scroller) { + List({ space: 20, initialIndex: 0 }) { + ForEach(this.arr, (item) => { + ListItem() { + Text('' + item) + .width('100%').height(100).fontSize(16) + .textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xFFFFFF) + }.editable(true) + }, item => item) + + } + .editMode(true) + .key("ScrollList") + .listDirection(Axis.Vertical) // 排列方向 + .divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) // 每行之间的分界线 + .edgeEffect(EdgeEffect.None) // 滑动到边缘无效果 + .chainAnimation(false) // 联动特效关闭 + .onScroll((scrollOffset: 5, scrollState:ScrollState) => { + console.info('scrollOffset' + scrollOffset) + console.info('scrollState ' + ScrollState.Scroll) + console.info('scrollState ' + ScrollState.Idle) + console.info('scrollState ' + ScrollState.Fling) + }) + .onClick(()=>{ + try { + var backData = { + data: { + "State": this.onScroll + } + } + let backEvent = { + eventId: 60303, + priority: events_emitter.EventPriority.LOW + } + console.info("Scroll start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("Scroll emit action state err: " + JSON.stringify(err.message)) + } + try { + this.scroller.scrollPage({ next: true }) + this.onScroll = true + } catch (err) { + console.info("Scroll emit action state err: " + JSON.stringify(err.message)) + } + }) + } + .scrollable(ScrollDirection.Vertical) + .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') + }) + } + }.width("100%").height("100%") + + + + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/loadingProgress.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/loadingProgress.ets new file mode 100644 index 0000000000000000000000000000000000000000..1353d00b78f82b9957c54f1afb626110fc8a6802 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/loadingProgress.ets @@ -0,0 +1,70 @@ +/** + * 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 LoadingProgressCircular { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear LoadingProgressCircular start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear LoadingProgressCircular end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("loadingProgress-Circular") + .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("CircularText") + + Text("loadingProgress-Orbital") + .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("OrbitalText") + + Text('Orbital LoadingProgress ').fontSize(9).fontColor(0xCCCCCC).width('100%') + LoadingProgress() + .color(Color.Blue) + }.width("100%").height("100%") + } +} + + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/onFrame.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/onFrame.ets new file mode 100644 index 0000000000000000000000000000000000000000..4fd2052f3a1e7cc3d4da105fe2aebf2641b7cdc3 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/onFrame.ets @@ -0,0 +1,126 @@ +/** + * 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 animator from '@ohos.animator'; +import prompt from '@system.prompt'; + +import Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct ColumnExample { + @State divWidth: number = 120; + @State divHeight: number = 120; + @State animation: AnimatorResult = animator.createAnimator({ + duration: 3000, + fill: 'forwards', + direction: "normal", + begin: 200, + end: 270 + }); + + onPageShow() { + this.animation.onrepeat(() => { + var repeatoptions = { + duration: 2000, + iterations: 1, + direction: 'alternate', + begin: 180, + end: 240 + }; + this.animation.update(repeatoptions); + this.animation.play(); + }); + } + + playAnimation() { + var _this = this; + this.animation.onframe = function(value) { + _this.translateVal= value + }; + this.animation.play(); + } + + build() { + Column() { + Column() { + Column() { + Column().width(this.divWidth).height(this.divHeight).backgroundColor(0xAFEEEE) + }.width('100%') + }.width('100%').padding({ top: 5 }) + + Column() { + Row() { + Button('play') + .borderRadius(8) + .backgroundColor(0x317aff) + .width(90) + .key("button1") + .onClick(() => { + this.animation.onframe((value) => { + this.divWidth = value + this.divHeight = value + }); + this.animation.play(); + }); + Button('update').borderRadius(8).backgroundColor(0x317aff).width(90).onClick(() => { + var newoptions = { + duration: 5000, + iterations: 2, + begin: 120, + end: 180 + }; + this.animation.update(newoptions); + this.animation.play(); + }); + }.margin({ top: 5 }) + + Row() { + Button('pause').borderRadius(8).backgroundColor(0x317aff).width(90).onClick(() => { + this.animation.pause(); + }); + Button('finish').borderRadius(8).backgroundColor(0x317aff).width(90).onClick(() => { + this.animation.onfinish(() => { + prompt.showToast({ + message: 'finish' + }) + }); + this.animation.finish(); + }); + }.margin({ top: 5 }) + + Row() { + Button('cancel').borderRadius(8).backgroundColor(0x317aff).width(90).onClick(() => { + this.animation.cancel(); + }); + Button('reverse').borderRadius(8).backgroundColor(0x317aff).width(90).onClick(() => { + this.animation.reverse(); + }); + }.margin({ top: 5 }) + + Row() { + Button('onframe') + .key("button1") + .borderRadius(8).backgroundColor(0x317aff).width(90).onClick(() => { + this.playAnimation() + }); + }.margin({ top: 5 }) + }.margin({ top: 30 }) + } + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/page1.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/page1.ets new file mode 100644 index 0000000000000000000000000000000000000000..0a3cea52a5108a0fc35925c3a4cb32a0c945e651 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/page1.ets @@ -0,0 +1,66 @@ +/** + * 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. + */ + +//在second页面中接收传递过来的参数 +import router from '@ohos.router' +import events_emitter from '@ohos.events.emitter'; +import Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct Second { + private content: string = "这是第二页" + @State text: string = router.getParams()['text'] + @State data: any = router.getParams()['data'] + @State secondData : string = '' + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text(this.text) + .fontSize(30) + .key("DataText") + .onClick(()=>{ + this.secondData = (this.data.array[1]).toString() + try { + var backData = { + data: { + "ArrayData": this.secondData + } + } + let backEvent = { + eventId: 101, + priority: events_emitter.EventPriority.LOW + } + console.info("page1 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("page1 emit action state err: " + JSON.stringify(err.message)) + } + }) + .margin({top:20}) + Text('第一页传来的数值是' + ' ' + this.secondData) + .fontSize(20) + .margin({top:20}) + .backgroundColor('red') + } + .width('100%') + .height('100%') + } +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/page2.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/page2.ets new file mode 100644 index 0000000000000000000000000000000000000000..72be9f5739354996e17186ec6e5f5c39066165c9 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/page2.ets @@ -0,0 +1,66 @@ +/** + * 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. + */ + +//在second页面中接收传递过来的参数 +import router from '@ohos.router' +import events_emitter from '@ohos.events.emitter'; +import Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct Second { + private content: string = "这是第二页" + @State text: string = router.getParams()['text'] + @State data: any = router.getParams()['data'] + @State secondData : string = '' + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Text(this.text) + .fontSize(30) + .key("SingleDataText") + .onClick(()=>{ + this.secondData = (this.data.array[1]).toString() + try { + var backData = { + data: { + "ArrayData": this.secondData + } + } + let backEvent = { + eventId: 102, + priority: events_emitter.EventPriority.LOW + } + console.info("page1 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("page1 emit action state err: " + JSON.stringify(err.message)) + } + }) + .margin({top:20}) + Text('第一页传来的数值是' + ' ' + this.secondData) + .fontSize(20) + .margin({top:20}) + .backgroundColor('red') + } + .width('100%') + .height('100%') + } +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/pluginComponent.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/pluginComponent.ets new file mode 100644 index 0000000000000000000000000000000000000000..e1310d6f783df35ccad68be0204f2764013ac9d6 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/pluginComponent.ets @@ -0,0 +1,66 @@ +/** + * 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 plugin from "../common/plugin_component.js" + +@Entry +@Component +struct PluginUserExample { + @StorageLink("plugincount") plugincount: Object[] = [ + { source: 'plugincomponent1', ability: 'com.example.plugin' }, + { source: 'plugintemplate', ability: 'com.example.myapplication' }, + { source: 'plugintemplate', ability: 'com.example.myapplication' }] + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button('Register Request Listener') + .fontSize(30) + .width(400) + .height(100) + .margin({top:20}) + .onClick(()=>{ + plugin.onListener() + console.log("Button('Register Request Listener')") + }) + Button('Request') + .fontSize(50) + .width(400) + .height(100) + .margin({ top: 20 }) + .onClick(() => { + plugin.Request() + console.log("Button('Request')") + }) + ForEach(this.plugincount, item => { + PluginComponent({ + template: { source: 'plugincomponent1', ability: 'com.example.plugin' }, + data: { 'countDownStartValue': 'new countDownStartValue' } + }).size({ width: 500, height: 100 }) + .onComplete(() => { + console.log("onComplete") + }) + .onError(({errcode, msg}) => { + console.log("onComplete" + errcode + ":" + msg) + }) + }) + } + .width('100%') + .height('100%') + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/popup.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/popup.ets new file mode 100644 index 0000000000000000000000000000000000000000..66f889a177338ef50f69cf573eb8f3ad8190de4b --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/popup.ets @@ -0,0 +1,99 @@ +/** + * 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct PopupExample { + @State noHandlePopup: boolean = false + @State handlePopup: boolean = false + @State customPopup: boolean = false + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear Popup start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear Popup end`) + } + + @Builder popupBuilder() { + Row({ space: 2 }) { + Image($rawfile('test.png')).width(24).height(24).margin({ left: -5 }) + Text('Custom Popup').fontSize(10) + }.width(100).height(50).backgroundColor(Color.White) + } + + build() { + Flex({ direction: FlexDirection.Column }) { + Button('no handle popup') + .onClick(() => { + this.noHandlePopup = !this.noHandlePopup + }) + .bindPopup(this.noHandlePopup, { + message: 'content1 content1', + placementOnTop: false, + arrowOffset: "100px", + onStateChange: (e) => { + console.info(e.isVisible.toString()) + if (!e.isVisible) { + this.noHandlePopup = false + } + } + }) + .position({ x: 100, y: 50 }) + + Button('with handle popup') + .onClick(() => { + this.handlePopup = !this.handlePopup + }) + .bindPopup(this.handlePopup, { + message: 'content2 content2', + placementOnTop: true, + primaryButton: { + value: 'ok', + action: () => { + this.handlePopup = !this.handlePopup + console.info('secondaryButton click') + } + }, + onStateChange: (e) => { + console.info(e.isVisible.toString()) + } + }) + .position({ x: 100, y: 200 }) + + Button('custom popup') + .onClick(() => { + this.customPopup = !this.customPopup + }) + .bindPopup(this.customPopup, { + builder: this.popupBuilder, + placement: Placement.Bottom, + maskColor: 0x33000000, + popupColor: Color.White, + enableArrow: true, + onStateChange: (e) => { + if (!e.isVisible) { + this.customPopup = false + } + } + }) + .position({ x: 100, y: 350 }) + }.width('100%').padding({ top: 5 }) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/progress.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/progress.ets new file mode 100644 index 0000000000000000000000000000000000000000..057015c5faab833b68bed41a12e1239b78896771 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/progress.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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct ProgressScaleCount { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear ProgressScaleCount start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear ProgressScaleCount end`) + } + + build() { + Column({ space: 15 }) { + Text('Linear Progress').fontSize(9).fontColor(0xCCCCCC).width('90%') + Progress({ value: 10, type: ProgressType.Linear }).width(200) + Progress({ value: 20, total: 150, type: ProgressType.Linear }).color(Color.Grey).value(50).width(200) + + Text('Eclipse Progress').fontSize(9).fontColor(0xCCCCCC).width('90%') + Row({ space: 40 }) { + Progress({ value: 10, type: ProgressType.Eclipse }).width(100) + Progress({ value: 20, total: 150, type: ProgressType.Eclipse }).color(Color.Grey).value(50).width(100) + } + + Text('ScaleRing Progress').fontSize(9).fontColor(0xCCCCCC).width('90%') + Row({ space: 40 }) { + Progress({ value: 10, type: ProgressType.ScaleRing }).width(100) + Progress({ value: 20, total: 150, type: ProgressType.ScaleRing }) + .key("progressStyleOptions") + .color(Color.Grey).value(50).width(100) + .style({ strokeWidth: 15, scaleCount: 15, scaleWidth: 5 }) + } + + Text('Ring Progress').fontSize(9).fontColor(0xCCCCCC).width('90%') + Row({ space: 40 }) { + Progress({ value: 10, type: ProgressType.Ring }).width(100) + Progress({ value: 20, total: 150, type: ProgressType.Ring }) + .color(Color.Grey).value(50).width(100) + .style({ strokeWidth: 20, scaleCount: 30, scaleWidth: 20 }) + } + + Text('Capsule Progress').fontSize(9).fontColor(0xCCCCCC).width('90%') + Row({ space: 40 }) { + Progress({ value: 10, type: ProgressType.Capsule }).width(100).height(50) + Progress({ value: 20, total: 150, type: ProgressType.Capsule }) + .color(Color.Grey) + .value(50) + .width(100) + .height(50) + } + }.width('100%').margin({ top: 30 }) + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/radio.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/radio.ets new file mode 100644 index 0000000000000000000000000000000000000000..17dab9a83e3135e812e619ac82a7563bfcea7d1e --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/radio.ets @@ -0,0 +1,70 @@ +/** + * 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 RadioGroup { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear RadioGroup start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear RadioGroup end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("radio-Group") + .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("groupText") + + Radio({ value: 'Radio1', group: 'radioGroup' }) + .checked(true) + .key("RadioOne") + .height(50) + .width(50) + .onChange((value: boolean) => { + console.log('Radio1 status is ' + value) + }) + Radio({ value: 'Radio2', group: 'radioGroup' }) + .checked(false) + .key("RadioTwo") + .height(50) + .width(50) + .onChange((value: boolean) => { + console.log('Radio2 status is ' + value) + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/refresh.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/refresh.ets new file mode 100644 index 0000000000000000000000000000000000000000..10c4660f49eaec9a2f492c4cea3735f3bc3968de --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/refresh.ets @@ -0,0 +1,132 @@ +/** + * 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 Utils from '../common/Utils.ets'; +import events_emitter from '@ohos.events.emitter'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct RefreshDrag { + dragRefresh() { + var rect = Utils.getComponentRect("Refresh") + Utils.drag(rect["left"],rect["top"],rect["right"],rect["bottom"],20) + } + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear RefreshDrag start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear RefreshDrag end`) + } + + @State isRefreshing: boolean = false + @State counter: number = 0 + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("refresh-Drag") + .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("DragText") + + Text("refresh-Refresh") + .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("RefreshText") + + + Refresh({refreshing: this.isRefreshing, offset: 120, friction: 100}) { + Text('Pull Down and refresh: ' + this.counter) + .fontSize(30) + .margin(10) + } + .key("Refresh") + .onClick(()=>{ + this.dragRefresh() + }) + .onStateChange((refreshStatus: RefreshStatus) => { + console.info('Refresh onStatueChange state is ' + refreshStatus) + if(refreshStatus === RefreshStatus.Drag){ + console.info("refreshStatus RefreshStatus.Drag") + } + if(refreshStatus === RefreshStatus.Refresh){ + console.info("refreshStatus RefreshStatus.Refresh") + } + try { + var backDataTwo = { + data: { + "Result": true + } + } + let backEventTwo = { + eventId: 60305, + priority: events_emitter.EventPriority.LOW + } + console.info("Refresh start to emit action state") + events_emitter.emit(backEventTwo, backDataTwo) + } catch (err) { + console.info("Refresh emit action state err: " + JSON.stringify(err.message)) + } + }) + .onRefreshing(() => { + setTimeout(() => { + this.counter++ + this.isRefreshing = false + }, 1000) + console.log('onRefreshing test') + try { + var backData = { + data: { + "Result": true + } + } + let backEvent = { + eventId: 60304, + priority: events_emitter.EventPriority.LOW + } + console.info("Drag start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("Drag emit action state err: " + JSON.stringify(err.message)) + } + }) + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/remoteWindow.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/remoteWindow.ets new file mode 100644 index 0000000000000000000000000000000000000000..40c64df19733671fdc145f14906ad09bb7456096 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/remoteWindow.ets @@ -0,0 +1,64 @@ +/** + * 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 FormComponentFormDimension { + @State target: WindowAnimationTarget = undefined // 通过windowAnimationManager获取 + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear Dimension start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear Dimension end`) + } + + build() { + Row() { + Column({ space: 10 }) { + Text("formComponent-FormDimension-WindowBounds") + .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("formComponentFormDimensionWindowBoundsText") + + RemoteWindow(this.target) + .translate({ x: 100, y: 200 }) + .scale({ x: 0.5, y: 0.5 }) + .opacity(0.8) + .position({ x: px2vp(this.target?.windowBounds.left), y: px2vp(this.target?.windowBounds.top) }) + .width(px2vp(this.target?.windowBounds.width)) + .height(px2vp(this.target?.windowBounds.height)) + .key('remoteWindow') + + } + .width('100%') + } + .height('100%') + } +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/responseType.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/responseType.ets new file mode 100644 index 0000000000000000000000000000000000000000..d892d7305c9042220d1d901320a68efc3e07e0f1 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/responseType.ets @@ -0,0 +1,88 @@ +//@ts-nocheck +/** + * 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 ResponseType { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear ResponseType start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear ResponseType end`) + } + + @Builder ContextMenuBuilder() { + Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Text('text3') + .fontSize(20) + .width(100) + .height(50) + .textAlign(TextAlign.Center) + Divider().height(10) + } +} + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + Text("responseType-RightClick") + .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("RightClickText") + .bindContextMenu(this.ContextMenuBuilder(), ResponseType.RightClick) + .visibility(Visibility.None) + + Text("responseType-LongPress") + .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("LongPressText") + .bindContextMenu(this.ContextMenuBuilder(), ResponseType.LongPress) + .visibility(Visibility.None) + + Column() { + Text('rightclick for menu') + } + .key("TestColumn") + .width('100%') + .margin({ top: 5 }) + .bindContextMenu(this.MenuBuilder, ResponseType.RightClick) + + }.width("100%").height("100%") + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/router.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/router.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb1ee208787174f03a7fd6604461e9ed06daefbb --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/router.ets @@ -0,0 +1,126 @@ +/** + * 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 '@ohos.router' +import uiAppearance from '@ohos.uiAppearance'; + +import Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct RouterStandard { + + + async routePage() { + let options = { + url: 'pages/page1', + params: { + text: '这是第一页的值', + data: { + array: [12, 45, 78] + } + } + } + try { + await router.push(options,router.RouterMode.Standard) + } catch (err) { + console.info(`Standard Page fail callback, code: ${err.code}, msg: ${err.msg}`) + } + } + + async routeSinglePage() { + let options = { + url: 'pages/page2', + params: { + text: '这是第二页的值', + data: { + array: [13, 46, 79] + } + } + } + try { + await router.push(options,router.RouterMode.Single) + } catch (err) { + console.info(`Single Page fail callback, code: ${err.code}, msg: ${err.msg}`) + } + } + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear RouterStandard start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear RouterStandard end`) + } + + build(){ + + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("router-Standard") + .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("StandardText") + .onClick(() => { + this.routePage() + }) + + Text("router-Single") + .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("SingleText") + .onClick(() => { + this.routeSinglePage() + }) + + Text('这是第一页') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ top: 20 }) + .backgroundColor('#ccc') + .onClick(() => { + this.routePage() + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/scroll_edge.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/scroll_edge.ets new file mode 100644 index 0000000000000000000000000000000000000000..8b9cc0077bf0b50a1bbcbb1ee5693b5b790796f4 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/scroll_edge.ets @@ -0,0 +1,73 @@ +/* + * 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 Log from '../common/Log.ets'; +import events_emitter from '@ohos.events.emitter'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +struct ScrollExample { + scroller: Scroller = new Scroller() + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Stack({ alignContent: Alignment.TopStart }) { + 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).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') + }) + Button('back Middle') + .key("MiddleText") + .onClick(() => { // 点击后回到顶部 + this.scroller.scrollEdge(Edge.Middle) + var result=(this.scroller.scrollEdge(Edge.Middle)!=null) + try { + var backData = { + data: { + "STATUS": result + } + } + let backEvent = { + eventId: 60306, + priority: events_emitter.EventPriority.LOW + } + console.info("onRequestPopupData start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("onRequestPopupData emit action state err: " + JSON.stringify(err.message)) + } + }) + .margin({ top: 60, left: 20 }) + }.width('100%').height('100%').backgroundColor(0xDCDCDC) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/sidebar.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/sidebar.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee12737a8ebfd56821557a7c18158461ddb14b04 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/sidebar.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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct SidebarIcons { + @State arr: number[] = [1, 2] + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear SidebarIcons start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear SidebarIcons end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("sidebar-Icons") + .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("iconsText") + + SideBarContainer(SideBarContainerType.Embed) { + Column() { + ForEach(this.arr, (item, index) => { + Column({ space: 5 }) { + Text("Index0" + item) + .fontSize(20) + } + }, item => item) + }.width('100%') + .justifyContent(FlexAlign.SpaceEvenly) + .backgroundColor('#19000000') + + RowSplit() { + Column() { + Text('Split page').fontSize(30) + } + }.width('100%') + } + .key("SideBarContainer") + .sideBarWidth(240) + .minSideBarWidth(210) + .maxSideBarWidth(260) + .controlButton({ + icons: { + shown: $r("app.media.icon"), + hidden: $r("app.media.icon") + } + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/slider.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/slider.ets new file mode 100644 index 0000000000000000000000000000000000000000..91ee60b8f6021dd6fe2092cd04cc4a78df660df5 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/slider.ets @@ -0,0 +1,95 @@ +/** + * 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 Utils from '../common/Utils.ets'; +import events_emitter from '@ohos.events.emitter'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct SliderMoving { + @State outSetValue: number = 40 + slide() { + var rect = Utils.getComponentRect("Slider") + Utils.drag(rect["left"],rect["top"],rect["right"],rect["bottom"],20) + } + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear SliderMoving start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear SliderMoving end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("slider-Moving") + .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("MovingText") + + Slider({ + value: this.outSetValue, + min: 0, + max: 100, + step: 1, + style: SliderStyle.OutSet + }) + .key("Slider") + .blockColor(Color.Blue) + .trackColor(Color.Gray) + .selectedColor(Color.Blue) + .showSteps(true) + .showTips(true) + .onChange((value: number, mode: SliderChangeMode) => { + Log.showInfo(TAG, 'SliderChangeMode.Moving: ' + SliderChangeMode.Moving.toString()) + Log.showInfo(TAG, 'value:' + value + 'mode:' + mode.toString()) + try { + var backData = { + data: { + "Mode": (mode==0)||(mode==1)||(mode==2) + } + } + let backEvent = { + eventId: 60307, + priority: events_emitter.EventPriority.LOW + } + console.info("Slider start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("Slider emit action state err: " + JSON.stringify(err.message)) + } + }) + .onClick(() => { + this.slide() + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/stateManagement.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/stateManagement.ets new file mode 100644 index 0000000000000000000000000000000000000000..99b385c0257c5ba609512300c0c9e82660c2fb4c --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/stateManagement.ets @@ -0,0 +1,52 @@ +/** + * 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 StateManagementDARK { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear StateManagementDARK start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear StateManagementDARK end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("stateManagement-DARK") + .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 }) + .backgroundColor(ColorMode.DARK) + .key("DARKText") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/stepperItem.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/stepperItem.ets new file mode 100644 index 0000000000000000000000000000000000000000..fd55e9512f41c981ed88e5afa95b48759aed4c42 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/stepperItem.ets @@ -0,0 +1,92 @@ +/** + * 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 StepperItemDisabled { + @State currentIndex: number = 0 + @State firstState: ItemState = ItemState.Normal + @State secondState: ItemState = ItemState.Normal + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear StepperItemDisabled start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear StepperItemDisabled end`) + } + + build() { + Row() { + Column({ space: 10 }) { + Text('message') + .fontSize(50) + .fontWeight(FontWeight.Bold) + + Stepper({ + index: this.currentIndex + }) { + StepperItem() { + Text('Page One') + .fontSize(35) + .fontColor(Color.Blue) + .width(200) + .lineHeight(50) + .margin({ top: 250 }) + } + .nextLabel('') + .position({ x: '35%', y: 0 }) + + StepperItem() { + Text('Page Two') + .fontSize(35) + .fontColor(Color.Blue) + .width(200) + .lineHeight(50) + .margin({ top: 250 }) + .onClick(() => { + this.firstState = this.firstState === ItemState.Skip ? ItemState.Normal : ItemState.Skip + }) + } + .key("StepperItem") + .nextLabel('Finish') + .prevLabel('Previous') + .status(this.firstState) + .position({ x: '35%', y: 0 }) + .status(ItemState.Disabled) + } + .onFinish(() => { + Log.showInfo(TAG, 'onFinish') + }) + .onSkip(() => { + Log.showInfo(TAG, 'onSkip') + }) + .onChange((prevIndex: number, index: number) => { + this.currentIndex = index + }) + .align(Alignment.Center) + .height('50%') + + } + .width('100%') + } + .height('100%') + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/swiper.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/swiper.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d10b8c60f11e1aa62ebb2be98210fcc8d9b7de2 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/swiper.ets @@ -0,0 +1,112 @@ +/** + * 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 SwiperMask { + private swiperController: SwiperController = new SwiperController() + private data: MyDataSource = new MyDataSource([]) + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear SwiperMask start`) + let list = [] + for (var i = 1; i <= 5; i++) { + list.push(i.toString()); + } + this.data = new MyDataSource(list) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear SwiperMask end`) + } + + build() { + Row() { + Column({ space: 10 }) { + Text("swiper-Mask") + .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("maskText") + + 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) // 动画曲线 + .key("maskSwiper") + .indicatorStyle({ + mask: false + }) + + } + .width('100%') + } + .height('100%') + } +} + + +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() { + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/text_input.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/text_input.ets new file mode 100644 index 0000000000000000000000000000000000000000..dd5271d4a3f7879f2a966b442eba4f89f979c745 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/text_input.ets @@ -0,0 +1,88 @@ +/** + * 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 Text_inputPhoneNumber { + @State text: string = '' + @State text1: string = 'PhoneNumber' + @State text2: string = 'Address' + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear Text_inputPhoneNumber start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear Text_inputPhoneNumber end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + TextInput({ placeholder: 'input your word' }) + .key("PhoneNumberText") + .placeholderColor("rgb(0,0,225)") + .placeholderFont({ size: 30, weight: 100, family: 'cursive', style: FontStyle.Italic }) + .caretColor(Color.Blue) + .height(50) + .fontSize(30) + .fontWeight(FontWeight.Bold) + .fontFamily("sans-serif") + .fontStyle(FontStyle.Normal) + .fontColor(Color.Red) + .type(InputType.PhoneNumber) + .onChange((value: string) => { + this.text = value + }) + + Text(this.text1).width('90%') + TextInput({ placeholder: 'input your word' }) + .key('textInput1') + .type(InputType.PhoneNumber) + .placeholderColor("rgb(0,0,225)") + .placeholderFont({ size: 30, weight: 100, family: 'cursive', style: FontStyle.Italic }) + .caretColor(Color.Blue) + .height(50) + .fontSize(30) + .fontWeight(FontWeight.Bold) + .fontFamily("sans-serif") + .fontStyle(FontStyle.Normal) + .fontColor(Color.Red) + .style(TextInputStyle.Default) + + Text(this.text2).width('90%') + TextInput({ placeholder: 'input your word' }) + .key('textInput2') + .type(InputType.PhoneNumber) + .placeholderColor("rgb(0,0,225)") + .placeholderFont({ size: 30, weight: 100, family: 'cursive', style: FontStyle.Italic }) + .caretColor(Color.Blue) + .height(50) + .fontSize(30) + .fontWeight(FontWeight.Bold) + .fontFamily("sans-serif") + .fontStyle(FontStyle.Normal) + .fontColor(Color.Red) + .style(TextInputStyle.Inline) + .margin(10) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/uiAppearance.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/uiAppearance.ets new file mode 100644 index 0000000000000000000000000000000000000000..3e5c60eb237ba6e725483fa5b7ca26bab1b19cf0 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/uiAppearance.ets @@ -0,0 +1,113 @@ +/** + * 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 uiAppearance from '@ohos.uiAppearance'; +import Log from '../common/Log.ets'; +import events_emitter from '@ohos.events.emitter'; + +const TAG = 'ets_apiLack_add'; +uiAppearance.DarkMode.ALWAYS_DARK + +@Entry +@Component +export default +struct UiAppearanceALWAYS_DARK { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear UiAppearanceALWAYS_DARK start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear UiAppearanceALWAYS_DARK end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("uiAppearance-ALWAYS_DARK") + .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("ALWAYS_DARKText") + .onClick(()=>{ + uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK, (err) => { + console.info(`${err}`); + }) + let darkMode = uiAppearance.getDarkMode(); + try{ + var backData = { + data: { + "Mode": darkMode + } + } + let backEvent = { + eventId: 60308, + priority: events_emitter.EventPriority.LOW + } + console.info("AlwaysDark start to emit action state") + events_emitter.emit(backEvent, backData) + } catch(err) { + console.info("AlwaysDark emit action state err: " + JSON.stringify(err.message)) + } + }) + + Text("uiAppearance-ALWAYS_LIGHT") + .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("ALWAYS_LIGHTText") + .onClick(()=>{ + uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_LIGHT, (err) => { + console.info(`${err}`); + }) + let darkMode = uiAppearance.getDarkMode(); + try{ + var backData = { + data: { + "Mode": darkMode + } + } + let backEvent = { + eventId: 60309, + priority: events_emitter.EventPriority.LOW + } + console.info("AlwaysLight start to emit action state") + events_emitter.emit(backEvent, backData) + } catch(err) { + console.info("AlwaysLight emit action state err: " + JSON.stringify(err.message)) + } + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/units.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/units.ets new file mode 100644 index 0000000000000000000000000000000000000000..3c0c963569e156b6c8de078ac3791bf08ca14d98 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/units.ets @@ -0,0 +1,178 @@ +/** + * 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'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct UnitsModuleName { + @State textHeight: number = 50 + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear UnitsModuleName start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear UnitsModuleName end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("units-ModuleName") + .width(320) + .height(this.textHeight) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("moduleNameText") + .onClick(() => { + console.log($r('app.string.MainAbility_label').bundleName) + try { + var backData = { + data: { + "ModuleName": ($r('app.string.MainAbility_label').bundleName != null) + } + } + let backEvent = { + eventId: 60310, + priority: events_emitter.EventPriority.LOW + } + console.info("ModuleName start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("ModuleName emit action state err: " + JSON.stringify(err.message)) + } + }) + + Text("units-GlobalPosition") + .width(320) + .height(this.textHeight) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("globalPositionText") + .onClick(() => { + this.textHeight = 100 + }) + .onAreaChange((oldValue: Area, newValue: Area) => { + console.info(`oldValue.globalPosition: ${JSON.stringify(oldValue.globalPosition)}`) + console.info(`newValue.globalPosition: ${JSON.stringify(newValue.globalPosition)}`) + try { + var backData = { + data: { + "Result": true + } + } + let backEvent = { + eventId: 60311, + priority: events_emitter.EventPriority.LOW + } + console.info("GlobalPosition start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("GlobalPosition emit action state err: " + JSON.stringify(err.message)) + } + }) + + + Text("units-MinWidth") + .width(100) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("minWidthText") + .constraintSize({ + minWidth: 200 + }) + + Text("units-MaxWidth") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("maxWidthText") + .constraintSize({ + maxWidth: 200 + }) + + Text("units-MinHeight") + .width(320) + .height(50) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("minHeightText") + + .constraintSize({ + minHeight: 100 + }) + + Text("units-MaxHeight") + .width(320) + .height(200) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("maxHeightText") + .constraintSize({ + maxHeight: 100 + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/web.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/web.ets new file mode 100644 index 0000000000000000000000000000000000000000..b48af9231b452ac0d80c24792acc7ad449993de5 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/MainAbility/pages/web.ets @@ -0,0 +1,100 @@ +/** + * 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 WebEditText { + controller: WebController = new WebController(); + webResourceResponse: WebResourceResponse = new WebResourceResponse(); + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear WebEditText start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear WebEditText end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + Web({ src:'www.baidu.com', controller:this.controller }) + .javaScriptAccess(true) + .height(500) + .padding(20) + .blur(2) + .fileFromUrlAccess(true) + .initialScale(2) + .webDebuggingAccess(true) + .onRenderExited((event) => { + console.info('onRenderExited getAcceptType: ', event.renderExitReason); + }) + .onShowFileSelector((event) => { + console.info('onShowFileSelector getAcceptType: ', event.fileSelector.getAcceptType()); + console.info('onShowFileSelector getTitle: ', event.fileSelector.getTitle()); + console.info('onShowFileSelector getMode: ', event.fileSelector.getMode()); + console.info('onShowFileSelector isCapture: ', event.fileSelector.isCapture()); + event.result.handleFileList(["D:\DevEcoStudioProjects","D:\DevEcoStudioProjects"]) + return true; + }) + .onInterceptRequest((event) => { + console.info('onInterceptRequest getRequestUrl: ', event.request.getRequestUrl()); + console.info('onInterceptRequest isMainFrame: ', event.request.isMainFrame()); + console.info('onInterceptRequest isRedirect: ', event.request.isRedirect()); + console.info('onInterceptRequest isRequestGesture: ', event.request.isRequestGesture()); + let result = event.request.getRequestHeader(); + console.log('The request header result size is ' + result.length); + for (let i of result) { + console.log('The request header key is : ' + i.headerKey + ' , value is : ' + i.headerValue); + } + return this.webResourceResponse; + }) + .onPermissionRequest((event) => { + AlertDialog.show({ + title: 'title', + message: 'text', + confirm: { + value: 'onConfirm', + action: () => { + event.request.grant(event.request.getAccessibleResource()); + } + }, + cancel: () => { + event.request.deny(); + } + }) + }) + .onHttpErrorReceive((event) => { + console.log('setResponseHeader:' + event.response.setResponseHeader([])); + console.log('web getExtra:' + this.controller.getHitTestValue().getExtra()); + console.log('web getType:' + this.controller.getHitTestValue().getType()); + let result = event.request.getRequestHeader(); + console.log('The request header result size is ' + result.length); + for (let i of result) { + console.log('The request header key is : ' + i.headerKey + ' , value is : ' + i.headerValue); + } + let resph = event.response.getResponseHeader(); + console.log('The response header result size is ' + resph.length); + for (let i of resph) { + console.log('The response header key is : ' + i.headerKey + ' , value is : ' + i.headerValue); + } + }) + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/TestAbility/app.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/TestAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..0d04e3a8354e1f9224f2fef1df0ecccfd5311f25 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/TestAbility/app.ets @@ -0,0 +1,32 @@ +/** + * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/TestAbility/pages/index.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c12e9993796c2c412a0846a03ef8bd2333d51e5f --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,49 @@ +/** + * 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 router from '@system.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('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/arkui/ace_ets_component_attrlack/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/arkui/ace_ets_component_attrlack/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..af65ea87c0e54067f9f4b2d80003c81f7b14f53c --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,77 @@ +/** + * 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 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 itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + 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') + } + + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility' + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + 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 call abilityDelegator.getAppContext') + var context = abilityDelegator.getAppContext() + console.info('getAppContext : ' + JSON.stringify(context)) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/List.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..67cda3d6e9126d6b79953d50e4e2c5ca573132d9 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,78 @@ +/** + * 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 animatorOnframeJsunit from './animator.test.ets'; +import curvesEaseOutJsunit from './curves.test.ets'; +import routerStandardJsunit from './router.test.ets'; +import uiAppearanceALWAYS_DARKJsunit from './uiAppearance.test.ets'; +import appVersionCodeJsunit from './app.test.ets'; +import alertDialogCenterStartJsunit from './alertDialog.test.ets'; +import canvasActualBoundingBoxAscentJsunit from './canvas.test.ets'; +import checkBoxGroupJsunit from './checkBox.test.ets'; +import checkBoxGroupPartJsunit from './checkBoxGroup.test.ets'; +import commonColorModeJsunit from './common.test.ets'; +import datePickerLunarJsunit from './datePicker.test.ets'; +import enumsCancelJsunit from './enums.test.ets'; +import gestureParallelJsunit from './gesture.test.ets'; +import listtestIdleJsunit from './listtest.test.ets'; +import list_item_groupJsunit from './list_item_group.test.ets' +import loadingProgressCircularJsunit from './loadingProgress.test.ets'; +import progressScaleCountJsunit from './progress.test.ets'; +import radioGroupJsunit from './radio.test.ets'; +import refreshDragJsunit from './refresh.test.ets'; +import remoteWindowJsunit from './remoteWindow.test.ets' +import sidebarIconsJsunit from './sidebar.test.ets'; +import sliderMovingJsunit from './slider.test.ets'; +import stateManagementDARKJsunit from './stateManagement.test.ets'; +import stepperItemDisabledJsunit from './stepperItem.test.ets'; +import swiperMaskJsunit from './swiper.test.ets'; +import text_inputPhoneNumberJsunit from './text_input.test.ets'; +import unitsModuleNameJsunit from './units.test.ets'; +import webEditTextJsunit from './web.test.ets'; +import hoverEffectJsunit from './hoverEffect.test.ets'; +import responseTypeJsunit from './responseType.test.ets'; +import copyOptionJsunit from './copyOption.test.ets'; +import hitTestModeJsunit from './hitTestMode.test.ets'; +import colorEnumJsunit from './color.test.ets'; + +export default function testsuite() { + animatorOnframeJsunit() + routerStandardJsunit() + appVersionCodeJsunit() + alertDialogCenterStartJsunit() + canvasActualBoundingBoxAscentJsunit() + checkBoxGroupJsunit() + checkBoxGroupPartJsunit() + commonColorModeJsunit() + datePickerLunarJsunit() + gestureParallelJsunit() + listtestIdleJsunit() + loadingProgressCircularJsunit() + progressScaleCountJsunit() + radioGroupJsunit() + remoteWindowJsunit() + sidebarIconsJsunit() + sliderMovingJsunit() + stateManagementDARKJsunit() + stepperItemDisabledJsunit() + swiperMaskJsunit() + unitsModuleNameJsunit() + webEditTextJsunit() + hoverEffectJsunit() + responseTypeJsunit() + copyOptionJsunit() + hitTestModeJsunit() + colorEnumJsunit() +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/Utils.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/Utils.ets new file mode 100644 index 0000000000000000000000000000000000000000..aa94fe4f7e0a3a0c066b9141e118b2229c839a96 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/Utils.ets @@ -0,0 +1,118 @@ +// @ts-nocheck +/** + * 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 class Utils { + static rect_left; + static rect_top; + static rect_right; + static rect_bottom; + static rect_value; + + static sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, time) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + static getComponentRect(key) { + let strJson = getInspectorByKey(key); + let obj = JSON.parse(strJson); + console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj)); + let rectInfo = JSON.parse('[' + obj.$rect + ']') + console.info("[getInspectorByKey] rectInfo is: " + rectInfo); + this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0] + this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1] + this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0] + this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1] + return this.rect_value = { + "left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom + } + } + + static async swipe(downX, downY, upX, upY, steps) { + console.info('start to swipe') + this.drags(downX, downY, upX, upY, steps, false) + } + + static async drag(downX, downY, upX, upY, steps) { + console.info('start to drag') + this.drags(downX, downY, upX, upY, steps, true) + } + + static async drags(downX, downY, upX, upY, steps, drag) { + var xStep; + var yStep; + var swipeSteps; + var ret; + xStep = 0; + yStep = 0; + ret = false; + swipeSteps = steps; + if (swipeSteps == 0) { + swipeSteps = 1; + } + xStep = (upX - downX) / swipeSteps; + yStep = (upY - downY) / swipeSteps; + console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep) + var downPonit: TouchObject = { + id: 1, + x: downX, + y: downY, + type: TouchType.Down, + } + console.info('down touch started: ' + JSON.stringify(downPonit)) + sendTouchEvent(downPonit); + console.info('start to move') + if (drag) { + await this.sleep(500) + } + for (var i = 1;i <= swipeSteps; i++) { + var movePoint: TouchObject = { + id: 1, + x: downX + (xStep * i), + y: downY + (yStep * i), + type: TouchType.Move + } + console.info('move touch started: ' + JSON.stringify(movePoint)) + ret = sendTouchEvent(movePoint) + if (ret == false) { + break; + } + await this.sleep(5) + } + console.info('start to up') + if (drag) { + await this.sleep(100) + } + var upPoint: TouchObject = { + id: 1, + x: upX, + y: upY, + type: TouchType.Up, + } + console.info('up touch started: ' + JSON.stringify(upPoint)) + sendTouchEvent(upPoint) + await this.sleep(500) + } +} + + + + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/alertDialog.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/alertDialog.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2dca5c993afa6b9decc1dc0db4699970d56234dd --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/alertDialog.test.ets @@ -0,0 +1,75 @@ +/** + * 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 alertDialogCenterStartJsunit() { + describe('alertDialogCenterStartTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/alertDialog', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get alertDialog state success " + JSON.stringify(pages)); + if (!("alertDialog" == pages.name)) { + console.info("get alertDialog state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push alertDialog page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push alertDialog page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("alertDialogCenterStart after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testalertDialogCenterStart0001 + * @tc.desic acealertDialogCenterStartEtsTest0001 + */ + it('testalertDialogCenterStart0001', 0, async function (done) { + console.info('alertDialogCenterStart testalertDialogCenterStart0011 START'); + await Utils.sleep(2000); + try { + var event = { + eventId: 81601, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testalertDialogCenterStart0001 get event data is: " + JSON.stringify(eventData)); + expect(eventData.data.Result).assertEqual(true); + console.info('testalertDialogCenterStart0011 END'); + done(); + } + console.info("testalertDialogCenterStart0001 click result is: " + JSON.stringify(sendEventByKey('CenterStartButton', 10, ""))); + events_emitter.on(event, callback); + } catch (err) { + console.info("testalertDialogCenterStart0001 on events_emitter err : " + JSON.stringify(err)); + } + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/animate_play_mode.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/animate_play_mode.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d27f16274cc72bd705cd0bb66f060d9b8ec2a661 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/animate_play_mode.test.ets @@ -0,0 +1,94 @@ +/** + * 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 playModeReverseJsunit() { + describe('playModeReverseTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/animate_play_mode', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get animate_play_mode state success " + JSON.stringify(pages)); + if (!("PlayModeReverse" == pages.name)) { + console.info("get animate_play_mode state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push animate_play_mode page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push animate_play_mode page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("playModeReverse after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testPlayModeReverse0001 + * @tc.desic acePlayModeReverseEtsTest0001 + */ + it('testPlayModeReverse0001', 0, async function (done) { + console.info('PlayModeReverse testPlayModeReverse0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Reverse'); + console.info("[testradioGroup0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.animation).assertEqual({ + duration: 3000, // 动画时长 + curve: Curve.EaseOut, // 动画曲线 + delay: 1000, // 动画延迟 + iterations: 1, // 播放次数 + playMode: PlayMode.Reverse // 动画模式 + }); + console.info("[testPlayModeReverse0001] width value :" + obj.$attrs.animation); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testPlayModeAlternate0001 + * @tc.desic acePlayModeAlternateEtsTest0009 + */ + it('testPlayModeAlternate0001', 0, async function (done) { + console.info('radioGroup testPlayModeAlternate0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Alternate'); + console.info("[testPlayModeAlternate0001] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.animation).assertEqual({ + duration: 3000, + curve: Curve.EaseOut, + delay: 1000, + iterations: 1, + playMode: PlayMode.Alternate + }); + console.info("[testPlayModeAlternate0001] padding value :" + obj.$attrs.animation); + done(); + }); + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/animator.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/animator.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..24f65f9b3227120a5e752ec2cc0c810b71c5210d --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/animator.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 animatorOnframeJsunit() { + describe('animatorOnframeTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/animator', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get animator state success " + JSON.stringify(pages)); + if (!("animator" == pages.name)) { + console.info("get animator state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push animator page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push animator page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("animatorOnframe after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testanimatorOnframe0001 + * @tc.desic aceanimatorOnframeEtsTest0001 + */ + it('testanimatorOnframe0001', 0, async function (done) { + console.info('animatorOnframe testanimatorOnframe0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onframeText'); + console.info("[testanimatorOnframe0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testanimatorOnframe0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testanimatorOnframe0002 + * @tc.desic aceanimatorOnframeEtsTest0002 + */ + it('testanimatorOnframe0002', 0, async function (done) { + console.info('animatorOnframe testanimatorOnframe0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onframeText'); + console.info("[testanimatorOnframe0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testanimatorOnframe0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testanimatorOnframe0003 + * @tc.desic aceanimatorOnframeEtsTest0003 + */ + it('testanimatorOnframe0003', 0, async function (done) { + console.info('animatorOnframe testanimatorOnframe0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onframeText'); + console.info("[testanimatorOnframe0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testanimatorOnframe0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testanimatorOnframe0004 + * @tc.desic aceanimatorOnframeEtsTest0004 + */ + it('testanimatorOnframe0004', 0, async function (done) { + console.info('animatorOnframe testanimatorOnframe0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onframeText'); + console.info("[testanimatorOnframe0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testanimatorOnframe0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testanimatorOnframe0005 + * @tc.desic aceanimatorOnframeEtsTest0005 + */ + it('testanimatorOnframe0005', 0, async function (done) { + console.info('animatorOnframe testanimatorOnframe0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onframeText'); + console.info("[testanimatorOnframe0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testanimatorOnframe0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testanimatorOnframe0006 + * @tc.desic aceanimatorOnframeEtsTest0006 + */ + it('testanimatorOnframe0006', 0, async function (done) { + console.info('animatorOnframe testanimatorOnframe0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onframeText'); + console.info("[testanimatorOnframe0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testanimatorOnframe0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testanimatorOnframe0007 + * @tc.desic aceanimatorOnframeEtsTest0007 + */ + it('testanimatorOnframe0007', 0, async function (done) { + console.info('animatorOnframe testanimatorOnframe0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onframeText'); + console.info("[testanimatorOnframe0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testanimatorOnframe0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testanimatorOnframe0009 + * @tc.desic aceanimatorOnframeEtsTest0009 + */ + it('testanimatorOnframe0009', 0, async function (done) { + console.info('animatorOnframe testanimatorOnframe009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onframeText'); + console.info("[testanimatorOnframe0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testanimatorOnframe0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testanimatorOnframe0010 + * @tc.desic aceanimatorOnframeEtsTest0010 + */ + it('testanimatorOnframe0010', 0, async function (done) { + console.info('animatorOnframe testanimatorOnframe0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onframeText'); + console.info("[testanimatorOnframe0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testanimatorOnframe0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/app.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/app.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d1d4b22716f28e9e1758bcf205a36a159d5ba770 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/app.test.ets @@ -0,0 +1,70 @@ +/** + * 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 events_emitter from '@ohos.events.emitter'; +import Utils from './Utils.ets' + +export default function appVersionCodeJsunit() { + describe('appVersionCodeTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/app', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get app state success " + JSON.stringify(pages)); + if (!("app" == pages.name)) { + console.info("get app state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push app page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push app page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("appVersionCode after each called"); + }); + + it('testappVersionCode0011', 0, async function (done) { + console.info('appVersionCode testappVersionCode0011 START'); + await Utils.sleep(1000); + try { + var innerEvent = { + eventId: 60302, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testappVersionCode_0011 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.Code).assertEqual("1"); + } + console.info("testappVersion click result is: " + JSON.stringify(sendEventByKey('versionCodeText', 10, ""))); + events_emitter.on(innerEvent, callback); + } catch (err) { + console.info("testappVersionCode_0011 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testappVersionCode_0011 END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/canvas.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/canvas.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..27e88fa4f8102087e174ed2e3f61812383795834 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/canvas.test.ets @@ -0,0 +1,109 @@ +/** + * 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 canvasActualBoundingBoxAscentJsunit() { + describe('canvasActualBoundingBoxAscentTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/canvas', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get canvas state success " + JSON.stringify(pages)); + if (!("canvas" == pages.name)) { + console.info("get canvas state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push canvas page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push canvas page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("canvasActualBoundingBoxAscent after each called"); + }); + + it('testcanvasAttributes0001', 0, async function (done) { + console.info('canvasAttributes0001 testcanvasAttributes0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Canvas'); + console.info("[testcanvasAttributes0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Canvas'); + expect(obj.$attrs.width).assertEqual("100.00%"); + console.info("[testcanvasAttributes0001] width value :" + obj.$attrs.width); + done(); + }); + + it('testcanvasAttributes0002', 0, async function (done) { + console.info('canvasAttributes0002 testcanvasAttributes0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Canvas'); + console.info("[testcanvasAttributes0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Canvas'); + expect(obj.$attrs.height).assertEqual("100.00%"); + console.info("[testcanvasAttributes0002] height value :" + obj.$attrs.height); + done(); + }); + + it('testcanvasAttributes0003', 0, async function (done) { + console.info('canvasAttributes0003 testcanvasAttributes0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Canvas'); + console.info("[testcanvasAttributes0003] component backgroundColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Canvas'); + expect(obj.$attrs.backgroundColor).assertEqual("#FFFFFF00"); + console.info("[testcanvasAttributes0003] backgroundColor value :" + obj.$attrs.backgroundColor); + done(); + }); + + it('testcanvasAttributes0004', 0, async function (done) { + console.info('canvasAttributes0003 testcanvasAttributes0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Canvas'); + console.info("[testcanvasAttributes0004] component position strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Canvas'); + expect(obj.$attrs.position.x).assertEqual("3.00vp"); + console.info("[testcanvasAttributes0004] position value :" + obj.$attrs.position); + done(); + }); + + it('testcanvasAttributes0005', 0, async function (done) { + console.info('canvasAttributes0005 testcanvasAttributes0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Canvas'); + console.info("[testcanvasAttributes0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Canvas'); + expect(obj.$attrs.align).assertEqual("Alignment.Center"); + console.info("[testcanvasAttributes0005] align value :" + obj.$attrs.align); + done(); + }); + + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/checkBox.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/checkBox.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..753af21a4fe9f9788d054dcb199c674f8c2b9811 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/checkBox.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 checkBoxGroupJsunit() { + describe('checkBoxGroupTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/checkBox', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get checkBox state success " + JSON.stringify(pages)); + if (!("checkBox" == pages.name)) { + console.info("get checkBox state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push checkBox page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push checkBox page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("checkBoxGroup after each called"); + }); + + it('testcheckBoxGroup001', 0, async function (done) { + console.info('checkBoxGroup testcheckBoxGroup001 START'); + await Utils.sleep(2000); + try { + console.info("testcheckBoxGroup_0011 click result is: " + JSON.stringify(sendEventByKey('CheckboxGroup', 10, ""))); + let strJson = getInspectorByKey('Checkbox2'); + console.info("[testcheckBoxGroup001] component select strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Checkbox'); + expect(obj.$attrs.select).assertEqual("false"); + } catch (err) { + console.info("testcheckBoxGroup_0011 on click err : " + JSON.stringify(err)); + } + console.info('testcheckBoxGroup001 END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/checkBoxGroup.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/checkBoxGroup.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..55765c38521b11b6be3d8f700cb2243beb949997 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/checkBoxGroup.test.ets @@ -0,0 +1,88 @@ +/** + * 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 events_emitter from '@ohos.events.emitter'; +import Utils from './Utils.ets' + +export default function checkBoxGroupPartJsunit() { + describe('checkBoxGroupPartTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/checkBoxGroup', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get checkBoxGroup state success " + JSON.stringify(pages)); + if (!("checkBoxGroup" == pages.name)) { + console.info("get checkBoxGroup state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push checkBoxGroup page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push checkBoxGroup page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("checkBoxGroupPart after each called"); + }); + + it('testcheckBoxGroupPart0011', 0, async function (done) { + console.info('checkBoxGroupPart testcheckBoxGroupPart0011 START'); + await Utils.sleep(2000); + try { + console.info("testcheckBoxGroupPart_0011 click result is: " + JSON.stringify(sendEventByKey('CheckboxGroup', 10, ""))); + let strJson = getInspectorByKey('Checkbox2'); + console.info("[testcheckBoxGroupPart0011] component select strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Checkbox'); + expect(obj.$attrs.select).assertEqual("false"); + } catch (err) { + console.info("testcheckBoxGroupPart_0011 on click err : " + JSON.stringify(err)); + } + console.info('testcheckBoxGroupPart0011 END'); + done(); + }); + + it('testcheckBoxGroup0001', 0, async function (done) { + console.info('checkBoxGroup testcheckBoxGroup0001 START'); + await Utils.sleep(2000); + try { + console.info("testcheckBoxGroup0001 click result is: " + JSON.stringify(sendEventByKey('CheckboxGroup', 10, ""))); + var innerEvent = { + eventId: 60301, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testcheckBoxGroup0001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(2); + done(); + } + events_emitter.on(innerEvent, callback); + } catch (err) { + console.info("testcheckBoxGroup0001 on click err : " + JSON.stringify(err)); + } + console.info('testcheckBoxGroup0001 END'); + }) + }) +} + diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/color.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/color.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5b7426766b35ee5196a0da2c896b58163510f942 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/color.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 colorEnumJsunit() { + describe('colorEnumJsunit', function () { + beforeEach(async function (done) { + console.info("color beforeEach start"); + let options = { + uri: 'pages/color', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get color state success " + JSON.stringify(pages)); + if (!("color" == pages.name)) { + console.info("get color state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(1000); + console.info("push color page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push color page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("colorEnumTest after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testcolorTransparent0001 + * @tc.desic acecolorTransparentEtsTest0001 + */ + it('testcolorTransparent0001', 0, async function (done) { + console.info('colorEnumTest testcolorTransparent0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Transparent'); + console.info("[testcolorTransparent0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + console.info("[testcolorTransparent0001] fontColor value :" + obj.$attrs.fontColor); + expect(obj.$attrs.fontColor).assertEqual("#FF000000"); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/common.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/common.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..95f35a18b1919ee687d3e0c145732f332575aea3 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/common.test.ets @@ -0,0 +1,246 @@ +/** + * 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 commonColorModeJsunit() { + describe('commonColorModeTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/common', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get common state success " + JSON.stringify(pages)); + if (!("common" == pages.name)) { + console.info("get common state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push common page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push common page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("commonColorMode after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0011 + * @tc.name testCommonColorMode0011 + * @tc.desic acecommonColorModeEtsTest0011 + */ + it('testCommonColorMode0011', 0, async function (done) { + console.info('commonColorMode testCommonColorMode0011 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ThinText'); + console.info("[testCommonColorMode0011] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.backgroundBlurStyle).assertEqual(undefined); + console.info("[testCommonColorMode0011] backgroundBlurStyle value :" + obj.$attrs.backgroundBlurStyle); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0012 + * @tc.name testCommonColorMode0012 + * @tc.desic acecommonColorModeEtsTest0012 + */ + it('testCommonColorMode0012', 0, async function (done) { + console.info('commonColorMode testCommonColorMode0012 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ThickText'); + console.info("[testCommonColorMode0012] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.backgroundBlurStyle).assertEqual(undefined); + console.info("[testCommonColorMode0012] backgroundBlurStyle value :" + obj.$attrs.backgroundBlurStyle); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_00017 + * @tc.name testCommonMiddle0001 + * @tc.desic acecommonMiddleEtsTest0001 + */ + it('testCommonMiddle0001', 0, async function (done) { + console.info('commonMiddle testCommonMiddle0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('middleText'); + console.info("[testCommonMiddle0001] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + console.info("[testCommonMiddle0001] alignRules value :" + obj.$attrs.alignRules); + expect(obj.$attrs.alignRules).assertEqual(undefined); + console.info("[testCommonMiddle0001] alignRules value :" + obj.$attrs.alignRules); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_00018 + * @tc.name testCommonOutset0001 + * @tc.desic acecommonOutsetEtsTest0001 + */ + it('testCommonOutset0001', 0, async function (done) { + console.info('commonOutset testCommonOutset0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('outsetText'); + console.info("[testCommonOutset0001] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + console.info("[testCommonOutset0001] borderImage value :" + obj.$attrs.borderImage); + expect(obj.$attrs.borderImage).assertEqual(undefined); + console.info("[testCommonOutset0001] borderImage value :" + obj.$attrs.borderImage); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_00019 + * @tc.name testCommonRepeat0001 + * @tc.desic acecommonRepeatEtsTest0001 + */ + it('testCommonRepeat0001', 0, async function (done) { + console.info('commonRepeat testCommonRepeat0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('RepeatText'); + console.info("[testCommonRepeat0001] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.borderImage).assertEqual(undefined); + console.info("[testCommonOutset0001] borderImage value :" + obj.$attrs.borderImage); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_00020 + * @tc.name testCommonSpace0001 + * @tc.desic acecommonSpaceEtsTest0001 + */ + it('testCommonSpace0001', 0, async function (done) { + console.info('commonSpace testCommonSpace0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('SpaceText'); + console.info("[testCommonSpace0001] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.borderImage).assertEqual(undefined); + console.info("[testCommonSpace0001] borderImage value :" + obj.$attrs.borderImage); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_00021 + * @tc.name testCommonSlice0001 + * @tc.desic acecommonSliceEtsTest0001 + */ + it('testCommonSlice0001', 0, async function (done) { + console.info('commonSlice testCommonSlice0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('sliceText'); + console.info("[testCommonSlice0001] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + console.info("[testCommonSlice0001] borderImage value :" + obj.$attrs.borderImage); + expect(obj.$attrs.borderImage).assertEqual(undefined); + console.info("[testCommonSlice0001] borderImage value :" + obj.$attrs.borderImage); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_00022 + * @tc.name testCommonArea0001 + * @tc.desic acecommonAreaEtsTest0001 + */ + it('testCommonArea0001', 0, async function (done) { + console.info('commonSlice testCommonArea0001 START'); + await Utils.sleep(500); + try { + var innerEvent = { + eventId: 60312, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testCommonArea0001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(320); + done(); + } + console.info("testCommonArea0001 click result is: " + JSON.stringify(sendEventByKey('areaText', 10, ""))); + events_emitter.on(innerEvent, callback); + } catch (err) { + console.info("testCommonArea0001 on click err : " + JSON.stringify(err)); + } + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_00023 + * @tc.name testCommonTouches0001 + * @tc.desic acecommonTouchesEtsTest0001 + */ + it('testCommonTouches0001', 0, async function (done) { + console.info('commonSlice testCommonTouches0001 START'); + await Utils.sleep(500); + try { + var innerEvent = { + eventId: 60313, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testCommonTouches0001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(undefined); + done(); + } + console.info("testCommonTouches0001 click result is: " + JSON.stringify(sendEventByKey('touchesText', 10, ""))); + events_emitter.on(innerEvent, callback); + } catch (err) { + console.info("testCommonTouches0001 on click err : " + JSON.stringify(err)); + } + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_00024 + * @tc.name testCommonChangedTouches0001 + * @tc.desic acecommonTouchesEtsTest0001 + */ + it('testCommonChangedTouches0001', 0, async function (done) { + console.info('commonSlice testCommonChangedTouches0001 START'); + await Utils.sleep(500); + try { + var innerEvent = { + eventId: 60314, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testCommonChangedTouches0001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(undefined); + done(); + } + console.info("changedTouches0001 click is: " + JSON.stringify(sendEventByKey('changedTouchesText', 10, ""))); + events_emitter.on(innerEvent, callback); + } catch (err) { + console.info("testCommonChangedTouches0001 on click err : " + JSON.stringify(err)); + } + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/copyOption.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/copyOption.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b12cd1d3284d4fdc5d6bc205e246dd15defa4876 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/copyOption.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 copyOptionJsunit() { + describe('copyOptionTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/copyOption', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get copyOption state success " + JSON.stringify(pages)); + if (!("copyOption" == pages.name)) { + console.info("get copyOption state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push copyOption page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push copyOption page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("copyOption after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testcopyOption0001 + * @tc.desic acecopyOptionEtsTest0001 + */ + it('testcopyOption0001', 0, async function (done) { + console.info('hoverEffect testcopyOption0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('InAppText'); + console.info("[testcopyOption0001] component copyOption strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.copyOption).assertEqual(undefined); + console.info("[testcopyOption0001] copyOption value :" + obj.$attrs.copyOption); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testcopyOption0002 + * @tc.desic acecopyOptionEtsTest0002 + */ + it('testcopyOption0002', 0, async function (done) { + console.info('hoverEffect testcopyOption0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('LocalDeviceText'); + console.info("[testcopyOption0002] component copyOption strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.copyOption).assertEqual(undefined); + console.info("[testcopyOption0002] copyOption value :" + obj.$attrs.copyOption); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/curves.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/curves.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..677aeb0f476a7a818474bfccda3631efb2f3f871 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/curves.test.ets @@ -0,0 +1,262 @@ +/** + * 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 curvesEaseOutJsunit() { + describe('curvesEaseOutTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/curves', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get curves state success " + JSON.stringify(pages)); + if (!("curves" == pages.name)) { + console.info("get curves state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(1000); + console.info("push curves page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push curves page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("curvesEaseOut after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testeaseOutText0001 + * @tc.desic aceeaseOutTextEtsTest0001 + */ + it('testeaseOutText0001', 0, async function (done){ + console.info('easeOutText testeaseOutText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('EaseOutText') + console.info("[testeaseOutText0001] component EaseOutText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testeaseOutText0001] width value :" + obj.$attrs.width); + console.info("[testeaseOutText0001] height value :" + obj.$attrs.height); + console.info("[testeaseOutText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testeaseInOutText0001 + * @tc.desic aceeaseInOutTextEtsTest0001 + */ + it('testeaseInOutText0001', 0, async function (done){ + console.info('easeInOutText testeaseInOutText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('EaseInOutText') + console.info("[testeaseInOutText0001] component EaseInOutText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testeaseInOutText0001] width value :" + obj.$attrs.width); + console.info("[testeaseInOutText0001] height value :" + obj.$attrs.height); + console.info("[testeaseInOutText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + console.info("[testeaseInOutText0001] animation value :" + obj.$attrs.animation); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testfastOutSlowInText0001 + * @tc.desic acefastOutSlowInTextEtsTest0001 + */ + it('testfastOutSlowInText0001', 0, async function (done){ + console.info('fastOutSlowInText testfastOutSlowInText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('FastOutSlowInText') + console.info("[testfastOutSlowInText0001] component fastOutSlowInText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testfastOutSlowInText0001] width value :" + obj.$attrs.width); + console.info("[testfastOutSlowInText0001] height value :" + obj.$attrs.height); + console.info("[testfastOutSlowInText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + console.info("[testfastOutSlowInText0001] animation value :" + obj.$attrs.animation); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testlinearOutSlowInText0001 + * @tc.desic acelinearOutSlowInTextEtsTest0001 + */ + it('testlinearOutSlowInText0001', 0, async function (done){ + console.info('linearOutSlowInText testlinearOutSlowInText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('LinearOutSlowInText') + console.info("[testlinearOutSlowInText0001] component linearOutSlowInText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testlinearOutSlowInText0001] width value :" + obj.$attrs.width); + console.info("[testlinearOutSlowInText0001] height value :" + obj.$attrs.height); + console.info("[testlinearOutSlowInText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + console.info("[testlinearOutSlowInText0001] animation value :" + obj.$attrs.animation); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testfastOutLinearInText0001 + * @tc.desic acefastOutLinearInTextEtsTest0001 + */ + it('testfastOutLinearInText0001', 0, async function (done){ + console.info('fastOutLinearInText testfastOutLinearInText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('fastOutLinearInText') + console.info("[testfastOutLinearInText0001] component fastOutLinearInText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testfastOutLinearInText0001] width value :" + obj.$attrs.width); + console.info("[testfastOutLinearInText0001] height value :" + obj.$attrs.height); + console.info("[testfastOutLinearInText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testextremeDecelerationText0001 + * @tc.desic aceextremeDecelerationTextEtsTest0001 + */ + it('testextremeDecelerationText0001', 0, async function (done){ + console.info('extremeDecelerationText testextremeDecelerationText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('ExtremeDecelerationText') + console.info("[testextremeDecelerationText0001] component extremeDecelerationText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testextremeDecelerationText0001] width value :" + obj.$attrs.width); + console.info("[testextremeDecelerationText0001] height value :" + obj.$attrs.height); + console.info("[testextremeDecelerationText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + console.info("[testextremeDecelerationText0001] animation value :" + obj.$attrs.animation); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testsharpText0001 + * @tc.desic acesharpTextEtsTest0001 + */ + it('testsharpText0001', 0, async function (done){ + console.info('sharpText testsharpText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('SharpText') + console.info("[testSharpText0001] component sharpText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testsharpText0001] width value :" + obj.$attrs.width); + console.info("[testsharpText0001] height value :" + obj.$attrs.height); + console.info("[testsharpText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testrhythmText0001 + * @tc.desic acerhythmTextEtsTest0001 + */ + it('testrhythmText0001', 0, async function (done){ + console.info('rhythmText testrhythmText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('RhythmText'); + console.info("[testrhythmText0001] component rhythmText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testrhythmText0001] width value :" + obj.$attrs.width); + console.info("[testrhythmText0001] height value :" + obj.$attrs.height); + console.info("[testrhythmText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testsmoothText0001 + * @tc.desic acesmoothTextEtsTest0001 + */ + it('testsmoothText0001', 0, async function (done){ + console.info('smoothText testsmoothText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('SmoothText'); + console.info("[testsmoothText0001] component smoothText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testsmoothText0001] width value :" + obj.$attrs.width); + console.info("[testsmoothText0001] height value :" + obj.$attrs.height); + console.info("[testsmoothText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testfrictionText0001 + * @tc.desic acefrictionTextEtsTest0001 + */ + it('testfrictionText0001', 0, async function (done){ + console.info('frictionText testfrictionText0001 START'); + await Utils.sleep(1000); + let strJson = getInspectorByKey('FrictionText'); + console.info("[testfrictionText0001] component frictionText strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + expect(obj.$attrs.width).assertEqual("400.00vp"); + expect(obj.$attrs.height).assertEqual("200.00vp"); + expect(obj.$attrs.backgroundColor).assertEqual("#FF317AFF"); + expect(obj.$attrs.animation).assertEqual(undefined); + console.info("[testfrictionText0001] width value :" + obj.$attrs.width); + console.info("[testfrictionText0001] height value :" + obj.$attrs.height); + console.info("[testfrictionText0001] backgroundColor value :" + obj.$attrs.backgroundColor); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/datePicker.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/datePicker.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c9590348458738454ac8b6f2a050db998bc97019 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/datePicker.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 datePickerLunarJsunit() { + describe('datePickerLunarTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/datePicker', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get datePicker state success " + JSON.stringify(pages)); + if (!("datePicker" == pages.name)) { + console.info("get datePicker state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push datePicker page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push datePicker page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("datePickerLunar after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_001 + * @tc.name testdatePickerLunar001 + * @tc.desic acedatePickerLunarEtsTest001 + */ + it('testdatePickerLunar001', 0, async function (done) { + console.info('datePickerLunar testdatePickerLunar001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('DatePicker'); + console.info("[testdatePickerLunar001] component lunar strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('DatePicker'); + expect(obj.$attrs.lunar).assertEqual("true"); + console.info("[testdatePickerLunar001] lunar value :" + obj.$attrs.lunar); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/enums.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/enums.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..daf073cbe404c4a91de46129d1dd7321934e8fb5 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/enums.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 enumsCancelJsunit() { + describe('enumsCancelTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/enums', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get enums state success " + JSON.stringify(pages)); + if (!("enums" == pages.name)) { + console.info("get enums state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push enums page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push enums page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("enumsCancel after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testenumsCancel0001 + * @tc.desic aceenumsCancelEtsTest0001 + */ + it('testenumsCancel0001', 0, async function (done) { + console.info('enumsCancel testenumsCancel0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('HighlightText'); + console.info("[testenumsCancel0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.hoverEffect).assertEqual("HoverEffect.Highlight"); + console.info("[testenumsCancel0001] hoverEffect value :" + obj.$attrs.hoverEffect); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/fill_mode.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/fill_mode.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c2985a5ce30a1079d35a7c71c8b47e76b1da37b8 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/fill_mode.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 fillModeForwardJsunit() { + describe('fillModeForwardTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/fill_mode', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get fill_mode state success " + JSON.stringify(pages)); + if (!("fill_mode" == pages.name)) { + console.info("get fill_mode state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push fill_mode page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push fill_mode page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("fillModeForward after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testfillModeForward0001 + * @tc.desic acefillModeForwardEtsTest0001 + */ + it('testfillModeForward0001', 0, async function (done) { + console.info('fillModeForward testfillModeForward0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ImageAnimator'); + console.info("[testfillModeForward0001] component fillMode strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('ImageAnimator'); + expect(obj.$attrs.fillMode).assertEqual("FillMode.Forwards"); + console.info("[testfillModeForward0001] fillMode value :" + obj.$attrs.fillMode); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/gesture.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/gesture.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5cc59adc00f72447ca340430514ba9e8261c5733 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/gesture.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 gestureParallelJsunit() { + describe('gestureParallelTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/gesture', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get gesture state success " + JSON.stringify(pages)); + if (!("gesture" == pages.name)) { + console.info("get gesture state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push gesture page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push gesture page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("gestureParallel after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testgestureParallel0001 + * @tc.desic acegestureParallelEtsTest0001 + */ + it('testgestureParallel0001', 0, async function (done) { + console.info('gestureParallel testgestureParallel0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ParallelText'); + console.info("[testgestureParallel0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("320.00vp"); + console.info("[testgestureParallel0001] width value :" + obj.$attrs.width); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/gridCol.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/gridCol.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a63d57bea0867ba5315c2854502de291f43a3eb8 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/gridCol.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 gridColXlJsunit() { + describe('gridColXlTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/gridCol', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get gridCol state success " + JSON.stringify(pages)); + if (!("gridCol" == pages.name)) { + console.info("get gridCol state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push gridCol page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push gridCol page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("gridColXl after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testgridColXl0001 + * @tc.desic acegridColXlEtsTest0001 + */ + it('testgridColXl0001', 0, async function (done) { + console.info('gridColXl testgridColXl0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('GridCol'); + console.info("[testgridColXl0001] component order strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('GridCol'); + expect(obj.$attrs.order).assertEqual("{xl: 10}"); + console.info("[testgridColXl0001] order value :" + obj.$attrs.order); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testgridColXl0002 + * @tc.desic acegridColXlEtsTest0002 + */ + it('testgridColXl0002', 0, async function (done) { + console.info('gridColXl testgridColXl0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('GridCol'); + console.info("[testgridColXl0002] component backgroundColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Color.Green'); + expect(obj.$attrs.backgroundColor).assertEqual("Color.Green"); + console.info("[testgridColXl0002] backgroundColor value :" + obj.$attrs.backgroundColor); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/gridRow.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/gridRow.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e330facb710d599a6ea91ade48fc93839a88d92b --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/gridRow.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 gridRowXlJsunit() { + describe('gridRowXlTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/gridRow', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get gridRow state success " + JSON.stringify(pages)); + if (!("gridRow" == pages.name)) { + console.info("get gridRow state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push gridRow page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push gridRow page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("gridRowXl after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testgridRowXl0001 + * @tc.desic acegridRowXlEtsTest0001 + */ + it('testgridRowXl0001', 0, async function (done) { + console.info('gridRowXl testgridRowXl0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('GridRowColumnOption——xl'); + console.info("[testgridRowXl0001] component backgroundColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('GridRow'); + expect(obj.$attrs.backgroundColor).assertEqual("Color.Red"); + console.info("[testgridRowXl0001] backgroundColor value :" + obj.$attrs.backgroundColor); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/hitTestMode.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/hitTestMode.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..863bee97f754eff2c079125d49206b49176aa356 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/hitTestMode.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 hitTestModeJsunit() { + describe('hitTestModeJsunit', function () { + beforeEach(async function (done) { + console.info("hitTestMode beforeEach start"); + let options = { + uri: 'pages/hitTestMode', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get hitTestMode state success " + JSON.stringify(pages)); + if (!("hitTestMode" == pages.name)) { + console.info("get hitTestMode state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push hitTestMode page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push hitTestMode page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("hitTestModeTest after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testhitTestMode0002 + * @tc.desic acehitTestModelEtsTest0002 + */ + it('testhitTestMode0002', 0, async function (done) { + console.info('hitTestMode testhitTestMode0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Block'); + console.info("[testhitTestMode0002] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Stack'); + console.info("[testhitTestMode0002] hitTestBehavior value :" + obj.$attrs.hitTestBehavior); +// expect(obj.$attrs.hitTestBehavior).assertEqual(undefined); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/hoverEffect.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/hoverEffect.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7a321fdd96ce308060bc8ee0df322e497b563ec6 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/hoverEffect.test.ets @@ -0,0 +1,83 @@ +//@ts-nocheck +/** + * 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 hoverEffectJsunit() { + describe('hoverEffectTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/hoverEffect', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get hoverEffect state success " + JSON.stringify(pages)); + if (!("hoverEffect" == pages.name)) { + console.info("get hoverEffect state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push hoverEffect page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push hoverEffect page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("hoverEffect after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testhoverEffect0001 + * @tc.desic acehoverEffectEtsTest0001 + */ + it('testhoverEffect0001', 0, async function (done) { + console.info('hoverEffect testhoverEffect0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ScaleText'); + console.info("[testhoverEffect0001] component hoverEffect strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.hoverEffect).assertEqual(undefined); + console.info("[testhoverEffect0001] hoverEffect value :" + obj.$attrs.hoverEffect); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testhoverEffect0002 + * @tc.desic acehoverEffectEtsTest0002 + */ + it('testhoverEffect0002', 0, async function (done) { + console.info('hoverEffect testhoverEffect0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('HighlightText'); + console.info("[testhoverEffect0002] component hoverEffect strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.hoverEffect).assertEqual(undefined); + console.info("[testhoverEffect0002] hoverEffect value :" + obj.$attrs.hoverEffect); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/list_item_group.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/list_item_group.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1acde951290c8ccca89fe9ab153ea649d72b4c4f --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/list_item_group.test.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 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 list_item_groupJsunit() { + describe('list_item_groupJsunit', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/list_item_group', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get list_item_group state success " + JSON.stringify(pages)); + if (!("list_item" == pages.name)) { + console.info("get list_item_group state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push list_item_group page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push list_item_group page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("list_item_group after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testlist_itemOnSelect0001 + * @tc.desic acelist_itemOnSelectEtsTest0001 + */ + it('testlist_item_group0001', 0, async function (done) { + console.info('testcase testlist_item_group0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Mon'); + console.info("[testlist_item_group0001] component state strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('ListItemGroup'); + console.info("[testlist_item_group0001] editable value :" + obj.$type); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testlist_itemOnSelect0002 + * @tc.desic acelist_itemOnSelectEtsTest0002 + */ + it('testlist_item_group0002', 0, async function (done) { + console.info('testcase testlist_item_group0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Tues'); + console.info("[testlist_item_group0002] component border strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('ListItemGroup'); + console.info("[testlist_item_group0002] selectable value :" + obj.$type); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testlist_itemOnSelect0003 + * @tc.desic acelist_itemOnSelectEtsTest0002 + */ + it('testlist_item_group0003', 0, async function (done) { + console.info('testcase testlist_item_group0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Wens'); + console.info("[testlist_item_group0003] component border strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('ListItemGroup'); + expect(obj.$attrs.header).assertNotEqual(undefined); + console.info("[testlist_itemOnSelect0003] hear value :" + obj.$attrs.header); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testlist_itemSwipeAction0004 + * @tc.desic acelist_itemSwipeActionEtsTest0004 + */ + it('testlist_item_group0004', 0, async function (done) { + console.info('testcase testlist_item_group0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Thurs'); + console.info("[testlist_item_group0004] component border strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('ListItemGroup'); + expect(obj.$attrs.rooter).assertNotEqual(undefined); + console.info("[testlist_item_group0004] hear value :" + obj.$attrs.rooter); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/listtest.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/listtest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..adad4c0d01e48288ac5142c0964985e8086411c3 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/listtest.test.ets @@ -0,0 +1,66 @@ +/** + * 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 listtestIdleJsunit() { + describe('listtestIdleTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/listtest', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get listtest state success " + JSON.stringify(pages)); + if (!("listtest" == pages.name)) { + console.info("get listtestI state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push listtest page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push listtest page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("listtestIdle after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testlisttestIdle0001 + * @tc.desic acelisttestIdleEtsTest0001 + */ + it('testlisttestIdle0001', 0, async function (done) { + console.info('listtestIdle testlisttestIdle0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('ScrollList'); + console.info("[testlisttestIdle0001] component controlButton strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('List'); + expect(obj.$attrs.editMode).assertEqual("true"); + console.info("[testlisttestIdle0001] editMode value :" + obj.$attrs.editMode); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/loadingProgress.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/loadingProgress.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..cea401c98a70c43152148d0689481df78ec69a16 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/loadingProgress.test.ets @@ -0,0 +1,90 @@ +/** + * 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 loadingProgressCircularJsunit() { + describe('loadingProgressCircularTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/loadingProgress', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get loadingProgress state success " + JSON.stringify(pages)); + if (!("loadingProgress" == pages.name)) { + console.info("get loadingProgress state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push loadingProgress page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push loadingProgress page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("loadingProgressCircular after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0011 + * @tc.name testloadingProgressCircular0011 + * @tc.desic aceloadingProgressCircularEtsTest0011 + */ + it('testloadingProgressCircular0011', 0, async function (done) { + console.info('loadingProgressCircular testloadingProgressCircular0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('CircularText'); + console.info("[testloadingProgressCircular0011] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.color).assertEqual(undefined); + expect(obj.$attrs.width).assertEqual('100.00vp'); + expect(obj.$attrs.margin).assertEqual('0.00px'); + console.info("[testloadingProgressCircular0011] color value :" + obj.$attrs.color); + console.info("[testloadingProgressCircular0011] width value :" + obj.$attrs.width); + console.info("[testloadingProgressCircular0011] margin value :" + obj.$attrs.margin); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testloadingProgressCircular0001 + * @tc.desic aceloadingProgressCircularEtsTest0011 + */ + it('testloadingProgressOrbital0001', 0, async function (done) { + console.info('loadingProgressOrbital testloadingProgressCircular0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('OrbitalText'); + console.info("[testloadingProgressOrbital0001] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.color).assertEqual(undefined); + expect(obj.$attrs.width).assertEqual('100.00vp'); + expect(obj.$attrs.margin).assertEqual('0.00px'); + console.info("[testloadingProgressOrbital0001] color value :" + obj.$attrs.color); + console.info("[testloadingProgressOrbital0001] width value :" + obj.$attrs.width); + console.info("[testloadingProgressOrbital0001] margin value :" + obj.$attrs.margin); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/pluginComponent.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/pluginComponent.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7ab1af3997cd58b6e0fbe8149ca896883f49b7c8 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/pluginComponent.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 pluginComponentKVObjectJsunit() { + describe('pluginComponentKVObjectTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/pluginComponent', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get pluginComponent state success " + JSON.stringify(pages)); + if (!("pluginComponent" == pages.name)) { + console.info("get pluginComponent state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push pluginComponent page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push pluginComponent page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("pluginComponentKVObject after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testpluginComponentKVObject0001 + * @tc.desic acepluginComponentKVObjectEtsTest0001 + */ + it('testpluginComponentKVObject0001', 0, async function (done) { + console.info('pluginComponentKVObject testpluginComponentKVObject0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('pluginComponent'); + console.info("[testpluginComponentKVObject0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('PluginComponent'); + expect(obj.$attrs.size.width).assertEqual('500.00vp'); + console.info("[testpluginComponentKVObject0001] size.width value :" + obj.$attrs.size.width); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/progress.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/progress.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ed59e82d59b948d11600f1dec9eedefd735a1f59 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/progress.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 progressScaleCountJsunit() { + describe('progressScaleCountTest', function () { + beforeEach(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("progressScaleCount after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testprogressScaleCount0001 + * @tc.desic aceprogressScaleCountEtsTest0001 + */ + it('testprogressScaleCount0001', 0, async function (done) { + console.info('progressScaleCount testprogressScaleCount0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('progressStyleOptions'); + console.info("[testprogressScaleCount0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Progress'); + expect(obj.$attrs.style.scaleCount).assertEqual("15"); + console.info("[testprogressScaleCount0001] style.scaleCount value :" + obj.$attrs.style.scaleCount); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testprogressScaleCount0002 + * @tc.desic aceprogressScaleCountEtsTest0002 + */ + it('testprogressScaleCount0002', 0, async function (done) { + console.info('progressScaleCount testprogressScaleCount0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('progressStyleOptions'); + console.info("[testprogressScaleCount0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Progress'); + expect(obj.$attrs.style.scaleWidth).assertEqual('5.00vp'); + console.info("[testprogressScaleCount0002] style.scaleWidth value :" + obj.$attrs.style.scaleWidth); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/radio.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/radio.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9413f4ab7156af3ee4ed00a15a840e91e860e907 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/radio.test.ets @@ -0,0 +1,71 @@ +/** + * 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 radioGroupJsunit() { + describe('radioGroupTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/radio', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get radio state success " + JSON.stringify(pages)); + if (!("radio" == pages.name)) { + console.info("get radio state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push radio page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push radio page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("radioGroup after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_001 + * @tc.name testradioGroup001 + * @tc.desic aceradioGroupEtsTest001 + */ + it('testradioGroup001', 0, async function (done) { + console.info('radioGroup testradioGroup001 START'); + await Utils.sleep(2000); + try { + console.info("testradioGroup_0011 click result is: " + JSON.stringify(sendEventByKey('RadioTwo', 10, ""))); + let strJson = getInspectorByKey('RadioOne'); + console.info("[testradioGroup001] component checked strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Radio'); + expect(obj.$attrs.checked).assertEqual("true"); + console.info("[testradioGroup001] checked value :" + obj.$attrs.checked); + } catch (err) { + console.info("testradioGroup_0011 on click err : " + JSON.stringify(err)); + } + console.info('testradioGroup001 END'); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/refresh.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/refresh.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..d8eeefd2e654496d3d55e3ad517df0eae3ac7dc1 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/refresh.test.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 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 refreshDragJsunit() { + describe('refreshDragTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/refresh', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get refresh state success " + JSON.stringify(pages)); + if (!("refresh" == pages.name)) { + console.info("get refresh state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push refresh page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push refresh page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("refreshDrag after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0011 + * @tc.name testrefreshDrag0011 + * @tc.desic acerefreshDragEtsTest0011 + */ + it('testrefreshDrag0011', 0, async function (done) { + console.info('refreshDrag testrefreshDrag0011 START'); + await Utils.sleep(2000); + try { + var event = { + eventId: 60304, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testrefreshDrag0011 get event data is: " + JSON.stringify(eventData)); + expect(eventData.data.Result).assertEqual(true); + done(); + } + console.info("testrefreshDrag0011 click result is: " + JSON.stringify(sendEventByKey('Refresh', 10, ""))); + events_emitter.on(event, callback); + } catch (err) { + console.info("testrefreshDrag0011 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testrefreshDrag0011 END'); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0012 + * @tc.name testrefreshRefresh0001 + * @tc.desic acerefreshRefreshEtsTest0001 + */ + it('testrefreshRefresh0001', 0, async function (done) { + console.info('refreshDrag testrefreshRefresh0001 START'); + await Utils.sleep(2000); + try { + var eventTwo = { + eventId: 60305, + priority: events_emitter.EventPriority.LOW + } + var callbackTwo = (eventData) => { + console.info("testrefreshRefresh0001 get event data is: " + JSON.stringify(eventData)); + expect(eventData.data.Result).assertEqual(true); + done(); + } + console.info("testrefreshRefresh0001 click result is: " + JSON.stringify(sendEventByKey('Refresh', 10, ""))); + events_emitter.on(eventTwo, callbackTwo); + } catch (err) { + console.info("testrefreshRefresh0001 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testrefreshRefresh0001 END'); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/remoteWindow.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/remoteWindow.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..748eb758e41ba810942a19cfedde51247741a76f --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/remoteWindow.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 remoteWindowJsunit() { + describe('remoteWindowTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/remoteWindow', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get remoteWindow state success " + JSON.stringify(pages)); + if (!("remoteWindow" == pages.name)) { + console.info("get RemoteWindow state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push remoteWindow page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push remoteWindow page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("remoteWindow after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testremoteWindow0001 + * @tc.desic acesremoteWindowEtsTest0001 + */ + it('testRemoteWindow0001', 0, async function (done) { + console.info('remoteWindow testRemoteWindow0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual('100.00vp'); + console.info("[testRemoteWindow0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testRemoteWindow0002 + * @tc.desic aceRemoteWindowEtsTest0002 + */ + it('testRemoteWindow0002', 0, async function (done) { + console.info('RemoteWindow testRemoteWindow0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual('70.00vp'); + console.info("[testRemoteWindow0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testRemoteWindow0003 + * @tc.desic aceRemoteWindowEtsTest0003 + */ + it('testRemoteWindow0003', 0, async function (done) { + console.info('RemoteWindow testRemoteWindow0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual('20.00fp'); + console.info("[testRemoteWindow0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testRemoteWindow0004 + * @tc.desic aceRemoteWindowEtsTest0004 + */ + it('testRemoteWindow0004', 0, async function (done) { + console.info('RemoteWindow testRemoteWindow0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testRemoteWindow0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testRemoteWindow0005 + * @tc.desic aceRemoteWindowEtsTest0005 + */ + it('testRemoteWindow0005', 0, async function (done) { + console.info('RemoteWindow testRemoteWindow0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual('Alignment.TopStart'); + console.info("[testRemoteWindow0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testRemoteWindow0006 + * @tc.desic aceRemoteWindowEtsTest0006 + */ + it('testRemoteWindow0006', 0, async function (done) { + console.info('RemoteWindow testRemoteWindow0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual('#FFCCCCCC'); + console.info("[testRemoteWindow0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testRemoteWindow0007 + * @tc.desic aceRemoteWindowEtsTest0007 + */ + it('testRemoteWindow0007', 0, async function (done) { + console.info('RemoteWindow testRemoteWindow0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual('25.00fp'); + console.info("[testRemoteWindow0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testRemoteWindow0009 + * @tc.desic aceRemoteWindowEtsTest0009 + */ + it('testRemoteWindow0009', 0, async function (done) { + console.info('RemoteWindow testRemoteWindow009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual('10.00vp'); + console.info("[testRemoteWindow0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testRemoteWindow0010 + * @tc.desic aceRemoteWindowEtsTest0010 + */ + it('testRemoteWindow0010', 0, async function (done) { + console.info('RemoteWindow testRemoteWindow0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('formComponentFormDimensionWindowBoundsText'); + console.info("[testRemoteWindow0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual('TextAlign.Left'); + console.info("[testRemoteWindow0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/responseType.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/responseType.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2722356a164cbc6591c499b29261365eeee29431 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/responseType.test.ets @@ -0,0 +1,83 @@ +//@ts-nocheck +/** + * 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 responseTypeJsunit() { + describe('responseTypeTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/responseType', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get responseType state success " + JSON.stringify(pages)); + if (!("responseType" == pages.name)) { + console.info("get responseType state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push responseType page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push responseType page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("responseType after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testresponseType0002 + * @tc.desic acehoverEffectEtsTest0002 + */ + it('testresponseType0002', 0, async function (done) { + console.info('responseType testresponseType0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('RightClickText'); + console.info("[testresponseType0002] component bindContextMenu strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.bindContextMenu).assertEqual("ResponseType.LongPress"); + console.info("[testresponseType0002] bindContextMenu value :" + obj.$attrs.bindContextMenu); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testhoverEffect0003 + * @tc.desic acehoverEffectEtsTest0003 + */ + it('testresponseType0003', 0, async function (done) { + console.info('responseType testresponseType0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('LongPressText'); + console.info("[testresponseType0003] component bindContextMenu strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.bindContextMenu).assertEqual("ResponseType.LongPress"); + console.info("[testresponseType0003] bindContextMenu value :" + obj.$attrs.bindContextMenu); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/router.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/router.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..955c82893abf8a7072b068da078a61accbc309fa --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/router.test.ets @@ -0,0 +1,95 @@ +/** + * 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 routerStandardJsunit() { + describe('routerStandardTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/router', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get router state success " + JSON.stringify(pages)); + if (!("router" == pages.name)) { + console.info("get router state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push router page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push router page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("routerStandard after each called"); + }); + + it('testrouterStandard0011', 0, async function (done) { + console.info('routerStandard testrouterStandard0011 START'); + await Utils.sleep(2000); + try { + var standardEvent = { + eventId: 101, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testrouterStandard_0011 get event data is: " + JSON.stringify(eventData)); + expect(eventData.data.ArrayData).assertEqual("45"); + done(); + } + console.info("testrouterStandard_0011 click result1 is: " + JSON.stringify(sendEventByKey('StandardText', 10, ""))); + await Utils.sleep(2000); + console.info("testrouterStandard_0011 click result2 is: " + JSON.stringify(sendEventByKey('DataText', 10, ""))); + events_emitter.on(standardEvent, callback1); + } catch (err) { + console.info("testrouterStandard_0011 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testrouterStandard0011 END'); + }); + + it('testrouterSingle0001', 0, async function (done) { + console.info('routerSingle testrouterSingle0001 START'); + await Utils.sleep(2000); + try { + var singleEvent = { + eventId: 102, + priority: events_emitter.EventPriority.LOW + } + var callback2 = (eventData) => { + console.info("testrouterSingle_0001 get event data is: " + JSON.stringify(eventData)); + expect(eventData.data.ArrayData).assertEqual("46"); + done(); + } + console.info("testrouterSingle_0001 click result1 is: " + JSON.stringify(sendEventByKey('SingleText', 10, ""))); + await Utils.sleep(2000); + console.info("testrouterSingle_0001 click result2 is: " + JSON.stringify(sendEventByKey('SingleDataText', 10, ""))); + events_emitter.on(singleEvent, callback2); + } catch (err) { + console.info("testrouterSingle_0001 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testrouterSingle_0001 END'); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/scrollEdge.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/scrollEdge.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..af1ae76fc8e34ebcdeb80ad79788b7da232a83fd --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/scrollEdge.test.ets @@ -0,0 +1,76 @@ +/** + * 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 ScrollExampleJsunit() { + describe('ScrollExampleTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/scroll_edge', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get scroll_edge state success " + JSON.stringify(pages)); + if (!("ScrollExample" == pages.name)) { + console.info("get scroll_edge state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push scroll_edge page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push scroll_edge page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("ScrollExample after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testscrollEdgeMiddle0001 + * @tc.desic acescrollEdgeMiddleEtsTest0001 + */ + it('testscrollEdgeMiddle0001', 0, async function (done) { + console.info('scrollEdgeMiddle testscrollEdgeMiddle0001 START'); + + await Utils.sleep(2000); + try { + var innerEventOne = { + eventId: 60306, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testscrollEdgeMiddle0001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + done(); + } + console.info("onSelect_0012 click result is: " + JSON.stringify(sendEventByKey('MiddleText', 10, ""))); + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("testscrollEdgeMiddle0001 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testscrollEdgeMiddle0001 END'); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/sidebar.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/sidebar.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ec91cfaa0fee9c4c337877753f9d038411407b49 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/sidebar.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 sidebarIconsJsunit() { + describe('sidebarIconsTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/sidebar', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get sidebar state success " + JSON.stringify(pages)); + if (!("sidebarIcons" == pages.name)) { + console.info("get sidebar state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push sidebar page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push sidebar page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("sidebarIcons after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0011 + * @tc.name testsidebarIcons0011 + * @tc.desic acesidebarIconsEtsTest0011 + */ + it('testsidebarIcons0011', 0, async function (done) { + console.info('sidebarIcons testsidebarIcons0011 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('SideBarContainer'); + console.info("[testsidebarIcons0011] component controlButton strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('SideBarContainer'); + expect(obj.$attrs.controlButton.icons).assertEqual(undefined); + console.info("[testsidebarIcons0011] controlButton value :" + obj.$attrs.controlButton); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/slider.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/slider.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4fc8e17b0ed3f2931133ea1981e175019869fe23 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/slider.test.ets @@ -0,0 +1,70 @@ +/** + * 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 sliderMovingJsunit() { + describe('sliderMovingTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/slider', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get slider state success " + JSON.stringify(pages)); + if (!("sliderMoving" == pages.name)) { + console.info("get slider state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push slider page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push slider page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("sliderMoving after each called"); + }); + + it('testsliderMoving0011', 0, async function (done) { + console.info('sliderMoving testsliderMoving0011 START'); + await Utils.sleep(2000); + try { + var event = { + eventId: 60307, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testsliderMoving0011 get event data is: " + JSON.stringify(eventData)); + expect(eventData.data.Mode).assertEqual(false); + done(); + } + console.info("testsliderMoving0011 click result is: " + JSON.stringify(sendEventByKey('Slider', 10, ""))); + events_emitter.on(event, callback); + } catch (err) { + console.info("testsliderMoving0011 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testsliderMoving0011 END'); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/stateManagement.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/stateManagement.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3da471d3e8c5c608698e4c08f1223453e273629a --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/stateManagement.test.ets @@ -0,0 +1,66 @@ +/** + * 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 stateManagementDARKJsunit() { + describe('stateManagementDARKTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/stateManagement', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get stateManagement state success " + JSON.stringify(pages)); + if (!("stateManagement" == pages.name)) { + console.info("get stateManagement state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push stateManagement page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push stateManagement page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("stateManagementDARK after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_001 + * @tc.name teststateManagementDARK001 + * @tc.desic acestateManagementDARKEtsTest001 + */ + it('teststateManagementDARK001', 0, async function (done) { + console.info('stateManagementDARK teststateManagementDARK001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('DARKText'); + console.info("[teststateManagementDARK001] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.backgroundColor).assertEqual('#FF000001'); + console.info("[teststateManagementDARK001] backgroundColor value :" + obj.$attrs.backgroundColor); + done(); + }); + + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/stepperItem.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/stepperItem.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..806c0a2a25a5efddc88fde3eef843553585151ca --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/stepperItem.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 stepperItemDisabledJsunit() { + describe('stepperItemDisabledTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/stepperItem', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get stepperItem state success " + JSON.stringify(pages)); + if (!("stepperItem" == pages.name)) { + console.info("get stepperItem state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push stepperItem page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push stepperItem page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("stepperItemDisabled after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name teststepperItemDisabled0001 + * @tc.desic acestepperItemDisabledEtsTest0001 + */ + it('teststepperItemDisabled0001', 0, async function (done) { + console.info('stepperItemDisabled teststepperItemDisabled0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('StepperItem'); + console.info("[teststepperItemDisabled0001] component status strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('StepperItem'); + expect(obj.$attrs.status).assertEqual("ItemState.Disabled"); + console.info("[teststepperItemDisabled0001] status value :" + obj.$attrs.status); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/swiper.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/swiper.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8e1e908a5f4b3944f46d29c1e711824bd3a07910 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/swiper.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 swiperMaskJsunit() { + describe('swiperMaskTest', function () { + beforeEach(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("swiperMask after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_001 + * @tc.name testswiperMask001 + * @tc.desic aceswiperMaskEtsTest001 + */ + it('testswiperMask001', 0, async function (done) { + console.info('swiperMask testswiperMask001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('maskSwiper'); + console.info("[testswiperMask001] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Swiper'); + expect(obj.$attrs.indicatorStyle.mask).assertEqual(undefined); + console.info("[testswiperMask001] indicatorStyle value :" + obj.$attrs.indicatorStyle.mask); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/text_input.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/text_input.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..78f6960769179cd2dfc27eef02627e0b749b1bb2 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/text_input.test.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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function text_inputPhoneNumberJsunit() { + describe('text_inputPhoneNumberTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/text_input', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get text_input state success " + JSON.stringify(pages)); + if (!("text_input" == pages.name)) { + console.info("get text_input state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push text_input page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push text_input page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("text_inputPhoneNumber after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testtext_inputPhoneNumber0001 + * @tc.desic acetext_inputPhoneNumberEtsTest0001 + */ + it('testtext_inputPhoneNumber0001', 0, async function (done) { + console.info('text_inputPhoneNumber testtext_inputPhoneNumber0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('PhoneNumberText'); + console.info("[testtext_inputPhoneNumber0001] component type strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.type).assertEqual('InputType.Normal'); + console.info("[testtext_inputPhoneNumber0001] type value :" + obj.$attrs.type); + done(); + }); + + it('testtextInputStyle0001', 0, async function (done) { + console.info('textInputStyle testtextInputStyle0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('textInput1'); + console.info("[testtextInputStyle0001] strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.style).assertEqual('TextInputStyle.Default'); + console.info("[testtextInputStyle0001] textInput1 InputStyle value :" + obj.$attrs.style); + done(); + }); + + it('testtextInputStyle0002', 0, async function (done) { + console.info('textInputStyle testtextInputStyle0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('textInput2'); + console.info("[testtextInputStyle0002] strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.style).assertEqual('TextInputStyle.Inline'); + console.info("[testtextInputStyle0002] textInput2 inputStyle value :" + obj.$attrs.style); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/uiAppearance.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/uiAppearance.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..444381d884a26b17041eb07164ff2845a2198602 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/uiAppearance.test.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 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 uiAppearanceALWAYS_DARKJsunit() { + describe('uiAppearanceALWAYS_DARKTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/uiAppearance', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get uiAppearance state success " + JSON.stringify(pages)); + if (!("uiAppearance" == pages.name)) { + console.info("get uiAppearance state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push uiAppearance page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push uiAppearance page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("uiAppearanceALWAYS_DARK after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testuiAppearanceALWAYS_DARK0001 + * @tc.desic aceuiAppearanceALWAYS_DARKEtsTest0001 + */ + it('testuiAppearanceALWAYS_DARK0001', 0, async function (done) { + console.info('uiAppearanceALWAYS_DARK testuiAppearanceALWAYS_DARK0001 START'); + await Utils.sleep(2000); + try { + var event = { + eventId: 60308, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testuiAppearanceALWAYS_DARK0001 get event data is: " + JSON.stringify(eventData)); + expect(eventData.data.Mode).assertEqual(0); + console.info('testuiAppearanceALWAYS_DARK0001 END'); + done(); + } + console.info("testuiAppearanceALWAYS_DARK0001 click result is: " + JSON.stringify(sendEventByKey('ALWAYS_DARKText', 10, ""))); + events_emitter.on(event, callback); + } catch (err) { + console.info("testuiAppearanceALWAYS_DARK0001 on events_emitter err : " + JSON.stringify(err)); + } + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testuiAppearanceALWAYS_LIGHT0001 + * @tc.desic aceuiAppearanceALWAYS_LIGHTEtsTest0001 + */ + it('testuiAppearanceALWAYS_LIGHT0001', 0, async function (done) { + console.info('uiAppearanceALWAYS_LIGHT testuiAppearanceALWAYS_LIGHT0001 START'); + await Utils.sleep(2000); + try { + var event = { + eventId: 60309, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testuiAppearanceALWAYS_LIGHT0001 get event data is: " + JSON.stringify(eventData)); + expect(eventData.data.Mode).assertEqual(1); + console.info('testuiAppearanceALWAYS_LIGHT0001 END'); + done(); + } + console.info("testuiAppearanceALWAYS_LIGHT0001 click result is: " + JSON.stringify(sendEventByKey('ALWAYS_LIGHTText', 10, ""))); + events_emitter.on(event, callback); + } catch (err) { + console.info("testuiAppearanceALWAYS_LIGHT0001 on events_emitter err : " + JSON.stringify(err)); + } + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/units.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/units.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c0520d73d0a4ae089cd2c10385bf5856442b84c6 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/units.test.ets @@ -0,0 +1,137 @@ +/** + * 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 unitsModuleNameJsunit() { + describe('unitsModuleNameTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/units', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get units state success " + JSON.stringify(pages)); + if (!("units" == pages.name)) { + console.info("get units state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push units page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push units page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("unitsModuleName after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testunitsModuleName0001 + * @tc.desic aceunitsModuleNameEtsTest0001 + */ + it('testunitsModuleName0001', 0, async function (done) { + console.info('unitsModuleName testunitsModuleName0001 START'); + await Utils.sleep(2000); + try { + console.info("testunitsModuleName0001 click result is: " + JSON.stringify(sendEventByKey('moduleNameText', 10, ""))); + var innerEvent = { + eventId: 60310, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testunitsModuleName0001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.ModuleName).assertEqual(true); + } + events_emitter.on(innerEvent, callback); + } catch (err) { + console.info("testunitsModuleName0001 on click err : " + JSON.stringify(err)); + } + console.info('testunitsModuleName0001 END'); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testunitsGlobalPosition0001 + * @tc.desic aceunitsGlobalPositionEtsTest0001 + */ + it('testunitsGlobalPosition0001', 0, async function (done) { + console.info('unitsModuleName testunitsGlobalPosition0001 START'); + await Utils.sleep(2000); + try { + console.info("testunitsGlobalPosition0001 click result is: " + JSON.stringify(sendEventByKey('globalPositionText', 10, ""))); + var innerEvent = { + eventId: 60311, + priority: events_emitter.EventPriority.LOW + } + var callback = (eventData) => { + console.info("testunitsGlobalPosition0001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.Result).assertEqual(true); + } + events_emitter.on(innerEvent, callback); + } catch (err) { + console.info("testunitsGlobalPosition0001 on click err : " + JSON.stringify(err)); + } + console.info('testunitsGlobalPosition0001 END'); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testunitsMinWidth0001 + * @tc.desic aceunitsMinWidthEtsTest0001 + */ + it('testunitsMinWidth0001', 0, async function (done) { + console.info('unitsModuleName testunitsMinWidth0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minWidthText'); + console.info("[testunitsMinWidth0001] component constraintSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.constraintSize).assertEqual('{"minWidth":"200.00vp","minHeight":"0.00vp","maxWidth":"119846208990821053862485980936868943386622755140025217957449185986963312195176500631099345318391471397553524277795258607297703698567960268420438325781003880454605934667138922450849236563878474354509650486846713237047577973081895276546573889957650195146049445629577007136228474373133005395361920118602782998528.00vp","maxHeight":"0.00vp"}'); + console.info("[testunitsMinWidth0001] constraintSize value :" + obj.$attrs.constraintSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testunitsMinWidth0002 + * @tc.desic aceunitsMinWidthEtsTest0002 + */ + it('testunitsMinWidth0002', 0, async function (done) { + console.info('unitsModuleName testunitsMinWidth0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minWidthText'); + console.info("[testunitsMinWidth0002] component constraintSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + let constraintSize = JSON.parse(obj.$attrs.constraintSize); + console.info("[testunitsMinWidth0002] constraintSize is : " + constraintSize); + expect(obj.$attrs.constraintSize.minWidth).assertEqual(undefined); + console.info("[testunitsMinWidth0002] constraintSize value :" + obj.$attrs.constraintSize); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/web.test.ets b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/web.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7c0517d018842420ec1b59b2ef0b0935e153519e --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/ets/test/web.test.ets @@ -0,0 +1,49 @@ +/** + * 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 webEditTextJsunit() { + describe('webEditTextTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/web', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get web state success " + JSON.stringify(pages)); + if (!("web" == pages.name)) { + console.info("get web state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push web page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push web page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("webEditText after each called"); + }); + + }) +} diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/element/color.json b/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..68f8331ba0fbe3404fe8ab5ede5ecb98a0a76d80 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/element/color.json @@ -0,0 +1,12 @@ +{ + "color": [ + { + "name": "color_hello", + "value": "#ffff0000" + }, + { + "name": "color_world", + "value": "#ff0000ff" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/element/float.json b/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/element/float.json new file mode 100644 index 0000000000000000000000000000000000000000..f26020ff03a653a81ecc6fa8fdef0d9a3b067f96 --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/element/float.json @@ -0,0 +1,12 @@ +{ + "float":[ + { + "name":"font_hello", + "value":"28.0fp" + }, + { + "name":"font_world", + "value":"20.0fp" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/element/string.json b/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..fa13b27d700b87e261e43fda028695c25d7a25ec --- /dev/null +++ b/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/element/string.json @@ -0,0 +1,36 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "MainAbility_label", + "value": "MainAbility_label" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + }, + { + "name":"string_hello", + "value":"Hello" + }, + { + "name":"string_world", + "value":"World" + }, + { + "name":"message_arrive", + "value":"We will arrive at %s." + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/media/icon.png b/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_ets_component_attrlack/entry/src/main/resources/base/media/icon.png differ diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/resources/rawfile/bg3.png b/arkui/ace_ets_component_attrlack/entry/src/main/resources/rawfile/bg3.png new file mode 100644 index 0000000000000000000000000000000000000000..70224e6e8d74391b43b0fc9911900b5cbbeaabb5 Binary files /dev/null and b/arkui/ace_ets_component_attrlack/entry/src/main/resources/rawfile/bg3.png differ diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/resources/rawfile/bg4.png b/arkui/ace_ets_component_attrlack/entry/src/main/resources/rawfile/bg4.png new file mode 100644 index 0000000000000000000000000000000000000000..f7f11a8f4f8296e2532f5a37bafd0d2f39bd2c17 Binary files /dev/null and b/arkui/ace_ets_component_attrlack/entry/src/main/resources/rawfile/bg4.png differ diff --git a/arkui/ace_ets_component_attrlack/entry/src/main/resources/rawfile/test.png b/arkui/ace_ets_component_attrlack/entry/src/main/resources/rawfile/test.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_ets_component_attrlack/entry/src/main/resources/rawfile/test.png differ diff --git a/settingsdata/settings_ets/signature/openharmony_sx.p7b b/arkui/ace_ets_component_attrlack/signature/openharmony_sx.p7b similarity index 100% rename from settingsdata/settings_ets/signature/openharmony_sx.p7b rename to arkui/ace_ets_component_attrlack/signature/openharmony_sx.p7b diff --git a/arkui/ace_ets_component_five/entry/src/main/config.json b/arkui/ace_ets_component_five/entry/src/main/config.json index 14d932c725c6b3aebd760a6827bd68ff4ba79e7c..3954da961d1b1e4c7abfbf7041957d4edbf06fbf 100644 --- a/arkui/ace_ets_component_five/entry/src/main/config.json +++ b/arkui/ace_ets_component_five/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".MyApplication", "mainAbility": "com.open.harmony.acetestfive.MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/arkui/ace_ets_component_four/entry/src/main/config.json b/arkui/ace_ets_component_four/entry/src/main/config.json index ac28b43af5a27e5bcb2431bd9f0c7ac4831ce144..28af5ff4ba0e3a953ab2dacecc91006ec1bc386b 100644 --- a/arkui/ace_ets_component_four/entry/src/main/config.json +++ b/arkui/ace_ets_component_four/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".MyApplication", "mainAbility": "com.open.harmony.acetestfour.MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/arkui/ace_ets_component_three/entry/src/main/config.json b/arkui/ace_ets_component_three/entry/src/main/config.json index cf734e2e6d4bcf57a891de23af0d67db9c8eef96..14b317c2764790c676c1b57a5ae7b714836898a5 100644 --- a/arkui/ace_ets_component_three/entry/src/main/config.json +++ b/arkui/ace_ets_component_three/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".MyApplication", "mainAbility": "com.open.harmony.acetestthree.MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/PanGesture.ets b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/PanGesture.ets index fd9cf5e7a0c01c6497d814b02ec10b320101babf..9b90447d108899dbbdbab09bc2fa401f7ed669ab 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/PanGesture.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/MainAbility/pages/PanGesture.ets @@ -22,15 +22,6 @@ struct PanGestureExample { @State offsetY: number = 0 @State touchable: boolean = true; @State isTouched: boolean = false; - - onPageShow() { - let ChangeEvent = { - eventId: 23, - priority: events_emitter.EventPriority.LOW - } - events_emitter.on(ChangeEvent, this.ChangCallBack) - } - private ChangCallBack = (eventData) => { console.info("[PanGesture] ChangCallBack stateChangCallBack"); if (eventData != null) { @@ -41,6 +32,14 @@ struct PanGestureExample { } } + onPageShow() { + var ChangeEvent = { + eventId: 23, + priority: events_emitter.EventPriority.LOW + } + events_emitter.on(ChangeEvent, this.ChangCallBack) + } + build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { Text('PanGesture offset:\nX: ' + this.offsetX + '\n' + 'Y: ' + this.offsetY) @@ -54,8 +53,8 @@ struct PanGestureExample { .translate({ x: this.offsetX, y: this.offsetY, z: 5 }) .touchable(this.touchable) .gesture( - PanGesture({ fingers: 1, direction: PanDirection.All, distance: 1 }) - .onActionStart((event: PanGestureEvent) => { + PanGesture({ fingers: 1, direction: PanDirection.All, distance: 1 }) + .onActionStart((event: GestureEvent) => { console.info('Pan start') console.log('PanGesture globalX' + event.globalX); console.log('PanGesture globalY' + event.globalY); @@ -67,14 +66,15 @@ struct PanGestureExample { console.log('PanGesture pinchCenterX' + event.pinchCenterX); console.log('PanGesture pinchCenterY' + event.pinchCenterY); }) - .onActionUpdate((event: PanGestureEvent) => { + .onActionUpdate((event: GestureEvent) => { this.offsetX = event.offsetX this.offsetY = event.offsetY }) .onActionEnd(() => { console.info('Pan end') }) - .onTouch((event: TouchEvent) => { + ) + .onTouch((event: TouchEvent) => { console.log('[PanGesture] TouchType start'); this.isTouched = true if (event.type === TouchType.Down) { @@ -104,7 +104,5 @@ struct PanGestureExample { console.info("[PanGesture] emit action state err: " + JSON.stringify(err.message)) } }) - ) } -} - +} \ No newline at end of file diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/QrCodeJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/QrCodeJsunit.test.ets index 336dd90934bb6c4bd085995c2aa9d6a49eee956e..ef88dc7c4993bffcfeef60bcf2160aeb08871c32 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/QrCodeJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/QrCodeJsunit.test.ets @@ -157,7 +157,7 @@ export default function qrCodeJsunit() { var strJson = getInspectorByKey('QrCodeColor'); var obj = JSON.parse(strJson); console.info("[test_qrCode_005] component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.color).assertEqual('#0000014C'); + expect(obj.$attrs.color).assertEqual('#FF00014C'); done(); }); @@ -209,7 +209,7 @@ export default function qrCodeJsunit() { var strJson = getInspectorByKey('QrCodeColor'); var obj = JSON.parse(strJson); console.info("[test_qrCode_007] component obj is: " + JSON.stringify(obj)); - expect(obj.$attrs.backgroundColor).assertEqual('#0000014D'); + expect(obj.$attrs.backgroundColor).assertEqual('#FF00014D'); done(); }); }) diff --git a/arkui/ace_ets_component_three/entry/src/main/ets/test/TextJsunit.test.ets b/arkui/ace_ets_component_three/entry/src/main/ets/test/TextJsunit.test.ets index 3cf16855f857a0583b765e21ca70e6b25d4d5452..e14423e4dbc3e0979f53a327d88f092fd5e4c3c8 100644 --- a/arkui/ace_ets_component_three/entry/src/main/ets/test/TextJsunit.test.ets +++ b/arkui/ace_ets_component_three/entry/src/main/ets/test/TextJsunit.test.ets @@ -270,7 +270,7 @@ export default function textJsunit() { let strJsonNew = getInspectorByKey('text'); let objNew = JSON.parse(strJsonNew); console.info("testText_1200 component objNew is: " + JSON.stringify(objNew.$attrs.fontColor)); - expect(objNew.$attrs.fontColor).assertEqual('#00BC0229'); + expect(objNew.$attrs.fontColor).assertEqual('#FFBC0229'); console.info('testText_1200 END'); done(); }); diff --git a/arkui/ace_ets_component_two/entry/src/main/config.json b/arkui/ace_ets_component_two/entry/src/main/config.json index 8ea5ff43f45814bedba5243eec89260924a348f0..869c8c29a405a3ef23574cff781fb41b2ccf93b9 100644 --- a/arkui/ace_ets_component_two/entry/src/main/config.json +++ b/arkui/ace_ets_component_two/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".MyApplication", "mainAbility": "com.open.harmony.acetesttwo.MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/arkui/ace_ets_dev/entry/src/main/config.json b/arkui/ace_ets_dev/entry/src/main/config.json index d565956d1832f48419686c631cc0cfe304a05c6d..21582c4258229f6528e2fc09dab8a696093d7a3e 100644 --- a/arkui/ace_ets_dev/entry/src/main/config.json +++ b/arkui/ace_ets_dev/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".MyApplication", "mainAbility": "com.open.harmony.acedevtest.MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/arkui/ace_ets_standard/entry/src/main/config.json b/arkui/ace_ets_standard/entry/src/main/config.json index 72ae2b9d5578fefc3e009d0269f64f20f459c680..260a7a4b87d4aa222d48b55662a6ff5e3d3b19af 100644 --- a/arkui/ace_ets_standard/entry/src/main/config.json +++ b/arkui/ace_ets_standard/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/arkui/ace_ets_standard/entry/src/main/ets/MainAbility/pages/Slider.ets b/arkui/ace_ets_standard/entry/src/main/ets/MainAbility/pages/Slider.ets index e77b544588c45f1fe989c7915c7c26c231b8dddb..ec1cf29ecf99a626ef5d9cc4fd53d9f7ff7123d0 100644 --- a/arkui/ace_ets_standard/entry/src/main/ets/MainAbility/pages/Slider.ets +++ b/arkui/ace_ets_standard/entry/src/main/ets/MainAbility/pages/Slider.ets @@ -46,8 +46,8 @@ struct slider { .blockColor('#FFFF0000') .selectedColor('#FF0000FF') .trackColor('#FF808080') - .minLabel('10') - .maxLabel('10') + .minLabel('0') + .maxLabel('100') .showTips(false) .showSteps(false) .onChange((value: number, mode: SliderChangeMode) => { diff --git a/arkui/ace_ets_test/entry/src/main/config.json b/arkui/ace_ets_test/entry/src/main/config.json index 7e3aea13e6404d8a8a1cb615145ae6affd4558fe..469f7bd2e705e8a276d78b32af3fa383e6afbb5b 100644 --- a/arkui/ace_ets_test/entry/src/main/config.json +++ b/arkui/ace_ets_test/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/arkui/ace_ets_third_test/entry/src/main/config.json b/arkui/ace_ets_third_test/entry/src/main/config.json index 9a996c6d9ccae55fdfe77ff5dd3f6fbedadbbec1..d9d11fe20cfa8d9df8058d3ee19615a7f5fd7ea0 100644 --- a/arkui/ace_ets_third_test/entry/src/main/config.json +++ b/arkui/ace_ets_third_test/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/arkui/ace_ets_webView/entry/src/main/config.json b/arkui/ace_ets_webView/entry/src/main/config.json index 12de22e4640f4384c34a0d9232ad44cb115c1422..6ea45d4d29984b702420d2fe5f6a6e2af4e662b5 100644 --- a/arkui/ace_ets_webView/entry/src/main/config.json +++ b/arkui/ace_ets_webView/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".MyApplication", "mainAbility": "com.open.harmony.webview.MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/arkui/ace_ets_web_dev/Test.json b/arkui/ace_ets_web_dev/Test.json index 5fbc03fba6a37e051a5413c50ad272d495d96ef7..9d98d84a5c0e57a6d257a72714dc6f42683a970e 100644 --- a/arkui/ace_ets_web_dev/Test.json +++ b/arkui/ace_ets_web_dev/Test.json @@ -14,5 +14,13 @@ ], "type": "AppInstallKit", "cleanup-apps": true - }] + }, + { + "type": "ShellKit", + "run-command": [ + "power-shell wakeup", + "power-shell setmode 602" + ] + } + ] } \ No newline at end of file diff --git a/arkui/ace_ets_web_dev/entry/src/main/ets/MainAbility/pages/web.ets b/arkui/ace_ets_web_dev/entry/src/main/ets/MainAbility/pages/web.ets index 2aaab4a36b71117b15abffc0e209840d4695325f..b8b08f00fbfe8a816817bd329030efb54253b39d 100644 --- a/arkui/ace_ets_web_dev/entry/src/main/ets/MainAbility/pages/web.ets +++ b/arkui/ace_ets_web_dev/entry/src/main/ets/MainAbility/pages/web.ets @@ -27,6 +27,34 @@ struct Index { @State loadedResource:string="" @State progress:string="" @State newUrl:string="" + @State pageBegin:string="" + @State pageEnd:string="" + @State console:string="" + @State confirm:string="" + @State alert:string="" + @State errorReceive:string="" + @State httpErrorReceive:number=0 + @State titleReceive:string="" + @State downloadStart:string="" + @State javaScriptAccess:boolean=true + @State fileAccess:boolean=true + @State domStorageAccess:boolean=false + @State imageAccess:boolean=true + @State geolocationAccess:boolean=true + @State onlineImageAccess:boolean=true + @State databaseAccess:boolean=true + @State overviewModeAccess:boolean=false + @State initialScale:number=100 + @State enterPageEnd:boolean=false + @State newScale:number=0 + @State scaleChange:boolean=false + @State geoShow:boolean=false + @State mixedMode:MixedMode=MixedMode.All + @State cacheMode:CacheMode=CacheMode.Default + @State cacheError:boolean=false + @State mixedSwitch:boolean=false + @State mixedAllSwitch:boolean=false + @State overViewFalseHeight:number=0 onPageShow(){ let valueChangeEvent={ eventId:10, @@ -49,6 +77,10 @@ struct Index { }, toString:(str)=>{ console.info("ets toString:"+String(str)); + }, + register:(res)=>{ + Utils.emitEvent(res,86); + return "web222" } } aboutToAppear(){ @@ -62,6 +94,17 @@ struct Index { build(){ Column(){ Web({src:$rawfile('index.html'),controller:this.controller}) + .javaScriptAccess(this.javaScriptAccess) + .fileAccess(this.fileAccess) + .imageAccess(this.imageAccess) + .domStorageAccess(this.domStorageAccess) + .geolocationAccess(this.geolocationAccess) + .onlineImageAccess(this.onlineImageAccess) + .databaseAccess(this.databaseAccess) + .cacheMode(this.cacheMode) + .initialScale(this.initialScale) + .mixedMode(this.mixedMode) + .overviewModeAccess(this.overviewModeAccess) .userAgent("Mozila/5.0 (Linux; Andriod 9; VRD-AL10; HMSCore 6.3.0.331) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.105 HuaweiBrowser/12.0.4.1 MobileSafari/537.36") .javaScriptProxy({ object:this.jsObj, @@ -93,8 +136,100 @@ struct Index { .onFocus(()=>{ Utils.emitEvent("requestFocus",126) }) + .onPageBegin((event) => { + this.pageBegin = event.url + }) + .onPageEnd((event) => { + this.pageEnd = event.url + console.log("onPageEnd==>") + if(this.enterPageEnd){ + Utils.emitEvent(this.newScale,97) + this.enterPageEnd=false + } + }) + .onConsole((event) => { + this.console = event.message.getMessage() + let level=event.message.getMessageLevel() + let msg=event.message.getMessage() + console.log("html==>"+msg) + if(this.mixedSwitch){ + Utils.emitEvent(msg,186) + this.mixedSwitch=false + }else if(this.mixedAllSwitch){ + Utils.emitEvent(level,188) + this.mixedAllSwitch=false + } + return false + }) + .onAlert((event) => { + this.alert = event.message + return false + }) + .onConfirm((event) => { + this.confirm = event.message + return false + }) + .onErrorReceive((event) => { + this.errorReceive = event.request.getRequestUrl() + console.log("onErrorReceive==>") + if(this.cacheError){ + Utils.emitEvent("cacheError",182) + this.cacheError=false + } + }) + .onHttpErrorReceive((event) => { + this.httpErrorReceive = event.response.getResponseCode() + }) + .onTitleReceive((event) => { + this.titleReceive = event.title + }) + .onDownloadStart((event) => { + this.downloadStart = event.url + }) + .onScaleChange((event)=>{ + console.log("onScaleChange==>") + this.newScale=event.newScale + if(this.scaleChange){ + Utils.emitEvent("onScaleChange",98) + this.scaleChange=false + } + }) + .onPrompt((event)=>{ + event.result.handlePromptConfirm("onPrompt ok") + Utils.emitEvent(event.message,178) + return true + }) + .onGeolocationShow(()=>{ + console.log("onGeolocationShow==>") + if(this.geoShow){ + Utils.emitEvent("onGeolocationShow",99) + this.geoShow=false + } + }) + .onBlur(()=>{ + console.info("onBlur==>") + this.controller.requestFocus() + }) + TextInput({placeholder:"inputs your words"}) + .key('textInput') + .type(InputType.Normal) + .placeholderColor(Color.Blue) + .placeholderFont({size:20,weight:FontWeight.Normal,family:"sans-serif",style:FontStyle.Normal}) + .enterKeyType(EnterKeyType.Next) + .caretColor(Color.Green) + .height(60) + .fontSize(30) + .fontWeight(FontWeight.Bold) + .fontFamily("cursive") + .fontStyle(FontStyle.Italic) + .fontColor(Color.Red) + .maxLength(20) + .border({width:1,color:0x317AF7,radius:10,style:BorderStyle.Solid}) + .onClick(()=>{ + console.info("TextInput click") + }) Row(){ - Button("web click").key('webcomponent').onClick(()=>{ + Button("web click").key('webcomponent').onClick(async ()=>{ console.info("key==>"+this.str) switch(this.str){ case "emitUserAgent":{ @@ -179,7 +314,7 @@ struct Index { let webPageHeight=this.controller.getPageHeight()+"" setTimeout(()=>{ this.controller.runJavaScript({script:"getPageHeight()",callback:(res)=>{ - console.info("getPageHeight==>"+res) + console.info("getPageHeight==>"+res) Utils.emitEventTwo(res,webPageHeight,124) }}) },3000) @@ -187,7 +322,8 @@ struct Index { } case "emitGetRequestFocus":{ this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/second.html"}) - this.controller.requestFocus() + await Utils.sleep(2000) + sendEventByKey('textInput',10,'') break; } case "emitAccessBackward":{ @@ -229,6 +365,404 @@ struct Index { },3000) break; } + case "emitGeolocationAccessFalse":{ + this.geolocationAccess=false + await Utils.sleep(2000) + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/geo.html"}) + setTimeout(()=>{ + this.controller.runJavaScript({script:"getGeoResult()",callback:(res)=>{ + console.info("getGeoResult==>"+res) + Utils.emitEvent(res,96) + }}) + },3000) + break; + } + case "emitInitialScale":{ + this.initialScale=120 + await Utils.sleep(1000) + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/second.html"}) + this.enterPageEnd=true + break; + } + case "emitOnscaleChange":{ + this.initialScale=110 + this.scaleChange=true + await Utils.sleep(2000) + this.controller.loadUrl({url:"https://gitee.com/"}) + break; + } + case "emitOnGeolocationShow":{ + this.geolocationAccess=true + this.geoShow=true + await Utils.sleep(2000) + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/geo.html"}) + break; + } + case "emitDomStorageAccessFalse":{ + this.domStorageAccess=false + await Utils.sleep(2000) + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/domApi.html"}) + setTimeout(()=>{ + this.controller.runJavaScript({script:"getDomResult()",callback:(res)=>{ + console.info("getDomResult==>"+res) + Utils.emitEvent(res,144) + }}) + },3000) + break; + } + case "emitDomStorageAccessTrue":{ + this.domStorageAccess=true + await Utils.sleep(2000) + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/domApi.html"}) + setTimeout(()=>{ + this.controller.runJavaScript({script:"getDomResult()",callback:(res)=>{ + console.info("getDomResult==>"+res) + Utils.emitEvent(res,146) + }}) + },3000) + break; + } + case "emitImageAccessFalse":{ + this.imageAccess=false + await Utils.sleep(1000) + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"}) + setTimeout(()=>{ + this.controller.runJavaScript({script:"getImgResult()",callback:(res)=>{ + console.info("getImgResult==>"+res) + Utils.emitEvent(res,148) + }}) + },3000) + break; + } + case "emitImageAccessTrue":{ + this.imageAccess=true + await Utils.sleep(1000) + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"}) + setTimeout(()=>{ + this.controller.runJavaScript({script:"getImgResult()",callback:(res)=>{ + console.info("getImgResult==>"+res) + Utils.emitEvent(res,150) + }}) + },3000) + break; + } + case "emitOnlineImageAccessFalse":{ + this.onlineImageAccess=false + await Utils.sleep(1000) + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/onlineImageAccess.html"}) + setTimeout(()=>{ + this.controller.runJavaScript({script:"getImageLoadResult()",callback:(res)=>{ + console.info("getImageLoadResult==>"+res) + Utils.emitEvent(res,156) + }}) + },3000) + break; + } + case "emitOnlineImageAccessTrue":{ + this.onlineImageAccess=true + await Utils.sleep(1000) + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/onlineImageAccess.html"}) + setTimeout(()=>{ + this.controller.runJavaScript({script:"getImageLoadResult()",callback:(res)=>{ + console.info("getImageLoadResult==>"+res) + Utils.emitEvent(res,158) + }}) + },3000) + break; + } + case "emitDatabaseAccessTrue":{ + this.databaseAccess=true + await Utils.sleep(2000) + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/databaseAccess.html"}) + setTimeout(()=>{ + this.controller.runJavaScript({script:"getDataResult()",callback:(res)=>{ + console.info("getDataResult==>"+res) + Utils.emitEvent(res,164) + }}) + },3000) + break; + } + case "emitOverviewModeAccessFalse":{ + this.overviewModeAccess=false + await Utils.sleep(1000) + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/overview.html"}) + setTimeout(()=>{ + let webPageHeight=this.controller.getPageHeight() + this.controller.runJavaScript({script:"getViewResult()",callback:(res)=>{ + this.overViewFalseHeight=parseInt(res) + console.info("getViewResult==>"+res) + Utils.emitEventTwo(webPageHeight,res,168) + }}) + },3000) + break; + } + case "emitOverviewModeAccessTrue":{ + this.overviewModeAccess=true + await Utils.sleep(1000) + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/overview.html"}) + setTimeout(()=>{ + this.controller.runJavaScript({script:"getViewResult()",callback:(res)=>{ + console.info("getViewResult==>"+res) + Utils.emitEventTwo(this.overViewFalseHeight,parseInt(res),170) + }}) + },3000) + break; + } + case "emitOnPrompt":{ + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"}) + setTimeout(()=>{ + this.controller.runJavaScript({script:"toPrompt()"}) + },3000) + break; + } + case "emitCacheModeOnly":{ + this.cacheError=true + this.cacheMode=CacheMode.Only + await Utils.sleep(2000) + this.controller.loadUrl({url:"https://www.openharmony.cn/mainPlay"}) + break; + } + case "emitCacheModeDefault":{ + this.cacheMode=CacheMode.Default + await Utils.sleep(2000) + this.controller.loadUrl({url:"https://www.openharmony.cn/mainPlay"}) + setTimeout(()=>{ + let webTitle=this.controller.getTitle() + Utils.emitEvent(webTitle,184) + },3000) + break; + } + case "emitMixedModeNone":{ + this.mixedSwitch=true + this.mixedMode=MixedMode.None + await Utils.sleep(2000) + this.controller.loadUrl({url:"https://www.openharmony.cn/mainPlay"}) + break; + } + case "emitMixedModeAll":{ + this.mixedAllSwitch=true + this.mixedMode=MixedMode.All + await Utils.sleep(2000) + this.controller.loadUrl({url:"https://www.openharmony.cn/mainPlay"}) + break; + } + case "emitFileAccessTrue":{ + this.fileAccess=true + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"}) + this.controller.runJavaScript({script:"openRawFile()"}) + setTimeout(()=>{ + let webTitle=this.controller.getTitle() + Utils.emitEvent(webTitle,190) + },3000) + break; + } + case "emitOnPageBegin":{ + Utils.emitEvent(this.pageBegin,59) + break; + } + case "emitOnPageEnd":{ + Utils.emitEvent(this.pageBegin,60) + break; + } + case "emitOnConsole":{ + this.controller.runJavaScript({script:"consoleTest()"}) + setTimeout(()=>{ + Utils.emitEvent(this.console,62) + },3000) + break; + } + case "emitOnAlert":{ + this.controller.runJavaScript({script:"alertTest()"}) + setTimeout(()=>{ + Utils.emitEvent(this.alert,63) + },3000) + break; + } + case "emitOnConfirm":{ + this.controller.runJavaScript({script:"confirmTest()"}) + setTimeout(()=>{ + Utils.emitEvent(this.confirm,64) + },3000) + break; + } + case "emitOnErrorReceive":{ + this.controller.loadUrl({url:'http://192.168.5.40:9006/sso_web/html/H5/doctor/aboutUs.html'}) + setTimeout(()=>{ + this.controller.loadUrl({url:'http://192.168.5.40:9006/sso_web/html/H5/doctor/aboutUs.html'}) + setTimeout(() => { + Utils.emitEvent(this.errorReceive,65) + },3000) + },3000) + break; + } + case "emitOnHttpErrorReceive":{ + this.controller.loadUrl({url:'https://example1.com/path/does/not/exist/index.jsp'}) + setTimeout(()=>{ + this.controller.loadUrl({url:'https://example1.com/path/does/not/exist/index.jsp'}) + setTimeout(()=>{ + Utils.emitEvent(this.httpErrorReceive,66) + },3000) + },3000) + break; + } + case "emitOnTitleReceive":{ + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"}) + setTimeout(()=>{ + Utils.emitEvent(this.titleReceive,67) + },3000) + break; + } + case "emitOnDownloadStart":{ + this.controller.loadUrl({url:"https://consumer.huawei.com/content/dam/huawei-cbg-site/cn/mkt/mobileservices/2022/download/PC107f1b3947c942ffaa14334a879065d8.2107261020.exe"}) + setTimeout(()=>{ + Utils.emitEvent(this.downloadStart,68) + },5000) + break; + } + case "emitSetCookie":{ + this.controller.getCookieManager().setCookie('http://www.baidu.com','e=f') + setTimeout(()=>{ + let setCookieCalled = this.controller.getCookieManager().getCookie('http://www.baidu.com') + Utils.emitEvent(setCookieCalled,76) + },3000) + break; + } + case "emitGetCookie":{ + this.controller.getCookieManager().setCookie('https://www.bilibili.com/','e=f') + setTimeout(()=>{ + let getCookieCalled = this.controller.getCookieManager().getCookie('https://www.bilibili.com/') + Utils.emitEvent(getCookieCalled,69) + },3000) + break; + } + case "emitZoom":{ + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"}) + setTimeout(()=>{ + this.controller.zoom(2) + setTimeout(() => { + if(this.controller.getPageHeight() > 1400){ + var zoomCalled = true + } + Utils.emitEvent(zoomCalled,77) + },3000) + },5000) + break; + } + case "emitZoomOut":{ + this.controller.zoomOut() + setTimeout(()=>{ + if(this.controller.getPageHeight() < 1500){ + var zoomOutCalled = true + } + Utils.emitEvent(zoomOutCalled,78) + },3000) + break; + } + case "emitZoomIn":{ + this.controller.zoomIn() + setTimeout(()=>{ + var zoomInCalled = false + if(this.controller.getPageHeight() > 1400){ + zoomInCalled = true + } + Utils.emitEvent(zoomInCalled,79) + },3000) + break; + } + case "emitDeleteEntireCookie":{ + this.controller.getCookieManager().deleteEntireCookie() + setTimeout(()=>{ + let deleteEntireCookieCalled = this.controller.getCookieManager().getCookie('http://www.baidu.com') + Utils.emitEvent(deleteEntireCookieCalled,80) + },3000) + break; + } + case "emitSaveCookieSync":{ + let saveCookieSyncCalled = this.controller.getCookieManager().saveCookieSync() + Utils.emitEvent(saveCookieSyncCalled,81) + break; + } + case "emitClearHistory":{ + this.controller.loadUrl({url:"http://www.baidu.com/"}) + setTimeout(()=>{ + this.controller.clearHistory() + setTimeout(() => { + let clearHistoryCalled = this.controller.accessBackward() + Utils.emitEvent(clearHistoryCalled,82) + },5000) + },10000) + break; + } + case "emitStop":{ + this.controller.loadUrl({url:"http://appgallery.huawei.com/"}) + this.controller.stop() + setTimeout(()=>{ + var stopCalled = false + if(this.pageEnd !== 'http://appgallery.huawei.com/'){ + stopCalled = true + } + Utils.emitEvent(stopCalled,83) + },3000) + break; + } + case "emitOnInactive":{ + this.controller.onInactive() + this.controller.zoomOut() + setTimeout(()=>{ + var onInactiveCalled = false + if(this.controller.getPageHeight() < 2600){ + onInactiveCalled = true + } + Utils.emitEvent(onInactiveCalled,84) + },3000) + break; + } + case "emitOnActive":{ + this.controller.onActive() + this.controller.loadUrl({url:"file:///data/storage/el1/bundle/phone/resources/rawfile/index.html"}) + setTimeout(()=>{ + let onActiveCalled = this.pageBegin + Utils.emitEvent(onActiveCalled,85) + },5000) + break; + } + case "emitRegisterJavaScriptProxy":{ + this.controller.registerJavaScriptProxy({object:this.jsObj,name:"objName",methodList:["test","toString","register"]}) + this.controller.refresh() + setTimeout(()=>{ + this.controller.runJavaScript({script:"proxy()"}) + },3000) + break; + } + case "emitDeleteJavaScriptRegister":{ + this.controller.deleteJavaScriptRegister("objName") + this.controller.runJavaScript({script:"registerTest()"}) + setTimeout(()=>{ + if(this.console !== "web222"){ + let deleteEntireCookieCalled = true + Utils.emitEvent(deleteEntireCookieCalled,87) + } + },3000) + break; + } + case "emitJavaScriptAccess":{ + this.javaScriptAccess = false + setTimeout(() => { + this.controller.runJavaScript({script:"jsAccess()"}) + setTimeout(()=>{ + if(this.console !== "web111"){ + let javaScriptAccessCalled = true + Utils.emitEvent(javaScriptAccessCalled,88) + } + },3000) + },3000) + break; + } + case "emitGetCookieManager":{ + let getCookieManagerCalled = this.controller.getCookieManager().setCookie("https://weibo.com","a=b") + Utils.emitEvent(getCookieManagerCalled,89) + break; + } default: console.info("can not match case") } diff --git a/arkui/ace_ets_web_dev/entry/src/main/ets/test/Utils.ets b/arkui/ace_ets_web_dev/entry/src/main/ets/test/Utils.ets index a53550f58088aa1d9b042b4595c06d7c7c1531a4..d8e0944a8887fe72e3e02cc31b9750c7d24feeda 100644 --- a/arkui/ace_ets_web_dev/entry/src/main/ets/test/Utils.ets +++ b/arkui/ace_ets_web_dev/entry/src/main/ets/test/Utils.ets @@ -115,4 +115,39 @@ export default class Utils { 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)); + } + } + static registerLargerEvent(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); + 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)); + } + } } diff --git a/arkui/ace_ets_web_dev/entry/src/main/ets/test/WebJsunit.test.ets b/arkui/ace_ets_web_dev/entry/src/main/ets/test/WebJsunit.test.ets index 9aba47efef75a44e17f7f8cdc6a2850ef47bc821..17ca26638ef2e8332d438c6591de32427ffd6082 100644 --- a/arkui/ace_ets_web_dev/entry/src/main/ets/test/WebJsunit.test.ets +++ b/arkui/ace_ets_web_dev/entry/src/main/ets/test/WebJsunit.test.ets @@ -79,6 +79,7 @@ export default function webJsunit() { *tc.desic Triggered when the render process exits */ it('onRenderExited',0,async function(done){ + Utils.commitKey("emitOnRenderExited") emitKey="emitOnResourceLoad"; Utils.registerEvent("onRenderExited",2,106,done); sendEventByKey('webcomponent',10,''); @@ -237,9 +238,439 @@ export default function webJsunit() { *tc.desic Goes forward or back backOrForward in the history of the web page */ it('backOrForward',0,async function(done){ - emitKey="emitBackOrForward"; + emitKey="emitGeolocationAccessFalse"; Utils.registerEvent("backOrForward","index",138,done); sendEventByKey('webcomponent',10,''); }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_021 + *tc.name geolocationAccessFalse + *tc.desic Sets false not allow access to geographical locations + */ + it('geolocationAccessFalse',0,async function(done){ + emitKey="emitInitialScale"; + Utils.registerContainEvent("geolocationAccessFalse","位置服务被拒绝",96,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_022 + *tc.name initialScale + *tc.desic Sets the initial scale for the Web + */ + it('initialScale',0,async function(done){ + emitKey="emitOnscaleChange"; + Utils.registerEvent("initialScale",120,97,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_023 + *tc.name onScaleChange + *tc.desic Triggered when the scale of WebView changed + */ + it('onScaleChange',0,async function(done){ + emitKey="emitOnGeolocationShow"; + Utils.registerContainEvent("onScaleChange","onScaleChange",98,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_024 + *tc.name onGeolocationShow + *tc.desic Triggered when requesting to show the geolocation permission + */ + it('onGeolocationShow',0,async function(done){ + emitKey="emitDomStorageAccessFalse"; + Utils.registerContainEvent("onGeolocationShow","onGeolocationShow",99,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_025 + *tc.name domStorageAccessFalse + *tc.desic Sets not to enable the DOM Storage API permission + */ + it('domStorageAccessFalse',0,async function(done){ + emitKey="emitDomStorageAccessTrue"; + Utils.registerContainEvent("domStorageAccessFalse","sorry",144,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_026 + *tc.name domStorageAccessTrue + *tc.desic Sets enable the DOM Storage API permission + */ + it('domStorageAccessTrue',0,async function(done){ + emitKey="emitImageAccessFalse"; + Utils.registerContainEvent("domStorageAccessTrue","domapi",146,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_027 + *tc.name imageAccessFalse + *tc.desic Sets Web can not automatically load image resources + */ + it('imageAccessFalse',0,async function(done){ + emitKey="emitImageAccessTrue"; + Utils.registerEvent("imageAccessFalse","null",148,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_028 + *tc.name imageAccessTrue + *tc.desic Sets Web can automatically load image resources + */ + it('imageAccessTrue',0,async function(done){ + emitKey="emitOnlineImageAccessFalse"; + Utils.registerContainEvent("imageAccessTrue","load complete",150,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_029 + *tc.name onlineImageAccessFalse + *tc.desic Sets not to allow image resources to be loaded from the network + */ + it('onlineImageAccessFalse',0,async function(done){ + emitKey="emitOnlineImageAccessTrue"; + Utils.registerEvent("onlineImageAccessFalse","null",156,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_030 + *tc.name onlineImageAccessTrue + *tc.desic Sets allow image resources to be loaded from the network + */ + it('onlineImageAccessTrue',0,async function(done){ + emitKey="emitDatabaseAccessTrue"; + Utils.registerContainEvent("onlineImageAccessTrue","load image complete",158,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_031 + *tc.name databaseAccessTrue + *tc.desic Sets allow the Web access the database + */ + it('databaseAccessTrue',0,async function(done){ + emitKey="emitOverviewModeAccessFalse"; + Utils.registerContainEvent("databaseAccessTrue","openDatabase",164,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_032 + *tc.name overviewModeAccessFalse + *tc.desic Sets not allow the Web access overview mode + */ + it('overviewModeAccessFalse',0,async function(done){ + emitKey="emitOverviewModeAccessTrue"; + Utils.registerEventTwo("overviewModeAccessFalse",168,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_033 + *tc.name overviewModeAccessTrue + *tc.desic Sets allow the Web access overview mode + */ + it('overviewModeAccessTrue',0,async function(done){ + emitKey="emitOnPrompt"; + Utils.registerLargerEvent("overviewModeAccessTrue",170,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_034 + *tc.name onPrompt + *tc.desic Triggered when the web page wants to display a JavaScript prompt() dialog + */ + it('onPrompt',0,async function(done){ + emitKey="emitCacheModeOnly"; + Utils.registerEvent("onPrompt","age",178,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_035 + *tc.name cacheModeOnly + *tc.desic load cache and not online + */ + it('cacheModeOnly',0,async function(done){ + emitKey="emitCacheModeDefault"; + Utils.registerEvent("cacheModeOnly","cacheError",182,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_036 + *tc.name cacheModeDefault + *tc.desic load cache when they are available and not expired, otherwise load online + */ + it('cacheModeDefault',0,async function(done){ + emitKey="emitMixedModeNone"; + Utils.registerContainEvent("cacheModeDefault","OpenHarmony",184,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_037 + *tc.name mixedModeNone + *tc.desic Sets Don't allow unsecure sources from a secure origin + */ + it('mixedModeNone',0,async function(done){ + emitKey="emitMixedModeAll"; + Utils.registerContainEvent("mixedModeNone","insecure",186,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_038 + *tc.name mixedModeAll + *tc.desic Sets Allows all HTTP and HTTPS content can be loaded + */ + it('mixedModeAll',0,async function(done){ + emitKey="emitFileAccessTrue"; + Utils.registerEvent("mixedModeAll",3,188,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_039 + *tc.name fileAccessTrue + *tc.desic Sets enable local file system access in Web + */ + it('fileAccessTrue',0,async function(done){ + emitKey="emitOnPageBegin"; + Utils.registerContainEvent("fileAccessTrue","index",190,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_040 + *tc.name onPageBegin + *tc.desic Triggered when the page loading progress changes + */ + it('onPageBegin',0,async function(done){ + emitKey="emitOnPageEnd"; + Utils.registerEvent("onPageBegin","file:///data/storage/el1/bundle/phone/resources/rawfile/index.html",59,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_041 + *tc.name onPageEnd + *tc.desic Triggered at the begin of web page loading + */ + it('onPageEnd',0,async function(done){ + emitKey="emitOnConsole"; + Utils.registerEvent("onPageEnd","file:///data/storage/el1/bundle/phone/resources/rawfile/index.html",60,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_042 + *tc.name onConsole + *tc.desic Triggered when the web page receives a JavaScript console message + */ + it('onConsole',0,async function(done){ + emitKey="emitOnAlert"; + Utils.registerEvent("onConsole","console test",62,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_043 + *tc.name onAlert + *tc.desic Triggered when the Web wants to display a JavaScript alert() dialog + */ + it('onAlert',0,async function(done){ + emitKey="emitOnConfirm"; + Utils.registerEvent("onAlert","alert test",63,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_044 + *tc.name onConfirm + *tc.desic Triggered when the web page wants to display a JavaScript confirm() dialog + */ + it('onConfirm',0,async function(done){ + emitKey="emitOnErrorReceive"; + Utils.registerEvent("onConfirm","confirm test",64,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_045 + *tc.name onErrorReceive + *tc.desic Triggered when the web page receives a web resource loading error + */ + it('onErrorReceive',0,async function(done){ + emitKey="emitOnHttpErrorReceive"; + Utils.registerEvent("onErrorReceive","http://192.168.5.40:9006/sso_web/html/H5/doctor/aboutUs.html",65,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_046 + *tc.name onHttpErrorReceive + *tc.desic Triggered when the web page receives a web resource loading HTTP error + */ + it('onHttpErrorReceive',0,async function(done){ + emitKey="emitOnTitleReceive"; + Utils.registerEvent("onHttpErrorReceive",404,66,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_047 + *tc.name onTitleReceive + *tc.desic Triggered when the title of the main application document changes + */ + it('onTitleReceive',0,async function(done){ + emitKey="emitOnDownloadStart"; + Utils.registerEvent("onTitleReceive","index",67,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_048 + *tc.name onDownloadStart + *tc.desic Triggered when starting to download + */ + it('onDownloadStart',0,async function(done){ + emitKey="emitSetCookie"; + Utils.registerEvent("onDownloadStart","https://consumer.huawei.com/content/dam/huawei-cbg-site/cn/mkt/mobileservices/2022/download/PC107f1b3947c942ffaa14334a879065d8.2107261020.exe",68,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_049 + *tc.name setCookie + *tc.desic Sets the cookie + */ + it('setCookie',0,async function(done){ + emitKey="emitGetCookie"; + Utils.registerEvent("setCookie","e=f",76,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_050 + *tc.name getCookie + *tc.desic Gets all cookies for the given URL + */ + it('getCookie',0,async function(done){ + emitKey="emitZoom"; + Utils.registerEvent("getCookie","e=f",69,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_051 + *tc.name zoom + *tc.desic Let the Web zoom by + */ + it('zoom',0,async function(done){ + emitKey="emitZoomOut"; + Utils.registerEvent("zoom",true,77,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_052 + *tc.name zoomOut + *tc.desic Let the Web zoom out + */ + it('zoomOut',0,async function(done){ + emitKey="emitZoomIn"; + Utils.registerEvent("zoomOut",true,78,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_053 + *tc.name zoomIn + *tc.desic Let the Web zoom in + */ + it('zoomIn',0,async function(done){ + emitKey="emitDeleteEntireCookie"; + Utils.registerEvent("zoomIn",true,79,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_054 + *tc.name deleteEntireCookie + *tc.desic Delete all cookies + */ + it('deleteEntireCookie',0,async function(done){ + emitKey="emitSaveCookieSync"; + Utils.registerEvent("deleteEntireCookie","",80,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_055 + *tc.name saveCookieSync + *tc.desic Saves the cookies + */ + it('saveCookieSync',0,async function(done){ + emitKey="emitClearHistory"; + Utils.registerEvent("saveCookieSync",true,81,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_056 + *tc.name clearHistory + *tc.desic Clears the history in the Web + */ + it('clearHistory',0,async function(done){ + emitKey="emitStop"; + Utils.registerEvent("clearHistory",false,82,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_057 + *tc.name stop + *tc.desic Stops the current load + */ + it('stop',0,async function(done){ + emitKey="emitOnInactive"; + Utils.registerEvent("stop",true,83,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_058 + *tc.name onInactive + *tc.desic Let the Web inactive. + */ + it('onInactive',0,async function(done){ + emitKey="emitOnActive"; + Utils.registerEvent("onInactive",true,84,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_059 + *tc.name onActive + *tc.desic Let the Web active + */ + it('onActive',0,async function(done){ + emitKey="emitRegisterJavaScriptProxy"; + Utils.registerEvent("onActive","file:///data/storage/el1/bundle/phone/resources/rawfile/index.html",85,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_060 + *tc.name registerJavaScriptProxy + *tc.desic Registers the JavaScript object and method list + */ + it('registerJavaScriptProxy',0,async function(done){ + emitKey="emitDeleteJavaScriptRegister"; + Utils.registerEvent("registerJavaScriptProxy","backToEts",86,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_061 + *tc.name deleteJavaScriptRegister + *tc.desic Deletes a registered JavaScript object with given name + */ + it('deleteJavaScriptRegister',0,async function(done){ + emitKey="emitJavaScriptAccess"; + Utils.registerEvent("deleteJavaScriptRegister",true,87,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_062 + *tc.name javaScriptAccess + *tc.desic Sets whether the Web allows JavaScript scripts to execute + */ + it('javaScriptAccess',0,async function(done){ + emitKey="emitGetCookieManager"; + Utils.registerEvent("javaScriptAccess",true,88,done); + sendEventByKey('webcomponent',10,''); + }) + /* + *tc.number SUB_ACE_BASIC_ETS_API_063 + *tc.name getCookieManager + *tc.desic Gets network cookie manager + */ + it('getCookieManager',0,async function(done){ + emitKey="emitGetCookieManager"; + Utils.registerEvent("getCookieManager",true,89,done); + sendEventByKey('webcomponent',10,''); + }) }) } diff --git a/arkui/ace_ets_web_dev/entry/src/main/module.json b/arkui/ace_ets_web_dev/entry/src/main/module.json index 1caeca096d756373af7eff5cea74a02a2c054cd0..dfe56dc90d0e3bb4563f8b8543f9bf7bf553634f 100644 --- a/arkui/ace_ets_web_dev/entry/src/main/module.json +++ b/arkui/ace_ets_web_dev/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/databaseAccess.html b/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/databaseAccess.html new file mode 100644 index 0000000000000000000000000000000000000000..e63a1944656e6a826aed2e69840959bf7bc221dc --- /dev/null +++ b/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/databaseAccess.html @@ -0,0 +1,26 @@ + + + + + + + databaseAccess + + +
+ + + \ No newline at end of file diff --git a/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/domApi.html b/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/domApi.html new file mode 100644 index 0000000000000000000000000000000000000000..e794a087455ef43bb789a8f14ab300d9dbefbb80 --- /dev/null +++ b/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/domApi.html @@ -0,0 +1,26 @@ + + + + + + + domApi + + +
+ + + \ No newline at end of file diff --git a/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/geo.html b/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/geo.html new file mode 100644 index 0000000000000000000000000000000000000000..4a2992c3d22223f417ede519cfb351d0722c9854 --- /dev/null +++ b/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/geo.html @@ -0,0 +1,28 @@ + + + + + + + 地理位置 + + +
+ + + \ No newline at end of file diff --git a/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/icon.png b/arkui/ace_ets_web_dev/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/entry/src/main/resources/rawfile/icon.png differ diff --git a/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/index.html b/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/index.html index ff3ff3e0194aec48d5d2f234386ce882006b181c..bd56a8209695b0732a480ccf0b5ed2eced1ae3ab 100644 --- a/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/index.html +++ b/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/index.html @@ -14,8 +14,15 @@
首页
+ 打开rawfile文件 + icon diff --git a/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/onlineImageAccess.html b/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/onlineImageAccess.html new file mode 100644 index 0000000000000000000000000000000000000000..7ed21bbf7e9c48e68c37c18990405dd56881e1cd --- /dev/null +++ b/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/onlineImageAccess.html @@ -0,0 +1,23 @@ + + + + + + + onlineImageAccess + + +
gitee
+ gitee + + + \ No newline at end of file diff --git a/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/overview.html b/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/overview.html new file mode 100644 index 0000000000000000000000000000000000000000..65faa8579cf1921dd1862e5473c97f3c90ea46af --- /dev/null +++ b/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/overview.html @@ -0,0 +1,22 @@ + + + gailan + + + + This is the test page to test SetLoadWithOverviewMode interface + + + \ No newline at end of file diff --git a/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/second.html b/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/second.html index 122ec205b7949306b8ad543e5f3cdea342b6e343..3017554b2ab0ca8725fd3acf1711c6d9b6aab02b 100644 --- a/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/second.html +++ b/arkui/ace_ets_web_dev/entry/src/main/resources/rawfile/second.html @@ -7,6 +7,6 @@ second -
second pages
+
second pages
\ No newline at end of file diff --git a/arkui/ace_ets_web_dev/signature/openharmony_sx.p7b b/arkui/ace_ets_web_dev/signature/openharmony_sx.p7b index 7ffcdc78527c5c1aa24520ab7e913c5f47c703f0..bd2ec963919e78b14f7b0a95673312126655f454 100644 Binary files a/arkui/ace_ets_web_dev/signature/openharmony_sx.p7b and b/arkui/ace_ets_web_dev/signature/openharmony_sx.p7b differ 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..dfe56dc90d0e3bb4563f8b8543f9bf7bf553634f --- /dev/null +++ b/arkui/ace_ets_web_dev_two/entry/src/main/module.json @@ -0,0 +1,42 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "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..bd2ec963919e78b14f7b0a95673312126655f454 Binary files /dev/null and b/arkui/ace_ets_web_dev_two/signature/openharmony_sx.p7b differ diff --git a/arkui/ace_ets_xcomponent/entry/src/main/config.json b/arkui/ace_ets_xcomponent/entry/src/main/config.json index d56ed6d5c3599a15f75b04da0a97f101cbda014d..0b5ccebbc554cca95aa95defe0cc11712ed74639 100644 --- a/arkui/ace_ets_xcomponent/entry/src/main/config.json +++ b/arkui/ace_ets_xcomponent/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": "com.acts.ace.xcomponentetstest.MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/arkui/ace_ets_xcomponent/entry/src/main/cpp/BUILD.gn b/arkui/ace_ets_xcomponent/entry/src/main/cpp/BUILD.gn index ce60b886b713e2d2deaec55cd3cf63fcf778b704..aa64da41eeb3dfc72e7392635c7c7dc1e4cc32b3 100644 --- a/arkui/ace_ets_xcomponent/entry/src/main/cpp/BUILD.gn +++ b/arkui/ace_ets_xcomponent/entry/src/main/cpp/BUILD.gn @@ -37,13 +37,7 @@ ohos_shared_library("nativerender") { ] if (!(product_name == "m40")) { - if (target_cpu == "arm") { - libs = [ "${clang_base_path}/../libcxx-ndk/lib/arm-linux-ohos/c++/libc++_shared.so" ] - } else if (target_cpu == "arm64") { - libs = [ "${clang_base_path}/../libcxx-ndk/lib/aarch64-linux-ohos/c++/libc++_shared.so" ] - } else { - libs = [] - } + stl = "c++_shared" } include_dirs = [ diff --git a/arkui/ace_js_attribute_api/BUILD.gn b/arkui/ace_js_attribute_api/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..936d39539951f5b5452fb58e21d3ed7d19c35c00 --- /dev/null +++ b/arkui/ace_js_attribute_api/BUILD.gn @@ -0,0 +1,35 @@ +# 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("ActsAceJsApiTest") { + hap_profile = "./src/main/config.json" + deps = [ + ":ace_js_assets", + ":ace_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAceJsApiTest" + subsystem_name = "arkui" + part_name = "ace_engine" +} +ohos_js_assets("ace_js_assets") { + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" +} +ohos_resources("ace_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/arkui/ace_js_attribute_api/Test.json b/arkui/ace_js_attribute_api/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..5346e8a8813d93ad20eff4e52ececcac801bf78b --- /dev/null +++ b/arkui/ace_js_attribute_api/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for ActsAceJsApiTest Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "1000000", + "shell-timeout": "1000000", + "bundle-name": "com.example.acejsapi", + "package-name": "com.example.acejsapi" + }, + "kits": [ + { + "test-file-name": [ + "ActsAceJsApiTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/startup/startup_standard/systemparamter/signature/openharmony_sx.p7b b/arkui/ace_js_attribute_api/signature/openharmony_sx.p7b similarity index 100% rename from startup/startup_standard/systemparamter/signature/openharmony_sx.p7b rename to arkui/ace_js_attribute_api/signature/openharmony_sx.p7b diff --git a/arkui/ace_js_attribute_api/src/main/config.json b/arkui/ace_js_attribute_api/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..e84af2c60f6a6341e44d8e65fafedec79f8f24d0 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/config.json @@ -0,0 +1,110 @@ +{ + "app": { + "bundleName": "com.example.acejsapi", + "vendor": "example", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 4, + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.acejsapi", + "name": ".entry", + "mainAbility": ".MainAbility", + "deviceType": [ + "default", + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "formsEnabled": false, + "name": ".MainAbility", + "srcLanguage": "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", + "pages/routerPush/index", + "pages/routerReplace/index", + "pages/video/router/index", + "pages/animate/router/index", + "pages/camera/router/index", + "pages/canvas/router/index", + "pages/div/router/index", + "pages/input/router/index", + "pages/text/router/index", + "pages/viewModel/child/child", + "pages/viewModel/parent/parent", + "pages/viewModel/root/root", + "pages/viewModel1/index/index", + "pages/viewModel1/comp/comp", + "pages/list/router/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": "" + } +} \ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/app.js b/arkui/ace_js_attribute_api/src/main/js/MainAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..d31b70c1edc2455c5f5cef023f72cfe10146335e --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/app.js @@ -0,0 +1,32 @@ +/* + * 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 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/arkui/ace_js_attribute_api/src/main/js/MainAbility/common/images/icon.png b/arkui/ace_js_attribute_api/src/main/js/MainAbility/common/images/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_js_attribute_api/src/main/js/MainAbility/common/images/icon.png differ diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/common/images/video.mp4 b/arkui/ace_js_attribute_api/src/main/js/MainAbility/common/images/video.mp4 new file mode 100644 index 0000000000000000000000000000000000000000..393a4938197715a65b57004c5dc56dcc13dd420d --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/common/images/video.mp4 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:14140624148d003e7e8b32b720d82591a5a68b2b85c97911b0ca39c05cf714c1 +size 23689159 diff --git a/time/TimeTest_js/src/main/js/default/i18n/en-US.json b/arkui/ace_js_attribute_api/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from time/TimeTest_js/src/main/js/default/i18n/en-US.json rename to arkui/ace_js_attribute_api/src/main/js/MainAbility/i18n/en-US.json diff --git a/time/TimeTest_js/src/main/js/default/i18n/zh-CN.json b/arkui/ace_js_attribute_api/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from time/TimeTest_js/src/main/js/default/i18n/zh-CN.json rename to arkui/ace_js_attribute_api/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/animate/router/index.css b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/animate/router/index.css new file mode 100644 index 0000000000000000000000000000000000000000..827dc7affd8e75d8ea4a8ad1bd0e890ad388ae27 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/animate/router/index.css @@ -0,0 +1,43 @@ +/** + * 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. + */ + +.container { + display: flex; + flex-direction: column; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 40px; + text-align: center; + width: 100%; + height: 40px; + margin: 10px; +} + +@media screen 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/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/animate/router/index.hml b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/animate/router/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..1b3cc065a00151b72dba4e6cea9819dba1b6a49f --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/animate/router/index.hml @@ -0,0 +1,20 @@ + + +
+ + AnimationResult测试 + +
diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/animate/router/index.js b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/animate/router/index.js new file mode 100644 index 0000000000000000000000000000000000000000..f3fc614343b172fe60c603c4bc145c6d65859308 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/animate/router/index.js @@ -0,0 +1,113 @@ +/** + * 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. + */ + +var options = { + duration: 1500, + easing: 'friction', + delay: 100, + fill: 'forwards', + iterations: 2, + direction: 'normal', +}; +var frames = [ + { + transform: { + translate: '-120px', + rotate: '10deg', + scale: 0.2, + skew: '40deg' + }, + opacity: 0.1, + offset: 0.0, + width: '40%', + height: '20px', + backgroundColor: '#ff0000', + backgroundPosition: '10px 20px', + transformOrigin: 'left top' + }, + { + transform: { + translateX: '0px', + translateY: '5px', + rotateX: '10deg', + rotateY: '10deg', + scaleX: 0.5, + scaleY: 0.7, + skewX: '22deg', + skewY: '30deg' + }, + opacity: 0.6, + offset: 2.0, + width: '60%', + height: '30px', + backgroundColor: '#ff00ff', + backgroundPosition: '15px 25px', + transformOrigin: 'center top' + }, + { + transform: { + translateX: '100px', + translateY: '0px', + translateZ: '20px', + rotateX: '0deg', + rotateY: '0deg', + rotateZ: '30deg', + scaleX: 1, + scaleY: 1, + scaleZ: 2, + skewX: '0', + skewY: '0', + skewZ: '30deg' + }, + opacity: 1, + offset: 0.0, + width: '100%', + height: '30px', + backgroundColor: '#ffff00', + backgroundPosition: '0px', + transformOrigin: 'center center' + }, +]; + +export default { + data: { + title: "" + }, + onInit() { + + }, + functionTest1() { + var function1 = this.$element('function1'); + var animationResult = function1.animate(frames, options); + animationResult.play() + animationResult.onfinish = function () { + console.info('The animation is finish') + console.info('The animationResult pending is ' + animationResult.pending) + console.info('The animationResult pending is ' + animationResult.startTime) + console.info('The animationResult playstate is ' + animationResult.playstate) + console.info('The animationResult finished is ' + animationResult.finished) + }; + animationResult.onstart = function () { + console.info('The animation is start') + console.info('The animationResult pending is ' + animationResult.pending) + console.info('The animationResult pending is ' + animationResult.startTime) + console.info('The animationResult playstate is ' + animationResult.playstate) + console.info('The animationResult finished is ' + animationResult.finished) + } + } +} + + + diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/camera/router/index.css b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/camera/router/index.css new file mode 100644 index 0000000000000000000000000000000000000000..2b1fdf855665965c6b8b41bfa7e5c99f1454917e --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/camera/router/index.css @@ -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. + */ + +.container { + display: flex; + flex-direction: column; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +camera{ + width: 300px; + height: 300px; +} + +.testDiv { + display: flex; + flex-direction: column; + left: 0px; + top: 0px; + width: 100%; +} + +.title { + font-size: 40px; + text-align: center; + width: 100%; + height: 60px; + margin: 10px; + padding: 10px; +} + +@media screen 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/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/camera/router/index.hml b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/camera/router/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..02949f96e62a4abfb5e91e0c37f7240228639d86 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/camera/router/index.hml @@ -0,0 +1,29 @@ + + +
+ + Camera takePhoto high + + + Camera takePhoto normal + + + Camera takePhoto low + + + + +
diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/camera/router/index.js b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/camera/router/index.js new file mode 100644 index 0000000000000000000000000000000000000000..b4aec187c935374a2fd38c23bfedc8d0abfaefcc --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/camera/router/index.js @@ -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. + */ + +export default { + data: { + title: "" + }, + onInit() { + + }, + functionTest1() { + var camera = this.$element('camera1'); + camera.takePhoto({ + quality: 'high' + }) + }, + functionTest2() { + var camera = this.$element('camera1'); + camera.takePhoto({ + quality: 'normal' + }) + }, + functionTest3() { + var camera = this.$element('camera1'); + camera.takePhoto({ + quality: 'low' + }) + }, + cameraError() { + console.info('授权失败!') + } +} + + + diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/canvas/router/index.css b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/canvas/router/index.css new file mode 100644 index 0000000000000000000000000000000000000000..d96f94f8d04fbbeaf4896ab19453c67de91139a2 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/canvas/router/index.css @@ -0,0 +1,45 @@ +/** + * 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. + */ + +.container{ + flex-direction: column; + background-color: #F1F3F5; + align-items: center; + width: 100%; +} +canvas{ + margin-top: 300px; + width: 600px; + height: 500px; + background-color: #fdfdfd; + border: 5px solid red; +} +.content{ + width: 80%; + margin-top: 50px; + margin-bottom: 50px; + display: flex; + flex-wrap: wrap; + justify-content: space-around; +} +text{ + width: 200px; + height: 80px; + color: white; + border-radius: 20px; + text-align: center; + background-color: #6060e7; + margin-bottom: 30px; +} \ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/canvas/router/index.hml b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/canvas/router/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..cb186b4e2b135be5c89573fd7d558af1d4ca0604 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/canvas/router/index.hml @@ -0,0 +1,26 @@ + + +
+
+ +
+
+ save + clear + restore + getLineDash +
+
\ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/canvas/router/index.js b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/canvas/router/index.js new file mode 100644 index 0000000000000000000000000000000000000000..dc08f0a494928a00f11d3e6e66e1f3f5dd1c336f --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/canvas/router/index.js @@ -0,0 +1,51 @@ +/** + * 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. + */ + +export default { + data: { + ctx: '', + }, + onShow() { + this.ctx = this.$refs.canvas.getContext("2d"); + this.ctx.fillStyle = "red" + this.ctx.fillRect(200, 150, 200, 200); + }, + save() { + // 画笔储存 + this.ctx.save(); + console.info('save succeed') + }, + clear() { + this.ctx.clearRect(0, 0, 600, 500); + // 该变画笔颜色 + this.ctx.fillStyle = "#2133d2"; + }, + restore() { + this.ctx.beginPath(); + // 画笔恢复 + this.ctx.restore(); + this.ctx.fillRect(200, 150, 200, 200); + }, + getLineDash() { + this.ctx.arc(100, 75, 50, 0, 6.28); + this.ctx.setLineDash([10, 20]); + this.ctx.stroke(); + var info = this.ctx.getLineDash(); + console.info('getLineDash:' + info) + } +} + + + diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/div/router/index.css b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/div/router/index.css new file mode 100644 index 0000000000000000000000000000000000000000..1e6b92df231ac98642b065dc490e4e65657a00a2 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/div/router/index.css @@ -0,0 +1,44 @@ +/** + * 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. + */ + +.container { + flex-direction: column; + width: 100%; + margin-top: 10px; + display: flex; +} + +.title { + width: 200px; + height: 70px; + color: white; + border-radius: 20px; + text-align: center; + background-color: #6060e7; + margin-bottom: 30px; +} + +.text { + width: 100%; + height: 100px; + font-size: 40px; + margin-left: 12px; +} + +.group { + width: 100%; + align-content: center; + justify-content: center; +} \ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/div/router/index.hml b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/div/router/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..0effa7520a7bdd1cc00cbb64a07c8167c784d71c --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/div/router/index.hml @@ -0,0 +1,58 @@ + + +
+
+ linear + ease + ease-in +
+
+ ease-out + ease-in-out + friction +
+
+ extreme-deceleration + sharp + rhythm +
+
+ smooth + cubic-bezier + steps +
+ 列表文本1 + 列表文本2 + 列表文本3 + 列表文本4 + 列表文本5 + 列表文本6 + 列表文本7 + 列表文本8 + 列表文本9 + 列表文本10 + 列表文本11 + 列表文本12 + 列表文本13 + 列表文本14 + 列表文本15 + 列表文本16 + 列表文本17 + 列表文本18 + 列表文本19 + 列表文本20 + 列表文本21 +
\ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/div/router/index.js b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/div/router/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d15fe00c325802b18c73548db18fb3d1df6ef926 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/div/router/index.js @@ -0,0 +1,156 @@ +/** + * 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. + */ + +export default { + data: { + appData: 'localData', + appVersion:'1.0', + }, + functionTest1() { + var div = this.$element('div1'); + div.scrollTo({ + id: "text12", + duration: 200, + timingFunction: "linear", + complete: () => { + console.info('scrollTo complete') + } + }) + }, + functionTest2() { + var div = this.$element('div1'); + div.scrollTo({ + id: "text12", + duration: 200, + timingFunction: "ease", + complete: () => { + console.info('scrollTo complete') + } + }) + }, + functionTest3() { + var div = this.$element('div1'); + div.scrollTo({ + id: "text12", + duration: 200, + timingFunction: "ease-in", + complete: () => { + console.info('scrollTo complete') + } + }) + }, + functionTest4() { + var div = this.$element('div1'); + div.scrollTo({ + id: "text12", + duration: 200, + timingFunction: "ease-out", + complete: () => { + console.info('scrollTo complete') + } + }) + }, + functionTest5() { + var div = this.$element('div1'); + div.scrollTo({ + id: "text12", + duration: 200, + timingFunction: "ease-in-out", + complete: () => { + console.info('scrollTo complete') + } + }) + }, + functionTest6() { + var div = this.$element('div1'); + div.scrollTo({ + id: "text12", + duration: 200, + timingFunction: "friction", + complete: () => { + console.info('scrollTo complete') + } + }) + }, + functionTest7() { + var div = this.$element('div1'); + div.scrollTo({ + id: "text12", + duration: 200, + timingFunction: "extreme-deceleration", + complete: () => { + console.info('scrollTo complete') + } + }) + }, + functionTest8() { + var div = this.$element('div1'); + div.scrollTo({ + id: "text12", + duration: 200, + timingFunction: "sharp", + complete: () => { + console.info('scrollTo complete') + } + }) + }, + functionTest9() { + var div = this.$element('div1'); + div.scrollTo({ + id: "text12", + duration: 200, + timingFunction: "rhythm", + complete: () => { + console.info('scrollTo complete') + } + }) + }, + functionTest10() { + var div = this.$element('div1'); + div.scrollTo({ + id: "text12", + duration: 200, + timingFunction: "smooth", + complete: () => { + console.info('scrollTo complete') + } + }) + }, + functionTest11() { + var div = this.$element('div1'); + div.scrollTo({ + id: "text12", + duration: 200, + timingFunction: "cubic-bezier", + complete: () => { + console.info('scrollTo complete') + } + }) + }, + functionTest12() { + var div = this.$element('div1'); + div.scrollTo({ + id: "text12", + duration: 200, + timingFunction: "steps", + complete: () => { + console.info('scrollTo complete') + } + }) + } +} + + + diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/index/index.css b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..00a7017da5a6e600cb10d3debc7c5be3cc1765c1 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,27 @@ +/** + * 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. + */ + +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 40px; + color: #000000; + opacity: 0.9; +} + diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/index/index.hml b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..cca0229e583e14a9be5135d93e44ecd41f410b71 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,20 @@ + + +
+ + Hello {{ title }} + +
diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/index/index.js b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..70604c8078174f5b707240000cdbb35ea6a816da --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,34 @@ +/** + * 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. + */ + + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: "" + }, + onInit() { + console.info('[test page log] index onInit') + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('[test page log] index onShow') + }, + onHide() { + console.info('[test page log] index onHide') + }, +} diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/input/router/index.css b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/input/router/index.css new file mode 100644 index 0000000000000000000000000000000000000000..4ab66f75df667f42c597537fa176f6cab83b5a32 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/input/router/index.css @@ -0,0 +1,52 @@ +/** + * 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. + */ + +.container { + display: flex; + flex-direction: column; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.testDiv { + display: flex; + flex-direction: column; + left: 0px; + top: 0px; + width: 100%; +} + +.title { + font-size: 40px; + text-align: center; + width: 100%; + height: 60px; + margin: 10px; + padding: 10px; +} + +@media screen 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/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/input/router/index.hml b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/input/router/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..680b78b4553df3ea0788dd7bc2181f750cd16dfa --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/input/router/index.hml @@ -0,0 +1,38 @@ + + +
+
+ +
+ + Element setStyle + + + Element setAttribute + + + Element addChild + + + Element rotation + + + watch test + + + set/delete test + +
diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/input/router/index.js b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/input/router/index.js new file mode 100644 index 0000000000000000000000000000000000000000..1336e058a5212be35c70071c596edc7a0e209d45 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/input/router/index.js @@ -0,0 +1,63 @@ +/** + * 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. + */ + +export default { + data: { + title: "", + watchVal:"123", + Version:"1.0" + }, + onInit() { + this.$watch("watchVal", "onwatch") + }, + functionTest1() { + var function1 = this.$element('function1'); + var result = function1.setStyle("font-size", "50px") + console.info('setStyle result is ' + result) + }, + functionTest2() { + var function2 = this.$element('function2'); + function2.setAttribute("type", "password") + }, + functionTest3() { + var elem = dom.createElement("button"); + elem.setAttribute("value", "buttoncreateElement"); + var testDiv = this.$element('testDiv'); + testDiv.addChild(elem); + }, + functionTest4() { + var function2 = this.$element('function2'); + function2.rotation({ + focus: true + }) + }, + functionTest5() { + //将watchVal从123改为456,触发onwatch事件 + this.watchVal = "456" + }, + functionTest6() { + this.$set('Version', '2.0'); + console.info("Version = " + this.Version); + this.$delete('Version'); + // log print:Version = undefined + console.info("Version = " + this.Version); + }, + onwatch(newVal, oldVal) { + console.log("watch newVal = " + newVal + ",oldVal =" + oldVal) + } +} + + + diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/list/router/index.css b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/list/router/index.css new file mode 100644 index 0000000000000000000000000000000000000000..45b462827557b3a9863709e7fb7b71add5c06d87 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/list/router/index.css @@ -0,0 +1,40 @@ +/** + * 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. + */ + +.container { + flex-direction: column; + width: 100%; + margin-top: 10px; +} +.title{ + height: 50px; + font-size: 16px; + color: grey; + margin-top: 40px; + margin-left: 30px; +} +.text{ + font-size: 20px; + font-weight:500; + margin-left: 12px; +} +.list{ + width: 96%; + margin-left: 5%; + height: 350px; + columns: 1; + background-color: blue; + overflow: scroll; +} \ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/list/router/index.hml b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/list/router/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..3a0af3281ab158984cdf567a3d99a6c2338d4b90 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/list/router/index.hml @@ -0,0 +1,23 @@ + + +
+ 默认列表 + + + {{$item.value}} + + +
\ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/list/router/index.js b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/list/router/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c429c3de01c7234de49b40ff6995f791f8943c1c --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/list/router/index.js @@ -0,0 +1,33 @@ +/** + * 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 Ability from '@ohos.application.Ability' +import ConfigurationConstant from '@ohos.application.ConfigurationConstant' + +export default { + data: { + title: "", + "array": [ + {"value": "列表文本"}, + {"value": "列表文本"}, + {"value": "列表文本"}, + {"value": "列表文本"}, + ], + }, + click() + { + console.log('scrollArrow begin...') + this.$element("list").scrollArrow({ reverse: true, smooth: false }); + } +} \ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/routerPush/index.css b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/routerPush/index.css new file mode 100644 index 0000000000000000000000000000000000000000..7a9a5d8901889d982cceab3effcec518226492e7 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/routerPush/index.css @@ -0,0 +1,27 @@ +/** + * 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. + */ + +.container { + width: 454px; + height: 454px; + justify-content: center; + align-items: center; +} + +.title { + width: 200px; + font-size: 30px; + text-align: center; +} diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/routerPush/index.hml b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/routerPush/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..b9c7e8c8d068ab2bae427af456063f05ee45f6e9 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/routerPush/index.hml @@ -0,0 +1,20 @@ + + +
+ + {{ title }} + +
diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/routerPush/index.js b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/routerPush/index.js new file mode 100644 index 0000000000000000000000000000000000000000..66890b58fcd042af32a95e0456fe13ded19a5150 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/routerPush/index.js @@ -0,0 +1,26 @@ +/** + * 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. + */ + +export default { + data: { + title: "router push test" + }, + onShow() { + console.info('[test page log] routerPush onShow'); + }, + onHide() { + console.info('[test page log] routerPush ohHide'); + }, +} diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/routerReplace/index.css b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/routerReplace/index.css new file mode 100644 index 0000000000000000000000000000000000000000..7a9a5d8901889d982cceab3effcec518226492e7 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/routerReplace/index.css @@ -0,0 +1,27 @@ +/** + * 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. + */ + +.container { + width: 454px; + height: 454px; + justify-content: center; + align-items: center; +} + +.title { + width: 200px; + font-size: 30px; + text-align: center; +} diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/routerReplace/index.hml b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/routerReplace/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..b9c7e8c8d068ab2bae427af456063f05ee45f6e9 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/routerReplace/index.hml @@ -0,0 +1,20 @@ + + +
+ + {{ title }} + +
diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/routerReplace/index.js b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/routerReplace/index.js new file mode 100644 index 0000000000000000000000000000000000000000..f1e5072e0a09d7efd6efbdb828ddbb936e69e58e --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/routerReplace/index.js @@ -0,0 +1,26 @@ +/** + * 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. + */ + +export default { + data: { + title: "router replace test" + }, + onShow() { + console.info('[test page log] routerReplace onShow'); + }, + onHide() { + console.info('[test page log] routerReplace ohHide'); + }, +} diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/text/router/index.css b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/text/router/index.css new file mode 100644 index 0000000000000000000000000000000000000000..ef3d3134d01ff129e80262d9a7dfe231c2183b32 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/text/router/index.css @@ -0,0 +1,21 @@ +/** + * 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. + */ + +.container { + background-color: #f8f8ff; + flex: 1; + flex-direction: column; + align-content: center; +} \ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/text/router/index.hml b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/text/router/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..8b84d9a35e24c923ded28a66ee82448d53eac746 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/text/router/index.hml @@ -0,0 +1,29 @@ + + +
+ + {{ $tc('strings.plurals', 0) }} + + {{ $tc('strings.plurals', 1) }} + + {{ $tc('strings.plurals', 2) }} + + {{ $tc('strings.plurals', 6) }} + + {{ $tc('strings.plurals', 50) }} + + {{ $tc('strings.plurals', 100) }} +
diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/text/router/index.js b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/text/router/index.js new file mode 100644 index 0000000000000000000000000000000000000000..4a67a257d84a51f7359cb6dea89dff567e57d4e4 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/text/router/index.js @@ -0,0 +1,24 @@ +/** + * 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. + */ + +export default { + data: { + text: '开始', + isShow: false, + }, + textClicked (e) { + this.text = e.detail.text; + } +} \ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/video/router/index.css b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/video/router/index.css new file mode 100644 index 0000000000000000000000000000000000000000..422c1e2da6ec88f8e0051b4494fff9adc18f79af --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/video/router/index.css @@ -0,0 +1,16 @@ +/** + * 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. + */ + + diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/video/router/index.hml b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/video/router/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..571ce4f5279ca6b70da53453fbd465c595481a6e --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/video/router/index.hml @@ -0,0 +1,22 @@ + + +
+ +
\ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/video/router/index.js b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/video/router/index.js new file mode 100644 index 0000000000000000000000000000000000000000..b162d0f9977a9da3b4712ae64adbecf7f82af64f --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/video/router/index.js @@ -0,0 +1,51 @@ +/** + * 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. + */ + +export default { + data: { + event:'', + seekingtime:'', + timeupdatetime:'', + seekedtime:'', + isStart: true, + isfullscreenchange: false, + duration: '', + }, + preparedCallback:function(e){this.event = '视频连接成功'; this.duration = e.duration;}, + startCallback:function(){this.event = '视频开始播放';}, + pauseCallback:function(){this.event = '视频暂停播放';}, + finishCallback:function(){this.event = '视频播放结束';}, + errorCallback:function(){this.event = '视频播放错误';}, + seekingCallback:function(e){this.seekingtime = e.currenttime;}, + timeupdateCallback:function(e){this.timeupdatetime = e.currenttime;}, + changeStartPause: function() { + if(this.isStart) { + this.$element('videoId').pause(); + this.isStart = false; + } else { + this.$element('videoId').start(); + this.isStart = true; + } + }, + changeFullScreenChange: function() {//全屏 + if(!this.isfullscreenchange) { + this.$element('videoId').requestFullscreen({ screenOrientation : 'default' }); + this.isfullscreenchange = true; + } else { + this.$element('videoId').exitFullscreen(); + this.isfullscreenchange = false; + } + } +} diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/child/child.css b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/child/child.css new file mode 100644 index 0000000000000000000000000000000000000000..f1c94ed5d9328631458b935fa0824f791bf063fc --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/child/child.css @@ -0,0 +1,35 @@ +/** + * 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. + */ + +.item { + width: 700px; + flex-direction: column; + height: 300px; + align-items: center; + margin-top: 100px; +} +.text-style { + width: 100%; + text-align: center; + font-weight: 500; + font-family: Courier; + font-size: 36px; +} +.title-style { + font-weight: 500; + font-family: Courier; + font-size: 50px; + color: #483d8b; +} \ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/child/child.hml b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/child/child.hml new file mode 100644 index 0000000000000000000000000000000000000000..8e6dabb67bce1a6f63e875e5ed72c0f67b62709f --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/child/child.hml @@ -0,0 +1,18 @@ + +
+ child component clicked + hello child component +
\ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/child/child.js b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/child/child.js new file mode 100644 index 0000000000000000000000000000000000000000..0d79a7d2854d0cf5872cc4ee71d116e8bf53fd4a --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/child/child.js @@ -0,0 +1,29 @@ +/** + * 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. + */ + +export default { + data: { + showsome: false, + text: 'I am child component!', + }, + childClicked () { + this.showsome = !this.showsome; + console.info('child component get parent text'); + console.info(this.$parent().text); + console.info('child component get root text'); + console.info(this.$root().text); + return "childClicked fuction return something" + }, +} \ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/parent/parent.css b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/parent/parent.css new file mode 100644 index 0000000000000000000000000000000000000000..f1c94ed5d9328631458b935fa0824f791bf063fc --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/parent/parent.css @@ -0,0 +1,35 @@ +/** + * 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. + */ + +.item { + width: 700px; + flex-direction: column; + height: 300px; + align-items: center; + margin-top: 100px; +} +.text-style { + width: 100%; + text-align: center; + font-weight: 500; + font-family: Courier; + font-size: 36px; +} +.title-style { + font-weight: 500; + font-family: Courier; + font-size: 50px; + color: #483d8b; +} \ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/parent/parent.hml b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/parent/parent.hml new file mode 100644 index 0000000000000000000000000000000000000000..2287b97563239dce7be75c33c2b723d1d1a6226c --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/parent/parent.hml @@ -0,0 +1,20 @@ + + +
+ parent component click + hello parent component! + +
\ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/parent/parent.js b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/parent/parent.js new file mode 100644 index 0000000000000000000000000000000000000000..c5db90322120fc22fefa1420aa131dd5933a9a76 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/parent/parent.js @@ -0,0 +1,27 @@ +/** + * 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. + */ +export default { + data: { + showsome: false, + text: 'I am parent component!', + }, + parentClicked () { + this.showsome = !this.showsome; + console.info('parent component get parent text'); + console.info(`${this.$parent().text}`); + console.info("parent component get child function"); + console.info(`${this.$child('selfDefineChild').childClicked()}`); + }, +} \ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/root/root.css b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/root/root.css new file mode 100644 index 0000000000000000000000000000000000000000..ef3d3134d01ff129e80262d9a7dfe231c2183b32 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/root/root.css @@ -0,0 +1,21 @@ +/** + * 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. + */ + +.container { + background-color: #f8f8ff; + flex: 1; + flex-direction: column; + align-content: center; +} \ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/root/root.hml b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/root/root.hml new file mode 100644 index 0000000000000000000000000000000000000000..97c606081c7ea116560b3a574959f02e8a11471b --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/root/root.hml @@ -0,0 +1,21 @@ + + +
+
+ {{text}} + +
+
\ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/root/root.js b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/root/root.js new file mode 100644 index 0000000000000000000000000000000000000000..33891e4829c660df692f429e3f361c2d37336dae --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel/root/root.js @@ -0,0 +1,19 @@ +/** + * 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. + */ +export default { + data: { + text: 'I am root!', + }, +} \ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel1/comp/comp.css b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel1/comp/comp.css new file mode 100644 index 0000000000000000000000000000000000000000..f1c94ed5d9328631458b935fa0824f791bf063fc --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel1/comp/comp.css @@ -0,0 +1,35 @@ +/** + * 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. + */ + +.item { + width: 700px; + flex-direction: column; + height: 300px; + align-items: center; + margin-top: 100px; +} +.text-style { + width: 100%; + text-align: center; + font-weight: 500; + font-family: Courier; + font-size: 36px; +} +.title-style { + font-weight: 500; + font-family: Courier; + font-size: 50px; + color: #483d8b; +} \ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel1/comp/comp.hml b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel1/comp/comp.hml new file mode 100644 index 0000000000000000000000000000000000000000..9e20dc08cd98d34d7028b335af91117bcd25b080 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel1/comp/comp.hml @@ -0,0 +1,19 @@ + +
+ {{title}} + 点击这里查看隐藏文本 + hello world +
\ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel1/comp/comp.js b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel1/comp/comp.js new file mode 100644 index 0000000000000000000000000000000000000000..2bd982922132fe77b1061a5a86c440328eeb807b --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel1/comp/comp.js @@ -0,0 +1,31 @@ +/** + * 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. + */ +export default { + props: { + title: { + default: 'title', + }, + showObject: {}, + }, + data() { + return { + showObj: this.showObject, + }; + }, + childClicked () { + this.$emit('eventType1', {text: '收到子组件参数'}); + this.showObj = !this.showObj; + }, +} \ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel1/index/index.css b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel1/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..ef3d3134d01ff129e80262d9a7dfe231c2183b32 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel1/index/index.css @@ -0,0 +1,21 @@ +/** + * 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. + */ + +.container { + background-color: #f8f8ff; + flex: 1; + flex-direction: column; + align-content: center; +} \ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel1/index/index.hml b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel1/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..204cc4352c1a1a075239b686ccad1c51a1a0689b --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel1/index/index.hml @@ -0,0 +1,19 @@ + + +
+ 父组件:{{text}} + +
\ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel1/index/index.js b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel1/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ca5109ca0f48e6561b56083e6c57b11bccf4323f --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/MainAbility/pages/viewModel1/index/index.js @@ -0,0 +1,23 @@ +/** + * 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. + */ +export default { + data: { + text: '开始', + isShow: false, + }, + textClicked (e) { + this.text = e.detail.text; + }, +} \ No newline at end of file diff --git a/arkui/ace_js_attribute_api/src/main/js/TestAbility/app.js b/arkui/ace_js_attribute_api/src/main/js/TestAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..2d316a0a089b332c5c28729be9ff937aa46618c5 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/TestAbility/app.js @@ -0,0 +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'); + } +}; diff --git a/arkui/ace_js_attribute_api/src/main/js/TestAbility/i18n/en-US.json b/arkui/ace_js_attribute_api/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/arkui/ace_js_attribute_api/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/arkui/ace_js_attribute_api/src/main/js/TestAbility/i18n/zh-CN.json b/arkui/ace_js_attribute_api/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/arkui/ace_js_attribute_api/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/arkui/ace_js_attribute_api/src/main/js/TestAbility/pages/index/index.css b/arkui/ace_js_attribute_api/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b21c92c6290ea747bd891e2ab673721afc5521ed --- /dev/null +++ b/arkui/ace_js_attribute_api/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/time/TimeTest_js/src/main/js/default/pages/index/index.hml b/arkui/ace_js_attribute_api/src/main/js/TestAbility/pages/index/index.hml similarity index 100% rename from time/TimeTest_js/src/main/js/default/pages/index/index.hml rename to arkui/ace_js_attribute_api/src/main/js/TestAbility/pages/index/index.hml diff --git a/arkui/ace_js_attribute_api/src/main/js/TestAbility/pages/index/index.js b/arkui/ace_js_attribute_api/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d94b75c085fa1c16a0b2721609b18c57a7295476 --- /dev/null +++ b/arkui/ace_js_attribute_api/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/arkui/ace_js_attribute_api/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/arkui/ace_js_attribute_api/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 0000000000000000000000000000000000000000..527be90a1240e77ba994eb71d2868331533bb464 --- /dev/null +++ b/arkui/ace_js_attribute_api/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'] + '.MainAbility' + + 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/arkui/ace_js_attribute_api/src/main/js/test/List.test.js b/arkui/ace_js_attribute_api/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..7c8238a14a1574c8677c22e1b328af69df78ffad --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/test/List.test.js @@ -0,0 +1,23 @@ +/* + * 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 basicabilityapi from './basicabilityapi.test.js' +import mediaqueryTest from './mediaquery.test.js' +import aceJsApiAndAttr from './commonComponentJsApi.test.js' +export default function testsuite() { +basicabilityapi() +mediaqueryTest() +aceJsApiAndAttr() +} diff --git a/arkui/ace_js_attribute_api/src/main/js/test/basicabilityapi.test.js b/arkui/ace_js_attribute_api/src/main/js/test/basicabilityapi.test.js new file mode 100644 index 0000000000000000000000000000000000000000..3fceaa42dc422d5e7e0a6b9cf494570243ee7b01 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/test/basicabilityapi.test.js @@ -0,0 +1,528 @@ +/* + * 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 configuration from '@system.configuration'; +import prompt from '@system.prompt'; +import router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'; + +export default function basicabilityapi() { + describe('basicabilityapi', function () { + let testResult; + let testResultFail; + let test; + beforeAll(function () { + testResult = true; + testResultFail = false; + test = "success" + }); + beforeEach(function () { + }); + afterEach(function () { + }); + afterAll(function () { + }); + + async function backToIndex(){ + let backToIndexPromise = new Promise((resolve, reject) => { + setTimeout(() => { + router.back({ + uri: 'pages/index/index' + }); + resolve(); + }, 500); + }); + let clearPromise = new Promise((resolve, reject) => { + setTimeout(() => { + router.clear(); + resolve(); + }, 500); + }); + await backToIndexPromise.then(() => { + return clearPromise; + }); + } + + /** + * @tc.number SUB_ACE_BASICABILITY_JS_API_0100 + * @tc.name testClearInterval + * @tc.desc Cancel the repetitive timing tasks previously set by setInterval. + */ + it('testClearInterval', 0, async function(done) { + console.info('testClearInterval START'); + let res = 0; + let intervalID = -1; + let promise1 = new Promise((resolve, reject) => { + intervalID = setInterval(function () { + res++; + console.info('testClearInterval res = ' + res); + resolve(); + }, 100); + }); + let promise2 = new Promise((resolve, reject) => { + setTimeout(function () { + console.info('[clearInterval] start'); + clearInterval(intervalID); + console.info('[clearInterval] end'); + resolve(); + }, 600); + }); + Promise.all([promise1, promise2]).then(() => { + console.info('testClearInterval finally'); + expect(5).assertEqual(res); + console.info('testClearInterval END'); + done(); + }); + }); + + /** + * @tc.number SUB_ACE_BASICABILITY_JS_API_0200 + * @tc.name testConsole + * @tc.desc Print a text message. + */ + it('testConsole', 0, function () { + console.info('testConsole START'); + try{ + const versionCode = 1.1; + console.info('[console.info] versionCode: ' + versionCode); + console.debug('[console.debug] versionCode: ' + versionCode); + console.log('[console.log] versionCode: ' + versionCode); + console.warn('[console.warn] versionCode: ' + versionCode); + console.error('[console.error] versionCode: ' + versionCode); + expect(test).assertEqual('success'); + console.info('testConsole END'); + } + catch(e){ + console.info('testConsole ERROR' + e); + } + }); + + /** + * @tc.number SUB_ACE_BASICABILITY_JS_API_0300 + * @tc.name testRouterPush + * @tc.desc Go to the specified page of the application. + */ + it('testRouterPush', 0, async function (done) { + console.info('testRouterPush START'); + let options = { + uri : 'pages/routerPush/index' + } + let promise1 = new Promise((resolve, reject) => { + router.push(options); + resolve(); + }); + let promise2 = new Promise((resolve, reject) => { + setTimeout(() => { + let pages = router.getState(); + console.info("[router.push] getState" + JSON.stringify(pages)); + expect("pages/routerPush/").assertEqual(pages.path); + console.info("[router.push] getLength:" + router.getLength()); + expect("2").assertEqual(router.getLength()); + console.info('testRouterPush SUCCESS'); + resolve(); + }, 500); + }); + await promise1.then(() => { + return promise2; + }); + await backToIndex(); + console.info('testRouterPush END'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASICABILITY_JS_API_0310 + * @tc.name testRouterPushNotExist + * @tc.desc Test push not exist page. + */ + it('testRouterPushNotExist', 0, async function (done) { + console.info('testRouterPushNotExist START'); + let promise1 = new Promise((resolve, reject) => { + router.push({ + uri: 'pages/routerNotExist/index' + }); + resolve(); + }); + let promise2 = new Promise((resolve, reject) => { + setTimeout(() => { + let pages = router.getState(); + console.info("testRouterPushNotExist getState" + JSON.stringify(pages)); + expect("pages/index/").assertEqual(pages.path); + console.info("testRouterPushNotExist getLength:" + router.getLength()); + expect("1").assertEqual(router.getLength()); + console.info('testRouterPushNotExist success'); + resolve(); + }, 500); + }); + await promise1.then(() => { + return promise2; + }); + console.info('testRouterPushNotExist END'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASICABILITY_JS_API_0400 + * @tc.name testRouterReplace + * @tc.desc Replace the current page with a page in the application, and destroy the replaced page. + */ + it('testRouterReplace', 0, async function (done) { + console.info('testRouterReplace START'); + let options = { + uri : 'pages/routerPush/index' + } + let promise1 = new Promise((resolve, reject) => { + router.push(options); + resolve(); + }); + let repleasePage = { + uri : 'pages/routerReplace/index' + } + let promise2 = new Promise((resolve, reject) => { + setTimeout(() => { + router.replace(repleasePage); + resolve(); + }, 500); + }); + //替换堆栈数量不会变 + let promise3 = new Promise((resolve, reject) => { + setTimeout(() => { + let pages = router.getState(); + console.info("[router.replace] getState" + JSON.stringify(pages)); + expect("pages/routerReplace/").assertEqual(pages.path); + console.info("[router.replace] getLength:" + router.getLength()); + expect("2").assertEqual(router.getLength()); + console.info('testRouterReplace SUCCESS'); + resolve(); + }, 1000); + }); + await promise1.then(() => { + return promise2; + }).then(() => { + return promise3; + }); + await backToIndex(); + console.info('testRouterReplace END'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASICABILITY_JS_API_0410 + * @tc.name testRouterReplaceNotExist + * @tc.desc Test replace not exist page. + */ + it('testRouterReplaceNotExist', 0, async function (done) { + console.info('testRouterReplaceNotExist START'); + await setTimeout(() => { + router.replace({ + uri: 'pages/routerNotExist/index' + }); + }, 500); + await setTimeout(() => { + let pages = router.getState(); + console.info("testRouterReplaceNotExist getState" + JSON.stringify(pages)); + expect("pages/index/").assertEqual(pages.path); + console.info("testRouterReplaceNotExist getLength:" + router.getLength()); + expect("1").assertEqual(router.getLength()); + console.info('testRouterReplaceNotExist END'); + done(); + }, 1000); + }); + + /** + * @tc.number SUB_ACE_BASICABILITY_JS_API_0500 + * @tc.name testRouterBack + * @tc.desc Return to the previous page or the specified page. + */ + it('testRouterBack', 0, async function (done) { + console.info('testRouterBack START'); + let promise1 = new Promise((resolve, reject) => { + router.push({ + uri: 'pages/routerPush/index' + }); + resolve(); + }); + let promise2 = new Promise((resolve, reject) => { + setTimeout(() => { + router.back({ + uri: 'pages/index/index' + }); + resolve(); + }, 500); + }); + let promise3 = new Promise((resolve, reject) => { + setTimeout(() => { + let pages = router.getState(); + console.info("[router.back] getState" + JSON.stringify(pages)); + expect("pages/index/").assertEqual(pages.path); + console.info("[router.back] getLength:" + router.getLength()); + expect("1").assertEqual(router.getLength()); + console.info('testRouterBack SUCCESS'); + resolve(); + }, 1000); + }); + await promise1.then(() => { + return promise2; + }).then(() => { + return promise3; + }); + console.info('testRouterBack END'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASICABILITY_JS_API_0600 + * @tc.name testRouterClear + * @tc.desc Clear all historical pages in the page stack, and only keep the current page as the top page. + */ + it('testRouterClear', 0, function () { + console.info('testRouterClear START'); + router.clear(); + console.info("[router.clear] router.getLength:" + router.getLength()); + expect("1").assertEqual(router.getLength()); + console.info('testRouterClear END'); + }); + + /** + * @tc.number SUB_ACE_BASICABILITY_JS_API_0700 + * @tc.name testRouterLength + * @tc.desc Get the number of pages currently in the page stack. + */ + it('testRouterLength', 0, async function (done) { + console.info('testRouterLength START'); + let size = router.getLength(); + console.info('[router.getLength] pages stack size = ' + size); + expect(size).assertEqual('1'); + let options = { + uri : 'pages/routerPush/index' + } + let promise1 = new Promise((resolve, reject) => { + router.push(options); + resolve(); + }); + let promise2 = new Promise((resolve, reject) => { + setTimeout(() => { + console.info("testRouterLength getLength:" + router.getLength()); + expect("2").assertEqual(router.getLength()); + console.info('testRouterLength SUCCESS'); + resolve(); + }, 500); + }); + await promise1.then(() => { + return promise2; + }); + await backToIndex(); + console.info('testRouterLength END'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASICABILITY_JS_API_0800 + * @tc.name testRouterGetState + * @tc.desc Get the status information of the current page. + */ + it('testRouterGetState', 0, async function (done) { + console.info('testRouterGetState START'); + await setTimeout(() => { + let page = router.getState(); + console.info('[router.getState] index: ' + page.index); + console.info('[router.getState] name: ' + page.name); + console.info('[router.getState] path: ' + page.path); + expect(page.index).assertEqual(1); + expect(page.name).assertEqual('index'); + expect(page.path).assertEqual('pages/index/'); + console.info('testRouterGetState END'); + done(); + }, 500); + }); + + /** + * @tc.number SUB_ACE_BASICABILITY_JS_API_0900 + * @tc.name testPromptShowToast + * @tc.desc Show text pop-up window. + */ + it('testPromptShowToast', 0, function () { + try{ + console.info('testPromptShowToast START'); + const delay = 5000; + prompt.showToast({ + message: 'message', + duration: delay, + }); + expect(test).assertEqual('success'); + console.info('[prompt.showToast] success'); + console.info('testPromptShowToast END'); + } + catch(e){ + console.log('testPromptShowToast ERROR' + e); + } + }); + + /** + * @tc.number SUB_ACE_BASICABILITY_JS_API_1000 + * @tc.name testPromptDialog + * @tc.desc Display the dialog box in the page. + */ + it('testPromptDialog', 0, function () { + console.info('testPromptDialog START') + try{ + prompt.showDialog({ + title: 'dialog showDialog test', + message: 'message of dialog', + buttons: [ + { + text: 'OK', + color: '#0000ff', + index: 0 + } + ], + success: function (ret) { + console.info("[prompt.showDialog] ret.index " + ret.index); + expect(testResult).toBeTrue(); + }, + cancel: function () { + console.log('[prompt.showDialog] dialog cancel callback'); + expect(testResultFail).toBeTrue(); + }, + complete: function () { + console.log('[prompt.showDialog] complete'); + } + }); + console.info('testPromptDialog END'); + } + catch(e) { + console.info('testPromptDialog error ' + e); + } + }); + + /** + * @tc.number SUB_ACE_BASICABILITY_JS_API_1100 + * @tc.name testConfigurationGetLocale + * @tc.desc Get the current language and region of the app. Synchronize with the language and region. + */ + it('testConfigurationGetLocale', 0, function () { + console.info('testConfigurationGetLocale START'); + const localeInfo = configuration.getLocale(); + console.info("[configuration.getLocale] localeInfo: " + JSON.stringify(localeInfo)); + console.info("[configuration.getLocale] language: " + localeInfo.language); + console.info("[configuration.getLocale] countryOrRegion: " + localeInfo.countryOrRegion); + console.info("[configuration.getLocale] dir: " + localeInfo.dir); + expect(localeInfo.language).assertEqual('zh'); + expect(localeInfo.dir).assertEqual('ltr'); + console.info('testConfigurationGetLocale END'); + }); + + /** + * @tc.number SUB_ACE_BASICABILITY_JS_API_1200 + * @tc.name testSetTimeout + * @tc.desc Set up a timer that executes a function or a specified piece of code after the timer expires. + */ + it('testSetTimeout', 0, async function (done) { + console.info('testSetTimeout START'); + let startTime = new Date().getTime(); + const delay = 200; + await setTimeout(function (v1, v2) { + let endTime = new Date().getTime(); + console.info("[setTimeout] startTime: " + startTime); + console.info("[setTimeout] endTime: " + endTime); + console.info('[setTimeout] delay: ' + (endTime - startTime)); + console.info('[setTimeout] v1: ' + v1); + console.info('[setTimeout] v2: ' + v2); + expect('test').assertEqual(v1); + expect('message').assertEqual(v2); + expect(endTime - startTime >= delay).assertTrue(); + console.info('testSetTimeout END'); + done(); + }, delay, 'test', 'message'); + }); + + /** + * @tc.number SUB_ACE_BASICABILITY_JS_API_1300 + * @tc.name testClearTimeout + * @tc.desc The timer previously established by calling setTimeout() is cancelled. + */ + it('testClearTimeout', 0, async function (done) { + console.info('testClearTimeout START'); + let res = 0; + let timeoutID = setTimeout(function () { + res++; + }, 700); + await setTimeout(function () { + console.info('testClearTimeout delay 0.5s') + clearTimeout(timeoutID); + console.info("[clearTimeout] success"); + }, 500); + await setTimeout(function () { + expect(0).assertEqual(res); + console.info('testClearTimeout END'); + done(); + }, 1000); + }); + + /** + * @tc.number SUB_ACE_BASICABILITY_JS_API_1400 + * @tc.name testSetInterval + * @tc.desc Call a function or execute a code segment repeatedly, with a fixed time delay between each call. + */ + it('testSetInterval', 0, async function (done) { + console.info('testSetInterval START'); + let res = 0; + let intervalID = setInterval(function () { + res++; + }, 100); + await setTimeout(function () { + expect(9).assertEqual(res); + console.info('testSetInterval SUCCESS'); + clearInterval(intervalID); + console.info('testSetInterval END'); + done(); + }, 1000); + }); + + + /** + * @tc.number SUB_ACE_BASICABILITY_JS_API_1500 + * @tc.name testRequestAnimationFrame + * @tc.desc Sets a vsync after which a function will be executed. + */ + it('testRequestAnimationFrame', 0, async function (done) { + console.info('testRequestAnimationFrame START'); + let requestId = requestAnimationFrame(function () { + console.info('testRequestAnimationFrame success'); + expect(true).assertTrue(); + done(); + }); + }); + + /** + * @tc.number SUB_ACE_BASICABILITY_JS_API_1600 + * @tc.name testCancelAnimationFrame + * @tc.desc Indicates the vsync callback ID returned by "requestAnimationFrame()". + */ + it('testCancelAnimationFrame', 0, async function (done) { + console.info('testCancelAnimationFrame START'); + let result = true; + let requestId = requestAnimationFrame(function () { + console.info('testCancelAnimationFrame fail'); + result = false; + }); + cancelAnimationFrame(requestId); + await setTimeout(function () { + expect(result).assertTrue(); + done(); + }, 1000); + }); + }); +} diff --git a/arkui/ace_js_attribute_api/src/main/js/test/commonComponentJsApi.test.js b/arkui/ace_js_attribute_api/src/main/js/test/commonComponentJsApi.test.js new file mode 100644 index 0000000000000000000000000000000000000000..0e959c6a81569a9df60b11b14a0bf8a758d6e3be --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/test/commonComponentJsApi.test.js @@ -0,0 +1,248 @@ +/* + * 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'; + + +export default function aceJsApiAndAttr() { +describe('aceJsApiAndAttr', function () { + + async function sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, time) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + async function backToIndex() { + let backToIndexPromise = new Promise((resolve, reject) => { + setTimeout(() => { + router.back({ + uri: 'pages/index/index' + }); + resolve(); + }, 500); + }); + let clearPromise = new Promise((resolve, reject) => { + setTimeout(() => { + router.clear(); + resolve(); + }, 500); + }); + await backToIndexPromise.then(() => { + return clearPromise; + }); + } + + /** + * run after testcase + */ + afterEach(async function () { + console.info('[aceJsTest] after each called') + await backToIndex(); + await sleep(5000) + }); + + /** + * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0100 + * @tc.name testVideoComponent + * @tc.desc ACE + */ + it('testVideoComponent', 0, async function (done) { + let result; + let options = { + uri: 'pages/video/router/index' + } + try { + result = router.push(options) + console.info("push video page success " + JSON.stringify(result)); + } catch (err) { + console.error("push video page error " + JSON.stringify(result)); + } + await sleep(5000) + let pages = router.getState(); + console.info("[router.video] getState" + JSON.stringify(pages)); + expect("pages/video/router/").assertEqual(pages.path); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0200 + * @tc.name testAnimateComponent + * @tc.desc ACE + */ + it('testAnimateComponent', 0, async function (done) { + let result; + let options = { + uri: 'pages/animate/router/index' + } + try { + result = router.push(options) + console.info("push animate page success " + JSON.stringify(result)); + } catch (err) { + console.error("push animate page error " + JSON.stringify(result)); + } + await sleep(5000) + let pages = router.getState(); + console.info("[router.animate] getState" + JSON.stringify(pages)); + expect("pages/animate/router/").assertEqual(pages.path); + done(); + }); + + + /** + * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0300 + * @tc.name testCameraComponent + * @tc.desc ACE + */ + it('testCameraComponent', 0, async function (done) { + let result; + let options = { + uri: 'pages/camera/router/index' + } + try { + result = router.push(options) + console.info("push camera page success " + JSON.stringify(result)); + } catch (err) { + console.error("push camera page error " + JSON.stringify(result)); + } + await sleep(5000) + let pages = router.getState(); + console.info("[router.camera] getState" + JSON.stringify(pages)); + expect("pages/camera/router/").assertEqual(pages.path); + done(); + }); + + + /** + * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0400 + * @tc.name testCanvasComponent + * @tc.desc ACE + */ + it('testCanvasComponent', 0, async function (done) { + let result; + let options = { + uri: 'pages/canvas/router/index' + } + try { + result = router.push(options) + console.info("push canvas page success " + JSON.stringify(result)); + } catch (err) { + console.error("push canvas page error " + JSON.stringify(result)); + } + await sleep(5000) + let pages = router.getState(); + console.info("[router.canvas] getState" + JSON.stringify(pages)); + expect("pages/canvas/router/").assertEqual(pages.path); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0500 + * @tc.name testDivComponent + * @tc.desc ACE + */ + it('testDivComponent', 0, async function (done) { + let result; + let options = { + uri: 'pages/div/router/index' + } + try { + result = router.push(options) + console.info("push div page success " + JSON.stringify(result)); + } catch (err) { + console.error("push div page error " + JSON.stringify(result)); + } + await sleep(5000) + let pages = router.getState(); + console.info("[router.div] getState" + JSON.stringify(pages)); + expect("pages/div/router/").assertEqual(pages.path); + done(); + }); + + + /** + * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0600 + * @tc.name testInputComponent + * @tc.desc ACE + */ + it('testInputComponent', 0, async function (done) { + let result; + let options = { + uri: 'pages/input/router/index' + } + try { + result = router.push(options) + console.info("push input page success " + JSON.stringify(result)); + } catch (err) { + console.error("push input page error " + JSON.stringify(result)); + } + await sleep(5000) + let pages = router.getState(); + console.info("[router.input] getState" + JSON.stringify(pages)); + expect("pages/input/router/").assertEqual(pages.path); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0700 + * @tc.name testListComponent + * @tc.desc ACE + */ + it('testListComponent', 0, async function (done) { + let result; + let options = { + uri: 'pages/list/router/index' + } + try { + result = router.push(options) + console.info("push list page success " + JSON.stringify(result)); + } catch (err) { + console.error("push list page error " + JSON.stringify(result)); + } + await sleep(5000) + let pages = router.getState(); + console.info("[router.list] getState" + JSON.stringify(pages)); + expect("pages/list/router/").assertEqual(pages.path); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_COMPONENT_JS_API_0800 + * @tc.name testTextComponent + * @tc.desc ACE + */ + it('testTextComponent', 0, async function (done) { + let result; + let options = { + uri: 'pages/text/router/index' + } + try { + result = router.push(options) + console.info("push text page success " + JSON.stringify(result)); + } catch (err) { + console.error("push text page error " + JSON.stringify(result)); + } + await sleep(5000) + let pages = router.getState(); + console.info("[router.text] getState" + JSON.stringify(pages)); + expect("pages/text/router/").assertEqual(pages.path); + done(); + }); +}); +} diff --git a/arkui/ace_js_attribute_api/src/main/js/test/mediaquery.test.js b/arkui/ace_js_attribute_api/src/main/js/test/mediaquery.test.js new file mode 100644 index 0000000000000000000000000000000000000000..dc63ba2fac14b77daaa7377c2c7e6b32b0320af9 --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/js/test/mediaquery.test.js @@ -0,0 +1,273 @@ +/* + * 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 mediaquery from '@system.mediaquery'; + +export default function mediaqueryTest() { +describe('mediaqueryTest', function() { + let testResult; + let test; + beforeAll(function() { + testResult = false; + test="success" + }); + + it('addListener', 0, function() { + console.info('MediaQuery addListener start'); + var mMediaQueryList = mediaquery.matchMedia('(min-height:0)'); +// mMediaQueryList.onreadystatechange = function(){ + function minWidthMatch(e){ + if(e.matches){ + //do something + expect(e.matches).assertEqual(true); + console.info('MediaQuery addListener success'); + expect(test).assertEqual('success'); + } + else{ + expect(e.matches).assertEqual(true); + console.info('MediaQuery addListener fail'); + expect(test).assertEqual('fail'); + } + } + + mMediaQueryList.addListener(minWidthMatch) + console.info('MediaQuery addListener end'); + // } + }); + + it('matchMedia', 0, function() { + console.info('matchMedia start'); + var mMediaQueryList = mediaquery.matchMedia('(min-height:0)'); + var med = mMediaQueryList.media + console.info("media:"+med) + mMediaQueryList.onchange = function(){ + console.info('MediaQuery detonate onchange') + } + function minWidthMatch(e){ + if(e.matches){ + console.info("MediaQuery matches:"+e.matches) + console.info("MediaQuery onchangeMessage:"+e.onchange) + console.info('MediaQuery matchMedia success'); + expect(test).assertEqual('success'); + } + else{ + console.info('MediaQuery matchMedia fail'); + expect(test).assertEqual('fail'); + } + console.info('MediaQuery matchMedia end'); + } + mMediaQueryList.addListener(minWidthMatch); + }); + + it('orientation', 0, function() { + console.info('orientation test start'); + var mMediaQueryList = mediaquery.matchMedia('(orientation:landscape)'); + var med = mMediaQueryList.media + console.info("orientation onchangeMessage:"+mMediaQueryList.onchange) + function orientationMatch(e){ + if(e.matches){ + //do something + console.info("MediaQuery orientation matches:"+e.matches) + console.info('MediaQuery orientation success'); + expect(test).assertEqual('success'); + } + else{ + console.info('MediaQuery orientation fail'); + expect(test).assertEqual('fail'); + } + } + mMediaQueryList.addListener(orientationMatch) + console.info('MediaQuery orientation test end') + }); + + it('rmeoveListener', 0, function() { + console.info('rmeoveListener start'); + var mMediaQueryList = mediaquery.matchMedia('(max-width:466)'); + function maxWidthMatch(e){ + if(e.matches){ + //do something + console.info('MediaQuery rmeoveListener success'); + expect(test).assertEqual('success'); + } + else{ + console.info('MediaQuery rmeoveListener fail'); + expect(test).assertEqual('fail'); + } + } + mMediaQueryList.addListener(maxWidthMatch) + mMediaQueryList.removeListener(maxWidthMatch) + console.info('MediaQuery removeListener end') + }); + + it('maxHeight', 0, function() { + console.info('maxHeight start'); + var mMediaQueryList = mediaquery.matchMedia('(max-width:10000)'); +// mMediaQueryList.onreadystatechange = function(){ + function maxHeightMatch(e){ + if(e.matches){ + //do something + console.info('MediaQuery maxHeight success'); + expect(test).assertEqual('success'); + } + else{ + console.info('MediaQuery maxHeight fail'); + expect(test).assertEqual('fail'); + } + } + // } + + mMediaQueryList.addListener(maxHeightMatch) + console.info('MediaQuery maxHeight end') + }); + + it('deviceType', 0, function() { + console.info('deviceType start'); + var mMediaQueryList = mediaquery.matchMedia('(deviceType:phone)'); + function deviceTypeMatch(e){ + if(e.matches){ + //do something + console.info('MediaQuery deviceType success'); + expect(test).assertEqual('success'); + } + else{ + console.info('MediaQuery deviceType fail'); + expect(test).assertEqual('fail'); + } + } + mMediaQueryList.addListener(deviceTypeMatch) + console.info('MediaQuery deviceType end') + }); + + it('logicOnly', 0, function() { + console.info('MediaQuery logicOnly start'); + var mMediaQueryList = mediaquery.matchMedia('only screen and(deviceType:phone)and(max-height:100000)'); +// mMediaQueryList.onreadystatechange = function(){ + function logicOnlyMatch(e){ + if(e.matches){ + //do something + console.info('MediaQuery logicOnly success'); + expect(test).assertEqual('success'); + } + else{ + console.info('MediaQuery logicOnly fail'); + expect(test).assertEqual('fail'); + } + } + mMediaQueryList.addListener(logicOnlyMatch) + console.info('MediaQuery logicOnly end') + //} + }); + + it('logicNot', 0, function() { + console.info('logicOnly start'); + var mMediaQueryList = mediaquery.matchMedia('not screen and(deviceType:tv)'); +// mMediaQueryList.onreadystatechange = function(){ + function logicNotMatch(e){ + if(e.matches){ + //do something + console.info('MediaQuery logicNot success'); + expect(test).assertEqual('success'); + } + else{ + console.info('MediaQuery logicNot fail'); + expect(test).assertEqual('fail'); + } + } + mMediaQueryList.addListener(logicNotMatch) + console.info('MediaQuery logicNot end') + //} + }); + + it('logicAnd', 0, function() { + console.info('MediaQuery logicAnd start'); + var mMediaQueryList = mediaquery.matchMedia('screen and(deviceType:phone)'); + function logicAndMatch(e){ + if(e.matches){ + //do something + expect(e.matches).assertEqual(true) + console.info('MediaQuery logicAnd success'); + expect(test).assertEqual('success'); + } + else{ + expect(e.matches).assertEqual(true) + console.info('MediaQuery logicAnd fail'); + expect(test).assertEqual('fail'); + } + } + mMediaQueryList.addListener(logicAndMatch) + console.info('MediaQuery logicAnd end') + }); + + it('logicComma', 0, function() { + console.info('MediaQuery logicComma start'); + var mMediaQueryList = mediaquery.matchMedia('screen and(min-height:0),(round-screen:true)'); + function logicCommaMatch(e){ + if(e.matches){ + //do something + expect(e.matches).assertEqual(true) + console.info('MediaQuery logicComma success'); + expect(test).assertEqual('success'); + } + else{ + expect(e.matches).assertEqual(true) + console.info('MediaQuery logicComma fail'); + expect(test).assertEqual('fail'); + } + } + mMediaQueryList.addListener(logicCommaMatch) + console.info('MediaQuery logicComma end') + }); + + it('logicOr', 0, function() { + console.info('MediaQuery logicOr start'); + var mMediaQueryList = mediaquery.matchMedia('screen and(max-device-height:2000)or(round-screen:true)'); + function logicOrMatch(e){ + if(e.matches){ + //do something + expect(e.matches).assertEqual(true) + console.info('MediaQuery logicOr success'); + expect(test).assertEqual('success'); + } + else{ + expect(e.matches).assertEqual(true) + console.info('MediaQuery logicOr fail'); + expect(test).assertEqual('fail'); + } + } + mMediaQueryList.addListener(logicOrMatch) + console.info('MediaQuery logicOr end') + }); + + it('logic1', 0, function() { + console.info('MediaQuery logic>= start'); + var mMediaQueryList = mediaquery.matchMedia('screen and(height>=0)'); + function logicOrMatch(e){ + if(e.matches){ + //do something + expect(e.matches).assertEqual(true) + console.info('MediaQuery logic>= success'); + expect(test).assertEqual('success'); + } + else{ + expect(e.matches).assertEqual(true) + console.info('MediaQuery logic>= fail'); + expect(test).assertEqual('fail'); + } + } + mMediaQueryList.addListener(logicOrMatch) + console.info('MediaQuery logic>= end') + }) +});} diff --git a/arkui/ace_js_attribute_api/src/main/resources/base/element/string.json b/arkui/ace_js_attribute_api/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2b0fb1fdde9686a3af8ddab18f312beb1144cb8f --- /dev/null +++ b/arkui/ace_js_attribute_api/src/main/resources/base/element/string.json @@ -0,0 +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" + } + ] +} diff --git a/arkui/ace_js_attribute_api/src/main/resources/base/media/icon.png b/arkui/ace_js_attribute_api/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_js_attribute_api/src/main/resources/base/media/icon.png differ diff --git a/arkui/ace_js_attribute_api/src/main/resources/base/media/icon_small.png b/arkui/ace_js_attribute_api/src/main/resources/base/media/icon_small.png new file mode 100644 index 0000000000000000000000000000000000000000..0ed5fea2de303364c18c00d93370d8d24ef70f08 Binary files /dev/null and b/arkui/ace_js_attribute_api/src/main/resources/base/media/icon_small.png differ diff --git a/arkui/ace_napi_test/BUILD.gn b/arkui/ace_napi_test/BUILD.gn index 67188778f391f7dde9c2f5ad0e322ae07204ce7a..6e54dc3bc55e746061794ae898d5b841496af14f 100644 --- a/arkui/ace_napi_test/BUILD.gn +++ b/arkui/ace_napi_test/BUILD.gn @@ -25,7 +25,7 @@ ohos_js_hap_suite("ActsAceNapiEtsTest") { hap_name = "ActsAceNapiEtsTest" subsystem_name = "arkui" part_name = "napi" - shared_libraries = [ "./entry/src/main/cpp:teststring" ] + shared_libraries = [ "./entry/src/main/cpp:napitest" ] } ohos_js_assets("ace_third_ets_assets") { diff --git a/arkui/ace_napi_test/entry/src/main/config.json b/arkui/ace_napi_test/entry/src/main/config.json index 0ebfbc4cfb670c2ac3dc027f750dff3241c70295..569bc2f01bac432578c49e7c426d4ae852b65cc8 100644 --- a/arkui/ace_napi_test/entry/src/main/config.json +++ b/arkui/ace_napi_test/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": "com.acts.ace.napitest.MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/arkui/ace_napi_test/entry/src/main/cpp/BUILD.gn b/arkui/ace_napi_test/entry/src/main/cpp/BUILD.gn index 8002ab1bf1f0ead1c684e3b6139edd97fc3b6c73..22b5e758da95e7e5027f4b76e9a8e2c72e592a9a 100644 --- a/arkui/ace_napi_test/entry/src/main/cpp/BUILD.gn +++ b/arkui/ace_napi_test/entry/src/main/cpp/BUILD.gn @@ -29,8 +29,8 @@ config("config") { config("public_config") { } -ohos_shared_library("teststring") { - sources = [ "./napi/test_string.cpp" ] +ohos_shared_library("napitest") { + sources = [ "./napi/napi_test.cpp" ] if (!(product_name == "m40")) { if (target_cpu == "arm") { libs = [ "${clang_base_path}/../libcxx-ndk/lib/arm-linux-ohos/c++/libc++_shared.so" ] diff --git a/arkui/ace_napi_test/entry/src/main/cpp/napi/napi_test.cpp b/arkui/ace_napi_test/entry/src/main/cpp/napi/napi_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1e4ed6ac3d5a8558aa371b9fc53bd3b231c2c4f4 --- /dev/null +++ b/arkui/ace_napi_test/entry/src/main/cpp/napi/napi_test.cpp @@ -0,0 +1,1393 @@ +/* + * 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 "common/native_common.h" +#include "napi/native_api.h" +#include +#include +#include +#include + +static bool exceptionWasPending = false; +static napi_ref test_reference = NULL; +static int test_value = 1; +static napi_deferred deferred = NULL; + +static void add_returned_status(napi_env env, + const char* key, + napi_value object, + const char* expected_message, + napi_status expected_status, + napi_status actual_status) { + char napi_message_string[100] = ""; + napi_value prop_value; + + if (actual_status != expected_status) { + snprintf(napi_message_string, sizeof(napi_message_string), "Invalid status [%d]", actual_status); + } + + NAPI_CALL_RETURN_VOID(env, + napi_create_string_utf8(env, + (actual_status == expected_status ? + expected_message : + napi_message_string), + NAPI_AUTO_LENGTH, + &prop_value)); + NAPI_CALL_RETURN_VOID(env, + napi_set_named_property(env, + object, + key, + prop_value)); +} + +static void add_last_status(napi_env env, const char* key, napi_value return_value) { + napi_value prop_value; + const napi_extended_error_info* p_last_error; + NAPI_CALL_RETURN_VOID(env, napi_get_last_error_info(env, &p_last_error)); + + NAPI_CALL_RETURN_VOID(env, + napi_create_string_utf8(env, + (p_last_error->error_message == NULL ? + "napi_ok" : + p_last_error->error_message), + NAPI_AUTO_LENGTH, + &prop_value)); + NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, + return_value, + key, + prop_value)); +} + +static napi_value getLastErrorInfo(napi_env env, napi_callback_info info) { + napi_value value; + NAPI_CALL(env, napi_create_string_utf8(env, "xyz", 3, &value)); + double double_value; + napi_status status = napi_get_value_double(env, value, &double_value); + NAPI_ASSERT(env, status != napi_ok, "Failed to produce error condition"); + const napi_extended_error_info * error_info = 0; + NAPI_CALL(env, napi_get_last_error_info(env, &error_info)); + + NAPI_ASSERT(env, error_info->error_code == status, + "Last error info code should match last status"); + NAPI_ASSERT(env, error_info->error_message, + "Last error info message should not be null"); + return NULL; +} + +static napi_value cleanUpErrorInfo(napi_env env, napi_callback_info info) { + const napi_extended_error_info * error_info = 0; + NAPI_CALL(env, napi_get_last_error_info(env, &error_info)); + + napi_value result; + bool is_ok = error_info->error_code == napi_ok; + NAPI_CALL(env, napi_get_boolean(env, is_ok, &result)); + + return result; +} + +static napi_value throwExistingError(napi_env env, napi_callback_info info) { + napi_value message; + napi_value error; + NAPI_CALL(env, napi_create_string_utf8(env, "existing error", NAPI_AUTO_LENGTH, &message)); + NAPI_CALL(env, napi_create_error(env, NULL, message, &error)); + NAPI_CALL(env, napi_throw(env, error)); + return NULL; +} + +static napi_value throwError(napi_env env, napi_callback_info info) { + NAPI_CALL(env, napi_throw_error(env, NULL, "error")); + return NULL; +} + +static napi_value throwTypeError(napi_env env, napi_callback_info info) { + NAPI_CALL(env, napi_throw_type_error(env, NULL, "type error")); + return NULL; +} + +static napi_value throwRangeError(napi_env env, napi_callback_info info) { + NAPI_CALL(env, napi_throw_range_error(env, NULL, "range error")); + return NULL; +} + +static napi_value isError(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + bool r; + NAPI_CALL(env, napi_is_error(env, args[0], &r)); + + napi_value result; + NAPI_CALL(env, napi_get_boolean(env, r, &result)); + + return result; +} + +static napi_value createError(napi_env env, napi_callback_info info) { + napi_value result; + napi_value message; + NAPI_CALL(env, napi_create_string_utf8(env, "error", NAPI_AUTO_LENGTH, &message)); + NAPI_CALL(env, napi_create_error(env, NULL, message, &result)); + return result; +} + +static napi_value createTypeError(napi_env env, napi_callback_info info) { + napi_value result; + napi_value message; + NAPI_CALL(env, napi_create_string_utf8(env, "type error", NAPI_AUTO_LENGTH, &message)); + NAPI_CALL(env, napi_create_type_error(env, NULL, message, &result)); + return result; +} + +static napi_value createRangeError(napi_env env, napi_callback_info info) { + napi_value result; + napi_value message; + NAPI_CALL(env, napi_create_string_utf8(env, "range error", NAPI_AUTO_LENGTH, &message)); + NAPI_CALL(env, napi_create_range_error(env, NULL, message, &result)); + return result; +} + +static napi_value getAndClearLastException(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + napi_value global; + NAPI_CALL(env, napi_get_global(env, &global)); + + napi_value result; + napi_status status = napi_call_function(env, global, args[0], 0, 0, &result); + if (status == napi_pending_exception) { + napi_value ex; + NAPI_CALL(env, napi_get_and_clear_last_exception(env, &ex)); + return ex; + } + return NULL; +} + +static napi_value isExceptionPending(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + napi_value global; + NAPI_CALL(env, napi_get_global(env, &global)); + + napi_value result; + napi_call_function(env, global, args[0], 0, 0, &result); + + NAPI_CALL(env, napi_is_exception_pending(env, &exceptionWasPending)); + return NULL; +} + +static napi_value openAndCloseHandleScope(napi_env env, napi_callback_info info) { + napi_handle_scope scope; + napi_value output = NULL; + + NAPI_CALL(env, napi_open_handle_scope(env, &scope)); + NAPI_CALL(env, napi_create_object(env, &output)); + NAPI_CALL(env, napi_close_handle_scope(env, scope)); + return NULL; +} + +static napi_value openAndCloseEscapableHandleScope(napi_env env, napi_callback_info info) { + napi_escapable_handle_scope scope; + napi_value output = NULL; + napi_value escapee = NULL; + + NAPI_CALL(env, napi_open_escapable_handle_scope(env, &scope)); + NAPI_CALL(env, napi_create_object(env, &output)); + NAPI_CALL(env, napi_escape_handle(env, scope, output, &escapee)); + NAPI_CALL(env, napi_close_escapable_handle_scope(env, scope)); + return escapee; +} + +static napi_value createReference(napi_env env, napi_callback_info info) { + NAPI_ASSERT(env, test_reference == NULL, + "The test allows only one reference at a time."); + + size_t argc = 2; + napi_value args[2]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + NAPI_ASSERT(env, argc == 2, "Expected two arguments."); + + uint32_t initial_refcount; + NAPI_CALL(env, napi_get_value_uint32(env, args[1], &initial_refcount)); + + NAPI_CALL(env, + napi_create_reference(env, args[0], initial_refcount, &test_reference)); + + NAPI_ASSERT(env, test_reference != NULL, + "A reference should have been created."); + + return NULL; +} + +static napi_value deleteReference(napi_env env, napi_callback_info info) { + NAPI_ASSERT(env, test_reference != NULL, + "A reference must have been created."); + + NAPI_CALL(env, napi_delete_reference(env, test_reference)); + test_reference = NULL; + return NULL; +} + +static napi_value referenceRef(napi_env env, napi_callback_info info) { + NAPI_ASSERT(env, test_reference != NULL, + "A reference must have been created."); + + uint32_t refcount; + NAPI_CALL(env, napi_reference_ref(env, test_reference, &refcount)); + + napi_value result; + NAPI_CALL(env, napi_create_uint32(env, refcount, &result)); + return result; +} + +static napi_value referenceUnref(napi_env env, napi_callback_info info) { + NAPI_ASSERT(env, test_reference != NULL, + "A reference must have been created."); + + uint32_t refcount; + NAPI_CALL(env, napi_reference_unref(env, test_reference, &refcount)); + + napi_value result; + NAPI_CALL(env, napi_create_uint32(env, refcount, &result)); + return result; +} + +static napi_value getReferenceValue(napi_env env, napi_callback_info info) { + NAPI_ASSERT(env, test_reference != NULL, + "A reference must have been created."); + + napi_value result; + NAPI_CALL(env, napi_get_reference_value(env, test_reference, &result)); + return result; +} + +static napi_value createArrayAndGetLength(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + NAPI_ASSERT(env, argc >= 1, "Wrong number of arguments"); + + napi_valuetype valuetype0; + NAPI_CALL(env, napi_typeof(env, args[0], &valuetype0)); + + NAPI_ASSERT(env, valuetype0 == napi_object, + "Wrong type of arguments. Expects an array as first argument."); + + napi_value ret; + NAPI_CALL(env, napi_create_array(env, &ret)); + + uint32_t i, length; + NAPI_CALL(env, napi_get_array_length(env, args[0], &length)); + + for (i = 0; i < length; i++) { + napi_value e; + NAPI_CALL(env, napi_get_element(env, args[0], i, &e)); + NAPI_CALL(env, napi_set_element(env, ret, i, e)); + } + + return ret; +} + +static napi_value getArrayWithLength(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + NAPI_ASSERT(env, argc >= 1, "Wrong number of arguments"); + + napi_valuetype valuetype0; + NAPI_CALL(env, napi_typeof(env, args[0], &valuetype0)); + + NAPI_ASSERT(env, valuetype0 == napi_number, + "Wrong type of arguments. Expects an integer the first argument."); + + int32_t array_length; + NAPI_CALL(env, napi_get_value_int32(env, args[0], &array_length)); + + napi_value ret; + NAPI_CALL(env, napi_create_array_with_length(env, array_length, &ret)); + + return ret; +} + +static void finalizer(napi_env env, void * data, void * hint) { + NAPI_CALL_RETURN_VOID(env, + napi_throw_error(env, NULL, "Error during Finalize")); +} + +static napi_value createExternal(napi_env env, napi_callback_info info) { + napi_value external; + + NAPI_CALL(env, + napi_create_external(env, NULL, finalizer, NULL, &external)); + + return external; +} + +static napi_value createExternalArraybuffer(napi_env env, napi_callback_info info) { + static void* data = NULL; + napi_value arraybuffer; + NAPI_CALL(env, + napi_create_external_arraybuffer(env, data, 0, NULL, NULL, &arraybuffer)); + return arraybuffer; +} + +static napi_value createObject(napi_env env, napi_callback_info info) { + napi_value ret; + NAPI_CALL(env, napi_create_object(env, &ret)); + + napi_value num; + NAPI_CALL(env, napi_create_int32(env, 987654321, &num)); + + NAPI_CALL(env, napi_set_named_property(env, ret, "test_number", num)); + + napi_value str; + const char* str_val = "test string"; + size_t str_len = strlen(str_val); + NAPI_CALL(env, napi_create_string_utf8(env, str_val, str_len, &str)); + + NAPI_CALL(env, napi_set_named_property(env, ret, "test_string", str)); + + return ret; +} + +static napi_value createSymbol(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + napi_value description = NULL; + if (argc >= 1) { + napi_valuetype valuetype; + NAPI_CALL(env, napi_typeof(env, args[0], &valuetype)); + + NAPI_ASSERT(env, valuetype == napi_string, + "Wrong type of arguments. Expects a string."); + + description = args[0]; + } + + napi_value symbol; + NAPI_CALL(env, napi_create_symbol(env, description, &symbol)); + + return symbol; +} + +static napi_value createTypeArray(napi_env env, napi_callback_info info) { + static int8_t externalData[] = { 0, 1, 2 }; + + napi_value output_buffer; + NAPI_CALL(env, napi_create_external_arraybuffer(env, + externalData, + sizeof(externalData), + NULL, // finalize_callback + NULL, // finalize_hint + &output_buffer)); + + napi_value output_array; + NAPI_CALL(env, napi_create_typedarray(env, + napi_int8_array, + sizeof(externalData) / sizeof(int8_t), + output_buffer, + 0, + &output_array)); + + return output_array; +} + +static napi_value createDataView(napi_env env, napi_callback_info info) { + size_t argc = 3; + napi_value args [3]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + NAPI_ASSERT(env, argc == 3, "Wrong number of arguments"); + + napi_valuetype valuetype0; + napi_value arraybuffer = args[0]; + + NAPI_CALL(env, napi_typeof(env, arraybuffer, &valuetype0)); + NAPI_ASSERT(env, valuetype0 == napi_object, + "Wrong type of arguments. Expects a ArrayBuffer as the first " + "argument."); + + bool is_arraybuffer; + NAPI_CALL(env, napi_is_arraybuffer(env, arraybuffer, &is_arraybuffer)); + NAPI_ASSERT(env, is_arraybuffer, + "Wrong type of arguments. Expects a ArrayBuffer as the first " + "argument."); + + napi_valuetype valuetype1; + NAPI_CALL(env, napi_typeof(env, args[1], &valuetype1)); + + NAPI_ASSERT(env, valuetype1 == napi_number, + "Wrong type of arguments. Expects a number as second argument."); + + size_t byte_offset = 0; + NAPI_CALL(env, napi_get_value_uint32(env, args[1], (uint32_t*)(&byte_offset))); + + napi_valuetype valuetype2; + NAPI_CALL(env, napi_typeof(env, args[2], &valuetype2)); + + NAPI_ASSERT(env, valuetype2 == napi_number, + "Wrong type of arguments. Expects a number as third argument."); + + size_t length = 0; + NAPI_CALL(env, napi_get_value_uint32(env, args[2], (uint32_t*)(&length))); + + napi_value output_dataview; + NAPI_CALL(env, + napi_create_dataview(env, length, arraybuffer, + byte_offset, &output_dataview)); + + return output_dataview; +} + +static napi_value createAndGetInt32(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + int32_t value; + NAPI_CALL(env, napi_get_value_int32(env, args[0], &value)); + + napi_value output; + NAPI_CALL(env, napi_create_int32(env, value, &output)); + + return output; +} + +static napi_value createAndGetUInt32(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + uint32_t value; + NAPI_CALL(env, napi_get_value_uint32(env, args[0], &value)); + + napi_value output; + NAPI_CALL(env, napi_create_uint32(env, value, &output)); + + return output; +} + +static napi_value createAndGetInt64(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + int64_t value; + NAPI_CALL(env, napi_get_value_int64(env, args[0], &value)); + + napi_value output; + NAPI_CALL(env, napi_create_int64(env, (double)value, &output)); + + return output; +} + +static napi_value createDouble(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + double value; + NAPI_CALL(env, napi_get_value_double(env, args[0], &value)); + + napi_value output; + NAPI_CALL(env, napi_create_double(env, value, &output)); + + return output; +} + +static napi_value createAndGetStringLatin1(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + NAPI_ASSERT(env, argc >= 1, "Wrong number of arguments"); + + napi_valuetype valuetype; + NAPI_CALL(env, napi_typeof(env, args[0], &valuetype)); + + NAPI_ASSERT(env, valuetype == napi_string, + "Wrong type of argment. Expects a string."); + + char buffer[128]; + size_t buffer_size = 128; + size_t copied; + + NAPI_CALL(env, + napi_get_value_string_latin1(env, args[0], buffer, buffer_size, &copied)); + + napi_value output; + NAPI_CALL(env, napi_create_string_latin1(env, buffer, copied, &output)); + + return output; +} + +static napi_value createAndGetStringUtf8(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + NAPI_ASSERT(env, argc >= 1, "Wrong number of arguments"); + + napi_valuetype valuetype; + NAPI_CALL(env, napi_typeof(env, args[0], &valuetype)); + + NAPI_ASSERT(env, valuetype == napi_string, + "Wrong type of argment. Expects a string."); + + char buffer[128]; + size_t buffer_size = 128; + size_t copied; + + NAPI_CALL(env, + napi_get_value_string_utf8(env, args[0], buffer, buffer_size, &copied)); + + napi_value output; + NAPI_CALL(env, napi_create_string_utf8(env, buffer, copied, &output)); + + return output; +} + +static napi_value getPrototype(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + napi_value result; + NAPI_CALL(env, napi_get_prototype(env, args[0], &result)); + + return result; +} + +static napi_value getDataViewInfo(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args [1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + NAPI_ASSERT(env, argc == 1, "Wrong number of arguments"); + + napi_valuetype valuetype; + napi_value input_dataview = args[0]; + + NAPI_CALL(env, napi_typeof(env, input_dataview, &valuetype)); + NAPI_ASSERT(env, valuetype == napi_object, + "Wrong type of arguments. Expects a DataView as the first " + "argument."); + + bool is_dataview; + NAPI_CALL(env, napi_is_dataview(env, input_dataview, &is_dataview)); + NAPI_ASSERT(env, is_dataview, + "Wrong type of arguments. Expects a DataView as the first " + "argument."); + size_t byte_offset = 0; + size_t length = 0; + napi_value buffer; + NAPI_CALL(env, + napi_get_dataview_info(env, input_dataview, &length, NULL, + &buffer, &byte_offset)); + + napi_value output_dataview; + NAPI_CALL(env, + napi_create_dataview(env, length, buffer, + byte_offset, &output_dataview)); + + + return output_dataview; +} + +static napi_value getValueBool(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + bool value; + NAPI_CALL(env, napi_get_value_bool(env, args[0], &value)); + + napi_value output; + NAPI_CALL(env, napi_get_boolean(env, value, &output)); + + return output; +} + +static napi_value getValueDouble(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + double value; + NAPI_CALL(env, napi_get_value_double(env, args[0], &value)); + + napi_value output; + NAPI_CALL(env, napi_create_double(env, value, &output)); + + return output; +} + +static napi_value getValueExternal(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value arg; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &arg, NULL, NULL)); + + NAPI_ASSERT(env, argc == 1, "Expected one argument."); + + napi_valuetype argtype; + NAPI_CALL(env, napi_typeof(env, arg, &argtype)); + + NAPI_ASSERT(env, argtype == napi_external, "Expected an external value."); + + void* data; + NAPI_CALL(env, napi_get_value_external(env, arg, &data)); + + NAPI_ASSERT(env, data != NULL && *(int*)data == test_value, + "An external data value of 1 was expected."); + + return NULL; +} + +static napi_value getNull(napi_env env, napi_callback_info info) { + napi_value result; + NAPI_CALL(env, napi_get_null(env, &result)); + return result; +} + +static napi_value getUndefined(napi_env env, napi_callback_info info) { + napi_value result; + NAPI_CALL(env, napi_get_undefined(env, &result)); + return result; +} + +static napi_value coerceToBool(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + napi_value output; + NAPI_CALL(env, napi_coerce_to_bool(env, args[0], &output)); + + return output; +} + +static napi_value coerceToNumber(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + napi_value output; + NAPI_CALL(env, napi_coerce_to_number(env, args[0], &output)); + + return output; +} + +static napi_value coerceToObject(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + napi_value output; + NAPI_CALL(env, napi_coerce_to_object(env, args[0], &output)); + + return output; +} + +static napi_value coerceToString(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + napi_value output; + NAPI_CALL(env, napi_coerce_to_string(env, args[0], &output)); + + return output; +} + +static napi_value instanceOf(napi_env env, napi_callback_info info) { + size_t argc = 2; + napi_value args[2]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + bool instanceof; + NAPI_CALL(env, napi_instanceof(env, args[0], args[1], &instanceof)); + + napi_value result; + NAPI_CALL(env, napi_get_boolean(env, instanceof, &result)); + + return result; +} + +static napi_value isArray(napi_env env, napi_callback_info info) { + size_t argc = 2; + napi_value args[2]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + NAPI_ASSERT(env, argc >= 2, "Wrong number of arguments"); + + napi_valuetype valuetype0; + NAPI_CALL(env, napi_typeof(env, args[0], &valuetype0)); + + NAPI_ASSERT(env, valuetype0 == napi_object, + "Wrong type of arguments. Expects an array as first argument."); + + napi_valuetype valuetype1; + NAPI_CALL(env, napi_typeof(env, args[1], &valuetype1)); + + NAPI_ASSERT(env, valuetype1 == napi_number, + "Wrong type of arguments. Expects an integer as second argument."); + + napi_value array = args[0]; + int32_t index; + NAPI_CALL(env, napi_get_value_int32(env, args[1], &index)); + + NAPI_ASSERT(env, index >= 0, "Invalid index. Expects a positive integer."); + + bool isarray; + NAPI_CALL(env, napi_is_array(env, array, &isarray)); + + if (!isarray) { + return NULL; + } + + uint32_t length; + NAPI_CALL(env, napi_get_array_length(env, array, &length)); + + NAPI_ASSERT(env, ((uint32_t)index < length), "Index out of bounds!"); + + napi_value ret; + NAPI_CALL(env, napi_get_element(env, array, index, &ret)); + + return ret; +} + +static napi_value isDate(napi_env env, napi_callback_info info) { + napi_value date, result; + size_t argc = 1; + bool is_date; + + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &date, NULL, NULL)); + NAPI_CALL(env, napi_is_date(env, date, &is_date)); + NAPI_CALL(env, napi_get_boolean(env, is_date, &result)); + + return result; +} + +static napi_value strictEquals(napi_env env, napi_callback_info info) { + size_t argc = 2; + napi_value args[2]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + bool bool_result; + napi_value result; + NAPI_CALL(env, napi_strict_equals(env, args[0], args[1], &bool_result)); + NAPI_CALL(env, napi_get_boolean(env, bool_result, &result)); + + return result; +} + +static napi_value getPropertyNames(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value args[1]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + NAPI_ASSERT(env, argc >= 1, "Wrong number of arguments"); + + napi_valuetype value_type0; + NAPI_CALL(env, napi_typeof(env, args[0], &value_type0)); + + NAPI_ASSERT(env, value_type0 == napi_object, + "Wrong type of arguments. Expects an object as first argument."); + + napi_value output; + NAPI_CALL(env, napi_get_property_names(env, args[0], &output)); + + return output; +} + +static napi_value setProperty(napi_env env, + napi_callback_info info) { + napi_status status; + napi_value object, key, value; + + NAPI_CALL(env, napi_create_object(env, &object)); + + NAPI_CALL(env, napi_create_string_utf8(env, "", NAPI_AUTO_LENGTH, &key)); + + NAPI_CALL(env, napi_create_object(env, &value)); + + status = napi_set_property(NULL, object, key, value); + + add_returned_status(env, + "envIsNull", + object, + "Invalid argument", + napi_invalid_arg, + status); + + napi_set_property(env, NULL, key, value); + + add_last_status(env, "objectIsNull", object); + + napi_set_property(env, object, NULL, value); + + add_last_status(env, "keyIsNull", object); + + napi_set_property(env, object, key, NULL); + + add_last_status(env, "valueIsNull", object); + + return object; +} + +static napi_value getProperty(napi_env env, + napi_callback_info info) { + napi_status status; + napi_value object, key, result; + + NAPI_CALL(env, napi_create_object(env, &object)); + + NAPI_CALL(env, napi_create_string_utf8(env, "", NAPI_AUTO_LENGTH, &key)); + + NAPI_CALL(env, napi_create_object(env, &result)); + + status = napi_get_property(NULL, object, key, &result); + + add_returned_status(env, + "envIsNull", + object, + "Invalid argument", + napi_invalid_arg, + status); + + napi_get_property(env, NULL, key, &result); + + add_last_status(env, "objectIsNull", object); + + napi_get_property(env, object, NULL, &result); + + add_last_status(env, "keyIsNull", object); + + napi_get_property(env, object, key, NULL); + + add_last_status(env, "resultIsNull", object); + + return object; +} + +static napi_value hasProperty(napi_env env, napi_callback_info info) { + size_t argc = 2; + napi_value args[2]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + NAPI_ASSERT(env, argc >= 2, "Wrong number of arguments"); + + napi_valuetype valuetype0; + NAPI_CALL(env, napi_typeof(env, args[0], &valuetype0)); + + NAPI_ASSERT(env, valuetype0 == napi_object, + "Wrong type of arguments. Expects an object as first argument."); + + napi_valuetype valuetype1; + NAPI_CALL(env, napi_typeof(env, args[1], &valuetype1)); + + NAPI_ASSERT(env, valuetype1 == napi_string || valuetype1 == napi_symbol, + "Wrong type of arguments. Expects a string or symbol as second."); + + bool has_property; + NAPI_CALL(env, napi_has_property(env, args[0], args[1], &has_property)); + + napi_value ret; + NAPI_CALL(env, napi_get_boolean(env, has_property, &ret)); + + return ret; +} + +static napi_value deleteProperty(napi_env env, napi_callback_info info) { + size_t argc = 2; + napi_value args[2]; + + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + NAPI_ASSERT(env, argc == 2, "Wrong number of arguments"); + + napi_valuetype valuetype0; + NAPI_CALL(env, napi_typeof(env, args[0], &valuetype0)); + NAPI_ASSERT(env, valuetype0 == napi_object, + "Wrong type of arguments. Expects an object as first argument."); + + napi_valuetype valuetype1; + NAPI_CALL(env, napi_typeof(env, args[1], &valuetype1)); + NAPI_ASSERT(env, valuetype1 == napi_string || valuetype1 == napi_symbol, + "Wrong type of arguments. Expects a string or symbol as second."); + + bool result; + napi_value ret; + NAPI_CALL(env, napi_delete_property(env, args[0], args[1], &result)); + NAPI_CALL(env, napi_get_boolean(env, result, &ret)); + + return ret; +} + +static napi_value hasOwnProperty(napi_env env, napi_callback_info info) { + size_t argc = 2; + napi_value args[2]; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + NAPI_ASSERT(env, argc == 2, "Wrong number of arguments"); + + napi_valuetype valuetype0; + NAPI_CALL(env, napi_typeof(env, args[0], &valuetype0)); + + NAPI_ASSERT(env, valuetype0 == napi_object, + "Wrong type of arguments. Expects an object as first argument."); + + bool has_property; + NAPI_CALL(env, napi_has_own_property(env, args[0], args[1], &has_property)); + + napi_value ret; + NAPI_CALL(env, napi_get_boolean(env, has_property, &ret)); + + return ret; +} + +static napi_value setNamedProperty(napi_env env, napi_callback_info info) { + size_t argc = 3; + napi_value args[3]; + char key[256] = ""; + size_t key_length; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + NAPI_ASSERT(env, argc >= 3, "Wrong number of arguments"); + + napi_valuetype value_type0; + NAPI_CALL(env, napi_typeof(env, args[0], &value_type0)); + + NAPI_ASSERT(env, value_type0 == napi_object, + "Wrong type of arguments. Expects an object as first argument."); + + napi_valuetype value_type1; + NAPI_CALL(env, napi_typeof(env, args[1], &value_type1)); + + NAPI_ASSERT(env, value_type1 == napi_string, + "Wrong type of arguments. Expects a string as second."); + + NAPI_CALL(env, + napi_get_value_string_utf8(env, args[1], key, 255, &key_length)); + key[255] = 0; + NAPI_ASSERT(env, key_length <= 255, + "Cannot accommodate keys longer than 255 bytes"); + + NAPI_CALL(env, napi_set_named_property(env, args[0], key, args[2])); + + napi_value value_true; + NAPI_CALL(env, napi_get_boolean(env, true, &value_true)); + + return value_true; +} + +static napi_value getNamedProperty(napi_env env, napi_callback_info info) { + size_t argc = 2; + napi_value args[2]; + char key[256] = ""; + size_t key_length; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + NAPI_ASSERT(env, argc >= 2, "Wrong number of arguments"); + + napi_valuetype value_type0; + NAPI_CALL(env, napi_typeof(env, args[0], &value_type0)); + + NAPI_ASSERT(env, value_type0 == napi_object, + "Wrong type of arguments. Expects an object as first argument."); + + napi_valuetype value_type1; + NAPI_CALL(env, napi_typeof(env, args[1], &value_type1)); + + NAPI_ASSERT(env, value_type1 == napi_string, + "Wrong type of arguments. Expects a string as second."); + + napi_value object = args[0]; + NAPI_CALL(env, + napi_get_value_string_utf8(env, args[1], key, 255, &key_length)); + key[255] = 0; + NAPI_ASSERT(env, key_length <= 255, + "Cannot accommodate keys longer than 255 bytes"); + napi_value output; + NAPI_CALL(env, napi_get_named_property(env, object, key, &output)); + + return output; +} + +static napi_value hasNamedProperty(napi_env env, napi_callback_info info) { + size_t argc = 2; + napi_value args[2]; + char key[256] = ""; + size_t key_length; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); + + NAPI_ASSERT(env, argc >= 2, "Wrong number of arguments"); + + napi_valuetype value_type0; + NAPI_CALL(env, napi_typeof(env, args[0], &value_type0)); + + NAPI_ASSERT(env, value_type0 == napi_object, + "Wrong type of arguments. Expects an object as first argument."); + + napi_valuetype value_type1; + NAPI_CALL(env, napi_typeof(env, args[1], &value_type1)); + + NAPI_ASSERT(env, value_type1 == napi_string || value_type1 == napi_symbol, + "Wrong type of arguments. Expects a string as second."); + + NAPI_CALL(env, + napi_get_value_string_utf8(env, args[1], key, 255, &key_length)); + key[255] = 0; + NAPI_ASSERT(env, key_length <= 255, + "Cannot accommodate keys longer than 255 bytes"); + + bool has_property; + NAPI_CALL(env, napi_has_named_property(env, args[0], key, &has_property)); + + napi_value ret; + NAPI_CALL(env, napi_get_boolean(env, has_property, &ret)); + + return ret; +} + +static napi_value setElement(napi_env env, napi_callback_info info) { + napi_value return_value, object; + + NAPI_CALL(env, napi_create_object(env, &return_value)); + NAPI_CALL(env, napi_create_object(env, &object)); + + add_returned_status(env, + "envIsNull", + return_value, + "Invalid argument", + napi_invalid_arg, + napi_set_element(NULL, object, 0, object)); + + napi_set_element(env, NULL, 0, object); + add_last_status(env, "objectIsNull", return_value); + + + napi_set_property(env, object, 0, NULL); + add_last_status(env, "valueIsNull", return_value); + + return return_value; +} + +static napi_value getElement(napi_env env, napi_callback_info info) { + napi_value return_value, object, prop; + + NAPI_CALL(env, napi_create_object(env, &return_value)); + NAPI_CALL(env, napi_create_object(env, &object)); + + add_returned_status(env, + "envIsNull", + return_value, + "Invalid argument", + napi_invalid_arg, + napi_get_element(NULL, object, 0, &prop)); + + napi_get_property(env, NULL, 0, &prop); + add_last_status(env, "objectIsNull", return_value); + + napi_get_property(env, object, 0, NULL); + add_last_status(env, "valueIsNull", return_value); + + return return_value; +} + +static napi_value TestBoolValuedElementApi(napi_env env, + napi_status (* api)(napi_env, napi_value, uint32_t, bool*)) { + napi_value return_value, object; + bool result; + + NAPI_CALL(env, napi_create_object(env, &return_value)); + NAPI_CALL(env, napi_create_object(env, &object)); + + add_returned_status(env, + "envIsNull", + return_value, + "Invalid argument", + napi_invalid_arg, + api(NULL, object, 0, &result)); + + api(env, NULL, 0, &result); + add_last_status(env, "objectIsNull", return_value); + + api(env, object, 0, NULL); + add_last_status(env, "valueIsNull", return_value); + + return return_value; +} + +static napi_value hasElement(napi_env env, napi_callback_info info) { + return TestBoolValuedElementApi(env, napi_has_element); +} + +static napi_value deleteElement(napi_env env, napi_callback_info info) { + return TestBoolValuedElementApi(env, napi_delete_element); +} + +static napi_value defineProperties(napi_env env, napi_callback_info info) { + napi_value object, return_value; + + napi_property_descriptor desc = { "prop", NULL, defineProperties, NULL, NULL, NULL, napi_enumerable, NULL }; + + NAPI_CALL(env, napi_create_object(env, &object)); + NAPI_CALL(env, napi_create_object(env, &return_value)); + + add_returned_status(env, + "envIsNull", + return_value, + "Invalid argument", + napi_invalid_arg, + napi_define_properties(NULL, object, 1, &desc)); + + napi_define_properties(env, NULL, 1, &desc); + add_last_status(env, "objectIsNull", return_value); + + napi_define_properties(env, object, 1, NULL); + add_last_status(env, "descriptorListIsNull", return_value); + + desc.utf8name = NULL; + napi_define_properties(env, object, 1, NULL); + add_last_status(env, "utf8nameIsNull", return_value); + desc.utf8name = "prop"; + + desc.method = NULL; + napi_define_properties(env, object, 1, NULL); + add_last_status(env, "methodIsNull", return_value); + desc.method = defineProperties; + + return return_value; +} + +static napi_value getNewTarget(napi_env env, napi_callback_info info) { + napi_value newTargetArg; + NAPI_CALL(env, napi_get_new_target(env, info, &newTargetArg)); + napi_value thisArg; + NAPI_CALL(env, napi_get_cb_info(env, info, NULL, NULL, &thisArg, NULL)); + napi_value undefined; + NAPI_CALL(env, napi_get_undefined(env, &undefined)); + + bool result; + NAPI_CALL(env, napi_strict_equals(env, newTargetArg, thisArg, &result)); + NAPI_ASSERT(env, !result, "this !== new.target"); + + NAPI_ASSERT(env, newTargetArg != NULL, "newTargetArg != NULL"); + NAPI_CALL(env, napi_strict_equals(env, newTargetArg, undefined, &result)); + NAPI_ASSERT(env, !result, "new.target !== undefined"); + + return thisArg; +} + +static napi_value wrap(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value arg; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &arg, NULL, NULL)); + + NAPI_CALL(env, napi_wrap(env, arg, &test_value, NULL, NULL, NULL)); + return NULL; +} + +static napi_value unwrap(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value arg; + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &arg, NULL, NULL)); + + void* data; + NAPI_CALL(env, napi_unwrap(env, arg, &data)); + + bool is_expected = (data != NULL && *(int*)data == 3); + napi_value result; + NAPI_CALL(env, napi_get_boolean(env, is_expected, &result)); + return result; +} + +static napi_value removeWrap(napi_env env, napi_callback_info info) { + size_t argc = 1; + napi_value wrapped; + void* data; + + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &wrapped, NULL, NULL)); + NAPI_CALL(env, napi_remove_wrap(env, wrapped, &data)); + + return NULL; +} + +static napi_value getVersion(napi_env env, napi_callback_info info) { + uint32_t version; + napi_value result; + NAPI_CALL(env, napi_get_version(env, &version)); + NAPI_CALL(env, napi_create_uint32(env, version, &result)); + return result; +} + +static napi_value createPromise(napi_env env, napi_callback_info info) { + napi_value promise; + + // We do not overwrite an existing deferred. + if (deferred != NULL) { + return NULL; + } + + NAPI_CALL(env, napi_create_promise(env, &deferred, &promise)); + + return promise; +} + +static napi_value resolveAndRejectDeferred(napi_env env, napi_callback_info info) { + napi_value argv[2]; + size_t argc = 2; + bool resolution; + + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, NULL, NULL)); + NAPI_CALL(env, napi_get_value_bool(env, argv[1], &resolution)); + if (resolution) { + NAPI_CALL(env, napi_resolve_deferred(env, deferred, argv[0])); + } else { + NAPI_CALL(env, napi_reject_deferred(env, deferred, argv[0])); + } + + deferred = NULL; + + return NULL; +} + +static napi_value isPromise(napi_env env, napi_callback_info info) { + napi_value promise, result; + size_t argc = 1; + bool is_promise; + + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &promise, NULL, NULL)); + NAPI_CALL(env, napi_is_promise(env, promise, &is_promise)); + NAPI_CALL(env, napi_get_boolean(env, is_promise, &result)); + + return result; +} + +static napi_value runScript(napi_env env, napi_callback_info info) { + napi_value script, result; + size_t argc = 1; + + NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &script, NULL, NULL)); + + NAPI_CALL(env, napi_run_script(env, script, &result)); + + return result; +} + +EXTERN_C_START + +static napi_value Init(napi_env env, napi_value exports) { + napi_property_descriptor properties[] = { DECLARE_NAPI_FUNCTION("getLastErrorInfo", getLastErrorInfo), + DECLARE_NAPI_FUNCTION("cleanUpErrorInfo", cleanUpErrorInfo), + DECLARE_NAPI_FUNCTION("throwExistingError", throwExistingError), + DECLARE_NAPI_FUNCTION("throwError", throwError), + DECLARE_NAPI_FUNCTION("throwTypeError", throwTypeError), + DECLARE_NAPI_FUNCTION("throwRangeError", throwRangeError), + DECLARE_NAPI_FUNCTION("isError", isError), + DECLARE_NAPI_FUNCTION("createError", createError), + DECLARE_NAPI_FUNCTION("createTypeError", createTypeError), + DECLARE_NAPI_FUNCTION("createRangeError", createRangeError), + DECLARE_NAPI_FUNCTION("getAndClearLastException", getAndClearLastException), + DECLARE_NAPI_FUNCTION("isExceptionPending", isExceptionPending), + DECLARE_NAPI_FUNCTION("openAndCloseHandleScope", openAndCloseHandleScope), + DECLARE_NAPI_FUNCTION("openAndCloseEscapableHandleScope", openAndCloseEscapableHandleScope), + DECLARE_NAPI_FUNCTION("createReference", createReference), + DECLARE_NAPI_FUNCTION("deleteReference", deleteReference), + DECLARE_NAPI_FUNCTION("referenceRef", referenceRef), + DECLARE_NAPI_FUNCTION("referenceUnref", referenceUnref), + DECLARE_NAPI_FUNCTION("getReferenceValue", getReferenceValue), + DECLARE_NAPI_FUNCTION("createArrayAndGetLength", createArrayAndGetLength), + DECLARE_NAPI_FUNCTION("getArrayWithLength", getArrayWithLength), + DECLARE_NAPI_FUNCTION("createExternal", createExternal), + DECLARE_NAPI_FUNCTION("createExternalArraybuffer", createExternalArraybuffer), + DECLARE_NAPI_FUNCTION("createObject", createObject), + DECLARE_NAPI_FUNCTION("createSymbol", createSymbol), + DECLARE_NAPI_FUNCTION("createTypeArray", createTypeArray), + DECLARE_NAPI_FUNCTION("createDataView", createDataView), + DECLARE_NAPI_FUNCTION("createAndGetInt32", createAndGetInt32), + DECLARE_NAPI_FUNCTION("createAndGetUInt32", createAndGetUInt32), + DECLARE_NAPI_FUNCTION("createAndGetInt64", createAndGetInt64), + DECLARE_NAPI_FUNCTION("createDouble", createDouble), + DECLARE_NAPI_FUNCTION("createAndGetStringLatin1", createAndGetStringLatin1), + DECLARE_NAPI_FUNCTION("createAndGetStringUtf8", createAndGetStringUtf8), + DECLARE_NAPI_FUNCTION("getPrototype", getPrototype), + DECLARE_NAPI_FUNCTION("getDataViewInfo", getDataViewInfo), + DECLARE_NAPI_FUNCTION("getValueBool", getValueBool), + DECLARE_NAPI_FUNCTION("getValueDouble", getValueDouble), + DECLARE_NAPI_FUNCTION("getValueExternal", getValueExternal), + DECLARE_NAPI_FUNCTION("getNull", getNull), + DECLARE_NAPI_FUNCTION("getUndefined", getUndefined), + DECLARE_NAPI_FUNCTION("coerceToBool", coerceToBool), + DECLARE_NAPI_FUNCTION("coerceToNumber", coerceToNumber), + DECLARE_NAPI_FUNCTION("coerceToObject", coerceToObject), + DECLARE_NAPI_FUNCTION("coerceToString", coerceToString), + DECLARE_NAPI_FUNCTION("instanceOf", instanceOf), + DECLARE_NAPI_FUNCTION("isArray", isArray), + DECLARE_NAPI_FUNCTION("isDate", isDate), + DECLARE_NAPI_FUNCTION("strictEquals", strictEquals), + DECLARE_NAPI_FUNCTION("getPropertyNames", getPropertyNames), + DECLARE_NAPI_FUNCTION("setProperty", setProperty), + DECLARE_NAPI_FUNCTION("getProperty", getProperty), + DECLARE_NAPI_FUNCTION("hasProperty", hasProperty), + DECLARE_NAPI_FUNCTION("deleteProperty", deleteProperty), + DECLARE_NAPI_FUNCTION("hasOwnProperty", hasOwnProperty), + DECLARE_NAPI_FUNCTION("setNamedProperty", setNamedProperty), + DECLARE_NAPI_FUNCTION("getNamedProperty", getNamedProperty), + DECLARE_NAPI_FUNCTION("hasNamedProperty", hasNamedProperty), + DECLARE_NAPI_FUNCTION("setElement", setElement), + DECLARE_NAPI_FUNCTION("getElement", getElement), + DECLARE_NAPI_FUNCTION("hasElement", hasElement), + DECLARE_NAPI_FUNCTION("deleteElement", deleteElement), + DECLARE_NAPI_FUNCTION("defineProperties", defineProperties), + DECLARE_NAPI_FUNCTION("getNewTarget", getNewTarget), + DECLARE_NAPI_FUNCTION("wrap", wrap), + DECLARE_NAPI_FUNCTION("unwrap", unwrap), + DECLARE_NAPI_FUNCTION("removeWrap", removeWrap), + DECLARE_NAPI_FUNCTION("getVersion", getVersion), + DECLARE_NAPI_FUNCTION("createPromise", createPromise), + DECLARE_NAPI_FUNCTION("resolveAndRejectDeferred", resolveAndRejectDeferred), + DECLARE_NAPI_FUNCTION("isPromise", isPromise), + DECLARE_NAPI_FUNCTION("runScript", runScript), }; + + NAPI_CALL(env, napi_define_properties(env, exports, sizeof(properties) / sizeof(*properties), properties)); + return exports; +} +EXTERN_C_END + +static napi_module +demoModule = { +.nm_version = 1, +.nm_flags = 0, +.nm_filename = nullptr, +.nm_register_func = Init, +.nm_modname = "napitest", +.nm_priv = ((void *)0), +.reserved = { +0 }, +}; + +extern "C" __attribute__((constructor)) void RegisterModule(void) +{ +napi_module_register(& demoModule); +} diff --git a/arkui/ace_napi_test/entry/src/main/ets/test/List.test.ets b/arkui/ace_napi_test/entry/src/main/ets/test/List.test.ets index 43dca6e7d2672a3e8733b52002b4e22020060609..ae1a06d64937523e8dffdf8938f07255115fa1f5 100644 --- a/arkui/ace_napi_test/entry/src/main/ets/test/List.test.ets +++ b/arkui/ace_napi_test/entry/src/main/ets/test/List.test.ets @@ -13,7 +13,9 @@ * limitations under the License. */ import napiStringTest from './NativeApiStringTest'; +import aceNapiEtsTest from './NapiEtsTest' export default function testsuite() { napiStringTest() + aceNapiEtsTest() } \ No newline at end of file diff --git a/arkui/ace_napi_test/entry/src/main/ets/test/NapiEtsTest.ets b/arkui/ace_napi_test/entry/src/main/ets/test/NapiEtsTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..9d7459acd9f04980bb8977ee58bfed4fb142cab8 --- /dev/null +++ b/arkui/ace_napi_test/entry/src/main/ets/test/NapiEtsTest.ets @@ -0,0 +1,849 @@ +/* + * 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 napitest from 'libnapitest.so' + +export default function aceNapiEtsTest() { + describe('aceNapiEtsTest', function () { + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0100 + * @tc.name aceNapiTest001 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest001', 0, async function (done) { + console.info('aceNapiTest001 START'); + napitest.add_returned_status() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0110 + * @tc.name aceNapiTest002 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest002', 0, async function (done) { + console.info('aceNapiTest002 START'); + napitest.add_last_status() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0120 + * @tc.name aceNapiTest003 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest003', 0, async function (done) { + console.info('aceNapiTest003 START'); + napitest.getLastErrorInfo() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0130 + * @tc.name aceNapiTest004 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest004', 0, async function (done) { + console.info('aceNapiTest004 START'); + napitest.cleanUpErrorInfo() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0140 + * @tc.name aceNapiTest005 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest005', 0, async function (done) { + console.info('aceNapiTest005 START'); + napitest.throwExistingError() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0150 + * @tc.name aceNapiTest006 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest006', 0, async function (done) { + console.info('aceNapiTest006 START'); + napitest.throwError() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0160 + * @tc.name aceNapiTest007 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest007', 0, async function (done) { + console.info('aceNapiTest007 START'); + napitest.throwTypeError() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0170 + * @tc.name aceNapiTest008 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest008', 0, async function (done) { + console.info('aceNapiTest008 START'); + napitest.throwRangeError() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0180 + * @tc.name aceNapiTest009 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest009', 0, async function (done) { + console.info('aceNapiTest009 START'); + napitest.isError() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0190 + * @tc.name aceNapiTest010 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest010', 0, async function (done) { + console.info('aceNapiTest010 START'); + napitest.createError() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0200 + * @tc.name aceNapiTest011 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest011', 0, async function (done) { + console.info('aceNapiTest011 START'); + napitest.createTypeError() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0210 + * @tc.name aceNapiTest012 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest012', 0, async function (done) { + console.info('aceNapiTest012 START'); + napitest.createRangeError() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0220 + * @tc.name aceNapiTest013 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest013', 0, async function (done) { + console.info('aceNapiTest013 START'); + napitest.getAndClearLastException() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0230 + * @tc.name aceNapiTest014 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest014', 0, async function (done) { + console.info('aceNapiTest014 START'); + napitest.isExceptionPending() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0240 + * @tc.name aceNapiTest015 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest015', 0, async function (done) { + console.info('aceNapiTest015 START'); + napitest.openAndCloseHandleScope() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0250 + * @tc.name aceNapiTest016 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest016', 0, async function (done) { + console.info('aceNapiTest016 START'); + napitest.openAndCloseEscapableHandleScope() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0260 + * @tc.name aceNapiTest017 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest017', 0, async function (done) { + console.info('aceNapiTest017 START'); + napitest.createReference() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0270 + * @tc.name aceNapiTest018 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest018', 0, async function (done) { + console.info('aceNapiTest018 START'); + napitest.deleteReference() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0280 + * @tc.name aceNapiTest019 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest019', 0, async function (done) { + console.info('aceNapiTest019 START'); + napitest.referenceRef() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0290 + * @tc.name aceNapiTest020 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest020', 0, async function (done) { + console.info('aceNapiTest020 START'); + napitest.referenceUnref() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0300 + * @tc.name aceNapiTest021 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest021', 0, async function (done) { + console.info('aceNapiTest021 START'); + napitest.getReferenceValue() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0310 + * @tc.name aceNapiTest022 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest022', 0, async function (done) { + console.info('aceNapiTest022 START'); + napitest.createArrayAndGetLength() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0320 + * @tc.name aceNapiTest023 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest023', 0, async function (done) { + console.info('aceNapiTest023 START'); + napitest.getArrayWithLength() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0330 + * @tc.name aceNapiTest024 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest024', 0, async function (done) { + console.info('aceNapiTest024 START'); + napitest.finalizer() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0340 + * @tc.name aceNapiTest025 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest025', 0, async function (done) { + console.info('aceNapiTest025 START'); + napitest.createExternal() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0350 + * @tc.name aceNapiTest026 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest026', 0, async function (done) { + console.info('aceNapiTest026 START'); + napitest.createExternalArraybuffer() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0360 + * @tc.name aceNapiTest027 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest027', 0, async function (done) { + console.info('aceNapiTest027 START'); + napitest.createObject() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0370 + * @tc.name aceNapiTest028 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest028', 0, async function (done) { + console.info('aceNapiTest028 START'); + napitest.createSymbol() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0380 + * @tc.name aceNapiTest029 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest029', 0, async function (done) { + console.info('aceNapiTest029 START'); + napitest.createTypeArray() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0390 + * @tc.name aceNapiTest030 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest030', 0, async function (done) { + console.info('aceNapiTest030 START'); + napitest.createDataView() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0400 + * @tc.name aceNapiTest031 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest031', 0, async function (done) { + console.info('aceNapiTest031 START'); + napitest.createAndGetInt32() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0410 + * @tc.name aceNapiTest032 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest032', 0, async function (done) { + console.info('aceNapiTest032 START'); + napitest.createAndGetUInt32() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0420 + * @tc.name aceNapiTest033 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest033', 0, async function (done) { + console.info('aceNapiTest033 START'); + napitest.createAndGetInt64() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0430 + * @tc.name aceNapiTest034 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest034', 0, async function (done) { + console.info('aceNapiTest034 START'); + napitest.createDouble() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0440 + * @tc.name aceNapiTest035 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest035', 0, async function (done) { + console.info('aceNapiTest035 START'); + napitest.createAndGetStringLatin1() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0450 + * @tc.name aceNapiTest036 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest036', 0, async function (done) { + console.info('aceNapiTest036 START'); + napitest.createAndGetStringUtf8() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0460 + * @tc.name aceNapiTest037 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest037', 0, async function (done) { + console.info('aceNapiTest037 START'); + napitest.getPrototype() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0470 + * @tc.name aceNapiTest038 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest038', 0, async function (done) { + console.info('aceNapiTest038 START'); + napitest.getTypedArrayInfo() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0480 + * @tc.name aceNapiTest039 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest039', 0, async function (done) { + console.info('aceNapiTest039 START'); + napitest.getDataViewInfo() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0490 + * @tc.name aceNapiTest040 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest040', 0, async function (done) { + console.info('aceNapiTest040 START'); + napitest.getValueBool() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0500 + * @tc.name aceNapiTest041 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest041', 0, async function (done) { + console.info('aceNapiTest041 START'); + napitest.getValueDouble() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0510 + * @tc.name aceNapiTest042 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest042', 0, async function (done) { + console.info('aceNapiTest042 START'); + napitest.getValueExternal() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0520 + * @tc.name aceNapiTest043 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest043', 0, async function (done) { + console.info('aceNapiTest043 START'); + napitest.getNull() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0530 + * @tc.name aceNapiTest044 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest044', 0, async function (done) { + console.info('aceNapiTest044 START'); + napitest.getUndefined() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0540 + * @tc.name aceNapiTest045 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest045', 0, async function (done) { + console.info('aceNapiTest045 START'); + napitest.coerceToBool() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0550 + * @tc.name aceNapiTest046 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest046', 0, async function (done) { + console.info('aceNapiTest046 START'); + napitest.coerceToNumber() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0560 + * @tc.name aceNapiTest047 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest047', 0, async function (done) { + console.info('aceNapiTest047 START'); + napitest.coerceToObject() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0570 + * @tc.name aceNapiTest048 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest048', 0, async function (done) { + console.info('aceNapiTest048 START'); + napitest.coerceToString() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0580 + * @tc.name aceNapiTest049 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest049', 0, async function (done) { + console.info('aceNapiTest049 START'); + napitest.instanceOf() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0590 + * @tc.name aceNapiTest050 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest050', 0, async function (done) { + console.info('aceNapiTest050 START'); + napitest.isArray() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0600 + * @tc.name aceNapiTest051 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest051', 0, async function (done) { + console.info('aceNapiTest051 START'); + napitest.isDate() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0610 + * @tc.name aceNapiTest052 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest052', 0, async function (done) { + console.info('aceNapiTest052 START'); + napitest.strictEquals() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0620 + * @tc.name aceNapiTest053 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest053', 0, async function (done) { + console.info('aceNapiTest053 START'); + napitest.getPropertyNames() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0630 + * @tc.name aceNapiTest054 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest054', 0, async function (done) { + console.info('aceNapiTest054 START'); + napitest.setProperty() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0640 + * @tc.name aceNapiTest055 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest055', 0, async function (done) { + console.info('aceNapiTest055 START'); + napitest.getProperty() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0650 + * @tc.name aceNapiTest056 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest056', 0, async function (done) { + console.info('aceNapiTest056 START'); + napitest.hasProperty() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0660 + * @tc.name aceNapiTest057 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest057', 0, async function (done) { + console.info('aceNapiTest057 START'); + napitest.deleteProperty() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0670 + * @tc.name aceNapiTest058 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest058', 0, async function (done) { + console.info('aceNapiTest058 START'); + napitest.hasOwnProperty() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0680 + * @tc.name aceNapiTest059 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest059', 0, async function (done) { + console.info('aceNapiTest059 START'); + napitest.setNamedProperty() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0690 + * @tc.name aceNapiTest060 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest060', 0, async function (done) { + console.info('aceNapiTest060 START'); + napitest.getNamedProperty() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0700 + * @tc.name aceNapiTest061 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest061', 0, async function (done) { + console.info('aceNapiTest061 START'); + napitest.hasNamedProperty() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0710 + * @tc.name aceNapiTest062 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest062', 0, async function (done) { + console.info('aceNapiTest062 START'); + napitest.setElement() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0720 + * @tc.name aceNapiTest063 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest063', 0, async function (done) { + console.info('aceNapiTest063 START'); + napitest.getElement() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0730 + * @tc.name aceNapiTest064 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest064', 0, async function (done) { + console.info('aceNapiTest064 START'); + napitest.hasElement() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0740 + * @tc.name aceNapiTest065 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest065', 0, async function (done) { + console.info('aceNapiTest065 START'); + napitest.deleteElement() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0750 + * @tc.name aceNapiTest066 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest066', 0, async function (done) { + console.info('aceNapiTest066 START'); + napitest.defineProperties() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0760 + * @tc.name aceNapiTest067 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest067', 0, async function (done) { + console.info('aceNapiTest067 START'); + napitest.getNewTarget() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0770 + * @tc.name aceNapiTest068 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest068', 0, async function (done) { + console.info('aceNapiTest068 START'); + napitest.wrap() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0780 + * @tc.name aceNapiTest069 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest069', 0, async function (done) { + console.info('aceNapiTest069 START'); + napitest.unwrap() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0790 + * @tc.name aceNapiTest070 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest070', 0, async function (done) { + console.info('aceNapiTest070 START'); + napitest.removeWrap() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0800 + * @tc.name aceNapiTest071 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest071', 0, async function (done) { + console.info('aceNapiTest071 START'); + napitest.getVersion() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0810 + * @tc.name aceNapiTest072 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest072', 0, async function (done) { + console.info('aceNapiTest072 START'); + napitest.createPromise() + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0820 + * @tc.name aceNapiTest073 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest073', 0, async function (done) { + console.info('aceNapiTest073 START'); + napitest.resolveAndRejectDeferred() + done(); + }); + + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0830 + * @tc.name aceNapiTest074 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest074', 0, async function (done) { + console.info('aceNapiTest074 START'); + napitest.isPromise() + done(); + }); + + + /** + * @tc.number SUB_ACE_BASIC_ETS_NAPI_0840 + * @tc.name aceNapiTest075 + * @tc.desc aceNapiEtsTest + */ + it('aceNapiTest075', 0, async function (done) { + console.info('aceNapiTest075 START'); + napitest.runScript() + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_standard/src/main/config.json b/arkui/ace_standard/src/main/config.json index 56350a3074be3705da409e1c6a1b98dd2abccd34..a660793a2a6fd70e5238dd80203d546a5d2ef8e4 100644 --- a/arkui/ace_standard/src/main/config.json +++ b/arkui/ace_standard/src/main/config.json @@ -17,6 +17,7 @@ "name": ".MyApplication", "mainAbility": "com.example.aceceshi.MainAbility", "deviceType": [ + "default", "phone" ], "distro": { @@ -149,7 +150,7 @@ "pages/stepper/style/index", "pages/stepperItem/router/index", "pages/stepperItem/prop/index", - "pages/stepperItem/style/index", + "pages/stepperItem/style/style", "pages/swiper/router/index", "pages/swiper/prop/index", "pages/swiper/style/index", diff --git a/arkui/ace_standard/src/main/js/default/pages/stepperItem/style/style.css b/arkui/ace_standard/src/main/js/default/pages/stepperItem/style/style.css index 99d20f168e39cb7b5f6e1393b9c7a420371a6aef..e291de16cf2041ea8c10a8242b5ff5a78130b46a 100644 --- a/arkui/ace_standard/src/main/js/default/pages/stepperItem/style/style.css +++ b/arkui/ace_standard/src/main/js/default/pages/stepperItem/style/style.css @@ -428,7 +428,7 @@ height: 20px; font-size: 15px; margin-bottom: 2px; - background-color:#0FFFFFF; + background-color:violet; width: 100%; margin-left: 10px; margin-right: 10px; diff --git a/arkui/ace_standard/src/main/js/default/pages/swiper/router/index.js b/arkui/ace_standard/src/main/js/default/pages/swiper/router/index.js index 9721f49d0616078cb0aae52a6c487a881bb4434a..80dbc8edf0939eeaecff704b164829696eb3bd89 100644 --- a/arkui/ace_standard/src/main/js/default/pages/swiper/router/index.js +++ b/arkui/ace_standard/src/main/js/default/pages/swiper/router/index.js @@ -101,13 +101,8 @@ export default { }, onShow(){ - // 通用属性 - var prop1 = this.$element('prop1'); - var name1 = prop1.dataSet.name - var prop2 = this.$refs.prop2; - var name2 = prop2.dataSet.name prompt.showToast({ - message: 'prop1--' + name1 + '\nprop2--' + name2 + message: 'onShow' }); }, diff --git a/arkui/ace_standard/src/main/js/default/test/pickerViewProps.test.js b/arkui/ace_standard/src/main/js/default/test/pickerViewProps.test.js index 03d0127c018446ceb82613ed79a9664236d2fc9d..f2ea44f68048821e21dcc53777faec69682aaa06 100644 --- a/arkui/ace_standard/src/main/js/default/test/pickerViewProps.test.js +++ b/arkui/ace_standard/src/main/js/default/test/pickerViewProps.test.js @@ -91,7 +91,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('idProp') done(); }); @@ -109,7 +109,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('classProp') expect(obj.$attrs.className).assertEqual('classProp') done(); @@ -128,7 +128,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('classPropNone') expect(obj.$attrs.className).assertEqual(undefined) console.info("[pickerViewProps] get className value is: " + JSON.stringify(obj.$attrs.className)); @@ -174,7 +174,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('refProp') expect(obj.$attrs.ref).assertEqual('refProp') done(); @@ -193,7 +193,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('refPropNone') expect(obj.$attrs.ref).assertEqual(undefined) console.info("[pickerViewProps] get ref value is: " + JSON.stringify(obj.$attrs.ref)); @@ -213,7 +213,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('disabledPropTrue') expect(obj.$attrs.disabled).assertEqual('true') done(); @@ -232,7 +232,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('disabledPropFalse') expect(obj.$attrs.disabled).assertEqual('false') done(); @@ -251,7 +251,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('disabledPropNone') expect(obj.$attrs.disabled).assertEqual('false') done(); @@ -270,7 +270,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('focusablePropTrue') expect(obj.$attrs.focusable).assertEqual('true') done(); @@ -289,7 +289,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('focusablePropFalse') expect(obj.$attrs.focusable).assertEqual('false') done(); @@ -308,7 +308,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('focusablePropNone') expect(obj.$attrs.focusable).assertEqual('false') done(); @@ -327,7 +327,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('dataProp') expect(obj.$attrs.datapickerView).assertEqual(undefined); console.info("[pickerViewProps] get datapickerView value is: " + JSON.stringify(obj.$attrs.datapickerView)); @@ -347,7 +347,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('dataPropNone') expect(obj.$attrs.datapickerView).assertEqual(undefined) console.info("[pickerViewProps] get datapickerView value is: " + JSON.stringify(obj.$attrs.datapickerView)); @@ -367,7 +367,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('clickEffectPropSmall') expect(obj.$attrs.clickEffect).assertEqual('spring-small') done(); @@ -386,7 +386,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('clickEffectPropMedium') expect(obj.$attrs.clickEffect).assertEqual('spring-medium') done(); @@ -405,7 +405,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('clickEffectPropLarge') expect(obj.$attrs.clickEffect).assertEqual('spring-large') done(); @@ -424,7 +424,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('clickEffectPropNone') expect(obj.$attrs.clickEffect).assertEqual(undefined) console.info("[pickerViewProps] get clickEffect value is: " + JSON.stringify(obj.$attrs.clickEffect)); @@ -444,7 +444,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('dirPropRtl') expect(obj.$attrs.dir).assertEqual('rtl') done(); @@ -463,7 +463,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('dirPropLtr') expect(obj.$attrs.dir).assertEqual('ltr') done(); @@ -482,7 +482,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('dirPropAuto') expect(obj.$attrs.dir).assertEqual('auto') done(); @@ -501,7 +501,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('dirPropNone') expect(obj.$attrs.dir).assertEqual('auto') done(); @@ -520,7 +520,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('forPropNull') expect(obj.$attrs.for).assertEqual(undefined) console.info("[pickerViewProps] get for value is: " + JSON.stringify(obj.$attrs.for)); @@ -540,7 +540,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('forPropOne') expect(obj.$attrs.for).assertEqual(undefined) console.info("[pickerViewProps] get for value is: " + JSON.stringify(obj.$attrs.for)); @@ -560,7 +560,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('forPropThree') expect(obj.$attrs.for).assertEqual(undefined) console.info("[pickerViewProps] get for value is: " + JSON.stringify(obj.$attrs.for)); @@ -580,7 +580,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('ifPropTrue') expect(obj.$attrs.if).assertEqual(undefined) console.info("[pickerViewProps] get for value is: " + JSON.stringify(obj.$attrs.if)); @@ -638,7 +638,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('showPropTrue') expect(obj.$attrs.show).assertEqual('true') console.info("[pickerViewProps] get show value is: " + JSON.stringify(obj.$attrs.show)); @@ -658,7 +658,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('showPropFalse') expect(obj.$attrs.show).assertEqual('false') console.info("[pickerViewProps] get show value is: " + JSON.stringify(obj.$attrs.show)); @@ -678,7 +678,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('showPropNone') expect(obj.$attrs.show).assertEqual('true') console.info("[pickerViewProps] get show value is: " + JSON.stringify(obj.$attrs.show)); @@ -698,7 +698,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('pickerViewText') expect(obj.$attrs.type).assertEqual('text') console.info("[pickerViewProps] get type value is: " + JSON.stringify(obj.$attrs.type)); @@ -718,7 +718,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('pickerViewTime') expect(obj.$attrs.type).assertEqual('time') console.info("[pickerViewProps] get type value is: " + JSON.stringify(obj.$attrs.type)); @@ -738,7 +738,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('pickerViewDate') expect(obj.$attrs.type).assertEqual('date') console.info("[pickerViewProps] get type value is: " + JSON.stringify(obj.$attrs.type)); @@ -758,7 +758,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('pickerViewDatetime') expect(obj.$attrs.type).assertEqual('datetime') console.info("[pickerViewProps] get type value is: " + JSON.stringify(obj.$attrs.type)); @@ -778,7 +778,7 @@ console.info("[pickerViewProps] get inspector value is: " + JSON.stringify(obj)); console.info("[pickerViewProps] get inspector attrs value is: " + JSON.stringify(obj.$attrs)); - expect(obj.$type).assertEqual('picker') + expect(obj.$type).assertEqual('picker-view') expect(obj.$attrs.id).assertEqual('pickerViewMultiText') expect(obj.$attrs.type).assertEqual('multi-text') console.info("[pickerViewProps] get type value is: " + JSON.stringify(obj.$attrs.type)); diff --git a/arkui/ace_standard_video/src/main/config.json b/arkui/ace_standard_video/src/main/config.json index 01b6944c017ae7e49df8857eac1280d7141efc9c..b2ab729e6d305d33af611033052f073505f5d84b 100644 --- a/arkui/ace_standard_video/src/main/config.json +++ b/arkui/ace_standard_video/src/main/config.json @@ -17,6 +17,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/barrierfree/BUILD.gn b/barrierfree/BUILD.gn index 03013055d7eaec776aad547cc961272ea1578ffd..b40a83952a502df10353dadbc1e9960f400d0dd8 100644 --- a/barrierfree/BUILD.gn +++ b/barrierfree/BUILD.gn @@ -28,6 +28,7 @@ group("barrierfree") { "accessiblecheckability:ActsAccessibleCheckAbilityTest", "accessibleregisterstate:ActsAccessibleRegisterStateTest", "accessiblesendevent:ActsAccessibleSendEventTest", + "accessibletest:actsaccessibletest", "targetProject/aceTest:aceTest", ] } diff --git a/barrierfree/accessibilityconfig/BUILD.gn b/barrierfree/accessibilityconfig/BUILD.gn index 134a8f4891a3fa2867922f89aef2c0ece531156f..ed7074adc45ee830226a25a2f6b9caa76baff0ab 100644 --- a/barrierfree/accessibilityconfig/BUILD.gn +++ b/barrierfree/accessibilityconfig/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/barrierfree/accessibilityconfig/entry/src/main/ets/test/AccessibilityConfig.test.ets b/barrierfree/accessibilityconfig/entry/src/main/ets/test/AccessibilityConfig.test.ets index e97bc102ddab07ad772a6c18fc2fc2d8946ec2fe..d7a0ff36d58e73dfc3391c03935f245df13e2c50 100644 --- a/barrierfree/accessibilityconfig/entry/src/main/ets/test/AccessibilityConfig.test.ets +++ b/barrierfree/accessibilityconfig/entry/src/main/ets/test/AccessibilityConfig.test.ets @@ -1827,5 +1827,599 @@ export default function abilityTest() { expect(ret).assertEqual(undefined); done(); }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncCallback_0100 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncCallback_0100 + * @tc.desc Test captionsStyle.set() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncCallback_0100', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncCallback_0100'); + config.captionsStyle.set({ + fontFamily: 'monospacedSerif', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'none', + backgroundColor: 'blue', + windowColor: 'blue' + }, (err, result) => { + if (err.code != 0) { + console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_0100 has error: ${err.code}`); + expect(null).assertFail(); + done(); + } + expect(result).assertEqual(undefined); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncCallback_0200 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncCallback_0200 + * @tc.desc Test captionsStyle.set() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncCallback_0200', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncCallback_0200'); + config.captionsStyle.set({ + fontFamily: 'serif', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'none', + backgroundColor: 'blue', + windowColor: 'blue' + }, (err, result) => { + if (err.code != 0) { + console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_0200 has error: ${err.code}`); + expect(null).assertFail(); + done(); + } + expect(result).assertEqual(undefined); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncCallback_0300 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncCallback_0300 + * @tc.desc Test captionsStyle.set() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncCallback_0300', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncCallback_0300'); + config.captionsStyle.set({ + fontFamily: 'monospacedSansSerif', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'none', + backgroundColor: 'blue', + windowColor: 'blue' + }, (err, result) => { + if (err.code != 0) { + console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_0300 has error: ${err.code}`); + expect(null).assertFail(); + done(); + } + expect(result).assertEqual(undefined); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncCallback_0400 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncCallback_0400 + * @tc.desc Test captionsStyle.set() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncCallback_0400', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncCallback_0400'); + config.captionsStyle.set({ + fontFamily: 'sansSerif', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'none', + backgroundColor: 'blue', + windowColor: 'blue' + }, (err, result) => { + if (err.code != 0) { + console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_0400 has error: ${err.code}`); + expect(null).assertFail(); + done(); + } + expect(result).assertEqual(undefined); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncCallback_0500 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncCallback_0500 + * @tc.desc Test captionsStyle.set() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncCallback_0500', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncCallback_0500'); + config.captionsStyle.set({ + fontFamily: 'casual', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'none', + backgroundColor: 'blue', + windowColor: 'blue' + }, (err, result) => { + if (err.code != 0) { + console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_0500 has error: ${err.code}`); + expect(null).assertFail(); + done(); + } + expect(result).assertEqual(undefined); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncCallback_0600 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncCallback_0600 + * @tc.desc Test captionsStyle.set() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncCallback_0600', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncCallback_0600'); + config.captionsStyle.set({ + fontFamily: 'cursive', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'none', + backgroundColor: 'blue', + windowColor: 'blue' + }, (err, result) => { + if (err.code != 0) { + console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_0600 has error: ${err.code}`); + expect(null).assertFail(); + done(); + } + expect(result).assertEqual(undefined); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncCallback_0700 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncCallback_0700 + * @tc.desc Test captionsStyle.set() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncCallback_0700', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncCallback_0700'); + config.captionsStyle.set({ + fontFamily: 'smallCapitals', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'none', + backgroundColor: 'blue', + windowColor: 'blue' + }, (err, result) => { + if (err.code != 0) { + console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_0700 has error: ${err.code}`); + expect(null).assertFail(); + done(); + } + expect(result).assertEqual(undefined); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncCallback_0800 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncCallback_0800 + * @tc.desc Test captionsStyle.set() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncCallback_0800', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncCallback_0800'); + config.captionsStyle.set({ + fontFamily: 'default', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'raised', + backgroundColor: 'blue', + windowColor: 'blue' + }, (err, result) => { + if (err.code != 0) { + console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_0800 has error: ${err.code}`); + expect(null).assertFail(); + done(); + } + expect(result).assertEqual(undefined); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncCallback_0900 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncCallback_0900 + * @tc.desc Test captionsStyle.set() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncCallback_0900', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncCallback_0900'); + config.captionsStyle.set({ + fontFamily: 'default', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'depressed', + backgroundColor: 'blue', + windowColor: 'blue' + }, (err, result) => { + if (err.code != 0) { + console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_0900 has error: ${err.code}`); + expect(null).assertFail(); + done(); + } + expect(result).assertEqual(undefined); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncCallback_1000 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncCallback_1000 + * @tc.desc Test captionsStyle.set() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncCallback_1000', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncCallback_1000'); + config.captionsStyle.set({ + fontFamily: 'default', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'uniform', + backgroundColor: 'blue', + windowColor: 'blue' + }, (err, result) => { + if (err.code != 0) { + console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_1000 has error: ${err.code}`); + expect(null).assertFail(); + done(); + } + expect(result).assertEqual(undefined); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncCallback_1100 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncCallback_1100 + * @tc.desc Test captionsStyle.set() function in callback mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncCallback_1100', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncCallback_1100'); + config.captionsStyle.set({ + fontFamily: 'default', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'dropShadow', + backgroundColor: 'blue', + windowColor: 'blue' + }, (err, result) => { + if (err.code != 0) { + console.error(`AccessibilityConfigTest_captionsStyle_asyncCallback_1100 has error: ${err.code}`); + expect(null).assertFail(); + done(); + } + expect(result).assertEqual(undefined); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncPromise_0100 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncPromise_0100 + * @tc.desc Test captionsStyle.set() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncPromise_0100', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncPromise_0100'); + config.captionsStyle.set({ + fontFamily: 'monospacedSerif', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'none', + backgroundColor: 'blue', + windowColor: 'blue' + }).then((result) => { + console.info(`AccessibilityConfigTest_captionsStyle_asyncPromise_0100 result: ${result}`); + expect(result).assertEqual(undefined); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0100 has error: ${err.code}`); + expect(null).assertFail(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncPromise_0200 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncPromise_0200 + * @tc.desc Test captionsStyle.set() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncPromise_0200', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncPromise_0200'); + config.captionsStyle.set({ + fontFamily: 'serif', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'none', + backgroundColor: 'blue', + windowColor: 'blue' + }).then((result) => { + console.info(`AccessibilityConfigTest_captionsStyle_asyncPromise_0200 result: ${result}`); + expect(result).assertEqual(undefined); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0200 has error: ${err.code}`); + expect(null).assertFail(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncPromise_0300 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncPromise_0300 + * @tc.desc Test captionsStyle.set() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncPromise_0300', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncPromise_0300'); + config.captionsStyle.set({ + fontFamily: 'monospacedSansSerif', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'none', + backgroundColor: 'blue', + windowColor: 'blue' + }).then((result) => { + console.info(`AccessibilityConfigTest_captionsStyle_asyncPromise_0300 result: ${result}`); + expect(result).assertEqual(undefined); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0300 has error: ${err.code}`); + expect(null).assertFail(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncPromise_0400 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncPromise_0400 + * @tc.desc Test captionsStyle.set() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncPromise_0400', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncPromise_0400'); + config.captionsStyle.set({ + fontFamily: 'sansSerif', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'none', + backgroundColor: 'blue', + windowColor: 'blue' + }).then((result) => { + console.info(`AccessibilityConfigTest_captionsStyle_asyncPromise_0400 result: ${result}`); + expect(result).assertEqual(undefined); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0400 has error: ${err.code}`); + expect(null).assertFail(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncPromise_0500 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncPromise_0500 + * @tc.desc Test captionsStyle.set() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncPromise_0500', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncPromise_0500'); + config.captionsStyle.set({ + fontFamily: 'casual', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'none', + backgroundColor: 'blue', + windowColor: 'blue' + }).then((result) => { + console.info(`AccessibilityConfigTest_captionsStyle_asyncPromise_0500 result: ${result}`); + expect(result).assertEqual(undefined); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0500 has error: ${err.code}`); + expect(null).assertFail(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncPromise_0600 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncPromise_0600 + * @tc.desc Test captionsStyle.set() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncPromise_0600', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncPromise_0600'); + config.captionsStyle.set({ + fontFamily: 'cursive', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'none', + backgroundColor: 'blue', + windowColor: 'blue' + }).then((result) => { + console.info(`AccessibilityConfigTest_captionsStyle_asyncPromise_0600 result: ${result}`); + expect(result).assertEqual(undefined); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0600 has error: ${err.code}`); + expect(null).assertFail(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncPromise_0700 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncPromise_0700 + * @tc.desc Test captionsStyle.set() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncPromise_0700', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncPromise_0700'); + config.captionsStyle.set({ + fontFamily: 'smallCapitals', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'none', + backgroundColor: 'blue', + windowColor: 'blue' + }).then((result) => { + console.info(`AccessibilityConfigTest_captionsStyle_asyncPromise_0700 result: ${result}`); + expect(result).assertEqual(undefined); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0700 has error: ${err.code}`); + expect(null).assertFail(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncPromise_0800 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncPromise_0800 + * @tc.desc Test captionsStyle.set() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncPromise_0800', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncPromise_0800'); + config.captionsStyle.set({ + fontFamily: 'default', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'raised', + backgroundColor: 'blue', + windowColor: 'blue' + }).then((result) => { + console.info(`AccessibilityConfigTest_captionsStyle_asyncPromise_0800 result: ${result}`); + expect(result).assertEqual(undefined); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0800 has error: ${err.code}`); + expect(null).assertFail(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncPromise_0900 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncPromise_0900 + * @tc.desc Test captionsStyle.set() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncPromise_0900', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncPromise_0900'); + config.captionsStyle.set({ + fontFamily: 'default', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'depressed', + backgroundColor: 'blue', + windowColor: 'blue' + }).then((result) => { + console.info(`AccessibilityConfigTest_captionsStyle_asyncPromise_0900 result: ${result}`); + expect(result).assertEqual(undefined); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_0900 has error: ${err.code}`); + expect(null).assertFail(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncPromise_1000 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncPromise_1000 + * @tc.desc Test captionsStyle.set() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncPromise_1000', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncPromise_1000'); + config.captionsStyle.set({ + fontFamily: 'default', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'uniform', + backgroundColor: 'blue', + windowColor: 'blue' + }).then((result) => { + console.info(`AccessibilityConfigTest_captionsStyle_asyncPromise_1000 result: ${result}`); + expect(result).assertEqual(undefined); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_1000 has error: ${err.code}`); + expect(null).assertFail(); + done(); + }); + }) + + /* + * @tc.number AccessibilityConfigTest_captionsStyle_asyncPromise_1100 + * @tc.name AccessibilityConfigTest_captionsStyle_asyncPromise_1100 + * @tc.desc Test captionsStyle.set() function in promise mode. + * @tc.size SmallTest + * @tc.type User + */ + it('AccessibilityConfigTest_captionsStyle_asyncPromise_1100', 0, async function(done) { + console.info('AccessibilityConfigTest_captionsStyle_asyncPromise_1100'); + config.captionsStyle.set({ + fontFamily: 'default', + fontScale: 10, + fontColor: 'blue', + fontEdgeType: 'dropShadow', + backgroundColor: 'blue', + windowColor: 'blue' + }).then((result) => { + console.info(`AccessibilityConfigTest_captionsStyle_asyncPromise_1100 result: ${result}`); + expect(result).assertEqual(undefined); + done(); + }).catch((err) => { + console.error(`AccessibilityConfigTest_captionsStyle_asyncPromise_1100 has error: ${err.code}`); + expect(null).assertFail(); + done(); + }); + }) }) } \ No newline at end of file diff --git a/barrierfree/accessibilityconfig/entry/src/main/module.json b/barrierfree/accessibilityconfig/entry/src/main/module.json index 716634826d1e04d1e1fc943f51b7bbc6b247a2e8..9af222b39328a230d0de00754b4dc5323c42958f 100644 --- a/barrierfree/accessibilityconfig/entry/src/main/module.json +++ b/barrierfree/accessibilityconfig/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/barrierfree/accessibilityelement/Test.json b/barrierfree/accessibilityelement/Test.json index 0e097cb2a51354b2ff889a3e629a8d918485b6fa..099bf2a88f3e229f8f326547f5a8fe83249fec49 100644 --- a/barrierfree/accessibilityelement/Test.json +++ b/barrierfree/accessibilityelement/Test.json @@ -11,7 +11,6 @@ "kits": [ { "test-file-name": [ - "aceTest.hap", "ActsAccessibilityElementTest.hap" ], "type": "AppInstallKit", @@ -19,9 +18,8 @@ }, { "type": "ShellKit", - "teardown-command":[ - "bm uninstall -n com.example.accessibilityxts", - "bm uninstall -n com.example.acetest" + "run-command": [ + "param set persist.ace.testmode.enabled 1" ] } ] diff --git a/barrierfree/accessibilityelement/entry/src/main/ets/MainAbility/pages/index/index.ets b/barrierfree/accessibilityelement/entry/src/main/ets/MainAbility/pages/index/index.ets index 83bb21248c681d6ed9d5dfaa26b65e9d847895cd..ed3ed7da39626bd785d22effda0174a96b639669 100644 --- a/barrierfree/accessibilityelement/entry/src/main/ets/MainAbility/pages/index/index.ets +++ b/barrierfree/accessibilityelement/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -17,7 +17,7 @@ import router from '@ohos.router'; @Entry @Component struct Index { - @State message: string = 'Hello World'; + @State message: string = 'accessibility element'; aboutToAppear(){ console.info("start run testcase!!!!"); @@ -27,8 +27,26 @@ struct Index { Row() { Column() { Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) + .fontSize(50) + .fontWeight(FontWeight.Bold) + .margin({bottom: 10}) + + Row() { + Button('left') + Button('button1') + .margin({ + left: 10, + right: 10 + }) + Button('right') + } + .margin({bottom: 10}) + + Button('button2') + .margin({bottom: 10}) + + Button('button3') + .margin({bottom: 10}) } .width('100%') } diff --git a/barrierfree/accessibilityelement/entry/src/main/ets/test/AccessibilityElement.test.ets b/barrierfree/accessibilityelement/entry/src/main/ets/test/AccessibilityElement.test.ets index 218b471abc8de978e9a844185314ab87ed43b2f4..6bf9b734e992826b997274d53f2f6477a5071c73 100644 --- a/barrierfree/accessibilityelement/entry/src/main/ets/test/AccessibilityElement.test.ets +++ b/barrierfree/accessibilityelement/entry/src/main/ets/test/AccessibilityElement.test.ets @@ -14,6 +14,7 @@ */ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" import commonEvent from '@ohos.commonEvent' +import config from '@ohos.accessibility.config' const passStr = 'pass'; const failStr = 'fail'; @@ -48,21 +49,40 @@ export default function abilityTest() { } }); - await globalThis.abilityContext.startAbility({ - deviceId: '', - bundleName: 'com.example.acetest', - abilityName: 'MainAbility', - action: 'action1', - parameters: {}, + config.enableAbility('com.example.accessibilityxts/AccessibilityExtAbility', + ["retrieve", "touchGuide", "gesture"] + ).then(() => { + console.info(`AccessibilityElementTest enableAbility: then`); + + config.enableAbility('com.example.accessibilityxts/AccessibilityExtAbility1', + ["retrieve", "touchGuide", "gesture"] + ).then(() => { + console.info(`AccessibilityElementTest1 enableAbility: then`); + }).catch((err) => { + console.error(`AccessibilityElementTest1 enableAbility has error: ${err.code}`); }); - setTimeout(done, 5000); + }).catch((err) => { + console.error(`AccessibilityElementTest enableAbility has error: ${err.code}`); + }); + + + setTimeout(async () => { + done(); + }, 5000); }) afterAll(async function (done) { console.info('AccessibilityElementTest: afterAll'); commonEvent.unsubscribe(subScriber); isConnect = false; - done(); + config.disableAbility('com.example.accessibilityxts/AccessibilityExtAbility').then(() => { + console.info(`AccessibilityElementTest disableAbility: then`); + }).catch((err) => { + console.error(`AccessibilityElementTest disableAbility has error: ${err.code}`); + }); + setTimeout(async () => { + done(); + }, 5000); }) beforeEach(async function (done) { diff --git a/barrierfree/accessibilityelement/entry/src/main/module.json b/barrierfree/accessibilityelement/entry/src/main/module.json index 9e08a2a2088e6692756df291b05d6fea063304a1..3bfff5b0dfde1e23ba06dde75cfe7027d2d3fa1a 100644 --- a/barrierfree/accessibilityelement/entry/src/main/module.json +++ b/barrierfree/accessibilityelement/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/barrierfree/accessibilityevent/Test.json b/barrierfree/accessibilityevent/Test.json index 0c0698835cbf8cd90ea6908fb5f95eec344d7ef0..9aea7341edda4a14c2b5843197fa9ea929f90185 100644 --- a/barrierfree/accessibilityevent/Test.json +++ b/barrierfree/accessibilityevent/Test.json @@ -11,18 +11,10 @@ "kits": [ { "test-file-name": [ - "aceTest.hap", "ActsAccessibilityEventTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true - }, - { - "type": "ShellKit", - "teardown-command":[ - "bm uninstall -n com.example.accessibilityxts", - "bm uninstall -n com.example.acetest" - ] } ] } \ No newline at end of file diff --git a/barrierfree/accessibilityevent/entry/src/main/ets/test/AccessibilityEventTest.test.ets b/barrierfree/accessibilityevent/entry/src/main/ets/test/AccessibilityEventTest.test.ets index 29414d25a44a156971e7cc8be2a4f42efa06bb69..a0eeca7febe30f46dd1a7b194797c4053e5e5803 100644 --- a/barrierfree/accessibilityevent/entry/src/main/ets/test/AccessibilityEventTest.test.ets +++ b/barrierfree/accessibilityevent/entry/src/main/ets/test/AccessibilityEventTest.test.ets @@ -15,6 +15,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" import accessibility from '@ohos.accessibility' import commonEvent from '@ohos.commonEvent' +import config from '@ohos.accessibility.config' export default function abilityTest() { let targetBundleName = 'com.example.accessibilityxts'; @@ -37,23 +38,27 @@ export default function abilityTest() { } }); - setTimeout(async () => { - await globalThis.abilityContext.startAbility({ - deviceId: "", - bundleName: "com.example.acetest", - abilityName: "MainAbility", - action: "action1", - parameters: {}, - }); - done(); - }, 5000); + config.enableAbility('com.example.accessibilityxts/AccessibilityExtAbility', + ["retrieve", "touchGuide", "gesture"] + ).then(() => { + console.info(`AccessibilityEventTest enableAbility: then`); + }).catch((err) => { + console.error(`AccessibilityEventTest enableAbility has error: ${err.code}`); + }); + + setTimeout(done, 5000); }) afterAll(async function (done) { console.info('AccessibilityEventTest: afterAll'); commonEvent.unsubscribe(subScriber); isConnected = false; - done(); + config.disableAbility('com.example.accessibilityxts/AccessibilityExtAbility').then(() => { + console.info(`AccessibilityEventTest disableAbility: then`); + }).catch((err) => { + console.error(`AccessibilityEventTest disableAbility has error: ${err.code}`); + }); + setTimeout(done, 5000); }) beforeEach(async function (done) { diff --git a/barrierfree/accessibilityevent/entry/src/main/module.json b/barrierfree/accessibilityevent/entry/src/main/module.json index 9e08a2a2088e6692756df291b05d6fea063304a1..3bfff5b0dfde1e23ba06dde75cfe7027d2d3fa1a 100644 --- a/barrierfree/accessibilityevent/entry/src/main/module.json +++ b/barrierfree/accessibilityevent/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/barrierfree/accessibilityextension/Test.json b/barrierfree/accessibilityextension/Test.json index cc51fdeb7c5ba23867d46ab8f3caa6c28ca2a7e3..4158a3bd330b28859dabf1d3cbbfb02b13fd44a4 100644 --- a/barrierfree/accessibilityextension/Test.json +++ b/barrierfree/accessibilityextension/Test.json @@ -11,18 +11,10 @@ "kits": [ { "test-file-name": [ - "aceTest.hap", "ActsAccessibilityExtensionTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true - }, - { - "type": "ShellKit", - "teardown-command":[ - "bm uninstall -n com.example.accessibilityxts", - "bm uninstall -n com.example.acetest" - ] } ] } \ No newline at end of file diff --git a/barrierfree/accessibilityextension/entry/src/main/ets/test/AccessibilityExtension.test.ets b/barrierfree/accessibilityextension/entry/src/main/ets/test/AccessibilityExtension.test.ets index 122c63b2c0d2c1df1b9dfb7a09b5acc5b4068f1d..0cf73d0079db1dcdd32315785da80ca2b9f3c609 100644 --- a/barrierfree/accessibilityextension/entry/src/main/ets/test/AccessibilityExtension.test.ets +++ b/barrierfree/accessibilityextension/entry/src/main/ets/test/AccessibilityExtension.test.ets @@ -14,6 +14,7 @@ */ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" import commonEvent from '@ohos.commonEvent' +import config from '@ohos.accessibility.config' export default function abilityTest() { let isCalled: boolean = false; @@ -57,12 +58,12 @@ export default function abilityTest() { */ it('AccessibilityExtensionTest_Connect_0100', 0, async function (done) { console.info('AccessibilityExtensionTest_Connect_0100: start'); - await globalThis.abilityContext.startAbility({ - deviceId: "", - bundleName: "com.example.acetest", - abilityName: "MainAbility", - action: "action1", - parameters: {}, + config.enableAbility('com.example.accessibilityxts/AccessibilityExtAbility', + ["retrieve", "touchGuide", "gesture"] + ).then(() => { + console.info(`AccessibilityExtensionTest enableAbility: then`); + }).catch((err) => { + console.error(`AccessibilityExtensionTest enableAbility has error: ${err.code}`); }); setTimeout(() => { @@ -82,11 +83,10 @@ export default function abilityTest() { */ it('AccessibilityExtensionTest_Disconnect_0200', 0, async function (done) { console.info('AccessibilityExtensionTest_Disconnect_0200 start'); - let commonEventPublishData = { - data: 'disable' - } - commonEvent.publish('disableExtAbility', commonEventPublishData, (err) => { - console.info("AccessibilityExtensionTest_Disconnect_0200 publish event: " + JSON.stringify(commonEventPublishData)); + config.disableAbility('com.example.accessibilityxts/AccessibilityExtAbility').then(() => { + console.info(`AccessibilityExtensionTest disableAbility: then`); + }).catch((err) => { + console.error(`AccessibilityExtensionTest disableAbility has error: ${err.code}`); }); setTimeout(() => { diff --git a/barrierfree/accessibilityextension/entry/src/main/module.json b/barrierfree/accessibilityextension/entry/src/main/module.json index 9e08a2a2088e6692756df291b05d6fea063304a1..3bfff5b0dfde1e23ba06dde75cfe7027d2d3fa1a 100644 --- a/barrierfree/accessibilityextension/entry/src/main/module.json +++ b/barrierfree/accessibilityextension/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/barrierfree/accessibilityextensioncontext/Test.json b/barrierfree/accessibilityextensioncontext/Test.json index 7e686e0d543c8648be8fa983d6da1f3b170aab90..2a684e585d7a8439798fbacff5cf0675b896fb58 100644 --- a/barrierfree/accessibilityextensioncontext/Test.json +++ b/barrierfree/accessibilityextensioncontext/Test.json @@ -11,7 +11,6 @@ "kits": [ { "test-file-name": [ - "aceTest.hap", "ActsAccessibilityExtensionContextTest.hap" ], "type": "AppInstallKit", @@ -19,9 +18,8 @@ }, { "type": "ShellKit", - "teardown-command":[ - "bm uninstall -n com.example.accessibilityxts", - "bm uninstall -n com.example.acetest" + "run-command": [ + "param set persist.ace.testmode.enabled 1" ] } ] diff --git a/barrierfree/accessibilityextensioncontext/entry/src/main/ets/AccessibilityExtAbility/ExtensionContextTest.ts b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/AccessibilityExtAbility/ExtensionContextTest.ts index 2408768b5e91292fd82f9fb7b20f71a5a18ec77d..f2cd57e626ce118599fce9a496ca2cad110ffdcf 100644 --- a/barrierfree/accessibilityextensioncontext/entry/src/main/ets/AccessibilityExtAbility/ExtensionContextTest.ts +++ b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/AccessibilityExtAbility/ExtensionContextTest.ts @@ -14,7 +14,8 @@ */ import commonEvent from '@ohos.commonEvent'; import display from '@ohos.display' -import accessibility from '@ohos.accessibility' +import { GesturePath } from '@ohos.accessibility.GesturePath'; +import { GesturePoint } from '@ohos.accessibility.GesturePoint'; export class ExtensionContextTest { private context = undefined; @@ -52,14 +53,10 @@ export class ExtensionContextTest { private async processCase(caseName) { console.info('ExtensionContextTest processCase: ' + caseName); - let eventType: Array = []; let bundleName: Array = []; let windowId = -1; let displayId = -1; - let gesturePath = {}; - let gesturePos1 = {}; - let gesturePos2 = {}; - let gesturePos3 = {}; + let gesturePath; switch (caseName) { case 'AccessibilityExtensionContextTest_setTargetBundleName_asyncCallback_1500': @@ -138,67 +135,43 @@ 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}; + gesturePath = new GesturePath(100); + gesturePath.points.push(new GesturePoint(10, 10)); this.gestureInjectCallback(caseName, gesturePath); break; case 'AccessibilityExtensionContextTest_gestureInject_asyncCallback_4600': - gesturePos1 = {positionX: 50, positionY: 50}; - gesturePath = {points: [gesturePos1], durationTime: 60000}; + gesturePath = new GesturePath(60000); + gesturePath.points.push(new GesturePoint(50, 50)); this.gestureInjectCallback(caseName, gesturePath); break; case 'AccessibilityExtensionContextTest_gestureInject_asyncCallback_4700': - gesturePos1 = {positionX: 200, positionY: 200}; - gesturePos2 = {positionX: 100, positionY: 100}; - gesturePath = {points: [gesturePos1, gesturePos2], durationTime: 1000}; + gesturePath = new GesturePath(1000); + gesturePath.points.push(new GesturePoint(200, 200), + new GesturePoint(100, 100)); this.gestureInjectCallback(caseName, gesturePath); break; case 'AccessibilityExtensionContextTest_gestureInject_asyncCallback_4800': - gesturePos1 = {positionX: 50, positionY: 50}; - gesturePos2 = {positionX: 100, positionY: 100}; - gesturePos3 = {positionX: 1000, positionY: 1000}; - gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3], durationTime: 60000}; + gesturePath = new GesturePath(60000); + gesturePath.points.push(new GesturePoint(50, 50), + new GesturePoint(100, 100), + new GesturePoint(1000, 1000)); this.gestureInjectCallback(caseName, gesturePath); break; case 'AccessibilityExtensionContextTest_gestureInject_asyncCallback_4900': @@ -206,26 +179,26 @@ export class ExtensionContextTest { this.gestureInjectCallback(caseName, gesturePath); break; case 'AccessibilityExtensionContextTest_gestureInject_asyncPromise_5000': - gesturePos1 = {positionX: 10, positionY: 10}; - gesturePath = {points: [gesturePos1], durationTime: 100}; + gesturePath = new GesturePath(100); + gesturePath.points.push(new GesturePoint(10, 10)); this.gestureInjectPromise(caseName, gesturePath); break; case 'AccessibilityExtensionContextTest_gestureInject_asyncPromise_5100': - gesturePos1 = {positionX: 50, positionY: 50}; - gesturePath = {points: [gesturePos1], durationTime: 60000}; + gesturePath = new GesturePath(60000); + gesturePath.points.push(new GesturePoint(50, 50)); this.gestureInjectPromise(caseName, gesturePath); break; case 'AccessibilityExtensionContextTest_gestureInject_asyncPromise_5200': - gesturePos1 = {positionX: 200, positionY: 200}; - gesturePos2 = {positionX: 100, positionY: 100}; - gesturePath = {points: [gesturePos1, gesturePos2], durationTime: 1000}; + gesturePath = new GesturePath(1000); + gesturePath.points.push(new GesturePoint(200, 200), + new GesturePoint(100, 100)); this.gestureInjectPromise(caseName, gesturePath); break; case 'AccessibilityExtensionContextTest_gestureInject_asyncPromise_5300': - gesturePos1 = {positionX: 50, positionY: 50}; - gesturePos2 = {positionX: 100, positionY: 100}; - gesturePos3 = {positionX: 1000, positionY: 1000}; - gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3], durationTime: 60000}; + gesturePath = new GesturePath(60000); + gesturePath.points.push(new GesturePoint(50, 50), + new GesturePoint(100, 100), + new GesturePoint(1000, 1000)); this.gestureInjectPromise(caseName, gesturePath); break; case 'AccessibilityExtensionContextTest_gestureInject_asyncPromise_5400': diff --git a/barrierfree/accessibilityextensioncontext/entry/src/main/ets/MainAbility/pages/index/index.ets b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/MainAbility/pages/index/index.ets index bf2bfe04597d272c2ca46893adf3b35ec6614416..93f4b2ac33caf457736cbe195a58a6d84d145358 100644 --- a/barrierfree/accessibilityextensioncontext/entry/src/main/ets/MainAbility/pages/index/index.ets +++ b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -18,7 +18,7 @@ import file from '@system.file'; @Entry @Component struct Index { - @State message: string = 'Extension Context'; + @State message: string = 'accessibility ExtensionContext'; aboutToAppear(){ console.info("start run testcase!!!!"); @@ -28,8 +28,26 @@ struct Index { Row() { Column() { Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) + .fontSize(50) + .fontWeight(FontWeight.Bold) + .margin({bottom: 10}) + + Row() { + Button('left') + Button('button1') + .margin({ + left: 10, + right: 10 + }) + Button('right') + } + .margin({bottom: 10}) + + Button('button2') + .margin({bottom: 10}) + + Button('button3') + .margin({bottom: 10}) } .width('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 7e1a7f327af00f6fe96c5aa8a1bc8416af51ae81..9984f0498fa0c6959b239b2236e07ef2d04c0f18 100644 --- a/barrierfree/accessibilityextensioncontext/entry/src/main/ets/test/AccessibilityExtensionContext.test.ets +++ b/barrierfree/accessibilityextensioncontext/entry/src/main/ets/test/AccessibilityExtensionContext.test.ets @@ -14,6 +14,7 @@ */ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" import commonEvent from '@ohos.commonEvent' +import config from '@ohos.accessibility.config' const passStr = 'pass'; const failStr = 'fail'; @@ -48,21 +49,27 @@ export default function abilityTest() { } }); - await globalThis.abilityContext.startAbility({ - deviceId: '', - bundleName: 'com.example.acetest', - abilityName: 'MainAbility', - action: 'action1', - parameters: {}, + config.enableAbility('com.example.accessibilityxts/AccessibilityExtAbility', + ["retrieve", "touchGuide", "gesture"] + ).then(() => { + console.info(`AccessibilityExtensionContextTest enableAbility: then`); + }).catch((err) => { + console.error(`AccessibilityExtensionContextTest enableAbility has error: ${err.code}`); }); - setTimeout(done, 3000); + + setTimeout(done, 5000); }) afterAll(async function (done) { console.info('AccessibilityElementTest: afterAll'); commonEvent.unsubscribe(subScriber); isConnect = false; - done(); + config.disableAbility('com.example.accessibilityxts/AccessibilityExtAbility').then(() => { + console.info(`AccessibilityExtensionContextTest disableAbility: then`); + }).catch((err) => { + console.error(`AccessibilityExtensionContextTest disableAbility has error: ${err.code}`); + }); + setTimeout(done, 5000); }) beforeEach(async function (done) { @@ -744,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 @@ -844,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 @@ -910,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 @@ -976,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 @@ -1043,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/barrierfree/accessibilityextensioncontext/entry/src/main/module.json b/barrierfree/accessibilityextensioncontext/entry/src/main/module.json index 904276339f82cf4e40ef5919cd69f8ea1ee09224..70ec2a32ef45b8af550590178fa4e47d7c5af7f0 100644 --- a/barrierfree/accessibilityextensioncontext/entry/src/main/module.json +++ b/barrierfree/accessibilityextensioncontext/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/barrierfree/accessibilitygestureevent/Test.json b/barrierfree/accessibilitygestureevent/Test.json index 969789426df3250712ee9f8d84bd52aa498ff4cd..cf2a19da206f0c041edf854a881d82a8e0e26f83 100644 --- a/barrierfree/accessibilitygestureevent/Test.json +++ b/barrierfree/accessibilitygestureevent/Test.json @@ -11,18 +11,10 @@ "kits": [ { "test-file-name": [ - "aceTest.hap", "ActsAccessibilityGestureEventTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true - }, - { - "type": "ShellKit", - "teardown-command":[ - "bm uninstall -n com.example.accessibilityxts", - "bm uninstall -n com.example.acetest" - ] } ] } diff --git a/barrierfree/accessibilitygestureevent/entry/src/main/ets/AccessibilityExtAbility/GestureEventTest.ts b/barrierfree/accessibilitygestureevent/entry/src/main/ets/AccessibilityExtAbility/GestureEventTest.ts index 3e078792098b4de52b4dd300fe2dab3298a1b700..130c8dcf15a719fa1a59477b3636487272dbe518 100644 --- a/barrierfree/accessibilitygestureevent/entry/src/main/ets/AccessibilityExtAbility/GestureEventTest.ts +++ b/barrierfree/accessibilitygestureevent/entry/src/main/ets/AccessibilityExtAbility/GestureEventTest.ts @@ -13,6 +13,8 @@ * limitations under the License. */ import commonEvent from '@ohos.commonEvent'; +import { GesturePath } from '@ohos.accessibility.GesturePath'; +import { GesturePoint } from '@ohos.accessibility.GesturePoint'; export class GestureEventTest { private context = undefined; @@ -38,239 +40,196 @@ export class GestureEventTest { private async processCase(caseName) { console.info('GestureEventTest processCase start'); - let gesturePath = {}; - let gesturePos1 = {}; - let gesturePos2 = {}; - let gesturePos3 = {}; - let gesturePos4 = {}; - let gesturePos5 = {}; - let gesturePos6 = {}; - let gesturePos7 = {}; - let gesturePos8 = {}; - let gesturePos9 = {}; - let gesturePos10 = {}; - let gesturePos11 = {}; + let gesturePath = new GesturePath(100); switch (caseName) { case 'AccessibilityGestureEventTest_0100'://'left' console.info('GestureEventTest processCase left'); - gesturePos1 = {positionX: 676, positionY: 735}; - gesturePos2 = {positionX: 567, positionY: 729}; - gesturePos3 = {positionX: 444, positionY: 719}; - gesturePos4 = {positionX: 255, positionY: 714}; - gesturePos5 = {positionX: 153, positionY: 715}; - gesturePos6 = {positionX: 15, positionY: 729}; - gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, gesturePos6], durationTime: 100}; + gesturePath.points.push(new GesturePoint(676, 735), + new GesturePoint(567, 729), + new GesturePoint(444, 719), + new GesturePoint(255, 714), + new GesturePoint(153, 715), + new GesturePoint(15, 729)); this.gestureInject(caseName, gesturePath); break; case 'AccessibilityGestureEventTest_0200'://'leftThenRight' console.info('GestureEventTest processCase leftThenRight'); - gesturePos1 = {positionX: 685, positionY: 798}; - gesturePos2 = {positionX: 575, positionY: 792}; - gesturePos3 = {positionX: 446, positionY: 785}; - gesturePos4 = {positionX: 285, positionY: 784}; - gesturePos5 = {positionX: 206, positionY: 785}; - gesturePos6 = {positionX: 87, positionY: 787}; - gesturePos7 = {positionX: 401, positionY: 772}; - gesturePos8 = {positionX: 535, positionY: 786}; - gesturePos9 = {positionX: 714, positionY: 806}; - gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, - gesturePos6, gesturePos7, gesturePos8, gesturePos9], durationTime: 100}; + gesturePath.points.push(new GesturePoint(685, 798), + new GesturePoint(575, 792), + new GesturePoint(446, 785), + new GesturePoint(285, 784), + new GesturePoint(206, 785), + new GesturePoint(87, 787), + new GesturePoint(401, 772), + new GesturePoint(535, 786), + new GesturePoint(714, 806)); this.gestureInject(caseName, gesturePath); break; case 'AccessibilityGestureEventTest_0300'://'leftThenUp' - console.info('GestureEventTest processCase leftThenUp'); - gesturePos1 = {positionX: 652, positionY: 903}; - gesturePos2 = {positionX: 570, positionY: 905}; - gesturePos3 = {positionX: 460, positionY: 920}; - gesturePos4 = {positionX: 280, positionY: 737}; - gesturePos5 = {positionX: 281, positionY: 555}; - gesturePos6 = {positionX: 285, positionY: 333}; - gesturePos7 = {positionX: 284, positionY: 116}; - gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, - gesturePos6, gesturePos7], durationTime: 100}; + console.info('GestureEventTest processCase leftThenUp'); + gesturePath.points.push(new GesturePoint(652, 903), + new GesturePoint(570, 905), + new GesturePoint(460, 920), + new GesturePoint(280, 737), + new GesturePoint(281, 555), + new GesturePoint(285, 333), + new GesturePoint(284, 116)); this.gestureInject(caseName, gesturePath); break; case 'AccessibilityGestureEventTest_0400'://'leftThenDown' - console.info('GestureEventTest processCase leftThenDown'); - gesturePos1 = {positionX: 583, positionY: 520}; - gesturePos2 = {positionX: 468, positionY: 485}; - gesturePos3 = {positionX: 377, positionY: 456}; - gesturePos4 = {positionX: 289, positionY: 435}; - gesturePos5 = {positionX: 283, positionY: 626}; - gesturePos6 = {positionX: 308, positionY: 836}; - gesturePos7 = {positionX: 335, positionY: 1108}; - gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, - gesturePos6, gesturePos7], durationTime: 100}; + console.info('GestureEventTest processCase leftThenDown'); + gesturePath.points.push(new GesturePoint(583, 520), + new GesturePoint(468, 485), + new GesturePoint(377, 456), + new GesturePoint(289, 435), + new GesturePoint(283, 626), + new GesturePoint(308, 836), + new GesturePoint(335, 1108)); this.gestureInject(caseName, gesturePath); break; case 'AccessibilityGestureEventTest_0500'://'right' - console.info('GestureEventTest processCase right'); - gesturePos1 = {positionX: 77, positionY: 589}; - gesturePos2 = {positionX: 185, positionY: 589}; - gesturePos3 = {positionX: 318, positionY: 589}; - gesturePos4 = {positionX: 499, positionY: 589}; - gesturePos5 = {positionX: 630, positionY: 588}; - gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5], durationTime: 100}; + console.info('GestureEventTest processCase right'); + gesturePath.points.push(new GesturePoint(77, 589), + new GesturePoint(185, 589), + new GesturePoint(318, 589), + new GesturePoint(499, 589), + new GesturePoint(630, 588)); this.gestureInject(caseName, gesturePath); break; case 'AccessibilityGestureEventTest_0600'://'rightThenLeft' - console.info('GestureEventTest processCase rightThenLeft'); - gesturePos1 = {positionX: 174, positionY: 731}; - gesturePos2 = {positionX: 251, positionY: 743}; - gesturePos3 = {positionX: 393, positionY: 772}; - gesturePos4 = {positionX: 673, positionY: 817}; - gesturePos5 = {positionX: 591, positionY: 805}; - gesturePos6 = {positionX: 511, positionY: 791}; - gesturePos7 = {positionX: 423, positionY: 779}; - gesturePos8 = {positionX: 333, positionY: 768}; - gesturePos9 = {positionX: 244, positionY: 764}; - gesturePos10 = {positionX: 167, positionY: 759}; - gesturePos11 = {positionX: 71, positionY: 755}; - gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, - gesturePos6, gesturePos7, gesturePos8, gesturePos9, gesturePos10, - gesturePos11], durationTime: 100}; + console.info('GestureEventTest processCase rightThenLeft'); + gesturePath.points.push(new GesturePoint(174, 731), + new GesturePoint(251, 743), + new GesturePoint(393, 772), + new GesturePoint(673, 817), + new GesturePoint(591, 805), + new GesturePoint(511, 791), + new GesturePoint(423, 779), + new GesturePoint(333, 768), + new GesturePoint(244, 764), + new GesturePoint(167, 759), + new GesturePoint(71, 755)); this.gestureInject(caseName, gesturePath); break; case 'AccessibilityGestureEventTest_0700'://'rightThenUp' - console.info('GestureEventTest processCase rightThenUp'); - gesturePos1 = {positionX: 117, positionY: 950}; - gesturePos2 = {positionX: 216, positionY: 950}; - gesturePos3 = {positionX: 311, positionY: 950}; - gesturePos4 = {positionX: 438, positionY: 933}; - gesturePos5 = {positionX: 491, positionY: 791}; - gesturePos6 = {positionX: 478, positionY: 622}; - gesturePos7 = {positionX: 471, positionY: 473}; - gesturePos8 = {positionX: 464, positionY: 320}; - gesturePos9 = {positionX: 458, positionY: 186}; - gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, - gesturePos6, gesturePos7, gesturePos8, gesturePos9], durationTime: 100}; + console.info('GestureEventTest processCase rightThenUp'); + gesturePath.points.push(new GesturePoint(117, 950), + new GesturePoint(216, 950), + new GesturePoint(311, 950), + new GesturePoint(438, 933), + new GesturePoint(491, 791), + new GesturePoint(478, 622), + new GesturePoint(471, 473), + new GesturePoint(464, 320), + new GesturePoint(458, 186)); this.gestureInject(caseName, gesturePath); break; case 'AccessibilityGestureEventTest_0800'://'rightThenDown' - console.info('GestureEventTest processCase rightThenDown'); - gesturePos1 = {positionX: 204, positionY: 501}; - gesturePos2 = {positionX: 307, positionY: 486}; - gesturePos3 = {positionX: 422, positionY: 478}; - gesturePos4 = {positionX: 547, positionY: 604}; - gesturePos5 = {positionX: 440, positionY: 771}; - gesturePos6 = {positionX: 348, positionY: 906}; - gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, - gesturePos6], durationTime: 100}; + console.info('GestureEventTest processCase rightThenDown'); + gesturePath.points.push(new GesturePoint(204, 501), + new GesturePoint(307, 486), + new GesturePoint(422, 478), + new GesturePoint(547, 604), + new GesturePoint(440, 771), + new GesturePoint(348, 906)); this.gestureInject(caseName, gesturePath); break; case 'AccessibilityGestureEventTest_0900'://'up' - console.info('GestureEventTest processCase up'); - gesturePos1 = {positionX: 372, positionY: 1053}; - gesturePos2 = {positionX: 355, positionY: 873}; - gesturePos3 = {positionX: 320, positionY: 558}; - gesturePos4 = {positionX: 296, positionY: 314}; - gesturePos5 = {positionX: 285, positionY: 163}; - gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5], durationTime: 100}; + console.info('GestureEventTest processCase up'); + gesturePath.points.push(new GesturePoint(372, 1053), + new GesturePoint(355, 873), + new GesturePoint(320, 558), + new GesturePoint(296, 314), + new GesturePoint(285, 163)); this.gestureInject(caseName, gesturePath); break; case 'AccessibilityGestureEventTest_1000'://'upThenLeft' - console.info('GestureEventTest processCase upThenLeft'); - gesturePos1 = {positionX: 437, positionY: 1139}; - gesturePos2 = {positionX: 437, positionY: 985}; - gesturePos3 = {positionX: 453, positionY: 739}; - gesturePos4 = {positionX: 466, positionY: 591}; - gesturePos5 = {positionX: 483, positionY: 455}; - gesturePos6 = {positionX: 489, positionY: 321}; - gesturePos7 = {positionX: 383, positionY: 274}; - gesturePos8 = {positionX: 258, positionY: 273}; - gesturePos9 = {positionX: 179, positionY: 276}; - gesturePos10 = {positionX: 102, positionY: 286}; - gesturePos11 = {positionX: 3, positionY: 298}; - gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, - gesturePos6, gesturePos7, gesturePos8, gesturePos9, gesturePos10, - gesturePos11], durationTime: 100}; + console.info('GestureEventTest processCase upThenLeft'); + gesturePath.points.push(new GesturePoint(437, 1139), + new GesturePoint(437, 985), + new GesturePoint(453, 739), + new GesturePoint(466, 591), + new GesturePoint(483, 455), + new GesturePoint(489, 321), + new GesturePoint(383, 274), + new GesturePoint(258, 273), + new GesturePoint(179, 276), + new GesturePoint(102, 286), + new GesturePoint(3, 298)); this.gestureInject(caseName, gesturePath); break; case 'AccessibilityGestureEventTest_1100'://'upThenRight' - console.info('GestureEventTest processCase upThenRight'); - gesturePos1 = {positionX: 332, positionY: 1143}; - gesturePos2 = {positionX: 322, positionY: 973}; - gesturePos3 = {positionX: 300, positionY: 779}; - gesturePos4 = {positionX: 276, positionY: 627}; - gesturePos5 = {positionX: 259, positionY: 496}; - gesturePos6 = {positionX: 375, positionY: 406}; - gesturePos7 = {positionX: 468, positionY: 409}; - gesturePos8 = {positionX: 704, positionY: 436}; - gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, - gesturePos6, gesturePos7, gesturePos8], durationTime: 100}; + console.info('GestureEventTest processCase upThenRight'); + gesturePath.points.push(new GesturePoint(332, 1143), + new GesturePoint(322, 973), + new GesturePoint(300, 779), + new GesturePoint(276, 627), + new GesturePoint(259, 496), + new GesturePoint(375, 406), + new GesturePoint(468, 409), + new GesturePoint(704, 436)); this.gestureInject(caseName, gesturePath); break; case 'AccessibilityGestureEventTest_1200'://'upThenDown' - console.info('GestureEventTest processCase upThenDown'); - gesturePos1 = {positionX: 377, positionY: 1047}; - gesturePos2 = {positionX: 368, positionY: 863}; - gesturePos3 = {positionX: 355, positionY: 564}; - gesturePos4 = {positionX: 339, positionY: 353}; - gesturePos5 = {positionX: 331, positionY: 210}; - gesturePos6 = {positionX: 361, positionY: 409}; - gesturePos7 = {positionX: 375, positionY: 665}; - gesturePos8 = {positionX: 380, positionY: 824}; - gesturePos9 = {positionX: 386, positionY: 977}; - gesturePos10 = {positionX: 393, positionY: 1177}; - gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, - gesturePos6, gesturePos7, gesturePos8, gesturePos9, gesturePos10], - durationTime: 100}; + console.info('GestureEventTest processCase upThenDown'); + gesturePath.points.push(new GesturePoint(377, 1047), + new GesturePoint(368, 863), + new GesturePoint(355, 564), + new GesturePoint(339, 353), + new GesturePoint(331, 210), + new GesturePoint(361, 409), + new GesturePoint(375, 665), + new GesturePoint(380, 824), + new GesturePoint(386, 977), + new GesturePoint(393, 1177)); this.gestureInject(caseName, gesturePath); break; case 'AccessibilityGestureEventTest_1300'://'down' - console.info('GestureEventTest processCase down'); - gesturePos1 = {positionX: 352, positionY: 250}; - gesturePos2 = {positionX: 371, positionY: 462}; - gesturePos3 = {positionX: 377, positionY: 828}; - gesturePos4 = {positionX: 378, positionY: 956}; - gesturePos5 = {positionX: 385, positionY: 1121}; - gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5], durationTime: 100}; + console.info('GestureEventTest processCase down'); + gesturePath.points.push(new GesturePoint(352, 250), + new GesturePoint(371, 462), + new GesturePoint(377, 828), + new GesturePoint(378, 956), + new GesturePoint(385, 1121)); this.gestureInject(caseName, gesturePath); break; case 'AccessibilityGestureEventTest_1400'://'downThenLeft' - console.info('GestureEventTest processCase downThenLeft'); - gesturePos1 = {positionX: 404, positionY: 177}; - gesturePos2 = {positionX: 406, positionY: 318}; - gesturePos3 = {positionX: 405, positionY: 459}; - gesturePos4 = {positionX: 415, positionY: 764}; - gesturePos5 = {positionX: 432, positionY: 910}; - gesturePos6 = {positionX: 335, positionY: 935}; - gesturePos7 = {positionX: 262, positionY: 934}; - gesturePos8 = {positionX: 182, positionY: 933}; - gesturePos9 = {positionX: 24, positionY: 929}; - gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, - gesturePos6, gesturePos7, gesturePos8, gesturePos9], durationTime: 100}; + console.info('GestureEventTest processCase downThenLeft'); + gesturePath.points.push(new GesturePoint(404, 177), + new GesturePoint(406, 318), + new GesturePoint(405, 459), + new GesturePoint(415, 764), + new GesturePoint(432, 910), + new GesturePoint(335, 935), + new GesturePoint(262, 934), + new GesturePoint(182, 933), + new GesturePoint(24, 929)); this.gestureInject(caseName, gesturePath); break; case 'AccessibilityGestureEventTest_1500'://'downThenRight' - console.info('GestureEventTest processCase downThenRight'); - gesturePos1 = {positionX: 317, positionY: 247}; - gesturePos2 = {positionX: 318, positionY: 393}; - gesturePos3 = {positionX: 299, positionY: 614}; - gesturePos4 = {positionX: 280, positionY: 766}; - gesturePos5 = {positionX: 278, positionY: 919}; - gesturePos6 = {positionX: 419, positionY: 961}; - gesturePos7 = {positionX: 502, positionY: 957}; - gesturePos8 = {positionX: 627, positionY: 939}; - gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, - gesturePos6, gesturePos7, gesturePos8], durationTime: 100}; + console.info('GestureEventTest processCase downThenRight'); + gesturePath.points.push(new GesturePoint(317, 247), + new GesturePoint(318, 393), + new GesturePoint(299, 614), + new GesturePoint(280, 766), + new GesturePoint(278, 919), + new GesturePoint(419, 961), + new GesturePoint(502, 957), + new GesturePoint(627, 939)); this.gestureInject(caseName, gesturePath); break; case 'AccessibilityGestureEventTest_1600'://'downThenUp' - console.info('GestureEventTest processCase downThenUp'); - gesturePos1 = {positionX: 321, positionY: 213}; - gesturePos2 = {positionX: 346, positionY: 407}; - gesturePos3 = {positionX: 354, positionY: 664}; - gesturePos4 = {positionX: 356, positionY: 833}; - gesturePos5 = {positionX: 358, positionY: 970}; - gesturePos6 = {positionX: 357, positionY: 738}; - gesturePos7 = {positionX: 349, positionY: 603}; - gesturePos8 = {positionX: 344, positionY: 450}; - gesturePos9 = {positionX: 342, positionY: 304}; - gesturePos10 = {positionX: 340, positionY: 115}; - gesturePath = {points: [gesturePos1, gesturePos2, gesturePos3, gesturePos4, gesturePos5, - gesturePos6, gesturePos7, gesturePos8, gesturePos9, gesturePos10], - durationTime: 100}; + console.info('GestureEventTest processCase downThenUp'); + gesturePath.points.push(new GesturePoint(321, 213), + new GesturePoint(346, 407), + new GesturePoint(354, 664), + new GesturePoint(356, 833), + new GesturePoint(358, 970), + new GesturePoint(357, 738), + new GesturePoint(349, 603), + new GesturePoint(344, 450), + new GesturePoint(342, 304), + new GesturePoint(340, 115)); this.gestureInject(caseName, gesturePath); break; default: diff --git a/barrierfree/accessibilitygestureevent/entry/src/main/ets/test/AccessibilityGestureEventTest.test.ets b/barrierfree/accessibilitygestureevent/entry/src/main/ets/test/AccessibilityGestureEventTest.test.ets index 99c52221dabea66614e8b87dea9a1f6ccdbc11a7..222c3fea855030400f6452e2d178e6c3274c1d01 100644 --- a/barrierfree/accessibilitygestureevent/entry/src/main/ets/test/AccessibilityGestureEventTest.test.ets +++ b/barrierfree/accessibilitygestureevent/entry/src/main/ets/test/AccessibilityGestureEventTest.test.ets @@ -14,6 +14,7 @@ */ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' import commonEvent from '@ohos.commonEvent' +import config from '@ohos.accessibility.config' function publishCaseExecute(caseName: string) { let commonEventPublishData = { @@ -45,21 +46,26 @@ export default function abilityTest() { } }); - await globalThis.abilityContext.startAbility({ - deviceId: '', - bundleName: 'com.example.acetest', - abilityName: 'MainAbility', - action: 'action1', - parameters: {}, + config.enableAbility('com.example.accessibilityxts/AccessibilityExtAbility', + ["retrieve", "touchGuide", "gesture"] + ).then(() => { + console.info(`AccessibilityGestureEventTest enableAbility: then`); + }).catch((err) => { + console.error(`AccessibilityGestureEventTest enableAbility has error: ${err.code}`); }); + setTimeout(done, 3000); }) afterAll(async function (done) { console.info('AccessibilityGestureEventTest: afterAll'); commonEvent.unsubscribe(subScriber); - isConnect = false; - done(); + config.disableAbility('com.example.accessibilityxts/AccessibilityExtAbility').then(() => { + console.info(`AccessibilityGestureEventTest disableAbility: then`); + }).catch((err) => { + console.error(`AccessibilityGestureEventTest disableAbility has error: ${err.code}`); + }); + setTimeout(done, 5000); }) beforeEach(async function (done) { diff --git a/barrierfree/accessibilitygestureevent/entry/src/main/module.json b/barrierfree/accessibilitygestureevent/entry/src/main/module.json index 9e08a2a2088e6692756df291b05d6fea063304a1..3bfff5b0dfde1e23ba06dde75cfe7027d2d3fa1a 100644 --- a/barrierfree/accessibilitygestureevent/entry/src/main/module.json +++ b/barrierfree/accessibilitygestureevent/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/barrierfree/accessibleabilitylist/BUILD.gn b/barrierfree/accessibleabilitylist/BUILD.gn index fdafb485904cbf14c1f67e5ed4b39c2417eff68f..4abbd388c232b0c34cf431239e08835d039c1a1c 100644 --- a/barrierfree/accessibleabilitylist/BUILD.gn +++ b/barrierfree/accessibleabilitylist/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/barrierfree/accessibleabilitylist/src/main/config.json b/barrierfree/accessibleabilitylist/src/main/config.json index 3e4075966d2e4d4a63cc368bd7a9f9b00f047c76..befae1bda09dacfeb806293948d6581deed9b8d5 100644 --- a/barrierfree/accessibleabilitylist/src/main/config.json +++ b/barrierfree/accessibleabilitylist/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/barrierfree/accessiblecaptionconfiguration/BUILD.gn b/barrierfree/accessiblecaptionconfiguration/BUILD.gn index be576f239480ffd68ed4eb3b389a7f4f2e386cd7..1b735f9c8f67e43874f24181ae0dc560c91441f2 100644 --- a/barrierfree/accessiblecaptionconfiguration/BUILD.gn +++ b/barrierfree/accessiblecaptionconfiguration/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/barrierfree/accessiblecaptionconfiguration/src/main/config.json b/barrierfree/accessiblecaptionconfiguration/src/main/config.json index 70874871f7d7c6b0fcd39367c8b10afdb40f73e5..af0a52f3b65a7f4ac9131a5d519e8267b6e2058a 100644 --- a/barrierfree/accessiblecaptionconfiguration/src/main/config.json +++ b/barrierfree/accessiblecaptionconfiguration/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.accessiblecaptionconfiguration", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/barrierfree/accessiblecaptionconfiguration/src/main/js/test/AccessibleCaptionConfiguration.test.js b/barrierfree/accessiblecaptionconfiguration/src/main/js/test/AccessibleCaptionConfiguration.test.js index 63efe95d0b7d54b4a0b558541513fc0a047a6422..e63be4f7b7f73b07b9f616c7517004a05b841726 100644 --- a/barrierfree/accessiblecaptionconfiguration/src/main/js/test/AccessibleCaptionConfiguration.test.js +++ b/barrierfree/accessiblecaptionconfiguration/src/main/js/test/AccessibleCaptionConfiguration.test.js @@ -164,744 +164,5 @@ describe('AccessibleCaptionConfiguration', function () { expect(ret).assertEqual(undefined); done(); }) - - - - /* - * @tc.number CaptionConfiguration_0090 - * @tc.name CaptionConfiguration_0090 - * @tc.desc Test captionManager.style.fontFamily function by assigning "default". - * captionManager.style.fontFamily will be "default" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0090', 0, async function (done) { - console.info('CaptionConfiguration_0090'); - let captionManager = accessibility.getCaptionsManager(); - let fontFamily = "default"; - captionManager.style.fontFamily = fontFamily; - let value = captionManager.style.fontFamily; - expect(value).assertEqual(fontFamily); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0100 - * @tc.name CaptionConfiguration_0100 - * @tc.desc Test captionManager.style.fontFamily function by assigning "monospacedSerif". - * captionManager.style.fontFamily will be "monospacedSerif" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0100', 0, async function (done) { - console.info('CaptionConfiguration_0100'); - let captionManager = accessibility.getCaptionsManager(); - let fontFamily = "monospacedSerif"; - captionManager.style.fontFamily = fontFamily; - let value = captionManager.style.fontFamily; - expect(value).assertEqual(fontFamily); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0110 - * @tc.name CaptionConfiguration_0110 - * @tc.desc Test captionManager.style.fontFamily function by assigning "serif". - * captionManager.style.fontFamily will be "serif" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0110', 0, async function (done) { - console.info('CaptionConfiguration_0110'); - let captionManager = accessibility.getCaptionsManager(); - let fontFamily = "serif"; - captionManager.style.fontFamily = fontFamily; - let value = captionManager.style.fontFamily; - expect(value).assertEqual(fontFamily); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0120 - * @tc.name CaptionConfiguration_0120 - * @tc.desc Test captionManager.style.fontFamily function by assigning "monospacedSansSerif". - * captionManager.style.fontFamily will be "monospacedSansSerif" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0120', 0, async function (done) { - console.info('CaptionConfiguration_0120'); - let captionManager = accessibility.getCaptionsManager(); - let fontFamily = "monospacedSansSerif"; - captionManager.style.fontFamily = fontFamily; - let value = captionManager.style.fontFamily; - expect(value).assertEqual(fontFamily); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0130 - * @tc.name CaptionConfiguration_0130 - * @tc.desc Test captionManager.style.fontFamily function by assigning "sansSerif". - * captionManager.style.fontFamily will be "sansSerif" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0130', 0, async function (done) { - console.info('CaptionConfiguration_0130'); - let captionManager = accessibility.getCaptionsManager(); - let fontFamily = "sansSerif"; - captionManager.style.fontFamily = fontFamily; - let value = captionManager.style.fontFamily; - expect(value).assertEqual(fontFamily); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0140 - * @tc.name CaptionConfiguration_0140 - * @tc.desc Test captionManager.style.fontFamily function by assigning "casual". - * captionManager.style.fontFamily will be "casual" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0140', 0, async function (done) { - console.info('CaptionConfiguration_0140'); - let captionManager = accessibility.getCaptionsManager(); - let fontFamily = "casual"; - captionManager.style.fontFamily = fontFamily; - let value = captionManager.style.fontFamily; - expect(value).assertEqual(fontFamily); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0150 - * @tc.name CaptionConfiguration_0150 - * @tc.desc Test captionManager.style.fontFamily function by assigning "cursive". - * captionManager.style.fontFamily will be "cursive" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0150', 0, async function (done) { - console.info('CaptionConfiguration_0150'); - let captionManager = accessibility.getCaptionsManager(); - let fontFamily = "cursive"; - captionManager.style.fontFamily = fontFamily; - let value = captionManager.style.fontFamily; - expect(value).assertEqual(fontFamily); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0160 - * @tc.name CaptionConfiguration_0160 - * @tc.desc Test captionManager.style.fontFamily function by assigning "smallCapitals". - * captionManager.style.fontFamily will be "smallCapitals" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0160', 0, async function (done) { - console.info('CaptionConfiguration_0160'); - let captionManager = accessibility.getCaptionsManager(); - let fontFamily = "smallCapitals"; - captionManager.style.fontFamily = fontFamily; - let value = captionManager.style.fontFamily; - expect(value).assertEqual(fontFamily); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0170 - * @tc.name CaptionConfiguration_0170 - * @tc.desc Test captionManager.style.fontFamily function by assigning "". - * captionManager.style.fontFamily will be "" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0170', 0, async function (done) { - console.info('CaptionConfiguration_0170'); - let captionManager = accessibility.getCaptionsManager(); - let fontFamily = ""; - captionManager.style.fontFamily = fontFamily; - let value = captionManager.style.fontFamily; - expect(value).assertEqual(fontFamily); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0180 - * @tc.name CaptionConfiguration_0180 - * @tc.desc Test captionManager.style.fontFamily function by assigning null. - * captionManager.style.fontFamily will be '' - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0180', 0, async function (done) { - console.info('CaptionConfiguration_0180'); - let captionManager = accessibility.getCaptionsManager(); - let fontFamily = null; - captionManager.style.fontFamily = fontFamily; - let value = captionManager.style.fontFamily; - expect(value).assertEqual(''); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0190 - * @tc.name CaptionConfiguration_0190 - * @tc.desc Test captionManager.style.fontScale function by assigning 9007199254740992. - * captionManager.style.fontScale will be 0 - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0190', 0, async function (done) { - console.info('CaptionConfiguration_0190'); - let captionManager = accessibility.getCaptionsManager(); - let fontScale = 9007199254740992; - captionManager.style.fontScale = fontScale; - let value = captionManager.style.fontScale; - expect(value).assertEqual(0); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0200 - * @tc.name CaptionConfiguration_0200 - * @tc.desc Test captionManager.style.fontScale function by assigning 1. - * captionManager.style.fontScale will be 1 - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0200', 0, async function (done) { - console.info('CaptionConfiguration_0200'); - let captionManager = accessibility.getCaptionsManager(); - let fontScale = 1; - captionManager.style.fontScale = fontScale; - let value = captionManager.style.fontScale; - expect(value).assertEqual(fontScale); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0210 - * @tc.name CaptionConfiguration_0210 - * @tc.desc Test captionManager.style.fontScale function by assigning 0. - * captionManager.style.fontScale will be 0 - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0210', 0, async function (done) { - console.info('CaptionConfiguration_0210'); - let captionManager = accessibility.getCaptionsManager(); - let fontScale = 0; - captionManager.style.fontScale = fontScale; - let value = captionManager.style.fontScale; - expect(value).assertEqual(fontScale); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0220 - * @tc.name CaptionConfiguration_0220 - * @tc.desc Test captionManager.style.fontScale function by assigning -1. - * captionManager.style.fontScale will be -1 - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0220', 0, async function (done) { - console.info('CaptionConfiguration_0220'); - let captionManager = accessibility.getCaptionsManager(); - let fontScale = -1; - captionManager.style.fontScale = fontScale; - let value = captionManager.style.fontScale; - expect(value).assertEqual(fontScale); - done(); - }) - - - /* - * @tc.number CaptionConfiguration_0230 - * @tc.name CaptionConfiguration_0230 - * @tc.desc Test captionManager.style.fontColor function by assigning "#12345678". - * captionManager.style.fontColor will be "#12345678" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0230', 0, async function (done) { - console.info('CaptionConfiguration_0230'); - let captionManager = accessibility.getCaptionsManager(); - let fontColor ="#12345678"; - captionManager.style.fontColor = fontColor; - let value = captionManager.style.fontColor; - expect(value).assertEqual(fontColor); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0240 - * @tc.name CaptionConfiguration_0240 - * @tc.desc Test captionManager.style.fontColor function by assigning "". - * captionManager.style.fontColor will be "" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0240', 0, async function (done) { - console.info('CaptionConfiguration_0240'); - let captionManager = accessibility.getCaptionsManager(); - let fontColor ="#"; - captionManager.style.fontColor = fontColor; - let value = captionManager.style.fontColor; - expect(value).assertEqual("#00000000"); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0250 - * @tc.name CaptionConfiguration_0250 - * @tc.desc Test captionManager.style.fontColor function by assigning null. - * captionManager.style.fontColor will be "#00000000" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0250', 0, async function (done) { - console.info('CaptionConfiguration_0250'); - let captionManager = accessibility.getCaptionsManager(); - let fontColor = null; - captionManager.style.fontColor = fontColor; - let value = captionManager.style.fontColor; - expect(value).assertEqual("#00000000"); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0260 - * @tc.name CaptionConfiguration_0260 - * @tc.desc Test captionManager.style.fontColor function by assigning 0x12345678. - * captionManager.style.fontColor will be "#34567812" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0260', 0, async function (done) { - console.info('CaptionConfiguration_0260'); - let captionManager = accessibility.getCaptionsManager(); - let fontColor = 0x12345678; - captionManager.style.fontColor = fontColor; - let value = captionManager.style.fontColor; - expect(value).assertEqual("#34567812"); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0270 - * @tc.name CaptionConfiguration_0270 - * @tc.desc Test captionManager.style.fontColor function by assigning 0. - * captionManager.style.fontColor will be "#00000000" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0270', 0, async function (done) { - console.info('CaptionConfiguration_0270'); - let captionManager = accessibility.getCaptionsManager(); - let fontColor = 0; - captionManager.style.fontColor = fontColor; - let value = captionManager.style.fontColor; - expect(value).assertEqual("#00000000"); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0280 - * @tc.name CaptionConfiguration_0280 - * @tc.desc Test captionManager.style.fontColor function by assigning -1. - * captionManager.style.fontColor will be "#ffffffff" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0280', 0, async function (done) { - console.info('CaptionConfiguration_0280'); - let captionManager = accessibility.getCaptionsManager(); - let fontColor = -1; - captionManager.style.fontColor = fontColor; - let value = captionManager.style.fontColor; - expect(value).assertEqual("#ffffffff"); - done(); - }) - - - /* - * @tc.number CaptionConfiguration_0290 - * @tc.name CaptionConfiguration_0290 - * @tc.desc Test captionManager.style.fontEdgeType function by assigning "none". - * captionManager.style.fontEdgeType will be "none" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0290', 0, async function (done) { - console.info('CaptionConfiguration_0290'); - let captionManager = accessibility.getCaptionsManager(); - let fontEdgeType = "none"; - captionManager.style.fontEdgeType = fontEdgeType; - let value = captionManager.style.fontEdgeType; - expect(value).assertEqual(fontEdgeType); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0300 - * @tc.name CaptionConfiguration_0300 - * @tc.desc Test captionManager.style.fontEdgeType function by assigning "raised". - * captionManager.style.fontEdgeType will be "raised" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0300', 0, async function (done) { - console.info('CaptionConfiguration_0300'); - let captionManager = accessibility.getCaptionsManager(); - let fontEdgeType = "raised"; - captionManager.style.fontEdgeType = fontEdgeType; - let value = captionManager.style.fontEdgeType; - expect(value).assertEqual(fontEdgeType); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0310 - * @tc.name CaptionConfiguration_0310 - * @tc.desc Test captionManager.style.fontEdgeType function by assigning "depressed". - * captionManager.style.fontEdgeType will be "depressed" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0310', 0, async function (done) { - console.info('CaptionConfiguration_0310'); - let captionManager = accessibility.getCaptionsManager(); - let fontEdgeType = "depressed"; - captionManager.style.fontEdgeType = fontEdgeType; - let value = captionManager.style.fontEdgeType; - expect(value).assertEqual(fontEdgeType); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0320 - * @tc.name CaptionConfiguration_0320 - * @tc.desc Test captionManager.style.fontEdgeType function by assigning "uniform". - * captionManager.style.fontEdgeType will be "uniform" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0320', 0, async function (done) { - console.info('CaptionConfiguration_0320'); - let captionManager = accessibility.getCaptionsManager(); - let fontEdgeType = "uniform"; - captionManager.style.fontEdgeType = fontEdgeType; - let value = captionManager.style.fontEdgeType; - expect(value).assertEqual(fontEdgeType); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0330 - * @tc.name CaptionConfiguration_0330 - * @tc.desc Test captionManager.style.fontEdgeType function by assigning "dropShadow". - * captionManager.style.fontEdgeType will be "dropShadow" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0330', 0, async function (done) { - console.info('CaptionConfiguration_0330'); - let captionManager = accessibility.getCaptionsManager(); - let fontEdgeType = "dropShadow"; - captionManager.style.fontEdgeType = fontEdgeType; - let value = captionManager.style.fontEdgeType; - expect(value).assertEqual(fontEdgeType); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0340 - * @tc.name CaptionConfiguration_0340 - * @tc.desc Test captionManager.style.fontEdgeType function by assigning "". - * captionManager.style.fontEdgeType will be "" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0340', 0, async function (done) { - console.info('CaptionConfiguration_0340'); - let captionManager = accessibility.getCaptionsManager(); - let fontEdgeType = ""; - captionManager.style.fontEdgeType = fontEdgeType; - let value = captionManager.style.fontEdgeType; - expect(value).assertEqual(fontEdgeType); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0350 - * @tc.name CaptionConfiguration_0350 - * @tc.desc Test captionManager.style.fontEdgeType function by assigning null. - * captionManager.style.fontEdgeType will be '' - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0350', 0, async function (done) { - console.info('CaptionConfiguration_0350'); - let captionManager = accessibility.getCaptionsManager(); - let fontEdgeType = null; - captionManager.style.fontEdgeType = fontEdgeType; - let value = captionManager.style.fontEdgeType; - expect(value).assertEqual(''); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0360 - * @tc.name CaptionConfiguration_0360 - * @tc.desc Test captionManager.style.backgroundColor function by assigning "#12345678". - * captionManager.style.backgroundColor will be "#12345678" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0360', 0, async function (done) { - console.info('CaptionConfiguration_0360'); - let captionManager = accessibility.getCaptionsManager(); - let backgroundColor ="#12345678"; - captionManager.style.backgroundColor = backgroundColor; - let value = captionManager.style.backgroundColor; - expect(value).assertEqual(backgroundColor); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0370 - * @tc.name CaptionConfiguration_0370 - * @tc.desc Test captionManager.style.backgroundColor function by assigning "". - * captionManager.style.backgroundColor will be "#00000000" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0370', 0, async function (done) { - console.info('CaptionConfiguration_0370'); - let captionManager = accessibility.getCaptionsManager(); - let backgroundColor = ""; - captionManager.style.backgroundColor = backgroundColor; - let value = captionManager.style.backgroundColor; - expect(value).assertEqual("#00000000"); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0380 - * @tc.name CaptionConfiguration_0380 - * @tc.desc Test captionManager.style.backgroundColor function by assigning null. - * captionManager.style.backgroundColor will be "#00000000" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0380', 0, async function (done) { - console.info('CaptionConfiguration_0380'); - let captionManager = accessibility.getCaptionsManager(); - let backgroundColor = null; - captionManager.style.backgroundColor = backgroundColor; - let value = captionManager.style.backgroundColor; - expect(value).assertEqual("#00000000"); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0390 - * @tc.name CaptionConfiguration_0390 - * @tc.desc Test captionManager.style.backgroundColor function by assigning 0x12345678. - * captionManager.style.backgroundColor will be "#34567812" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0390', 0, async function (done) { - console.info('CaptionConfiguration_0390'); - let captionManager = accessibility.getCaptionsManager(); - let backgroundColor = 0x12345678; - captionManager.style.backgroundColor = backgroundColor; - let value = captionManager.style.backgroundColor; - expect(value).assertEqual("#34567812"); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0400 - * @tc.name CaptionConfiguration_0400 - * @tc.desc Test captionManager.style.backgroundColor function by assigning 0. - * captionManager.style.backgroundColor will be "#00000000" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0400', 0, async function (done) { - console.info('CaptionConfiguration_0400'); - let captionManager = accessibility.getCaptionsManager(); - let backgroundColor = 0; - captionManager.style.backgroundColor = backgroundColor; - let value = captionManager.style.backgroundColor; - expect(value).assertEqual("#00000000"); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0410 - * @tc.name CaptionConfiguration_0410 - * @tc.desc Test captionManager.style.backgroundColor function by assigning -1. - * captionManager.style.backgroundColor will be "#ffffffff" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0410', 0, async function (done) { - console.info('CaptionConfiguration_0410'); - let captionManager = accessibility.getCaptionsManager(); - let backgroundColor = -1; - captionManager.style.backgroundColor = backgroundColor; - let value = captionManager.style.backgroundColor; - expect(value).assertEqual("#ffffffff"); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0420 - * @tc.name CaptionConfiguration_0420 - * @tc.desc Test captionManager.style.windowColor function by assigning "#12345678". - * captionManager.style.windowColor will be "#12345678" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0420', 0, async function (done) { - console.info('CaptionConfiguration_0420'); - let captionManager = accessibility.getCaptionsManager(); - let windowColor ="#12345678"; - captionManager.style.windowColor = windowColor; - let value = captionManager.style.windowColor; - expect(value).assertEqual(windowColor); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0430 - * @tc.name CaptionConfiguration_0430 - * @tc.desc Test captionManager.style.windowColor function by assigning "". - * captionManager.style.windowColor will be "" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0430', 0, async function (done) { - console.info('CaptionConfiguration_0430'); - let captionManager = accessibility.getCaptionsManager(); - let windowColor =""; - captionManager.style.windowColor = windowColor; - let value = captionManager.style.windowColor; - expect(value).assertEqual("#00000000"); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0440 - * @tc.name CaptionConfiguration_0440 - * @tc.desc Test captionManager.style.windowColor function by assigning null. - * captionManager.style.windowColor will be "#00000000" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0440', 0, async function (done) { - console.info('CaptionConfiguration_0440'); - let captionManager = accessibility.getCaptionsManager(); - let windowColor = null; - captionManager.style.windowColor = windowColor; - let value = captionManager.style.windowColor; - expect(value).assertEqual("#00000000"); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0450 - * @tc.name CaptionConfiguration_0450 - * @tc.desc Test captionManager.style.windowColor function by assigning 0x12345678. - * captionManager.style.windowColor will be "#34567812" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0450', 0, async function (done) { - console.info('CaptionConfiguration_0450'); - let captionManager = accessibility.getCaptionsManager(); - let windowColor = 0x12345678; - captionManager.style.windowColor = windowColor; - let value = captionManager.style.windowColor; - expect(value).assertEqual("#34567812"); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0460 - * @tc.name CaptionConfiguration_0460 - * @tc.desc Test captionManager.style.windowColor function by assigning 0. - * captionManager.style.windowColor will be "#00000000" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0460', 0, async function (done) { - console.info('CaptionConfiguration_0460'); - let captionManager = accessibility.getCaptionsManager(); - let windowColor = 0; - captionManager.style.windowColor = windowColor; - let value = captionManager.style.windowColor; - expect(value).assertEqual("#00000000"); - done(); - }) - - /* - * @tc.number CaptionConfiguration_0470 - * @tc.name CaptionConfiguration_0470 - * @tc.desc Test captionManager.style.windowColor function by assigning -1. - * captionManager.style.windowColor will be "#ffffffff" - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0470', 0, async function (done) { - console.info('CaptionConfiguration_0470'); - let captionManager = accessibility.getCaptionsManager(); - let windowColor = -1; - captionManager.style.windowColor = windowColor; - let value = captionManager.style.windowColor; - expect(value).assertEqual("#ffffffff"); - done(); - }) - - - /* - * @tc.number CaptionConfiguration_0480 - * @tc.name CaptionConfiguration_0480 - * @tc.desc Test captionManager.style function by assigning a value. - * Attributes of captionManager.style will be equal to that of this value - * @tc.size SmallTest - * @tc.type User - */ - it('CaptionConfiguration_0480', 0, async function (done) { - console.info('CaptionConfiguration_0480'); - let captionManager = accessibility.getCaptionsManager(); - let StyleTest = { - fontFamily: "monospacedSerif", - fontScale: 99, - fontColor: "#12345678", - fontEdgeType: "uniform", - backgroundColor: "#23456789", - windowColor: "#34567890" - }; - captionManager.style = StyleTest; - let value = captionManager.style; - expect(value.fontFamily).assertEqual(StyleTest.fontFamily); - expect(value.fontScale).assertEqual(StyleTest.fontScale); - expect(value.fontColor).assertEqual(StyleTest.fontColor); - expect(value.fontEdgeType).assertEqual(StyleTest.fontEdgeType); - expect(value.backgroundColor).assertEqual(StyleTest.backgroundColor); - expect(value.windowColor).assertEqual(StyleTest.windowColor); - done(); - }) - - }) } diff --git a/barrierfree/accessiblecheckability/BUILD.gn b/barrierfree/accessiblecheckability/BUILD.gn index 4f849707c5d200b025a23510caf9b851238708a9..e4749adec15d836575db476f1bafd0e9755b5510 100644 --- a/barrierfree/accessiblecheckability/BUILD.gn +++ b/barrierfree/accessiblecheckability/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/barrierfree/accessiblecheckability/src/main/config.json b/barrierfree/accessiblecheckability/src/main/config.json index aa6fe8ea78ef69799d0eda5bc82048fe5ec546e7..7179db620bd1992d707c708748643012183ff68c 100644 --- a/barrierfree/accessiblecheckability/src/main/config.json +++ b/barrierfree/accessiblecheckability/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.accessiblecheckability", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/barrierfree/accessibleregisterstate/BUILD.gn b/barrierfree/accessibleregisterstate/BUILD.gn index 3f1b44eed44ebd26c898b9b30cc584e7c9ab75d4..e4cac2a48069fce700f8f620e431e32b9a2989d0 100644 --- a/barrierfree/accessibleregisterstate/BUILD.gn +++ b/barrierfree/accessibleregisterstate/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/barrierfree/accessibleregisterstate/src/main/config.json b/barrierfree/accessibleregisterstate/src/main/config.json index 44ccc0f75b72eb9277d083ec5f0690facc80fbc7..952066e85f354ea41b91cf5768adad7df67d4206 100644 --- a/barrierfree/accessibleregisterstate/src/main/config.json +++ b/barrierfree/accessibleregisterstate/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.accessibleregisterstate", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/barrierfree/accessiblesendevent/BUILD.gn b/barrierfree/accessiblesendevent/BUILD.gn index 55d83cca2e8869fe026cd2cea0bee251bcf2d814..6adaa2ce53620ed0a501f5badf4be7869363819b 100644 --- a/barrierfree/accessiblesendevent/BUILD.gn +++ b/barrierfree/accessiblesendevent/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/barrierfree/accessiblesendevent/src/main/config.json b/barrierfree/accessiblesendevent/src/main/config.json index a543b1e738b560d1f24b83d727993be87a71cd1a..a74767a52005befd42c9aa48c319cecce84742a0 100644 --- a/barrierfree/accessiblesendevent/src/main/config.json +++ b/barrierfree/accessiblesendevent/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.accessiblesendevent", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/barrierfree/accessiblesendevent/src/main/js/test/AccessibleSendEvent.test.js b/barrierfree/accessiblesendevent/src/main/js/test/AccessibleSendEvent.test.js index 1089ed85a31218c28f277f24eeb4a95d47c3518f..0d61e18aa691f2bbaf038efda1cc4326f687be45 100644 --- a/barrierfree/accessiblesendevent/src/main/js/test/AccessibleSendEvent.test.js +++ b/barrierfree/accessiblesendevent/src/main/js/test/AccessibleSendEvent.test.js @@ -513,6 +513,39 @@ describe('AccessibleSendEvent', function () { }); }) + /* + * @tc.number SendEvent_windowUpdateType_constructor_0050 + * @tc.name SendEvent_windowUpdateType_constructor_0050 + * @tc.desc The windowUpdateType of EventInfo is '', test sendEvent() function + * The result of sendEvent() should be equal to a promise of undefined + * Another test point is to test whether the modified constructor (EventInfo) + * works correctly. + * @tc.size SmallTest + * @tc.type User + */ + it('SendEvent_windowUpdateType_constructor_0050', 0, async function (done) { + console.info(`AccessibleSendEvent: SendEvent_windowUpdateType_constructor_0050 starts`); + + let windowUpdateType = 'add'; + let jsonObj = { + type : eventType, + windowUpdateType : windowUpdateType, + bundleName : bundleName, + triggerAction : triggerAction, + } + + let event = new accessibility.EventInfo(jsonObj); + + accessibility.sendEvent(event).then((result) => { + expect(result).assertEqual(undefined); + done(); + }).catch(err => { + console.error(`AccessibleSendEvent: SendEvent_windowUpdateType_constructor_0050 has error: ${err}`); + expect(null).assertFail(); + done(); + }); + }) + /* * @tc.number SendEvent_windowUpdateType_constructor_0060 * @tc.name SendEvent_windowUpdateType_constructor_0060 diff --git a/barrierfree/accessibletest/BUILD.gn b/barrierfree/accessibletest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..bacf236cb3aba186a8c0488caca0cd8986c3a6d3 --- /dev/null +++ b/barrierfree/accessibletest/BUILD.gn @@ -0,0 +1,29 @@ +# 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") + +group("actsaccessibletest") { + testonly = true + if (is_standard_system) { + deps = [ + "actsabilitylisttest:ActsAbilityListTest", + "actscaptionconfigurationtest:ActsCaptionConfigurationTest", + "sceneProject/accessibilityAudibleAbility:accessibilityAudibleAbility", + "sceneProject/accessibilityGenericAbility:accessibilityGenericAbility", + "sceneProject/accessibilityHapticAbility:accessibilityHapticAbility", + "sceneProject/accessibilitySpokenAbility:accessibilitySpokenAbility", + "sceneProject/accessibilityVisualAbility:accessibilityVisualAbility", + ] + } +} diff --git a/barrierfree/accessibletest/actsabilitylisttest/AppScope/app.json b/barrierfree/accessibletest/actsabilitylisttest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..e7e8606d8f5ee69b2cb72f71f1089957136af670 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.abilitylisttest", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/barrierfree/accessibletest/actsabilitylisttest/AppScope/resources/base/element/string.json b/barrierfree/accessibletest/actsabilitylisttest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b9d556bebf5f976578683fc750102cc13e853127 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AbilityListTest" + } + ] +} diff --git a/barrierfree/accessibletest/actsabilitylisttest/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibletest/actsabilitylisttest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/actsabilitylisttest/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibletest/actsabilitylisttest/BUILD.gn b/barrierfree/accessibletest/actsabilitylisttest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..50796edf680f4a68e4bd873f35f869b53d5c6b78 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAbilityListTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessible_js_assets", + ":accessible_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAbilityListTest" + subsystem_name = "barrierfree" + part_name = "accessibility" +} + +ohos_app_scope("accessible_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessible_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessible_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessible_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibletest/actsabilitylisttest/Test.json b/barrierfree/accessibletest/actsabilitylisttest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..e2657e4c96e6ef2b7be916c421d3d7afd3710089 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/Test.json @@ -0,0 +1,36 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "280000", + "bundle-name": "com.example.abilitylisttest", + "module-name": "phone", + "shell-timeout": "600000", + "testcase-timeout": 70000 + }, + "kits": [ + { + "test-file-name": [ + "ActsAbilityListTest.hap", + "accessibilityAudibleAbility.hap", + "accessibilityGenericAbility.hap", + "accessibilityHapticAbility.hap", + "accessibilitySpokenAbility.hap", + "accessibilityVisualAbility.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "teardown-command":[ + "bm uninstall -n com.example.abilitylisttest", + "bm uninstall -n com.example.accessibleaudibleability.hmservice", + "bm uninstall -n com.example.accessiblegenericability.hmservice", + "bm uninstall -n com.example.accessiblehapticability.hmservice", + "bm uninstall -n com.example.accessiblespokenability.hmservice", + "bm uninstall -n com.example.accessiblevisualability.hmservice" + ] + } + ] +} diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..4972d0cb74d9e97563c81264a0c2cb9d290d353e --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/Application/AbilityStage.ts @@ -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. + */ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[AbilityListTest] MyAbilityStage onCreate") + globalThis.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..b17fcff203e5c2c5f770dee0fcfa21a77e15eb14 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,58 @@ +/* + * 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' +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; + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "MainAbility/pages/index", 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/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/MainAbility/pages/index.ets b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..2c7c2522fcd119c87bf7e6c2831297c6d0e59548 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,121 @@ +/* + * 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 file from '@system.file' +import config from '@ohos.accessibility.config' +import accessibility from '@ohos.accessibility' +import prompt from '@ohos.prompt' + +const AUDIBLE_BUNDLE_NAME = 'com.example.accessibleaudibleability.hmservice/ServiceExtAbility' +const GENERIC_BUNDLE_NAME = 'com.example.accessiblegenericability.hmservice/ServiceExtAbility' +const HAPTIC_BUNDLE_NAME = 'com.example.accessiblehapticability.hmservice/ServiceExtAbility' +const SPOKEN_BUNDLE_NAME = 'com.example.accessiblespokenability.hmservice/ServiceExtAbility' +const VISUAL_BUNDLE_NAME = 'com.example.accessiblevisualability.hmservice/ServiceExtAbility' +const LOG_PREFIX = '[CQH-ABILITY-LIST-TEST-MANUAL]' + +@Entry +@Component +struct Index { + @State message: string = 'AbilityListTest' + @State abilityListsCallBack: string = '' + @State abilityListsPromise: string = '' + + aboutToAppear() { + console.info("start run aboutToAppear") + } + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button('AbilityList_0170-0180启动辅助应用') + .fontSize(25) + .fontWeight(FontWeight.Bold) + .margin(5) + .onClick((e) => { + this.enableAbility(LOG_PREFIX, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + }) + Button('AbilityList_0170-0180关闭辅助应用') + .fontSize(25) + .fontWeight(FontWeight.Bold) + .margin(5) + .onClick((e) => { + this.disableAbility(LOG_PREFIX, [AUDIBLE_BUNDLE_NAME]) + }) + Button('AbilityList_0170(callback)查询辅助应用') + .fontSize(25) + .fontWeight(FontWeight.Bold) + .margin(5) + .onClick((e) => { + accessibility.getAbilityLists('all', 'enable', (err, data) => { + if (err.code != 0) { + console.error(LOG_PREFIX + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.error(LOG_PREFIX + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.error(LOG_PREFIX + 'data.length : ' + JSON.stringify(data.length)) + this.abilityListsCallBack = JSON.stringify(data) + }) + }) + Text(this.abilityListsCallBack) + .fontSize(25) + Button('AbilityList_0180(promise)查询辅助应用') + .fontSize(25) + .fontWeight(FontWeight.Bold) + .margin(5) + .onClick((e) => { + accessibility.getAbilityLists('all', 'enable').then((data) => { + console.error(LOG_PREFIX + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.error(LOG_PREFIX + 'data.length : ' + JSON.stringify(data.length)) + this.abilityListsPromise = JSON.stringify(data) + }).catch((err) => { + console.error(LOG_PREFIX + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }) + Text(this.abilityListsPromise) + .fontSize(25) + } + .width('100%') + } + .height('100%') + } + + enableAbility(logTag, bundleNameArr) { + for (let bundleName of bundleNameArr) { + config.enableAbility(bundleName, ['retrieve']).then((data) => { + console.error(logTag + 'enableAbility ' + bundleName + ' success. data: ' + JSON.stringify(data)) + prompt.showToast({ message: '启动应用成功'}) + }).catch((error) => { + console.error(logTag + 'enableAbility ' + bundleName + ' failed. Cause: ' + JSON.stringify(error)) + prompt.showToast({ message: '启动应用异常'}) + return + }) + } + } + + disableAbility(logTag, bundleNameArr) { + for (let bundleName of bundleNameArr) { + config.disableAbility(bundleName).then((data) => { + console.error(logTag + 'disableAbility ' + bundleName + ' success. data: ' + JSON.stringify(data)) + prompt.showToast({ message: '关闭应用成功'}) + }).catch((error) => { + console.error(logTag + 'disableAbility ' + bundleName + ' failed. Cause: ' + JSON.stringify(error)) + prompt.showToast({ message: '关闭应用异常'}) + return + }) + } + } +} diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/TestAbility/TestAbility.ts b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..20877f79a5ad57aa25c107d236bd4c3835d0d472 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/TestAbility/TestAbility.ts @@ -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 Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.loadContent("TestAbility/pages/index", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) + }); + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/TestAbility/pages/index.ets b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..33b5d087aff46bee138cb4b6086fa0579101c8db --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,48 @@ +/* + * 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 router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('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%') + } + } diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..09b160c7278dd0db1c256d2b489386b1f303acc5 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/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.abilitylisttest.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') + } +}; diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/test/Ability.test.ets b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/test/Ability.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..70340ca88583c613c555e286b5f872560f7cc909 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/test/Ability.test.ets @@ -0,0 +1,624 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import config from '@ohos.accessibility.config' +import accessibility from '@ohos.accessibility' +import prompt from '@ohos.prompt' + +const AUDIBLE_BUNDLE_NAME = 'com.example.accessibleaudibleability.hmservice/ServiceExtAbility' +const GENERIC_BUNDLE_NAME = 'com.example.accessiblegenericability.hmservice/ServiceExtAbility' +const HAPTIC_BUNDLE_NAME = 'com.example.accessiblehapticability.hmservice/ServiceExtAbility' +const SPOKEN_BUNDLE_NAME = 'com.example.accessiblespokenability.hmservice/ServiceExtAbility' +const VISUAL_BUNDLE_NAME = 'com.example.accessiblevisualability.hmservice/ServiceExtAbility' +const LOG_PREFIX = '[CQH-ABILITY-LIST-TEST]' +const TIME_OUT = 3000 +const TIME_OUT_S = 1000 + +export default function abilityTest() { + describe('ActsAbilityListTest', function () { + afterEach(async function (done) { + disableAll(LOG_PREFIX + ' disableAll ') + setTimeout(() => { + done() + }, TIME_OUT) + }) + afterAll(async function (done) { + prompt.showToast({ + message: 'CASE All End' + }) + done() + }) + /** + * @tc.number: AbilityList_0010 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is spoken, stateType is install. + */ + it('AbilityList_0010', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0010 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('spoken', 'install', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0020 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is spoken, stateType is install. + */ + it('AbilityList_0020', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0020 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('spoken', 'install').then((data) => { + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0030 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is audible, stateType is install. + */ + it('AbilityList_0030', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0030 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('audible', 'install', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0040 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is audible, stateType is install. + */ + it('AbilityList_0040', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0040 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('audible', 'install').then((data) => { + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0050 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is visual, stateType is install. + */ + it('AbilityList_0050', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0050 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('visual', 'install', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0060 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is visual, stateType is install. + */ + it('AbilityList_0060', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0060 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('visual', 'install').then((data) => { + console.info(LOG_PREFIX + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0070 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is haptic, stateType is install. + */ + it('AbilityList_0070', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0070 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('haptic', 'install', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0080 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is haptic, stateType is install. + */ + it('AbilityList_0080', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0080 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('haptic', 'install').then((data) => { + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0090 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is generic, stateType is install. + */ + it('AbilityList_0090', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0090 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('generic', 'install', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0100 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is generic, stateType is install. + */ + it('AbilityList_0100', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0100 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('generic', 'install').then((data) => { + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0110 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is all, stateType is enable. + */ + it('AbilityList_0110', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0110 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'enable', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0111 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is all, stateType is enable, get eventTypes. + */ + it('AbilityList_0111', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0111 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'enable', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + let eventTypes = [] + if (data.length > 0) { + eventTypes = data[0].eventTypes + } + expect(eventTypes.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0112 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is all, stateType is enable, get targetBundleNames. + */ + it('AbilityList_0112', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0112 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'enable', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + let targetBundleNames = [] + if (data.length > 0) { + targetBundleNames = data[0].targetBundleNames + } + expect(targetBundleNames.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0113 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is all, stateType is enable, get other attribute. + */ + it('AbilityList_0113', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0113 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'enable', (err, data) => { + if (err.code != 0) { + console.error(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.error(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + let id = '' + let name = '' + let bundleName = '' + let abilityTypes = [] + let capabilities = [] + let description = '' + if (data.length > 0) { + id = data[0].id + name = data[0].name + bundleName = data[0].bundleName + abilityTypes = data[0].abilityTypes + capabilities = data[0].capabilities + description = data[0].description + } + expect(id.length).assertLarger(0) + expect(name.length).assertLarger(0) + expect(bundleName.length).assertLarger(0) + expect(abilityTypes.length).assertLarger(0) + expect(capabilities.length).assertLarger(0) + expect(description.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0120 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is all, stateType is enable. + */ + it('AbilityList_0120', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0120 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'enable').then((data) => { + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0121 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is all, stateType is enable, get eventTypes. + */ + it('AbilityList_0121', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0121 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'enable').then((data) => { + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + let eventTypes = [] + if (data.length > 0) { + eventTypes = data[0].eventTypes + } + expect(eventTypes.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0122 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is all, stateType is enable, get targetBundleNames. + */ + it('AbilityList_0122', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0122 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'enable').then((data) => { + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + let targetBundleNames = [] + if (data.length > 0) { + targetBundleNames = data[0].targetBundleNames + } + expect(targetBundleNames.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0123 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is all, stateType is enable, get other attribute. + */ + it('AbilityList_0123', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0123 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'enable').then((data) => { + console.error(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + let id = '' + let name = '' + let bundleName = '' + let abilityTypes = [] + let capabilities = [] + let description = '' + if (data.length > 0) { + id = data[0].id + name = data[0].name + bundleName = data[0].bundleName + abilityTypes = data[0].abilityTypes + capabilities = data[0].capabilities + description = data[0].description + } + expect(id.length).assertLarger(0) + expect(name.length).assertLarger(0) + expect(bundleName.length).assertLarger(0) + expect(abilityTypes.length).assertLarger(0) + expect(capabilities.length).assertLarger(0) + expect(description.length).assertLarger(0) + done() + }).catch((err) => { + console.error(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0130 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is all, stateType is disable. + */ + it('AbilityList_0130', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0130 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'disable', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0140 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is all, stateType is disable. + */ + it('AbilityList_0140', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0140 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'disable').then((data) => { + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0150 + * @tc.name: getAbilityLists callback API. + * @tc.desc: getAbilityLists callback API abilityType is all, stateType is enable. + */ + it('AbilityList_0150', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0150 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'disable', (err, data) => { + if (err.code != 0) { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + return + } + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + /** + * @tc.number: AbilityList_0160 + * @tc.name: getAbilityLists promise API. + * @tc.desc: getAbilityLists promise API abilityType is all, stateType is enable. + */ + it('AbilityList_0160', 1, async function (done) { + let logTag = LOG_PREFIX + ' AbilityList_0160 ' + enableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME]) + setTimeout(() => { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME]) + setTimeout(() => { + accessibility.getAbilityLists('all', 'disable').then((data) => { + console.info(logTag + 'success data:getAbilityLists : ' + JSON.stringify(data)) + console.info(logTag + 'data.length : ' + JSON.stringify(data.length)) + expect(data.length).assertLarger(0) + done() + }).catch((err) => { + console.info(logTag + 'failed to getAbilityLists because ' + JSON.stringify(err)) + }) + }, TIME_OUT) + }, TIME_OUT_S) + }) + }) + + function enableAbility(logTag, bundleNameArr) { + for (let bundleName of bundleNameArr) { + config.enableAbility(bundleName, ['retrieve']).then(() => { + console.info(logTag + 'enableAbility ' + bundleName + ' success.') + }).catch((error) => { + console.info(logTag + 'enableAbility ' + bundleName + ' failed. Cause: ' + JSON.stringify(error)) + return + }) + } + } + + function disableAbility(logTag, bundleNameArr) { + for (let bundleName of bundleNameArr) { + config.disableAbility(bundleName).then(() => { + console.info(logTag + 'disableAbility ' + bundleName + ' success.') + }).catch((error) => { + console.info(logTag + 'disableAbility ' + bundleName + ' failed. Cause: ' + JSON.stringify(error)) + return + }) + } + } + + function disableAll(logTag) { + disableAbility(logTag, [AUDIBLE_BUNDLE_NAME, GENERIC_BUNDLE_NAME, HAPTIC_BUNDLE_NAME, SPOKEN_BUNDLE_NAME, VISUAL_BUNDLE_NAME]) + } +} diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/test/List.test.ets b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..cb35098ac281d443c7add6de76cee00a268ce092 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * 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 abilityTest from './Ability.test' + +export default function testsuite() { + abilityTest() +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/module.json b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..415d7455e3432627a7484a5557fc684f78d2f38c --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/module.json @@ -0,0 +1,48 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "com.example.abilitylisttest.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.SYSTEM_FLOAT_WINDOW", + "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" + }, + { + "name": "ohos.permission.CAPTURE_SCREEN", + "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" + } + ] + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/resources/base/element/string.json b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..26c6350af6eeb5284556f05dd7a8360a06b2b5f5 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "AbilityListTest entry" + }, + { + "name": "MainAbility_desc", + "value": "AbilityListTest MainAbility" + }, + { + "name": "MainAbility_label", + "value": "AbilityList" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..c1858c216308ad312862a877139a8ba6908ec3c6 --- /dev/null +++ b/barrierfree/accessibletest/actsabilitylisttest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} diff --git a/barrierfree/accessibletest/actsabilitylisttest/signature/openharmony_sx.p7b b/barrierfree/accessibletest/actsabilitylisttest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibletest/actsabilitylisttest/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/AppScope/app.json b/barrierfree/accessibletest/actscaptionconfigurationtest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..c626da84041386e4a7767b2cbfeafe13ac2c8b57 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/AppScope/app.json @@ -0,0 +1,20 @@ +{ + "app": { + "bundleName": "com.example.myapplicationxtsd", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "description": "$string:description_application", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/AppScope/resources/base/element/string.json b/barrierfree/accessibletest/actscaptionconfigurationtest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..bea3196ac976df41039009ea9ba8af2a4c8003a7 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/AppScope/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplicationXtsD" + }, + { + "name": "description_application", + "value": "MyApplicationXtsD" + } + ] +} diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibletest/actscaptionconfigurationtest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/actscaptionconfigurationtest/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/BUILD.gn b/barrierfree/accessibletest/actscaptionconfigurationtest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..321a2b7d93375598fee2924f8328c0a70ea6b457 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsCaptionConfigurationTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessible_js_assets", + ":accessible_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsCaptionConfigurationTest" + subsystem_name = "barrierfree" + part_name = "accessibility" +} + +ohos_app_scope("accessible_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessible_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessible_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessible_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/Test.json b/barrierfree/accessibletest/actscaptionconfigurationtest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..756ab0c14bf06819e04cba78d1671b903e217a1e --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/Test.json @@ -0,0 +1,26 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "500000", + "bundle-name": "com.example.myapplicationxtsd", + "module-name": "phone", + "shell-timeout": "600000", + "testcase-timeout": 70000 + }, + "kits": [ + { + "test-file-name": [ + "ActsCaptionConfigurationTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "teardown-command":[ + "bm uninstall -n com.example.myapplicationxtsd" + ] + } + ] +} diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..add36a172b393fc11866ac788a9a3d8258410cdf --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityStage from "@ohos.application.AbilityStage" +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.info("[Demo] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..871643e56b2d19878104d250c2fecc0f721e4adf --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -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' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' +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; + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + globalThis.windowStage = windowStage + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "MainAbility/pages/index", 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/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/MainAbility/pages/index.ets b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..2427bbde2907b3a624b915bc0f2fbb9cf0ee22a2 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,677 @@ +/* + * 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 file from '@system.file'; +import commonEvent from '@ohos.commonEvent' +import accessibility from '@ohos.accessibility'; +import config from '@ohos.accessibility.config' + +export { }; +const LOG: string = "[xtsLog]"; + +const CaptionConfiguration_0270 = () => { + const caseName = "CaptionConfiguration_0270" + const logTag = LOG + caseName; + config.captions.get().then((res) => { + console.info(logTag + "Config before modification. enabled=" + res); + config.captions.set(!res).then(() => { + console.info(logTag + "Config after modification. enabled=" + !res); + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "caption set err=" + JSON.stringify(err)); + }); + }); +} + +const printCaptionsManagerStyle = (logTag, captionsManager) => { + const back = "{\"fontFamily\":\"" + captionsManager.style.fontFamily + + "\",\"fontScale\":" + captionsManager.style.fontScale + + ",\"fontColor\":\"" + captionsManager.style.fontColor + + "\",\"fontEdgeType\":\"" + captionsManager.style.fontEdgeType + + "\",\"backgroundColor\":\"" + captionsManager.style.backgroundColor + + "\",\"windowColor\":\"" + captionsManager.style.windowColor + "\"}"; + console.info(logTag + back); + return back; +}; + +const printCaptionStyle = (logTag, CaptionStyle) => { + const back = "{\"fontFamily\":\"" + CaptionStyle.fontFamily + + "\",\"fontScale\":" + CaptionStyle.fontScale + + ",\"fontColor\":\"" + CaptionStyle.fontColor + + "\",\"fontEdgeType\":\"" + CaptionStyle.fontEdgeType + + "\",\"backgroundColor\":\"" + CaptionStyle.backgroundColor + + "\",\"windowColor\":\"" + CaptionStyle.windowColor + "\"}"; + console.info(logTag + back); + return back; +}; + +const foreachList = (currValue, array) => { + if (!currValue || currValue.length < 1) { + return array[0]; + } + let result = array[0]; + array.forEach((value, index) => { + if (currValue === value) { + if (array.length > index + 1) { + result = array[index + 1]; + } + } + }); + return result; +} + +const CaptionConfiguration_0280 = () => { + const caseName = "CaptionConfiguration_0280" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontFamily = foreachList(res.fontFamily, ['default', 'monospacedSerif', 'serif', + 'monospacedSansSerif', 'sansSerif', 'casual', 'cursive', 'smallCapitals']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0290 = () => { + const caseName = "CaptionConfiguration_0290" + const logTag = LOG + caseName; + config.captions.get().then((res) => { + console.info(logTag + "Config before modification. enabled=" + res); + config.captions.set(!res).then(() => { + console.info(logTag + "Config after modification. enabled=" + !res); + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "caption set err=" + JSON.stringify(err)); + }); + }); +} + +const CaptionConfiguration_0300 = () => { + const caseName = "CaptionConfiguration_0300" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontFamily = foreachList(res.fontFamily, ['default', 'monospacedSerif', 'serif', + 'monospacedSansSerif', 'sansSerif', 'casual', 'cursive', 'smallCapitals']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0310 = () => { + const caseName = "CaptionConfiguration_0310" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontFamily = foreachList(res.fontFamily, ['default', 'monospacedSerif', 'serif', + 'monospacedSansSerif', 'sansSerif', 'casual', 'cursive', 'smallCapitals']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0320 = () => { + const caseName = "CaptionConfiguration_0320" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontScale = (res.fontScale ?? 0) + 1; + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0330 = () => { + const caseName = "CaptionConfiguration_0330" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontColor = foreachList(res.fontColor, ['red', 'yellow', 'blue', '#FFFFFF', '#000000', 'black', 'white']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0340 = () => { + const caseName = "CaptionConfiguration_0340" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontEdgeType = foreachList(res.fontEdgeType, ['none', 'raised', 'depressed', 'uniform', 'dropShadow']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0090 = () => { + const caseName = "CaptionConfiguration_0090" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.backgroundColor = foreachList(res.backgroundColor, ['red', 'yellow', 'blue', '#ff0000ff', '#ff000000', '#00000000', '#f0000000', 'black', 'white']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0100 = () => { + const caseName = "CaptionConfiguration_0100" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.windowColor = foreachList(res.windowColor, ['red', 'yellow', 'blue', '#ff0000ff', '#ff000000', '#00000000', '#f0000000', 'black', 'white']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0110 = () => { + const caseName = "CaptionConfiguration_0110" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + for (let index = 0; index < 3; index++) { + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.windowColor = foreachList(res.windowColor, ['red', 'yellow', 'blue', '#ff0000ff', '#ff000000', '#00000000', '#f0000000', 'black', 'white']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + } + }) +}; + +const CaptionConfiguration_0120 = () => { + const caseName = "CaptionConfiguration_0120" + const logTag = LOG + caseName; + config.captions.get().then((res) => { + console.info(logTag + "Config before modification. enabled=" + res); + config.captions.set(!res).then(() => { + console.info(logTag + "Config after modification. enabled=" + !res); + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "caption set err=" + JSON.stringify(err)); + }); + }); +}; + +const CaptionConfiguration_0130 = () => { + const caseName = "CaptionConfiguration_0130" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontEdgeType = undefined; + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0140 = () => { + const caseName = "CaptionConfiguration_0140" + const logTag = LOG + caseName; + config.captions.get().then((res) => { + console.info(logTag + "Config before modification. enabled=" + res); + config.captions.set(!res).then(() => { + console.info(logTag + "Config after modification. enabled=" + !res); + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "caption set err=" + JSON.stringify(err)); + }); + }); +}; + +const CaptionConfiguration_0150 = () => { + const caseName = "CaptionConfiguration_0150" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontFamily = foreachList(res.fontFamily, ['default', 'monospacedSerif', 'serif', + 'monospacedSansSerif', 'sansSerif', 'casual', 'cursive', 'smallCapitals']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0160 = () => { + const caseName = "CaptionConfiguration_0160" + const logTag = LOG + caseName; + config.captions.get().then((res) => { + console.info(logTag + "Config before modification. enabled=" + res); + config.captions.set(!res).then(() => { + console.info(logTag + "Config after modification. enabled=" + !res); + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "caption set err=" + JSON.stringify(err)); + }); + }); +}; + +const CaptionConfiguration_0170 = () => { + const caseName = "CaptionConfiguration_0170" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontFamily = foreachList(res.fontFamily, ['default', 'monospacedSerif', 'serif', + 'monospacedSansSerif', 'sansSerif', 'casual', 'cursive', 'smallCapitals']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0180 = () => { + const caseName = "CaptionConfiguration_0180" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontFamily = foreachList(res.fontFamily, ['default', 'monospacedSerif', 'serif', + 'monospacedSansSerif', 'sansSerif', 'casual', 'cursive', 'smallCapitals']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0190 = () => { + const caseName = "CaptionConfiguration_0190" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontScale = (res.fontScale ?? 0) + 1; + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0200 = () => { + const caseName = "CaptionConfiguration_0200" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontColor = foreachList(res.fontColor, ['red', 'yellow', 'blue', '#FFFFFF', '#000000', 'black', 'white']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0210 = () => { + const caseName = "CaptionConfiguration_0210" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontEdgeType = foreachList(res.fontEdgeType, ['none', 'raised', 'depressed', 'uniform', 'dropShadow']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0220 = () => { + const caseName = "CaptionConfiguration_0220" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.backgroundColor = foreachList(res.backgroundColor, ['red', 'yellow', 'blue', '#ff0000ff', '#ff000000', '#00000000', '#f0000000', 'black', 'white']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0230 = () => { + const caseName = "CaptionConfiguration_0230" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.windowColor = foreachList(res.windowColor, ['red', 'yellow', 'blue', '#ff0000ff', '#ff000000', '#00000000', '#f0000000', 'black', 'white']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const CaptionConfiguration_0240 = () => { + const caseName = "CaptionConfiguration_0240" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + for (let index = 0; index < 3; index++) { + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.windowColor = foreachList(res.windowColor, ['red', 'yellow', 'blue', '#ff0000ff', '#ff000000', '#00000000', '#f0000000', 'black', 'white']); + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + } + }) +}; + +const CaptionConfiguration_0260 = () => { + const caseName = "CaptionConfiguration_0260" + const logTag = LOG + caseName; + config.captionsStyle.get().then((res) => { + if (!res) { + console.info(logTag + "captionsStyle is undefined"); + return; + } + var captionsStyle = res; + printCaptionStyle(logTag + "captionsStyle before modification. style=", JSON.stringify(res)); + captionsStyle.fontEdgeType = undefined; + printCaptionStyle(logTag + "captionsStyle after modification. style=", JSON.stringify(captionsStyle)); + config.captionsStyle.set(captionsStyle).then(() => { + commonEventPublishOnTargetChangeExtra(caseName); + }).catch((err) => { + console.info(logTag + "captionsStyle fontFamily set err=" + JSON.stringify(err)); + }); + }) +}; + +const commonEventPublishOnTargetChangeExtra = (caseName) => { + function publishCallback(err) { + console.info(LOG + caseName + " on_target_change_extra publish call back result:" + JSON.stringify(err)); + } + var commonEventPublishData = { + data: caseName + "_on_target_change_extra_success", + } + commonEvent.publish("on_target_change_extra", commonEventPublishData, publishCallback); +} + +const excuteAbility = (data) => { + switch (data) { + case "CaptionConfiguration_0270" + "_AccessibilityApp_start": + CaptionConfiguration_0270() + break; + case "CaptionConfiguration_0280" + "_AccessibilityApp_start": + CaptionConfiguration_0280() + break; + case "CaptionConfiguration_0290" + "_AccessibilityApp_start": + CaptionConfiguration_0290() + break; + case "CaptionConfiguration_0300" + "_AccessibilityApp_start": + CaptionConfiguration_0300() + break; + case "CaptionConfiguration_0310" + "_AccessibilityApp_start": + CaptionConfiguration_0310() + break; + case "CaptionConfiguration_0320" + "_AccessibilityApp_start": + CaptionConfiguration_0320() + break; + case "CaptionConfiguration_0330" + "_AccessibilityApp_start": + CaptionConfiguration_0330() + break; + case "CaptionConfiguration_0340" + "_AccessibilityApp_start": + CaptionConfiguration_0340() + break; + case "CaptionConfiguration_0090" + "_AccessibilityApp_start": + CaptionConfiguration_0090() + break; + case "CaptionConfiguration_0100" + "_AccessibilityApp_start": + CaptionConfiguration_0100() + break; + case "CaptionConfiguration_0110" + "_AccessibilityApp_start": + CaptionConfiguration_0110() + break; + case "CaptionConfiguration_0120" + "_AccessibilityApp_start": + CaptionConfiguration_0120() + break; + case "CaptionConfiguration_0130" + "_AccessibilityApp_start": + CaptionConfiguration_0130() + break; + case "CaptionConfiguration_0140" + "_AccessibilityApp_start": + CaptionConfiguration_0140() + break; + case "CaptionConfiguration_0150" + "_AccessibilityApp_start": + CaptionConfiguration_0150() + break; + case "CaptionConfiguration_0160" + "_AccessibilityApp_start": + CaptionConfiguration_0160() + break; + case "CaptionConfiguration_0170" + "_AccessibilityApp_start": + CaptionConfiguration_0170() + break; + case "CaptionConfiguration_0180" + "_AccessibilityApp_start": + CaptionConfiguration_0180() + break; + case "CaptionConfiguration_0190" + "_AccessibilityApp_start": + CaptionConfiguration_0190() + break; + case "CaptionConfiguration_0200" + "_AccessibilityApp_start": + CaptionConfiguration_0200() + break; + case "CaptionConfiguration_0210" + "_AccessibilityApp_start": + CaptionConfiguration_0210() + break; + case "CaptionConfiguration_0220" + "_AccessibilityApp_start": + CaptionConfiguration_0220() + break; + case "CaptionConfiguration_0230" + "_AccessibilityApp_start": + CaptionConfiguration_0230() + break; + case "CaptionConfiguration_0240" + "_AccessibilityApp_start": + CaptionConfiguration_0240() + break; + case "CaptionConfiguration_0260" + "_AccessibilityApp_start": + CaptionConfiguration_0260() + break; + default: + break; + } +} + +@Entry +@Component +struct Index { + private subScriber = undefined; + aboutToAppear() { + var commonEventSubscribeInfo = { + events: ["on_target_change"] + } + function subscriberCallback(err, data) { + console.info(LOG + "====>Target subscriberCallback start"); + console.info(LOG + "====>Target receive event err:" + JSON.stringify(err)); + console.info(LOG + "====>Target receive event data:" + JSON.stringify(data)); + excuteAbility(data.data); + console.info(LOG + "====>Target subscriberCallback end"); + } + commonEvent.createSubscriber(commonEventSubscribeInfo).then((subscriber) => { + console.info(LOG + "====> Target createSubscriber Start====") + this.subScriber = subscriber; + commonEvent.subscribe(subscriber, subscriberCallback); + console.info(LOG + "====> Target createSubscriber End====") + }) + console.info("start run testcase!!!!"); + } + + aboutToDisappear() { + console.info('TargetApp aboutToDisappear'); + commonEvent.unsubscribe(this.subScriber); + this.subScriber = undefined; + } + + build() { + Row() { + Column() { + Button('CaptionConfiguration') + .fontSize(15) + .fontWeight(FontWeight.Bold) + .margin(5) + .onClick((e) => { + console.info("CaptionConfiguration onClick") + }) + } + .width('100%') + } + .height('100%') + } +} diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/TestAbility/TestAbility.ts b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..20877f79a5ad57aa25c107d236bd4c3835d0d472 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/TestAbility/TestAbility.ts @@ -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 Ability from '@ohos.application.Ability' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../test/List.test' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.loadContent("TestAbility/pages/index", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) + }); + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/TestAbility/pages/index.ets b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..33b5d087aff46bee138cb4b6086fa0579101c8db --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,48 @@ +/* + * 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 router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('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%') + } + } diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..4ce7693d4c47cd4af0c889eb86adc4026995c123 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/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.myapplicationxtsd.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') + } +}; diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/test/CaptionConfiguration.test.ets b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/test/CaptionConfiguration.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9c3d0484d53db708126e9e28a04abe0efcc22532 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/test/CaptionConfiguration.test.ets @@ -0,0 +1,730 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterAll, it, expect } from '@ohos/hypium' +import commonEvent from '@ohos.commonEvent' +import accessibility from '@ohos.accessibility'; +import config from '@ohos.accessibility.config'; +const LOG = "[xtsLog]" +const START_TIMEOUT = 5000; +var backList = [] +let subScriber = undefined; +let registerOn = false; + +const callbackData = (data) => { + console.info(LOG + " captionsManager on res = " + JSON.stringify(data)) + registerOn = true +} + +const CaptionConfigurationOn = (logTag, captionType) => { + let captionsManager = accessibility.getCaptionsManager(); + if (!captionsManager) { + console.info(logTag + " captionsManager is undefined"); + return; + } + captionsManager.on(captionType, callbackData); +} + +const CaptionConfigurationOff = (logTag, captionType) => { + let captionsManager = accessibility.getCaptionsManager(); + if (!captionsManager) { + console.info(logTag + " captionsManager is undefined"); + return; + } + captionsManager.off(captionType, callbackData); +} + +const CaptionConfigurationOffAll = (logTag, captionType) => { + let captionsManager = accessibility.getCaptionsManager(); + if (!captionsManager) { + console.info(logTag + " captionsManager is undefined"); + return; + } + captionsManager.off(captionType); +} + +const captionOn = (logTag, caseName) => { + config.captions.on(callbackData); +} + +const captionOff = (logTag, captionType) => { + config.captions.off(callbackData); +} + +const captionStyleOn = (logTag, caseName) => { + config.captionsStyle.on(callbackData); +} + +const captionStyleOff = (logTag, captionType) => { + config.captionsStyle.off(callbackData); +} + +const excuteCase = (caseNamePara) => { + console.info(LOG + 'AccessibleEventTest excuteCase: ' + caseNamePara); + + function publishCallback(err) { + console.info(LOG + caseNamePara + "on_target_change publish call back result:" + JSON.stringify(err)); + } + + var commonEventPublishData = { + data: caseNamePara + "_AccessibilityApp_start" + } + commonEvent.publish("on_target_change", commonEventPublishData, publishCallback); +} + +export default function CaptionConfigurationTest() { + describe('ActsCaptionConfigurationTest', function () { + beforeEach(async function (done) { + console.info(LOG + 'ActsCaptionConfigurationTest: beforeEach'); + setTimeout(() => { + backList = [] + done(); + }, 1000); + }); + beforeAll(async function (done) { + console.info(LOG + 'ActsCaptionConfigurationTest: beforeAll'); + + subScriber = await commonEvent.createSubscriber({ + events: ['on_target_change_extra'] + }); + console.info(LOG + 'ActsCaptionConfigurationTest beforeAll subscribe send:' + JSON.stringify(subScriber)); + + commonEvent.subscribe(subScriber, (err, data) => { + console.info(LOG + ' ActsCaptionConfigurationTest beforeAll subscribe data:' + JSON.stringify(data)); + if (data.data) { + console.info(LOG + " ActsCaptionConfigurationTest CallBack: " + data.data); + backList.push(data.data) + } + }); + setTimeout(done(), START_TIMEOUT); + }); + + afterAll(async function (done) { + console.info(LOG + 'ActsCaptionConfigurationTest: afterAll'); + setTimeout(function () { + commonEvent.unsubscribe(subScriber); + config.captions.set(false); + let captionsStyle: accessibility.CaptionsStyle = {"fontFamily":"default","fontScale":0,"fontColor":"#000000ff","fontEdgeType":"none","backgroundColor":"#000000ff","windowColor":"#000000ff"}; + config.captionsStyle.set(captionsStyle); + done(); + }, 10000); + }); + + /** + * @tc.number: CaptionConfiguration_0270 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0270', 1, async function (done) { + const caseName = "CaptionConfiguration_0270"; + const logF = LOG + caseName; + registerOn = false; + setTimeout(() => { + CaptionConfigurationOn(caseName, 'enableChange') + }, 1000); + setTimeout(() => { + excuteCase(caseName); + }, 3000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + expect(registerOn).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + CaptionConfigurationOff(caseName, 'enableChange') + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0280 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0280', 1, async function (done) { + const caseName = "CaptionConfiguration_0280"; + const logF = LOG + caseName; + registerOn = false; + CaptionConfigurationOn(caseName, 'styleChange') + setTimeout(() => { + excuteCase(caseName); + }, 3000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + expect(registerOn).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + CaptionConfigurationOffAll(caseName, 'styleChange') + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0290 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0290', 1, async function (done) { + const caseName = "CaptionConfiguration_0290"; + const logF = LOG + caseName; + registerOn = false; + setTimeout(() => { + CaptionConfigurationOn(caseName, 'enableChange'); + }, 1000); + setTimeout(() => { + CaptionConfigurationOff(caseName, 'enableChange') + setTimeout(() => { + excuteCase(caseName); + }, 3000); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + expect(registerOn).assertEqual(false); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0300 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0300', 1, async function (done) { + const caseName = "CaptionConfiguration_0300"; + const logF = LOG + caseName; + registerOn = false; + setTimeout(() => { + CaptionConfigurationOn(caseName, 'styleChange'); + }, 1000); + setTimeout(() => { + CaptionConfigurationOff(caseName, 'styleChange') + setTimeout(() => { + excuteCase(caseName); + }, 3000); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + expect(registerOn).assertEqual(false); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0310 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0310', 1, async function (done) { + const caseName = "CaptionConfiguration_0310"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0320 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0320', 1, async function (done) { + const caseName = "CaptionConfiguration_0320"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0330 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0330', 1, async function (done) { + const caseName = "CaptionConfiguration_0330"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0340 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0340', 1, async function (done) { + const caseName = "CaptionConfiguration_0340"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0090 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0090', 1, async function (done) { + const caseName = "CaptionConfiguration_0090"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0100 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0100', 1, async function (done) { + const caseName = "CaptionConfiguration_0100"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0110 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0110', 1, async function (done) { + const caseName = "CaptionConfiguration_0110"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0120 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0120', 1, async function (done) { + const caseName = "CaptionConfiguration_0120"; + const logF = LOG + caseName; + registerOn = false; + setTimeout(() => { + CaptionConfigurationOn(caseName, undefined); + }, 1000); + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') != -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + expect(registerOn).assertEqual(false); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0130 + * @tc.name: Call api:getcaptionsmanager() to set the caption parameter. + * @tc.desc: Call api:getcaptionsmanager() to set the caption parameter. + */ + it('CaptionConfiguration_0130', 1, async function (done) { + const caseName = "CaptionConfiguration_0130"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0140 + * @tc.name: Call api:config to set the captions parameter. + * @tc.desc: Call api:config to set the captions parameter. + */ + it('CaptionConfiguration_0140', 1, async function (done) { + const caseName = "CaptionConfiguration_0140"; + const logF = LOG + caseName; + registerOn = false; + setTimeout(() => { + captionOn(logF, caseName); + }, 1000); + setTimeout(() => { + excuteCase(caseName); + }, 3000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + expect(registerOn).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + captionOff(logF, caseName); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0150 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0150', 1, async function (done) { + const caseName = "CaptionConfiguration_0150"; + const logF = LOG + caseName; + registerOn = false; + captionStyleOn(logF, caseName); + setTimeout(() => { + excuteCase(caseName); + }, 3000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + expect(registerOn).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + config.captionsStyle.off(); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0160 + * @tc.name: Call api:config to set the captions parameter. + * @tc.desc: Call api:config to set the captions parameter. + */ + it('CaptionConfiguration_0160', 1, async function (done) { + const caseName = "CaptionConfiguration_0160"; + const logF = LOG + caseName; + registerOn = false; + setTimeout(() => { + captionOn(logF, caseName) + }, 1000); + setTimeout(() => { + captionOff(logF, caseName) + setTimeout(() => { + excuteCase(caseName); + }, 3000); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + expect(registerOn).assertEqual(false); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0170 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0170', 1, async function (done) { + const caseName = "CaptionConfiguration_0170"; + const logF = LOG + caseName; + registerOn = false; + setTimeout(() => { + captionStyleOn(logF, caseName); + }, 1000); + setTimeout(() => { + captionStyleOff(logF, caseName) + setTimeout(() => { + excuteCase(caseName); + }, 3000); + }, 2000); + + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + expect(registerOn).assertEqual(false); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0180 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0180', 1, async function (done) { + const caseName = "CaptionConfiguration_0180"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0190 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0190', 1, async function (done) { + const caseName = "CaptionConfiguration_0190"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0200 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0200', 1, async function (done) { + const caseName = "CaptionConfiguration_0200"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0210 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0210', 1, async function (done) { + const caseName = "CaptionConfiguration_0210"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0220 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0220', 1, async function (done) { + const caseName = "CaptionConfiguration_0220"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0230 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0230', 1, async function (done) { + const caseName = "CaptionConfiguration_0230"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0240 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0240', 1, async function (done) { + const caseName = "CaptionConfiguration_0240"; + const logF = LOG + caseName; + setTimeout(() => { + excuteCase(caseName); + }, 2000); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + + /** + * @tc.number: CaptionConfiguration_0260 + * @tc.name: Call api:config to set the captionsStyle parameter. + * @tc.desc: Call api:config to set the captionsStyle parameter. + */ + it('CaptionConfiguration_0260', 1, async function (done) { + const caseName = "CaptionConfiguration_0260"; + const logF = LOG + caseName; + excuteCase(caseName); + setTimeout(() => { + var isSucceedTarget: boolean = false; + if (backList.indexOf(caseName + '_on_target_change_extra_success') !== -1) { + isSucceedTarget = true; + } + expect(isSucceedTarget).assertEqual(true); + console.info(logF + ' isSucceed : ' + (isSucceedTarget)); + done(); + }, 8000); + }); + }) +} diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/test/List.test.ets b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..736fd152148eb4a2c51bd071f744164e674020ed --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * 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 CaptionConfigurationTest from './CaptionConfiguration.test' + +export default function testsuite() { + CaptionConfigurationTest() +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/module.json b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..a5264e6a206aa6dd61cda1a8c17fe31a8b9887f5 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/module.json @@ -0,0 +1,48 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "com.example.myapplicationxtsd.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:entry_desc", + "icon": "$media:icon", + "label": "$string:entry_desc", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.SYSTEM_FLOAT_WINDOW", + "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" + }, + { + "name": "ohos.permission.CAPTURE_SCREEN", + "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" + } + ] + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/element/string.json b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..e533d8e9d7cea8546c278831aac3d5b7b6f96eb1 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,20 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "9xts" + }, + { + "name": "MainAbility_desc", + "value": "9xts" + }, + { + "name": "MainAbility_label", + "value": "9xts" + }, + { + "name": "description_serviceability", + "value": "Accessiable" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/profile/accessibility_config.json b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/profile/accessibility_config.json new file mode 100644 index 0000000000000000000000000000000000000000..d044b388f86e66d0c6412cb286fc52dded2ca3d3 --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/profile/accessibility_config.json @@ -0,0 +1,10 @@ +{ + "accessibilityCapabilities": [ + "retrieve", + "keyEventObserver", + "gesture", + "touchGuide" + ], + "accessibilityCapabilityRationale": "a11y_rationale", + "settingsAbility": "com.example.myapplication.accessibilitySetting" +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..c7cf4ba21afceed8745647810ebec481620a975c --- /dev/null +++ b/barrierfree/accessibletest/actscaptionconfigurationtest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} \ No newline at end of file diff --git a/barrierfree/accessibletest/actscaptionconfigurationtest/signature/openharmony_sx.p7b b/barrierfree/accessibletest/actscaptionconfigurationtest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibletest/actscaptionconfigurationtest/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/AppScope/app.json b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..cbfdbe824e38cd1444889467261a61c8e639f2b6 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.accessibleaudibleability.hmservice", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/AppScope/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0cc5794a55b4d3ba6b0bc45f4a46315236ddd4a2 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AccessibleAudibleAbility" + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/BUILD.gn b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c38234ff28d163be491e1faabf18f2b0813052fd --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("accessibilityAudibleAbility") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessible_js_assets", + ":accessible_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "accessibilityAudibleAbility" + subsystem_name = "barrierfree" + part_name = "accessibility" +} + +ohos_app_scope("accessible_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessible_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessible_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessible_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/Test.json b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..b9f4122fbf466755fe279be1082dcf138af90789 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..3788aefd2346d1170a208d47515b850c0cd27b2f --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +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. + */ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[AccessibleAudibleAbility] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..1cc33db635c16e08a4aea1ddf62473cc494e4459 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[AccessibleAudibleAbility] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[AccessibleAudibleAbility] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[AccessibleAudibleAbility] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "MainAbility/pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[AccessibleAudibleAbility] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[AccessibleAudibleAbility] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[AccessibleAudibleAbility] MainAbility onBackground") + } +}; diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/MainAbility/pages/index.ets b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4c382cf18941ac82d25ab571ebb3879b0f82811 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..959e5a24c978e00f7e6fef9bded2fabde6adfe02 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts @@ -0,0 +1,37 @@ +/* + * 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 AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility' +import commonEvent from '@ohos.commonEvent' + + +const LOG_PREFIX = '[CQH-AUDIBLE-ABILITY-ACCESSIBLE]' +class ServiceExtAbility extends AccessibilityExtensionAbility { + onConnect() { + console.info(LOG_PREFIX + " onConnect") + } + onDisconnect() { + console.info(LOG_PREFIX + " onDisconnect") + } + onAccessibilityEvent(accessibilityEvent) { + console.info(LOG_PREFIX + " accessibilityEvent : " + JSON.stringify(accessibilityEvent)) + } + onKeyEvent(keyEvent) { + console.info(LOG_PREFIX + " keyEvent : " + JSON.stringify(keyEvent)) + return true + } +} + +export default ServiceExtAbility \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/module.json b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..a058b2c33d3ce2904ee530c007cd18dbc1cadb71 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/module.json @@ -0,0 +1,64 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": true, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "com.example.accessibleaudibleability.hmservice.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "srcEntrance": "./ets/ServiceExtAbility/ServiceExtAbility.ts", + "name": "ServiceExtAbility", + "icon": "$media:icon", + "description": "$string:description_serviceability", + "type": "accessibility", + "visible": true, + "metadata": [ + { + "name": "ohos.accessibleability", + "resource": "$profile:accessibility_config" + } + ] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.SYSTEM_FLOAT_WINDOW", + "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" + }, + { + "name": "ohos.permission.CAPTURE_SCREEN", + "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" + } + ] + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f16cb4634cfc9c58783fd4a58ecfaaa6ecb0c1b5 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "audible辅助应用" + }, + { + "name": "description_serviceability", + "value": "audible后台服务" + }, + { + "name": "form_description", + "value": "audible辅助应用" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/profile/accessibility_config.json b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/profile/accessibility_config.json new file mode 100644 index 0000000000000000000000000000000000000000..8151c7d393b92ece5d6f07c71b7fb99b345c609a --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/profile/accessibility_config.json @@ -0,0 +1,11 @@ +{ + "accessibilityCapabilities": [ + "retrieve", + "touchGuide", + "keyEventObserver", + "gesture" + ], + "accessibilityAbilityTypes": ["audible"], + "accessibilityCapabilityRationale": "a11y_rationale", + "settingsAbility": "com.example.myapplication.accessibilitySetting" +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/profile/form_config.json b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/profile/form_config.json new file mode 100644 index 0000000000000000000000000000000000000000..ba3489dd5c6ee9435d07201193fcb137e3ad083e --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/profile/form_config.json @@ -0,0 +1,24 @@ +{ + "forms": [ + { + "name": "Form_Js", + "description": "$string:form_description", + "src": "pages/card/index", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "colorMode": "auto", + "formConfigAbility": "ability://xxxxx", + "formVisibleNotify": false, + "isDefault": true, + "updateEnabled": true, + "scheduledUpdateTime": "10:30", + "updateDuration": 1, + "defaultDimension": "2*2", + "supportDimensions": [ + "2*2" + ] + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..c1858c216308ad312862a877139a8ba6908ec3c6 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/signature/openharmony_sx.p7b b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityAudibleAbility/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/AppScope/app.json b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..65cc983e91379165abea8959b770b8c97860eb1e --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.accessiblegenericability.hmservice", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/AppScope/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..74b4363b3be83d1eb1dc3111775f32169670fb5a --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AccessibleGenericAbility" + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/BUILD.gn b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..5228324be0ae5fdae2945468db3853120b7d2490 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("accessibilityGenericAbility") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessible_js_assets", + ":accessible_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "accessibilityGenericAbility" + subsystem_name = "barrierfree" + part_name = "accessibility" +} + +ohos_app_scope("accessible_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessible_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessible_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessible_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/Test.json b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..b9f4122fbf466755fe279be1082dcf138af90789 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..14b999a57dcdb13c5d435888ab8623ce5d1df2b7 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +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. + */ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[AccessibleGenericAbility] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..faa3d8f6238f2e09036f5dbf4433a1e4c84c8a72 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[AccessibleGenericAbility] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[AccessibleGenericAbility] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[AccessibleGenericAbility] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "MainAbility/pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[AccessibleGenericAbility] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[AccessibleGenericAbility] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[AccessibleGenericAbility] MainAbility onBackground") + } +}; diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/MainAbility/pages/index.ets b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4c382cf18941ac82d25ab571ebb3879b0f82811 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c8eb280227366ba3cea571269ba82f8f4fd2bede --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts @@ -0,0 +1,37 @@ +/* + * 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 AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility' + +const LOG_PREFIX = '[CQH-GENERIC-ABILITY-ACCESSIBLE]' +class ServiceExtAbility extends AccessibilityExtensionAbility { + onConnect() { + console.info(LOG_PREFIX + " onConnect") + let context = this.context + context.setTargetBundleName(['com.example.abilitylisttest', 'com.example.manualcase']) + } + onDisconnect() { + console.info(LOG_PREFIX + " onDisconnect"); + } + onAccessibilityEvent(accessibilityEvent) { + console.info(LOG_PREFIX + " accessibilityEvent : " + JSON.stringify(accessibilityEvent)); + } + onKeyEvent(keyEvent) { + console.info(LOG_PREFIX + " keyEvent : " + JSON.stringify(keyEvent)); + return true + } +} + +export default ServiceExtAbility \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/module.json b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..199b72fdb6589b0b242048bd30d2e6214c2b437f --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/module.json @@ -0,0 +1,64 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": true, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "com.example.accessiblegesturesimulation.hmservice.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "srcEntrance": "./ets/ServiceExtAbility/ServiceExtAbility.ts", + "name": "ServiceExtAbility", + "icon": "$media:icon", + "description": "$string:description_serviceability", + "type": "accessibility", + "visible": true, + "metadata": [ + { + "name": "ohos.accessibleability", + "resource": "$profile:accessibility_config" + } + ] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.SYSTEM_FLOAT_WINDOW", + "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" + }, + { + "name": "ohos.permission.CAPTURE_SCREEN", + "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" + } + ] + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..4287e9d5ccc478c3dce8c3b46f44ac39acb6522f --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "generic辅助应用" + }, + { + "name": "description_serviceability", + "value": "generic后台服务" + }, + { + "name": "form_description", + "value": "generic辅助应用" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/profile/accessibility_config.json b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/profile/accessibility_config.json new file mode 100644 index 0000000000000000000000000000000000000000..586720cff93a82d99ef081c9055cd4c2451fd5fc --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/profile/accessibility_config.json @@ -0,0 +1,11 @@ +{ + "accessibilityCapabilities": [ + "retrieve", + "touchGuide", + "keyEventObserver", + "gesture" + ], + "accessibilityAbilityTypes": ["generic"], + "accessibilityCapabilityRationale": "a11y_rationale", + "settingsAbility": "com.example.myapplication.accessibilitySetting" +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/profile/form_config.json b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/profile/form_config.json new file mode 100644 index 0000000000000000000000000000000000000000..ba3489dd5c6ee9435d07201193fcb137e3ad083e --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/profile/form_config.json @@ -0,0 +1,24 @@ +{ + "forms": [ + { + "name": "Form_Js", + "description": "$string:form_description", + "src": "pages/card/index", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "colorMode": "auto", + "formConfigAbility": "ability://xxxxx", + "formVisibleNotify": false, + "isDefault": true, + "updateEnabled": true, + "scheduledUpdateTime": "10:30", + "updateDuration": 1, + "defaultDimension": "2*2", + "supportDimensions": [ + "2*2" + ] + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..c1858c216308ad312862a877139a8ba6908ec3c6 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/signature/openharmony_sx.p7b b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityGenericAbility/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/AppScope/app.json b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..43bb9cae5eb94843fb319bcaf72c763cfeb35fe5 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.accessiblehapticability.hmservice", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/AppScope/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..baaf37d061e7923297806c49bdb24755469eee16 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AccessibleHapticAbility" + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/BUILD.gn b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..66c19036e8ad61df9918ba04dcdcfd33ee47d530 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("accessibilityHapticAbility") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessible_js_assets", + ":accessible_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "accessibilityHapticAbility" + subsystem_name = "barrierfree" + part_name = "accessibility" +} + +ohos_app_scope("accessible_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessible_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessible_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessible_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/Test.json b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..b9f4122fbf466755fe279be1082dcf138af90789 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..eb46727c442a4d2aec87bff72165107770fa9e9e --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +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. + */ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[AccessibleHapticAbility] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..5a19cec0825e72325e4479f877bbff12ec83df06 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[AccessibleHapticAbility] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[AccessibleHapticAbility] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[AccessibleHapticAbility] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "MainAbility/pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[AccessibleHapticAbility] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[AccessibleHapticAbility] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[AccessibleHapticAbility] MainAbility onBackground") + } +}; diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/MainAbility/pages/index.ets b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4c382cf18941ac82d25ab571ebb3879b0f82811 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..0562ddaeb7f7f3cf5e47502bf37adf1eee8e5be1 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts @@ -0,0 +1,38 @@ +/* + * 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 AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility' + + +const LOG_PREFIX = '[CQH-HAPTIC-ABILITY-ACCESSIBLE]' +class ServiceExtAbility extends AccessibilityExtensionAbility { + onConnect() { + console.info(LOG_PREFIX + " onConnect") + let context = this.context + context.setTargetBundleName(['com.example.abilitylisttest', 'com.example.manualcase']) + } + onDisconnect() { + console.info(LOG_PREFIX + " onDisconnect") + } + onAccessibilityEvent(accessibilityEvent) { + console.info(LOG_PREFIX + " accessibilityEvent : " + JSON.stringify(accessibilityEvent)) + } + onKeyEvent(keyEvent) { + console.info(LOG_PREFIX + " keyEvent : " + JSON.stringify(keyEvent)); + return true + } +} + +export default ServiceExtAbility \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/module.json b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..7c78424539c25d1102190920d357629a34931272 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/module.json @@ -0,0 +1,64 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": true, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "com.example.accessiblehapticability.hmservice.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "srcEntrance": "./ets/ServiceExtAbility/ServiceExtAbility.ts", + "name": "ServiceExtAbility", + "icon": "$media:icon", + "description": "$string:description_serviceability", + "type": "accessibility", + "visible": true, + "metadata": [ + { + "name": "ohos.accessibleability", + "resource": "$profile:accessibility_config" + } + ] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.SYSTEM_FLOAT_WINDOW", + "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" + }, + { + "name": "ohos.permission.CAPTURE_SCREEN", + "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" + } + ] + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..265991740a0ca444a8bad839d4d2411958f95bca --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "haptic辅助应用" + }, + { + "name": "description_serviceability", + "value": "haptic后台服务" + }, + { + "name": "form_description", + "value": "haptic辅助应用" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/profile/accessibility_config.json b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/profile/accessibility_config.json new file mode 100644 index 0000000000000000000000000000000000000000..e02d33c515eba85c77d6d8b65b052f4374165aaa --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/profile/accessibility_config.json @@ -0,0 +1,11 @@ +{ + "accessibilityCapabilities": [ + "retrieve", + "touchGuide", + "keyEventObserver", + "gesture" + ], + "accessibilityAbilityTypes": ["haptic"], + "accessibilityCapabilityRationale": "a11y_rationale", + "settingsAbility": "com.example.myapplication.accessibilitySetting" +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/profile/form_config.json b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/profile/form_config.json new file mode 100644 index 0000000000000000000000000000000000000000..ba3489dd5c6ee9435d07201193fcb137e3ad083e --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/profile/form_config.json @@ -0,0 +1,24 @@ +{ + "forms": [ + { + "name": "Form_Js", + "description": "$string:form_description", + "src": "pages/card/index", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "colorMode": "auto", + "formConfigAbility": "ability://xxxxx", + "formVisibleNotify": false, + "isDefault": true, + "updateEnabled": true, + "scheduledUpdateTime": "10:30", + "updateDuration": 1, + "defaultDimension": "2*2", + "supportDimensions": [ + "2*2" + ] + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..c1858c216308ad312862a877139a8ba6908ec3c6 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/signature/openharmony_sx.p7b b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityHapticAbility/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/AppScope/app.json b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..ec6887eb9a5358089d6c52ca743e6ae775fbce07 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.accessiblespokenability.hmservice", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/AppScope/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..a4f2bd581747e390a6e52e0b8ee803060508c047 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AccessibleSpokenAbility" + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/BUILD.gn b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..99dd49114513c6a55399ed7dd2e68dc9dca35321 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("accessibilitySpokenAbility") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessible_js_assets", + ":accessible_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "accessibilitySpokenAbility" + subsystem_name = "barrierfree" + part_name = "accessibility" +} + +ohos_app_scope("accessible_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessible_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessible_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessible_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/Test.json b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..b9f4122fbf466755fe279be1082dcf138af90789 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..b57816d1c23bfd8a2769b3f46bd17b2fb41bbb68 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +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. + */ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[AccessibleSpokenAbility] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..a28eed3fa6e465181949446d1b091f9f3cfefefc --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[AccessibleSpokenAbility] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[AccessibleSpokenAbility] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[AccessibleSpokenAbility] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "MainAbility/pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[AccessibleSpokenAbility] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[AccessibleSpokenAbility] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[AccessibleSpokenAbility] MainAbility onBackground") + } +}; diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/MainAbility/pages/index.ets b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4c382cf18941ac82d25ab571ebb3879b0f82811 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..f21b462e8e743088fd684fda85171a191cbb42e6 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts @@ -0,0 +1,37 @@ +/* + * 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 AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility' +import commonEvent from '@ohos.commonEvent' + + +const LOG_PREFIX = '[CQH-SPOKEN-ABILITY-ACCESSIBLE]' +class ServiceExtAbility extends AccessibilityExtensionAbility { + onConnect() { + console.info(LOG_PREFIX + " onConnect") + } + onDisconnect() { + console.info(LOG_PREFIX + " onDisconnect") + } + onAccessibilityEvent(accessibilityEvent) { + console.info(LOG_PREFIX + " accessibilityEvent : " + JSON.stringify(accessibilityEvent)) + } + onKeyEvent(keyEvent) { + console.info(LOG_PREFIX + " keyEvent : " + JSON.stringify(keyEvent)) + return true + } +} + +export default ServiceExtAbility \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/module.json b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..bb518cf0202e0033932ade100f68c7b074e6baeb --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/module.json @@ -0,0 +1,64 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": true, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "com.example.accessiblespokenability.hmservice.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "srcEntrance": "./ets/ServiceExtAbility/ServiceExtAbility.ts", + "name": "ServiceExtAbility", + "icon": "$media:icon", + "description": "$string:description_serviceability", + "type": "accessibility", + "visible": true, + "metadata": [ + { + "name": "ohos.accessibleability", + "resource": "$profile:accessibility_config" + } + ] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.SYSTEM_FLOAT_WINDOW", + "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" + }, + { + "name": "ohos.permission.CAPTURE_SCREEN", + "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" + } + ] + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ec4966b7c16117811826ccb46918ad6969f5f329 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "spoken辅助应用" + }, + { + "name": "description_serviceability", + "value": "spoken后台服务" + }, + { + "name": "form_description", + "value": "spoken辅助应用" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/profile/accessibility_config.json b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/profile/accessibility_config.json new file mode 100644 index 0000000000000000000000000000000000000000..a36e7870744f8fbbea4e2d6b9df0bf0deb08f4e1 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/profile/accessibility_config.json @@ -0,0 +1,11 @@ +{ + "accessibilityCapabilities": [ + "retrieve", + "touchGuide", + "keyEventObserver", + "gesture" + ], + "accessibilityAbilityTypes": ["spoken"], + "accessibilityCapabilityRationale": "a11y_rationale", + "settingsAbility": "com.example.myapplication.accessibilitySetting" +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/profile/form_config.json b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/profile/form_config.json new file mode 100644 index 0000000000000000000000000000000000000000..ba3489dd5c6ee9435d07201193fcb137e3ad083e --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/profile/form_config.json @@ -0,0 +1,24 @@ +{ + "forms": [ + { + "name": "Form_Js", + "description": "$string:form_description", + "src": "pages/card/index", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "colorMode": "auto", + "formConfigAbility": "ability://xxxxx", + "formVisibleNotify": false, + "isDefault": true, + "updateEnabled": true, + "scheduledUpdateTime": "10:30", + "updateDuration": 1, + "defaultDimension": "2*2", + "supportDimensions": [ + "2*2" + ] + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..c1858c216308ad312862a877139a8ba6908ec3c6 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/signature/openharmony_sx.p7b b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilitySpokenAbility/signature/openharmony_sx.p7b differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/AppScope/app.json b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..68d4327cfefa721d895bb2cb08ef43fbd34b7dc3 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.accessiblevisualability.hmservice", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 9, + "targetAPIVersion": 9, + "car": { + "apiCompatibleVersion": 9, + "singleUser": false + } + } +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/AppScope/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2b6d6217cb2ab209b6af27e1f23add5aa6cca758 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AccessibleVisualAbility" + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/AppScope/resources/base/media/app_icon.png b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/AppScope/resources/base/media/app_icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/BUILD.gn b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..be60016fdd8fedb3d6e4460ede3b6da7405f9719 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_hap_assist_suite("accessibilityVisualAbility") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":accessible_js_assets", + ":accessible_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "accessibilityVisualAbility" + subsystem_name = "barrierfree" + part_name = "accessibility" +} + +ohos_app_scope("accessible_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("accessible_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("accessible_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":accessible_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/Test.json b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..b9f4122fbf466755fe279be1082dcf138af90789 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/Test.json @@ -0,0 +1,3 @@ +{ + "description": "Configuration for hjunit demo Tests", +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/Application/AbilityStage.ts b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..36f6b6d60dc194aa60bb64abdbfb4686e3d6663b --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +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. + */ + +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[AccessibleVisualAbility] MyAbilityStage onCreate") + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/MainAbility/MainAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..9f7a954299536d8e5b4a74dd9b18b38ae7569273 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[AccessibleVisualAbility] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[AccessibleVisualAbility] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[AccessibleVisualAbility] MainAbility onWindowStageCreate") + + windowStage.setUIContent(this.context, "MainAbility/pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[AccessibleVisualAbility] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[AccessibleVisualAbility] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[AccessibleVisualAbility] MainAbility onBackground") + } +}; diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/MainAbility/pages/index.ets b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..c4c382cf18941ac82d25ab571ebb3879b0f82811 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..3787fced051fb57a59767f1349dd4c1c24988e64 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/ets/ServiceExtAbility/ServiceExtAbility.ts @@ -0,0 +1,37 @@ +/* + * 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 AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtensionAbility' +import commonEvent from '@ohos.commonEvent' + + +const LOG_PREFIX = '[CQH-VISUAL-ABILITY-ACCESSIBLE]' +class ServiceExtAbility extends AccessibilityExtensionAbility { + onConnect() { + console.info(LOG_PREFIX + " onConnect") + } + onDisconnect() { + console.info(LOG_PREFIX + " onDisconnect") + } + onAccessibilityEvent(accessibilityEvent) { + console.info(LOG_PREFIX + " accessibilityEvent : " + JSON.stringify(accessibilityEvent)) + } + onKeyEvent(keyEvent) { + console.info(LOG_PREFIX + " keyEvent : " + JSON.stringify(keyEvent)) + return true + } +} + +export default ServiceExtAbility \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/module.json b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..46af077579ab69acecd60dd33debf4f304797d46 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/module.json @@ -0,0 +1,64 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": true, + "pages": "$profile:main_pages", + "uiSyntax": "ets", + "abilities": [ + { + "name": "com.example.accessiblevisualability.hmservice.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "srcEntrance": "./ets/ServiceExtAbility/ServiceExtAbility.ts", + "name": "ServiceExtAbility", + "icon": "$media:icon", + "description": "$string:description_serviceability", + "type": "accessibility", + "visible": true, + "metadata": [ + { + "name": "ohos.accessibleability", + "resource": "$profile:accessibility_config" + } + ] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.SYSTEM_FLOAT_WINDOW", + "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" + }, + { + "name": "ohos.permission.CAPTURE_SCREEN", + "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" + } + ] + } +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/element/string.json b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..97595607d0f714fb496802bbba19e4c98c5e4702 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/element/string.json @@ -0,0 +1,24 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "visual辅助应用" + }, + { + "name": "description_serviceability", + "value": "visual后台服务" + }, + { + "name": "form_description", + "value": "visual辅助应用" + } + ] +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/media/icon.png b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/media/icon.png differ diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/profile/accessibility_config.json b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/profile/accessibility_config.json new file mode 100644 index 0000000000000000000000000000000000000000..513f5644b437cf7fe677a13597213ec833351808 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/profile/accessibility_config.json @@ -0,0 +1,11 @@ +{ + "accessibilityCapabilities": [ + "retrieve", + "touchGuide", + "keyEventObserver", + "gesture" + ], + "accessibilityAbilityTypes": ["visual"], + "accessibilityCapabilityRationale": "a11y_rationale", + "settingsAbility": "com.example.myapplication.accessibilitySetting" +} \ No newline at end of file diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/profile/form_config.json b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/profile/form_config.json new file mode 100644 index 0000000000000000000000000000000000000000..ba3489dd5c6ee9435d07201193fcb137e3ad083e --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/profile/form_config.json @@ -0,0 +1,24 @@ +{ + "forms": [ + { + "name": "Form_Js", + "description": "$string:form_description", + "src": "pages/card/index", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "colorMode": "auto", + "formConfigAbility": "ability://xxxxx", + "formVisibleNotify": false, + "isDefault": true, + "updateEnabled": true, + "scheduledUpdateTime": "10:30", + "updateDuration": 1, + "defaultDimension": "2*2", + "supportDimensions": [ + "2*2" + ] + } + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/profile/main_pages.json b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..c1858c216308ad312862a877139a8ba6908ec3c6 --- /dev/null +++ b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index" + ] +} diff --git a/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/signature/openharmony_sx.p7b b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/barrierfree/accessibletest/sceneProject/accessibilityVisualAbility/signature/openharmony_sx.p7b differ diff --git a/barrierfree/targetProject/aceTest/entry/src/main/module.json b/barrierfree/targetProject/aceTest/entry/src/main/module.json index 72cade6b548cf275703c58d2ab613ef5e16d95da..ea606c02376c455612e7f41cfd227007e920282b 100644 --- a/barrierfree/targetProject/aceTest/entry/src/main/module.json +++ b/barrierfree/targetProject/aceTest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/bundlemanager/bundle_standard/bundlemanager/BUILD.gn b/bundlemanager/bundle_standard/bundlemanager/BUILD.gn index f572ed055ad458c8b054281e975fab70fec5f696..d8e793c9bab5190260fb156f02e1e27f3b42548b 100644 --- a/bundlemanager/bundle_standard/bundlemanager/BUILD.gn +++ b/bundlemanager/bundle_standard/bundlemanager/BUILD.gn @@ -25,7 +25,7 @@ group("bundlemanager") { "actsbmsjstest:ActsBmsJsTest", "actsbmsjsunpermissiontest:ActsBmsJsUnPermissionTest", "actsbmsmetadatatest:ActsBmsMetaDataTest", - "actsbmsstageetstest:ActBmsStageEtsTest", + "actsbmsstageetstest:ActsBmsStageEtsTest", "actsbundlemanageretstest:ActsBundleManagerEtsTest", "actsbundlemanagertest:ActsBundleManagerTest", "actsbundlenativetest:ActsBundleNativeTest", diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/BUILD.gn b/bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/BUILD.gn index 077cccec3e53c256b730b9c1de0bac87cba6f303..5ee120a21f5abfd486437451b62a38a17242833d 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/BUILD.gn +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/config.json index 8a8e4f762238fc509323abb28da3b481b78e4cfe..b13afd535154adc734db0a9af1c04655a59bbe22 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsaccesstokentest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsbmsaccesstokentest", "name": ".entry", "deviceType": [ + "default", "default" ], "distro": { 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..b6a0916df0866f756ff239956ad5090522102172 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); @@ -91,8 +91,8 @@ describe('ActsBmsAccessTokenTest', function () { expect(bundleInfo.reqPermissions[0]).assertEqual("ohos.permission.ALPHA"); expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING"); expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.LOCATION_IN_BACKGROUND"); - expect(bundleInfo.reqPermissions[3]).assertEqual("ohos.permission.SYSTEM_FLOAT_WINDOW"); - expect(bundleInfo.reqPermissions[4]).assertEqual("ohos.permission.USE_BLUETOOTH"); + expect(bundleInfo.reqPermissions[3]).assertEqual("ohos.permission.USE_BLUETOOTH"); + expect(bundleInfo.reqPermissions[4]).assertEqual("ohos.permission.VIBRATE"); expect(bundleInfo.reqPermissionStates.length).assertEqual(5); expect(bundleInfo.reqPermissionStates[0]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED); expect(bundleInfo.reqPermissionStates[1]).assertEqual(bundle.GrantStatus.PERMISSION_GRANTED); @@ -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); @@ -120,8 +120,8 @@ describe('ActsBmsAccessTokenTest', function () { expect(bundleInfo.reqPermissions[1]).assertEqual("ohos.permission.BETA"); expect(bundleInfo.reqPermissions[2]).assertEqual("ohos.permission.KEEP_BACKGROUND_RUNNING"); expect(bundleInfo.reqPermissions[3]).assertEqual("ohos.permission.LOCATION_IN_BACKGROUND"); - expect(bundleInfo.reqPermissions[4]).assertEqual("ohos.permission.SYSTEM_FLOAT_WINDOW"); - expect(bundleInfo.reqPermissions[5]).assertEqual("ohos.permission.USE_BLUETOOTH"); + expect(bundleInfo.reqPermissions[4]).assertEqual("ohos.permission.USE_BLUETOOTH"); + expect(bundleInfo.reqPermissions[5]).assertEqual("ohos.permission.VIBRATE"); expect(bundleInfo.reqPermissionStates.length).assertEqual(6); expect(bundleInfo.reqPermissionStates[0]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED); expect(bundleInfo.reqPermissionStates[1]).assertEqual(bundle.GrantStatus.PERMISSION_DENIED); @@ -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/Test.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsetsmodulenametest/Test.json index b0b5e7c209fd659c0baf7a4db3a5e39a00abed90..d8c4a8d2ab8131f6dcdc7f8c4ccf41d9f4a1d4cf 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsetsmodulenametest/Test.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsetsmodulenametest/Test.json @@ -10,7 +10,9 @@ "kits": [ { "test-file-name": [ - "ActsBmsEtsModuleNameTest.hap" + "ActsBmsEtsModuleNameTest.hap", + "bmsJstest2.hap", + "bmsJstest3.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/config.json index 90bdb3fe0dcf5e4526b09ab8a2fa9cd762578409..e6a3860dd35ab89947ec85f283146b4b96a3e31d 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "default" ], "distro": { 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..02dbd887d9baaa0a61960f6ec89eca75bec4305a 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 @@ -19,509 +19,751 @@ import account from '@ohos.account.osAccount' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'hypium/index' const ABILITY_NAME = 'com.example.bmsmodulename.MainAbility'; +const ABILITY_NAME1 = 'com.example.myapplication2.MainAbility'; const BUNDLE_NAME = 'com.example.bmsmodulename'; +const BUNDLE_NAME1 = 'com.example.myapplication2'; const MODULE_NAME1 = ''; const MODULE_NAME2 = 'noModule'; const MODULE_NAME3 = 'entry'; const MODULE_NAME4 = undefined; +const MODULE_NAME5 = null; +const MODULE_NAME6 = 'feature'; const DEFAULT_FLAG = bundle.BundleFlag.GET_BUNDLE_DEFAULT; const SUCCESS_CODE = 0; const INVALID_CODE = 1; const INVALID_PARAM = 2; const ABILITY_INFO_ONE = { - bundleName: BUNDLE_NAME, - moduleName: MODULE_NAME1, - name: ABILITY_NAME + bundleName: BUNDLE_NAME, + moduleName: MODULE_NAME1, + name: ABILITY_NAME }; const ABILITY_INFO_TWO = { - bundleName: BUNDLE_NAME, - moduleName: MODULE_NAME2, - name: ABILITY_NAME + bundleName: BUNDLE_NAME, + moduleName: MODULE_NAME2, + name: ABILITY_NAME }; const ABILITY_INFO_THREE = { - bundleName: BUNDLE_NAME, - moduleName: MODULE_NAME3, - name: ABILITY_NAME + bundleName: BUNDLE_NAME, + moduleName: MODULE_NAME3, + name: ABILITY_NAME }; const ABILITY_INFO_FOUR = { - bundleName: BUNDLE_NAME, - moduleName: MODULE_NAME4, - name: ABILITY_NAME + bundleName: BUNDLE_NAME, + moduleName: MODULE_NAME4, + name: ABILITY_NAME }; let userId = 0; export default function actsBmsJsModuleNameTest() { - describe('actsBmsJsModuleNameTest', 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(); - }) + describe('actsBmsJsModuleNameTest', 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: SUB_BMS_APPINFO_QUERYMODULE_0030 + * @tc.name: getAbilityInfoEmptyModule + * @tc.desc: test empty moduleName + */ + it('getAbilityInfoEmptyModule', 0, async function (done) { + await bundle.getAbilityInfo(BUNDLE_NAME, MODULE_NAME1, ABILITY_NAME) + .then(data => { + expect(data).assertFail(); + }).catch((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('[getAbilityInfoEmptyModule]Operation failed. Err: ' + JSON.stringify(err)); + } + console.info("'[getAbilityInfoEmptyModule]Return data: " + JSON.stringify(data)); + done(); + }); + }); - /* - * @tc.number: GetabilityInfo_0100 - * @tc.name: test getAbilityInfo - * @tc.desc: test empty moduleName - */ - it('GetabilityInfo_0100', 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)); - 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.info("'[GetabilityInfo_0100]Return data: " + JSON.stringify(data)); - done(); - }); + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0020 + * @tc.name: getAbilityInfoInvalidModule + * @tc.desc: test non-existent moduleName + */ + it('getAbilityInfoInvalidModule', 0, async function (done) { + await bundle.getAbilityInfo(BUNDLE_NAME, MODULE_NAME2, ABILITY_NAME) + .then(data => { + expect(data).assertFail(); + }).catch((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('[getAbilityInfoInvalidModule]Operation failed. Err: ' + JSON.stringify(err)); + } + console.info("'[getAbilityInfoInvalidModule]Return data : " + JSON.stringify(data)); + done(); + }); + }); - /* - * @tc.number: GetabilityInfo_0200 - * @tc.name: test getAbilityInfo - * @tc.desc: test non-existent moduleName - */ - it('GetabilityInfo_0200', 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)); - 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.info("'[GetabilityInfo_0200]Return data : " + JSON.stringify(data)); - done(); - }); + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0018 + * @tc.name: getAbilityInfoHasModule + * @tc.desc: test existent moduleName + */ + it('getAbilityInfoHasModule', 0, async function (done) { + await bundle.getAbilityInfo(BUNDLE_NAME, MODULE_NAME3, ABILITY_NAME) + .then(data => { + console.info('[getAbilityInfoHasModule]Return data successful: ' + JSON.stringify(data)); + checkDataInfo(data); + }).catch((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('[getAbilityInfoHasModule]Operation failed. Err: ' + JSON.stringify(err)); + } + console.info("'[getAbilityInfoHasModule]Return data: " + JSON.stringify(data)); + done(); + }); + }); - /* - * @tc.number: GetabilityInfo_0300 - * @tc.name: test getAbilityInfo - * @tc.desc: test existent moduleName - */ - it('GetabilityInfo_0300', 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)); - checkDataInfo(data); - }).catch((err) => { - console.error('[GetabilityInfo_0300]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.info("'[GetabilityInfo_0300]Return data: " + JSON.stringify(data)); - done(); - }); + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0031 + * @tc.name: getAbilityIconEmptyModule + * @tc.desc: test empty moduleName + */ + it('getAbilityIconEmptyModule', 0, async function (done) { + await bundle.getAbilityIcon(BUNDLE_NAME, MODULE_NAME1, ABILITY_NAME) + .then(data => { + expect(data).assertFail(); + }).catch((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('[getAbilityIconEmptyModule]Operation failed. Err: ' + JSON.stringify(err)); + } + console.info("'[getAbilityIconEmptyModule]Return data: " + JSON.stringify(data)); + done(); + }); + }); - /* - * @tc.number: GetAbilityIcon_0100 - * @tc.name: test getAbilityIcon - * @tc.desc: test empty moduleName - */ - it('GetAbilityIcon_0100', 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)); - 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.info("'[GetAbilityIcon_0100]Return data: " + JSON.stringify(data)); - done(); - }); + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0028 + * @tc.name: getAbilityIconInvalidModule + * @tc.desc: test non-existent moduleName + */ + it('getAbilityIconInvalidModule', 0, async function (done) { + await bundle.getAbilityIcon(BUNDLE_NAME, MODULE_NAME2, ABILITY_NAME) + .then(data => { + expect(data).assertFail(); + }).catch((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('[getAbilityIconInvalidModule]Operation failed. Err: ' + JSON.stringify(err)); + } + console.info("'[getAbilityIconInvalidModule]Return data: " + JSON.stringify(data)); + done(); + }); + }); - /* - * @tc.number: GetAbilityIcon_0200 - * @tc.name: test getAbilityIcon - * @tc.desc: test non-existent moduleName - */ - it('GetAbilityIcon_0200', 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)); - 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.info("'[GetAbilityIcon_0200]Return data: " + JSON.stringify(data)); - done(); - }); + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0026 + * @tc.name: getAbilityIconHasModule + * @tc.desc: test existent moduleName + */ + it('getAbilityIconHasModule', 0, async function (done) { + await bundle.getAbilityIcon(BUNDLE_NAME, MODULE_NAME3, ABILITY_NAME) + .then(data => { + console.info('[getAbilityIconHasModule]Return data successful: ' + JSON.stringify(data)); + expect(data.getBytesNumberPerRow()).assertLarger(0); + }).catch((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('[getAbilityIconHasModule]Operation failed. Err: ' + JSON.stringify(err)); + } + console.info("'[getAbilityIconHasModule]Return data: " + JSON.stringify(data)); + done(); + }); + }); - /* - * @tc.number: GetAbilityIcon_0300 - * @tc.name: test getAbilityIcon - * @tc.desc: test existent moduleName - */ - it('GetAbilityIcon_0300', 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)); - expect(data.getBytesNumberPerRow()).assertLarger(0); - }).catch((err) => { - console.error('[GetAbilityIcon_0300]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.info("'[GetAbilityIcon_0300]Return data: " + JSON.stringify(data)); - done(); - }); + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0032 + * @tc.name: getAbilityLabelEmptyModule + * @tc.desc: test empty moduleName + */ + it('getAbilityLabelEmptyModule', 0, async function (done) { + await bundle.getAbilityLabel(BUNDLE_NAME, MODULE_NAME1, ABILITY_NAME) + .then(data => { + expect(data).assertFail(); + }).catch((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('[getAbilityLabelEmptyModule]Operation failed. Err: ' + JSON.stringify(err)); + } + console.info("'[getAbilityLabelEmptyModule]Return data: " + JSON.stringify(data)); + done(); + }); + }); - /* - * @tc.number: GetAbilityLabel_0100 - * @tc.name: test getAbilityLabel - * @tc.desc: test empty moduleName - */ - it('GetAbilityLabel_0100', 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)); - 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.info("'[GetAbilityLabel_0100]Return data: " + JSON.stringify(data)); - done(); - }); + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0024 + * @tc.name: getAbilityLabelInvalidModule + * @tc.desc: test non-existent moduleName + */ + it('getAbilityLabelInvalidModule', 0, async function (done) { + await bundle.getAbilityLabel(BUNDLE_NAME, MODULE_NAME2, ABILITY_NAME) + .then(data => { + expect(data).assertFail(); + }).catch((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('[getAbilityLabelInvalidModule]Operation failed. Err: ' + JSON.stringify(err)); + } + console.info("'[getAbilityLabelInvalidModule]Return data: " + JSON.stringify(data)); + done(); + }); + }); - /* - * @tc.number: GetAbilityLabel_0200 - * @tc.name: test getAbilityLabel - * @tc.desc: test non-existent moduleName - */ - it('GetAbilityLabel_0200', 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)); - 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.info("'[GetAbilityLabel_0200]Return data: " + JSON.stringify(data)); - done(); - }); + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0022 + * @tc.name: getAbilityLabelHasModule + * @tc.desc: test existent moduleName + */ + it('getAbilityLabelHasModule', 0, async function (done) { + await bundle.getAbilityLabel(BUNDLE_NAME, MODULE_NAME3, ABILITY_NAME) + .then(data => { + console.info('[getAbilityLabelHasModule]Return data successful: ' + JSON.stringify(data)); + expect(data).assertEqual("bmsfirstright"); + }).catch((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('[getAbilityLabelHasModule]Operation failed. Err: ' + JSON.stringify(err)); + } + expect(data).assertEqual("bmsfirstright"); + console.info("'[getAbilityLabelHasModule]Return data: " + JSON.stringify(data)); + done(); + }); + }); - /* - * @tc.number: GetAbilityLabel_0300 - * @tc.name: test getAbilityLabel - * @tc.desc: test existent moduleName - */ - it('GetAbilityLabel_0300', 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)); - expect(data).assertEqual("bmsfirstright"); - }).catch((err) => { - console.error('[GetAbilityLabel_0300]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)); - } - expect(data).assertEqual("bmsfirstright"); - console.info("'[GetAbilityLabel_0300]Return data: " + JSON.stringify(data)); - done(); - }); + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0010 + * @tc.name: isAbilityEnabledEmptyModule + * @tc.desc: test empty moduleName + */ + 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('[isAbilityEnabledEmptyModule]Return data successful: ' + JSON.stringify(data)); + expect(data).assertTrue(); + }).catch((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('[isAbilityEnabledEmptyModule]Operation failed. Err: ' + JSON.stringify(err)); + } + expect(data).assertTrue(); + console.info("'[isAbilityEnabledEmptyModule]Return data: " + JSON.stringify(data)); + done(); + }); + }); - /* - * @tc.number: IsAbilityEnabled_0100 - * @tc.name: test isAbilityEnabled - * @tc.desc: test empty moduleName - */ - it('IsAbilityEnabled_0100', 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)); - expect(data).assertTrue(); - }).catch((err) => { - console.error('[IsAbilityEnabled_0100]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)); - } - expect(data).assertTrue(); - console.info("'[IsAbilityEnabled_0100]Return data: " + JSON.stringify(data)); - done(); - }); + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0011 + * @tc.name: isAbilityEnabledInvalidModule + * @tc.desc: test non-existent moduleName + */ + 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('[isAbilityEnabledInvalidModule]Operation failed. Err: ' + JSON.stringify(err)); + expect(err).assertFail(); }); + bundle.isAbilityEnabled(abilityInfo, (err, data) => { + expect(data).assertEqual(false); + if (err) { + console.error('[isAbilityEnabledInvalidModule]Operation failed. Err: ' + JSON.stringify(err)); + } + expect(err).assertEqual(SUCCESS_CODE); + console.info("'[isAbilityEnabledInvalidModule]Return data: " + JSON.stringify(data)); + done(); + }); + }); - /* - * @tc.number: IsAbilityEnabled_0200 - * @tc.name: test isAbilityEnabled - * @tc.desc: test non-existent moduleName - */ - it('IsAbilityEnabled_0200', 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)); - expect(err).assertFail(); - }); - bundle.isAbilityEnabled(abilityInfo, (err, data) => { - expect(data).assertEqual(false); - if (err) { - console.error('[IsAbilityEnabled_0200]Operation failed. Err: ' + JSON.stringify(err)); - } - expect(err).assertEqual(SUCCESS_CODE); - console.info("'[IsAbilityEnabled_0200]Return data: " + JSON.stringify(data)); - done(); - }); + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0008 + * @tc.name: isAbilityEnabledHasModule + * @tc.desc: test existent moduleName + */ + 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('[isAbilityEnabledHasModule]Return data successful: ' + JSON.stringify(data)); + expect(data).assertTrue(); + }).catch((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('[isAbilityEnabledHasModule]Operation failed. Err: ' + JSON.stringify(err)); + } + expect(data).assertTrue(); + console.info("'[isAbilityEnabledHasModule]Return data: " + JSON.stringify(data)); + done(); + }); + }); - /* - * @tc.number: IsAbilityEnabled_0300 - * @tc.name: test isAbilityEnabled - * @tc.desc: test existent moduleName - */ - it('IsAbilityEnabled_0300', 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)); - expect(data).assertTrue(); - }).catch((err) => { - console.error('[IsAbilityEnabled_0300]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)); - } - expect(data).assertTrue(); - console.info("'[IsAbilityEnabled_0300]Return data: " + JSON.stringify(data)); - done(); - }); + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0012 + * @tc.name: isAbilityEnabledUndefinedModule + * @tc.desc: test empty moduleName + */ + 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('[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('[isAbilityEnabledUndefinedModule]Operation failed. Err: ' + JSON.stringify(err)); + } + expect(err).assertEqual(INVALID_PARAM); + console.info("'[isAbilityEnabledUndefinedModule]Return data: " + JSON.stringify(data)); + done(); + }); + }); - /* - * @tc.number: IsAbilityEnabled_0400 - * @tc.name: test isAbilityEnabled - * @tc.desc: test empty moduleName - */ - it('IsAbilityEnabled_0400', 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)); - 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)); - } - expect(err).assertEqual(INVALID_PARAM); - console.info("'[IsAbilityEnabled_0400]Return data: " + JSON.stringify(data)); - done(); - }); + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0033 + * @tc.name: queryAbilityByWantEmptyModule + * @tc.desc: test empty moduleName + */ + 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("'[queryAbilityByWantEmptyModule]Return data : " + JSON.stringify(data)); + }).catch(err => { + console.info("[queryAbilityByWantEmptyModule]Operation failed. Err: " + JSON.stringify(err)); + expect(err).assertFail(); + }); + bundle.queryAbilityByWant({ + bundleName: BUNDLE_NAME, + abilityName: ABILITY_NAME, + moduleName: MODULE_NAME1 + }, DEFAULT_FLAG, userId, (err, data) => { + expect(err).assertEqual(SUCCESS_CODE); + if (err) { + console.error('[queryAbilityByWantEmptyModule]Operation failed. Err: ' + JSON.stringify(err)); + } + checkDataInfo(data[0]); + console.info("'[queryAbilityByWantEmptyModule]Return data : " + JSON.stringify(data)); + done(); + }); + }); + + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0002 + * @tc.name: queryAbilityByWantInvalidModule + * @tc.desc: test non-existent moduleName + */ + it('queryAbilityByWantInvalidModule', 0, async function (done) { + await bundle.queryAbilityByWant({ + bundleName: BUNDLE_NAME, + abilityName: ABILITY_NAME, + moduleName: MODULE_NAME2 + }, DEFAULT_FLAG, userId).then(data => { + expect(data).assertFail(); + }).catch(err => { + console.error('[queryAbilityByWantInvalidModule]Operation failed. Err: ' + JSON.stringify(err)); + expect(err).assertEqual(INVALID_CODE); + }); + bundle.queryAbilityByWant({ + bundleName: BUNDLE_NAME, + abilityName: ABILITY_NAME, + moduleName: MODULE_NAME2 + }, DEFAULT_FLAG, userId, (err, data) => { + console.info("'[queryAbilityByWantInvalidModule]Return data " + JSON.stringify(data)); + expect(data).assertEqual("QueryAbilityInfos failed"); + console.error('[queryAbilityByWantInvalidModule]Operation failed. Err: ' + JSON.stringify(err)); + expect(err).assertEqual(INVALID_CODE); + done(); + }); + }); + + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0001 + * @tc.name: queryAbilityByWantHasModule + * @tc.desc: test existent moduleName + */ + 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("'[queryAbilityByWantHasModule]Return data : " + JSON.stringify(data)); + }).catch(err => { + console.info("[queryAbilityByWantHasModule]Operation failed. Err: " + JSON.stringify(err)); + expect(err).assertFail(); + }); + bundle.queryAbilityByWant({ + bundleName: BUNDLE_NAME, + abilityName: ABILITY_NAME, + moduleName: MODULE_NAME3 + }, DEFAULT_FLAG, userId, (err, data) => { + expect(err).assertEqual(SUCCESS_CODE); + if (err) { + console.error('[queryAbilityByWantHasModule]Operation failed. Err: ' + JSON.stringify(err)); + } + checkDataInfo(data[0]); + console.info("'[queryAbilityByWantHasModule]Return data : " + JSON.stringify(data)); + done(); + }); + }); + + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0022 + * @tc.name: getAbilityInfoUndefinedModule + * @tc.desc: test undefined moduleName + */ + it('getAbilityInfoUndefinedModule', 0, async function (done) { + await bundle.getAbilityInfo(BUNDLE_NAME, MODULE_NAME4, ABILITY_NAME) + .then(data => { + expect(data).assertFail(); + }).catch((err) => { + expect(err).assertEqual(INVALID_PARAM); + bundle.getAbilityInfo(BUNDLE_NAME, MODULE_NAME4, ABILITY_NAME, (error, data) => { + expect(error).assertEqual(INVALID_PARAM); + }); + }); + await bundle.getAbilityInfo(BUNDLE_NAME, MODULE_NAME5, ABILITY_NAME) + .then(data => { + expect(data).assertFail(); + done(); + }).catch((err) => { + expect(err).assertEqual(INVALID_PARAM); + bundle.getAbilityInfo(BUNDLE_NAME, MODULE_NAME5, ABILITY_NAME, (error, data) => { + expect(error).assertEqual(INVALID_PARAM); + done(); + }); }); + }); + - /* - * @tc.number: QueryAbilityByWant_0100 - * @tc.name: test queryAbilityByWant - * @tc.desc: test empty moduleName - */ - it('QueryAbilityByWant_0100', 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)); - }).catch(err => { - console.info("[QueryAbilityByWant_0100]Operation failed. Err: " + JSON.stringify(err)); - expect(err).assertFail(); - }); - bundle.queryAbilityByWant({ - bundleName: BUNDLE_NAME, - abilityName: ABILITY_NAME, - moduleName: MODULE_NAME1 - }, DEFAULT_FLAG, userId, (err, data) => { - expect(err).assertEqual(SUCCESS_CODE); - if (err) { - console.error('[QueryAbilityByWant_0100]Operation failed. Err: ' + JSON.stringify(err)); - } - checkDataInfo(data[0]); - console.info("'[QueryAbilityByWant_0100]Return data : " + JSON.stringify(data)); - done(); - }); + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0029 + * @tc.name: getAbilityIconUndefinedModule + * @tc.desc: test undefined moduleName + */ + it('getAbilityIconUndefinedModule', 0, async function (done) { + await bundle.getAbilityIcon(BUNDLE_NAME, MODULE_NAME4, ABILITY_NAME) + .then(data => { + expect(data).assertFail(); + }).catch((err) => { + expect(err).assertEqual(INVALID_PARAM); + bundle.getAbilityIcon(BUNDLE_NAME, MODULE_NAME4, ABILITY_NAME, (error, data) => { + expect(error).assertEqual(INVALID_PARAM); + }); }); + await bundle.getAbilityIcon(BUNDLE_NAME, MODULE_NAME5, ABILITY_NAME) + .then(data => { + expect(data).assertFail(); + done(); + }).catch((err) => { + expect(err).assertEqual(INVALID_PARAM); + bundle.getAbilityIcon(BUNDLE_NAME, MODULE_NAME5, ABILITY_NAME, (error, data) => { + expect(error).assertEqual(INVALID_PARAM); + done(); + }); + }); + }); - /* - * @tc.number: QueryAbilityByWant_0200 - * @tc.name: test queryAbilityByWant - * @tc.desc: test non-existent moduleName - */ - it('QueryAbilityByWant_0200', 0, async function (done) { - await bundle.queryAbilityByWant({ - bundleName: BUNDLE_NAME, - abilityName: ABILITY_NAME, - moduleName: MODULE_NAME2 - }, DEFAULT_FLAG, userId).then(data => { - expect(data).assertFail(); - }).catch(err => { - console.error('[QueryAbilityByWant_0200]Operation failed. Err: ' + JSON.stringify(err)); - expect(err).assertEqual(INVALID_CODE); - }); - bundle.queryAbilityByWant({ - bundleName: BUNDLE_NAME, - abilityName: ABILITY_NAME, - moduleName: MODULE_NAME2 - }, DEFAULT_FLAG, userId, (err, data) => { - console.info("'[QueryAbilityByWant_0200]Return data " + JSON.stringify(data)); - expect(data).assertEqual("QueryAbilityInfos failed"); - console.error('[QueryAbilityByWant_0200]Operation failed. Err: ' + JSON.stringify(err)); - expect(err).assertEqual(INVALID_CODE); - done(); - }); + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0025 + * @tc.name: getAbilityLabelUndefinedModule + * @tc.desc: test undefined moduleName + */ + it('getAbilityLabelUndefinedModule', 0, async function (done) { + await bundle.getAbilityLabel(BUNDLE_NAME, MODULE_NAME4, ABILITY_NAME) + .then(data => { + expect(data).assertFail(); + }).catch((err) => { + expect(err).assertEqual(INVALID_PARAM); + bundle.getAbilityLabel(BUNDLE_NAME, MODULE_NAME4, ABILITY_NAME, (error, data) => { + expect(error).assertEqual(INVALID_PARAM); + }); }); + await bundle.getAbilityLabel(BUNDLE_NAME, MODULE_NAME5, ABILITY_NAME) + .then(data => { + expect(data).assertFail(); + done(); + }).catch((err) => { + expect(err).assertEqual(INVALID_PARAM); + bundle.getAbilityLabel(BUNDLE_NAME, MODULE_NAME5, ABILITY_NAME, (error, data) => { + expect(error).assertEqual(INVALID_PARAM); + done(); + }); + }); + }); - /* - * @tc.number: QueryAbilityByWant_0300 - * @tc.name: test queryAbilityByWant - * @tc.desc: test existent moduleName - */ - it('QueryAbilityByWant_0300', 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)); - }).catch(err => { - console.info("[QueryAbilityByWant_0300]Operation failed. Err: " + JSON.stringify(err)); - expect(err).assertFail(); - }); - bundle.queryAbilityByWant({ - bundleName: BUNDLE_NAME, - abilityName: ABILITY_NAME, - moduleName: MODULE_NAME3 - }, DEFAULT_FLAG, userId, (err, data) => { - expect(err).assertEqual(SUCCESS_CODE); - if (err) { - console.error('[QueryAbilityByWant_0300]Operation failed. Err: ' + JSON.stringify(err)); - } - checkDataInfo(data[0]); - console.info("'[QueryAbilityByWant_0300]Return data : " + JSON.stringify(data)); - done(); - }); + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0004 + * @tc.name: queryAbilityByWantUndefinedModule + * @tc.desc: test undefined moduleName + */ + it('queryAbilityByWantUndefinedModule', 0, async function (done) { + await bundle.queryAbilityByWant({ + bundleName: BUNDLE_NAME, + abilityName: ABILITY_NAME, + moduleName: MODULE_NAME4 + }, DEFAULT_FLAG, userId).then(data => { + checkDataInfo(data[0]); + bundle.queryAbilityByWant({ + bundleName: BUNDLE_NAME, + abilityName: ABILITY_NAME, + moduleName: MODULE_NAME4 + }, DEFAULT_FLAG, userId, (err1, data1) => { + checkDataInfo(data1[0]); + expect(err1).assertEqual(SUCCESS_CODE); + }); + }).catch(err => { + expect().assertFail(); + }); + await bundle.queryAbilityByWant({ + bundleName: BUNDLE_NAME, + abilityName: ABILITY_NAME, + moduleName: MODULE_NAME5 + }, DEFAULT_FLAG, userId).then(data => { + checkDataInfo(data[0]); + bundle.queryAbilityByWant({ + bundleName: BUNDLE_NAME, + abilityName: ABILITY_NAME, + moduleName: MODULE_NAME5 + }, DEFAULT_FLAG, userId, (err1, data1) => { + checkDataInfo(data1[0]); + expect(err1).assertEqual(SUCCESS_CODE); + done(); }); + }).catch(err => { + expect().assertFail(); + done(); + }); + }); - function checkDataInfo(data) { - expect(typeof (data.bundleName)).assertEqual("string"); - expect(data.bundleName).assertEqual("com.example.bmsmodulename"); - expect(typeof (data.name)).assertEqual("string"); - expect(data.name).assertEqual("com.example.bmsmodulename.MainAbility"); - expect(data.label).assertEqual("$string:app_name"); - expect(typeof (data.label)).assertEqual("string"); - expect(data.description).assertEqual("$string:mainability_description"); - expect(typeof (data.description)).assertEqual("string"); - expect(data.icon).assertEqual("$media:icon"); - expect(typeof (data.icon)).assertEqual("string"); - expect(data.isVisible).assertEqual(false); - expect(data.deviceTypes[0]).assertEqual("default"); - expect(typeof (data.process)).assertEqual("string"); - expect(data.process).assertEqual("com.example.bmsmodulename"); - expect(typeof (data.uri)).assertEqual("string"); - expect(data.uri).assertEqual(""); - expect(data.moduleName).assertEqual("entry"); - expect(typeof (data.moduleName)).assertEqual("string"); - expect(typeof (data.applicationInfo)).assertEqual("object"); - let info = data.applicationInfo; - expect(typeof (info)).assertEqual("object"); - expect(typeof (info.name)).assertEqual("string"); - expect(info.name).assertEqual("com.example.bmsmodulename"); - expect(typeof (info.codePath)).assertEqual("string"); - expect(info.codePath).assertEqual("/data/app/el1/bundle/public/com.example.bmsmodulename"); - expect(typeof (info.accessTokenId)).assertEqual("number"); - expect(info.accessTokenId > 0).assertTrue(); - expect(typeof (info.description)).assertEqual("string"); - expect(info.description).assertEqual(""); - expect(typeof (info.descriptionId)).assertEqual("number"); - expect(info.descriptionId).assertEqual(0); - expect(typeof (info.icon)).assertEqual("string"); - expect(info.icon).assertEqual("$media:icon"); - expect(typeof (info.iconId)).assertEqual("number"); - expect(info.iconId > 0).assertTrue(); - expect(typeof (info.label)).assertEqual("string"); - expect(info.label).assertEqual("$string:app_name"); - expect(typeof (info.labelId)).assertEqual("number"); - expect(info.labelId > 0).assertTrue(); - expect(info.systemApp).assertEqual(false); - expect(typeof (info.entryDir)).assertEqual("string"); - expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/com.example.bmsmodulename/com.example.bmsmodulenamedentry"); - expect(typeof (info.process)).assertEqual("string"); - expect(info.process).assertEqual("com.example.bmsmodulename"); - expect(Array.isArray(info.permissions)).assertEqual(true); - console.log("---checkDataInfo End--- "); - } + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0027 + * @tc.name: getAbilityIconMultiHap + * @tc.desc: test existent moduleName + */ + it('getAbilityIconMultiHap', 0, async function (done) { + await bundle.getAbilityIcon(BUNDLE_NAME1, MODULE_NAME6, ABILITY_NAME1) + .then(data => { + expect(data.getBytesNumberPerRow()).assertLarger(0); + }).catch((err) => { + expect(err).assertFail(); + }); + bundle.getAbilityIcon(BUNDLE_NAME1, MODULE_NAME6, ABILITY_NAME1, (err, data) => { + expect(err).assertEqual(SUCCESS_CODE); + expect(data.getBytesNumberPerRow()).assertLarger(0); + done(); + }); + }); + + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0019 + * @tc.name: getAbilityInfoMultiHap + * @tc.desc: test existent moduleName + */ + it('getAbilityInfoMultiHap', 0, async function (done) { + await bundle.getAbilityInfo(BUNDLE_NAME1, MODULE_NAME6, ABILITY_NAME1) + .then(data => { + checkAbilityInfo(data); + }).catch((err) => { + expect(err).assertFail(); + }); + bundle.getAbilityInfo(BUNDLE_NAME1, MODULE_NAME6, ABILITY_NAME1, (err, data) => { + checkAbilityInfo(data); + expect(err).assertEqual(SUCCESS_CODE); + done(); + }); + }); + + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMODULE_0023 + * @tc.name: getAbilityLabelMultiHap + * @tc.desc: test existent moduleName + */ + it('getAbilityLabelMultiHap', 0, async function (done) { + await bundle.getAbilityLabel(BUNDLE_NAME1, MODULE_NAME6, ABILITY_NAME1) + .then(data => { + expect(data).assertEqual("bmsscenethree"); + }).catch((err) => { + expect(err).assertFail(); + }); + bundle.getAbilityLabel(BUNDLE_NAME1, MODULE_NAME6, ABILITY_NAME1, (err, data) => { + expect(data).assertEqual("bmsscenethree"); + expect(err).assertNull(); + done(); + }); + }); + + + function checkDataInfo(data) { + expect(typeof (data.bundleName)).assertEqual("string"); + expect(data.bundleName).assertEqual("com.example.bmsmodulename"); + expect(typeof (data.name)).assertEqual("string"); + expect(data.name).assertEqual("com.example.bmsmodulename.MainAbility"); + expect(data.label).assertEqual("$string:app_name"); + expect(typeof (data.label)).assertEqual("string"); + expect(data.description).assertEqual("$string:mainability_description"); + expect(typeof (data.description)).assertEqual("string"); + expect(data.icon).assertEqual("$media:icon"); + expect(typeof (data.icon)).assertEqual("string"); + expect(data.isVisible).assertEqual(false); + expect(data.deviceTypes[0]).assertEqual("default"); + expect(typeof (data.process)).assertEqual("string"); + expect(data.process).assertEqual("com.example.bmsmodulename"); + expect(typeof (data.uri)).assertEqual("string"); + expect(data.uri).assertEqual(""); + expect(data.moduleName).assertEqual("entry"); + expect(typeof (data.moduleName)).assertEqual("string"); + expect(typeof (data.applicationInfo)).assertEqual("object"); + let info = data.applicationInfo; + expect(typeof (info)).assertEqual("object"); + expect(typeof (info.name)).assertEqual("string"); + expect(info.name).assertEqual("com.example.bmsmodulename"); + expect(typeof (info.codePath)).assertEqual("string"); + expect(info.codePath).assertEqual("/data/app/el1/bundle/public/com.example.bmsmodulename"); + expect(typeof (info.accessTokenId)).assertEqual("number"); + expect(info.accessTokenId > 0).assertTrue(); + expect(typeof (info.description)).assertEqual("string"); + expect(info.description).assertEqual(""); + expect(typeof (info.descriptionId)).assertEqual("number"); + expect(info.descriptionId).assertEqual(0); + expect(typeof (info.icon)).assertEqual("string"); + expect(info.icon).assertEqual("$media:icon"); + expect(typeof (info.iconId)).assertEqual("number"); + expect(info.iconId > 0).assertTrue(); + expect(typeof (info.label)).assertEqual("string"); + expect(info.label).assertEqual("$string:app_name"); + expect(typeof (info.labelId)).assertEqual("number"); + expect(info.labelId > 0).assertTrue(); + expect(info.systemApp).assertEqual(false); + expect(typeof (info.entryDir)).assertEqual("string"); + expect(info.entryDir) + .assertEqual("/data/app/el1/bundle/public/com.example.bmsmodulename/com.example.bmsmodulenamedentry"); + expect(typeof (info.process)).assertEqual("string"); + expect(info.process).assertEqual("com.example.bmsmodulename"); + expect(Array.isArray(info.permissions)).assertEqual(true); + console.log("---checkDataInfo End--- "); + } + + function checkAbilityInfo(data) { + expect(typeof (data.bundleName)).assertEqual("string"); + expect(data.bundleName).assertEqual("com.example.myapplication2"); + expect(typeof (data.name)).assertEqual("string"); + expect(data.name).assertEqual("com.example.myapplication2.MainAbility"); + expect(data.label).assertEqual("$string:app_name"); + expect(typeof (data.label)).assertEqual("string"); + expect(data.description).assertEqual("$string:mainability_description"); + expect(typeof (data.description)).assertEqual("string"); + expect(data.icon).assertEqual("$media:icon"); + expect(typeof (data.icon)).assertEqual("string"); + expect(data.isVisible).assertEqual(false); + expect(data.deviceTypes[0]).assertEqual("default"); + expect(typeof (data.process)).assertEqual("string"); + expect(data.process).assertEqual("com.example.myapplication2"); + expect(typeof (data.uri)).assertEqual("string"); + expect(data.uri).assertEqual(""); + expect(data.moduleName).assertEqual("feature"); + expect(typeof (data.moduleName)).assertEqual("string"); + expect(typeof (data.applicationInfo)).assertEqual("object"); + let info = data.applicationInfo; + expect(typeof (info)).assertEqual("object"); + expect(typeof (info.name)).assertEqual("string"); + expect(info.name).assertEqual("com.example.myapplication2"); + expect(typeof (info.codePath)).assertEqual("string"); + expect(info.codePath).assertEqual("/data/app/el1/bundle/public/com.example.myapplication2"); + expect(typeof (info.accessTokenId)).assertEqual("number"); + expect(info.accessTokenId > 0).assertTrue(); + expect(typeof (info.description)).assertEqual("string"); + expect(info.description).assertEqual("$string:entry_description"); + expect(typeof (info.descriptionId)).assertEqual("number"); + expect(info.descriptionId).assertLarger(0); + expect(typeof (info.icon)).assertEqual("string"); + expect(info.icon).assertEqual("$media:icon"); + expect(typeof (info.iconId)).assertEqual("number"); + expect(info.iconId > 0).assertTrue(); + expect(typeof (info.label)).assertEqual("string"); + expect(info.label).assertEqual("$string:app_name"); + expect(typeof (info.labelId)).assertEqual("number"); + expect(info.labelId > 0).assertTrue(); + expect(info.systemApp).assertEqual(false); + expect(typeof (info.entryDir)).assertEqual("string"); + expect(info.entryDir) + .assertEqual("/data/app/el1/bundle/public/com.example.myapplication2/com.example.myapplication1"); + expect(typeof (info.process)).assertEqual("string"); + expect(info.process).assertEqual("com.example.myapplication2"); + expect(Array.isArray(info.permissions)).assertEqual(true); + console.log("---checkDataInfo End--- "); + } function generateAbilityInfoForTest(bundleName, name, moduleName) { let map1 = new Map([ ["", [{ @@ -570,5 +812,5 @@ export default function actsBmsJsModuleNameTest() { return abilityInfo; } - }); + }); } diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/BUILD.gn b/bundlemanager/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/BUILD.gn index ce69909e471eb69348be861b54313422eab4d704..b156672adcb825f0f6dd42e203a626c4916a5c0c 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/BUILD.gn +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/config.json index 5a510c5707e8676d55cb44b06d71daa248569a2a..46a91eb673358adbb2763e13198f5cb0286ab30a 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "default" ], "distro": { 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/BUILD.gn b/bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/BUILD.gn index 47abab63072b2e5a19872b8f357b01d0f8ef4659..23dab43993f857c7521cf2a918ce6d34f6d096c3 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/BUILD.gn +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/src/main/config.json index a7302380af1b2f4900e0f18b0f8439801d45ec3b..3aef2b629639ce249b0d064d662afd5fa0e77c86 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsgetinfostest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsbmsgetinfostest", "name": ".entry", "deviceType": [ + "default", "default" ], "distro": { 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/actsbmshapmoduletest/BUILD.gn b/bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/BUILD.gn index aafe9d7433059cd3e0e9aa67956f5d566bce364e..78d1752b348fede4ded76cde8747859a82fb5c18 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/BUILD.gn +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/config.json index 1ecdf3575b7842aff8132f76f9891496c1f41c2b..cf475a3d80568927aaed75f67360bd0641263cd0 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmshapmoduletest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsbmshapmoduletest", "name": ".entry", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsjstest/BUILD.gn b/bundlemanager/bundle_standard/bundlemanager/actsbmsjstest/BUILD.gn index d6661af0c79cc7a5e8c1e4e788ab0f6ef95d74b1..349cce860076a7831d0310ff37c4f1de82ba0819 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsjstest/BUILD.gn +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsjstest/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsjstest/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsjstest/src/main/config.json index 64f0ad19830d7cb8d520af2dfb6e33005def655f..64d1423f3c19c2fda745d743dfb76610064d0d2e 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsjstest/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsjstest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsbmsjstest", "name": ".entry", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsjstest/src/main/js/test/ActsBmsHasInstalldTest.test.js b/bundlemanager/bundle_standard/bundlemanager/actsbmsjstest/src/main/js/test/ActsBmsHasInstalldTest.test.js index 7f946d076264a2ced79b1dfe44bf1aa105ea3e68..5b2db1c03f187f2a3779e66b2b916e91fb11916a 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsjstest/src/main/js/test/ActsBmsHasInstalldTest.test.js +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsjstest/src/main/js/test/ActsBmsHasInstalldTest.test.js @@ -23,12 +23,12 @@ const ERR_MERSSAGE = 'value is not an available number'; export default function ActsBmsHasInstalldTest() { describe('ActsBmsHasInstalldTest', function () { - /** - * @tc.number hasInstalled_0100 - * @tc.name Package::hasInstalled + /* + * @tc.number SUB_BMS_HAP_STATUS_0001 + * @tc.name testHasInstalled * @tc.desc Test hasInstalled interface. */ - it('hasInstalled_0100', 0, async function (done) { + it('testHasInstalled', 0, async function (done) { let flag = 0; pkg.hasInstalled({ bundleName: 'com.example.third2', @@ -49,54 +49,73 @@ describe('ActsBmsHasInstalldTest', function () { }); }); - /** - * @tc.number hasInstalled_0200 - * @tc.name Package::hasInstalled - * @tc.desc Test hasInstalled interface. + /* + * @tc.number SUB_BMS_HAP_STATUS_0002 + * @tc.name testHasInstalledNoSuccess + * @tc.desc Test hasInstalled interface without success function. */ - it('hasInstalled_0200', 0, async function (done) { - let flag = 0; + it('testHasInstalledNoSuccess', 0, async function (done) { pkg.hasInstalled({ - bundleName: 'wrongName', - success: function success(data) { - console.info('hasInstalled success function in'); - flag += 1; - expect(data.result).assertFalse(); - }, + bundleName: 'com.example.third2', fail: function fail(data, code) { console.info('hasInstalled fail function in'); expect().assertFail(); }, complete: function complete() { console.info('hasInstalled complete function in'); - expect(flag).assertEqual(1); done(); } }); }); - /** - * @tc.number hasInstalled_0300 - * @tc.name Package::hasInstalled - * @tc.desc Test hasInstalled interface. + /* + * @tc.number SUB_BMS_HAP_STATUS_0003 + * @tc.name testHasInstalledNoFailComplete + * @tc.desc Test hasInstalled without fail function and complete function. */ - it('hasInstalled_0300', 0, async function (done) { + it('testHasInstalledNoFailComplete', 0, async function (done) { pkg.hasInstalled({ - bundleName: 'wrongName', + bundleName: 'com.example.third2', success: function success(data) { console.info('hasInstalled success function in'); + expect(data.result).assertTrue(); + done(); + } + }); + }); + + /* + * @tc.number SUB_BMS_HAP_STATUS_0004 + * @tc.name hasInstalledHapNotExist + * @tc.desc Test hasInstalled when hap not exist. + */ + it('hasInstalledHapNotExist', 0, async function (done) { + let flag = 0; + pkg.hasInstalled({ + bundleName: 'wrongName', + success: function success(data) { + console.info('hasInstalled success function in' + JSON.stringify(data)); + flag += 1; expect(data.result).assertFalse(); + }, + fail: function fail(data, code) { + console.info('hasInstalled fail function in'); + expect().assertFail(); + }, + complete: function complete() { + console.info('hasInstalled complete function in'); + expect(flag).assertEqual(1); done(); } }); }); - /** - * @tc.number hasInstalled_0400 - * @tc.name Package::hasInstalled - * @tc.desc Test hasInstalled interface. + /* + * @tc.number SUB_BMS_HAP_STATUS_0007 + * @tc.name testHasInstalledNumberParam + * @tc.desc Test hasInstalled when bundleName is number. */ - it('hasInstalled_0400', 0, async function (done) { + it('testHasInstalledNumberParam', 0, async function (done) { let flag = 0; pkg.hasInstalled({ bundleName: NUM_TWO, @@ -111,41 +130,97 @@ describe('ActsBmsHasInstalldTest', function () { expect(code).assertEqual(ERR_CODE); }, complete: function complete() { - flag += 3; console.info('hasInstalled complete function in'); - expect(flag).assertEqual(5) + expect(flag).assertEqual(2) done(); } }); }); /* - * @tc.number: hasInstalled_0500 - * @tc.name: test hasInstalled bundleName is number - * @tc.desc: test hasInstalled bundleName is number without function fail - * @tc.level 3 - */ - it('hasInstalled_0500', 0, async function (done) { + * @tc.number SUB_BMS_HAP_STATUS_0008 + * @tc.name testHasInstalledFailNotExist + * @tc.desc Test hasInstalled without function fail. + */ + it('testHasInstalledFailNotExist', 0, async function (done) { pkg.hasInstalled({ bundleName: NUM_TWO, success: function success(data) { - console.info('hasInstalled success' + JSON.stringify(data)); - expect(error).assertFail(); + console.info('hasInstalled success function in'); + expect().assertFail(); }, complete: function complete() { - console.info('hasInstalled complete'); + console.info('hasInstalled complete function in'); done(); } - }) + }); + }); + + /* + * @tc.number SUB_BMS_HAP_STATUS_0009 + * @tc.name testHasInstalledCompleteNotExit + * @tc.desc Test hasInstalled without function complete. + */ + it('testHasInstalledCompleteNotExit', 0, async function (done) { + pkg.hasInstalled({ + bundleName: undefined, + success: function success(data) { + console.info('hasInstalled success function in'); + expect().assertFail(); + done(); + }, + fail: function fail(data, code) { + console.info('hasInstalled fail function in'); + expect(data).assertEqual(ERR_MERSSAGE); + expect(code).assertEqual(ERR_CODE); + done(); + } + }); + }); + + /* + * @tc.number SUB_BMS_HAP_STATUS_0010 + * @tc.name testHasInstalledReturnNotExist + * @tc.desc Test hasInstalled without function fail and function complete. + */ + it('testHasInstalledReturnNotExist', 0, async function (done) { + let status = "normal"; + pkg.hasInstalled({ + bundleName: NUM_TWO, + success: function success(data) { + status = "success"; + console.info('hasInstalled success function in'); + expect().assertFail(); + } + }); + await sleep(500); + expect(status).assertEqual("normal"); + done(); + }); + + /* + * @tc.number SUB_BMS_HAP_STATUS_0013 + * @tc.name testHasInstalledNoFailCompleteBundleNotExist + * @tc.desc Test hasInstalled interface without function fail and function complete bundleName not exiet + */ + it('testHasInstalledNoFailCompleteBundleNotExist', 0, async function (done) { + pkg.hasInstalled({ + bundleName: 'wrongName', + success: function success(data) { + console.info('hasInstalled success function in'); + expect(data.result).assertFalse(); + done(); + } + }); }); /* - * @tc.number: hasInstalled_0600 - * @tc.name: test hasInstalled bundleName is number + * @tc.number: SUB_BMS_HAP_STATUS_0014 + * @tc.name: testHasInstalledInvalidParamCompleteNotExit * @tc.desc: test hasInstalled bundleName is number without function complete * @tc.level 3 */ - it('hasInstalled_0600', 0, async function (done) { + it('testHasInstalledInvalidParamCompleteNotExit', 0, async function (done) { pkg.hasInstalled({ bundleName: NUM_TWO, success: function success(data) { @@ -161,4 +236,14 @@ describe('ActsBmsHasInstalldTest', function () { } }) }); + + async function sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, time) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } })} diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/BUILD.gn b/bundlemanager/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/BUILD.gn index 2f64089d6a22a54527b87e34b390573e2d69b901..dcb6fc519da7692b4d0a93382b9368dfbc132d1c 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/BUILD.gn +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/src/main/config.json index 72d3b12363834fc353ae18b7aaac6ab1def77f72..795255c8e28795d8a7c6672cc3cfb21ecb21f41e 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsbmsjsunpermissiontest", "name": ".entry", "deviceType": [ + "default", "default" ], "distro": { 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/actsbmsmetadatatest/BUILD.gn b/bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/BUILD.gn index ac55ba709d435d3aa105149297df9cb28e8aad21..99231471ee62e940e350871cad25aafd90741d2e 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/BUILD.gn +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/config.json index 098a8a9a49bd0426c12890978808d7eb2b0682d7..b557b285618669c39a0622c1d356cefa9ebabb3f 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsmetadatatest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsbmsmetadatatest", "name": ".entry", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/BUILD.gn b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/BUILD.gn index f83310bbd43e46863a5ab5f1da2f3292b6202c57..42bf02cae3c615a02e8d7478ae50b6b7911288ee 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/BUILD.gn +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/BUILD.gn @@ -13,7 +13,7 @@ import("//test/xts/tools/build/suite.gni") -ohos_js_hap_suite("ActBmsStageEtsTest") { +ohos_js_hap_suite("ActsBmsStageEtsTest") { hap_profile = "entry/src/main/module.json" deps = [ ":actbmsstageetstest_js_assets", @@ -21,7 +21,7 @@ ohos_js_hap_suite("ActBmsStageEtsTest") { ] ets2abc = true certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActBmsStageEtsTest" + hap_name = "ActsBmsStageEtsTest" subsystem_name = "bundlemanager" part_name = "bundle_framework" } diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/Test.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/Test.json index e565426f0d39470bcb38bdc4e6be7fc187ab3d8f..f123b79ba7eef10d79ac450741b246bf32bee58a 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/Test.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/Test.json @@ -11,7 +11,7 @@ "kits": [ { "test-file-name": [ - "ActBmsStageEtsTest.hap" + "ActsBmsStageEtsTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true 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 4d53d13b00964c93a4416e0771a9938fac3ac35d..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 @@ -25,60 +25,61 @@ const METADATA_NAME = "ohos.ability.form" const METADATA_NAME1 = "ohos.ability.form1" const METADATA_NAME2 = "ohos.ability.form2" const METADATA_NAME3 = "ohos.ability.form3" +const METADATA_NAME4 = "ohos.ability.form4" const METADATA_NAME_TEST = "ohos.test.form" const PROFILE_JSON_STRING = "{\"src\":[\"MainAbility/pages/index/index\",\"MainAbility/pages/second/second\"]}" export default function getProfileByAbility() { describe('getProfileByAbility', function () { /* - * @tc.number: getProfileByAbility_0400 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0011 + * @tc.name: getProfileByAbilityInvalidModulePro * @tc.desc: Check the invalid moduleName (by promise) * @tc.level 0 */ - it('getProfileByAbility_0400', 0, async function (done) { + it('getProfileByAbilityInvalidModulePro', 0, async function (done) { await bundle.getProfileByAbility(MODULE_NAME_TEST, ABILITY_NAME, METADATA_NAME).then(data => { - console.info("getProfileByAbility_0400 success" + JSON.stringify(data)) + console.info("getProfileByAbilityInvalidModulePro success" + JSON.stringify(data)) expect(data).assertFail() done() }).catch(err => { - console.info("getProfileByAbility_0400 failed" + JSON.stringify(err)) + console.info("getProfileByAbilityInvalidModulePro failed" + JSON.stringify(err)) expect(err).assertEqual(1) done() }) }) /* - * @tc.number: getProfileByAbility_0500 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability - * @tc.desc: Check the invalid moduleName (by promise) + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0015 + * @tc.name: getProfileByAbilityEmptyModulePro + * @tc.desc: Check the empty moduleName (by promise) * @tc.level 0 */ - it('getProfileByAbility_0500', 0, async function (done) { + it('getProfileByAbilityEmptyModulePro', 0, async function (done) { await bundle.getProfileByAbility('', ABILITY_NAME, METADATA_NAME).then(data => { - console.info("getProfileByAbility_0500 success" + JSON.stringify(data)) + console.info("getProfileByAbilityEmptyModulePro success" + JSON.stringify(data)) expect(data).assertFail() done() }).catch(err => { - console.info("getProfileByAbility_0500 failed" + JSON.stringify(err)) + console.info("getProfileByAbilityEmptyModulePro failed" + JSON.stringify(err)) expect(err).assertEqual(1) done() }) }) /* - * @tc.number: getProfileByAbility_0600 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0017 + * @tc.name: getProfileByAbilityInvalidModuleCall * @tc.desc: Check the invalid moduleName (by callback) * @tc.level 0 */ - it('getProfileByAbility_0600', 0, async function (done) { + it('getProfileByAbilityInvalidModuleCall', 0, async function (done) { bundle.getProfileByAbility(MODULE_NAME_TEST, ABILITY_NAME, METADATA_NAME, (err, data) => { if (err) { - console.error('[getProfileByAbility_0600]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByAbilityInvalidModuleCall]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); } - console.info('[getProfileByAbility_0600] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByAbilityInvalidModuleCall] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(typeof data).assertEqual("string"); expect(data).assertEqual("GetProfile failed"); done(); @@ -86,18 +87,18 @@ export default function getProfileByAbility() { }) /* - * @tc.number: getProfileByAbility_0700 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability - * @tc.desc: Check the invalid moduleName (by callback) + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0034 + * @tc.name: getProfileByAbilityEmptyModuleCall + * @tc.desc: Check the empty moduleName (by callback) * @tc.level 0 */ - it('getProfileByAbility_0700', 0, async function (done) { + it('getProfileByAbilityEmptyModuleCall', 0, async function (done) { bundle.getProfileByAbility('', ABILITY_NAME, METADATA_NAME, (err, data) => { if (err) { - console.error('[getProfileByAbility_0700]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByAbilityEmptyModuleCall]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); } - console.info('[getProfileByAbility_0700] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByAbilityEmptyModuleCall] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(typeof data).assertEqual("string"); expect(data).assertEqual("GetProfile failed"); done(); @@ -105,54 +106,54 @@ export default function getProfileByAbility() { }) /* - * @tc.number: getProfileByAbility_0800 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0012 + * @tc.name: getProfileByAbilityInvalidAbilityPro * @tc.desc: Check the invalid abilityName (by promise) * @tc.level 0 */ - it('getProfileByAbility_0800', 0, async function (done) { + it('getProfileByAbilityInvalidAbilityPro', 0, async function (done) { await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME_TEST, METADATA_NAME).then(data => { - console.info("getProfileByAbility_0800 success" + JSON.stringify(data)) + console.info("getProfileByAbilityInvalidAbilityPro success" + JSON.stringify(data)) expect(data).assertFail() done() }).catch(err => { - console.info("getProfileByAbility_0800 failed" + JSON.stringify(err)) + console.info("getProfileByAbilityInvalidAbilityPro failed" + JSON.stringify(err)) expect(err).assertEqual(1) done() }) }) /* - * @tc.number: getProfileByAbility_0900 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability - * @tc.desc: Check the invalid abilityName (by promise) + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0029 + * @tc.name: getProfileByAbilityEmptyAbilityPro + * @tc.desc: Check the empty abilityName (by promise) * @tc.level 0 */ - it('getProfileByAbility_0900', 0, async function (done) { + it('getProfileByAbilityEmptyAbilityPro', 0, async function (done) { await bundle.getProfileByAbility(MODULE_NAME, '', METADATA_NAME).then(data => { - console.info("getProfileByAbility_0900 success" + JSON.stringify(data)) + console.info("getProfileByAbilityEmptyAbilityPro success" + JSON.stringify(data)) expect(data).assertFail() done() }).catch(err => { - console.info("getProfileByAbility_0900 failed" + JSON.stringify(err)) + console.info("getProfileByAbilityEmptyAbilityPro failed" + JSON.stringify(err)) expect(err).assertEqual(1) done() }) }) /* - * @tc.number: getProfileByAbility_1000 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0022 + * @tc.name: getProfileByAbilityInvalidAbilityCall * @tc.desc: Check the invalid abilityName (by callback) * @tc.level 0 */ - it('getProfileByAbility_1000', 0, async function (done) { + it('getProfileByAbilityInvalidAbilityCall', 0, async function (done) { bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME_TEST, METADATA_NAME, (err, data) => { if (err) { - console.error('[getProfileByAbility_1000]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByAbilityInvalidAbilityCall]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); } - console.info('[getProfileByAbility_1000] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByAbilityInvalidAbilityCall] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(typeof data).assertEqual("string"); expect(data).assertEqual("GetProfile failed"); done(); @@ -160,18 +161,18 @@ export default function getProfileByAbility() { }) /* - * @tc.number: getProfileByAbility_1100 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability - * @tc.desc: Check the invalid abilityName (by callback) + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0029 + * @tc.name: getProfileByAbilityEmptyAbilityCall + * @tc.desc: Check the empty abilityName (by callback) * @tc.level 0 */ - it('getProfileByAbility_1100', 0, async function (done) { + it('getProfileByAbilityEmptyAbilityCall', 0, async function (done) { bundle.getProfileByAbility(MODULE_NAME, '', METADATA_NAME, (err, data) => { if (err) { - console.error('[getProfileByAbility_1100]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByAbilityEmptyAbilityCall]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); } - console.info('[getProfileByAbility_1100] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByAbilityEmptyAbilityCall] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(typeof data).assertEqual("string"); expect(data).assertEqual("GetProfile failed"); done(); @@ -179,18 +180,18 @@ export default function getProfileByAbility() { }) /* - * @tc.number: getProfileByAbility_1200 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0024 + * @tc.name: getProfileByAbilityCallback * @tc.desc: Check the valid metadataName (by callback) * @tc.level 0 */ - it('getProfileByAbility_1200', 0, async function (done) { + it('getProfileByAbilityCallback', 0, async function (done) { bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME, (err, data) => { if (err) { - console.error('[getProfileByAbility_1200]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByAbilityCallback]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); } - console.info('[getProfileByAbility_1200] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByAbilityCallback] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(Array.isArray(data)).assertTrue(); expect(typeof data[0]).assertEqual("string"); expect(data[0]).assertEqual(PROFILE_JSON_STRING); @@ -199,18 +200,18 @@ export default function getProfileByAbility() { }) /* - * @tc.number: getProfileByAbility_1300 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0026 + * @tc.name: getProfileByAbilityInvalidMetaDataCall * @tc.desc: Check the invalid metadataName (by callback) * @tc.level 0 */ - it('getProfileByAbility_1300', 0, async function (done) { + it('getProfileByAbilityInvalidMetaDataCall', 0, async function (done) { bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME_TEST, (err, data) => { if (err) { - console.error('[getProfileByAbility_1300]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByAbilityInvalidMetaDataCall]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); } - console.info('[getProfileByAbility_1300] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByAbilityInvalidMetaDataCall] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(typeof data).assertEqual("string"); expect(data).assertEqual("GetProfile failed"); done(); @@ -218,18 +219,18 @@ export default function getProfileByAbility() { }) /* - * @tc.number: getProfileByAbility_1400 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0036 + * @tc.name: getProfileByAbilityEmptyMetaDataCall * @tc.desc: Check the empty metadataName (by callback) * @tc.level 0 */ - it('getProfileByAbility_1400', 0, async function (done) { + it('getProfileByAbilityEmptyMetaDataCall', 0, async function (done) { bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, '', (err, data) => { if (err) { - console.error('[getProfileByAbility_1400]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByAbilityEmptyMetaDataCall]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); } - console.info('[getProfileByAbility_1400] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByAbilityEmptyMetaDataCall] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(Array.isArray(data)).assertTrue(); expect(typeof data[0]).assertEqual("string"); expect(data[0]).assertEqual(PROFILE_JSON_STRING); @@ -240,52 +241,52 @@ export default function getProfileByAbility() { }) /* - * @tc.number: getProfileByAbility_1500 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0002 + * @tc.name: getProfileByAbilityPromise * @tc.desc: Check the valid metadataName (by promise) * @tc.level 0 */ - it('getProfileByAbility_1500', 0, async function (done) { + it('getProfileByAbilityPromise', 0, async function (done) { await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME).then(data => { - console.info('[getProfileByAbility_1500] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByAbilityPromise] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(Array.isArray(data)).assertTrue(); expect(typeof data[0]).assertEqual("string"); expect(data[0]).assertEqual(PROFILE_JSON_STRING); done(); }).catch(err => { - console.error('[getProfileByAbility_1500]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByAbilityPromise]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); done(); }) }) /* - * @tc.number: getProfileByAbility_1600 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0004 + * @tc.name: getProfileByAbilityInvalidMetaDataPro * @tc.desc: Check the invalid metadataName (by promise) * @tc.level 0 */ - it('getProfileByAbility_1600', 0, async function (done) { + it('getProfileByAbilityInvalidMetaDataPro', 0, async function (done) { await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME_TEST).then(data => { - console.info('[getProfileByAbility_1600] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByAbilityInvalidMetaDataPro] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(data).assertFail() done() }).catch(err => { - console.error('[getProfileByAbility_1600]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByAbilityInvalidMetaDataPro]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); done(); }) }) /* - * @tc.number: getProfileByAbility_1700 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0030 + * @tc.name: getProfileByAbilityEmptyMetaDataPro * @tc.desc: Check the empty metadataName (by promise) * @tc.level 0 */ - it('getProfileByAbility_1700', 0, async function (done) { + it('getProfileByAbilityEmptyMetaDataPro', 0, async function (done) { await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, '').then(data => { - console.info('[getProfileByAbility_1700] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByAbilityEmptyMetaDataPro] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(Array.isArray(data)).assertTrue(); expect(typeof data[0]).assertEqual("string"); expect(data[0]).assertEqual(PROFILE_JSON_STRING); @@ -293,21 +294,21 @@ export default function getProfileByAbility() { expect(data[1]).assertEqual(PROFILE_JSON_STRING); done(); }).catch(err => { - console.error('[getProfileByAbility_1700]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByAbilityEmptyMetaDataPro]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); done(); }) }) /* - * @tc.number: getProfileByAbility_1800 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0009 + * @tc.name: getProfileByAbilityNoMetaDataPro * @tc.desc: without metadataName (by promise) * @tc.level 0 */ - it('getProfileByAbility_1800', 0, async function (done) { + it('getProfileByAbilityNoMetaDataPro', 0, async function (done) { await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME).then(data => { - console.info('[getProfileByAbility_1800] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByAbilityNoMetaDataPro] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(Array.isArray(data)).assertTrue(); expect(typeof data[0]).assertEqual("string"); expect(data[0]).assertEqual(PROFILE_JSON_STRING); @@ -315,61 +316,61 @@ export default function getProfileByAbility() { expect(data[1]).assertEqual(PROFILE_JSON_STRING); done(); }).catch(err => { - console.error('[getProfileByAbility_1800]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByAbilityNoMetaDataPro]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); done(); }) }) /* - * @tc.number: getProfileByAbility_1900 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0048 + * @tc.name: getProfileByAbilityNoProfilePro * @tc.desc: no profile configured under the ability (by promise) * @tc.level 0 */ - it('getProfileByAbility_1900', 0, async function (done) { + it('getProfileByAbilityNoProfilePro', 0, async function (done) { await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME1).then(data => { - console.info('[getProfileByAbility_1900] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByAbilityNoProfilePro] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(data).assertFail() done(); }).catch(err => { - console.error('[getProfileByAbility_1900]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByAbilityNoProfilePro]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); done(); }) }) /* - * @tc.number: getProfileByAbility_2000 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0045 + * @tc.name: getProfileByAbilityNotPrefixPro * @tc.desc: resource has no prefix '$profile:' (by promise) * @tc.level 0 */ - it('getProfileByAbility_2000', 0, async function (done) { + it('getProfileByAbilityNotPrefixPro', 0, async function (done) { await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME2).then(data => { - console.info('[getProfileByAbility_2000] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByAbilityNotPrefixPro] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(data).assertFail() done(); }).catch(err => { - console.error('[getProfileByAbility_2000]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByAbilityNotPrefixPro]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); done(); }) }) /* - * @tc.number: getProfileByAbility_2100 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0044 + * @tc.name: getProfileByAbilityNotPrefixCall * @tc.desc: resource has no prefix '$profile:' (by callback) * @tc.level 0 */ - it('getProfileByAbility_2100', 0, async function (done) { + it('getProfileByAbilityNotPrefixCall', 0, async function (done) { bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME2, (err, data) => { if (err) { - console.error('[getProfileByAbility_2100]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByAbilityNotPrefixCall]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); } - console.info('[getProfileByAbility_2100] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByAbilityNotPrefixCall] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(typeof data).assertEqual("string"); expect(data).assertEqual("GetProfile failed"); done(); @@ -377,36 +378,72 @@ export default function getProfileByAbility() { }) /* - * @tc.number: getProfileByAbility_2200 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability - * @tc.desc: profile is not json-format (by promise) + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0007 + * @tc.name: getProfileByAbilityNotSuffixPro + * @tc.desc: profile is .txt suffix (by promise) * @tc.level 0 */ - it('getProfileByAbility_2200', 0, async function (done) { + it('getProfileByAbilityNotSuffixPro', 0, async function (done) { await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME3).then(data => { - console.info('[getProfileByAbility_2200] getApplicationInfo callback data is: ' + JSON.stringify(data)); - expect(data).assertFail() + console.info('[getProfileByAbilityNotSuffixPro] getApplicationInfo callback data is: ' + JSON.stringify(data)); + expect(Array.isArray(data)).assertTrue(); + expect(typeof data[0]).assertEqual("string"); done(); }).catch(err => { - console.error('[getProfileByAbility_2200]Operation failed. Cause: ' + JSON.stringify(err)); - expect(err).assertEqual(1); + console.error('[getProfileByAbilityNotSuffixPro]Operation failed. Cause: ' + JSON.stringify(err)); + expect().assertFail(); done(); }) }) /* - * @tc.number: getProfileByAbility_2300 - * @tc.name: getProfileByAbility : The profile is obtained by specified ability - * @tc.desc: profile is not json-format (by callback) + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0040 + * @tc.name: getProfileByAbilityNotSuffixCall + * @tc.desc: profile is .txt suffix (by callback) * @tc.level 0 */ - it('getProfileByAbility_2300', 0, async function (done) { + it('getProfileByAbilityNotSuffixCall', 0, async function (done) { bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME3, (err, data) => { if (err) { - console.error('[getProfileByAbility_2300]Operation failed. Cause: ' + JSON.stringify(err)); - expect(err).assertEqual(1); + console.error('[getProfileByAbilityNotSuffixCall]Operation failed. Cause: ' + JSON.stringify(err)); + expect().assertFail(); } - console.info('[getProfileByAbility_2300] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByAbilityNotSuffixCall] getApplicationInfo callback data is: ' + JSON.stringify(data)); + expect(Array.isArray(data)).assertTrue(); + expect(typeof data[0]).assertEqual("string"); + done(); + }); + }) + + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0008 + * @tc.name: getProfileByAbilityNoJsonPro + * @tc.desc: profile is invalid json format (by promise) + * @tc.level 0 + */ + it('getProfileByAbilityNoJsonPro', 0, async function (done) { + await bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME4).then(data => { + console.info('[getProfileByAbilityNoJsonPro] data is: ' + JSON.stringify(data)); + expect().assertFail(); + done(); + }).catch(err => { + console.error('[getProfileByAbilityNoJsonPro] Operation failed. Cause: ' + JSON.stringify(err)); + expect(err).assertEqual(1); + done(); + }) + }) + + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0046 + * @tc.name: getProfileByAbilityNoJsonCall + * @tc.desc: profile is invalid json format (by callback) + * @tc.level 0 + */ + it('getProfileByAbilityNoJsonCall', 0, async function (done) { + bundle.getProfileByAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME4, (err, data) => { + console.info('[getProfileByAbilityNoJsonCall] err: ' + JSON.stringify(err)); + expect(err).assertEqual(1); + console.info('[getProfileByAbilityNoJsonCall] data is: ' + JSON.stringify(data)); expect(typeof data).assertEqual("string"); expect(data).assertEqual("GetProfile failed"); done(); 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 1f96904892aaf4470b4f4084c14c9944265b215f..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 @@ -25,60 +25,61 @@ const METADATA_NAME = "ohos.extension.form" const METADATA_NAME1 = "ohos.extension.form1" const METADATA_NAME2 = "ohos.extension.form2" const METADATA_NAME3 = "ohos.extension.form3" +const METADATA_NAME4 = "ohos.extension.form4" const METADATA_NAME_TEST = "ohos.test.form" const PROFILE_JSON_STRING = "{\"src\":[\"MainAbility/pages/index/index\",\"MainAbility/pages/second/second\"]}" export default function getProfileByExtensionAbility() { describe('getProfileByExtensionAbility', function () { /* - * @tc.number: getProfileByExtensionAbility_0400 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0021 + * @tc.name: getProfileByExtensionInvalidModulePro * @tc.desc: Check the invalid moduleName (by promise) * @tc.level 0 */ - it('getProfileByExtensionAbility_0400', 0, async function (done) { + it('getProfileByExtensionInvalidModulePro', 0, async function (done) { await bundle.getProfileByExtensionAbility(MODULE_NAME_TEST, ABILITY_NAME, METADATA_NAME).then(data => { - console.info("getProfileByExtensionAbility_0400 success" + JSON.stringify(data)) + console.info("getProfileByExtensionInvalidModulePro success" + JSON.stringify(data)) expect(data).assertFail() done() }).catch(err => { - console.info("getProfileByExtensionAbility_0400 failed" + JSON.stringify(err)) + console.info("getProfileByExtensionInvalidModulePro failed" + JSON.stringify(err)) expect(err).assertEqual(1) done() }) }) /* - * @tc.number: getProfileByExtensionAbility_0500 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability - * @tc.desc: Check the invalid moduleName (by promise) + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0031 + * @tc.name: getProfileByExtensionEmptyModulePro + * @tc.desc: Check the Empty moduleName (by promise) * @tc.level 0 */ - it('getProfileByExtensionAbility_0500', 0, async function (done) { + it('getProfileByExtensionEmptyModulePro', 0, async function (done) { await bundle.getProfileByExtensionAbility('', ABILITY_NAME, METADATA_NAME).then(data => { - console.info("getProfileByExtensionAbility_0500 success" + JSON.stringify(data)) + console.info("getProfileByExtensionEmptyModulePro success" + JSON.stringify(data)) expect(data).assertFail() done() }).catch(err => { - console.info("getProfileByExtensionAbility_0500 failed" + JSON.stringify(err)) + console.info("getProfileByExtensionEmptyModulePro failed" + JSON.stringify(err)) expect(err).assertEqual(1) done() }) }) /* - * @tc.number: getProfileByExtensionAbility_0600 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0028 + * @tc.name: getProfileByExtensionEmptyModuleCall * @tc.desc: Check the invalid moduleName (by callback) * @tc.level 0 */ - it('getProfileByExtensionAbility_0600', 0, async function (done) { + it('getProfileByExtensionEmptyModuleCall', 0, async function (done) { bundle.getProfileByExtensionAbility(MODULE_NAME_TEST, ABILITY_NAME, METADATA_NAME, (err, data) => { if (err) { - console.error('[getProfileByExtensionAbility_0600]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByExtensionEmptyModuleCall]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); } - console.info('[getProfileByExtensionAbility_0600] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByExtensionEmptyModuleCall] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(typeof data).assertEqual("string"); expect(data).assertEqual("GetProfile failed"); done(); @@ -86,18 +87,18 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: getProfileByExtensionAbility_0700 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability - * @tc.desc: Check the invalid moduleName (by callback) + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0037 + * @tc.name: getProfileByExtensionEmptyModuleCall + * @tc.desc: Check the Empty moduleName (by callback) * @tc.level 0 */ - it('getProfileByExtensionAbility_0700', 0, async function (done) { + it('getProfileByExtensionEmptyModuleCall', 0, async function (done) { bundle.getProfileByExtensionAbility('', ABILITY_NAME, METADATA_NAME, (err, data) => { if (err) { - console.error('[getProfileByExtensionAbility_0700]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByExtensionEmptyModuleCall]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); } - console.info('[getProfileByExtensionAbility_0700] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByExtensionEmptyModuleCall] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(typeof data).assertEqual("string"); expect(data).assertEqual("GetProfile failed"); done(); @@ -105,54 +106,54 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: getProfileByExtensionAbility_0800 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0013 + * @tc.name: getProfileByExtensionInvalidAbilityPro * @tc.desc: Check the invalid abilityName (by promise) * @tc.level 0 */ - it('getProfileByExtensionAbility_0800', 0, async function (done) { + it('getProfileByExtensionInvalidAbilityPro', 0, async function (done) { await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME_TEST, METADATA_NAME).then(data => { - console.info("getProfileByExtensionAbility_0800 success" + JSON.stringify(data)) + console.info("getProfileByExtensionInvalidAbilityPro success" + JSON.stringify(data)) expect(data).assertFail() done() }).catch(err => { - console.info("getProfileByExtensionAbility_0800 failed" + JSON.stringify(err)) + console.info("getProfileByExtensionInvalidAbilityPro failed" + JSON.stringify(err)) expect(err).assertEqual(1) done() }) }) /* - * @tc.number: getProfileByExtensionAbility_0900 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability - * @tc.desc: Check the invalid abilityName (by promise) + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0032 + * @tc.name: getProfileByExtensionEmptyAbilityPro + * @tc.desc: Check the Empty abilityName (by promise) * @tc.level 0 */ - it('getProfileByExtensionAbility_0900', 0, async function (done) { + it('getProfileByExtensionEmptyAbilityPro', 0, async function (done) { await bundle.getProfileByExtensionAbility(MODULE_NAME, '', METADATA_NAME).then(data => { - console.info("getProfileByExtensionAbility_0900 success" + JSON.stringify(data)) + console.info("getProfileByExtensionEmptyAbilityPro success" + JSON.stringify(data)) expect(data).assertFail() done() }).catch(err => { - console.info("getProfileByExtensionAbility_0900 failed" + JSON.stringify(err)) + console.info("getProfileByExtensionEmptyAbilityPro failed" + JSON.stringify(err)) expect(err).assertEqual(1) done() }) }) /* - * @tc.number: getProfileByExtensionAbility_1000 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0023 + * @tc.name: getProfileByExtensionInvalidAbilityCall * @tc.desc: Check the invalid abilityName (by callback) * @tc.level 0 */ - it('getProfileByExtensionAbility_1000', 0, async function (done) { + it('getProfileByExtensionInvalidAbilityCall', 0, async function (done) { bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME_TEST, METADATA_NAME, (err, data) => { if (err) { - console.error('[getProfileByExtensionAbility_1000]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByExtensionInvalidAbilityCall]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); } - console.info('[getProfileByExtensionAbility_1000] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByExtensionInvalidAbilityCall] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(typeof data).assertEqual("string"); expect(data).assertEqual("GetProfile failed"); done(); @@ -160,18 +161,18 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: getProfileByExtensionAbility_1100 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability - * @tc.desc: Check the invalid abilityName (by callback) + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0038 + * @tc.name: getProfileByExtensionEmptyAbilityCall + * @tc.desc: Check the Empty abilityName (by callback) * @tc.level 0 */ - it('getProfileByExtensionAbility_1100', 0, async function (done) { + it('getProfileByExtensionEmptyAbilityCall', 0, async function (done) { bundle.getProfileByExtensionAbility(MODULE_NAME, '', METADATA_NAME, (err, data) => { if (err) { - console.error('[getProfileByExtensionAbility_1100]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByExtensionEmptyAbilityCall]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); } - console.info('[getProfileByExtensionAbility_1100] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByExtensionEmptyAbilityCall] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(typeof data).assertEqual("string"); expect(data).assertEqual("GetProfile failed"); done(); @@ -179,18 +180,18 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: getProfileByExtensionAbility_1200 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0025 + * @tc.name: getProfileByExtensionAbilityCallback * @tc.desc: Check the valid metadataName (by callback) * @tc.level 0 */ - it('getProfileByExtensionAbility_1200', 0, async function (done) { + it('getProfileByExtensionAbilityCallback', 0, async function (done) { bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME, (err, data) => { if (err) { - console.error('[getProfileByExtensionAbility_1200]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByExtensionAbilityCallback]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); } - console.info('[getProfileByExtensionAbility_1200] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByExtensionAbilityCallback] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(Array.isArray(data)).assertTrue(); expect(typeof data[0]).assertEqual("string"); expect(data[0]).assertEqual(PROFILE_JSON_STRING); @@ -199,18 +200,18 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: getProfileByExtensionAbility_1300 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0027 + * @tc.name: getProfileByExtensionInvalidMetaDataCall * @tc.desc: Check the invalid metadataName (by callback) * @tc.level 0 */ - it('getProfileByExtensionAbility_1300', 0, async function (done) { + it('getProfileByExtensionInvalidMetaDataCall', 0, async function (done) { bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME_TEST, (err, data) => { if (err) { - console.error('[getProfileByExtensionAbility_1300]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByExtensionInvalidMetaDataCall]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); } - console.info('[getProfileByExtensionAbility_1300] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByExtensionInvalidMetaDataCall] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(typeof data).assertEqual("string"); expect(data).assertEqual("GetProfile failed"); done(); @@ -218,18 +219,18 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: getProfileByExtensionAbility_1400 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0039 + * @tc.name: getProfileByExtensionEmptyMetaDataCall * @tc.desc: Check the empty metadataName (by callback) * @tc.level 0 */ - it('getProfileByExtensionAbility_1400', 0, async function (done) { + it('getProfileByExtensionEmptyMetaDataCall', 0, async function (done) { bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, '', (err, data) => { if (err) { - console.error('[getProfileByExtensionAbility_1400]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByExtensionEmptyMetaDataCall]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); } - console.info('[getProfileByExtensionAbility_1400] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByExtensionEmptyMetaDataCall] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(Array.isArray(data)).assertTrue(); expect(typeof data[0]).assertEqual("string"); expect(data[0]).assertEqual(PROFILE_JSON_STRING); @@ -240,52 +241,52 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: getProfileByExtensionAbility_1500 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0003 + * @tc.name: getProfileByExtensionAbilityPromise * @tc.desc: Check the valid metadataName (by promise) * @tc.level 0 */ - it('getProfileByExtensionAbility_1500', 0, async function (done) { + it('getProfileByExtensionAbilityPromise', 0, async function (done) { await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME).then(data => { - console.info('[getProfileByExtensionAbility_1500] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByExtensionAbilityPromise] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(Array.isArray(data)).assertTrue(); expect(typeof data[0]).assertEqual("string"); expect(data[0]).assertEqual(PROFILE_JSON_STRING); done(); }).catch(err => { - console.error('[getProfileByExtensionAbility_1500]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByExtensionAbilityPromise]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); done(); }) }) /* - * @tc.number: getProfileByExtensionAbility_1600 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0016 + * @tc.name: getProfileByExtensionInvalidMetaDataPro * @tc.desc: Check the invalid metadataName (by promise) * @tc.level 0 */ - it('getProfileByExtensionAbility_1600', 0, async function (done) { + it('getProfileByExtensionInvalidMetaDataPro', 0, async function (done) { await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME_TEST).then(data => { - console.info('[getProfileByExtensionAbility_1600] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByExtensionInvalidMetaDataPro] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(data).assertFail() done() }).catch(err => { - console.error('[getProfileByExtensionAbility_1600]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByExtensionInvalidMetaDataPro]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); done(); }) }) /* - * @tc.number: getProfileByExtensionAbility_1700 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0033 + * @tc.name: getProfileByExtensionEmptyMetaDataPro * @tc.desc: Check the empty metadataName (by promise) * @tc.level 0 */ - it('getProfileByExtensionAbility_1700', 0, async function (done) { + it('getProfileByExtensionEmptyMetaDataPro', 0, async function (done) { await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, '').then(data => { - console.info('[getProfileByExtensionAbility_1700] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByExtensionEmptyMetaDataPro] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(Array.isArray(data)).assertTrue(); expect(typeof data[0]).assertEqual("string"); expect(data[0]).assertEqual(PROFILE_JSON_STRING); @@ -293,21 +294,21 @@ export default function getProfileByExtensionAbility() { expect(data[1]).assertEqual(PROFILE_JSON_STRING); done(); }).catch(err => { - console.error('[getProfileByExtensionAbility_1700]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByExtensionEmptyMetaDataPro]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); done(); }) }) /* - * @tc.number: getProfileByExtensionAbility_1800 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0010 + * @tc.name: getProfileByExtensionAbilityNoMetaDataPro * @tc.desc: without metadataName (by promise) * @tc.level 0 */ - it('getProfileByExtensionAbility_1800', 0, async function (done) { + it('getProfileByExtensionAbilityNoMetaDataPro', 0, async function (done) { await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME).then(data => { - console.info('[getProfileByExtensionAbility_1800] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByExtensionAbilityNoMetaDataPro] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(Array.isArray(data)).assertTrue(); expect(typeof data[0]).assertEqual("string"); expect(data[0]).assertEqual(PROFILE_JSON_STRING); @@ -315,61 +316,61 @@ export default function getProfileByExtensionAbility() { expect(data[1]).assertEqual(PROFILE_JSON_STRING); done(); }).catch(err => { - console.error('[getProfileByExtensionAbility_1800]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByExtensionAbilityNoMetaDataPro]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); done(); }) }) /* - * @tc.number: getProfileByExtensionAbility_1900 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0049 + * @tc.name: getProfileByExtensionAbilityNoProfilePro * @tc.desc: no profile configured under the ability (by promise) * @tc.level 0 */ - it('getProfileByExtensionAbility_1900', 0, async function (done) { + it('getProfileByExtensionAbilityNoProfilePro', 0, async function (done) { await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME1).then(data => { - console.info('[getProfileByExtensionAbility_1900] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByExtensionAbilityNoProfilePro] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(data).assertFail() done(); }).catch(err => { - console.error('[getProfileByExtensionAbility_1900]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByExtensionAbilityNoProfilePro]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); done(); }) }) /* - * @tc.number: getProfileByExtensionAbility_2000 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0043 + * @tc.name: getProfileByExtensionNotPrefixPro * @tc.desc: resource has no prefix '$profile:' (by promise) * @tc.level 0 */ - it('getProfileByExtensionAbility_2000', 0, async function (done) { + it('getProfileByExtensionNotPrefixPro', 0, async function (done) { await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME2).then(data => { - console.info('[getProfileByExtensionAbility_2000] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByExtensionNotPrefixPro] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(data).assertFail() done(); }).catch(err => { - console.error('[getProfileByExtensionAbility_2000]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByExtensionNotPrefixPro]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); done(); }) }) /* - * @tc.number: getProfileByExtensionAbility_2100 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0042 + * @tc.name: getProfileByExtensionNotPrefixCall * @tc.desc: resource has no prefix '$profile:' (by callback) * @tc.level 0 */ - it('getProfileByExtensionAbility_2100', 0, async function (done) { + it('getProfileByExtensionNotPrefixCall', 0, async function (done) { bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME2, (err, data) => { if (err) { - console.error('[getProfileByExtensionAbility_2100]Operation failed. Cause: ' + JSON.stringify(err)); + console.error('[getProfileByExtensionNotPrefixCall]Operation failed. Cause: ' + JSON.stringify(err)); expect(err).assertEqual(1); } - console.info('[getProfileByExtensionAbility_2100] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByExtensionNotPrefixCall] getApplicationInfo callback data is: ' + JSON.stringify(data)); expect(typeof data).assertEqual("string"); expect(data).assertEqual("GetProfile failed"); done(); @@ -377,36 +378,72 @@ export default function getProfileByExtensionAbility() { }) /* - * @tc.number: getProfileByExtensionAbility_2200 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability - * @tc.desc: profile is not json-format (by promise) + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0019 + * @tc.name: getProfileByExtensionNotSuffixPro + * @tc.desc: profile is .txt suffix (by promise) * @tc.level 0 */ - it('getProfileByExtensionAbility_2200', 0, async function (done) { + it('getProfileByExtensionNotSuffixPro', 0, async function (done) { await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME3).then(data => { - console.info('[getProfileByExtensionAbility_2200] getApplicationInfo callback data is: ' + JSON.stringify(data)); - expect(data).assertFail() + console.info('[getProfileByExtensionNotSuffixPro] getApplicationInfo callback data is: ' + JSON.stringify(data)); + expect(Array.isArray(data)).assertTrue(); + expect(typeof data[0]).assertEqual("string"); done(); }).catch(err => { - console.error('[getProfileByExtensionAbility_2200]Operation failed. Cause: ' + JSON.stringify(err)); - expect(err).assertEqual(1); + console.error('[getProfileByExtensionNotSuffixPro]Operation failed. Cause: ' + JSON.stringify(err)); + expect().assertFail(); done(); }) }) /* - * @tc.number: getProfileByExtensionAbility_2300 - * @tc.name: getProfileByExtensionAbility : The profile is obtained by specified ability - * @tc.desc: profile is not json-format (by callback) + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0041 + * @tc.name: getProfileByExtensionNotSuffixCall + * @tc.desc: profile is .txt suffix (by callback) * @tc.level 0 */ - it('getProfileByExtensionAbility_2300', 0, async function (done) { + it('getProfileByExtensionNotSuffixCall', 0, async function (done) { bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME3, (err, data) => { if (err) { - console.error('[getProfileByExtensionAbility_2300]Operation failed. Cause: ' + JSON.stringify(err)); - expect(err).assertEqual(1); + console.error('[getProfileByExtensionNotSuffixCall]Operation failed. Cause: ' + JSON.stringify(err)); + expect().assertFail(); } - console.info('[getProfileByExtensionAbility_2300] getApplicationInfo callback data is: ' + JSON.stringify(data)); + console.info('[getProfileByExtensionNotSuffixCall] getApplicationInfo callback data is: ' + JSON.stringify(data)); + expect(Array.isArray(data)).assertTrue(); + expect(typeof data[0]).assertEqual("string"); + done(); + }); + }) + + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0020 + * @tc.name: getProfileByExtensionNoJsonPro + * @tc.desc: profile is invalid json format (by promise) + * @tc.level 0 + */ + it('getProfileByExtensionNoJsonPro', 0, async function (done) { + await bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME4).then(data => { + console.info('[getProfileByExtensionNoJsonPro] data is: ' + JSON.stringify(data)); + expect().assertFail(); + done(); + }).catch(err => { + console.error('[getProfileByExtensionNoJsonPro] Operation failed. Cause: ' + JSON.stringify(err)); + expect(err).assertEqual(1); + done(); + }) + }) + + /* + * @tc.number: SUB_BMS_APPINFO_QUERYMETAFILE_0047 + * @tc.name: getProfileByExtensionNoJsonCall + * @tc.desc: profile is invalid json format (by callback) + * @tc.level 0 + */ + it('getProfileByExtensionNoJsonCall', 0, async function (done) { + bundle.getProfileByExtensionAbility(MODULE_NAME, ABILITY_NAME, METADATA_NAME4, (err, data) => { + console.info('[getProfileByExtensionNoJsonCall] err: ' + JSON.stringify(err)); + expect(err).assertEqual(1); + console.info('[getProfileByExtensionNoJsonCall] data is: ' + JSON.stringify(data)); expect(typeof data).assertEqual("string"); expect(data).assertEqual("GetProfile failed"); done(); diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/module.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/module.json index 4412bd29f7a455446996c4f36b6b51b0ee746a5a..69858ac37ab5ddb9ed9d304bae494e0cf90d2f9c 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/module.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "default" ], "deliveryWithInstall": true, @@ -51,6 +52,11 @@ "name": "ohos.ability.form3", "value": "", "resource": "$profile:form_config1" + }, + { + "name": "ohos.ability.form4", + "value": "", + "resource": "$profile:invalid" } ] }, @@ -91,6 +97,11 @@ "name": "ohos.extension.form3", "value": "", "resource": "$profile:form_config1" + }, + { + "name": "ohos.extension.form4", + "value": "", + "resource": "$profile:invalid" } ], "name": "Form", diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/invalid.txt b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/invalid.txt new file mode 100644 index 0000000000000000000000000000000000000000..cdca51a17bcbc5128c3b424ef9467ecd68b98737 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/resources/base/profile/invalid.txt @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index/index", + "MainAbility/pages/second/second" +} \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/BUILD.gn b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/BUILD.gn index c86708e4429aa9f518581371acb5b50d9972a8c0..28f8539b83c130e6ee9716b8b0abfa99745a08df 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/BUILD.gn +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/config.json index 685a9b1217c7de81e130a0fa20a8277a8da45edf..0cf1741aecd6afa0b3ecbc8eda76df2ba0c223e0 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/config.json @@ -19,6 +19,7 @@ "srcPath": "", "mainAbility": "com.open.harmony.packagemag.MainAbility", "deviceType": [ + "default", "default" ], "reqPermissions": [ 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/GetResourceTest.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetResourceTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0220ffbeaeb043ea424d489df8fd324710f15f56 --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetResourceTest.test.ets @@ -0,0 +1,300 @@ +/** + * 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, it, expect, beforeAll, beforeEach, afterEach, afterAll } from 'hypium/index'; +import bundleManager from '@ohos.bundle'; +import account from '@ohos.account.osAccount' + +const BUNDLE_NAME = 'com.example.myapplication1'; +const MODULE_NAME = 'entry'; +const ABILITY_NAME = 'com.example.myapplication1.MainAbility'; +const PATH = '/data/test/bmsJstest1.hap'; +const FLAG1 = bundleManager.BundleFlag.GET_BUNDLE_WITH_ABILITIES; +const FLAG2 = bundleManager.BundleFlag.GET_ALL_APPLICATION_INFO; +const FLAG3 = bundleManager.BundleFlag.GET_BUNDLE_DEFAULT; +let userId = 0; + +export default function GetResourceTest() { + + describe('GetResourceTest', 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: SUB_BMS_APPINFO_GETAPPICON_0001 + * @tc.name: getBundleInfoForResource + * @tc.desc: get Resource by getBundleInfo + */ + it('getBundleInfoForResource', 0, async function (done) { + await bundleManager.getBundleInfo(BUNDLE_NAME, FLAG1).then(data => { + let applicationInfo = data.appInfo; + expect(applicationInfo.iconResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.iconResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.iconResource.id).assertLarger(0) + expect(applicationInfo.labelResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.labelResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.labelResource.id).assertLarger(0) + expect(applicationInfo.descriptionResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.descriptionResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.descriptionResource.id).assertLarger(0) + }).catch(err => { + expect().assertFail(); + }) + bundleManager.getBundleInfo(BUNDLE_NAME, FLAG1, (err, data) => { + let applicationInfo = data.appInfo; + expect(applicationInfo.iconResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.iconResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.iconResource.id).assertLarger(0) + expect(applicationInfo.labelResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.labelResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.labelResource.id).assertLarger(0) + expect(applicationInfo.descriptionResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.descriptionResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.descriptionResource.id).assertLarger(0) + expect(err).assertEqual(0) + done() + }) + }); + + /* + * @tc.number: SUB_BMS_APPINFO_GETAPPICON_0002 + * @tc.name: getAllBundleInfoForResource + * @tc.desc: get Resource by getAllBundleInfo + */ + it('getAllBundleInfoForResource', 0, async function (done) { + await bundleManager.getAllBundleInfo(FLAG1).then(data => { + if (data.length > 0) { + for (let i = 0; i < data.length; i++) { + if (data[i].name == BUNDLE_NAME) { + let applicationInfo = data[i].appInfo; + expect(applicationInfo.iconResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.iconResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.iconResource.id).assertLarger(0) + expect(applicationInfo.labelResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.labelResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.labelResource.id).assertLarger(0) + expect(applicationInfo.descriptionResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.descriptionResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.descriptionResource.id).assertLarger(0) + } + } + } else { + expect().assertFail(); + } + }).catch(err => { + expect().assertFail(); + }); + bundleManager.getAllBundleInfo(FLAG1, (err, data) => { + if (data.length > 0) { + for (let i = 0; i < data.length; i++) { + if (data[i].name == BUNDLE_NAME) { + let applicationInfo = data[i].appInfo; + expect(applicationInfo.iconResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.iconResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.iconResource.id).assertLarger(0) + expect(applicationInfo.labelResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.labelResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.labelResource.id).assertLarger(0) + expect(applicationInfo.descriptionResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.descriptionResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.descriptionResource.id).assertLarger(0) + } + } + } else { + expect().assertFail(); + } + expect(err).assertEqual(0) + done(); + }) + }); + + /* + * @tc.number: SUB_BMS_APPINFO_GETAPPICON_0004 + * @tc.name: getAllApplicationInfoForResource + * @tc.desc: get Resource by getAllApplicationInfo + */ + it('getAllApplicationInfoForResource', 0, async function (done) { + await bundleManager.getAllApplicationInfo(FLAG2).then(data => { + if (data.length > 0) { + for (let i = 0; i < data.length; i++) { + if (data[i].name == BUNDLE_NAME) { + let applicationInfo = data[i]; + expect(applicationInfo.iconResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.iconResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.iconResource.id).assertLarger(0) + expect(applicationInfo.labelResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.labelResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.labelResource.id).assertLarger(0) + expect(applicationInfo.descriptionResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.descriptionResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.descriptionResource.id).assertLarger(0) + } + } + } else { + expect().assertFail(); + } + }).catch(err => { + expect().assertFail(); + }); + bundleManager.getAllApplicationInfo(FLAG2, (err, data) => { + if (data.length > 0) { + for (let i = 0; i < data.length; i++) { + if (data[i].name == BUNDLE_NAME) { + let applicationInfo = data[i]; + expect(applicationInfo.iconResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.iconResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.iconResource.id).assertLarger(0) + expect(applicationInfo.labelResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.labelResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.labelResource.id).assertLarger(0) + expect(applicationInfo.descriptionResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.descriptionResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.descriptionResource.id).assertLarger(0) + } + } + } else { + expect().assertFail(); + } + expect(err).assertEqual(0) + done(); + }) + }); + + + /* + * @tc.number: SUB_BMS_APPINFO_GETAPPICON_0005 + * @tc.name: getAbilityInfoForResource + * @tc.desc: get Resource by getAbilityInfo + */ + it('getAbilityInfoForResource', 0, async function (done) { + await bundleManager.getAbilityInfo(BUNDLE_NAME, ABILITY_NAME).then(data => { + let applicationInfo = data.applicationInfo; + expect(applicationInfo.iconResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.iconResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.iconResource.id).assertLarger(0) + expect(applicationInfo.labelResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.labelResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.labelResource.id).assertLarger(0) + expect(applicationInfo.descriptionResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.descriptionResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.descriptionResource.id).assertLarger(0) + }).catch(error => { + expect().assertFail(); + }); + bundleManager.getAbilityInfo(BUNDLE_NAME, ABILITY_NAME, (err, data) => { + let applicationInfo = data.applicationInfo; + expect(applicationInfo.iconResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.iconResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.iconResource.id).assertLarger(0) + expect(applicationInfo.labelResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.labelResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.labelResource.id).assertLarger(0) + expect(applicationInfo.descriptionResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.descriptionResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.descriptionResource.id).assertLarger(0) + expect(err).assertEqual(0) + done(); + }) + }); + + /* + * @tc.number: SUB_BMS_APPINFO_GETAPPICON_0006 + * @tc.name: queryAbilityByWantForResource + * @tc.desc: get Resource by queryAbilityByWant + */ + it('queryAbilityByWantForResource', 0, async function (done) { + await bundleManager.queryAbilityByWant({ + bundleName: BUNDLE_NAME, + abilityName: ABILITY_NAME + }, FLAG3, userId).then((data) => { + let applicationInfo = data[0].applicationInfo; + expect(applicationInfo.iconResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.iconResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.iconResource.id).assertLarger(0) + expect(applicationInfo.labelResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.labelResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.labelResource.id).assertLarger(0) + expect(applicationInfo.descriptionResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.descriptionResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.descriptionResource.id).assertLarger(0) + }).catch((error) => { + expect().assertFail(); + }); + bundleManager.queryAbilityByWant({ + bundleName: BUNDLE_NAME, + abilityName: ABILITY_NAME + }, FLAG3, userId, (err, data) => { + let applicationInfo = data[0].applicationInfo; + expect(applicationInfo.iconResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.iconResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.iconResource.id).assertLarger(0) + expect(applicationInfo.labelResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.labelResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.labelResource.id).assertLarger(0) + expect(applicationInfo.descriptionResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.descriptionResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.descriptionResource.id).assertLarger(0) + expect(err).assertEqual(0) + done(); + }) + }); + + /* + * @tc.number: SUB_BMS_APPINFO_GETAPPICON_0007 + * @tc.name: getBundleArchiveInfoForResource + * @tc.desc: get Resource by getBundleArchiveInfo + */ + it('getBundleArchiveInfoForResource', 0, async function (done) { + await bundleManager.getBundleArchiveInfo(PATH, FLAG1).then((data) => { + let applicationInfo = data.appInfo; + expect(applicationInfo.iconResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.iconResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.iconResource.id).assertLarger(0) + expect(applicationInfo.labelResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.labelResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.labelResource.id).assertLarger(0) + expect(applicationInfo.descriptionResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.descriptionResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.descriptionResource.id).assertLarger(0) + }).catch((err) => { + expect().assertFail(); + }) + bundleManager.getBundleArchiveInfo(PATH, FLAG1, (err, data) => { + let applicationInfo = data.appInfo; + expect(applicationInfo.iconResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.iconResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.iconResource.id).assertLarger(0) + expect(applicationInfo.labelResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.labelResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.labelResource.id).assertLarger(0) + expect(applicationInfo.descriptionResource.bundleName).assertEqual(BUNDLE_NAME) + expect(applicationInfo.descriptionResource.moduleName).assertEqual(MODULE_NAME) + expect(applicationInfo.descriptionResource.id).assertLarger(0) + expect(err).assertEqual(0) + done(); + }) + }); + + }); +} \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetSecondModule.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetSecondModule.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ccfdf5a6ea07c40999bc9d8890e5e5dd144df9ff --- /dev/null +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetSecondModule.test.ets @@ -0,0 +1,87 @@ +/* + * 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 '@ohos/hypium' +import demo from '@ohos.bundle' +import account from '@ohos.account.osAccount' +import featureAbility from '@ohos.ability.featureAbility' + +let userId = 0; + +export default function ActsBundleManagerTest() { +describe('GetSecondModuleTest', 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 GetSecondModuleTest_0100 + * @tc.name GetSecondModuleTest + * @tc.desc Test whether the secondary module (BundleInfo / ReqPermissionDetail / UsedScene / HapModuleInfo + * ApplicationInfo / ModuleInfo) can be exported by the primary module + */ + it('GetSecondModuleTest', 0, async function (done) { + let bundleInfo = await demo.getBundleInfo("com.example.myapplication1", + demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES | demo.BundleFlag.GET_BUNDLE_WITH_REQUESTED_PERMISSION); + let bundleInfoTest : demo.BundleInfo = bundleInfo; + expect(typeof(bundleInfoTest.name)).assertEqual('string'); + let reqPermissionDetailTest : demo.ReqPermissionDetail = bundleInfo.reqPermissionDetails[0]; + expect(typeof(reqPermissionDetailTest.name)).assertEqual('string'); + let usedSceneTest : demo.UsedScene = bundleInfo.reqPermissionDetails[0].usedScene; + expect(typeof(usedSceneTest.when)).assertEqual('string'); + let hapModuleInfoTest : demo.HapModuleInfo = bundleInfo.hapModuleInfos[0]; + expect(typeof(hapModuleInfoTest.name)).assertEqual('string'); + let applicationInfoTest : demo.ApplicationInfo = bundleInfo.appInfo; + expect(typeof (applicationInfoTest.name)).assertEqual('string'); + let moduleInfoTest : demo.ModuleInfo = bundleInfo.appInfo.moduleInfos[0]; + expect(typeof (moduleInfoTest.moduleName)).assertEqual('string'); + + let abilityInfo = await demo.queryAbilityByWant({ + "bundleName": "com.example.myapplication1", + "abilityName": "com.example.myapplication1.MainAbility" + }, demo.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | demo.BundleFlag.GET_ABILITY_INFO_WITH_PERMISSION | + demo.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, userId); + let abilityInfoTest : demo.AbilityInfo = abilityInfo[0]; + expect(typeof(abilityInfoTest.name)).assertEqual('string'); + let customizeDataTest : demo.CustomizeData = abilityInfo[0].metaData[0]; + expect(typeof(customizeDataTest.name)).assertEqual('string'); + + let extensionAbilityInfos = await demo.queryExtensionAbilityInfos({ + "bundleName": "ohos.acts.bundle.stage", + "abilityName": "ExtensionAbility1" + }, demo.ExtensionAbilityType.FORM, demo.ExtensionFlag.GET_EXTENSION_INFO_WITH_METADATA); + let extensionAbilityInfoTest : demo.ExtensionAbilityInfo = extensionAbilityInfos[0]; + expect(typeof(extensionAbilityInfoTest.bundleName)).assertEqual('string'); + let metadataTest : demo.Metadata = extensionAbilityInfos[0].metadata[0]; + expect(typeof(metadataTest.name)).assertEqual('string'); + + let context = featureAbility.getContext(); + let elementNameInfo = await context.getElementName(); + let elementNameTest : demo.ElementName = elementNameInfo; + expect(typeof (elementNameTest.bundleName)).assertEqual("string"); + + done(); + }) +}) + +} diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/IsDefaultApplication.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/IsDefaultApplication.test.ets index 900a00eb8e539d1808d4cbabe05c5963ec3d9933..e33336eedc1cae5da17879cca5d25e107cf6eb7f 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/IsDefaultApplication.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/IsDefaultApplication.test.ets @@ -32,7 +32,7 @@ export default function isDefaultApplicationTest() { console.info("isDefaultApplication_0100 data--- " + data) console.info("isDefaultApplication_0100 err--- " + err) expect(data).assertFalse() - expect(err).assertEqual(0) + expect(err).assertEqual(null) done() }) }); 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 97fbdceee5e619b66a7d42f04e798ec59f36c80c..809d6f10171db39479f3d6c6dcccfde3400038f8 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 @@ -26,6 +26,9 @@ import getBundleArchiveInfo from "./getBundleArchiveInfo.test.ets"; 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'; +import GetResourceTest from './GetResourceTest.test.ets'; export default function testsuite() { getBundleArchiveInfo(); @@ -46,4 +49,7 @@ export default function testsuite() { isAbilityEnableETSUnit(); isApplicationEnabledETSUnit(); getWindowPorperties(); + GetSecondModuleTest(); + GetInfoSync(); + GetResourceTest(); } \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/Utils.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/Utils.ets index 4437fa06f93f079ebd680fce496fba345fbc7eb8..a90b727982116431eee1cc74ad4a2138c0faf784 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/Utils.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/Utils.ets @@ -1,4 +1,3 @@ -// @ts-nocheck /** * Copyright (c) 2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,8 +22,8 @@ export default class Utils { static sleep(time) { return new Promise((resolve, reject) => { - setTimeout(() => { - resolve() + setTimeout((data) => { + resolve(data) }, time) }).then(() => { console.info(`sleep ${time} over...`) @@ -46,72 +45,6 @@ export default class Utils { } } - static async swipe(downX, downY, upX, upY, steps) { - console.info('start to swipe') - this.drags(downX, downY, upX, upY, steps, false) - } - - static async drag(downX, downY, upX, upY, steps) { - console.info('start to drag') - this.drags(downX, downY, upX, upY, steps, true) - } - - static async drags(downX, downY, upX, upY, steps, drag) { - let xStep; - let yStep; - let swipeSteps; - let ret; - xStep = 0; - yStep = 0; - ret = false; - swipeSteps = steps; - if (swipeSteps == 0) { - swipeSteps = 1; - } - xStep = (upX - downX) / swipeSteps; - yStep = (upY - downY) / swipeSteps; - console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep) - let downPonit: TouchObject = { - id: 1, - x: downX, - y: downY, - type: TouchType.Down, - } - console.info('down touch started: ' + JSON.stringify(downPonit)) - sendTouchEvent(downPonit); - console.info('start to move') - if (drag) { - await this.sleep(500) - } - for (let i = 1;i <= swipeSteps; i++) { - let movePoint: TouchObject = { - id: 1, - x: downX + (xStep * i), - y: downY + (yStep * i), - type: TouchType.Move - } - console.info('move touch started: ' + JSON.stringify(movePoint)) - ret = sendTouchEvent(movePoint) - if (ret == false) { - break; - } - await this.sleep(5) - } - console.info('start to up') - if (drag) { - await this.sleep(100) - } - let upPoint: TouchObject = { - id: 1, - x: upX, - y: upY, - type: TouchType.Up, - } - console.info('up touch started: ' + JSON.stringify(upPoint)) - sendTouchEvent(upPoint) - await this.sleep(500) - } - static getNowTime() { return new Date().getTime(); } diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getWindowProperties.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getWindowProperties.test.ets index 94e3ea2527a7b911a966625aecc9af9dab78abf9..cb4ae564fd75dd58707351404d6386531224507a 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getWindowProperties.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getWindowProperties.test.ets @@ -51,9 +51,9 @@ const MAX_WINDOW_WIDTH_VALUE = 2560 const MIN_WINDOW_WIDTH_VALUE = 1400 const MAX_WINDOW_HEIGHT_VALUE = 300 const MIN_WINDOW_HEIGHT_VALUE = 200 -const FULL_SCREEN_WINDOW_MODE = 0 -const SPLIT_WINDOW_MODE = 1 -const FLOATING_WINDOW_MODE = 2 +const FULL_SCREEN_WINDOW_MODE = bundle.SupportWindowMode.FULL_SCREEN +const SPLIT_WINDOW_MODE = bundle.SupportWindowMode.SPLIT +const FLOATING_WINDOW_MODE = bundle.SupportWindowMode.FLOATING export default function getWindowPorperties() { diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanagertest/BUILD.gn b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanagertest/BUILD.gn index 20e449aa302ed98efac21de646bb5252ef2e361d..4dd065a87ecd424a6831eb04681d2365f415b994 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanagertest/BUILD.gn +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanagertest/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanagertest/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanagertest/src/main/config.json index f4d3dc35e4b6a2d357d6f37187cd38c001c1ca09..122c9aab1ea87c155ec4bec97f379df82c9f5ef6 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanagertest/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanagertest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsbundlemanagertest", "name": ".entry", "deviceType": [ + "default", "default" ], "distro": { 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/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/config.json index 651700bfa0bfef26e718b52f90bb4a5e9f5e6149..233ac2b8978bc8affdb1e8bc5bb84c90d66b15ec 100755 --- a/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlenativetest/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": "com.actsbundle.napitest.MainAbility", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokenfive/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokenfive/src/main/config.json index 84b49e048fdffb6a0d5a42ccba5cd4498c6d969c..6b77aaf0564ecbfaa2cbb98243abac487918e311 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokenfive/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokenfive/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.bmsaccesstoken3", "name": ".MyApplication1", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokenfour/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokenfour/src/main/config.json index 8ccd38dcbaee0ad59671379df31f5d962579faf3..4095ad7baa22a749d71bc96f2e9b6e4f926a9fc0 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokenfour/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokenfour/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.bmsaccesstoken2", "name": ".MyApplication1", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokenone/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokenone/src/main/config.json index 729e0a50c8d14bcdf72b5354cfaa179dd20301aa..26f8d1358e323d4a7de58f4c2e3b06e7f0d0b959 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokenone/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokenone/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.bmsaccesstoken1", "name": ".MyApplication1", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokenthree/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokenthree/src/main/config.json index 242095c4243b7d2e8daa66ee6f90aaf7e650fbb9..277c5734047856dae5ccd01444362f1c6b4aa83e 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokenthree/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokenthree/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.bmsaccesstoken2", "name": ".MyApplication2", "deviceType": [ + "default", "default" ], "distro": { @@ -104,8 +105,8 @@ "reason": "use ohos.permission.USE_BLUETOOTH" }, { - "name": "ohos.permission.SYSTEM_FLOAT_WINDOW", - "reason": "use ohos.permission.SYSTEM_FLOAT_WINDOW" + "name": "ohos.permission.VIBRATE", + "reason": "use ohos.permission.VIBRATE" } ] } diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokentwo/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokentwo/src/main/config.json index dcbaf5e8936a06c6c34e6a1741dfd81fcd824214..12f3d13dcfa247293c444616261948afee383159 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokentwo/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsaccesstokentwo/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.bmsaccesstoken2", "name": ".MyApplication1", "deviceType": [ + "default", "default" ], "distro": { @@ -104,8 +105,8 @@ "reason": "use ohos.permission.USE_BLUETOOTH" }, { - "name": "ohos.permission.SYSTEM_FLOAT_WINDOW", - "reason": "use ohos.permission.SYSTEM_FLOAT_WINDOW" + "name": "ohos.permission.VIBRATE", + "reason": "use ohos.permission.VIBRATE" } ] } diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsfirstright/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsfirstright/src/main/config.json index 2a5ef6768483f1724cdca9cf5b4e56f7a4f0ba6d..daf090c689f43b09ab88a3584b11d48deadf5990 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsfirstright/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsfirstright/src/main/config.json @@ -52,6 +52,7 @@ } ], "deviceType": [ + "default", "tablet" ], "mainAbility": "com.example.l3jsdemo.MainAbility", diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfifthscene/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfifthscene/src/main/config.json index e4f87f79bc311bf09622d66e395d6e454a68c078..a2f2e2b194fc84da20721acac689a249eedcc745 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfifthscene/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfifthscene/src/main/config.json @@ -18,6 +18,7 @@ "name": ".BmsThirdBundle5", "mainAbility": "com.example.third5.AMainAbility", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfirstscene/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfirstscene/src/main/config.json index fdfd7716ec08e93e0bb44ed07e2966c645de8888..d1bd1041f75b6a4dff0f4c320be6385232684782 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfirstscene/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfirstscene/src/main/config.json @@ -20,6 +20,7 @@ "name": "com.example.third1.BmsThirdBundle1", "colorMode": "light", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfirstsceneupdate/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfirstsceneupdate/src/main/config.json index c7cbe14c379546484f2cb581e0351b11cd6ce89e..4dc912d53cf676ed8f692fe089d148e0d9db6450 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfirstsceneupdate/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfirstsceneupdate/src/main/config.json @@ -21,6 +21,7 @@ "mainAbility": "com.example.third1.MainAbility", "colorMode": "dark", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfourthscene/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfourthscene/src/main/config.json index 2a6ffb69bd398315888126cc5facfcf2dfd288e6..1bb0d66f76f957c620327ab4328bcf430688ca8f 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfourthscene/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosfourthscene/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.third4", "name": ".BmsThirdBundle4", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/config.json index 75b185bad712573bbabc12f071f3fe76293195d6..cd74a55c8ae80be0fed0f67b0c70b169d9431f9c 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfoshapc/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.c", "name": ".MyApplication", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosjsscene/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosjsscene/src/main/config.json index d0c6c0ee1a4565f236657cad66d11c1eeedd46c7..717504116a54d79d98333a0ca02640f283429d9f 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosjsscene/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosjsscene/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.js", "name": ".MyApplication", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenesystem/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenesystem/src/main/config.json index 24a092d1b1f66123c0c94a6803a8dbaac569494b..c2baea87547313dd643dabf37ae02b8e1098db03 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenesystem/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenesystem/src/main/config.json @@ -20,6 +20,7 @@ "name": ".BmsSystemBundle1", "mainAbility": "com.example.system1.MainAbility", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenesystemtwo/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenesystemtwo/src/main/config.json index f3a246d7115d97666a8a2089877a3914862583b8..22e1a2f9487b7d007caf12c7ce165c029c39b7e5 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenesystemtwo/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenesystemtwo/src/main/config.json @@ -20,6 +20,7 @@ "name": ".BmsSystemBundle1", "mainAbility": "com.example.system2.MainAbility", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenevendor/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenevendor/src/main/config.json index cdf7c57466ae4f887c695ec23e62406063a1f1fd..0155abb852c0ebab4f13c600793b60f73aab0dfa 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenevendor/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosscenevendor/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.vendor1", "name": ".BmsVendorBundle1", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfossecondscene/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfossecondscene/src/main/config.json index e857339e2d88c23928973f8627fe51d080a04abf..c241fb7235d80eb6d13e884b47bdf14259fb0560 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfossecondscene/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfossecondscene/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.third2", "name": ".MyApplication", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosseventhscene/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosseventhscene/src/main/config.json index 7d098a08650ae53c600638848bb00208850b9c87..c2010ccee3eb500ed2210fe301a0afb5b6149360 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosseventhscene/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosseventhscene/src/main/config.json @@ -21,6 +21,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "default" ], "abilities": [ diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfossixthscene/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfossixthscene/src/main/config.json index 8be57cb245c339d43e09ed7c5c7d537c0ed3f5e6..867d3f43e0a715d1a87692e91d6ee38a96222b6c 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfossixthscene/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfossixthscene/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.third6", "name": ".MyApplication", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosthirdscene/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosthirdscene/src/main/config.json index 334b794ac4d35ec3a9d205a7470ab5be58bd54d8..a55d2dce1cd46345ed9eb8c324a02842d4f78972 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosthirdscene/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosthirdscene/src/main/config.json @@ -20,6 +20,7 @@ "name": ".BmsThirdBundle3", "colorMode": "auto", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsmainabilityfirstscene/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsmainabilityfirstscene/src/main/config.json index 2bf552d40b1ab41a46f2b6dea6140c98494610f1..17b0be505b4552fb866ce8bcbbf1a5d1d7a3c55f 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsmainabilityfirstscene/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsmainabilityfirstscene/src/main/config.json @@ -18,6 +18,7 @@ "mainAbility": "com.example.bmsmainabilityfirstscene.MainAbility", "name": ".MyApplication", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsmainabilitysecondscene/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsmainabilitysecondscene/src/main/config.json index 4437fc76061ab938f38fd9ba318e118535dd592e..df99fad9b97e524ffdf8def8c330c4523d70a9dc 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsmainabilitysecondscene/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsmainabilitysecondscene/src/main/config.json @@ -18,6 +18,7 @@ "mainAbility": "com.example.bmsmainabilitysecondscene.MainAbility", "name": ".MyApplication", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsmodulenameone/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsmodulenameone/src/main/config.json index d6ae45dd398617b774e752e290cb663780a9a3a0..64cffb905d4ec57f57ef5524e0a87bf948830c3d 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsmodulenameone/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsmodulenameone/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.bmsmodulenamedentry", "name": "MyApplication1", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsmodulenametwo/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsmodulenametwo/src/main/config.json index f0703665650a8c8a7f2c627159d810295cd0f0db..953fe5edfcdc6fe0eb31ca4cffae9ba9056358c8 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsmodulenametwo/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsmodulenametwo/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.bmsmodulenamedfeature", "name": "MyApplication2", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenefive/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenefive/src/main/config.json index 8f91dd95a79c5cd5b6bb733221a5eee8c0a70df4..7f97ae34314bbd463b49616b6c122c38bcec16ac 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenefive/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenefive/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.myapplication", "name": ".MyApplication", "deviceType": [ + "default", "default" ], "distro": { @@ -45,7 +46,7 @@ "isVisible": "true", "launchType": "standard", "language": "C++", - "uri":"dataability://" + "uri":"dataability://com.example.myapplication5" } ], "js": [ diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenefour/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenefour/src/main/config.json index a2d20e5ac847fe016aa4eb92def5909a0e11a8b6..721691f0ab848fded9fdf519f9f7819e427fd9d8 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenefour/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenefour/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.myapplication", "name": ".MyApplication", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmssceneone/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmssceneone/src/main/config.json index 2e8868b5d0a4e192c41da5f815c9a872000213e8..c24e4d148017503496c2828c8f41325612c315b8 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmssceneone/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmssceneone/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.myapplication1", "name": ".MyApplication1", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenesix/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenesix/src/main/config.json index d0c6298f04e66ed8f9c33e51a571e0bac32e8883..0f5620a6c2e48b8467efcd6d69f43b31dfc37a9d 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenesix/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenesix/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.myapplication", "name": ".MyApplication", "deviceType": [ + "default", "default" ], "distro": { @@ -44,7 +45,7 @@ "type": "page", "isVisible": "true", "launchType": "standard", - "orientation": "followrecent", + "orientation": "followRecent", "language": "C++" } ], diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenethree/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenethree/src/main/config.json index 7b5ac2625b5e8f224aea71a00bcf9a25dc3e1ad3..58a5104ed90dd923c0f7113353036abb057f7938 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenethree/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenethree/src/main/config.json @@ -44,6 +44,7 @@ } ], "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenetwo/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenetwo/src/main/config.json index f0ebb2d66613897d6de7f74f550d6614de9ba957..218e66064ff28751d39c60d832237ce51945801f 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenetwo/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsscenetwo/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.myapplication1", "name": ".MyApplication1", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmssecondright/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmssecondright/src/main/config.json index 1225443af5dd48963928e27bd387fc0f1499370d..7fcd524bd42f75710a35a7dc20d1609e4fe99a71 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmssecondright/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmssecondright/src/main/config.json @@ -47,6 +47,7 @@ } ], "deviceType": [ + "default", "tablet" ], "mainAbility": "com.example.l2jsdemo.MainAbility", diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/module.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/module.json index 08e5cffe7d5a986c261ff98ca5905769e070495c..deee99f91bb7a925bbd8a680ccd950a6534b11d8 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/module.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "default" ], "deliveryWithInstall": true, diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/module.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/module.json index 584fb1e4d81078163ee39a0c2edace7ea5073830..6148e705ceb242cabe8bbdc37f991d02ddbfcccf 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/module.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsstagedemotwo/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility1", "deviceTypes": [ + "default", "default" ], "deliveryWithInstall": true, diff --git a/bundlemanager/zlib/actszipfileandunzipfiletest/src/main/config.json b/bundlemanager/zlib/actszipfileandunzipfiletest/src/main/config.json index 764ad47ff255eabe7aaa4f7b9717551db80f2129..2485435fd1156a8dcfcf3b27ba1b911789e2885c 100644 --- a/bundlemanager/zlib/actszipfileandunzipfiletest/src/main/config.json +++ b/bundlemanager/zlib/actszipfileandunzipfiletest/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "default" ], "distro": { diff --git a/bundlemanager/zlib/actszlibtest/ActsZlibTest.cpp b/bundlemanager/zlib/actszlibtest/ActsZlibTest.cpp index 90dfb69aab7803fb6835fea9a62dbf2321690171..c52fea3865fa443dcd537d1170a5fd199f787772 100644 --- a/bundlemanager/zlib/actszlibtest/ActsZlibTest.cpp +++ b/bundlemanager/zlib/actszlibtest/ActsZlibTest.cpp @@ -1245,6 +1245,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestGzUnGetc, Function | MediumTest | Level2) file = gzopen(TESTFILE, "rb"); ASSERT_TRUE(file != NULL); ASSERT_FALSE(gzungetc(' ', file) != ' '); + gzclose(file); #endif } @@ -1264,6 +1265,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestGzVprintf, Function | MediumTest | Level2) int err = TestGzPrintf(file, ", %s!", "hello"); fprintf(stderr, "gzvprintf result: %d\n", err); + gzclose(file); #endif } 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/ets_utils/atomics_lib_standard/src/main/config.json b/commonlibrary/ets_utils/atomics_lib_standard/src/main/config.json index 90b72b8abdb7122f9dc172d1d7668c5bd891e647..19637d618690b6e14302cfae378515c0b62c922a 100644 --- a/commonlibrary/ets_utils/atomics_lib_standard/src/main/config.json +++ b/commonlibrary/ets_utils/atomics_lib_standard/src/main/config.json @@ -18,6 +18,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/commonlibrary/ets_utils/buffer_lib_standard/src/main/config.json b/commonlibrary/ets_utils/buffer_lib_standard/src/main/config.json index 0e10b9c963ee167ce8546428cb077b7013ab389e..a52dcace2bcce1210068f56d3f51e2393f33d9f7 100644 --- a/commonlibrary/ets_utils/buffer_lib_standard/src/main/config.json +++ b/commonlibrary/ets_utils/buffer_lib_standard/src/main/config.json @@ -18,6 +18,7 @@ "srcPath": "", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/commonlibrary/ets_utils/buffer_lib_standard/src/main/js/test/Buffer.test.js b/commonlibrary/ets_utils/buffer_lib_standard/src/main/js/test/Buffer.test.js index 6c12c0ad385767b83f95ed9f673a9036eecce0e3..0d487c94980dff13f60c04cecc54c86a3d87080f 100644 --- a/commonlibrary/ets_utils/buffer_lib_standard/src/main/js/test/Buffer.test.js +++ b/commonlibrary/ets_utils/buffer_lib_standard/src/main/js/test/Buffer.test.js @@ -108,6 +108,36 @@ describe('BufferTest', function () { } }); + /** + * @tc.name: testAlloc0017 + * @tc.desc: Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. + * For example: buffer.alloc(10, string, encode); + * @tc.author: lengchangjing + */ + it("testAlloc0017", 0, function () { + let encodeArr = ['utf8', 'utf-8', 'ucs2', 'ucs-2', 'ascii', 'latin1', 'binary', + 'utf16le', 'utf-16le', 'base64', 'base64url', 'hex']; + for (const encode of encodeArr) { + let buf = buffer.alloc(10, "ab$#", encode); + expect(buf.length).assertEqual(10); + } + }); + + /** + * @tc.name: testAlloc0018 + * @tc.desc: Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. + * For example: buffer.alloc(0).fill(string, encode); + * @tc.author: lengchangjing + */ + it("testAlloc0018", 0, function () { + let encodeArr = ['utf8', 'utf-8', 'ucs2', 'ucs-2', 'ascii', 'latin1', 'binary', + 'utf16le', 'utf-16le', 'base64', 'base64url', 'hex']; + for (const encode of encodeArr) { + let buf = buffer.alloc(0, "ab$#", encode); + expect(buf.length).assertEqual(0); + } + }); + /** * @tc.name: testAlloc0019 * @tc.desc: Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. @@ -1016,6 +1046,22 @@ describe('BufferTest', function () { expect(index).assertEqual(-1); }); + /** + * @tc.name: testIndexOf0177 + * @tc.desc: Returns true if value was found in buf, false otherwise. + * For example: let buf = buffer.from("13236"); buf.indexOf("a", 0, "utf8"); + * @tc.author: lengchangjing + */ + it("testIndexOf0177", 0, function () { + let encodeArr = ['utf8', 'utf-8', 'ucs2', 'ucs-2', 'ascii', 'latin1', 'binary', + 'utf16le', 'utf-16le', 'base64', 'base64url', 'hex']; + let buf = buffer.from("13236"); + for (const encode of encodeArr) { + let index = buf.indexOf("ab", 0, encode); + expect(index).assertEqual(-1); + } + }); + /** * @tc.name: testLastIndexOf0180 * @tc.desc: The index of the last occurrence of value in buf. @@ -1076,6 +1122,22 @@ describe('BufferTest', function () { expect(index).assertEqual(-1); }); + /** + * @tc.name: testLastIndexOf0187 + * @tc.desc: Returns true if value was found in buf, false otherwise. + * For example: let buf = buffer.from("13236"); buf.lastIndexOf("a", 0, "utf8"); + * @tc.author: lengchangjing + */ + it("testLastIndexOf0187", 0, function () { + let encodeArr = ['utf8', 'utf-8', 'ucs2', 'ucs-2', 'ascii', 'latin1', 'binary', + 'utf16le', 'utf-16le', 'base64', 'base64url', 'hex']; + let buf = buffer.from("13236"); + for (const encode of encodeArr) { + let index = buf.lastIndexOf("ab", 0, encode); + expect(index).assertEqual(-1); + } + }); + /** * @tc.name: testIncludes0190 * @tc.desc: Returns true if value was found in buf, false otherwise. @@ -1150,6 +1212,22 @@ describe('BufferTest', function () { expect(flag).assertEqual(false); }); + /** + * @tc.name: testIncludes0197 + * @tc.desc: Returns true if value was found in buf, false otherwise. + * For example: let buf1 = buffer.from("13236"); buf1.includes("abc", 0, "utf8"); + * @tc.author: lengchangjing + */ + it("testIncludes0197", 0, function () { + let encodeArr = ['utf8', 'utf-8', 'ucs2', 'ucs-2', 'ascii', 'latin1', 'binary', + 'utf16le', 'utf-16le', 'base64', 'base64url', 'hex']; + for (const encode of encodeArr) { + let buf = buffer.from("13236"); + let flag = buf.includes("abc", 0, encode); + expect(flag).assertEqual(false); + } + }); + /** * @tc.name: testSwap160200 * @tc.desc: Interprets buf as an array of unsigned 16-bit integers and swaps the byte order in-place. @@ -1421,20 +1499,36 @@ describe('BufferTest', function () { str = buf3.toString("base64"); expect(str).assertEqual("F1FG"); - let buf4 = buffer.from("F1FG刘", "binary") - str = buf4.toString("binary"); + let buf4 = buffer.from("F1FG刘", "base64url") + str = buf4.toString("base64url"); + expect(str).assertEqual("F1FG"); + + let buf5 = buffer.from("F1FG刘", "binary") + str = buf5.toString("binary"); expect(str).assertEqual("F1FGå"); - let buf5 = buffer.from("F1FG刘", "latin1") - str = buf5.toString("latin1"); + let buf6 = buffer.from("F1FG刘", "latin1") + str = buf6.toString("latin1"); expect(str).assertEqual("F1FGe"); - let buf6 = buffer.from("F1FG刘", "ucs2") - str = buf6.toString("ucs2"); + let buf7 = buffer.from("F1FG刘", "ucs2") + str = buf7.toString("ucs2"); expect(str).assertEqual("F1FG刘"); - let buf7 = buffer.from("F1FG刘", "utf-8") - str = buf7.toString("utf-8"); + let buf8 = buffer.from("F1FG刘", "utf16le") + str = buf8.toString("utf16le"); + expect(str).assertEqual("F1FG刘"); + + let buf9 = buffer.from("F1FG刘", "ucs2") + str = buf9.toString("ucs2"); + expect(str).assertEqual("F1FG刘"); + + let buf10 = buffer.from("F1FG刘", "utf-8") + str = buf10.toString("utf-8"); + expect(str).assertEqual("F1FG刘"); + + let buf11 = buffer.from("F1FG刘", "utf8") + str = buf11.toString("utf8"); expect(str).assertEqual("F1FG刘"); }); @@ -3223,11 +3317,55 @@ describe('BufferTest', function () { * @tc.desc: Returns the number of bytes in buf. * @tc.author: liuganlin */ - it("testBufferLength0751", 0, function () { + it("testBufferLength0752", 0, function () { let buf = buffer.from("测试特殊字符$#@!"); let len = buf.length; expect(len).assertEqual(22); }); + + /** + * @tc.name: testBufferByteOffset0755 + * @tc.desc: Returns the offset of bytes in buf. + * @tc.author: lengchangjing + */ + it("testBufferByteOffset0755", 0, function () { + let buf = buffer.from("1236"); + let offset = buf.byteOffset; + expect(offset >= 0).assertTrue(); + }); + + /** + * @tc.name: testBufferByteOffset0756 + * @tc.desc: Returns the offset of bytes in buf. + * @tc.author: lengchangjing + */ + it("testBufferByteOffset0756", 0, function () { + let buf = buffer.alloc(10); + let offset = buf.byteOffset; + expect(offset >= 0).assertTrue(); + }); + + /** + * @tc.name: testBufferByteOffset0757 + * @tc.desc: Returns the offset of bytes in buf. + * @tc.author: lengchangjing + */ + it("testBufferByteOffset0757", 0, function () { + let buf = buffer.allocUninitializedFromPool(10); + let offset = buf.byteOffset; + expect(offset >= 0).assertTrue(); + }); + + /** + * @tc.name: testBufferByteOffset0758 + * @tc.desc: Returns the offset of bytes in buf. + * @tc.author: lengchangjing + */ + it("testBufferByteOffset0758", 0, function () { + let buf = buffer.allocUninitialized(10); + let offset = buf.byteOffset; + expect(offset >= 0).assertTrue(); + }); /** * @tc.name: testBlobSize0760 diff --git a/commonlibrary/ets_utils/containerLine_lib_standard/BUILD.gn b/commonlibrary/ets_utils/containerLine_lib_standard/BUILD.gn index 3d2dbc9d2277dfc8976e8454213c47cff0f5f722..f9e376229545f45dc04f0061d7f4cd74b897e615 100644 --- a/commonlibrary/ets_utils/containerLine_lib_standard/BUILD.gn +++ b/commonlibrary/ets_utils/containerLine_lib_standard/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("containerLine_js_test") { diff --git a/commonlibrary/ets_utils/containerLine_lib_standard/src/main/config.json b/commonlibrary/ets_utils/containerLine_lib_standard/src/main/config.json index b5469e1a38df849eb70948276a9cef56b80657f9..4949b4bb58c20ab5dd49b0711c33f4f60ae882eb 100644 --- a/commonlibrary/ets_utils/containerLine_lib_standard/src/main/config.json +++ b/commonlibrary/ets_utils/containerLine_lib_standard/src/main/config.json @@ -18,6 +18,7 @@ "srcPath": "", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/commonlibrary/ets_utils/containerRelation_lib_standard/BUILD.gn b/commonlibrary/ets_utils/containerRelation_lib_standard/BUILD.gn index d9d237b654d6818346b3d422315312bc30d1dd0b..6974bec793b6206b61abc64c5c30787bb371b55d 100644 --- a/commonlibrary/ets_utils/containerRelation_lib_standard/BUILD.gn +++ b/commonlibrary/ets_utils/containerRelation_lib_standard/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("containerRelation_js_test") { diff --git a/commonlibrary/ets_utils/containerRelation_lib_standard/src/main/config.json b/commonlibrary/ets_utils/containerRelation_lib_standard/src/main/config.json index a19823b9a5f5d012c8369e800f86d423ec3a3851..ece346434a35add4627a998094aa129becf8dabb 100644 --- a/commonlibrary/ets_utils/containerRelation_lib_standard/src/main/config.json +++ b/commonlibrary/ets_utils/containerRelation_lib_standard/src/main/config.json @@ -18,6 +18,7 @@ "srcPath": "", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/commonlibrary/ets_utils/convertxml_lib_standard/src/main/config.json b/commonlibrary/ets_utils/convertxml_lib_standard/src/main/config.json index e8b53b4a5941adbc873e1441f7e5dc8deacab187..c2bdab10ebbcc5edfe4ef8ccf3321fb70166583e 100644 --- a/commonlibrary/ets_utils/convertxml_lib_standard/src/main/config.json +++ b/commonlibrary/ets_utils/convertxml_lib_standard/src/main/config.json @@ -18,6 +18,7 @@ "srcPath": "", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/commonlibrary/ets_utils/process_lib_standard/src/main/config.json b/commonlibrary/ets_utils/process_lib_standard/src/main/config.json index 3f6e8ba22f84526cbf299fc3876b8508855efd95..83101364952f3f1b89e74f914dd9214e0a81e538 100644 --- a/commonlibrary/ets_utils/process_lib_standard/src/main/config.json +++ b/commonlibrary/ets_utils/process_lib_standard/src/main/config.json @@ -18,6 +18,7 @@ "srcPath": "", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/commonlibrary/ets_utils/uri_lib_standard/src/main/config.json b/commonlibrary/ets_utils/uri_lib_standard/src/main/config.json index dac12fb411729a40d910eb18b157882f9a8ef9de..29cb3188c8e54c0628a2df8000f8ddfa2bd28d53 100644 --- a/commonlibrary/ets_utils/uri_lib_standard/src/main/config.json +++ b/commonlibrary/ets_utils/uri_lib_standard/src/main/config.json @@ -17,6 +17,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/commonlibrary/ets_utils/url_lib_standard/src/main/config.json b/commonlibrary/ets_utils/url_lib_standard/src/main/config.json index 0254ab91ceef1b5c6fa1917e7d5dc06444204d8a..f3477626ed6f1bf908979565e85a836c7e098924 100644 --- a/commonlibrary/ets_utils/url_lib_standard/src/main/config.json +++ b/commonlibrary/ets_utils/url_lib_standard/src/main/config.json @@ -18,6 +18,7 @@ "srcPath": "", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/commonlibrary/ets_utils/util_lib_standard/src/main/config.json b/commonlibrary/ets_utils/util_lib_standard/src/main/config.json index 6b006d2f5430a0d8e1a6cd609c176401e0f370ec..5e9c5a588a282da98100be6331fa6bf4cbb0a6f0 100644 --- a/commonlibrary/ets_utils/util_lib_standard/src/main/config.json +++ b/commonlibrary/ets_utils/util_lib_standard/src/main/config.json @@ -18,6 +18,7 @@ "srcPath": "", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/commonlibrary/ets_utils/util_lib_standard/src/main/js/test/util.test.js b/commonlibrary/ets_utils/util_lib_standard/src/main/js/test/util.test.js index fb3a34ec04bb8b0e5ef4d8ef566024b5af375381..df4bf8067ecc3fb5fb9ccc31bdf474e0bbd6904b 100644 --- a/commonlibrary/ets_utils/util_lib_standard/src/main/js/test/util.test.js +++ b/commonlibrary/ets_utils/util_lib_standard/src/main/js/test/util.test.js @@ -5310,6 +5310,50 @@ describe('TypesTest', function() { * @tc.author: wangjingwu */ it('testIsBigInt64Array001', 0, function() { + var proc = new util.types(); + var result = proc.isBigInt64Array(new BigInt64Array([])); + expect(result).assertEqual(true); + }) + + /** + * @tc.name: testIsBigInt64Array002 + * @tc.desc: Check whether the entered value is of bigint64array array type. + * @tc.author: wangjingwu + */ + it('testIsBigInt64Array002', 0, function() { + var proc = new util.types(); + var result = proc.isBigInt64Array(new Int32Array([])); + expect(result).assertEqual(false); + }) + + /** + * @tc.name: testIsBigInt64Array003 + * @tc.desc: Check whether the entered value is of bigint64array array type. + * @tc.author: wangjingwu + */ + it('testIsBigInt64Array003', 0, function() { + var proc = new util.types(); + var result = proc.isBigInt64Array(new Uint8Array([])); + expect(result).assertEqual(false); + }) + + /** + * @tc.name: testIsBigInt64Array004 + * @tc.desc: Check whether the entered value is of bigint64array array type. + * @tc.author: wangjingwu + */ + it('testIsBigInt64Array004', 0, function() { + var proc = new util.types(); + var result = proc.isBigInt64Array(new Float64Array([])); + expect(result).assertEqual(false); + }) + + /** + * @tc.name: testIsBigInt64Array005 + * @tc.desc: Check whether the entered value is of bigint64array array type. + * @tc.author: wangjingwu + */ + it('testIsBigInt64Array005', 0, function() { var proc = new util.types(); var result = proc.isBigInt64Array(new Int8Array([])); expect(result).assertEqual(false); @@ -5321,11 +5365,67 @@ describe('TypesTest', function() { * @tc.author: wangjingwu */ it('testIsBigUint64Array001', 0, function() { + var proc = new util.types(); + var result = proc.isBigUint64Array(new BigUint64Array([])); + expect(result).assertEqual(true); + }) + + /** + * @tc.name: testIsBigUint64Array002 + * @tc.desc: Check whether the entered value is of biguint64array array array type. + * @tc.author: wangjingwu + */ + it('testIsBigUint64Array002', 0, function() { var proc = new util.types(); var result = proc.isBigUint64Array(new Int8Array([])); expect(result).assertEqual(false); }) + /** + * @tc.name: testIsBigUint64Array002 + * @tc.desc: Check whether the entered value is of biguint64array array array type. + * @tc.author: wangjingwu + */ + it('testIsBigUint64Array002', 0, function() { + var proc = new util.types(); + var result = proc.isBigUint64Array(new Float64Array([])); + expect(result).assertEqual(false); + }) + + /** + * @tc.name: testIsBigUint64Array003 + * @tc.desc: Check whether the entered value is of biguint64array array array type. + * @tc.author: wangjingwu + */ + it('testIsBigUint64Array003', 0, function() { + var proc = new util.types(); + var result = proc.isBigUint64Array(new Uint8Array([])); + expect(result).assertEqual(false); + }) + + /** + * @tc.name: testIsBigUint64Array004 + * @tc.desc: Check whether the entered value is of biguint64array array array type. + * @tc.author: wangjingwu + */ + it('testIsBigUint64Array004', 0, function() { + var proc = new util.types(); + var result = proc.isBigUint64Array(new BigInt64Array([])); + expect(result).assertEqual(false); + }) + + /** + * @tc.name: testIsBigUint64Array005 + * @tc.desc: Check whether the entered value is of biguint64array array array type. + * @tc.author: wangjingwu + */ + it('testIsBigUint64Array005', 0, function() { + var proc = new util.types(); + var result = proc.isBigUint64Array(new Int8Array([])); + expect(result).assertEqual(false); + }) + + /** * @tc.name: testIsBooleanObject001 * @tc.desc: Check whether the entered value is a Boolean object type. @@ -5554,9 +5654,8 @@ describe('TypesTest', function() { */ it('testIsExternal001', 0, function() { var proc = new util.types(); - const data = util.createExternalType(); - var result = proc.isExternal(data); - expect(result).assertEqual(true); + var result = proc.isExternal(new Float32Array()); + expect(result).assertEqual(false); }) /** @@ -6081,16 +6180,6 @@ describe('TypesTest', function() { expect(result).assertEqual(false); }) - /** - * @tc.name: testIsModuleNamespaceObject001 - * @tc.desc: Check whether the entered value is the module namespace object object type. - * @tc.author: bihu - */ - it('testIsModuleNamespaceObject001', 0, function() { - var proc = new util.types(); - var result = proc.isModuleNamespaceObject(util); - expect(result).assertEqual(false); - }) /** * @tc.name: testIsModuleNamespaceObject002 @@ -6557,8 +6646,8 @@ describe('TypesTest', function() { */ it('testIsSharedArrayBuffer001', 0, function() { var proc = new util.types(); - var result = proc.isSharedArrayBuffer(new Int8Array([])); - expect(result).assertEqual(false); + var result = proc.isSharedArrayBuffer(new SharedArrayBuffer([])); + expect(result).assertEqual(true); }) /** @@ -7104,5 +7193,81 @@ describe('TypesTest', function() { var result = proc.isWeakSet(new Map()); expect(result).assertEqual(false); }) + + /** + * @tc.name: testUtilRandomUUID001 + * @tc.desc: Generate a random RFC 4122 version 4 UUID. + * @tc.author: linhaoran + */ + it('testUtilRandomUUID001', 0, async function () { + var result = util.randomUUID(true); + expect(result.length).assertEqual(36); + }) + + /** + * @tc.name: testUtilRandomUUID002 + * @tc.desc: Generate a random RFC 4122 version 4 UUID. + * @tc.author: linhaoran + */ + it('testUtilRandomUUID002', 0, async function () { + var result = util.randomUUID(false); + expect(result.length).assertEqual(36); + }) + + /** + * @tc.name: testUtilRandomBinaryUUID001 + * @tc.desc: Generate a random RFC 4122 version 4 UUID. + * @tc.author: linhaoran + */ + it('testUtilRandomBinaryUUID001', 0, async function () { + var result = util.randomBinaryUUID(true); + expect(result.length).assertEqual(16); + }) + + /** + * @tc.name: testUtilRandomBinaryUUID002 + * @tc.desc: Generate a random RFC 4122 version 4 UUID. + * @tc.author: linhaoran + */ + it('testUtilRandomBinaryUUID002', 0, async function () { + var result = util.randomBinaryUUID(false); + expect(result.length).assertEqual(16); + }) + + /** + * @tc.name: testUtilParseUUID001 + * @tc.desc: Generate a random RFC 4122 version 4 UUID. + * @tc.author: linhaoran + */ + it('testUtilParseUUID001', 0, async function () { + var result = util.parseUUID('84bdf796-66cc-4655-9b89-d6218d100f9c'); + expect(result.length).assertEqual(16); + }) + + /** + * @tc.name: testUtilParseUUID002 + * @tc.desc: Generate a random RFC 4122 version 4 UUID. + * @tc.author: linhaoran + */ + it('testUtilParseUUID002', 0, async function () { + try { + var result = util.parseUUID('84df796-66cc-4655-9b89-d6218d100f9c'); + } catch(e) { + expect(e.message).assertEqual('this uuid parsing failed'); + } + }) + + /** + * @tc.name: testUtilParseUUID003 + * @tc.desc: Generate a random RFC 4122 version 4 UUID. + * @tc.author: linhaoran + */ + it('testUtilParseUUID003', 0, async function () { + try { + var result = util.parseUUID('84Wdf796-66cc-4655-9b89-d6218d100f9c'); + } catch(e) { + expect(e.message).assertEqual('this uuid parsing failed'); + } + }) }) } diff --git a/commonlibrary/ets_utils/worker_lib_standard/src/main/config.json b/commonlibrary/ets_utils/worker_lib_standard/src/main/config.json index 04e8086d703ac6705a387daebd69d395ea02f081..63ce0c10c21c0fc54a178a844178d27105d791e4 100644 --- a/commonlibrary/ets_utils/worker_lib_standard/src/main/config.json +++ b/commonlibrary/ets_utils/worker_lib_standard/src/main/config.json @@ -18,6 +18,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/commonlibrary/ets_utils/xml_lib_standard/src/main/config.json b/commonlibrary/ets_utils/xml_lib_standard/src/main/config.json index 1c1ce305be3b4ec8b9dc578d1d56ea46fd710d7c..e3ddbef9cd0d5cd9668e9616fb856b33d46412d5 100644 --- a/commonlibrary/ets_utils/xml_lib_standard/src/main/config.json +++ b/commonlibrary/ets_utils/xml_lib_standard/src/main/config.json @@ -18,6 +18,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/commonlibrary/toolchain/BUILD.gn b/commonlibrary/toolchain/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..7d36b548855265beeef66a1ec851372cc6620af3 --- /dev/null +++ b/commonlibrary/toolchain/BUILD.gn @@ -0,0 +1,125 @@ +# 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") { + if (!(product_name == "m40")) { + testonly = true + deps = [ "//third_party/musl:libctest" ] + if (is_standard_system) { + deps += [ ":tar_dllib" ] + } + } +} + +action("tar_testcases") { + testonly = true + deps = [ + "libc-test:ActsToolChainTest", + "//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/musl/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..daaf75e0721488baf479c931bb6a540db1db08ef --- /dev/null +++ b/commonlibrary/toolchain/libc-test/BUILD.gn @@ -0,0 +1,52 @@ +# 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 = [ + "//commonlibrary/c_utils/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("ActsToolChainTest") { + configs = [ ":module_private_config" ] + cflags_cc = [ "-DHILOG_ENABLE" ] + defines = [ "_STANDARD_SYSTEM_" ] + + sources = [ + "include/getfiles.cpp", + "include/setrlim.cpp", + "src/toolchaintest.cpp", + ] + + include_dirs = [ + "//commonlibrary/c_utils/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", + ] + + external_deps = [ "c_utils:utils" ] + deps = [ "//third_party/bounds_checking_function:libsec_static" ] +} diff --git a/commonlibrary/toolchain/libc-test/Test.json b/commonlibrary/toolchain/libc-test/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..5230d4fae5199befc89b24755597669318b0c96f --- /dev/null +++ b/commonlibrary/toolchain/libc-test/Test.json @@ -0,0 +1,180 @@ +{ + "description": "Configuration for ActsToolChainTest Tests", + "driver": { + "type": "CppTest", + "native-test-timeout": "3600000", + "module-name": "ActsToolChainTest", + "runtime-hint": "100s", + "native-test-device-path": "/data/local/tmp" + }, + "kits": [ + { + "push": [ + "ActsToolChainTest->/data/local/tmp/ActsToolChainTest", + "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/vsyslog", + "rm -rf /data/local/tmp/libc-test/mkstemps", + "rm -rf /data/local/tmp/libc-test/mkostemps", + "rm -rf /data/local/tmp/libc-test/syncfs", + "rm -rf /data/local/tmp/libc-test/sync_file_range", + "rm -rf /data/local/tmp/libc-test/tee", + "rm -rf /data/local/tmp/libc-test/sendfile", + "rm -rf /data/local/tmp/libc-test/removexattr", + "rm -rf /data/local/tmp/libc-test/copy_file_range", + "rm -rf /data/local/tmp/libc-test/setxattr", + "rm -rf /data/local/tmp/libc-test/splice", + "rm -rf /data/local/tmp/libc-test/mremap", + "rm -rf /data/local/tmp/libc-test/mincore", + "rm -rf /data/local/tmp/libc-test/msync", + "rm -rf /data/local/tmp/libc-test/rewinddir", + "rm -rf /data/local/tmp/libc-test/scandir", + "rm -rf /data/local/tmp/libc-test/readdir_r", + "rm -rf /data/local/tmp/libc-test/tcgetattr", + "rm -rf /data/local/tmp/libc-test/tcsendbreak", + "rm -rf /data/local/tmp/libc-test/tcgetsid", + "rm -rf /data/local/tmp/libc-test/tcsetattr", + "rm -rf /data/local/tmp/libc-test/a_stack_chk_fail", + "rm -rf /data/local/tmp/libc-test/tcsetpgrp", + "rm -rf /data/local/tmp/libc-test/ttyname", + "rm -rf /data/local/tmp/libc-test/tcgetpgrp", + "rm -rf /data/local/tmp/libc-test/isatty", + "rm -rf /data/local/tmp/libc-test/posix_fallocate", + "rm -rf /data/local/tmp/libc-test/posix_fadvise", + "rm -rf /data/local/tmp/libc-test/getgrnam_r", + "rm -rf /data/local/tmp/libc-test/ftok", + "rm -rf /data/local/tmp/libc-test/freopen", + "rm -rf /data/local/tmp/libc-test/__fwritable", + "rm -rf /data/local/tmp/libc-test/setbuffer", + "rm -rf /data/local/tmp/libc-test/vfscanf", + "rm -rf /data/local/tmp/libc-test/tmpfile", + "rm -rf /data/local/tmp/libc-test/__fwriting", + "rm -rf /data/local/tmp/libc-test/setbuf", + "rm -rf /data/local/tmp/libc-test/getwc", + "rm -rf /data/local/tmp/libc-test/ungetwc", + "rm -rf /data/local/tmp/libc-test/setlinebuf", + "rm -rf /data/local/tmp/libc-test/fputc", + "rm -rf /data/local/tmp/libc-test/fputs", + "rm -rf /data/local/tmp/libc-test/truncate", + "rm -rf /data/local/tmp/libc-test/fchownat", + "rm -rf /data/local/tmp/libc-test/fsync", + "rm -rf /data/local/tmp/libc-test/linkat", + "rm -rf /data/local/tmp/libc-test/lchown", + "rm -rf /data/local/tmp/libc-test/faccessat", + "rm -rf /data/local/tmp/libc-test/unlinkat", + "rm -rf /data/local/tmp/libc-test/acct", + "rm -rf /data/local/tmp/libc-test/exit", + "rm -rf /data/local/tmp/libc-test/readlinkat", + "rm -rf /data/local/tmp/libc-test/write", + "rm -rf /data/local/tmp/libc-test/getpid", + "rm -rf /data/local/tmp/libc-test/exittest02", + "rm -rf /data/local/tmp/libc-test/unlink", + "rm -rf /data/local/tmp/libc-test/readv", + "rm -rf /data/local/tmp/libc-test/pread", + "rm -rf /data/local/tmp/libc-test/syslog", + "rm -rf /data/local/tmp/libc-test/vsyslog", + "rm -rf /data/local/tmp/libc-test/res_query", + "rm -rf /data/local/tmp/libc-test/dlns_dlopen_test ", + "rm -rf /data/local/tmp/libc-test/dlns_set_fun_test", + "rm -rf /data/local/tmp/libc-test/dlns_inherit_test", + "rm -rf /data/local/tmp/libc-test/dlns_dlsym_test", + "rm -rf /data/local/tmp/libc-test/dlns_special_scene_test", + "rm -rf /data/local/tmp/libc-test/dlns_separated_test", + "rm -rf /data/local/tmp/libc-test/dlopen_ext_relro_test", + "rm -rf /data/local/tmp/libc-test/strptime_ext", + "rm -rf /data/local/tmp/libc-test/ctime", + "rm -rf /data/local/tmp/libc-test/asctime", + "rm -rf /data/local/tmp/libc-test/strftime_l", + "rm -rf /data/local/tmp/libc-test/strftime_ext", + "rm -rf /data/local/tmp/libc-test/localtime_r", + "rm -rf /data/local/tmp/libc-test/localtime", + "rm -rf /data/local/tmp/libc-test/ctime_r", + "rm -rf /data/local/tmp/libc-test/timegm", + "rm -rf /data/local/tmp/libc-test/asctime_r", + "rm -rf /data/local/tmp/libc-test/trace_stresstest", + "rm -rf /data/local/tmp/libc-test/ldso_randomization_test", + "rm -rf /data/local/tmp/libc-test/ldso_randomization_manual", + "rm -rf /data/local/tmp/libc-test/dlsym", + "rm -rf /data/local/tmp/libc-test/dynlink", + "rm -rf /data/local/tmp/libc-test/reloc_symver", + "rm -rf /data/local/tmp/libc-test/dynlink_default", + "rm -rf /data/local/tmp/libc-test/dlvsym", + "rm -rf /data/local/tmp/libc-test/sem_open", + "rm -rf /data/local/tmp/libc-test/ipc_shm", + "rm -rf /data/local/tmp/libc-test/tgkill", + "rm -rf /data/local/tmp/libc-test/fcntl", + "rm -rf /data/local/tmp/libc-test/tls_init_dlopen", + "rm -rf /data/local/tmp/libc-test/tls_align", + "rm -rf /data/local/tmp/libc-test/dlopen_ns", + "rm -rf /data/local/tmp/libc-test/tls_align_dlopen", + "rm -rf /data/local/tmp/libc-test/utim", + "rm -rf /data/local/tmp/libc-test/dlclose_reset", + "rm -rf /data/local/tmp/libc-test/ipc_sem", + "rm -rf /data/local/tmp/libc-test/ungetc", + "rm -rf /data/local/tmp/libc-test/fscanf", + "rm -rf /data/local/tmp/libc-test/pthread_cancel", + "rm -rf /data/local/tmp/libc-test/tls_init", + "rm -rf /data/local/tmp/libc-test/fdopen", + "rm -rf /data/local/tmp/libc-test/fwscanf", + "rm -rf /data/local/tmp/libc-test/dlopen", + "rm -rf /data/local/tmp/libc-test/ipc_msg", + "rm -rf /data/local/tmp/libc-test/ftello-unflushed-append", + "rm -rf /data/local/tmp/libc-test/malloc-brk-fail", + "rm -rf /data/local/tmp/libc-test/pthread_atfork-errno-clobber", + "rm -rf /data/local/tmp/libc-test/fflush-exit", + "rm -rf /data/local/tmp/libc-test/lseek-large", + "rm -rf /data/local/tmp/libc-test/tls_get_new-dtv", + "rm -rf /data/local/tmp/libc-test/flockfile-list", + "rm -rf /data/local/tmp/libc-test/rintf", + "rm -rf /data/local/tmp/libc-test/nearbyint", + "rm -rf /data/local/tmp/libc-test/fma", + "rm -rf /data/local/tmp/libc-test/fmal", + "rm -rf /data/local/tmp/libc-test/acoshl", + "rm -rf /data/local/tmp/libc-test/tgammal", + "rm -rf /data/local/tmp/libc-test/sqrtl", + "rm -rf /data/local/tmp/libc-test/erfcl", + "rm -rf /data/local/tmp/libc-test/rint", + "rm -rf /data/local/tmp/libc-test/lgammal", + "rm -rf /data/local/tmp/libc-test/nearbyintf", + "rm -rf /data/local/tmp/libc-test/fmaf", + "rm -rf /data/local/tmp/libc-test/sqrtf", + "rm -rf /data/local/tmp/libc-test/rintl", + "rm -rf /data/local/tmp/libc-test/sqrt", + "rm -rf /data/local/tmp/libc-test/nearbyintl", + "rm -rf /data/local/tmp/libc-test/fenv", + "rm -rf /data/local/tmp/libc-test/asinhl", + "rm -rf /data/local/tmp/libc-test/fatal_message", + "rm -rf /data/local/tmp/libc-test/utime", + "rm -rf /data/local/tmp/libc-test/network", + "rm -rf /data/local/tmp/libc-test/vfprintf", + "rm -rf /data/local/tmp/libc-test/gethostbyname2_r", + "rm -rf /data/local/tmp/libc-test/utimensat", + "rm -rf /data/local/tmp/libc-test/tgkill_ext", + "rm -rf /data/local/tmp/libc-test/getnetbyname", + "rm -rf /data/local/tmp/libc-test/getnetbyaddr", + "rm -rf /data/local/tmp/libc-test/getline", + "rm -rf /data/local/tmp/libc-test/setvbuf", + "rm -rf /data/local/tmp/libc-test/res_send", + "rm -rf /data/local/tmp/libc-test/fchmodat", + "rm -rf /data/local/tmp/libc-test/gethostbyaddr_r", + "rm -rf /data/local/tmp/libc-test/getnameinfo", + "rm -rf /data/local/tmp/libc-test/res_querydomain", + "rm -rf /data/local/tmp/libc-test/gethostbyname2", + "rm -rf /data/local/tmp/libc-test/gethostbyaddr", + "rm -rf /data/local/tmp/libc-test/gethostbyname_r" + ], + "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..5ce697e1bc11a73bd32d6bb080c558f643e2a6bd --- /dev/null +++ b/commonlibrary/toolchain/libc-test/include/getfiles.cpp @@ -0,0 +1,40 @@ +/* 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 g_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; + } + g_filenames.push_back(tempName[i]); + } + return g_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..c78100f8a16fc1e7bfd74f65b3fbf4890908df12 --- /dev/null +++ b/commonlibrary/toolchain/libc-test/include/gettestfiles.cpp @@ -0,0 +1,43 @@ +/* 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/commonlibrary/toolchain/libc-test/include/runtest.h b/commonlibrary/toolchain/libc-test/include/runtest.h new file mode 100644 index 0000000000000000000000000000000000000000..d65a62e40d3442068cc821130fa93e271eba77ea --- /dev/null +++ b/commonlibrary/toolchain/libc-test/include/runtest.h @@ -0,0 +1,27 @@ +/* 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 TSetrlim(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..8bfe58c20f32d881cfa777a316175134f2ad1641 --- /dev/null +++ b/commonlibrary/toolchain/libc-test/include/setrlim.cpp @@ -0,0 +1,43 @@ +/* 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::TSetrlim(int r, long lim) +{ + struct rlimit rl; + // Gets the current stack size + if (getrlimit(r, &rl) != 0) { + 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) != 0) { + 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..56dcf037cacdd05028079521564e06e377a2cb9b --- /dev/null +++ b/commonlibrary/toolchain/libc-test/src/toolchaintest.cpp @@ -0,0 +1,140 @@ +/* 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 g_filepath = "/data/local/tmp/libc-test"; +static vector temp = Runtest::GetFileNames(g_filepath); + +volatile int g_tStatus = 0; + +static void Handler(int sig) +{ +} + +static int Start(const char *argvs) +{ + int pid, spaceSize = 100 * 1024; + // Create a child process + // Set the process stack space + pid = fork(); + if (pid == 0) { + Runtest::TSetrlim(RLIMIT_STACK, spaceSize); + // 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 g_tStatus; + } + 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..e0e0a5645c92399c3407705e83fd7e9c6f147554 --- /dev/null +++ b/commonlibrary/toolchain/libc-test/tar_files.py @@ -0,0 +1,68 @@ +#!/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 + +copy_file_counts = 0 + + +def copy_files(sourcedir, targetdir): + global copy_file_counts + for f in os.listdir(sourcedir): + source_f = os.path.join(sourcedir, f) + target_f = os.path.join(targetdir, f) + if not os.path.isfile(source_f): + if os.path.isdir(source_f): + copy_files(source_f, target_f) + continue + if os.path.exists(targetdir): + copy_file_counts += 1 + with open(target_f, "wb") as fp: + fp.write(open(source_f, "rb").read()) + elif not os.path.exists(targetdir): + os.makedirs(targetdir) + copy_file_counts += 1 + with open(target_f, "wb") as fp: + fp.write(open(source_f, "rb").read()) + + +def make_targz_one_by_one(output_filename, source_dir): + tar = tarfile.open(output_filename, "w") + for root, dirs, 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) + + copy_files(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/commonlibrary_lite/file_hal/BUILD.gn b/commonlibrary_lite/file_hal/BUILD.gn old mode 100755 new mode 100644 index f49c0263afe117a08c8f6771c8f0080386c607bb..c81009b351a1980681bb3e9bebffe2ecf5856c2a --- a/commonlibrary_lite/file_hal/BUILD.gn +++ b/commonlibrary_lite/file_hal/BUILD.gn @@ -22,7 +22,7 @@ hctest_suite("ActsUtilsFileTest") { include_dirs = [ "src", - "//utils/native/lite/include", + "//commonlibrary/utils_lite/include", ] cflags = [ "-Wno-error" ] } diff --git a/commonlibrary_lite/file_hal/Test.tmpl b/commonlibrary_lite/file_hal/Test.tmpl old mode 100755 new mode 100644 diff --git a/commonlibrary_lite/file_hal/src/utils_file_func_test.c b/commonlibrary_lite/file_hal/src/utils_file_func_test.c old mode 100755 new mode 100644 index b1a126dbf60d48d595f5bb87c5fe6e316e7e7d58..da996ceb6a09ed405ab64d0d3fd9a0fb90392f4f --- a/commonlibrary_lite/file_hal/src/utils_file_func_test.c +++ b/commonlibrary_lite/file_hal/src/utils_file_func_test.c @@ -58,10 +58,10 @@ static BOOL UtilsFileFuncTestSuiteTearDown(void) /** * @tc.number : SUB_UTILS_FILE_OPERATION_0100 - * @tc.name : File operation for file creation and close with parameter RDONLY + * @tc.name : File operation for file create and close with parameter RDONLY * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreatAndClose001, Function | MediumTest | Level1) +LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreateAndClose001, Function | MediumTest | Level1) { char* fileName = "testfile101"; int fd = UtilsFileOpen(fileName, O_RDONLY_FS | O_CREAT_FS, 0); @@ -73,10 +73,10 @@ LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreatAndClose001, Function | Medi /** * @tc.number : SUB_UTILS_FILE_OPERATION_0200 - * @tc.name : File operation for file creat and close with parameter WRONLY + * @tc.name : File operation for file create and close with parameter WRONLY * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreatAndClose002, Function | MediumTest | Level1) +LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreateAndClose002, Function | MediumTest | Level1) { char* fileName = "testfile102"; int fd = UtilsFileOpen(fileName, O_WRONLY_FS | O_CREAT_FS, 0); @@ -88,10 +88,10 @@ LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreatAndClose002, Function | Medi /** * @tc.number : SUB_UTILS_FILE_OPERATION_0300 - * @tc.name : File operation for file creat and close with parameter RDWR + * @tc.name : File operation for file create and close with parameter RDWR * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreatAndClose003, Function | MediumTest | Level1) +LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreateAndClose003, Function | MediumTest | Level1) { char* fileName = "testfile103"; int fd = UtilsFileOpen(fileName, O_RDWR_FS | O_CREAT_FS, 0); @@ -188,10 +188,10 @@ LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileOpenAndClose005, Function | Mediu /** * @tc.number : SUB_UTILS_FILE_OPERATION_0900 - * @tc.name : File operation for file creat and close with parameter RDONLY and EXCL + * @tc.name : File operation for file create and close with parameter RDONLY and EXCL * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreatAndClose004, Function | MediumTest | Level1) +LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreateAndClose004, Function | MediumTest | Level1) { char* fileName = "testfile109"; int fd = UtilsFileOpen(fileName, O_RDONLY_FS | O_CREAT_FS | O_EXCL_FS, 0); @@ -207,10 +207,10 @@ LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreatAndClose004, Function | Medi /** * @tc.number : SUB_UTILS_FILE_OPERATION_1000 - * @tc.name : File operation for file creation and close with parameter WRONLY and EXCL + * @tc.name : File operation for file create and close with parameter WRONLY and EXCL * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreatAndClose005, Function | MediumTest | Level1) +LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreateAndClose005, Function | MediumTest | Level1) { char* fileName = "testfile110"; int fd = UtilsFileOpen(fileName, O_WRONLY_FS | O_CREAT_FS | O_EXCL_FS, 0); @@ -226,7 +226,7 @@ LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreatAndClose005, Function | Medi /** * @tc.number : SUB_UTILS_FILE_OPERATION_1100 - * @tc.name : File operation for file creat and close with parameter RDWR and EXCL + * @tc.name : File operation for file create and close with parameter RDWR and EXCL * @tc.desc : [C- SOFTWARE -0200] */ LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreatAndClose006, Function | MediumTest | Level1) @@ -245,10 +245,10 @@ LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreatAndClose006, Function | Medi /** * @tc.number : SUB_UTILS_FILE_OPERATION_1200 - * @tc.name : File operation for file creation and close with parameter TRUNC and EXCL + * @tc.name : File operation for file create and close with parameter TRUNC and EXCL * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreatAndClose007, Function | MediumTest | Level1) +LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreateAndClose007, Function | MediumTest | Level1) { char* fileName = "testfile112"; int fd = UtilsFileOpen(fileName, O_RDWR_FS | O_CREAT_FS | O_EXCL_FS | O_TRUNC_FS, 0); @@ -264,10 +264,10 @@ LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreatAndClose007, Function | Medi /** * @tc.number : SUB_UTILS_FILE_OPERATION_1300 - * @tc.name : File operation for file creation and close with parameter APPEND and EXCL + * @tc.name : File operation for file create and close with parameter APPEND and EXCL * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreatAndClose008, Function | MediumTest | Level1) +LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileCreateAndClose008, Function | MediumTest | Level1) { char* fileName = "testfile113"; int fd = UtilsFileOpen(fileName, O_RDWR_FS | O_CREAT_FS | O_EXCL_FS | O_APPEND_FS, 0); @@ -322,10 +322,10 @@ LITE_TEST_CASE(UtilsFileFuncTestSuite, testFileWrite002, Function | MediumTest | /** * @tc.number : SUB_UTILS_FILE_OPERATION_1600 - * @tc.name : Creat file with long file name + * @tc.name : Create file with long file name * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(UtilsFileFuncTestSuite, testCreatLongNameFile, Function | MediumTest | Level1) +LITE_TEST_CASE(UtilsFileFuncTestSuite, testCreateLongNameFile, Function | MediumTest | Level1) { char* fileName = "testLongFileName116-Ab123456789"; int fd = UtilsFileOpen(fileName, O_RDONLY_FS | O_CREAT_FS, 0); @@ -372,10 +372,10 @@ LITE_TEST_CASE(UtilsFileFuncTestSuite, testCloseNotExistFile, Function | MediumT /** * @tc.number : SUB_UTILS_FILE_OPERATION_2100 - * @tc.name : Creat file with invalid long file name + * @tc.name : Create file with invalid long file name * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(UtilsFileFuncTestSuite, testCreatInvalidlongNameFile, Function | MediumTest | Level1) +LITE_TEST_CASE(UtilsFileFuncTestSuite, testCreateInvalidlongNameFile, Function | MediumTest | Level1) { char* fileName = "copyLongFileName403-Abcdefg123456789Abcdefg123456789Abcdefg123456789\ Abcdefg123456789Abcdefg123456789"; diff --git a/commonlibrary_lite/file_hal/src/utils_file_reli_test.c b/commonlibrary_lite/file_hal/src/utils_file_reli_test.c old mode 100755 new mode 100644 index 96b55f10130cf9aa48691029be720b3d04becd26..61c980801ae7dae84502acc05ca55d799ecb5c8e --- a/commonlibrary_lite/file_hal/src/utils_file_reli_test.c +++ b/commonlibrary_lite/file_hal/src/utils_file_reli_test.c @@ -57,10 +57,10 @@ static BOOL UtilsFileReliTestSuiteTearDown(void) /** * @tc.number : SUB_UTILS_FILE_OPERATION_5200 - * @tc.name : Creat file after max files opened + * @tc.name : Create file after max files opened * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(UtilsFileReliTestSuite, testCreatFileAfterMaxFilesOpened, Function | MediumTest | Level1) +LITE_TEST_CASE(UtilsFileReliTestSuite, testCreateFileAfterMaxFilesOpened, Function | MediumTest | Level1) { // Open 32 files int fd32[MAX_NUM_OF_OPENED_FILES] = {0}; @@ -120,13 +120,13 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testDeleteFileAfterMaxFilesOpened, Functi } // Delete file char* fileName1 = "testReli101-1"; - UtilsFileClose(fd32[0]); + UtilsFileClose(fd32[0]); int ret = UtilsFileDelete(fileName1); TEST_ASSERT_EQUAL_INT(0, ret); // Delete all files for (int i = 1; i < MAX_NUM_OF_OPENED_FILES; i++) { UtilsFileClose(fd32[i]); - } + } for (int i = 0; i < MAX_NUM_OF_OPENED_FILES; i++) { int j = i + 1; char fileName32[LENGTH_OF_FILE_NAME_BUF] = {0}; @@ -243,7 +243,7 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testFileOperFlow001, Function | MediumTes { char* fileName1 = "testReli102a"; char* fileName2 = "testReli102b"; - // Creat file + // Create file int fd1 = UtilsFileOpen(fileName1, O_RDWR_FS | O_CREAT_FS, 0); UtilsFileWrite(fd1, g_def, strlen(g_def)); UtilsFileClose(fd1); @@ -281,7 +281,7 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testFileOperFlow002, Function | MediumTes char* fileName1 = "testReli102a"; char* fileName2 = "testReli102b"; char* fileName3 = "testReli102c"; - // Creat file + // Create file int fd1 = UtilsFileOpen(fileName1, O_RDWR_FS | O_CREAT_FS, 0); UtilsFileWrite(fd1, g_def, strlen(g_def)); UtilsFileClose(fd1); @@ -323,7 +323,7 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testEmptyFileOperFlow001, Function | Medi { char* fileName1 = "testReli103a"; char* fileName2 = "testReli103b"; - // Creat an empty file + // Create an empty file int fd1 = UtilsFileOpen(fileName1, O_RDWR_FS | O_CREAT_FS, 0); UtilsFileClose(fd1); // Copy file @@ -359,7 +359,7 @@ LITE_TEST_CASE(UtilsFileReliTestSuite, testEmptyFileOperFlow002, Function | Medi char* fileName1 = "testReli103a"; char* fileName2 = "testReli103b"; char* fileName3 = "testReli103c"; - // Creat an empty file + // Create an empty file int fd1 = UtilsFileOpen(fileName1, O_RDWR_FS | O_CREAT_FS, 0); UtilsFileClose(fd1); // Copy file diff --git a/communication/BUILD.gn b/communication/BUILD.gn index ffe83db90eeaca17eadf6dfe4fba131cec90dd2f..3f600974f5776f2fee1f65ae37a4c042b508c423 100644 --- a/communication/BUILD.gn +++ b/communication/BUILD.gn @@ -21,6 +21,8 @@ group("communication") { "bluetooth_profile:ActsBluetoothProFileJsTest", "bluetooth_standard:ActsBluetoothJsTest", "dsoftbus/rpc:ActsRpcJsTest", + "dsoftbus/rpc_server:ActsRpcJsServer", + "nfc_Controller:ActsNFCJSTest", "wifi_p2p:ActsP2PJSTest", "wifi_standard:ActsWifiJSTest", ] diff --git a/communication/bluetooth_ble/BUILD.gn b/communication/bluetooth_ble/BUILD.gn index 62f8c12f1d6649f4ccefab31a5342b1d563a59de..deeda2f5e900a773d08bb70e9b4ccbcb1370fdae 100644 --- a/communication/bluetooth_ble/BUILD.gn +++ b/communication/bluetooth_ble/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("ActsBluetoothBleJsTest") { diff --git a/communication/bluetooth_ble/src/main/config.json b/communication/bluetooth_ble/src/main/config.json index 9175146c5f6ad96816a2fd65537b4d78a755b4e7..bfb89e51a16507b2878db06a035b3745ee27e588 100644 --- a/communication/bluetooth_ble/src/main/config.json +++ b/communication/bluetooth_ble/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.communication.bluetooth.bluetoothhost", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/communication/bluetooth_ble/src/main/js/test/BleAdvertiser.test.js b/communication/bluetooth_ble/src/main/js/test/BleAdvertiser.test.js index 89121e872a5d832a99f06adfa3cc024390101a81..d8339e9c7b914ec20d0fd127404b984161c12923 100644 --- a/communication/bluetooth_ble/src/main/js/test/BleAdvertiser.test.js +++ b/communication/bluetooth_ble/src/main/js/test/BleAdvertiser.test.js @@ -79,44 +79,51 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 0 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0100', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); - let manufactureValueBuffer = new Uint8Array(4); - manufactureValueBuffer[0] = 1; - manufactureValueBuffer[1] = 2; - manufactureValueBuffer[2] = 3; - manufactureValueBuffer[3] = 4; - let serviceValueBuffer = new Uint8Array(4); - serviceValueBuffer[0] = 4; - serviceValueBuffer[1] = 6; - serviceValueBuffer[2] = 7; - serviceValueBuffer[3] = 8; - gattServer.startAdvertising({ - interval:150, - txPower:60, - connectable:true, - },{ - serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:4567, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - },{ - serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:1789, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - }); - gattServer.stopAdvertising(); - done(); + let gattServer =bluetooth.BLE.createGattServer(); + let manufactureValueBuffer = new Uint8Array(4); + manufactureValueBuffer[0] = 1; + manufactureValueBuffer[1] = 2; + manufactureValueBuffer[2] = 3; + manufactureValueBuffer[3] = 4; + let serviceValueBuffer = new Uint8Array(4); + serviceValueBuffer[0] = 4; + serviceValueBuffer[1] = 6; + serviceValueBuffer[2] = 7; + serviceValueBuffer[3] = 8; + let setting={ + interval:150, + txPower:60, + connectable:true, + } + let advData={ + serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:4567, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + let advResponse ={ + serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:1789, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + try { + gattServer.startAdvertising(setting,advData,advResponse); + gattServer.stopAdvertising(); + }catch(e) { + expect(null).assertFail(); + } + done(); }) /** @@ -129,44 +136,51 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 2 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0200', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); - let manufactureValueBuffer = new Uint8Array(4); - manufactureValueBuffer[0] = 1; - manufactureValueBuffer[1] = 2; - manufactureValueBuffer[2] = 3; - manufactureValueBuffer[3] = 4; - let serviceValueBuffer = new Uint8Array(4); - serviceValueBuffer[0] = 4; - serviceValueBuffer[1] = 6; - serviceValueBuffer[2] = 7; - serviceValueBuffer[3] = 8; - gattServer.startAdvertising({ - interval:20, - txPower:60, - connectable:true, - },{ - serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:4567, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - },{ - serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:1789, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - }); - gattServer.stopAdvertising(); - done(); + let gattServer =bluetooth.BLE.createGattServer(); + let manufactureValueBuffer = new Uint8Array(4); + manufactureValueBuffer[0] = 1; + manufactureValueBuffer[1] = 2; + manufactureValueBuffer[2] = 3; + manufactureValueBuffer[3] = 4; + let serviceValueBuffer = new Uint8Array(4); + serviceValueBuffer[0] = 4; + serviceValueBuffer[1] = 6; + serviceValueBuffer[2] = 7; + serviceValueBuffer[3] = 8; + let setting={ + interval:20, + txPower:60, + connectable:true, + } + let advData={ + serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:4567, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + let advResponse ={ + serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:1789, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + try { + gattServer.startAdvertising(setting,advData,advResponse); + gattServer.stopAdvertising(); + }catch(e) { + expect(null).assertFail(); + } + done(); }) /** @@ -179,44 +193,51 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0300', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); - let manufactureValueBuffer = new Uint8Array(4); - manufactureValueBuffer[0] = 1; - manufactureValueBuffer[1] = 2; - manufactureValueBuffer[2] = 3; - manufactureValueBuffer[3] = 4; - let serviceValueBuffer = new Uint8Array(4); - serviceValueBuffer[0] = 4; - serviceValueBuffer[1] = 6; - serviceValueBuffer[2] = 7; - serviceValueBuffer[3] = 8; - gattServer.startAdvertising({ - interval:16385, - txPower:60, - connectable:true, - },{ - serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:4567, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - },{ - serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:1789, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - }); - gattServer.stopAdvertising(); - done(); + let gattServer =bluetooth.BLE.createGattServer(); + let manufactureValueBuffer = new Uint8Array(4); + manufactureValueBuffer[0] = 1; + manufactureValueBuffer[1] = 2; + manufactureValueBuffer[2] = 3; + manufactureValueBuffer[3] = 4; + let serviceValueBuffer = new Uint8Array(4); + serviceValueBuffer[0] = 4; + serviceValueBuffer[1] = 6; + serviceValueBuffer[2] = 7; + serviceValueBuffer[3] = 8; + let setting={ + interval:16385, + txPower:60, + connectable:true, + } + let advData={ + serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:4567, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + let advResponse ={ + serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:1789, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + try { + gattServer.startAdvertising(setting,advData,advResponse); + gattServer.stopAdvertising(); + }catch(e) { + expect(null).assertFail(); + } + done(); }) /** @@ -229,44 +250,51 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0400', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); - let manufactureValueBuffer = new Uint8Array(4); - manufactureValueBuffer[0] = 1; - manufactureValueBuffer[1] = 2; - manufactureValueBuffer[2] = 3; - manufactureValueBuffer[3] = 4; - let serviceValueBuffer = new Uint8Array(4); - serviceValueBuffer[0] = 4; - serviceValueBuffer[1] = 6; - serviceValueBuffer[2] = 7; - serviceValueBuffer[3] = 8; - gattServer.startAdvertising({ - interval:16400, - txPower:60, - connectable:true, - },{ - serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:4567, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - },{ - serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:1789, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - }); - gattServer.stopAdvertising(); - done(); + let gattServer =bluetooth.BLE.createGattServer(); + let manufactureValueBuffer = new Uint8Array(4); + manufactureValueBuffer[0] = 1; + manufactureValueBuffer[1] = 2; + manufactureValueBuffer[2] = 3; + manufactureValueBuffer[3] = 4; + let serviceValueBuffer = new Uint8Array(4); + serviceValueBuffer[0] = 4; + serviceValueBuffer[1] = 6; + serviceValueBuffer[2] = 7; + serviceValueBuffer[3] = 8; + let setting={ + interval:16400, + txPower:60, + connectable:true, + } + let advData={ + serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:4567, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + let advResponse ={ + serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:1789, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + try { + gattServer.startAdvertising(setting,advData,advResponse); + gattServer.stopAdvertising(); + }catch(e) { + expect(null).assertFail(); + } + done(); }) /** @@ -279,47 +307,54 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0500', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); - let manufactureValueBuffer = new Uint8Array(4); - manufactureValueBuffer[0] = 1; - manufactureValueBuffer[1] = 2; - manufactureValueBuffer[2] = 3; - manufactureValueBuffer[3] = 4; - let serviceValueBuffer = new Uint8Array(4); - serviceValueBuffer[0] = 4; - serviceValueBuffer[1] = 6; - serviceValueBuffer[2] = 7; - serviceValueBuffer[3] = 8; - gattServer.startAdvertising({ - interval:19, - txPower:60, - connectable:true, - },{ - serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:4567, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - },{ - serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:1789, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - }); - gattServer.stopAdvertising(); - done(); + let gattServer =bluetooth.BLE.createGattServer(); + let manufactureValueBuffer = new Uint8Array(4); + manufactureValueBuffer[0] = 1; + manufactureValueBuffer[1] = 2; + manufactureValueBuffer[2] = 3; + manufactureValueBuffer[3] = 4; + let serviceValueBuffer = new Uint8Array(4); + serviceValueBuffer[0] = 4; + serviceValueBuffer[1] = 6; + serviceValueBuffer[2] = 7; + serviceValueBuffer[3] = 8; + let setting={ + interval:19, + txPower:60, + connectable:true, + } + let advData={ + serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:4567, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + let advResponse ={ + serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:1789, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + try { + gattServer.startAdvertising(setting,advData,advResponse); + gattServer.stopAdvertising(); + }catch(e) { + expect(null).assertFail(); + } + done(); }) - /** + /** * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0800 * @tc.name testStartAdvertising * @tc.desc Test StartAdvertising api. @@ -329,44 +364,51 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 2 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0800', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); - let manufactureValueBuffer = new Uint8Array(4); - manufactureValueBuffer[0] = 1; - manufactureValueBuffer[1] = 2; - manufactureValueBuffer[2] = 3; - manufactureValueBuffer[3] = 4; - let serviceValueBuffer = new Uint8Array(4); - serviceValueBuffer[0] = 4; - serviceValueBuffer[1] = 6; - serviceValueBuffer[2] = 7; - serviceValueBuffer[3] = 8; - gattServer.startAdvertising({ - interval:1000, - txPower:-10, - connectable:true, - },{ - serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:4567, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - },{ - serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:1789, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - }); - gattServer.stopAdvertising(); - done(); + let gattServer =bluetooth.BLE.createGattServer(); + let manufactureValueBuffer = new Uint8Array(4); + manufactureValueBuffer[0] = 1; + manufactureValueBuffer[1] = 2; + manufactureValueBuffer[2] = 3; + manufactureValueBuffer[3] = 4; + let serviceValueBuffer = new Uint8Array(4); + serviceValueBuffer[0] = 4; + serviceValueBuffer[1] = 6; + serviceValueBuffer[2] = 7; + serviceValueBuffer[3] = 8; + let setting={ + interval:1000, + txPower:-10, + connectable:true, + } + let advData={ + serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:4567, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + let advResponse ={ + serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:1789, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + try { + gattServer.startAdvertising(setting,advData,advResponse); + gattServer.stopAdvertising(); + }catch(e) { + expect(null).assertFail(); + } + done(); }) /** @@ -379,44 +421,51 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 2 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_0900', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); - let manufactureValueBuffer = new Uint8Array(4); - manufactureValueBuffer[0] = 1; - manufactureValueBuffer[1] = 2; - manufactureValueBuffer[2] = 3; - manufactureValueBuffer[3] = 4; - let serviceValueBuffer = new Uint8Array(4); - serviceValueBuffer[0] = 4; - serviceValueBuffer[1] = 6; - serviceValueBuffer[2] = 7; - serviceValueBuffer[3] = 8; - gattServer.startAdvertising({ - interval:1000, - txPower:-127, - connectable:true, - },{ - serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:4567, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - },{ - serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:1789, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - }); - gattServer.stopAdvertising(); - done(); + let gattServer =bluetooth.BLE.createGattServer(); + let manufactureValueBuffer = new Uint8Array(4); + manufactureValueBuffer[0] = 1; + manufactureValueBuffer[1] = 2; + manufactureValueBuffer[2] = 3; + manufactureValueBuffer[3] = 4; + let serviceValueBuffer = new Uint8Array(4); + serviceValueBuffer[0] = 4; + serviceValueBuffer[1] = 6; + serviceValueBuffer[2] = 7; + serviceValueBuffer[3] = 8; + let setting={ + interval:1000, + txPower:-127, + connectable:true, + } + let advData={ + serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:4567, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + let advResponse ={ + serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:1789, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + try { + gattServer.startAdvertising(setting,advData,advResponse); + gattServer.stopAdvertising(); + }catch(e) { + expect(null).assertFail(); + } + done(); }) /** @@ -429,44 +478,51 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 2 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1000', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); - let manufactureValueBuffer = new Uint8Array(4); - manufactureValueBuffer[0] = 1; - manufactureValueBuffer[1] = 2; - manufactureValueBuffer[2] = 3; - manufactureValueBuffer[3] = 4; - let serviceValueBuffer = new Uint8Array(4); - serviceValueBuffer[0] = 4; - serviceValueBuffer[1] = 6; - serviceValueBuffer[2] = 7; - serviceValueBuffer[3] = 8; - gattServer.startAdvertising({ - interval:1000, - txPower:1, - connectable:true, - },{ - serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:4567, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - },{ - serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:1789, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - }); - gattServer.stopAdvertising(); - done(); + let gattServer =bluetooth.BLE.createGattServer(); + let manufactureValueBuffer = new Uint8Array(4); + manufactureValueBuffer[0] = 1; + manufactureValueBuffer[1] = 2; + manufactureValueBuffer[2] = 3; + manufactureValueBuffer[3] = 4; + let serviceValueBuffer = new Uint8Array(4); + serviceValueBuffer[0] = 4; + serviceValueBuffer[1] = 6; + serviceValueBuffer[2] = 7; + serviceValueBuffer[3] = 8; + let setting={ + interval:1000, + txPower:1, + connectable:true, + } + let advData={ + serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:4567, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + let advResponse ={ + serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:1789, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + try { + gattServer.startAdvertising(setting,advData,advResponse); + gattServer.stopAdvertising(); + }catch(e) { + expect(null).assertFail(); + } + done(); }) /** @@ -479,44 +535,51 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1100', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); - let manufactureValueBuffer = new Uint8Array(4); - manufactureValueBuffer[0] = 1; - manufactureValueBuffer[1] = 2; - manufactureValueBuffer[2] = 3; - manufactureValueBuffer[3] = 4; - let serviceValueBuffer = new Uint8Array(4); - serviceValueBuffer[0] = 4; - serviceValueBuffer[1] = 6; - serviceValueBuffer[2] = 7; - serviceValueBuffer[3] = 8; - gattServer.startAdvertising({ - interval:1000, - txPower:10, - connectable:true, - },{ - serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:4567, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - },{ - serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:1789, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - }); - gattServer.stopAdvertising(); - done(); + let gattServer =bluetooth.BLE.createGattServer(); + let manufactureValueBuffer = new Uint8Array(4); + manufactureValueBuffer[0] = 1; + manufactureValueBuffer[1] = 2; + manufactureValueBuffer[2] = 3; + manufactureValueBuffer[3] = 4; + let serviceValueBuffer = new Uint8Array(4); + serviceValueBuffer[0] = 4; + serviceValueBuffer[1] = 6; + serviceValueBuffer[2] = 7; + serviceValueBuffer[3] = 8; + let setting={ + interval:1000, + txPower:10, + connectable:true, + } + let advData={ + serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:4567, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + let advResponse ={ + serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:1789, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + try { + gattServer.startAdvertising(setting,advData,advResponse); + gattServer.stopAdvertising(); + }catch(e) { + expect(null).assertFail(); + } + done(); }) /** @@ -529,44 +592,51 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1200', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); - let manufactureValueBuffer = new Uint8Array(4); - manufactureValueBuffer[0] = 1; - manufactureValueBuffer[1] = 2; - manufactureValueBuffer[2] = 3; - manufactureValueBuffer[3] = 4; - let serviceValueBuffer = new Uint8Array(4); - serviceValueBuffer[0] = 4; - serviceValueBuffer[1] = 6; - serviceValueBuffer[2] = 7; - serviceValueBuffer[3] = 8; - gattServer.startAdvertising({ - interval:1000, - txPower:-130, - connectable:true, - },{ - serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:4567, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - },{ - serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:1789, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - }); - gattServer.stopAdvertising(); - done(); + let gattServer =bluetooth.BLE.createGattServer(); + let manufactureValueBuffer = new Uint8Array(4); + manufactureValueBuffer[0] = 1; + manufactureValueBuffer[1] = 2; + manufactureValueBuffer[2] = 3; + manufactureValueBuffer[3] = 4; + let serviceValueBuffer = new Uint8Array(4); + serviceValueBuffer[0] = 4; + serviceValueBuffer[1] = 6; + serviceValueBuffer[2] = 7; + serviceValueBuffer[3] = 8; + let setting={ + interval:1000, + txPower:-130, + connectable:true, + } + let advData={ + serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:4567, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + let advResponse ={ + serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:1789, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + try { + gattServer.startAdvertising(setting,advData,advResponse); + gattServer.stopAdvertising(); + }catch(e) { + expect(null).assertFail(); + } + done(); }) /** @@ -579,44 +649,51 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 2 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1400', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); - let manufactureValueBuffer = new Uint8Array(4); - manufactureValueBuffer[0] = 1; - manufactureValueBuffer[1] = 2; - manufactureValueBuffer[2] = 3; - manufactureValueBuffer[3] = 4; - let serviceValueBuffer = new Uint8Array(4); - serviceValueBuffer[0] = 4; - serviceValueBuffer[1] = 6; - serviceValueBuffer[2] = 7; - serviceValueBuffer[3] = 8; - gattServer.startAdvertising({ - interval:1000, - txPower:1, - connectable:false, - },{ - serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:4567, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - },{ - serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:1789, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - }); - gattServer.stopAdvertising(); - done(); + let gattServer =bluetooth.BLE.createGattServer(); + let manufactureValueBuffer = new Uint8Array(4); + manufactureValueBuffer[0] = 1; + manufactureValueBuffer[1] = 2; + manufactureValueBuffer[2] = 3; + manufactureValueBuffer[3] = 4; + let serviceValueBuffer = new Uint8Array(4); + serviceValueBuffer[0] = 4; + serviceValueBuffer[1] = 6; + serviceValueBuffer[2] = 7; + serviceValueBuffer[3] = 8; + let setting={ + interval:1000, + txPower:1, + connectable:false, + } + let advData={ + serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:4567, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + let advResponse ={ + serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:1789, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + try { + gattServer.startAdvertising(setting,advData,advResponse); + gattServer.stopAdvertising(); + }catch(e) { + expect(null).assertFail(); + } + done(); }) /** @@ -629,44 +706,51 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1500', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); - let manufactureValueBuffer = new Uint8Array(4); - manufactureValueBuffer[0] = 1; - manufactureValueBuffer[1] = 2; - manufactureValueBuffer[2] = 3; - manufactureValueBuffer[3] = 4; - let serviceValueBuffer = new Uint8Array(4); - serviceValueBuffer[0] = 4; - serviceValueBuffer[1] = 6; - serviceValueBuffer[2] = 7; - serviceValueBuffer[3] = 8; - gattServer.startAdvertising({ - interval:1000, - txPower:70, - connectable:true, - },{ - serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:4567, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - },{ - serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:1789, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - }); - gattServer.stopAdvertising(); - done(); + let gattServer =bluetooth.BLE.createGattServer(); + let manufactureValueBuffer = new Uint8Array(4); + manufactureValueBuffer[0] = 1; + manufactureValueBuffer[1] = 2; + manufactureValueBuffer[2] = 3; + manufactureValueBuffer[3] = 4; + let serviceValueBuffer = new Uint8Array(4); + serviceValueBuffer[0] = 4; + serviceValueBuffer[1] = 6; + serviceValueBuffer[2] = 7; + serviceValueBuffer[3] = 8; + let setting={ + interval:1000, + txPower:70, + connectable:true, + } + let advData={ + serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:4567, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + let advResponse ={ + serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:1789, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + try { + gattServer.startAdvertising(setting,advData,advResponse); + gattServer.stopAdvertising(); + }catch(e) { + expect(null).assertFail(); + } + done(); }) /** @@ -679,45 +763,234 @@ describe('bluetoothBLETest2', function() { * @tc.level Level 1 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1600', 0, async function (done) { - let gattServer =bluetooth.BLE.createGattServer(); - let manufactureValueBuffer = new Uint8Array(4); - manufactureValueBuffer[0] = 1; - manufactureValueBuffer[1] = 2; - manufactureValueBuffer[2] = 3; - manufactureValueBuffer[3] = 4; - let serviceValueBuffer = new Uint8Array(4); - serviceValueBuffer[0] = 4; - serviceValueBuffer[1] = 6; - serviceValueBuffer[2] = 7; - serviceValueBuffer[3] = 8; - gattServer.startAdvertising({ - interval:1000, - txPower:-70, - connectable:true, - },{ - serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:4567, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - },{ - serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], - manufactureData:[{ - manufactureId:1789, - manufactureValue:manufactureValueBuffer.buffer - }], - serviceData:[{ - serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", - serviceValue:serviceValueBuffer.buffer - }], - }); - gattServer.stopAdvertising(); - done(); - }) + let gattServer =bluetooth.BLE.createGattServer(); + let manufactureValueBuffer = new Uint8Array(4); + manufactureValueBuffer[0] = 1; + manufactureValueBuffer[1] = 2; + manufactureValueBuffer[2] = 3; + manufactureValueBuffer[3] = 4; + let serviceValueBuffer = new Uint8Array(4); + serviceValueBuffer[0] = 4; + serviceValueBuffer[1] = 6; + serviceValueBuffer[2] = 7; + serviceValueBuffer[3] = 8; + let setting={ + interval:1000, + txPower:70, + connectable:true, + } + let advData={ + serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:4567, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + let advResponse ={ + serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:1789, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + try { + gattServer.startAdvertising(setting,advData,advResponse); + gattServer.stopAdvertising(); + }catch(e) { + expect(null).assertFail(); + } + done(); + }) + + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1800 + * @tc.name testStartAdvertising + * @tc.desc Test StartAdvertising api. + * @tc.size MEDIUM + * @ since 7 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1800', 0, async function (done) { + let gattServer =bluetooth.BLE.createGattServer(); + let manufactureValueBuffer = new Uint8Array(4); + manufactureValueBuffer[0] = 1; + manufactureValueBuffer[1] = 2; + manufactureValueBuffer[2] = 3; + manufactureValueBuffer[3] = 4; + let serviceValueBuffer = new Uint8Array(4); + serviceValueBuffer[0] = 4; + serviceValueBuffer[1] = 6; + serviceValueBuffer[2] = 7; + serviceValueBuffer[3] = 8; + let setting={ + interval:1000, + txPower:1, + connectable:true, + } + let advData={ + serviceUuids:[""], + manufactureData:[{ + manufactureId:4567, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"", + serviceValue:serviceValueBuffer.buffer + }], + } + let advResponse ={ + serviceUuids:[""], + manufactureData:[{ + manufactureId:1789, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"", + serviceValue:serviceValueBuffer.buffer + }], + } + try { + gattServer.startAdvertising(setting,advData,advResponse); + gattServer.stopAdvertising(); + }catch(e) { + expect(null).assertFail(); + } + done(); + }) + + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1900 + * @tc.name testStartAdvertising + * @tc.desc Test StartAdvertising api. + * @tc.size MEDIUM + * @ since 7 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_1900', 0, async function (done) { + let gattServer =bluetooth.BLE.createGattServer(); + let manufactureValueBuffer = new Uint8Array(4); + manufactureValueBuffer[0] = 1; + manufactureValueBuffer[1] = 2; + manufactureValueBuffer[2] = 3; + manufactureValueBuffer[3] = 4; + let serviceValueBuffer = new Uint8Array(4); + serviceValueBuffer[0] = 4; + serviceValueBuffer[1] = 6; + serviceValueBuffer[2] = 7; + serviceValueBuffer[3] = 8; + let setting={ + interval:1000, + txPower:1, + connectable:true, + } + let advData={ + serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:4567, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[], + } + let advResponse ={ + serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:1789, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[], + } + try { + gattServer.startAdvertising(setting,advData,advResponse); + gattServer.stopAdvertising(); + }catch(e) { + expect(null).assertFail(); + } + done(); + }) + + + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_2100 + * @tc.name testStartAdvertising + * @tc.desc Test StartAdvertising api. + * @tc.size MEDIUM + * @ since 7 + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BLE_AdvertiseData_2100', 0, async function (done) { + let gattServer =bluetooth.BLE.createGattServer(); + let manufactureValueBuffer = new Uint8Array(4); + manufactureValueBuffer[0] = 1; + manufactureValueBuffer[1] = 2; + manufactureValueBuffer[2] = 3; + manufactureValueBuffer[3] = 4; + let serviceValueBuffer = new Uint8Array(4); + serviceValueBuffer[0] = 4; + serviceValueBuffer[1] = 6; + serviceValueBuffer[2] = 7; + serviceValueBuffer[3] = 8; + let setting={ + interval:1000, + txPower:1, + connectable:true, + } + let advData={ + serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], + manufactureData:[], + serviceData:[{ + serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + let advResponse ={ + serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], + manufactureData:[], + serviceData:[{ + serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + } + try { + gattServer.startAdvertising(setting,advData,advResponse); + gattServer.stopAdvertising(); + }catch(e) { + expect(null).assertFail(); + } + done(); + }) + + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_StartAdvertise_0400 + * @tc.name testStartAdvertising + * @tc.desc Test StartAdvertising api. + * @tc.size MEDIUM + * @ since 7 + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BLE_StartAdvertise_0400', 0, function () { + let isRet = true; + try{ + let gattServer =bluetooth.BLE.createGattServer(); + gattServer.stopAdvertising(); + expect(isRet).assertTrue(); + }catch(error){ + console.info("[bluetooth_js] GattclientClose err:" + JSON.stringify(error)); + let isRet = false; + expect(isRet).assertFalse(); + } + }) }) diff --git a/communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js b/communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js index ca11022046512d597180ac4c7cd6b1b68138a423..972da8c07f4cf7dd9ad3ac605fc7b77e68640701 100644 --- a/communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js +++ b/communication/bluetooth_ble/src/main/js/test/BleGattManager.test.js @@ -89,7 +89,7 @@ describe('bluetoothBLETest', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Connect_0300 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Connect_0200 * @tc.name testGetConnectedBLEDevices * @tc.desc Test getConnectedBLEDevices api . * @tc.size MEDIUM @@ -97,13 +97,39 @@ describe('bluetoothBLETest', function() { * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_GattConnect_0300', 0, function () { + it('SUB_COMMUNICATION_BLUETOOTH_BLE_GattConnect_0200', 0, function () { let result = bluetooth.BLE.getConnectedBLEDevices(); console.info("[bluetooth_js] getConnDev:" + JSON.stringify(result) + "length:" +result.length); expect(result.length).assertEqual(0); }) + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Connect_0300 + * test Client BLEconnectStateChange + * @tc.desc Test on and off api + * @tc.size MEDIUM + * @ since 7 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BLE_GattConnect_0300', 0, async function (done) { + function ConnectStateChanged(state) { + console.log('bluetooth connect state changed'); + let connectState = state.state; + console.info('[bluetooth_js] state changed' + connectState) + expect(true).assertEqual(connectState!=null); + } + let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); + await gattClient.on('BLEConnectionStateChange', ConnectStateChanged); + let ret = gattClient.connect(); + console.info('[bluetooth_js] gattClient connect' + ret) + expect(ret).assertTrue(); + gattClient.disconnect(); + await gattClient.off("BLEConnectionStateChange"); + done() + }) + /** * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0100 * @tc.name testgetRssiValue @@ -119,17 +145,19 @@ describe('bluetoothBLETest', function() { console.info('[bluetooth_js] gattClient getrssi2 connect' + JSON.stringify(ret)) expect(ret).assertTrue(); await gattClient.getRssiValue().then((data) => { - console.info('[bluetooth_js] BLE read rssi ' + JSON.stringify(data)); + console.info('[bluetooth_js] BLE read rssi: ' + JSON.stringify(data)); let rssiLength = Object.keys(data).length; expect(rssiLength).assertEqual(0); - }).catch(err => { - console.error('bluetooth getRssiValue has error: '+ err); + done(); + }).catch(error => { + console.info('bluetooth getRssiValue has error: '+ JSON.stringify(error)); expect(true).assertEqual(true); + done(); }); let disconnect = gattClient.disconnect(); console.info('[bluetooth_js] gatt getrssi2 disconnect:' + disconnect); expect(disconnect).assertEqual(false); - done(); + }) /** @@ -146,15 +174,17 @@ describe('bluetoothBLETest', function() { let ret = gattClient.connect(); console.info('[bluetooth_js] gattClient getRssi connect' + JSON.stringify(ret)) expect(ret).assertTrue(); - gattClient.getRssiValue((err, data)=> { - console.info('[bluetooth_js]getRssi value:'+JSON.stringify(data)); - expect(data).assertNull(); - let disconnect = gattClient.disconnect(); - console.info('[bluetooth_js] gatt getrssi1 disconnect:' + disconnect); - expect(disconnect).assertEqual(false); - }); - await sleep(2000); - done(); + let promise = new Promise((resolve) => { + gattClient.getRssiValue((err, data)=> { + console.info('[bluetooth_js]getRssi value:'+JSON.stringify(data)); + expect(data).assertNull(); + let disconnect = gattClient.disconnect(); + console.info('[bluetooth_js] gatt getrssi1 disconnect:' + disconnect); + expect(disconnect).assertEqual(false); + }); + resolve() + }) + await promise.then(done) }) /** @@ -174,14 +204,16 @@ describe('bluetoothBLETest', function() { await gattClient.getDeviceName().then((data) => { console.info('[bluetooth_js] device name' + JSON.stringify(data)) expect(data).assertNull(); + done(); }).catch(err => { console.error('bluetooth getDeviceName has error: '+ err); expect(true).assertEqual(true); + done(); }); let disconnect = gattClient.disconnect(); console.info('[bluetooth_js] gatt getname2 disconnect:' + disconnect); expect(disconnect).assertEqual(false); - done(); + }) @@ -227,14 +259,15 @@ describe('bluetoothBLETest', function() { await gattClient.getServices().then((GattService) => { console.info('[bluetooth_js] getServices successfully:'+JSON.stringify(GattService)); expect(GattService).assertNull(); + done(); }).catch(err => { console.error('[bluetooth_js] getServices has error:'+ JSON.stringify(err)); expect(true).assertEqual(true); + done(); }); let disconnect = gattClient.disconnect(); console.info('[bluetooth_js] gatt getservices1 disconnect:' + disconnect); expect(disconnect).assertEqual(false); - done(); }) /** @@ -353,34 +386,33 @@ describe('bluetoothBLETest', function() { * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0100', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0100', 0, async function (done) { let descriptors = []; let arrayBuffer = new ArrayBuffer(8); let desValue = new Uint8Array(arrayBuffer); - desValue[0] = 11; + desValue[0] = 11; let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; - descriptors[0] = descriptor; + descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', + descriptorValue: arrayBuffer}; + descriptors[0] = descriptor; let arrayBufferCCC = new ArrayBuffer(8); let cccValue = new Uint8Array(arrayBufferCCC); - cccValue[0] = 32; + cccValue[0] = 32; let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', - characteristicValue: arrayBufferCCC, descriptors:descriptors}; - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - await gattClient.readCharacteristicValue(characteristic).then((object) => { + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', + characteristicValue: arrayBufferCCC, descriptors:descriptors}; + let gattClient = bluetooth.BLE.createGattClientDevice("00:00:00:00:00:00"); + gattClient.readCharacteristicValue(characteristic).then((object) => { if (object != null) { - console.error('bluetooth readCharacteristicValue promise object :' - +JSON.stringify(object)); expect(true).assertEqual(true); } else { - console.info('[bluetooth_js] readCharacValue promise null:' + JSON.stringify(object)); + console.info('[bluetooth_js] readCharacValue promise data:' + + JSON.stringify(data)); expect(null).assertFail(); } done(); - }).catch(error => { - console.error('[bluetooth_js] readCharacteristicValue promise has error:' - +JSON.stringify(error)); + }).catch(err => { + console.error(`bluetooth readCharacteValue promise has error: ${err}`); expect(true).assertEqual(true); done(); }) @@ -400,6 +432,7 @@ describe('bluetoothBLETest', function() { return; } console.log('bluetooth characteristic uuid:'+ BLECharacteristic.characteristicUuid); + expect(true).assertEqual(data==null); let value = new Uint8Array(BLECharacteristic.characteristicValue); console.log('bluetooth characteristic value: ' + value[0] +','+ value[1]+','+ value[2]+','+ value[3]); @@ -408,7 +441,8 @@ describe('bluetoothBLETest', function() { let desValue = new Uint8Array(arrayBuffer); desValue[0] = 11; let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue:arrayBuffer}; + descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', + descriptorValue:arrayBuffer}; let arrayBufferCCC = new ArrayBuffer(8); let cccValue = new Uint8Array(arrayBufferCCC); cccValue[0] = 32; @@ -416,9 +450,38 @@ describe('bluetoothBLETest', function() { characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferCCC, descriptors:descriptor}; let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let data = await gattClient.readCharacteristicValue(characteristic,readCcc); - console.log('[bluetooth_js] readCharacteristicValue callback: ' + JSON.stringify(data)) - expect(true).assertEqual(data==null); + await gattClient.readCharacteristicValue(characteristic,readCcc); + done() + }) + + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0300 + * @tc.name test characteristicReadOn + * @tc.desc Test On and off api. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0300', 0, async function (done) { + let arrayBufferCCC = new ArrayBuffer(8); + let cccValue = new Uint8Array(arrayBufferCCC); + cccValue[0] = 1123; + function ReadCharacteristicReq(CharacteristicReadReq) { + let deviceId = CharacteristicReadReq.deviceId; + let transId = CharacteristicReadReq.transId; + let offset = CharacteristicReadReq.offset; + let characteristicUuid = CharacteristicReadReq.characteristicUuid; + + let serverResponse = {deviceId: deviceId, transId: transId, + status: 0, offset: offset, value:arrayBufferCCC}; + let ret = gattServer.sendResponse(serverResponse); + console.info('[bluetooth_js] sendResponse ret : ' + ret); + expect(ret).assertEqual(false); + } + + let gattServer = bluetooth.BLE.createGattServer(); + await gattServer.on("characteristicRead", ReadCharacteristicReq); + await gattServer.off("characteristicRead"); done() }) @@ -435,7 +498,8 @@ describe('bluetoothBLETest', function() { let desValue = new Uint8Array(arrayBuffer); desValue[0] = 11; let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; + descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', + descriptorValue: arrayBuffer}; let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); await gattClient.readDescriptorValue(descriptor).then((object) => { if (object != null) { @@ -443,12 +507,12 @@ describe('bluetoothBLETest', function() { expect(true).assertEqual(true); } else { - console.info('[bluetooth_js]readDescriptorValue null:' + JSON.stringify(object)); + console.info('[bluetooth_js]readDescripValue null:' + JSON.stringify(object)); expect(null).assertFail(); } done(); - }).catch(error => { - console.error('[bluetooth_js]readDescriptorValue promise error:'+JSON.stringify(error)); + }).catch(err => { + console.error('[bluetooth_js]readDescrValue promise err:'+JSON.stringify(err)); expect(true).assertEqual(true); done(); }) @@ -466,7 +530,7 @@ describe('bluetoothBLETest', function() { function readDesc(code, BLEDescriptor) { if (code.code != 0) { console.info('[bluetooth_js] descriptor code: ' + BLEDescriptor.descriptorUuid); - return; + expect(true).assertEqual(BLEDescriptor.descriptorUuid==null); } console.info('[bluetooth_js] descriptor uuid: ' + BLEDescriptor.descriptorUuid); let value = new Uint8Array(BLEDescriptor.descriptorValue); @@ -479,9 +543,43 @@ describe('bluetoothBLETest', function() { let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let data1 = await gattClient.readDescriptorValue(descriptor,readDesc); - console.log('[bluetooth_js] readDescriptorValue callback: ' + JSON.stringify(data1)) - expect(true).assertEqual(data1==null); + gattClient.readDescriptorValue(descriptor,readDesc); + done() + }) + + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0300 + * @tc.name test ReadDescriptorOn + * @tc.desc Test On and Off api. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0300', 0, async function (done) { + let arrayBufferCCC = new ArrayBuffer(8); + let cccValue = new Uint8Array(arrayBufferCCC); + cccValue[0] = 1011; + function ReadDescriptorReq(DescriptorReadReq) { + let deviceId = DescriptorReadReq.deviceId; + let transId = DescriptorReadReq.transId; + let offset = DescriptorReadReq.offset; + let characteristicUuid = DescriptorReadReq.characteristicUuid; + + let serverResponse = {deviceId: deviceId, transId: transId, + status: 0, offset: offset, value:arrayBufferCCC}; + let ret = gattServer.sendResponse(serverResponse); + console.info('[bluetooth_js]sendResponse ret : ' + ret); + expect(ret).assertEqual(false); + console.info("[bluetooth_js] DesRedon jsondata:" + + 'deviceId:' + deviceId + 'transId:' +transId + 'offset:' + + offset +'descriptorUuid:' + DescriptorReadReq.descriptorUuid + + 'characteristicUuid:' +characteristicUuid + + 'serviceUuid:' + DescriptorReadReq.serviceUuid); + expect(true).assertEqual(DescriptorReadReq !=null); + } + let gattServer = bluetooth.BLE.createGattServer(); + await gattServer.on("descriptorRead", ReadDescriptorReq); + await gattServer.off("descriptorRead"); done() }) @@ -513,7 +611,7 @@ describe('bluetoothBLETest', function() { expect(ret).assertEqual(false); }) - /** + /** * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0200 * @tc.name testWriteCharacteristicValue * @tc.desc Test Client WriteCharacteristicValue api. @@ -528,6 +626,40 @@ describe('bluetoothBLETest', function() { expect(ret).assertEqual(false); }) + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0300 + * @tc.name test characteristicWriteOn + * @tc.desc Test on and off api. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0300', 0, async function (done) { + let arrayBufferCCC = new ArrayBuffer(8); + let cccValue = new Uint8Array(arrayBufferCCC); + function WriteCharacteristicReq(CharacteristicWriteReq) { + let deviceId = CharacteristicWriteReq.deviceId; + let transId = CharacteristicWriteReq.transId; + let offset = CharacteristicWriteReq.offset; + let isPrep = CharacteristicWriteReq.isPrep; + let needRsp = CharacteristicWriteReq.needRsp; + let value = new Uint8Array(CharacteristicWriteReq.value); + let characteristicUuid = CharacteristicWriteReq.characteristicUuid; + + cccValue[0] = value[0]; + let serverResponse = {deviceId: deviceId, transId: transId, + status: 0, offset: offset, value:arrayBufferCCC}; + + let ret = gattServer.sendResponse(serverResponse); + console.info('[bluetooth_js] sendResponse ret : ' + ret); + expect(ret).assertEqual(false); + } + let gattServer = bluetooth.BLE.createGattServer(); + gattServer.on("characteristicWrite", WriteCharacteristicReq); + gattServer.off("characteristicWrite"); + done() + }) + /** * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0100 * @tc.name testWriteDescriptorValue @@ -563,7 +695,48 @@ describe('bluetoothBLETest', function() { expect(ret).assertEqual(false); }) - /** + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0300 + * @tc.name test WriteDescriptorOn + * @tc.desc Test on and off api. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0300', 0, async function (done) { + let arrayBufferDesc = new ArrayBuffer(8); + let descValue = new Uint8Array(arrayBufferDesc); + function WriteDescriptorReq(DescriptorWriteReq) { + let deviceId = DescriptorWriteReq.deviceId; + let transId = DescriptorWriteReq.transId; + let offset = DescriptorWriteReq.offset; + let isPrep = DescriptorWriteReq.isPrep; + let needRsp = DescriptorWriteReq.needRsp; + let value = new Uint8Array(DescriptorWriteReq.value); + let descriptorUuid = DescriptorWriteReq.descriptorUuid; + + descValue[0] = value[0]; + let serverResponse = {deviceId: deviceId, transId: transId, + status: 0, offset: offset, value:arrayBufferDesc}; + + let ret = gattServer.sendResponse(serverResponse); + console.info('[bluetooth_js] sendResponse ret : ' + ret); + expect(ret).assertEqual(false); + console.info("[bluetooth_js] desWriOn jsondata: " +'deviceId: ' + + deviceId + 'transId:' + transId + 'offset:' + offset +'descriptorUuid:' + + descriptorUuid + 'charUuid:' + DescriptorWriteReq.characteristicUuid + + 'serviceUuid:' + DescriptorWriteReq.serviceUuid + + 'value:' + DescriptorWriteReq.value + 'needRsp' + + needRsp + 'isPrep:' +isPrep ); + expect(true).assertEqual(DescriptorWriteReq !=null); + } + let gattServer = bluetooth.BLE.createGattServer(); + gattServer.on("descriptorWrite", WriteDescriptorReq); + gattServer.off("descriptorWrite"); + done() + }) + + /** * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_NotifyCharacteristic_0100 * @tc.name testSetNotifyCharacteristicChanged * @tc.desc Test SetNotifyCharacteristicChanged api. @@ -643,7 +816,7 @@ describe('bluetoothBLETest', function() { * @tc.desc Test SetNotifyCharacteristicChanged api. * @tc.size MEDIUM * @tc.type Function - * @tc.level Level 2 + * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0300', 0, async function (done) { let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); @@ -653,6 +826,66 @@ describe('bluetoothBLETest', function() { done(); }) + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_NotifyCharacteristic_0400 + * @tc.name test BLECharacteristicChangeON + * @tc.desc Test On and off api. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0400', 0, async function (done) { + let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); + function CharacteristicChange(CharacteristicChangeReq) { + let serviceUuid = CharacteristicChangeReq.serviceUuid; + let characteristicUuid = CharacteristicChangeReq.characteristicUuid; + let value = new Uint8Array(CharacteristicChangeReq.characteristicValue); + expect(true).assertEqual(CharacteristicChangeReq !=null); + } + gattClient.on('BLECharacteristicChange', CharacteristicChange); + let descriptors = []; + let arrayBuffer = new ArrayBuffer(8); + let desValue = new Uint8Array(arrayBuffer); + desValue[0] = 11; + let arrayBufferNotify = new ArrayBuffer(8); + let descNotifyValue = new Uint8Array(arrayBufferNotify); + descNotifyValue[0] = 1 + let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', + descriptorValue: arrayBuffer}; + let descriptorNotify = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', + descriptorValue: arrayBufferNotify}; + descriptors[0] = descriptor; + descriptors[1] = descriptorNotify; + let arrayBufferCCC = new ArrayBuffer(8); + let cccValue = new Uint8Array(arrayBufferCCC); + cccValue[0] = 1; + let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', + characteristicValue: arrayBufferCCC, descriptors:descriptors}; + let ret = gattClient.setNotifyCharacteristicChanged(characteristic, false); + expect(ret).assertEqual(false); + gattClient.off('BLECharacteristicChange'); + done(); + }) + + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_NotifyCharacteristic_0300 + * @tc.name testSetNotifyCharacteristicChanged + * @tc.desc Test SetNotifyCharacteristicChanged api. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BLE_GattClose_0100', 0, async function (done) { + let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); + let ret = gattClient.close(); + console.info('[bluetooth_js] gattClient close ret:' + ret); + expect(ret).assertEqual(true); + done(); + }) + }) } diff --git a/communication/bluetooth_ble/src/main/js/test/BleService.test.js b/communication/bluetooth_ble/src/main/js/test/BleService.test.js index 914327d160e1cda649d33bd199581d21e00efac6..277795b8ab96bb65c50f15e60fba549d8c3c33ae 100644 --- a/communication/bluetooth_ble/src/main/js/test/BleService.test.js +++ b/communication/bluetooth_ble/src/main/js/test/BleService.test.js @@ -67,555 +67,36 @@ describe('bluetoothBLETest1', function() { gattServer.close(); }) - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0100 - * @tc.name testgetRssiValue - * @tc.desc Test getRssiValue api by promise. - * @tc.size MEDIUM - * @ since 7 - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0100', 0, async function (done) { - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let ret = gattClient.connect(); - console.info('[bluetooth_js] gattClient getrssi2 connect' + JSON.stringify(ret)) - expect(ret).assertTrue(); - await gattClient.getRssiValue().then((data) => { - console.info('[bluetooth_js] BLE read rssi ' + JSON.stringify(data)); - let rssiLength = Object.keys(data).length; - expect(rssiLength).assertEqual(0); - }).catch(err => { - console.error('bluetooth getRssiValue has error: '+ err); - expect(true).assertEqual(true); - }); - let disconnect = gattClient.disconnect(); - console.info('[bluetooth_js] gatt getrssi2 disconnect:' + disconnect); - expect(disconnect).assertEqual(false); - done(); - }) - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0200 - * @tc.name testgetRssiValue - * @tc.desc Test testGetDeviceName api by callback. - * @tc.size MEDIUM - * @ since 7 - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_GetRssiValue_0200', 0, async function (done) { - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let ret = gattClient.connect(); - console.info('[bluetooth_js] gattClient getRssi connect' + JSON.stringify(ret)) - expect(ret).assertTrue(); - gattClient.getRssiValue((err, data)=> { - console.info('[bluetooth_js]getRssi value:'+JSON.stringify(data)); - expect(data).assertNull(); - let disconnect = gattClient.disconnect(); - console.info('[bluetooth_js] gatt getrssi1 disconnect:' + disconnect); - expect(disconnect).assertEqual(false); - }); - await sleep(2000); - done(); - }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GetDeviceName_0100 - * @tc.name testGetDeviceName - * @tc.desc Test GetDeviceName api by promise. + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_Connect_0100 + * @tc.name test Server connectStateChange + * @tc.desc Test on and off api . * @tc.size MEDIUM * @ since 7 * @tc.type Function * @tc.level Level 2 */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_GetDeviceName_0100', 0, async function (done) { - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let ret = gattClient.connect(); - console.info('[bluetooth_js] gattClient getname2 connect' + JSON.stringify(ret)) - expect(ret).assertTrue(); - await gattClient.getDeviceName().then((data) => { - console.info('[bluetooth_js] device name' + JSON.stringify(data)) - expect(data).assertNull(); - }).catch(err => { - console.error('bluetooth getDeviceName has error: '+ err); - expect(true).assertEqual(true); - }); - let disconnect = gattClient.disconnect(); - console.info('[bluetooth_js] gatt getname2 disconnect:' + disconnect); - expect(disconnect).assertEqual(false); - done(); - }) - - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_getDeviceName_0200 - * @tc.name testGetDeviceName - * @tc.desc Test testGetDeviceName api by callback. - * @tc.size MEDIUM - * @ since 7 - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_GetDeviceName_0200', 0, async function (done) { + it('SUB_COMMUNICATION_BLUETOOTH_BLE_Connect_0100', 0, async function (done) { + function Connected(BLEConnectChangedState) { + let deviceId = BLEConnectChangedState.deviceId; + let status = BLEConnectChangedState.state; + console.info("[bluetooth_js] connectStateChange jsondata:" + +'deviceId:' + deviceId + 'status:' + status); + expect(true).assertEqual(BLEConnectChangedState !=null); + } + + let gattServer = bluetooth.BLE.createGattServer(); + await gattServer.on("connectStateChange", Connected); let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); let ret = gattClient.connect(); - console.info('[bluetooth_js] gattClient getname1 connect' + JSON.stringify(ret)) - expect(ret).assertTrue(); - gattClient.getDeviceName((err, data)=> { - console.info('[bluetooth_js]getname value:'+JSON.stringify(data)); - expect(data).assertNull(); - let disconnect = gattClient.disconnect(); - console.info('[bluetooth_js] gatt getname1 disconnect:' + disconnect); - expect(disconnect).assertEqual(false); - }); await sleep(2000); - done(); - }) - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GetService_0100 - * @tc.name testGetServices - * @tc.desc Test GetServices api by promise. - * @tc.size MEDIUM - * @ since 7 - * @tc.type Function - * @tc.level Level 3 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_GetService_0100', 0, async function (done) { - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let ret = gattClient.connect(); - console.info('[bluetooth_js]gattClient getservices1 connect' + JSON.stringify(ret)) + console.info('[bluetooth_js] gattClient connect' + ret) expect(ret).assertTrue(); - await gattClient.getServices().then((GattService) => { - console.info('[bluetooth_js] getServices successfully:'+JSON.stringify(GattService)); - expect(GattService).assertNull(); - }).catch(err => { - console.error('[bluetooth_js] getServices has error:'+ JSON.stringify(err)); - expect(true).assertEqual(true); - }); - let disconnect = gattClient.disconnect(); - console.info('[bluetooth_js] gatt getservices1 disconnect:' + disconnect); - expect(disconnect).assertEqual(false); - done(); - }) - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_GetService_0200 - * @tc.name testGetServices - * @tc.desc Test GetServices api by callback. - * @tc.size MEDIUM - * @ since 7 - * @tc.type Function - * @tc.level Level 3 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_GetService_0200', 0, async function (done) { - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let ret = gattClient.connect(); - console.info('[bluetooth_js]gattClient getservices2 connect' + JSON.stringify(ret)) - gattClient.getServices((code, data)=> { - if(code.code==0){ - console.info("bluetooth services size is ", data.length) - expect(true).assertEqual(data.length >= 0); - } else { - console.info('[bluetooth_js] get services code ' + JSON.stringify(code)); - expect(true).assertEqual(code.code == -1); - } - let disconnect = gattClient.disconnect(); - console.info('[bluetooth_js] gatt getservices1 disconnect:' + disconnect); - expect(disconnect).assertEqual(false); - }); - done(); - }) - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0100 - * @tc.name testSetBLEMtuSize - * @tc.desc Test SetBLEMtuSize api. - * @tc.size MEDIUM - * @ since 7 - * @tc.type Function - * @tc.level Level 1 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0100', 0, function () { - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let ret = gattClient.setBLEMtuSize(100); - console.info('[bluetooth_js] bluetooth setBLEMtuSize 128bit ret:' + ret); - expect(ret).assertEqual(false); - }) - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0200 - * @tc.name testSetBLEMtuSize - * @tc.desc Test SetBLEMtuSize api. - * @tc.size MEDIUM - * @ since 7 - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0200', 0, function () { - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let ret = gattClient.setBLEMtuSize(22); - console.info('[bluetooth_js] bluetooth setBLEMtuSize 128bit ret:' + ret); - expect(ret).assertEqual(false); - }) - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0300 - * @tc.name testSetBLEMtuSize - * @tc.desc Test SetBLEMtuSize api. - * @tc.size MEDIUM - * @ since 7 - * @tc.type Function - * @tc.level Level 3 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0300', 0, function () { - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let ret = gattClient.setBLEMtuSize(21); - console.info('[bluetooth_js] bluetooth setBLEMtuSize 128bit ret:' + ret); - expect(ret).assertEqual(false); - }) - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0400 - * @tc.name testSetBLEMtuSize - * @tc.desc Test SetBLEMtuSize api. - * @tc.size MEDIUM - * @ since 7 - * @tc.type Function - * @tc.level Level 1 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0400', 0, function () { - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let ret = gattClient.setBLEMtuSize(512); - console.info('[bluetooth_js] bluetooth setBLEMtuSize 128bit ret:' + ret); - expect(ret).assertEqual(false); - }) - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0500 - * @tc.name testSetBLEMtuSize - * @tc.desc Test SetBLEMtuSize api. - * @tc.size MEDIUM - * @ since 7 - * @tc.type Function - * @tc.level Level 3 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_MtuSize_0500', 0, function () { - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let ret = gattClient.setBLEMtuSize(513); - console.info('[bluetooth_js] bluetooth setBLEMtuSize 128bit ret:' + ret); - expect(ret).assertEqual(false); - }) - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0100 - * @tc.name testReadDescriptorValue - * @tc.desc Test ReadDescriptorValue api by promise. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0100', 0, async function (done) { - let descriptors = []; - let arrayBuffer = new ArrayBuffer(8); - let desValue = new Uint8Array(arrayBuffer); - desValue[0] = 11; - let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; - descriptors[0] = descriptor; - let arrayBufferCCC = new ArrayBuffer(8); - let cccValue = new Uint8Array(arrayBufferCCC); - cccValue[0] = 32; - let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', - characteristicValue: arrayBufferCCC, descriptors:descriptors}; - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - await gattClient.readCharacteristicValue(characteristic).then((object) => { - if (object != null) { - console.error('bluetooth readCharacteristicValue promise object :' - +JSON.stringify(object)); - expect(true).assertEqual(true); - } else { - console.info('[bluetooth_js] readCharacValue promise null:' + JSON.stringify(object)); - expect(null).assertFail(); - } - done(); - }).catch(error => { - console.error('[bluetooth_js] readCharacteristicValue promise has error:' - +JSON.stringify(error)); - expect(true).assertEqual(true); - done(); - }) - }) - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0200 - * @tc.name testReadDescriptorValue - * @tc.desc Test ReadDescriptorValue api by callback. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_ReadCharacteristic_0200', 0, async function(done) { - function readCcc(code, BLECharacteristic) { - if (code.code != 0) { - return; - } - console.log('bluetooth characteristic uuid:'+ BLECharacteristic.characteristicUuid); - let value = new Uint8Array(BLECharacteristic.characteristicValue); - console.log('bluetooth characteristic value: ' - + value[0] +','+ value[1]+','+ value[2]+','+ value[3]); - } - let arrayBuffer = new ArrayBuffer(8); - let desValue = new Uint8Array(arrayBuffer); - desValue[0] = 11; - let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue:arrayBuffer}; - let arrayBufferCCC = new ArrayBuffer(8); - let cccValue = new Uint8Array(arrayBufferCCC); - cccValue[0] = 32; - let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', - characteristicValue: arrayBufferCCC, descriptors:descriptor}; - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let data = await gattClient.readCharacteristicValue(characteristic,readCcc); - console.log('[bluetooth_js] readCharacteristicValue callback: ' + JSON.stringify(data)) - expect(true).assertEqual(data==null); + await gattServer.off("connectStateChange"); done() }) - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0100 - * @tc.name testReadDescriptorValue - * @tc.desc Test ReadDescriptorValue api by promise. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0100', 0, async function (done) { - let arrayBuffer = new ArrayBuffer(8); - let desValue = new Uint8Array(arrayBuffer); - desValue[0] = 11; - let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - await gattClient.readDescriptorValue(descriptor).then((object) => { - if (object != null) { - console.error('readDescriptorValue promise object:'+JSON.stringify(object)); - expect(true).assertEqual(true); - - } else { - console.info('[bluetooth_js]readDescriptorValue null:' + JSON.stringify(object)); - expect(null).assertFail(); - } - done(); - }).catch(error => { - console.error('[bluetooth_js]readDescriptorValue promise error:'+JSON.stringify(error)); - expect(true).assertEqual(true); - done(); - }) - }) - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0200 - * @tc.name testReadDescriptorValue - * @tc.desc Test ReadDescriptorValue api by callback. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_ReadDescriptor_0200', 0, async function (done) { - function readDesc(code, BLEDescriptor) { - if (code.code != 0) { - console.info('[bluetooth_js] descriptor code: ' + BLEDescriptor.descriptorUuid); - return; - } - console.info('[bluetooth_js] descriptor uuid: ' + BLEDescriptor.descriptorUuid); - let value = new Uint8Array(BLEDescriptor.descriptorValue); - console.info('[bluetooth_js] descriptor value: ' - + value[0] +','+ value[1]+','+ value[2]+','+ value[3]); - } - let arrayBuffer = new ArrayBuffer(8); - let desValue = new Uint8Array(arrayBuffer); - desValue[0] = 11; - let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let data1 = await gattClient.readDescriptorValue(descriptor,readDesc); - console.log('[bluetooth_js] readDescriptorValue callback: ' + JSON.stringify(data1)) - expect(true).assertEqual(data1==null); - done() - }) - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0100 - * @tc.name testWriteCharacteristicValue - * @tc.desc Test Client WriteCharacteristicValue api. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0100', 0, function () { - let descriptors = []; - let arrayBuffer = new ArrayBuffer(8); - let desValue = new Uint8Array(arrayBuffer); - desValue[0] = 11; - let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; - descriptors[0] = descriptor; - let arrayBufferCCC = new ArrayBuffer(8); - let cccValue = new Uint8Array(arrayBufferCCC); - cccValue[0] = 32; - let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', - characteristicValue: arrayBufferCCC, descriptors:descriptors}; - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let ret = gattClient.writeCharacteristicValue(characteristic); - console.info('[bluetooth_js] writeCharacteristicValue ret : ' + ret); - expect(ret).assertEqual(false); - }) - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0200 - * @tc.name testWriteCharacteristicValue - * @tc.desc Test Client WriteCharacteristicValue api. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 3 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_WriteCharacteristic_0200', 0, function () { - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let ret = gattClient.writeCharacteristicValue("123"); - console.info('[bluetooth_js] invaild writeCharacteristicValue ret : ' + ret); - expect(ret).assertEqual(false); - }) - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0100 - * @tc.name testWriteDescriptorValue - * @tc.desc Test Client WriteDescriptorValue api. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0100', 0, function () { - let arrayBuffer = new ArrayBuffer(8); - let desValue = new Uint8Array(arrayBuffer); - desValue[0] = 11; - let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let ret = gattClient.writeDescriptorValue(descriptor); - console.info('[bluetooth_js] bluetooth writeDescriptorValue ret : ' + ret); - expect(ret).assertEqual(false); - }) - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0200 - * @tc.name testWriteDescriptorValue - * @tc.desc Test WriteDescriptorValue api. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 3 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_WriteDescriptor_0200', 0, function () { - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let ret = gattClient.writeDescriptorValue(""); - console.info('[bluetooth_js] bluetooth writeDescriptorValue ret : ' + ret); - expect(ret).assertEqual(false); - }) - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_NotifyCharacteristic_0100 - * @tc.name testSetNotifyCharacteristicChanged - * @tc.desc Test SetNotifyCharacteristicChanged api. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0100', 0, async function (done) { - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let descriptors = []; - let arrayBuffer = new ArrayBuffer(8); - let desValue = new Uint8Array(arrayBuffer); - desValue[0] = 11; - let arrayBufferNotify = new ArrayBuffer(8); - let descNotifyValue = new Uint8Array(arrayBufferNotify); - descNotifyValue[0] = 1 - let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', - descriptorValue: arrayBuffer}; - let descriptorNotify = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', - descriptorValue: arrayBufferNotify}; - descriptors[0] = descriptor; - descriptors[1] = descriptorNotify; - let arrayBufferCCC = new ArrayBuffer(8); - let cccValue = new Uint8Array(arrayBufferCCC); - cccValue[0] = 1; - let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', - characteristicValue: arrayBufferCCC, descriptors:descriptors}; - let ret = gattClient.setNotifyCharacteristicChanged(characteristic, true); - console.info('[bluetooth_js] setNotifyCharacteristicChanged ret:' + ret); - expect(ret).assertEqual(false); - done(); - }) - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_NotifyCharacteristic_0200 - * @tc.name testSetNotifyCharacteristicChanged - * @tc.desc Test SetNotifyCharacteristicChanged api. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0200', 0, async function(done) { - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let descriptors = []; - let arrayBuffer = new ArrayBuffer(8); - let desValue = new Uint8Array(arrayBuffer); - desValue[0] = 11; - let arrayBufferNotify = new ArrayBuffer(8); - let descNotifyValue = new Uint8Array(arrayBufferNotify); - descNotifyValue[0] = 1 - let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', - descriptorValue: arrayBuffer}; - let descriptorNotify = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', - descriptorValue: arrayBufferNotify}; - descriptors[0] = descriptor; - descriptors[1] = descriptorNotify; - let arrayBufferCCC = new ArrayBuffer(8); - let cccValue = new Uint8Array(arrayBufferCCC); - cccValue[0] = 1; - let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', - characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', - characteristicValue: arrayBufferCCC, descriptors:descriptors}; - let ret = gattClient.setNotifyCharacteristicChanged(characteristic, false); - console.info('[bluetooth_js] setNotifyCharacteristicChanged ret:' + ret); - expect(ret).assertEqual(false); - done(); - }) - - /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_NotifyCharacteristic_0300 - * @tc.name testSetNotifyCharacteristicChanged - * @tc.desc Test SetNotifyCharacteristicChanged api. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNICATION_BLUETOOTH_BLE_SetNotifyCharacteristic_0300', 0, async function (done) { - let gattClient = bluetooth.BLE.createGattClientDevice("11:22:33:44:55:66"); - let ret = gattClient.setNotifyCharacteristicChanged(null, false); - console.info('[bluetooth_js] setNotifyCharacteristicChanged is null ret:' + ret); - expect(ret).assertEqual(false); - done(); - }) - /** * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_AddService_0100 * @tc.name testAddService @@ -631,9 +112,9 @@ describe('bluetoothBLETest1', function() { let ret = gattServer.addService(service); console.info('[bluetooth_js] bluetooth addService characteristics is null result:' + ret); expect(ret).assertTrue(); - await sleep(3000); + await sleep(1000); let ret1=gattServer.removeService('00001810-0000-1000-8000-00805F9B34FB'); - await sleep(3000); + await sleep(1000); console.info('[bluetooth_js]removeService ret:'+ret1); expect(ret1).assertTrue(); done(); @@ -737,7 +218,7 @@ describe('bluetoothBLETest1', function() { cccV[0] = 1; let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', - characteristicValue: arrayBufferC, descriptors:[]}; + characteristicValue: arrayBufferC}; characteristics[0] = characteristic; let gattService = {serviceUuid:'00001810-0000-1000-8000-00805F9B34FB', isPrimary: true, characteristics:characteristics, includeServices:[]}; @@ -1022,9 +503,9 @@ describe('bluetoothBLETest1', function() { let ret = gattServer.addService(gattService); console.info('[bluetooth_js] bluetooth addService null characteristicValue result : ' + ret); expect(ret).assertFalse(); - await sleep(2000); + await sleep(1000); let ret1=gattServer.removeService('00001810-0000-1000-8000-00805F9B34FB'); - console.info('[bluetooth_js]removeService ret:'+ret1); + console.info('[bluetooth_js]removeService ret:'+ ret1); expect(ret1).assertFalse(); done(); }) @@ -1060,7 +541,7 @@ describe('bluetoothBLETest1', function() { let ret = gattServer.addService(gattService); console.info('[bluetooth_js] bluetooth addService null descriptorValue result : ' + ret); expect(ret).assertFalse(); - await sleep(2000); + await sleep(1000); let ret1=gattServer.removeService('00001810-0000-1000-8000-00805F9B34FB'); console.info('[bluetooth_js]removeService ret:'+ret1); expect(ret1).assertFalse(); @@ -1087,7 +568,7 @@ describe('bluetoothBLETest1', function() { let retN = gattServer.addService(gattService1); console.info('[bluetooth_js] bluetooth addService2 result : ' + retN); expect(retN).assertTrue(); - await sleep(2000); + await sleep(1000); let ret1=gattServer.removeService('00001888-0000-1000-8000-00805f9b34fb'); console.info('[bluetooth_js]removeService ret:'+ret1); expect(ret1).assertTrue(); @@ -1147,7 +628,7 @@ describe('bluetoothBLETest1', function() { console.info('[bluetooth_js]removeService ret:'+ret1); expect(ret1).assertTrue(); let ret2=gattServer.removeService('00001810-0000-1000-8000-00805F9B34FB'); - await sleep(2000); + await sleep(1000); console.info('[bluetooth_js]removeService ret:'+ret2); expect(ret2).assertFalse(); done(); @@ -1230,7 +711,7 @@ describe('bluetoothBLETest1', function() { }) /** - * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_sendResponse_0200 + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_sendResponse_0100 * @tc.name testSendResponse success * @tc.desc Test SendResponse api. * @tc.size MEDIUM @@ -1249,6 +730,26 @@ describe('bluetoothBLETest1', function() { done(); }) + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BLE_sendResponse_0200 + * @tc.name testSendResponse success + * @tc.desc Test SendResponse api. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 1 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BLE_sendResponse_0200', 0, async function (done) { + let arrayBuffer = new ArrayBuffer(8); + let value = new Uint8Array(arrayBuffer); + value[0] = 1; + let ServerResponse = {deviceId: '00:11:22:33:44:55', transId: 1, + status: -1, offset: 0, value: arrayBuffer}; + let ret = gattServer.sendResponse(ServerResponse); + console.info('[bluetooth_js] sendResponse ret : ' + ret); + expect(ret).assertEqual(false); + done(); + }) + }) } diff --git a/communication/bluetooth_on/BUILD.gn b/communication/bluetooth_on/BUILD.gn index d29d25d54bad216a86562d0794c9403f390115f8..ff4368703f2ce3b382d744c7d4583490b317dee5 100644 --- a/communication/bluetooth_on/BUILD.gn +++ b/communication/bluetooth_on/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("ActsBluetoothOnJsTest") { diff --git a/communication/bluetooth_on/src/main/config.json b/communication/bluetooth_on/src/main/config.json index 9175146c5f6ad96816a2fd65537b4d78a755b4e7..bfb89e51a16507b2878db06a035b3745ee27e588 100644 --- a/communication/bluetooth_on/src/main/config.json +++ b/communication/bluetooth_on/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.communication.bluetooth.bluetoothhost", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/communication/bluetooth_on/src/main/js/test/BleScanResult.test.js b/communication/bluetooth_on/src/main/js/test/BleScanResult.test.js index ea57acb1ad84f029ec5a390029cf50027d851c31..ac5f196886d718efed4a182210abf2c05ad6a13e 100644 --- a/communication/bluetooth_on/src/main/js/test/BleScanResult.test.js +++ b/communication/bluetooth_on/src/main/js/test/BleScanResult.test.js @@ -475,7 +475,7 @@ describe('bluetoothhostTest', function() { }]); await sleep(1000); console.info('[bluetooth_js] BLE scan off14 '); - bluetooth.BLE.off('BLEDeviceFind'); + bluetooth.BLE.stopBLEScan(); bluetooth.BLE.off('BLEDeviceFind', onReceiveEvent); done(); diff --git a/communication/bluetooth_on/src/main/js/test/BluetoothOn.test.js b/communication/bluetooth_on/src/main/js/test/BluetoothOn.test.js deleted file mode 100644 index c0b4e38c021fe15ccca5ff457a3062dd38a41991..0000000000000000000000000000000000000000 --- a/communication/bluetooth_on/src/main/js/test/BluetoothOn.test.js +++ /dev/null @@ -1,500 +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 bluetooth from '@ohos.bluetooth'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' - -let MajorMinorClass = { - COMPUTER_UNCATEGORIZED : 0x0100, - COMPUTER_DESKTOP : 0x0104, - COMPUTER_SERVER : 0x0108, - COMPUTER_LAPTOP : 0x010C, - COMPUTER_HANDHELD_PC_PDA : 0x0110, - COMPUTER_PALM_SIZE_PC_PDA : 0x0114, - COMPUTER_WEARABLE : 0x0118, - COMPUTER_TABLET : 0x011C, - PHONE_UNCATEGORIZED : 0x0200, - PHONE_CELLULAR : 0x0204, - PHONE_CORDLESS : 0x0208, - PHONE_SMART : 0x020C, - PHONE_MODEM_OR_GATEWAY : 0x0210, - PHONE_ISDN : 0x0214, - NETWORK_FULLY_AVAILABLE : 0x0300, - NETWORK_1_TO_17_UTILIZED : 0x0320, - NETWORK_17_TO_33_UTILIZED : 0x0340, - NETWORK_33_TO_50_UTILIZED : 0x0360, - NETWORK_60_TO_67_UTILIZED : 0x0380, - NETWORK_67_TO_83_UTILIZED : 0x03A0, - NETWORK_83_TO_99_UTILIZED : 0x03C0, - NETWORK_NO_SERVICE : 0x03E0, - AUDIO_VIDEO_UNCATEGORIZED : 0x0400, - AUDIO_VIDEO_WEARABLE_HEADSET : 0x0404, - AUDIO_VIDEO_HANDSFREE : 0x0408, - AUDIO_VIDEO_MICROPHONE : 0x0410, - AUDIO_VIDEO_LOUDSPEAKER : 0x0414, - AUDIO_VIDEO_HEADPHONES : 0x0418, - AUDIO_VIDEO_PORTABLE_AUDIO : 0x041C, - AUDIO_VIDEO_CAR_AUDIO : 0x0420, - AUDIO_VIDEO_SET_TOP_BOX : 0x0424, - AUDIO_VIDEO_HIFI_AUDIO : 0x0428, - AUDIO_VIDEO_VCR : 0x042C, - AUDIO_VIDEO_VIDEO_CAMERA : 0x0430, - AUDIO_VIDEO_CAMCORDER : 0x0434, - AUDIO_VIDEO_VIDEO_MONITOR : 0x0438, - AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER : 0x043C, - AUDIO_VIDEO_VIDEO_CONFERENCING : 0x0440, - AUDIO_VIDEO_VIDEO_GAMING_TOY : 0x0448, - PERIPHERAL_NON_KEYBOARD_NON_POINTING : 0x0500, - PERIPHERAL_KEYBOARD : 0x0540, - PERIPHERAL_POINTING_DEVICE : 0x0580, - PERIPHERAL_KEYBOARD_POINTING : 0x05C0, - PERIPHERAL_UNCATEGORIZED : 0x0500, - PERIPHERAL_JOYSTICK : 0x0504, - PERIPHERAL_GAMEPAD : 0x0508, - PERIPHERAL_REMOTE_CONTROL : 0x05C0, - PERIPHERAL_SENSING_DEVICE : 0x0510, - PERIPHERAL_DIGITIZER_TABLET : 0x0514, - PERIPHERAL_CARD_READER : 0x0518, - PERIPHERAL_DIGITAL_PEN : 0x051C, - PERIPHERAL_SCANNER_RFID : 0x0520, - PERIPHERAL_GESTURAL_INPUT : 0x0522, - IMAGING_UNCATEGORIZED : 0x0600, - IMAGING_DISPLAY : 0x0610, - IMAGING_CAMERA : 0x0620, - IMAGING_SCANNER : 0x0640, - IMAGING_PRINTER : 0x0680, - WEARABLE_UNCATEGORIZED : 0x0700, - WEARABLE_WRIST_WATCH : 0x0704, - WEARABLE_PAGER : 0x0708, - WEARABLE_JACKET : 0x070C, - WEARABLE_HELMET : 0x0710, - WEARABLE_GLASSES : 0x0714, - TOY_UNCATEGORIZED : 0x0800, - TOY_ROBOT : 0x0804, - TOY_VEHICLE : 0x0808, - TOY_DOLL_ACTION_FIGURE : 0x080C, - TOY_CONTROLLER : 0x0810, - TOY_GAME : 0x0814, - HEALTH_UNCATEGORIZED : 0x0900, - HEALTH_BLOOD_PRESSURE : 0x0904, - HEALTH_THERMOMETER : 0x0908, - HEALTH_WEIGHING : 0x090C, - HEALTH_GLUCOSE : 0x0910, - HEALTH_PULSE_OXIMETER : 0x0914, - HEALTH_PULSE_RATE : 0x0918, - HEALTH_DATA_DISPLAY : 0x091C, - HEALTH_STEP_COUNTER : 0x0920, - HEALTH_BODY_COMPOSITION_ANALYZER : 0x0924, - HEALTH_PEAK_FLOW_MOITOR : 0x0928, - HEALTH_MEDICATION_MONITOR : 0x092C, - HEALTH_KNEE_PROSTHESIS : 0x0930, - HEALTH_ANKLE_PROSTHESIS : 0x0934, - HEALTH_GENERIC_HEALTH_MANAGER : 0x0938, - HEALTH_PERSONAL_MOBILITY_DEVICE : 0x093C, - HEALTH_PERSONAL_MOBILITY_DEVICE : 0x093C -}; - -let ScanDuty= - { - SCAN_MODE_LOW_POWER : 0, - SCAN_MODE_BALANCED : 1, - SCAN_MODE_LOW_LATENCY : 2, - }; - -let MatchMode= - { - MATCH_MODE_AGGRESSIVE : 1, - MATCH_MODE_STICKY : 2, - }; - - -export default function bluetoothTEST() { -describe('bluetoothTEST', function() { - - let gattServer = null; - let gattClient = null; - beforeAll(function () { - console.info('beforeAll called') - gattServer = bluetooth.BLE.createGattServer(); - gattClient = bluetooth.BLE.createGattClientDevice("00:00:00:00:00:00"); - }) - beforeEach(function () { - console.info('beforeEach called') - - }) - afterEach(function () { - console.info('afterEach called') - }) - afterAll(function () { - console.info('afterAll called') - }) - - function sleep(delay) { - return new Promise(resovle => setTimeout(resovle, delay)) - } - - async function tryToEnableBt() { - let sta = bluetooth.getState(); - switch(sta){ - case 0: - console.info('[bluetooth_js] bt turn off:'+ JSON.stringify(sta)); - bluetooth.enableBluetooth(); - await sleep(3000); - break; - case 1: - console.info('[bluetooth_js] bt turning on:'+ JSON.stringify(sta)); - await sleep(3000); - break; - case 2: - console.info('[bluetooth_js] bt turn on:'+ JSON.stringify(sta)); - break; - case 3: - console.info('[bluetooth_js] bt turning off:'+ JSON.stringify(sta)); - bluetooth.enableBluetooth(); - await sleep(3000); - break; - default: - console.info('[bluetooth_js] enable success'); - } - } - - - /** - * @tc.number SUB_COMMUNACATION_bluetooth_PAIR_DEVICE_0002 - * @tc.name testClassicPairDevice - * @tc.desc Test ClassicPairDevice api. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNACATION_bluetooth_PAIR_DEVICE_0002', 0, async function (done) { - console.info('[bluetooth_js] pair device start'); - await tryToEnableBt(); - await bluetooth.BLE.on('bondStateChange', result => { - console.info("[bluetooth_js] bondStateChange on:" + JSON.stringify(result) - +'bondStateChange deviceId:' + data.deviceId + 'bondStateChange state:' + data.state); - expect(true).assertEqual(result !=null); - done(); - }); - let BondState= - { - BOND_STATE_INVALID : 0, - BOND_STATE_BONDING : 1, - BOND_STATE_BONDED : 2 - }; - - expect(BondState.BOND_STATE_INVALID == 0).assertTrue(); - expect(BondState.BOND_STATE_BONDING == 1).assertTrue(); - expect(BondState.BOND_STATE_BONDED == 2).assertTrue(); - bluetooth.BLE.off('bondStateChange', result => { - expect(true).assertEqual(true); - done(); - }); - }) - - /** - * @tc.number SUB_COMMUNACATION_bluetoothble_CHARAC_READ_ON_0001 - * @tc.name testonCharacteristicReadOn - * @tc.desc Test CharacteristicReadOn api . - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNACATION_bluetoothble_CHARAC_READ_ON_0001', 0, async function (done) { - try { - await tryToEnableBt(); - console.info('[bluetooth_js] CharacteristicReadOn test start'); - gattServer.on('characteristicRead', function (data) { - console.info('[bluetooth_js] CharRedReq deviceId: ' + data.deviceId + - 'transId:' + data.transId + 'offset:' + data.offset + 'charUuid:' + - data.characteristicUuid + 'serviceUuid:' + data.serviceUuid); - let serverResponse = { - "deviceId": data.deviceId, - "transId": data.transId, - "status": 0, - "offset": data.offset, - "value": str2ab("characteristic read response", data.offset), - }; - let result = gattServer.sendResponse(serverResponse); - expect(JSON.stringify(result)).assertContain("true"); - }); - }catch(e) { - expect(null).assertFail(); - } - try { - console.info('[bluetooth_js] characteristicRead test1 start'); - gattServer.off('characteristicRead', function (data) { - console.info("[bluetooth_js] charaRead off data:" + JSON.stringify(data)); - expect(true).assertEqual(true); - }); - }catch(e) { - expect(null).assertFail(); - } - done(); - }) - - - /** - * @tc.number SUB_COMMUNACATION_bluetoothble_CHARAC_WRITE_ON_0001 - * @tc.name testonCharacteristicwriteOn - * @tc.desc Test CharacteristicwriteOn api . - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNACATION_bluetoothble_CHARAC_WRITE_ON_0001', 0, async function (done) { - try { - await tryToEnableBt(); - console.info('[bluetooth_js] CharacteristicwriteOn test start'); - gattServer.on('characteristicWrite', function (data) { - console.info('[bluetooth_js] CharWriReq deviceId: ' + data.deviceId + - 'transId:' + data.transId + 'offset:' + data.offset + 'isPrep:' + data.isPrep + - 'charUuid:' + data.characteristicUuid + 'serviceUuid:' + data.serviceUuid + - 'value:' + data.value + 'needRsp' + data.needRsp); - if (data.value instanceof ArrayBuffer) { - console.log(`[bluetooth_js] value: ${ab2hex(data.value)}`) - } - if (data.needRsp == false) { - return; - } - console.log(`data.value is ArraryBuffer: ${ab2hex(data.value)}`) - let serverResponse = { - "deviceId": data.deviceId, - "transId": data.transId, - "status": 0, - "offset": data.offset, - "value": data.value, - }; - let result = gattServer.sendResponse(serverResponse); - expect(JSON.stringify(result)).assertContain("true"); - }); - }catch(e) { - expect(null).assertFail(); - } - try { - console.info('[bluetooth_js] characteristicWrite test1 start'); - gattServer.off('characteristicWrite', function (data) { - console.info("[bluetooth_js] charaWrite off data2:" + JSON.stringify(data)); - expect(true).assertEqual(true); - }); - }catch(e) { - expect(null).assertFail(); - } - done(); - }) - - - /** - * @tc.number SUB_COMMUNACATION_bluetooth_DESC_READ_ON_0001 - * @tc.name testDescriptorReadOn - * @tc.desc Test DescriptorReadOn api . - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNACATION_bluetooth_DESC_READ_ON_0001', 0, async function (done) { - try { - await tryToEnableBt(); - console.info('[bluetooth_js] descriptorReadOn test start ...'); - gattServer.on('descriptorRead', function (data) { - console.info("[bluetooth_js] DesRedon jsondata:" + JSON.stringify(data) + - 'deviceId:' + data.deviceId + 'transId:' + data.transId + 'offset:' + - data.offset +'descriptorUuid:' + data.descriptorUuid + 'characteristicUuid:' + - data.characteristicUuid + 'serviceUuid:' + data.serviceUuid); - expect(true).assertEqual(data !=null); - }); - }catch(e) { - expect(null).assertFail(); - } - try { - console.info('[bluetooth_js] descriptorReadOff test start ...'); - gattServer.off('descriptorRead', function (data) { - expect(true).assertEqual(true); - }); - }catch(e) { - expect(null).assertFail(); - } - done(); - }) - - - /** - * @tc.number SUB_COMMUNACATION_bluetooth_DESC_WRITE_ON_0001 - * @tc.name testDescriptorWriteOn - * @tc.desc Test DescriptorWriteOn api . - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNACATION_bluetooth_DESC_WRITE_ON_0001', 0, async function (done) { - try { - await tryToEnableBt(); - console.info('[bluetooth_js] descriptorWriteOn test start ...'); - gattServer.on('descriptorWrite', function (data) { - console.info("[bluetooth_js] desWriOn jsondata: " + JSON.stringify(data) + - 'deviceId: ' + data.deviceId + 'transId:' + data.transId + 'offset:' + - data.offset +'descriptorUuid:' + data.descriptorUuid + - 'charUuid:' + data.characteristicUuid +'serviceUuid:' + data.serviceUuid + - 'value:' + data.value + 'needRsp' + data.needRsp + 'isPrep:' + data.isPrep ); - expect(true).assertEqual(data !=null); - }); - }catch(e) { - expect(null).assertFail(); - } - try { - console.info('[bluetooth_js] descriptorWriteOff test start ...'); - gattServer.off('descriptorWrite', function (data) { - expect(true).assertTrue(); - }); - }catch(e) { - expect(null).assertFail(); - } - done(); - }) - - - /** - * @tc.number SUB_COMMUNACATION_bluetooth_CONNE_STATE_CHANGE_ON_0001 - * @tc.name testConnectStateChangeOn - * @tc.desc Test ConnectStateChangeOn api . - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNACATION_bluetooth_CONNE_STATE_CHANGE_ON_0001', 0, async function (done) { - try { - await tryToEnableBt(); - console.info('[bluetooth_js] ConnectStateChangeOn test start ...'); - gattServer.on('connectStateChange', function (data) { - console.info("[bluetooth_js] connectStaOn jsonData -> " + JSON.stringify(data) + - 'deviceId: ' + data.deviceId + 'state:'+ data.state); - expect(true).assertEqual(data !=null); - }); - }catch(e) { - expect(null).assertFail(); - } - try { - console.info('[bluetooth_js] ConnectStateChangeOff test start ...'); - gattServer.off('connectStateChange', function (data) { - console.info("[bluetooth_js] connectStateChange_off Data:" + JSON.stringify(data)); - expect(true).assertTrue(); - }); - }catch(e) { - expect(null).assertFail(); - } - done(); - }) - - - /** - * @tc.number SUB_COMMUNACATION_bluetooth_BLE_CHAR_CHANGE_ON_0001 - * @tc.name testBLECharacteristicChangeOn - * @tc.desc Test BLECharacteristicChangeOn api . - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNACATION_bluetooth_BLE_CHAR_CHANGE_ON_0001', 0, async function (done) { - try { - await tryToEnableBt(); - console.info('[bluetooth_js] BLECharacteristicChangeOn test start ...'); - gattClient.on('BLECharacteristicChange', function (data) { - console.info("[bluetooth_js] BLECharacteristicChange data " + JSON.stringify(data)); - expect(true).assertEqual(data !=null); - }); - }catch(e) { - expect(null).assertFail(); - } - try { - console.info('[bluetooth_js] BLECharacteristicChangeOff test start'); - gattClient.off('BLECharacteristicChange', function (data) { - console.info("[bluetooth_js] BLECharcChange_off data-> " + JSON.stringify(data)); - expect(true).assertTrue(); - }); - }catch(e) { - expect(null).assertFail(); - } - done(); - }) - - - /** - * @tc.number SUB_COMMUNACATION_bluetooth_BLE_CONNE_STATE_CHANGE_ON_0001 - * @tc.name testBLEConnectionStateChangeOn - * @tc.desc Test BLEConnectionStateChangeOn api . - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNACATION_bluetooth_BLE_CONNE_STATE_CHANGE_ON_0001', 0, async function (done) { - try { - await tryToEnableBt(); - console.info('[bluetooth_js] BLEConnectionStateChangeOn test start'); - gattClient.on('BLEConnectionStateChange', function (data) { - console.info("[bluetooth_js] BLEConnecStateChange_on data " + JSON.stringify(data) - +'deviceId: ' + data.deviceId + 'state:'+ data.state); - expect(true).assertEqual(data !=null); - }); - }catch(e) { - expect(null).assertFail(); - } - try { - console.info('[bluetooth_js] BLEConnectionStateChangeOff test start'); - gattClient.off('BLEConnectionStateChange', function (data) { - console.info("[bluetooth_js] BLEConneStateChange_off data-> " + JSON.stringify(data)); - expect(true).assertEqual(true); - }); - }catch(e) { - expect(null).assertFail(); - } - done(); - }) - - - /** - * @tc.number SUB_COMMUNACATION_bluetoothble_SPP_READ_ON_0001 - * @tc.name testonsppReadOn - * @tc.desc Test sppReadOn api . - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNACATION_bluetoothble_SPP_READ_ON_0001', 0, async function (done) { - try { - await tryToEnableBt(); - console.info('[bluetooth_js] sppReadOn test start'); - bluetooth.on("sppRead",-1, (result) => { - console.info("[bluetooth_js] sppReadOn json_result -> " + JSON.stringify(result)); - expect(true).assertEqual(result !=null); - }); - }catch(e) { - expect(null).assertFail(); - } - try { - console.info('[bluetooth_js] sppReadOff test start ...'); - bluetooth.off("sppRead",-1, (result) => { - console.info("[bluetooth_js] sppReadOff json_result -> " + JSON.stringify(result)); - expect(true).assertEqual(true); - }); - }catch(e) { - expect(null).assertFail(); - } - done(); - }) - -}) - -} - diff --git a/communication/bluetooth_on/src/main/js/test/BluetoothPair.test.js b/communication/bluetooth_on/src/main/js/test/BluetoothPair.test.js index bf469ef91a3640edfc15edafd393e3a629e6df71..e4d29317b2462e2b539f56229ff30fd774277758 100644 --- a/communication/bluetooth_on/src/main/js/test/BluetoothPair.test.js +++ b/communication/bluetooth_on/src/main/js/test/BluetoothPair.test.js @@ -64,6 +64,22 @@ describe('bluetoothhostTest2', function() { console.info('afterAll called') }) + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0100 + * @tc.name Test pairDevice of use invailded address + * @tc.desc Test pairDevice api + * @tc.size MEDIUM + * @ since 8 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0100', 0, async function (done) { + let result = bluetooth.pairDevice("11:22:55:66:33:44"); + console.info("[bluetooth_js] onStartpair001 -> " + JSON.stringify(result)); + expect(result).assertFalse(); + done() + }) + /** * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0200 * @tc.name testStartpair @@ -75,7 +91,8 @@ describe('bluetoothhostTest2', function() { */ it('SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0200', 0, async function (done) { function PinRequiredParam(data) { - console.info("[bluetooth_js] pinRequired on:" + JSON.stringify(data)); + console.info("[bluetooth_js] pinRequired on:" + + JSON.stringify(data.deviceId)+JSON.stringify(data.pinCode)); bluetooth.setDevicePairingConfirmation(data.deviceId,false); } bluetooth.BLE.on('pinRequired', PinRequiredParam); @@ -179,8 +196,8 @@ describe('bluetoothhostTest2', function() { /** * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0500 - * @tc.name test getRemoteDeviceClass - * @tc.desc Test get getRemoteDeviceClass + * @tc.name test get RemoteDeviceName + * @tc.desc Test getRemoteDeviceName api * @tc.size MEDIUM * @ since 8 * @tc.type Function @@ -195,8 +212,8 @@ describe('bluetoothhostTest2', function() { /** * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0600 - * @tc.name test getPairedDevices - * @tc.desc Test get getPairedDevices + * @tc.name test get PairedDevices + * @tc.desc Test getPairedDevices api * @tc.size MEDIUM * @ since 8 * @tc.type Function @@ -211,8 +228,8 @@ describe('bluetoothhostTest2', function() { /** * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0700 - * @tc.name test pinRequired - * @tc.desc Test pinRequired and setDevicePairing false + * @tc.name Test pinRequired and setDevicePairing false + * @tc.desc Test pinRequired ON api * @tc.size MEDIUM * @ since 8 * @tc.type Function @@ -224,17 +241,17 @@ describe('bluetoothhostTest2', function() { bluetooth.setDevicePairingConfirmation(data.deviceId,false); } bluetooth.BLE.on('pinRequired', PinRequiredParam); - let result = bluetooth.pairDevice("00:00:00:00:00:00"); + let result = bluetooth.pairDevice("11:22:55:66:33:44"); console.info("[bluetooth_js] onStartpair007 -> " + JSON.stringify(result)); - expect(result).assertTrue(); + expect(result).assertFalse(); bluetooth.BLE.off('pinRequired', PinRequiredParam); done() }) /** * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0800 - * @tc.name test pinRequired - * @tc.desc Test pinRequired and setDevicePairing true + * @tc.name Test pinRequired and setDevicePairing true + * @tc.desc Test pinRequired off api * @tc.size MEDIUM * @ since 8 * @tc.type Function @@ -246,13 +263,44 @@ describe('bluetoothhostTest2', function() { bluetooth.setDevicePairingConfirmation(data.deviceId,true); } bluetooth.BLE.on('pinRequired', PinRequiredParam); - let result = bluetooth.pairDevice("00:00:00:00:00:00"); + let result = bluetooth.pairDevice("11:22:55:66:33:44"); console.info("[bluetooth_js] onStartpair008 -> " + JSON.stringify(result)); - expect(result).assertTrue(); + expect(result).assertFalse(); bluetooth.BLE.off('pinRequired', PinRequiredParam); done() }) + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0900 + * @tc.name Test On pair StateChange + * @tc.desc Test bondStateChange ON api + * @tc.size MEDIUM + * @ since 8 + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BR_Pair_0900', 0, async function (done) { + let BondState= + { + BOND_STATE_INVALID : 0, + BOND_STATE_BONDING : 1, + BOND_STATE_BONDED : 2 + }; + function BondStateParam(data) { + console.info("[bluetooth_js] bondStateChange on:" + JSON.stringify(data) + +'bondStateChange deviceId:' + data.deviceId + 'bondStateChange state:' + data.state); + } + bluetooth.BLE.on('bondStateChange', BondStateParam); + let result = bluetooth.pairDevice("11:22:55:66:33:44"); + expect(BondState.BOND_STATE_INVALID == 0).assertTrue(); + expect(BondState.BOND_STATE_BONDING == 1).assertTrue(); + expect(BondState.BOND_STATE_BONDED == 2).assertTrue(); + bluetooth.BLE.off('bondStateChange', BondStateParam); + done() + }) + }) } + + diff --git a/communication/bluetooth_on/src/main/js/test/List.test.js b/communication/bluetooth_on/src/main/js/test/List.test.js index 17ed00c5f3b79a7b30cb923012f7ab665b6c4453..f948ffb08b46c1e6353c922c6072ac4b0fe0a987 100644 --- a/communication/bluetooth_on/src/main/js/test/List.test.js +++ b/communication/bluetooth_on/src/main/js/test/List.test.js @@ -13,15 +13,13 @@ * limitations under the License. */ -import bluetoothTEST from './BluetoothOn.test.js' + import bluetoothhostTest from './BleScanResult.test.js' import bluetoothhostTest2 from './BluetoothPair.test.js' -import bluetoothhostTest1 from './bluetoothProfileAdd.test.js' import bluetoothhostTest4 from './bluetoothSys.test.js' export default function testsuite() { -bluetoothTEST() + bluetoothhostTest() bluetoothhostTest2() -bluetoothhostTest1() bluetoothhostTest4() } diff --git a/communication/bluetooth_on/src/main/js/test/bluetoothProfileAdd.test.js b/communication/bluetooth_on/src/main/js/test/bluetoothProfileAdd.test.js deleted file mode 100644 index a721f3ef861e9cf2fc7fbc8271bc7552e67cf875..0000000000000000000000000000000000000000 --- a/communication/bluetooth_on/src/main/js/test/bluetoothProfileAdd.test.js +++ /dev/null @@ -1,97 +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 bluetooth from '@ohos.bluetooth'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' - -export default function bluetoothhostTest1() { -describe('bluetoothhostTest1', function() { - - beforeAll(function () { - console.info('beforeAll called') - }) - beforeEach(function () { - console.info('beforeEach called') - - }) - afterEach(function () { - console.info('afterEach called') - }) - afterAll(function () { - console.info('afterAll called') - }) - - function sleep(delay) { - return new Promise(resovle => setTimeout(resovle, delay)) - } - - async function tryToEnableBt() { - let sta = bluetooth.getState(); - switch(sta){ - case 0: - console.info('[bluetooth_js] bt turn off:'+ JSON.stringify(sta)); - bluetooth.enableBluetooth(); - await sleep(3000); - break; - case 1: - console.info('[bluetooth_js] bt turning on:'+ JSON.stringify(sta)); - await sleep(3000); - break; - case 2: - console.info('[bluetooth_js] bt turn on:'+ JSON.stringify(sta)); - break; - case 3: - console.info('[bluetooth_js] bt turning off:'+ JSON.stringify(sta)); - bluetooth.enableBluetooth(); - await sleep(3000); - break; - default: - console.info('[bluetooth_js] enable success'); - } - } - - - /** - * @tc.number SUB_COMMUNACATION_bluetooth_GET_BT_CONNECT_STATE_0001 - * @tc.name testClassicGetBtConnectionState - * @tc.desc Test ClassicGetBtConnectionState api. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 2 - */ - it('SUB_COMMUNACATION_bluetooth_GET_BT_CONNECT_STATE_0001', 0, async function (done) { - console.info('[bluetooth_js] get connection state start'); - await tryToEnableBt(); - let ProfileConnectionState= - { - STATE_CONNECTING : 1, - STATE_CONNECTED : 2, - STATE_DISCONNECTED : 0, - STATE_DISCONNECTING : 3, - }; - let connState = bluetooth.getBtConnectionState(); - console.info('[bluetooth_js] get bt connection state result' + JSON.stringify(connState)); - expect(connState).assertEqual(ProfileConnectionState.STATE_DISCONNECTED); - expect(true).assertTrue(ProfileConnectionState.STATE_CONNECTING!= connState ); - expect(true).assertTrue(ProfileConnectionState.STATE_CONNECTED!= connState ); - expect(true).assertTrue(ProfileConnectionState.STATE_DISCONNECTING!= connState ); - done(); - }) - - -}) - -} - diff --git a/communication/bluetooth_profile/BUILD.gn b/communication/bluetooth_profile/BUILD.gn index 1823dbcfac9b20ae3aa03c53bd534be4d434eb9a..34a75db60980f98e662d2140c46ad7e4678a31cd 100644 --- a/communication/bluetooth_profile/BUILD.gn +++ b/communication/bluetooth_profile/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") ohos_js_hap_suite("ActsBluetoothProFileJsTest") { diff --git a/communication/bluetooth_profile/src/main/config.json b/communication/bluetooth_profile/src/main/config.json index 9175146c5f6ad96816a2fd65537b4d78a755b4e7..bfb89e51a16507b2878db06a035b3745ee27e588 100644 --- a/communication/bluetooth_profile/src/main/config.json +++ b/communication/bluetooth_profile/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.communication.bluetooth.bluetoothhost", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/communication/bluetooth_profile/src/main/js/test/BluetoothA2dp.test.js b/communication/bluetooth_profile/src/main/js/test/BluetoothA2dp.test.js index 27b419b44934af36812498bb36ebc11c385c46ac..c548b0ace0059a0fe28346e82fb65ea85fc9f018 100644 --- a/communication/bluetooth_profile/src/main/js/test/BluetoothA2dp.test.js +++ b/communication/bluetooth_profile/src/main/js/test/BluetoothA2dp.test.js @@ -17,14 +17,10 @@ import bluetooth from '@ohos.bluetooth'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' - let ProfileId = { - PROFILE_A2DP_SINK : 0, + PROFILE_A2DP_SOURCE : 1, - PROFILE_AVRCP_CT : 2, - PROFILE_AVRCP_TG : 3, PROFILE_HANDS_FREE_AUDIO_GATEWAY : 4, - PROFILE_HANDS_FREE_UNIT : 5, PROFILE_HID_HOST : 6, PROFILE_PAN_NETWORK : 7 } @@ -34,49 +30,16 @@ let PlayingState = { STATE_PLAYING : 0x0001, } -let a2dpSourceProfile = bluetooth.getProfile(1); - - -function on(ON_VALUE_TEST_ELEMENT) { - return new Promise((resolve, reject) => { - a2dpSourceProfile.on(ON_VALUE_TEST_ELEMENT, function (err, data) { - if (err != undefined) { - reject(err); - } else { - resolve(data); - } - }) - }); -} - -function off(OFF_VALUE_TEST_ELEMENT) { - return new Promise((resolve, reject) => { - a2dpSourceProfile.off(OFF_VALUE_TEST_ELEMENT, function (err, data) { - if (err != undefined) { - reject(err); - } else { - resolve(data); - } - }) - }); -} - +let ProfileConnectionState= + { + STATE_CONNECTING : 1, + STATE_CONNECTED : 2, + STATE_DISCONNECTED : 0, + STATE_DISCONNECTING : 3 + } export default function bluetoothhostTest_host_1() { describe('bluetoothhostTest_host_1', function () { - beforeAll(function () { - console.info('beforeAll called') - }) - beforeEach(function () { - console.info('beforeEach called') - }) - afterEach(function () { - console.info('afterEach called') - }) - afterAll(function () { - console.info('afterAll called') - }) - function sleep(delay) { return new Promise(resovle => setTimeout(resovle, delay)) } @@ -85,9 +48,10 @@ describe('bluetoothhostTest_host_1', function () { let sta = bluetooth.getState(); switch(sta){ case 0: - console.info('[bluetooth_js] bt turn off:'+ JSON.stringify(sta)); bluetooth.enableBluetooth(); - await sleep(3000); + await sleep(5000); + let sta1 = bluetooth.getState(); + console.info('[bluetooth_js] bt turn off:'+ JSON.stringify(sta1)); break; case 1: console.info('[bluetooth_js] bt turning on:'+ JSON.stringify(sta)); @@ -97,122 +61,224 @@ describe('bluetoothhostTest_host_1', function () { console.info('[bluetooth_js] bt turn on:'+ JSON.stringify(sta)); break; case 3: - console.info('[bluetooth_js] bt turning off:'+ JSON.stringify(sta)); bluetooth.enableBluetooth(); await sleep(3000); + let sta2 = bluetooth.getState(); + console.info('[bluetooth_js] bt turning off:'+ JSON.stringify(sta2)); break; default: console.info('[bluetooth_js] enable success'); } } - + beforeAll(function () { + console.info('beforeAll called') + }) + beforeEach(async function(done) { + console.info('beforeEach called') + await tryToEnableBt() + done() + }) + afterEach(function () { + console.info('afterEach called') + }) + afterAll(function () { + console.info('afterAll called') + }) /** - * @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_A2DP_GET_PROFILE_0001 - * @tc.name testgetprofile - * @tc.desc Test getProfile api. + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0100 + * @tc.name test bluetooth Profile ConnectionState + * @tc.desc Test getBtConnectionState api. + * @tc.size MEDIUM + * @ since 7 * @tc.type Function - * @tc.level Level 0 + * @tc.level Level 2 */ - it('SUB_COMMUNACATION_bluetooth_DEVICE_JS_A2DP_GET_PROFILE_0001', 0, async function (done) { - console.info('[bluetooth_js] a2dp get profile start'); - await tryToEnableBt(); - let proFile = bluetooth.getProfile(1); - console.info('[bluetooth_js] a2dp get profile result:' + JSON.stringify(proFile)); - expect(proFile != null).assertEqual(true); + it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0100', 0, async function (done) { + let connState = bluetooth.getBtConnectionState(); + console.info('[bluetooth_js] get bt connection state result' + JSON.stringify(connState)); + expect(connState).assertEqual(ProfileConnectionState.STATE_DISCONNECTED); + expect(true).assertTrue(ProfileConnectionState.STATE_CONNECTING!= connState ); + expect(true).assertTrue(ProfileConnectionState.STATE_CONNECTED!= connState ); + expect(true).assertTrue(ProfileConnectionState.STATE_DISCONNECTING!= connState ); done(); }) - /** - * @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_A2DP_SOURCCE_PROFILE_CONN_0001 - * @tc.name testa2dpSourceProfileconnect - * @tc.desc Test a2dpSourceProfile connect api. + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0200 + * @tc.name test A2DP Connect + * @tc.desc Test connect api. + * @tc.size MEDIUM + * @ since 8 * @tc.type Function - * @tc.level Level 0 + * @tc.level Level 1 */ - it('SUB_COMMUNACATION_bluetooth_DEVICE_JS_A2DP_SOURCCE_PROFILE_CONN_0001', 0, async function (done) { - console.info('[bluetooth_js] a2dpSourceProfile the connect start'); - await tryToEnableBt(); - let conn = a2dpSourceProfile.connect('00:00:00:00:00:02'); - expect(conn).assertTrue(); + it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0200', 0, async function (done) { + function StateChangeParam(data) { + console.info("[bluetooth_js] a2dp state " + JSON.stringify(data) + + 'deviceId: ' + data.deviceId + 'state:'+ data.state); + expect(true).assertEqual(data !=null); + } + let a2dpSrc = bluetooth.getProfile(ProfileId.PROFILE_A2DP_SOURCE); + console.info('[bluetooth_js]a2dp get profile result:' + JSON.stringify(a2dpSrc)); + a2dpSrc.on('connectionStateChange', StateChangeParam); + a2dpSrc.connect('11:22:33:44:55:77'); await sleep(6000); - let disConn = a2dpSourceProfile.disconnect('00:00:00:00:00:02'); - console.info('[bluetooth_js] a2dpSourceProfile disconnect:' + JSON.stringify(disConn)); - expect(disConn).assertFalse(); + + a2dpSrc.off('connectionStateChange', StateChangeParam); done(); }) - + + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0300 + * @tc.name test A2DP disconnect + * @tc.desc Test disconnect api. + * @tc.size MEDIUM + * @ since 8 + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0300', 0, async function (done) { + function StateChangeParam(data) { + console.info("[bluetooth_js] a2dp state " + JSON.stringify(data) + + 'deviceId: ' + data.deviceId + 'state:'+ data.state); + expect(true).assertEqual(data !=null); + } + let a2dpSrc = bluetooth.getProfile(ProfileId.PROFILE_A2DP_SOURCE); + console.info('[bluetooth_js]a2dp get profile result:' + JSON.stringify(a2dpSrc)); + a2dpSrc.on('connectionStateChange', StateChangeParam); + await sleep(6000); + let conn = a2dpSrc.disconnect('11:22:33:44:55:66'); + console.info('[bluetooth_js]a2dp disconnect result:' + JSON.stringify(conn)); + expect(conn).assertFalse(); + a2dpSrc.off('connectionStateChange', StateChangeParam); + done(); + }) /** - * @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_A2DP_GET_PLAYING_STATE_0001 - * @tc.name testgetPlayingState - * @tc.desc Test getPlayingState api. + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0400 + * @tc.name test a invaild A2DP disconnect + * @tc.desc Test disconnect api. + * @tc.size MEDIUM + * @ since 8 * @tc.type Function - * @tc.level Level 0 + * @tc.level Level 3 */ - it('SUB_COMMUNACATION_bluetooth_DEVICE_JS_A2DP_GET_PLAYING_STATE_0001', 0, async function (done) { - console.info('[bluetooth_js] a2dpSourceProfile getPlayingState start'); - await tryToEnableBt(); - let state = a2dpSourceProfile.getPlayingState('00:00:00:00:00:02'); - console.info('[bluetooth_js] a2dpSourceProfile the disconnect result:' + state); - await sleep(3000); + it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0400', 0, async function (done) { + let a2dpSrc = bluetooth.getProfile(ProfileId.PROFILE_A2DP_SOURCE); + console.info('[bluetooth_js]a2dp get profile result:' + JSON.stringify(a2dpSrc)); + let conn = a2dpSrc.disconnect('test'); + console.info('[bluetooth_js]a2dp disconnect1 result:' + JSON.stringify(conn)); + expect(conn).assertFalse(); done(); }) + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0500 + * @tc.name test Get A2DP ConnectionState + * @tc.desc Test getProfileConnState api. + * @tc.size MEDIUM + * @ since 8 + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0500', 0, async function (done) { + let a2dpSrcConn = bluetooth.getProfileConnState(ProfileId.PROFILE_A2DP_SOURCE); + console.info('[bluetooth_js]get a2dp result:' + JSON.stringify(a2dpSrcConn)); + expect(a2dpSrcConn).assertEqual(ProfileConnectionState.STATE_DISCONNECTED); + done(); + }) + + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0600 + * @tc.name test a invaild A2DP Connect + * @tc.desc Test connect api. + * @tc.size MEDIUM + * @ since 8 + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0600', 0, async function (done) { + let a2dpSrc = bluetooth.getProfile(ProfileId.PROFILE_A2DP_SOURCE); + let conn = a2dpSrc.connect('test'); + console.info('[bluetooth_js]a2dp invaild connect:' + JSON.stringify(conn)); + expect(conn).assertFalse(); + done(); + }) /** - * @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_A2DP_GET_PROFILE_STATE_0001 - * @tc.name testgetProfileState - * @tc.desc Test getProfileState api. + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0700 + * @tc.name test getDevice A2DP State. + * @tc.desc Test getDeviceState api. + * @tc.size MEDIUM + * @ since 8 * @tc.type Function - * @tc.level Level 0 + * @tc.level Level 3 */ - it('SUB_COMMUNACATION_bluetooth_DEVICE_JS_A2DP_GET_PROFILE_STATE_0001', 0, async function (done) { - console.info('[bluetooth_js] a2dpSourceProfile getProfileState start'); - await tryToEnableBt(); - let state = bluetooth.getProfileConnState(bluetooth.ProfileId.PROFILE_A2DP_SOURCE); - console.info('[bluetooth_js] a2dpSourceProfile state is:' + state); - expect(state).assertEqual(0); - await sleep(1000); + it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0700', 0, async function (done) { + let a2dpSrc = bluetooth.getProfile(ProfileId.PROFILE_A2DP_SOURCE); + console.info('[bluetooth_js]a2dp get profile result:' + JSON.stringify(a2dpSrc)); + let ret = a2dpSrc.getDeviceState('11:22:33:44:55:66'); + expect(ret).assertEqual(ProfileConnectionState.STATE_DISCONNECTED); done(); }) + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0800 + * @tc.name test getDevice A2DP State. + * @tc.desc Test getDeviceState api. + * @tc.size MEDIUM + * @ since 8 + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0800', 0, async function (done) { + let a2dpSrc = bluetooth.getProfile(ProfileId.PROFILE_A2DP_SOURCE); + console.info('[bluetooth_js]a2dp get profile result:' + JSON.stringify(a2dpSrc)); + let ret = a2dpSrc.getDeviceState('test'); + expect(ret).assertEqual(ProfileConnectionState.STATE_DISCONNECTED); + done(); + }) + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0900 + * @tc.name test get A2DP Playing State + * @tc.desc Test getPlayingState api. + * @tc.size MEDIUM + * @ since 8 + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_0900', 0, async function (done) { + let a2dpSrc = bluetooth.getProfile(ProfileId.PROFILE_A2DP_SOURCE); + console.info('[bluetooth_js]a2dp get profile result:' + JSON.stringify(a2dpSrc)); + let state = a2dpSrc.getPlayingState('11:22:33:44:55:66'); + console.info('[bluetooth_js]a2dp getPlayingState result:' + JSON.stringify(state)); + expect(state).assertEqual(PlayingState.STATE_NOT_PLAYING); + expect(true).assertEqual(state!=PlayingState.STATE_PLAYING); + done(); + }) /** - * @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_A2DP_SOURCCE_PROFILE_ON_0001 - * @tc.name testa2dpSourceProfileon - * @tc.desc Test a2dpSourceProfile on api. + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_1000 + * @tc.name test getDevice A2DP State. + * @tc.desc Test getDeviceState api. + * @tc.size MEDIUM + * @ since 8 * @tc.type Function - * @tc.level Level 0 + * @tc.level Level 1 */ - it('SUB_COMMUNACATION_bluetooth_DEVICE_JS_A2DP_SOURCCE_PROFILE_ON_0001', 0, async function (done) { - try { - await tryToEnableBt(); - console.info('[bluetooth_js] a2dpSourceProfile the on start'); - on("connectionStateChange", function (data) { - console.info("[bluetooth_js] a2dpSource_on data " + JSON.stringify(data)); - expect(true).assertEqual(data !=null); - console.info("[bluetooth_js] StateChangeParam deviceId" + data.deviceId + - "ProfileConnectionState" + data.state); - }); - }catch(e) { - expect(null).assertFail(); - } - try { - console.info('[bluetooth_js] a2dpSourceProfile the off test start'); - off("connectionStateChange", function (data) { - console.info("[bluetooth_js] a2dpSource_off data-> " + JSON.stringify(data)); - expect(true).assertEqual(data ==null); - }); - }catch(e) { - expect(null).assertFail(); - } + it('SUB_COMMUNICATION_BLUETOOTH_BR_A2DP_Conn_1000', 0, async function (done) { + let a2dpSrc = bluetooth.getProfile(ProfileId.PROFILE_A2DP_SOURCE); + console.info('[bluetooth_js]a2dp get profile result:' + JSON.stringify(a2dpSrc)); + let retArray = a2dpSrc.getConnectionDevices(); + expect(true).assertEqual(retArray.length>=0); done(); }) + }) } + diff --git a/communication/bluetooth_profile/src/main/js/test/BluetoothHfp.test.js b/communication/bluetooth_profile/src/main/js/test/BluetoothHfp.test.js index 4a44230cd6e1d6f4bc3de5d5bd61c76e20568a91..ea5c7ef36eaa80e8027599b18d90508f464a4346 100644 --- a/communication/bluetooth_profile/src/main/js/test/BluetoothHfp.test.js +++ b/communication/bluetooth_profile/src/main/js/test/BluetoothHfp.test.js @@ -16,59 +16,23 @@ import bluetooth from '@ohos.bluetooth'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -let hfpGatewayProfile = bluetooth.getProfile(4); - - -let ProfileId = { - PROFILE_A2DP_SINK : 0, +let ProfileId = { PROFILE_A2DP_SOURCE : 1, - PROFILE_AVRCP_CT : 2, - PROFILE_AVRCP_TG : 3, PROFILE_HANDS_FREE_AUDIO_GATEWAY : 4, - PROFILE_HANDS_FREE_UNIT : 5, PROFILE_HID_HOST : 6, PROFILE_PAN_NETWORK : 7 } -function on(ON_VALUE_TEST_ELEMENT) { - return new Promise((resolve, reject) => { - hfpGatewayProfile.on(ON_VALUE_TEST_ELEMENT, function (err, data) { - if (err != undefined) { - reject(err); - } else { - resolve(data); - } - }) - }); -} - -function off(OFF_VALUE_TEST_ELEMENT) { - return new Promise((resolve, reject) => { - hfpGatewayProfile.off(OFF_VALUE_TEST_ELEMENT, function (err, data) { - if (err != undefined) { - reject(err); - } else { - resolve(data); - } - }) - }); -} +let ProfileConnectionState= + { + STATE_CONNECTING : 1, + STATE_CONNECTED : 2, + STATE_DISCONNECTED : 0, + STATE_DISCONNECTING : 3, + }; export default function bluetoothhostTest_host_3() { describe('bluetoothhostTest_host_3', function () { - beforeAll(function () { - console.info('beforeAll called') - }) - beforeEach(function () { - console.info('beforeEach called') - }) - afterEach(function () { - console.info('afterEach called') - }) - afterAll(function () { - console.info('afterAll called') - }) - function sleep(delay) { return new Promise(resovle => setTimeout(resovle, delay)) } @@ -77,9 +41,10 @@ describe('bluetoothhostTest_host_3', function () { let sta = bluetooth.getState(); switch(sta){ case 0: - console.info('[bluetooth_js] bt turn off:'+ JSON.stringify(sta)); bluetooth.enableBluetooth(); - await sleep(3000); + await sleep(5000); + let sta1 = bluetooth.getState(); + console.info('[bluetooth_js] bt turn off:'+ JSON.stringify(sta1)); break; case 1: console.info('[bluetooth_js] bt turning on:'+ JSON.stringify(sta)); @@ -89,84 +54,183 @@ describe('bluetoothhostTest_host_3', function () { console.info('[bluetooth_js] bt turn on:'+ JSON.stringify(sta)); break; case 3: - console.info('[bluetooth_js] bt turning off:'+ JSON.stringify(sta)); bluetooth.enableBluetooth(); await sleep(3000); + let sta2 = bluetooth.getState(); + console.info('[bluetooth_js] bt turning off:'+ JSON.stringify(sta2)); break; default: console.info('[bluetooth_js] enable success'); } } - + beforeAll(function () { + console.info('beforeAll called') + }) + beforeEach(async function(done) { + console.info('beforeEach called') + await tryToEnableBt() + done() + }) + afterEach(function () { + console.info('afterEach called') + }) + afterAll(function () { + console.info('afterAll called') + }) /** - * @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_GET_PROFILE_0001 - * @tc.name testgetprofile - * @tc.desc Test getProfile api. + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1100 + * @tc.name test Get HFP ConnectionState + * @tc.desc Test getProfileConnState api. + * @tc.size MEDIUM + * @ since 8 * @tc.type Function - * @tc.level Level 0 + * @tc.level Level 3 */ - it('SUB_COMMUNACATION_bluetooth_DEVICE_JS_HFP_GET_PROFILE_0001', 0, async function (done) { - console.info('[bluetooth_js] hfp get profile start'); - await tryToEnableBt(); - let proFile = bluetooth.getProfile(4); - console.info('[bluetooth_js] get profile:' + JSON.stringify(proFile)); - expect(proFile != null).assertEqual(true); + it('SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1100', 0, async function (done) { + let hfpSrcConn = + bluetooth.getProfileConnState(ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY); + console.info('[bluetooth_js]get hfp result:' + JSON.stringify(hfpSrcConn)); + expect(hfpSrcConn).assertEqual(ProfileConnectionState.STATE_DISCONNECTED); done(); }) - /** - * @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_HFP_GATWAY_PROFILE_CONN_0001 - * @tc.name testhfpGatewayProfileconnect - * @tc.desc Test hfpGatewayProfile connect api. + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1200 + * @tc.name test getDevice HFP State. + * @tc.desc Test getDeviceState api. + * @tc.size MEDIUM + * @ since 8 * @tc.type Function - * @tc.level Level 0 + * @tc.level Level 3 */ - it('SUB_COMMUNACATION_bluetooth_DEVICE_JS_HFP_GATWAY_PROFILE_CONN_0001', 0, async function (done) { - console.info('[bluetooth_js] hfpGatewayProfile the connect start'); - await tryToEnableBt(); - let conn = hfpGatewayProfile.connect('00:00:00:00:00:01'); - expect(conn).assertTrue(); - await sleep(2000); - let disConn = hfpGatewayProfile.disconnect('00:00:00:00:00:01'); - console.info('[bluetooth_js] hfpGatewayProfile disconnect:' + disConn); - expect(disConn).assertTrue(); - await sleep(2000); + it('SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1200', 0, async function (done) { + let hfpSrc = bluetooth.getProfile(ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY); + let ret = hfpSrc.getDeviceState('11:22:33:44:55:66'); + console.info('[bluetooth_js]hfp getDeviceState:' + JSON.stringify(ret)); + expect(ret).assertEqual(ProfileConnectionState.STATE_DISCONNECTED); done(); }) + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1300 + * @tc.name test getDevice HFP State. + * @tc.desc Test getDeviceState api. + * @tc.size MEDIUM + * @ since 8 + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1300', 0, async function (done) { + let hfpSrc = bluetooth.getProfile(ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY); + let ret = hfpSrc.getDeviceState('bluetooth1'); + console.info('[bluetooth_js]hfp get valid mac DeviceState:' + JSON.stringify(ret)); + expect(ret).assertEqual(ProfileConnectionState.STATE_DISCONNECTED); + done(); + }) /** - * @tc.number SUB_COMMUNACATION_bluetooth_DEVICE_JS_HFP_GATWAY_PROFILE_ON_0001 - * @tc.name testhfpGatewayProfileon - * @tc.desc Test hfpGatewayProfile on api. + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1400 + * @tc.name test HFP Connect + * @tc.desc Test connect api. + * @tc.size MEDIUM + * @ since 8 * @tc.type Function - * @tc.level Level 0 + * @tc.level Level 1 */ - it('SUB_COMMUNACATION_bluetooth_DEVICE_JS_HFP_GATWAY_PROFILE_ON_0001', 0, async function (done) { - try { - await tryToEnableBt(); - console.info('[bluetooth_js] hfpGatewayProfile the on start'); - on("connectionStateChange", function (data) { - console.info("[bluetooth_js] hfpGateway_on data " + JSON.stringify(data)); - expect(true).assertEqual(data !=null); - }); - }catch(e) { - expect(null).assertFail(); + it('SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1400', 0, async function (done) { + function StateChangeParam(data) { + console.info("[bluetooth_js] hfp state " + JSON.stringify(data) + + 'deviceId: ' + data.deviceId + 'state:'+ data.state); + expect(true).assertEqual(data !=null); } - try { - console.info('[bluetooth_js] hfpGatewayProfile the off test start'); - off("connectionStateChange", function (data) { - console.info("[bluetooth_js] hfpGateway_off data-> " + JSON.stringify(data)); - expect(true).assertEqual(data ==null); - }); - }catch(e) { - expect(null).assertFail(); + let hfpSrc = bluetooth.getProfile(ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY); + hfpSrc.on('connectionStateChange', StateChangeParam); + hfpSrc.connect('11:22:33:44:55:66'); + await sleep(6000); + hfpSrc.off('connectionStateChange', StateChangeParam); + done(); + }) + + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1500 + * @tc.name test HFP disconnect + * @tc.desc Test disconnect api. + * @tc.size MEDIUM + * @ since 8 + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1500', 0, async function (done) { + function StateChangeParam(data) { + console.info("[bluetooth_js] hfp state " + JSON.stringify(data) + + 'deviceId: ' + data.deviceId + 'state:'+ data.state); + expect(true).assertEqual(data !=null); } + let hfpSrc = bluetooth.getProfile(ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY); + hfpSrc.on('connectionStateChange', StateChangeParam); + await sleep(10000); + let conn = hfpSrc.disconnect('11:22:33:44:55:66'); + console.info('[bluetooth_js]hfp disconnect result:' + JSON.stringify(conn)); + expect(conn).assertFalse(); + hfpSrc.off('connectionStateChange', StateChangeParam); + done(); + }) + + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1600 + * @tc.name test a invaild HFP Connect + * @tc.desc Test connect api. + * @tc.size MEDIUM + * @ since 8 + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1600', 0, async function (done) { + let hfpSrc = bluetooth.getProfile(ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY); + let conn1 = hfpSrc.connect('test'); + console.info('[bluetooth_js]hfp vaild MAC disconnect :' + JSON.stringify(conn1)); + expect(conn1).assertFalse(); + done(); + }) + + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1700 + * @tc.name test a invaild HFP disconnect + * @tc.desc Test disconnect api. + * @tc.size MEDIUM + * @ since 8 + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1700', 0, async function (done) { + let hfpSrc = bluetooth.getProfile(ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY); + console.info('[bluetooth_js]hfp get profile result:' + JSON.stringify(hfpSrc)); + let conn = hfpSrc.disconnect('test'); + console.info('[bluetooth_js]hfp disconnect1 result:' + JSON.stringify(conn)); + expect(conn).assertFalse(); done(); }) + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1800 + * @tc.name test getDevice HFP State. + * @tc.desc Test getDeviceState api. + * @tc.size MEDIUM + * @ since 8 + * @tc.type Function + * @tc.level Level 1 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BR_HFP_Conn_1800', 0, async function (done) { + let hfpSrc = bluetooth.getProfile(ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY); + let retArray = hfpSrc.getConnectionDevices(); + console.info('[bluetooth_js]hfp getConnectionDevices:' + JSON.stringify(retArray)); + expect(true).assertEqual(retArray.length>=0); + done(); + }) + + }) } + diff --git a/communication/bluetooth_standard/src/main/config.json b/communication/bluetooth_standard/src/main/config.json index 9175146c5f6ad96816a2fd65537b4d78a755b4e7..bfb89e51a16507b2878db06a035b3745ee27e588 100644 --- a/communication/bluetooth_standard/src/main/config.json +++ b/communication/bluetooth_standard/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.communication.bluetooth.bluetoothhost", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/communication/bluetooth_standard/src/main/js/test/BRSetLocalName.test.js b/communication/bluetooth_standard/src/main/js/test/BRSetLocalName.test.js index 0e508b7fa634b2c57abedb96a383d9c24a23ab84..edffde0b249b0dd553df59963876504a00b4d75e 100644 --- a/communication/bluetooth_standard/src/main/js/test/BRSetLocalName.test.js +++ b/communication/bluetooth_standard/src/main/js/test/BRSetLocalName.test.js @@ -91,23 +91,14 @@ describe('bluetoothhostTest1', function() { * @tc.size MEDIUM * @ since 8 * @tc.type Function - * @tc.level Level 3 + * @tc.level Level 1 */ it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0100', 0, async function (done) { - let localName = bluetooth.getLocalName(); - console.info('[bluetooth_js] LocalName_0600 localName = '+ JSON.stringify(localName)); - expect(true).assertEqual(localName!=null); - let newName = 'bluetoothtest'; - let result = bluetooth.setLocalName(newName); + let result = bluetooth.setLocalName(Btname.LETTERS_TEST); expect(result).assertTrue(); let getNewName = bluetooth.getLocalName(); console.info('[bluetooth_js] LocalName_0100 NewName = '+ JSON.stringify(getNewName)); - expect(true).assertEqual(newName == getNewName); - let result1=bluetooth.setLocalName(localName); - expect(result1).assertTrue(); - let getLocalName = bluetooth.getLocalName(); - console.info('[bluetooth_js] LocalName_0100 localName = '+ JSON.stringify(getLocalName)); - expect(true).assertEqual(localName == getLocalName); + expect(true).assertEqual(Btname.LETTERS_TEST == getNewName); done(); }) @@ -118,14 +109,14 @@ describe('bluetoothhostTest1', function() { * @tc.size MEDIUM * @ since 8 * @tc.type Function - * @tc.level Level 1 + * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0200', 0, async function (done) { - let result = bluetooth.setLocalName(Btname.LETTERS_TEST); + let result = bluetooth.setLocalName(Btname.CHINESES_TEST); expect(result).assertTrue(); let getNewName = bluetooth.getLocalName(); console.info('[bluetooth_js] LocalName_0200 NewName = '+ JSON.stringify(getNewName)); - expect(true).assertEqual(Btname.LETTERS_TEST == getNewName); + expect(true).assertEqual(Btname.CHINESES_TEST == getNewName); done(); }) @@ -136,50 +127,51 @@ describe('bluetoothhostTest1', function() { * @tc.size MEDIUM * @ since 8 * @tc.type Function - * @tc.level Level 3 + * @tc.level Level 2 */ it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0300', 0, async function (done) { - let result = bluetooth.setLocalName(Btname.CHINESES_TEST); + let result = bluetooth.setLocalName(Btname.NUM_TEST); expect(result).assertTrue(); let getNewName = bluetooth.getLocalName(); console.info('[bluetooth_js] LocalName_0300 NewName = '+ JSON.stringify(getNewName)); - expect(true).assertEqual(Btname.CHINESES_TEST == getNewName); + expect(true).assertEqual(Btname.NUM_TEST == getNewName); done(); }) - /** + /** * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0400 * @tc.name setLocalName * @tc.desc Test setLocalName api by promise. * @tc.size MEDIUM * @ since 8 * @tc.type Function - * @tc.level Level 2 + * @tc.level Level 1 */ it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0400', 0, async function (done) { - let result = bluetooth.setLocalName(Btname.NUM_TEST); + let result = bluetooth.setLocalName(Btname.SYMBOL_TEST); expect(result).assertTrue(); let getNewName = bluetooth.getLocalName(); console.info('[bluetooth_js] LocalName_0400 NewName = '+ JSON.stringify(getNewName)); - expect(true).assertEqual(Btname.NUM_TEST == getNewName); + expect(true).assertEqual(Btname.SYMBOL_TEST == getNewName); done(); }) - /** + /** * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0500 * @tc.name setLocalName * @tc.desc Test setLocalName api by promise. * @tc.size MEDIUM * @ since 8 * @tc.type Function - * @tc.level Level 1 + * @tc.level Level 2 */ it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0500', 0, async function (done) { - let result = bluetooth.setLocalName(Btname.SYMBOL_TEST); + let newName = 'my bluetooth'; + let result = bluetooth.setLocalName(newName); expect(result).assertTrue(); let getNewName = bluetooth.getLocalName(); console.info('[bluetooth_js] LocalName_0500 NewName = '+ JSON.stringify(getNewName)); - expect(true).assertEqual(Btname.SYMBOL_TEST == getNewName); + expect(true).assertEqual(newName == getNewName); done(); }) @@ -190,10 +182,10 @@ describe('bluetoothhostTest1', function() { * @tc.size MEDIUM * @ since 8 * @tc.type Function - * @tc.level Level 2 + * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0600', 0, async function (done) { - let newName = 'my bluetooth'; + let newName = 'bluetooth1234ABCDEFGH'; let result = bluetooth.setLocalName(newName); expect(result).assertTrue(); let getNewName = bluetooth.getLocalName(); @@ -204,15 +196,15 @@ describe('bluetoothhostTest1', function() { /** * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0700 - * @tc.name setLocalName - * @tc.desc Test setLocalName api by promise. + * @tc.name TEST setLocalName + * @tc.desc TEST setLocalName api by promise. * @tc.size MEDIUM * @ since 8 * @tc.type Function * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0700', 0, async function (done) { - let newName = 'bluetooth1234ABCDEFGH'; + let newName = '蓝牙设备bluetooth'; let result = bluetooth.setLocalName(newName); expect(result).assertTrue(); let getNewName = bluetooth.getLocalName(); @@ -230,13 +222,12 @@ describe('bluetoothhostTest1', function() { * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0800', 0, async function (done) { - let newName = '蓝牙设备bluetooth'; - let result = bluetooth.setLocalName(newName); + it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0800', 0, async function (done) { + let result = bluetooth.setLocalName(Btname.MIXES4); expect(result).assertTrue(); let getNewName = bluetooth.getLocalName(); console.info('[bluetooth_js] LocalName_0800 NewName = '+ JSON.stringify(getNewName)); - expect(true).assertEqual(newName == getNewName); + expect(true).assertEqual(Btname.MIXES4 == getNewName); done(); }) @@ -249,12 +240,12 @@ describe('bluetoothhostTest1', function() { * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0900', 0, async function (done) { - let result = bluetooth.setLocalName(Btname.MIXES4); + it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_0900', 0, async function (done) { + let result = bluetooth.setLocalName(Btname.MIXES2); expect(result).assertTrue(); let getNewName = bluetooth.getLocalName(); console.info('[bluetooth_js] LocalName_0900 NewName = '+ JSON.stringify(getNewName)); - expect(true).assertEqual(Btname.MIXES4 == getNewName); + expect(true).assertEqual(Btname.MIXES2 == getNewName); done(); }) @@ -268,11 +259,11 @@ describe('bluetoothhostTest1', function() { * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1000', 0, async function (done) { - let result = bluetooth.setLocalName(Btname.MIXES2); + let result = bluetooth.setLocalName(Btname.MIXES3); expect(result).assertTrue(); let getNewName = bluetooth.getLocalName(); console.info('[bluetooth_js] LocalName_1000 NewName = '+ JSON.stringify(getNewName)); - expect(true).assertEqual(Btname.MIXES2 == getNewName); + expect(true).assertEqual(Btname.MIXES3 == getNewName); done(); }) @@ -283,14 +274,15 @@ describe('bluetoothhostTest1', function() { * @tc.size MEDIUM * @ since 8 * @tc.type Function - * @tc.level Level 3 + * @tc.level Level 2 */ it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1100', 0, async function (done) { - let result = bluetooth.setLocalName(Btname.MIXES3); + let newName = '蓝牙设备123'; + let result = bluetooth.setLocalName(newName); expect(result).assertTrue(); let getNewName = bluetooth.getLocalName(); console.info('[bluetooth_js] LocalName_1100 NewName = '+ JSON.stringify(getNewName)); - expect(true).assertEqual(Btname.MIXES3 == getNewName); + expect(true).assertEqual(newName == getNewName); done(); }) @@ -301,14 +293,14 @@ describe('bluetoothhostTest1', function() { * @tc.size MEDIUM * @ since 8 * @tc.type Function - * @tc.level Level 2 + * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1200', 0, async function (done) { - let newName = '蓝牙设备123'; + let newName = '蓝牙设备bluetooth12'; let result = bluetooth.setLocalName(newName); expect(result).assertTrue(); let getNewName = bluetooth.getLocalName(); - console.info('[bluetooth_js] LocalName_1200 NewName = '+ JSON.stringify(getNewName)); + console.info('[bluetooth_js] LocalName1200 NewName = '+ JSON.stringify(getNewName)); expect(true).assertEqual(newName == getNewName); done(); }) @@ -322,13 +314,12 @@ describe('bluetoothhostTest1', function() { * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1300', 0, async function (done) { - let newName = '蓝牙设备bluetooth12'; - let result = bluetooth.setLocalName(newName); + it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1300', 0, async function (done) { + let result = bluetooth.setLocalName(Btname.MIXES6); expect(result).assertTrue(); let getNewName = bluetooth.getLocalName(); console.info('[bluetooth_js] LocalName_1300 NewName = '+ JSON.stringify(getNewName)); - expect(true).assertEqual(newName == getNewName); + expect(true).assertEqual(Btname.MIXES6 == getNewName); done(); }) @@ -341,12 +332,13 @@ describe('bluetoothhostTest1', function() { * @tc.type Function * @tc.level Level 3 */ - it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1400', 0, async function (done) { - let result = bluetooth.setLocalName(Btname.MIXES6); + it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1400', 0, async function (done) { + let result = bluetooth.setLocalName(Btname.MIXES); expect(result).assertTrue(); let getNewName = bluetooth.getLocalName(); console.info('[bluetooth_js] LocalName_1400 NewName = '+ JSON.stringify(getNewName)); - expect(true).assertEqual(Btname.MIXES6 == getNewName); + expect(true).assertEqual(Btname.MIXES == getNewName); + done(); }) @@ -360,12 +352,11 @@ describe('bluetoothhostTest1', function() { * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1500', 0, async function (done) { - let result = bluetooth.setLocalName(Btname.MIXES); + let result = bluetooth.setLocalName(Btname.MIXES5); expect(result).assertTrue(); let getNewName = bluetooth.getLocalName(); console.info('[bluetooth_js] LocalName_1500 NewName = '+ JSON.stringify(getNewName)); - expect(true).assertEqual(Btname.MIXES == getNewName); - + expect(true).assertEqual(Btname.MIXES5 == getNewName); done(); }) @@ -379,11 +370,11 @@ describe('bluetoothhostTest1', function() { * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1600', 0, async function (done) { - let result = bluetooth.setLocalName(Btname.MIXES5); + let result = bluetooth.setLocalName(Btname.NUM_TEST1); expect(result).assertTrue(); let getNewName = bluetooth.getLocalName(); console.info('[bluetooth_js] LocalName_1600 NewName = '+ JSON.stringify(getNewName)); - expect(true).assertEqual(Btname.MIXES5 == getNewName); + expect(true).assertEqual(Btname.NUM_TEST1 == getNewName); done(); }) @@ -397,11 +388,11 @@ describe('bluetoothhostTest1', function() { * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1700', 0, async function (done) { - let result = bluetooth.setLocalName(Btname.NUM_TEST1); + let result = bluetooth.setLocalName(Btname.MIXES7); expect(result).assertTrue(); let getNewName = bluetooth.getLocalName(); console.info('[bluetooth_js] LocalName_1700 NewName = '+ JSON.stringify(getNewName)); - expect(true).assertEqual(Btname.NUM_TEST1 == getNewName); + expect(false).assertEqual(Btname.MIXES7 == getNewName); done(); }) @@ -415,14 +406,43 @@ describe('bluetoothhostTest1', function() { * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1800', 0, async function (done) { - let result = bluetooth.setLocalName(Btname.MIXES7); + let name = bluetooth.getLocalName(); + let set = bluetooth.setLocalName(''); + expect(set).assertFalse(); + let localName = bluetooth.getLocalName(); + expect(true).assertTrue(localName==name); + console.info('[bluetooth_js] getLocalName1800=' + JSON.stringify(localName)); + done(); + }) + + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1900 + * @tc.name set LocalName + * @tc.desc Test setLocalName api by promise. + * @tc.size MEDIUM + * @ since 8 + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BR_LocalName_1900', 0, async function (done) { + let localName = bluetooth.getLocalName(); + console.info('[bluetooth_js] LocalName_1900 localName = '+ JSON.stringify(localName)); + expect(true).assertEqual(localName!=null); + let newName = 'bluetoothtest'; + let result = bluetooth.setLocalName(newName); expect(result).assertTrue(); let getNewName = bluetooth.getLocalName(); - console.info('[bluetooth_js] LocalName_1800 NewName = '+ JSON.stringify(getNewName)); - expect(false).assertEqual(Btname.MIXES7 == getNewName); + console.info('[bluetooth_js] LocalName_1900 NewName = '+ JSON.stringify(getNewName)); + expect(true).assertEqual(newName == getNewName); + let result1=bluetooth.setLocalName(localName); + expect(result1).assertTrue(); + let getLocalName = bluetooth.getLocalName(); + console.info('[bluetooth_js] LocalNam1900 localName ='+ JSON.stringify(getLocalName)); + expect(true).assertEqual(localName == getLocalName); done(); }) }) } + diff --git a/communication/bluetooth_standard/src/main/js/test/BRSpp.test.js b/communication/bluetooth_standard/src/main/js/test/BRSpp.test.js index da557b6e22ef996fa99827343dd111219808760b..35f8c03f6179208f6a4c8dc6a89937c2bffe5ff1 100644 --- a/communication/bluetooth_standard/src/main/js/test/BRSpp.test.js +++ b/communication/bluetooth_standard/src/main/js/test/BRSpp.test.js @@ -1,4 +1,3 @@ - /* * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); @@ -79,14 +78,15 @@ describe('bluetoothhostTest4', function() { secure: true, type: SppType.SPP_RFCOMM}; let serverNumber = -1; function serverSocket(code, number) { - console.log('bluetooth error code: ' + code.code); - if (code.code == 0) { - console.log('bluetooth serverSocket Number: ' + number); + if (code) { + console.log('bluetooth error code01: ' + code); + }else{ + console.log('bluetooth serverSocket Number:' + JSON.stringify(number)); serverNumber = number; expect(true).assertEqual(number!=null); } } - bluetooth.sppListen('server1', SppOption, serverSocket); + await bluetooth.sppListen('server1', SppOption, serverSocket); done() }) @@ -103,14 +103,15 @@ describe('bluetoothhostTest4', function() { secure: false, type: 0}; let serverNumber = -1; function serverSocket(code, number) { - console.log('[bluetooth_js] error code: ' + code.code); - if (code.code == 0) { - console.log('[bluetooth_js] serverSocket Number: ' + number); - serverNumber = number; - expect(true).assertEqual(number!=null); + if (code) { + console.log('[bluetooth_js] error code02: ' + code); + }else{ + console.log('[bluetooth_js] serverSocket Number: ' + JSON.stringify(number)); + serverNumber = number; + expect(true).assertEqual(number!=null); } } - bluetooth.sppListen('server1', sppOption, serverSocket); + await bluetooth.sppListen('server1', sppOption, serverSocket); done(); }) @@ -127,14 +128,15 @@ describe('bluetoothhostTest4', function() { secure: true, type: 0}; let serverNumber = -1; function serverSocket(code, number) { - console.log('[bluetooth_js] error code: ' + code.code); - if (code.code == 0) { - console.log('[bluetooth_js] serverSocket Number: ' + number); - serverNumber = number; - expect(true).assertEqual(number!=null); - } + if (code) { + console.log('[bluetooth_js] error code03: ' + JSON.stringify(code)); + }else{ + console.log('[bluetooth_js] serverSocket Number: '+JSON.stringify(number)); + serverNumber = number; + expect(true).assertEqual(serverNumber!=null); + } } - bluetooth.sppListen('server1', sppOption, serverSocket); + await bluetooth.sppListen('server1', sppOption, serverSocket); done(); }) @@ -150,15 +152,17 @@ describe('bluetoothhostTest4', function() { let sppOption = {uuid: '00000000-0000-1000-8000-00805F9B34FB', secure: false, type: 0}; let serverNumber = -1; - function serverSocket(code, number) { - console.log('[bluetooth_js] error code: ' + code.code); - if (code.code == 0) { - console.log('[bluetooth_js] serverSocket Number: ' + number); - serverNumber = number; - expect(true).assertEqual(number!=null); + function serverSocket(code, number) { + if (code) { + console.log('[bluetooth_js] error code04: ' + JSON.stringify(code)); + + }else{ + console.log('[bluetooth_js] serverSocket Number:'+ JSON.stringify(number)); + serverNumber = number; + expect(true).assertEqual(serverNumber!=null); } } - bluetooth.sppListen('server1', sppOption, serverSocket); + await bluetooth.sppListen('server1', sppOption, serverSocket); done(); }) @@ -172,13 +176,15 @@ describe('bluetoothhostTest4', function() { */ it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0500', 0, async function (done) { function acceptClientSocket(code, number) { - console.log('[bluetooth_js] error code: ' + code.code); - if (code.code == 0) { - console.log('[bluetooth_js] clientSocket Number: ' + number); - expect(true).assertEqual(number!=null); - } + + if (code) { + console.log('[bluetooth_js] error code05: ' + JSON.stringify(code)); + }else{ + console.log('[bluetooth_js] clientSocket Number:' + JSON.stringify(number)); + expect(true).assertEqual(number!=null); + } } - bluetooth.sppAccept(0, acceptClientSocket); + await bluetooth.sppAccept(0, acceptClientSocket); done(); }) @@ -191,13 +197,13 @@ describe('bluetoothhostTest4', function() { * @tc.level Level 3 */ it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0600', 0, async function (done) { - bluetooth.sppAccept(-1, function(code, clientSocketNumber) { - console.info('[bluetooth_js] code is: ' + code.code); - if (code.code == 0) { - console.log('[bluetooth_js]sppAccept Number:' + clientSocketNumber); - expect(true).assertEqual(clientSocketNumber!=null); + await bluetooth.sppAccept(-1, function(code, clientSocketNumber) { + if (code) { + console.info('[bluetooth_js] code is: ' + JSON.stringify(code)); } else { - expect(true).assertEqual(false); + console.log('[bluetooth_js]sppAccept Number:' + + JSON.stringify(clientSocketNumber)); + expect(true).assertEqual(clientSocketNumber!=null); } }); done(); @@ -214,13 +220,13 @@ describe('bluetoothhostTest4', function() { it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0700', 0, async function (done) { let sppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB', secure: true, type: 0}; - bluetooth.sppConnect('00:11:22:33:44:55', sppOption, function(code, clientSocketNumber) { - console.info('[bluetooth_js] code is: ' + code.code); - if (code.code == 0) { - console.log('[bluetooth_js]sppConnect Number:' + clientSocketNumber); - expect(true).assertEqual(clientSocketNumber!=null); + await bluetooth.sppConnect('00:11:22:33:44:55', sppOption, function(code, number) { + if (code) { + console.info('[bluetooth_js] code is: ' + JSON.stringify(code)); } else { - expect(true).assertEqual(false); + console.log('[bluetooth_js]sppConnect Number:' + + JSON.stringify(number)); + expect(true).assertEqual(number!=null); } }); done(); @@ -237,13 +243,13 @@ describe('bluetoothhostTest4', function() { it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0800', 0, async function (done) { let sppOption = {uuid: '0000', secure: false, type: 0}; - bluetooth.sppConnect('ABC', sppOption, function(code, clientSocketNumber) { - console.info('[bluetooth_js] code is: ' + code.code); - if (code.code == 0) { - console.log('[bluetooth_js]sppConnect Number' + clientSocketNumber); - expect(true).assertEqual(clientSocketNumber!=null); + await bluetooth.sppConnect('ABC', sppOption, function(code, clientSocketNumber) { + if (code) { + console.info('[bluetooth_js] code is: ' + JSON.stringify(code)); } else { - expect(true).assertEqual(false); + console.log('[bluetooth_js]sppConnect Number' + + JSON.stringify(clientSocketNumber)); + expect(true).assertEqual(clientSocketNumber!=null); } }); done(); @@ -260,13 +266,13 @@ describe('bluetoothhostTest4', function() { it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_0900', 0, async function (done) { let sppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB', secure: true, type: 0}; - bluetooth.sppConnect('BT', sppOption, function(code, clientSocketNumber) { - console.info('[bluetooth_js] code is: ' + code.code); - if (code.code == 0) { - console.log('[bluetooth_js]sppConnect Number' + clientSocketNumber); - expect(true).assertEqual(clientSocketNumber!=null); + await bluetooth.sppConnect('BT', sppOption, function(code, clientSocketNumber) { + if (code) { + console.info('[bluetooth_js] code is: ' + JSON.stringify(code)); } else { - expect(true).assertEqual(false); + console.log('[bluetooth_js]sppConnect Number' + + JSON.stringify(clientSocketNumber)); + expect(true).assertEqual(clientSocketNumber!=null); } }); done(); @@ -283,15 +289,18 @@ describe('bluetoothhostTest4', function() { it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1000', 0, async function (done) { let serverNumber = -1; function serverSocket(code, number) { - console.log('bluetooth error code: ' + code.code); - if (code.code == 0) { - console.log('bluetooth serverSocket Number: ' + number); + if (code) { + console.log('bluetooth error code10: ' + JSON.stringify(code)); + }else{ + console.log('bluetooth serverSocket Number:'+ JSON.stringify(number)); serverNumber = number; + expect(true).assertEqual(serverNumber!=null); } + } let SppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB', secure: true, type: 0}; - bluetooth.sppListen('server1', SppOption, serverSocket); + await bluetooth.sppListen('server1', SppOption, serverSocket); bluetooth.sppCloseServerSocket(serverNumber); done(); }) @@ -306,14 +315,14 @@ describe('bluetoothhostTest4', function() { */ it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1100', 0, async function (done) { let clientNumber = -1; - bluetooth.sppAccept(-1, function(code, clientSocketNumber) { - console.info('[bluetooth_js] code is: ' + code.code); - if (code.code == 0) { - console.log('[bluetooth_js]sppAccept Number:' + clientSocketNumber); + await bluetooth.sppAccept(-1, function(code, clientSocketNumber) { + if (code) { + console.info('[bluetooth_js] code is: ' + JSON.stringify(code)); + } else { + console.log('[bluetooth_js]sppAccept Number:' + + JSON.stringify(clientSocketNumber)); clientNumber =clientSocketNumber; expect(true).assertEqual(clientSocketNumber!=null); - } else { - expect(true).assertEqual(false); } }); bluetooth.sppCloseClientSocket(clientNumber); @@ -330,14 +339,14 @@ describe('bluetoothhostTest4', function() { */ it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1200', 0, async function (done) { let clientNumber = -1; - bluetooth.sppAccept(-1, function(code, clientSocketNumber) { - console.info('[bluetooth_js] code is: ' + code.code); - if (code.code == 0) { - console.log('[bluetooth_js]sppAccept Number:' + clientSocketNumber); + await bluetooth.sppAccept(-1, function(code, clientSocketNumber) { + if (code) { + console.info('[bluetooth_js] code is: ' + JSON.stringify(code)); + } else { + console.log('[bluetooth_js]sppAccept Number:' + + JSON.stringify(clientSocketNumber)); clientNumber =clientSocketNumber; expect(true).assertEqual(clientSocketNumber!=null); - } else { - expect(true).assertEqual(false); } }); let arrayBuffer = new ArrayBuffer(8); @@ -348,8 +357,38 @@ describe('bluetoothhostTest4', function() { expect(ret).assertEqual(false); done(); }) + + /** + * @tc.number SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1300 + * @tc.name test sppReadOn + * @tc.desc Test On and Off Api + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_COMMUNICATION_BLUETOOTH_BR_SPP_1300', 0, async function (done) { + let clientNumber = -1; + function acceptClientSocket(code, number) { + if (code) { + console.log('[bluetooth_js] error code13: ' + JSON.stringify(code)); + }else{ + console.log('[bluetooth_js]clientSocke Number:' + JSON.stringify(number)); + clientNumber = number; + expect(true).assertEqual(number!=null); + } + } + await bluetooth.sppAccept(0, acceptClientSocket); + function dataRead(dataBuffer) { + let data = new Uint8Array(dataBuffer); + console.log('bluetooth data is: ' + data[0]); + } + await bluetooth.on('sppRead', clientNumber, dataRead); + await bluetooth.off('sppRead', clientNumber, dataRead); + done(); + }) }) } + diff --git a/communication/bluetooth_standard/src/main/js/test/BRSwitch.test.js b/communication/bluetooth_standard/src/main/js/test/BRSwitch.test.js index 58cac4e2760cad01b8d372b0b5b8a0c6dc93913c..21120def33c4339641e060ee540937ce5770499d 100644 --- a/communication/bluetooth_standard/src/main/js/test/BRSwitch.test.js +++ b/communication/bluetooth_standard/src/main/js/test/BRSwitch.test.js @@ -82,25 +82,30 @@ describe('bluetoothhostTest', function() { * @tc.level Level 0 */ it('SUB_COMMUNICATION_BLUETOOTH_BR_Switch_0100', 0, async function (done) { + function onReceiveEvent(data) { + console.info('bluetooth state001 ='+ JSON.stringify(data)); + } + await bluetooth.on('stateChange', onReceiveEvent); let state = bluetooth.getState(); - console.info('[bluetooth_js] get bluetooth state result'+ JSON.stringify(state)); + console.info('[bluetooth_js] get bluetooth state001'+ JSON.stringify(state)); if(state!=BluetoothState.STATE_ON) { let enable = bluetooth.enableBluetooth(); - await sleep(3000); - console.info('[bluetooth_js] bluetooth enable result'+JSON.stringify(enable)); + await sleep(5000); + console.info('[bluetooth_js] bluetooth enable001'+JSON.stringify(enable)); expect(enable).assertTrue(); let state1 = bluetooth.getState(); - console.info('[bluetooth_js] enable state1 '+ JSON.stringify(state1)); + console.info('[bluetooth_js] enable state001 '+ JSON.stringify(state1)); expect(state1).assertEqual(BluetoothState.STATE_ON); } let disable = bluetooth.disableBluetooth(); await sleep(3000); - console.info('[bluetooth_js] bluetooth disable result'+JSON.stringify(disable)); + console.info('[bluetooth_js] bluetooth disable001'+JSON.stringify(disable)); expect(disable).assertTrue(); let state2 = bluetooth.getState(); - console.info('[bluetooth_js] disable state2 '+ JSON.stringify(state2)); + console.info('[bluetooth_js] disable state001 '+ JSON.stringify(state2)); expect(state2).assertEqual(BluetoothState.STATE_OFF); + await bluetooth.off('stateChange', onReceiveEvent); done() }) diff --git a/communication/dsoftbus/rpc/BUILD.gn b/communication/dsoftbus/rpc/BUILD.gn old mode 100755 new mode 100644 diff --git a/communication/dsoftbus/rpc/Test.json b/communication/dsoftbus/rpc/Test.json old mode 100755 new mode 100644 index 8298fdcfe0dad0430d313790ff23f272eabc7691..64b24131994477ff3cec9dd94382111ae24f2e17 --- a/communication/dsoftbus/rpc/Test.json +++ b/communication/dsoftbus/rpc/Test.json @@ -13,7 +13,7 @@ { "test-file-name": [ "ActsRpcHapTest.hap", - "./resource/dsoftbus/ipcserver/entry-release-standard-signed.hap" + "ActsRpcHapServer.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/communication/dsoftbus/rpc/src/main/config.json b/communication/dsoftbus/rpc/src/main/config.json old mode 100755 new mode 100644 index 588bbb972b8844744e21605cb2566b59fe180384..e235838ce54667e156464fe5cd447c92f52a27d2 --- a/communication/dsoftbus/rpc/src/main/config.json +++ b/communication/dsoftbus/rpc/src/main/config.json @@ -30,6 +30,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/communication/dsoftbus/rpc/src/main/js/test/List.test.js b/communication/dsoftbus/rpc/src/main/js/test/List.test.js old mode 100755 new mode 100644 diff --git a/communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js b/communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js index e50881dc6ed3cbfcc70ee60eedb589e75c88ac6e..08bfc6c0034fe4e78c9bd72bc96e355fd7ec5388 100755 --- a/communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js +++ b/communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js @@ -22,7 +22,7 @@ export default function actsRpcClientJsTest() { var gIRemoteObject = undefined; describe('ActsRpcClientJsTest', function(){ - console.info("-----------------------SUB_Softbus_IPC_MessageParce_Test is starting-----------------------"); + console.info("-----------------------SUB_Softbus_IPC_Compatibility_MessageParce_Test is starting-----------------------"); beforeEach(async function (){ console.info('beforeEach called'); @@ -40,6 +40,7 @@ describe('ActsRpcClientJsTest', function(){ const M = 1024*1024; const G = 1024*1024*1024; const CODE_WRITE_BYTEARRAY = 1; + const CODE_SAME_PROCESS = 1; const CODE_WRITE_INTARRAY = 2; const CODE_WRITE_FLOATARRAY = 3; const CODE_WRITE_SHORT = 4; @@ -69,6 +70,8 @@ describe('ActsRpcClientJsTest', function(){ const CODE_FILESDIR = 29; const CODE_WRITE_REMOTEOBJECTARRAY_1 = 30; const CODE_WRITE_REMOTEOBJECTARRAY_2 = 31; + const CODE_ONREMOTEREQUESTEX_OR_ONREMOTEREQUEST = 32; + const CODE_ONREMOTEREQUESTEX = 33; function connectAbility() { let want = { @@ -164,40 +167,26 @@ describe('ActsRpcClientJsTest', function(){ case 1: { let tmp1 = data.readByte() - let tmp2 = data.readByte() - let tmp3 = data.readShort() - let tmp4 = data.readShort() - let tmp5 = data.readInt() - let tmp6 = data.readInt() - let tmp7 = data.readLong() - let tmp8 = data.readLong() - let tmp9 = data.readFloat() - let tmp10 = data.readFloat() - let tmp11 = data.readDouble() - let tmp12 = data.readDouble() - let tmp13 = data.readBoolean() - let tmp14 = data.readBoolean() - let tmp15 = data.readChar() - let tmp16 = data.readString() + let tmp2 = data.readShort() + let tmp3 = data.readInt() + let tmp4 = data.readLong() + let tmp5 = data.readFloat() + let tmp6 = data.readDouble() + let tmp7 = data.readBoolean() + let tmp8 = data.readChar() + let tmp9 = data.readString() let s = new MySequenceable(null, null) data.readSequenceable(s) reply.writeNoException() reply.writeByte(tmp1) - reply.writeByte(tmp2) - reply.writeShort(tmp3) - reply.writeShort(tmp4) - reply.writeInt(tmp5) - reply.writeInt(tmp6) - reply.writeLong(tmp7) - reply.writeLong(tmp8) - reply.writeFloat(tmp9) - reply.writeFloat(tmp10) - reply.writeDouble(tmp11) - reply.writeDouble(tmp12) - reply.writeBoolean(tmp13) - reply.writeBoolean(tmp14) - reply.writeChar(tmp15) - reply.writeString(tmp16) + reply.writeShort(tmp2) + reply.writeInt(tmp3) + reply.writeLong(tmp4) + reply.writeFloat(tmp5) + reply.writeDouble(tmp6) + reply.writeBoolean(tmp7) + reply.writeChar(tmp8) + reply.writeString(tmp9) reply.writeSequenceable(s) return true } @@ -270,532 +259,532 @@ describe('ActsRpcClientJsTest', function(){ }) /* - * @tc.number SUB_Softbus_IPC_MessageParcel_00100 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_00100 * @tc.name Call the writeinterfacetoken interface, write the interface descriptor, and read interfacetoken * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_00100", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_00100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_00100", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_00100---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_00100: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00100: create object successfully."); var token = "hello ruan zong xian"; var result = data.writeInterfaceToken(token); - console.info("SUB_Softbus_IPC_MessageParcel_00100:run writeInterfaceToken result is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00100:run writeInterfaceToken result is " + result); expect(result).assertTrue(); var resultToken = data.readInterfaceToken(); - console.info("SUB_Softbus_IPC_MessageParcel_00100:run readInterfaceToken result is " + resultToken); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00100:run readInterfaceToken result is " + resultToken); expect(resultToken).assertEqual(token); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_00100:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00100:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_00100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_00100---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_00200 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_00200 * @tc.name Call the writeinterfacetoken interface, write the interface descriptor, and read interfacetoken * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_00200", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_00200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_00200", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_00200---------------------------"); try{ for (let i = 0; i<5; i++){ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_00200: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00200: create object successfully."); var token = "hello ruan zong xian"; var result = data.writeInterfaceToken(token); - console.info("SUB_Softbus_IPC_MessageParcel_00200:run writeInterfaceToken result is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00200:run writeInterfaceToken result is " + result); expect(result).assertTrue(); var resultToken = data.readInterfaceToken(); - console.info("SUB_Softbus_IPC_MessageParcel_00200:run readInterfaceToken result is " + resultToken); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00200:run readInterfaceToken result is " + resultToken); expect(resultToken).assertEqual(token); data.reclaim(); } } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_00200:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00200:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_00200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_00200---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_00300 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_00300 * @tc.name Call the writeinterfacetoken interface to write a non string interface descriptor and read interfacetoken * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_00300", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_00300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_00300", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_00300---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_00300: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00300: create object successfully."); var token = ""; for(let i = 0; i < (40*K -1); i++){ token += 'a'; }; var result = data.writeInterfaceToken(token); - console.info("SUB_Softbus_IPC_MessageParcel_00300:run writeInterfaceToken is" + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00300:run writeInterfaceToken is" + result); expect(result).assertTrue(); var resultToken = data.readInterfaceToken(); - console.info("SUB_Softbus_IPC_MessageParcel_00300:run readInterfaceToken is " + resultToken.length); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00300:run readInterfaceToken is " + resultToken.length); expect(resultToken).assertEqual(token); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_00300: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00300: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_00300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_00300---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_00400 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_00400 * @tc.name The WriteInterfaceToken interface is called, the exceeding-length interface descriptor is written, and the InterfaceToken is read * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_00400", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_00400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_00400", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_00400---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_00400: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00400: create object successfully."); var token = ""; for(let i = 0; i < 40*K; i++){ token += 'a'; }; var result = data.writeInterfaceToken(token); - console.info("SUB_Softbus_IPC_MessageParcel_00400:run writeInterfaceToken is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00400:run writeInterfaceToken is " + result); expect(result).assertEqual(false); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_00400: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00400: error = " + error); expect(error != null).assertTrue(); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_00400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_00400---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_00500 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_00500 * @tc.name Call the writeinterfacetoken interface to write a non string interface descriptor and read interfacetoken * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_00500", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_00500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_00500", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_00500---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_00500: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00500: create object successfully."); var token = 123; var result = data.writeInterfaceToken(token); - console.info("SUB_Softbus_IPC_MessageParcel_00500:run writeInterfaceToken is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00500:run writeInterfaceToken is " + result); expect(result).assertEqual(false); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_00500: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00500: error = " + error); expect(error != null).assertTrue(); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_00500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_00500---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_00600 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_00600 * @tc.name The data size of the messageparcel obtained by calling the getSize interface * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_00600", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_00600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_00600", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_00600---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_00600: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00600: create object successfully."); var size = data.getSize(); - console.info("SUB_Softbus_IPC_MessageParcel_00600:run getSize is " + size); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00600:run getSize is " + size); expect(size).assertEqual(0); var addData = 1; var result = data.writeInt(addData); - console.info("SUB_Softbus_IPC_MessageParcel_00600:run writeInt is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00600:run writeInt is " + result); expect(result).assertTrue(); size = data.getSize(); - console.info("SUB_Softbus_IPC_MessageParcel_00600:run getSize is " + size); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00600:run getSize is " + size); expect(size).assertEqual(4); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_00600: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00600: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_00600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_00600---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_00700 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_00700 * @tc.name The capacity of the messageparcel obtained by calling the getcapacity interface * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_00700", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_00700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_00700", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_00700---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_00700: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00700: create object successfully."); var size = data.getCapacity(); - console.info("SUB_Softbus_IPC_MessageParcel_00700:run getCapacity is " + size); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00700:run getCapacity is " + size); expect(size).assertEqual(0); var addData = 1; var result = data.writeInt(addData); - console.info("SUB_Softbus_IPC_MessageParcel_00700:run writeInt is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00700:run writeInt is " + result); expect(result).assertTrue(); size = data.getCapacity(); - console.info("SUB_Softbus_IPC_MessageParcel_00700:run getCapacity is " + size); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00700:run getCapacity is " + size); expect(size).assertEqual(64); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_00700: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00700: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_00700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_00700---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_00800 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_00800 * @tc.name Call the SetSize interface to set the data size of messageparcel * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_00800", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_00800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_00800", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_00800---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_00800: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00800: create object successfully."); var addData = 1; var result = data.writeInt(addData); - console.info("SUB_Softbus_IPC_MessageParcel_00800:run writeInt is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00800:run writeInt is " + result); expect(result).assertTrue(); var size = 6; var setResult = data.setSize(size); - console.info("SUB_Softbus_IPC_MessageParcel_00800:run setSize " + setResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00800:run setSize " + setResult); expect(setResult).assertTrue(); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_00800: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00800: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_00800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_00800---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_00900 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_00900 * @tc.name Call the SetSize interface to set the data size of messageparcel * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_00900", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_00900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_00900", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_00900---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_00900: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00900: create object successfully."); var addData = 1; var result = data.writeInt(addData); - console.info("SUB_Softbus_IPC_MessageParcel_00900:run writeInt is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00900:run writeInt is " + result); expect(result).assertTrue(); var size = 4*G; var setResult = data.setSize(size); - console.info("SUB_Softbus_IPC_MessageParcel_00900:run setSize " + setResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00900:run setSize " + setResult); expect(setResult).assertTrue(); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_00900: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_00900: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_00900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_00900---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_01000 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_01000 * @tc.name Call the SetSize interface to set the data size of messageparcel * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_01000", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_01000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_01000", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01000---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_01000: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01000: create object successfully."); var addData = 1; var result = data.writeInt(addData); - console.info("SUB_Softbus_IPC_MessageParcel_01000:run writeInt is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01000:run writeInt is " + result); expect(result).assertTrue(); var size = 4*G - 4; var setResult = data.setSize(size); - console.info("SUB_Softbus_IPC_MessageParcel_01000:run setSize " + setResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01000:run setSize " + setResult); expect(setResult).assertEqual(false); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_01000: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01000: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_01000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01000---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_01100 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_01100 * @tc.name Call the SetSize interface to set the data size of messageparcel. The write data size does not match the set value * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_01100", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_01100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_01100", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01100---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_01100: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01100: create object successfully."); var capacity = 64; var setResult = data.setCapacity(capacity); - console.info("SUB_Softbus_IPC_MessageParcel_01100:run setCapacity " + setResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01100:run setCapacity " + setResult); expect(setResult).assertTrue(); var size = 4; setResult = data.setSize(size); - console.info("SUB_Softbus_IPC_MessageParcel_01100:run setSize " + setResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01100:run setSize " + setResult); expect(setResult).assertTrue(); var addData = 2; var result = data.writeLong(addData); - console.info("SUB_Softbus_IPC_MessageParcel_01100:run writeInt is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01100:run writeInt is " + result); expect(result).assertTrue(); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_01100: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01100: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_01100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01100---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_01200 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_01200 * @tc.name Call the setcapacity interface to set the capacity of messageparcel * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_01200", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_01200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_01200", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01200---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_01200: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01200: create object successfully."); var size = 64; var setResult = data.setCapacity(size); - console.info("SUB_Softbus_IPC_MessageParcel_01200:run setSize " + setResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01200:run setSize " + setResult); expect(setResult).assertTrue(); var addData = 1; var result = data.writeInt(addData); - console.info("SUB_Softbus_IPC_MessageParcel_01200:run writeInt is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01200:run writeInt is " + result); expect(result).assertTrue(); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_01200: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01200: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_01200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01200---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_01300 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_01300 * @tc.name Call the setcapacity interface to set the capacity of messageparcel * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_01300", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_01300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_01300", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01300---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_01300: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01300: create object successfully."); var size = M; var setResult = data.setCapacity(size); - console.info("SUB_Softbus_IPC_MessageParcel_01300:run setSize " + setResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01300:run setSize " + setResult); expect(setResult).assertTrue(); var addData = 1; var result = data.writeInt(addData); - console.info("SUB_Softbus_IPC_MessageParcel_01300:run writeInt is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01300:run writeInt is " + result); expect(result).assertTrue(); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_01300: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01300: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_01300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01300---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_01400 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_01400 * @tc.name Call the setcapacity interface to set the capacity of messageparcel * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_01400", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_01400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_01400", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01400---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_01400: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01400: create object successfully."); var size = 4*G; var setResult = data.setCapacity(size); - console.info("SUB_Softbus_IPC_MessageParcel_01400:run setSize " + setResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01400:run setSize " + setResult); expect(setResult).assertEqual(false); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_01400: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01400: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_01400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01400---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_01500 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_01500 * @tc.name Call the setcapacity interface to set the capacity of messageparcel. * The write data capacity is inconsistent with the set value * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_01500", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_01500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_01500", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01500---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_01500: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01500: create object successfully."); var size = 4; var setResult = data.setCapacity(size); - console.info("SUB_Softbus_IPC_MessageParcel_01500:run setSize " + setResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01500:run setSize " + setResult); expect(setResult).assertTrue(); var addData = [1, 2, 3, 4, 5, 6, 7, 8]; var result = data.writeIntArray(addData); - console.info("SUB_Softbus_IPC_MessageParcel_01500:run writeInt is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01500:run writeInt is " + result); expect(result).assertEqual(false); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_01500: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01500: error = " + error); expect(error != null).assertTrue(); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_01500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01500---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_01600 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_01600 * @tc.name Empty object to obtain the readable byte space, read location, * writable byte space and write location information of messageparcel * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_01600", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_01600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_01600", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01600---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_01600: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01600: create object successfully."); var result1 = data.getWritableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_01600: run getWritableBytes is " + result1); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01600: run getWritableBytes is " + result1); expect(result1).assertEqual(0); var result2 = data.getReadableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_01600: run getReadableBytes is " + result2); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01600: run getReadableBytes is " + result2); expect(result2).assertEqual(0); var result3 = data.getReadPosition(); - console.info("SUB_Softbus_IPC_MessageParcel_01600: run getReadPosition is " + result2); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01600: run getReadPosition is " + result2); expect(result3).assertEqual(0); var result4 = data.getWritePosition(); - console.info("SUB_Softbus_IPC_MessageParcel_01600: run getWritePosition is " + result2); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01600: run getWritePosition is " + result2); expect(result4).assertEqual(0); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_01600: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01600: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_01600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01600---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_01700 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_01700 * @tc.name Create an object and write data to obtain the readable byte space, read location, * writable byte space and write location information of messageparcel * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_01700", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_01700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_01700", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01700---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_01700: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01700: create object successfully."); var dataInt = 1; var resultInt = data.writeInt(dataInt); - console.info("SUB_Softbus_IPC_MessageParcel_01700: run writeInt is " + resultInt); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01700: run writeInt is " + resultInt); var dataLong = 2; var resultLong = data.writeLong(dataLong); - console.info("SUB_Softbus_IPC_MessageParcel_01700: run writeLong is " + resultLong); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01700: run writeLong is " + resultLong); var result1 = data.getWritableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_01700: run getWritableBytes is " + result1); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01700: run getWritableBytes is " + result1); expect(result1).assertEqual(52); var result2 = data.getReadableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_01700: run getReadableBytes is " + result2); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01700: run getReadableBytes is " + result2); expect(result2).assertEqual(12); var result3 = data.getReadPosition(); - console.info("SUB_Softbus_IPC_MessageParcel_01700: run getReadPosition is " + result3); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01700: run getReadPosition is " + result3); expect(result3).assertEqual(0); var result4 = data.getWritePosition(); - console.info("SUB_Softbus_IPC_MessageParcel_01700: run getWritePosition is " + result4); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01700: run getWritePosition is " + result4); expect(result4).assertEqual(12); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_01700: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01700: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_01700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01700---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_01800 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_01800 * @tc.name Call rewindread interface to offset the read position to the specified position * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_01800", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_01800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_01800", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01800---------------------------"); try{ var data = rpc.MessageParcel.create(); expect(data.getWritableBytes()).assertEqual(0); @@ -805,10 +794,10 @@ describe('ActsRpcClientJsTest', function(){ var dataInt = 1; var resultInt = data.writeInt(dataInt); - console.info("SUB_Softbus_IPC_MessageParcel_01800: run writeInt is " + resultInt); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01800: run writeInt is " + resultInt); var dataLong = 2; var resultLong = data.writeLong(dataLong); - console.info("SUB_Softbus_IPC_MessageParcel_01800: run writeLong is " + resultLong); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01800: run writeLong is " + resultLong); expect(data.getWritableBytes()).assertEqual(52); expect(data.getReadableBytes()).assertEqual(12); @@ -816,285 +805,285 @@ describe('ActsRpcClientJsTest', function(){ expect(data.getWritePosition()).assertEqual(12); var readIntData = data.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_01800: run readInt is " + readIntData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01800: run readInt is " + readIntData); expect(readIntData).assertEqual(dataInt); var writePosition = 0; var writeResult = data.rewindWrite(writePosition); - console.info("SUB_Softbus_IPC_MessageParcel_01800: run rewindWrite is " + writeResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01800: run rewindWrite is " + writeResult); expect(writeResult).assertTrue(); expect(data.getWritePosition()).assertEqual(0); dataInt = 3; resultInt = data.writeInt(dataInt); - console.info("SUB_Softbus_IPC_MessageParcel_01800: run writeInt is " + resultInt); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01800: run writeInt is " + resultInt); var readPosition = 0; var readResult = data.rewindRead(readPosition); - console.info("SUB_Softbus_IPC_MessageParcel_01800: run rewindWrite is " + readResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01800: run rewindWrite is " + readResult); expect(readResult).assertTrue(); readIntData = data.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_01800: run readInt is " + readIntData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01800: run readInt is " + readIntData); expect(readIntData).assertEqual(dataInt); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_01800: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01800: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_01800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01800---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_01900 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_01900 * @tc.name The rewindread interface is called to re offset the read position to the specified position. The specified position is out of range * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_01900", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_01900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_01900", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_01900---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_01900: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: create object successfully."); var result1 = data.getWritableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_01900: run getWritableBytes is " + result1); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run getWritableBytes is " + result1); expect(result1 == 0).assertTrue(); var result2 = data.getReadableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_01900: run getReadableBytes is " + result2); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run getReadableBytes is " + result2); expect(result2 == 0).assertTrue(); var result3 = data.getReadPosition(); - console.info("SUB_Softbus_IPC_MessageParcel_01900: run getReadPosition is " + result3); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run getReadPosition is " + result3); expect(result3 == 0).assertTrue(); var result4 = data.getWritePosition(); - console.info("SUB_Softbus_IPC_MessageParcel_01900: run getWritePosition is " + result4); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run getWritePosition is " + result4); expect(result4 == 0).assertTrue(); var dataInt = 1; var resultInt = data.writeInt(dataInt); - console.info("SUB_Softbus_IPC_MessageParcel_01900: run writeInt is " + resultInt); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run writeInt is " + resultInt); expect(resultInt).assertTrue(); var dataLong = 2; var resultLong = data.writeLong(dataLong); - console.info("SUB_Softbus_IPC_MessageParcel_01900: run writeLong is " + resultLong); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run writeLong is " + resultLong); expect(resultLong).assertTrue(); result1 = data.getWritableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_01900: run getWritableBytes is " + result1); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run getWritableBytes is " + result1); expect(result1 == 52).assertTrue(); result2 = data.getReadableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_01900: run getReadableBytes is " + result2); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run getReadableBytes is " + result2); expect(result2 == 12).assertTrue(); result3 = data.getReadPosition(); - console.info("SUB_Softbus_IPC_MessageParcel_01900: run getReadPosition is " + result3); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run getReadPosition is " + result3); expect(result3 == 0).assertTrue(); result4 = data.getWritePosition(); - console.info("SUB_Softbus_IPC_MessageParcel_01900: run getWritePosition is " + result4); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run getWritePosition is " + result4); expect(result4 == 12).assertTrue(); var readPosition = 100; var readResult = data.rewindRead(readPosition); - console.info("SUB_Softbus_IPC_MessageParcel_01900: run rewindRead is " + readResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: run rewindRead is " + readResult); expect(readResult == false).assertTrue(); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_01900: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_01900: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_01900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_01900---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_02000 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_02000 * @tc.name Call rewindwrite and the interface offsets the write position to the specified position * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_02000", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_02000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_02000", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02000---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_02000: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02000: create object successfully."); var dataInt = 1; var resultInt = data.writeInt(dataInt); - console.info("SUB_Softbus_IPC_MessageParcel_02000: run writeInt is " + resultInt); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02000: run writeInt is " + resultInt); expect(resultInt).assertTrue(); var readIntData = data.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_02000: run readInt is " + readIntData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02000: run readInt is " + readIntData); expect(readIntData).assertEqual(dataInt); var writePosition = 0; var rewindWriteResult = data.rewindWrite(writePosition); - console.info("SUB_Softbus_IPC_MessageParcel_02000: run rewindWrite is" + rewindWriteResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02000: run rewindWrite is" + rewindWriteResult); expect(rewindWriteResult).assertTrue(); dataInt = 3; resultInt = data.writeInt(dataInt); - console.info("SUB_Softbus_IPC_MessageParcel_02000: run writeInt is " + resultInt); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02000: run writeInt is " + resultInt); expect(resultInt).assertTrue(); var readPosition = 0; var rewindReadResult = data.rewindRead(readPosition); - console.info("SUB_Softbus_IPC_MessageParcel_02000: run rewindRead is " + rewindReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02000: run rewindRead is " + rewindReadResult); expect(rewindReadResult); readIntData = data.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_02000: run readInt is " + readIntData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02000: run readInt is " + readIntData); expect(readIntData).assertEqual(dataInt); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_02000: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02000: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02000---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_02100 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_02100 * @tc.name Call rewindwrite and the interface offsets the write position to the specified position. The specified position is out of range * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_02100", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_02100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_02100", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02100---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_02100: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02100: create object successfully."); var dataInt = 1; var resultInt = data.writeInt(dataInt); - console.info("SUB_Softbus_IPC_MessageParcel_02100: run writeInt result is " + resultInt); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02100: run writeInt result is " + resultInt); expect(resultInt).assertTrue(); var readIntData = data.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_02100: run readInt is" + readIntData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02100: run readInt is" + readIntData); expect(readIntData == dataInt).assertTrue(); var writePosition = 99; var rewindWriteResult = data.rewindWrite(writePosition); - console.info("SUB_Softbus_IPC_MessageParcel_02100: run rewindWrite is " + rewindWriteResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02100: run rewindWrite is " + rewindWriteResult); expect(rewindWriteResult).assertEqual(false); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_02100: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02100: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02100---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_02200 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_02200 * @tc.name Call the writeshortarray interface, write the array to the messageparcel instance, * and call readshortarray to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_02200", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_02200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_02200", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02200---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_02200: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02200: create object successfully."); var wShortArryData = [3, 5, 9]; var writeShortArrayResult = data.writeShortArray(wShortArryData); - console.info("SUB_Softbus_IPC_MessageParcel_02200: run writeShortArray " + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02200: run writeShortArray " + writeShortArrayResult); expect(writeShortArrayResult).assertTrue(); var rShortArryData = data.readShortArray(); - console.info("SUB_Softbus_IPC_MessageParcel_02200: run readShortArray is " + rShortArryData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02200: run readShortArray is " + rShortArryData); assertArrayElementEqual(rShortArryData,wShortArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_02200: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02200: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02200---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_02300 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_02300 * @tc.name Call the writeshortarray interface, write the short integer array to the messageparcel instance, * and call readshortarray (datain: number []) to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_02300", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_02300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_02300", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02300---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_02300: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02300: create object successfully."); var wShortArryData = []; for(let i=0;i<(50*K - 1);i++){ wShortArryData[i] = 1; } var writeShortArrayResult = data.writeShortArray(wShortArryData); - console.info("SUB_Softbus_IPC_MessageParcel_02300: run writeShortArray " + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02300: run writeShortArray " + writeShortArrayResult); expect(writeShortArrayResult).assertTrue(); var rShortArryData = []; data.readShortArray(rShortArryData); - console.info("SUB_Softbus_IPC_MessageParcel_02300: run readShortArray is " + rShortArryData.length); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02300: run readShortArray is " + rShortArryData.length); assertArrayElementEqual(rShortArryData,wShortArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_02300: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02300: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02300---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_02400 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_02400 * @tc.name Writeshortarray interface, boundary value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_02400", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_02400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_02400", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02400---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_02400: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02400: create object successfully."); var wShortArryData = [-32768, 0, 1, 2, 32767]; var writeShortArrayResult = data.writeShortArray(wShortArryData); - console.info("SUB_Softbus_IPC_MessageParcel_02400: run writeShortArray is " + writeShortArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02400: run writeShortArray is " + writeShortArrayResult); expect(writeShortArrayResult).assertTrue(); var rShortArryData = []; data.readShortArray(rShortArryData); - console.info("SUB_Softbus_IPC_MessageParcel_02400: run readShortArray is " + rShortArryData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02400: run readShortArray is " + rShortArryData); assertArrayElementEqual(rShortArryData,wShortArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_02400: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02400: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02400---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_02500 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_02500 * @tc.name Writeshortarray interface, illegal value validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_02500", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_02500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_02500", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02500---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_02500: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02500: create object successfully."); var wShortArryData = [-32769, 0, 1, 2]; var writeShortArrayResult = data.writeShortArray(wShortArryData); - console.info("SUB_Softbus_IPC_MessageParcel_02500: run writeShortArray is " + writeShortArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02500: run writeShortArray is " + writeShortArrayResult); expect(writeShortArrayResult).assertTrue(); var rShotrArrayData = data.readShortArray(); - console.info("SUB_Softbus_IPC_MessageParcel_02500: run readShortArray is " + rShotrArrayData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02500: run readShortArray is " + rShotrArrayData); expect(32767).assertEqual(rShotrArrayData[0]); expect(wShortArryData[1]).assertEqual(rShotrArrayData[1]); expect(wShortArryData[2]).assertEqual(rShotrArrayData[2]); @@ -1102,31 +1091,31 @@ describe('ActsRpcClientJsTest', function(){ data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_02500: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02500: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02500---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_02600 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_02600 * @tc.name Writeshortarray interface, illegal value validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_02600", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_02600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_02600", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02600---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_02600: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02600: create object successfully."); var wShortArryData = [0, 1, 2, 32768]; var writeShortArrayResult = data.writeShortArray(wShortArryData); - console.info("SUB_Softbus_IPC_MessageParcel_02600: run writeShortArray is " + writeShortArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02600: run writeShortArray is " + writeShortArrayResult); expect(writeShortArrayResult).assertTrue(); var rShotrArrayData = data.readShortArray(); - console.info("SUB_Softbus_IPC_MessageParcel_02600: run readShortArray " + rShotrArrayData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02600: run readShortArray " + rShotrArrayData); expect(wShortArryData[0]).assertEqual(rShotrArrayData[0]); expect(wShortArryData[1]).assertEqual(rShotrArrayData[1]); expect(wShortArryData[2]).assertEqual(rShotrArrayData[2]); @@ -1134,366 +1123,366 @@ describe('ActsRpcClientJsTest', function(){ data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_02600: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02600: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02600---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_02700 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_02700 * @tc.name Writeshortarray interface, illegal value validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_02700", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_02700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_02700", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02700---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_02700: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02700: create object successfully."); var wShortArryData = []; for (let i = 0; i < 50*K; i++){ wShortArryData[i] = 11111; } var writeShortArrayResult = data.writeShortArray(wShortArryData); - console.info("SUB_Softbus_IPC_MessageParcel_02700: run writeShortArray " + writeShortArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02700: run writeShortArray " + writeShortArrayResult); expect(writeShortArrayResult).assertEqual(false); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_02700: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02700: error = " + error); expect(error != null).assertTrue(); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02700---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_02800 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_02800 * @tc.name Call the writelongarray interface, write the long integer array to the messageparcel instance, * and call readlongarray to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_02800", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_02800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_02800", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02800---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_02800: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02800: create object successfully."); var LongArryData = []; for (let i = 0;i<(25*K - 1);i++){ LongArryData[i] = 11; } var WriteLongArray = data.writeLongArray(LongArryData); - console.info("SUB_Softbus_IPC_MessageParcel_03200: run writeShortArray is " + WriteLongArray); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03200: run writeShortArray is " + WriteLongArray); expect(WriteLongArray).assertTrue(); var rLongArryData = data.readLongArray(); - console.info("SUB_Softbus_IPC_MessageParcel_03200: run readShortArray is " + rLongArryData.length); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03200: run readShortArray is " + rLongArryData.length); assertArrayElementEqual(LongArryData,rLongArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_02800: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02800: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02800---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_02900 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_02900 * @tc.name Writelongarray interface, boundary value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_02900", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_02900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_02900", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_02900---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_02900: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02900: create object successfully."); var wLongArryData = [-2147483648, 0, 1, 2, 2147483647]; var writeLongArrayResult = data.writeLongArray(wLongArryData); - console.info("SUB_Softbus_IPC_MessageParcel_02900: run writeShortArrayis is " + writeLongArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02900: run writeShortArrayis is " + writeLongArrayResult); expect(writeLongArrayResult).assertTrue(); var rLongArryData = data.readLongArray(); - console.info("SUB_Softbus_IPC_MessageParcel_02900: run readShortArray is " + rLongArryData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02900: run readShortArray is " + rLongArryData); assertArrayElementEqual(wLongArryData,rLongArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_02900: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_02900: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_02900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_02900---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_03000 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_03000 * @tc.name Writelongarray interface, illegal value validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_03000", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_03000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_03000", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03000---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_03000: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03000: create object successfully."); var errorLongArryData = [-2147483649, 0, 1, 2, 3]; var erWriteLongArray = data.writeLongArray(errorLongArryData); - console.info("SUB_Softbus_IPC_MessageParcel_03000: run writeShortArrayis is " + erWriteLongArray); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03000: run writeShortArrayis is " + erWriteLongArray); expect(erWriteLongArray).assertTrue(); var erLongArryData = data.readLongArray(); - console.info("SUB_Softbus_IPC_MessageParcel_03000: run readShortArray is " + erLongArryData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03000: run readShortArray is " + erLongArryData); assertArrayElementEqual(errorLongArryData,erLongArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_03000: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03000: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03000---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_03100 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_03100 * @tc.name Writelongarray interface, illegal value validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_03100", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_03100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_03100", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03100---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_03100: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03100: create object successfully."); var errorLongArryData = [0, 1, 2, 3, 2147483648]; var erWriteLongArray = data.writeLongArray(errorLongArryData); - console.info("SUB_Softbus_IPC_MessageParcel_03100: run writeShortArrayis is " + erWriteLongArray); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03100: run writeShortArrayis is " + erWriteLongArray); expect(erWriteLongArray).assertTrue(); var erLongArryData = data.readLongArray(); - console.info("SUB_Softbus_IPC_MessageParcel_03100: run readShortArray is " + erLongArryData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03100: run readShortArray is " + erLongArryData); assertArrayElementEqual(errorLongArryData,erLongArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_03100: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03100: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03100---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_03200 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_03200 * @tc.name Writelongarray interface, illegal value validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_03200", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_03200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_03200", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03200---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_03200: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03200: create object successfully."); var errorLongArryData = []; for (let i = 0;i<25*K;i++){ errorLongArryData[i] = 11; } var erWriteLongArray = data.writeLongArray(errorLongArryData); - console.info("SUB_Softbus_IPC_MessageParcel_03200: run writeShortArrayis is " + erWriteLongArray); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03200: run writeShortArrayis is " + erWriteLongArray); expect(erWriteLongArray).assertEqual(false); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_03200: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03200: error " + error); expect(error != null).assertTrue(); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03200---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_03300 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_03300 * @tc.name Call the writedoublearray interface, write the array to the messageparcel instance, * and call readdoublearra to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_03300", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_03300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_03300", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03300---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_03300: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03300: create object successfully."); var wDoubleArryData = [1.2, 235.67, 99.76]; var writeDoubleArrayResult = data.writeDoubleArray(wDoubleArryData); - console.info("SUB_Softbus_IPC_MessageParcel_03300: run writeShortArrayis is " + writeDoubleArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03300: run writeShortArrayis is " + writeDoubleArrayResult); expect(writeDoubleArrayResult).assertTrue(); var rDoubleArryData = data.readDoubleArray(); - console.info("SUB_Softbus_IPC_MessageParcel_03300: run readShortArray is " + rDoubleArryData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03300: run readShortArray is " + rDoubleArryData); assertArrayElementEqual(wDoubleArryData,rDoubleArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_03300: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03300: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03300---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_03400 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_03400 * @tc.name Call the writedoublearray interface, write the array to the messageparcel instance, * and call readdoublearra (datain: number []) to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_03400", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_03400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_03400", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03400---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_03400: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03400: create object successfully."); var wDoubleArryData = []; for(let i = 0;i < (25*K - 1);i++){ wDoubleArryData[i] = 11.1; } var writeDoubleArrayResult = data.writeDoubleArray(wDoubleArryData); - console.info("SUB_Softbus_IPC_MessageParcel_03400: run writeShortArrayis is " + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03400: run writeShortArrayis is " + writeDoubleArrayResult); expect(writeDoubleArrayResult).assertTrue(); var rDoubleArryData = []; data.readDoubleArray(rDoubleArryData); - console.info("SUB_Softbus_IPC_MessageParcel_03400: run readShortArray is " + rDoubleArryData.length); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03400: run readShortArray is " + rDoubleArryData.length); assertArrayElementEqual(wDoubleArryData,rDoubleArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_03400: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03400: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03400---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_03500 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_03500 * @tc.name Writedoublearray interface, boundary value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_03500", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_03500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_03500", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03500---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_03500: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03500: create object successfully."); var wDoubleArryData = [-1235453.2, 235.67, 9987659.76]; var writeDoubleArrayResult = data.writeDoubleArray(wDoubleArryData); - console.info("SUB_Softbus_IPC_MessageParcel_03500: run writeShortArrayis is " + writeDoubleArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03500: run writeShortArrayis is " + writeDoubleArrayResult); expect(writeDoubleArrayResult).assertTrue(); var rDoubleArryData = data.readDoubleArray(); - console.info("SUB_Softbus_IPC_MessageParcel_03500: run readShortArray is " + rDoubleArryData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03500: run readShortArray is " + rDoubleArryData); assertArrayElementEqual(wDoubleArryData,rDoubleArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_03500: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03500: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03500---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_03600 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_03600 * @tc.name Writedoublearray interface, illegal value validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_03600", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_03600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_03600", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03600---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_03600: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03600: create object successfully."); var DoubleArryData = [-12354883737337373873853.2, 235.67, 99999999999999993737373773987659.76]; var WriteDoubleArrayResult = data.writeDoubleArray(DoubleArryData); - console.info("SUB_Softbus_IPC_MessageParcel_03600: run writeDoubleArrayis is " + WriteDoubleArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03600: run writeDoubleArrayis is " + WriteDoubleArrayResult); expect(WriteDoubleArrayResult).assertTrue(); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_03600: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03600: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03600---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_03700 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_03700 * @tc.name Writedoublearray interface, illegal value validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_03700", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_03700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_03700", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03700---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_03700: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03700: create object successfully."); var errorDoubleArryData = []; for (let i=0;i<25*K;i++){ errorDoubleArryData[i] = 11.1; } var WriteDoubleArrayResult = data.writeDoubleArray(errorDoubleArryData); - console.info("SUB_Softbus_IPC_MessageParcel_03700: run writeDoubleArrayis is " + WriteDoubleArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03700: run writeDoubleArrayis is " + WriteDoubleArrayResult); expect(WriteDoubleArrayResult).assertEqual(false); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_03700: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03700: error " + error); expect(error != null).assertTrue(); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03700---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_03800 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_03800 * @tc.name Call the writeboolean array interface, write the array to the messageparcel instance, * and call readboolean array to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_03800", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_03800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_03800", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03800---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_03800: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03800: create object successfully."); var wBooleanArryData = [true, false, false]; var writeBooleanArrayResult = data.writeBooleanArray(wBooleanArryData); - console.info("SUB_Softbus_IPC_MessageParcel_03800: run writeShortArrayis is " + writeBooleanArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03800: run writeShortArrayis is " + writeBooleanArrayResult); expect(writeBooleanArrayResult).assertTrue(); var rBooleanArryData = data.readBooleanArray(); - console.info("SUB_Softbus_IPC_MessageParcel_03800: run readShortArray is " + rBooleanArryData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03800: run readShortArray is " + rBooleanArryData); assertArrayElementEqual(wBooleanArryData,rBooleanArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_03800: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03800: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03800---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_03900 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_03900 * @tc.name Call the writeboolean array interface, write the array to the messageparcel instance, * and call readboolean array (datain: number []) to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_03900", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_03900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_03900", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_03900---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_03900: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03900: create object successfully."); var wBooleanArryData = []; for (let i=0;i<(50*K - 1);i++){ @@ -1504,60 +1493,60 @@ describe('ActsRpcClientJsTest', function(){ } } var writeBooleanArrayResult = data.writeBooleanArray(wBooleanArryData); - console.info("SUB_Softbus_IPC_MessageParcel_03900: run writeShortArrayis is " + writeBooleanArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03900: run writeShortArrayis is " + writeBooleanArrayResult); expect(writeBooleanArrayResult).assertTrue(); var rBooleanArryData = []; data.readBooleanArray(rBooleanArryData); - console.info("SUB_Softbus_IPC_MessageParcel_03900: run readShortArray is " + rBooleanArryData.length); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03900: run readShortArray is " + rBooleanArryData.length); assertArrayElementEqual(wBooleanArryData,rBooleanArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_03900: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_03900: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_03900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_03900---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_04000 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_04000 * @tc.name Writeboolean array interface, illegal value validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_04000", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_04000", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04000---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_04000: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04000: create object successfully."); var BooleanArryData = [true, 'abc', false]; var WriteBooleanArrayResult = data.writeBooleanArray(BooleanArryData); - console.info("SUB_Softbus_IPC_MessageParcel_04000: run writeShortArrayis is " + WriteBooleanArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04000: run writeShortArrayis is " + WriteBooleanArrayResult); expect(WriteBooleanArrayResult).assertTrue(); var rBooleanArryData = data.readBooleanArray(); - console.info("SUB_Softbus_IPC_MessageParcel_04000: run readShortArray is " + rBooleanArryData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04000: run readShortArray is " + rBooleanArryData); var newboolean = [true,false,false]; assertArrayElementEqual(newboolean,rBooleanArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_04000: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04000: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04000---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_04100 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_04100 * @tc.name Writeboolean array interface, illegal value validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_04100", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_04100", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04100---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_04100: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04100: create object successfully."); var errorBooleanArryData = []; for (let i=0;i<50*K;i++){ @@ -1568,297 +1557,297 @@ describe('ActsRpcClientJsTest', function(){ }; } var WriteBooleanArrayResult = data.writeBooleanArray(errorBooleanArryData); - console.info("SUB_Softbus_IPC_MessageParcel_04100: run writeShortArrayis is " + WriteBooleanArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04100: run writeShortArrayis is " + WriteBooleanArrayResult); expect(WriteBooleanArrayResult).assertEqual(false); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_04100: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04100: error " + error); expect(error != null).assertTrue(); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04100---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_04200 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_04200 * @tc.name Call the writechararray interface, write the array to the messageparcel instance, * and call readchararray to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_04200", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_04200", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04200---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_04200: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04200: create object successfully."); var wCharArryData = []; for(let i=0;i<(50*K - 1);i++){ wCharArryData[i] = 96; } var writeCharArrayResult = data.writeCharArray(wCharArryData); - console.info("SUB_Softbus_IPC_MessageParcel_04200: run writeShortArrayis is " + writeCharArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04200: run writeShortArrayis is " + writeCharArrayResult); expect(writeCharArrayResult).assertTrue(); var rCharArryData = data.readCharArray(); - console.info("SUB_Softbus_IPC_MessageParcel_04200: run readShortArray is " + rCharArryData.length); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04200: run readShortArray is " + rCharArryData.length); assertArrayElementEqual(wCharArryData,rCharArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_04200: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04200: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04200---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_04300 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_04300 * @tc.name Call the writechararray interface, write the array to the messageparcel instance, * and call readchararray (datain: number []) to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_04300", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_04300", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04300---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_04300: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04300: create object successfully."); var wCharArryData = []; for(let i=0;i<(50*K - 1);i++){ wCharArryData[i] = 96; } var writeCharArrayResult = data.writeCharArray(wCharArryData); - console.info("SUB_Softbus_IPC_MessageParcel_04300: run writeShortArrayis is " + writeCharArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04300: run writeShortArrayis is " + writeCharArrayResult); expect(writeCharArrayResult).assertTrue(); var rCharArryData = []; data.readCharArray(rCharArryData); - console.info("SUB_Softbus_IPC_MessageParcel_04300: run readShortArray is " + rCharArryData.length); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04300: run readShortArray is " + rCharArryData.length); assertArrayElementEqual(wCharArryData,rCharArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_04300: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04300: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04300---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_04400 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_04400 * @tc.name Writechararray interface, illegal value validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_04400", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_04400", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04400---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_04400: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04400: create object successfully."); var errorCharArryData = [10, 'asfgdgdtu', 20]; var WriteCharArrayResult = data.writeCharArray(errorCharArryData); - console.info("SUB_Softbus_IPC_MessageParcel_04400: run writeShortArrayis is " + WriteCharArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04400: run writeShortArrayis is " + WriteCharArrayResult); expect(WriteCharArrayResult).assertTrue(); var rCharArryData = data.readCharArray(); - console.info("SUB_Softbus_IPC_MessageParcel_04400: run readShortArray is " + rCharArryData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04400: run readShortArray is " + rCharArryData); var xresult = [10,0,20]; assertArrayElementEqual(xresult,rCharArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_04400: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04400: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04400---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_04500 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_04500 * @tc.name Call the writestringarray interface, write the array to the messageparcel instance, * and call readstringarray (datain: number []) to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_04500", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_04500", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04500---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_04500: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04500: create object successfully."); var wStringArryData = ['abc', 'hello', 'beauty']; var writeStringArrayResult = data.writeStringArray(wStringArryData); - console.info("SUB_Softbus_IPC_MessageParcel_04500: run writeShortArrayis is " + writeStringArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04500: run writeShortArrayis is " + writeStringArrayResult); expect(writeStringArrayResult).assertTrue(); var rStringArryData = data.readStringArray(); - console.info("SUB_Softbus_IPC_MessageParcel_04500: run readShortArray is " + rStringArryData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04500: run readShortArray is " + rStringArryData); assertArrayElementEqual(wStringArryData,rStringArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_04500: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04500: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04500---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_04600 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_04600 * @tc.name Call the writestringarray interface, write the array to the messageparcel instance, * and call readstringarray() to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_04600", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_04600", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04600---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_04600: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04600: create object successfully."); var wStringArryData = ['abc', 'hello', 'beauty']; var writeStringArrayResult = data.writeStringArray(wStringArryData); - console.info("SUB_Softbus_IPC_MessageParcel_04600: run writeShortArrayis is " + writeStringArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04600: run writeShortArrayis is " + writeStringArrayResult); expect(writeStringArrayResult).assertTrue(); var rStringArryData = []; data.readStringArray(rStringArryData); - console.info("SUB_Softbus_IPC_MessageParcel_04600: run readShortArray is " + rStringArryData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04600: run readShortArray is " + rStringArryData); assertArrayElementEqual(wStringArryData,rStringArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_04600: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04600: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04600---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_04700 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_04700 * @tc.name Writestringarray interface, illegal value validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_04700", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_04700", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04700---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_04700: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04700: create object successfully."); var errorStringArryData = ['abc', 123, 'beauty']; var WriteStringArrayResult = data.writeStringArray(errorStringArryData); - console.info("SUB_Softbus_IPC_MessageParcel_04700: run writeStringArrayis is " + WriteStringArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04700: run writeStringArrayis is " + WriteStringArrayResult); expect(WriteStringArrayResult).assertEqual(false); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_04700: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04700: error " + error); expect(error != null).assertTrue(); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04700---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_04800 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_04800 * @tc.name Writestringarray interface, illegal value validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_04800", 0, function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_04800", 0, function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04800---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_04800: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04800: create object successfully."); var errorStringArryData = []; for (let i=0;i<(10*K - 1);i++){ errorStringArryData[i] = "heddSDF"; } var WriteStringArrayResult = data.writeStringArray(errorStringArryData); - console.info("SUB_Softbus_IPC_MessageParcel_04800: run writeStringArrayis is " + WriteStringArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04800: run writeStringArrayis is " + WriteStringArrayResult); expect(WriteStringArrayResult).assertTrue(); var errorStringArray = data.readStringArray(); - console.info("SUB_Softbus_IPC_MessageParcel_04800: run writeStringArrayis is " + errorStringArray.length); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04800: run writeStringArrayis is " + errorStringArray.length); assertArrayElementEqual(errorStringArray,errorStringArryData); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_04800: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04800: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04800---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_04900 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_04900 * @tc.name Call the writebytearray interface, write the array to the messageparcel instance, * and call readbytearray to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_04900", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_04900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_04900", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_04900---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_04900: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04900: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var ByteArrayVar = [1, 2, 3, 4, 5]; var writeShortArrayResult = data.writeByteArray(ByteArrayVar); - console.info("SUB_Softbus_IPC_MessageParcel_04900: run writeShortArrayis is " + writeShortArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04900: run writeShortArrayis is " + writeShortArrayResult); expect(writeShortArrayResult == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_04900: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04900: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_BYTEARRAY, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_04900: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04900: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var shortArryDataReply = result.reply.readByteArray(); - console.info("SUB_Softbus_IPC_MessageParcel_04900: run readByteArray is " + shortArryDataReply); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04900: run readByteArray is " + shortArryDataReply); assertArrayElementEqual(ByteArrayVar,shortArryDataReply); }); data.reclaim(); reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_04900: error " +error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_04900: error " +error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_04900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_04900---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_05000 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_05000 * @tc.name Call the writebytearray interface, write the array to the messageparcel instance, * and call readbytearray (datain: number []) to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_05000", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_05000", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05000---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_05000: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05000: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var ByteArrayVar = [1, 2, 3, 4, 5]; var writeShortArrayResult = data.writeByteArray(ByteArrayVar); - console.info("SUB_Softbus_IPC_MessageParcel_05000: run writeShortArrayis is " + writeShortArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05000: run writeShortArrayis is " + writeShortArrayResult); expect(writeShortArrayResult == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_05000: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05000: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_BYTEARRAY, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_05000: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05000: sendRequestis is " + result.errCode); var newArr = new Array(5); result.reply.readByteArray(newArr); - console.info("SUB_Softbus_IPC_MessageParcel_05000: run readByteArray is " + newArr); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05000: run readByteArray is " + newArr); assertArrayElementEqual(ByteArrayVar,newArr); }); @@ -1866,40 +1855,40 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_05000: error " +error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05000: error " +error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05000---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_05100 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_05100 * @tc.name Writebytearray interface, boundary value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_05100", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_05100", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05100---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_05100: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05100: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var teArrayVar = [-128, 0, 1, 2, 127]; var writeShortArrayResult = data.writeByteArray(teArrayVar); - console.info("SUB_Softbus_IPC_MessageParcel_05100: run writeShortArrayis is " + writeShortArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05100: run writeShortArrayis is " + writeShortArrayResult); expect(writeShortArrayResult == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_05100: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05100: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_BYTEARRAY, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_05100: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05100: sendRequestis is " + result.errCode); var newArr = new Array(5) result.reply.readByteArray(newArr); - console.info("SUB_Softbus_IPC_MessageParcel_05100: run readByteArray is " + newArr); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05100: run readByteArray is " + newArr); assertArrayElementEqual(newArr,teArrayVar); }); @@ -1907,39 +1896,39 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_05100: error " +error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05100: error " +error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05100---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_05200 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_05200 * @tc.name Writebytearray interface, illegal value validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_05200", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_05200", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05200---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_05200: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05200: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var teArrayVar = [-128, 0, 1, 2, 128]; var writeShortArrayResult = data.writeByteArray(teArrayVar); - console.info("SUB_Softbus_IPC_MessageParcel_05200: run writeShortArrayis is " + writeShortArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05200: run writeShortArrayis is " + writeShortArrayResult); expect(writeShortArrayResult == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_05200: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05200: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_BYTEARRAY, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_05200: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05200: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var shortArryDataReply = result.reply.readByteArray(); - console.info("SUB_Softbus_IPC_MessageParcel_05200: run readByteArray is " + shortArryDataReply); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05200: run readByteArray is " + shortArryDataReply); expect(shortArryDataReply[0] == teArrayVar[0]).assertTrue(); expect(shortArryDataReply[1] == teArrayVar[1]).assertTrue(); expect(shortArryDataReply[2] == teArrayVar[2]).assertTrue(); @@ -1950,39 +1939,39 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_05200: error " +error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05200: error " +error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05200---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_05300 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_05300 * @tc.name Writebytearray interface, illegal value validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_05300", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_05300", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05300---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_05300: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05300: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var ByteArrayVar = [-129, 0, 1, 2, 127]; var writeShortArrayResult = data.writeByteArray(ByteArrayVar); - console.info("SUB_Softbus_IPC_MessageParcel_05300: run writeShortArrayis is " + writeShortArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05300: run writeShortArrayis is " + writeShortArrayResult); expect(writeShortArrayResult == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_05300: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05300: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_BYTEARRAY, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_05300: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05300: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var shortArryDataReply = result.reply.readByteArray(); - console.info("SUB_Softbus_IPC_MessageParcel_05300: run readByteArray is " + shortArryDataReply); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05300: run readByteArray is " + shortArryDataReply); expect(shortArryDataReply[0] == 127).assertTrue(); expect(shortArryDataReply[1] == ByteArrayVar[1]).assertTrue(); expect(shortArryDataReply[2] == ByteArrayVar[2]).assertTrue(); @@ -1993,41 +1982,41 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_05300: error " +error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05300: error " +error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05300---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_05400 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_05400 * @tc.name Call the writeintarray interface, write the array to the messageparcel instance, * and call readintarray to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_05400", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_05400", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05400---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_05400: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05400: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var intArryData = [100, 111, 112]; var writeShortArrayResult = data.writeIntArray(intArryData); - console.info("SUB_Softbus_IPC_MessageParcel_05400: run writeShortArrayis is " + writeShortArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05400: run writeShortArrayis is " + writeShortArrayResult); expect(writeShortArrayResult == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_05400: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05400: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_INTARRAY, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_05400: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05400: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var shortArryDataReply = result.reply.readIntArray(); - console.info("SUB_Softbus_IPC_MessageParcel_05400: run readByteArray is " + shortArryDataReply); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05400: run readByteArray is " + shortArryDataReply); assertArrayElementEqual(intArryData,shortArryDataReply); }); @@ -2035,42 +2024,42 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_05400: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05400: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05400---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_05500 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_05500 * @tc.name Call the writeintarray interface, write the array to the messageparcel instance, * and call readintarray (datain: number []) to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_05500", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_05500", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05500---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_05500: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05500: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var intArryData = [100, 111, 112]; var writeShortArrayResult = data.writeIntArray(intArryData); - console.info("SUB_Softbus_IPC_MessageParcel_05500: run writeShortArrayis is " + writeShortArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05500: run writeShortArrayis is " + writeShortArrayResult); expect(writeShortArrayResult == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_05500: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05500: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_INTARRAY, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_05500: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05500: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var newArr = [] result.reply.readIntArray(newArr); - console.info("SUB_Softbus_IPC_MessageParcel_05500: run readIntArray is " + newArr); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05500: run readIntArray is " + newArr); assertArrayElementEqual(intArryData,newArr); }); @@ -2078,79 +2067,79 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_05500: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05500: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05500---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_05600 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_05600 * @tc.name Writeintarray interface, boundary value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_05600", 0, async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_05600", 0, async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05600---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_05600: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05600: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var intArryData = [-2147483648, 0, 1, 2, 2147483647]; var writeIntArrayResult = data.writeIntArray(intArryData); - console.info("SUB_Softbus_IPC_MessageParcel_05600: run writeShortArrayis is " + writeIntArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05600: run writeShortArrayis is " + writeIntArrayResult); expect(writeIntArrayResult == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_05600: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05600: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_INTARRAY, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_05600: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05600: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var shortArryDataReply = result.reply.readIntArray(); - console.info("SUB_Softbus_IPC_MessageParcel_05600: run readByteArray is " + shortArryDataReply); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05600: run readByteArray is " + shortArryDataReply); assertArrayElementEqual(intArryData,shortArryDataReply); }); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_05600: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05600: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05600---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_05700 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_05700 * @tc.name Writeintarray interface, illegal value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_05700", 0, async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_05700", 0, async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05700---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_05700: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05700: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var intArryData = [-2147483649, 0, 1, 2, 2147483647]; var writeIntArrayResult = data.writeIntArray(intArryData); - console.info("SUB_Softbus_IPC_MessageParcel_05700: run writeShortArrayis is " + writeIntArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05700: run writeShortArrayis is " + writeIntArrayResult); expect(writeIntArrayResult == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_05700: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05700: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_INTARRAY, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_05700: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05700: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var shortArryDataReply = result.reply.readIntArray(); - console.info("SUB_Softbus_IPC_MessageParcel_05700: run readByteArray is " + shortArryDataReply); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05700: run readByteArray is " + shortArryDataReply); expect(shortArryDataReply[0] == 2147483647).assertTrue(); expect(shortArryDataReply[1] == intArryData[1]).assertTrue(); expect(shortArryDataReply[2] == intArryData[2]).assertTrue(); @@ -2160,82 +2149,82 @@ describe('ActsRpcClientJsTest', function(){ data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_05700: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05700: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05700---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_05800 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_05800 * @tc.name Writeintarray interface, illegal value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_05800", 0, async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_05800", 0, async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05800---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_05800: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05800: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var intArryData = [0, 1, 2, 3, 2147483648]; var writeIntArrayResult = data.writeIntArray(intArryData); - console.info("SUB_Softbus_IPC_MessageParcel_05800: run writeShortArrayis is " + writeIntArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05800: run writeShortArrayis is " + writeIntArrayResult); expect(writeIntArrayResult == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_05800: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05800: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_INTARRAY, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_05800: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05800: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var shortArryDataReply = result.reply.readIntArray(); - console.info("SUB_Softbus_IPC_MessageParcel_05800: run readByteArray is " + shortArryDataReply); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05800: run readByteArray is " + shortArryDataReply); var newintArryData = [0, 1, 2, 3, -2147483648]; assertArrayElementEqual(newintArryData,shortArryDataReply); }); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_05800: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05800: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05800---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_05900 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_05900 * @tc.name Call the writefloatarray interface, write the array to the messageparcel instance, * and call readfloatarray to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_05900", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_05900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_05900", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_05900---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_05900: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05900: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var floatArryData = [1.2, 1.3, 1.4]; var writeShortArrayResult = data.writeFloatArray(floatArryData); - console.info("SUB_Softbus_IPC_MessageParcel_05900: run writeFloatArrayis is " + writeShortArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05900: run writeFloatArrayis is " + writeShortArrayResult); expect(writeShortArrayResult == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_05900: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05900: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_FLOATARRAY, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_05900: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05900: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var floatArryDataReply = result.reply.readFloatArray(); - console.info("SUB_Softbus_IPC_MessageParcel_05900: run readFloatArray is " + floatArryDataReply); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05900: run readFloatArray is " + floatArryDataReply); assertArrayElementEqual(floatArryData,floatArryDataReply); }); @@ -2243,42 +2232,42 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_05900: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_05900: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_05900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_05900---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_06000 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_06000 * @tc.name Call the writefloatarray interface, write the array to the messageparcel instance, * and call readfloatarray (datain: number []) to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_06000", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_06000", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06000---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_06000: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06000: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var floatArryData = [1.2, 1.3, 1.4] var writeShortArrayResult = data.writeFloatArray(floatArryData); - console.info("SUB_Softbus_IPC_MessageParcel_06000: run writeFloatArrayis is " + writeShortArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06000: run writeFloatArrayis is " + writeShortArrayResult); expect(writeShortArrayResult == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_06000: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06000: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_FLOATARRAY, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_06000: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06000: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var newArr = [] result.reply.readFloatArray(newArr); - console.info("SUB_Softbus_IPC_MessageParcel_06000: readFloatArray is " + newArr); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06000: readFloatArray is " + newArr); assertArrayElementEqual(floatArryData,newArr); }); @@ -2286,80 +2275,80 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_06000: error " +error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06000: error " +error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06000---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_06100 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_06100 * @tc.name Writefloatarray interface, boundary value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_06100", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_06100", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06100---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_06100: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06100: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var floatArryData = [-3.40E+38, 1.3, 3.40E+38]; var writeShortArrayResult = data.writeFloatArray(floatArryData); - console.info("SUB_Softbus_IPC_MessageParcel_06100: run writeFloatArrayis is " + writeShortArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06100: run writeFloatArrayis is " + writeShortArrayResult); expect(writeShortArrayResult == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_06100: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06100: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_FLOATARRAY, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_06100: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06100: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var newArr = result.reply.readFloatArray(); - console.info("SUB_Softbus_IPC_MessageParcel_06100: run readFloatArray is " + newArr); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06100: run readFloatArray is " + newArr); assertArrayElementEqual(floatArryData,newArr); }); data.reclaim(); reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_06100: error " +error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06100: error " +error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06100---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_06200 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_06200 * @tc.name Writefloatarray interface, illegal value validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_06200", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_06200", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06200---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_06200: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06200: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var floatArryData = [-4.40E+38, 1.3, 3.40E+38]; var writeShortArrayResult = data.writeFloatArray(floatArryData); - console.info("SUB_Softbus_IPC_MessageParcel_06200: run writeFloatArrayis is " + writeShortArrayResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06200: run writeFloatArrayis is " + writeShortArrayResult); expect(writeShortArrayResult == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_06200: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06200: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_FLOATARRAY, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_06200: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06200: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var newArr = result.reply.readFloatArray(); - console.info("SUB_Softbus_IPC_MessageParcel_06200: run readFloatArray is " + newArr); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06200: run readFloatArray is " + newArr); expect(newArr[0] == floatArryData[0]).assertTrue(); expect(newArr[1] == floatArryData[1]).assertTrue(); expect(newArr[2] == floatArryData[2]).assertTrue(); @@ -2368,41 +2357,41 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_06200: error " +error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06200: error " +error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06200---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_06300 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_06300 * @tc.name Call the writeShort interface to write the short integer data to the messageparcel instance, * and call readshort to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_06300", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_06300", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06300---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_06300: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06300: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var short = 8; var writeShor = data.writeShort(short); - console.info("SUB_Softbus_IPC_MessageParcel_06300: run writeShort success, writeShor is " + writeShor); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06300: run writeShort success, writeShor is " + writeShor); expect(writeShor == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_06300: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06300: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_SHORT, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_06300: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06300: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var readShort = result.reply.readShort(); - console.info("SUB_Softbus_IPC_MessageParcel_06300: run readFloatArray is success, readShort is " + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06300: run readFloatArray is success, readShort is " + readShort); expect(readShort == short).assertTrue(); }); @@ -2411,22 +2400,22 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_06300: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06300: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06300---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_06400 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_06400 * @tc.name WriteShort interface, boundary value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_06400", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_06400", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06400---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_06400: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06400: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); expect(data.writeShort(-32768) == true).assertTrue(); @@ -2437,10 +2426,10 @@ describe('ActsRpcClientJsTest', function(){ if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_06400: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06400: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_SHORT_MULTI, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_06400: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06400: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); expect(result.reply.readShort() == -32768).assertTrue(); @@ -2454,32 +2443,32 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_06400: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06400: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06400---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_06500 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_06500 * @tc.name WriteShort interface, illegal value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_06500", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_06500", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06500---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_06500: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06500: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); expect(data.writeShort(32768) == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_06500: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06500: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_SHORT_MULTI, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_06500: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06500: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); expect(result.reply.readShort() == -32768).assertTrue(); }); @@ -2488,41 +2477,41 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_06500: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06500: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06500---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_06600 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_06600 * @tc.name Call the writeShort interface to write the short integer data to the messageparcel instance, * and call readshort to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_06600", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_06600", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06600---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_06600: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06600: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var short = -32769; var writeShor = data.writeShort(short); - console.info("SUB_Softbus_IPC_MessageParcel_06600: run writeShort success, writeShor is " + writeShor); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06600: run writeShort success, writeShor is " + writeShor); expect(writeShor == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_06600: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06600: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_SHORT, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_06600: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06600: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var readShort = result.reply.readShort(); - console.info("SUB_Softbus_IPC_MessageParcel_06600: run readFloatArray is " + readShort); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06600: run readFloatArray is " + readShort); expect(readShort == 32767).assertTrue(); }); @@ -2530,41 +2519,41 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_06600: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06600: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06600---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_06700 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_06700 * @tc.name Call the writeShort interface to write the short integer data to the messageparcel instance, * and call readshort to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_06700", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_06700", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06700---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_06700: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06700: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var short = 32768; var writeShor = data.writeShort(short); - console.info("SUB_Softbus_IPC_MessageParcel_06700: run writeShort success, writeShor is " + writeShor); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06700: run writeShort success, writeShor is " + writeShor); expect(writeShor == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_06700: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06700: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_SHORT, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_06700: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06700: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var readShort = result.reply.readShort(); - console.info("SUB_Softbus_IPC_MessageParcel_06700: run readFloatArray is " + readShort); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06700: run readFloatArray is " + readShort); expect(readShort == -32768).assertTrue(); }); @@ -2572,42 +2561,42 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_06700: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06700: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06700---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_06800 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_06800 * @tc.name Call writelong interface to write long integer data to messageparcel instance * and call readlong to read data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_06800", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_06800", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06800---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_06800: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06800: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var short = 10000; var writelong = data.writeLong(short); - console.info("SUB_Softbus_IPC_MessageParcel_06800: run writeLong success, writelong is " + writelong); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06800: run writeLong success, writelong is " + writelong); expect(writelong == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_06800: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06800: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_LONG, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_06800: run sendRequestis is " + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06800: run sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var readlong = result.reply.readLong(); - console.info("SUB_Softbus_IPC_MessageParcel_06800: run readLong is success, readlong is " + readlong); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06800: run readLong is success, readlong is " + readlong); expect(readlong == short).assertTrue(); }); @@ -2615,416 +2604,416 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_06800: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06800: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06800---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_06900 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_06900 * @tc.name Writelong interface, boundary value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_06900", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_06900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_06900", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_06900---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_06900: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06900: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var short = 2147483647; var writelong = data.writeLong(short); - console.info("SUB_Softbus_IPC_MessageParcel_06900: run writeLong success, writelong is " + writelong); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06900: run writeLong success, writelong is " + writelong); expect(writelong == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_06900: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06900: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_LONG, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_06900: run sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06900: run sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var readlong = result.reply.readLong(); - console.info("SUB_Softbus_IPC_MessageParcel_06900: run readLong is success, readlong is " + readlong); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06900: run readLong is success, readlong is " + readlong); expect(readlong == short).assertTrue(); }); data.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_06900: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_06900: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_06900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_06900---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_07000 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_07000 * @tc.name Writelong interface, illegal value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_07000", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_07000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_07000", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07000---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_07000: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07000: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var short = 214748364887; var writelong = data.writeLong(short); - console.info("SUB_Softbus_IPC_MessageParcel_07000: run writeLong success, writelong is " + writelong); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07000: run writeLong success, writelong is " + writelong); expect(writelong == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_07000: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07000: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_LONG, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_07000: run sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07000: run sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var readlong = result.reply.readLong(); - console.info("SUB_Softbus_IPC_MessageParcel_07000: run readLong is success, readlong is " + readlong); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07000: run readLong is success, readlong is " + readlong); expect(readlong == short).assertTrue(); }); data.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_07000: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07000: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_07000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07000---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_07100 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_07100 * @tc.name Writelong interface, illegal value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_07100", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_07100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_07100", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07100---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_07100: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07100: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var short = 2147483649; var writelong = data.writeLong(short); - console.info("SUB_Softbus_IPC_MessageParcel_07100: run writeLong success, writelong is " + writelong); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07100: run writeLong success, writelong is " + writelong); expect(writelong == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_07100: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07100: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_LONG, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_07100: run sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07100: run sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); var readlong = result.reply.readLong(); - console.info("SUB_Softbus_IPC_MessageParcel_07100: run readLong is success, readlong is " + readlong); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07100: run readLong is success, readlong is " + readlong); expect(readlong == short).assertTrue(); }); data.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_07100: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07100: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_07100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07100---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_07200 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_07200 * @tc.name Call the parallel interface to read and write data to the double instance * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_07200", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_07200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_07200", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07200---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_07200: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07200: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = 10.2; var result = data.writeDouble(token); - console.info("SUB_Softbus_IPC_MessageParcel_07200:run writeDoubleis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07200:run writeDoubleis is " + result); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_07200: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07200: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_DOUBLE, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_07200: run sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07200: run sendRequestis is " + result.errCode); var replyReadResult = reply.readDouble(); - console.info("SUB_Softbus_IPC_MessageParcel_07200: run replyReadResult is " + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07200: run replyReadResult is " + replyReadResult); expect(replyReadResult == token).assertTrue(); }); data.reclaim(); reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_07200:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07200:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_07200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07200---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_07300 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_07300 * @tc.name Writedouble interface, boundary value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_07300", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_07300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_07300", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07300---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_07300: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07300: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = 1.79E+308; var result = data.writeDouble(token); - console.info("SUB_Softbus_IPC_MessageParcel_07300:run writeDoubleis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07300:run writeDoubleis is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_07300: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07300: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_DOUBLE, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_07300: run sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07300: run sendRequestis is " + result.errCode); var replyReadResult = reply.readDouble(); - console.info("SUB_Softbus_IPC_MessageParcel_07300: run rreplyReadResult is " + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07300: run rreplyReadResult is " + replyReadResult); expect(replyReadResult == token).assertTrue(); }); data.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_07300:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07300:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_07300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07300---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_07400 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_07400 * @tc.name Writedouble interface, boundary value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_07400", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_07400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_07400", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07400---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_07400: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07400: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = 4.9000000e-32; var result = data.writeDouble(token); - console.info("SUB_Softbus_IPC_MessageParcel_07400:run writeDoubleis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07400:run writeDoubleis is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_07400: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07400: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_DOUBLE, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_07400: run sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07400: run sendRequestis is " + result.errCode); var replyReadResult = reply.readDouble(); - console.info("SUB_Softbus_IPC_MessageParcel_07400: run replyReadResult is " + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07400: run replyReadResult is " + replyReadResult); expect(replyReadResult == token).assertTrue(); }); data.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_07400:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07400:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_07400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07400---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_07500 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_07500 * @tc.name Writedouble interface, illegal value validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_07500", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_07500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_07500", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07500---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_07500: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07500: create object successfully."); var token = "1.79E+465312156"; var result = data.writeDouble(token); - console.info("SUB_Softbus_IPC_MessageParcel_07500:run writeDoubleis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07500:run writeDoubleis is " + result); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_07500:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07500:error = " + error); expect(error != null).assertTrue(); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_07500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07500---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_07600 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_07600 * @tc.name Call the writeboolean interface to write the data to the messageparcel instance, * and call readboolean to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_07600", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_07600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_07600", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07600---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_07600: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07600: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = true; var result = data.writeBoolean(token); - console.info("SUB_Softbus_IPC_MessageParcel_07600:run writeBooleanis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07600:run writeBooleanis is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_07600: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07600: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_BOOLEAN, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_07600: run sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07600: run sendRequestis is " + result.errCode); var replyReadResult = result.reply.readBoolean(); - console.info("SUB_Softbus_IPC_MessageParcel_07600: run readBoolean is " + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07600: run readBoolean is " + replyReadResult); expect(replyReadResult == token).assertTrue(); }); data.reclaim(); reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_07600:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07600:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_07600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07600---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_07700 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_07700 * @tc.name Call the writeboolean interface to write the data to the messageparcel instance, * and call readboolean to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_07700", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_07700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_07700", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07700---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_07700: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07700: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = false; var result = data.writeBoolean(token); - console.info("SUB_Softbus_IPC_MessageParcel_07700:run writeBooleanis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07700:run writeBooleanis is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_07700: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07700: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_BOOLEAN, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_07700: run sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07700: run sendRequestis is " + result.errCode); var replyReadResult = result.reply.readBoolean(); - console.info("SUB_Softbus_IPC_MessageParcel_07700: run readBoolean is " + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07700: run readBoolean is " + replyReadResult); expect(replyReadResult == token).assertTrue(); }); data.reclaim(); reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_07700:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07700:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_07700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07700---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_07800 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_07800 * @tc.name Writeboolean interface, illegal value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_07800", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_07800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_07800", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07800---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_07800: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07800: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = 9; var result = data.writeBoolean(token); - console.info("SUB_Softbus_IPC_MessageParcel_07800:run writeBooleanis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07800:run writeBooleanis is " + result); expect(result == false).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_07800:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07800:error = " + error); expect(error != null).assertTrue(); } data.reclaim(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_07800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07800---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_07900 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_07900 * @tc.name Writeboolean interface, illegal value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_07900", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_07900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_07900", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_07900---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_07900: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07900: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = "aaa"; var result = data.writeBoolean(token); - console.info("SUB_Softbus_IPC_MessageParcel_07900:run writeBooleanis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07900:run writeBooleanis is " + result); expect(result == false).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_07900:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_07900:error = " + error); expect(error != null).assertTrue(); } data.reclaim(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_07900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_07900---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_08000 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_08000 * @tc.name Call the writechar interface to write the data to the messageparcel instance, * and call readchar to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_08000", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_08000", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08000---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_08000: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08000: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = 65; var result = data.writeChar(token); - console.info("SUB_Softbus_IPC_MessageParcel_08000:run writeCharis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08000:run writeCharis is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_08000: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08000: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_CHAR, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_08000: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08000: sendRequestis is " + result.errCode); var replyReadResult = result.reply.readChar(); - console.info("SUB_Softbus_IPC_MessageParcel_08000: run readChar is " + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08000: run readChar is " + replyReadResult); expect(replyReadResult == token).assertTrue(); }); @@ -3032,37 +3021,37 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_08000:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08000:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08000---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_08100 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_08100 * @tc.name Call the writechar interface to write the data to the messageparcel instance, * and call readchar to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_08100", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_08100", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08100---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_08100: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08100: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = 122; var result = data.writeChar(token); - console.info("SUB_Softbus_IPC_MessageParcel_08100:run writeCharis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08100:run writeCharis is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_08100: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08100: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_CHAR, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_08100: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08100: sendRequestis is " + result.errCode); var replyReadResult = result.reply.readChar(); - console.info("SUB_Softbus_IPC_MessageParcel_08100: run readChar is " + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08100: run readChar is " + replyReadResult); expect(replyReadResult == token).assertTrue(); }); @@ -3070,37 +3059,37 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_08100:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08100:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08100---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_08200 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_08200 * @tc.name Call the writechar interface to write the data to the messageparcel instance, * and call readchar to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_08200", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_08200", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08200---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_08200: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08200: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = 64; var result = data.writeChar(token); - console.info("SUB_Softbus_IPC_MessageParcel_08200:run writeCharis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08200:run writeCharis is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_08200: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08200: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_CHAR, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_08200: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08200: sendRequestis is " + result.errCode); var replyReadResult = result.reply.readChar(); - console.info("SUB_Softbus_IPC_MessageParcel_08200: run readChar is " + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08200: run readChar is " + replyReadResult); expect(replyReadResult == token).assertTrue(); }); @@ -3108,37 +3097,37 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_08200:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08200:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08200---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_08300 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_08300 * @tc.name Call the writechar interface to write the data to the messageparcel instance, * and call readchar to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_08300", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_08300", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08300---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_08300: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08300: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = 123; var result = data.writeChar(token); - console.info("SUB_Softbus_IPC_MessageParcel_08300:run writeCharis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08300:run writeCharis is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_08300: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08300: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_CHAR, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_08300: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08300: sendRequestis is " + result.errCode); var replyReadResult = result.reply.readChar(); - console.info("SUB_Softbus_IPC_MessageParcel_08300: run readChar is " + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08300: run readChar is " + replyReadResult); expect(replyReadResult == token).assertTrue(); }); @@ -3146,37 +3135,37 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_08300:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08300:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08300---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_08400 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_08400 * @tc.name Call the writechar interface to write the data to the messageparcel instance, * and call readchar to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_08400", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_08400", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08400---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_08400: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08400: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = 65; var result = data.writeChar(token); - console.info("SUB_Softbus_IPC_MessageParcel_08400:run writeCharis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08400:run writeCharis is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_08400: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08400: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_CHAR, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_08400: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08400: sendRequestis is " + result.errCode); var replyReadResult = result.reply.readChar(); - console.info("SUB_Softbus_IPC_MessageParcel_08400: run readChar is " + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08400: run readChar is " + replyReadResult); expect(replyReadResult == token).assertTrue(); }); @@ -3184,49 +3173,49 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_08400:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08400:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08400---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_08500 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_08500 * @tc.name Writechar interface, illegal value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_08500", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_08500", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08500---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_08500: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08500: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = 'ades'; var result = data.writeChar(token); - console.info("SUB_Softbus_IPC_MessageParcel_08500:run writeCharis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08500:run writeCharis is " + result); expect(result == false).assertTrue() } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_08500:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08500:error = " + error); expect(error != null).assertTrue(); } data.reclaim(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08500---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_08600 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_08600 * @tc.name Call the writestring interface to write the data to the messageparcel instance, * and call readstring() to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_08600", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_08600", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08600---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_08600: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08600: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = ''; @@ -3234,16 +3223,16 @@ describe('ActsRpcClientJsTest', function(){ token += 'a'; }; var result = data.writeString(token); - console.info("SUB_Softbus_IPC_MessageParcel_08600:run writeStringis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08600:run writeStringis is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_08600: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08600: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_08600: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08600: sendRequestis is " + result.errCode); var replyReadResult = result.reply.readString(); - console.info("SUB_Softbus_IPC_MessageParcel_08600: run readString is " + replyReadResult.length); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08600: run readString is " + replyReadResult.length); expect(replyReadResult == token).assertTrue(); }); @@ -3251,91 +3240,91 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_08600:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08600:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08600---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_08700 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_08700 * @tc.name Call the writestring interface to write the data to the messageparcel instance, * and call readstring() to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_08700", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_08700", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08700---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_08700: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08700: create object successfully."); var token = ''; for(var i = 0; i < 40*K; i++){ token += 'a'; }; var result = data.writeString(token); - console.info("SUB_Softbus_IPC_MessageParcel_08700:run writeStringis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08700:run writeStringis is " + result); expect(result == false).assertTrue(); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_08700:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08700:error = " + error); expect(error != null).assertTrue(); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08700---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_08800 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_08800 * @tc.name Writestring interface, illegal value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_08800", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_08800", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08800---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_08800: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08800: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = 123; var result = data.writeString(token); - console.info("SUB_Softbus_IPC_MessageParcel_08800:run writeStringis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08800:run writeStringis is " + result); expect(result == false).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_08800:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08800:error = " + error); expect(error != null).assertTrue(); } data.reclaim(); reply.reclaim(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08800---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_08900 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_08900 * @tc.name Call the writebyte interface to write data to the messageparcel instance, * and call readbyte to read data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_08900", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_08900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_08900", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_08900---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_08900: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08900: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = 2; var result = data.writeByte(token); - console.info("SUB_Softbus_IPC_MessageParcel_08900:run writeByteis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08900:run writeByteis is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_08900: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08900: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_BYTE, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_08900: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08900: sendRequestis is " + result.errCode); var replyReadResult = result.reply.readByte(); - console.info("SUB_Softbus_IPC_MessageParcel_08900: run readByte is " + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08900: run readByte is " + replyReadResult); expect(replyReadResult == token).assertTrue(); }); @@ -3343,22 +3332,22 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_08900:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_08900:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_08900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_08900---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_09000 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_09000 * @tc.name Writebyte interface, boundary value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_09000", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_09000", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09000---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_09000: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09000: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); @@ -3369,10 +3358,10 @@ describe('ActsRpcClientJsTest', function(){ expect(data.writeByte(127) == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_09000: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09000: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_BYTE_MULTI, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_09000: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09000: sendRequestis is " + result.errCode); expect(reply.readByte() == -128).assertTrue(); expect(reply.readByte() == 0).assertTrue(); @@ -3385,123 +3374,123 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_09000:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09000:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09000---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_09100 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_09100 * @tc.name Writebyte interface, illegal value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_09100", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_09100", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09100---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_09100: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09100: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); expect(data.writeByte(-129) == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_09100: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09100: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_BYTE_MULTI, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_09100: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09100: sendRequestis is " + result.errCode); expect(reply.readByte() == 127).assertTrue(); }); data.reclaim(); reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_09100:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09100:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09100---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_09200 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_09200 * @tc.name Writebyte interface, illegal value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_09200", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_09200", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09200---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_09200: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09200: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); expect(data.writeByte(128) == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_09200: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09200: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_BYTE_MULTI, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_09200: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09200: sendRequestis is " + result.errCode); expect(reply.readByte() == -128).assertTrue(); }); data.reclaim(); reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_09200:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09200:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09200---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_09300 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_09300 * @tc.name Writebyte interface, illegal value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_09300", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_09300", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09300---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_09300: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09300: create object successfully."); let writeby = data.writeByte("error"); - console.info("SUB_Softbus_IPC_MessageParcel_09300: writeByte is" + writeby); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09300: writeByte is" + writeby); expect(writeby).assertEqual(false); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_09300:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09300:error = " + error); expect(error != null).assertTrue(); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09300---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_09400 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_09400 * @tc.name Call the writeint interface to write the data to the messageparcel instance, * and call readint to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_09400", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_09400", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09400---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_09400: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09400: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = 2; var result = data.writeInt(token); - console.info("SUB_Softbus_IPC_MessageParcel_09400:run writeIntis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09400:run writeIntis is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_09400: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09400: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_09400: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09400: sendRequestis is " + result.errCode); var replyReadResult = result.reply.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_09400: run readInt is " + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09400: run readInt is " + replyReadResult); expect(replyReadResult == token).assertTrue(); }); @@ -3509,23 +3498,23 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_09400:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09400:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09400---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_09500 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_09500 * @tc.name Writeint interface, boundary value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_09500", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_09500", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09500---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_09500: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09500: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); @@ -3537,10 +3526,10 @@ describe('ActsRpcClientJsTest', function(){ if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_09500: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09500: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_INT_MULTI, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_09500: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09500: sendRequestis is " + result.errCode); expect(result.reply.readInt() == -2147483648).assertTrue(); expect(result.reply.readInt() == 0).assertTrue(); expect(result.reply.readInt() == 1).assertTrue(); @@ -3552,33 +3541,33 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_09500:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09500:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09500---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_09600 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_09600 * @tc.name Writeint interface, illegal value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_09600", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_09600", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09600---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_09600: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09600: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); expect(data.writeInt(2147483648) == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_09600: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09600: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_INT_MULTI, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_09600: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09600: sendRequestis is " + result.errCode); expect(result.reply.readInt() == -2147483648).assertTrue(); }); @@ -3586,33 +3575,33 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_09600:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09600:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09600---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_09700 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_09700 * @tc.name Writeint interface, illegal value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_09700", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_09700", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09700---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_09700: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09700: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); expect(data.writeInt(-2147483649) == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_09700: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09700: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_INT_MULTI, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_09700: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09700: sendRequestis is " + result.errCode); expect(result.reply.readInt() == 2147483647).assertTrue(); }); @@ -3620,38 +3609,38 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_09700:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09700:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09700---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_09800 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_09800 * @tc.name Call the writefloat interface to write data to the messageparcel instance, * and call readfloat to read data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_09800", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_09800", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09800---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_09800: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09800: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = 2.2; var result = data.writeFloat(token); - console.info("SUB_Softbus_IPC_MessageParcel_09800:run writeDoubleis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09800:run writeDoubleis is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_09800: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09800: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_FLOAT, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_09800: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09800: sendRequestis is " + result.errCode); var replyReadResult = result.reply.readFloat(); - console.info("SUB_Softbus_IPC_MessageParcel_09800: run readFloat is " + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09800: run readFloat is " + replyReadResult); expect(replyReadResult == token).assertTrue(); }); @@ -3659,36 +3648,36 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_09800:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09800:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09800---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_09900 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_09900 * @tc.name Writefloat interface, boundary value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_09900", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_09900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_09900", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_09900---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_09900: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09900: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = 3.4E+38; var result = data.writeFloat(token); - console.info("SUB_Softbus_IPC_MessageParcel_09900:run writeFloatis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09900:run writeFloatis is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_09900: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09900: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_FLOAT, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_09900: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09900: sendRequestis is " + result.errCode); var newReadResult = result.reply.readFloat(); - console.info("SUB_Softbus_IPC_MessageParcel_09900: readFloat result is " + newReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09900: readFloat result is " + newReadResult); expect(newReadResult == token).assertTrue(); }); @@ -3696,37 +3685,37 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_09900:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_09900:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_09900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_09900---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_10000 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_10000 * @tc.name Writefloat interface, boundary value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_10000", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_10000", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10000---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_10000: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10000: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = 1.4E-45; var result = data.writeFloat(token); - console.info("SUB_Softbus_IPC_MessageParcel_10000:run writeFloatis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10000:run writeFloatis is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_10000: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10000: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_FLOAT, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_10000: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10000: sendRequestis is " + result.errCode); var newReadResult = result.reply.readFloat(); - console.info("SUB_Softbus_IPC_MessageParcel_10000: readFloat result is " + newReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10000: readFloat result is " + newReadResult); expect(newReadResult == token).assertTrue(); }); @@ -3734,37 +3723,37 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_10000:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10000:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10000---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_10100 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_10100 * @tc.name Writefloat interface, boundary value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_10100", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_10100", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10100---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_10100: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10100: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var token = 4.4E+38; var result = data.writeFloat(token); - console.info("SUB_Softbus_IPC_MessageParcel_10100:run writeFloatis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10100:run writeFloatis is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_10100: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10100: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_FLOAT, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_10100: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10100: sendRequestis is " + result.errCode); var newReadResult = result.reply.readFloat(); - console.info("SUB_Softbus_IPC_MessageParcel_10100: readFloat result is " + newReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10100: readFloat result is " + newReadResult); expect(newReadResult == token).assertTrue(); }); @@ -3772,177 +3761,177 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_10100:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10100:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10100---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_10200 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_10200 * @tc.name Writefloat interface, illegal value validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_10200", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_10200", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10200---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_10200: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10200: create object successfully."); var token = 'a'; var result = data.writeFloat(token); - console.info("SUB_Softbus_IPC_MessageParcel_10200:run writeFloatis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10200:run writeFloatis is " + result); expect(result == false).assertTrue(); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_10200:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10200:error = " + error); expect(error != null).assertTrue(); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10200---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_10300 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_10300 * @tc.name Test messageparcel to deliver rawdata data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_10300", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_10300", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10300---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_10300: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10300: create object successfully."); var Capacity = data.getRawDataCapacity() - console.info("SUB_Softbus_IPC_MessageParcel_10300:run Capacity success, Capacity is " + Capacity); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10300:run Capacity success, Capacity is " + Capacity); expect(Capacity).assertEqual(128*M); var rawdata = [1, 2, 3] var result = data.writeRawData(rawdata, rawdata.length); - console.info("SUB_Softbus_IPC_MessageParcel_10300:run writeRawDatais is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10300:run writeRawDatais is " + result); expect(result == true).assertTrue(); var newReadResult = data.readRawData(rawdata.length) - console.info("SUB_Softbus_IPC_MessageParcel_10300:run readRawDatais is " + newReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10300:run readRawDatais is " + newReadResult); assertArrayElementEqual(newReadResult,rawdata); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_10300:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10300:error = " + error); } data.reclaim(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10300---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_10400 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_10400 * @tc.name Illegal value passed in from writerawdata interface * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_10400", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_10400", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10400---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_10400: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10400: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var Capacity = data.getRawDataCapacity() - console.info("SUB_Softbus_IPC_MessageParcel_10400:run Capacityis is " + Capacity); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10400:run Capacityis is " + Capacity); expect(Capacity).assertEqual(128*M); var token = [2,1,4,3,129] ; var result = data.writeRawData(token, 149000000); - console.info("SUB_Softbus_IPC_MessageParcel_10400:run writeRawDatais is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10400:run writeRawDatais is " + result); expect(result == false).assertTrue(); data.reclaim(); reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_10400:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10400:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10400---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_10500 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_10500 * @tc.name Illegal value passed in from writerawdata interface * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_10500", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_10500", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10500---------------------------"); try{ let parcel = new rpc.MessageParcel(); - console.info("SUB_Softbus_IPC_MessageParcel_10500: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10500: create object successfully."); let reply = new rpc.MessageParcel(); let option = new rpc.MessageOption(); let arr = [1, 2, 3, 4, 5]; expect(parcel.writeInt(arr.length)).assertTrue(); let isWriteSuccess = parcel.writeRawData(arr, arr.length); - console.info("SUB_Softbus_IPC_MessageParcel_10500: parcel write raw data result is : " + isWriteSuccess); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10500: parcel write raw data result is : " + isWriteSuccess); expect(isWriteSuccess).assertTrue(); let Capacity = parcel.getRawDataCapacity() - console.info("SUB_Softbus_IPC_MessageParcel_10500:run Capacity success, Capacity is " + Capacity); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10500:run Capacity success, Capacity is " + Capacity); expect(Capacity).assertEqual(128*M); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_10500: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10500: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_RAWDATA, parcel, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_10500: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10500: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); let size = result.reply.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_10500:run readIntis is " + size); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10500:run readIntis is " + size); expect(size).assertEqual(arr.length); let reCapacity = parcel.getRawDataCapacity() - console.info("SUB_Softbus_IPC_MessageParcel_10500:run Capacity is " + reCapacity); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10500:run Capacity is " + reCapacity); expect(reCapacity).assertEqual(128*M); let newReadResult = result.reply.readRawData(size); - console.info("SUB_Softbus_IPC_MessageParcel_10500:run readRawDatais " + newReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10500:run readRawDatais " + newReadResult); assertArrayElementEqual(newReadResult,arr); }); parcel.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_10500:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10500:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10500---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_10600 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_10600 * @tc.name Test messageParcel to deliver abnormal RawData data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_10600", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_10600", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10600---------------------------"); try{ let parcel = new rpc.MessageParcel(); - console.info("SUB_Softbus_IPC_MessageParcel_10600: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10600: create object successfully."); let reply = new rpc.MessageParcel(); let option = new rpc.MessageOption(); let arr = [1, 2, 3, 4, 5]; expect(parcel.writeInt(arr.length + 1)).assertTrue(); let isWriteSuccess = parcel.writeRawData(arr, (arr.length + 1)); - console.info("SUB_Softbus_IPC_MessageParcel_10600: parcel write raw data result is : " + isWriteSuccess); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10600: parcel write raw data result is : " + isWriteSuccess); expect(isWriteSuccess).assertTrue(); let Capacity = parcel.getRawDataCapacity() - console.info("SUB_Softbus_IPC_MessageParcel_10600:run Capacity success, Capacity is " + Capacity); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10600:run Capacity success, Capacity is " + Capacity); expect(Capacity).assertEqual(128*M); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_10600: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10600: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_RAWDATA, parcel, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_10600: result is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10600: result is " + result.errCode); expect(result.errCode == 0).assertTrue(); let size = result.reply.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_10600:run readIntis is " + size); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10600:run readIntis is " + size); expect(size).assertEqual(arr.length + 1); let reCapacity = parcel.getRawDataCapacity() - console.info("SUB_Softbus_IPC_MessageParcel_10600:run Capacity is " + reCapacity); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10600:run Capacity is " + reCapacity); expect(reCapacity).assertEqual(128*M); let newReadResult = result.reply.readRawData(size); - console.info("SUB_Softbus_IPC_MessageParcel_10600:run readRawDatais " + newReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10600:run readRawDatais " + newReadResult); expect(arr[0]).assertEqual(newReadResult[0]); expect(arr[1]).assertEqual(newReadResult[1]); expect(arr[2]).assertEqual(newReadResult[2]); @@ -3952,46 +3941,46 @@ describe('ActsRpcClientJsTest', function(){ parcel.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_10600:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10600:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10600---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_10700 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_10700 * @tc.name Test messageParcel to deliver abnormal RawData data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_10700", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_10700", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10700---------------------------"); try{ let parcel = new rpc.MessageParcel(); - console.info("SUB_Softbus_IPC_MessageParcel_10700: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10700: create object successfully."); let reply = new rpc.MessageParcel(); let option = new rpc.MessageOption(); let arr = [1, 2, 3, 4, 5]; expect(parcel.writeInt(arr.length-1)).assertTrue(); let isWriteSuccess = parcel.writeRawData(arr, (arr.length - 1)); - console.info("SUB_Softbus_IPC_MessageParcel_10700: parcel write raw data result is : " + isWriteSuccess); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10700: parcel write raw data result is : " + isWriteSuccess); expect(isWriteSuccess).assertTrue(); let Capacity = parcel.getRawDataCapacity() - console.info("SUB_Softbus_IPC_MessageParcel_10700:run Capacity success, Capacity is " + Capacity); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10700:run Capacity success, Capacity is " + Capacity); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_10700: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10700: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_RAWDATA, parcel, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_10700: result is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10700: result is " + result.errCode); expect(result.errCode == 0).assertTrue(); let size = result.reply.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_10700:run readIntis is " + size); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10700:run readIntis is " + size); expect(size).assertEqual(arr.length - 1); let reCapacity = parcel.getRawDataCapacity() - console.info("SUB_Softbus_IPC_MessageParcel_10700:run Capacity success, Capacity is " + reCapacity); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10700:run Capacity success, Capacity is " + reCapacity); expect(reCapacity).assertEqual(128*M); let newReadResult = result.reply.readRawData(size); - console.info("SUB_Softbus_IPC_MessageParcel_10700:run readRawDatais is " + newReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10700:run readRawDatais is " + newReadResult); expect(arr[0]).assertEqual(newReadResult[0]); expect(arr[1]).assertEqual(newReadResult[1]); expect(arr[2]).assertEqual(newReadResult[2]); @@ -4000,191 +3989,191 @@ describe('ActsRpcClientJsTest', function(){ parcel.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_10700:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10700:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10700---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_10800 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_10800 * @tc.name Test messageParcel to deliver out-of-bounds RawData data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_10800", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_10800", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10800---------------------------"); try{ let parcel = new rpc.MessageParcel(); - console.info("SUB_Softbus_IPC_MessageParcel_10800: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10800: create object successfully."); let reply = new rpc.MessageParcel(); let option = new rpc.MessageOption(); let arr = [-129, 2, 3, 4, 128]; expect(parcel.writeInt(arr.length)).assertTrue(); let isWriteSuccess = parcel.writeRawData(arr, arr.length); - console.info("SUB_Softbus_IPC_MessageParcel_10800: parcel write raw data result is : " + isWriteSuccess); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10800: parcel write raw data result is : " + isWriteSuccess); expect(isWriteSuccess).assertTrue(); let Capacity = parcel.getRawDataCapacity() - console.info("SUB_Softbus_IPC_MessageParcel_10800:run Capacity success, Capacity is " + Capacity); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10800:run Capacity success, Capacity is " + Capacity); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_10800: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10800: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_RAWDATA, parcel, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_10800: result is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10800: result is " + result.errCode); expect(result.errCode == 0).assertTrue(); let size = result.reply.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_10800:run readIntis is " + size); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10800:run readIntis is " + size); expect(size).assertEqual(arr.length); let reCapacity = parcel.getRawDataCapacity() - console.info("SUB_Softbus_IPC_MessageParcel_10800:run Capacity is " + reCapacity); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10800:run Capacity is " + reCapacity); expect(reCapacity).assertEqual(128*M); let newReadResult = result.reply.readRawData(size); - console.info("SUB_Softbus_IPC_MessageParcel_10800:run readRawDatais is " + newReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10800:run readRawDatais is " + newReadResult); assertArrayElementEqual(newReadResult,arr); }); parcel.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_10800:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10800:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10800---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_10900 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_10900 * @tc.name Test messageParcel to deliver illegal RawData data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_10900", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_10900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_10900", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_10900---------------------------"); try{ let parcel = new rpc.MessageParcel(); - console.info("SUB_Softbus_IPC_MessageParcel_10900: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10900: create object successfully."); let reply = new rpc.MessageParcel(); let option = new rpc.MessageOption(); let arr = ["aaa", 1, 2, 3]; expect(parcel.writeInt(arr.length)).assertTrue(); let isWriteSuccess = parcel.writeRawData(arr, arr.length); - console.info("SUB_Softbus_IPC_MessageParcel_10900: parcel write raw data result is : " + isWriteSuccess); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10900: parcel write raw data result is : " + isWriteSuccess); expect(isWriteSuccess).assertTrue(); let reCapacity = parcel.getRawDataCapacity() - console.info("SUB_Softbus_IPC_MessageParcel_10900:run Capacity success, Capacity is " + reCapacity); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10900:run Capacity success, Capacity is " + reCapacity); expect(reCapacity).assertEqual(128*M); parcel.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_10900:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_10900:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_10900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_10900---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_11000 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_11000 * @tc.name Call the writeremoteobject interface to serialize the remote object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_11000", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_11000", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11000---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_11000: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11000: create object successfully."); let testRemoteObject = new TestRemoteObject("testObject"); var result = data.writeRemoteObject(testRemoteObject); - console.info("SUB_Softbus_IPC_MessageParcel_11000: result is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11000: result is " + result); expect(result == true).assertTrue(); data.readRemoteObject() } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_11000:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11000:error = " + error); } data.reclaim(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11000---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_11100 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_11100 * @tc.name Call the writeremoteobject interface to serialize the remote object and pass in the empty object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_11100", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_11100", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11100---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_11100: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11100: create object successfully."); var token = {} var result = data.writeRemoteObject(token); - console.info("SUB_Softbus_IPC_MessageParcel_11100: result is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11100: result is " + result); expect(result == false).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_11100:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11100:error = " + error); } data.reclaim(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11100---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_11200 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_11200 * @tc.name Call the writesequenceable interface to write the custom serialized * object to the messageparcel instance * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_11200", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_11200", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11200---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_11200: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11200: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); let sequenceable = new MySequenceable(1, "aaa"); let result = data.writeSequenceable(sequenceable); - console.info("SUB_Softbus_IPC_MessageParcel_11200: writeSequenceable is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11200: writeSequenceable is " + result); expect(result == true).assertTrue(); let ret = new MySequenceable(0, ""); let result2 = data.readSequenceable(ret); - console.info("SUB_Softbus_IPC_MessageParcel_11200: readSequenceable is " + result2); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11200: readSequenceable is " + result2); expect(result2 == true).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_11200:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11200:error = " + error); } data.reclaim(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11200---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_11300 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_11300 * @tc.name After the server finishes processing, write noexception first before writing the result, * and the client calls readexception to judge whether the server is abnormal * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_11300", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_11300", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11300---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_11300: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11300: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); data.writeNoException(); - console.info("SUB_Softbus_IPC_MessageParcel_11300: run writeNoException success"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11300: run writeNoException success"); expect(data.writeInt(6) == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_11300: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11300: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_NOEXCEPTION, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_11300: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11300: sendRequestis is " + result.errCode); result.reply.readException() var replyData = result.reply.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_11300: readResult is " + replyData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11300: readResult is " + replyData); expect(replyData == 6).assertTrue(); }); @@ -4192,76 +4181,76 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_11300:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11300:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11300---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_11400 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_11400 * @tc.name If the data on the server is abnormal, the client calls readexception * to judge whether the server is abnormal * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_11400", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_11400", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11400---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_11400: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11400: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); data.writeNoException(); - console.info("SUB_Softbus_IPC_MessageParcel_11400: run writeNoException success"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11400: run writeNoException success"); expect(data.writeInt(1232222223444) == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_11400: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11400: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_NOEXCEPTION, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_11400: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11400: sendRequestis is " + result.errCode); result.reply.readException() var replyData = result.reply.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_11400: readResult is " + replyData); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11400: readResult is " + replyData); }); data.reclaim(); reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_11400:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11400:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11400---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_11500 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_11500 * @tc.name Serializable object marshaling and unmarshalling test * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_11500", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_11500", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11500---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_11500: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11500: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var sequenceable = new MySequenceable(1, "aaa"); var result = data.writeSequenceable(sequenceable); - console.info("SUB_Softbus_IPC_MessageParcel_11500: writeSequenceable is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11500: writeSequenceable is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_11500: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11500: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_SEQUENCEABLE, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_11500: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11500: sendRequestis is " + result.errCode); var s = new MySequenceable(null,null) var resultReply = result.reply.readSequenceable(s); - console.info("SUB_Softbus_IPC_MessageParcel_11500: run readSequenceable is " + resultReply); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11500: run readSequenceable is " + resultReply); expect(resultReply == true).assertTrue(); expect(s.str == sequenceable.str).assertTrue(); expect(s.num == sequenceable.num).assertTrue(); @@ -4271,38 +4260,38 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_11500:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11500:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11500---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_11600 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_11600 * @tc.name Non serializable object marshaling test * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_11600", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_11600", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11600---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_11600: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11600: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var sequenceable = new MySequenceable(1, "aaa"); var result = data.writeSequenceable(sequenceable); - console.info("SUB_Softbus_IPC_MessageParcel_11600: writeSequenceable is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11600: writeSequenceable is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_11600: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11600: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_SEQUENCEABLE, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_11600: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11600: sendRequestis is " + result.errCode); var s = new MySequenceable(null,null) var replyReadResult = reply.readSequenceable(s); - console.info("SUB_Softbus_IPC_MessageParcel_11600: run readSequenceable is " + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11600: run readSequenceable is " + replyReadResult); expect(replyReadResult == true).assertTrue(); expect(s.str == sequenceable.str).assertTrue(); expect(s.num == sequenceable.num).assertTrue(); @@ -4312,61 +4301,61 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_11600:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11600:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11600---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_11700 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_11700 * @tc.name The server did not send a serializable object, and the client was ungrouped * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_11700", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_11700", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11700---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_11700: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11700: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var sequenceable = 10; var result = data.writeInt(sequenceable); - console.info("SUB_Softbus_IPC_MessageParcel_11700 writeInt is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11700 writeInt is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_11700: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11700: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_11700: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11700: sendRequestis is " + result.errCode); var s = new MySequenceable(0,null) var replyReadResult = result.reply.readSequenceable(s); - console.info("SUB_Softbus_IPC_MessageParcel_11700: run readSequenceable is" + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11700: run readSequenceable is" + replyReadResult); }); data.reclaim(); reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_11700:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11700:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11700---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_11800 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_11800 * @tc.name Call the writesequenceable interface to write the custom serialized object to the * messageparcel instance, and call readsequenceable to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_11800", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_11800", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11800---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_11800: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11800: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var sequenceable = new MySequenceable(2, "abc"); @@ -4375,13 +4364,13 @@ describe('ActsRpcClientJsTest', function(){ expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_11800: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11800: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_SEQUENCEABLE, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_11800: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11800: sendRequestis is " + result.errCode); var s = new MySequenceable(null,null) var replyReadResult = result.reply.readSequenceable(s); - console.info("SUB_Softbus_IPC_MessageParcel_11800: run readSequenceable is" + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11800: run readSequenceable is" + replyReadResult); expect(s.str == sequenceable.str).assertTrue(); expect(s.num == sequenceable.num).assertTrue(); }); @@ -4390,41 +4379,41 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_11800:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11800:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11800---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_11900 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_11900 * @tc.name Call the writesequenceablearray interface to write the custom serialized object to the * messageparcel instance, and call readsequenceablearray to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_11900", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_11900", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11900---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_11900: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11900: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var sequenceable = [new MySequenceable(1, "aaa"), new MySequenceable(2, "bbb"), new MySequenceable(3, "ccc")]; var result = data.writeSequenceableArray(sequenceable); - console.info("SUB_Softbus_IPC_MessageParcel_11900: writeSequenceableArray is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11900: writeSequenceableArray is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_11900: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11900: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_SEQUENCEABLEARRAY, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_11900: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11900: sendRequestis is " + result.errCode); var s = [new MySequenceable(null, null), new MySequenceable(null, null), new MySequenceable(null, null)]; result.reply.readSequenceableArray(s); - console.info("SUB_Softbus_IPC_MessageParcel_11900: run readSequenceableArray is" + s); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11900: run readSequenceableArray is" + s); for (let i = 0; i < s.length; i++) { expect(s[i].str).assertEqual(sequenceable[i].str) expect(s[i].num).assertEqual(sequenceable[i].num) @@ -4435,41 +4424,41 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_11900:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_11900:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_11900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_11900---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_12000 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_12000 * @tc.name Call the writesequenceablearray interface to write the custom serialized object to the * messageparcel instance, and call readsequenceablearray to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_12000", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_12000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_12000", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12000---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_12000: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12000: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); var sequenceable = [new MySequenceable(4, "abc"), new MySequenceable(5, "bcd"), new MySequenceable(6, "cef")]; var result = data.writeSequenceableArray(sequenceable); - console.info("SUB_Softbus_IPC_MessageParcel_12000: writeSequenceable is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12000: writeSequenceable is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_12000: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12000: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_SEQUENCEABLEARRAY, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_12000: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12000: sendRequestis is " + result.errCode); var s = [new MySequenceable(null, null), new MySequenceable(null, null), new MySequenceable(null, null)] result.reply.readSequenceableArray(s); - console.info("SUB_Softbus_IPC_MessageParcel_12000: run readSequenceableArray is" +s); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12000: run readSequenceableArray is" +s); for (let i = 0; i < s.length; i++) { expect(s[i].str).assertEqual(sequenceable[i].str) expect(s[i].num).assertEqual(sequenceable[i].num) @@ -4480,45 +4469,45 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_12000:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12000:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12000---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_12100 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_12100 * @tc.name Call the writesequenceablearray interface to write the custom * serialized object to the messageparcel instance * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_12100", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_12100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_12100", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12100---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_12100: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12100: create object successfully."); var sequenceable = 1; var result = data.writeSequenceableArray(sequenceable); - console.info("SUB_Softbus_IPC_MessageParcel_12100: writeSequenceable is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12100: writeSequenceable is " + result); expect(result == false).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_12100:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12100:error = " + error); expect(error != null).assertTrue(); } data.reclaim(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12100---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_12200 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_12200 * @tc.name Call the writeremoteobjectarray interface to write the object array to the messageparcel * instance, and call readremoteobjectarray to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_12200", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_12200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_12200", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12200---------------------------"); try{ let count = 0 function checkResult(num, str) { @@ -4531,7 +4520,7 @@ describe('ActsRpcClientJsTest', function(){ } } var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_12200: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12200: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); @@ -4540,14 +4529,14 @@ describe('ActsRpcClientJsTest', function(){ new TestListener("rpcListener2", checkResult), new TestListener("rpcListener3", checkResult)]; var result = data.writeRemoteObjectArray(listeners); - console.info("SUB_Softbus_IPC_MessageParcel_12200: writeRemoteObjectArray is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12200: writeRemoteObjectArray is " + result); expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_12200: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12200: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_REMOTEOBJECTARRAY, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_12200: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12200: sendRequestis is " + result.errCode); expect(result.errCode).assertEqual(0); expect(result.code).assertEqual(CODE_WRITE_REMOTEOBJECTARRAY); expect(result.data).assertEqual(data); @@ -4558,21 +4547,21 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_12200:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12200:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12200---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_12300 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_12300 * @tc.name Call the writeremoteobjectarray interface to write the object array to the messageparcel instance, * and call readremoteobjectarray (objects: iremoteobject []) to read the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_12300", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_12300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_12300", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12300---------------------------"); try{ let count = 0 function checkResult(num, str) { @@ -4585,7 +4574,7 @@ describe('ActsRpcClientJsTest', function(){ } } var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_12300: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12300: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); expect(data.writeInterfaceToken("rpcTestAbility")).assertTrue() @@ -4597,10 +4586,10 @@ describe('ActsRpcClientJsTest', function(){ expect(result == true).assertTrue(); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageParcel_12300: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12300: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_REMOTEOBJECTARRAY, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_12300: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12300: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); }); @@ -4608,19 +4597,19 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_12300:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12300:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12300---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_12400 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_12400 * @tc.name Test messageparcel delivery file descriptor object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_12400", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_12400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_12400", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12400---------------------------"); let context = FA.getContext() await context.getFilesDir() .then(async function(path) { @@ -4667,20 +4656,20 @@ describe('ActsRpcClientJsTest', function(){ } }) done() - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12400---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_12500 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_12500 * @tc.name Test messageparcel to deliver the reply message received in promise across processes * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_12500", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_12500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_12500", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12500---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_12500: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12500: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); expect(data.writeByte(2)).assertTrue() @@ -4715,25 +4704,26 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_12500:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12500:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12500---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_12600 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_12600 * @tc.name Test the cross process delivery of messageparcel and receive the reply message * in the callback function * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_12600", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_12600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_12600", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12600---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_12500: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12600: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); + expect(data.writeByte(2)).assertTrue() expect(data.writeShort(3)).assertTrue() expect(data.writeInt(4)).assertTrue() @@ -4745,47 +4735,53 @@ describe('ActsRpcClientJsTest', function(){ expect(data.writeString("HelloWorld")).assertTrue() expect(data.writeSequenceable(new MySequenceable(1, "aaa"))).assertTrue() - gIRemoteObject.sendRequest(CODE_ALL_TYPE, data, reply, option,(err, result) => { - console.info("sendRequest done, error code: " + result.errCode) - expect(result.errCode).assertEqual(0) - expect(result.reply.readByte()).assertEqual(2) - expect(result.reply.readShort()).assertEqual(3) - expect(result.reply.readInt()).assertEqual(4) - expect(result.reply.readLong()).assertEqual(5) - expect(result.reply.readFloat()).assertEqual(1.2) - expect(result.reply.readDouble()).assertEqual(10.2) - expect(result.reply.readBoolean()).assertTrue() - expect(result.reply.readChar()).assertEqual(5) - expect(result.reply.readString()).assertEqual("HelloWorld") - let s = new MySequenceable(null, null) - expect(result.reply.readSequenceable(s)).assertTrue() - expect(s.num).assertEqual(1) - expect(s.str).assertEqual("aaa") - }); - data.reclaim(); - reply.reclaim(); - done(); + function sendRequestCallback(result) { + try{ + console.info("sendRequest Callback") + console.info("sendRequest done, error code: " + result.errCode) + expect(result.errCode).assertEqual(0) + expect(result.reply.readByte()).assertEqual(2) + expect(result.reply.readShort()).assertEqual(3) + expect(result.reply.readInt()).assertEqual(4) + expect(result.reply.readLong()).assertEqual(5) + expect(result.reply.readFloat()).assertEqual(1.2) + expect(result.reply.readDouble()).assertEqual(10.2) + expect(result.reply.readBoolean()).assertTrue() + expect(result.reply.readChar()).assertEqual(5) + expect(result.reply.readString()).assertEqual("HelloWorld") + let s = new MySequenceable(null, null) + expect(result.reply.readSequenceable(s)).assertTrue() + expect(s.num).assertEqual(1) + expect(s.str).assertEqual("aaa") + } finally { + result.data.reclaim(); + result.reply.reclaim(); + console.info("test done") + done() + } + } + + console.info("start send request") + await gIRemoteObject.sendRequest(CODE_ALL_TYPE, data, reply, option, sendRequestCallback) + } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_12600:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12600:error = " + error); } - sleep(2000) - data.reclaim(); - reply.reclaim(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12600---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_12700 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_12700 * @tc.name Test the cross process transmission of messageparcel. * After receiving the reply message in promise, read various types of arrays in order * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_12700", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_12700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_12700", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12700---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_12700: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12700: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); expect(data.writeByteArray([1, 2, 3])).assertTrue(); @@ -4823,27 +4819,27 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_12700:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12700:error = " + error); } sleep(2000) data.reclaim(); reply.reclaim(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12700---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_12800 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_12800 * @tc.name Test messageparcel cross process delivery. After receiving the reply message in promise, * the client constructs an empty array in sequence and reads the data from the reply message * into the corresponding array * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_12800", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_12800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_12800", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12800---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_12800: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12800: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); expect(data.writeByteArray([1, 2, 3])).assertTrue(); @@ -4881,22 +4877,22 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_12800:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12800:error = " + error); } sleep(2000) data.reclaim(); reply.reclaim(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12800---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_12900 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_12900 * @tc.name Test messageparcel to pass an object of type iremoteobject across processes * @tc.desc Function test * @tc.level 0 */ - it('SUB_Softbus_IPC_MessageParcel_12900', 0, async function(done) { - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_12900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_12900", 0, async function(done) { + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_12900---------------------------"); function checkResult(num, str) { expect(num).assertEqual(123) expect(str).assertEqual("rpcListenerTest") @@ -4909,13 +4905,13 @@ describe('ActsRpcClientJsTest', function(){ let listener = new TestListener("rpcListener", checkResult) let result = data.writeRemoteObject(listener) - console.info("SUB_Softbus_IPC_MessageParcel_12900 result is:" + result) + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12900 result is:" + result) expect(result == true).assertTrue() expect(data.writeInt(123)).assertTrue() expect(data.writeString("rpcListenerTest")).assertTrue() await gIRemoteObject.sendRequest(CODE_WRITE_REMOTEOBJECT, data, reply, option) .then((result)=> { - console.info("SUB_Softbus_IPC_MessageParcel_12900 sendRequest done, error code: " + result.errCode) + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12900 sendRequest done, error code: " + result.errCode) expect(result.errCode).assertEqual(0) result.reply.readException() }) @@ -4923,20 +4919,20 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim() console.info("test done") } catch(error) { - console.info("SUB_Softbus_IPC_MessageParcel_12900: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_12900: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_12900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_12900---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_MessageParcel_13000 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_13000 * @tc.name Test messageparcel to pass an array of iremoteobject objects across processes * @tc.desc Function test * @tc.level 0 */ - it('SUB_Softbus_IPC_MessageParcel_13000', 0, async function(done) { - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_13000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_13000", 0, async function(done) { + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13000---------------------------"); let count = 0; function checkResult(num, str) { @@ -4957,12 +4953,12 @@ describe('ActsRpcClientJsTest', function(){ new TestListener("rpcListener3", checkResult)] let result = data.writeRemoteObjectArray(listeners) expect(result == true).assertTrue() - console.info("SUB_Softbus_IPC_MessageParcel_13000 result is:" + result) + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13000 result is:" + result) expect(data.writeInt(123)).assertTrue() expect(data.writeString("rpcListenerTest")).assertTrue() await gIRemoteObject.sendRequest(CODE_WRITE_REMOTEOBJECTARRAY_1, data, reply, option) .then((result)=> { - console.info("SUB_Softbus_IPC_MessageParcel_13000 sendRequest done, error code: " + result.errCode) + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13000 sendRequest done, error code: " + result.errCode) expect(result.errCode).assertEqual(0) result.reply.readException() }) @@ -4971,20 +4967,20 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim() console.info("test done") } catch(error) { - console.info("SUB_Softbus_IPC_MessageParcel_13000: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13000: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13000---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_MessageParcel_13100 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_13100 * @tc.name Test messageparcel to pass the array of iremoteobject objects across processes. The server * constructs an empty array in onremoterequest and reads it from messageparcel * @tc.desc Function test * @tc.level 0 */ - it('SUB_Softbus_IPC_MessageParcel_13100', 0, async function(done) { - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_13100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_13100", 0, async function(done) { + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13100---------------------------"); let count = 0; function checkResult(num, str) { expect(num).assertEqual(123) @@ -5006,7 +5002,7 @@ describe('ActsRpcClientJsTest', function(){ let result = data.writeRemoteObjectArray(listeners) expect(result == true).assertTrue() data.readRemoteObjectArray() - console.info("SUB_Softbus_IPC_MessageParcel_13100 result is:" + result) + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13100 result is:" + result) expect(data.writeInt(123)).assertTrue() expect(data.writeString("rpcListenerTest")).assertTrue() await gIRemoteObject.sendRequest(CODE_WRITE_REMOTEOBJECTARRAY_2, data, reply, option) @@ -5020,379 +5016,379 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim() console.info("test done") } catch(error) { - console.info("SUB_Softbus_IPC_MessageParcel_13100: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13100: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13100---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_MessageParcel_13200 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_13200 * @tc.name Invoke the rewindRead interface, write the POS, and read the offset value * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_13200", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_13200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_13200", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13200---------------------------"); try{ let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_13200: create object successfully"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13200: create object successfully"); let option = new rpc.MessageOption(); let reply = rpc.MessageParcel.create(); data.writeInt(12); data.writeString("parcel"); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_13200: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13200: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_13200: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13200: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); let number1 = result.reply.readInt(); expect(number1).assertEqual(12); expect(result.reply.rewindRead(0)).assertTrue(); let number2 = result.reply.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_13200:run readIntis is " + number1 + ";" + number2); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13200:run readIntis is " + number1 + ";" + number2); expect(number2).assertEqual(12); let reString = result.reply.readString(); - console.info("SUB_Softbus_IPC_MessageParcel_13200:run readStringis is " + reString); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13200:run readStringis is " + reString); expect(reString).assertEqual(""); }); data.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_13200:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13200:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13200---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_13300 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_13300 * @tc.name Invoke the rewindRead interface, write the POS, and read the offset value * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_13300", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_13300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_13300", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13300---------------------------"); try{ let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_13300: create object successfully"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13300: create object successfully"); let option = new rpc.MessageOption(); let reply = rpc.MessageParcel.create(); data.writeInt(12); data.writeString("parcel"); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_13300: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13300: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_13300: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13300: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); let number1 = result.reply.readInt(); expect(result.reply.rewindRead(1)).assertTrue(); let number2 = result.reply.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_13300:run readIntis is " + number1 + ";" + number2); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13300:run readIntis is " + number1 + ";" + number2); expect(number1).assertEqual(12); expect(number2).assertEqual(0); }); data.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_13300:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13300:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13300---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_13400 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_13400 * @tc.name Invoke the rewindWrite interface, write the POS, and read the offset value * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_13400", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_11800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_13400", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_11800---------------------------"); try{ let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_13400: create object successfully"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13400: create object successfully"); let option = new rpc.MessageOption(); let reply = rpc.MessageParcel.create(); data.writeInt(4); data.rewindWrite(0); data.writeInt(5); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_13400: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13400: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_13400: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13400: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); let number = result.reply.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_13400:run readIntis is " + number); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13400:run readIntis is " + number); expect(number).assertEqual(5); }); data.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_13400:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13400:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13400---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_13500 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_13500 * @tc.name Invoke the rewindWrite interface, write the POS, and read the offset value * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_13500", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_13500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_13500", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13500---------------------------"); try{ let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_13500: create object successfully"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13500: create object successfully"); let option = new rpc.MessageOption(); let reply = rpc.MessageParcel.create(); data.writeInt(4); data.rewindWrite(1); data.writeInt(5); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_13500: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13500: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_13500: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13500: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); let number = result.reply.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_13500:run readIntis is " + number); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13500:run readIntis is " + number); expect(number != 5).assertTrue(); }); data.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_13500:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13500:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13500---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_13600 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_13600 * @tc.name setCapacity Sets the storage capacity of the MessageParcel instance. The getCapacity obtains the current MessageParcel capacity * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_13600", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_13600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_13600", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13600---------------------------"); try{ let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_13600: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13600: create object successfully."); let option = new rpc.MessageOption(); let reply = rpc.MessageParcel.create(); expect(data.getCapacity()).assertEqual(0); let setMePaCapacity = data.setCapacity(100); - console.info("SUB_Softbus_IPC_MessageParcel_13600:run setCapacityis is " + setMePaCapacity); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13600:run setCapacityis is " + setMePaCapacity); expect(setMePaCapacity).assertTrue(); expect(data.writeString("constant")).assertTrue(); expect(data.getCapacity()).assertEqual(100); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_13600: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13600: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_13600: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13600: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); let getMePaCapacity = result.reply.getCapacity(); - console.info("SUB_Softbus_IPC_MessageParcel_13600:run getCapacityis is " + getMePaCapacity); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13600:run getCapacityis is " + getMePaCapacity); expect(getMePaCapacity).assertEqual(("constant".length * 2) + 8); expect(result.reply.readString()).assertEqual("constant"); }); data.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_13600:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13600:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13600---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_13700 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_13700 * @tc.name setCapacity Sets the storage capacity of the MessageParcel instance. The getCapacity obtains the current MessageParcel capacity * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_13700", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_13700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_13700", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13700---------------------------"); try{ let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_13700: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13700: create object successfully."); let option = new rpc.MessageOption(); let reply = rpc.MessageParcel.create(); expect(data.writeString("constant")).assertTrue(); expect(data.setCapacity(100)).assertTrue(); expect(data.getCapacity()).assertEqual(100); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_13700: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13700: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_13700: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13700: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); expect(result.reply.readString()).assertEqual("constant"); let getMeCa = result.reply.getCapacity(); - console.info("SUB_Softbus_IPC_MessageParcel_13700:run getCapacityis is " + getMeCa); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13700:run getCapacityis is " + getMeCa); expect(getMeCa).assertEqual(("constant".length * 2) + 8); }); data.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_13700:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13700:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13700---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_13800 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_13800 * @tc.name SetCapacity Tests the storage capacity threshold of the MessageParcel instance * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_13800", 0, async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_13800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_13800", 0, async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13800---------------------------"); try{ let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_13800: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13800: create object successfully."); let getCapacitydata0 = data.getCapacity(); - console.info("SUB_Softbus_IPC_MessageParcel_13800:run getCapacityis is " + getCapacitydata0); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13800:run getCapacityis is " + getCapacitydata0); expect(data.writeString("constant")).assertTrue(); let getSizedata = data.getSize(); - console.info("SUB_Softbus_IPC_MessageParcel_13800:run getSizeis is " + getSizedata); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13800:run getSizeis is " + getSizedata); let getCapacitydata = data.getCapacity(); - console.info("SUB_Softbus_IPC_MessageParcel_13800:run getCapacityis is " + getCapacitydata); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13800:run getCapacityis is " + getCapacitydata); let setCapacitydata1 = data.setCapacity(getSizedata + 1); - console.info("SUB_Softbus_IPC_MessageParcel_13800:run setCapacityis is " + setCapacitydata1); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13800:run setCapacityis is " + setCapacitydata1); expect(setCapacitydata1).assertTrue(); - console.info("SUB_Softbus_IPC_MessageParcel_13800:run getCapacityis is " + data.getCapacity()); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13800:run getCapacityis is " + data.getCapacity()); expect(data.getCapacity()).assertEqual((getSizedata + 1)); let setCapacitydata2 = data.setCapacity(getSizedata); - console.info("SUB_Softbus_IPC_MessageParcel_13800:run setCapacityis is " + setCapacitydata2); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13800:run setCapacityis is " + setCapacitydata2); expect(setCapacitydata2).assertEqual(false); - console.info("SUB_Softbus_IPC_MessageParcel_13800:run getCapacityis is " + data.getCapacity()); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13800:run getCapacityis is " + data.getCapacity()); expect(data.getCapacity()).assertEqual((getSizedata + 1)); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_13800:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13800:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13800---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_13900 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_13900 * @tc.name SetCapacity Tests the storage capacity threshold of the MessageParcel instance * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_13900", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_13900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_13900", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_13900---------------------------"); try{ let data = rpc.MessageParcel.create(); let option = new rpc.MessageOption(); let reply = rpc.MessageParcel.create(); expect(data.writeString("constant")).assertTrue(); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_13900: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13900: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_13900: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13900: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); let getSizeresult = result.reply.getSize(); - console.info("SUB_Softbus_IPC_MessageParcel_13900:run getSizeis is " + getSizeresult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13900:run getSizeis is " + getSizeresult); let setCapacityresult = result.reply.getCapacity(); - console.info("SUB_Softbus_IPC_MessageParcel_13900:run getCapacityis is " + setCapacityresult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13900:run getCapacityis is " + setCapacityresult); expect(setCapacityresult).assertEqual(("constant".length * 2) + 8); }); data.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_13900:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_13900:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_13900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_13900---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_14000 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_14000 * @tc.name SetCapacity Tests the storage capacity threshold of the MessageParcel instance * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_14000", 0, async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_14000", 0, async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14000---------------------------"); try{ let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_14000: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14000: create object successfully."); let getSizedata = data.getSize(); - console.info("SUB_Softbus_IPC_MessageParcel_14000:run setCapacityis is " + getSizedata); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14000:run setCapacityis is " + getSizedata); expect(getSizedata).assertEqual(0); let setMeCapacity = data.setCapacity(M); - console.info("SUB_Softbus_IPC_MessageParcel_14000:run setCapacityis is " + setMeCapacity); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14000:run setCapacityis is " + setMeCapacity); expect(setMeCapacity).assertTrue(); let getCapacitydata = data.getCapacity(); - console.info("SUB_Softbus_IPC_MessageParcel_14000:run getCapacityis is " + getCapacitydata); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14000:run getCapacityis is " + getCapacitydata); expect(getCapacitydata).assertEqual(M); let setMeCapacity1 = data.setCapacity(4*G); - console.info("SUB_Softbus_IPC_MessageParcel_14000:run setCapacityis is " + setMeCapacity1); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14000:run setCapacityis is " + setMeCapacity1); expect(setMeCapacity1).assertEqual(false); let getCapacitydata1 = data.getCapacity(); - console.info("SUB_Softbus_IPC_MessageParcel_14000:run getCapacityis is " + getCapacitydata1); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14000:run getCapacityis is " + getCapacitydata1); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_14000:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14000:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_14000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14000---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_14100 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_14100 * @tc.name setCapacity Sets the storage capacity of the MessageParcel instance to decrease by one. The getCapacity obtains the current MessageParcel capacity * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_14100", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_14100", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14100---------------------------"); try{ let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_14100: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14100: create object successfully."); let option = new rpc.MessageOption(); let reply = rpc.MessageParcel.create(); expect(data.getSize()).assertEqual(0); let setSizedata = data.setSize(0); - console.info("SUB_Softbus_IPC_MessageParcel_14100:run setSizeis is " + setSizedata); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14100:run setSizeis is " + setSizedata); expect(setSizedata).assertTrue(); expect(data.writeString("constant")).assertTrue(); let getSizedata = data.getSize(); - console.info("SUB_Softbus_IPC_MessageParcel_14100:run getSizeis is " + getSizedata); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14100:run getSizeis is " + getSizedata); expect(getSizedata).assertEqual(("constant".length * 2) + 8); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_14100: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14100: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_14100: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14100: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); let getSizeresult = result.reply.getSize(); - console.info("SUB_Softbus_IPC_MessageParcel_14100:run getSizeis is " + getSizeresult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14100:run getSizeis is " + getSizeresult); expect(getSizeresult).assertEqual(("constant".length * 2) + 8); expect(result.reply.readString()).assertEqual("constant"); @@ -5400,24 +5396,24 @@ describe('ActsRpcClientJsTest', function(){ data.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_14100:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14100:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_14100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14100---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_14200 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_14200 * @tc.name setSize Sets the size of the data contained in the MessageParcel instance. The getSize command reads the data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_14200", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_14200", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14200---------------------------"); try{ let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_14200: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14200: create object successfully."); let option = new rpc.MessageOption(); let reply = rpc.MessageParcel.create(); expect(data.writeString("constant")).assertTrue(); @@ -5425,210 +5421,210 @@ describe('ActsRpcClientJsTest', function(){ expect(data.setSize(0)).assertTrue(); let getSizedata = data.getSize(); - console.info("SUB_Softbus_IPC_MessageParcel_14200:run setSizeis is " + getSizedata); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14200:run setSizeis is " + getSizedata); expect(getSizedata).assertEqual(0); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_14200: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14200: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_14200: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14200: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); let getSizeresult = result.reply.getSize(); - console.info("SUB_Softbus_IPC_MessageParcel_14200:run getSizeis is " + getSizeresult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14200:run getSizeis is " + getSizeresult); expect(getSizeresult).assertEqual( 8); let writeresult = result.reply.readString(); - console.info("SUB_Softbus_IPC_MessageParcel_14200:run readStringis is " + writeresult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14200:run readStringis is " + writeresult); expect(writeresult).assertEqual(""); }); data.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_14200:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14200:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_14200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14200---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_14300 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_14300 * @tc.name SetSize: Increases the value of the data contained in the MessageParcel instance by 1, Write setSize * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_14300", 0, async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_14300", 0, async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14300---------------------------"); try{ let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_14300: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14300: create object successfully."); expect(data.getSize()).assertEqual(0); expect(data.writeString("constant")).assertTrue(); expect(data.getSize()).assertEqual(("constant".length * 2) + 8); let getCapacitydata = data.getCapacity(); - console.info("SUB_Softbus_IPC_MessageParcel_14300:run getCapacityis is " + getCapacitydata); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14300:run getCapacityis is " + getCapacitydata); let setSizedata1 = data.setSize(getCapacitydata); - console.info("SUB_Softbus_IPC_MessageParcel_14300:run setSizeis is " + setSizedata1); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14300:run setSizeis is " + setSizedata1); expect(setSizedata1).assertTrue(); expect(data.getSize()).assertEqual(getCapacitydata); let setSizedata2 = data.setSize(getCapacitydata + 1); - console.info("SUB_Softbus_IPC_MessageParcel_14300:run setSizeis is " + setSizedata2); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14300:run setSizeis is " + setSizedata2); expect(setSizedata2).assertEqual(false); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_14300:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14300:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_14300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14300---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_14400 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_14400 * @tc.name SetSize: Increases the value of the data contained in the MessageParcel instance by 1, Write the setSize boundary value * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_14400", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_14400", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14400---------------------------"); try{ let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_14400: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14400: create object successfully."); let option = new rpc.MessageOption(); let reply = rpc.MessageParcel.create(); expect(data.writeString("constant")).assertTrue(); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_14400: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14400: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_14400: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14400: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); expect(result.reply.readString()).assertEqual("constant"); expect(result.reply.getSize()).assertEqual(("constant".length * 2) + 8); let getCapacityresult = result.reply.getCapacity(); - console.info("SUB_Softbus_IPC_MessageParcel_14400:run getCapacityis is " + getCapacityresult); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14400:run getCapacityis is " + getCapacityresult); let setSizeresult1 = result.reply.setSize(getCapacityresult); - console.info("SUB_Softbus_IPC_MessageParcel_14400:run setSizeis is " + setSizeresult1); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14400:run setSizeis is " + setSizeresult1); expect(setSizeresult1).assertTrue(); expect(result.reply.getSize()).assertEqual(getCapacityresult); let setSizeresult2 = result.reply.setSize(getCapacityresult + 1); - console.info("SUB_Softbus_IPC_MessageParcel_14400:run setSizeis is " + setSizeresult2); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14400:run setSizeis is " + setSizeresult2); expect(setSizeresult2).assertEqual(false); }); data.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_14400:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14400:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_14400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14400---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_14500 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_14500 * @tc.name Validate the setSize boundary value in the MessageParcel instance * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_14500", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_14500", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14500---------------------------"); try{ let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_14500: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14500: create object successfully."); let getCapacitydata = data.getCapacity(); - console.info("SUB_Softbus_IPC_MessageParcel_14500:run getCapacityis is " + getCapacitydata); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14500:run getCapacityis is " + getCapacitydata); expect(getCapacitydata).assertEqual(0); let setSizedata1 = data.setSize(4*G); - console.info("SUB_Softbus_IPC_MessageParcel_14500:run setSizeis is " + setSizedata1); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14500:run setSizeis is " + setSizedata1); expect(setSizedata1).assertTrue(); let getSizedata1 = data.getSize(); - console.info("SUB_Softbus_IPC_MessageParcel_14500:run getCapacityis is " + getSizedata1); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14500:run getCapacityis is " + getSizedata1); expect(getSizedata1).assertEqual(0); let setSizedata = data.setSize(4*G - 1); - console.info("SUB_Softbus_IPC_MessageParcel_14500:run setSizeis is " + setSizedata); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14500:run setSizeis is " + setSizedata); expect(setSizedata).assertEqual(false); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_14500:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14500:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_14500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14500---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_14600 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_14600 * @tc.name Verify that setSize is out of bounds in a MessageParcel instance * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_14600", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_14600", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14600---------------------------"); try{ let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_14600: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14600: create object successfully."); let setSizedata = data.setSize(0); - console.info("SUB_Softbus_IPC_MessageParcel_14600:run setCapacityis is " + setSizedata); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14600:run setCapacityis is " + setSizedata); expect(setSizedata).assertTrue(); expect(data.getSize()).assertEqual(0); let setSizedata1 = data.setSize(2*4*G); - console.info("SUB_Softbus_IPC_MessageParcel_14600:run setCapacityis is " + setSizedata1); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14600:run setCapacityis is " + setSizedata1); expect(setSizedata1).assertTrue(); expect(data.getSize()).assertEqual(0); let setSizedata2 = data.setSize(2*G); - console.info("SUB_Softbus_IPC_MessageParcel_14600:run setCapacityis is " + setSizedata2); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14600:run setCapacityis is " + setSizedata2); expect(setSizedata2).assertEqual(false); data.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_14600:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14600:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_14600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14600---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_14700 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_14700 * @tc.name Obtaining the Writable and Readable Byte Spaces of MessageParcel * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_14700", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_14700", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14700---------------------------"); try{ let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_14700: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14700: create object successfully."); let option = new rpc.MessageOption(); let reply = rpc.MessageParcel.create(); let getwbyte1 = data.getWritableBytes(); data.writeInt(10); let getwbyte2 = data.getWritableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_14700:result getWritePosition is getWritableBytes is " + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14700:result getWritePosition is getWritableBytes is " + getwbyte1 + ";" + getwbyte2); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_14700: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14700: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_14700: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14700: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); let getrbyte1 = result.reply.getReadableBytes(); let readint = result.reply.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_14700:result readInt is " + readint); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14700:result readInt is " + readint); let getrbyte2 = result.reply.getReadableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_14700:result getReadPosition is getReadableBytes is" + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14700:result getReadPosition is getReadableBytes is" + getrbyte1 + ";" + getrbyte2); expect(readint).assertEqual(10); expect(getrbyte2).assertEqual(0); @@ -5636,41 +5632,41 @@ describe('ActsRpcClientJsTest', function(){ data.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_14700:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14700:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_14700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14700---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_14800 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_14800 * @tc.name Obtains the writeable and readable byte space and read position of the MessageParcel * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_14800", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_14800", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14800---------------------------"); try{ let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_14800: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14800: create object successfully."); let option = new rpc.MessageOption(); let reply = rpc.MessageParcel.create(); data.writeInt(10); let getwPos = data.getWritePosition(); let getwbyte = data.getWritableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_14800:result getWritePosition is " + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14800:result getWritePosition is " + getwPos + "getWritableBytes is " + getwbyte); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_14800: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14800: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_14800: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14800: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); let getrbyte = result.reply.getReadableBytes(); let readint = result.reply.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_14800:result readInt is " + readint); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14800:result readInt is " + readint); let getrPos = result.reply.getReadPosition(); - console.info("SUB_Softbus_IPC_MessageParcel_14800:result getReadPosition is " + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14800:result getReadPosition is " + getrPos + "getReadableBytes is" + getrbyte); expect(readint).assertEqual(10); expect(getrPos).assertEqual(getwPos); @@ -5678,131 +5674,127 @@ describe('ActsRpcClientJsTest', function(){ data.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_14800:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14800:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_14800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14800---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_14900 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_14900 * @tc.name Obtains the writeable and readable byte space and read position of the MessageParcel * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_14900", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_14900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_14900", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_14900---------------------------"); try{ let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_14900: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14900: create object successfully."); let option = new rpc.MessageOption(); let reply = rpc.MessageParcel.create(); data.writeInt(10); let getwPos = data.getWritePosition(); let getwbyte = data.getWritableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_14900:result getWritePosition is " + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14900:result getWritePosition is " + getwPos + "getWritableBytes is " + getwbyte); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_14900: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14900: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_14900: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14900: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); let readint = result.reply.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_14900:result readInt is " + readint); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14900:result readInt is " + readint); let getrPos = result.reply.getReadPosition(); let getrbyte = result.reply.getReadableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_14900:result getReadPosition is " + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14900:result getReadPosition is " + getrPos + "getReadableBytes is" + getrbyte); expect(readint).assertEqual(10); let getrPos1 = result.reply.getReadPosition(); expect(getrPos1).assertEqual(getwPos); let getrbyte1 = result.reply.getReadableBytes(); - console.info("SUB_Softbus_IPC_MessageParcel_14900:result getReadPosition is " + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14900:result getReadPosition is " + getrPos1 + "getReadableBytes is" + getrbyte1); expect(getrbyte1).assertEqual(0); }); data.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_14900:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_14900:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_14900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_14900---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_15000 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_15000 * @tc.name Test fixed MessageParcel space size to pass rawData data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_15000", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_15000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_15000", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_15000---------------------------"); try{ - let maxsize = 1024; let data = rpc.MessageParcel.create(); - let Capacity = data.getRawDataCapacity() - console.info("SUB_Softbus_IPC_MessageParcel_15000:run Capacity success, Capacity is " + Capacity); let rawdata = [1, 2, 3]; let option = new rpc.MessageOption(); let reply = rpc.MessageParcel.create(); - expect(data.writeInt(maxsize)).assertTrue(); - let result = data.writeRawData(rawdata, maxsize); - console.info("SUB_Softbus_IPC_MessageParcel_15000:run writeRawDatais is " + result); + expect(data.writeInt(rawdata.length)).assertTrue(); + let result = data.writeRawData(rawdata, rawdata.length); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15000:run writeRawDatais is " + result); expect(result).assertTrue(); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_15000: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15000: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_RAWDATA, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_15000: result is " + result.errCode); expect(result.errCode == 0).assertTrue(); let size = result.reply.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_15000:run readIntis is " + size); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15000:run readIntis is " + size); var newReadResult = result.reply.readRawData(size) - console.info("SUB_Softbus_IPC_MessageParcel_15000:run readRawDatais is " + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15000:run readRawDatais is " + newReadResult.length); expect(newReadResult != rawdata).assertTrue(); }); data.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_15000:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15000:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_15000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_15000---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_15100 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_15100 * @tc.name Obtains the write and read positions of the MessageParcel * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_15100", 0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_15100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_15100", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_15100---------------------------"); try{ let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageParcel_15100: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15100: create object successfully."); let option = new rpc.MessageOption(); let reply = rpc.MessageParcel.create(); let getwPos1 = data.getWritePosition(); expect(data.writeInt(10)).assertTrue(); let getwPos2 = data.getWritePosition(); - console.info("SUB_Softbus_IPC_MessageParcel_15100:result getWritePosition is " + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15100:result getWritePosition is " + getwPos1 + ";" + getwPos2); if (gIRemoteObject == undefined){ - console.info("SUB_Softbus_IPC_MessageParcel_15100: gIRemoteObject undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15100: gIRemoteObject undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_INT, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageParcel_15100: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15100: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); let getrPos1 = result.reply.getReadPosition(); let readint = result.reply.readInt(); - console.info("SUB_Softbus_IPC_MessageParcel_15100:result readInt is " + readint); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15100:result readInt is " + readint); let getrPos2 = result.reply.getReadPosition(); - console.info("SUB_Softbus_IPC_MessageParcel_15100:result getReadPosition is " + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15100:result getReadPosition is " + getrPos1 + ";" + getrPos2); expect(getwPos1).assertEqual(getrPos1); expect(getwPos2).assertEqual(getrPos2); @@ -5810,272 +5802,460 @@ describe('ActsRpcClientJsTest', function(){ data.reclaim(); reply.reclaim(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_15100:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15100:error = " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_15100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_15100---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_15200 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_15200 * @tc.name Test messageparcel delivery file descriptor object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_15200", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_15200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_15200", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_15200---------------------------"); try{ let testab = new TestProxy(gIRemoteObject).asObject(); - console.info("SUB_Softbus_IPC_MessageParcel_15200: run TestProxy success" + testab); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15200: run TestProxy success" + testab); expect(testab != null).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_15200:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15200:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_15200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_15200---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageParcel_15300 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_15300 * @tc.name Test messageparcel delivery file descriptor object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageParcel_15300", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageParcel_15300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageParcel_15300", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_15300---------------------------"); try{ let testRemoteObject = new TestRemoteObject("testObject"); - console.info("SUB_Softbus_IPC_MessageParcel_15300: TestRemoteObject is" + testRemoteObject); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15300: TestRemoteObject is" + testRemoteObject); let testab = testRemoteObject.asObject(); - console.info("SUB_Softbus_IPC_MessageParcel_15300: asObject is" + testab); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15300: asObject is" + testab); expect(testab != null).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_MessageParcel_15300:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15300:error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_15300---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_15400 + * @tc.name MessageParcel sendRequestAsync API test + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_Compatibility_MessageParcel_15400", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_15400---------------------------"); + try{ + let data = rpc.MessageParcel.create(); + let Capacity = data.getRawDataCapacity() + let rawdata = [1, 2, 3]; + let option = new rpc.MessageOption(); + let reply = rpc.MessageParcel.create(); + expect(data.writeInt(rawdata.length)).assertTrue(); + let result = data.writeRawData(rawdata, rawdata.length); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15400:run writeRawData is " + result); + expect(result).assertTrue(); + if (gIRemoteObject == undefined){ + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15400: gIRemoteObject undefined"); + } + await gIRemoteObject.sendRequestAsync(CODE_WRITE_RAWDATA, data, reply, option).then((result) => { + expect(result.errCode == 0).assertTrue(); + let size = result.reply.readInt(); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15400:run readInt is " + size); + var newReadResult = result.reply.readRawData(size) + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15400:run readRawData is " + + newReadResult.length); + expect(newReadResult != rawdata).assertTrue(); + }); + data.reclaim(); + reply.reclaim(); + } catch (error) { + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15400 : error = " + error); + } + done(); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_15400---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_15500 + * @tc.name Invoke the writestring interface to write data to the messageparcel instance SendRequest Asynchronous + * Authentication onRemoteRequestEx Server Processing + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_Compatibility_MessageParcel_15500", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_15500---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15500: create object successfully."); + var reply = rpc.MessageParcel.create(); + var option = new rpc.MessageOption(); + var token = 'onRemoteRequestEx invoking'; + var result = data.writeString(token); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15500:run writeStringis is " + result); + expect(result == true).assertTrue(); + if (gIRemoteObject == undefined) + { + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15500: gIRemoteObject is undefined"); + } + await gIRemoteObject.sendRequest(CODE_ONREMOTEREQUESTEX, data, reply, option).then((result) => { + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15500: sendRequestis is " + result.errCode); + var replyReadResult = result.reply.readString(); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15500: run readString is " + replyReadResult); + expect(replyReadResult).assertEqual(token); + }); + data.reclaim(); + reply.reclaim(); + done(); + } catch (error) { + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15500:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageParcel_15300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_15500---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_MessageOption_00100 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_15600 + * @tc.name Invoke the writestring interface to write data to the messageparcel instance sendRequestAsync Asynchronous + * Authentication onRemoteRequestEx Server Processing + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_Compatibility_MessageParcel_15600", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_15600---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15600: create object successfully."); + var reply = rpc.MessageParcel.create(); + var option = new rpc.MessageOption(); + var token = 'onRemoteRequestEx invoking'; + var result = data.writeString(token); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15600:run writeStringis is " + result); + expect(result == true).assertTrue(); + if (gIRemoteObject == undefined) + { + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15600: gIRemoteObject is undefined"); + } + await gIRemoteObject.sendRequestAsync(CODE_ONREMOTEREQUESTEX, data, reply, option).then((result) => { + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15600: sendRequestis is " + result.errCode); + var replyReadResult = result.reply.readString(); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15600: run readString is " + replyReadResult); + expect(replyReadResult).assertEqual(token); + }); + data.reclaim(); + reply.reclaim(); + done(); + } catch (error) { + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15600:error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_15600---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_15700 + * @tc.name Invoke the writestring interface to write data to the messageparcel instance. SendRequest asynchronously + * verifies the priority processing levels of onRemoteRequestEx and onRemoteRequest + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_Compatibility_MessageParcel_15700", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_15700---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15700: create object successfully."); + var reply = rpc.MessageParcel.create(); + var option = new rpc.MessageOption(); + var token = "onRemoteRequest or onRemoteRequestEx invoking"; + var result = data.writeString(token); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15700:run writeStringis is " + result); + expect(result == true).assertTrue(); + if (gIRemoteObject == undefined) + { + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15700: gIRemoteObject is undefined"); + } + await gIRemoteObject.sendRequest(CODE_ONREMOTEREQUESTEX_OR_ONREMOTEREQUEST, data, reply, option).then((result) => { + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15700: sendRequestis is " + result.errCode); + var replyReadResult = result.reply.readString(); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15700: run readString is " + replyReadResult); + expect(replyReadResult).assertEqual("onRemoteRequestEx invoking"); + }); + data.reclaim(); + reply.reclaim(); + done(); + } catch (error) { + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15700:error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_15700---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_Compatibility_MessageParcel_15800 + * @tc.name Invoke the writestring interface to write data to the messageparcel instance. sendRequestAsync asynchronously verifies + * the priority processing levels of onRemoteRequestEx and onRemoteRequest + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_Compatibility_MessageParcel_15800", 0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageParcel_15800---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15800: create object successfully."); + var reply = rpc.MessageParcel.create(); + var option = new rpc.MessageOption(); + var token = 'onRemoteRequest or onRemoteRequestEx invoking'; + var result = data.writeString(token); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15800:run writeStringis is " + result); + expect(result == true).assertTrue(); + if (gIRemoteObject == undefined) + { + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15800: gIRemoteObject is undefined"); + } + await gIRemoteObject.sendRequestAsync(CODE_ONREMOTEREQUESTEX_OR_ONREMOTEREQUEST, data, reply, option).then((result) => { + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15800: sendRequestis is " + result.errCode); + var replyReadResult = result.reply.readString(); + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15800: run readString is " + replyReadResult); + expect(replyReadResult).assertEqual("onRemoteRequestEx invoking"); + }); + data.reclaim(); + reply.reclaim(); + done(); + } catch (error) { + console.info("SUB_Softbus_IPC_Compatibility_MessageParcel_15800:error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageParcel_15800---------------------------"); + }); + + + /* + * @tc.number SUB_Softbus_IPC_Compatibility_MessageOption_00100 * @tc.name Basic method of testing messageoption * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageOption_00100",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageOption_00100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageOption_00100",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_00100---------------------------"); try{ let option = new rpc.MessageOption(); - console.info("SUB_Softbus_IPC_MessageOption_00100: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00100: create object successfully."); let time = option.getWaitTime(); - console.info("SUB_Softbus_IPC_MessageOption_00100: run getWaitTime success, time is " + time); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00100: run getWaitTime success, time is " + time); expect(time).assertEqual(rpc.MessageOption.TF_WAIT_TIME); option.setWaitTime(16); let time2 = option.getWaitTime(); - console.info("SUB_Softbus_IPC_MessageOption_00100: run getWaitTime success, time is " + time2); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00100: run getWaitTime success, time is " + time2); expect(time2).assertEqual(16); }catch(error){ - console.info("SUB_Softbus_IPC_MessageOption_00100: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00100: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageOption_00100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_00100---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_MessageOption_00200 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageOption_00200 * @tc.name Basic method of testing messageoption * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageOption_00200",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageOption_00200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageOption_00200",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_00200---------------------------"); try{ let option = new rpc.MessageOption(); - console.info("SUB_Softbus_IPC_MessageOption_00200: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00200: create object successfully."); let time = option.getWaitTime(); - console.info("SUB_Softbus_IPC_MessageOption_00200: run getWaitTime success, time is " + time); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00200: run getWaitTime success, time is " + time); expect(time).assertEqual(rpc.MessageOption.TF_WAIT_TIME); option.setWaitTime(0); let time2 = option.getWaitTime(); - console.info("SUB_Softbus_IPC_MessageOption_00200: run getWaitTime success, time is " + time2); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00200: run getWaitTime success, time is " + time2); expect(time2).assertEqual(rpc.MessageOption.TF_WAIT_TIME); option.setWaitTime(60); let time3 = option.getWaitTime(); - console.info("SUB_Softbus_IPC_MessageOption_00200: run getWaitTime success, time is " + time3); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00200: run getWaitTime success, time is " + time3); expect(time3).assertEqual(60); }catch(error){ - console.info("SUB_Softbus_IPC_MessageOption_00200: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00200: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageOption_00200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_00200---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_MessageOption_00300 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageOption_00300 * @tc.name Basic method of testing messageoption * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageOption_00300",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageOption_00300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageOption_00300",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_00300---------------------------"); try{ let option = new rpc.MessageOption(); - console.info("SUB_Softbus_IPC_MessageOption_00300: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00300: create object successfully."); let time = option.getWaitTime(); - console.info("SUB_Softbus_IPC_MessageOption_00300: run getWaitTime success, time is " + time); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00300: run getWaitTime success, time is " + time); expect(time).assertEqual(rpc.MessageOption.TF_WAIT_TIME); option.setWaitTime(-1); let time2 = option.getWaitTime(); - console.info("SUB_Softbus_IPC_MessageOption_00300: run getWaitTime success, time is " + time2); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00300: run getWaitTime success, time is " + time2); expect(time2).assertEqual(rpc.MessageOption.TF_WAIT_TIME); }catch(error){ - console.info("SUB_Softbus_IPC_MessageOption_00300: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00300: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageOption_00300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_00300---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_MessageOption_00400 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageOption_00400 * @tc.name Basic method of testing messageoption * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageOption_00400",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageOption_00400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageOption_00400",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_00400---------------------------"); try{ let option = new rpc.MessageOption(); - console.info("SUB_Softbus_IPC_MessageOption_00400: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00400: create object successfully."); let time = option.getWaitTime(); - console.info("SUB_Softbus_IPC_MessageOption_00400: run getWaitTime success, time is " + time); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00400: run getWaitTime success, time is " + time); expect(time).assertEqual(rpc.MessageOption.TF_WAIT_TIME); option.setWaitTime(61); let time2 = option.getWaitTime(); - console.info("SUB_Softbus_IPC_MessageOption_00400: run getWaitTime success, time is " + time2); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00400: run getWaitTime success, time is " + time2); expect(time2).assertEqual(61); }catch(error){ - console.info("SUB_Softbus_IPC_MessageOption_00400: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00400: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageOption_00400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_00400---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_MessageOption_00500 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageOption_00500 * @tc.name Basic method of testing messageoption * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageOption_00500",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageOption_00500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageOption_00500",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_00500---------------------------"); try{ let option = new rpc.MessageOption(); - console.info("SUB_Softbus_IPC_MessageOption_00500: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00500: create object successfully."); let flog = option.getFlags(); - console.info("SUB_Softbus_IPC_MessageOption_00500: run getFlags success, flog is " + flog); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00500: run getFlags success, flog is " + flog); expect(flog).assertEqual(rpc.MessageOption.TF_SYNC); option.setFlags(1) - console.info("SUB_Softbus_IPC_MessageOption_00500: run setFlags success"); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00500: run setFlags success"); let flog2 = option.getFlags(); - console.info("SUB_Softbus_IPC_MessageOption_00500: run getFlags success, flog2 is " + flog2); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00500: run getFlags success, flog2 is " + flog2); expect(flog2).assertEqual(rpc.MessageOption.TF_ASYNC); }catch(error){ - console.info("SUB_Softbus_IPC_MessageOption_00500: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00500: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageOption_00500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_00500---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_MessageOption_00600 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageOption_00600 * @tc.name Basic method of testing messageoption * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageOption_00600",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageOption_00600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageOption_00600",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_00600---------------------------"); try{ let option = new rpc.MessageOption(); - console.info("SUB_Softbus_IPC_MessageOption_00600: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00600: create object successfully."); let flog = option.getFlags(); - console.info("SUB_Softbus_IPC_MessageOption_00600: run getFlags success, flog is " + flog); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00600: run getFlags success, flog is " + flog); expect(flog).assertEqual(rpc.MessageOption.TF_SYNC); option.setFlags(1); - console.info("SUB_Softbus_IPC_MessageOption_00600: run setFlags success"); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00600: run setFlags success"); let flog2 = option.getFlags(); - console.info("SUB_Softbus_IPC_MessageOption_00600: run getFlags success, flog2 is " + flog2); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00600: run getFlags success, flog2 is " + flog2); expect(flog2).assertEqual(rpc.MessageOption.TF_ASYNC); option.setFlags(0) - console.info("SUB_Softbus_IPC_MessageOption_00600: run setFlags success"); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00600: run setFlags success"); let flog3 = option.getFlags(); - console.info("SUB_Softbus_IPC_MessageOption_00600: run getFlags success, flog2 is " + flog3); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00600: run getFlags success, flog2 is " + flog3); expect(flog2).assertEqual(rpc.MessageOption.TF_ASYNC); }catch(error){ - console.info("SUB_Softbus_IPC_MessageOption_00600: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00600: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageOption_00600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_00600---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_MessageOption_00700 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageOption_00700 * @tc.name Basic method of testing messageoption * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageOption_00700",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageOption_00700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageOption_00700",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_00700---------------------------"); try{ let option = new rpc.MessageOption(); - console.info("SUB_Softbus_IPC_MessageOption_00700: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00700: create object successfully."); let flog = option.getFlags(); - console.info("SUB_Softbus_IPC_MessageOption_00700: run getFlags success, flog is " + flog); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00700: run getFlags success, flog is " + flog); expect(flog).assertEqual(rpc.MessageOption.TF_SYNC); option.setFlags(-1); let flog2 = option.getFlags(); - console.info("SUB_Softbus_IPC_MessageOption_00700: run getFlags success, flog2 is " + flog2); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00700: run getFlags success, flog2 is " + flog2); expect(flog2).assertEqual(-1); }catch(error){ - console.info("SUB_Softbus_IPC_MessageOption_00700: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00700: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageOption_00700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_00700---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_MessageOption_00800 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageOption_00800 * @tc.name Basic method of testing messageoption * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageOption_00800",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageOption_00800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageOption_00800",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_00800---------------------------"); try{ let option = new rpc.MessageOption(); - console.info("SUB_Softbus_IPC_MessageOption_00800: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00800: create object successfully."); let flog = option.getFlags(); - console.info("SUB_Softbus_IPC_MessageOption_00800: run getFlags success, flog is " + flog); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00800: run getFlags success, flog is " + flog); expect(flog).assertEqual(rpc.MessageOption.TF_SYNC); option.setFlags(3); let flog2 = option.getFlags(); - console.info("SUB_Softbus_IPC_MessageOption_00800: run getFlags success, flog2 is " + flog2); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00800: run getFlags success, flog2 is " + flog2); expect(flog2).assertEqual(3); }catch(error){ - console.info("SUB_Softbus_IPC_MessageOption_00800: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00800: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageOption_00800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_00800---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_MessageOption_00900 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageOption_00900 * @tc.name Basic method of testing messageoption * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageOption_00900",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_MessageOption_00900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageOption_00900",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_00900---------------------------"); try{ expect(rpc.MessageOption.TF_SYNC).assertEqual(0); @@ -6085,43 +6265,43 @@ describe('ActsRpcClientJsTest', function(){ expect(rpc.MessageOption.TF_ACCEPT_FDS).assertEqual(0x10); }catch(error){ - console.info("SUB_Softbus_IPC_MessageOption_00900: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_00900: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_MessageOption_00900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_00900---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_MessageOption_01000 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageOption_01000 * @tc.name Basic method of testing messageoption * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageOption_01000",0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageOption_01000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageOption_01000",0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_01000---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageOption_01000: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01000: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); option.setWaitTime(20); option.setFlags(0); var token = "option"; var result = data.writeString(token); - console.info("SUB_Softbus_IPC_MessageOption_01000:run writeStringis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01000:run writeStringis is " + result); expect(result).assertTrue(); expect(option.getFlags()).assertEqual(0); expect(option.getWaitTime()).assertEqual(20); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageOption_01000: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01000: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageOption_01000: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01000: sendRequestis is " + result.errCode); var replyReadResult = result.reply.readString(); - console.info("SUB_Softbus_IPC_MessageOption_01000: run readString is " + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01000: run readString is " + replyReadResult); expect(replyReadResult).assertEqual(token); expect(option.getFlags()).assertEqual(0); expect(option.getWaitTime()).assertEqual(20); @@ -6130,40 +6310,40 @@ describe('ActsRpcClientJsTest', function(){ data.reclaim(); reply.reclaim(); }catch(error){ - console.info("SUB_Softbus_IPC_MessageOption_01000: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01000: error " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageOption_01000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_01000---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_MessageOption_01100 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageOption_01100 * @tc.name Basic method of testing messageoption * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageOption_01100",0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageOption_01100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageOption_01100",0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_01100---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageOption_01100: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01100: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); option.setFlags(1); var token = "option"; var result = data.writeString(token); - console.info("SUB_Softbus_IPC_MessageOption_01100:run writeStringis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01100:run writeStringis is " + result); expect(result).assertTrue(); expect(option.getFlags()).assertEqual(1); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageOption_01100: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01100: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageOption_01100: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01100: sendRequestis is " + result.errCode); var replyReadResult = result.reply.readString(); - console.info("SUB_Softbus_IPC_MessageOption_01100: run readString is " + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01100: run readString is " + replyReadResult); expect(replyReadResult).assertEqual(""); expect(option.getFlags()).assertEqual(1); @@ -6171,852 +6351,893 @@ describe('ActsRpcClientJsTest', function(){ data.reclaim(); reply.reclaim(); }catch(error){ - console.info("SUB_Softbus_IPC_MessageOption_01100: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01100: error " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageOption_01100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_01100---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_MessageOption_01200 + * @tc.number SUB_Softbus_IPC_Compatibility_MessageOption_01200 * @tc.name Basic method of testing messageoption * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_MessageOption_01200",0, async function(done){ - console.info("---------------------start SUB_Softbus_IPC_MessageOption_01200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_MessageOption_01200",0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_01200---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_MessageOption_01200: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01200: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); option.setFlags(3); var token = "option"; var result = data.writeString(token); - console.info("SUB_Softbus_IPC_MessageOption_01200:run writeStringis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01200:run writeStringis is " + result); expect(result).assertTrue(); expect(option.getFlags()).assertEqual(3); if (gIRemoteObject == undefined) { - console.info("SUB_Softbus_IPC_MessageOption_01200: gIRemoteObject is undefined"); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01200: gIRemoteObject is undefined"); } await gIRemoteObject.sendRequest(CODE_WRITE_STRING, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_MessageOption_01200: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01200: sendRequestis is " + result.errCode); var replyReadResult = result.reply.readString(); - console.info("SUB_Softbus_IPC_MessageOption_01200: run readString is " + replyReadResult); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01200: run readString is " + replyReadResult); expect(replyReadResult).assertEqual(""); expect(option.getFlags()).assertEqual(3); }); data.reclaim(); reply.reclaim(); }catch(error){ - console.info("SUB_Softbus_IPC_MessageOption_01200: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01200: error " + error); + } + done(); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_01200---------------------------"); + }) + + /* + * @tc.number SUB_Softbus_IPC_Compatibility_MessageOption_01300 + * @tc.name MessageOption sendRequestAsync test + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_Compatibility_MessageOption_01300",0, async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_MessageOption_01300---------------------------"); + try{ + + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01300: create object successfully."); + var reply = rpc.MessageParcel.create(); + var option = new rpc.MessageOption(); + option.setFlags(1); + var token = "option"; + var result = data.writeString(token); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01300:run writeString is " + result); + expect(result).assertTrue(); + expect(option.getFlags()).assertEqual(1); + if (gIRemoteObject == undefined) + { + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01300: gIRemoteObject is undefined"); + } + await gIRemoteObject.sendRequestAsync(CODE_WRITE_STRING, data, reply, option).then((result) => { + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01300: sendRequestAsync is " + result.errCode); + var replyReadResult = result.reply.readString(); + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01300: run readString is " + replyReadResult); + expect(replyReadResult).assertEqual(""); + expect(option.getFlags()).assertEqual(1); + + }); + data.reclaim(); + reply.reclaim(); + }catch(error){ + console.info("SUB_Softbus_IPC_Compatibility_MessageOption_01300: error " + error); } done(); - console.info("---------------------end SUB_Softbus_IPC_MessageOption_01200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_MessageOption_01300---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_00100 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_00100 * @tc.name Exception parameter validation of the created anonymous shared memory object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_00100",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_00100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_00100",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_00100---------------------------"); try{ let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", -1) - console.info("SUB_Softbus_IPC_Ashmem_00100: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00100: ashmem " + ashmem); let ashmem2 = rpc.Ashmem.createAshmem(null, K) - console.info("SUB_Softbus_IPC_Ashmem_00100: ashmem2 " + ashmem2); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00100: ashmem2 " + ashmem2); }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_00100: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00100: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_00100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_00100---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_00200 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_00200 * @tc.name Call the getashmemsize interface to get the size of the shared memory object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_00200",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_00200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_00200",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_00200---------------------------"); try{ var mapSize = 2*G - 1; var jsash = ""; for (let i = 0;i < (256 - 1);i++){ jsash += "a"; } - console.info("SUB_Softbus_IPC_Ashmem_00200: run createAshmem success" + jsash.length); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00200: run createAshmem success" + jsash.length); let ashmem = rpc.Ashmem.createAshmem(jsash, mapSize) - console.info("SUB_Softbus_IPC_Ashmem_00200: run createAshmem success" + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00200: run createAshmem success" + ashmem); expect(ashmem != null).assertTrue(); ashmem.closeAshmem(); }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_00200: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00200: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_00200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_00200---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_00300 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_00300 * @tc.name Call the getashmemsize interface to get the size of the shared memory object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_00300",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_00300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_00300",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_00300---------------------------"); try{ let mapSize = 2*G - 1; let jsash = ''; for (let i = 0;i < 256;i++){ jsash += 'a'; } - console.info("SUB_Softbus_IPC_Ashmem_00300: run createAshmem success" + jsash.length); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00300: run createAshmem success" + jsash.length); let ashmem = rpc.Ashmem.createAshmem(jsash, mapSize) - console.info("SUB_Softbus_IPC_Ashmem_00300: run createAshmem success" + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00300: run createAshmem success" + ashmem); ashmem.closeAshmem(); }catch(error){ expect(error != null).assertTrue(); - console.info("SUB_Softbus_IPC_Ashmem_00300: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00300: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_00300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_00300---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_00400 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_00400 * @tc.name Call the getashmemsize interface to get the size of the shared memory object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_00400",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_00400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_00400",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_00400---------------------------"); try{ let mapSize = 2*G - 1; let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize) - console.info("SUB_Softbus_IPC_Ashmem_00400: run createAshmem success" + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00400: run createAshmem success" + ashmem); let size = ashmem.getAshmemSize() - console.info("SUB_Softbus_IPC_Ashmem_00400: run getAshmemSize success, size is " + size); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00400: run getAshmemSize success, size is " + size); expect(size).assertEqual(mapSize); ashmem.closeAshmem(); }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_00400: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00400: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_00400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_00400---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_00500 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_00500 * @tc.name Call the getashmemsize interface to get the size of the shared memory object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_00500",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_00500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_00500",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_00500---------------------------"); try{ let mapSize = 2*G; let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest ", mapSize) - console.info("SUB_Softbus_IPC_Ashmem_00500: run createAshmem success " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00500: run createAshmem success " + ashmem); let size = ashmem.getAshmemSize() - console.info("SUB_Softbus_IPC_Ashmem_00500: run getAshmemSize success, size is " + size); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00500: run getAshmemSize success, size is " + size); expect(size).assertEqual(mapSize); ashmem.closeAshmem(); }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_00500: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00500: error " + error); expect(error != null).assertTrue(); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_00500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_00500---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_00600 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_00600 * @tc.name Writeashmem exception validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_00600",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_00600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_00600",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_00600---------------------------"); try{ let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096) - console.info("SUB_Softbus_IPC_Ashmem_00600: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00600: ashmem " + ashmem); ashmem.closeAshmem() var data = rpc.MessageParcel.create(); let writeAshmem = data.writeAshmem(ashmem); - console.info("SUB_Softbus_IPC_Ashmem_00600: run writeAshmem success, writeAshmem is " + writeAshmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00600: run writeAshmem success, writeAshmem is " + writeAshmem); expect(writeAshmem).assertEqual(false); }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_00600: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00600: error " + error); } data.reclaim(); - console.info("---------------------end SUB_Softbus_IPC_Ashmem_00600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_00600---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_00700 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_00700 * @tc.name Readfromashmem exception validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_00700",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_00700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_00700",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_00700---------------------------"); try{ let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096) - console.info("SUB_Softbus_IPC_Ashmem_00700: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00700: ashmem " + ashmem); ashmem.unmapAshmem() - console.info("SUB_Softbus_IPC_Ashmem_00700: run unmapAshmem success"); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00700: run unmapAshmem success"); let bytes = [1, 2, 3, 4, 5]; let ret = ashmem.readFromAshmem(bytes.length, 0); - console.info("SUB_Softbus_IPC_Ashmem_00700: run readFromAshmem result is " + ret); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00700: run readFromAshmem result is " + ret); expect(ret==null).assertTrue(); ashmem.closeAshmem(); }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_00700: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00700: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_00700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_00700---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_00800 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_00800 * @tc.name Mapashmem interface creates shared file mappings * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_00800",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_00800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_00800",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_00800---------------------------"); try{ let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096) - console.info("SUB_Softbus_IPC_Ashmem_00800: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00800: ashmem " + ashmem); let result = ashmem.mapAshmem(rpc.Ashmem.PROT_READ); - console.info("SUB_Softbus_IPC_Ashmem_00800: run mapAshmemis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00800: run mapAshmemis is " + result); expect(result).assertTrue(); ashmem.closeAshmem() }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_00800: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00800: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_00800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_00800---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_00900 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_00900 * @tc.name Mapashmem exception validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_00900",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_00900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_00900",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_00900---------------------------"); try{ let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", (2*G - 1)) - console.info("SUB_Softbus_IPC_Ashmem_00900: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00900: ashmem " + ashmem); let result = ashmem.mapAshmem(999); - console.info("SUB_Softbus_IPC_Ashmem_00900: run mapAshmemis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00900: run mapAshmemis is " + result); expect(result).assertEqual(false); ashmem.closeAshmem() }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_00900: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_00900: error " + error); expect(error != null).assertTrue(); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_00900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_00900---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_01000 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_01000 * @tc.name Mapreadandwriteashmem interface creates a shared file map with the protection level of read-write * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_01000",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_01000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_01000",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01000---------------------------"); try{ let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K) - console.info("SUB_Softbus_IPC_Ashmem_01000: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01000: ashmem " + ashmem); let result = ashmem.mapReadAndWriteAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_01000: run mapAshmemis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01000: run mapAshmemis is " + result); ashmem.closeAshmem() }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_01000: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01000: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_01000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01000---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_01100 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_01100 * @tc.name Mapreadandwriteashmem exception validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_01100",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_01100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_01100",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01100---------------------------"); try{ let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096) - console.info("SUB_Softbus_IPC_Ashmem_01100: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01100: ashmem " + ashmem); let result = ashmem.mapAshmem(rpc.Ashmem.PROT_READ); - console.info("SUB_Softbus_IPC_Ashmem_01100: run mapAshmemis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01100: run mapAshmemis is " + result); expect(result).assertTrue(); ashmem.unmapAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_01100: run unmapAshmem success"); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01100: run unmapAshmem success"); let result2 = ashmem.mapReadAndWriteAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_01100: run mapReadAndWriteAshmemis2 is " + result2); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01100: run mapReadAndWriteAshmemis2 is " + result2); expect(result2).assertTrue(); ashmem.closeAshmem() }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_01100: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01100: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_01100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01100---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_01200 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_01200 * @tc.name Mapreadonlyashmem interface creates a shared file map with the protection level of read-write * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_01200",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_01200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_01200",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01200---------------------------"); try{ let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096) - console.info("SUB_Softbus_IPC_Ashmem_01200: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01200: ashmem " + ashmem); let result = ashmem.mapReadOnlyAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_01200: run mapReadAndWriteAshmemis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01200: run mapReadAndWriteAshmemis is " + result); expect(result).assertTrue(); ashmem.closeAshmem(); }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_01200: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01200: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_01200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01200---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_01300 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_01300 * @tc.name Mapreadonlyashmem exception validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_01300",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_01300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_01300",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01300---------------------------"); try{ let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K) - console.info("SUB_Softbus_IPC_Ashmem_01300: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01300: ashmem " + ashmem); let result = ashmem.mapAshmem(rpc.Ashmem.PROT_WRITE); - console.info("SUB_Softbus_IPC_Ashmem_01300: run mapAshmemis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01300: run mapAshmemis is " + result); expect(result).assertTrue(); ashmem.unmapAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_01300: run unmapAshmem success"); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01300: run unmapAshmem success"); ashmem.closeAshmem() let result2 = ashmem.mapReadOnlyAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_01300: run mapReadAndWriteAshmemis2 is " + result2); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01300: run mapReadAndWriteAshmemis2 is " + result2); expect(result2).assertEqual(false); }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_01300: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01300: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_01300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01300---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_01400 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_01400 * @tc.name Mapreadonlyashmem exception validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_01400",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_01400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_01400",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01400---------------------------"); try{ let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K); let resultwrite = ashmem.setProtection(rpc.Ashmem.PROT_WRITE) - console.info("SUB_Softbus_IPC_Ashmem_01400: run setProtectioniswrite is " + resultwrite); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01400: run setProtectioniswrite is " + resultwrite); expect(resultwrite).assertTrue(); let resultread = ashmem.setProtection(rpc.Ashmem.PROT_READ) - console.info("SUB_Softbus_IPC_Ashmem_01400: run setProtectionisread is " + resultread); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01400: run setProtectionisread is " + resultread); expect(resultread).assertEqual(false); let resultreadAndwrite = ashmem.mapReadAndWriteAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_01400: run setProtection success, mapReadAndWriteAshmem is " + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01400: run setProtection success, mapReadAndWriteAshmem is " + resultreadAndwrite); expect(resultreadAndwrite ).assertEqual(false); let resultnone = ashmem.setProtection(rpc.Ashmem.PROT_NONE) - console.info("SUB_Softbus_IPC_Ashmem_01400: run setProtectionisnone is " + resultnone); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01400: run setProtectionisnone is " + resultnone); expect(resultnone).assertTrue(); let resultread2 = ashmem.setProtection(rpc.Ashmem.PROT_READ) - console.info("SUB_Softbus_IPC_Ashmem_01400: run setProtectionisread2 is " + resultread2); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01400: run setProtectionisread2 is " + resultread2); expect(resultread2).assertEqual(false); ashmem.closeAshmem() }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_01400: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01400: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_01400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01400---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_01500 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_01500 * @tc.name Setprotection exception input parameter verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_01500",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_01500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_01500",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01500---------------------------"); try{ let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K); - console.info("SUB_Softbus_IPC_Ashmem_01500: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01500: ashmem " + ashmem); let result = ashmem.setProtection(3); - console.info("SUB_Softbus_IPC_Ashmem_01500: run setProtectionis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01500: run setProtectionis is " + result); expect(result).assertTrue(); ashmem.closeAshmem() }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_01500: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01500: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_01500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01500---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_01600 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_01600 * @tc.name The writetoashmem interface writes the shared file associated with the object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_01600",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_01600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_01600",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01600---------------------------"); try{ let mapSize = 4096 let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize) - console.info("SUB_Softbus_IPC_Ashmem_01600: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01600: ashmem " + ashmem); let resultMapRAndW = ashmem.mapReadAndWriteAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_01600: run mapReadAndWriteAshmemis2 is " + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01600: run mapReadAndWriteAshmemis2 is " + resultMapRAndW); expect(resultMapRAndW).assertTrue(); let bytes = [1, 2, 3, 4, 5]; let result = ashmem.writeToAshmem(bytes, bytes.length, 0); - console.info("SUB_Softbus_IPC_Ashmem_01600: run writeToAshmemis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01600: run writeToAshmemis is " + result); expect(result).assertTrue(); ashmem.closeAshmem(); }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_01600: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01600: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_01600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01600---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_01700 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_01700 * @tc.name The writetoashmem interface writes the shared file associated with the object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_01700",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_01700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_01700",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01700---------------------------"); try{ let mapSize = 4096 let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize) - console.info("SUB_Softbus_IPC_Ashmem_01700: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01700: ashmem " + ashmem); let resultMapRAndW = ashmem.mapReadAndWriteAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_01700: run mapReadAndWriteAshmemis2 is " + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01700: run mapReadAndWriteAshmemis2 is " + resultMapRAndW); expect(resultMapRAndW).assertTrue(); let bytes = [-2147483648,2147483647]; let result = ashmem.writeToAshmem(bytes, bytes.length, 0); - console.info("SUB_Softbus_IPC_Ashmem_01700: run writeToAshmemis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01700: run writeToAshmemis is " + result); expect(result).assertTrue(); let reresult = ashmem.readFromAshmem(bytes.length,0); - console.info("SUB_Softbus_IPC_Ashmem_01700: run readFromAshmemis is " + reresult); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01700: run readFromAshmemis is " + reresult); assertArrayElementEqual(reresult,bytes); ashmem.closeAshmem(); }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_01700: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01700: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_01700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01700---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_01800 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_01800 * @tc.name The writetoashmem interface writes the shared file associated with the object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_01800",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_01800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_01800",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01800---------------------------"); try{ let mapSize = 4096 let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize) - console.info("SUB_Softbus_IPC_Ashmem_01800: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01800: ashmem " + ashmem); let resultMapRAndW = ashmem.mapReadAndWriteAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_01800: run mapReadAndWriteAshmemis2 is " + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01800: run mapReadAndWriteAshmemis2 is " + resultMapRAndW); expect(resultMapRAndW).assertTrue(); let bytes = [-2147483649,2147483647]; let result = ashmem.writeToAshmem(bytes, bytes.length, 0); - console.info("SUB_Softbus_IPC_Ashmem_01800: run writeToAshmemis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01800: run writeToAshmemis is " + result); expect(result).assertTrue(); let readresult = ashmem.readFromAshmem(bytes.length,0); - console.info("SUB_Softbus_IPC_Ashmem_01800: run readFromAshmemis is " + readresult); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01800: run readFromAshmemis is " + readresult); expect(readresult[0]).assertEqual(2147483647); expect(readresult[1]).assertEqual(bytes[1]); ashmem.closeAshmem(); }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_01800: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01800: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_01800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01800---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_01900 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_01900 * @tc.name The writetoashmem interface writes the shared file associated with the object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_01900",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_01900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_01900",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_01900---------------------------"); try{ let mapSize = 4096 let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize) - console.info("SUB_Softbus_IPC_Ashmem_01900: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01900: ashmem " + ashmem); let resultMapRAndW = ashmem.mapReadAndWriteAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_01900: run mapReadAndWriteAshmemis2 is " + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01900: run mapReadAndWriteAshmemis2 is " + resultMapRAndW); expect(resultMapRAndW).assertTrue(); let bytes = [-2147483648,2147483648]; let result = ashmem.writeToAshmem(bytes, bytes.length, 0); - console.info("SUB_Softbus_IPC_Ashmem_01900: run writeToAshmemis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01900: run writeToAshmemis is " + result); expect(result).assertTrue(); let reresult = ashmem.readFromAshmem(bytes.length,0); - console.info("SUB_Softbus_IPC_Ashmem_01900: run readFromAshmemis is " + reresult); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01900: run readFromAshmemis is " + reresult); expect(reresult[0]).assertEqual(bytes[0]); expect(reresult[1]).assertEqual(-2147483648); ashmem.closeAshmem(); }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_01900: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_01900: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_01900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_01900---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_02000 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_02000 * @tc.name The writetoashmem interface writes the shared file associated with the object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_02000",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_02000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_02000",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02000---------------------------"); try{ let mapSize = 2*M; let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize) - console.info("SUB_Softbus_IPC_Ashmem_02000: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02000: ashmem " + ashmem); let resultMapRAndW = ashmem.mapReadAndWriteAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_02000: run mapReadAndWriteAshmemis2 is " + resultMapRAndW); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02000: run mapReadAndWriteAshmemis2 is " + resultMapRAndW); expect(resultMapRAndW).assertTrue(); let bytes = [0,1]; let result = ashmem.writeToAshmem(bytes, bytes.length, 2147483647); - console.info("SUB_Softbus_IPC_Ashmem_02000: run writeToAshmemis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02000: run writeToAshmemis is " + result); expect(result).assertEqual(false); ashmem.closeAshmem(); }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_02000: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02000: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_02000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02000---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_02100 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_02100 * @tc.name The writetoashmem interface writes the shared file associated with the object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_02100",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_02100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_02100",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02100---------------------------"); try{ let mapSize = 2*M; let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", mapSize) - console.info("SUB_Softbus_IPC_Ashmem_02100: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02100: ashmem " + ashmem); let resultMapRAndW = ashmem.mapReadAndWriteAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_02100: run mapReadAndWriteAshmemis2 is " + resultMapRAndW); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02100: run mapReadAndWriteAshmemis2 is " + resultMapRAndW); expect(resultMapRAndW).assertTrue(); let bytes = [0,1]; let result = ashmem.writeToAshmem(bytes, bytes.length, 2147483648); - console.info("SUB_Softbus_IPC_Ashmem_02100: run writeToAshmemis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02100: run writeToAshmemis is " + result); expect(result).assertTrue(); let readresult1 = ashmem.readFromAshmem(bytes.length,0); - console.info("SUB_Softbus_IPC_Ashmem_02100: run readFromAshmemis is " + readresult1); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02100: run readFromAshmemis is " + readresult1); assertArrayElementEqual(readresult1,bytes); }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_02100: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02100: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_02100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02100---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_02200 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_02200 * @tc.name The writetoashmem interface writes the shared file associated with the object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_02200",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_02200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_02200",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02200---------------------------"); try{ let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096) - console.info("SUB_Softbus_IPC_Ashmem_02200: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02200: ashmem " + ashmem); let resultMapRAndW = ashmem.mapReadAndWriteAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_02200: run mapReadAndWriteAshmemis2 is " + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02200: run mapReadAndWriteAshmemis2 is " + resultMapRAndW); expect(resultMapRAndW).assertTrue(); let bytes = [1, 2, 3, 4, 5]; let result = ashmem.writeToAshmem(bytes, bytes.length, 0); - console.info("SUB_Softbus_IPC_Ashmem_02200: run writeToAshmemis is " +result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02200: run writeToAshmemis is " +result); expect(result).assertTrue(); let resultread = ashmem.setProtection(rpc.Ashmem.PROT_READ); - console.info("SUB_Softbus_IPC_Ashmem_02200: run setProtectionisread is " + resultread); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02200: run setProtectionisread is " + resultread); expect(resultread).assertTrue() let result2 = ashmem.writeToAshmem(bytes, bytes.length, 0); - console.info("SUB_Softbus_IPC_Ashmem_02200: run writeToAshmemis is2 " + result2); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02200: run writeToAshmemis is2 " + result2); expect(result2).assertEqual(false) ashmem.closeAshmem(); }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_02200: error " +error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02200: error " +error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_02200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02200---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_02300 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_02300 * @tc.name Writetoashmem exception validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_02300",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_02300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_02300",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02300---------------------------"); try{ let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096); - console.info("SUB_Softbus_IPC_Ashmem_02300: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02300: ashmem " + ashmem); let resultMapRAndW = ashmem.mapReadAndWriteAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_02300: run mapReadAndWriteAshmemis2 is " + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02300: run mapReadAndWriteAshmemis2 is " + resultMapRAndW); expect(resultMapRAndW).assertTrue(); let bytes = [1, 2, 3, 4, 5]; let size = bytes.length + 10; let result = ashmem.writeToAshmem(bytes, 3, 0); - console.info("SUB_Softbus_IPC_Ashmem_02300: run writeToAshmemis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02300: run writeToAshmemis is " + result); expect(result).assertTrue(); ashmem.closeAshmem() }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_02300: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02300: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_02300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02300---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_02400 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_02400 * @tc.name Read data from the shared file associated with readfromashmem * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_02400",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_02400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_02400",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02400---------------------------"); try{ let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096) - console.info("SUB_Softbus_IPC_Ashmem_02400: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02400: ashmem " + ashmem); let resultMapRAndW = ashmem.mapReadAndWriteAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_02400: run mapReadAndWriteAshmemis2 is " + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02400: run mapReadAndWriteAshmemis2 is " + resultMapRAndW); expect(resultMapRAndW).assertTrue(); let bytes = [1, 2, 3, 4, 5]; let result = ashmem.writeToAshmem(bytes, bytes.length, 0); - console.info("SUB_Softbus_IPC_Ashmem_02400: run writeToAshmemis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02400: run writeToAshmemis is " + result); expect(result).assertTrue(); var resultRead = ashmem.readFromAshmem(bytes.length, 0); - console.info("SUB_Softbus_IPC_Ashmem_02400: run readFromAshmemis is " + resultRead); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02400: run readFromAshmemis is " + resultRead); assertArrayElementEqual(resultRead,bytes); ashmem.closeAshmem() }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_02400: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02400: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_02400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02400---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_02500 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_02500 * @tc.name Readfromashmem exception validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_02500",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_02500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_02500",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02500---------------------------"); try{ let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096); - console.info("SUB_Softbus_IPC_Ashmem_02500: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02500: ashmem " + ashmem); let resultMapRAndW = ashmem.mapReadAndWriteAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_02500: run mapReadAndWriteAshmemis2 is " + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02500: run mapReadAndWriteAshmemis2 is " + resultMapRAndW); expect(resultMapRAndW).assertTrue(); let bytes = [1, 2, 3, 4, 5]; let result = ashmem.writeToAshmem(bytes, bytes.length, 1); - console.info("SUB_Softbus_IPC_Ashmem_02500: run writeToAshmemis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02500: run writeToAshmemis is " + result); expect(result).assertTrue() let result2 = ashmem.readFromAshmem(bytes.length, 3); - console.info("SUB_Softbus_IPC_Ashmem_02500: run readFromAshmemis2 is " + result2); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02500: run readFromAshmemis2 is " + result2); expect(bytes[2]).assertEqual(result2[0]); expect(bytes[3]).assertEqual(result2[1]); expect(bytes[4]).assertEqual(result2[2]); ashmem.closeAshmem() }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_02500: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02500: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_02500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02500---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_02600 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_02600 * @tc.name Createashmemfromexisting copies the ashmem object description and creates a new object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_02600",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_02600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_02600",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02600---------------------------"); try{ let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", 4096) - console.info("SUB_Softbus_IPC_Ashmem_02600: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02600: ashmem " + ashmem); let resultWriteAndRead = ashmem.mapReadAndWriteAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_02600: run mapReadAndWriteAshmem result " + resultWriteAndRead); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02600: run mapReadAndWriteAshmem result " + resultWriteAndRead); expect(resultWriteAndRead).assertTrue(); let bytes = [1, 2, 3]; let result = ashmem.writeToAshmem(bytes, bytes.length, 1); - console.info("SUB_Softbus_IPC_Ashmem_02600: run writeToAshmemis " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02600: run writeToAshmemis " + result); expect(result).assertTrue() let newashmem = rpc.Ashmem.createAshmemFromExisting(ashmem); let resultWriteAndRead2 = newashmem.mapReadAndWriteAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_02600: run mapReadAndWriteAshmem result " + resultWriteAndRead2); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02600: run mapReadAndWriteAshmem result " + resultWriteAndRead2); expect(resultWriteAndRead2).assertTrue(); let result2 = newashmem.readFromAshmem(bytes.length, 1); - console.info("SUB_Softbus_IPC_Ashmem_02600: run readFromAshmemis2 is " + result2); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02600: run readFromAshmemis2 is " + result2); expect(result).assertTrue(); assertArrayElementEqual(result2,bytes); ashmem.closeAshmem(); newashmem.closeAshmem(); }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_02600: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02600: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_02600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02600---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_02700 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_02700 * @tc.name Create a shared memory object and call writeashmem to write the shared anonymous object into the messageparcel object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_02700",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_02700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_02700",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02700---------------------------"); try{ let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K); let data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_Ashmem_02700: ashmem " + ashmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02700: ashmem " + ashmem); let resultMapRAndW = ashmem.mapReadAndWriteAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_02700: run mapReadAndWriteAshmem result is " + resultMapRAndW); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02700: run mapReadAndWriteAshmem result is " + resultMapRAndW); expect(resultMapRAndW).assertTrue(); let bytes = [1, 2, 3]; let result = ashmem.writeToAshmem(bytes, bytes.length, 1); - console.info("SUB_Softbus_IPC_Ashmem_02700: run writeToAshmemis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02700: run writeToAshmemis is " + result); expect(result).assertTrue() let result2 = data.writeAshmem(ashmem) - console.info("SUB_Softbus_IPC_Ashmem_02700: run writeAshmemis is " + result2); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02700: run writeAshmemis is " + result2); expect(result2).assertTrue(); let retReadAshmem = data.readAshmem(); - console.info("SUB_Softbus_IPC_Ashmem_02700: run readAshmem is " + retReadAshmem); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02700: run readAshmem is " + retReadAshmem); let retBytes = retReadAshmem.readFromAshmem(bytes.length, 1); - console.info("SUB_Softbus_IPC_Ashmem_02700: run readFromAshmem result is " + retBytes); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02700: run readFromAshmem result is " + retBytes); ashmem.closeAshmem(); data.reclaim(); }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_02700: error " +error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02700: error " +error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_02700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02700---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_02800 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_02800 * @tc.name Create a non shared memory object and call writeashmem to write the messageparcel object object into the messageparcel object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_02800",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_02800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_02800",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02800---------------------------"); try{ let data = rpc.MessageParcel.create(); let data2 = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_Ashmem_02800: create MessageParcel object success"); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02800: create MessageParcel object success"); let result = data.writeAshmem(data2); - console.info("SUB_Softbus_IPC_Ashmem_02800: run writeAshmemis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02800: run writeAshmemis is " + result); data.reclaim(); data2.reclaim(); }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_02800: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02800: error " + error); expect(error != null).assertTrue(); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_02800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02800---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_Ashmem_02900 + * @tc.number SUB_Softbus_IPC_Compatibility_Ashmem_02900 * @tc.name Create a non shared memory object and call writeashmem to write the messageparcel object object into the messageparcel object * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_Ashmem_02900",0,function(){ - console.info("---------------------start SUB_Softbus_IPC_Ashmem_02900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_Ashmem_02900",0,function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_Ashmem_02900---------------------------"); try{ let ashmem = rpc.Ashmem.createAshmem("JsAshmemTest", K); let resultwrite = ashmem.setProtection(rpc.Ashmem.PROT_EXEC) - console.info("SUB_Softbus_IPC_Ashmem_02900: run setProtectioniswrite is " + resultwrite); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02900: run setProtectioniswrite is " + resultwrite); expect(resultwrite).assertTrue(); ashmem.closeAshmem() }catch(error){ - console.info("SUB_Softbus_IPC_Ashmem_02900: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_Ashmem_02900: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_Ashmem_02900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_Ashmem_02900---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_IRemoteObject_00100 + * @tc.number SUB_Softbus_IPC_Compatibility_IRemoteObject_00100 * @tc.name Call sendrequestresult interface to send data * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_IRemoteObject_00100",0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_IRemoteObject_00100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IRemoteObject_00100",0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IRemoteObject_00100---------------------------"); try{ let data = rpc.MessageParcel.create(); let reply = rpc.MessageParcel.create(); let option = new rpc.MessageOption(); let sequenceable = new MySequenceable(1, "aaa"); let result = data.writeSequenceable(sequenceable); - console.info("SUB_Softbus_IPC_IRemoteObject_00100: run writeSequenceableis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00100: run writeSequenceableis is " + result); await gIRemoteObject.sendRequest(CODE_WRITESEQUENCEABLE, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_IRemoteObject_00100: sendRequestis is " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00100: sendRequestis is " + result.errCode); expect(result.errCode == 0).assertTrue(); let ret = new MySequenceable(0, ""); var shortArryDataReply = result.reply.readSequenceable(ret); - console.info("SUB_Softbus_IPC_IRemoteObject_00100: run readSequenceable is " + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00100: run readSequenceable is " + shortArryDataReply); expect(shortArryDataReply == true).assertTrue() expect(ret.num).assertEqual(1) @@ -7027,23 +7248,23 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); }catch(error){ - console.info("SUB_Softbus_IPC_IRemoteObject_00100: error " + error); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00100: error " + error); } - console.info("---------------------end SUB_Softbus_IPC_IRemoteObject_00100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_00100---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_IRemoteObject_00200 + * @tc.number SUB_Softbus_IPC_Compatibility_IRemoteObject_00200 * @tc.name Test that messageparcel passes through the same process, and the client * receives the reply message in promise * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_IRemoteObject_00200", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_IRemoteObject_00200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IRemoteObject_00200", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IRemoteObject_00200---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_IRemoteObject_00200: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00200: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); expect(data.writeByte(1)).assertTrue() @@ -7058,7 +7279,7 @@ describe('ActsRpcClientJsTest', function(){ expect(data.writeSequenceable(new MySequenceable(1, "aaa"))).assertTrue() await gIRemoteObject.sendRequest(CODE_ALL_TYPE, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_IRemoteObject_00200: sendRequest done, error code: " + result.errCode); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00200: sendRequest done, error code: " + result.errCode); expect(result.errCode).assertEqual(0) expect(result.reply.readByte()).assertEqual(1) expect(result.reply.readShort()).assertEqual(2) @@ -7078,419 +7299,530 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_IRemoteObject_00200:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00200:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_IRemoteObject_00200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_00200---------------------------"); done(); }); /* - * @tc.number SUB_Softbus_IPC_IRemoteObject_00300 + * @tc.number SUB_Softbus_IPC_Compatibility_IRemoteObject_00300 * @tc.name Test that messageparcel passes through the same process, and the client * receives the reply message in the callback function * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_IRemoteObject_00300", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_IRemoteObject_00300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IRemoteObject_00300", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IRemoteObject_00300---------------------------"); try{ var data = rpc.MessageParcel.create(); - console.info("SUB_Softbus_IPC_IRemoteObject_00300: create object successfully."); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00300: create object successfully."); var reply = rpc.MessageParcel.create(); var option = new rpc.MessageOption(); - expect(data.writeByte(1)).assertTrue() - expect(data.writeShort(2)).assertTrue() - expect(data.writeInt(3)).assertTrue() - expect(data.writeLong(10000)).assertTrue() + expect(data.writeByte(2)).assertTrue() + expect(data.writeShort(3)).assertTrue() + expect(data.writeInt(4)).assertTrue() + expect(data.writeLong(5)).assertTrue() expect(data.writeFloat(1.2)).assertTrue() expect(data.writeDouble(10.2)).assertTrue() expect(data.writeBoolean(true)).assertTrue() - expect(data.writeChar(10)).assertTrue() + expect(data.writeChar(5)).assertTrue() expect(data.writeString("HelloWorld")).assertTrue() expect(data.writeSequenceable(new MySequenceable(1, "aaa"))).assertTrue() - const CODE_IREMOTEOBJECT_0200 = 21; - await gIRemoteObject.sendRequest(CODE_ALL_TYPE, data, reply, option, (err, result) => { - console.info("SUB_Softbus_IPC_IRemoteObject_00300:sendRequest done, error code: " + result.errCode) - expect(result.errCode).assertEqual(0) - expect(result.reply.readByte()).assertEqual(1) - expect(result.reply.readShort()).assertEqual(2) - expect(result.reply.readInt()).assertEqual(3) - expect(result.reply.readLong()).assertEqual(10000) - expect(result.reply.readFloat()).assertEqual(1.2) - expect(result.reply.readDouble()).assertEqual(10.2) - expect(result.reply.readBoolean()).assertTrue() - expect(result.reply.readChar()).assertEqual(10) - expect(result.reply.readString()).assertEqual("HelloWorld") - let s = new MySequenceable(0, '') - expect(result.reply.readSequenceable(s)).assertTrue() - expect(s.num).assertEqual(1) - expect(s.str).assertEqual("aaa") - }); - data.reclaim(); - reply.reclaim(); - done(); + function sendRequestCallback(result) { + try{ + console.info("sendRequest Callback") + console.info("sendRequest done, error code: " + result.errCode) + expect(result.errCode).assertEqual(0) + expect(result.reply.readByte()).assertEqual(2) + expect(result.reply.readShort()).assertEqual(3) + expect(result.reply.readInt()).assertEqual(4) + expect(result.reply.readLong()).assertEqual(5) + expect(result.reply.readFloat()).assertEqual(1.2) + expect(result.reply.readDouble()).assertEqual(10.2) + expect(result.reply.readBoolean()).assertTrue() + expect(result.reply.readChar()).assertEqual(5) + expect(result.reply.readString()).assertEqual("HelloWorld") + let s = new MySequenceable(null, null) + expect(result.reply.readSequenceable(s)).assertTrue() + expect(s.num).assertEqual(1) + expect(s.str).assertEqual("aaa") + } finally { + result.data.reclaim(); + result.reply.reclaim(); + console.info("test done") + done() + } + } + + console.info("start send request") + await gIRemoteObject.sendRequest(CODE_ALL_TYPE, data, reply, option, sendRequestCallback) + } catch (error) { - console.info("SUB_Softbus_IPC_IRemoteObject_00300:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00300:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_IRemoteObject_00300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_00300---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_IRemoteObject_00400 + * @tc.number SUB_Softbus_IPC_Compatibility_IRemoteObject_00400 * @tc.name Iremoteobject, register death notification verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_IRemoteObject_00400", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_IRemoteObject_00400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IRemoteObject_00400", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IRemoteObject_00400---------------------------"); try{ let object = new TestAbilityStub("Test1") var resultAdd1 = object.addDeathRecipient(null, 0) - console.info("SUB_Softbus_IPC_IRemoteObject_00400:run addDeathRecipient first result is" + resultAdd1); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00400:run addDeathRecipient first result is" + resultAdd1); expect(resultAdd1 == false).assertTrue(); var resultRemove1 = object.removeDeathRecipient(null, 0) - console.info("SUB_Softbus_IPC_IRemoteObject_00400:run removeDeathRecipient1 result is" + resultRemove1); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00400:run removeDeathRecipient1 result is" + resultRemove1); expect(resultRemove1 == false).assertTrue(); let isDead = object.isObjectDead() - console.info("SUB_Softbus_IPC_IRemoteObject_00400:run isDead result is " + isDead); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00400:run isDead result is " + isDead); expect(isDead == false).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_IRemoteObject_00400:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00400:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_IRemoteObject_00400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_00400---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_IRemoteObject_00500 + * @tc.number SUB_Softbus_IPC_Compatibility_IRemoteObject_00500 * @tc.name Do not get the server agent, do not create a remoteobject instance, and directly getcallingpid, * getcallingpid, getcallingdeviceid, getlocaldeviceid * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_IRemoteObject_00500", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_IRemoteObject_00500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IRemoteObject_00500", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IRemoteObject_00500---------------------------"); try{ let callingPid = rpc.IPCSkeleton.getCallingPid() - console.info("SUB_Softbus_IPC_IRemoteObject_00500: run getCallingPid success, callingPid " + callingPid); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00500: run getCallingPid success, callingPid " + callingPid); expect(callingPid != null).assertTrue(); let callingUid = rpc.IPCSkeleton.getCallingUid() - console.info("SUB_Softbus_IPC_IRemoteObject_00500: run getCallingPid success, callingPid " + callingUid); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00500: run getCallingPid success, callingPid " + callingUid); expect(callingUid != null).assertTrue(); let callingDeviceID = rpc.IPCSkeleton.getCallingDeviceID() - console.info("SUB_Softbus_IPC_IRemoteObject_00500: run getCallingDeviceID success, callingDeviceID is " + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00500: run getCallingDeviceID success, callingDeviceID is " + callingDeviceID); expect(callingDeviceID == "").assertTrue(); let localDeviceID = rpc.IPCSkeleton.getLocalDeviceID() - console.info("SUB_Softbus_IPC_IRemoteObject_00500: run getLocalDeviceID success, localDeviceID is " + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00500: run getLocalDeviceID success, localDeviceID is " + localDeviceID); expect(localDeviceID == "").assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_IRemoteObject_00500:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00500:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_IRemoteObject_00500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_00500---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_IRemoteObject_00600 + * @tc.number SUB_Softbus_IPC_Compatibility_IRemoteObject_00600 * @tc.name Querylocalinterface searches for objects based on descriptors * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_IRemoteObject_00600", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_IRemoteObject_00600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IRemoteObject_00600", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IRemoteObject_00600---------------------------"); try{ let object = new TestAbilityStub("Test1"); - console.info("SUB_Softbus_IPC_IRemoteObject_00600: run TestAbilityStub success"); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00600: run TestAbilityStub success"); let result = object.isObjectDead() - console.info("SUB_Softbus_IPC_IRemoteObject_00600: run isObjectDeadis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00600: run isObjectDeadis is " + result); expect(result == false).assertTrue() let callingPid = object.getCallingPid() - console.info("SUB_Softbus_IPC_IRemoteObject_00600: run getCallingPid success,callingPid " + callingPid); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00600: run getCallingPid success,callingPid " + callingPid); let callingUid = object.getCallingUid() - console.info("SUB_Softbus_IPC_IRemoteObject_00600: run getCallingPid success,callingPid " + callingUid); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00600: run getCallingPid success,callingPid " + callingUid); object.attachLocalInterface(object, "Test1") - console.info("SUB_Softbus_IPC_IRemoteObject_00600: run attachLocalInterface success"); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00600: run attachLocalInterface success"); let res = object.queryLocalInterface("Test1") - console.info("SUB_Softbus_IPC_IRemoteObject_00600: run queryLocalInterface success, res2 is " + res); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00600: run queryLocalInterface success, res2 is " + res); } catch (error) { - console.info("SUB_Softbus_IPC_IRemoteObject_00600:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00600:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_IRemoteObject_00600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_00600---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_IRemoteObject_00700 + * @tc.number SUB_Softbus_IPC_Compatibility_IRemoteObject_00700 * @tc.name Getinterfacedescriptor to get the interface description * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_IRemoteObject_00700", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_IRemoteObject_00700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IRemoteObject_00700", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IRemoteObject_00700---------------------------"); try{ let object = new TestAbilityStub("Test1223"); let result = object.isObjectDead() - console.info("SUB_Softbus_IPC_IRemoteObject_00700: run isObjectDeadis is " + result); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00700: run isObjectDeadis is " + result); expect(result == false).assertTrue() let callingPid = object.getCallingPid() - console.info("SUB_Softbus_IPC_IRemoteObject_00700: run getCallingPid success,callingPid " + callingPid); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00700: run getCallingPid success,callingPid " + callingPid); let callingUid = object.getCallingUid() - console.info("SUB_Softbus_IPC_IRemoteObject_00700: run getCallingPid success,callingPid " + callingUid); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00700: run getCallingPid success,callingPid " + callingUid); object.attachLocalInterface(object, "test1") - console.info("SUB_Softbus_IPC_IRemoteObject_00700: run attachLocalInterface success"); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00700: run attachLocalInterface success"); let result2 = object.getInterfaceDescriptor(); - console.info("SUB_Softbus_IPC_IRemoteObject_00700: run getInterfaceDescriptoris2 is " + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00700: run getInterfaceDescriptoris2 is " + result2); expect(result2 == "test1").assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_IRemoteObject_00700:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00700:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_IRemoteObject_00700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_00700---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_RemoteProxy_00100 + * @tc.number SUB_Softbus_IPC_Compatibility_IRemoteObject_00800 + * @tc.name Test that messageparcel passes through the same process, and the client + * receives the reply message in the callback function + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_Compatibility_IRemoteObject_00800", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IRemoteObject_00800---------------------------"); + try{ + let object = new TestAbilityStub("TestAbilityStub") + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00800: create object successfully."); + var reply = rpc.MessageParcel.create(); + var option = new rpc.MessageOption(); + expect(data.writeInterfaceToken("TestAbilityStub")).assertTrue() + expect(data.writeByte(2)).assertTrue() + expect(data.writeShort(3)).assertTrue() + expect(data.writeInt(4)).assertTrue() + expect(data.writeLong(5)).assertTrue() + expect(data.writeFloat(1.2)).assertTrue() + expect(data.writeDouble(10.2)).assertTrue() + expect(data.writeBoolean(true)).assertTrue() + expect(data.writeChar(5)).assertTrue() + expect(data.writeString("HelloWorld")).assertTrue() + expect(data.writeSequenceable(new MySequenceable(1, "aaa"))).assertTrue() + + function sendRequestCallback(result) { + try{ + console.info("sendRequest Callback") + console.info("sendRequest done, error code: " + result.errCode) + expect(result.errCode).assertEqual(0) + result.reply.readException() + expect(result.reply.readByte()).assertEqual(2) + expect(result.reply.readShort()).assertEqual(3) + expect(result.reply.readInt()).assertEqual(4) + expect(result.reply.readLong()).assertEqual(5) + expect(result.reply.readFloat()).assertEqual(1.2) + expect(result.reply.readDouble()).assertEqual(10.2) + expect(result.reply.readBoolean()).assertTrue() + expect(result.reply.readChar()).assertEqual(5) + expect(result.reply.readString()).assertEqual("HelloWorld") + let s = new MySequenceable(null, null) + expect(result.reply.readSequenceable(s)).assertTrue() + expect(s.num).assertEqual(1) + expect(s.str).assertEqual("aaa") + } finally { + result.data.reclaim(); + result.reply.reclaim(); + console.info("test done") + done() + } + } + + console.info("start send request") + object.sendRequest(CODE_SAME_PROCESS, data, reply, option, sendRequestCallback) + + } catch (error) { + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00800:error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_00800---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_Compatibility_IRemoteObject_00900 + * @tc.name IRemoteObject sendRequestAsync API Test + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_Compatibility_IRemoteObject_00900", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IRemoteObject_00900---------------------------"); + try{ + var data = rpc.MessageParcel.create(); + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00900: create object successfully."); + var reply = rpc.MessageParcel.create(); + var option = new rpc.MessageOption(); + expect(data.writeByte(1)).assertTrue() + expect(data.writeShort(2)).assertTrue() + expect(data.writeInt(3)).assertTrue() + expect(data.writeLong(10000)).assertTrue() + expect(data.writeFloat(1.2)).assertTrue() + expect(data.writeDouble(10.2)).assertTrue() + expect(data.writeBoolean(true)).assertTrue() + expect(data.writeChar(96)).assertTrue() + expect(data.writeString("HelloWorld")).assertTrue() + expect(data.writeSequenceable(new MySequenceable(1, "aaa"))).assertTrue() + + await gIRemoteObject.sendRequestAsync(CODE_ALL_TYPE, data, reply, option, (err, result) => { + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00900:sendRequest done, error code: " + result.errCode) + expect(result.errCode).assertEqual(0) + expect(result.reply.readByte()).assertEqual(1) + expect(result.reply.readShort()).assertEqual(2) + expect(result.reply.readInt()).assertEqual(3) + expect(result.reply.readLong()).assertEqual(10000) + expect(result.reply.readFloat()).assertEqual(1.2) + expect(result.reply.readDouble()).assertEqual(10.2) + expect(result.reply.readBoolean()).assertTrue() + expect(result.reply.readChar()).assertEqual(96) + expect(result.reply.readString()).assertEqual("HelloWorld") + let s = new MySequenceable(0, '') + expect(result.reply.readSequenceable(s)).assertTrue() + expect(s.num).assertEqual(1) + expect(s.str).assertEqual("aaa") + }); + } catch (error) { + console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00900:error = " + error); + } + data.reclaim(); + reply.reclaim(); + done(); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IRemoteObject_00900---------------------------"); + }); + + + /* + * @tc.number SUB_Softbus_IPC_Compatibility_RemoteProxy_00100 * @tc.name Call adddeathrecipient to register the death notification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_RemoteProxy_00100", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_RemoteProxy_00100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_RemoteProxy_00100", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_RemoteProxy_00100---------------------------"); try{ let recipient = new MyDeathRecipient(gIRemoteObject, null) var resultAdd1 = gIRemoteObject.addDeathRecipient(recipient, 0) - console.info("SUB_Softbus_IPC_RemoteProxy_00100:run addDeathRecipient first is " + resultAdd1); expect(resultAdd1 == true).assertTrue(); - var resultAdd2 = gIRemoteObject.addDeathRecipient(recipient, 0) - console.info("SUB_Softbus_IPC_RemoteProxy_00100:run addDeathRecipient second is " + resultAdd2); expect(resultAdd2 == true).assertTrue(); - var resultRemove1 = gIRemoteObject.removeDeathRecipient(recipient, 0) - console.info("SUB_Softbus_IPC_RemoteProxy_00100:run removeDeathRecipient1 is " + resultRemove1); expect(resultRemove1 == true).assertTrue(); var resultRemove2 = gIRemoteObject.removeDeathRecipient(recipient, 0) - console.info("SUB_Softbus_IPC_RemoteProxy_00100:run removeDeathRecipient2 is " + resultRemove2); expect(resultRemove2 == true).assertTrue(); var resultRemove3 = gIRemoteObject.removeDeathRecipient(recipient, 0) - console.info("SUB_Softbus_IPC_RemoteProxy_00100:run removeDeathRecipient3 is " + resultRemove3); expect(resultRemove3 == false).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_RemoteProxy_00100:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00100:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_RemoteProxy_00100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_00100---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_RemoteProxy_00200 + * @tc.number SUB_Softbus_IPC_Compatibility_RemoteProxy_00200 * @tc.name AddDeathRecipient Validates the interface flags input parameter boundary value * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_RemoteProxy_00200", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_RemoteProxy_00200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_RemoteProxy_00200", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_RemoteProxy_00200---------------------------"); try{ let recipient = new MyDeathRecipient(gIRemoteObject, null); var resultAdd = gIRemoteObject.addDeathRecipient(recipient, -(2*G)); - console.info("SUB_Softbus_IPC_RemoteProxy_00200:run addDeathRecipient first is " + resultAdd); expect(resultAdd).assertTrue(); var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, -(2*G)); - console.info("SUB_Softbus_IPC_RemoteProxy_00200:run removeDeathRecipient1 is " + resultRemove); expect(resultRemove).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_RemoteProxy_00200:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00200:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_RemoteProxy_00200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_00200---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_RemoteProxy_00300 + * @tc.number SUB_Softbus_IPC_Compatibility_RemoteProxy_00300 * @tc.name AddDeathRecipient Validates the interface flags input parameter boundary value * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_RemoteProxy_00300", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_RemoteProxy_00300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_RemoteProxy_00300", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_RemoteProxy_00300---------------------------"); try{ let recipient = new MyDeathRecipient(gIRemoteObject, null); var resultAdd = gIRemoteObject.addDeathRecipient(recipient, (2*G - 1)); - console.info("SUB_Softbus_IPC_RemoteProxy_00300:run addDeathRecipient first is " + resultAdd); expect(resultAdd).assertTrue(); var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, (2*G - 1)); - console.info("SUB_Softbus_IPC_RemoteProxy_00300:run removeDeathRecipient1 is " + resultRemove); expect(resultRemove).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_RemoteProxy_00300:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00300:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_RemoteProxy_00300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_00300---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_RemoteProxy_00400 + * @tc.number SUB_Softbus_IPC_Compatibility_RemoteProxy_00400 * @tc.name AddDeathRecipient Validates the interface flags input parameter boundary value * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_RemoteProxy_00400", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_RemoteProxy_00400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_RemoteProxy_00400", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_RemoteProxy_00400---------------------------"); try{ let recipient = new MyDeathRecipient(gIRemoteObject, null); var resultAdd = gIRemoteObject.addDeathRecipient(recipient, 2*G); - console.info("SUB_Softbus_IPC_RemoteProxy_00400:run addDeathRecipient first is " + resultAdd); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00400:run addDeathRecipient first is " + resultAdd); expect(resultAdd).assertTrue(); var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, 2*G); - console.info("SUB_Softbus_IPC_RemoteProxy_00400:run removeDeathRecipient1 is " + resultRemove); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00400:run removeDeathRecipient1 is " + resultRemove); expect(resultRemove).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_RemoteProxy_00400:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00400:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_RemoteProxy_00400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_00400---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_RemoteProxy_00500 + * @tc.number sendfile/trans_file_func_test.cppRemoteProxy_00500 * @tc.name AddDeathRecipient Validates the interface flags input parameter boundary value * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_RemoteProxy_00500", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_RemoteProxy_00500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_RemoteProxy_00500", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_RemoteProxy_00500---------------------------"); try{ let recipient = new MyDeathRecipient(gIRemoteObject, null); var resultAdd = gIRemoteObject.addDeathRecipient(recipient, -(2*G + 1)); - console.info("SUB_Softbus_IPC_RemoteProxy_00500:run addDeathRecipient first is " + resultAdd); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00500:run addDeathRecipient first is " + resultAdd); expect(resultAdd).assertTrue(); var resultRemove = gIRemoteObject.removeDeathRecipient(recipient, -(2*G + 1)); - console.info("SUB_Softbus_IPC_RemoteProxy_00500:run removeDeathRecipient1 is " + resultRemove); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00500:run removeDeathRecipient1 is " + resultRemove); expect(resultRemove).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_RemoteProxy_00500:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00500:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_RemoteProxy_00500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_00500---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_RemoteProxy_00600 + * @tc.number SUB_Softbus_IPC_Compatibility_RemoteProxy_00600 * @tc.name Call isobjectdead to check whether the object is dead * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_RemoteProxy_00600", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_RemoteProxy_00600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_RemoteProxy_00600---------------------------"); try{ let recipient = new MyDeathRecipient(gIRemoteObject, null) var isDead = gIRemoteObject.isObjectDead(); - console.info("SUB_Softbus_IPC_RemoteProxy_00600: run isObjectDead result is " + isDead); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600: run isObjectDead result is " + isDead); expect(isDead == false).assertTrue(); var resultAdd1 = gIRemoteObject.addDeathRecipient(recipient, 0) - console.info("SUB_Softbus_IPC_RemoteProxy_00600:run addDeathRecipient first result is " + resultAdd1); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600:run addDeathRecipient first result is " + resultAdd1); expect(resultAdd1 == true).assertTrue(); var isDead1 = gIRemoteObject.isObjectDead(); - console.info("SUB_Softbus_IPC_RemoteProxy_00600: run isObjectDead result is " + isDead1); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600: run isObjectDead result is " + isDead1); expect(isDead1 == false).assertTrue(); var resultRemove1 = gIRemoteObject.removeDeathRecipient(recipient, 0) - console.info("SUB_Softbus_IPC_RemoteProxy_00600:run removeDeathRecipient result is " + resultRemove1); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600:run removeDeathRecipient result is " + resultRemove1); expect(resultRemove1 == true).assertTrue(); var resultAdd2 = gIRemoteObject.addDeathRecipient(recipient, 0) - console.info("SUB_Softbus_IPC_RemoteProxy_00600:run addDeathRecipient second result is " + resultAdd2); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600:run addDeathRecipient second result is " + resultAdd2); expect(resultAdd2 == true).assertTrue(); var resultRemove2 = gIRemoteObject.removeDeathRecipient(recipient, 0) - console.info("SUB_Softbus_IPC_RemoteProxy_00600:run removeDeathRecipient1 result is " + resultRemove2); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600:run removeDeathRecipient1 result is " + resultRemove2); expect(resultRemove2 == true).assertTrue(); var resultRemove3 = gIRemoteObject.removeDeathRecipient(recipient, 0) - console.info("SUB_Softbus_IPC_RemoteProxy_00600:run removeDeathRecipient3 result is " + resultRemove3); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600:run removeDeathRecipient3 result is " + resultRemove3); expect(resultRemove3 == false).assertTrue(); var isDead2 = gIRemoteObject.isObjectDead(); - console.info("SUB_Softbus_IPC_RemoteProxy_00600: run isObjectDead2 result is " + isDead2); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600: run isObjectDead2 result is " + isDead2); expect(isDead2 == false).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_RemoteProxy_00600:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00600:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_RemoteProxy_00600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_00600---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_RemoteProxy_00700 + * @tc.number SUB_Softbus_IPC_Compatibility_RemoteProxy_00700 * @tc.name Getinterfacedescriptor to get the object interface description * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_RemoteProxy_00700", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_RemoteProxy_00700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_RemoteProxy_00700", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_RemoteProxy_00700---------------------------"); try{ let object = new TestAbilityStub("Test0300"); let result = object.getInterfaceDescriptor() - console.info("SUB_Softbus_IPC_RemoteProxy_00700: run getInterfaceDescriptor result is " + result); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00700: run getInterfaceDescriptor result is " + result); expect(result).assertEqual("Test0300"); } catch (error) { - console.info("SUB_Softbus_IPC_RemoteProxy_00700:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00700:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_RemoteProxy_00700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_00700---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_RemoteProxy_00800 + * @tc.number SUB_Softbus_IPC_Compatibility_RemoteProxy_00800 * @tc.name Querylocalinterface searches for objects based on descriptors * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_RemoteProxy_00800", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_RemoteProxy_00800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_RemoteProxy_00800", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_RemoteProxy_00800---------------------------"); try{ let object = new TestAbilityStub("Test0400"); let result = object.isObjectDead(); - console.info("SUB_Softbus_IPC_RemoteProxy_00800: run getInterfaceDescriptor is " + result); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00800: run getInterfaceDescriptor is " + result); expect(result).assertEqual(false); object.attachLocalInterface(object, "Test2"); - console.info("SUB_Softbus_IPC_RemoteProxy_00800: run attachLocalInterface success"); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00800: run attachLocalInterface success"); let res2 = object.queryLocalInterface('Test2'); - console.info("SUB_Softbus_IPC_RemoteProxy_00800: run queryLocalInterface success, res2 is " + res2); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00800: run queryLocalInterface success, res2 is " + res2); let resultDescrip = object.getInterfaceDescriptor() - console.info("SUB_Softbus_IPC_RemoteProxy_00800: run getInterfaceDescriptor success resultDescrip is " + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00800: run getInterfaceDescriptor success resultDescrip is " + resultDescrip); expect(resultDescrip).assertEqual("Test2"); } catch (error) { - console.info("SUB_Softbus_IPC_RemoteProxy_00800:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00800:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_RemoteProxy_00800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_00800---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_RemoteProxy_00900 + * @tc.number SUB_Softbus_IPC_Compatibility_RemoteProxy_00900 * @tc.name Transaction constant validation * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_RemoteProxy_00900", 0, async function(){ - console.info("SUB_Softbus_IPC_RemoteProxy_00900 is starting-------------") + it("SUB_Softbus_IPC_Compatibility_RemoteProxy_00900", 0, async function(){ + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00900 is starting-------------") try { expect(rpc.RemoteProxy.PING_TRANSACTION).assertEqual(1599098439); expect(rpc.RemoteProxy.DUMP_TRANSACTION).assertEqual(1598311760); @@ -7498,165 +7830,165 @@ describe('ActsRpcClientJsTest', function(){ expect(rpc.RemoteProxy.MIN_TRANSACTION_ID).assertEqual(0x1); expect(rpc.RemoteProxy.MAX_TRANSACTION_ID).assertEqual(0x00FFFFFF); } catch (error) { - console.info("SUB_Softbus_IPC_RemoteProxy_00900 error is" + error); + console.info("SUB_Softbus_IPC_Compatibility_RemoteProxy_00900 error is" + error); } - console.info("---------------------end SUB_Softbus_IPC_RemoteProxy_00900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_RemoteProxy_00900---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_IPCSkeleton_00100 + * @tc.number SUB_Softbus_IPC_Compatibility_IPCSkeleton_00100 * @tc.name Create an empty object and verify the function of the flushcommands interface * @tc.desc Function test * @tc.level 0 */ - it('SUB_Softbus_IPC_IPCSkeleton_00100', 0, async function() { - console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_00100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00100", 0, async function() { + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_00100---------------------------"); try { - console.info("SUB_Softbus_IPC_IPCSkeleton_00100") + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00100") let remoteObject = new TestRemoteObject("aaa"); let ret = rpc.IPCSkeleton.flushCommands(remoteObject); - console.info("SUB_Softbus_IPC_IPCSkeleton_00100 RpcServer: flushCommands result: " + ret); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00100 RpcServer: flushCommands result: " + ret); expect(ret != null).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_IPCSkeleton_00100 error is :" + error) + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00100 error is :" + error) } - console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_00100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_00100---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_IPCSkeleton_00200 + * @tc.number SUB_Softbus_IPC_Compatibility_IPCSkeleton_00200 * @tc.name Create an empty object and verify the function of the flushcommands interface * @tc.desc Function test * @tc.level 0 */ - it('SUB_Softbus_IPC_IPCSkeleton_00200', 0, async function() { - console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_00200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00200", 0, async function() { + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_00200---------------------------"); try { - console.info("SUB_Softbus_IPC_IPCSkeleton_00200 testcase") + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00200 testcase") let remoteObject = {}; let ret = rpc.IPCSkeleton.flushCommands(remoteObject); - console.info("SUB_Softbus_IPC_IPCSkeleton_00200 RpcServer: flushCommands result: " + ret); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00200 RpcServer: flushCommands result: " + ret); expect(ret != null).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_IPCSkeleton_00200 error is :" + error) + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00200 error is :" + error) } - console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_00200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_00200---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_IPCSkeleton_00300 + * @tc.number SUB_Softbus_IPC_Compatibility_IPCSkeleton_00300 * @tc.name Create an empty object and verify the function of the flushcommands interface * @tc.desc Function test * @tc.level 0 */ - it('SUB_Softbus_IPC_IPCSkeleton_00300', 0, async function() { - console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_00300---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00300", 0, async function() { + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_00300---------------------------"); try { - console.info("SUB_Softbus_IPC_IPCSkeleton_00300 testcase") + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00300 testcase") let samgr = rpc.IPCSkeleton.getContextObject(); - console.info("SUB_Softbus_IPC_IPCSkeleton_00300 getContextObject result: " + samgr); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00300 getContextObject result: " + samgr); expect(samgr != null).assertTrue(); let geinde = samgr.getInterfaceDescriptor(); - console.info("SUB_Softbus_IPC_IPCSkeleton_00300 getInterfaceDescriptor result: " + geinde); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00300 getInterfaceDescriptor result: " + geinde); expect(geinde).assertEqual(""); } catch (error) { - console.info("SUB_Softbus_IPC_IPCSkeleton_00300 error is :" + error) + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00300 error is :" + error) } - console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_00300---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_00300---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_IPCSkeleton_00400 + * @tc.number SUB_Softbus_IPC_Compatibility_IPCSkeleton_00400 * @tc.name Create an empty object and verify the function of the flushcommands interface * @tc.desc Function test * @tc.level 0 */ - it('SUB_Softbus_IPC_IPCSkeleton_00400', 0, async function() { - console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_00400---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00400", 0, async function() { + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_00400---------------------------"); try { - console.info("SUB_Softbus_IPC_IPCSkeleton_00400 testcase") + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00400 testcase") let getCallingPid = rpc.IPCSkeleton.getCallingPid(); - console.info("SUB_Softbus_IPC_IPCSkeleton_00400 getCallingPid result: " + getCallingPid); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00400 getCallingPid result: " + getCallingPid); expect(getCallingPid != null).assertTrue(); let getCallingUid = rpc.IPCSkeleton.getCallingUid(); - console.info("SUB_Softbus_IPC_IPCSkeleton_00400 getCallingUid result: " + getCallingUid); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00400 getCallingUid result: " + getCallingUid); expect(getCallingUid != null).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_IPCSkeleton_00400 error is :" + error) + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00400 error is :" + error) } - console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_00400---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_00400---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_IPCSkeleton_00500 + * @tc.number SUB_Softbus_IPC_Compatibility_IPCSkeleton_00500 * @tc.name Create an empty object and verify the function of the flushcommands interface * @tc.desc Function test * @tc.level 0 */ - it('SUB_Softbus_IPC_IPCSkeleton_00500', 0, async function() { - console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_00500---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00500", 0, async function() { + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_00500---------------------------"); try { - console.info("SUB_Softbus_IPC_IPCSkeleton_00500 testcase") + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00500 testcase") let getCallingPid = rpc.IPCSkeleton.getLocalDeviceID(); - console.info("SUB_Softbus_IPC_IPCSkeleton_00500 getCallingPid result: " + getCallingPid); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00500 getCallingPid result: " + getCallingPid); expect(getCallingPid != null).assertTrue(); let getCallingUid = rpc.IPCSkeleton.getCallingDeviceID(); - console.info("SUB_Softbus_IPC_IPCSkeleton_00500 getCallingUid result: " + getCallingUid); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00500 getCallingUid result: " + getCallingUid); expect(getCallingUid != null).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_IPCSkeleton_00500 error is :" + error) + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00500 error is :" + error) } - console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_00500---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_00500---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_IPCSkeleton_00600 + * @tc.number SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600 * @tc.name Do not get the server agent, do not create a remoteobject instance, and directly getcallingpid, * getcallingpid, getcallingdeviceid, getlocaldeviceid * @tc.desc Function test * @tc.level 0 */ - it('SUB_Softbus_IPC_IPCSkeleton_00600', 0, async function() { - console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_00600---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600", 0, async function() { + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600---------------------------"); try{ let getCallingPid = rpc.IPCSkeleton.getCallingPid(); - console.info("SUB_Softbus_IPC_IPCSkeleton_00600: run getCallingPid result is :" + getCallingPid); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600: run getCallingPid result is :" + getCallingPid); expect(getCallingPid != null).assertTrue(); let getCallingUid = rpc.IPCSkeleton.getCallingUid(); - console.info("SUB_Softbus_IPC_IPCSkeleton_00600: run getCallingUid result is :" + getCallingUid); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600: run getCallingUid result is :" + getCallingUid); expect(getCallingUid != null).assertTrue(); let getCallingToKenId = rpc.IPCSkeleton.getCallingTokenId(); - console.info("SUB_Softbus_IPC_IPCSkeleton_00600: run getCallingToKenId result is :" + getCallingToKenId); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600: run getCallingToKenId result is :" + getCallingToKenId); expect(getCallingToKenId != null).assertTrue(); let getLocalDeviceID = rpc.IPCSkeleton.getLocalDeviceID(); - console.info("SUB_Softbus_IPC_IPCSkeleton_00600: run getLocalDeviceID result is :" + getLocalDeviceID); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600: run getLocalDeviceID result is :" + getLocalDeviceID); expect(getLocalDeviceID != null).assertTrue(); let getCallingDeviceID = rpc.IPCSkeleton.getCallingDeviceID(); - console.info("SUB_Softbus_IPC_IPCSkeleton_00600: run getCallingDeviceID result is :" + getCallingDeviceID); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600: run getCallingDeviceID result is :" + getCallingDeviceID); expect(getCallingDeviceID != null).assertTrue(); } catch (error){ - console.info("SUB_Softbus_IPC_IPCSkeleton_00600: error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600: error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_00600---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_00600---------------------------"); }) /* - * @tc.number SUB_Softbus_IPC_IPCSkeleton_00700 + * @tc.number SUB_Softbus_IPC_Compatibility_IPCSkeleton_00700 * @tc.name Basic method of testing ipcskeleton * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_IPCSkeleton_00700", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_00700---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00700", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_00700---------------------------"); try{ expect(rpc.IPCSkeleton.getContextObject().getInterfaceDescriptor()).assertEqual(""); let callingPid = rpc.IPCSkeleton.getCallingPid(); @@ -7665,17 +7997,17 @@ describe('ActsRpcClientJsTest', function(){ let data = rpc.MessageParcel.create(); let reply = rpc.MessageParcel.create(); expect(data.writeInterfaceToken("rpcTestAbility")).assertTrue(); - console.info("SUB_Softbus_IPC_IPCSkeleton_00700: callingPid: " + callingPid + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00700: callingPid: " + callingPid + ", callingUid: " + callingUid); expect(callingUid != null).assertTrue(); expect(callingPid != null).assertTrue(); await gIRemoteObject.sendRequest(CODE_IPCSKELETON, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_IPCSkeleton_00700: sendRequest done, error code: " + result.errCode) + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00700: sendRequest done, error code: " + result.errCode) expect(result.errCode).assertEqual(0); result.reply.readException(); let rescallingPid = result.reply.readInt(); let rescallingUid = result.reply.readInt(); - console.info("SUB_Softbus_IPC_IPCSkeleton_00700:" + rescallingPid +" ;"+ rescallingUid); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00700:" + rescallingPid +" ;"+ rescallingUid); expect(rescallingPid).assertEqual(callingPid); expect(rescallingUid).assertEqual(callingUid); }) @@ -7683,19 +8015,19 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_IPCSkeleton_00700:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00700:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_00700---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_00700---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_IPCSkeleton_00800 + * @tc.number SUB_Softbus_IPC_Compatibility_IPCSkeleton_00800 * @tc.name Basic method of testing ipcskeleton * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_IPCSkeleton_00800", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_00800---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00800", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_00800---------------------------"); try{ let callingPid = rpc.IPCSkeleton.getCallingPid(); let callingUid = rpc.IPCSkeleton.getCallingUid(); @@ -7703,10 +8035,10 @@ describe('ActsRpcClientJsTest', function(){ let data = rpc.MessageParcel.create(); let reply = rpc.MessageParcel.create(); expect(data.writeInterfaceToken("rpcTestAbility")).assertTrue(); - console.info("SUB_Softbus_IPC_IPCSkeleton_00800: callingPid: " + callingPid + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00800: callingPid: " + callingPid + ", callingUid: " + callingUid); await gIRemoteObject.sendRequest(CODE_IPCSKELETON_INT, data, reply, option).then((result) => { - console.info("SUB_Softbus_IPC_IPCSkeleton_00800: sendRequest done, error code: " + result.errCode) + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00800: sendRequest done, error code: " + result.errCode) expect(result.errCode).assertEqual(0); result.reply.readException(); let rescallingPid = result.reply.readInt(); @@ -7717,7 +8049,7 @@ describe('ActsRpcClientJsTest', function(){ let resicallingUid = result.reply.readInt(); let resflushCommands = result.reply.readInt(); - console.info("SUB_Softbus_IPC_IPCSkeleton_00800:" + resicallingUid +" ;"+ resflushCommands); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00800:" + resicallingUid +" ;"+ resflushCommands); expect(rescallingPid).assertEqual(callingPid); expect(rescallingUid).assertEqual(callingUid); expect(restcallingPid).assertEqual(callingPid); @@ -7730,81 +8062,81 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_IPCSkeleton_00800:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00800:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_00800---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_00800---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_IPCSkeleton_00900 + * @tc.number SUB_Softbus_IPC_Compatibility_IPCSkeleton_00900 * @tc.name SetCallingIdentity Interface flags input parameter boundary value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_IPCSkeleton_00900", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_00900---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00900", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_00900---------------------------"); try{ let id = ""; let ret = rpc.IPCSkeleton.setCallingIdentity(id); - console.info("SUB_Softbus_IPC_IPCSkeleton_00900: setCallingIdentity is: " + ret); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00900: setCallingIdentity is: " + ret); expect(ret).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_IPCSkeleton_00900:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_00900:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_00900---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_00900---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_IPCSkeleton_01000 + * @tc.number SUB_Softbus_IPC_Compatibility_IPCSkeleton_01000 * @tc.name SetCallingIdentity Interface flags input parameter boundary value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_IPCSkeleton_01000", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_01000---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01000", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_01000---------------------------"); try{ let id = 0; let ret = rpc.IPCSkeleton.setCallingIdentity(id); - console.info("SUB_Softbus_IPC_IPCSkeleton_01000: setCallingIdentity is: " + ret); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01000: setCallingIdentity is: " + ret); expect(ret).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_IPCSkeleton_01000:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01000:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_01000---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_01000---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_IPCSkeleton_01100 + * @tc.number SUB_Softbus_IPC_Compatibility_IPCSkeleton_01100 * @tc.name SetCallingIdentity Interface flags input parameter boundary value verification * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_IPCSkeleton_01100", 0,async function(){ - console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_01100---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01100", 0,async function(){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_01100---------------------------"); try{ let id = ""; for (let i = 0; i < (40*K - 1); i++){ id += "a"; } - console.info("SUB_Softbus_IPC_IPCSkeleton_01100: id length is: " + id.length); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01100: id length is: " + id.length); let ret = rpc.IPCSkeleton.setCallingIdentity(id); - console.info("SUB_Softbus_IPC_IPCSkeleton_01100: setCallingIdentity is: " + ret); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01100: setCallingIdentity is: " + ret); expect(ret).assertTrue(); } catch (error) { - console.info("SUB_Softbus_IPC_IPCSkeleton_01100:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01100:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_01100---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_01100---------------------------"); }); /* - * @tc.number SUB_Softbus_IPC_IPCSkeleton_01200 + * @tc.number SUB_Softbus_IPC_Compatibility_IPCSkeleton_01200 * @tc.name Basic method of testing ipcskeleton * @tc.desc Function test * @tc.level 0 */ - it("SUB_Softbus_IPC_IPCSkeleton_01200", 0,async function(done){ - console.info("---------------------start SUB_Softbus_IPC_IPCSkeleton_01200---------------------------"); + it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01200", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_01200---------------------------"); try{ let object = rpc.IPCSkeleton.getContextObject(); let callingPid = rpc.IPCSkeleton.getCallingPid(); @@ -7821,7 +8153,7 @@ describe('ActsRpcClientJsTest', function(){ expect(id).assertEqual(""); expect(ret).assertTrue(); expect(rpc.IPCSkeleton.flushCommands(gIRemoteObject)).assertEqual(0); - console.info("SUB_Softbus_IPC_IPCSkeleton_01200: callingPid: " + callingPid + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01200: callingPid: " + callingPid + ", callingUid: " + callingUid + ", callingDeviceID: " + callingDeviceID + ", localDeviceID: " + localDeviceID + ", isLocalCalling: " + isLocalCalling); @@ -7829,9 +8161,9 @@ describe('ActsRpcClientJsTest', function(){ let data = rpc.MessageParcel.create(); let reply = rpc.MessageParcel.create(); expect(data.writeInterfaceToken("rpcTestAbility")).assertTrue(); - console.info("SUB_Softbus_IPC_IPCSkeleton_01200: start send request"); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01200: start send request"); await gIRemoteObject.sendRequest(CODE_IPCSKELETON, data, reply, option).then(function(result) { - console.info("SUB_Softbus_IPC_IPCSkeleton_01200: sendRequest done, error code: " + result.errCode) + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01200: sendRequest done, error code: " + result.errCode) expect(result.errCode).assertEqual(0); result.reply.readException(); expect(result.reply.readInt()).assertEqual(callingPid); @@ -7849,11 +8181,50 @@ describe('ActsRpcClientJsTest', function(){ reply.reclaim(); done(); } catch (error) { - console.info("SUB_Softbus_IPC_IPCSkeleton_01200:error = " + error); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01200:error = " + error); + } + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_01200---------------------------"); + }); + + /* + * @tc.number SUB_Softbus_IPC_Compatibility_IPCSkeleton_01300 + * @tc.name IPCSkeleton sendRequestAsync API test + * @tc.desc Function test + * @tc.level 0 + */ + it("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01300", 0,async function(done){ + console.info("---------------------start SUB_Softbus_IPC_Compatibility_IPCSkeleton_01300---------------------------"); + try{ + expect(rpc.IPCSkeleton.getContextObject().getInterfaceDescriptor()).assertEqual(""); + let callingPid = rpc.IPCSkeleton.getCallingPid(); + let callingUid = rpc.IPCSkeleton.getCallingUid(); + let option = new rpc.MessageOption(); + let data = rpc.MessageParcel.create(); + let reply = rpc.MessageParcel.create(); + expect(data.writeInterfaceToken("rpcTestAbility")).assertTrue(); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01300 callingPid: " + callingPid + + ", callingUid: " + callingUid); + expect(callingUid != null).assertTrue(); + expect(callingPid != null).assertTrue(); + await gIRemoteObject.sendRequestAsync(CODE_IPCSKELETON, data, reply, option).then((result) => { + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01300 sendRequest done, error code: " + result.errCode) + expect(result.errCode).assertEqual(0); + result.reply.readException(); + let rescallingPid = result.reply.readInt(); + let rescallingUid = result.reply.readInt(); + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01300" + rescallingPid +" ;"+ rescallingUid); + expect(rescallingPid).assertEqual(callingPid); + expect(rescallingUid).assertEqual(callingUid); + }) + data.reclaim(); + reply.reclaim(); + done(); + } catch (error) { + console.info("SUB_Softbus_IPC_Compatibility_IPCSkeleton_01300:error = " + error); } - console.info("---------------------end SUB_Softbus_IPC_IPCSkeleton_01200---------------------------"); + console.info("---------------------end SUB_Softbus_IPC_Compatibility_IPCSkeleton_01300---------------------------"); }); - console.info("-----------------------SUB_Softbus_IPC_MessageParce_Test is end-----------------------"); + console.info("-----------------------SUB_Softbus_IPC_Compatibility_MessageParce_Test is end-----------------------"); }); } diff --git a/communication/dsoftbus/rpc/src/main/resources/base/element/string.json b/communication/dsoftbus/rpc/src/main/resources/base/element/string.json old mode 100755 new mode 100644 diff --git a/communication/dsoftbus/rpc/src/main/resources/base/media/icon.png b/communication/dsoftbus/rpc/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 diff --git a/communication/dsoftbus/rpc_server/BUILD.gn b/communication/dsoftbus/rpc_server/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..084d3daac96a69c150e0ddd2e60f7b5ca71cb709 --- /dev/null +++ b/communication/dsoftbus/rpc_server/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_hap_assist_suite("ActsRpcJsServer") { + hap_profile = "./src/main/config.json" + deps = [ + ":rpc_js_assets", + ":rpc_js_resources", + ] + + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsRpcHapServer" + subsystem_name = "communication" + part_name = "ipc" +} +ohos_js_assets("rpc_js_assets") { + source_dir = "./src/main/js" + hap_profile = "./src/main/config.json" +} +ohos_resources("rpc_js_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/communication/dsoftbus/rpc_server/Test.json b/communication/dsoftbus/rpc_server/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..1cf442933fd02ebd2be6d0fc3fcac778edc6ebee --- /dev/null +++ b/communication/dsoftbus/rpc_server/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for rpc Servers", + "driver": { + "type": "JSUnitServer", + "test-timeout": "900000", + "package": "ohos.rpc.test.server", + "abilityName": ".MainAbility", + "shell-timeout": "900000" + }, + "kits": [ + { + "test-file-name": [ + "ActsRpcHapServer.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] + +} diff --git a/communication/dsoftbus/rpc_server/signature/openharmony_sx.p7b b/communication/dsoftbus/rpc_server/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..d00afeff6b13a18a2b5fd8aa9b3d7623aabb6a11 Binary files /dev/null and b/communication/dsoftbus/rpc_server/signature/openharmony_sx.p7b differ diff --git a/communication/dsoftbus/rpc_server/src/main/config.json b/communication/dsoftbus/rpc_server/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..538fdc27de9c7e6a7273466c35c34d5ab2d546cb --- /dev/null +++ b/communication/dsoftbus/rpc_server/src/main/config.json @@ -0,0 +1,90 @@ +{ + "app": { + "bundleName": "ohos.rpc.test.server", + "vendor": "rpc", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "target": 8 + } + }, + "deviceConfig": {}, + "module": { + "reqPermissions": [ + { + "name": "ohos.permission.DISTRIBUTED_DATASYNC" + }, + { + "name": "ohos.permission.GET_DISTRIBUTED_DEVICE_INFO" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO" + } + ], + "package": "ohos.rpc.test.server", + "name": ".MyApplication", + "mainAbility": ".MainAbility", + "deviceType": [ + "default", + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "js", + "icon": "$media:icon", + "description": "$string:mainability_description", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + }, + { + "srcPath": "ServiceAbility", + "name": ".ServiceAbility", + "icon": "$media:icon", + "srcLanguage": "js", + + "description": "$string:serviceability_description", + "type": "service", + "visible": true, + "formsEnabled": false + } + ], + "js": [ + { + "pages": [ + "pages/index/index", + "pages/second/second" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/communication/dsoftbus/rpc_server/src/main/js/MainAbility/app.js b/communication/dsoftbus/rpc_server/src/main/js/MainAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..8ae33ddcfbaffc15aa458bb6aa434d7049925ccc --- /dev/null +++ b/communication/dsoftbus/rpc_server/src/main/js/MainAbility/app.js @@ -0,0 +1,23 @@ +/* + * 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("Application onCreate"); + }, + onDestroy() { + console.info("Application onDestroy"); + } +}; diff --git a/communication/dsoftbus/rpc_server/src/main/js/MainAbility/i18n/en-US.json b/communication/dsoftbus/rpc_server/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..8feb7199333a82bab6f9e29341246e466c7dfd55 --- /dev/null +++ b/communication/dsoftbus/rpc_server/src/main/js/MainAbility/i18n/en-US.json @@ -0,0 +1,11 @@ +{ + "strings": { + "hello": "Hello", + "world": "World", + "page": "Second Page", + "next": "Next Page", + "back": "Back" + }, + "Files": { + } +} \ No newline at end of file diff --git a/communication/dsoftbus/rpc_server/src/main/js/MainAbility/i18n/zh-CN.json b/communication/dsoftbus/rpc_server/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..6551d160806d9089707897124655bcba11a83932 --- /dev/null +++ b/communication/dsoftbus/rpc_server/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,11 @@ +{ + "strings": { + "hello": "您好", + "world": "世界", + "page": "第二页", + "next": "下一页", + "back": "返回" + }, + "Files": { + } +} \ No newline at end of file diff --git a/communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/index/index.css b/communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..87b92cb0fa66fabbd552fc73804aab915f79c22e --- /dev/null +++ b/communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,24 @@ +.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; +} + +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/index/index.hml b/communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..ee2e929407a27df6cccf2d5bd36ded974215b209 --- /dev/null +++ b/communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,6 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + + +
diff --git a/communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/index/index.js b/communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..dc1588bf19750fbfc3cdf94b27acd30c60487029 --- /dev/null +++ b/communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,32 @@ +/* + * 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 router from '@system.router' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onclick: function () { + router.replace({ + uri: "pages/second/second" + }) + } +} + + diff --git a/communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/second/second.css b/communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/second/second.css new file mode 100644 index 0000000000000000000000000000000000000000..87b92cb0fa66fabbd552fc73804aab915f79c22e --- /dev/null +++ b/communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/second/second.css @@ -0,0 +1,24 @@ +.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; +} + +.btn { + width: 50%; + height: 100px; + font-size: 40px; +} diff --git a/communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/second/second.hml b/communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/second/second.hml new file mode 100644 index 0000000000000000000000000000000000000000..5d50c7448ea9304c23c6d9a2e0d8790aab310d3d --- /dev/null +++ b/communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/second/second.hml @@ -0,0 +1,6 @@ +
+ + {{ $t('strings.page') }} + + +
diff --git a/communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/second/second.js b/communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/second/second.js new file mode 100644 index 0000000000000000000000000000000000000000..694f92fc0e5daefe6ae23cdb88c571a454663488 --- /dev/null +++ b/communication/dsoftbus/rpc_server/src/main/js/MainAbility/pages/second/second.js @@ -0,0 +1,27 @@ +/* + * 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 router from '@system.router' + +export default { + data: { + title: 'World' + }, + onclick: function () { + router.replace({ + uri: "pages/index/index" + }) + } +} diff --git a/communication/dsoftbus/rpc_server/src/main/js/ServiceAbility/service.js b/communication/dsoftbus/rpc_server/src/main/js/ServiceAbility/service.js new file mode 100644 index 0000000000000000000000000000000000000000..b2a68a0d74c60e4e9fad037e008b54c86f700687 --- /dev/null +++ b/communication/dsoftbus/rpc_server/src/main/js/ServiceAbility/service.js @@ -0,0 +1,498 @@ +/* + * 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 rpc from "@ohos.rpc" +import fileio from '@ohos.fileio'; +import process from '@ohos.process' + +export default { + onStart() { + console.info('RpcServer: onStart') + }, + onStop() { + console.info('RpcServer: onStop') + }, + onCommand(want, startId) { + console.info('RpcServer: onCommand, want: ' + JSON.stringify(want) +', startId: ' + startId) + }, + onConnect(want) { + console.info('RpcServer: service onConnect called.') + return new Stub("rpcTestAbility") + }, + onDisconnect(want) { + console.info('RpcServer: service onDisConnect called.') + }, + onReconnect(want) { + console.info('RpcServer: service onReConnect called.') + } +} + +class MySequenceable { + num = null + str = null + constructor(num, string) { + this.num = num; + this.str = string; + } + + marshalling(messageParcel) { + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + return true; + } + + unmarshalling(messageParcel) { + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + return true; + } +} + +class Stub extends rpc.RemoteObject { + constructor(descriptor) { + super(descriptor); + } + onRemoteRequest(code, data, reply, option) { + try{ + console.info("onRemoteRequest: " + code) + if (code === 32){ + console.info("case 32 start") + let tmp1 = data.readString() + let result = reply.writeString("onRemoteRequest invoking") + return true + } else if (code === 33){ + console.info("case 33 start") + let tmp1 = data.readString() + let result = reply.writeString(tmp1) + return true + }else { + console.error("default case " + code) + return super.onRemoteRequest(code, data, reply, option) + } + } catch (error) { + console.info("onRemoteRequest: " + error); + } + return false + } + onRemoteRequestEx(code, data, reply, option) { + try{ + console.info("onRemoteRequestEx: " + code) + switch(code) { + case 1: + { + console.info("case 1 start") + let tmp1 = data.readByteArray() + let result = reply.writeByteArray(tmp1) + return true + } + case 2: + { + console.info("case 2 start") + let tmp1 = data.readIntArray() + let result = reply.writeIntArray(tmp1) + return true + } + case 3: + { + console.info("case 3 start") + let tmp1 = data.readFloatArray() + let result = reply.writeFloatArray(tmp1) + return true + } + case 4: + { + console.info("case 4 start") + let tmp1 = data.readShort() + let result = reply.writeShort(tmp1) + return true + } + case 5: + { + console.info("case 5 start") + let tmp1 = data.readLong() + let result = reply.writeLong(tmp1) + return true + } + case 6: + { + console.info("case 6 start") + let tmp1 = data.readDouble() + let result = reply.writeDouble(tmp1) + return true + } + case 7: + { + console.info("case 7 start") + let tmp1 = data.readBoolean() + let result = reply.writeBoolean(tmp1) + return true + } + case 8: + { + console.info("case 8 start") + let tmp1 = data.readChar() + let result = reply.writeChar(tmp1) + return true + } + case 9: + { + console.info("case 9 start") + let tmp1 = data.readString() + let result = reply.writeString(tmp1) + return true + } + case 10: + { + console.info("case 10 start") + let tmp1 = data.readByte() + let result = reply.writeByte(tmp1) + return true + } + case 11: + { + console.info("case 11 start") + let tmp1 = data.readInt() + let result = reply.writeInt(tmp1) + return true + } + case 12: + { + console.info("case 12 start") + let tmp1 = data.readFloat() + let result = reply.writeFloat(tmp1) + return true + } + case 13: + { + console.info("case 13 start") + var size = data .readInt(); + let tmp1 = data.readRawData(size); + let size1 = reply.writeInt(size); + let result = reply.writeRawData(tmp1, tmp.length) + return true + } + case 14: + { + console.info("case 14 start") + let listener = data.readRemoteObject(); + let num = data.readInt() + let str = data.readString() + let option2 = new rpc.MessageOption() + let data2 = rpc.MessageParcel.create() + let reply2 = rpc.MessageParcel.create() + data2.writeInt(num) + data2.writeString(str) + listener.sendRequest(1, data2, reply2, option2) + .then(function(result) { + console.info("send request done, error code: " + result.errCode ) + }) + .catch(function(e) { + console.error("send request got exception: " + e) + }) + .finally(() => { + data2.reclaim() + reply2.reclaim() + console.info("case 14 test done") + }) + reply.writeNoException() + return true + } + case 15: + { + console.info("case 15 start") + let s = new MySequenceable(null, null) + var tmp1 = data.readSequenceable(s) + let result = reply.writeSequenceable(s) + return true + } + case 16: + { + console.info("case 16 start") + data.readException() + var tmp = data.readInt(); + reply.writeNoException() + var result = reply.writeInt(tmp); + return true + } + case 17: + { + console.info("case 17 start") + var s = [new MySequenceable(null, null), new MySequenceable(null, null), + new MySequenceable(null, null)]; + data.readSequenceableArray(s); + let result = reply.writeSequenceableArray(s); + return true + } + case 18: + { + console.info("case 18 start") + let listeners = data.readRemoteObjectArray(); + for (let i = 0; i < listeners.length; i++) { + let option2 = new rpc.MessageOption() + let data2 = rpc.MessageParcel.create() + let reply2 = rpc.MessageParcel.create() + listeners[i].sendRequest(1, data2, reply2, option2) + .then(function(result) { + console.info("send request done, error code: " + result.errCode + ", index: " + i) + }) + .catch(function(e) { + console.error("send request got exception: " + e) + }) + .finally(() => { + data2.reclaim() + reply2.reclaim() + console.info("case 18 test done") + }) + } + console.info("The server's writeRemoteObjectArray result is " + result); + return true + } + case 19: + { + console.info("case 19 start") + let tmp1 = data.readDoubleArray() + let result = reply.writeDoubleArray(tmp1) + return true + } + + case 20: + { + console.info("case 20 start") + let tmp1 = data.readByte() + let tmp2 = data.readShort() + let tmp3 = data.readInt() + let tmp4 = data.readLong() + let tmp5 = data.readFloat() + let tmp6 = data.readDouble() + let tmp7 = data.readBoolean() + let tmp8 = data.readChar() + let tmp9 = data.readString() + let s = new MySequenceable(null, null) + let tmp10 = data.readSequenceable(s) + let result1 = reply.writeByte(tmp1) + let result2 = reply.writeShort(tmp2) + let result3 = reply.writeInt(tmp3) + let result4 = reply.writeLong(tmp4) + let result5 = reply.writeFloat(tmp5) + let result6 = reply.writeDouble(tmp6) + let result7 = reply.writeBoolean(tmp7) + let result8 = reply.writeChar(tmp8) + let result9 = reply.writeString(tmp9) + let result10 = reply.writeSequenceable(s) + return true + } + case 21: + { + console.info("case 21 start") + let tmp1 = data.readByteArray() + let tmp2 = data.readShortArray() + let tmp3 = data.readIntArray() + let tmp4 = data.readLongArray() + let tmp5 = data.readFloatArray() + let tmp6 = data.readDoubleArray() + let tmp7 = data.readBooleanArray() + let tmp8 = data.readCharArray() + let tmp9 = data.readStringArray() + let s = [new MySequenceable(null, null), new MySequenceable(null, null), + new MySequenceable(null, null)] + let tmp10 = data.readSequenceableArray(s) + let result1 = reply.writeByteArray(tmp1) + let result2 = reply.writeShortArray(tmp2) + let result3 = reply.writeIntArray(tmp3) + let result4 = reply.writeLongArray(tmp4) + let result5 = reply.writeFloatArray(tmp5) + let result6 = reply.writeDoubleArray(tmp6) + let result7 = reply.writeBooleanArray(tmp7) + let result8 = reply.writeCharArray(tmp8) + let result9 = reply.writeStringArray(tmp9) + let result10 = reply.writeSequenceableArray(s) + return true + } + case 22: + { + console.info("case 22 start") + let callingPid = rpc.IPCSkeleton.getCallingPid() + let callingUid = rpc.IPCSkeleton.getCallingUid() + reply.writeNoException() + reply.writeInt(callingPid) + reply.writeInt(callingUid) + reply.writeInt(this.getCallingPid()) + reply.writeInt(this.getCallingUid()) + let id = rpc.IPCSkeleton.resetCallingIdentity() + rpc.IPCSkeleton.setCallingIdentity(id) + reply.writeInt(rpc.IPCSkeleton.getCallingPid()) + reply.writeInt(rpc.IPCSkeleton.getCallingUid()) + reply.writeInt(rpc.IPCSkeleton.flushCommands(this)) + return true + } + case 23: + { + console.info("case 23 start") + let s = new MySequenceable(null, null); + var tmp1 = data.readSequenceable(s); + var result = reply.writeSequenceable(s); + return true + } + case 24: + { + console.info("case 24 start") + var tmp1 = data.readShort(); + var tmp2 = data.readShort(); + var tmp3 = data.readShort(); + var tmp4 = data.readShort(); + var tmp5 = data.readShort(); + var result1 = reply.writeShort(tmp1); + var result2 = reply.writeShort(tmp2); + var result3 = reply.writeShort(tmp3); + var result4 = reply.writeShort(tmp4); + var result5 = reply.writeShort(tmp5); + return true + } + case 25: + { + console.info("case 25 start") + var tmp1 = data.readByte(); + var tmp2 = data.readByte(); + var tmp3 = data.readByte(); + var tmp4 = data.readByte(); + var tmp5 = data.readByte(); + var result1 = reply.writeByte(tmp1); + var result2 = reply.writeByte(tmp2); + var result3 = reply.writeByte(tmp3); + var result4 = reply.writeByte(tmp4); + var result5 = reply.writeByte(tmp5); + return true + } + case 26: + { + console.info("case 26 start") + var tmp1 = data.readInt(); + var tmp2 = data.readInt(); + var tmp3 = data.readInt(); + var tmp4 = data.readInt(); + var tmp5 = data.readInt(); + var result1 = reply.writeInt(tmp1); + var result2 = reply.writeInt(tmp2); + var result3 = reply.writeInt(tmp3); + var result4 = reply.writeInt(tmp4); + var result5 = reply.writeInt(tmp5); + return true + } + case 28: + { + console.info("case 28 start") + let callingPid = rpc.IPCSkeleton.getCallingPid() + let callingUid = rpc.IPCSkeleton.getCallingUid() + let callingDeviceID = rpc.IPCSkeleton.getCallingDeviceID() + let localDeviceID = rpc.IPCSkeleton.getLocalDeviceID() + let isLocalCalling = rpc.IPCSkeleton.isLocalCalling() + reply.writeNoException() + reply.writeInt(callingPid) + reply.writeInt(callingUid) + reply.writeString(callingDeviceID) + reply.writeString(localDeviceID) + reply.writeBoolean(isLocalCalling) + reply.writeInt(this.getCallingPid()) + reply.writeInt(this.getCallingUid()) + let id = rpc.IPCSkeleton.resetCallingIdentity() + rpc.IPCSkeleton.setCallingIdentity(id) + reply.writeInt(rpc.IPCSkeleton.getCallingPid()) + reply.writeInt(rpc.IPCSkeleton.getCallingUid()) + reply.writeInt(rpc.IPCSkeleton.flushCommands(this)) + return true + } + case 29: + { + console.info("case 29 starts") + let bytesWr = data.readInt() + let fd = data.readFileDescriptor() + let writeFileResult = fileio.writeSync(fd, "HELLO RPC", {position: bytesWr + 1}); + rpc.MessageParcel.closeFileDescriptor(fd) + return true + } + case 30: + { + console.info("case 30 start") + let listeners = data.readRemoteObjectArray(); + let num = data.readInt() + let str = data.readString() + for (let i = 0; i < listeners.length; i++) { + let option2 = new rpc.MessageOption() + let data2 = rpc.MessageParcel.create() + let reply2 = rpc.MessageParcel.create() + data2.writeInt(num) + data2.writeString(str) + listeners[i].sendRequest(1, data2, reply2, option2) + .then(function(result) { + console.info("send request done, error code: " + result.errCode + ", index: " + i) + }) + .catch(function(e) { + console.error("send request got exception: " + e) + }) + .finally(() => { + data2.reclaim() + reply2.reclaim() + console.info("case 30 test done") + }) + } + reply.writeNoException() + return true + } + + case 31: + { + console.info("case 31 start") + let listeners = new Array(3) + data.readRemoteObjectArray(listeners) + let num = data.readInt() + let str = data.readString() + for (let i = 0; i < listeners.length; i++) { + let option2 = new rpc.MessageOption() + let data2 = rpc.MessageParcel.create() + let reply2 = rpc.MessageParcel.create() + data2.writeInt(num) + data2.writeString(str) + listeners[i].sendRequest(1, data2, reply2, option2) + .then(function(result) { + console.info("send request done, error code: " + result.errCode + ", index: " + i) + }) + .catch(function(e) { + console.error("send request got exception: " + e) + }) + .finally(() => { + data2.reclaim() + reply2.reclaim() + console.info("case 31 test done") + }) + } + reply.writeNoException() + return true + } + case 32: + { + console.info("case 32 start") + let tmp1 = data.readString() + let result = reply.writeString("onRemoteRequestEx invoking") + return true + } + default: + this.onRemoteRequest(code, data, reply, option) + } + } catch (error) { + console.info("onRemoteRequestEx: " + error); + } + return false + } +} \ No newline at end of file diff --git a/communication/dsoftbus/rpc_server/src/main/resources/base/element/string.json b/communication/dsoftbus/rpc_server/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..16e3bbc3f7c9ec1caf47bc5dcd117beadc774f53 --- /dev/null +++ b/communication/dsoftbus/rpc_server/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "RpcServer" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + }, + { + "name": "serviceability_description", + "value": "hap sample empty service" + } + ] +} \ No newline at end of file diff --git a/communication/dsoftbus/rpc_server/src/main/resources/base/media/icon.png b/communication/dsoftbus/rpc_server/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/communication/dsoftbus/rpc_server/src/main/resources/base/media/icon.png differ diff --git a/communication/nfc_Controller/BUILD.gn b/communication/nfc_Controller/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..06d8e28a0e95cb6cc69ede6a40186630a2a85796 --- /dev/null +++ b/communication/nfc_Controller/BUILD.gn @@ -0,0 +1,35 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsNFCJSTest") { + hap_profile = "./src/main/config.json" + deps = [ + ":nfc_js_assets", + ":nfc_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsNFCJSTest" + part_name = "nfc" + subsystem_name = "communication" +} +ohos_js_assets("nfc_js_assets") { + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" +} +ohos_resources("nfc_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/communication/nfc_Controller/Test.json b/communication/nfc_Controller/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..f0fb0ef9b119ece50a78f6b119873b27d833cadf --- /dev/null +++ b/communication/nfc_Controller/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Configuration for nfc js api Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "shell-timeout": "600000", + "testcase-timeout": "600000", + "bundle-name": "ohos.acts.communication.nfc.nfcdevice", + "package-name": "ohos.acts.communication.nfc.nfcdevice" + }, + "kits": [ + { + "test-file-name": [ + "ActsNFCJSTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/communication/nfc_Controller/signature/openharmony_sx.p7b b/communication/nfc_Controller/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/communication/nfc_Controller/signature/openharmony_sx.p7b differ diff --git a/communication/nfc_Controller/src/main/config.json b/communication/nfc_Controller/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..8bfe00ca282be2b11c970c7bf15f4e7feb598253 --- /dev/null +++ b/communication/nfc_Controller/src/main/config.json @@ -0,0 +1,222 @@ +{ + "app": { + "bundleName": "ohos.acts.communication.nfc.nfcdevice", + "vendor": "acts", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5 + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.acts.communication.nfc.nfcdevice", + "name": ".entry", + "mainAbility": ".MainAbility", + "deviceType": [ + "default", + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "nfc_standard", + "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 + } + } + ], + "defPermissions": [ + { + "availableScope": [], + "grantMode": "user_grant", + "name": "ohos.permission.ACCESS_LOCATION", + "availableLevel": "system_basic", + "provisionEnable": true, + "distributedSceneEnable": true, + "label": "ACCESS_LOCATION label", + "description": "ACCESS_LOCATION description" + }, + { + "availableScope": [], + "grantMode": "system_grant", + "name": "ohos.permission.MANAGE_SECURE_SETTINGS", + "availableLevel": "system_basic", + "provisionEnable": true, + "distributedSceneEnable": false, + "label": "MANAGE_SECURE_SETTINGS label", + "description": "MANAGE_SECURE_SETTINGS description" + }, + { + "availableScope": [], + "grantMode": "user_grant", + "name": "ohos.permission.LOCATION", + "availableLevel": "system_basic", + "provisionEnable": true, + "distributedSceneEnable": true, + "label": "LOCATION label", + "description": "LOCATION description" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.MANAGE_SECURE_SETTINGS", + "reason": "need use ohos.permission.MANAGE_SECURE_SETTINGS" + }, + { + "name": "ohos.permission.NFC_CARD_EMULATION", + "reason": "use ohos.permission.SET_nfc_INFO" + }, + { + "name": "ohos.permission.MANAGE_nfc_CONNECTION", + "reason": "use ohos.permission.MANAGE_nfc_CONNECTION" + }, + { + "name": "ohos.permission.NFC_TAG", + "reason": "use ohos.permission.NFC_TAG" + }, + { + "name": "ohos.permission.GET_nfc_CONFIG", + "reason": "use ohos.permission.GET_nfc_CONFIG" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason": "use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.GET_nfc_LOCAL_MAC", + "reason": "use ohos.permission.GET_nfc_LOCAL_MAC" + }, + { + "name": "ohos.permission.GET_nfc_PEERS_MAC", + "reason": "use ohos.permission.GET_nfc_PEERS_MAC" + }, + { + "name": "ohos.permission.MANAGE_nfc_HOTSPOT", + "reason": "use ohos.permission.MANAGE_nfc_HOTSPOT" + }, + { + "name": "ohos.permission.GET_nfc_INFO_INTERNAL", + "reason": "use ohos.permission.GET_nfc_INFO_INTERNAL" + }, + { + "name": "ohos.permission.LOCATION", + "reason": "need use ohos.permission.LOCATION", + "usedScene": { + "ability": [ + "ohos.acts.communication.nfc.nfcdevice" + ], + "when": "inuse" + } + }, + { + "name": "ohos.permission.ACCESS_LOCATION", + "reason": "need use ohos.permission.ACCESS_LOCATION", + "usedScene": { + "ability": [ + "ohos.acts.communication.nfc.nfcdevice" + ], + "when": "inuse" + } + }, + { + "name": "ohos.permission.LOCATION_IN_BACKGROUND", + "reason": "need use ohos.permission.LOCATION_IN_BACKGROUND", + "usedScene": { + "ability": [ + "ohos.acts.communication.nfc.nfcdevice" + ], + "when": "inuse" + } + }, + { + "name": "ohos.permission.MANAGE_SECURE_SETTINGS", + "reason": "need use ohos.permission.MANAGE_SECURE_SETTINGS", + "usedScene": { + "ability": [ + "ohos.acts.communication.nfc.nfcdevice" + ], + "when": "inuse" + } + }, + { + "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.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO" + } + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + }, + "srcPath": "" + } +} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/app.js b/communication/nfc_Controller/src/main/js/MainAbility/app.js similarity index 100% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/app.js rename to communication/nfc_Controller/src/main/js/MainAbility/app.js diff --git a/time/TimerTest_js/src/main/js/default/i18n/en-US.json b/communication/nfc_Controller/src/main/js/MainAbility/i18n/en-US.json similarity index 100% rename from time/TimerTest_js/src/main/js/default/i18n/en-US.json rename to communication/nfc_Controller/src/main/js/MainAbility/i18n/en-US.json diff --git a/time/TimerTest_js/src/main/js/default/i18n/zh-CN.json b/communication/nfc_Controller/src/main/js/MainAbility/i18n/zh-CN.json similarity index 100% rename from time/TimerTest_js/src/main/js/default/i18n/zh-CN.json rename to communication/nfc_Controller/src/main/js/MainAbility/i18n/zh-CN.json diff --git a/communication/nfc_Controller/src/main/js/MainAbility/pages/index/index.css b/communication/nfc_Controller/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..3a8326a076cdb9ecabf543df9dba84240f5b52a4 --- /dev/null +++ b/communication/nfc_Controller/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,25 @@ +/* + * 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/communication/nfc_Controller/src/main/js/MainAbility/pages/index/index.hml b/communication/nfc_Controller/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..0053057b5ff7362e00db48887ee1663cffa35988 --- /dev/null +++ b/communication/nfc_Controller/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. + */ + + +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/communication/nfc_Controller/src/main/js/MainAbility/pages/index/index.js b/communication/nfc_Controller/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..3300c9cfc4ff94297fee72c00d5c28d3114854f3 --- /dev/null +++ b/communication/nfc_Controller/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,34 @@ +/* + * 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: '', + myTimeout: 25000 + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + }, + onReady() { + console.info('onReady finish') + }, +} + diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/app.js b/communication/nfc_Controller/src/main/js/TestAbility/app.js similarity index 100% rename from distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/app.js rename to communication/nfc_Controller/src/main/js/TestAbility/app.js diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/i18n/en-US.json b/communication/nfc_Controller/src/main/js/TestAbility/i18n/en-US.json similarity index 100% rename from distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/i18n/en-US.json rename to communication/nfc_Controller/src/main/js/TestAbility/i18n/en-US.json diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/i18n/zh-CN.json b/communication/nfc_Controller/src/main/js/TestAbility/i18n/zh-CN.json similarity index 100% rename from distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/i18n/zh-CN.json rename to communication/nfc_Controller/src/main/js/TestAbility/i18n/zh-CN.json diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/pages/index/index.css b/communication/nfc_Controller/src/main/js/TestAbility/pages/index/index.css similarity index 100% rename from distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/pages/index/index.css rename to communication/nfc_Controller/src/main/js/TestAbility/pages/index/index.css diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/pages/index/index.hml b/communication/nfc_Controller/src/main/js/TestAbility/pages/index/index.hml similarity index 100% rename from distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/pages/index/index.hml rename to communication/nfc_Controller/src/main/js/TestAbility/pages/index/index.hml diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/pages/index/index.js b/communication/nfc_Controller/src/main/js/TestAbility/pages/index/index.js similarity index 100% rename from distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/pages/index/index.js rename to communication/nfc_Controller/src/main/js/TestAbility/pages/index/index.js diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/communication/nfc_Controller/src/main/js/TestRunner/OpenHarmonyTestRunner.js similarity index 100% rename from distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestRunner/OpenHarmonyTestRunner.js rename to communication/nfc_Controller/src/main/js/TestRunner/OpenHarmonyTestRunner.js diff --git a/communication/nfc_Controller/src/main/js/test/List.test.js b/communication/nfc_Controller/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..7bb31ffc969e0c8239793dfb0c7f20558bac0467 --- /dev/null +++ b/communication/nfc_Controller/src/main/js/test/List.test.js @@ -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. + */ + +import nfcControllerTest from './nfc.Controller.js' +import parameter from '@ohos.systemparameter'; +let info = parameter.getSync("const.SystemCapability.Communication.NFC.Core" ,"false"); +export default function testsuite() { +if (info != "false") +{ + nfcControllerTest(); +} +} diff --git a/communication/nfc_Controller/src/main/js/test/nfc.Controller.js b/communication/nfc_Controller/src/main/js/test/nfc.Controller.js new file mode 100644 index 0000000000000000000000000000000000000000..669a9021b3e9e2631ed8d99fe039e9e66a9421c5 --- /dev/null +++ b/communication/nfc_Controller/src/main/js/test/nfc.Controller.js @@ -0,0 +1,257 @@ +/* + * 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 tag from '@ohos.nfc.tag'; +import controller from '@ohos.nfc.controller'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' + + +let aTag = { + "uid": "15273952", + "technology": [1, 2], + "extrasData": [ + { + "sak": 0x08, "atqa": "B000" + }, + { + "appData": "A0C0", "protocolInfo": "131F" + } + ], + "tagRfDiscId": 1, +}; + +let vTag = { + "uid": "17293952", + "technology": [ 5 ], + "extrasData": [{"responseFlags": 0xA0, "dsfId": 0x13}], + "tagRfDiscId": 1, +}; + +let bTag = { + "uid": "15273952", + "technology": [1, 2], + "extrasData": [ + { + "sak": 0x08, "atqa": "B000" + }, + { + "appData": "A0C0", "protocolInfo": "131F" + } + ], + "tagRfDiscId": 1, +}; + +let fTag = { + "uid": "15273952", + "technology": [2, 4], + "extrasData": [ + { + "appData": "A0C0", "protInfo": "131F" + }, + { + "systemCode": "A0C0", "pmm": "131F" + } + ], + "tagRfDiscId": 1, +}; + +function sleep(delay) { // delay x ms + let start = (new Date()).getTime(); + while ((new Date()).getTime() - start < delay) { + continue; + } +} + +let NfcState={ + STATE_OFF : 1, + STATE_TURNING_ON : 2, + STATE_ON : 3, + STATE_TURNING_OFF : 4, +} + +export default function nfcControllerTest() { + describe('nfcControllerTest', function () { + beforeEach(function () { + console.info("[NFC_test]beforeEach start" ); + }) + afterEach(async function () { + console.info("[NFC_test]afterEach start" ); + }) + + /** + * @tc.number SUB_COMMUNICATION_NFC_Cont_0100 + * @tc.name Test on_off_openNfcapi + * @tc.desc Register the NFC switch status event and enable the NFC switch. + * @tc.size since 7 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_COMMUNICATION_NFC_Cont_0100', 0, function () { + let NFC_STATE_NOTIFY = "nfcStateChange"; + let recvNfcStateNotifyFunc = result => { + console.info("nfc state receive state ->" + result); + expect(result != null).assertTrue(); + } + controller.on(NFC_STATE_NOTIFY, recvNfcStateNotifyFunc); + try { + let openNfcswitch = controller.openNfc(); + sleep(5000); + console.info('[nfc_js] open Nfc switch ->' + openNfcswitch); + expect(openNfcswitch===undefined || openNfcswitch===true).assertTrue(); + }catch(error) { + console.info('[nfc_js] Failed to enable the switch ->' + error); + expect(error != null).assertTrue(); + } + controller.off(NFC_STATE_NOTIFY, recvNfcStateNotifyFunc); + }) + + /** + * @tc.number SUB_COMMUNICATION_NFC_Cont_0200 + * @tc.name Test isNfcAvailableapi + * @tc.desc Check whether the NFC function is enabled. + * @tc.size since 7 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_COMMUNICATION_NFC_Cont_0200', 0, function () { + let nfcisAvailable = controller.isNfcAvailable(); + expect(nfcisAvailable).assertTrue(); + console.info('[nfc_js] Nfc Available ->' + JSON.stringify(nfcisAvailable)); + }) + + /** + * @tc.number SUB_COMMUNICATION_NFC_Cont_0300 + * @tc.name Test isNfcOpenapi + * @tc.desc Check whether the NFC function is enabled. + * @tc.size since 7 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_COMMUNICATION_NFC_Cont_0300', 0, function () { + let nfcswitchis = controller.isNfcOpen(); + expect(nfcswitchis).assertTrue(); + console.info('[nfc_js] Nfc isopen state is ->' + JSON.stringify(nfcswitchis)); + }) + + /** + * @tc.number SUB_COMMUNICATION_NFC_Cont_0400 + * @tc.name Test isNfcAvailable_isNfcOpenapi + * @tc.desc Check whether the NFC function is enabled on the device. + * @tc.size since 7 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_COMMUNICATION_NFC_Cont_0400', 0, function () { + let nfcisAvailable1 = controller.isNfcAvailable(); + expect(nfcisAvailable1).assertTrue(); + console.info('[nfc_js] NfcAvailable 1 ->' + JSON.stringify(nfcisAvailable1)); + let nfcenable1 = controller.isNfcOpen(); + expect(nfcenable1).assertTrue(); + console.info('[nfc_js] Nfc isopen 1 state is ->' + JSON.stringify(nfcenable1)); + }) + + /** + * @tc.number SUB_COMMUNICATION_NFC_Cont_0500 + * @tc.name Test getNfcStateapi + * @tc.desc Querying the Status When NFC Is Enabled + * @tc.size since 7 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_COMMUNICATION_NFC_Cont_0500', 0, function () { + let checkopennfc = controller.getNfcState(); + expect(checkopennfc).assertEqual(NfcState.STATE_ON); + console.log("[nfc_test] checkopen the state of nfc-> " + JSON.stringify(checkopennfc)); + }) + + /** + * @tc.number SUB_COMMUNICATION_NFC_Cont_0600 + * @tc.name Test closeNfcapi + * @tc.desc Deregister the NFC switch status event and disable the NFC. + * @tc.size since 7 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_COMMUNICATION_NFC_Cont_0600', 0, function () { + try { + let closeNfc = controller.closeNfc(); + console.info('[nfc_js] clocse Nfc switch ->' + closeNfc); + expect(closeNfc===undefined || closeNfc===true).assertTrue(); + }catch(error) { + console.info('[nfc_js] Failed to disable the switch ->' + error ); + expect(error!=null).assertTrue(); + } + }) + + /** + * @tc.number SUB_COMMUNICATION_NFC_getTag_js_0700 + * @tc.name Test getNfcATagapi + * @tc.desc Obtaining an NFC Type A Tag Object + * @tc.size since 7 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_COMMUNICATION_NFC_getTag_js_0700', 0, function () { + let taga = tag.getNfcATag(aTag); + expect(taga !=null).assertTrue(); + console.info('aTag is--<-!!!->' + JSON.stringify(taga)); + }) + + /** + * @tc.number SUB_COMMUNICATION_NFC_getTag_js_0800 + * @tc.name Test getNfcVTagapi + * @tc.desc Obtaining an NFC Type V Tag Object + * @tc.size since 7 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_COMMUNICATION_NFC_getTag_js_0800', 0, function () { + let tagV = tag.getNfcVTag(vTag); + expect(vTag !=null).assertTrue(); + console.info('vTag is--<-!!!->' + JSON.stringify(tagV)); + }) + + /** + * @tc.number SUB_COMMUNICATION_NFC_getTag_js_0900 + * @tc.name Test getNfcBTagapi + * @tc.desc Obtaining an NFC Type B Tag Object + * @tc.size since 7 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_COMMUNICATION_NFC_getTag_js_0900', 0, function () { + let tagB = tag.getNfcBTag(bTag); + expect(tagB !=null).assertTrue(); + console.info('bTag is--<-!!!->' + JSON.stringify(tagB)); + }) + + /** + * @tc.number SUB_COMMUNICATION_NFC_getTag_js_1000 + * @tc.name Test getNfcFTagapi + * @tc.desc Obtaining an NFC Type F Tag Object + * @tc.size since 7 + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_COMMUNICATION_NFC_getTag_js_1000', 0, function () { + let tagF = tag.getNfcFTag(fTag); + expect(tagF !=null).assertTrue(); + console.info('fTag is--<-!!!->' + JSON.stringify(tagF)); + }) + console.log("*************[nfc_test] start nfc js unit test end*************"); + }) +} + diff --git a/communication/nfc_Controller/src/main/resources/base/element/string.json b/communication/nfc_Controller/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d4b2a0a059d21198f9767cea679a5cc2bb8f6dad --- /dev/null +++ b/communication/nfc_Controller/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "OsAccountTest" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature 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 diff --git a/communication/nfc_Controller/src/main/resources/base/media/icon.png b/communication/nfc_Controller/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/communication/nfc_Controller/src/main/resources/base/media/icon.png differ diff --git a/communication/wifi_p2p/BUILD.gn b/communication/wifi_p2p/BUILD.gn index 94309f29b2fccd393b71ecb687a4e190dc35a649..15c726bc79e033126b140957845e3d478f7410d4 100644 --- a/communication/wifi_p2p/BUILD.gn +++ b/communication/wifi_p2p/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/communication/wifi_p2p/Test.json b/communication/wifi_p2p/Test.json index b4aec6c4eabdff5cd661e1874c2d4dc9033510c5..74df7750738c266d1c4c698d8c8195658c9f829c 100644 --- a/communication/wifi_p2p/Test.json +++ b/communication/wifi_p2p/Test.json @@ -4,6 +4,7 @@ "type": "OHJSUnitTest", "test-timeout": "600000", "shell-timeout": "600000", + "testcase-timeout": "600000", "bundle-name": "ohos.acts.communication.wifi.wifidevice", "package-name": "ohos.acts.communication.wifi.wifidevice" }, @@ -16,4 +17,4 @@ "cleanup-apps": true } ] -} \ No newline at end of file +} diff --git a/communication/wifi_p2p/src/main/config.json b/communication/wifi_p2p/src/main/config.json index 23109ec513cd3f201d9560602865e35c0a8c20ca..66c9ac984d8dcc8f2396ccc4121fb700d6cee425 100644 --- a/communication/wifi_p2p/src/main/config.json +++ b/communication/wifi_p2p/src/main/config.json @@ -17,6 +17,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/communication/wifi_p2p/src/main/js/test/List.test.js b/communication/wifi_p2p/src/main/js/test/List.test.js index 244af299caffe638be9510fcbe2b1c7e493d0fb4..d5770730cfd6bfcbaee8c5d038ce87820da31fbb 100644 --- a/communication/wifi_p2p/src/main/js/test/List.test.js +++ b/communication/wifi_p2p/src/main/js/test/List.test.js @@ -12,10 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import actsWifiTestNew from './WifiP2P.testsame.js' -import actsWifiTest from './WifiP2P.test2.js' +import actsWifiFunctionTest from './WifiP2PFunction.test.js' +import actsWifiEventTest from './WifiP2PEvent.test.js' export default function testsuite() { -actsWifiTestNew() -actsWifiTest() +actsWifiFunctionTest() +actsWifiEventTest() } - diff --git a/communication/wifi_p2p/src/main/js/test/WifiP2P.test2.js b/communication/wifi_p2p/src/main/js/test/WifiP2P.test2.js deleted file mode 100644 index 97fcab741807d239cbd7d68b64a6d948bda098ca..0000000000000000000000000000000000000000 --- a/communication/wifi_p2p/src/main/js/test/WifiP2P.test2.js +++ /dev/null @@ -1,121 +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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -import wifi from '@ohos.wifi' - -function sleep(delay) { - return new Promise(resovle => setTimeout(resovle, delay)) -} - -function checkWifiPowerOn(){ - console.info("wifi_test/wifi status:" + wifi.isWifiActive()); -} - -export default function actsWifiTestNew() { - describe('actsWifiTestNew', function () { - beforeEach(function () { - checkWifiPowerOn(); - }) - afterEach(function () { - }) - - /** - * @tc.number P2P_0009 - * @tc.name SUB_Communication_WiFi_XTS_P2P_0009 - * @since 8 - * @tc.desc Test p2pCancelConnect Group API functionality. - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO - */ - it('SUB_Communication_WiFi_XTS_P2P_0009', 0, async function (done) { - let WifiP2PConfig = { - deviceAddress : "00:00:00:00:00:00", - netId : -1, - passphrase : "12345678", - groupName : "AAAZZZ123", - goBand : 0 - }; - let addConfig = wifi.createGroup(WifiP2PConfig); - console.info("[wifi_test] test p2pConnect result." + addConfig); - let disConn = wifi.p2pCancelConnect(); - sleep(2000); - console.info("[wifi_test] test p2pCancelConnect result." + disConn); - expect(disConn).assertTrue(); - let removeConfig = wifi.removeGroup(); - console.info("[wifi_test] test start removeGroup" + removeConfig); - expect(removeConfig).assertTrue(); - done(); - }) - - /** - * @tc.number P2P_0011 - * @tc.name SUB_Communication_WiFi_XTS_P2P_0011 - * @since 8 - * @tc.desc Test remove error Group functionality. - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO - */ - it('SUB_Communication_WiFi_XTS_P2P_0011', 0, async function (done) { - let isRemoved = wifi.removeGroup(10000); - console.info("[wifi_test]removeGroup(10000) result : " + JSON.stringify(isRemoved)); - expect(isRemoved).assertTrue(); - done(); - }) - - /** - * @tc.number P2P_0002 - * @tc.name SUB_Communication_WiFi_XTS_P2P_0002 - * @since 8 - * @tc.desc Test set P2P DeviceName ,get TO P2pLocalDevice API functionality. - * @systemapi Hide this for inner system use. - * hits case(setDeviceName) - */ - - it('SUB_Communication_WiFi_XTS_P2P_0002', 0, async function (done) { - await wifi.getP2pLocalDevice() - .then(data => { - let resultLength = Object.keys(data).length; - console.info("[wifi_test] getP2pLocalDevice [promise] result :" + JSON.stringify(data)); - expect(true).assertEqual(resultLength >= 0); - }).catch((error) => { - console.info("[wifi_test]getP2pLocalDevice promise error." + JSON.stringify(error)); - expect().assertFail(); - }); - function getP2pLocal(){ - return new Promise((resolve, reject) => { - wifi.getP2pLocalDevice( - (err, ret) => { - if(err) { - console.info("[wifi_test]getP2pLocalDevice callback failed : " + JSON.stringify(err)); - return; - } - console.info("[wifi_test] getP2pLocalDevice callback result: " + JSON.stringify(ret)); - console.info("deviceName: " + ret.deviceName + "deviceAddress: " + - ret.deviceAddress + "primaryDeviceType: " + ret.primaryDeviceType + - "deviceStatus: " + ret.deviceStatus + "groupCapabilitys: " + - ret.groupCapabilitys ); - resolve(); - }); - }); - } - await getP2pLocal(); - done(); - }) - - }) -} - - diff --git a/communication/wifi_p2p/src/main/js/test/WifiP2P.testsame.js b/communication/wifi_p2p/src/main/js/test/WifiP2P.testsame.js deleted file mode 100644 index 66537148627a5771f73c23018632e0fc08375308..0000000000000000000000000000000000000000 --- a/communication/wifi_p2p/src/main/js/test/WifiP2P.testsame.js +++ /dev/null @@ -1,564 +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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' - -import wifi from '@ohos.wifi' - -function sleep(delay) { // delay x ms - var start = (new Date()).getTime(); - while ((new Date()).getTime() - start > delay) { - break; - } -} - -function checkWifiPowerOn(){ - console.info("wifi_test/wifi status:" + wifi.isWifiActive()); -} - -let GroupOwnerBand = { - GO_BAND_AUTO : 0, - GO_BAND_2GHZ : 1, - GO_BAND_5GHZ : 2, -} - -export default function actsWifiTest() { - describe('actsWifiTest', function () { - beforeEach(function () { - console.info("beforeEach start" ); - checkWifiPowerOn(); - }) - afterEach(async function () { - console.info("afterEach start" ); - }) - - /** - * @tc.number P2P_Config_0001 - * @tc.name SUB_Communication_WiFi_P2P_Config_0001 - * @tc.desc Test createGroup and getCurrentGroup promise infos - * @since 8 - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO - */ - it('SUB_Communication_WiFi_P2P_Config_0001', 0, async function(done) { - let WifiP2PConfig = { - deviceAddress : "00:00:00:00:00:00", - netId : -1, - passphrase : "12345678", - groupName : "AAAZZZ123", - goBand : 0 - }; - console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); - expect(wifi.isWifiActive()).assertTrue(); - let addConfig = wifi.createGroup(WifiP2PConfig); - console.info("[wifi_test] test createGroup end." + addConfig); - sleep(2000); - expect(addConfig).assertTrue(); - wifi.getCurrentGroup() - .then(data => { - let resultLength = Object.keys(data).length; - console.info("[wifi_test] getCurrentGroup [promise] result -> " + JSON.stringify(data)); - expect(true).assertEqual(resultLength!=0); - let removeConfig = wifi.removeGroup(); - expect(removeConfig).assertTrue(); - }); - done() - }) - - /** - * @tc.number P2P_Config_0002 - * @tc.name SUB_Communication_WiFi_P2P_Config_0002 - * @tc.desc Test getCurrentGroup callback infos - * @since 8 - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION - */ - it('SUB_Communication_WiFi_P2P_Config_0002', 0, async function(done) { - let WifiP2PConfig = { - deviceAddress : "00:00:00:00:00:00", - netId : -1, - passphrase : "12345678", - groupName : "AAAZZZ123", - goBand : 0 - }; - - console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); - expect(wifi.isWifiActive()).assertTrue(); - let addConfig = wifi.createGroup(WifiP2PConfig); - sleep(2000); - console.log("[wifi_test] check the state of wifi: " + addConfig); - expect(addConfig).assertTrue(); - wifi.getCurrentGroup( - (err, result) => { - if (err) { - console.error('wifi_test / failed to get getCurrentGroup: ' + JSON.stringify(err)); - expect().assertFail(); - }else{ - console.info("[wifi_test] getCurrentGroup [callback] -> " + JSON.stringify(result)); - // console.info("isP2pGo: " + result.isP2pGo + - // "deviceName: " + result.ownerInfo.deviceName + - // "deviceAddress: " + result.ownerInfo.deviceAddress + - // "primaryDeviceType: " + result.ownerInfo.primaryDeviceType + - // "deviceStatus: " + result.ownerInfo.deviceStatus + - // "groupCapabilitys: " + result.ownerInfo.groupCapabilitys + - // "passphrase: " + result.passphrase + "interface: "+ result.interface - // + "groupName: " + result.groupName + - // "clientDevices: " + result.clientDevices +"networkId: " + result.networkId - // + "frequency: " + result.frequency + "goIpAddress: " + result.goIpAddress); - let removeConfig = wifi.removeGroup(); - expect(removeConfig).assertTrue(); - } - done(); - }); - }) - - /** - * @tc.number P2P_Config_0003 - * @tc.name SUB_Communication_WiFi_P2P_Config_0003 - * @tc.desc Test createGroup 2.4G band and getCurrentGroup infos - * @since 8 - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO - */ - it('SUB_Communication_WiFi_P2P_Config_0003', 0, async function(done) { - let WifiP2PConfig2 = { - deviceAddress : "00:00:00:00:00:00", - netId : -1, - passphrase : "12345678", - groupName : "AAAZZZ123", - goBand : 1 - }; - console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); - expect(wifi.isWifiActive()).assertTrue(); - let addConfig = wifi.createGroup(WifiP2PConfig2); - sleep(2000); - console.info("[wifi_test] test createGroup3 result." + addConfig) - expect(addConfig).assertTrue(); - await wifi.getCurrentGroup() - .then(data => { - let resultLength = Object.keys(data).length; - console.info("[wifi_test] getCurrentGroup [promise] result -> " + JSON.stringify(data)); - expect(true).assertEqual(resultLength!=0); - let removeConfig = wifi.removeGroup(); - expect(removeConfig).assertTrue(); - }); - done() - }) - - /** - * @tc.number P2P_Config_0004 - * @tc.name SUB_Communication_WiFi_P2P_Config_0004 - * @tc.desc Test create PersistentGroup infos - * @since 8 - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO - */ - it('SUB_Communication_WiFi_P2P_Config_0004', 0, async function(done) { - let WifiP2PConfig = { - deviceAddress : "00:00:00:00:00:00", - netId : -2, - passphrase : "12345678", - groupName : "AAAZZZ123", - goBand : 0 - }; - console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); - expect(wifi.isWifiActive()).assertTrue(); - let addConfig = wifi.createGroup(WifiP2PConfig); - sleep(2000); - console.info("[wifi_test] test p2pConnect result." + addConfig); - expect(addConfig).assertTrue(); - await wifi.getCurrentGroup() - .then((data) => { - let resultLength = Object.keys(data).length; - console.info("[wifi_test] getCurrentGroup [promise] result -> " + JSON.stringify(data)); - expect(true).assertEqual(resultLength!=0); - let removeConfig = wifi.removeGroup(); - expect(removeConfig).assertTrue(); - }); - done(); - }) - - /** - * @tc.number P2P_Config_0005 - * @tc.name SUB_Communication_WiFi_P2P_Config_0005 - * @tc.desc Test p2pConnect infos - * @since 8 - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION - */ - it('SUB_Communication_WiFi_P2P_Config_0005', 0, async function(done) { - let WifiP2PConfig3 = { - deviceAddress : "00:00:00:00:00:00", - netId : -2, - passphrase : "12345678", - groupName : "AAAZZZ", - goBand : 2 - }; - console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); - expect(wifi.isWifiActive()).assertTrue(); - let scanConfig = wifi.startDiscoverDevices(); - sleep(2000); - expect(scanConfig).assertTrue(); - - let connConfig = wifi.p2pConnect(WifiP2PConfig3); - console.info("[wifi_test] test p2pConnect result." + connConfig); - expect(connConfig).assertTrue(); - let stopScan = wifi.stopDiscoverDevices(); - console.info("[wifi_test] test stopDiscoverDevices result." + stopScan); - done() - }) - - /** - * @tc.number P2P_Config_0006 - * @tc.name SUB_Communication_WiFi_P2P_Config_0006 - * @tc.desc Test getP2pLinkedInfo promise infos - * @since 8 - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO - */ - it('SUB_Communication_WiFi_P2P_Config_0006', 0, async function(done) { - await wifi.getP2pLinkedInfo() - .then(data => { - let resultLength = Object.keys(data).length; - console.info("[wifi_test] getP2pLinkedInfo [promise] result -> " + JSON.stringify(data)); - expect(true).assertEqual(resultLength!=0); - done() - }); - }) - - /** - * @tc.number P2P_Config_0007 - * @tc.name SUB_Communication_WiFi_P2P_Config_0007 - * @tc.desc Test getP2pLinkedInfo callback infos - * @since 8 - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO - */ - it('SUB_Communication_WiFi_P2P_Config_0007', 0, async function(done) { - let P2pConnectState = { - DISCONNECTED :0, - CONNECTED : 1, - }; - function getP2pInfo(){ - return new Promise((resolve, reject) => { - wifi.getP2pLinkedInfo( - (err, result) => { - if(err) { - console.info("[wifi_test]failed to getP2pLinkedInfo callback" + JSON.stringify(err)); - return; - } - let resultLength = Object.keys(result).length; - console.info("[wifi_test] getP2pLinkedInfo [callback] -> " + JSON.stringify(resultLength)); - console.info("connectState: " + result.connectState + - "isGroupOwner: " + result.isGroupOwner + - "groupOwnerAddr: " + result.groupOwnerAddr); - expect(true).assertEqual(resultLength!=0); - resolve(); - }); - }); - } - await getP2pInfo(); - done(); - }) - - /** - * @tc.number P2P_Config_0008 - * @tc.name SUB_Communication_WiFi_P2P_Config_0008 - * @tc.desc Test p2pCancelConnect infos - * @since 8 - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO - */ - it('SUB_Communication_WiFi_P2P_Config_0008', 0, async function(done) { - let disConn = wifi.p2pCancelConnect(); - sleep(2000); - console.info("[wifi_test] test p2pCancelConnect result." + disConn); - expect(disConn).assertTrue(); - let removeConfig = wifi.removeGroup(); - console.info("[wifi_test] test start removeGroup" + removeConfig); - expect(removeConfig).assertTrue(); - done(); - }) - - /** - * @tc.number P2P_Config_0009 - * @tc.name SUB_Communication_WiFi_P2P_Config_0009 - * @tc.desc Test getP2pPeerDevices promise infos - * @since 8 - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION - */ - it('SUB_Communication_WiFi_P2P_Config_0009', 0, async function(done){ - console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); - expect(wifi.isWifiActive()).assertTrue(); - let scanConfig = wifi.startDiscoverDevices(); - sleep(2000); - expect(scanConfig).assertTrue(); - await wifi.getP2pPeerDevices() - .then((data) => { - let resultLength = Object.keys(data).length; - console.info("[wifi_test] getP2pPeerDevices [promise] result -> " + JSON.stringify(data)); - expect(true).assertEqual(resultLength >= 0); - }).catch((error) => { - console.info("[wifi_test]getP2pPeerDevices promise then error." + JSON.stringify(error)); - expect().assertFail(); - }); - done(); - }) - - /** - * @tc.number P2P_Config_0010 - * @tc.name SUB_Communication_WiFi_P2P_Config_0010 - * @tc.desc Test getP2pPeerDevices callback infos - * @since 8 - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION - */ - it('SUB_Communication_WiFi_P2P_Config_0010', 0, async function(done){ - let P2pDeviceStatus = { - CONNECTED : 0, - INVITED : 1, - FAILED : 2, - AVAILABLE : 3, - UNAVAILABLE : 4, - }; - console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); - expect(wifi.isWifiActive()).assertTrue(); - let scanConfig = wifi.startDiscoverDevices(); - sleep(2000); - expect(scanConfig).assertTrue(); - await wifi.getP2pPeerDevices((err, result) => { - if (err) { - console.error('failed to getP2pPeerDevices infos callback because ' + JSON.stringify(err)); - }else{ - console.info("[wifi_test] getP2pPeerDevices [callback] -> " + JSON.stringify(result)); - let len = Object.keys(result).length; - for (let j = 0; j < len; ++j) { - console.info("deviceName: " + result[j].deviceName + - "deviceAddress: " + result[j].deviceAddress + - "primaryDeviceType: " + result[j].primaryDeviceType + - "deviceStatus: " + result[j].deviceStatus + - "groupCapabilitys: " + result[j].groupCapabilitys ); - if(result[j].deviceStatus ==P2pDeviceStatus.UNAVAILABLE){ - console.info("deviceStatus: " + result[j].deviceStatus); - } - if(result[j].deviceStatus ==P2pDeviceStatus.CONNECTED){ - console.info("deviceStatus: " + result[j].deviceStatus); - } - if(result[j].deviceStatus ==P2pDeviceStatus.INVITED){ - console.info("deviceStatus: " + result[j].deviceStatus); - } - if(result[j].deviceStatus ==P2pDeviceStatus.FAILED){ - console.info("deviceStatus: " + result[j].deviceStatus); - } - if(result[j].deviceStatus ==P2pDeviceStatus.AVAILABLE){ - console.info("deviceStatus: " + result[j].deviceStatus); - } - } - let stopScan = wifi.stopDiscoverDevices(); - expect(stopScan).assertTrue(); - } - done(); - }); - }) - - /** - * @tc.number P2P_P2pStateChange_0001 - * @tc.name SUB_Communication_WiFi_P2P_P2pStateChange_0001 - * @tc.desc Test p2pStateChange callback - * @since 8 - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO - */ - it('SUB_Communication_WiFi_P2P_P2pStateChange_0001', 0, async function (done) { - await wifi.on('p2pStateChange', result => { - console.info("onP2pStateChange callback, result:" + JSON.stringify(result)); - expect(true).assertEqual(result !=null); - done(); - }); - setTimeout(function() { - wifi.off('p2pStateChange', result => { - console.info("offP2pStateChange callback, result: " + JSON.stringify(result)); - expect(true).assertEqual(result !=null); - }); - }, 1 * 1000); - done(); - }) - - /** - * @tc.number p2pConnectionChange_0002 - * @tc.name SUB_Communication_WiFi_P2P_p2pConnectionChange_0002 - * @tc.desc Test p2pConnectionChange callback - * @since 8 - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO - */ - it('SUB_Communication_WiFi_P2P_p2pConnectionChange_0002', 0, async function (done) { - await wifi.on('p2pConnectionChange', recvP2pConnectionChangeFunc => { - console.info("[wifi_test] p2pConnectionChange result -> " + recvP2pConnectionChangeFunc); - expect(true).assertEqual(recvP2pConnectionChangeFunc !=null); - done(); - }); - setTimeout(function() { - console.info('[wifi_test] offP2pStateChange test start ...'); - wifi.off('p2pConnectionChange', recvP2pConnectionChangeFunc => { - console.info("p2pConnectionChange callback" + JSON.stringify(recvP2pConnectionChangeFunc)); - expect(true).assertEqual(recvP2pConnectionChangeFunc !=null); - }); - }, 1 * 1000); - done(); - }) - - /** - * @tc.number P2P_p2pDeviceChange_0003 - * @tc.name SUB_Communication_WiFi_P2P_p2pDeviceChange_0003 - * @tc.desc Test p2pDeviceChange callback - * @since 8 - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION - */ - it('SUB_Communication_WiFi_P2P_p2pDeviceChange_0003', 0, async function (done) { - console.info('[wifi_test] Onp2pDeviceChange test start ...'); - await wifi.on('p2pDeviceChange', result => { - console.info("onP2pDeviceChange callback, result:" + JSON.stringify(result)); - expect(true).assertEqual(result !=null); - done(); - }); - setTimeout(function() { - console.info('[wifi_test] offP2pDeviceChange test start ...'); - wifi.off('p2pDeviceChange', result => { - console.info("offP2pStateChange callback, result: " + JSON.stringify(result)); - expect(true).assertEqual(result !=null); - }); - }, 1 * 1000); - done(); - }) - - /** - * @tc.number P2P_p2pPeerDeviceChange_0004 - * @tc.name SUB_Communication_WiFi_P2P_p2pPeerDeviceChange_0004 - * @tc.desc Test p2pDeviceChange callback - * @since 8 - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO and ohos.permission.LOCATION - */ - it('SUB_Communication_WiFi_P2P_p2pPeerDeviceChange_0004', 0, async function (done) { - let recvP2pPeerDeviceChangeFunc = result => { - console.info("wifi_test / p2p peer device change receive event: " + JSON.stringify(result)); - wifi.getP2pDevices((err, data) => { - if (err) { - console.error('wifi_test / failed to get getP2pDevices: ' + JSON.stringify(err)); - return; - } - console.info("wifi_test / getP2pDevices [callback] -> " + JSON.stringify(data)); - let len = Object.keys(data).length; - console.log("getP2pDevices number: " + len); - for (let i = 0; i < len; ++i) { - if (data[i].deviceName === "GRE") { - console.info("wifi_test / p2pConnect: -> " + data[i].deviceAddress); - let config = { - "deviceAddress":data[i].deviceAddress, - "netId":-1, - "passphrase":"", - "groupName":"", - "goBand":0, - } - wifi.p2pConnect(config); - } - } - }); - } - await wifi.on('p2pPeerDeviceChange', result => { - console.info("onP2pPeerDeviceChange callback, result:" + JSON.stringify(result)); - expect(true).assertEqual(result !=null); - done(); - }); - setTimeout(function() { - wifi.off('p2pPeerDeviceChange', result => { - console.info("offP2pPeerDeviceChange callback, result: " + JSON.stringify(result)); - expect(true).assertEqual(result !=null); - }); - }, 1 * 1000); - done(); - }) - - /** - * @tc.number P2P_p2pPersistentGroupChange_0005 - * @tc.name SUB_Communication_WiFi_P2P_p2pPersistentGroupChange_0005 - * @tc.desc Test p2pPersistentGroupChange callback - * @since 8 - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO - */ - it('SUB_Communication_WiFi_P2P_p2pPersistentGroupChange_0005', 0, async function (done) { - let recvP2pPersistentGroupChangeFunc = () => { - console.info("wifi_test / p2p persistent group change receive event"); - let config = { - "deviceAddress" : "02:11:65:f2:0d:6e", - "netId":-2, - "passphrase":"", - "groupName":"", - "goBand":0, - }; - let addConfig = wifi.createGroup(config); - expect(addConfig).assertTrue(); - wifi.getCurrentGroup((err, data) => { - if (err) { - console.error('wifi_test / failed to get getCurrentGroup: ' + JSON.stringify(err)); - return; - } - console.info("wifi_test / get getCurrentGroup [callback] -> " + JSON.stringify(data)); - }); - }; - wifi.on("p2pPersistentGroupChange",recvP2pPersistentGroupChangeFunc); - setTimeout(async function() { - wifi.off('p2pPersistentGroupChange', result => { - console.info("offP2pPersistentGroupChange callback, result: " + JSON.stringify(result)); - expect(true).assertEqual(result !=null); - }); - }, 1 * 1000); - done(); - }) - - /** - * @tc.number P2P_p2pDiscoveryChange_0006 - * @tc.name SUB_Communication_WiFi_P2P_p2pDiscoveryChange_0006 - * @tc.desc Test p2pDiscoveryChange callback - * @since 8 - * @syscap SystemCapability.Communication.WiFi.P2P - * @permission ohos.permission.GET_WIFI_INFO - */ - it('SUB_Communication_WiFi_P2P_p2pDiscoveryChange_0006', 0, async function (done) { - await wifi.on('p2pDiscoveryChange', result => { - console.info("onp2pDiscoveryChange callback, result:" + JSON.stringify(result)); - expect(true).assertEqual((result !=null)); - done(); - }); - setTimeout(function() { - wifi.off('p2pDiscoveryChange', result => { - console.info("offp2pDiscoveryChange callback, result: " + JSON.stringify(result)); - expect(true).assertEqual(result !=null); - }); - }, 1 * 1000); - done(); - }) - console.log("*************[wifi_test] start wifi js unit test end*************"); - }) -} - - - - - diff --git a/communication/wifi_p2p/src/main/js/test/WifiP2PEvent.test.js b/communication/wifi_p2p/src/main/js/test/WifiP2PEvent.test.js new file mode 100644 index 0000000000000000000000000000000000000000..df9a6c97045bca71c92154dc1fc418ba63df3388 --- /dev/null +++ b/communication/wifi_p2p/src/main/js/test/WifiP2PEvent.test.js @@ -0,0 +1,200 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' + +import wifi from '@ohos.wifi' + +function sleep(delay) { + return new Promise(resovle => setTimeout(resovle, delay)) +} + +function checkWifiPowerOn(){ + console.info("[wifi_test]wifi status:" + wifi.isWifiActive()); +} + +let groupOwnerBand = { + GO_BAND_AUTO : 0, + GO_BAND_2GHZ : 1, + GO_BAND_5GHZ : 2, +} + +export default function actsWifiEventTest() { + describe('actsWifiEventTest', function () { + beforeEach(function () { + console.info("[wifi_test]beforeEach start" ); + checkWifiPowerOn(); + }) + afterEach(async function () { + console.info("[wifi_test]afterEach start" ); + }) + + /** + * @tc.number SUB_Communication_WiFi_Event_Test_0008 + * @tc.name testp2pStateChange + * @tc.desc Test p2pStateChange callback + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_Event_Test_0008', 0, async function (done) { + let p2pState = "p2pStateChange"; + let p2pStateChangeCallback = result => { + console.info("[wifi_test]p2pStateChange callback, result: " + JSON.stringify(result)); + } + wifi.on(p2pState, p2pStateChangeCallback); + await sleep(3000); + wifi.off(p2pState, p2pStateChangeCallback); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_Event_Test_0009 + * @tc.name testp2pConnectionChange + * @tc.desc Test p2pConnectionChange callback + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_Event_Test_0009', 0, async function (done) { + let p2pConnectionState = "p2pConnectionChange"; + let p2pConnectionChangeCallback = result => { + console.info("[wifi_test]p2pConnectionChange callback, result: " + JSON.stringify(result)); + } + wifi.on(p2pConnectionState, p2pConnectionChangeCallback); + let p2pConnectState = { + DISCONNECTED :0, + CONNECTED : 1, + }; + let wifiP2PConfig = { + deviceAddress : "00:00:00:00:00:00", + netId : -1, + passphrase : "12345678", + groupName : "AAAZZZ456", + goBand : 0 + }; + let connectResult = wifi.p2pConnect(wifiP2PConfig); + console.info("[wifi_test]test p2pConnect result." + connectResult); + await wifi.getP2pLinkedInfo() + .then(data => { + let resultLength = Object.keys(data).length; + console.info("[wifi_test]getP2pLinkedInfo promise result : " + JSON.stringify(data)); + expect(true).assertEqual(resultLength!=0); + done() + }); + await sleep(2000); + wifi.off(p2pConnectionState, p2pConnectionChangeCallback); + let removeGroupResult = wifi.removeGroup(); + console.info("[wifi_test]test start removeGroup:" + removeGroupResult); + expect(removeGroupResult).assertTrue(); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_Event_Test_0012 + * @tc.name testp2pDeviceChange + * @tc.desc Test p2pDeviceChange callback + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_Event_Test_0012', 0, async function (done) { + let p2pDeviceState = "p2pDeviceChange"; + let p2pDeviceChangeCallback = result => { + console.info("[wifi_test]p2pDeviceChange callback, result: " + JSON.stringify(result)); + } + wifi.on(p2pDeviceState, p2pDeviceChangeCallback); + await sleep(3000); + wifi.off(p2pDeviceState, p2pDeviceChangeCallback); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_Event_Test_0010 + * @tc.name testp2pPeerDeviceChange + * @tc.desc Test p2pPeerDeviceChange callback + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_Event_Test_0010', 0, async function (done) { + let p2pPeerDeviceState = "p2pPeerDeviceChange"; + let p2pPeerDeviceChangeCallback = result => { + console.info("[wifi_test]p2pPeerDeviceChange callback, result: " + JSON.stringify(result)); + } + wifi.on(p2pPeerDeviceState, p2pPeerDeviceChangeCallback); + let startDiscover = wifi.startDiscoverDevices(); + await sleep(3000); + expect(startDiscover).assertTrue(); + let stopDiscover = wifi.stopDiscoverDevices(); + console.info("[wifi_test] test stopDiscoverDevices result." + stopDiscover); + wifi.off(p2pPeerDeviceState, p2pPeerDeviceChangeCallback); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_Event_Test_0013 + * @tc.name testp2pPersistentGroupChange + * @tc.desc Test p2pPersistentGroupChange callback + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_Event_Test_0013', 0, async function (done) { + let p2pGroupState = "p2pPersistentGroupChange"; + let p2pPersistentGroupChangeCallback = () => { + console.info("[wifi_test]p2pPersistentGroupChange callback, result: " + JSON.stringify(result)); + } + wifi.on(p2pGroupState, p2pPersistentGroupChangeCallback); + let WifiP2PConfig = { + deviceAddress : "00:00:00:00:00:00", + netId : -2, + passphrase : "12345678", + groupName : "AAAZZZ123", + goBand : 0, + }; + let createGroupResult = wifi.createGroup(WifiP2PConfig); + await (2000); + console.info("[wifi_test] test createGroup result." + createGroupResult) + expect(createGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + let resultLength = Object.keys(data).length; + console.info("[wifi_test] getCurrentGroup promise result -> " + JSON.stringify(data)); + expect(true).assertEqual(resultLength!=0); + }); + wifi.off(p2pGroupState, p2pPersistentGroupChangeCallback); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_Event_Test_0011 + * @tc.name testpp2pDiscoveryChange + * @tc.desc Test p2pDiscoveryChange callback + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_Event_Test_0011', 0, async function (done) { + let p2pPeerDeviceState = "p2pDiscoveryChange"; + let p2pDiscoveryChangeCallback = result => { + console.info("[wifi_test]p2pDiscoveryChange callback, result: " + JSON.stringify(result)); + } + wifi.on(p2pPeerDeviceState, p2pDiscoveryChangeCallback); + let startDiscover = wifi.startDiscoverDevices(); + await sleep(3000); + expect(startDiscover).assertTrue(); + let stopDiscover = wifi.stopDiscoverDevices(); + console.info("[wifi_test] test stopDiscoverDevices result." + stopDiscover); + wifi.off(p2pPeerDeviceState, p2pDiscoveryChangeCallback); + done(); + }) + console.log("*************[wifi_test] start wifi js unit test end*************"); + }) +} diff --git a/communication/wifi_p2p/src/main/js/test/WifiP2PFunction.test.js b/communication/wifi_p2p/src/main/js/test/WifiP2PFunction.test.js new file mode 100644 index 0000000000000000000000000000000000000000..fcb56e62388e75aeb24f4a39605764b4c279b9f1 --- /dev/null +++ b/communication/wifi_p2p/src/main/js/test/WifiP2PFunction.test.js @@ -0,0 +1,592 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' + +import wifi from '@ohos.wifi' + +function sleep(delay) { + return new Promise(resovle => setTimeout(resovle, delay)) +} + +function checkWifiPowerOn(){ + console.info("[wifi_test]/wifi status:" + wifi.isWifiActive()); +} + +let groupOwnerBand = { + GO_BAND_AUTO : 0, + GO_BAND_2GHZ : 1, + GO_BAND_5GHZ : 2, +} + +export default function actsWifiFunctionTest() { + describe('actsWifiFunctionTest', function () { + beforeEach(function () { + console.info("[wifi_test]beforeEach start" ); + checkWifiPowerOn(); + }) + afterEach(async function () { + console.info("[wifi_test]afterEach start" ); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_P2P_0003 + * @tc.name testCreateGroup + * @tc.desc Test createGroup and getCurrentGroup API Function + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_XTS_P2P_0003', 0, async function(done) { + let wifiP2PConfig = { + deviceAddress : "00:00:00:00:00:00", + netId : -1, + passphrase : "12345678", + groupName : "AAAZZZ123", + goBand : groupOwnerBand.GO_BAND_2GHZ, + }; + console.log("[wifi_test]check the state of wifi: " + wifi.isWifiActive()); + expect(wifi.isWifiActive()).assertTrue(); + let createGroupResult = wifi.createGroup(wifiP2PConfig); + console.log("[wifi_test]createGroup result: " + JSON.stringify(createGroupResult)); + await sleep(2000); + expect(createGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + console.info("[wifi_test]getCurrentGroup promise result -> " + JSON.stringify(data)); + expect(true).assertEqual(data.groupName == wifiP2PConfig.groupName); + }); + function getCurrentGroupResult(){ + return new Promise((resolve, reject) => { + wifi.getCurrentGroup( + (err, result) => { + if(err) { + console.info("[wifi_test]failed to get getCurrentGroup:" + JSON.stringify(err)); + expect().assertFail(); + } + console.info("[wifi_test]getCurrentGroup callback:" + JSON.stringify(result)); + console.info("isP2pGo: " + result.isP2pGo + + "deviceName: " + result.ownerInfo.deviceName + + "deviceAddress: " + result.ownerInfo.deviceAddress + + "primaryDeviceType: " + result.ownerInfo.primaryDeviceType + + "deviceStatus: " + result.ownerInfo.deviceStatus + + "groupCapabilitys: " + result.ownerInfo.groupCapabilitys + + "passphrase: " + result.passphrase + "interface: "+ result.interface + + "groupName: " + result.groupName + + "frequency: " + result.frequency + "goIpAddress: " + result.goIpAddress); + resolve(); + }); + }); + } + await getCurrentGroupResult(); + let removeGroupResult = wifi.removeGroup(); + await sleep(2000); + expect(removeGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + console.info("[wifi_test] getCurrentGroup promise result1 :" + JSON.stringify(data)); + expect(true).assertEqual(data.deviceName == null); + }); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_P2P_0004 + * @tc.name testCreateGroup + * @tc.desc Test createGroup-Setting a 7-bit Key Function. + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_XTS_P2P_0004', 0, async function (done) { + console.log("[wifi_test]check the state of wifi: " + wifi.isWifiActive()); + expect(wifi.isWifiActive()).assertTrue(); + let wifiP2PConfig = { + deviceAddress: "00:00:00:00:00:00", + netId: -1, + passphrase: "1234567", + groupName: "test_pass", + goBand: groupOwnerBand.GO_BAND_2GHZ, + }; + let createGroupResult = wifi.createGroup(wifiP2PConfig); + console.info("[wifi_test]test createGroup end." + JSON.stringify(createGroupResult)); + await sleep(2000); + expect(createGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + let resultLength = Object.keys(data).length; + console.info("[wifi_test] getCurrentGroup promise result :" + JSON.stringify(data)); + expect(true).assertEqual(data.networkId == -999); + }); + let removeGroupResult = wifi.removeGroup(); + await sleep(2000); + expect(removeGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + console.info("[wifi_test] getCurrentGroup promise result1 :" + JSON.stringify(data)); + expect(true).assertEqual(data.deviceName == null); + }); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_P2P_0104 + * @tc.name testCreateGroup + * @tc.desc Test createGroup-Key setting: Chinese, English, and characters Function. + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_XTS_P2P_0104', 0, async function (done) { + console.log("[wifi_test]check the state of wifi: " + wifi.isWifiActive()); + expect(wifi.isWifiActive()).assertTrue(); + let wifiP2PConfig = { + deviceAddress: "00:00:00:00:00:00", + netId: -1, + passphrase: "123@%abcD", + groupName: "test_pass1", + goBand: groupOwnerBand.GO_BAND_2GHZ, + }; + let createGroupResult = wifi.createGroup(wifiP2PConfig); + console.info("[wifi_test]test createGroup end." + JSON.stringify(createGroupResult)); + await sleep(2000); + expect(createGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + console.info("[wifi_test]getCurrentGroup promise result : " + JSON.stringify(data)); + expect(true).assertEqual(data.passphrase == wifiP2PConfig.passphrase); + }); + let removeGroupResult = wifi.removeGroup(); + await sleep(2000); + expect(removeGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + console.info("[wifi_test] getCurrentGroup promise result1 :" + JSON.stringify(data)); + expect(true).assertEqual(data.deviceName == null); + }); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_P2P_0204 + * @tc.name testCreateGroup + * @tc.desc Test createGroup-Key setting 64 bit Function. + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_XTS_P2P_0204', 0, async function (done) { + console.log("[wifi_test]check the state of wifi: " + wifi.isWifiActive()); + expect(wifi.isWifiActive()).assertTrue(); + let wifiP2PConfig = { + deviceAddress: "00:00:00:00:00:00", + netId: -1, + passphrase: "abc345678901234567890123456789012345678901234567890123456789012", + groupName: "test_pass2", + goBand: groupOwnerBand.GO_BAND_2GHZ, + }; + let createGroupResult = wifi.createGroup(wifiP2PConfig); + console.info("[wifi_test]test createGroup end." + JSON.stringify(createGroupResult)); + await sleep(2000); + expect(createGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + console.info("[wifi_test]getCurrentGroup promise result : " + JSON.stringify(data)); + expect(true).assertEqual(data.passphrase == wifiP2PConfig.passphrase); + }); + let removeGroupResult = wifi.removeGroup(); + await sleep(2000); + expect(removeGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + console.info("[wifi_test] getCurrentGroup promise result1 :" + JSON.stringify(data)); + expect(true).assertEqual(data.deviceName == null); + }); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_P2P_0304 + * @tc.name testCreateGroup + * @tc.desc Test createGroup-Key setting 65 bitsFunction. + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_XTS_P2P_0304', 0, async function (done) { + console.log("[wifi_test]check the state of wifi: " + wifi.isWifiActive()); + expect(wifi.isWifiActive()).assertTrue(); + let wifiP2PConfig = { + deviceAddress: "00:00:00:00:00:00", + netId: -1, + passphrase: "abc3456789012345678901234567890123456789012345678901234567890123", + groupName: "test_pass3", + goBand: groupOwnerBand.GO_BAND_2GHZ, + }; + let createGroupResult = wifi.createGroup(wifiP2PConfig); + console.info("[wifi_test]test createGroup end." + JSON.stringify(createGroupResult)); + await sleep(2000); + expect(createGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + console.info("[wifi_test]getCurrentGroup promise result :" + JSON.stringify(data)); + expect(true).assertEqual(data.passphrase != wifiP2PConfig.passphrase); + }); + let removeGroupResult = wifi.removeGroup(); + await sleep(2000); + expect(removeGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + console.info("[wifi_test] getCurrentGroup promise result1 :" + JSON.stringify(data)); + expect(true).assertEqual(data.deviceName == null); + }); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_P2P_0007 + * @tc.name testCreateGroup + * @tc.desc Test createGroup-2.4 GHz frequency band setting Function + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_Communication_WiFi_XTS_P2P_0007', 0, async function(done) { + console.log("[wifi_test]check the state of wifi: " + wifi.isWifiActive()); + expect(wifi.isWifiActive()).assertTrue(); + let wifiP2PConfig = { + deviceAddress : "00:00:00:00:00:00", + netId : -1, + passphrase : "12345678", + groupName : "test_band1", + goBand : groupOwnerBand.GO_BAND_2GHZ, + }; + let createGroupResult = wifi.createGroup(wifiP2PConfig); + await sleep(2000); + console.info("[wifi_test] test createGroup result." + createGroupResult) + expect(createGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + console.info("[wifi_test]getCurrentGroup promise result :" + JSON.stringify(data)); + expect(true).assertEqual(data.frequency == 2412); + }); + let removeGroupResult = wifi.removeGroup(); + await sleep(2000); + expect(removeGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + console.info("[wifi_test] getCurrentGroup promise result1 :" + JSON.stringify(data)); + expect(true).assertEqual(data.deviceName == null); + }); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_P2P_0107 + * @tc.name testCreateGroup + * @tc.desc Test createGroup-5 GHz frequency band setting Function + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_Communication_WiFi_XTS_P2P_0107', 0, async function(done) { + console.log("[wifi_test]check the state of wifi: " + wifi.isWifiActive()); + expect(wifi.isWifiActive()).assertTrue(); + try { + let wifiP2PConfig = { + deviceAddress : "00:00:00:00:00:00", + netId : -1, + passphrase : "12345678", + groupName : "test_band2", + goBand : groupOwnerBand.GO_BAND_5GHZ, + }; + let createGroupResult = wifi.createGroup(wifiP2PConfig); + await sleep(2000); + console.info("[wifi_test]test createGroup result." + createGroupResult) + expect(createGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + console.info("[wifi_test] getCurrentGroup promise result :" + JSON.stringify(data)); + expect(true).assertEqual(data.frequency == 5745); + }); + let removeGroupResult = await wifi.removeGroup(); + await sleep(2000); + expect(removeGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + console.info("[wifi_test] getCurrentGroup promise result1 :" + JSON.stringify(data)); + expect(true).assertEqual(data.deviceName == null); + }); + }catch(error){ + console.info("[wifi_test]createGroup 5G goBand result : " + JSON.stringify(error.message)); + expect(true).assertEqual( (JSON.stringify(error.message)) !=null); + } + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_P2P_0207 + * @tc.name testCreateGroup + * @tc.desc Test createGroup-Auto frequency band setting Function + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_Communication_WiFi_XTS_P2P_0207', 0, async function(done) { + console.log("[wifi_test]check the state of wifi: " + wifi.isWifiActive()); + expect(wifi.isWifiActive()).assertTrue(); + try { + let wifiP2PConfig = { + deviceAddress : "00:00:00:00:00:00", + netId : -1, + passphrase : "12345678", + groupName : "test_band3", + goBand : groupOwnerBand.GO_BAND_AUTO, + }; + let createGroupResult = wifi.createGroup(wifiP2PConfig); + await sleep(2000); + console.info("[wifi_test]test createGroup result." + createGroupResult) + expect(createGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + console.info("[wifi_test]getCurrentGroup promise result : " + JSON.stringify(data)); + expect(true).assertEqual(data.frequency != null ); + }); + let removeGroupResult = await wifi.removeGroup(); + await sleep(2000); + expect(removeGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + console.info("[wifi_test] getCurrentGroup promise result1 :" + JSON.stringify(data)); + expect(true).assertEqual(data.deviceName == null); + }); + }catch(error){ + console.info("[wifi_test]createGroup auto goBand result : " + JSON.stringify(error.message)); + expect(true).assertEqual( (JSON.stringify(error.message)) !=null); + } + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_P2P_0009 + * @tc.name testP2pCancelConnect + * @tc.desc Test p2pCancelConnect Group API functionality. + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_XTS_P2P_0009', 0, async function (done) { + let wifiP2PConfig = { + deviceAddress : "00:00:00:00:00:00", + netId : -1, + passphrase : "12345678", + groupName : "AAAZZZ456", + goBand : groupOwnerBand.GO_BAND_2GHZ, + }; + let p2pConnectResult = wifi.p2pConnect(wifiP2PConfig); + console.info("[wifi_test]test p2pConnect result." + p2pConnectResult); + let p2pCancelResult = wifi.p2pCancelConnect(); + await sleep(2000); + console.info("[wifi_test]test p2pCancelConnect result." + p2pCancelResult); + expect(p2pCancelResult).assertTrue(); + let removeGroupResult = wifi.removeGroup(); + console.info("[wifi_test]test start removeGroup:" + removeGroupResult); + expect(removeGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + console.info("[wifi_test] getCurrentGroup promise result1 :" + JSON.stringify(data)); + expect(true).assertEqual(data.deviceName == null); + }); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_P2P_0011 + * @tc.name testRemoveGroup + * @tc.desc Test remove a nonexistent group. + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_XTS_P2P_0011', 0, async function (done) { + let removeGroupResult = wifi.removeGroup(10000); + console.info("[wifi_test]removeGroup(10000) result : " + JSON.stringify(removeGroupResult)); + expect(removeGroupResult).assertTrue(); + await wifi.getCurrentGroup() + .then(data => { + console.info("[wifi_test] getCurrentGroup promise result1 :" + JSON.stringify(data)); + expect(true).assertEqual(data.deviceName == null); + }); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_P2P_0002 + * @tc.name testP2pLocalDevice + * @tc.desc Test get P2pLocalDevice API functionality. + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_XTS_P2P_0002', 0, async function (done) { + await wifi.getP2pLocalDevice() + .then(data => { + console.info("[wifi_test]getP2pLocalDevice promise result :" + JSON.stringify(data)); + expect(true).assertEqual(data.deviceName !=null); + }).catch((error) => { + console.info("[wifi_test]getP2pLocalDevice promise error." + JSON.stringify(error)); + expect().assertFail(); + }); + function getP2pLocal(){ + return new Promise((resolve, reject) => { + wifi.getP2pLocalDevice( + (err, ret) => { + if(err) { + console.info("[wifi_test]getP2pLocalDevice callback failed : " + JSON.stringify(err)); + return; + } + console.info("[wifi_test]getP2pLocalDevice callback result: " + JSON.stringify(ret)); + console.info("deviceName: " + ret.deviceName + "deviceAddress: " + + ret.deviceAddress + "primaryDeviceType: " + ret.primaryDeviceType + + "deviceStatus: " + ret.deviceStatus + "groupCapabilitys: " + + ret.groupCapabilitys ); + resolve(); + }); + }); + } + await getP2pLocal(); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_P2P_0010 + * @tc.name testGetP2pLinkedInfo + * @tc.desc Test getP2pLinkedInfo API functionality + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_Communication_WiFi_XTS_P2P_0010', 0, async function(done) { + let p2pConnectState = { + DISCONNECTED :0, + CONNECTED : 1, + }; + await wifi.getP2pLinkedInfo() + .then(data => { + let resultLength = Object.keys(data).length; + console.info("[wifi_test]getP2pLinkedInfo promise result :" + JSON.stringify(data)); + expect(true).assertEqual(resultLength!=0); + done() + }); + function getP2pLinkedInfoResult(){ + return new Promise((resolve, reject) => { + wifi.getP2pLinkedInfo( + (err, result) => { + if(err) { + console.info("[wifi_test]failed to getP2pLinkedInfo callback:" + JSON.stringify(err)); + return; + } + let resultLength = Object.keys(result).length; + console.info("[wifi_test]getP2pLinkedInfo callback:" + JSON.stringify(resultLength)); + console.info("connectState: " + result.connectState + + "isGroupOwner: " + result.isGroupOwner + + "groupOwnerAddr: " + result.groupOwnerAddr); + expect(true).assertEqual(resultLength!=0); + resolve(); + }); + }); + } + await getP2pLinkedInfoResult(); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_P2P_0001 + * @tc.name testGetP2pPeerDevices + * @tc.desc Test getP2pPeerDevices promise API functionality + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_Communication_WiFi_XTS_P2P_0001', 0, async function(done){ + console.log("[wifi_test]check the state of wifi: " + wifi.isWifiActive()); + expect(wifi.isWifiActive()).assertTrue(); + let startDiscover = wifi.startDiscoverDevices(); + await sleep(2000); + expect(startDiscover).assertTrue(); + await wifi.getP2pPeerDevices() + .then((data) => { + let resultLength = Object.keys(data).length; + console.info("[wifi_test]getP2pPeerDevices promise result -> " + JSON.stringify(data)); + expect(true).assertEqual(resultLength >= 0); + }).catch((error) => { + console.info("[wifi_test]getP2pPeerDevices promise then error." + JSON.stringify(error)); + expect().assertFail(); + }); + let stopDiscover = wifi.stopDiscoverDevices(); + console.info("[wifi_test]test stopDiscoverDevices result." + stopDiscover); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_P2P_0101 + * @tc.name testGetP2pPeerDevices + * @tc.desc Test getP2pPeerDevices callback API functionality + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_Communication_WiFi_XTS_P2P_0101', 0, async function(done){ + let p2pDeviceStatus = { + CONNECTED : 0, + INVITED : 1, + FAILED : 2, + AVAILABLE : 3, + UNAVAILABLE : 4, + }; + console.log("[wifi_test]check the state of wifi: " + wifi.isWifiActive()); + expect(wifi.isWifiActive()).assertTrue(); + let startDiscover = wifi.startDiscoverDevices(); + await sleep(2000); + expect(startDiscover).assertTrue(); + + function getP2pPeerDevicesResult(){ + return new Promise((resolve, reject) => { + wifi.getP2pPeerDevices( + (err, result) => { + if(err) { + console.error('[wifi_test]failed to getP2pPeerDevices :' + JSON.stringify(err)); + } + console.info("[wifi_test] getP2pPeerDevices callback result :" + JSON.stringify(result)); + let len = Object.keys(result).length; + for (let j = 0; j < len; ++j) { + console.info("deviceName: " + result[j].deviceName + + "deviceAddress: " + result[j].deviceAddress + + "primaryDeviceType: " + result[j].primaryDeviceType + + "deviceStatus: " + result[j].deviceStatus + + "groupCapabilitys: " + result[j].groupCapabilitys ); + if(result[j].deviceStatus ==p2pDeviceStatus.UNAVAILABLE){ + console.info("deviceStatus: " + result[j].deviceStatus); + } + if(result[j].deviceStatus ==p2pDeviceStatus.CONNECTED){ + console.info("deviceStatus: " + result[j].deviceStatus); + } + if(result[j].deviceStatus ==p2pDeviceStatus.INVITED){ + console.info("deviceStatus: " + result[j].deviceStatus); + } + if(result[j].deviceStatus ==p2pDeviceStatus.FAILED){ + console.info("deviceStatus: " + result[j].deviceStatus); + } + if(result[j].deviceStatus ==p2pDeviceStatus.AVAILABLE){ + console.info("deviceStatus: " + result[j].deviceStatus); + } + } + resolve(); + }); + }); + } + await getP2pPeerDevicesResult(); + done(); + }); + console.log("*************[wifi_test] start wifi js unit test end*************"); + }) +} + diff --git a/communication/wifi_standard/BUILD.gn b/communication/wifi_standard/BUILD.gn index 2b257dfa97f7efab9fc33558b4052febf59dda87..6087817593db232f813c5a166d4335fbabc106ee 100644 --- a/communication/wifi_standard/BUILD.gn +++ b/communication/wifi_standard/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/communication/wifi_standard/src/main/config.json b/communication/wifi_standard/src/main/config.json index 23109ec513cd3f201d9560602865e35c0a8c20ca..66c9ac984d8dcc8f2396ccc4121fb700d6cee425 100644 --- a/communication/wifi_standard/src/main/config.json +++ b/communication/wifi_standard/src/main/config.json @@ -17,6 +17,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/communication/wifi_standard/src/main/js/test/List.test.js b/communication/wifi_standard/src/main/js/test/List.test.js index a815a54b3ae5747ed1470ff0eec59ed4f9378e69..1e7e3fd6c6bcf139c0ae9ec860bad5295e816e92 100644 --- a/communication/wifi_standard/src/main/js/test/List.test.js +++ b/communication/wifi_standard/src/main/js/test/List.test.js @@ -12,10 +12,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import actsWifiTestNew from './WifiJsunit.test1.js' -import actsWifiTest from './WifiJsunit.testsame.js' +import actsWifiCandidateNetWorkTest from './WifiCandidateNetWork.test.js' +import actsWifiFunctionsTest from './WifiStationFunctions.test.js' +import actsWifiEventTest from './WifiStationEvent.test.js' export default function testsuite() { -actsWifiTestNew() -actsWifiTest() +actsWifiCandidateNetWorkTest() +actsWifiFunctionsTest() +actsWifiEventTest() } + diff --git a/communication/wifi_standard/src/main/js/test/WifiCandidateNetWork.test.js b/communication/wifi_standard/src/main/js/test/WifiCandidateNetWork.test.js new file mode 100644 index 0000000000000000000000000000000000000000..15ee2673e10b484a355f973bf41744dec89075e3 --- /dev/null +++ b/communication/wifi_standard/src/main/js/test/WifiCandidateNetWork.test.js @@ -0,0 +1,445 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' +import wifi from '@ohos.wifi' + +function sleep(delay) { + return new Promise(resovle => setTimeout(resovle, delay)) +} + +function checkWifiPowerOn(){ + console.info("[wifi_test]wifi status:" + wifi.isWifiActive()); +} + +function resolveIP(ip) { + return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF) + "." + (ip>>8 & 0xFF) + "." + (ip & 0xFF); +} + +let wifiSecurityType = { + WIFI_SEC_TYPE_INVALID: 0, + WIFI_SEC_TYPE_OPEN: 1, + WIFI_SEC_TYPE_WEP: 2, + WIFI_SEC_TYPE_PSK: 3, + WIFI_SEC_TYPE_SAE: 4, +} + +let connState = { + SCANNING: 0, + CONNECTING: 1, + AUTHENTICATING: 2, + OBTAINING_IPADDR: 3, + CONNECTED: 4, + DISCONNECTING: 5, + DISCONNECTED: 6, + UNKNOWN: 7, +} + +let wifiChannelWidth = { + WIDTH_20MHZ : 0, + WIDTH_40MHZ : 1, + WIDTH_80MHZ : 2, + WIDTH_160MHZ : 3, + WIDTH_80MHZ_PLUS : 4, + WIDTH_INVALID:null, +} + +export default function actsWifiCandidateNetWorkTest() { + describe('actsWifiCandidateNetWorkTest', function () { + beforeEach(function () { + checkWifiPowerOn(); + }) + afterEach(function () { + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_CandidateNetWork_0001 + * @tc.name testaddCandidateConfig + * @tc.desc Test add OPEN and WEP CandidateConfig Promise API functionality. + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_Communication_WiFi_XTS_CandidateNetWork_0001', 0, async function (done) { + let wifiDeviceConfig = { + "ssid": "TEST_OPEN", + "bssid": "", + "preSharedKey": "", + "isHiddenSsid": false, + "securityType": wifiSecurityType.WIFI_SEC_TYPE_OPEN, + }; + await wifi.addCandidateConfig(wifiDeviceConfig) + .then(netWorkId => { + console.info("[wifi_test]add OPEN CandidateConfig promise : " + JSON.stringify(netWorkId)); + expect(true).assertEqual(netWorkId = -1); + }).catch((error) => { + console.error('[wifi_test]add OPEN CandidateConfig promise failed -> ' + JSON.stringify(error)); + expect(false).assertFalse(); + }); + + let getconfig = wifi.getCandidateConfigs(); + console.info("[wifi_test]wifi get OPEN CandidateConfigs result : " + JSON.stringify(getconfig)); + + let wifiDeviceConfig1 = { + "ssid": "TEST_WEP", + "bssid": "", + "preSharedKey": "ABCDEF1234", + "isHiddenSsid": false, + "securityType": wifiSecurityType.WIFI_SEC_TYPE_WEP, + }; + + await wifi.addCandidateConfig(wifiDeviceConfig1) + .then(netWorkId => { + console.info("[wifi_test]add WEP CandidateConfig promise : " + JSON.stringify(netWorkId)); + expect(true).assertEqual(netWorkId = -1); + }).catch((error) => { + console.error('[wifi_test]add WEP CandidateConfig promise failed -> ' + JSON.stringify(error)); + expect(false).assertFalse(); + }); + console.info("[wifi_test]wifi get WEP CandidateConfigs result : " + JSON.stringify(getconfig)); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_CandidateNetWork_0002 + * @tc.name testaddCandidateConfig + * @tc.desc Test add PSK CandidateConfig and removeCandidateConfig Promise API functionality. + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_Communication_WiFi_XTS_CandidateNetWork_0002', 0, async function (done) { + let wifiDeviceConfig = { + "ssid": "TEST_PSK", + "bssid": "", + "preSharedKey": "12345678", + "isHiddenSsid": false, + "securityType": wifiSecurityType.WIFI_SEC_TYPE_PSK, + "netId": -1, + "ipType": 1, + "creatorUid": 7, + "disableReason": 0, + "randomMacType": 0, + "randomMacAddr": "11:22:33:44:55:66", + "staticIp": {"ipAddress": 1284752956,"gateway": 1284752936}, + }; + await wifi.addCandidateConfig(wifiDeviceConfig) + .then(netWorkId => { + console.info("[wifi_test]add PSK CandidateConfig promise : " + JSON.stringify(netWorkId)); + expect(true).assertEqual(netWorkId != -1); + }).catch((error) => { + console.error('[wifi_test]add PSK CandidateConfig promise failed -> ' + JSON.stringify(error)); + expect().assertFail(); + }); + let getCandidateResult = wifi.getCandidateConfigs(); + console.info("[wifi_test]wifi get PSK CandidateConfigs result : " + JSON.stringify(getCandidateResult)); + var networkId = getCandidateResult[0].netId; + console.info("[wifi_test]wifi get networkId result : " + JSON.stringify(networkId)); + await wifi.removeCandidateConfig(networkId) + .then(ret => { + console.info("[wifi_test]remove CandidateConfig promise:" + JSON.stringify(ret)); + expect(false).assertFalse(); + let getCandidate = wifi.getCandidateConfigs(); + console.info("[wifi_test]wifi get CandidateConfigs result : " + JSON.stringify(getCandidate)); + console.info("[wifi_test]wifi getconfig.length result : " + JSON.stringify(getCandidate.length)); + expect(true).assertEqual(getCandidate.length == 0); + }).catch((error) => { + console.error('[wifi_test]remove CandidateConfig promise failed : ' + JSON.stringify(error)); + expect().assertFail(); + }); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_CandidateNetWork_0003 + * @tc.name testaddCandidateConfig + * @tc.desc Test add SAE CandidateConfig Promise API functionality. + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_Communication_WiFi_XTS_CandidateNetWork_0003', 0, async function (done) { + let wifiDeviceConfig = { + "ssid": "TEST_SAE", + "bssid": "", + "preSharedKey": "12345678", + "isHiddenSsid": false, + "securityType": wifiSecurityType.WIFI_SEC_TYPE_SAE, + }; + await wifi.addCandidateConfig(wifiDeviceConfig) + .then(netWorkId => { + console.info("[wifi_test]add SAE CandidateConfig promise : " + JSON.stringify(netWorkId)); + expect(true).assertEqual(netWorkId != -1); + }).catch((error) => { + console.error('[wifi_js]add SAE CandidateConfig promise failed -> ' + JSON.stringify(error)); + }); + let getCandidateResult = wifi.getCandidateConfigs(); + console.info("[wifi_test]wifi get SAE CandidateConfigs result : " + JSON.stringify(getCandidateResult)); + var networkId = getCandidateResult[0].netId; + console.info("[wifi_test]wifi get networkId result : " + JSON.stringify(networkId)); + await wifi.removeCandidateConfig(networkId) + .then(ret => { + console.info("[wifi_test]remove CandidateConfig promise" + JSON.stringify(ret)); + expect(false).assertFalse(); + let getconfig1 = wifi.getCandidateConfigs(); + console.info("[wifi_test]wifi get CandidateConfigs result : " + JSON.stringify(getconfig1)); + console.info("[wifi_test]wifi getconfig.length result : " + JSON.stringify(getconfig1.length)); + expect(true).assertEqual(getconfig1.length == 0); + }).catch((error) => { + console.error('[wifi_test]remove CandidateConfig promise failed -> ' + JSON.stringify(error)); + expect().assertFail(); + }); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_CandidateNetWork_0004 + * @tc.name testaddCandidateConfig + * @tc.desc Test add MAX CandidateConfig and removeall CandidateConfig. + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_Communication_WiFi_XTS_CandidateNetWork_0004', 0, async function (done) { + let SSID = "TYPE_PSK" + for (let i = 0; i < 16; i++) { + SSID = "TYPE_PSK" + i + console.info("[wifi_test] get canshu result : "); + let wifiDeviceConfig = { + "ssid": SSID, + "bssid": "", + "preSharedKey": "12345678", + "isHiddenSsid": false, + "securityType": wifiSecurityType.WIFI_SEC_TYPE_PSK, + }; + console.info("[wifi_test]get wifiDeviceConfig ssid result : " + JSON.stringify(wifiDeviceConfig.ssid)); + await wifi.addCandidateConfig(wifiDeviceConfig) + .then(netWorkId => { + console.info("[wifi_test]add 16th CandidateConfig promise : " + JSON.stringify(netWorkId)); + expect(true).assertEqual(netWorkId != -1); + }).catch((error) => { + console.error('[wifi_test]add 16th CandidateConfig promise failed :' + JSON.stringify(error)); + expect().assertFail(); + }); + } + let wifiDeviceConfig1 = { + "ssid": "TYPE_17", + "bssid": "", + "preSharedKey": "12345678", + "isHiddenSsid": false, + "securityType": wifiSecurityType.WIFI_SEC_TYPE_PSK, + }; + await wifi.addCandidateConfig(wifiDeviceConfig1) + .then(netWorkId => { + console.info("[wifi_test]add 17th CandidateConfig promise : " + JSON.stringify(netWorkId)); + expect(true).assertEqual(netWorkId != -1); + }).catch((error) => { + console.error('[wifi_test]add 17th CandidateConfig promise failed -> ' + JSON.stringify(error)); + expect(true).assertEqual(error == -1); + }); + let getCandidateResult = wifi.getCandidateConfigs(); + console.info("[wifi_test]wifi get 16 CandidateConfigs result : " + JSON.stringify(getCandidateResult)); + for (let i = 0; i < 16; i++) { + var networkId = getCandidateResult[i].netId; + console.info("[wifi_test]wifi get networkId result : " + JSON.stringify(networkId)); + await wifi.removeCandidateConfig(networkId) + .then(ret => { + console.info("[wifi_test]remove CandidateConfig promise" + JSON.stringify(ret)); + let getconfig1 = wifi.getCandidateConfigs(); + console.info("[wifi_test] wifi get CandidateConfigs result : " + JSON.stringify(getconfig1)); + console.info("[wifi_test] wifi getconfiglength result : " + JSON.stringify(getconfig1.length)); + }).catch((error) => { + console.error('[wifi_test]remove CandidateConfig promise failed -> ' + JSON.stringify(error)); + }); + } + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_CandidateNetWork_0005 + * @tc.name testaddCandidateConfig + * @tc.desc Test add CandidateConfig and removeCandidateConfig callback API functionality. + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_Communication_WiFi_XTS_CandidateNetWork_0005', 0, async function (done) { + let wifiDeviceConfig = { + "ssid": "TYPE_PSK1", + "bssid": "", + "preSharedKey": "12345678", + "isHiddenSsid": false, + "securityType": wifiSecurityType.WIFI_SEC_TYPE_PSK, + } + + function addCandidate() { + return new Promise((resolve, reject) => { + wifi.addCandidateConfig(wifiDeviceConfig, + (err, netWorkId) => { + if (err) { + console.info("[wifi_test]add CandidateConfig callback failed : " + JSON.stringify(err)); + } + console.info("[wifi_test]addCandidateConfig callback result: " + JSON.stringify(netWorkId)); + expect(true).assertEqual(netWorkId != -1); + resolve(); + }); + }); + } + await addCandidate(); + let getCandidateResult = wifi.getCandidateConfigs(); + console.info("[wifi_test] wifi getCandidateConfigs result : " + JSON.stringify(getCandidateResult)); + var networkId = getCandidateResult[0].netId; + function removeCandidate() { + return new Promise((resolve, reject) => { + wifi.removeCandidateConfig(networkId, + (err, ret) => { + if (err) { + console.info("[wifi_test]removeCandidate callback failed : " + JSON.stringify(err)); + } + console.info("[wifi_test] removeCandidateConfig callback result:" + JSON.stringify(ret)); + expect(ret).assertTrue(); + let configs1 = wifi.getCandidateConfigs(); + console.info("[wifi_test] wifi get CandidateConfigs result : " + JSON.stringify(configs1)); + console.info("[wifi_test] getconfig.length result : " + JSON.stringify(configs1.length)); + expect(true).assertEqual(configs1.length == 0); + resolve(); + }); + }); + } + await removeCandidate(); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_CandidateNetWork_0006 + * @tc.name testaddCandidateConfig + * @tc.desc Test connect To CandidateConfig API functionality. + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_Communication_WiFi_XTS_CandidateNetWork_0006', 0, async function (done) { + let wifiSecurityType = { + WIFI_SEC_TYPE_INVALID: 0, + WIFI_SEC_TYPE_OPEN: 1, + WIFI_SEC_TYPE_WEP: 2, + WIFI_SEC_TYPE_PSK: 3, + WIFI_SEC_TYPE_SAE: 4, + } + let wifiDeviceConfig = { + "ssid": "HONOR 3000", + "bssid": "", + "preSharedKey": "12345678", + "isHiddenSsid": false, + "securityType": wifiSecurityType.WIFI_SEC_TYPE_PSK, + }; + await wifi.addCandidateConfig(wifiDeviceConfig) + .then(netWorkId => { + console.info("[wifi_test]add CandidateConfig promise : " + JSON.stringify(netWorkId)); + expect(true).assertEqual(netWorkId != -1); + }).catch((error) => { + console.error('[wifi_test]add CandidateConfig promise failed -> ' + JSON.stringify(error)); + expect().assertFail(); + }); + let getCandidateResult = wifi.getCandidateConfigs(); + console.info("[wifi_test]wifi get CandidateConfigs result : " + JSON.stringify(getCandidateResult)); + let connectToCandidateResult = wifi.connectToCandidateConfig(getCandidateResult[0].netId); + console.info("[wifi_test]connect To CandidateConfig result : " + JSON.stringify(connectToCandidateResult)); + await sleep(3000); + await wifi.getLinkedInfo() + .then((result) => { + console.info("[wifi_test]get wifi link [promise] -> " + JSON.stringify(result)); + done(); + }).catch((error) => { + console.info("[wifi_test]promise then error." + JSON.stringify(error)); + expect().assertFail(); + }); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_UntrustedConfig_0001 + * @tc.name testaddUntrustedConfig + * @tc.desc Test add UntrustedConfig and removeUntrustedConfig Promise API functionality. + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_Communication_WiFi_XTS_UntrustedConfig_0001', 0, async function (done) { + let wifiDeviceConfig = { + "ssid": "TEST_PSK", + "bssid": "", + "preSharedKey": "12345678", + "isHiddenSsid": false, + "securityType": wifiSecurityType.WIFI_SEC_TYPE_PSK, + }; + await wifi.addUntrustedConfig(wifiDeviceConfig) + .then(ret => { + console.info("[wifi_test]addUntrustedConfig promise : " + JSON.stringify(ret)); + expect(ret).assertTrue(); + }).catch((error) => { + console.error('[wifi_test]addUntrustedConfig promise failed -> ' + JSON.stringify(error)); + }); + await wifi.removeUntrustedConfig(wifiDeviceConfig) + .then(ret => { + console.info("[wifi_test]removeUntrustedConfig promise:" + JSON.stringify(ret)); + expect(ret).assertTrue(); + }).catch((error) => { + console.error('[wifi_test]removeUntrustedConfig promise failed -> ' + JSON.stringify(error)); + }); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_UntrustedConfig_0002 + * @tc.name testaddUntrustedConfig + * @tc.desc Test add UntrustedConfig and removeUntrustedConfig callback API functionality. + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_Communication_WiFi_XTS_UntrustedConfig_0002', 0, async function (done) { + let wifiDeviceConfig = { + "ssid": "TYPE_PSK1", + "bssid": "", + "preSharedKey": "12345678", + "isHiddenSsid": false, + "securityType": wifiSecurityType.WIFI_SEC_TYPE_PSK, + } + function addCandidate() { + return new Promise((resolve, reject) => { + wifi.addUntrustedConfig(wifiDeviceConfig, + (err, ret) => { + if (err) { + console.info("[wifi_test]addUntrustedConfig callback failed : " + JSON.stringify(err)); + } + console.info("[wifi_test]addUntrustedConfig callback result: " + JSON.stringify(ret)); + expect(ret).assertTrue(); + resolve(); + }); + }); + } + await addCandidate(); + function removeCandidate() { + return new Promise((resolve, reject) => { + wifi.removeUntrustedConfig(wifiDeviceConfig, + (err, ret) => { + if (err) { + console.info("[wifi_test]removeUntrustedConfig callback failed" + JSON.stringify(err)); + } + console.info("[wifi_test]removeUntrustedConfig callback result:" + JSON.stringify(ret)); + expect(ret).assertTrue(); + resolve(); + }); + }); + } + await removeCandidate(); + done(); + }) + }) +} + diff --git a/communication/wifi_standard/src/main/js/test/WifiJsunit.test1.js b/communication/wifi_standard/src/main/js/test/WifiJsunit.test1.js deleted file mode 100644 index 1a88929093e60f3288fcefcd50c37d7f642c2a56..0000000000000000000000000000000000000000 --- a/communication/wifi_standard/src/main/js/test/WifiJsunit.test1.js +++ /dev/null @@ -1,455 +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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -import wifi from '@ohos.wifi' - -function sleep(delay) { - return new Promise(resovle => setTimeout(resovle, delay)) -} - -function checkWifiPowerOn(){ - console.info("wifi_test/wifi status:" + wifi.isWifiActive()); -} - -function resolveIP(ip) { - return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF) + "." + (ip>>8 & 0xFF) + "." + (ip & 0xFF); -} - -let WifiSecurityType = { - WIFI_SEC_TYPE_INVALID: 0, - WIFI_SEC_TYPE_OPEN: 1, - WIFI_SEC_TYPE_WEP: 2, - WIFI_SEC_TYPE_PSK: 3, - WIFI_SEC_TYPE_SAE: 4, -} - -let ConnState = { - SCANNING: 0, - CONNECTING: 1, - AUTHENTICATING: 2, - OBTAINING_IPADDR: 3, - CONNECTED: 4, - DISCONNECTING: 5, - DISCONNECTED: 6, - UNKNOWN: 7, -} - -let WifiChannelWidth = { - WIDTH_20MHZ : 0, - WIDTH_40MHZ : 1, - WIDTH_80MHZ : 2, - WIDTH_160MHZ : 3, - WIDTH_80MHZ_PLUS : 4, - WIDTH_INVALID:null, -} - -export default function actsWifiTestNew() { - describe('actsWifiTestNew', function () { - beforeEach(function () { - checkWifiPowerOn(); - }) - afterEach(function () { - }) - - /** - * @tc.number CandidateNetWork_0001 - * @tc.name SUB_Communication_WiFi_XTS_CandidateNetWork_0001 - * @since 9 - * @tc.desc Test add OPEN and WEP CandidateConfig Promise API functionality. - * @syscap SystemCapability.Communication.WiFi.STA - * @permission ohos.permission.SET_WIFI_INFO - */ - it('SUB_Communication_WiFi_XTS_CandidateNetWork_0001', 0, async function (done) { - let wifiDeviceConfig = { - "ssid": "TEST_OPEN", - "bssid": "", - "preSharedKey": "", - "isHiddenSsid": false, - "securityType": WifiSecurityType.WIFI_SEC_TYPE_OPEN, - }; - - await wifi.addCandidateConfig(wifiDeviceConfig) - .then(netWorkId => { - console.info("[wifi_test]add OPEN CandidateConfig promise : " + JSON.stringify(netWorkId)); - expect(true).assertEqual(netWorkId = -1); - }).catch((error) => { - console.error('[wifi_js] add OPEN CandidateConfig promise failed -> ' + JSON.stringify(error)); - expect(false).assertFalse(); - }); - - let getconfig = wifi.getCandidateConfigs(); - console.info("[wifi_test] wifi get OPEN CandidateConfigs result : " + JSON.stringify(getconfig)); - - let wifiDeviceConfig1 = { - "ssid": "TEST_WEP", - "bssid": "", - "preSharedKey": "ABCDEF1234", - "isHiddenSsid": false, - "securityType": WifiSecurityType.WIFI_SEC_TYPE_WEP, - }; - - await wifi.addCandidateConfig(wifiDeviceConfig1) - .then(netWorkId => { - console.info("[wifi_test]add WEP CandidateConfig promise : " + JSON.stringify(netWorkId)); - expect(true).assertEqual(netWorkId = -1); - }).catch((error) => { - console.error('[wifi_js] add WEP CandidateConfig promise failed -> ' + JSON.stringify(error)); - expect(false).assertFalse(); - }); - console.info("[wifi_test] wifi get WEP CandidateConfigs result : " + JSON.stringify(getconfig)); - done(); - }) - - /** - * @tc.number CandidateNetWork_0001 - * @tc.name SUB_Communication_WiFi_XTS_CandidateNetWork_0002 - * @since 8 - * @tc.desc Test add PSK CandidateConfig and removeCandidateConfig Promise API functionality. - * @syscap SystemCapability.Communication.WiFi.STA - * @permission ohos.permission.SET_WIFI_INFO - */ - it('SUB_Communication_WiFi_XTS_CandidateNetWork_0002', 0, async function (done) { - let wifiDeviceConfig = { - "ssid": "TEST_PSK", - "bssid": "", - "preSharedKey": "12345678", - "isHiddenSsid": false, - "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, - "netId": "", - }; - await wifi.addCandidateConfig(wifiDeviceConfig) - .then(netWorkId => { - console.info("[wifi_test]add PSK CandidateConfig promise : " + JSON.stringify(netWorkId)); - expect(true).assertEqual(netWorkId != -1); - }).catch((error) => { - console.error('[wifi_js] add PSK CandidateConfig promise failed -> ' + JSON.stringify(error)); - expect().assertFail(); - }); - let getconfig = wifi.getCandidateConfigs(); - console.info("[wifi_test] wifi get PSK CandidateConfigs result : " + JSON.stringify(getconfig)); - expect(true).assertEqual(getconfig[0].securityType == wifiDeviceConfig.securityType); - expect(true).assertEqual(getconfig[0].isHiddenSsid == wifiDeviceConfig.isHiddenSsid); - expect(true).assertEqual(getconfig[0].ssid == wifiDeviceConfig.ssid); - var networkId = getconfig[0].netId; - console.info("[wifi_test] wifi get networkId result : " + JSON.stringify(networkId)); - await wifi.removeCandidateConfig(networkId) - .then(ret => { - console.info("[wifi_test]remove CandidateConfig promise" + JSON.stringify(ret)); - expect(false).assertFalse(); - let getconfig1 = wifi.getCandidateConfigs(); - console.info("[wifi_test] wifi get CandidateConfigs result : " + JSON.stringify(getconfig1)); - console.info("[wifi_test] wifi getconfig.length result : " + JSON.stringify(getconfig1.length)); - expect(true).assertEqual(getconfig1.length == 0); - }).catch((error) => { - console.error('[wifi_js] remove CandidateConfig promise failed -> ' + JSON.stringify(error)); - expect().assertFail(); - }); - done(); - }) - - /** - * @tc.number CandidateNetWork_0003 - * @tc.name SUB_Communication_WiFi_XTS_CandidateNetWork_0003 - * @since 8 - * @tc.desc Test add SAE CandidateConfig Promise API functionality. - * @syscap SystemCapability.Communication.WiFi.STA - * @permission ohos.permission.SET_WIFI_INFO - */ - it('SUB_Communication_WiFi_XTS_CandidateNetWork_0003', 0, async function (done) { - let wifiDeviceConfig = { - "ssid": "TEST_SAE", - "bssid": "", - "preSharedKey": "12345678", - "isHiddenSsid": false, - "securityType": WifiSecurityType.WIFI_SEC_TYPE_SAE, - }; - await wifi.addCandidateConfig(wifiDeviceConfig) - .then(netWorkId => { - console.info("[wifi_test]add SAE CandidateConfig promise : " + JSON.stringify(netWorkId)); - expect(true).assertEqual(netWorkId = -1); - }).catch((error) => { - console.error('[wifi_js] add SAE CandidateConfig promise failed -> ' + JSON.stringify(error)); - }); - let getconfig = wifi.getCandidateConfigs(); - console.info("[wifi_test] wifi get SAE CandidateConfigs result : " + JSON.stringify(getconfig)); - done(); - }) - - /** - * @tc.number CandidateNetWork_0005 - * @tc.name SUB_Communication_WiFi_XTS_CandidateNetWork_0005 - * @since 8 - * @tc.desc Test add CandidateConfig and removeCandidateConfig callback API functionality. - * @syscap SystemCapability.Communication.WiFi.STA - * @permission ohos.permission.SET_WIFI_INFO - */ - it('SUB_Communication_WiFi_XTS_CandidateNetWork_0005', 0, async function (done) { - let wifiDeviceConfig = { - "ssid": "TYPE_PSK1", - "bssid": "", - "preSharedKey": "12345678", - "isHiddenSsid": false, - "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, - } - - function addCandidate() { - return new Promise((resolve, reject) => { - wifi.addCandidateConfig(wifiDeviceConfig, - (err, netWorkId) => { - if (err) { - console.info("[wifi_test]add CandidateConfig callback failed : " + JSON.stringify(err)); - - } - console.info("[wifi_test]addCandidateConfig callback result: " + JSON.stringify(netWorkId)); - expect(true).assertEqual(netWorkId != -1); - resolve(); - }); - }); - } - - await addCandidate(); - let configs = wifi.getCandidateConfigs(); - console.info("[wifi_test] wifi getCandidateConfigs result : " + JSON.stringify(configs)); - expect(true).assertEqual(configs[0].securityType == wifiDeviceConfig.securityType); - expect(true).assertEqual(configs[0].isHiddenSsid == wifiDeviceConfig.isHiddenSsid); - expect(true).assertEqual(configs[0].ssid == wifiDeviceConfig.ssid); - var networkId = configs[0].netId; - - function removeCandidate() { - return new Promise((resolve, reject) => { - wifi.removeCandidateConfig(networkId, - (err, ret) => { - if (err) { - console.info("[wifi_test]removeCandidate callback failed : " + JSON.stringify(err)); - - } - console.info("[wifi_test] removeCandidateConfig callback result:" + JSON.stringify(ret)); - expect(ret).assertTrue(); - let configs1 = wifi.getCandidateConfigs(); - console.info("[wifi_test] wifi get CandidateConfigs result : " + JSON.stringify(configs1)); - console.info("[wifi_test] getconfig.length result : " + JSON.stringify(configs1.length)); - expect(true).assertEqual(configs1.length == 0); - resolve(); - }); - }); - } - - await removeCandidate(); - done(); - }) - - /** - * @tc.number CandidateNetWork_0006 - * @tc.name SUB_Communication_WiFi_XTS_SUB_Communication_WiFi_XTS_CandidateNetWork_0006 - * @tc.desc Test connect To CandidateConfig API functionality. - * @since 9 - * @syscap SystemCapability.Communication.WiFi.STA - * @permission ohos.permission.SET_WIFI_INFO - */ - it('SUB_Communication_WiFi_XTS_CandidateNetWork_0006', 0, async function (done) { - let WifiSecurityType = { - WIFI_SEC_TYPE_INVALID: 0, - WIFI_SEC_TYPE_OPEN: 1, - WIFI_SEC_TYPE_WEP: 2, - WIFI_SEC_TYPE_PSK: 3, - WIFI_SEC_TYPE_SAE: 4, - } - let wifiDeviceConfig = { - "ssid": "HONOR 3000", - "bssid": "", - "preSharedKey": "12345678", - "isHiddenSsid": false, - "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, - }; - await wifi.addCandidateConfig(wifiDeviceConfig) - .then(netWorkId => { - console.info("[wifi_test]add CandidateConfig promise : " + JSON.stringify(netWorkId)); - expect(true).assertEqual(netWorkId != -1); - }).catch((error) => { - console.error('[wifi_js] add CandidateConfig promise failed -> ' + JSON.stringify(error)); - expect().assertFail(); - }); - let getconfig = wifi.getCandidateConfigs(); - console.info("[wifi_test] wifi get CandidateConfigs result : " + JSON.stringify(getconfig)); - let connectToCandidate = wifi.connectToCandidateConfig(getconfig[0].netId); - console.info("[wifi_test] connect To CandidateConfig result : " + JSON.stringify(connectToCandidate)); - await sleep(3000); - await wifi.getLinkedInfo() - .then((result) => { - console.info("[wifi_test] get wifi link [promise] -> " + JSON.stringify(result)); - expect(JSON.stringify(result)).assertContain('band'); - done(); - }).catch((error) => { - console.info("[wifi_test] promise then error." + JSON.stringify(error)); - expect().assertFail(); - }); - done(); - }) - - - /** - * @tc.number Sta_0002 - * @tc.name SUB_Communication_WiFi_XTS_Sta_0002 - * @tc.desc Test get to ScanInfos promise and callback API functionality. - * @since 6 - * @syscap SystemCapability.Communication.WiFi.STA - * @permission ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or ohos.permission.LOCATION) - */ - it('SUB_Communication_WiFi_XTS_Sta_0002', 0, async function (done) { - await wifi.getScanInfos() - .then(result => { - let clen = Object.keys(result).length; - expect(clen).assertLarger(0); - console.info("[wifi_test] getScanInfos promise result " + JSON.stringify(result)); - }); - - function getScanInfos() { - return new Promise((resolve, reject) => { - wifi.getScanInfos( - (err, result) => { - if (err) { - console.log("[wifi_test] wifi getScanInfos failed " + err); - } - let clen = Object.keys(result).length; - if (!(clen == 0)) { - expect(clen).assertLarger(0); - console.info("[wifi_test] getScanInfos callback result: " + JSON.stringify(result)); - for (let j = 0; j < clen; ++j) { - console.info("ssid: " + result[j].ssid + "bssid: " + result[j].bssid + - "securityType: " + result[j].securityType + - "rssi: " + result[j].rssi + "band: " + result[j].band + - "frequency: " + result[j].frequency + "channelWidth: " + result[j].channelWidth + - "timestamp" + result[j].timestamp + "capabilities" + result[j].capabilities - + "centerFrequency0: " + result[j].centerFrequency0 - + "centerFrequency1: " + result[j].centerFrequency1 - + "infoElems: " + result[j].infoElems); - } - } - resolve(); - }); - }); - } - - await getScanInfos(); - done(); - }) - - /** - * @tc.number Sta_0034 - * @tc.name SUB_Communication_WiFi_XTS_Sta_0034 - * @tc.desc Test get to ScanInfos Sync API functionality. - * @since 9 - * @syscap SystemCapability.Communication.WiFi.STA - * @permission ohos.permission.GET_WIFI_INFO and (ohos.permission.GET_WIFI_PEERS_MAC or ohos.permission.LOCATION) - */ - it('SUB_Communication_WiFi_XTS_Sta_0034', 0, async function (done) { - let getScanInfos = wifi.getScanInfosSync(); - console.info("[wifi_test] wifi get to ScanInfosSync result : " + JSON.stringify(getScanInfos)); - let lenth = Object.keys(getScanInfos).length; - console.info("[wifi_test] wifi ScanInfosSync length result : " + JSON.stringify(lenth)); - expect(lenth).assertLarger(0); - done(); - }) - - /** - * @tc.number CandidateNetWork_0001 - * @tc.name SUB_Communication_WiFi_XTS_CandidateNetWork_1 - * @since 8 - * @tc.desc Test add UntrustedConfig and removeUntrustedConfig Promise API functionality. - * @syscap SystemCapability.Communication.WiFi.STA - * @permission ohos.permission.SET_WIFI_INFO - */ - it('SUB_Communication_WiFi_XTS_CandidateNetWork_1', 0, async function (done) { - let wifiDeviceConfig = { - "ssid": "TEST_PSK", - "bssid": "", - "preSharedKey": "12345678", - "isHiddenSsid": false, - "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, - "netId": "", - }; - await wifi.addUntrustedConfig(wifiDeviceConfig) - .then(ret => { - console.info("[wifi_test]addUntrustedConfig promise : " + JSON.stringify(ret)); - expect(ret).assertTrue(); - }).catch((error) => { - console.error('[wifi_js]addUntrustedConfig promise failed -> ' + JSON.stringify(error)); - - }); - await wifi.removeUntrustedConfig(wifiDeviceConfig) - .then(ret => { - console.info("[wifi_test]removeUntrustedConfig promise:" + JSON.stringify(ret)); - expect(True).assertTrue(); - }).catch((error) => { - console.error('[wifi_js]removeUntrustedConfig promise failed -> ' + JSON.stringify(error)); - - }); - done(); - }) - - /** - * @tc.number CandidateNetWork_0001 - * @tc.name SUB_Communication_WiFi_XTS_CandidateNetWork_2 - * @since 8 - * @tc.desc Test add UntrustedConfig and removeUntrustedConfig callback API functionality. - * @syscap SystemCapability.Communication.WiFi.STA - * @permission ohos.permission.SET_WIFI_INFO - */ - it('SUB_Communication_WiFi_XTS_CandidateNetWork_2', 0, async function (done) { - let wifiDeviceConfig = { - "ssid": "TYPE_PSK1", - "bssid": "", - "preSharedKey": "12345678", - "isHiddenSsid": false, - "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK, - } - function addCandidate() { - return new Promise((resolve, reject) => { - wifi.addUntrustedConfig(wifiDeviceConfig, - (err, ret) => { - if (err) { - console.info("[wifi_test]addUntrustedConfig callback failed : " + JSON.stringify(err)); - - } - console.info("[wifi_test]addUntrustedConfig callback result: " + JSON.stringify(ret)); - expect(ret).assertTrue(); - resolve(); - }); - }); - } - await addCandidate(); - function removeCandidate() { - return new Promise((resolve, reject) => { - wifi.removeUntrustedConfig(wifiDeviceConfig, - (err, ret) => { - if (err) { - console.info("[wifi_test]removeUntrustedConfig callback failed" + JSON.stringify(err)); - - } - console.info("[wifi_test]removeUntrustedConfig callback result:" + JSON.stringify(ret)); - expect(ret).assertTrue(); - resolve(); - }); - }); - } - await removeCandidate(); - done(); - }) - }) -} - - - diff --git a/communication/wifi_standard/src/main/js/test/WifiJsunit.testsame.js b/communication/wifi_standard/src/main/js/test/WifiJsunit.testsame.js deleted file mode 100644 index e7418f36d754da205b176a89178200ba403a50f9..0000000000000000000000000000000000000000 --- a/communication/wifi_standard/src/main/js/test/WifiJsunit.testsame.js +++ /dev/null @@ -1,479 +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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' - -import wifi from '@ohos.wifi' - -function sleep(delay) { // delay x ms - var start = (new Date()).getTime(); - while ((new Date()).getTime() - start > delay) { - break; - } -} -function checkWifiPowerOn(){ - console.info("wifi_test/wifi status:" + wifi.isWifiActive()); -} -function resolveIP(ip) { - return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF) + "." + (ip>>8 & 0xFF) + "." + (ip & 0xFF); -} - -let WifiSecurityType = { - WIFI_SEC_TYPE_INVALID: 0, - WIFI_SEC_TYPE_OPEN: 1, - WIFI_SEC_TYPE_WEP: 2, - WIFI_SEC_TYPE_PSK: 3, - WIFI_SEC_TYPE_SAE: 4, -} - -let ConnState = { - SCANNING: 0, - CONNECTING: 1, - AUTHENTICATING: 2, - OBTAINING_IPADDR: 3, - CONNECTED: 4, - DISCONNECTING: 5, - DISCONNECTED: 6, - UNKNOWN: 7, -} - -let untrustedDeviceConfig = { - "ssid": "untrusted_ssid", - "bssid": "", - "preSharedKey": "12345678", - "isHiddenSsid": false, - "securityType": WifiSecurityType.WIFI_SEC_TYPE_PSK -} - -let WifiChannelWidth = { - WIDTH_20MHZ : 0, - WIDTH_40MHZ : 1, - WIDTH_80MHZ : 2, - WIDTH_160MHZ : 3, - WIDTH_80MHZ_PLUS : 4, - WIDTH_INVALID:null, -} - -export default function actsWifiTest() { - describe('actsWifiTest', function() { - beforeEach(function() { - checkWifiPowerOn(); - }) - afterEach(function() { - }) - - /** - * @tc.number open_0001 - * @tc.name SUB_Communication_WiFi_Sta_Open_0001 - * @since 6 - * @tc.desc Test wifi.isWifiActive API functionality. - */ - it('SUB_Communication_WiFi_Sta_WifiActive_0001', 0, function() { - sleep(3000); - console.log("[wifi_test] check the state of wifi: " + wifi.isWifiActive()); - expect(wifi.isWifiActive()).assertTrue(); - }) - - /** - * @tc.number Scan_0001 - * @tc.name SUB_Communication_WiFi_Sta_Scan_0001 - * @since 6 - * @tc.desc Test get ScanInfos callback API functionality. - */ - it('SUB_Communication_WiFi_Sta_Scan_0001', 0, async function(done) { - let scan = wifi.scan(); - sleep(3000); - console.log("[wifi_test] open wifi scan result: " + scan); - await wifi.getScanInfos() - .then(result => { - let clen = Object.keys(result).length; - expect(clen).assertLarger(0); - console.info("[wifi_test] getScanInfos promise result " + JSON.stringify(result)); - }); - wifi.getScanInfos( - (err,result) => { - if(err) { - console.log("[wifi_test] wifi getScanInfos failed " + err); - } - let clen = Object.keys(result).length; - if (!(clen == 0)) { - expect(clen).assertLarger(0); - console.info("[wifi_test] getScanInfos callback result: " + JSON.stringify(result)); - for (let j = 0; j < clen; ++j) { - console.info("ssid: " + result[j].ssid + "bssid: " + result[j].bssid + - "securityType: " + result[j].securityType + - "rssi: " + result[j].rssi + "band: " + result[j].band + - "frequency: " + result[j].frequency + - "timestamp" + result[j].timestamp + "capabilities" + result[j].capabilities - + "channelWidth: " + result[j].channelWidth+ "centerFrequency0: " - + result[j].centerFrequency0 - + "centerFrequency1: " + result[j].centerFrequency1 - +"infoElems: " + result[j].infoElems); - } - } - done() - }); - }) - - /** - * @tc.number Scan_0004 - * @tc.name SUB_Communication_WiFi_Sta_Scan_0004 - * @since 7 - * @tc.desc Test wifi.getSignalLevel API functionality. - */ - it('SUB_Communication_WiFi_Sta_Scan_0004', 0, function() { - console.info("[wifi_test] check the 2.4G rssi assgined to level test."); - console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-65, 1)); - expect(wifi.getSignalLevel(-65, 1)).assertEqual(4); - console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-66, 1)); - expect(wifi.getSignalLevel(-66, 1)).assertEqual(3); - console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-75, 1)); - expect(wifi.getSignalLevel(-75, 1)).assertEqual(3); - console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-76, 1)); - expect(wifi.getSignalLevel(-76, 1)).assertEqual(2); - console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-82, 1)); - expect(wifi.getSignalLevel(-82, 1)).assertEqual(2); - console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-83, 1)); - expect(wifi.getSignalLevel(-83, 1)).assertEqual(1); - console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-88, 1)); - expect(wifi.getSignalLevel(-88, 1)).assertEqual(1); - console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-89, 1)); - expect(wifi.getSignalLevel(-89, 1)).assertEqual(0); - console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-127, 1)); - expect(wifi.getSignalLevel(-127, 1)).assertEqual(0); - - console.info("[wifi_test] check the 5G rssi assgined to level test."); - console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-65, 2)); - expect(wifi.getSignalLevel(-65, 2)).assertEqual(4); - console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-66, 2)); - expect(wifi.getSignalLevel(-66, 2)).assertEqual(3); - console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-72, 2)); - expect(wifi.getSignalLevel(-72, 2)).assertEqual(3); - console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-73, 2)); - expect(wifi.getSignalLevel(-73, 2)).assertEqual(2); - console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-79, 2)); - expect(wifi.getSignalLevel(-79, 2)).assertEqual(2); - console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-80, 2)); - expect(wifi.getSignalLevel(-80, 2)).assertEqual(1); - console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-85, 2)); - expect(wifi.getSignalLevel(-85, 2)).assertEqual(1); - console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-86, 2)); - expect(wifi.getSignalLevel(-86, 2)).assertEqual(0); - console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-127, 2)); - expect(wifi.getSignalLevel(-127, 2)).assertEqual(0); - }) - - /** - * @tc.number SUB_Communication_WiFi_Sta_info_0002 - * @tc.name testgetCountryCode - * @tc.desc Test getCountryCode api. - * @since 7 - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 3 - */ - it('SUB_Communication_WiFi_Sta_Info_0002', 0, function() { - expect(wifi.isWifiActive()).assertTrue(); - let countryCode = wifi.getCountryCode(); - console.info("[wifi_test] getCountryCode -> " + JSON.stringify(countryCode)); - let countrylen = countryCode.length; - console.info("[wifi_test] getCountryCode.length -> " + JSON.stringify(countrylen)); - expect(true).assertEqual(countrylen ==2); - }) - - /** - * @tc.number SUB_Communication_WiFi_Sta_info_0004 - * @tc.name testFeatureSupported - * @tc.desc Test FeatureSupported api. - * @since 7 - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 3 - */ - it('SUB_Communication_WiFi_Sta_info_0004', 0, function () { - expect(wifi.isWifiActive()).assertTrue(); - let WifiUtils = { - WIFI_FEATURE_INFRA: 0x0001, - WIFI_FEATURE_INFRA_5G: 0x0002, - WIFI_GAS_ANQP: 0x0004, - WIFI_WIFI_DIRECT: 0x0008, - WIFI_FEATURE_MOBILE_HOTSPOT: 0x0010, - WIFI_FEATURE_AWARE: 0x0040, - WIFI_FEATURE_AP_STA: 0x8000, - WIFI_FEATURE_WPA3_SAE: 0x8000000, - WIFI_FEATURE_WPA3_SUITE_B:0x10000000, - WIFI_FEATURE_OWE:0x20000000 - } - let isSupport1 = wifi.isFeatureSupported(WifiUtils.WIFI_FEATURE_INFRA); - console.info("[wifi_test] isFeatureSupported -> " + isSupport1); - let isSupport2 = wifi.isFeatureSupported(WifiUtils.WIFI_FEATURE_INFRA_5G); - console.info("[wifi_test] isFeatureSupported2 -> " + isSupport2); - let isSupport3 = wifi.isFeatureSupported(WifiUtils.WIFI_GAS_ANQP); - console.info("[wifi_test] isFeatureSupported3 -> " + isSupport3); - let isSupport4 = wifi.isFeatureSupported(WifiUtils.WIFI_WIFI_DIRECT); - console.info("[wifi_test] isFeatureSupported4 -> " + isSupport4); - let isSupport5 = wifi.isFeatureSupported(WifiUtils.WIFI_FEATURE_MOBILE_HOTSPOT); - console.info("[wifi_test] isFeatureSupported5 -> " + isSupport5); - let isSupport6 = wifi.isFeatureSupported(WifiUtils.WIFI_FEATURE_AWARE); - console.info("[wifi_test] isFeatureSupported6 -> " + isSupport6); - let isSupport7 = wifi.isFeatureSupported(WifiUtils.WIFI_FEATURE_AP_STA); - console.info("[wifi_test] isFeatureSupported7 -> " + isSupport7); - let isSupport8 = wifi.isFeatureSupported(WifiUtils.WIFI_FEATURE_WPA3_SAE); - console.info("[wifi_test] isFeatureSupported8 -> " + isSupport8); - let isSupport9 = wifi.isFeatureSupported(WifiUtils.WIFI_FEATURE_WPA3_SUITE_B); - console.info("[wifi_test] isFeatureSupported9 -> " + isSupport9); - let isSupport = wifi.isFeatureSupported(WifiUtils.WIFI_FEATURE_OWE); - console.info("[wifi_test] isFeatureSupported -> " + isSupport); - }) - - /** - * @tc.number conn_Config_0002 - * @tc.name SUB_Communication_WiFi_Sta_Conn_Info_0002 - * @since 7 - * @tc.desc Test getLinkedInfo information - */ - it('SUB_Communication_WiFi_Sta_Conn_Info_0002', 0, async function(done) { - let isConnected= wifi.isConnected(); - expect(isConnected).assertFalse(); - await wifi.getLinkedInfo() - .then((result) => { - console.info("[wifi_test] get wifi link [promise] -> " + JSON.stringify(result)); - expect(JSON.stringify(result)).assertContain('band'); - done(); - }).catch((error) => { - console.info("[wifi_test] promise then error." + JSON.stringify(error)); - expect().assertFail(); - }); - }) - - /** - * @tc.number conn_Config_0003 - * @tc.name SUB_Communication_WiFi_Sta_Conn_Info_0003 - * @since 7 - * @tc.desc Test getLinkedInfo callback information - */ - it('SUB_Communication_WiFi_Sta_Conn_Info_0003', 0, async function(done) { - wifi.getLinkedInfo( - (err,result) => { - if(err) { - console.log("[wifi_test] wifi getLinkedInfo failed " + err); - } - let clen = Object.keys(result).length; - expect(clen).assertLarger(0); - console.info("[wifi_test] getLinkedInfo callback result: " + JSON.stringify(result)); - console.info("ssid: " + result.ssid + "bssid:"+ result.bssid +"band: " + result.band+ - "isHidden: " + result.isHidden + "isRestricted: " + result.isRestricted + - "chload: " + result.chload + "rssi " + result.rssi + "netWorkId: " + result.netWorkId+ - "linkSpeed: " + result.linkSpeed + "frequency:" - + result.frequency +"snr:" + result.snr+ - "macAddress: " + result.macAddress + "ipAddress: " + result.ipAddress + - "suppState: " + result.suppState + "connState: " + result.connState - + "macType: " + result.macType); - - let state = wifi.getLinkedInfo().connState; - if(state == ConnState.SCANNING){ - expect(true).assertEqual(state == 0); - } - if(state == ConnState.CONNECTING){ - expect(true).assertEqual(state == 1); - } - if(state == ConnState.AUTHENTICATING){ - expect(true).assertEqual(state == 2); - } - if(state == ConnState.OBTAINING_IPADDR){ - expect(true).assertEqual(state == 3); - } - if(state == ConnState.CONNECTED){ - expect(true).assertEqual(state == 4); - } - if(state == ConnState.DISCONNECTING){ - expect(true).assertEqual(state == 5); - } - if(state == ConnState.DISCONNECTED){ - expect(true).assertEqual(state == 6); - } - if(state == ConnState.UNKNOWN){ - expect(true).assertEqual(state == 7); - } - done(); - }); - }) - - /** - * @tc.number Conn_Info_0003 - * @tc.name SUB_Communication_WiFi_Sta_Conn_Info_0003 - * @since 7 - * @tc.desc Test get IpInfo information - */ - it('SUB_Communication_WiFi_Sta_Conn_Info_0001', 0, function () { - let isConnected= wifi.isConnected(); - expect(isConnected).assertFalse(); - let ipInfo = wifi.getIpInfo(); - expect(JSON.stringify(ipInfo)).assertContain("gateway"); - let ipAddress = resolveIP(ipInfo.ipAddress); - console.info("ipAddress result: " + ipAddress); - console.info("gateway: " + ipInfo.gateway + "ipAddress: " + ipInfo.ipAddress - + "leaseDuration: " + ipInfo.leaseDuration + - "leaseDuration: " + ipInfo.leaseDuration + - "netmask: " + ipInfo.netmask + "primaryDns:" + ipInfo.primaryDns + - "secondDns: " + ipInfo.secondDns + "serverIp: " + ipInfo.serverIp ); - }) - - /** - * @tc.number wifiStateChange_0001 - * @tc.name SUB_Communication_WiFi_Sta_wifiStateChange_0001 - * @since 7 - * @tc.desc Test wifiStateChange callback - */ - it('SUB_Communication_WiFi_Sta_wifiStateChange_0001', 0, async function (done) { - wifi.on('wifiStateChange', async result => { - console.info("wifiStateChange callback, result:" + JSON.stringify(result)); - expect(true).assertEqual(result !=null); - let promise = new Promise((resolve) => { - wifi.off('wifiStateChange', result => { - console.info("offwifiStateChange callback, result: " + JSON.stringify(result)); - expect(true).assertEqual(result !=null); - resolve() - }); - }) - await promise.then(done) - }); - done(); - - }) - - /** - * @tc.number wifiConnectionChange_0002 - * @tc.name SUB_Communication_WiFi_Sta_wifiConnectionChange_0002 - * @since 7 - * @tc.desc Test wifiStateChange callback - */ - it('SUB_Communication_WiFi_Sta_wifiConnectionChange_0002', 0, async function (done) { - wifi.on('wifiConnectionChange', async result => { - console.info("wifiConnectionChange callback, result:" + JSON.stringify(result)); - expect(true).assertEqual(result !=null); - let promise = new Promise((resolve) => { - console.info('[wifi_test] offwifiConnectionChange test start ...'); - wifi.off('wifiConnectionChange', result => { - console.info("offwifiConnectionChange callback, result: " + JSON.stringify(result)); - expect(true).assertEqual(result !=null); - resolve() - }); - }) - await promise.then(done) - }); - done(); - - }) - - /** - * @tc.number wifiScanStateChange_0003 - * @tc.name SUB_Communication_WiFi_Sta_wifiScanStateChange_0003 - * @since 7 - * @tc.desc Test wifiScanStateChange callback - */ - it('SUB_Communication_WiFi_Sta_wifiScanStateChange_0003', 0, async function (done) { - wifi.on('wifiScanStateChange', async result => { - console.info("wifiScanStateChange callback, result:" + JSON.stringify(result)); - expect(true).assertEqual(result !=null); - let promise = new Promise((resolve) => { - console.info('[wifi_test] offwifiScanStateChange test start ...'); - wifi.off('wifiScanStateChange', result => { - console.info("offwifiScanStateChange callback, result: " + JSON.stringify(result)); - expect(true).assertEqual(result !=null); - resolve() - }); - }) - await promise.then(done) - }); - let scan = wifi.scan(); - sleep(3000); - done(); - - }) - - /** - * @tc.number wifiRssiChange_0004 - * @tc.name SUB_Communication_WiFi_Sta_wifiRssiChange_0004 - * @since 7 - * @tc.desc Test wifiRssiChange callback - */ - it('SUB_Communication_WiFi_Sta_wifiRssiChange_0004', 0, async function (done) { - wifi.on('wifiRssiChange', async result => { - console.info("wifiRssiChange callback, result:" + JSON.stringify(result)); - expect(true).assertEqual(result !=null); - let promise = new Promise((resolve) => { - console.info('[wifi_test] offwifiRssiChange test start ...'); - wifi.off('wifiRssiChange', result => { - console.info("offwifiRssiChange callback, result: " + JSON.stringify(result)); - expect(true).assertEqual(result !=null); - resolve() - }); - }) - await promise.then(done) - }); - done(); - }) - - /** - * @tc.number SUB_Communication_WiFi_Hotspot_ON_0001 - * @tc.name testhotspotStateChangeOn - * @since 7 - * @tc.desc Test hotspotStateChangeOn api. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 3 - */ - it('SUB_Communication_WiFi_Hotspot_ON_0001', 0, async function (done) { - console.info("[wifi_test]hotspotStateChange On test"); - try { - await wifi.on('hotspotStateChange', (data) => { - console.info("[wifi_test] hotspotStateChange On ->" + data); - expect(true).assertEqual(data != null); - }); - - }catch(e) { - expect(null).assertFail(); - } - done(); - }) - - /** - * @tc.number SUB_Communication_WiFi_Hotspot_Off_0002 - * @tc.name testhotspotStateChangeOff - * @since 7 - * @tc.desc Test hotspotStateChange api. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 3 - */ - it('SUB_Communication_WiFi_Hotspot_Off_0002', 0, async function (done) { - console.info("[wifi_test]hotspotStateChange Off test"); - try { - await wifi.off('hotspotStateChange', (data) => { - console.info("[wifi_test] hotspotStateChange Off ->" + data); - expect(true).assertEqual(data != null); - }); - }catch(e) { - expect(null).assertFail(); - } - done(); - }) - console.log("*************[wifi_test] start wifi js unit test end*************"); - }) -} - - - diff --git a/communication/wifi_standard/src/main/js/test/WifiStationEvent.test.js b/communication/wifi_standard/src/main/js/test/WifiStationEvent.test.js new file mode 100644 index 0000000000000000000000000000000000000000..7b29c71f9dbce44a6104f8b483e10e605a3d99e0 --- /dev/null +++ b/communication/wifi_standard/src/main/js/test/WifiStationEvent.test.js @@ -0,0 +1,168 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +import wifi from '@ohos.wifi' + +function sleep(delay) { + return new Promise(resovle => setTimeout(resovle, delay)) +} + +function checkWifiPowerOn(){ + console.info("[wifi_test]wifi status:" + wifi.isWifiActive()); +} +function resolveIP(ip) { + return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF) + "." + (ip>>8 & 0xFF) + "." + (ip & 0xFF); +} + +let wifiSecurityType = { + WIFI_SEC_TYPE_INVALID: 0, + WIFI_SEC_TYPE_OPEN: 1, + WIFI_SEC_TYPE_WEP: 2, + WIFI_SEC_TYPE_PSK: 3, + WIFI_SEC_TYPE_SAE: 4, +} + +let connState = { + SCANNING: 0, + CONNECTING: 1, + AUTHENTICATING: 2, + OBTAINING_IPADDR: 3, + CONNECTED: 4, + DISCONNECTING: 5, + DISCONNECTED: 6, + UNKNOWN: 7, +} + +let untrustedDeviceConfig = { + "ssid": "untrusted_ssid", + "bssid": "", + "preSharedKey": "12345678", + "isHiddenSsid": false, + "securityType": wifiSecurityType.WIFI_SEC_TYPE_PSK +} + +let wifiChannelWidth = { + WIDTH_20MHZ : 0, + WIDTH_40MHZ : 1, + WIDTH_80MHZ : 2, + WIDTH_160MHZ : 3, + WIDTH_80MHZ_PLUS : 4, + WIDTH_INVALID:null, +} + +export default function actsWifiEventTest() { + describe('actsWifiEventTest', function() { + beforeEach(function () { + checkWifiPowerOn(); + }) + afterEach(function () { + }) + + /** + * @tc.number SUB_Communication_WiFi_Event_Test_0001 + * @tc.name testWifiStateChange + * @tc.desc Test wifiStateChange callback + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_Event_Test_0001', 0, async function (done) { + let wifiState = "wifiStateChange"; + let wifiStateChangeCallback = result => { + console.info("[wifi_test]wifiStateChange callback, result: " + JSON.stringify(result)); + } + wifi.on(wifiState, wifiStateChangeCallback); + await sleep(3000); + wifi.off(wifiState, wifiStateChangeCallback); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_Event_Test_0002 + * @tc.name testWifiConnectionChange + * @tc.desc Test wifiConnectionChange callback + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_Event_Test_0002', 0, async function (done) { + let wifiConnectionState = "wifiConnectionChange"; + let wifiConnectionChangeCallback = result => { + console.info("[wifi_test]wifiConnectionChange callback, result: " + JSON.stringify(result)); + } + wifi.on(wifiConnectionState, wifiConnectionChangeCallback); + await sleep(3000); + wifi.off(wifiConnectionState, wifiConnectionChangeCallback); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_Event_Test_0003 + * @tc.name testWifiScanStateChange + * @tc.desc Test wifiScanStateChange callback + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_Event_Test_0003', 0, async function (done) { + let wifiScanState = "wifiScanStateChange"; + let wifiScanStateChangeCallback = result => { + console.info("[wifi_test]wifiScanStateChange callback, result: " + JSON.stringify(result)); + } + wifi.on(wifiScanState, wifiScanStateChangeCallback); + let scanResult = wifi.scan(); + await sleep(3000); + wifi.off(wifiScanState, wifiScanStateChangeCallback); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_Event_Test_0004 + * @tc.name testWifiRssiChange + * @tc.desc Test wifiRssiChange callback + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_Event_Test_0004', 0, async function (done) { + let wifiRssiState = "wifiRssiChange"; + let wifiRssiChangeCallback = result => { + console.info("[wifi_test]wifiRssiChange callback, result: " + JSON.stringify(result)); + } + wifi.on(wifiRssiState, wifiRssiChangeCallback); + await sleep(3000); + wifi.off(wifiRssiState, wifiRssiChangeCallback); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_Event_Test_0005 + * @tc.name testHotspotStateChange + * @tc.desc Test hotspotStateChange api. + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_Event_Test_0005', 0, async function (done) { + let hotspotState = "hotspotStateChange"; + let hotspotStateChangeCallback = result => { + console.info("[wifi_test]hotspotStateChange callback, result: " + JSON.stringify(result)); + } + wifi.on(hotspotState, hotspotStateChangeCallback); + await sleep(3000); + wifi.off(hotspotState, hotspotStateChangeCallback); + done(); + }) + console.log("*************[wifi_test] start wifi js unit test end*************"); + }) +} + diff --git a/communication/wifi_standard/src/main/js/test/WifiStationFunctions.test.js b/communication/wifi_standard/src/main/js/test/WifiStationFunctions.test.js new file mode 100644 index 0000000000000000000000000000000000000000..510b99066a9b874db5b55b5b4aed45800bc7d046 --- /dev/null +++ b/communication/wifi_standard/src/main/js/test/WifiStationFunctions.test.js @@ -0,0 +1,327 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +import wifi from '@ohos.wifi' + +function sleep(delay) { // delay x ms + var start = (new Date()).getTime(); + while ((new Date()).getTime() - start > delay) { + break; + } +} +function checkWifiPowerOn(){ + console.info("[wifi_test]wifi status:" + wifi.isWifiActive()); +} +function resolveIP(ip) { + return (ip>>24 & 0xFF) + "." + (ip>>16 & 0xFF) + "." + (ip>>8 & 0xFF) + "." + (ip & 0xFF); +} + +let wifiSecurityType = { + WIFI_SEC_TYPE_INVALID: 0, + WIFI_SEC_TYPE_OPEN: 1, + WIFI_SEC_TYPE_WEP: 2, + WIFI_SEC_TYPE_PSK: 3, + WIFI_SEC_TYPE_SAE: 4, +} + +let connState = { + SCANNING: 0, + CONNECTING: 1, + AUTHENTICATING: 2, + OBTAINING_IPADDR: 3, + CONNECTED: 4, + DISCONNECTING: 5, + DISCONNECTED: 6, + UNKNOWN: 7, +} + +let untrustedDeviceConfig = { + "ssid": "untrusted_ssid", + "bssid": "", + "preSharedKey": "12345678", + "isHiddenSsid": false, + "securityType": wifiSecurityType.WIFI_SEC_TYPE_PSK +} + +let wifiChannelWidth = { + WIDTH_20MHZ : 0, + WIDTH_40MHZ : 1, + WIDTH_80MHZ : 2, + WIDTH_160MHZ : 3, + WIDTH_80MHZ_PLUS : 4, + WIDTH_INVALID:null, +} + +export default function actsWifiFunctionsTest() { + describe('actsWifiFunctionsTest', function() { + beforeEach(function () { + checkWifiPowerOn(); + }) + afterEach(function () { + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_Sta_0002 + * @tc.name testGetScanInfos + * @tc.desc Test getScanInfos promise and callback API functionality. + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_Communication_WiFi_XTS_Sta_0002', 0, async function (done) { + let scan = wifi.scan(); + await sleep(3000); + await wifi.getScanInfos() + .then(result => { + let clen = Object.keys(result).length; + expect(true).assertEqual(clen >= 0); + console.info("[wifi_test]getScanInfos promise result:" + JSON.stringify(result)); + }); + function getScan() { + return new Promise((resolve, reject) => { + wifi.getScanInfos( + (err, result) => { + if (err) { + console.log("[wifi_test] wifi getScanInfos failed:" + err); + } + let clen = Object.keys(result).length; + if (!(clen == 0)) { + expect(clen).assertLarger(0); + console.info("[wifi_test] getScanInfos callback result: " + JSON.stringify(result)); + for (let j = 0; j < clen; ++j) { + console.info("ssid: " + result[j].ssid + "bssid: " + result[j].bssid + + "securityType: " + result[j].securityType + + "rssi: " + result[j].rssi + "band: " + result[j].band + + "frequency: " + result[j].frequency + "channelWidth: " + result[j].channelWidth + + "timestamp" + result[j].timestamp + "capabilities" + result[j].capabilities + + "centerFrequency0: " + result[j].centerFrequency0 + + "centerFrequency1: " + result[j].centerFrequency1 + + "infoElems: " + result[j].infoElems); + } + } + resolve(); + }); + }); + } + await getScan(); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_Sta_0021 + * @tc.name testGetSignalLevel + * @tc.desc Test getSignalLevel API functionality.. + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_XTS_Sta_0021', 0, function () { + console.info("[wifi_test] check the 2.4G rssi assgined to level test."); + console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-65, 1)); + expect(wifi.getSignalLevel(-65, 1)).assertEqual(4); + console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-66, 1)); + expect(wifi.getSignalLevel(-66, 1)).assertEqual(3); + console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-75, 1)); + expect(wifi.getSignalLevel(-75, 1)).assertEqual(3); + console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-76, 1)); + expect(wifi.getSignalLevel(-76, 1)).assertEqual(2); + console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-82, 1)); + expect(wifi.getSignalLevel(-82, 1)).assertEqual(2); + console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-83, 1)); + expect(wifi.getSignalLevel(-83, 1)).assertEqual(1); + console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-88, 1)); + expect(wifi.getSignalLevel(-88, 1)).assertEqual(1); + console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-89, 1)); + expect(wifi.getSignalLevel(-89, 1)).assertEqual(0); + console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-127, 1)); + expect(wifi.getSignalLevel(-127, 1)).assertEqual(0); + + console.info("[wifi_test] check the 5G rssi assgined to level test."); + console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-65, 2)); + expect(wifi.getSignalLevel(-65, 2)).assertEqual(4); + console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-66, 2)); + expect(wifi.getSignalLevel(-66, 2)).assertEqual(3); + console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-72, 2)); + expect(wifi.getSignalLevel(-72, 2)).assertEqual(3); + console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-73, 2)); + expect(wifi.getSignalLevel(-73, 2)).assertEqual(2); + console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-79, 2)); + expect(wifi.getSignalLevel(-79, 2)).assertEqual(2); + console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-80, 2)); + expect(wifi.getSignalLevel(-80, 2)).assertEqual(1); + console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-85, 2)); + expect(wifi.getSignalLevel(-85, 2)).assertEqual(1); + console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-86, 2)); + expect(wifi.getSignalLevel(-86, 2)).assertEqual(0); + console.info("[wifi_test] getSignalLevel " + wifi.getSignalLevel(-127, 2)); + expect(wifi.getSignalLevel(-127, 2)).assertEqual(0); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_Sta_0017 + * @tc.name testgetCountryCode + * @tc.desc Test getCountryCode API function. + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_XTS_Sta_0017', 0, function () { + expect(wifi.isWifiActive()).assertTrue(); + let getCountryCodeResult = wifi.getCountryCode(); + console.info("[wifi_test]getCountryCode :" + JSON.stringify(getCountryCodeResult)); + let countrylenth = getCountryCodeResult.length; + console.info("[wifi_test]getCountryCode.length :" + JSON.stringify(countrylenth)); + expect(true).assertEqual(countrylenth == 2); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_Sta_0020 + * @tc.name testFeatureSupported + * @tc.desc Test FeatureSupported API function. + * @tc.type Function + * @tc.level Level 3 + */ + it('SUB_Communication_WiFi_XTS_Sta_0020', 0, function () { + expect(wifi.isWifiActive()).assertTrue(); + let wifiUtils = { + WIFI_FEATURE_INFRA: 0x0001, + WIFI_FEATURE_INFRA_5G: 0x0002, + WIFI_GAS_ANQP: 0x0004, + WIFI_WIFI_DIRECT: 0x0008, + WIFI_FEATURE_MOBILE_HOTSPOT: 0x0010, + WIFI_FEATURE_AWARE: 0x0040, + WIFI_FEATURE_AP_STA: 0x8000, + WIFI_FEATURE_WPA3_SAE: 0x8000000, + WIFI_FEATURE_WPA3_SUITE_B: 0x10000000, + WIFI_FEATURE_OWE: 0x20000000 + } + let isSupport1 = wifi.isFeatureSupported(wifiUtils.WIFI_FEATURE_INFRA); + console.info("[wifi_test] isFeatureSupported -> " + isSupport1); + let isSupport2 = wifi.isFeatureSupported(wifiUtils.WIFI_FEATURE_INFRA_5G); + console.info("[wifi_test] isFeatureSupported2 -> " + isSupport2); + let isSupport3 = wifi.isFeatureSupported(wifiUtils.WIFI_GAS_ANQP); + console.info("[wifi_test] isFeatureSupported3 -> " + isSupport3); + let isSupport4 = wifi.isFeatureSupported(wifiUtils.WIFI_WIFI_DIRECT); + console.info("[wifi_test] isFeatureSupported4 -> " + isSupport4); + let isSupport5 = wifi.isFeatureSupported(wifiUtils.WIFI_FEATURE_MOBILE_HOTSPOT); + console.info("[wifi_test] isFeatureSupported5 -> " + isSupport5); + let isSupport6 = wifi.isFeatureSupported(wifiUtils.WIFI_FEATURE_AWARE); + console.info("[wifi_test] isFeatureSupported6 -> " + isSupport6); + let isSupport7 = wifi.isFeatureSupported(wifiUtils.WIFI_FEATURE_AP_STA); + console.info("[wifi_test] isFeatureSupported7 -> " + isSupport7); + let isSupport8 = wifi.isFeatureSupported(wifiUtils.WIFI_FEATURE_WPA3_SAE); + console.info("[wifi_test] isFeatureSupported8 -> " + isSupport8); + let isSupport9 = wifi.isFeatureSupported(wifiUtils.WIFI_FEATURE_WPA3_SUITE_B); + console.info("[wifi_test] isFeatureSupported9 -> " + isSupport9); + let isSupport = wifi.isFeatureSupported(wifiUtils.WIFI_FEATURE_OWE); + console.info("[wifi_test] isFeatureSupported -> " + isSupport); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_Sta_0004 + * @tc.name testGetLinkedInfo + * @tc.desc Test Test getLinkedInfo and getIpInfo information. + * @tc.type Function + * @tc.level Level 1 + */ + it('SUB_Communication_WiFi_XTS_Sta_0004', 0, async function (done) { + let isConnectedResult = wifi.isConnected(); + let ipInfoResult = wifi.getIpInfo(); + expect(JSON.stringify(ipInfoResult)).assertContain("gateway"); + let ipAddress = resolveIP(ipInfoResult.ipAddress); + console.info("[wifi_test]ipAddress result: " + ipAddress); + console.info("gateway: " + ipInfoResult.gateway + "ipAddress: " + ipInfoResult.ipAddress + + "leaseDuration: " + ipInfoResult.leaseDuration + + "leaseDuration: " + ipInfoResult.leaseDuration + + "netmask: " + ipInfoResult.netmask + "primaryDns:" + ipInfoResult.primaryDns + + "secondDns: " + ipInfoResult.secondDns + "serverIp: " + ipInfoResult.serverIp); + await wifi.getLinkedInfo() + .then((result) => { + console.info("[wifi_test]get wifi link promise:" + JSON.stringify(result)); + done(); + }).catch((error) => { + console.info("[wifi_test]promise then error." + JSON.stringify(error)); + expect().assertFail(); + }); + + function getLinked(){ + return new Promise((resolve, reject) => { + wifi.getLinkedInfo( + (err, result) => { + if(err) { + console.log("[wifi_test]wifi getLinkedInfo failed " + err); + } + let clen = Object.keys(result).length; + expect(clen).assertLarger(0); + console.info("[wifi_test]getLinkedInfo callback result: " + JSON.stringify(result)); + console.info("ssid: " + result.ssid + "bssid:" + result.bssid + "band: " + result.band + + "isHidden: " + result.isHidden + "isRestricted: " + result.isRestricted + + "chload: " + result.chload + "rssi " + result.rssi + "netWorkId: " + result.netWorkId + + "linkSpeed: " + result.linkSpeed + "frequency:" + + result.frequency + "snr:" + result.snr + + "macAddress: " + result.macAddress + "ipAddress: " + result.ipAddress + + "suppState: " + result.suppState + "connState: " + result.connState + + "macType: " + result.macType); + let state = wifi.getLinkedInfo().ConnState; + if (state == connState.SCANNING) { + expect(true).assertEqual(state == 0); + } + if (state == connState.CONNECTING) { + expect(true).assertEqual(state == 1); + } + if (state == connState.AUTHENTICATING) { + expect(true).assertEqual(state == 2); + } + if (state == connState.OBTAINING_IPADDR) { + expect(true).assertEqual(state == 3); + } + if (state == connState.CONNECTED) { + expect(true).assertEqual(state == 4); + } + if (state == connState.DISCONNECTING) { + expect(true).assertEqual(state == 5); + } + if (state == connState.DISCONNECTED) { + expect(true).assertEqual(state == 6); + } + if (state == connState.UNKNOWN) { + expect(true).assertEqual(state == 7); + } + resolve(); + }); + }); + } + await getLinked(); + done(); + }) + + /** + * @tc.number SUB_Communication_WiFi_XTS_Sta_0034 + * @tc.name testGetScanInfosSync + * @tc.desc Test getScanInfos Sync API functionality. + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_Communication_WiFi_XTS_Sta_0034', 0, async function (done) { + let getScanInfosResult = wifi.getScanInfosSync(); + console.info("[wifi_test]wifi getScanInfosSync result : " + JSON.stringify(getScanInfosResult)); + let scanInfolenth = Object.keys(getScanInfosResult).length; + console.info("[wifi_test]wifi ScanInfosSync length result : " + JSON.stringify(scanInfolenth)); + expect(true).assertEqual(scanInfolenth >= 0); + done(); + }) + console.log("*************[wifi_test] start wifi js unit test end*************"); + }) +} + 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/customization/TestExtensionAbility_001/entry/src/main/module.json b/customization/TestExtensionAbility_001/entry/src/main/module.json index 07f87be0af6ac810f04ed68a08e589e94744fca9..45ee1dffc3118c7758b11eda15416dd132477dbe 100644 --- a/customization/TestExtensionAbility_001/entry/src/main/module.json +++ b/customization/TestExtensionAbility_001/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/customization/edm_xts_stage/Test.json b/customization/edm_xts_stage/Test.json index 2064ffd5d147b319c7f5f3bbe994f83b14894a91..bf9adadfadb2eac1636dd053ec416af422bdf843 100644 --- a/customization/edm_xts_stage/Test.json +++ b/customization/edm_xts_stage/Test.json @@ -1,9 +1,10 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", + "type": "OHJSUnitTest", "test-timeout": "180000", - "package": "com.example.myapplication", + "bundle-name": "com.example.myapplication", + "module-name": "phone", "shell-timeout": "600000" }, "kits": [ diff --git a/customization/edm_xts_stage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/customization/edm_xts_stage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..adcea6b8e39cffa4d1dc9942a0f712203782942b --- /dev/null +++ b/customization/edm_xts_stage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,72 @@ +/* +* 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' + ]) + 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 MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' + let lMonitor = { + abilityName: MainAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a com.example.myapplication.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + 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/customization/edm_xts_stage/entry/src/main/ets/pages/index/index.ets b/customization/edm_xts_stage/entry/src/main/ets/pages/index/index.ets index 59482e5ec08385149947751f60e9059fc3d979c5..4c26b68c0f0469281c69f04dcec62a5083f40142 100644 --- a/customization/edm_xts_stage/entry/src/main/ets/pages/index/index.ets +++ b/customization/edm_xts_stage/entry/src/main/ets/pages/index/index.ets @@ -12,35 +12,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import file from '@system.file'; - -import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' import testsuite from "../../test/List.test.ets" - @Entry @Component struct Index { aboutToAppear(){ - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters.timeout = 70000; - configService.setConfig(globalThis.abilityWant.parameters) - // testsuite(globalThis.abilityContext,globalThis.windowStage,globalThis.abilityStorage) - testsuite() - core.execute() + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) } build() { diff --git a/customization/edm_xts_stage/entry/src/main/ets/test/commom.ets b/customization/edm_xts_stage/entry/src/main/ets/test/commom.ets index 097589f6ae724e609fc39bc163a66412d1ad9f8c..a6540fcd9eb2329151d7283190c1559ef34fdd5e 100644 --- a/customization/edm_xts_stage/entry/src/main/ets/test/commom.ets +++ b/customization/edm_xts_stage/entry/src/main/ets/test/commom.ets @@ -39,7 +39,10 @@ const DEFAULT_USER_ID = 100; const TEST_USER_ID = 101; const ERR_USER_ID = 102; +const SUBSCRIBE_EVENTS: Array = [0,1]; +const SUBSCRIBE_INVALID_EVENTS: Array = [20,21]; + export { WANT1, ENTINFO1, SELFWANT, SELFHAPNAME, COMPANYNAME2, DESCRIPTION2, ENTINFO2, - DEFAULT_USER_ID, TEST_USER_ID, ERR_USER_ID + DEFAULT_USER_ID, TEST_USER_ID, ERR_USER_ID, SUBSCRIBE_EVENTS, SUBSCRIBE_INVALID_EVENTS } \ No newline at end of file diff --git a/customization/edm_xts_stage/entry/src/main/ets/test/edmCallback.test.ets b/customization/edm_xts_stage/entry/src/main/ets/test/edmCallback.test.ets index 070788296ee729ffe09fa5b7cc6473bc2ca91a68..8b014567022c5611ea1e3bcc6f0813d4d0a0f5bb 100644 --- a/customization/edm_xts_stage/entry/src/main/ets/test/edmCallback.test.ets +++ b/customization/edm_xts_stage/entry/src/main/ets/test/edmCallback.test.ets @@ -13,10 +13,10 @@ * limitations under the License. */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "hypium/index" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" import { WANT1, ENTINFO1, SELFWANT, SELFHAPNAME, COMPANYNAME2, DESCRIPTION2, - ENTINFO2, DEFAULT_USER_ID, TEST_USER_ID, ERR_USER_ID + ENTINFO2, DEFAULT_USER_ID, TEST_USER_ID, ERR_USER_ID, SUBSCRIBE_EVENTS, SUBSCRIBE_INVALID_EVENTS } from "./commom.ets"; import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager' @@ -31,17 +31,16 @@ export default function edmCallbackTest() { it('enableAdmin_test_002', 0, async function (done) { await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, OnReceiveEvent); - async function OnReceiveEvent(err, datainfo) { - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL :' + datainfo); - expect(datainfo).assertTrue(); + async function OnReceiveEvent(err) { + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); + expect(err == null).assertTrue(); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); expect(isEnabled).assertTrue(); - var retValue = await enterpriseDeviceManager.disableAdmin(WANT1); - console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); - expect(retValue).assertTrue(); + await enterpriseDeviceManager.disableAdmin(WANT1); + console.log('enterpriseDeviceManager.disableAdmin.'); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); @@ -58,17 +57,16 @@ export default function edmCallbackTest() { it('enableAdmin_test_004', 0, async function (done) { await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, OnReceiveEvent); - async function OnReceiveEvent(err, datainfo) { - console.log('enterpriseDeviceManager.enableAdmin : ' + retValue); - expect(datainfo).assertTrue(); + async function OnReceiveEvent(err) { + console.log('enterpriseDeviceManager.enableAdmin.'); + expect(err == null).assertTrue(); var isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); console.log('enterpriseDeviceManager.isSuperAdmin :' + isEnabled); expect(isEnabled).assertTrue(); - var retValue = await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); - console.log('enterpriseDeviceManager.disableSuperAdmin : ' + retValue); - expect(retValue).assertTrue(); + await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); + console.log('enterpriseDeviceManager.disableSuperAdmin.'); isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); console.log('enterpriseDeviceManager.isSuperAdmin : ' + isEnabled); @@ -77,34 +75,6 @@ export default function edmCallbackTest() { } }) - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0006 - * @tc.name test enableAdmin method in callback mode without user id - * @tc.desc enable admin in callback mode - */ - it('enableAdmin_test_006', 0, async function (done) { - console.log(' enableAdmin()'); - await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, OnReceiveEvent); - async function OnReceiveEvent(err, datainfo) { - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL :' + datainfo); - expect(datainfo).assertTrue(); - - var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); - console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); - expect(isEnabled).assertTrue(); - - var retValue = await enterpriseDeviceManager.disableAdmin(WANT1); - console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); - expect(retValue).assertTrue(); - - isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertFalse(); - done(); - } - }) - /** * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0008 * @tc.name test enableAdmin method with user id in callback mode with default user id @@ -113,17 +83,16 @@ export default function edmCallbackTest() { it('enableAdmin_test_008', 0, async function (done) { await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID, OnReceiveEvent); - async function OnReceiveEvent(err, datainfo) { - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL :' + datainfo); - expect(datainfo).assertTrue(); + async function OnReceiveEvent(err) { + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); + expect(err == null).assertTrue(); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); expect(isEnabled).assertTrue(); - var retValue = await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); - expect(retValue).assertTrue(); + await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.disableAdmin.'); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); @@ -140,17 +109,16 @@ export default function edmCallbackTest() { it('enableAdmin_test_012', 0, async function (done) { await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID, OnReceiveEvent); - async function OnReceiveEvent(err, datainfo) { - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL :' + datainfo); - expect(datainfo).assertTrue(); + async function OnReceiveEvent(err) { + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); + expect(err == null).assertTrue(); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); expect(isEnabled).assertTrue(); - var retValue = await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); - expect(retValue).assertTrue(); + await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID); + console.log('enterpriseDeviceManager.disableAdmin.'); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); @@ -167,17 +135,16 @@ export default function edmCallbackTest() { it('enableAdmin_test_013', 0, async function (done) { await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID, OnReceiveEvent); - async function OnReceiveEvent(err, datainfo) { - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL :' + datainfo); - expect(datainfo).assertTrue(); + async function OnReceiveEvent(err) { + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); + expect(err == null).assertTrue(); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); expect(isEnabled).assertFalse(); - var retValue = await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); - expect(retValue).assertTrue(); + await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.disableAdmin.'); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); @@ -194,9 +161,9 @@ export default function edmCallbackTest() { it('enableAdmin_test_014', 0, async function (done) { await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID, OnReceiveEvent); - async function OnReceiveEvent(err, datainfo) { - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL :' + datainfo); - expect(datainfo).assertTrue(); + async function OnReceiveEvent(err) { + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); + expect(err == null).assertTrue(); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); @@ -214,9 +181,8 @@ export default function edmCallbackTest() { console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); expect(isEnabled).assertTrue(); - retValue = await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); - expect(retValue).assertTrue(); + await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID); + console.log('enterpriseDeviceManager.disableAdmin.'); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); @@ -231,26 +197,24 @@ export default function edmCallbackTest() { * @tc.desc set enterprise info in callback mode */ it('setEnterpriseInfo_test_002', 0, async function (done) { - var retValue = await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL : ' + retValue); - expect(retValue).assertTrue(); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(SELFWANT); expect(isEnabled).assertTrue(); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); await enterpriseDeviceManager.setEnterpriseInfo(SELFWANT, ENTINFO2, OnReceiveEvent); - async function OnReceiveEvent(err, datainfo) { - console.log('enterpriseDeviceManager.setEnterpriseInfo : ' + datainfo); - expect(datainfo).assertTrue(); + async function OnReceiveEvent(err) { + console.log('enterpriseDeviceManager.setEnterpriseInfo.'); + expect(err == null).assertTrue(); var entInfo = await enterpriseDeviceManager.getEnterpriseInfo(SELFWANT); expect(entInfo.name).assertEqual(COMPANYNAME2); expect(entInfo.description).assertEqual(DESCRIPTION2); - retValue = await enterpriseDeviceManager.disableAdmin(SELFWANT); - console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); - expect(retValue).assertTrue(); + await enterpriseDeviceManager.disableAdmin(SELFWANT); + console.log('enterpriseDeviceManager.disableAdmin.'); isEnabled = await enterpriseDeviceManager.isAdminEnabled(SELFWANT); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); @@ -283,11 +247,201 @@ export default function edmCallbackTest() { let dsmgr = await enterpriseDeviceManager.getDeviceSettingsManager(); expect(dsmgr !== null).assertTrue(); console.log('before setDateTime'); - await dsmgr.setDateTime(SELFWANT, 1526003846000, (error, data) => { - console.log("setDateTime ===data: " + data); - console.log("setDateTime ===error: " + error); + await dsmgr.setDateTime(SELFWANT, 1526003846000, OnReceiveEvent); + async function OnReceiveEvent() { + await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); + done(); + } + }) + + /** + * @tc.number subscribeManagedEvent_test_001 + * @tc.desc Test subscribeManagedEvent method in callback mode. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('subscribeManagedEvent_test_001', 0, async function (done) { + console.info('-----------subscribeManagedEvent_test_001 start-------------'); + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); + await new Promise((resolve, reject) => { + enterpriseDeviceManager.subscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS, error => { + expect(error == null).assertTrue(); + console.log('enterpriseDeviceManager.subscribeManagedEvent. null 1'); + resolve(0); + }); + }); + await enterpriseDeviceManager.disableAdmin(SELFWANT); + console.log('enterpriseDeviceManager.disableAdmin.'); + done(); + }) + + /** + * @tc.number subscribeManagedEvent_test_003 + * @tc.desc Test subscribeManagedEvent method in callback mode and subscribe invalid managed events. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('subscribeManagedEvent_test_003', 0, async function (done) { + console.info('-----------subscribeManagedEvent_test_003 start-------------'); + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); + await new Promise((resolve, reject) => { + enterpriseDeviceManager.subscribeManagedEvent(SELFWANT, SUBSCRIBE_INVALID_EVENTS, error => { + expect(error.code == 9200008).assertTrue(); + console.log('enterpriseDeviceManager.subscribeManagedEvent. 9200008'); + resolve(0); + }); + }); + await enterpriseDeviceManager.disableAdmin(SELFWANT); + done(); + }) + + /** + * @tc.number subscribeManagedEvent_test_005 + * @tc.desc Test subscribeManagedEvent method in callback mode subscribe when disable admin. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('subscribeManagedEvent_test_005', 0, async function (done) { + console.info('-----------subscribeManagedEvent_test_005 start-------------'); + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); + await enterpriseDeviceManager.disableAdmin(SELFWANT); + console.log('enterpriseDeviceManager.disableAdmin.'); + await new Promise((resolve, reject) => { + enterpriseDeviceManager.subscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS, error => { + expect(error.code == 9200001).assertTrue(); + console.log('enterpriseDeviceManager.subscribeManagedEvent. 9200001'); + resolve(0); + }); + }); + done(); + }) + + /** + * @tc.number subscribeManagedEvent_test_007 + * @tc.desc Test subscribeManagedEvent method in callback mode and subscribe when enable super admin. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('subscribeManagedEvent_test_007', 0, async function (done) { + console.info('-----------subscribeManagedEvent_test_007 start-------------'); + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER.'); + await new Promise((resolve, reject) => { + enterpriseDeviceManager.subscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS, error => { + expect(error == null).assertTrue(); + console.log('enterpriseDeviceManager.subscribeManagedEvent. null 2'); + resolve(0); + }); + }); + await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); + console.log('enterpriseDeviceManager.disableSuperAdmin ADMIN_TYPE_SUPER.'); + done(); + }) + + /** + * @tc.number unsubscribeManagedEvent_test_001 + * @tc.desc Test unsubscribeManagedEvent method in callback mode. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('unsubscribeManagedEvent_test_001', 0, async function (done) { + console.info('-----------unsubscribeManagedEvent_test_001 start-------------'); + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); + await new Promise((resolve, reject) => { + enterpriseDeviceManager.unsubscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS, error => { + expect(error == null).assertTrue(); + console.log('enterpriseDeviceManager.unsubscribeManagedEvent. null 1'); + resolve(0); + }); + }); + await enterpriseDeviceManager.disableAdmin(SELFWANT); + console.log('enterpriseDeviceManager.disableAdmin.'); + done(); + }) + + /** + * @tc.number unsubscribeManagedEvent_test_003 + * @tc.desc Test unsubscribeManagedEvent method in callback mode and unsubscribe invalid managed events. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('unsubscribeManagedEvent_test_003', 0, async function (done) { + console.info('-----------unsubscribeManagedEvent_test_003 start-------------'); + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); + await new Promise((resolve, reject) => { + enterpriseDeviceManager.unsubscribeManagedEvent(SELFWANT, SUBSCRIBE_INVALID_EVENTS, error => { + expect(error.code == 9200008).assertTrue(); + console.log('enterpriseDeviceManager.unsubscribeManagedEvent. 9200008'); + resolve(0); + }); + }); + await enterpriseDeviceManager.disableAdmin(SELFWANT); + console.log('enterpriseDeviceManager.disableAdmin.'); + done(); + }) + + /** + * @tc.number unsubscribeManagedEvent_test_005 + * @tc.desc Test unsubscribeManagedEvent method in callback mode and unsubscribe when disable admin. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('unsubscribeManagedEvent_test_005', 0, async function (done) { + console.info('-----------unsubscribeManagedEvent_test_005 start-------------'); + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); + await enterpriseDeviceManager.disableAdmin(SELFWANT); + console.log('enterpriseDeviceManager.disableAdmin.'); + await new Promise((resolve, reject) => { + enterpriseDeviceManager.unsubscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS, error => { + expect(error.code == 9200001).assertTrue(); + console.log('enterpriseDeviceManager.unsubscribeManagedEvent. 9200001'); + resolve(0); + }); + }); + done(); + }) + + /** + * @tc.number unsubscribeManagedEvent_test_007 + * @tc.desc Test unsubscribeManagedEvent method in callback mode and unsubscribe when enable super admin. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('unsubscribeManagedEvent_test_007', 0, async function (done) { + console.info('-----------unsubscribeManagedEvent_test_007 start-------------'); + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER.'); + await new Promise((resolve, reject) => { + enterpriseDeviceManager.unsubscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS, error => { + expect(error == null).assertTrue(); + console.log('enterpriseDeviceManager.unsubscribeManagedEvent. null 2'); + resolve(0); + }); }); await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); + console.log('enterpriseDeviceManager.disableSuperAdmin ADMIN_TYPE_SUPER.'); done(); }) }) diff --git a/customization/edm_xts_stage/entry/src/main/ets/test/edmPromise.test.ets b/customization/edm_xts_stage/entry/src/main/ets/test/edmPromise.test.ets index f3a4810b69ddae1ec9aaf2efbb7fdfd548de6e33..98a0fa46668277750da6c3503381583abd30425b 100644 --- a/customization/edm_xts_stage/entry/src/main/ets/test/edmPromise.test.ets +++ b/customization/edm_xts_stage/entry/src/main/ets/test/edmPromise.test.ets @@ -12,10 +12,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "hypium/index" +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" import { WANT1, ENTINFO1, SELFWANT, SELFHAPNAME, COMPANYNAME2, DESCRIPTION2, ENTINFO2, - DEFAULT_USER_ID, TEST_USER_ID, ERR_USER_ID + DEFAULT_USER_ID, TEST_USER_ID, ERR_USER_ID, SUBSCRIBE_EVENTS, SUBSCRIBE_INVALID_EVENTS } from "./commom.ets"; import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager' @@ -27,18 +27,16 @@ export default function edmPromiseTest() { * @tc.desc enable admin in promise mode */ it('enableAdmin_test_001', 0, async function (done) { - var retValue = await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, + await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL : ' + retValue); - expect(retValue).assertTrue(); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); expect(isEnabled).assertTrue(); - retValue = await enterpriseDeviceManager.disableAdmin(WANT1); - console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); - expect(retValue).assertTrue(); + await enterpriseDeviceManager.disableAdmin(WANT1); + console.log('enterpriseDeviceManager.disableAdmin.'); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); @@ -53,18 +51,16 @@ export default function edmPromiseTest() { */ it('enableAdmin_test_003', 0, async function (done) { console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER'); - var retValue = await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER : ' + retValue); - expect(retValue).assertTrue(); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER.'); var isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); console.log('enterpriseDeviceManager.isSuperAdmin :' + isEnabled); expect(isEnabled).assertTrue(); - retValue = await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); - console.log('enterpriseDeviceManager.disableSuperAdmin : ' + retValue); - expect(retValue).assertTrue(); + await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); + console.log('enterpriseDeviceManager.disableSuperAdmin.'); isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); console.log('enterpriseDeviceManager.isSuperAdmin : ' + isEnabled); @@ -72,51 +68,23 @@ export default function edmPromiseTest() { done(); }) - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0005 - * @tc.name test enableAdmin method in promise mode without user id - * @tc.desc enable admin in promise mode - */ - it('enableAdmin_test_005', 0, async function (done) { - var retValue = await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL : ' + retValue); - expect(retValue).assertTrue(); - - var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertTrue(); - - retValue = await enterpriseDeviceManager.disableAdmin(WANT1); - console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); - expect(retValue).assertTrue(); - - isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertFalse(); - - done(); - }) - /** * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0007 * @tc.name test enableAdmin method in promise mode with default user id * @tc.desc enable admin in multi-user */ it('enableAdmin_test_007', 0, async function (done) { - var retValue = await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, + await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL : ' + retValue); - expect(retValue).assertTrue(); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); expect(isEnabled).assertTrue(); - retValue = await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); - expect(retValue).assertTrue(); + await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.disableAdmin.'); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); @@ -130,9 +98,9 @@ export default function edmPromiseTest() { * @tc.desc enable admin in multi-user */ it('enableAdmin_test_009', 0, async function (done) { - var retValue = await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, + await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, TEST_USER_ID, OnReceiveEvent); - async function OnReceiveEvent(err, datainfo) { + async function OnReceiveEvent(err) { expect(err != null).assertTrue(); if (err) { // user exsit but super admin can only be enabled in user 100 @@ -148,9 +116,9 @@ export default function edmPromiseTest() { * @tc.desc enable admin in multi-user */ it('enableAdmin_test_010', 0, async function (done) { - var retValue = await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, + await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, ERR_USER_ID, OnReceiveEvent); - async function OnReceiveEvent(err, datainfo) { + async function OnReceiveEvent(err) { expect(err != null).assertTrue(); if (err) { // user does not exsit @@ -165,26 +133,24 @@ export default function edmPromiseTest() { * @tc.name test enableAdmin method in promise mode with test user id * @tc.desc enable admin in multi-user */ - it('enableAdmin_test_011', 0, async function (done) { - var retValue = await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL : ' + retValue); - expect(retValue).assertTrue(); + it('enableAdmin_test_011', 0, async function (done) { + await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertTrue(); + var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); + console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); + expect(isEnabled).assertTrue(); - retValue = await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); - expect(retValue).assertTrue(); + await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID); + console.log('enterpriseDeviceManager.disableAdmin.'); - isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertFalse(); - done(); - }) + isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); + console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); + expect(isEnabled).assertFalse(); + done(); + }) /** * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0015 @@ -192,13 +158,13 @@ export default function edmPromiseTest() { * @tc.desc enable admin in multi-user */ it('enableAdmin_test_015', 0, async function (done) { - var retValue = await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, + await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID, OnReceiveEvent); - async function OnReceiveEvent(err, datainfo) { - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL :' + datainfo); - expect(datainfo).assertTrue(); + async function OnReceiveEvent(err) { + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); + expect(err == null).assertTrue(); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); @@ -208,9 +174,8 @@ export default function edmPromiseTest() { console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); expect(isEnabled).assertTrue(); - retValue = await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); - expect(retValue).assertTrue(); + await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.disableAdmin.'); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); @@ -220,9 +185,8 @@ export default function edmPromiseTest() { console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); expect(isEnabled).assertTrue(); - retValue = await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); - expect(retValue).assertTrue(); + await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID); + console.log('enterpriseDeviceManager.disableAdmin.'); isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); @@ -237,17 +201,16 @@ export default function edmPromiseTest() { * @tc.desc enable and disable admin in multi-user */ it('enableAdmin_test_0016', 0, async function (done) { - var retValue = await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER : ' + retValue); - expect(retValue).assertTrue(); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER.'); var isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); console.log('enterpriseDeviceManager.isSuperAdmin :' + isEnabled); expect(isEnabled).assertTrue(); try { - retValue = await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID); } catch (error) { expect(error != null).assertTrue(); @@ -258,9 +221,8 @@ export default function edmPromiseTest() { console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); expect(isEnabled).assertFalse(); - retValue = await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); - console.log('enterpriseDeviceManager.disableSuperAdmin : ' + retValue); - expect(retValue).assertTrue(); + await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); + console.log('enterpriseDeviceManager.disableSuperAdmin.'); isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); console.log('enterpriseDeviceManager.isSuperAdmin : ' + isEnabled); @@ -274,26 +236,23 @@ export default function edmPromiseTest() { * @tc.desc set enterprise info in promise mode */ it('setEnterpriseInfo_test_001', 0, async function (done) { - var retValue = await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL : ' + retValue); - expect(retValue).assertTrue(); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); var isEnabled = await enterpriseDeviceManager.isAdminEnabled(SELFWANT); expect(isEnabled).assertTrue(); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - retValue = await enterpriseDeviceManager.setEnterpriseInfo(SELFWANT, ENTINFO2); - console.log('enterpriseDeviceManager.setEnterpriseInfo : ' + retValue); - expect(retValue).assertTrue(); + await enterpriseDeviceManager.setEnterpriseInfo(SELFWANT, ENTINFO2); + console.log('enterpriseDeviceManager.setEnterpriseInfo.'); var entInfo = await enterpriseDeviceManager.getEnterpriseInfo(SELFWANT); expect(entInfo.name).assertEqual(COMPANYNAME2); expect(entInfo.description).assertEqual(DESCRIPTION2); - retValue = await enterpriseDeviceManager.disableAdmin(SELFWANT); - console.log('enterpriseDeviceManager.disableAdmin : ' + retValue); - expect(retValue).assertTrue(); + await enterpriseDeviceManager.disableAdmin(SELFWANT); + console.log('enterpriseDeviceManager.disableAdmin.'); isEnabled = await enterpriseDeviceManager.isAdminEnabled(SELFWANT); console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); @@ -325,9 +284,177 @@ export default function edmPromiseTest() { let dsmgr = await enterpriseDeviceManager.getDeviceSettingsManager(); expect(dsmgr !== null).assertTrue(); console.log('before setDateTime'); - var setSuccess = await dsmgr.setDateTime(SELFWANT, 1526003846000); - expect(setSuccess).assertTrue(); + await dsmgr.setDateTime(SELFWANT, 1526003846000); + await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); + done(); + }) + + /** + * @tc.number subscribeManagedEvent_test_002 + * @tc.desc Test subscribeManagedEvent method in promise mode. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('subscribeManagedEvent_test_002', 0, async function (done) { + console.info('-----------subscribeManagedEvent_test_002 start-------------'); + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); + await enterpriseDeviceManager.subscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS).then(() => { + }).catch((error) => { + expect(error == null).assertTrue(); + }); + await enterpriseDeviceManager.disableAdmin(SELFWANT); + console.log('enterpriseDeviceManager.disableAdmin.'); + done(); + }) + + /** + * @tc.number subscribeManagedEvent_test_004 + * @tc.desc Test subscribeManagedEvent method in promise mode and subscribe invalid managed events. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('subscribeManagedEvent_test_004', 0, async function (done) { + console.info('-----------subscribeManagedEvent_test_004 start-------------'); + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); + await enterpriseDeviceManager.subscribeManagedEvent(SELFWANT, SUBSCRIBE_INVALID_EVENTS).then(() => { + }).catch((error) => { + expect(error.code == 9200008).assertTrue(); + }); + await enterpriseDeviceManager.disableAdmin(SELFWANT); + console.log('enterpriseDeviceManager.disableAdmin.'); + done(); + }) + + /** + * @tc.number subscribeManagedEvent_test_006 + * @tc.desc Test subscribeManagedEvent method in promise mode and subscribe when disable admin. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('subscribeManagedEvent_test_006', 0, async function (done) { + console.info('-----------subscribeManagedEvent_test_006 start-------------'); + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); + await enterpriseDeviceManager.disableAdmin(SELFWANT); + console.log('enterpriseDeviceManager.disableAdmin.'); + await enterpriseDeviceManager.subscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS).then(() => { + }).catch((error) => { + expect(error.code == 9200001).assertTrue(); + }); + done(); + }) + + /** + * @tc.number subscribeManagedEvent_test_008 + * @tc.desc Test subscribeManagedEvent method in promise mode and subscribe when enable super admin. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('subscribeManagedEvent_test_008', 0, async function (done) { + console.info('-----------subscribeManagedEvent_test_008 start-------------'); + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER.'); + await enterpriseDeviceManager.subscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS).then(() => { + }).catch((error) => { + expect(error == null).assertTrue(); + }); + await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); + console.log('enterpriseDeviceManager.disableSuperAdmin ADMIN_TYPE_SUPER.'); + done(); + }) + + /** + * @tc.number unsubscribeManagedEvent_test_002 + * @tc.desc Test subscribeManagedEvent method in promise mode. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('unsubscribeManagedEvent_test_002', 0, async function (done) { + console.info('-----------unsubscribeManagedEvent_test_002 start-------------'); + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); + + await enterpriseDeviceManager.unsubscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS).then(() => { + }).catch((error) => { + expect(error == null).assertTrue(); + }); + await enterpriseDeviceManager.disableAdmin(SELFWANT); + console.log('enterpriseDeviceManager.disableAdmin.'); + done(); + }) + + /** + * @tc.number unsubscribeManagedEvent_test_004 + * @tc.desc Test subscribeManagedEvent method in promise mode and unsubscribe invalid managed events. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('unsubscribeManagedEvent_test_004', 0, async function (done) { + console.info('-----------unsubscribeManagedEvent_test_004 start-------------'); + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); + await enterpriseDeviceManager.unsubscribeManagedEvent(SELFWANT, SUBSCRIBE_INVALID_EVENTS).then(() => { + }).catch((error) => { + expect(error.code == 9200008).assertTrue(); + }); + await enterpriseDeviceManager.disableAdmin(SELFWANT); + console.log('enterpriseDeviceManager.disableAdmin.'); + done(); + }) + + /** + * @tc.number unsubscribeManagedEvent_test_006 + * @tc.desc Test subscribeManagedEvent method in promise mode and unsubscribe when disable admin. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('unsubscribeManagedEvent_test_006', 0, async function (done) { + console.info('-----------unsubscribeManagedEvent_test_006 start-------------'); + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); + await enterpriseDeviceManager.disableAdmin(SELFWANT); + console.log('enterpriseDeviceManager.disableAdmin.'); + await enterpriseDeviceManager.unsubscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS).then(() => { + }).catch((error) => { + expect(error.code == 9200001).assertTrue(); + }); + done(); + }) + + /** + * @tc.number unsubscribeManagedEvent_test_008 + * @tc.desc Test subscribeManagedEvent method in promise mode and unsubscribe when enable super admin. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('unsubscribeManagedEvent_test_008', 0, async function (done) { + console.info('-----------unsubscribeManagedEvent_test_008 start-------------'); + await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, + enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, DEFAULT_USER_ID); + console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER.'); + await enterpriseDeviceManager.unsubscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS).then(() => { + }).catch((error) => { + expect(error == null).assertTrue(); + }); await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); + console.log('enterpriseDeviceManager.disableSuperAdmin ADMIN_TYPE_SUPER.'); done(); }) }) diff --git a/customization/edm_xts_stage/entry/src/main/module.json b/customization/edm_xts_stage/entry/src/main/module.json index 82f43a88410eecc7978d3367b221d5bca900076f..9c4263f206bade7054233b465e1a88fdc38d0dd3 100644 --- a/customization/edm_xts_stage/entry/src/main/module.json +++ b/customization/edm_xts_stage/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/demo/hjsunit_sample/src/main/config.json b/demo/hjsunit_sample/src/main/config.json index 9889c145cf45093c6b938d34bb050c555653f09e..9fe87aa97e7e50d9d943b8183a2b3c67926208fe 100755 --- a/demo/hjsunit_sample/src/main/config.json +++ b/demo/hjsunit_sample/src/main/config.json @@ -16,6 +16,7 @@ "package": "com.example.myapplication", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/distributed_schedule_lite/distributed_schedule_posix/BUILD.gn b/distributed_schedule_lite/distributed_schedule_posix/BUILD.gn index eae26eaccfd046a6a7ecb2d4f4fc187fa56ba71e..bba5678f7f919a0cf359132e9d2360bf4fc7c91d 100755 --- a/distributed_schedule_lite/distributed_schedule_posix/BUILD.gn +++ b/distributed_schedule_lite/distributed_schedule_posix/BUILD.gn @@ -25,7 +25,7 @@ hcpptest_suite("ActsDMSTest") { include_dirs = [ "src", "src/utils", - "//utils/native/lite/include", + "//commonlibrary/utils_lite/include", "//third_party/bounds_checking_function/include", "//foundation/communication/ipc/interfaces/innerkits/c/ipc/include", "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/registry", diff --git a/distributed_schedule_lite/system_ability_manager_posix/BUILD.gn b/distributed_schedule_lite/system_ability_manager_posix/BUILD.gn index dd19e328133a92de4ecc05ab8028521f9acdff14..fa17cce4c39c4b79db8fc687e043381de72c0642 100755 --- a/distributed_schedule_lite/system_ability_manager_posix/BUILD.gn +++ b/distributed_schedule_lite/system_ability_manager_posix/BUILD.gn @@ -67,7 +67,7 @@ hcpptest_suite("ActsSamgrTest") { "src", "src/utils", "include", - "//utils/native/native_lite/include", + "//commonlibrary/utils_lite/include", "//third_party/bounds_checking_function/include", "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/registry", "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/samgr", diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/config.json b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/config.json index 54d1cf250dd5e0d46cf961e27411950028bb1feb..5c08d093f17179dd85bcd399a562ac95f3658684 100644 --- a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/config.json +++ b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/config.json @@ -17,7 +17,10 @@ "package": "com.acts.distributeddatamgr.pasteboardtest", "name": ".MyApplication", "mainAbility": "com.acts.distributeddatamgr.pasteboardtest.MainAbility", - "deviceType": ["phone"], + "deviceType": [ + "default", + "phone" + ], "distro": { "deliveryWithInstall": true, "moduleName": "entry", diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/List.test.ets b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/List.test.ets index 2645795bb8fdb4a1a29ad872f1215e6dad059171..c3c7b5e55b6a32c474d9ac7a90fe44f60f17c838 100644 --- a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/List.test.ets +++ b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/List.test.ets @@ -14,7 +14,10 @@ */ import pasteBoardJEtsunitTest from './PasteBoardEtsunitTest'; - +import pasteBoardTest from './PasteBoard.test.ets'; +import pasteBoardSupportBinaryDataTest from './PasteBoardSupportBinaryData.test'; export default function testsuite() { + pasteBoardSupportBinaryDataTest() pasteBoardJEtsunitTest() + pasteBoardTest() } \ No newline at end of file diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoard.test.ets b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoard.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ef9757805211d02384abea7e1743b5e243d76638 --- /dev/null +++ b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoard.test.ets @@ -0,0 +1,114 @@ +/* + * 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 pasteboard from '@ohos.pasteboard' +import image from '@ohos.multimedia.image'; + +const color = new ArrayBuffer(96); +let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } +export default function pasteBoardTest(){ + describe('pasteBoardTest', function() { + console.info('start################################start'); + + /** + * @tc.number SUB_PASTEBOARD_FUNCTION_ETS_TEST_1100 + * @tc.name Adds one record(s) + * @tc.desc Test pasteBoard SetProperty API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_PASTEBOARD_FUNCTION_ETS_TEST_1100', 0, async function (done) { + var pasteData = pasteboard.createHtmlData('application/xml'); + console.info("SUB_PASTEBOARD_FUNCTION_ETS_TEST_1100 start") + var systemPasteBoard = pasteboard.getSystemPasteboard(); + await systemPasteBoard.clear().then(async () => { + let prop = pasteData.getProperty(); + prop.shareOption = pasteboard.ShareOption.InApp; + pasteData.setProperty(prop); + var property = pasteData.getProperty(); + expect(0).assertEqual(property.shareOption) + console.info("SUB_PASTEBOARD_FUNCTION_ETS_TEST_1100 end") + }) + done(); + }) + /** + * @tc.number SUB_PASTEBOARD_FUNCTION_ETS_TEST_1200 + * @tc.name Adds one record(s) + * @tc.desc Test pasteBoard SetProperty API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_PASTEBOARD_FUNCTION_ETS_TEST_1200', 0, async function (done) { + var pasteData = pasteboard.createPlainTextData("hello"); + console.info("SUB_PASTEBOARD_FUNCTION_ETS_TEST_1200 start") + var systemPasteBoard = pasteboard.getSystemPasteboard(); + await systemPasteBoard.clear().then(async () => { + let prop = pasteData.getProperty(); + prop.shareOption = pasteboard.ShareOption.LocalDevice; + pasteData.setProperty(prop); + var property = pasteData.getProperty(); + expect(1).assertEqual(property.shareOption) + console.info("SUB_PASTEBOARD_FUNCTION_ETS_TEST_1200 end") + }) + done(); + }) + /** + * @tc.number SUB_PASTEBOARD_FUNCTION_ETS_TEST_1300 + * @tc.name Adds one record(s) + * @tc.desc Test pasteBoard SetProperty API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_PASTEBOARD_FUNCTION_ETS_TEST_1300', 0, async function (done) { + var pasteData = pasteboard.createPlainTextData("hello"); + console.info("SUB_PASTEBOARD_FUNCTION_ETS_TEST_1300 start") + var systemPasteBoard = pasteboard.getSystemPasteboard(); + await systemPasteBoard.clear().then(async () => { + let prop = pasteData.getProperty(); + prop.shareOption = pasteboard.ShareOption.CrossDevice; + pasteData.setProperty(prop); + var property = pasteData.getProperty(); + expect(2).assertEqual(property.shareOption) + console.info("SUB_PASTEBOARD_FUNCTION_ETS_TEST_1300 end") + }) + done(); + }) + /** + * @tc.number SUB_PASTEBOARD_FUNCTION_ETS_TEST_1400 + * @tc.name Adds one record(s) + * @tc.desc Test pasteBoard SetProperty API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_PASTEBOARD_FUNCTION_ETS_TEST_1400', 0, async function (done) { + var pasteData = pasteboard.createPlainTextData("hello"); + console.info("SUB_PASTEBOARD_FUNCTION_ETS_TEST_1400 start") + var systemPasteBoard = pasteboard.getSystemPasteboard(); + await systemPasteBoard.clear().then(async () => { + let prop = pasteData.getProperty(); + pasteData.setProperty(prop); + var property = pasteData.getProperty(); + expect(2).assertEqual(property.shareOption) + console.info("SUB_PASTEBOARD_FUNCTION_ETS_TEST_1400 end") + }) + done(); + }) + }); +} diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoardEtsunitTest.ets b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoardEtsunitTest.ets index fe992165d2ccff4a508af22730d9d3354e503635..f974c490eb762556f93c55423bb8ec3d9583bb75 100644 --- a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoardEtsunitTest.ets +++ b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoardEtsunitTest.ets @@ -3358,6 +3358,7 @@ export default function pasteBoardJEtsunitTest() { console.info('f_test64 Checks there is content in the pasteboard') systemPasteboard.hasPasteData().then((data) => { console.info('f_test64 systemPasteboard.hasPasteData promise data = ' + data); + expect(data).assertTrue(); console.info('f_test64 Checks the number of records'); systemPasteboard.getPasteData().then((data) => { @@ -3365,12 +3366,14 @@ export default function pasteBoardJEtsunitTest() { var pasteData1 = data; var recordCount = pasteData1.getRecordCount(); console.info('f_test64 recordCount = ' + recordCount); + expect(recordCount).assertEqual(1) console.info('f_test64 Removes the Record') pasteData1.removeRecordAt(0) console.info('f_test64 Checks the number of records'); var recordCount1 = pasteData1.getRecordCount(); + expect(recordCount1).assertEqual(0); console.info('f_test64 recordCount = ' + recordCount1); console.info('SUB_pasteBoard_function_JS_API_6400 end'); @@ -3427,7 +3430,7 @@ export default function pasteBoardJEtsunitTest() { systemPasteboard.hasPasteData().then((data) => { console.info('f_test65 systemPasteboard.hasPasteData promise data = ' + data); - console.info('SUB_pasteBoard_function_JS_API_6400 end'); + console.info('SUB_pasteBoard_function_JS_API_6500 end'); done(); }); }); diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoardSupportBinaryData.test.ets b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoardSupportBinaryData.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2676c83415d666713293550a504be53a78737d05 --- /dev/null +++ b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoardSupportBinaryData.test.ets @@ -0,0 +1,147 @@ +/* + * 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 pasteboard from '@ohos.pasteboard' + +export default function pasteBoardSupportBinaryDataTest(){ + describe('pasteBoardSupportBinaryDataTest', function() { + console.info('start################################start'); + + /** + * @tc.number SUB_PASTEBOARD_BINARY_FUNCTION_ETS_TEST_0100 + * @tc.name Create pasteData use binary parameter + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_PASTEBOARD_BINARY_FUNCTION_ETS_TEST_0100', 0, async function (done) { + console.info("SUB_PASTEBOARD_BINARY_FUNCTION_ETS_TEST_0100 start") + var systemPasteBoard = pasteboard.getSystemPasteboard(); + await systemPasteBoard.clear().then(async () => { + var pasteData = undefined; + console.info("systemPasteBoard clear data success") + var dataUri = new ArrayBuffer(256) + pasteData = pasteboard.createData("text/uri",dataUri) + var addUri = new ArrayBuffer(128) + pasteData.addRecord("text/uri", addUri) + var recordUri = new ArrayBuffer(96) + var pasteDataRecord = pasteboard.createRecord("text/uri", recordUri) + pasteData.addRecord(pasteDataRecord) + await systemPasteBoard.setPasteData(pasteData).then(async () => { + console.info("Set pastedata success") + await systemPasteBoard.hasPasteData().then(async (data) => { + console.info("Check pastedata has data success, result: " + data) + expect(data).assertTrue(); + await systemPasteBoard.getPasteData().then(async (data) => { + console.info("Get paste data success") + expect(data.getRecordCount()).assertEqual(3) + }) + }) + }) + }) + done(); + }) + + /** + * @tc.number SUB_PASTEBOARD_BINARY_FUNCTION_ETS_TEST_0200 + * @tc.name Create pasteData use binary parameter + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_PASTEBOARD_BINARY_FUNCTION_ETS_TEST_0200', 0, async function (done) { + console.info("SUB_PASTEBOARD_BINARY_FUNCTION_ETS_TEST_0200 start") + var systemPasteBoard = pasteboard.getSystemPasteboard(); + await systemPasteBoard.clear().then(async () => { + var pasteData = undefined; + console.info("systemPasteBoard clear data success") + var dataHtml = new ArrayBuffer(256) + pasteData = pasteboard.createData("text/html",dataHtml) + var addHtml = new ArrayBuffer(128) + pasteData.addRecord("text/html", addHtml) + var recordHtml = new ArrayBuffer(64) + var pasteDataRecord = pasteboard.createRecord("text/html", recordHtml) + pasteData.addRecord(pasteDataRecord) + await systemPasteBoard.setPasteData(pasteData).then(async () => { + console.info("set pastedata success") + await systemPasteBoard.hasPasteData().then(async (data) => { + console.info("Check pastedata has data success, result: " + data) + expect(data).assertTrue(); + await systemPasteBoard.getPasteData().then(async (data) => { + console.info("get paste data success") + expect(data.getRecordCount()).assertEqual(3) + }) + }) + }) + }) + done(); + }) + + /** + * @tc.number SUB_PASTEBOARD_BINARY_FUNCTION_ETS_TEST_0300 + * @tc.name Create pasteData use binary parameter + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_PASTEBOARD_BINARY_FUNCTION_ETS_TEST_0300', 0, async function (done) { + console.info("SUB_PASTEBOARD_BINARY_FUNCTION_ETS_TEST_0300 start") + var systemPasteBoard = pasteboard.getSystemPasteboard(); + await systemPasteBoard.clear().then(async () => { + console.info("systemPasteBoard clear data success") + var pasteData = undefined + var pasteRecord = undefined; + + + var dataHtml = new ArrayBuffer(256) + pasteData = pasteboard.createData("x".repeat(1025),dataHtml) + expect(pasteData).assertEqual(undefined) + pasteData = pasteboard.createData("x".repeat(1024),dataHtml) + expect(pasteData != undefined).assertTrue(); + + var addHtml = new ArrayBuffer(128) + pasteData.addRecord("x".repeat(1025),dataHtml) + expect(pasteData.getRecordCount()).assertEqual(1) + pasteData.addRecord("x".repeat(1024),dataHtml) + expect(pasteData.getRecordCount()).assertEqual(2) + + var recordHtml = new ArrayBuffer(64) + pasteRecord = pasteboard.createRecord("x".repeat(1025),dataHtml) + expect(pasteRecord).assertEqual(undefined); + pasteRecord = pasteboard.createRecord("x".repeat(1024),dataHtml) + expect(pasteRecord != undefined).assertTrue();; + + pasteData.addRecord(pasteRecord) + await systemPasteBoard.setPasteData(pasteData).then(async () => { + console.info("set pastedata success") + await systemPasteBoard.hasPasteData().then(async (data) => { + console.info("Check pastedata has data success, result: " + data) + expect(data).assertTrue(); + await systemPasteBoard.getPasteData().then(async (data) => { + console.info("get paste data success") + expect(data.getRecordCount()).assertEqual(3) + }) + }) + }) + }) + done(); + }) + console.info('end################################end'); + }); +} diff --git a/distributeddatamgr/dataObjectjstest/hap/src/main/config.json b/distributeddatamgr/dataObjectjstest/hap/src/main/config.json index 6d81160593f04a9230751298d772c31cb7a3b686..bf5c1ac6ef50f891761f9c2febdb0b07bf9d18cc 100644 --- a/distributeddatamgr/dataObjectjstest/hap/src/main/config.json +++ b/distributeddatamgr/dataObjectjstest/hap/src/main/config.json @@ -17,6 +17,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/distributeddatamgr/dataSharejstest/hap/src/main/config.json b/distributeddatamgr/dataSharejstest/hap/src/main/config.json index c8e4ccb52ca65152056d27f168f7f76301196895..4a69c0c481e8ebfbf0a9d4d2f4101444fea6f96c 100644 --- a/distributeddatamgr/dataSharejstest/hap/src/main/config.json +++ b/distributeddatamgr/dataSharejstest/hap/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.dataSharejstest", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/distributeddatamgr/dataSharejstest/hap/src/main/js/test/DataAbilityPredicatesJsunit.test.js b/distributeddatamgr/dataSharejstest/hap/src/main/js/test/DataAbilityPredicatesJsunit.test.js index ed75ef56d171fcb09f74032e06e00eee8556eb72..9b03e957e67e7a29434a1016a27990c57f069c89 100644 --- a/distributeddatamgr/dataSharejstest/hap/src/main/js/test/DataAbilityPredicatesJsunit.test.js +++ b/distributeddatamgr/dataSharejstest/hap/src/main/js/test/DataAbilityPredicatesJsunit.test.js @@ -1908,7 +1908,9 @@ describe('dataAbilityPredicatesTest', function () { console.info(TAG + "************* testAnd0003 start *************"); { let dataAbilityPredicates = await new dataAbility.DataAbilityPredicates(); + var dataAbilityPredicatesInit = dataAbilityPredicates dataAbilityPredicates.equalTo("stringValue", "ABCDEFGHIJKLMN").or().and().equalTo("integerValue", 1); + expect(dataAbilityPredicates == dataAbilityPredicatesInit).assertTrue(); let predicates = dataAbility.createRdbPredicates("AllDataType", dataAbilityPredicates); console.info(TAG + "you should not start a request" + " with \"and\" or use or() before this function"); @@ -1926,9 +1928,10 @@ describe('dataAbilityPredicatesTest', function () { console.info(TAG + "************* testAnd0004 start *************"); { let dataAbilityPredicates = await new dataAbility.DataAbilityPredicates(); + var dataAbilityPredicatesInit = dataAbilityPredicates dataAbilityPredicates.equalTo("stringValue", "ABCDEFGHIJKLMN").or().or().equalTo("integerValue", 1); let predicates = dataAbility.createRdbPredicates("AllDataType", dataAbilityPredicates); - + expect(dataAbilityPredicates == dataAbilityPredicatesInit).assertTrue(); console.info(TAG + "you are starting a sql request with predicate or or," + "using function or() immediately after another or(). that is ridiculous."); } diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/BUILD.gn b/distributeddatamgr/kvStoretest/kvStoreStagetest/BUILD.gn index 7df872a941a62acce0a57423a3d3f8ca36f1555f..bb8ec70fd54ec27e52b580575a6352b0936713b7 100644 --- a/distributeddatamgr/kvStoretest/kvStoreStagetest/BUILD.gn +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/BUILD.gn @@ -24,7 +24,7 @@ ohos_js_hap_suite("ActsKvStoreStageTest") { certificate_profile = "signature/openharmony_sx.p7b" hap_name = "ActsKvStoreStageTest" subsystem_name = "distributeddatamgr" - part_name = "distributeddatamgr" + part_name = "kv_store" } ohos_app_scope("kvStoreStage_app_profile") { diff --git a/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/module.json b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/module.json index 0623bfe3915dfb3e5a6b562acee1c55826c02ce5..8cb95183bf14e1126d71751db75e15e979585301 100644 --- a/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/module.json +++ b/distributeddatamgr/kvStoretest/kvStoreStagetest/entry/src/main/module.json @@ -8,6 +8,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/distributeddatamgr/kvStoretest/kvStorejstest/hap/BUILD.gn b/distributeddatamgr/kvStoretest/kvStorejstest/hap/BUILD.gn index 9a1cba87c45661295d266cf8e55d8180071b07f5..49e3451d314157ea0bc5ad7b9cff774b0bef5d8d 100644 --- a/distributeddatamgr/kvStoretest/kvStorejstest/hap/BUILD.gn +++ b/distributeddatamgr/kvStoretest/kvStorejstest/hap/BUILD.gn @@ -22,7 +22,7 @@ ohos_js_hap_suite("kvStore_js_test") { certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsKvStoreJsTest" subsystem_name = "distributeddatamgr" - part_name = "distributeddatamgr" + part_name = "kv_store" } ohos_js_assets("kvStore_js_assets") { js2abc = true diff --git a/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/config.json b/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/config.json index c6f672c60b170074d371177d0dfd4029033754b2..d84d2eed15214cc8563d126a5ec54955c32f7f47 100644 --- a/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/config.json +++ b/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/config.json @@ -18,6 +18,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { 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 66d4db197f479d2a7a1068926dcc113e68cf799a..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 @@ -1795,7 +1795,7 @@ describe('deviceKvStoreCallbackTest', function () { * @tc.name [JS-API8]DeviceKvStore.RemoveDeviceData() * @tc.desc Test Js Api DeviceKvStore.RemoveDeviceData testcase 103 */ - it('testDeviceKvStoreRemoveDeviceData103', 0, async function (done) { + it('testDeviceKvStoreRemoveDeviceData103', 0, async function (done) { console.info('testDeviceKvStoreRemoveDeviceData103'); try { await kvStore.removeDeviceData('', function (err,data) { 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 dccb08d871cd5561a7f2151f09dbc8e8a4af596c..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,10 +1987,10 @@ 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((err) => { + await kvStore.removeDeviceData('').then((data) => { console.info('testDeviceKvStoreRemoveDeviceData003 removeDeviceData success'); expect(null).assertFail(); }).catch((err) => { @@ -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/FieldNodeJsunit.test.js b/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/FieldNodeJsunit.test.js index 480b40a6842c84e0905f0d0071b3cb7e05e0432f..8eaf9bf4524fcbea49c91b6d1f224f0dd9f9e368 100644 --- a/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/FieldNodeJsunit.test.js +++ b/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/FieldNodeJsunit.test.js @@ -57,6 +57,7 @@ describe('fieldNodeTest', function() { node = null; } catch (e) { console.info("testAppendChild002 " + e); + expect(null).assertFail(); } done(); }) diff --git a/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/KvManagerCallbackJsunit.test.js b/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/KvManagerCallbackJsunit.test.js index d815f6660c28a13961a19b47aebc1d1cfabf50ce..08bc6006bb9d40debcd4094a3cfa179d10376893 100644 --- a/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/KvManagerCallbackJsunit.test.js +++ b/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/KvManagerCallbackJsunit.test.js @@ -911,7 +911,7 @@ describe('kvManagerCallbackTest', function () { }) /** - * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORE_PUT_1000 + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVSTORE_PUT_CALLBACK_1000 * @tc.name [JS-API8]KVStore.Put * @tc.desc Test Js Api KVManager.Put testcase 100 */ diff --git a/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/KvManagerPromiseJsunit.test.js b/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/KvManagerPromiseJsunit.test.js index bec1542099209219c32724ca9cb1b7dc0a46cc1c..d6b7c7f856d827638f2101d1b644301bd8859afa 100644 --- a/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/KvManagerPromiseJsunit.test.js +++ b/distributeddatamgr/kvStoretest/kvStorejstest/hap/src/main/js/test/KvManagerPromiseJsunit.test.js @@ -319,7 +319,7 @@ describe('kvManagerPromiseTest', function () { }) /** - * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1000 + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_PROMISE_1000 * @tc.name [JS-API8]KVManager.GetKVStore. * @tc.desc Test Js Api KVManager.GetKVStore testcase 010 */ @@ -346,7 +346,7 @@ describe('kvManagerPromiseTest', function () { }) /** - * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1100 + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_PROMISE_1100 * @tc.name [JS-API8]KVManager.GetKVStore. * @tc.desc Test Js Api KVManager.GetKVStore testcase 011 */ @@ -373,7 +373,7 @@ describe('kvManagerPromiseTest', function () { }) /** - * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1200 + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_PROMISE_1200 * @tc.name [JS-API8]KVManager.GetKVStore. * @tc.desc Test Js Api KVManager.GetKVStore testcase 012 */ @@ -400,7 +400,7 @@ describe('kvManagerPromiseTest', function () { }) /** - * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1300 + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_PROMISE_1300 * @tc.name [JS-API8]KVManager.GetKVStore. * @tc.desc Test Js Api KVManager.GetKVStore testcase 013 */ @@ -429,7 +429,7 @@ describe('kvManagerPromiseTest', function () { }) /** - * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1400 + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_PROMISE_1400 * @tc.name [JS-API8]KVManager.GetKVStore. * @tc.desc Test Js Api KVManager.GetKVStore testcase 014 */ @@ -455,7 +455,7 @@ describe('kvManagerPromiseTest', function () { }) /** - * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1500 + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_PROMISE_1500 * @tc.name [JS-API8]KVManager.GetKVStore. * @tc.desc Test Js Api KVManager.GetKVStore testcase 015 */ @@ -481,7 +481,7 @@ describe('kvManagerPromiseTest', function () { }) /** - * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1600 + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_PROMISE_1600 * @tc.name [JS-API8]KVManager.GetKVStore. * @tc.desc Test Js Api KVManager.GetKVStore testcase 016 */ @@ -507,7 +507,7 @@ describe('kvManagerPromiseTest', function () { }) /** - * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1700 + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_PROMISE_1700 * @tc.name [JS-API8]KVManager.GetKVStore. * @tc.desc Test Js Api KVManager.GetKVStore testcase 017 */ @@ -533,7 +533,7 @@ describe('kvManagerPromiseTest', function () { }) /** - * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1800 + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_PROMISE_1800 * @tc.name [JS-API8]KVManager.GetKVStore. * @tc.desc Test Js Api KVManager.GetKVStore testcase 018 */ @@ -559,7 +559,7 @@ describe('kvManagerPromiseTest', function () { }) /** - * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_1900 + * @tc.number SUB_DISTRIBUTEDDATAMGR_KVMANAGER_GETKVSTORE_PROMISE_1900 * @tc.name [JS-API8]KVManager.GetKVStore. * @tc.desc Test Js Api KVManager.GetKVStore testcase 019 */ 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 792701fc1f32562714dc18aaa0578fe5c9082363..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 @@ -1754,7 +1754,7 @@ describe('singleKvStoreCallbackTest', function () { * @tc.name [JS-API8]SingleKvStore.RemoveDeviceData() * @tc.desc Test Js Api SingleKvStore.RemoveDeviceData() testcase 103 */ - it('testSingleKvStoreRemoveDeviceData103', 0, async function (done) { + it('testSingleKvStoreRemoveDeviceData103', 0, async function (done) { console.info('testSingleKvStoreRemoveDeviceData103'); try { await kvStore.removeDeviceData('', function (err,data) { 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 15bcefc7a0b18d1025f84605235e53e981938718..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,10 +1956,10 @@ 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((err) => { + await kvStore.removeDeviceData('').then((data) => { console.info('testSingleKvStoreRemoveDeviceData003 removeDeviceData success'); expect(null).assertFail(); }).catch((err) => { @@ -1971,6 +1971,7 @@ describe('singleKvStorePromiseTest', function () { done(); }) + /** * @tc.number SUB_DISTRIBUTEDDATAMGR_SINGLEKVSTORE_REMOVEDEVICEDATA_0400 * @tc.name [JS-API8]SingleKvStoreRemoveDeviceData. diff --git a/distributeddatamgr/preferencesjstest/hap/BUILD.gn b/distributeddatamgr/preferencesjstest/hap/BUILD.gn index 183f1fb69ff719accff029fcea8df110e5b99143..50504948d0eda0490bb7f08c66014b6d5b6d773c 100644 --- a/distributeddatamgr/preferencesjstest/hap/BUILD.gn +++ b/distributeddatamgr/preferencesjstest/hap/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/distributeddatamgr/preferencesjstest/hap/src/main/config.json b/distributeddatamgr/preferencesjstest/hap/src/main/config.json index 7e2209339231c13c6c1c316e2186166d4082f6f1..83ccc536c07be174f6fb4f17b413da6926f00061 100644 --- a/distributeddatamgr/preferencesjstest/hap/src/main/config.json +++ b/distributeddatamgr/preferencesjstest/hap/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.preferencesjstest", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesCallBackJsunit.test.js b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesCallBackJsunit.test.js index a80e09aafb8dc49c88a254b8863fb2461e8d4e40..5304dcfb38f4ab114bf314ed5d826ef7512d340c 100644 --- a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesCallBackJsunit.test.js +++ b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesCallBackJsunit.test.js @@ -44,7 +44,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name clear callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0010 + * @tc.number SUB_DDM_Preferences_Clear_CallBack_0010 * @tc.desc clear callback interface test */ it('testPreferencesClear0012', 0, async function (done) { @@ -59,7 +59,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name has string callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0020 + * @tc.number SUB_DDM_Preferences_Has_CallBack_0020 * @tc.desc has string callback interface test */ it('testPreferencesHasKey0032', 0, async function (done) { @@ -72,7 +72,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name has int callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0130 + * @tc.number SUB_DDM_Preferences_Has_CallBack_0030 * @tc.desc has int callback interface test */ it('testPreferencesHasKey0033', 0, async function (done) { @@ -85,7 +85,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name has float callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0140 + * @tc.number SUB_DDM_Preferences_Has_CallBack_0040 * @tc.desc has float callback interface test */ it('testPreferencesHasKey0034', 0, async function (done) { @@ -98,7 +98,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name has long callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0150 + * @tc.number SUB_DDM_Preferences_Has_CallBack_0050 * @tc.desc has long callback interface test */ it('testPreferencesHasKey0035', 0, async function (done) { @@ -111,7 +111,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name has boolean callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0160 + * @tc.number SUB_DDM_Preferences_Has_CallBack_0060 * @tc.desc has boolean callback interface test */ it('testPreferencesHasKey0036', 0, async function (done) { @@ -124,7 +124,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name get defaultValue callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0030 + * @tc.number SUB_DDM_Preferences_Get_CallBack_0070 * @tc.desc get defaultValue callback interface test */ it('testPreferencesGetDefValue0062', 0, async function (done) { @@ -137,7 +137,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name get float callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0040 + * @tc.number SUB_DDM_Preferences_Get_CallBack_0080 * @tc.desc get float callback interface test */ it('testPreferencesGetFloat0072', 0, async function (done) { @@ -151,7 +151,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name get int callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0050 + * @tc.number SUB_DDM_Preferences_Get_CallBack_0090 * @tc.desc get int callback interface test */ it('testPreferencesGetInt0082', 0, async function (done) { @@ -165,7 +165,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name get long callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0060 + * @tc.number SUB_DDM_Preferences_Get_CallBack_0100 * @tc.desc get long callback interface test */ it('testPreferencesGetLong0092', 0, async function (done) { @@ -181,7 +181,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name get String callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0070 + * @tc.number SUB_DDM_Preferences_Get_CallBack_0110 * @tc.desc get String callback interface test */ it('testPreferencesGetString102', 0, async function (done) { @@ -196,7 +196,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name put boolean callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0080 + * @tc.number SUB_DDM_Preferences_Put_CallBack_0120 * @tc.desc put boolean callback interface test */ it('testPreferencesPutBoolean0122', 0, async function (done) { @@ -213,7 +213,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name put float callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0090 + * @tc.number SUB_DDM_Preferences_Put_CallBack_0130 * @tc.desc put float callback interface test */ it('testPreferencesPutFloat0132', 0, async function (done) { @@ -230,7 +230,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name put int callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0100 + * @tc.number SUB_DDM_Preferences_Put_CallBack_0140 * @tc.desc put int callback interface test */ it('testPreferencesPutInt0142', 0, async function (done) { @@ -247,7 +247,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name put long callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0110 + * @tc.number SUB_DDM_Preferences_Put_CallBack_0150 * @tc.desc put long callback interface test */ it('testPreferencesPutLong0152', 0, async function (done) { @@ -265,7 +265,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name put String callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0120 + * @tc.number SUB_DDM_Preferences_Put_CallBack_0160 * @tc.desc put String callback interface test */ it('testPreferencesPutString0162', 0, async function (done) { @@ -282,7 +282,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name clear、put、get、flush String callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0120 + * @tc.number SUB_DDM_Preferences_Flush_CallBack_0170 * @tc.desc flush String callback interface test */ it('testPreferencesCallback0172', 0, function (done) { @@ -320,7 +320,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name put StringArray callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0001 + * @tc.number SUB_DDM_Preferences_Put_CallBack_0180 * @tc.desc put String callback interface test */ it('testPreferencesPutStringArray0001', 0, async function (done) { @@ -338,7 +338,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name put NumberArray callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0002 + * @tc.number SUB_DDM_Preferences_Put_CallBack_0190 * @tc.desc put String callback interface test */ it('testPreferencesPutNumArray0001', 0, async function (done) { @@ -356,7 +356,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name put BoolArray callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0003 + * @tc.number SUB_DDM_Preferences_Put_CallBack_0200 * @tc.desc put String callback interface test */ it('testPreferencesPutBoolArray0001', 0, async function (done) { @@ -374,7 +374,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name getAll callback interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0004 + * @tc.number SUB_DDM_Preferences_GetAll_CallBack_0210 * @tc.desc getAll callback interface test */ it('testPreferencesGetAll0001', 0, async function (done) { @@ -416,7 +416,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name getPreferences callback interface test - * @tc.number SUB_DDM_AppDataFWK_GetPreferencesTest_CallBack_0001 + * @tc.number SUB_DDM_Preferences_GetPreferencesTest_CallBack_0220 * @tc.desc getPreferences callback interface test */ it('testPreferencesGetPreferences0001', 0, async function (done) { @@ -435,7 +435,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name deletePreferences callback interface test - * @tc.number SUB_DDM_AppDataFWK_DeletePreferencesTest_CallBack_0001 + * @tc.number SUB_DDM_Preferences_DeletePreferencesTest_CallBack_0230 * @tc.desc deletePreferences callback interface test */ it('testPreferencesDeletePreferences0001', 0, async function (done) { @@ -463,7 +463,7 @@ describe('preferencesCallBackTest', function () { /** * @tc.name removePreferencesFromCache interface test - * @tc.number SUB_DDM_AppDataFWK_RemovePreferencesFromCache_CallBack_0001 + * @tc.number SUB_DDM_Preferences_RemovePreferencesFromCache_CallBack_0240 * @tc.desc removePreferencesFromCache interface test */ it('testRemovePreferencesFromCache0001', 0, async function (done) { @@ -487,5 +487,19 @@ describe('preferencesCallBackTest', function () { }) done(); }) + + /** + * @tc.name get defaultValue callback interface test + * @tc.number SUB_DDM_Preferences_Get_CallBack_0250 + * @tc.desc get defaultValue callback interface test + */ + it('testPreferencesGetDefValue0173', 0, async function (done) { + await mPreferences.clear(); + await mPreferences.get(KEY_TEST_BOOLEAN_ELEMENT, true, function (err, ret) { + expect(true).assertEqual(ret); + done(); + }) + }) + }) } \ No newline at end of file diff --git a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesHelperJsunit.test.js b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesHelperJsunit.test.js index cf97d631a8675fbe363a828c8126370a92bd5f66..0f40ad0020d0513d269b37a3306df583d79dc788 100644 --- a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesHelperJsunit.test.js +++ b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesHelperJsunit.test.js @@ -36,7 +36,7 @@ describe('preferencesHelperTest', function () { /** * @tc.name getPreferencesSync interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0010 + * @tc.number SUB_DDM_Preferences_GetPreferences_Helper_0010 * @tc.desc getPreferencesSync interface test */ it('testGetPreferencesHelper001', 0, async function () { @@ -49,7 +49,7 @@ describe('preferencesHelperTest', function () { /** * @tc.name getPreferences interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0020 + * @tc.number SUB_DDM_Preferences_GetPreferences_Helper_0020 * @tc.desc getPreferences interface test */ it('testGetPreferencesHelper002', 0, async function (done) { @@ -68,7 +68,7 @@ describe('preferencesHelperTest', function () { /** * @tc.name removePreferencesFromCache interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0030 + * @tc.number SUB_DDM_Preferences_GetPreferences_Helper_0030 * @tc.desc removePreferencesFromCache interface test */ it('testRemovePreferencesFromCache001', 0, async function (done) { @@ -85,7 +85,7 @@ describe('preferencesHelperTest', function () { /** * @tc.name deletePreferences interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0060 + * @tc.number SUB_DDM_Preferences_GetPreferences_Helper_0040 * @tc.desc deletePreferences interface test */ it('testDeletePreferencesHelper002', 0, async function (done) { @@ -102,7 +102,7 @@ describe('preferencesHelperTest', function () { /** * @tc.name put interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_0140 + * @tc.number SUB_DDM_Preferences_Put_Helper_0050 * @tc.desc put interface test */ it('testPreferencesRegisterObserver001', 0, async function () { @@ -117,7 +117,7 @@ describe('preferencesHelperTest', function () { /** * @tc.name repeat on interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_0150 + * @tc.number SUB_DDM_Preferences_On_Helper_0060 * @tc.desc repeat on interface test */ it('testPreferencesRegisterObserver002', 0, async function () { @@ -133,7 +133,7 @@ describe('preferencesHelperTest', function () { /** * @tc.name off interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_0160 + * @tc.number SUB_DDM_Preferences_Off_Helper_0070 * @tc.desc off interface test */ it('testPreferencesUnRegisterObserver001', 0, async function () { diff --git a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesPromiseJsunit.test.js b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesPromiseJsunit.test.js index e4d53dfdac035c7a3e579f6c04e1e5b5d73b6d64..4c6207456cf11971410c29e1b0b043068f8a25ce 100644 --- a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesPromiseJsunit.test.js +++ b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesPromiseJsunit.test.js @@ -29,426 +29,426 @@ var mPreferences; var context; export default function preferencesPromiseTest(){ -describe('preferencesPromiseTest', function () { - beforeAll(async function () { - console.info('beforeAll') - context = featureAbility.getContext() - mPreferences = await dataPreferences.getPreferences(context, NAME); - }) - - afterAll(async function () { - console.info('afterAll') - await dataPreferences.deletePreferences(context, NAME); - }) - - /** - * @tc.name put StringArray promise interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0131 - * @tc.desc put StringArray promise interface test - */ - it('testPreferencesPutStringArray0131', 0, async function (done) { - await mPreferences.clear(); - var stringArr = ['1', '2', '3'] - let promise1 = mPreferences.put(KEY_TEST_STRING_ARRAY_ELEMENT, stringArr) - await promise1 - let promise2 = mPreferences.get(KEY_TEST_STRING_ARRAY_ELEMENT, ['123', '321']) - promise2.then((pre) => { - for (let i = 0; i < stringArr.length; i++) { - expect(stringArr[i]).assertEqual(pre[i]); - } - - }).catch((err) => { - expect(null).assertFail(); + describe('preferencesPromiseTest', function () { + beforeAll(async function () { + console.info('beforeAll') + context = featureAbility.getContext() + mPreferences = await dataPreferences.getPreferences(context, NAME); }) - await promise2 - - done(); - }); - - /** - * @tc.name put NumberArray promise interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0132 - * @tc.desc put NumberArray promise interface test - */ - it('testPreferencesPutNumberArray0132', 0, async function (done) { - await mPreferences.clear(); - var numberArr = [11, 22, 33, 44, 55] - let promise1 = mPreferences.put(KEY_TEST_NUMBER_ARRAY_ELEMENT, numberArr) - await promise1 - let promise2 = mPreferences.get(KEY_TEST_NUMBER_ARRAY_ELEMENT, [123, 321]) - promise2.then((pre) => { - for (let i = 0; i < numberArr.length; i++) { - expect(numberArr[i]).assertEqual(pre[i]); - } - }).catch((err) => { - expect(null).assertFail(); - }) - await promise2 - - done(); - }); - - /** - * @tc.name put BoolArray promise interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0133 - * @tc.desc put BoolArray promise interface test - */ - it('testPreferencesPutBoolArray0133', 0, async function (done) { - await mPreferences.clear(); - var boolArr = [true, true, false] - let promise1 = mPreferences.put(KEY_TEST_BOOL_ARRAY_ELEMENT, boolArr) - await promise1 - let promise2 = mPreferences.get(KEY_TEST_BOOL_ARRAY_ELEMENT, [false, true]) - promise2.then((pre) => { - for (let i = 0; i < boolArr.length; i++) { - expect(boolArr[i]).assertEqual(pre[i]); - } - }).catch((err) => { - expect(null).assertFail(); - }) - await promise2 - - done(); - }); - - /** - * @tc.name getAll promise interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0133 - * @tc.desc getAll promise interface test - */ - it('testPreferencesGetAll0001', 0, async function (done) { - await mPreferences.clear(); - let doubleArr = [11, 22, 33] - let stringArr = ['11', '22', '33'] - let boolArr = [true, false, false, true] - await mPreferences.put(KEY_TEST_STRING_ARRAY_ELEMENT, stringArr) - await mPreferences.put(KEY_TEST_BOOL_ARRAY_ELEMENT, boolArr) - await mPreferences.put(KEY_TEST_NUMBER_ARRAY_ELEMENT, doubleArr) - await mPreferences.put(KEY_TEST_BOOLEAN_ELEMENT, false) - await mPreferences.put(KEY_TEST_STRING_ELEMENT, "123") - await mPreferences.put(KEY_TEST_FLOAT_ELEMENT, 123.1) - - await mPreferences.flush() - - let promise = mPreferences.getAll() - promise.then((obj) => { - expect(false).assertEqual(obj.key_test_boolean) - expect("123").assertEqual(obj.key_test_string) - expect(123.1).assertEqual(obj.key_test_float) - let sArr = obj.key_test_string_array - for (let i = 0; i < sArr.length; i++) { - expect(sArr[i]).assertEqual(stringArr[i]); - } - - let bArr = obj.key_test_bool_array - for (let i = 0; i < bArr.length; i++) { - expect(bArr[i]).assertEqual(boolArr[i]); - } - - let nArr = obj.key_test_number_array - for (let i = 0; i < nArr.length; i++) { - expect(nArr[i]).assertEqual(doubleArr[i]); - } - }).catch((err) => { - expect(null).assertFail(); - }) - await promise - done(); - }) + afterAll(async function () { + console.info('afterAll') + await dataPreferences.deletePreferences(context, NAME); + }) - /** - * @tc.name clear promise interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Promise_0010 - * @tc.desc clear promise interface test - */ - it('testPreferencesClear0011', 0, async function (done) { - await mPreferences.put(KEY_TEST_STRING_ELEMENT, "test"); - await mPreferences.flush(); - const promise = mPreferences.clear(); - promise.then(async (ret) => { - let per = await mPreferences.get(KEY_TEST_STRING_ELEMENT, "defaultvalue"); - expect("defaultvalue").assertEqual(per); - }).catch((err) => { - expect(null).assertFail(); + /** + * @tc.name put StringArray promise interface test + * @tc.number SUB_DDM_Preferences_Put_Promise_0010 + * @tc.desc put StringArray promise interface test + */ + it('testPreferencesPutStringArray0131', 0, async function (done) { + await mPreferences.clear(); + var stringArr = ['1', '2', '3'] + let promise1 = mPreferences.put(KEY_TEST_STRING_ARRAY_ELEMENT, stringArr) + await promise1 + let promise2 = mPreferences.get(KEY_TEST_STRING_ARRAY_ELEMENT, ['123', '321']) + promise2.then((pre) => { + for (let i = 0; i < stringArr.length; i++) { + expect(stringArr[i]).assertEqual(pre[i]); + } + + }).catch((err) => { + expect(null).assertFail(); + }) + await promise2 + + done(); }); - await promise; - done(); - }) - /** - * @tc.name has string interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0020 - * @tc.desc has string interface test - */ - it('testPreferencesHasKey0031', 0, async function (done) { - await mPreferences.put(KEY_TEST_STRING_ELEMENT, "test"); - const promise = mPreferences.has(KEY_TEST_STRING_ELEMENT); - promise.then((ret) => { - expect(true).assertEqual(ret); - }).catch((err) => { - expect(null).assertFail(); + /** + * @tc.name put NumberArray promise interface test + * @tc.number SUB_DDM_Preferences_Put_Promise_0020 + * @tc.desc put NumberArray promise interface test + */ + it('testPreferencesPutNumberArray0132', 0, async function (done) { + await mPreferences.clear(); + var numberArr = [11, 22, 33, 44, 55] + let promise1 = mPreferences.put(KEY_TEST_NUMBER_ARRAY_ELEMENT, numberArr) + await promise1 + let promise2 = mPreferences.get(KEY_TEST_NUMBER_ARRAY_ELEMENT, [123, 321]) + promise2.then((pre) => { + for (let i = 0; i < numberArr.length; i++) { + expect(numberArr[i]).assertEqual(pre[i]); + } + }).catch((err) => { + expect(null).assertFail(); + }) + await promise2 + + done(); }); - await promise; - done(); - }) - /** - * @tc.name has int interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0140 - * @tc.desc has int interface test - */ - it('testPreferencesHasKey0032', 0, async function (done) { - await mPreferences.put(KEY_TEST_INT_ELEMENT, 1); - const promise = mPreferences.has(KEY_TEST_INT_ELEMENT); - promise.then((ret) => { - expect(true).assertEqual(ret); - }).catch((err) => { - expect(null).assertFail(); + /** + * @tc.name put BoolArray promise interface test + * @tc.number SUB_DDM_Preferences_Put_Promise_0030 + * @tc.desc put BoolArray promise interface test + */ + it('testPreferencesPutBoolArray0133', 0, async function (done) { + await mPreferences.clear(); + var boolArr = [true, true, false] + let promise1 = mPreferences.put(KEY_TEST_BOOL_ARRAY_ELEMENT, boolArr) + await promise1 + let promise2 = mPreferences.get(KEY_TEST_BOOL_ARRAY_ELEMENT, [false, true]) + promise2.then((pre) => { + for (let i = 0; i < boolArr.length; i++) { + expect(boolArr[i]).assertEqual(pre[i]); + } + }).catch((err) => { + expect(null).assertFail(); + }) + await promise2 + + done(); }); - await promise; - done(); - }) - /** - * @tc.name has float interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0150 - * @tc.desc has float interface test - */ - it('testPreferencesHasKey0033', 0, async function (done) { - await mPreferences.put(KEY_TEST_FLOAT_ELEMENT, 2.0); - const promise = mPreferences.has(KEY_TEST_FLOAT_ELEMENT); - promise.then((ret) => { - expect(true).assertEqual(ret); - }).catch((err) => { - expect(null).assertFail(); - }); - await promise; - done(); - }) + /** + * @tc.name getAll promise interface test + * @tc.number SUB_DDM_Preferences_GetAll_Promise_0040 + * @tc.desc getAll promise interface test + */ + it('testPreferencesGetAll0001', 0, async function (done) { + await mPreferences.clear(); + let doubleArr = [11, 22, 33] + let stringArr = ['11', '22', '33'] + let boolArr = [true, false, false, true] + await mPreferences.put(KEY_TEST_STRING_ARRAY_ELEMENT, stringArr) + await mPreferences.put(KEY_TEST_BOOL_ARRAY_ELEMENT, boolArr) + await mPreferences.put(KEY_TEST_NUMBER_ARRAY_ELEMENT, doubleArr) + await mPreferences.put(KEY_TEST_BOOLEAN_ELEMENT, false) + await mPreferences.put(KEY_TEST_STRING_ELEMENT, "123") + await mPreferences.put(KEY_TEST_FLOAT_ELEMENT, 123.1) + + await mPreferences.flush() + + let promise = mPreferences.getAll() + promise.then((obj) => { + expect(false).assertEqual(obj.key_test_boolean) + expect("123").assertEqual(obj.key_test_string) + expect(123.1).assertEqual(obj.key_test_float) + let sArr = obj.key_test_string_array + for (let i = 0; i < sArr.length; i++) { + expect(sArr[i]).assertEqual(stringArr[i]); + } + + let bArr = obj.key_test_bool_array + for (let i = 0; i < bArr.length; i++) { + expect(bArr[i]).assertEqual(boolArr[i]); + } + + let nArr = obj.key_test_number_array + for (let i = 0; i < nArr.length; i++) { + expect(nArr[i]).assertEqual(doubleArr[i]); + } + }).catch((err) => { + expect(null).assertFail(); + }) + await promise + + done(); + }) - /** - * @tc.name has boolean interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0160 - * @tc.desc has boolean interface test - */ - it('testPreferencesHasKey0034', 0, async function (done) { - await mPreferences.put(KEY_TEST_BOOLEAN_ELEMENT, false); - const promise = mPreferences.has(KEY_TEST_BOOLEAN_ELEMENT); - promise.then((ret) => { - expect(true).assertEqual(ret); - }).catch((err) => { - expect(null).assertFail(); - }); - await promise; - done(); - }) + /** + * @tc.name clear promise interface test + * @tc.number SUB_DDM_Preferences_Clear_Promise_0050 + * @tc.desc clear promise interface test + */ + it('testPreferencesClear0011', 0, async function (done) { + await mPreferences.put(KEY_TEST_STRING_ELEMENT, "test"); + await mPreferences.flush(); + const promise = mPreferences.clear(); + promise.then(async (ret) => { + let per = await mPreferences.get(KEY_TEST_STRING_ELEMENT, "defaultvalue"); + expect("defaultvalue").assertEqual(per); + }).catch((err) => { + expect(null).assertFail(); + }); + await promise; + done(); + }) - /** - * @tc.name has long interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0170 - * @tc.desc has long interface test - */ - it('testPreferencesHasKey0035', 0, async function (done) { - await mPreferences.put(KEY_TEST_LONG_ELEMENT, 0); - const promise = mPreferences.has(KEY_TEST_LONG_ELEMENT); - promise.then((ret) => { - expect(true).assertEqual(ret); - }).catch((err) => { - expect(null).assertFail(); - }); - await promise; - done(); - }) + /** + * @tc.name has string interface test + * @tc.number SUB_DDM_Preferences_Has_Promise_0060 + * @tc.desc has string interface test + */ + it('testPreferencesHasKey0031', 0, async function (done) { + await mPreferences.put(KEY_TEST_STRING_ELEMENT, "test"); + const promise = mPreferences.has(KEY_TEST_STRING_ELEMENT); + promise.then((ret) => { + expect(true).assertEqual(ret); + }).catch((err) => { + expect(null).assertFail(); + }); + await promise; + done(); + }) - /** - * @tc.name get string promise interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0030 - * @tc.desc get string promise interface test - */ - it('testPreferencesGetDefValue0061', 0, async function (done) { - await mPreferences.clear(); - const promise = mPreferences.get(KEY_TEST_STRING_ELEMENT, "defaultValue"); - promise.then((ret) => { - expect('defaultValue').assertEqual(ret); - }).catch((err) => { - expect(null).assertFail(); - }); - await promise; - done(); - }) + /** + * @tc.name has int interface test + * @tc.number SUB_DDM_Preferences_Has_Promise_0070 + * @tc.desc has int interface test + */ + it('testPreferencesHasKey0032', 0, async function (done) { + await mPreferences.put(KEY_TEST_INT_ELEMENT, 1); + const promise = mPreferences.has(KEY_TEST_INT_ELEMENT); + promise.then((ret) => { + expect(true).assertEqual(ret); + }).catch((err) => { + expect(null).assertFail(); + }); + await promise; + done(); + }) - /** - * @tc.name get float promise interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0040 - * @tc.desc get float promise interface test - */ - it('testPreferencesGetFloat0071', 0, async function (done) { - await mPreferences.clear(); - await mPreferences.put(KEY_TEST_FLOAT_ELEMENT, 3.0); - const promise = mPreferences.get(KEY_TEST_FLOAT_ELEMENT, 0.0); - promise.then((ret) => { - expect(3.0).assertEqual(ret); - }).catch((err) => { - expect(null).assertFail(); - }); - await promise; - done(); - }) + /** + * @tc.name has float interface test + * @tc.number SUB_DDM_Preferences_Put_Promise_0080 + * @tc.desc has float interface test + */ + it('testPreferencesHasKey0033', 0, async function (done) { + await mPreferences.put(KEY_TEST_FLOAT_ELEMENT, 2.0); + const promise = mPreferences.has(KEY_TEST_FLOAT_ELEMENT); + promise.then((ret) => { + expect(true).assertEqual(ret); + }).catch((err) => { + expect(null).assertFail(); + }); + await promise; + done(); + }) - /** - * @tc.name get int promise interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0050 - * @tc.desc get int promise interface test - */ - it('testPreferencesGetInt0081', 0, async function (done) { - await mPreferences.clear(); - await mPreferences.put(KEY_TEST_INT_ELEMENT, 3); - const promise = mPreferences.get(KEY_TEST_INT_ELEMENT, 0.0); - promise.then((ret) => { - expect(3).assertEqual(ret); - }).catch((err) => { - expect(null).assertFail(); - }); - await promise; - done(); - }) + /** + * @tc.name has boolean interface test + * @tc.number SUB_DDM_Preferences_Has_Promise_0090 + * @tc.desc has boolean interface test + */ + it('testPreferencesHasKey0034', 0, async function (done) { + await mPreferences.put(KEY_TEST_BOOLEAN_ELEMENT, false); + const promise = mPreferences.has(KEY_TEST_BOOLEAN_ELEMENT); + promise.then((ret) => { + expect(true).assertEqual(ret); + }).catch((err) => { + expect(null).assertFail(); + }); + await promise; + done(); + }) - /** - * @tc.name get long promise interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0060 - * @tc.desc get long promise interface test - */ - it('testPreferencesGetLong0091', 0, async function (done) { - await mPreferences.clear(); - await mPreferences.put(KEY_TEST_LONG_ELEMENT, 3); - const promise = mPreferences.get(KEY_TEST_LONG_ELEMENT, 0); - promise.then((ret) => { - expect(3).assertEqual(ret); - }).catch((err) => { - expect(null).assertFail(); - }); - await promise; - done(); - }) + /** + * @tc.name has long interface test + * @tc.number SUB_DDM_Preferences_Put_Promise_0100 + * @tc.desc has long interface test + */ + it('testPreferencesHasKey0035', 0, async function (done) { + await mPreferences.put(KEY_TEST_LONG_ELEMENT, 0); + const promise = mPreferences.has(KEY_TEST_LONG_ELEMENT); + promise.then((ret) => { + expect(true).assertEqual(ret); + }).catch((err) => { + expect(null).assertFail(); + }); + await promise; + done(); + }) - /** - * @tc.name get String promise interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0070 - * @tc.desc get String promise interface test - */ - it('tesPreferencesGetString101', 0, async function (done) { - await mPreferences.clear(); - await mPreferences.put(KEY_TEST_STRING_ELEMENT, "test"); - await mPreferences.flush(); - const promise = mPreferences.get(KEY_TEST_STRING_ELEMENT, "defaultvalue"); - promise.then((ret) => { - expect('test').assertEqual(ret); - }).catch((err) => { - expect(null).assertFail(); - }); - await promise; - done(); - }) + /** + * @tc.name get string promise interface test + * @tc.number SUB_DDM_Preferences_Get_Promise_0110 + * @tc.desc get string promise interface test + */ + it('testPreferencesGetDefValue0061', 0, async function (done) { + await mPreferences.clear(); + const promise = mPreferences.get(KEY_TEST_STRING_ELEMENT, "defaultValue"); + promise.then((ret) => { + expect('defaultValue').assertEqual(ret); + }).catch((err) => { + expect(null).assertFail(); + }); + await promise; + done(); + }) + + /** + * @tc.name get float promise interface test + * @tc.number SUB_DDM_Preferences_Get_Promise_0120 + * @tc.desc get float promise interface test + */ + it('testPreferencesGetFloat0071', 0, async function (done) { + await mPreferences.clear(); + await mPreferences.put(KEY_TEST_FLOAT_ELEMENT, 3.0); + const promise = mPreferences.get(KEY_TEST_FLOAT_ELEMENT, 0.0); + promise.then((ret) => { + expect(3.0).assertEqual(ret); + }).catch((err) => { + expect(null).assertFail(); + }); + await promise; + done(); + }) - /** - * @tc.name put boolean promise interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0090 - * @tc.desc put boolean promise interface test - */ - it('testPreferencesPutBoolean0121', 0, async function (done) { - const promise = mPreferences.put(KEY_TEST_BOOLEAN_ELEMENT, true); - promise.then(async (ret) => { + /** + * @tc.name get int promise interface test + * @tc.number SUB_DDM_Preferences_Put_Promise_0130 + * @tc.desc get int promise interface test + */ + it('testPreferencesGetInt0081', 0, async function (done) { + await mPreferences.clear(); + await mPreferences.put(KEY_TEST_INT_ELEMENT, 3); + const promise = mPreferences.get(KEY_TEST_INT_ELEMENT, 0.0); + promise.then((ret) => { + expect(3).assertEqual(ret); + }).catch((err) => { + expect(null).assertFail(); + }); + await promise; + done(); + }) + + /** + * @tc.name get long promise interface test + * @tc.number SUB_DDM_Preferences_Put_Promise_0140 + * @tc.desc get long promise interface test + */ + it('testPreferencesGetLong0091', 0, async function (done) { + await mPreferences.clear(); + await mPreferences.put(KEY_TEST_LONG_ELEMENT, 3); + const promise = mPreferences.get(KEY_TEST_LONG_ELEMENT, 0); + promise.then((ret) => { + expect(3).assertEqual(ret); + }).catch((err) => { + expect(null).assertFail(); + }); + await promise; + done(); + }) + + /** + * @tc.name get String promise interface test + * @tc.number SUB_DDM_Preferences_Get_Promise_0150 + * @tc.desc get String promise interface test + */ + it('tesPreferencesGetString101', 0, async function (done) { + await mPreferences.clear(); + await mPreferences.put(KEY_TEST_STRING_ELEMENT, "test"); + await mPreferences.flush(); + const promise = mPreferences.get(KEY_TEST_STRING_ELEMENT, "defaultvalue"); + promise.then((ret) => { + expect('test').assertEqual(ret); + }).catch((err) => { + expect(null).assertFail(); + }); + await promise; + done(); + }) + + /** + * @tc.name put boolean promise interface test + * @tc.number SUB_DDM_Preferences_Put_Promise_0160 + * @tc.desc put boolean promise interface test + */ + it('testPreferencesPutBoolean0121', 0, async function (done) { + await mPreferences.clear(); + let promise = mPreferences.put(KEY_TEST_BOOLEAN_ELEMENT, true); + await promise; let per = await mPreferences.get(KEY_TEST_BOOLEAN_ELEMENT, false); expect(true).assertEqual(per); await mPreferences.flush(); let per2 = await mPreferences.get(KEY_TEST_BOOLEAN_ELEMENT, false); expect(true).assertEqual(per2); - }).catch((err) => { - expect(null).assertFail(); - }); - await promise; - done(); - }) + done(); + }) - /** - * @tc.name put float promise interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0100 - * @tc.desc put float promise interface test - */ - it('testPreferencesPutFloat0131', 0, async function (done) { - const promise = mPreferences.put(KEY_TEST_FLOAT_ELEMENT, 4.0); - promise.then(async (ret) => { + /** + * @tc.name put float promise interface test + * @tc.number SUB_DDM_Preferences_Put_Promise_0170 + * @tc.desc put float promise interface test + */ + it('testPreferencesPutFloat0131', 0, async function (done) { + await mPreferences.clear(); + const promise = mPreferences.put(KEY_TEST_FLOAT_ELEMENT, 4.0); + await promise; let per = await mPreferences.get(KEY_TEST_FLOAT_ELEMENT, 0.0); expect(4.0).assertEqual(per); await mPreferences.flush(); let per2 = await mPreferences.get(KEY_TEST_FLOAT_ELEMENT, 0.0); expect(4.0).assertEqual(per2); - }).catch((err) => { - expect(null).assertFail(); - }); - await promise; - done(); - }) + done(); + }) - /** - * @tc.name put int promise interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0110 - * @tc.desc put int promise interface test - */ - it('testPreferencesPutInt0141', 0, async function (done) { - const promise = mPreferences.put(KEY_TEST_INT_ELEMENT, 4); - promise.then(async (ret) => { + /** + * @tc.name put int promise interface test + * @tc.number SUB_DDM_Preferences_Put_Promise_0180 + * @tc.desc put int promise interface test + */ + it('testPreferencesPutInt0141', 0, async function (done) { + await mPreferences.clear(); + let promise = mPreferences.put(KEY_TEST_INT_ELEMENT, 4); + await promise; let per = await mPreferences.get(KEY_TEST_INT_ELEMENT, 0); expect(4).assertEqual(per); await mPreferences.flush(); let per2 = await mPreferences.get(KEY_TEST_INT_ELEMENT, 0); expect(4).assertEqual(per2); - }).catch((err) => { - expect(null).assertFail(); - }); - await promise; - done(); - }) + done(); + }) - /** - * @tc.name put long promise interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0120 - * @tc.desc put long promise interface test - */ - it('testPreferencesPutLong0151', 0, async function (done) { - const promise = mPreferences.put(KEY_TEST_LONG_ELEMENT, 4); - promise.then(async (ret) => { + /** + * @tc.name put long promise interface test + * @tc.number SUB_DDM_Preferences_Put_Promise_0190 + * @tc.desc put long promise interface test + */ + it('testPreferencesPutLong0151', 0, async function (done) { + let promise = mPreferences.put(KEY_TEST_LONG_ELEMENT, 4); + await promise; let per = await mPreferences.get(KEY_TEST_LONG_ELEMENT, 0); expect(4).assertEqual(per); await mPreferences.flush(); let per2 = await mPreferences.get(KEY_TEST_LONG_ELEMENT, 0); expect(4).assertEqual(per2); - }).catch((err) => { - expect(null).assertFail(); - }); - await promise; - done(); - }) + done(); + }) - /** - * @tc.name put String promise interface test - * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Preferences_0130 - * @tc.desc put String promise interface test - */ - it('testPreferencesPutString0161', 0, async function (done) { - const promise = mPreferences.put(KEY_TEST_STRING_ELEMENT, ''); - promise.then(async (ret) => { + /** + * @tc.name put String promise interface test + * @tc.number SUB_DDM_Preferences_Put_Promise_0200 + * @tc.desc put String promise interface test + */ + it('testPreferencesPutString0161', 0, async function (done) { + let promise = mPreferences.put(KEY_TEST_STRING_ELEMENT, ''); + await promise; let per = await mPreferences.get(KEY_TEST_STRING_ELEMENT, "defaultvalue") expect('').assertEqual(per); await mPreferences.flush(); let per2 = await mPreferences.get(KEY_TEST_STRING_ELEMENT, "defaultvalue") expect('').assertEqual(per2); - }).catch((err) => { - expect(null).assertFail(); - }); - await promise; - done(); + done(); + }) + + /** + * @tc.name get string promise interface test + * @tc.number SUB_DDM_Preferences_Get_Promise_0210 + * @tc.desc get string promise interface test + */ + it('testPreferencesGetDefValue00162', 0, async function (done) { + await mPreferences.clear(); + let promise = mPreferences.get(KEY_TEST_BOOLEAN_ELEMENT, true); + promise.then((ret) => { + expect(true).assertEqual(ret); + }).catch((err) => { + expect(null).assertFail(); + }); + await promise; + done(); + }) }) -}) } \ No newline at end of file diff --git a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StorageCallBackJsunit.test.js b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StorageCallBackJsunit.test.js index d4576c2bb212755dcebf214362f1f74dea7a59c7..8119b0901a0a7e60798ba8e14769addb2ac00183 100644 --- a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StorageCallBackJsunit.test.js +++ b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StorageCallBackJsunit.test.js @@ -333,5 +333,18 @@ describe('storageCallBackTest', function () { }); done(); }) + + /** + * @tc.name get defaultValue callback interface test + * @tc.number SUB_DDM_AppDataFWK_JSPreferences_CallBack_0190 + * @tc.desc get defaultValue callback interface test + */ + it('testGetDefValue0192', 0, async function (done) { + await mPref.clear(); + await mPref.get(KEY_TEST_BOOLEAN_ELEMENT, true, function (err, ret) { + expect(true).assertEqual(ret); + done(); + }) + }) }) } diff --git a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StoragePromiseJsunit.test.js b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StoragePromiseJsunit.test.js index 5f968862f1d7c891940ebd376ddc4fec39a326d3..bddc402152574f850c0eb05241e05f428d35594f 100644 --- a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StoragePromiseJsunit.test.js +++ b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StoragePromiseJsunit.test.js @@ -491,5 +491,22 @@ describe('storagePromiseTest', function () { expect(MAX_VALUE_LENGTH).assertEqual(mPref.getSync("test", "defaultvalue")); done(); }) + + /** + * @tc.name get string promise interface test + * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Storage_0260 + * @tc.desc get string promise interface test + */ + it('testGetDefValue0260', 0, async function (done) { + await mPref.clear(); + const promise = mPref.get(KEY_TEST_BOOLEAN_ELEMENT, true); + promise.then((ret) => { + expect(true).assertEqual(ret); + }).catch((err) => { + expect(null).assertFail(); + }); + await promise; + done(); + }) }) } diff --git a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StorageSyncJsunit.test.js b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StorageSyncJsunit.test.js index 75df1645efa798ea97cea117d9494a7d7ac10cac..35cd4f61a6d801649514ad75120ea53e16583ee9 100644 --- a/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StorageSyncJsunit.test.js +++ b/distributeddatamgr/preferencesjstest/hap/src/main/js/test/StorageSyncJsunit.test.js @@ -287,4 +287,16 @@ describe('storageSyncTest', function () { mPref.off('change', observer); mPref.putSync(KEY_TEST_STRING_ELEMENT, "abc"); }) + + /** + * @tc.name get defaultValue callback interface test + * @tc.number SUB_DDM_AppDataFWK_JSPreferences_Sync_0170 + * @tc.desc get defaultValue callback interface test + */ + it('testGetDefValue001', 0, async function (done) { + await mPref.clear(); + var ret = mPref.getSync(KEY_TEST_BOOLEAN_ELEMENT, true) + expect(ret).assertTrue(); + done(); + }) })} diff --git a/distributeddatamgr/relationalStorejstest/hap/src/main/config.json b/distributeddatamgr/relationalStorejstest/hap/src/main/config.json index 7fa74de9bde02c613d920422c1618de81889edfb..fb0d2a61e2e525916b73c669fbcddcb5e12bf33c 100644 --- a/distributeddatamgr/relationalStorejstest/hap/src/main/config.json +++ b/distributeddatamgr/relationalStorejstest/hap/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.relationalStorejstest", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/List.test.js b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/List.test.js index e9fe4f1bbca2b52df40d5df4b82e10952908a8f1..ffdbfd37545f643e5bfb969c464256dfc706a256 100644 --- a/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/List.test.js +++ b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/List.test.js @@ -26,6 +26,7 @@ import rdbstoreStoreExcuteSqlTest from './RdbstoreStoreExcuteSqlJsunit.test.js' import rdbstoreTransactionTest from './RdbstoreTransactionJsunit.test.js' import rdbStoreUpdateTest from './RdbstoreUpdateJsunit.test.js' import rdbstoreQueryTest from './RdbstoreQuery.test.js' +import rdbStoreEncryptionTest from './RdbstoreEncryptionJsunit.test.js' export default function testsuite() { rdbStoreBackupRestoreCallbackTest() rdbStoreBackupRestoreWithFAContextTest() @@ -41,4 +42,5 @@ rdbstoreStoreExcuteSqlTest() rdbstoreTransactionTest() rdbStoreUpdateTest() rdbstoreQueryTest() +rdbStoreEncryptionTest() } 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 5cb624e81a9b3eb3cd55502f85abd6a159992045..a2fb7c9ae923be1607f7dd60149312f2e44fb078 100644 --- a/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbStoreResultSetJsunit.test.js +++ b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbStoreResultSetJsunit.test.js @@ -24,6 +24,41 @@ const STORE_CONFIG = { const COLOUNM_NAMES = ["id","data1","data2","data3","data4"]; var rdbStore = undefined; +function createUint8Array(length) { + let i = 0 + let index = 0 + let temp = null + let u8 = new Uint8Array(length) + length = typeof (length) === 'undefined' ? 9 : length + for (i = 1; i <= length; i++) { + u8[i - 1] = i + } + for (i = 1; i <= length; i++) { + index = parseInt(Math.random() * (length - i)) + i + if (index != i) { + temp = u8[i - 1] + u8[i - 1] = u8[index - 1] + u8[index - 1] = temp + } + } + return u8; +} + +async function createBigData(size) { + await rdbStore.executeSql("DELETE FROM test"); + let u8 = createUint8Array(32768); + let valueBucketArray = new Array(); + for (let i = 0; i < size; i++) { + valueBucketArray.push({ + "data1": "test" + i, + "data2": 18, + "data3": 100.5, + "data4": u8, + }); + } + await rdbStore.batchInsert("test", valueBucketArray); +} + export default function rdbResultSetTest() { describe('rdbResultSetTest', function () { beforeAll(async function () { @@ -214,20 +249,21 @@ describe('rdbResultSetTest', function () { * @tc.desc resultSet isStarted normal test */ it('testIsStarted0003', 0, async function (done) { - console.info(TAG + '************* testIsStarted0003 start *************'); - let predicates = await new dataRdb.RdbPredicates('test') + console.info(TAG + "************* testIsStarted0003 start *************"); + let predicates = await new dataRdb.RdbPredicates("test") let resultSet = await rdbStore.query(predicates) try { + expect(false).assertEqual(resultSet.isStarted) expect(true).assertEqual(resultSet.goToNextRow()) expect(true).assertEqual(resultSet.isStarted) expect(false).assertEqual(resultSet.goToPreviousRow()) - expect(false).assertEqual(resultSet.isStarted) + expect(true).assertEqual(resultSet.isStarted) } catch (e) { expect(null).assertFail(); } resultSet = null done(); - console.info(TAG + '************* testIsStarted0003 end *************'); + console.info(TAG + "************* testIsStarted0003 end *************"); }) /** @@ -1768,6 +1804,34 @@ describe('rdbResultSetTest', function () { console.info(TAG + '************* testcolumnNames0001 end *************'); } }) + + /** + * @tc.name big resultSet data test + * @tc.number SUB_DDM_AppDataFWK_JSRDB_ResultSet_0250 + * @tc.desc big resultSet data test + */ + it('testBigData0001', 0, async function (done) { + console.log(TAG + "************* testBigData0001 start *************"); + { + await createBigData(500); + let resultSet = await rdbStore.querySql("SELECT * FROM test"); + let count = resultSet.rowCount; + expect(500).assertEqual(count); + + resultSet.goToFirstRow(); + let i = 0; + while (resultSet.isEnded == false) { + expect("test" + i++).assertEqual(resultSet.getString(1)) + resultSet.goToNextRow(); + } + + resultSet.close() + expect(true).assertEqual(resultSet.isClosed) + resultSet = null; + done(); + console.log(TAG + "************* testBigData0001 end *************"); + } + }) console.info(TAG + '*************Unit Test End*************'); }) diff --git a/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreEncryptionJsunit.test.js b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreEncryptionJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..77434e4d9cc60c595094399477bda1b279cc6705 --- /dev/null +++ b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreEncryptionJsunit.test.js @@ -0,0 +1,200 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' +import data_rdb from '@ohos.data.rdb' +import ability_featureAbility from '@ohos.ability.featureAbility' + + +const TAG = "[RDB_JSKITS_TEST]" +const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + + "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)" + +var rdbStore +var context +const STORE_CONFIG_ENCRYPT = { + name: "Encrypt.db", + encrypt: true, +} +const STORE_CONFIG_UNENCRYPT = { + name: "Unencrypt.db", + encrypt: false, +} +const STORE_CONFIG_WRONG = { + name: "Encrypt.db", + encrypt: false, +} + +export default function rdbStoreEncryptionTest() { +async function CreatRdbStore(context, STORE_CONFIG) { + let rdbStore = await data_rdb.getRdbStore(context, STORE_CONFIG, 1) + await rdbStore.executeSql(CREATE_TABLE_TEST, null) + let u8 = new Uint8Array([1, 2, 3]) + { + const valueBucket = { + "name": "zhangsan", + "age": 18, + "salary": 100.5, + "blobType": u8, + } + await rdbStore.insert("test", valueBucket) + } + { + const valueBucket = { + "name": "lisi", + "age": 28, + "salary": 100.5, + "blobType": u8, + } + await rdbStore.insert("test", valueBucket) + } + { + const valueBucket = { + "name": "wangwu", + "age": 38, + "salary": 90.0, + "blobType": u8, + } + await rdbStore.insert("test", valueBucket) + } + return rdbStore +} + +describe('rdbEncryptTest', function () { + beforeAll(async function () { + console.info(TAG + 'beforeAll') + + }) + + beforeEach(async function () { + console.info(TAG + 'beforeEach') + + }) + + afterEach(async function () { + console.info(TAG + 'afterEach') + await data_rdb.deleteRdbStore(context, STORE_CONFIG_ENCRYPT.name) + await data_rdb.deleteRdbStore(context, STORE_CONFIG_UNENCRYPT.name) + await data_rdb.deleteRdbStore(context, STORE_CONFIG_WRONG.name) + rdbStore = null + }) + + afterAll(async function () { + console.info(TAG + 'afterAll') + }) + + console.log(TAG + "*************Unit Test Begin*************") + + /** + * @tc.name RDB encrypted test + * @tc.number SUB_DDM_RDB_JS_RdbEncryptTest_0010 + * @tc.desc RDB create encrypt db test + */ + it('RdbEncryptTest_0010', 0, async function (done) { + await console.log(TAG + "************* RdbEncryptTest_0010 start *************") + context = ability_featureAbility.getContext() + let storePromise = data_rdb.getRdbStore(context, STORE_CONFIG_ENCRYPT, 1); + storePromise.then(async (store) => { + try { + await console.log(TAG + "getRdbStore done: " + store); + } catch (err) { + expect(null).assertFail(); + } + }).catch((err) => { + expect(null).assertFail(); + }) + await storePromise + storePromise = null + + done() + await console.log(TAG + "************* RdbEncryptTest_0010 end *************") + }) + + /** + * @tc.name RDB unencrypted test + * @tc.number SUB_DDM_RDB_JS_RdbEncryptTest_0020 + * @tc.desc RDB create unencrypted db test + */ + it('RdbEncryptTest_0020', 0, async function (done) { + await console.log(TAG + "************* RdbEncryptTest_0020 start *************") + context = ability_featureAbility.getContext() + let storePromise = data_rdb.getRdbStore(context, STORE_CONFIG_UNENCRYPT, 1); + storePromise.then(async (store) => { + try { + await console.log(TAG + "getRdbStore done: " + store); + } catch (err) { + expect(null).assertFail(); + } + }).catch((err) => { + expect(null).assertFail(); + }) + await storePromise + storePromise = null + + done() + await console.log(TAG + "************* RdbEncryptTest_0020 end *************") + }) + + + /** + * @tc.name RDB Encrypt test + * @tc.number SUB_DDM_RDB_JS_RdbEncryptTest_0030 + * @tc.desc RDB Encrypt function test + */ + it('RdbEncryptTest_0030', 0, async function (done) { + await console.log(TAG + "************* RdbEncryptTest_0030 start *************") + context = ability_featureAbility.getContext() + rdbStore = await CreatRdbStore(context, STORE_CONFIG_ENCRYPT) + let predicates = new data_rdb.RdbPredicates("test") + predicates.equalTo("name", "zhangsan") + let resultSet = await rdbStore.query(predicates) + try { + console.log(TAG + "After restore resultSet query done") + expect(true).assertEqual(resultSet.goToFirstRow()) + const id = resultSet.getLong(resultSet.getColumnIndex("id")) + const name = resultSet.getString(resultSet.getColumnIndex("name")) + const blobType = resultSet.getBlob(resultSet.getColumnIndex("blobType")) + expect(1).assertEqual(id) + expect("zhangsan").assertEqual(name) + expect(1).assertEqual(blobType[0]) + } catch (err) { + expect(false).assertTrue() + } + resultSet = null + rdbStore = null + done() + await console.log(TAG + "************* RdbEncryptTest_0030 end *************") + }) + + /** + * @tc.name RDB Encrypt test + * @tc.number SUB_DDM_RDB_JS_RdbEncryptTest_0040 + * @tc.desc RDB Encrypt function test + */ + it('RdbEncryptTest_0040', 0, async function (done) { + await console.log(TAG + "************* RdbEncryptTest_0040 start *************") + context = ability_featureAbility.getContext() + rdbStore = await CreatRdbStore(context, STORE_CONFIG_ENCRYPT) + rdbStore = null + rdbStore = await CreatRdbStore(context, STORE_CONFIG_WRONG) + expect(rdbStore).assertNull + + done() + await console.log(TAG + "************* RdbEncryptTest_0040 end *************") + }) + console.log(TAG + "*************Unit Test End*************") + } +) + +} \ No newline at end of file diff --git a/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreInsertJsunit.test.js b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreInsertJsunit.test.js index ad08336449719db73ad54d1ccf5841fee13483db..ca5a8dc2d7efe83fa678f09010edbc9289aa4551 100644 --- a/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreInsertJsunit.test.js +++ b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreInsertJsunit.test.js @@ -25,6 +25,7 @@ const STORE_CONFIG = { } var rdbStore = undefined; +var resultSet = undefined; function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); @@ -320,7 +321,7 @@ describe('rdbstoreInsertTest', function () { }) let predicates = new dataRdb.RdbPredicates("test2"); predicates.equalTo("name", "lisi") - resultSet = await rdbStore.query(predicates) + let resultSet = await rdbStore.query(predicates) try { console.info(TAG + "resultSet query done"); expect(true).assertEqual(resultSet.goToFirstRow()) @@ -334,11 +335,11 @@ describe('rdbstoreInsertTest', function () { expect("lisi").assertEqual(name) expect(23).assertEqual(age) expect(200).assertEqual(salary) - await rdbstore.delete(predicates).then((number) => { + await rdbStore.delete(predicates).then((number) => { expect(1).assertEqual(number) }).then(async () => { resultSet = await rdbStore.query(predicates).catch((err) =>{ - expect(true).assertTrue(); + expect(err != null).assertTrue(); }) }) } catch (e) { @@ -393,6 +394,7 @@ describe('rdbstoreInsertTest', function () { const name = resultSet.getString(resultSet.getColumnIndex("name")) const age = resultSet.getLong(resultSet.getColumnIndex("age")) const salary = resultSet.getDouble(resultSet.getColumnIndex("salary")) + const blobType = resultSet.getBlob(resultSet.getColumnIndex("blobType")) console.info(TAG + "id=" + id + ", name=" + name + ", age=" + age + ", salary=" + salary + ", blobType=" + blobType); expect(1).assertEqual(id); expect("zhangsan").assertEqual(name) @@ -414,6 +416,7 @@ describe('rdbstoreInsertTest', function () { const name = resultSet.getString(resultSet.getColumnIndex("name")) const age = resultSet.getLong(resultSet.getColumnIndex("age")) const salary = resultSet.getDouble(resultSet.getColumnIndex("salary")) + const blobType = resultSet.getBlob(resultSet.getColumnIndex("blobType")) console.info(TAG + "id=" + id + ", name=" + name + ", age=" + age + ", salary=" + salary + ", blobType=" + blobType); expect(2).assertEqual(id); expect("lisi").assertEqual(name) @@ -425,7 +428,7 @@ describe('rdbstoreInsertTest', function () { "salary": 500, "blobType": u8, } - await rdbstore.insert("test3",valueBucket4) + await rdbStore.insert("test3",valueBucket4) predicates = new dataRdb.RdbPredicates("test3"); predicates.equalTo("name", "zhangmaowen") resultSet = await rdbStore.query(predicates) @@ -488,6 +491,7 @@ describe('rdbstoreInsertTest', function () { const name = resultSet.getString(resultSet.getColumnIndex("name")) const age = resultSet.getLong(resultSet.getColumnIndex("age")) const salary = resultSet.getDouble(resultSet.getColumnIndex("salary")) + const blobType = resultSet.getBlob(resultSet.getColumnIndex("blobType")) console.info(TAG + "id=" + id + ", name=" + name + ", age=" + age + ", salary=" + salary + ", blobType=" + blobType); expect(56).assertEqual(id); expect("zhangsan55").assertEqual(name) @@ -593,12 +597,15 @@ describe('rdbstoreInsertTest', function () { } const valueBuckets = [valueBucket1, valueBucket2, valueBucket3] try{ - await rdbStore.batchInsert("test6","valueBuckets").catch((err) =>{ - expect(true).assertTrue(); + await rdbStore.batchInsert("test6","valueBuckets").then((number) => { + console.info(TAG + "Affect row is " + number) + expect(number).assertEqual(-1) + }).catch((err) =>{ + expect(err == null).assertTrue(); }) }catch(err){ console.info(TAG + "Batch insert data error: " + err) - expect(true).assertTrue(); + expect(null).assertFail();; } done() console.info(TAG + "************* testRdbStorebatchInsertPromise0006 end *************"); @@ -613,12 +620,15 @@ describe('rdbstoreInsertTest', function () { console.info(TAG + "************* testRdbStorebatchInsertPromise0007 start *************"); await rdbStore.executeSql(CREATE_TABLE_NAME + "7" + CREATE_TABLE) try{ - await rdbStore.batchInsert("test7").catch((err) =>{ - expect(true).assertTrue(); + await rdbStore.batchInsert("test7").then((number) => { + console.info(TAG + "BatchInsert without data,affect row number is " + number) + expect(number).assertEqual(0) + }).catch((err) =>{ + expect(err == null).assertTrue(); }) }catch(err){ console.info(TAG + "Batch insert data error: " + err) - expect(true).assertTrue(); + expect(null).assertFail(); } done() console.info(TAG + "************* testRdbStorebatchInsertPromise0007 end *************"); @@ -748,7 +758,7 @@ describe('rdbstoreInsertTest', function () { expect(3).assertEqual(data) let predicates = new dataRdb.RdbPredicates("testCallback2"); predicates.equalTo("name", "lisi") - resultSet = await rdbStore.query(predicates) + let resultSet = await rdbStore.query(predicates) try { console.info(TAG + "resultSet query done"); expect(true).assertEqual(resultSet.goToFirstRow()) @@ -762,11 +772,11 @@ describe('rdbstoreInsertTest', function () { expect("lisi").assertEqual(name) expect(23).assertEqual(age) expect(200).assertEqual(salary) - await rdbstore.delete(predicates).then((number) => { + await rdbStore.delete(predicates).then((number) => { expect(1).assertEqual(number) }).then(async () => { resultSet = await rdbStore.query(predicates).catch((err) =>{ - expect(true).assertTrue(); + expect(err != null).assertTrue(); }) }) } catch (e) { @@ -856,7 +866,7 @@ describe('rdbstoreInsertTest', function () { "salary": 500, "blobType": u8, } - await rdbstore.insert("testCallback3",valueBucket4) + await rdbStore.insert("testCallback3",valueBucket4) predicates = new dataRdb.RdbPredicates("testCallback3"); predicates.equalTo("name", "zhangmaowen") resultSet = await rdbStore.query(predicates) @@ -1032,16 +1042,17 @@ describe('rdbstoreInsertTest', function () { const valueBuckets = [valueBucket1, valueBucket2, valueBucket3] await rdbStore.executeSql(CREATE_TABLE_NAME + "Callback6" + CREATE_TABLE).then(async () => { try{ - await rdbStore.batchInsert("testCallback6", "valueBuckets", (err, data) => { + rdbStore.batchInsert("testCallback6", "valueBuckets", (err, data) => { + console.info(TAG + "Affect row is " + data) if(err != null){ - expect(true).assertTrue() + expect(null).assertFail(); }else{ - expect(false).assertTrue() + expect(data).assertEqual(-1) } }) }catch(err){ console.info(TAG + "Batch insert data error: " + err) - expect(true).assertTrue(); + expect(null).assertFail(); } }) @@ -1059,15 +1070,23 @@ describe('rdbstoreInsertTest', function () { console.info(TAG + "************* testRdbStorebatchInsertCallback0007 start *************"); try{ await rdbStore.executeSql(CREATE_TABLE_NAME + "Callback7" + CREATE_TABLE).then(async () => { - await rdbstore.batchInsert("testCallback7", (err,data) => { + await rdbStore.batchInsert("testCallback7", (err,data) => { + console.info(TAG + "Affect row is " + data) if(err != null){ - expect(true).assertTrue(); + expect(null).assertFail(); + }else{ + expect(data).assertEqual(-1) } + }).then((data) => { + console.info(TAG + "Batch insert fail ,affect row number is: " + data) + expect(data).assertEqual(-1) }) + }).catch((err) => { + expect(null).assertFail(); }) }catch(err){ console.info(TAG + "Batch insert data error: " + err) - expect(true).assertTrue(); + expect(null).assertFail(); } done() console.info(TAG + "************* testRdbStorebatchInsertCallback0007 end *************"); diff --git a/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstorePredicatesJsunit.test.js b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstorePredicatesJsunit.test.js index 97712af847e015b68bd1fc7e67411b968fe9cb2f..2fbd64d9eafb299e93d4835d49c83df7a1ad39df 100644 --- a/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstorePredicatesJsunit.test.js +++ b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstorePredicatesJsunit.test.js @@ -1725,7 +1725,9 @@ describe('rdbPredicatesTest', function () { console.info(TAG + "************* testAnd0003 start *************"); { let predicates = await new dataRdb.RdbPredicates("AllDataType"); + var predicatesInit = predicates predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").or().and().equalTo("integerValue", 1); + expect(predicates == predicatesInit).assertTrue(); console.info(TAG + "you should not start a request" + " with \"and\" or use or() before this function"); } done(); @@ -1741,7 +1743,9 @@ describe('rdbPredicatesTest', function () { console.info(TAG + "************* testAnd0004 start *************"); { let predicates = await new dataRdb.RdbPredicates("AllDataType"); + var predicatesInit = predicates predicates.equalTo("stringValue", "ABCDEFGHIJKLMN").or().or().equalTo("integerValue", 1); + expect(predicates == predicatesInit).assertTrue(); console.info(TAG + "you are starting a sql request with predicate or or," + "using function or() immediately after another or(). that is ridiculous."); } diff --git a/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreTransactionJsunit.test.js b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreTransactionJsunit.test.js index 2f7f827d192e1e88d4dcbfdea3b23b5442d22b21..5c3a89475a354cb1ff4eded1fe75a1b2ba3bc096 100644 --- a/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreTransactionJsunit.test.js +++ b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreTransactionJsunit.test.js @@ -20,7 +20,7 @@ const TAG = "[RDB_JSKITS_TEST]" const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY, " + "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)"; const STORE_CONFIG = { - name: "RdbInsertTest.db", + name: "rdbstoreTransactionTest.db", } var rdbStore = undefined; @@ -41,7 +41,7 @@ describe('rdbstoreTransactionTest', function () { console.info(TAG + 'afterEach') await rdbStore.executeSql("DELETE FROM test"); rdbStore = null - await dataRdb.deleteRdbStore("Delete.db"); + await dataRdb.deleteRdbStore("rdbstoreTransactionTest.db"); }) afterAll(async function () { diff --git a/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreUpdateJsunit.test.js b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreUpdateJsunit.test.js index 68519afd9b241d392d054e6a8655ce836f01d736..633d856a202281f9ff7a58f70416556e7cf6cfc3 100644 --- a/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreUpdateJsunit.test.js +++ b/distributeddatamgr/relationalStorejstest/hap/src/main/js/test/RdbstoreUpdateJsunit.test.js @@ -38,7 +38,7 @@ describe('rdbStoreUpdateTest', function () { console.info(TAG + 'afterEach') await rdbStore.executeSql("DELETE FROM test"); rdbStore = null - await dataRdb.deleteRdbStore("Delete.db"); + await dataRdb.deleteRdbStore("UpdataTest.db"); }) afterAll(async function () { diff --git a/distributeddatamgr_lite/kv_store_hal/BUILD.gn b/distributeddatamgr_lite/kv_store_hal/BUILD.gn index 7723902d37cd3f5e5b38a77a12f8ca70fa9795f4..f958111515bce6b74ac82be7ab4784f9193f65eb 100755 --- a/distributeddatamgr_lite/kv_store_hal/BUILD.gn +++ b/distributeddatamgr_lite/kv_store_hal/BUILD.gn @@ -23,7 +23,7 @@ hctest_suite("ActsKvStoreTest") { include_dirs = [ "src", - "//utils/native/lite/include", + "//commonlibrary/utils_lite/include", "//base/iothardware/peripheral/interfaces/inner_api", ] cflags = [ "-Wno-error" ] diff --git a/distributeddatamgr_lite/kv_store_posix/BUILD.gn b/distributeddatamgr_lite/kv_store_posix/BUILD.gn index 7d1573c37c203022ed0dac83af48d3f2e9abc02a..910e01ab9f953cbbeda47b88070eee7841a03b46 100755 --- a/distributeddatamgr_lite/kv_store_posix/BUILD.gn +++ b/distributeddatamgr_lite/kv_store_posix/BUILD.gn @@ -21,7 +21,7 @@ hcpptest_suite("ActsKvStoreTest") { "src", "//foundation/distributeddatamgr/kv_store/interfaces/inner_api/kv_store/include", "//third_party/bounds_checking_function/include", - "//utils/native/lite/include", + "//commonlibrary/utils_lite/include", ] deps = [ "//foundation/distributeddatamgr/kv_store/interfaces/inner_api/kv_store:kv_store" ] cflags = [ "-Wno-error" ] diff --git a/distributedschedule/BUILD.gn b/distributedschedule/BUILD.gn deleted file mode 100644 index 414d8ff9a95b9ae3afc928034eeff86f2b0ef58d..0000000000000000000000000000000000000000 --- a/distributedschedule/BUILD.gn +++ /dev/null @@ -1,21 +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("//build/ohos_var.gni") - -group("systemabilitymgr") { - testonly = true - if (is_standard_system) { - deps = [ "dmsfwk:dmsfwk" ] - } -} diff --git a/distributedschedule/dmsfwk/BUILD.gn b/distributedschedule/dmsfwk/BUILD.gn deleted file mode 100644 index bf5ae7cc6a6b9d131590e16ce205f6d02cc21e84..0000000000000000000000000000000000000000 --- a/distributedschedule/dmsfwk/BUILD.gn +++ /dev/null @@ -1,21 +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("//build/ohos_var.gni") - -group("dmsfwk") { - testonly = true - if (is_standard_system) { - deps = [ "continuationmanagertest:continuationmanager_js_test" ] - } -} diff --git a/distributedschedule/dmsfwk/continuationmanagertest/BUILD.gn b/distributedschedule/dmsfwk/continuationmanagertest/BUILD.gn deleted file mode 100644 index b3d2e5dff1cfdb6ac2581eb54670da32c3727399..0000000000000000000000000000000000000000 --- a/distributedschedule/dmsfwk/continuationmanagertest/BUILD.gn +++ /dev/null @@ -1,35 +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("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("continuationmanager_js_test") { - hap_profile = "./src/main/config.json" - deps = [ - ":continuationmanager_js_assets", - ":continuationmanager_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsContinuationManagerJsTest" - subsystem_name = "ability" - part_name = "dmsfwk" -} -ohos_js_assets("continuationmanager_js_assets") { - js2abc = true - hap_profile = "./src/main/config.json" - source_dir = "./src/main/js" -} -ohos_resources("continuationmanager_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/distributedschedule/dmsfwk/continuationmanagertest/Test.json b/distributedschedule/dmsfwk/continuationmanagertest/Test.json deleted file mode 100644 index 7104e0ef7c00a5c259c78829d4600437e0bc4343..0000000000000000000000000000000000000000 --- a/distributedschedule/dmsfwk/continuationmanagertest/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "1200000", - "shell-timeout": "1200000", - "bundle-name": "ohos.acts.distributedschedule.continuationmanager", - "package-name": "ohos.acts.distributedschedule.continuationmanager" - }, - "kits": [ - { - "test-file-name": [ - "ActsContinuationManagerJsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/config.json b/distributedschedule/dmsfwk/continuationmanagertest/src/main/config.json deleted file mode 100644 index 73664228baca03b9cd85ed6d2e4a22fcfcae8b9e..0000000000000000000000000000000000000000 --- a/distributedschedule/dmsfwk/continuationmanagertest/src/main/config.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.distributedschedule.continuationmanager", - "vendor": "example", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5 - } - }, - "deviceConfig": {}, - "module": { - "package": "ohos.acts.distributedschedule.continuationmanager", - "name": ".entry", - "mainAbility": ".MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "formsEnabled": false, - "name": ".MainAbility", - "srcLanguage": "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": true - } - }, - { - "pages": [ - "pages/index/index" - ], - "name": ".TestAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ], - "testRunner": { - "name": "OpenHarmonyTestRunner", - "srcPath": "TestRunner" - }, - "srcPath": "" - } -} \ No newline at end of file diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/app.js b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/app.js deleted file mode 100644 index 3a41e590ec6d582abedac2821eb54bf9aad77dd4..0000000000000000000000000000000000000000 --- a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +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. -*/ -export default { - onCreate() { - console.info('TestApplication onCreate'); - }, - onDestroy() { - console.info('TestApplication onDestroy'); - } -}; diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/pages/index/index.css b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 0eb1086016dbb3adcbaed911f027264630f12993..0000000000000000000000000000000000000000 --- a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,23 +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; -} - -.title { - font-size: 100px; -} diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/pages/index/index.hml b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 2a54c0734ed9fa2b56dcd7bdcb282ba0477c90fd..0000000000000000000000000000000000000000 --- a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. -*/ - -
- - {{ $t('strings.hello') }} {{title}} - -
diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/pages/index/index.js b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index bd4cb14f07d97ea29445efd49882eab0c698f263..0000000000000000000000000000000000000000 --- a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,31 +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. -*/ - -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/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/test/ContinuationManagerJsunit.test.js b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/test/ContinuationManagerJsunit.test.js deleted file mode 100644 index f068b50c8ea82270f50312b0b232ce1c068f98c5..0000000000000000000000000000000000000000 --- a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/test/ContinuationManagerJsunit.test.js +++ /dev/null @@ -1,575 +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 { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -import continuationManager from '@ohos.continuation.continuationManager'; - -const TEST_DEVICE_ID = "test_deviceId"; -const TEST_CONNECT_STATUS = continuationManager.DeviceConnectState.CONNECTED; -let token = -1; - -export default function ContinuationManagerTest() { -describe('ContinuationManagerTest', function() { - - beforeAll(async function (done) { - console.info('beforeAll'); - done(); - }) - - afterAll(async function (done) { - console.info('afterAll'); - done(); - }) - - beforeEach(async function (done) { - console.info('beforeEach'); - await continuationManager.register(function (err, data) { - token = data; - console.info('beforeEach register success'); - done(); - }); - console.info('beforeEach end'); - }) - - afterEach(async function (done) { - console.info('afterEach'); - await continuationManager.unregister(token, function (err, data) { - console.info('afterEach unregister success'); - done(); - }); - console.info('afterEach end'); - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_REGISTER_0100 - * @tc.name [JS-API8]ContinuationManager.register(). - * @tc.desc Test Js Api ContinuationManager.register() testcase 001 - */ - it('testRegister001', 0, async function(done) { - try { - continuationManager.register(function (err, data) { - expect(err.code == 0).assertTrue(); - expect(data - token == 1).assertTrue(); - done(); - }); - } catch (e) { - console.info("testRegister001 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_REGISTER_0200 - * @tc.name [JS-API8]ContinuationManager.register(). - * @tc.desc Test Js Api ContinuationManager.register() testcase 002 - */ - it('testRegister002', 0, async function(done) { - try { - let continuationExtraParams = { - deviceType: [], - description: "", - filter: "", - continuationMode: null, - authInfo: {} - }; - continuationManager.register(continuationExtraParams, function(err, data){ - console.info("testRegister002 " + err.message) - expect(err.message == "Invalidate params.").assertTrue(); - done(); - }); - } catch (e) { - console.info("testRegister002 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_REGISTER_0300 - * @tc.name [JS-API8]ContinuationManager.register(). - * @tc.desc Test Js Api ContinuationManager.register() testcase 003 - */ - it('testRegister003', 0, async function(done) { - try { - let continuationExtraParams = { - deviceType: ["00E"], - description: "description", - filter: {"name": "authInfo","length": 8}, - continuationMode: 10, - authInfo: {"name": "authInfo","length": 8} - }; - continuationManager.register(continuationExtraParams, function(err, data) { - expect(err.code == 29360216).assertTrue(); - console.info("testRegister003 "+ err); - done(); - }); - } catch (e) { - console.info("testRegister003 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_REGISTER_0400 - * @tc.name [JS-API8]ContinuationManager.register(). - * @tc.desc Test Js Api ContinuationManager.register() testcase 004 - */ - it('testRegister004', 0, async function(done) { - try { - let continuationExtraParams = { - deviceType: ["00E"], - description: "description", - filter: {"name": "authInfo","length": 8}, - continuationMode: continuationManager.ContinuationMode.COLLABORATION_MUTIPLE, - authInfo: {"name": "authInfo","length": 8} - }; - continuationManager.register(continuationExtraParams, function(err, data) { - expect(err.code == 0).assertTrue(); - expect(data - token == 1).assertTrue(); - done(); - }); - } catch (e) { - console.info("testRegister004 " + e); - expect(null).assertFail(); - done(); - } - }) - - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UNREGISTER_0100 - * @tc.name [JS-API8]ContinuationManager.unregister(). - * @tc.desc Test Js Api ContinuationManager.unregister() testcase 001 - */ - it('testUnregister001', 0, async function(done) { - try { - continuationManager.unregister(token, function (err, data) { - expect(err.code == 0).assertTrue(); - expect(data == undefined).assertTrue(); - }) - done(); - } catch (e) { - console.info("testUnregister001 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UNREGISTER_0200 - * @tc.name [JS-API8]ContinuationManager.unregister(). - * @tc.desc Test Js Api ContinuationManager.unregister() testcase 002 - */ - it('testUnregister002', 0, async function(done) { - try { - continuationManager.unregister(null, function (err, data) { - console.info("testUnregister002 " + data); - expect(err.message == "Invalidate params.").assertTrue(); - expect(data == undefined).assertTrue(); - }) - done(); - } catch (e) { - console.info("testUnregister002 " + e); - expect(null).assertFail(); - done(); - } - }) - - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UNREGISTER_0300 - * @tc.name [JS-API8]ContinuationManager.unregister(). - * @tc.desc Test Js Api ContinuationManager.unregister() testcase 003 - */ - it('testUnregister003', 0, async function(done) { - try { - continuationManager.unregister(300, function (err, data) { - expect(err.code == 29360208).assertTrue(); - expect(data == undefined).assertTrue(); - }) - done(); - } catch (e) { - console.info("testUnregister003 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_ON_0100 - * @tc.name [JS-API8]ContinuationManager.on(). - * @tc.desc Test Js Api ContinuationManager.on() testcase 001 - */ - it('testOn001', 0, async function(done) { - try { - continuationManager.on("deviceConnect", function (data) { - expect(data == undefined).assertTrue(); - }); - done(); - } catch (e) { - console.info("testOn001 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_ON_0200 - * @tc.name [JS-API8]ContinuationManager.on(). - * @tc.desc Test Js Api ContinuationManager.on() testcase 002 - */ - it('testOn002', 0, async function(done) { - try { - continuationManager.on("deviceDisconnect", function (data) { - expect(data == undefined).assertTrue(); - }); - done(); - } catch (e) { - console.info("testOn002 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_ON_0300 - * @tc.name [JS-API9]ContinuationManager.on(). - * @tc.desc Test Js Api ContinuationManager.on() testcase 003 - */ - it('testOn003', 0, async function(done) { - try { - continuationManager.on("deviceConnect", token, function (data) { - expect(data == undefined).assertTrue(); - }) - done(); - } catch (e) { - console.info("testOn003 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_ON_0400 - * @tc.name [JS-API9]ContinuationManager.on(). - * @tc.desc Test Js Api ContinuationManager.on() testcase 004 - */ - it('testOn004', 0, async function(done) { - try { - continuationManager.on("deviceDisconnect", token, function (data) { - expect(data == undefined).assertTrue(); - }); - done(); - } catch (e) { - console.info("testOn004 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_OFF_0100 - * @tc.name [JS-API8]ContinuationManager.off(). - * @tc.desc Test Js Api ContinuationManager.off() testcase 001 - */ - it('testOff001', 0, async function(done) { - try { - continuationManager.off("deviceConnect", function (data) { - expect(data == undefined).assertTrue(); - }); - done(); - } catch (e) { - console.info("testOff001 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_OFF_0200 - * @tc.name [JS-API8]ContinuationManager.off(). - * @tc.desc Test Js Api ContinuationManager.off() testcase 002 - */ - it('testOff002', 0, async function(done) { - try { - continuationManager.off("deviceDisconnect", function (data) { - expect(data == undefined).assertTrue(); - }); - done(); - } catch (e) { - console.info("testOff002 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_OFF_0300 - * @tc.name [JS-API9]ContinuationManager.off(). - * @tc.desc Test Js Api ContinuationManager.off() testcase 003 - */ - it('testOff003', 0, async function(done) { - try { - continuationManager.off("deviceConnect", token); - done(); - } catch (e) { - console.info("testOff003 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_OFF_0400 - * @tc.name [JS-API9]ContinuationManager.off(). - * @tc.desc Test Js Api ContinuationManager.off() testcase 004 - */ - it('testOff004', 0, async function(done) { - try { - continuationManager.off("deviceDisconnect", token); - done(); - } catch (e) { - console.info("testOff004 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_STARTDEVICEMANAGER_0100 - * @tc.name [JS-API8]ContinuationManager.startDeviceManager(). - * @tc.desc Test Js Api ContinuationManager.startDeviceManager() testcase 001 - */ - it('testStartDeviceManager001', 0, async function(done) { - try { - continuationManager.startDeviceManager(token, function (err, data) { - expect(err.code != 0).assertTrue(); - expect(data == undefined).assertTrue(); - }); - done(); - } catch (e) { - console.info("testStartDeviceManager001 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_STARTDEVICEMANAGER_0200 - * @tc.name [JS-API8]ContinuationManager.startDeviceManager(). - * @tc.desc Test Js Api ContinuationManager.startDeviceManager() testcase 002 - */ - it('testStartDeviceManager002', 0, async function(done) { - try { - continuationManager.startDeviceManager(null, function (err, data) { - expect(err.code == -1).assertTrue(); - expect(data == undefined).assertTrue(); - }); - done(); - } catch (e) { - console.info("testStartDeviceManager002 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_STARTDEVICEMANAGER_0300 - * @tc.name [JS-API8]ContinuationManager.startDeviceManager(). - * @tc.desc Test Js Api ContinuationManager.startDeviceManager() testcase 003 - */ - it('testStartDeviceManager003', 0, async function(done) { - try { - let continuationExtraParams = { - deviceType: ["00E"], - description: "description", - filter: {"name": "authInfo","length": 8}, - continuationMode: continuationManager.ContinuationMode.COLLABORATION_MUTIPLE, - authInfo: {"name": "authInfo","length": 8} - }; - continuationManager.startDeviceManager(null, continuationExtraParams, function (err, data) { - expect(err.code == -1).assertTrue(); - expect(data == undefined).assertTrue(); - }); - done(); - } catch (e) { - console.info("testStartDeviceManager003 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_STARTDEVICEMANAGER_0400 - * @tc.name [JS-API8]ContinuationManager.startDeviceManager(). - * @tc.desc Test Js Api ContinuationManager.startDeviceManager() testcase 004 - */ - it('testStartDeviceManager004', 0, async function(done) { - try { - let continuationExtraParams = { - deviceType: ["00E"], - description: "description", - filter: {"name": "authInfo","length": 8}, - continuationMode: continuationManager.ContinuationMode.COLLABORATION_MUTIPLE, - authInfo: {"name": "authInfo","length": 8} - }; - continuationManager.startDeviceManager(52, continuationExtraParams, function (err, data) { - console.info("testStartDeviceManager004 " + err.code); - expect(err.code == 29360208).assertTrue(); - expect(data == undefined).assertTrue(); - }); - done(); - } catch (e) { - console.info("testStartDeviceManager004 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_STARTDEVICEMANAGER_0500 - * @tc.name [JS-API8]ContinuationManager.startDeviceManager(). - * @tc.desc Test Js Api ContinuationManager.startDeviceManager() testcase 005 - */ - it('testStartDeviceManager005', 0, async function(done) { - try { - let continuationExtraParams = { - deviceType: ["00E"], - description: "description", - filter: {"name": "authInfo","length": 8}, - continuationMode: 30, - authInfo: {"name": "authInfo","length": 8} - }; - continuationManager.startDeviceManager(token, continuationExtraParams, function (err, data) { - console.info("testStartDeviceManager005 " + err.code); - expect(err.code == 29360216).assertTrue(); - expect(data == undefined).assertTrue(); - }); - done(); - } catch (e) { - console.info("testStartDeviceManager005 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_STARTDEVICEMANAGER_0600 - * @tc.name [JS-API8]ContinuationManager.startDeviceManager(). - * @tc.desc Test Js Api ContinuationManager.startDeviceManager() testcase 006 - */ - it('testStartDeviceManager006', 0, async function(done) { - try { - let continuationExtraParams = { - }; - continuationManager.startDeviceManager(token, continuationExtraParams, function (err, data) { - console.info("testStartDeviceManager006 " + err.code); - expect(err.code != 0).assertTrue(); - expect(data == undefined).assertTrue(); - }); - done(); - } catch (e) { - console.info("testStartDeviceManager006 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_STARTDEVICEMANAGER_0700 - * @tc.name [JS-API8]ContinuationManager.startDeviceManager(). - * @tc.desc Test Js Api ContinuationManager.startDeviceManager() testcase 007 - */ - it('testStartDeviceManager007', 0, async function(done) { - try { - let continuationExtraParams = { - deviceType: ["00E"], - description: "description", - filter: {"name": "authInfo","length": 8}, - continuationMode: continuationManager.ContinuationMode.COLLABORATION_MUTIPLE, - authInfo: {"name": "authInfo","length": 8} - }; - continuationManager.startDeviceManager(token, continuationExtraParams, function (err, data) { - expect(err.code != 0).assertTrue(); - expect(data == undefined).assertTrue(); - }); - done(); - } catch (e) { - console.info("testStartDeviceManager007 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UPDATECONNECTSTATUS_0100 - * @tc.name [JS-API8]ContinuationManager.updateConnectStatus(). - * @tc.desc Test Js Api ContinuationManager.updateConnectStatus() testcase 001 - */ - it('testUpdateConnectStatus001', 0, async function(done) { - try { - continuationManager.updateConnectStatus(token, TEST_DEVICE_ID, TEST_CONNECT_STATUS, function (err, data) { - expect(err.code != 0).assertTrue(); - expect(data == undefined).assertTrue(); - }); - done(); - } catch (e) { - console.info("testUpdateConnectStatus001 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UPDATECONNECTSTATUS_0200 - * @tc.name [JS-API8]ContinuationManager.updateConnectStatus(). - * @tc.desc Test Js Api ContinuationManager.updateConnectStatus() testcase 002 - */ - it('testUpdateConnectStatus002', 0, async function(done) { - try { - continuationManager.updateConnectStatus(null, TEST_DEVICE_ID, TEST_CONNECT_STATUS, function (err, data) { - console.info("testUpdateConnectStatus002 " + err.code); - expect(err.code == -1).assertTrue(); - expect(data == undefined).assertTrue(); - }); - done(); - } catch (e) { - console.info("testUpdateConnectStatus002 " + e); - expect(null).assertFail(); - done(); - } - }) - - /** - * @tc.number SUB_DISTRIBUTEDSCHEDULE_CONTINUATIONMANAGER_UPDATECONNECTSTATUS_0300 - * @tc.name [JS-API8]ContinuationManager.updateConnectStatus(). - * @tc.desc Test Js Api ContinuationManager.updateConnectStatus() testcase 003 - */ - it('testUpdateConnectStatus003', 0, async function(done) { - try { - continuationManager.updateConnectStatus(token, TEST_DEVICE_ID, -2, function (err, data) { - console.info("testUpdateConnectStatus003 " + err.code); - expect(err.code == 29360215).assertTrue(); - expect(data == undefined).assertTrue(); - }); - done(); - } catch (e) { - console.info("testUpdateConnectStatus003 " + e); - expect(null).assertFail(); - done(); - } - }) -})} diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/test/List.test.js b/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/test/List.test.js deleted file mode 100644 index a6a82ae64195f994ca4755177bb6e6eb66b4ae48..0000000000000000000000000000000000000000 --- a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +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 ContinuationManagerTest from './ContinuationManagerJsunit.test.js' -export default function testsuite() { -ContinuationManagerTest() -} diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/resources/base/element/string.json b/distributedschedule/dmsfwk/continuationmanagertest/src/main/resources/base/element/string.json deleted file mode 100644 index c931e164748318159c3a3939e588b26ec19f7b7f..0000000000000000000000000000000000000000 --- a/distributedschedule/dmsfwk/continuationmanagertest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ContinuationManagerJsTest" - }, - { - "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/global/global_napi_test/Test.json b/global/global_napi_test/Test.json index 755540b84c745d5045e0a17491c356f016705fa6..d19ee5217fb5a9f8115ed09602a88f99d842ca2e 100644 --- a/global/global_napi_test/Test.json +++ b/global/global_napi_test/Test.json @@ -3,6 +3,7 @@ "driver": { "type": "OHJSUnitTest", "test-timeout": "600000", + "testcase-timeout": "300000", "bundle-name": "ohos.global.napitest", "package-name": "ohos.global.napitest", "shell-timeout": "600000" diff --git a/global/global_napi_test/entry/src/main/config.json b/global/global_napi_test/entry/src/main/config.json index e788d7d883c947afee0459e9e77d019ca6ef6dd5..2c57492e41ed1a666b55f2b811d7c0b3c29e97d1 100644 --- a/global/global_napi_test/entry/src/main/config.json +++ b/global/global_napi_test/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": "ohos.global.napitest.MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/global/i18n_standard/intljs/Test.json b/global/i18n_standard/intljs/Test.json index 2839fb01d953a68d9aa996ba969bfe49a3945812..868dc49c2eebb3d125fe60dd4df40f44858291cf 100644 --- a/global/i18n_standard/intljs/Test.json +++ b/global/i18n_standard/intljs/Test.json @@ -3,6 +3,7 @@ "driver": { "type": "OHJSUnitTest", "test-timeout": "300000", + "testcase-timeout": "300000", "shell-timeout": "300000", "bundle-name": "ohos.intl.test", "package-name": "ohos.intl.test" diff --git a/global/i18n_standard/intljs/signature/openharmony_sx.p7b b/global/i18n_standard/intljs/signature/openharmony_sx.p7b index da83885803764a8fc629c0189f630a2be261e2ee..17a9c30d3f57b5406b985e582410b98daba51c37 100644 Binary files a/global/i18n_standard/intljs/signature/openharmony_sx.p7b and b/global/i18n_standard/intljs/signature/openharmony_sx.p7b differ diff --git a/global/i18n_standard/intljs/src/main/config.json b/global/i18n_standard/intljs/src/main/config.json index f1808af3f5379c4e1e1a9e98a3f72eff3258e724..72624cf927669527a870d2febe49de9883eb18b0 100644 --- a/global/i18n_standard/intljs/src/main/config.json +++ b/global/i18n_standard/intljs/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.intl.test", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/global/i18n_standard/intljs/src/main/js/test/I18n.test.js b/global/i18n_standard/intljs/src/main/js/test/I18n.test.js index c23a19076697e561c96db8501bf2d851514e3d2a..3558352f7cdac0ee175145adc8097afab7b89a63 100644 --- a/global/i18n_standard/intljs/src/main/js/test/I18n.test.js +++ b/global/i18n_standard/intljs/src/main/js/test/I18n.test.js @@ -90,6 +90,50 @@ describe('I18nTest', function () { expect(locale).assertInstanceOf('String'); }) + /* * + * @tc.number SUB_GLOBAL_I18N_JS_2310 + * @tc.name isSuggested with zh param + * @tc.desc check the isSuggested + */ + it('i18n_test_2310', 0, function () { + let value = I18n.isSuggested('zh'); + console.log('i18n_test_2310 ' + value); + expect(value).assertTrue(); + }) + + /* * + * @tc.number SUB_GLOBAL_I18N_JS_2320 + * @tc.name isSuggested with en param + * @tc.desc check the isSuggested + */ + it('i18n_test_2320', 0, function () { + let value = I18n.isSuggested('en'); + console.log('i18n_test_2320 ' + value); + expect(value).assertFalse(); + }) + + /* * + * @tc.number SUB_GLOBAL_I18N_JS_2330 + * @tc.name isSuggested with zh-CN param + * @tc.desc check the isSuggested + */ + it('i18n_test_2330', 0, function () { + let value = I18n.isSuggested('zh', 'CN'); + console.log('i18n_test_2330 ' + value); + expect(value).assertTrue(); + }) + + /* * + * @tc.number SUB_GLOBAL_I18N_JS_2340 + * @tc.name isSuggested with en-US param + * @tc.desc check the isSuggested + */ + it('i18n_test_2340', 0, function () { + let value = I18n.isSuggested('en' , 'US'); + console.log('i18n_test_2340 ' + value); + expect(value).assertTrue(); + }) + /* * * @tc.number SUB_GLOBAL_I18N_JS_3800 * @tc.name getDisplayCountry with zh-Hans-CN and en-US and true param @@ -1235,7 +1279,7 @@ describe('I18nTest', function () { */ it('i18n_test_9100', 0, function () { console.log('i18n_test_9100 ' + 'start'); - let value = I18n.Util.unitConvert({unit: 'cup', measureSystem: 'US'}, + let value = I18n.I18NUtil.unitConvert({unit: 'cup', measureSystem: 'US'}, {unit: 'liter', measureSystem: 'SI'}, 1000, 'en-US', @@ -1251,7 +1295,7 @@ describe('I18nTest', function () { */ it('i18n_test_9200', 0, function () { console.log('i18n_test_9200 ' + 'start'); - let value = I18n.Util.unitConvert({unit: 'cup', measureSystem: 'US'}, + let value = I18n.I18NUtil.unitConvert({unit: 'cup', measureSystem: 'US'}, {unit: 'liter', measureSystem: 'SI'}, 1000, 'en-US', @@ -1267,7 +1311,7 @@ describe('I18nTest', function () { */ it('i18n_test_9250', 0, function () { console.log('i18n_test_9250 ' + 'start'); - let value = I18n.Util.unitConvert({unit: 'cup', measureSystem: 'US'}, + let value = I18n.I18NUtil.unitConvert({unit: 'cup', measureSystem: 'US'}, {unit: 'liter', measureSystem: 'SI'}, 1000, 'en-US', @@ -1283,7 +1327,7 @@ describe('I18nTest', function () { */ it('i18n_test_9300', 0, function () { console.log('i18n_test_9300 ' + 'start'); - let value = I18n.Util.unitConvert({unit: 'cup', measureSystem: 'US'}, + let value = I18n.I18NUtil.unitConvert({unit: 'cup', measureSystem: 'US'}, {unit: 'liter', measureSystem: 'SI'}, 1000, 'en-US', @@ -1299,7 +1343,7 @@ describe('I18nTest', function () { */ it('i18n_test_9400', 0, function () { console.log('i18n_test_9400 ' + 'start'); - let value = I18n.Util.unitConvert({unit: 'meter', measureSystem: 'SI'}, + let value = I18n.I18NUtil.unitConvert({unit: 'meter', measureSystem: 'SI'}, {unit: 'mile', measureSystem: 'SI'}, 1000, 'zh-CN', @@ -1315,7 +1359,7 @@ describe('I18nTest', function () { */ it('i18n_test_9500', 0, function () { console.log('i18n_test_9500 ' + 'start'); - let value = I18n.Util.unitConvert({unit: 'hour', measureSystem: 'SI'}, + let value = I18n.I18NUtil.unitConvert({unit: 'hour', measureSystem: 'SI'}, {unit: 'second', measureSystem: 'SI'}, 10, 'zh-CN', @@ -1331,7 +1375,7 @@ describe('I18nTest', function () { */ it('i18n_test_9600', 0, function () { console.log('i18n_test_9600 ' + 'start'); - let value = I18n.Util.unitConvert({unit: 'celsius', measureSystem: 'SI'}, + let value = I18n.I18NUtil.unitConvert({unit: 'celsius', measureSystem: 'SI'}, {unit: 'fahrenheit', measureSystem: 'SI'}, 1000, 'zh-CN', @@ -1347,7 +1391,7 @@ describe('I18nTest', function () { */ it('i18n_test_9700', 0, function () { console.log('i18n_test_9700 ' + 'start'); - let value = I18n.Util.unitConvert({unit: 'acre', measureSystem: 'SI'}, + let value = I18n.I18NUtil.unitConvert({unit: 'acre', measureSystem: 'SI'}, {unit: 'hectare', measureSystem: 'SI'}, 1000, 'zh-CN', @@ -1363,7 +1407,7 @@ describe('I18nTest', function () { */ it('i18n_test_9710', 0, function () { console.log('i18n_test_9710 ' + 'start'); - let value = I18n.Util.unitConvert({unit: 'acre', measureSystem: 'SI'}, + let value = I18n.I18NUtil.unitConvert({unit: 'acre', measureSystem: 'SI'}, {unit: 'square-meter', measureSystem: 'SI'}, 1000, 'zh-CN', @@ -1379,7 +1423,7 @@ describe('I18nTest', function () { */ it('i18n_test_9800', 0, function () { console.log('i18n_test_9800 ' + 'start'); - let value = I18n.Util.unitConvert({unit: 'kilometer-per-hour', measureSystem: 'SI'}, + let value = I18n.I18NUtil.unitConvert({unit: 'kilometer-per-hour', measureSystem: 'SI'}, {unit: 'knot', measureSystem: 'SI'}, 1000, 'zh-CN', @@ -1395,7 +1439,7 @@ describe('I18nTest', function () { */ it('i18n_test_9850', 0, function () { console.log('i18n_test_9850 ' + 'start'); - let value = I18n.Util.unitConvert({unit: 'kilometer-per-hour', measureSystem: 'SI'}, + let value = I18n.I18NUtil.unitConvert({unit: 'kilometer-per-hour', measureSystem: 'SI'}, {unit: 'meter-per-second', measureSystem: 'SI'}, 1000, 'zh-CN', @@ -1411,7 +1455,7 @@ describe('I18nTest', function () { */ it('i18n_test_9900', 0, function () { console.log('i18n_test_9900 ' + 'start'); - let value = I18n.Util.unitConvert({unit: 'meter', measureSystem: 'SI'}, + let value = I18n.I18NUtil.unitConvert({unit: 'meter', measureSystem: 'SI'}, {unit: 'kilometer', measureSystem: 'SI'}, 1000, 'zh-CN', @@ -1427,7 +1471,7 @@ describe('I18nTest', function () { */ it('i18n_test_9910', 0, function () { console.log('i18n_test_9910 ' + 'start'); - let value = I18n.Util.unitConvert({unit: 'meter', measureSystem: 'SI'}, + let value = I18n.I18NUtil.unitConvert({unit: 'meter', measureSystem: 'SI'}, {unit: 'meter-per-second', measureSystem: 'SI'}, 1000, 'zh-CN', @@ -1675,7 +1719,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0100', 0, function () { console.log('i18n_test_character_0100 ' + 'start'); - let value = I18n.Character.isDigit('abc'); + let value = I18n.Unicode.isDigit('abc'); console.log('i18n_test_character_0100 ' + value); expect(value).assertFalse(); }) @@ -1687,7 +1731,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0120', 0, function () { console.log('i18n_test_character_0120 ' + 'start'); - let value = I18n.Character.isDigit('123'); + let value = I18n.Unicode.isDigit('123'); console.log('i18n_test_character_0120 ' + value); expect(value).assertTrue(); }) @@ -1699,7 +1743,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0140', 0, function () { console.log('i18n_test_character_0140 ' + 'start'); - let value = I18n.Character.isDigit('123abc'); + let value = I18n.Unicode.isDigit('123abc'); console.log('i18n_test_character_0140 ' + value); expect(value).assertTrue(); }) @@ -1711,7 +1755,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0150', 0, function () { console.log('i18n_test_character_0150 ' + 'start'); - let value = I18n.Character.isDigit('abc123'); + let value = I18n.Unicode.isDigit('abc123'); console.log('i18n_test_character_0150 ' + value); expect(value).assertFalse(); }) @@ -1723,7 +1767,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0160', 0, function () { console.log('i18n_test_character_0160 ' + 'start'); - let value = I18n.Character.isDigit(''); + let value = I18n.Unicode.isDigit(''); console.log('i18n_test_character_0160 ' + value); expect(value).assertFalse(); }) @@ -1735,7 +1779,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0200', 0, function () { console.log('i18n_test_character_0200 ' + 'start'); - let value = I18n.Character.isSpaceChar('abc'); + let value = I18n.Unicode.isSpaceChar('abc'); console.log('i18n_test_character_0200 ' + value); expect(value).assertFalse(); }) @@ -1747,7 +1791,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0220', 0, function () { console.log('i18n_test_character_0220 ' + 'start'); - let value = I18n.Character.isSpaceChar(' '); + let value = I18n.Unicode.isSpaceChar(' '); console.log('i18n_test_character_0220 ' + value); expect(value).assertTrue(); }) @@ -1759,7 +1803,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0240', 0, function () { console.log('i18n_test_character_0240 ' + 'start'); - let value = I18n.Character.isSpaceChar(' '); + let value = I18n.Unicode.isSpaceChar(' '); console.log('i18n_test_character_0240--' + value + '--'); expect(value).assertTrue(); }) @@ -1771,7 +1815,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0300', 0, function () { console.log('i18n_test_character_0300 ' + 'start'); - let value = I18n.Character.isWhitespace('abc'); + let value = I18n.Unicode.isWhitespace('abc'); console.log('i18n_test_character_0300 ' + value); expect(value).assertFalse(); }) @@ -1783,7 +1827,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0320', 0, function () { console.log('i18n_test_character_0320 ' + 'start'); - let value = I18n.Character.isWhitespace('\u0009'); + let value = I18n.Unicode.isWhitespace('\u0009'); console.log('i18n_test_character_0320--' + value + '--'); expect(value).assertTrue(); }) @@ -1795,7 +1839,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0400', 0, function () { console.log('i18n_test_character_0400 ' + 'start'); - let value = I18n.Character.isRTL('abc'); + let value = I18n.Unicode.isRTL('abc'); console.log('i18n_test_character_0400 ' + value); expect(value).assertFalse(); }) @@ -1807,7 +1851,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0420', 0, function () { console.log('i18n_test_character_0420 ' + 'start'); - let value = I18n.Character.isRTL('١٢٣٤٥٦٧'); + let value = I18n.Unicode.isRTL('١٢٣٤٥٦٧'); console.log('i18n_test_character_0420 ' + value); expect(value).assertFalse(); }) @@ -1819,7 +1863,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0440', 0, function () { console.log('i18n_test_character_0440 ' + 'start'); - let value = I18n.Character.isRTL('我是小明'); + let value = I18n.Unicode.isRTL('我是小明'); console.log('i18n_test_character_0440 ' + value); expect(value).assertFalse(); }) @@ -1831,7 +1875,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0460', 0, function () { console.log('i18n_test_character_0460 ' + 'start'); - let value = I18n.Character.isRTL('نحن'); + let value = I18n.Unicode.isRTL('نحن'); console.log('i18n_test_character_0460 ' + value); expect(value).assertTrue(); }) @@ -1843,7 +1887,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0500', 0, function () { console.log('i18n_test_character_0500 ' + 'start'); - let value = I18n.Character.isIdeograph('abc'); + let value = I18n.Unicode.isIdeograph('abc'); console.log('i18n_test_character_0500 ' + value); expect(value).assertFalse(); }) @@ -1855,7 +1899,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0520', 0, function () { console.log('i18n_test_character_0520 ' + 'start'); - let value = I18n.Character.isIdeograph('我'); + let value = I18n.Unicode.isIdeograph('我'); console.log('i18n_test_character_0520 ' + value); expect(value).assertTrue(); }) @@ -1867,7 +1911,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0540', 0, function () { console.log('i18n_test_character_0540 ' + 'start'); - let value = I18n.Character.isIdeograph('우리'); + let value = I18n.Unicode.isIdeograph('우리'); console.log('i18n_test_character_0540 ' + value); expect(value).assertFalse(); }) @@ -1879,7 +1923,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0560', 0, function () { console.log('i18n_test_character_0560 ' + 'start'); - let value = I18n.Character.isIdeograph('私たち'); + let value = I18n.Unicode.isIdeograph('私たち'); console.log('i18n_test_character_0560 ' + value); expect(value).assertTrue(); }) @@ -1891,7 +1935,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0600', 0, function () { console.log('i18n_test_character_0600 ' + 'start'); - let value = I18n.Character.isLetter('abc'); + let value = I18n.Unicode.isLetter('abc'); console.log('i18n_test_character_0600 ' + value); expect(value).assertTrue(); }) @@ -1903,7 +1947,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0620', 0, function () { console.log('i18n_test_character_0620 ' + 'start'); - let value = I18n.Character.isLetter('123'); + let value = I18n.Unicode.isLetter('123'); console.log('i18n_test_character_0620 ' + value); expect(value).assertFalse(); }) @@ -1915,7 +1959,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0640', 0, function () { console.log('i18n_test_character_0640 ' + 'start'); - let value = I18n.Character.isLetter('abc123'); + let value = I18n.Unicode.isLetter('abc123'); console.log('i18n_test_character_0640 ' + value); expect(value).assertTrue(); }) @@ -1927,7 +1971,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0660', 0, function () { console.log('i18n_test_character_0660 ' + 'start'); - let value = I18n.Character.isLetter('123abc'); + let value = I18n.Unicode.isLetter('123abc'); console.log('i18n_test_character_0660 ' + value); expect(value).assertFalse(); }) @@ -1939,7 +1983,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0700', 0, function () { console.log('i18n_test_character_0700 ' + 'start'); - let value = I18n.Character.isLowerCase('abc'); + let value = I18n.Unicode.isLowerCase('abc'); console.log('i18n_test_character_0700 ' + value); expect(value).assertTrue(); }) @@ -1951,7 +1995,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0720', 0, function () { console.log('i18n_test_character_0720 ' + 'start'); - let value = I18n.Character.isLowerCase('ABC'); + let value = I18n.Unicode.isLowerCase('ABC'); console.log('i18n_test_character_0720 ' + value); expect(value).assertFalse(); }) @@ -1963,7 +2007,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0740', 0, function () { console.log('i18n_test_character_0740 ' + 'start'); - let value = I18n.Character.isLowerCase('abcDEF'); + let value = I18n.Unicode.isLowerCase('abcDEF'); console.log('i18n_test_character_0740 ' + value); expect(value).assertTrue(); }) @@ -1975,7 +2019,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0760', 0, function () { console.log('i18n_test_character_0760 ' + 'start'); - let value = I18n.Character.isLowerCase('ABCdef'); + let value = I18n.Unicode.isLowerCase('ABCdef'); console.log('i18n_test_character_0760 ' + value); expect(value).assertFalse(); }) @@ -1987,7 +2031,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0800', 0, function () { console.log('i18n_test_character_0800 ' + 'start'); - let value = I18n.Character.isUpperCase('ABC'); + let value = I18n.Unicode.isUpperCase('ABC'); console.log('i18n_test_character_0800 ' + value); expect(value).assertTrue(); }) @@ -1999,7 +2043,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0820', 0, function () { console.log('i18n_test_character_0820 ' + 'start'); - let value = I18n.Character.isUpperCase('abc'); + let value = I18n.Unicode.isUpperCase('abc'); console.log('i18n_test_character_0820 ' + value); expect(value).assertFalse(); }) @@ -2011,7 +2055,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0840', 0, function () { console.log('i18n_test_character_0840 ' + 'start'); - let value = I18n.Character.isUpperCase('ABCdef'); + let value = I18n.Unicode.isUpperCase('ABCdef'); console.log('i18n_test_character_0840 ' + value); expect(value).assertTrue(); }) @@ -2023,7 +2067,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0860', 0, function () { console.log('i18n_test_character_0860 ' + 'start'); - let value = I18n.Character.isUpperCase('abcDEF'); + let value = I18n.Unicode.isUpperCase('abcDEF'); console.log('i18n_test_character_0860 ' + value); expect(value).assertFalse(); }) @@ -2035,7 +2079,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0900', 0, function () { console.log('i18n_test_character_0900 ' + 'start'); - let value = I18n.Character.getType('a'); + let value = I18n.Unicode.getType('a'); console.log('i18n_test_character_0900 ' + value); expect(value).assertEqual('U_LOWERCASE_LETTER'); }) @@ -2047,7 +2091,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0920', 0, function () { console.log('i18n_test_character_0920 ' + 'start'); - let value = I18n.Character.getType('ABC'); + let value = I18n.Unicode.getType('ABC'); console.log('i18n_test_character_0920 ' + value); expect(value).assertEqual('U_UPPERCASE_LETTER'); }) @@ -2059,7 +2103,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0940', 0, function () { console.log('i18n_test_character_0940 ' + 'start'); - let value = I18n.Character.getType('ABCdef'); + let value = I18n.Unicode.getType('ABCdef'); console.log('i18n_test_character_0940 ' + value); expect(value).assertEqual('U_UPPERCASE_LETTER'); }) @@ -2071,7 +2115,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0960', 0, function () { console.log('i18n_test_character_0960 ' + 'start'); - let value = I18n.Character.getType('123'); + let value = I18n.Unicode.getType('123'); console.log('i18n_test_character_0960 ' + value); expect(value).assertEqual('U_DECIMAL_DIGIT_NUMBER'); }) @@ -2083,7 +2127,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0970', 0, function () { console.log('i18n_test_character_0970 ' + 'start'); - let value = I18n.Character.getType('123abc'); + let value = I18n.Unicode.getType('123abc'); console.log('i18n_test_character_0970 ' + value); expect(value).assertEqual('U_DECIMAL_DIGIT_NUMBER'); }) @@ -2095,7 +2139,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0980', 0, function () { console.log('i18n_test_character_0980 ' + 'start'); - let value = I18n.Character.getType('١٢٣٤٥٦٧'); + let value = I18n.Unicode.getType('١٢٣٤٥٦٧'); console.log('i18n_test_character_0980 ' + value); expect(value).assertEqual('U_DECIMAL_DIGIT_NUMBER'); }) @@ -2107,7 +2151,7 @@ describe('I18nTest', function () { */ it('i18n_test_character_0990', 0, function () { console.log('i18n_test_character_0990 ' + 'start'); - let value = I18n.Character.getType(' '); + let value = I18n.Unicode.getType(' '); console.log('i18n_test_character_0990 ' + value); expect(value).assertEqual('U_SPACE_SEPARATOR'); }) diff --git a/global/i18n_standard/intljs/src/main/js/test/Lang.test.js b/global/i18n_standard/intljs/src/main/js/test/Lang.test.js index 9584d179ad1e80a09744988afaef33ed2198b6b7..e8cef3d6a8cbf70380c28a628273b7514761fb41 100644 --- a/global/i18n_standard/intljs/src/main/js/test/Lang.test.js +++ b/global/i18n_standard/intljs/src/main/js/test/Lang.test.js @@ -89,7 +89,7 @@ describe('LangTest', function () { console.log('i18n_test_clock_0100 ' + 'start'); let value = I18n.is24HourClock(); console.log('i18n_test_clock_0100 ' + value); - if(hour) + if(value) { expect(value).assertTrue(); } @@ -99,6 +99,33 @@ describe('LangTest', function () { } }) + /* * + * @tc.number SUB_GLOBAL_I18N_JS_CLOCK_0120 + * @tc.name test the set24HourClock interface + * @tc.desc check the value of set24HourClock method + */ + it('i18n_test_clock_0120', 0, function () { + console.log('i18n_test_clock_0120 ' + 'start'); + let value = I18n.is24HourClock(); + console.log('i18n_test_clock_0120 ' + value); + if(value) + { + let hourclock = I18n.set24HourClock(false); + console.log('i18n_test_clock_0120 ' + hourclock); + hourclock = I18n.set24HourClock(true); + console.log('i18n_test_clock_0120 ' + hourclock); + expect(value).assertTrue(); + } + else + { + let hourclock = I18n.set24HourClock(true); + console.log('i18n_test_clock_0120 ' + hourclock); + hourclock = I18n.set24HourClock(false); + console.log('i18n_test_clock_0120 ' + hourclock); + expect(value).assertFalse(); + } + }) + /* * * @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0100 * @tc.name test the getPreferredLanguageList interface with default value @@ -111,6 +138,46 @@ describe('LangTest', function () { expect(value.length).assertLarger(0); }) + /* * + * @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0120 + * @tc.name test the addPreferredLanguage interface + * @tc.desc check the value of addPreferredLanguage method + */ + it('i18n_test_preferredlanguage_0120', 0, function () { + console.log('i18n_test_preferredlanguage_0120 ' + 'start'); + let list = I18n.getPreferredLanguageList(); + console.log('i18n_test_preferredlanguage_0120 ' + list); + expect(list.length).assertLarger(0); + if(list[0] != 'zh-Hans-CN'){ + let value = I18n.addPreferredLanguage('zh-Hans-CN'); + console.log('i18n_test_preferredlanguage_0120 ' + value); + expect(value).assertTrue(); + } + else{ + let value = I18n.addPreferredLanguage('en-Latn-US'); + console.log('i18n_test_preferredlanguage_0120 ' + value); + } + console.log('i18n_test_preferredlanguage_0120 ' + I18n.getPreferredLanguageList()); + }) + + /* * + * @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_0140 + * @tc.name test the removePreferredLanguage interface + * @tc.desc check the value of removePreferredLanguage method + */ + it('i18n_test_preferredlanguage_0140', 0, function () { + console.log('i18n_test_preferredlanguage_0140 ' + 'start'); + let list = I18n.getPreferredLanguageList(); + console.log('i18n_test_preferredlanguage_0140 ' + list); + expect(list.length).assertLarger(0); + if(list[1] == 'zh-Hans-CN'){ + let value = I18n.removePreferredLanguage(1); + console.log('i18n_test_preferredlanguage_0140 ' + value); + expect(value).assertTrue(); + } + console.log('i18n_test_preferredlanguage_0140 ' + I18n.getPreferredLanguageList()); + }) + /* * * @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_1000 * @tc.name test the getFirstPreferredLanguage interface @@ -131,6 +198,18 @@ describe('LangTest', function () { } }) + /* * + * @tc.number SUB_GLOBAL_I18N_JS_PREFERREDLANGUAGE_1100 + * @tc.name test the getAppPreferredLanguage interface + * @tc.desc check the value of getAppPreferredLanguage method + */ + it('i18n_test_preferredlanguage_1100', 0, function () { + console.log('i18n_test_preferredlanguage_1100 ' + 'start'); + let value = I18n.getAppPreferredLanguage(); + console.log('i18n_test_preferredlanguage_1100 ' + value); + expect(value).assertEqual('zh-Hans'); + }) + /* * * @tc.number SUB_GLOBAL_INTL_JS_TRANSFER_0100 * @tc.name transfer from lower to upper @@ -514,7 +593,7 @@ describe('LangTest', function () { */ it('dateorder_test_0100', 0, function () { console.log('dateorder_test_0100 ' + 'start'); - let value = I18n.Util.getDateOrder('zh'); + let value = I18n.I18NUtil.getDateOrder('zh'); console.log('dateorder_test_0100 ' + value); expect(value).assertEqual('y-L-d'); }) @@ -526,7 +605,7 @@ describe('LangTest', function () { */ it('dateorder_test_0200', 0, function () { console.log('dateorder_test_0200 ' + 'start'); - let value = I18n.Util.getDateOrder('en'); + let value = I18n.I18NUtil.getDateOrder('en'); console.log('dateorder_test_0200 ' + value); expect(value).assertEqual('LLL-d-y'); }) @@ -538,7 +617,7 @@ describe('LangTest', function () { */ it('dateorder_test_0300', 0, function () { console.log('dateorder_test_0300 ' + 'start'); - let value = I18n.Util.getDateOrder('th'); + let value = I18n.I18NUtil.getDateOrder('th'); console.log('dateorder_test_0300 ' + value); expect(value).assertEqual('d-LLL-y'); }) @@ -550,7 +629,7 @@ describe('LangTest', function () { */ it('dateorder_test_0400', 0, function () { console.log('dateorder_test_0400 ' + 'start'); - let value = I18n.Util.getDateOrder('jp'); + let value = I18n.I18NUtil.getDateOrder('jp'); console.log('dateorder_test_0400 ' + value); expect(value).assertEqual('LLL-d-y'); }) diff --git a/global/perf/perfjs/Test.json b/global/perf/perfjs/Test.json index bfbb43bdbcc773a65655ff9705ca8b1c91713808..bdeb6ad3cf638da87070638bb0b088e9679eab1c 100644 --- a/global/perf/perfjs/Test.json +++ b/global/perf/perfjs/Test.json @@ -3,6 +3,7 @@ "driver": { "type": "OHJSUnitTest", "test-timeout": "300000", + "testcase-timeout": "300000", "shell-timeout": "300000", "bundle-name": "ohos.perf.test", "package-name": "ohos.perf.test" diff --git a/global/perf/perfjs/src/main/config.json b/global/perf/perfjs/src/main/config.json index 09fd467b989a92c2c3834f34e91af53992a68528..a4efde6bcddc944f34028ce62bc9b6f4d1a88329 100644 --- a/global/perf/perfjs/src/main/config.json +++ b/global/perf/perfjs/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.perf.test", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/global/perf/perfjs/src/main/js/test/Perf.test.js b/global/perf/perfjs/src/main/js/test/Perf.test.js index 7cac3f8b262aefbe48c7408cdc6ad471ef56b927..3355d231fbac96e252a6e3189d95afce63225310 100644 --- a/global/perf/perfjs/src/main/js/test/Perf.test.js +++ b/global/perf/perfjs/src/main/js/test/Perf.test.js @@ -634,7 +634,7 @@ describe('PerfTest', function () { let value = 'test'; let startTime = new Date().getTime(); for(let i = 0; i < EXETIME; i++){ - value = I18n.Util.unitConvert({unit: 'hour', measureSystem: 'SI'}, + value = I18n.I18NUtil.unitConvert({unit: 'hour', measureSystem: 'SI'}, {unit: 'second', measureSystem: 'SI'}, 10, 'zh-CN', @@ -1068,7 +1068,7 @@ describe('PerfTest', function () { let value = false; let startTime = new Date().getTime(); for(let i = 0; i < EXETIME; i++){ - value = I18n.Character.isDigit('abc'); + value = I18n.Unicode.isDigit('abc'); } let exeTime = new Date().getTime() - startTime; let avgTime = exeTime/EXETIME; @@ -1094,7 +1094,7 @@ describe('PerfTest', function () { let value = false; let startTime = new Date().getTime(); for(let i = 0; i < EXETIME; i++){ - value = I18n.Character.isSpaceChar('abc'); + value = I18n.Unicode.isSpaceChar('abc'); } let exeTime = new Date().getTime() - startTime; let avgTime = exeTime/EXETIME; @@ -1121,7 +1121,7 @@ describe('PerfTest', function () { let value = false; let startTime = new Date().getTime(); for(let i = 0; i < EXETIME; i++){ - value = I18n.Character.isWhitespace('abc'); + value = I18n.Unicode.isWhitespace('abc'); } let exeTime = new Date().getTime() - startTime; let avgTime = exeTime/EXETIME; @@ -1147,7 +1147,7 @@ describe('PerfTest', function () { let value = false; let startTime = new Date().getTime(); for(let i = 0; i < EXETIME; i++){ - value = I18n.Character.isRTL('abc'); + value = I18n.Unicode.isRTL('abc'); } let exeTime = new Date().getTime() - startTime; let avgTime = exeTime/EXETIME; @@ -1173,7 +1173,7 @@ describe('PerfTest', function () { let value = false; let startTime = new Date().getTime(); for(let i = 0; i < EXETIME; i++){ - value = I18n.Character.isIdeograph('abc'); + value = I18n.Unicode.isIdeograph('abc'); } let exeTime = new Date().getTime() - startTime; let avgTime = exeTime/EXETIME; @@ -1199,7 +1199,7 @@ describe('PerfTest', function () { let value = false; let startTime = new Date().getTime(); for(let i = 0; i < EXETIME; i++){ - value = I18n.Character.isLetter('abc'); + value = I18n.Unicode.isLetter('abc'); } let exeTime = new Date().getTime() - startTime; let avgTime = exeTime/EXETIME; @@ -1225,7 +1225,7 @@ describe('PerfTest', function () { let value = false; let startTime = new Date().getTime(); for(let i = 0; i < EXETIME; i++){ - value = I18n.Character.isLowerCase('abc'); + value = I18n.Unicode.isLowerCase('abc'); } let exeTime = new Date().getTime() - startTime; let avgTime = exeTime/EXETIME; @@ -1251,7 +1251,7 @@ describe('PerfTest', function () { let value = false; let startTime = new Date().getTime(); for(let i = 0; i < EXETIME; i++){ - value = I18n.Character.isUpperCase('ABC'); + value = I18n.Unicode.isUpperCase('ABC'); } let exeTime = new Date().getTime() - startTime; let avgTime = exeTime/EXETIME; @@ -1277,7 +1277,7 @@ describe('PerfTest', function () { let value = 'test'; let startTime = new Date().getTime(); for(let i = 0; i < EXETIME; i++){ - value = I18n.Character.getType('a'); + value = I18n.Unicode.getType('a'); } let exeTime = new Date().getTime() - startTime; let avgTime = exeTime/EXETIME; @@ -2101,7 +2101,7 @@ describe('PerfTest', function () { let value = 'test'; let startTime = new Date().getTime(); for(let i = 0; i < EXETIME; i++){ - value = I18n.Util.getDateOrder('zh'); + value = I18n.I18NUtil.getDateOrder('zh'); } let exeTime = new Date().getTime() - startTime; let avgTime = exeTime/EXETIME; diff --git a/global/resmgr_standard/resmgrjs/Test.json b/global/resmgr_standard/resmgrjs/Test.json index 9e7e245ca36563bf840b46c20882a871d7ff38fb..f758b259aee5f26974df345b14c1db9ccd96b43f 100644 --- a/global/resmgr_standard/resmgrjs/Test.json +++ b/global/resmgr_standard/resmgrjs/Test.json @@ -3,6 +3,7 @@ "driver": { "type": "OHJSUnitTest", "test-timeout": "300000", + "testcase-timeout": "300000", "shell-timeout": "60000", "bundle-name": "ohos.resmgr.test", "package-name": "ohos.resmgr.test" diff --git a/global/resmgr_standard/resmgrjs/src/main/config.json b/global/resmgr_standard/resmgrjs/src/main/config.json index 6a9a32e8f4240336f9e9c9d056848968320bfda5..fc50b22f5fa244bf8e49e22bde30a5ba1a704f2f 100644 --- a/global/resmgr_standard/resmgrjs/src/main/config.json +++ b/global/resmgr_standard/resmgrjs/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.resmgr.test", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/graphic/BUILD.gn b/graphic/BUILD.gn index a3ffe2dae02f3920fae0081a5bc867a8da131a48..5df7e3274a210b82ef1b3c10617ac5e3b075ceb8 100755 --- a/graphic/BUILD.gn +++ b/graphic/BUILD.gn @@ -17,7 +17,9 @@ group("graphic") { if (is_standard_system) { deps = [ "effectKit:EffectKitTest", + "graphicColorSpace:ActsColorSpaceManagerTest", "graphicnapidrawingtest:ActsGraphicNapiDrawingTest", + "graphicnapitest:ActsGraphicNapiTest", "webGL:webGL_hap_test", "windowStage:ActsWindowStageTest", "windowstandard:window_hap_test", diff --git a/graphic/effectKit/entry/src/main/module.json b/graphic/effectKit/entry/src/main/module.json index 2f75303710fc9915a694392337254ae6fdbc266d..20eee391852fdc45f8a5aeaee8faba1ae3016b1d 100644 --- a/graphic/effectKit/entry/src/main/module.json +++ b/graphic/effectKit/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/graphic/graphicColorSpace/AppScope/app.json b/graphic/graphicColorSpace/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..2c223fed485d736ab9906abf778f3d48eeb6c7cf --- /dev/null +++ b/graphic/graphicColorSpace/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app": { + "bundleName": "com.example.myapplication", + "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/graphic/graphicColorSpace/AppScope/resources/base/element/string.json b/graphic/graphicColorSpace/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ee69f9a861d9dc269ed6638735d52674583498e1 --- /dev/null +++ b/graphic/graphicColorSpace/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/graphic/graphicColorSpace/AppScope/resources/base/media/app_icon.png b/graphic/graphicColorSpace/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/graphic/graphicColorSpace/AppScope/resources/base/media/app_icon.png differ diff --git a/graphic/graphicColorSpace/BUILD.gn b/graphic/graphicColorSpace/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c7e1cc2b8278be2d45a65927953455730841f66a --- /dev/null +++ b/graphic/graphicColorSpace/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("ActsColorSpaceManagerTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":graphicColorSpace_js_assets", + ":graphicColorSpace_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsColorSpaceManagerTest" +} + +ohos_app_scope("graphicColorSpace_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("graphicColorSpace_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("graphicColorSpace_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":graphicColorSpace_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/graphic/graphicColorSpace/Test.json b/graphic/graphicColorSpace/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..3f5b791cf8b0bd562f0e60d1d1fe0df1b7509398 --- /dev/null +++ b/graphic/graphicColorSpace/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "180000", + "bundle-name": "com.example.myapplication", + "module-name": "phone", + "shell-timeout": "600000", + "testcase-timeout": 70000 + }, + "kits": [{ + "test-file-name": [ + "ActsColorSpaceManagerTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }] +} \ No newline at end of file diff --git a/graphic/graphicColorSpace/entry/src/main/ets/Application/AbilityStage.ts b/graphic/graphicColorSpace/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..e3fdadfebeeeb676df2ce8f78f4b59e26fae9cf0 --- /dev/null +++ b/graphic/graphicColorSpace/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/graphic/graphicColorSpace/entry/src/main/ets/MainAbility/MainAbility.ts b/graphic/graphicColorSpace/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..c3b2b245c4356ac17dd34e3ac70a144703cecfaa --- /dev/null +++ b/graphic/graphicColorSpace/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/index/index", 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") + } +}; \ No newline at end of file diff --git a/graphic/graphicColorSpace/entry/src/main/ets/MainAbility/pages/index/index.ets b/graphic/graphicColorSpace/entry/src/main/ets/MainAbility/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..97504e2440a9a6110fd5c9c02985914ef8d9e655 --- /dev/null +++ b/graphic/graphicColorSpace/entry/src/main/ets/MainAbility/pages/index/index.ets @@ -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 router from '@ohos.router'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../../../test/List.test' + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/graphic/graphicColorSpace/entry/src/main/ets/TestAbility/TestAbility.ts b/graphic/graphicColorSpace/entry/src/main/ets/TestAbility/TestAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..89a84730505783ba229175ab4b55d37f91a16266 --- /dev/null +++ b/graphic/graphicColorSpace/entry/src/main/ets/TestAbility/TestAbility.ts @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + console.log('TestAbility onCreate') + } + + onDestroy() { + console.log('TestAbility onDestroy') + } + + onWindowStageCreate(windowStage) { + console.log('TestAbility onWindowStageCreate') + windowStage.loadContent("TestAbility/pages/index", (err, data) => { + if (err.code) { + console.error('Failed to load the content. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in loading the content. Data: ' + JSON.stringify(data)) + }); + + globalThis.abilityContext = this.context; + } + + onWindowStageDestroy() { + console.log('TestAbility onWindowStageDestroy') + } + + onForeground() { + console.log('TestAbility onForeground') + } + + onBackground() { + console.log('TestAbility onBackground') + } +}; \ No newline at end of file diff --git a/graphic/graphicColorSpace/entry/src/main/ets/TestAbility/pages/index.ets b/graphic/graphicColorSpace/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b93567f962921124b282f78c8ef123965d1460c9 --- /dev/null +++ b/graphic/graphicColorSpace/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,48 @@ +/* + * 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 router from '@ohos.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('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/graphic/graphicColorSpace/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/graphic/graphicColorSpace/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..a4ee2f1652b3d04ce83ece64ef70f8dfa62a2dc8 --- /dev/null +++ b/graphic/graphicColorSpace/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/graphic/graphicColorSpace/entry/src/main/ets/test/List.test.ets b/graphic/graphicColorSpace/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..58410a34ad2f2626b575754a90a5f5aa8d6755dc --- /dev/null +++ b/graphic/graphicColorSpace/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 colorSpaceManagerTest from './colorSpaceManager.test' + +export default function testsuite(context, windowStage, abilityStorage) { + colorSpaceManagerTest(context, windowStage, abilityStorage) +} diff --git a/graphic/graphicColorSpace/entry/src/main/ets/test/colorSpaceManager.test.ets b/graphic/graphicColorSpace/entry/src/main/ets/test/colorSpaceManager.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..432f059d8d630642584a7e4a4bcd970267bb4469 --- /dev/null +++ b/graphic/graphicColorSpace/entry/src/main/ets/test/colorSpaceManager.test.ets @@ -0,0 +1,222 @@ +/* + * 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, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index" +import colorSpaceManager from '@ohos.graphics.colorSpaceManager'; + +export default function colorSpaceManagerTest(context, windowStage, abilityStorage) { + describe('colorSpaceManagerTest', function () { + console.info('describe colorSpaceManagerTest start!!!'); + beforeAll(function () { + console.info('before all'); + }) + beforeEach(function () { + console.info('before each'); + }) + afterEach(async function (done) { + console.info('afterEach'); + done(); + }) + afterAll(function () { + console.info('afterAll'); + }) + + /** + * @tc.number SUB_GRAPHIC_ENUMCOLORSPACE_JSAPI_001 + * @tc.name Test enumcolorspace_Test_001 + * @tc.desc test the value of enum color space + */ + it('SUB_GRAPHIC_ENUMCOLORSPACE_JSAPI_001', 0, async function (done) { + console.info('test the enum value of ColorSpace Manager begin'); + try { + expect(0).assertEqual(colorSpaceManager.ColorSpace.UNKNOWN); + expect(1).assertEqual(colorSpaceManager.ColorSpace.ADOBE_RGB_1998); + expect(2).assertEqual(colorSpaceManager.ColorSpace.DCI_P3); + expect(3).assertEqual(colorSpaceManager.ColorSpace.DISPLAY_P3); + expect(4).assertEqual(colorSpaceManager.ColorSpace.SRGB); + expect(5).assertEqual(colorSpaceManager.ColorSpace.CUSTOM); + done(); + } catch (err) { + console.info('test enum value of ColorSpace Manager error ' + JSON.stringify(err)); + expect.assertFail(); + done(); + } + }) + + /** + * @tc.number SUB_GRAPHIC_CREATE_JSAPI_002 + * @tc.name Test createcolorspacemanager_Test_002 + * @tc.desc test the interface of create + */ + it('SUB_GRAPHIC_CREATE_JSAPI_002', 0, async function (done) { + console.info('test createcolorspacemanager begin'); + try { + var csManager = colorSpaceManager.create(colorSpaceManager.ColorSpace.ADOBE_RGB_1998); + expect(csManager!= null).assertTrue(); + var colorSpaceName = csManager.getColorSpaceName(); + console.info("the name is " + colorSpaceName); + expect(colorSpaceName).assertEqual(colorSpaceManager.ColorSpace.ADOBE_RGB_1998); + done(); + } catch (err) { + console.log('test enum value of ColorSpace Manager error ' + JSON.stringify(err)); + expect.assertFail(); + done(); + } + }) + + /** + * @tc.number SUB_GRAPHIC_CREATE_JSAPI_003 + * @tc.name Test createcolorspacemanager_Test_003 + * @tc.desc test the interface of create + */ + it('SUB_GRAPHIC_CREATE_JSAPI_003', 0, async function (done) { + console.info('test createcolorspacemanager begin'); + try { + var csManager = colorSpaceManager.create(colorSpaceManager.ColorSpace.UNKNOWN); + expect(csManager!= null).assertTrue(); + var colorSpaceName = csManager.getColorSpaceName(); + console.info("the name is " + colorSpaceName); + expect(colorSpaceName).assertEqual(colorSpaceManager.ColorSpace.UNKNOWN); + done(); + } catch (err) { + console.log('test enum value of ColorSpace Manager error ' + JSON.stringify(err)); + expect.assertFail(); + done(); + } + }) + + /** + * @tc.number SUB_GRAPHIC_CREATE_JSAPI_004 + * @tc.name Test createcolorspacemanager_Test_004 + * @tc.desc test the interface of create + */ + it('SUB_GRAPHIC_CREATE_JSAPI_004', 0, async function (done) { + console.info('test createcolorspacemanager begin'); + try { + var csManager = colorSpaceManager.create(colorSpaceManager.ColorSpace.DCI_P3); + expect(csManager!= null).assertTrue(); + var colorSpaceName = csManager.getColorSpaceName(); + console.info("the name is " + colorSpaceName); + expect(colorSpaceName).assertEqual(colorSpaceManager.ColorSpace.DCI_P3); + done(); + } catch (err) { + console.log('test enum value of ColorSpace Manager error ' + JSON.stringify(err)); + expect.assertFail(); + done(); + } + }) + + /** + * @tc.number SUB_GRAPHIC_CREATE_JSAPI_005 + * @tc.name Test createcolorspacemanager_Test_005 + * @tc.desc test the interface of create + */ + it('SUB_GRAPHIC_CREATE_JSAPI_005', 0, async function (done) { + console.info('test createcolorspacemanager begin'); + try { + var csManager = colorSpaceManager.create(colorSpaceManager.ColorSpace.DISPLAY_P3); + expect(csManager!= null).assertTrue(); + var colorSpaceName = csManager.getColorSpaceName(); + console.info("the name is " + colorSpaceName); + expect(colorSpaceName).assertEqual(colorSpaceManager.ColorSpace.DISPLAY_P3); + done(); + } catch (err) { + console.log('test enum value of ColorSpace Manager error ' + JSON.stringify(err)); + expect.assertFail(); + done(); + } + }) + + /** + * @tc.number SUB_GRAPHIC_CREATE_JSAPI_006 + * @tc.name Test createcolorspacemanager_Test_006 + * @tc.desc test the interface of create + */ + it('SUB_GRAPHIC_CREATE_JSAPI_006', 0, async function (done) { + console.info('test createcolorspacemanager begin'); + try { + var csManager = colorSpaceManager.create(colorSpaceManager.ColorSpace.SRGB); + expect(csManager!= null).assertTrue(); + var colorSpaceName = csManager.getColorSpaceName(); + console.info("the name is " + colorSpaceName); + expect(colorSpaceName).assertEqual(colorSpaceManager.ColorSpace.SRGB); + done(); + } catch (err) { + console.log('test enum value of ColorSpace Manager error ' + JSON.stringify(err)); + expect.assertFail(); + done(); + } + }) + + /** + * @tc.number SUB_GRAPHIC_CREATE_JSAPI_007 + * @tc.name Test createcolorspacemanager_Test_007 + * @tc.desc test the interface of create colorSpaceManager.ColorSpace.CUSTOM invalid + */ + it('SUB_GRAPHIC_CREATE_JSAPI_007', 0, async function (done) { + console.info('test createcolorspacemanager begin'); + try { + var csManager = colorSpaceManager.create(colorSpaceManager.ColorSpace.CUSTOM); + expect(csManager != null).assertTrue(); + var colorSpaceName = csManager.getColorSpaceName(); + console.info("the name is " + colorSpaceName); + expect(colorSpaceName).assertEqual(colorSpaceManager.ColorSpace.UNKNOWN); + done(); + } catch (err) { + console.log('test enum value of ColorSpace Manager error ' + JSON.stringify(err)); + expect.assertFail(); + done(); + } + }) + + + /** + * @tc.number SUB_GRAPHIC_CREATE_JSAPI_008 + * @tc.name Test createcolorspacemanager_Test_008 + * @tc.desc test the interface of create + */ + it('SUB_GRAPHIC_CREATE_JSAPI_008', 0, async function (done) { + console.info('test createcolorspacemanager08 begin'); + try { + let primaries:colorSpaceManager.ColorSpacePrimaries = { + redX: 0.64, + redY: 0.33, + greenX: 0.3, + greenY: 0.6, + blueX: 0.15, + blueY: 0.06, + whitePointX: 0.3127, + whitePointY: 0.3290 + }; + var gamma = 2.875; + var colorSpaceMgr = colorSpaceManager.create(primaries, gamma); + expect(colorSpaceMgr!= null).assertTrue(); + var ga = colorSpaceMgr.getGamma(); + var gap = ga - gamma; + var wp:number[] = colorSpaceMgr.getWhitePoint(); + expect(gap == 0).assertTrue(); + expect(Math.abs(primaries.whitePointX -wp[0] ) <= 0.00001).assertTrue(); + expect(Math.abs(primaries.whitePointY - wp[1] ) <= 0.00001).assertTrue(); + done(); + } catch (err) { + console.log('test enum value of ColorSpace Manager error ' + JSON.stringify(err)); + expect.assertFail(); + done(); + } + }) + + }) +} diff --git a/graphic/graphicColorSpace/entry/src/main/module.json b/graphic/graphicColorSpace/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..a60dde9399bc7a808166c745a86e7d0439d6b3e9 --- /dev/null +++ b/graphic/graphicColorSpace/entry/src/main/module.json @@ -0,0 +1,35 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "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" + ] + }] + }] + + } +} \ No newline at end of file diff --git a/graphic/graphicColorSpace/entry/src/main/resources/base/element/string.json b/graphic/graphicColorSpace/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2a61b2e5baa39d8f3b258d50598e365ee889fee5 --- /dev/null +++ b/graphic/graphicColorSpace/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": "ActsColorSpaceManagerTest" + }, + { + "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/graphic/graphicColorSpace/entry/src/main/resources/base/media/icon.png b/graphic/graphicColorSpace/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/graphic/graphicColorSpace/entry/src/main/resources/base/media/icon.png differ diff --git a/graphic/graphicColorSpace/entry/src/main/resources/base/profile/main_pages.json b/graphic/graphicColorSpace/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..ceb075cd80946aade673d707aac904fb8998bce9 --- /dev/null +++ b/graphic/graphicColorSpace/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "MainAbility/pages/index/index" + ] +} \ No newline at end of file diff --git a/graphic/graphicColorSpace/signature/openharmony_sx.p7b b/graphic/graphicColorSpace/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..7ffcdc78527c5c1aa24520ab7e913c5f47c703f0 Binary files /dev/null and b/graphic/graphicColorSpace/signature/openharmony_sx.p7b differ diff --git a/graphic/graphicnapidrawingtest/BUILD.gn b/graphic/graphicnapidrawingtest/BUILD.gn index d9aac4bb1963d62e3e66ff8bf7ab7ec83bc3a3a0..ae58a6814ea41e35f4bf8d7a117c09f68cbd62cd 100644 --- a/graphic/graphicnapidrawingtest/BUILD.gn +++ b/graphic/graphicnapidrawingtest/BUILD.gn @@ -45,9 +45,9 @@ ohos_moduletest_suite("ActsGraphicNapiDrawingTest") { "//third_party/googletest/googletest/include", ] + external_deps = [ "c_utils:utils" ] deps = [ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", - "//commonlibrary/c_utils/base:utils", "//foundation/graphic/graphic_2d/rosen/modules/2d_graphics:2d_graphics", "//third_party/googletest:gtest_main", ] diff --git a/graphic/graphicnapitest/BUILD.gn b/graphic/graphicnapitest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..b017c3ea6c3427924858e0f67b64d60a6d6fbc7f --- /dev/null +++ b/graphic/graphicnapitest/BUILD.gn @@ -0,0 +1,65 @@ +# Copyright (C) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +module_output_path = "hit/ActsGraphicNapiTest" + +############################################################################### + +ohos_moduletest_suite("ActsGraphicNapiTest") { + module_out_path = module_output_path + subsystem_name = "graphic" + part_name = "graphic_standard" + + sources = [ + "NativeBufferTest.cpp", + "NativeImageTest.cpp", + "NativeVsyncTest.cpp", + ] + + cflags = [ + "-Wall", + "-Werror", + "-g3", + "-Dprivate=public", + "-Dprotected=public", + ] + + include_dirs = [ + "//foundation/graphic/graphic_2d/interfaces/inner_api/common", + "//foundation/graphic/graphic_2d/rosen/modules/composer/vsync/include", + "//foundation/graphic/graphic_2d/frameworks/surface/include", + "//foundation/communication/ipc/interfaces/innerkits/ipc_core/include", + "//drivers/peripheral/display/interfaces/include", + "//base/security/access_token/interfaces/innerkits/nativetoken/include", + "//base/security/access_token/interfaces/innerkits/accesstoken/include", + "//base/security/access_token/interfaces/innerkits/token_setproc/include", + ] + + deps = [ + "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", + "//base/security/access_token/interfaces/innerkits/accesstoken:libaccesstoken_sdk", + "//base/security/access_token/interfaces/innerkits/nativetoken:libnativetoken", + "//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc", + "//foundation/graphic/graphic_2d:libnative_image", + "//foundation/graphic/graphic_2d:libsurface", + "//foundation/graphic/graphic_2d/rosen/modules/composer/native_vsync:libnative_vsync", + "//foundation/graphic/graphic_2d/rosen/modules/composer/vsync:libvsync", + "//foundation/graphic/graphic_2d/utils:buffer_handle", + "//foundation/graphic/graphic_2d/utils:libgraphic_utils", + "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", + "//third_party/googletest:gmock_main", + "//third_party/googletest:gtest_main", + ] +} diff --git a/graphic/graphicnapitest/NativeBufferTest.cpp b/graphic/graphicnapitest/NativeBufferTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..655257182413596f73b59c517245900e49625463 --- /dev/null +++ b/graphic/graphicnapitest/NativeBufferTest.cpp @@ -0,0 +1,230 @@ +/* + * 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 "surface_type.h" +#include "graphic_common_c.h" + +using namespace testing; +using namespace testing::ext; + +namespace OHOS::Rosen { +class NativeBufferTest : public testing::Test { +public: + static void SetUpTestCase(); + static void TearDownTestCase(); + + static inline OH_NativeBuffer_Config config = { + .width = 0x100, + .height = 0x100, + .format = PIXEL_FMT_RGBA_8888, + .usage = BUFFER_USAGE_CPU_READ | BUFFER_USAGE_CPU_WRITE | BUFFER_USAGE_MEM_DMA, + }; + static inline OH_NativeBuffer_Config checkConfig = {}; + static inline OH_NativeBuffer* buffer = nullptr; +}; + +void NativeBufferTest::SetUpTestCase() +{ + buffer = nullptr; +} + +void NativeBufferTest::TearDownTestCase() +{ + buffer = nullptr; +} + +/* + * @tc.name OHNativeBufferAlloc001 + * @tc.desc test for call OH_NativeBuffer_Alloc by abnormal input and check ret + * @tc.type FUNC + */ +HWTEST_F(NativeBufferTest, OHNativeBufferAlloc001, Function | MediumTest | Level2) +{ + buffer = OH_NativeBuffer_Alloc(nullptr); + ASSERT_EQ(buffer, nullptr); +} + +/* + * @tc.name OHNativeBufferAlloc002 + * @tc.desc test for call OH_NativeBuffer_Alloc and check ret + * @tc.type FUNC + */ +HWTEST_F(NativeBufferTest, OHNativeBufferAlloc002, Function | MediumTest | Level2) +{ + buffer = OH_NativeBuffer_Alloc(&config); + ASSERT_NE(buffer, nullptr); +} + +/* + * @tc.name OHNativeBufferGetSeqNum001 + * @tc.desc test for call OH_NativeBuffer_GetSeqNum by abnormal input and check ret + * @tc.type FUNC + */ +HWTEST_F(NativeBufferTest, OHNativeBufferGetSeqNum001, Function | MediumTest | Level2) +{ + uint32_t id = OH_NativeBuffer_GetSeqNum(nullptr); + ASSERT_EQ(id, GSERROR_INVALID_ARGUMENTS); +} + +/* + * @tc.name OHNativeBufferGetSeqNum002 + * @tc.desc test for call OH_NativeBuffer_GetSeqNum and check ret + * @tc.type FUNC + */ +HWTEST_F(NativeBufferTest, OHNativeBufferGetSeqNum002, Function | MediumTest | Level2) +{ + uint32_t id = OH_NativeBuffer_GetSeqNum(buffer); + ASSERT_NE(id, GSERROR_INVALID_ARGUMENTS); +} + +/* + * @tc.name OHNativeBufferGetConfig001 + * @tc.desc test for call OH_NativeBuffer_GetConfig and check ret + * @tc.type FUNC + */ +HWTEST_F(NativeBufferTest, OHNativeBufferGetConfig001, Function | MediumTest | Level2) +{ + OH_NativeBuffer_GetConfig(buffer, &checkConfig); + ASSERT_NE(&checkConfig, nullptr); +} + +/* + * @tc.name OHNativeBufferGetConfig002 + * @tc.desc test for call OH_NativeBuffer_GetConfig by abnormal input and check ret + * @tc.type FUNC + */ +HWTEST_F(NativeBufferTest, OHNativeBufferGetConfig002, Function | MediumTest | Level2) +{ + checkConfig.width = 0x0; + checkConfig.height = 0x0; + checkConfig.format = 0x0; + checkConfig.usage = 0x0; + OH_NativeBuffer_GetConfig(nullptr, &checkConfig); + ASSERT_EQ(checkConfig.width, 0x0); + ASSERT_EQ(checkConfig.height, 0x0); + ASSERT_EQ(checkConfig.format, 0x0); + ASSERT_EQ(checkConfig.usage, 0x0); +} + + +/* + * @tc.name OHNativeBufferReference001 + * @tc.desc test for call OH_NativeBuffer_Reference by abnormal input and check ret + * @tc.type FUNC + */ +HWTEST_F(NativeBufferTest, OHNativeBufferReference001, Function | MediumTest | Level2) +{ + int32_t ret = OH_NativeBuffer_Reference(nullptr); + ASSERT_NE(ret, GSERROR_OK); +} + +/* + * @tc.name OHNativeBufferReference002 + * @tc.desc test for call OH_NativeBuffer_Reference and check ret + * @tc.type FUNC + */ +HWTEST_F(NativeBufferTest, OHNativeBufferReference002, Function | MediumTest | Level2) +{ + int32_t ret = OH_NativeBuffer_Reference(buffer); + ASSERT_EQ(ret, GSERROR_OK); +} + +/* + * @tc.name OHNativeBufferUnreference001 + * @tc.desc test for call OH_NativeBuffer_Unreference by abnormal input and check ret + * @tc.type FUNC + */ +HWTEST_F(NativeBufferTest, OHNativeBufferUnreference001, Function | MediumTest | Level2) +{ + int32_t ret = OH_NativeBuffer_Unreference(nullptr); + ASSERT_NE(ret, GSERROR_OK); +} + +/* + * @tc.name OHNativeBufferUnreference002 + * @tc.desc test for call OH_NativeBuffer_Unreference and check ret + * @tc.type FUNC + */ +HWTEST_F(NativeBufferTest, OHNativeBufferUnreference002, Function | MediumTest | Level2) +{ + int32_t ret = OH_NativeBuffer_Unreference(buffer); + ASSERT_EQ(ret, GSERROR_OK); +} + +/* + * @tc.name OHNativeBufferGetSeqNum003 + * @tc.desc test for check OH_NativeBuffer_GetSeqNum + * @tc.type FUNC + */ +HWTEST_F(NativeBufferTest, OHNativeBufferGetSeqNum003, Function | MediumTest | Level2) +{ + uint32_t oldSeq = OH_NativeBuffer_GetSeqNum(buffer); + int32_t ret = OH_NativeBuffer_Unreference(buffer); + ASSERT_EQ(ret, GSERROR_OK); + buffer = OH_NativeBuffer_Alloc(&config); + ASSERT_EQ(oldSeq + 1, OH_NativeBuffer_GetSeqNum(buffer)); +} + +/* + * @tc.name OHNativeBufferMap001 + * @tc.desc test for call OH_NativeBuffer_Map by abnormal input and check ret + * @tc.type FUNC + */ +HWTEST_F(NativeBufferTest, OHNativeBufferMap001, Function | MediumTest | Level2) +{ + void *virAddr = nullptr; + int32_t ret = OH_NativeBuffer_Map(nullptr, &virAddr); + ASSERT_NE(ret, GSERROR_OK); +} + +/* + * @tc.name OHNativeBufferMap002 + * @tc.desc test for call OH_NativeBuffer_Map and check ret + * @tc.type FUNC + */ +HWTEST_F(NativeBufferTest, OHNativeBufferMap002, Function | MediumTest | Level2) +{ + void *virAddr = nullptr; + int32_t ret = OH_NativeBuffer_Map(buffer, &virAddr); + ASSERT_EQ(ret, GSERROR_OK); + ASSERT_NE(virAddr, nullptr); +} + +/* + * @tc.name OHNativeBufferUnmap001 + * @tc.desc test for call OH_NativeBuffer_Unmap by abnormal input and check ret + * @tc.type FUNC + */ +HWTEST_F(NativeBufferTest, OHNativeBufferUnmap001, Function | MediumTest | Level2) +{ + int32_t ret = OH_NativeBuffer_Unmap(nullptr); + ASSERT_NE(ret, GSERROR_OK); +} + +/* + * @tc.name OHNativeBufferUnmap001 + * @tc.desc test for call OH_NativeBuffer_Unmap + * @tc.type FUNC + */ +HWTEST_F(NativeBufferTest, OHNativeBufferUnmap002, Function | MediumTest | Level2) +{ + int32_t ret = OH_NativeBuffer_Unmap(buffer); + ASSERT_EQ(ret, GSERROR_OK); + ret = OH_NativeBuffer_Unreference(buffer); + ASSERT_EQ(ret, GSERROR_OK); +} +} \ No newline at end of file diff --git a/graphic/graphicnapitest/NativeImageTest.cpp b/graphic/graphicnapitest/NativeImageTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..83b2dfb0b13a214cf8f63965adc9912f61189535 --- /dev/null +++ b/graphic/graphicnapitest/NativeImageTest.cpp @@ -0,0 +1,499 @@ +/* + * 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 "graphic_common_c.h" +#include "surface_type.h" +#include "window.h" +#include "GLES/gl.h" +#include "buffer_log.h" + +using namespace testing; +using namespace testing::ext; +using namespace std; + +namespace OHOS::Rosen { +using GetPlatformDisplayExt = PFNEGLGETPLATFORMDISPLAYEXTPROC; +constexpr const char* EGL_EXT_PLATFORM_WAYLAND = "EGL_EXT_platform_wayland"; +constexpr const char* EGL_KHR_PLATFORM_WAYLAND = "EGL_KHR_platform_wayland"; +constexpr int32_t EGL_CONTEXT_CLIENT_VERSION_NUM = 2; +constexpr char CHARACTER_WHITESPACE = ' '; +constexpr const char* CHARACTER_STRING_WHITESPACE = " "; +constexpr const char* EGL_GET_PLATFORM_DISPLAY_EXT = "eglGetPlatformDisplayEXT"; + +struct TEST_IMAGE { + int a; + bool b; +}; + +static bool CheckEglExtension(const char* extensions, const char* extension) +{ + size_t extlen = strlen(extension); + const char* end = extensions + strlen(extensions); + + while (extensions < end) { + size_t n = 0; + /* Skip whitespaces, if any */ + if (*extensions == CHARACTER_WHITESPACE) { + extensions++; + continue; + } + n = strcspn(extensions, CHARACTER_STRING_WHITESPACE); + /* Compare strings */ + if (n == extlen && strncmp(extension, extensions, n) == 0) { + return true; /* Found */ + } + extensions += n; + } + /* Not found */ + return false; +} + +static EGLDisplay GetPlatformEglDisplay(EGLenum platform, void* native_display, const EGLint* attrib_list) +{ + static GetPlatformDisplayExt eglGetPlatformDisplayExt = NULL; + + if (!eglGetPlatformDisplayExt) { + const char* extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); + if (extensions && + (CheckEglExtension(extensions, EGL_EXT_PLATFORM_WAYLAND) || + CheckEglExtension(extensions, EGL_KHR_PLATFORM_WAYLAND))) { + eglGetPlatformDisplayExt = (GetPlatformDisplayExt)eglGetProcAddress(EGL_GET_PLATFORM_DISPLAY_EXT); + } + } + + if (eglGetPlatformDisplayExt) { + return eglGetPlatformDisplayExt(platform, native_display, attrib_list); + } + + return eglGetDisplay((EGLNativeDisplayType)native_display); +} + +class NativeImageTest : public testing::Test { +public: + static void SetUpTestCase(); + static void TearDownTestCase(); + + static void InitEglContext(); + static void Deinit(); + + static inline OH_NativeImage* image = nullptr; + static inline OHNativeWindow* nativeWindow = nullptr; + static inline GLuint textureId = 0; + static inline GLuint textureId2 = 0; + static inline EGLDisplay eglDisplay_ = EGL_NO_DISPLAY; + static inline EGLContext eglContext_ = EGL_NO_CONTEXT; + static inline EGLConfig config_;; +}; + +void NativeImageTest::SetUpTestCase() +{ + image = nullptr; + nativeWindow = nullptr; + glGenTextures(1, &textureId); + glGenTextures(1, &textureId2); +} + +void NativeImageTest::TearDownTestCase() +{ + image = nullptr; + nativeWindow = nullptr; + Deinit(); +} + +void NativeImageTest::InitEglContext() +{ + if (eglContext_ != EGL_NO_DISPLAY) { + return; + } + + BLOGI("Creating EGLContext!!!"); + eglDisplay_ = GetPlatformEglDisplay(EGL_PLATFORM_OHOS_KHR, EGL_DEFAULT_DISPLAY, NULL); + if (eglDisplay_ == EGL_NO_DISPLAY) { + BLOGW("Failed to create EGLDisplay gl errno : %{public}x", eglGetError()); + return; + } + + EGLint major, minor; + if (eglInitialize(eglDisplay_, &major, &minor) == EGL_FALSE) { + BLOGE("Failed to initialize EGLDisplay"); + return; + } + + if (eglBindAPI(EGL_OPENGL_ES_API) == EGL_FALSE) { + BLOGE("Failed to bind OpenGL ES API"); + return; + } + + unsigned int ret; + EGLint count; + EGLint config_attribs[] = { EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, + EGL_ALPHA_SIZE, 8, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT, EGL_NONE }; + + ret = eglChooseConfig(eglDisplay_, config_attribs, &config_, 1, &count); + if (!(ret && static_cast(count) >= 1)) { + BLOGE("Failed to eglChooseConfig"); + return; + } + + static const EGLint context_attribs[] = { EGL_CONTEXT_CLIENT_VERSION, EGL_CONTEXT_CLIENT_VERSION_NUM, EGL_NONE }; + + eglContext_ = eglCreateContext(eglDisplay_, config_, EGL_NO_CONTEXT, context_attribs); + if (eglContext_ == EGL_NO_CONTEXT) { + BLOGE("Failed to create egl context %{public}x", eglGetError()); + return; + } + + eglMakeCurrent(eglDisplay_, EGL_NO_SURFACE, EGL_NO_SURFACE, eglContext_); + + BLOGW("Create EGL context successfully, version %{public}d.%{public}d", major, minor); +} + +void NativeImageTest::Deinit() +{ + if (eglDisplay_ == EGL_NO_DISPLAY) { + return; + } + eglDestroyContext(eglDisplay_, eglContext_); + eglMakeCurrent(eglDisplay_, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglTerminate(eglDisplay_); + eglReleaseThread(); + + eglDisplay_ = EGL_NO_DISPLAY; + eglContext_ = EGL_NO_CONTEXT; +} + +/* + * @tc.name: OHNativeImageCreate001 + * @tc.desc: test for call OH_NativeImage_Create and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageCreate001, Function | MediumTest | Level1) +{ + image = OH_NativeImage_Create(textureId, GL_TEXTURE_2D); + ASSERT_NE(image, nullptr); +} + +/* + * @tc.name: OHNativeImageAcquireNativeWindow001 + * @tc.desc: test for call OH_NativeImage_AcquireNativeWindow by abnormal input and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageAcquireNativeWindow001, Function | MediumTest | Level2) +{ + nativeWindow = OH_NativeImage_AcquireNativeWindow(nullptr); + ASSERT_EQ(nativeWindow, nullptr); +} + +/* + * @tc.name: OHNativeImageAcquireNativeWindow001 + * @tc.desc: test for call OH_NativeImage_AcquireNativeWindow and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageAcquireNativeWindow002, Function | MediumTest | Level1) +{ + nativeWindow = OH_NativeImage_AcquireNativeWindow(image); + ASSERT_NE(nativeWindow, nullptr); +} + +/* + * @tc.name: OHNativeImageAttachContext001 + * @tc.desc: test for call OH_NativeImage_AttachContext by abnormal input and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageAttachContext001, Function | MediumTest | Level2) +{ + int32_t ret = OH_NativeImage_AttachContext(nullptr, textureId); + ASSERT_NE(ret, SURFACE_ERROR_OK); +} + +/* + * @tc.name: OHNativeImageDetachContext001 + * @tc.desc: test for call OHNativeImageDetachContext by abnormal input and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageDetachContext001, Function | MediumTest | Level2) +{ + int32_t ret = OH_NativeImage_DetachContext(nullptr); + ASSERT_NE(ret, SURFACE_ERROR_OK); +} + +/* + * @tc.name: OHNativeImageDetachContext002 + * @tc.desc: test for call OHNativeImageDetachContext and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageDetachContext002, Function | MediumTest | Level1) +{ + int32_t ret = OH_NativeImage_DetachContext(image); + ASSERT_EQ(ret, SURFACE_ERROR_INIT); +} + +/* + * @tc.name: OHNativeImageDetachContext003 + * @tc.desc: test for call OHNativeImageDetachContext and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageDetachContext003, Function | MediumTest | Level1) +{ + InitEglContext(); + int32_t ret = OH_NativeImage_DetachContext(image); + ASSERT_EQ(ret, SURFACE_ERROR_ERROR); +} + +/* + * @tc.name: OHNativeImageDetachContext003 + * @tc.desc: test for call OH_NativeImage_AttachContext and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageAttachContext002, Function | MediumTest | Level1) +{ + int32_t ret = OH_NativeImage_AttachContext(image, textureId); + ASSERT_EQ(ret, SURFACE_ERROR_OK); +} + +/* + * @tc.name: OHNativeImageUpdateSurfaceImage001 + * @tc.desc: test for call OH_NativeImage_UpdateSurfaceImage by abnormal input and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageUpdateSurfaceImage001, Function | MediumTest | Level2) +{ + int32_t ret = OH_NativeImage_UpdateSurfaceImage(nullptr); + ASSERT_NE(ret, SURFACE_ERROR_OK); +} + +/* + * @tc.name: OHNativeImageUpdateSurfaceImage002 + * @tc.desc: test for call OH_NativeImage_UpdateSurfaceImage and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageUpdateSurfaceImage002, Function | MediumTest | Level1) +{ + int32_t ret = OH_NativeImage_UpdateSurfaceImage(image); + ASSERT_NE(ret, SURFACE_ERROR_OK); +} + +/* + * @tc.name: OHNativeImageUpdateSurfaceImage003 + * @tc.desc: test for call OH_NativeImage_UpdateSurfaceImage. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageUpdateSurfaceImage003, Function | MediumTest | Level1) +{ + int code = SET_USAGE; + int32_t usage = BUFFER_USAGE_CPU_READ | BUFFER_USAGE_CPU_WRITE | BUFFER_USAGE_MEM_DMA; + int32_t ret = NativeWindowHandleOpt(nativeWindow, code, usage); + if (ret != GSERROR_OK) { + std::cout << "NativeWindowHandleOpt SET_USAGE faile" << std::endl; + } + code = SET_BUFFER_GEOMETRY; + int32_t width = 0x100; + int32_t height = 0x100; + ret = NativeWindowHandleOpt(nativeWindow, code, width, height); + if (ret != GSERROR_OK) { + std::cout << "NativeWindowHandleOpt SET_BUFFER_GEOMETRY failed" << std::endl; + } + code = SET_STRIDE; + int32_t stride = 0x8; + ret = NativeWindowHandleOpt(nativeWindow, code, stride); + if (ret != GSERROR_OK) { + std::cout << "NativeWindowHandleOpt SET_STRIDE failed" << std::endl; + } + code = SET_FORMAT; + int32_t format = PIXEL_FMT_RGBA_8888; + ret = NativeWindowHandleOpt(nativeWindow, code, format); + if (ret != GSERROR_OK) { + std::cout << "NativeWindowHandleOpt SET_FORMAT failed" << std::endl; + } + + NativeWindowBuffer* nativeWindowBuffer = nullptr; + int fenceFd = -1; + ret = OH_NativeWindow_NativeWindowRequestBuffer(nativeWindow, &nativeWindowBuffer, &fenceFd); + ASSERT_EQ(ret, GSERROR_OK); + + struct Region *region = new Region(); + struct Region::Rect *rect = new Region::Rect(); + rect->x = 0x100; + rect->y = 0x100; + rect->w = 0x100; + rect->h = 0x100; + region->rects = rect; + ret = OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow, nativeWindowBuffer, fenceFd, *region); + ASSERT_EQ(ret, GSERROR_OK); + delete region; + + ret = OH_NativeImage_UpdateSurfaceImage(image); + ASSERT_EQ(ret, SURFACE_ERROR_OK); +} + +/* + * @tc.name: OHNativeImageGetTimestamp001 + * @tc.desc: test for call OH_NativeImage_GetTimestamp by abnormal input and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageGetTimestamp001, Function | MediumTest | Level2) +{ + int64_t timeStamp = OH_NativeImage_GetTimestamp(nullptr); + ASSERT_EQ(timeStamp, SURFACE_ERROR_ERROR); +} + +/* + * @tc.name: OHNativeImageGetTimestamp002 + * @tc.desc: test for call OH_NativeImage_GetTimestamp and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageGetTimestamp002, Function | MediumTest | Level1) +{ + int64_t timeStamp = OH_NativeImage_GetTimestamp(image); + ASSERT_NE(timeStamp, SURFACE_ERROR_ERROR); +} + +/* + * @tc.name: OHNativeImageGetTransformMatrix001 + * @tc.desc: test for call OH_NativeImage_GetTransformMatrix by abnormal input and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageGetTransformMatrix001, Function | MediumTest | Level2) +{ + float matrix[16]; + int32_t ret = OH_NativeImage_GetTransformMatrix(nullptr, matrix); + ASSERT_NE(ret, SURFACE_ERROR_OK); +} + +/* + * @tc.name: OHNativeImageGetTransformMatrix002 + * @tc.desc: test for call OH_NativeImage_GetTransformMatrix and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageGetTransformMatrix002, Function | MediumTest | Level1) +{ + float matrix[16]; + int32_t ret = OH_NativeImage_GetTransformMatrix(image, matrix); + ASSERT_EQ(ret, SURFACE_ERROR_OK); +} + +/* + * @tc.name: OHNativeImageGetTransformMatrix003 + * @tc.desc: test for call OH_NativeImage_GetTransformMatrix with another texture and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageAttachContext003, Function | MediumTest | Level1) +{ + int32_t ret = OH_NativeImage_AttachContext(image, textureId2); + ASSERT_EQ(ret, SURFACE_ERROR_OK); +} + +/* + * @tc.name: OHNativeImageUpdateSurfaceImage004 + * @tc.desc: test for OH_NativeImage_UpdateSurfaceImage after the OPENGL ES texture changed and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageUpdateSurfaceImage004, Function | MediumTest | Level1) +{ + NativeWindowBuffer* nativeWindowBuffer = nullptr; + int fenceFd = -1; + int32_t ret = OH_NativeWindow_NativeWindowRequestBuffer(nativeWindow, &nativeWindowBuffer, &fenceFd); + ASSERT_EQ(ret, GSERROR_OK); + + struct Region *region = new Region(); + struct Region::Rect *rect = new Region::Rect(); + rect->x = 0x100; + rect->y = 0x100; + rect->w = 0x100; + rect->h = 0x100; + region->rects = rect; + ret = OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow, nativeWindowBuffer, fenceFd, *region); + ASSERT_EQ(ret, GSERROR_OK); + delete region; + + ret = OH_NativeImage_UpdateSurfaceImage(image); + ASSERT_EQ(ret, SURFACE_ERROR_OK); +} + +/* + * @tc.name: OHNativeImageDetachContext004 + * @tc.desc: test for call OH_NativeImage_DetachContext and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageDetachContext004, Function | MediumTest | Level1) +{ + int32_t ret = OH_NativeImage_DetachContext(image); + ASSERT_EQ(ret, SURFACE_ERROR_OK); +} + +/* + * @tc.name: OHNativeImageAttachContext004 + * @tc.desc: test for call OH_NativeImage_AttachContext after OH_NativeImage_DetachContext and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageAttachContext004, Function | MediumTest | Level1) +{ + int32_t ret = OH_NativeImage_AttachContext(image, textureId2); + ASSERT_EQ(ret, SURFACE_ERROR_OK); +} + +/* + * @tc.name: OHNativeImageUpdateSurfaceImage005 + * @tc.desc: test for OHNativeImageUpdateSurfaceImage again and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageUpdateSurfaceImage005, Function | MediumTest | Level1) +{ + NativeWindowBuffer* nativeWindowBuffer = nullptr; + int fenceFd = -1; + int32_t ret = OH_NativeWindow_NativeWindowRequestBuffer(nativeWindow, &nativeWindowBuffer, &fenceFd); + ASSERT_EQ(ret, GSERROR_OK); + + struct Region *region = new Region(); + struct Region::Rect *rect = new Region::Rect(); + rect->x = 0x100; + rect->y = 0x100; + rect->w = 0x100; + rect->h = 0x100; + region->rects = rect; + ret = OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow, nativeWindowBuffer, fenceFd, *region); + ASSERT_EQ(ret, GSERROR_OK); + delete region; + + ret = OH_NativeImage_UpdateSurfaceImage(image); + ASSERT_EQ(ret, SURFACE_ERROR_OK); +} + +/* + * @tc.name: OHNativeImageDestroy001 + * @tc.desc: test for call OH_NativeImage_Destroy by abnormal input and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageDestroy001, Function | MediumTest | Level2) +{ + OH_NativeImage_Destroy(nullptr); + ASSERT_NE(image, nullptr); +} + +/* + * @tc.name: OHNativeImageDestroy002 + * @tc.desc: test for call OH_NativeImage_Destroy and check ret. + * @tc.type: FUNC + */ +HWTEST_F(NativeImageTest, OHNativeImageDestroy002, Function | MediumTest | Level1) +{ + OH_NativeImage_Destroy(&image); + ASSERT_EQ(image, nullptr); +} +} \ No newline at end of file diff --git a/graphic/graphicnapitest/NativeVsyncTest.cpp b/graphic/graphicnapitest/NativeVsyncTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..92f22d562c62bcfdadb92dc7ed2d0a57bcc4c1c1 --- /dev/null +++ b/graphic/graphicnapitest/NativeVsyncTest.cpp @@ -0,0 +1,118 @@ +/* + * 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 "native_vsync.h" + +using namespace testing; +using namespace testing::ext; + +namespace OHOS { +namespace Rosen { +class NativeVsyncTest : public testing::Test { +public: + static void SetUpTestCase(); + static void TearDownTestCase(); + + static inline OH_NativeVSync* native_vsync = nullptr; +}; + +void NativeVsyncTest::SetUpTestCase() +{ +} + +void NativeVsyncTest::TearDownTestCase() +{ +} + +static void OnVSync(long long timestamp, void* data) +{ +} + +namespace { +/* + * @tc.name: OH_NativeVSync_Create001 + * @tc.desc: test for call OH_NativeVSync_Create by abnormal input and check ret + * @tc.type: FUNC + */ +HWTEST_F(NativeVsyncTest, OH_NativeVSync_Create001, Function | MediumTest | Level2) +{ + ASSERT_EQ(OH_NativeVSync_Create(nullptr, 0), nullptr); +} + +/* + * @tc.name: OH_NativeVSync_Create002 + * @tc.desc: test for call OH_NativeVSync_Create and check ret + * @tc.type: FUNC + */ +HWTEST_F(NativeVsyncTest, OH_NativeVSync_Create002, Function | MediumTest | Level2) +{ + char name[] = "test"; + native_vsync = OH_NativeVSync_Create(name, sizeof(name)); + ASSERT_NE(native_vsync, nullptr); +} + +/* + * @tc.name: OH_NativeVSync_RequestFrame001 + * @tc.desc: test for call OH_NativeVSync_RequestFrame by abnormal input and check ret + * @tc.type: FUNC + */ +HWTEST_F(NativeVsyncTest, OH_NativeVSync_RequestFrame001, Function | MediumTest | Level2) +{ + ASSERT_NE(OH_NativeVSync_RequestFrame(nullptr, nullptr, nullptr), 0); +} + +/* + * @tc.name: OH_NativeVSync_RequestFrame002 + * @tc.desc: test for call OH_NativeVSync_RequestFrame by abnormal input and check ret + * @tc.type: FUNC + */ +HWTEST_F(NativeVsyncTest, OH_NativeVSync_RequestFrame002, Function | MediumTest | Level2) +{ + ASSERT_NE(OH_NativeVSync_RequestFrame(native_vsync, nullptr, nullptr), 0); +} + +/* + * @tc.name: OH_NativeVSync_RequestFrame003 + * @tc.desc: test for call OH_NativeVSync_RequestFrame and check ret + * @tc.type: FUNC + */ +HWTEST_F(NativeVsyncTest, OH_NativeVSync_RequestFrame003, Function | MediumTest | Level2) +{ + OH_NativeVSync_FrameCallback callback = OnVSync; + ASSERT_EQ(OH_NativeVSync_RequestFrame(native_vsync, callback, nullptr), 0); +} + +/* + * @tc.name: OH_NativeVSync_Destroy001 + * @tc.desc: test for call OH_NativeVSync_Destroy by abnormal input and check ret + * @tc.type: FUNC + */ +HWTEST_F(NativeVsyncTest, OH_NativeVSync_Destroy001, Function | MediumTest | Level2) +{ + OH_NativeVSync_Destroy(nullptr); +} + +/* + * @tc.name: OH_NativeVSync_Destroy002 + * @tc.desc: test for call OH_NativeVSync_Destroy and check ret + * @tc.type: FUNC + */ +HWTEST_F(NativeVsyncTest, OH_NativeVSync_Destroy002, Function | MediumTest | Level2) +{ + OH_NativeVSync_Destroy(native_vsync); +} +} // namespace +} // namespace Rosen +} // namespace OHOS \ No newline at end of file diff --git a/graphic/graphicnapitest/Test.json b/graphic/graphicnapitest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4b4990e202c90acf50b990a7ded31d45636de5de --- /dev/null +++ b/graphic/graphicnapitest/Test.json @@ -0,0 +1,21 @@ +{ + "kits": [ + { + "push": [ + "ActsGraphicNapiTest->/data/local/tmp/ActsGraphicNapiTest" + ], + "type": "PushKit", + "post-push" : [ + "chmod -R 777 /data/local/tmp/*" + ] + } + ], + "driver": { + "native-test-timeout": "150000", + "type": "CppTest", + "module-name": "ActsGraphicNapiTest", + "runtime-hint": "1s", + "native-test-device-path": "/data/local/tmp" + }, + "description": "Configuration for ActsGraphicNapiTest Tests" +} \ No newline at end of file diff --git a/graphic/vkgl/src/deqpgles2/build0001/BUILD.gn b/graphic/vkgl/src/deqpgles2/build0001/BUILD.gn index dc2c22bb9a78776eab73b98c067821f50b1c8928..dd88300cebee9f44464cd54285fed6a7514b89dd 100644 --- a/graphic/vkgl/src/deqpgles2/build0001/BUILD.gn +++ b/graphic/vkgl/src/deqpgles2/build0001/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles2func0001") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles2/build0002/BUILD.gn b/graphic/vkgl/src/deqpgles2/build0002/BUILD.gn index 04b5f80518f39a4767fdf8a35308bb844b7eb8e0..6eec05f5359ecda39ca913b2b308b7615805ed25 100644 --- a/graphic/vkgl/src/deqpgles2/build0002/BUILD.gn +++ b/graphic/vkgl/src/deqpgles2/build0002/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles2func0002") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles2/build0003/BUILD.gn b/graphic/vkgl/src/deqpgles2/build0003/BUILD.gn index 8053a8887db6bb5747c906646fae83bdd01f4b04..167a9170304fae177ea6442ea675371384e3f26b 100644 --- a/graphic/vkgl/src/deqpgles2/build0003/BUILD.gn +++ b/graphic/vkgl/src/deqpgles2/build0003/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles2func0003") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles2/build0004/BUILD.gn b/graphic/vkgl/src/deqpgles2/build0004/BUILD.gn index 2c89b51b71036152bee2769f329e2788323f17de..0ba9baf009483291ed446e56b934ba43ca325abe 100644 --- a/graphic/vkgl/src/deqpgles2/build0004/BUILD.gn +++ b/graphic/vkgl/src/deqpgles2/build0004/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles2func0004") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles2/build0005/BUILD.gn b/graphic/vkgl/src/deqpgles2/build0005/BUILD.gn index 710c69b1b9656a07c949daa6d31f75d156d4a8de..419fc74ddfa4dce92c6d1fca0460c582833f9e58 100644 --- a/graphic/vkgl/src/deqpgles2/build0005/BUILD.gn +++ b/graphic/vkgl/src/deqpgles2/build0005/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles2func0005") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles2/build0006/BUILD.gn b/graphic/vkgl/src/deqpgles2/build0006/BUILD.gn index 45cd7268b80fb055bed991ab167e7cbdf2e02b47..1b4cd07e18ac98dd4b91a2ee04c06940fa2a6452 100644 --- a/graphic/vkgl/src/deqpgles2/build0006/BUILD.gn +++ b/graphic/vkgl/src/deqpgles2/build0006/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles2func0006") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles2/build0007/BUILD.gn b/graphic/vkgl/src/deqpgles2/build0007/BUILD.gn index fa5178112f6337f2698e1f41490b770b63efa312..d32d386e384b2103039b3f8adbab1cad47a78c68 100644 --- a/graphic/vkgl/src/deqpgles2/build0007/BUILD.gn +++ b/graphic/vkgl/src/deqpgles2/build0007/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles2func0007") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles2/build0008/BUILD.gn b/graphic/vkgl/src/deqpgles2/build0008/BUILD.gn index 2b53f3f2608d1ab69faa5e0fe1082a2807baca32..4ace6eebb06f65a254772564286856a409cc446f 100644 --- a/graphic/vkgl/src/deqpgles2/build0008/BUILD.gn +++ b/graphic/vkgl/src/deqpgles2/build0008/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles2func0008") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles2/build0009/BUILD.gn b/graphic/vkgl/src/deqpgles2/build0009/BUILD.gn index f214dc5745d6a597d49a7319892612d478dc43c5..19c981af3bad2d2dec4951c0d1234ac290e9068a 100644 --- a/graphic/vkgl/src/deqpgles2/build0009/BUILD.gn +++ b/graphic/vkgl/src/deqpgles2/build0009/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles2func0009") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles2/build0010/BUILD.gn b/graphic/vkgl/src/deqpgles2/build0010/BUILD.gn index fb1c5152227c8691a15dc2e5f7c11f3b4fcfdbd5..562c15337cefd4a77bf087f3b5e41cb582c7f42d 100644 --- a/graphic/vkgl/src/deqpgles2/build0010/BUILD.gn +++ b/graphic/vkgl/src/deqpgles2/build0010/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles2func0010") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles2/build0011/BUILD.gn b/graphic/vkgl/src/deqpgles2/build0011/BUILD.gn index c80890ad44aa536d17f44f4d4ba88fcc10932904..d0aef446b333f09cffcb2b4c2fa53536f2464e48 100644 --- a/graphic/vkgl/src/deqpgles2/build0011/BUILD.gn +++ b/graphic/vkgl/src/deqpgles2/build0011/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles2func0011") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles2/build0012/BUILD.gn b/graphic/vkgl/src/deqpgles2/build0012/BUILD.gn index 03aab67dd5498b7fc299c4587f301636eb9a5a0f..6feb5486f261360070dfb15af9ff3febc4ecede7 100644 --- a/graphic/vkgl/src/deqpgles2/build0012/BUILD.gn +++ b/graphic/vkgl/src/deqpgles2/build0012/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles2func0012") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles2/build0013/BUILD.gn b/graphic/vkgl/src/deqpgles2/build0013/BUILD.gn index b069a779b6b9a685ac79a00177f678069f82da3d..d5d17de721178557aabbaf16a69d9d8ffc8a4807 100644 --- a/graphic/vkgl/src/deqpgles2/build0013/BUILD.gn +++ b/graphic/vkgl/src/deqpgles2/build0013/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles2func0013") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles2/build0014/BUILD.gn b/graphic/vkgl/src/deqpgles2/build0014/BUILD.gn index 6e531cd7edf1f6710b03de20cb1aef039e66b4df..bfdb3ba6fcae90d0b0b865eedf85bd6a9f84ade6 100644 --- a/graphic/vkgl/src/deqpgles2/build0014/BUILD.gn +++ b/graphic/vkgl/src/deqpgles2/build0014/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles2func0014") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles2/build0015/BUILD.gn b/graphic/vkgl/src/deqpgles2/build0015/BUILD.gn index e6e975dfe11e4a97a5893e6ad6d9867b0217a8c4..d13b5d6a1e9eba85438bf2e6834d61c0c8c2db83 100644 --- a/graphic/vkgl/src/deqpgles2/build0015/BUILD.gn +++ b/graphic/vkgl/src/deqpgles2/build0015/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles2func0015") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles2/build0016/BUILD.gn b/graphic/vkgl/src/deqpgles2/build0016/BUILD.gn index 8169c44bd1262316180be15c3d5f5cd8116d98de..e353748e3163a28ef56a0bcef4dc36b92a90dfd9 100644 --- a/graphic/vkgl/src/deqpgles2/build0016/BUILD.gn +++ b/graphic/vkgl/src/deqpgles2/build0016/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles2func0016") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles2/build0017/BUILD.gn b/graphic/vkgl/src/deqpgles2/build0017/BUILD.gn index aa2a38335732d5f895e292176d8b4150adfa2d57..2543b2ba4149986fd79816f5851ab34d67cfb0a4 100644 --- a/graphic/vkgl/src/deqpgles2/build0017/BUILD.gn +++ b/graphic/vkgl/src/deqpgles2/build0017/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles2func0017") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles2/functional/Deqpgles2negative_api_textureTestCase.cpp b/graphic/vkgl/src/deqpgles2/functional/Deqpgles2negative_api_textureTestCase.cpp index 9d7288f8821d8758a1a9da1b660fccfa7dfd8e0c..3bd2eec654151799c19f2b60313816eddfe3db29 100644 --- a/graphic/vkgl/src/deqpgles2/functional/Deqpgles2negative_api_textureTestCase.cpp +++ b/graphic/vkgl/src/deqpgles2/functional/Deqpgles2negative_api_textureTestCase.cpp @@ -149,7 +149,7 @@ static SHRINK_HWTEST_F(ActsDeqpgles20014TestSuite, TestCase_013759, static SHRINK_HWTEST_F(ActsDeqpgles20014TestSuite, TestCase_013760, "dEQP-GLES2.functional.negative_api.tex", - "ture.compressedteximage2d_invalid_size"); + "true.compressedteximage2d_invalid_size"); static SHRINK_HWTEST_F(ActsDeqpgles20014TestSuite, TestCase_013761, "dEQP-GLES2.functional.negative_api.t", diff --git a/graphic/vkgl/src/deqpgles3/build0001/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0001/BUILD.gn index 6cf6c4caad87bc2bf6c0b1ea58357bb6c3e73c81..702d9d584c7f82ed89d12df8051f0af5911882a2 100644 --- a/graphic/vkgl/src/deqpgles3/build0001/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0001/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0001") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0002/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0002/BUILD.gn index cc52799659c49fdbbe0ea7ea2002f1b6a38c4f70..ef8ea05f858b1e0c025f23bc5c0524bf350a97f9 100644 --- a/graphic/vkgl/src/deqpgles3/build0002/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0002/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0002") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0003/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0003/BUILD.gn index c61cfa11dbe9030d2ddbfa680cef9986698ae5c4..d6b5fafe9160cd99099f942d52fbe766c0b72d72 100644 --- a/graphic/vkgl/src/deqpgles3/build0003/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0003/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0003") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0004/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0004/BUILD.gn index 4331dc3921b326e3329ef68e3b6b960cdfe148e7..b37668dbe483f4c1429a26d48dc5ff66e16985a2 100644 --- a/graphic/vkgl/src/deqpgles3/build0004/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0004/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0004") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0005/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0005/BUILD.gn index 5269371045c5b8ea18cb34fef8177b972efe9000..03c89fcf240b5c3b912e4d1fe9915aed21e72786 100644 --- a/graphic/vkgl/src/deqpgles3/build0005/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0005/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0005") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0006/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0006/BUILD.gn index 0785454dc2cf4bb8c3087f09ffc73b0f4200e674..bed2b50544cf0c42a38007e35275f5e95fa39031 100644 --- a/graphic/vkgl/src/deqpgles3/build0006/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0006/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0006") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0007/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0007/BUILD.gn index 18ebef3ba6369ef52db02520e4ee390dd74cd7cb..cca335a91e5b4b3ab73dffcbaff5d4c50b994bf0 100644 --- a/graphic/vkgl/src/deqpgles3/build0007/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0007/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0007") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0008/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0008/BUILD.gn index 5eb71891a15dd40c61757e6c170487e520af4165..0068786d7e3c1a423379e5d37a190dbeb3f4cbfc 100644 --- a/graphic/vkgl/src/deqpgles3/build0008/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0008/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0008") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0009/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0009/BUILD.gn index f153b668f22bb7aab3b34f9d155d928fb213df34..785e7ac7c44bf21778f8a71c5ee774f80bf015bf 100644 --- a/graphic/vkgl/src/deqpgles3/build0009/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0009/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0009") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0010/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0010/BUILD.gn index 63791718f2621cae893bc8c71bd11fa76a69473b..13050b149afdb37c32422f58afb66cc1f44f32a9 100644 --- a/graphic/vkgl/src/deqpgles3/build0010/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0010/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0010") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0011/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0011/BUILD.gn index d94a19cf1e2f38c857ebb6bcfba43f26546816a6..4fb9d90d03e5d690dc2c98c2de7d145f96a3594e 100644 --- a/graphic/vkgl/src/deqpgles3/build0011/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0011/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0011") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0012/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0012/BUILD.gn index 12a352bd9c2620730c4936884e184200d884d351..a1e6675ae3ff0a01f8b84903269aef87a7cc3676 100644 --- a/graphic/vkgl/src/deqpgles3/build0012/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0012/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0012") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0013/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0013/BUILD.gn index 1424834078485ad73be0603e701ddc8d13707cb8..3bd822e0a81966afc9bf9b1f2bfe0b5da2f9d242 100644 --- a/graphic/vkgl/src/deqpgles3/build0013/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0013/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0013") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0014/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0014/BUILD.gn index 63793fb19001ad1173d8a002485c3cc2472755a6..47083c74aa58d6caab147929fe6d9ddb4de756af 100644 --- a/graphic/vkgl/src/deqpgles3/build0014/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0014/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0014") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0015/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0015/BUILD.gn index 8bef02e296aa6c5cb78a391487a0b4b315e75cc1..ab02662b154edb02bda35d38ab81266f89b75fbe 100644 --- a/graphic/vkgl/src/deqpgles3/build0015/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0015/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0015") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0016/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0016/BUILD.gn index 4c78f0a39293d001f1f517778a84faf281993653..f4884c782ac99122a36313ad42e529caaca514fa 100644 --- a/graphic/vkgl/src/deqpgles3/build0016/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0016/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0016") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0017/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0017/BUILD.gn index 9b1305a8ce32b24e375420e16878889d23d19221..82933855aeefcaec61dd0182e1072e7aee709c44 100644 --- a/graphic/vkgl/src/deqpgles3/build0017/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0017/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0017") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0018/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0018/BUILD.gn index 97e0e834128ec08b02fc28b00aaf3c3a54a07699..92d8683585459fe9c74cddbdba76cb031a62b385 100644 --- a/graphic/vkgl/src/deqpgles3/build0018/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0018/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0018") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0019/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0019/BUILD.gn index 9e4e92fc88d5acff1f7c78bb9f46e5ec7362eb07..98e2b6fa049d3cb2e6577b5bd341c2def59d18ce 100644 --- a/graphic/vkgl/src/deqpgles3/build0019/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0019/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0019") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0020/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0020/BUILD.gn index 4c89175ef75684b0d3276af7d5f144575c806e81..2ecf8048518e19b9a2818da260199eb0c4755da7 100644 --- a/graphic/vkgl/src/deqpgles3/build0020/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0020/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0020") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0021/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0021/BUILD.gn index d96ba49814d5bd0926d865f0ffe7df935848d79f..96bdcb25b7806343f12279b07839f7ebd4fee728 100644 --- a/graphic/vkgl/src/deqpgles3/build0021/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0021/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0021") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0022/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0022/BUILD.gn index 2de91d528d1f4e798c73caf29db4ae8765970879..fe48c91cad2977c158c10a48268ebfd41e26c503 100644 --- a/graphic/vkgl/src/deqpgles3/build0022/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0022/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0022") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0023/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0023/BUILD.gn index abbbe3a4a81c1be6bc2cd46cfe9fa7a83b4d6ebe..a63e96364951f2d3306a5f7b2d4b75337ae37141 100644 --- a/graphic/vkgl/src/deqpgles3/build0023/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0023/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0023") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0024/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0024/BUILD.gn index ac867820b92536ea178894c015345fa2a0b61ecf..6e41e682f858ab5cca8e1614cc63f24122f467e9 100644 --- a/graphic/vkgl/src/deqpgles3/build0024/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0024/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0024") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0025/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0025/BUILD.gn index 5e71f3e180919cc15c52103aedcd691e7c8eff1c..96fcca813db020456be222dfc1da5ebc7442454b 100644 --- a/graphic/vkgl/src/deqpgles3/build0025/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0025/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0025") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0026/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0026/BUILD.gn index 4f67953962f3be6970d8f8d3c056019e9c6e4714..42e2c8af8163608da225a4be64d3dba79a1b33f0 100644 --- a/graphic/vkgl/src/deqpgles3/build0026/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0026/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0026") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0027/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0027/BUILD.gn index a34d5f54ccd394b3d77a5a69c0c66328fc015f9d..0dd2add0950528a6d03df66648987027699f5608 100644 --- a/graphic/vkgl/src/deqpgles3/build0027/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0027/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0027") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0028/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0028/BUILD.gn index 0613a19beb0c99e162af9af157a943a44d5cc542..7a8f7090aec6d0e34e2d0d728c70815fa86a02e8 100644 --- a/graphic/vkgl/src/deqpgles3/build0028/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0028/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0028") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0029/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0029/BUILD.gn index be24e685dc0528a1b0aafc6d61c5f453cc009c86..ec21f593462f67eb17f8f7c24a16ebbb827a8f78 100644 --- a/graphic/vkgl/src/deqpgles3/build0029/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0029/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0029") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0030/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0030/BUILD.gn index 7e35139eb7a30beab11608b20985bcf70da46b75..3e50b60207b4ba4a5ff15ff1462b8145a634777c 100644 --- a/graphic/vkgl/src/deqpgles3/build0030/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0030/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0030") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0031/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0031/BUILD.gn index ec4dc16ff85cadc42a99ac633161e5db62940d33..c197594c637fd600d499b52ed797309c8f590e26 100644 --- a/graphic/vkgl/src/deqpgles3/build0031/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0031/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0031") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0032/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0032/BUILD.gn index 956495735f59b4ed3c00720f72ef1ef96586a418..f21c5a7111849e4e7d7a767a67942a7572bdac6e 100644 --- a/graphic/vkgl/src/deqpgles3/build0032/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0032/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0032") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0033/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0033/BUILD.gn index 8f29fddb627880a32a46c8aef59bcc2b5776c531..c064622912242c975b4f89ef09c1c5bada7794d4 100644 --- a/graphic/vkgl/src/deqpgles3/build0033/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0033/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0033") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0034/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0034/BUILD.gn index ec5233a8c915967e16ec4184dd58e41492802755..9b4fe3a10e50184ab57394d130da3d658bda0d0d 100644 --- a/graphic/vkgl/src/deqpgles3/build0034/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0034/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0034") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0035/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0035/BUILD.gn index b71845415a32cac4b1a5210b8a1e79a8dcb45dcc..a642d4fb99cb142dcb68df1a9e41b6878b90dd4d 100644 --- a/graphic/vkgl/src/deqpgles3/build0035/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0035/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0035") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0036/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0036/BUILD.gn index 88d45ff9c37c0abb85d081bbc13a07943f0fdf3d..f7d8cbab61525802ce4c9ef9c9969debf5f8f371 100644 --- a/graphic/vkgl/src/deqpgles3/build0036/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0036/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0036") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0037/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0037/BUILD.gn index 5a148a9a711a5079945fdb025fa5428b951d3a64..d550367517c6786dfb20a8a9ab231fd2f6e323bd 100644 --- a/graphic/vkgl/src/deqpgles3/build0037/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0037/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0037") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0038/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0038/BUILD.gn index 8be3e5cc464f2d278c2b6e4c219d3449a87e89af..27d9afdabb0fe1d6f8e18e27d6bdaae938f06430 100644 --- a/graphic/vkgl/src/deqpgles3/build0038/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0038/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0038") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0039/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0039/BUILD.gn index 0ae45299da2960ec45e5a4f7d32610afa307e28e..b5391eb4b170ef833eec1289dc8af502bdf5cc65 100644 --- a/graphic/vkgl/src/deqpgles3/build0039/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0039/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0039") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0040/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0040/BUILD.gn index c3d050af88315263d6e03ec6daa5a1a874e1324b..23a7e60470c828daf0b34d57749cd059f1edb126 100644 --- a/graphic/vkgl/src/deqpgles3/build0040/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0040/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0040") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0041/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0041/BUILD.gn index 910e91e098bd22f123951cbdd2f2d2184ab89dde..72899d0df41a3d781ca52701dd11058db5e137bd 100644 --- a/graphic/vkgl/src/deqpgles3/build0041/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0041/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0041") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0042/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0042/BUILD.gn index 354c8aa0d67f6c7376e8a609b39e7d77ea09af79..3796a37705edf21012a310595111a913a1f10a14 100644 --- a/graphic/vkgl/src/deqpgles3/build0042/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0042/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0042") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0043/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0043/BUILD.gn index bbfd1c330006877573a36948c0bb238a8e4b3f2a..59de01d2c9e3b789091c3dc917096d0313e2024f 100644 --- a/graphic/vkgl/src/deqpgles3/build0043/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0043/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0043") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0044/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0044/BUILD.gn index 7a7d944ef1a76aa5b7d475a8290f0456e22f2c47..08e22254361bf4c9c613e6cfe5ed4acaccde24cf 100644 --- a/graphic/vkgl/src/deqpgles3/build0044/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0044/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0044") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles3/build0045/BUILD.gn b/graphic/vkgl/src/deqpgles3/build0045/BUILD.gn index 25dea449c2ae0868f686c4e13a521856a52e5d88..433b3dffbc3e967a2b54b514b75beb8208dd8b46 100644 --- a/graphic/vkgl/src/deqpgles3/build0045/BUILD.gn +++ b/graphic/vkgl/src/deqpgles3/build0045/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles3func0045") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0001/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0001/BUILD.gn index 4e7a65251ac271996588a372a493983cd00eff51..f7cc9ebe5c64651c5415f95fbf2405eeed57507d 100644 --- a/graphic/vkgl/src/deqpgles31/build0001/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0001/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0001") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0002/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0002/BUILD.gn index 1de7eb96a924ccec1835a12fe1eeba1621e96789..f4dc3bc7cc323dc0acbe530621af443866406d8d 100644 --- a/graphic/vkgl/src/deqpgles31/build0002/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0002/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0002") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0003/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0003/BUILD.gn index ad760dd4753697ae736537d237e9e645defe0052..0c29046a7bf8fc2b48f775093f6d48e6b1118339 100644 --- a/graphic/vkgl/src/deqpgles31/build0003/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0003/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0003") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0004/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0004/BUILD.gn index 58eb87431a7e0278391a5dd2bca4d1020a94b23a..363844c00d9f6e61236eb389c9aba1b18d91f28f 100644 --- a/graphic/vkgl/src/deqpgles31/build0004/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0004/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0004") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0005/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0005/BUILD.gn index f977dfbf383b809d35f4962e282b426010e04ac8..03331a56a453904d280d252bd6d76a0995095ad9 100644 --- a/graphic/vkgl/src/deqpgles31/build0005/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0005/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0005") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0006/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0006/BUILD.gn index fb14fabe899aa1d269d32188df79705a826fa69f..7c72b41c9832bff594e0ba0fe16505dda60b2d63 100644 --- a/graphic/vkgl/src/deqpgles31/build0006/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0006/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0006") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0007/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0007/BUILD.gn index 7597017f105f3f8e6444a29f2cd12f177f9f77e4..eecf94998214626b4a942e88d32db12b5bcb2a27 100644 --- a/graphic/vkgl/src/deqpgles31/build0007/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0007/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0007") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0008/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0008/BUILD.gn index 045f60b1baa618bfaaed6e7b452ca9dac3f01e42..2d8815f19b1751121077fa95083886612a6f0acc 100644 --- a/graphic/vkgl/src/deqpgles31/build0008/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0008/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0008") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0009/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0009/BUILD.gn index 7e59998272946dd75bb66afe948020ee78890c50..f73df2d17351ab0b76ee9a275fb4ead6a5483aad 100644 --- a/graphic/vkgl/src/deqpgles31/build0009/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0009/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0009") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0010/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0010/BUILD.gn index 80ab81a0116fe8ae4054dabfe9396792a1145a48..3a657194d9fad1bf4bdb7a98983b3156a25b43c8 100644 --- a/graphic/vkgl/src/deqpgles31/build0010/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0010/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0010") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0011/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0011/BUILD.gn index ae468339e54d9370314b54b45bb988b781c530b9..ebcfdec4133471fc96bb00af173e997f75e3ced7 100644 --- a/graphic/vkgl/src/deqpgles31/build0011/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0011/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0011") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0012/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0012/BUILD.gn index 0b666e41d813dca8446d396072865837877b07fd..905c1b96ae831daa53fe0f52a6e0755df51b40b0 100644 --- a/graphic/vkgl/src/deqpgles31/build0012/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0012/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0012") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0013/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0013/BUILD.gn index b943d4056577e01765cae8a5349d638225ae43e6..69ebef9b0af8c43cce86d0891d436dade2965f40 100644 --- a/graphic/vkgl/src/deqpgles31/build0013/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0013/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0013") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0014/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0014/BUILD.gn index 830a3889b98ef43aa88a8d347627b9de9c83f550..f8c3612285f12a73ca78fc3d7ef386325b3c0d66 100644 --- a/graphic/vkgl/src/deqpgles31/build0014/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0014/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0014") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0015/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0015/BUILD.gn index fa202f089f1f5eda300d201f8dfb083bc77565e9..6191b9e48d53371d7f2b07cd843a892a773297d9 100644 --- a/graphic/vkgl/src/deqpgles31/build0015/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0015/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0015") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0016/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0016/BUILD.gn index 5c374df21fbee70b54ba8c1571eb53603760c647..df05cefa91e453b4c3aa2062724b7c00d4899cd1 100644 --- a/graphic/vkgl/src/deqpgles31/build0016/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0016/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0016") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0017/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0017/BUILD.gn index 1521fac57bf53cd0a7347977cc75a64d3f1602df..57537ebd1c6192cd9f34786e6f64aa902e1fab44 100644 --- a/graphic/vkgl/src/deqpgles31/build0017/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0017/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0017") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0018/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0018/BUILD.gn index a94ed577402178c423a27f0e3d207ce7f216e776..fdb5ce1ce29f50251fdd9fd9b10c8aa2b38d8e4f 100644 --- a/graphic/vkgl/src/deqpgles31/build0018/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0018/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0018") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0019/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0019/BUILD.gn index ed7bc18346fad0a72e032b028e6a04b0de9ed972..9ceb92331d6631c53f4d0092e26997ba5775c3b7 100644 --- a/graphic/vkgl/src/deqpgles31/build0019/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0019/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0019") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0020/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0020/BUILD.gn index 2f1730e1b55ca2b72d2a68938e0136ea8f390f49..0290bb5a8a40cb14a95e6487421ad54a08a2c949 100644 --- a/graphic/vkgl/src/deqpgles31/build0020/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0020/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0020") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0021/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0021/BUILD.gn index 702bad1e52957ccb6933ae3236df3735a005daf0..eebe9b1ed06588e8c8808335a0487fa5ee3c1b1a 100644 --- a/graphic/vkgl/src/deqpgles31/build0021/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0021/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0021") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0022/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0022/BUILD.gn index d5772c23dcb6082db57e5e244e6933d727bab9f4..ab641f82dc017cdf0a98aec81ec249a6c0105f51 100644 --- a/graphic/vkgl/src/deqpgles31/build0022/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0022/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0022") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0023/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0023/BUILD.gn index bee20e7ad7b66a872190b2c708442b9082860dfe..417ddb3cda68ae15b5c937f396f0cb7723cb3a81 100644 --- a/graphic/vkgl/src/deqpgles31/build0023/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0023/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0023") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0024/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0024/BUILD.gn index 70d7b1fefc1f01cf88ee73267add5248ff069682..f33b9cbe3efc60c276e723685ecd2ad144ad1b62 100644 --- a/graphic/vkgl/src/deqpgles31/build0024/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0024/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0024") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0025/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0025/BUILD.gn index c4cb11369d5501994f330a9c05fc428118e73d37..92e6b10f74385149d78864e482571a4a75a64873 100644 --- a/graphic/vkgl/src/deqpgles31/build0025/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0025/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0025") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0026/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0026/BUILD.gn index b0abaa7a1201180560ebb3ee8d06c57e356315a9..a82400b20cc2fd81ae81a2fe52394e2aff9ce289 100644 --- a/graphic/vkgl/src/deqpgles31/build0026/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0026/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0026") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0027/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0027/BUILD.gn index eeaa09233fe5dce1ea9f3a5545249c3ce49f65e8..d28cd61b020397191a4af85617f927973c7514eb 100644 --- a/graphic/vkgl/src/deqpgles31/build0027/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0027/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0027") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0028/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0028/BUILD.gn index 80c21d3dffc5f2bd45e37452a5a94dec6f7b1fe2..97a1de453e9838b0298bbf348ea534c6bb30edb2 100644 --- a/graphic/vkgl/src/deqpgles31/build0028/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0028/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0028") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0029/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0029/BUILD.gn index 82a230a364362d06b489fff093811c281e59b72c..20b20749c6bdb3dddd5941e62a62d25fdc06d5af 100644 --- a/graphic/vkgl/src/deqpgles31/build0029/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0029/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0029") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0030/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0030/BUILD.gn index 7932f69e833fb6e90744d5d2a9a34a792cbeb736..365c58e42423b0f01be519e36b78e84907871297 100644 --- a/graphic/vkgl/src/deqpgles31/build0030/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0030/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0030") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0031/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0031/BUILD.gn index 322de2983ccb29fb851c4ed651d36318d3a3cad9..93cc5d306fde6789d32f80d096b1d29efa55553b 100644 --- a/graphic/vkgl/src/deqpgles31/build0031/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0031/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0031") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0032/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0032/BUILD.gn index 0e7d6b89d14307a1e4789fbc78188eae2be06b4e..894c2ae1404ee3214b6070be9167403182a3186c 100644 --- a/graphic/vkgl/src/deqpgles31/build0032/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0032/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0032") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0033/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0033/BUILD.gn index 3018438eccec47dbb2099707c0becd84acf6ec5f..8fce5e1b3a2fc85a63ef1fa00a6588f2891937eb 100644 --- a/graphic/vkgl/src/deqpgles31/build0033/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0033/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0033") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0034/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0034/BUILD.gn index c645b1a21307b268d26d872a09b8f55f2f47e29e..165369b5f485dd9606461c34eed9936ebbc4cb6b 100644 --- a/graphic/vkgl/src/deqpgles31/build0034/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0034/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0034") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0035/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0035/BUILD.gn index 25bcbbdb4b27ba36b289a75443b1eb07084fa1f0..0749cb87c64a86df8942736b75af925df9e5c291 100644 --- a/graphic/vkgl/src/deqpgles31/build0035/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0035/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0035") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0036/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0036/BUILD.gn index b068fdfdf03c2fa455f898e6d1f9af8fba813edd..2e08019767356c3acffa01df11ec1056ed0f1f6a 100644 --- a/graphic/vkgl/src/deqpgles31/build0036/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0036/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0036") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0037/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0037/BUILD.gn index 250ddae88e5ed41e14c38cae4b11b1edf8d9593a..02f6345a02c378e07144321150e7f3833330e6b4 100644 --- a/graphic/vkgl/src/deqpgles31/build0037/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0037/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0037") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/deqpgles31/build0038/BUILD.gn b/graphic/vkgl/src/deqpgles31/build0038/BUILD.gn index b82459c8a31689a44eea9c2d2e7cff3028533419..a77e3ea70f1537526c5e9c94ad629f1097f44c14 100644 --- a/graphic/vkgl/src/deqpgles31/build0038/BUILD.gn +++ b/graphic/vkgl/src/deqpgles31/build0038/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libdeqpgles31func0038") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/khrgles2/build0001/BUILD.gn b/graphic/vkgl/src/khrgles2/build0001/BUILD.gn index e88f7ef89222d563d56fbb4016a2bc4c715e1ed0..daaed72a4c7cf18d6ea677da2910ea28f72dcc50 100644 --- a/graphic/vkgl/src/khrgles2/build0001/BUILD.gn +++ b/graphic/vkgl/src/khrgles2/build0001/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libkhrgles2func0001") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/khrgles3/build0001/BUILD.gn b/graphic/vkgl/src/khrgles3/build0001/BUILD.gn index 8bf50b1de02e430868e13cdf902662aa8ab13820..0a978a5fc5648867c6be69d92750c3e454e96927 100644 --- a/graphic/vkgl/src/khrgles3/build0001/BUILD.gn +++ b/graphic/vkgl/src/khrgles3/build0001/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libkhrgles3func0001") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/khrgles3/build0002/BUILD.gn b/graphic/vkgl/src/khrgles3/build0002/BUILD.gn index 0f20f1811f74b184a99e5bb980058f19cb15bec9..8fa7eca8825aa65999f35d9fa4164a7186b44720 100644 --- a/graphic/vkgl/src/khrgles3/build0002/BUILD.gn +++ b/graphic/vkgl/src/khrgles3/build0002/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libkhrgles3func0002") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/khrgles3/build0003/BUILD.gn b/graphic/vkgl/src/khrgles3/build0003/BUILD.gn index 2de0843eccd33310ab58a8136a549239d4c7575f..6832940d02874652a86f24f2b1e48d92bfa7748c 100644 --- a/graphic/vkgl/src/khrgles3/build0003/BUILD.gn +++ b/graphic/vkgl/src/khrgles3/build0003/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libkhrgles3func0003") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/khrgles3/build0004/BUILD.gn b/graphic/vkgl/src/khrgles3/build0004/BUILD.gn index 6a404d8f12c7d76b5bba19100facd6c2e292143c..5992bf163cb94bb192d30bb01a9b7ea01bf114d0 100644 --- a/graphic/vkgl/src/khrgles3/build0004/BUILD.gn +++ b/graphic/vkgl/src/khrgles3/build0004/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libkhrgles3func0004") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/khrgles3/build0005/BUILD.gn b/graphic/vkgl/src/khrgles3/build0005/BUILD.gn index 8dd488112362762e3f97e92ecae9546981144190..39836c1c35c2a61ed50c8a96bf860565a3ece880 100644 --- a/graphic/vkgl/src/khrgles3/build0005/BUILD.gn +++ b/graphic/vkgl/src/khrgles3/build0005/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libkhrgles3func0005") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/khrgles31/build0001/BUILD.gn b/graphic/vkgl/src/khrgles31/build0001/BUILD.gn index fa01d9970566893b9a09ef47be5c248fa292fd91..46dcda6adcf4a0565ac203dcc6d3c59250b4a0a3 100644 --- a/graphic/vkgl/src/khrgles31/build0001/BUILD.gn +++ b/graphic/vkgl/src/khrgles31/build0001/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libkhrgles31func0001") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/khrgles31/build0002/BUILD.gn b/graphic/vkgl/src/khrgles31/build0002/BUILD.gn index ec037be3e3354ce5d8e12426e6f5312387a8a2f3..e9d92740d896077c721cb2027caaf77fb59f7993 100644 --- a/graphic/vkgl/src/khrgles31/build0002/BUILD.gn +++ b/graphic/vkgl/src/khrgles31/build0002/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libkhrgles31func0002") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/khrgles31/build0003/BUILD.gn b/graphic/vkgl/src/khrgles31/build0003/BUILD.gn index af8c2bbd28fac3e374063b953a15d4df060aaa66..ba02ac85e6dbd6c445a5a3ab701a7d4ba029bac1 100644 --- a/graphic/vkgl/src/khrgles31/build0003/BUILD.gn +++ b/graphic/vkgl/src/khrgles31/build0003/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libkhrgles31func0003") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/khrgles31/build0004/BUILD.gn b/graphic/vkgl/src/khrgles31/build0004/BUILD.gn index 098d60de5f03e3763a565dca2c802b7a450e51d0..f86f9b97a923bcf9820d8bcef76b41a672033dfc 100644 --- a/graphic/vkgl/src/khrgles31/build0004/BUILD.gn +++ b/graphic/vkgl/src/khrgles31/build0004/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libkhrgles31func0004") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/khrgles32/build0001/BUILD.gn b/graphic/vkgl/src/khrgles32/build0001/BUILD.gn index 11758d5032069b17b942f7ae2ce037f23dbcb003..26b2ccf114274a439815b0deb338032880a541d1 100644 --- a/graphic/vkgl/src/khrgles32/build0001/BUILD.gn +++ b/graphic/vkgl/src/khrgles32/build0001/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libkhrgles32func0001") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/khrgles32/build0002/BUILD.gn b/graphic/vkgl/src/khrgles32/build0002/BUILD.gn index 4911788d71cd10c9ea6a09016b07ffe12c88211a..992432b1365378e26df17a6008bdea973ac889f7 100644 --- a/graphic/vkgl/src/khrgles32/build0002/BUILD.gn +++ b/graphic/vkgl/src/khrgles32/build0002/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libkhrgles32func0002") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/vkgl/src/khrglesext/build0001/BUILD.gn b/graphic/vkgl/src/khrglesext/build0001/BUILD.gn index a582caca8c30af8c0387ce1d9edb48ae84bc2ac9..a428d1291bffee501b0b28e915de7628f8d41d90 100644 --- a/graphic/vkgl/src/khrglesext/build0001/BUILD.gn +++ b/graphic/vkgl/src/khrglesext/build0001/BUILD.gn @@ -39,7 +39,7 @@ ohos_static_library("libkhrglesextfunc0001") { deps = common_depends external_deps = [ "hilog_native:libhilog", - "multimedia_image_standard:image_native", + "multimedia_image_framework:image_native", ] configs = [ ":deqp_platform_ohos_config" ] public_deps = [ "//foundation/ace/ace_engine/build/external_config/flutter/skia:ace_skia_ohos" ] diff --git a/graphic/webGL/src/main/config.json b/graphic/webGL/src/main/config.json index b19ca27e634b0933aa3e7e816c04c74d30309278..d63a24c607db8f4538de0d25fdfe6dbbc8b37741 100644 --- a/graphic/webGL/src/main/config.json +++ b/graphic/webGL/src/main/config.json @@ -16,6 +16,7 @@ "package": "com.test.webGL", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/graphic/windowStage/entry/src/main/ets/test/windowCallback.test.ets b/graphic/windowStage/entry/src/main/ets/test/windowCallback.test.ets index dce7f4108f8f31d52e07dad48e7d6e31ca4639c0..8c6e6646607cd5f0c33eff63bb962e27b1e739dc 100644 --- a/graphic/windowStage/entry/src/main/ets/test/windowCallback.test.ets +++ b/graphic/windowStage/entry/src/main/ets/test/windowCallback.test.ets @@ -1418,12 +1418,63 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) }) }) /** - * @tc.number SUB_WINDOW_SETPREFERREDORIENTATION_JSAPI_001 - * @tc.name Test setPreferredOrientation + * @tc.number SUB_WINDOW_SETDENSITTYDPI_JSAPI_002 + * @tc.name Test setDensityDpiTest2 + * @tc.desc Verify Sets the screen pixel + */ + it('setDensityDpiTest2', 0, async function (done) { + let caseName = 'setDensityDpiTest2'; + let msgStr = 'jsunittest ' + caseName + ' '; + console.log(msgStr + 'begin'); + let screens = await screenManager.getAllScreens().catch(errScreen => { + unexpectedError(errScreen, caseName, 'screenManager.getAllScreen', done); + }) + console.log(msgStr + 'screenManager.getAllScreen' + JSON.stringify(screens)); + expect(!!screens).assertTrue(); + + let currentDeviceDefaultDpi; + let currentDeviceDefault = null; + display.getDefaultDisplay(async(err, data) => { + if (err.code) { + console.error('Failed to obtain the default display object. Code: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in obtaining the default display object. Data:' + JSON.stringify(data)); + currentDeviceDefault = data; + currentDeviceDefaultDpi = parseInt(currentDeviceDefault.densityDPI) + let dpiItem = [-80, 80, 1000, 160, 0, 320, 188.88, 0, 640, 300,currentDeviceDefaultDpi]; + for (let i = 0;i < dpiItem.length; i++) { + await sleep(1000); + screens[0].setDensityDpi(dpiItem[i],(errDpi,dataDpi)=>{ + if (errDpi.code) { + console.error('Failed to set DensityDpi. Cause: ' + JSON.stringify(err)+ dpiItem[i]); + return; + } + console.log(msgStr + 'screen.setDensityDpi success set DPI ' + dpiItem[i]); + display.getDefaultDisplay((error,result)=>{ + if (error.code) { + console.error(msgStr + 'screen.setDensityDpi display.getDefaultDisplay failed'); + return; + console.log(msgStr + 'screen.setDensityDpi display.getDefaultDisplay' + JSON.stringify(result)); + let isEqual = Number(result.densityDPI) == parseInt(dpiItem[i]) + console.log(msgStr + 'same ? ' + isEqual) + expect(isEqual).assertTrue() + } + }) + }) + } + }); + + console.log(msgStr + 'done '); + done(); + }) + /** + * @tc.number SUB_WINDOW_SETPREFERREDORIENTATION_JSAPI_002 + * @tc.name Test setPreferredOrientationTest2 * @tc.desc Sets the display direction property of the window */ - it('setPreferredOrientation', 0, async function (done) { - let caseName = 'setPreferredOrientation'; + it('setPreferredOrientationTest2', 0, async function (done) { + let caseName = 'setPreferredOrientationTest2'; let msgStr = 'jsunittest ' + caseName + ' '; console.log(msgStr + 'begin'); let mainWin = await windowStage.getMainWindow().catch(err => { @@ -1446,12 +1497,12 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) done(); }) /** - * @tc.number SUB_WINDOW_SETFORBIDSPLITMOVE_JSAPI_001 - * @tc.name Test setForbidSplitMove + * @tc.number SUB_WINDOW_SETFORBIDSPLITMOVE_JSAPI_002 + * @tc.name Test setForbidSplitMoveTest2 * @tc.desc Sets whether Windows are forbidden to move in split screen mode */ - it('setForbidSplitMove', 0, async function (done) { - let caseName = 'setForbidSplitMove'; + it('setForbidSplitMoveTest2', 0, async function (done) { + let caseName = 'setForbidSplitMoveTest2'; let msgStr = 'jsunittest ' + caseName + ' '; console.log(msgStr + 'begin'); let mainWin = await windowStage.getMainWindow().catch(err => { @@ -1477,10 +1528,10 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) done(); }) /** -* @tc.number SUB_WINDOW_SNAPSHOT_JSAPI_002 -* @tc.name Test snapshotTest2 -* @tc.desc Scenario of screenshot of verification window -*/ + * @tc.number SUB_WINDOW_SNAPSHOT_JSAPI_002 + * @tc.name Test snapshotTest2 + * @tc.desc Scenario of screenshot of verification window + */ it('snapshotTest2', 0, async function (done) { let caseName = 'snapshotTest2'; let msgStr = 'jsunittest ' + caseName + ' '; @@ -1558,12 +1609,12 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) controller.animationForShown = (context: ohosWindow.TransitionContext) => { let toWindow = context.toWindow animateTo({ - duration: 1000, // 动画时长 - tempo: 0.5, // 播放速率 - curve: Curve.EaseInOut, // 动画曲线 - delay: 0, // 动画延迟 - iterations: 1, // 播放次数 - playMode: PlayMode.Normal, // 动画模式 + duration: 1000, + tempo: 0.5, + curve: Curve.EaseInOut, + delay: 0, + iterations: 1, + playMode: PlayMode.Normal, }, () => { var obj: ohosWindow.TranslateOptions; obj.x = 100.0; @@ -1581,5 +1632,86 @@ export default function windowCallbackTest(context, windowStage, abilityStorage) }); }) + /** + * @tc.number SUB_WINDOW_GETCUTOUTINFO_JSAPI_002 + * @tc.name Test getCutoutInfoTest2 + * @tc.desc Obtain information about unavailable screen areas such as the hole screen, fringe screen, and waterfall screen + */ + it('getCutoutInfoTest2', 0, async function (done) { + let caseName = 'getCutoutInfoTest2'; + let msgStr = 'jsunittest ' + caseName + ' '; + console.log(msgStr + 'begin context==' + JSON.stringify(context)); + let dpClass = display.getDefaultDisplaySync(); + expect(!!dpClass).assertTrue(); + dpClass.getCutoutInfo((err, data) => { + if (err && err.code) { + unexpectedError(err, caseName, 'displayClass.getCutoutInfo', done); + }else{ + console.info(msgStr+'Succeeded in getting cutoutInfo. Data: ' + JSON.stringify(data)); + done(); + } + }) + }) + /** + * @tc.number SUB_WINDOW_SHOWWITHANIMATION_JSAPI_002 + * @tc.name Test showWithAnimationTest2 + * @tc.desc Displays the current window, playing an animation in the process + */ + it('showWithAnimationTest2', 0, async function (done) { + let caseName = 'showWithAnimationTest2'; + let msgStr = 'jsunittest ' + caseName + ' '; + console.log(msgStr + 'begin context==' + JSON.stringify(context)); + let wndId = 'showWithAnimationTest2'; + let baseType = ohosWindow.WindowType.TYPE_FLOAT; + ohosWindow.create(context, wndId, baseType, (err, data) => { + if (err && err.code) { + unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done); + } else { + let tempWnd=data; + console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + JSON.stringify(tempWnd)); + expect(!!tempWnd).assertTrue(); + tempWnd.showWithAnimation((error, animationData) => { + if (error && error.code) { + unexpectedError(error, caseName, 'Failed to show the window with animation', done); + }else { + console.info('Succeeded in showing the window with animation. Data: ' + JSON.stringify(animationData)); + done(); + } + }) + } + }) + }) + /** + * @tc.number SUB_WINDOW_HIDEWITHANIMATION_JSAPI_002 + * @tc.name Test hideWithAnimationTest2 + * @tc.desc Hide the current window and play an animation in the process + */ + it('hideWithAnimationTest2', 0, async function (done) { + let caseName = 'hideWithAnimationTest2'; + let msgStr = 'jsunittest ' + caseName + ' '; + console.log(msgStr + 'begin context==' + JSON.stringify(context)); + let wndId = 'hideWithAnimationTest2'; + let baseType = ohosWindow.WindowType.TYPE_FLOAT; + ohosWindow.create(context, wndId, baseType, (creare_err, tempWnd) => { + if (creare_err && creare_err.code) { + unexpectedError(creare_err, caseName, 'ohosWindow.create ' + baseType, done); + } + expect(!!tempWnd).assertTrue(); + ohosWindow.find(wndId, (findErr, findWnd) => { + if (findErr && findErr.code) { + unexpectedError(findErr, caseName, 'Failed to hide the window with animation', done); + }else { + findWnd.hideWithAnimation((err, data) => { + if (err && err.code) { + unexpectedError(err, caseName, 'Failed to hide the window with animation', done); + }else { + console.info('Succeeded in hiding the window with animation. Data: ' + JSON.stringify(data)); + done(); + } + }) + } + }) + }) + }) }) } diff --git a/graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets b/graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets index 22239b673d9bdd81dfc341c1bdd602b73e4ac194..40e29bcd30e11fb5e3c00dd2b8de24cd21aedc02 100644 --- a/graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets +++ b/graphic/windowStage/entry/src/main/ets/test/windowPromise.test.ets @@ -1332,7 +1332,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) }) console.log(msgStr + 'screenManager.getAllScreen' + JSON.stringify(screens)); expect(!!screens).assertTrue(); - let dpiItem = [-80, 80, 1000, 160, 0, 320, 188.88, 0, 640, 300]; + let currentDeviceDefault = await display.getDefaultDisplay().catch(err => { + console.log(msgStr + 'screen.setDensityDpi display.getDefaultDisplay failed current device'); + }); + console.log(msgStr + 'screen.setDensityDpi display.getDefaultDisplay current device' + JSON.stringify(currentDeviceDefault)); + let currentDeviceDefaultDpi = parseInt(currentDeviceDefault.densityDPI) + let dpiItem = [-80, 80, 1000, 160, 0, 320, 188.88, 0, 640, 300,currentDeviceDefaultDpi]; for (let i = 0;i < dpiItem.length; i++) { await sleep(1000); await screens[0].setDensityDpi(dpiItem[i]).then(async () => { @@ -1353,11 +1358,11 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) }) /** * @tc.number SUB_WINDOW_SETPREFERREDORIENTATION_JSAPI_001 - * @tc.name Test setPreferredOrientation + * @tc.name Test setPreferredOrientationTest1 * @tc.desc Sets the display direction property of the window */ - it('setPreferredOrientation', 0, async function (done) { - let caseName = 'setPreferredOrientation'; + it('setPreferredOrientationTest1', 0, async function (done) { + let caseName = 'setPreferredOrientationTest1'; let msgStr = 'jsunittest ' + caseName + ' '; console.log(msgStr + 'begin'); let mainWin = await windowStage.getMainWindow().catch(err => { @@ -1380,11 +1385,11 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) }) /** * @tc.number SUB_WINDOW_SETFORBIDSPLITMOVE_JSAPI_001 - * @tc.name Test setForbidSplitMove + * @tc.name Test setForbidSplitMoveTest1 * @tc.desc Sets whether Windows are forbidden to move in split screen mode */ - it('setForbidSplitMove', 0, async function (done) { - let caseName = 'setForbidSplitMove'; + it('setForbidSplitMoveTest1', 0, async function (done) { + let caseName = 'setForbidSplitMoveTest1'; let msgStr = 'jsunittest ' + caseName + ' '; console.log(msgStr + 'begin'); let mainWin = await windowStage.getMainWindow().catch(err => { @@ -1464,12 +1469,12 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) controller.animationForShown = (context: ohosWindow.TransitionContext) => { let toWindow = context.toWindow animateTo({ - duration: 1000, // 动画时长 - tempo: 0.5, // 播放速率 - curve: Curve.EaseInOut, // 动画曲线 - delay: 0, // 动画延迟 - iterations: 1, // 播放次数 - playMode: PlayMode.Normal, // 动画模式 + duration: 1000, + tempo: 0.5, + curve: Curve.EaseInOut, + delay: 0, + iterations: 1, + playMode: PlayMode.Normal, }, () => { var obj: ohosWindow.TranslateOptions; obj.x = 100.0; @@ -1484,5 +1489,78 @@ export default function windowPromiseTest(context, windowStage, abilityStorage) } done(); }) + /** + * @tc.number SUB_WINDOW_GETCUTOUTINFO_JSAPI_001 + * @tc.name Test getCutoutInfoTest1 + * @tc.desc Obtain information about unavailable screen areas such as the hole screen, fringe screen, and waterfall screen + */ + it('getCutoutInfoTest1', 0, async function (done) { + let caseName = 'getCutoutInfoTest1'; + let msgStr = 'jsunittest ' + caseName + ' '; + console.log(msgStr + 'begin context==' + JSON.stringify(context)); + let dpClass = display.getDefaultDisplaySync(); + expect(!!dpClass).assertTrue(); + dpClass.getCutoutInfo().then((data) => { + console.info('Succeeded in getting cutoutInfo. Data: ' + JSON.stringify(data)); + done(); + }).catch(err=>{ + unexpectedError(err, caseName, 'displayClass.getCutoutInfo', done); + }); + }) + /** + * @tc.number SUB_WINDOW_SHOWWITHANIMATION_JSAPI_001 + * @tc.name Test showWithAnimationTest1 + * @tc.desc Displays the current window, playing an animation in the process + */ + it('showWithAnimationTest1', 0, async function (done) { + let caseName = 'showWithAnimationTest1'; + let msgStr = 'jsunittest ' + caseName + ' '; + console.log(msgStr + 'begin context==' + JSON.stringify(context)); + let wndId = 'showWithAnimationTest1'; + let baseType = ohosWindow.WindowType.TYPE_FLOAT; + let tempWnd = await ohosWindow.create(context,wndId, baseType).catch((err) => { + unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done); + }); + console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + JSON.stringify(tempWnd)); + expect(!!tempWnd).assertTrue(); + console.info('showWithAnimationTest1 ****' + Reflect.has(tempWnd,'showWithAnimation')) + await tempWnd.showWithAnimation().then((data)=> { + console.info('Succeeded in showing the window with animation. Data: ' + JSON.stringify(data)); + done(); + }).catch((err)=>{ + unexpectedError(err, caseName, 'Failed to show the window with animation', done); + }) + }) + /** + * @tc.number SUB_WINDOW_HIDEWITHANIMATION_JSAPI_001 + * @tc.name Test hideWithAnimationTest1 + * @tc.desc Hide the current window and play an animation in the process + */ + it('hideWithAnimationTest1', 0, async function (done) { + let caseName = 'hideWithAnimationTest1'; + let msgStr = 'jsunittest ' + caseName + ' '; + console.log(msgStr + 'begin context==' + JSON.stringify(context)); + let wndId = 'hideWithAnimationTest1'; + let baseType = ohosWindow.WindowType.TYPE_FLOAT; + let tempWnd = await ohosWindow.create(context,wndId, baseType).catch((err) => { + unexpectedError(err, caseName, 'ohosWindow.create ' + baseType, done); + }); + console.log(msgStr + 'ohosWindow.create ' + baseType + ', tempWnd: ' + JSON.stringify(tempWnd)); + expect(!!tempWnd).assertTrue(); + let findWnd = await ohosWindow.find(wndId).catch((err) => { + expectedError(err, caseName, 'ohosWindow.find', done); + }); + console.log(msgStr + 'find findWnd: ' + JSON.stringify(findWnd)); + expect(!!findWnd).assertTrue(); + console.info('hideWithAnimationTest1 ****' + Reflect.has(findWnd,'hideWithAnimation')) + console.info('hideWithAnimationTest1 ****' + Reflect.has(findWnd,'destroy')) + let promise = findWnd.hideWithAnimation(); + promise.then((data)=> { + console.info('Succeeded in hiding the window with animation. Data: ' + JSON.stringify(data)); + done(); + }).catch((err)=>{ + console.error('Failed to hide the window with animation. Cause: ' + JSON.stringify(err)); + }) + }) }) } diff --git a/graphic/windowStage/entry/src/main/module.json b/graphic/windowStage/entry/src/main/module.json index 2f75303710fc9915a694392337254ae6fdbc266d..20eee391852fdc45f8a5aeaee8faba1ae3016b1d 100644 --- a/graphic/windowStage/entry/src/main/module.json +++ b/graphic/windowStage/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:phone_entry_dsc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/graphic/windowstandard/Test.json b/graphic/windowstandard/Test.json index 0900a392ec9f4bc71cb98e4a269860befdd2eb1b..54d236836ac41650381e85d2d956016eb8e7a433 100644 --- a/graphic/windowstandard/Test.json +++ b/graphic/windowstandard/Test.json @@ -5,7 +5,8 @@ "test-timeout": "800000", "shell-timeout": "800000", "bundle-name": "com.test.window", - "package-name": "com.test.window" + "package-name": "com.test.window", + "testcase-timeout": "300000" }, "kits": [ { @@ -14,6 +15,13 @@ ], "type": "AppInstallKit", "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "power-shell wakeup", + "power-shell setmode 602" + ] } ] } \ No newline at end of file diff --git a/graphic/windowstandard/src/main/config.json b/graphic/windowstandard/src/main/config.json index 2cb01b6dc7f19d15ee83ded1fc31ad844e5b5cf9..62feb5da9f7d2d30ae93e9be223a63a2bbea70a5 100644 --- a/graphic/windowstandard/src/main/config.json +++ b/graphic/windowstandard/src/main/config.json @@ -16,6 +16,7 @@ "package": "com.test.window", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/graphic/windowstandard/src/main/js/test/display.test.js b/graphic/windowstandard/src/main/js/test/display.test.js index 83ba26fda317ae9d629d5fc5778058e43d663a63..86be6768fbe08a6aa96196b9ec91203d1f6f3c89 100644 --- a/graphic/windowstandard/src/main/js/test/display.test.js +++ b/graphic/windowstandard/src/main/js/test/display.test.js @@ -45,12 +45,12 @@ describe('display_test', function () { expect(dsp.rotation != null).assertTrue(); expect(dsp.densityDPI != null).assertTrue(); expect(dsp.name != null).assertTrue(); - expect(dsp.alive).assertEqual(undefined); - expect(dsp.state).assertEqual(undefined); + expect(dsp.alive).assertTrue(); + expect(dsp.state != null).assertTrue(); expect(dsp.densityPixels != null).assertTrue(); expect(dsp.scaledDensity !=null).assertTrue(); - expect(dsp.xDPI).assertEqual(undefined); - expect(dsp.yDPI).assertEqual(undefined); + expect(dsp.xDPI != null).assertTrue(); + expect(dsp.yDPI != null).assertTrue(); done(); }, (err) => { console.log('displayTest getDefaultDisplayTest1 getDefaultDisplay failed, err :' + JSON.stringify(err)); @@ -80,12 +80,12 @@ describe('display_test', function () { expect(data.rotation != null).assertTrue(); expect(data.densityDPI != null).assertTrue(); expect(data.name != null).assertTrue(); - expect(data.alive).assertEqual(undefined); - expect(data.state).assertEqual(undefined); + expect(data.alive).assertTrue(); + expect(data.state != null).assertTrue(); expect(data.densityPixels != null).assertTrue(); expect(data.scaledDensity !=null).assertTrue(); - expect(data.xDPI).assertEqual(undefined); - expect(data.yDPI).assertEqual(undefined); + expect(data.xDPI != null).assertTrue(); + expect(data.yDPI != null).assertTrue(); done(); } }) @@ -107,12 +107,12 @@ describe('display_test', function () { expect(dsp[0].rotation != null).assertTrue(); expect(dsp[0].densityDPI != null).assertTrue(); expect(dsp[0].name != null).assertTrue(); - expect(dsp[0].alive).assertEqual(undefined); - expect(dsp[0].state).assertEqual(undefined); + expect(dsp[0].alive).assertTrue(); + expect(dsp[0].state != null).assertTrue(); expect(dsp[0].densityPixels != null).assertTrue(); expect(dsp[0].scaledDensity !=null).assertTrue(); - expect(dsp[0].xDPI).assertEqual(undefined); - expect(dsp[0].yDPI).assertEqual(undefined); + expect(dsp[0].xDPI != null).assertTrue(); + expect(dsp[0].yDPI != null).assertTrue(); done(); }, (err) => { console.log('displayTest getAllDisplayTest1 getAllDisplay failed, err :' + JSON.stringify(err)); @@ -141,12 +141,12 @@ describe('display_test', function () { expect(data[0].rotation != null).assertTrue(); expect(data[0].densityDPI != null).assertTrue(); expect(data[0].name != null).assertTrue(); - expect(data[0].alive).assertEqual(undefined); - expect(data[0].state).assertEqual(undefined); + expect(data[0].alive).assertTrue(); + expect(data[0].state != null).assertTrue(); expect(data[0].densityPixels != null).assertTrue(); expect(data[0].scaledDensity !=null).assertTrue(); - expect(data[0].xDPI).assertEqual(undefined); - expect(data[0].yDPI).assertEqual(undefined); + expect(data[0].xDPI != null).assertTrue(); + expect(data[0].yDPI != null).assertTrue(); done(); } }) @@ -169,12 +169,12 @@ describe('display_test', function () { expect(dsp.rotation != null).assertTrue(); expect(dsp.densityDPI != null).assertTrue(); expect(dsp.name != null).assertTrue(); - expect(dsp.alive).assertEqual(undefined); - expect(dsp.state).assertEqual(undefined); + expect(dsp.alive).assertTrue(); + expect(dsp.state != null).assertTrue(); expect(dsp.densityPixels != null).assertTrue(); expect(dsp.scaledDensity !=null).assertTrue(); - expect(dsp.xDPI).assertEqual(undefined); - expect(dsp.yDPI).assertEqual(undefined); + expect(dsp.xDPI != null).assertTrue(); + expect(dsp.yDPI != null).assertTrue(); done(); } catch (err) { console.error('getDefaultDisplaySyncTest1 error ' + JSON.stringify(err)); diff --git a/graphic/windowstandard/src/main/js/test/window.test.js b/graphic/windowstandard/src/main/js/test/window.test.js index 9589657ddc84aa254f50420ba5dd980ea517b4f7..69c7fbaab279688423cd6a4048bdcdff523aa206 100644 --- a/graphic/windowstandard/src/main/js/test/window.test.js +++ b/graphic/windowstandard/src/main/js/test/window.test.js @@ -176,6 +176,7 @@ describe('window_test', function () { expect(wnd != null).assertTrue(); wnd.getAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).then((data) => { console.log('windowTest getAvoidAreaTest1 wnd.getAvoidArea success, data :' + JSON.stringify(data)); + expect(data.visible).assertTrue(); expect(data.rightRect != null).assertTrue(); expect(data.topRect != null).assertTrue(); expect(data.bottomRect != null).assertTrue(); @@ -205,6 +206,7 @@ describe('window_test', function () { expect(wnd != null).assertTrue(); wnd.getAvoidArea(window.AvoidAreaType.TYPE_CUTOUT).then((data) => { console.log('windowTest getAvoidAreaTest2 wnd.getAvoidArea success, data :' + JSON.stringify(data)); + expect(!data.visible).assertTrue(); expect(data.rightRect != null).assertTrue(); expect(data.topRect != null).assertTrue(); expect(data.bottomRect != null).assertTrue(); @@ -234,6 +236,7 @@ describe('window_test', function () { expect(wnd != null).assertTrue(); wnd.getAvoidArea(avoidAreaType).then((data) => { console.log('windowTest getAvoidAreaTest3 wnd.getAvoidArea success, data :' + JSON.stringify(data)); + expect(data.visible).assertTrue(); expect(data.rightRect != null).assertTrue(); expect(data.topRect != null).assertTrue(); expect(data.bottomRect != null).assertTrue(); @@ -267,6 +270,7 @@ describe('window_test', function () { expect().assertFail(); done(); } else { + expect(data.visible).assertTrue(); expect(data.topRect != null).assertTrue(); expect(data.rightRect != null).assertTrue(); expect(data.bottomRect != null).assertTrue(); @@ -293,6 +297,7 @@ describe('window_test', function () { expect().assertFail(); done(); } else { + expect(!data.visible).assertTrue(); expect(data.topRect != null).assertTrue(); expect(data.rightRect != null).assertTrue(); expect(data.bottomRect != null).assertTrue(); @@ -324,6 +329,7 @@ describe('window_test', function () { expect().assertFail(); done(); } else { + expect(data.visible).assertTrue(); expect(data.topRect != null).assertTrue(); expect(data.rightRect != null).assertTrue(); expect(data.bottomRect != null).assertTrue(); @@ -1476,7 +1482,7 @@ describe('window_test', function () { wnd.moveTo(200, 200, (err) => { if (err.code) { console.log('windowTest moveTest1 moveTo callback fail' + JSON.stringify(err.code)); - expect(err.code).assertEqual(7); + expect(err.code).assertEqual(6); done(); } else { console.log('windowTest moveTest1 moveTo callback success'); @@ -1502,7 +1508,7 @@ describe('window_test', function () { done(); }, (err) => { console.log('windowTest moveTest2 wnd.moveTo failed, err :' + JSON.stringify(err)); - expect(err.code).assertEqual(7); + expect(err.code).assertEqual(6); done(); }) }, (err) => { @@ -1528,7 +1534,7 @@ describe('window_test', function () { done(); }, (err) => { console.log('windowTest moveTest3 wnd.moveTo failed, err :' + JSON.stringify(err)); - expect(err.code).assertEqual(7); + expect(err.code).assertEqual(6); done(); }) }, (err) => { @@ -1554,7 +1560,7 @@ describe('window_test', function () { done(); }, (err) => { console.log('windowTest moveTest4 wnd.moveTo failed, err :' + JSON.stringify(err)); - expect(err.code).assertEqual(7); + expect(err.code).assertEqual(6); done(); }) }, (err) => { @@ -1580,7 +1586,7 @@ describe('window_test', function () { done(); }, (err) => { console.log('windowTest moveTest5 wnd.moveTo failed, err :' + JSON.stringify(err)); - expect(err.code).assertEqual(7); + expect(err.code).assertEqual(6); done(); }) } @@ -1604,7 +1610,7 @@ describe('window_test', function () { wnd.moveTo(-200, -200, (err) => { if (err) { console.log('windowTest moveTest6 wnd.moveTo failed, err :' + JSON.stringify(err)); - expect(err.code).assertEqual(7); + expect(err.code).assertEqual(6); done(); } else { console.log('windowTest moveTest6 wnd.moveTo success'); @@ -1635,7 +1641,7 @@ describe('window_test', function () { done(); }, (err) => { console.log('windowTest moveTestNegative moveTo failed, err :' + JSON.stringify(err)); - expect(err.code).assertEqual(7); + expect(err.code).assertEqual(6); done(); }) }, (err) => { @@ -1661,12 +1667,12 @@ describe('window_test', function () { done(); }, (err) => { console.log('windowTest moveTest8 create failed, err :' + JSON.stringify(err)); - expect(err.code).assertEqual(7); + expect(err.code).assertEqual(6); done(); }) }, (err) => { console.log('windowTest moveTest8 create failed, err :' + JSON.stringify(err)); - expect(err.code).assertEqual(7); + expect(err.code).assertEqual(6); done(); }) }, (err) => { @@ -1692,7 +1698,7 @@ describe('window_test', function () { done(); }, (err) => { console.log('windowTest resetSizeTest1 wnd.resetSize failed, err :' + JSON.stringify(err)); - expect(err.code).assertEqual(7); + expect(err.code).assertEqual(6); done(); }) }, (err) => { @@ -1718,7 +1724,7 @@ describe('window_test', function () { done(); }, (err) => { console.log('windowTest resetSizeTest2 wnd.resetSize failed, err :' + JSON.stringify(err)); - expect(err.code).assertEqual(7); + expect(err.code).assertEqual(6); done(); }) }, (err) => { @@ -1797,7 +1803,7 @@ describe('window_test', function () { done(); },(err) => { console.log('windowTest resetSizeTest5 wnd.resetSize failed, err :' + JSON.stringify(err)); - expect(err.code).assertEqual(7); + expect(err.code).assertEqual(6); done(); }) } @@ -1821,7 +1827,7 @@ describe('window_test', function () { wnd.resetSize(200, 200, (err) => { if (err.code) { console.log('windowTest ResetSizeTest6 resetSize callback fail' + JSON.stringify(err.code)); - expect(err.code).assertEqual(7); + expect(err.code).assertEqual(6); done(); } else { console.log('windowTest ResetSizeTest6 resetSize callback success'); @@ -1853,7 +1859,7 @@ describe('window_test', function () { done(); },(err) => { console.log('windowTest resetSizeLoop resetSize failed, err :' + JSON.stringify(err)); - expect(err.code).assertEqual(7); + expect(err.code).assertEqual(6); done(); }) } @@ -3154,11 +3160,11 @@ describe('window_test', function () { }) /** - * @tc.number SUB_WMS_SETBACKGROUNDCOLORBACK_JSAPI_004 - * @tc.name Test setBackgroundColorBack_Test_004 + * @tc.number SUB_WMS_SETBACKGROUNDCOLORCallBACK_JSAPI_004 + * @tc.name Test setBackgroundColorCallBack_Test_004 * @tc.desc Set the background color input parameter as an outlier */ - it('setBackgroundColorBack_Test_004', 0, async function (done) { + it('setBackgroundColorCallBack_Test_004', 0, async function (done) { console.info('windowTest setBackgroundColorCallBackTest4 begin'); window.getTopWindow().then(wnd => { console.info('windowTest setBackgroundColorTestCallBack4 getTopWindow wnd' + wnd); @@ -3489,6 +3495,7 @@ describe('window_test', function () { expect().assertFail(); done(); } else { + expect(data.visible).assertTrue(); expect(data.topRect != null).assertTrue(); expect(data.rightRect != null).assertTrue(); expect(data.bottomRect != null).assertTrue(); @@ -3513,13 +3520,10 @@ describe('window_test', function () { console.info('windowTest getAvoidAreaTestAdd2' + JSON.stringify(data)); if (err.code != 0) { console.log('windowTest getAvoidAreaTestAdd002 wnd.getAvoidArea callback fail' + JSON.stringify(err)); - expect().assertFail(); + expect(err.code).assertEqual(1003); done(); } else { - expect(data.topRect != null).assertTrue(); - expect(data.rightRect != null).assertTrue(); - expect(data.bottomRect != null).assertTrue(); - expect(data.leftRect != null).assertTrue(); + expect().assertFail(); done(); } }) diff --git a/hiviewdfx/BUILD.gn b/hiviewdfx/BUILD.gn index 0483c8bacc0d1bccc90bee1fb1f4a89dfb2ee4fc..831800e06692c6a85cc7e634673b6abb90d7f688 100644 --- a/hiviewdfx/BUILD.gn +++ b/hiviewdfx/BUILD.gn @@ -18,8 +18,11 @@ group("hiviewdfxtestacts") { "bytracetest:ActsBytraceJsTest", "hiappeventtest/hiappeventcpptest:ActsHiAppEventCPPTest", "hiappeventtest/hiappeventjstest:ActsHiAppeventTest", + "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/bytracetest/src/main/config.json b/hiviewdfx/bytracetest/src/main/config.json index 835c81c8421d6c76acc73a90fc2f4f03b37685e4..4a310f886b4d92b3551fc4b9ddcea70da2f36015 100644 --- a/hiviewdfx/bytracetest/src/main/config.json +++ b/hiviewdfx/bytracetest/src/main/config.json @@ -18,6 +18,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/hiviewdfx/hiappeventtest/hiappeventcpptest/BUILD.gn b/hiviewdfx/hiappeventtest/hiappeventcpptest/BUILD.gn index 73b8176c862bb0a193166badcebeacf9fdd82dd3..3bce5aef486cacf9934d3c247f1bddd4fc9d0e40 100755 --- a/hiviewdfx/hiappeventtest/hiappeventcpptest/BUILD.gn +++ b/hiviewdfx/hiappeventtest/hiappeventcpptest/BUILD.gn @@ -29,12 +29,12 @@ config("hilogtest_config") { ohos_moduletest_suite("ActsHiAppEventCPPTest") { module_out_path = module_output_path sources = [ "HiAppEventCPPTest.cpp" ] + external_deps = [ "c_utils:utils" ] deps = [ "../../utils/native:utilskit", "//base/hiviewdfx/hiappevent/frameworks/native/libhiappevent:libhiappevent_base", "//base/hiviewdfx/hiappevent/frameworks/native/ndk:hiappevent_ndk", "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", - "//commonlibrary/c_utils/base:utils", "//third_party/googletest:gtest_main", ] configs = [ ":hilogtest_config" ] 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/hiviewdfx/hiappeventtest/hiappeventjstest/src/main/config.json b/hiviewdfx/hiappeventtest/hiappeventjstest/src/main/config.json index 07e8861cae6e296726509b178515cef22dae3050..f97a0cbbc586ee8e87f391a02c6d33e297d732e7 100644 --- a/hiviewdfx/hiappeventtest/hiappeventjstest/src/main/config.json +++ b/hiviewdfx/hiappeventtest/hiappeventjstest/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.hiviewdfx.hiappevent.function", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/hiviewdfx/hiappeventtest/hiappeventjstest/src/main/js/test/HiAppEvent.test.js b/hiviewdfx/hiappeventtest/hiappeventjstest/src/main/js/test/HiAppEvent.test.js index 82afe7cb3adcc7a8acfd44afc6faaa3a53168a65..3ec815f9606adb601f32b67fc6cda2636c6282c9 100644 --- a/hiviewdfx/hiappeventtest/hiappeventjstest/src/main/js/test/HiAppEvent.test.js +++ b/hiviewdfx/hiappeventtest/hiappeventjstest/src/main/js/test/HiAppEvent.test.js @@ -538,12 +538,12 @@ describe('HiAppEventApiTest', function () { console.info('testHiAppEventApi24 end') }) - /** + /** * @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_2500 * @tc.name testHiAppEventApi25 * @tc.desc HiAppEvent with predefined event and param. */ - it('testHiAppEventApi25', 3, async function (done) { + it('testHiAppEventApi25', 3, async function (done) { console.info('testHiAppEventApi25 start') HiAppEvent.write(HiAppEvent.Event.USER_LOGIN, HiAppEvent.EventType.BEHAVIOR, {[HiAppEvent.Param.USER_ID]: 'userlogin', [HiAppEvent.Param.DISTRIBUTED_SERVICE_NAME]: 'HiAppEvent', @@ -578,5 +578,59 @@ describe('HiAppEventApiTest', function () { }); console.info('testHiAppEventApi25 end') }) + + /** + * @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_2600 + * @tc.name testHiAppEventApi26 + * @tc.desc HiAppEvent write by Promise. + */ + it('testHiAppEventApi26', 2, async function (done) { + console.info('testHiAppEventApi26 start') + HiAppEvent.write({ + domain: "test_domain", + name: "write", + eventType: HiAppEvent.EventType.FAULT, + params: { + "key_int": 100, "key_string": "demo", + "key_bool":true, "key_float":1.1,"key_array_int": [1, 2, 3], "key_array_float": [1.1, 2.2, 3.3], + "key_array_str": ["a", "b", "c"], "key_array_bool": [true, false],"key_array_int2": [1, 2, 3], + "key_arr_float2": [1.1, 2.2, 3.3], "key_arr_str2": ["a", "b", "c"], "key_array_bool2": [true, false] + } + }).then((value) => { + console.log(`success to write event: ${value}`); + done(); + }).catch((err) =>{ + console.error(`failed to write event because ${err.code}`); + }); + console.info('testHiAppEventApi26 end') + }) + + /** + * @tc.number DFX_DFT_HiviewKit_HiAppEvent_JSNAPI_2700 + * @tc.name testHiAppEventApi27 + * @tc.desc HiAppEvent write by callback. + */ + it('testHiAppEventApi27', 2, async function (done) { + console.info('testHiAppEventApi27 start') + HiAppEvent.write({ + domain: "test_domain", + name: "test_event", + eventType: HiAppEvent.EventType.FAULT, + params: { + "key_int": 100, "key_string": "demo", + "key_bool":true, "key_float":1.1,"key_array_int": [1, 2, 3], "key_array_float": [1.1, 2.2, 3.3], + "key_array_str": ["a", "b", "c"], "key_array_bool": [true, false],"key_array_int2": [1, 2, 3], + "key_arr_float2": [1.1, 2.2, 3.3], "key_arr_str2": ["a", "b", "c"], "key_array_bool2": [true, false] + } + }, (err, value) => { + if (err) { + console.error(`failed to write event because ${err.code}`); + done(); + } + console.log(`success to write event: ${value}`) + done(); + }); + console.info('testHiAppEventApi27 end') + }) }) -} +} \ No newline at end of file diff --git a/hiviewdfx/hiappeventtest/hiappeventsubjstest/BUILD.gn b/hiviewdfx/hiappeventtest/hiappeventsubjstest/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..28d26deeaa581201a97bdb451c718f5592910b1e --- /dev/null +++ b/hiviewdfx/hiappeventtest/hiappeventsubjstest/BUILD.gn @@ -0,0 +1,40 @@ +# 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("ActsHiAppeventSubTest") { + hap_profile = "./src/main/config.json" + deps = [ + ":hiappevent_js_assets", + ":hiappevent_resources", + ] + + # shared_libraries = [ + # "//third_party/giflib:libgif", + # "//third_party/libpng:libpng", + # ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsHiAppeventSubTest" + + # part_name = "prebuilt_hap" + # subsystem_name = "xts" +} +ohos_js_assets("hiappevent_js_assets") { + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" +} +ohos_resources("hiappevent_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/hiviewdfx/hiappeventtest/hiappeventsubjstest/Test.json b/hiviewdfx/hiappeventtest/hiappeventsubjstest/Test.json new file mode 100755 index 0000000000000000000000000000000000000000..daacd3c388921f90b264b284b64aa7ef9cb96458 --- /dev/null +++ b/hiviewdfx/hiappeventtest/hiappeventsubjstest/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "270000", + "shell-timeout": "270000", + "bundle-name": "ohos.acts.hiviewdfx.hiappeventsub.function", + "package-name": "ohos.acts.hiviewdfx.hiappeventsub.function" + }, + "kits": [ + { + "test-file-name": [ + "ActsHiAppeventSubTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/hiviewdfx/hiappeventtest/hiappeventsubjstest/signature/openharmony_sx.p7b b/hiviewdfx/hiappeventtest/hiappeventsubjstest/signature/openharmony_sx.p7b new file mode 100755 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/hiviewdfx/hiappeventtest/hiappeventsubjstest/signature/openharmony_sx.p7b differ diff --git a/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/config.json b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/config.json new file mode 100755 index 0000000000000000000000000000000000000000..568ea07de25b8c451cdf40d97e7a54cf63315d5c --- /dev/null +++ b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/config.json @@ -0,0 +1,94 @@ +{ + "app": { + "bundleName": "ohos.acts.hiviewdfx.hiappeventsub.function", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5 + } + }, + "deviceConfig": {}, + "module": { + "package": "ohos.acts.hiviewdfx.hiappeventsub.function", + "name": ".entry", + "deviceType": [ + "default", + "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": "" + } +} diff --git a/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/MainAbility/app.js b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/MainAbility/app.js new file mode 100755 index 0000000000000000000000000000000000000000..4b241cccbaa71f0c5cbd9e7dc437a0feb224c7d5 --- /dev/null +++ b/hiviewdfx/hiappeventtest/hiappeventsubjstest/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/hiappeventtest/hiappeventsubjstest/src/main/js/MainAbility/i18n/en-US.json b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/MainAbility/i18n/en-US.json new file mode 100755 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/hiviewdfx/hiappeventtest/hiappeventsubjstest/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/hiappeventtest/hiappeventsubjstest/src/main/js/MainAbility/i18n/zh-CN.json b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100755 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/startup/startup_standard/systemparamter/src/main/js/MainAbility/pages/index/index.css b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/MainAbility/pages/index/index.css old mode 100644 new mode 100755 similarity index 100% rename from startup/startup_standard/systemparamter/src/main/js/MainAbility/pages/index/index.css rename to hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/MainAbility/pages/index/index.css diff --git a/time/TimerTest_js/src/main/js/default/pages/index/index.hml b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/MainAbility/pages/index/index.hml old mode 100644 new mode 100755 similarity index 100% rename from time/TimerTest_js/src/main/js/default/pages/index/index.hml rename to hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/MainAbility/pages/index/index.hml diff --git a/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/MainAbility/pages/index/index.js b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/MainAbility/pages/index/index.js new file mode 100755 index 0000000000000000000000000000000000000000..152a4ed733ad9f51f9b906227fe1362ca5ae2960 --- /dev/null +++ b/hiviewdfx/hiappeventtest/hiappeventsubjstest/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/hiappeventtest/hiappeventsubjstest/src/main/js/TestAbility/app.js b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/TestAbility/app.js new file mode 100755 index 0000000000000000000000000000000000000000..d5ee271df29e516d1c8929054283e5f2bf5c981c --- /dev/null +++ b/hiviewdfx/hiappeventtest/hiappeventsubjstest/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/hiappeventtest/hiappeventsubjstest/src/main/js/TestAbility/i18n/en-US.json b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/TestAbility/i18n/en-US.json new file mode 100755 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/hiviewdfx/hiappeventtest/hiappeventsubjstest/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/hiappeventtest/hiappeventsubjstest/src/main/js/TestAbility/i18n/zh-CN.json b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100755 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/hiviewdfx/hiappeventtest/hiappeventsubjstest/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/hiappeventtest/hiappeventsubjstest/src/main/js/TestAbility/pages/index/index.css b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/TestAbility/pages/index/index.css new file mode 100755 index 0000000000000000000000000000000000000000..b21c92c6290ea747bd891e2ab673721afc5521ed --- /dev/null +++ b/hiviewdfx/hiappeventtest/hiappeventsubjstest/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/hiappeventtest/hiappeventsubjstest/src/main/js/TestAbility/pages/index/index.hml b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/TestAbility/pages/index/index.hml new file mode 100755 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/TestAbility/pages/index/index.js b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/TestAbility/pages/index/index.js new file mode 100755 index 0000000000000000000000000000000000000000..d94b75c085fa1c16a0b2721609b18c57a7295476 --- /dev/null +++ b/hiviewdfx/hiappeventtest/hiappeventsubjstest/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/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100755 index 0000000000000000000000000000000000000000..b9e78ce7cf73f1ade6ba52a408a44e33f5430f0d --- /dev/null +++ b/hiviewdfx/hiappeventtest/hiappeventsubjstest/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/hiappeventtest/hiappeventsubjstest/src/main/js/test/HiAppEventSub.test.js b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/test/HiAppEventSub.test.js new file mode 100755 index 0000000000000000000000000000000000000000..41f820a6e80b43bf8b5ee55b780129f54ffc54a2 --- /dev/null +++ b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/test/HiAppEventSub.test.js @@ -0,0 +1,2013 @@ +/* + * 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 HiAppEvent from '@ohos.hiAppEvent' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' +import Constant from 'deccjsunit/src/Constant' + +export default function HiAppEventSubTest() { +describe('HiAppEventSubTest', function () { + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_0100 + * @tc.name 验证调用hiAppEvent.addWatcher,添加watcher为string类型,事件订阅成功,使用function可自动分发事件 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub01', 3, async function (done) { + console.info('testHiAppEventSub01 start') + let result = HiAppEvent.addWatcher({ + name: "watcher1", + triggerCondition: { + row: 1 + }, + + onTrigger: function (curRow, curSize, holder) { + expect(holder != null).assertTrue(); + + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + console.info("HiAppEventSub_result" + result) + expect(result != null).assertTrue(); + + setTimeout(() => { + HiAppEvent.write("test_event1", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub01 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub01 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + }, 500) + + setTimeout(() => { + HiAppEvent.write("test_event1", HiAppEvent.EventType.STATISTIC, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub01 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub01 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + }, 1000) + + setTimeout(() => { + HiAppEvent.write("test_event1", HiAppEvent.EventType.SECURITY, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub01 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub01 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + }, 1500) + setTimeout(() => { + HiAppEvent.write("test_event1", HiAppEvent.EventType.BEHAVIOR, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub01 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub01 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + }, 2000) + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub01 end') + }, 4000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_0200 + * @tc.name 验证调用hiAppEvent.addWatcher,添加watcher为string类型,事件订阅成功,使用function可自动分发事件 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub02', 3, async function (done) { + console.info('testHiAppEventSub02 start') + function sleep(numberMillis) { + var now = new Date(); + var exitTime = now.getTime() + numberMillis; + while (true) { + now = new Date(); + if (now.getTime() > exitTime) + return; + } + } + let holder = HiAppEvent.addWatcher({ + name: "watcher2", + }); + HiAppEvent.write("test_event2", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub02 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub02 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event2", HiAppEvent.EventType.STATISTIC, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub02 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub02 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event2", HiAppEvent.EventType.SECURITY, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub09 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub02 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event2", HiAppEvent.EventType.BEHAVIOR, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub02 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub02 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + sleep(3000) + if (holder != null) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + return; + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher2"}) + done() + console.info('HiAppEventSub02 end') + }, 5000) + + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_0300 + * @tc.name 验证调用hiAppEvent.addWatcher,添加watcher为int类型,事件订阅失败 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub03', 3, async function (done) { + console.info('testHiAppEventSub03 start') + let result = HiAppEvent.addWatcher({ + name: 123, + appEventFilters: [ + { + domain: "default", + eventTypes: [HiAppEvent.EventType.FAULT] + } + ], + triggerCondition: { + row: 1 + }, + + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + console.info("HiAppEventSub_result" + result) + expect(result == null).assertTrue(); + HiAppEvent.write("test_event3", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub03 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub03 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event3", HiAppEvent.EventType.STATISTIC, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub03 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub03 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event3", HiAppEvent.EventType.SECURITY, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub03 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub03 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event3", HiAppEvent.EventType.BEHAVIOR, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub03 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub03 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub03 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_0400 + * @tc.name 验证调用hiAppEvent.addWatcher,添加watcher为bool类型,事件订阅失败 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub04', 3, async function (done) { + console.info('testHiAppEventSub04 start') + let result = HiAppEvent.addWatcher({ + name: true, + appEventFilters: [ + { + domain: "default", + eventTypes: [HiAppEvent.EventType.FAULT] + } + ], + triggerCondition: { + row: 1 + }, + + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result == null).assertTrue();; + HiAppEvent.write("test_event4", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub04 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub04 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event4", HiAppEvent.EventType.STATISTIC, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub04 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub04 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event4", HiAppEvent.EventType.SECURITY, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub04 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub04 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event4", HiAppEvent.EventType.BEHAVIOR, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub04 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub04 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub04 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_0500 + * @tc.name 验证调用hiAppEvent.addWatcher,无watcher,事件订阅失败 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub05', 3, async function (done) { + console.info('testHiAppEventSub05 start') + let result = HiAppEvent.addWatcher({ + appEventFilters: [ + { + domain: "default", + } + ], + triggerCondition: { + row: 0 + }, + + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result == null).assertTrue(); + HiAppEvent.write("test_event5", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub05 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub05 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event5", HiAppEvent.EventType.STATISTIC, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub05 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub05 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event5", HiAppEvent.EventType.SECURITY, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub05 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub05 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event5", HiAppEvent.EventType.BEHAVIOR, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub05 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub05 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub05 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_0600 + * @tc.name 验证调用hiAppEvent.addWatcher,添加domain为有效,事件订阅成功 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub06', 3, async function (done) { + console.info('testHiAppEventSub06 start') + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + domain: "default" + } + ], + triggerCondition: { + row: 1 + }, + + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + // expect().assertFail() + console.info("HiAppEventSub_result6:" + eventPkg) + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event6", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub06 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub06 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event6", HiAppEvent.EventType.STATISTIC, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub06 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub06 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event6", HiAppEvent.EventType.SECURITY, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub06 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub06 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event6", HiAppEvent.EventType.BEHAVIOR, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub06 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub06 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub06 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_0700 + * @tc.name 验证调用hiAppEvent.addWatcher,domain为空,事件订阅失败 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub07', 3, async function (done) { + console.info('testHiAppEventSub07 start') + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + domain: "" + } + ], + triggerCondition: { + row: 1, + size: 1, + timeOut: 1 + }, + + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result == null).assertTrue(); + HiAppEvent.write("test_event7", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub07 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub07 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub07 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_0800 + * @tc.name 验证调用hiAppEvent.addWatcher,domain为无效,事件订阅失败 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub08', 3, async function (done) { + console.info('testHiAppEventSub08 start') + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + domain: "default1" + } + ], + triggerCondition: { + row: 1, + size: 1, + timeOut: 1 + }, + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + console.info("HiAppEventSub_result" + result) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event8", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub08 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub08 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub08 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_0900 + * @tc.name 验证调用hiAppEvent.addWatcher,设置domain,eventType为FAULT,事件订阅成功 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub09', 3, async function (done) { + console.info('testHiAppEventSub09 start') + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + domain: "default", + eventTypes: [HiAppEvent.EventType.FAULT] + } + ], + triggerCondition: { + row: 1 + }, + + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + console.info("HiAppEventSub_result" + result) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event9", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub09 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub09 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event9", HiAppEvent.EventType.STATISTIC, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub09 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub09 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event9", HiAppEvent.EventType.SECURITY, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub09 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub09 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event9", HiAppEvent.EventType.BEHAVIOR, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub09 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub09 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub09 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_1000 + * @tc.name 验证调用hiAppEvent.addWatcher,设置domain,eventType为STATISTIC,事件订阅成功 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub10', 3, async function (done) { + console.info('testHiAppEventSub10 start') + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + domain: "default", + eventTypes: [HiAppEvent.EventType.STATISTIC] + } + ], + triggerCondition: { + row: 1 + }, + + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event10", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub10 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub10 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event10", HiAppEvent.EventType.STATISTIC, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub10 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub10 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event10", HiAppEvent.EventType.SECURITY, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub10 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub10 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event10", HiAppEvent.EventType.BEHAVIOR, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub10 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub10 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub10 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_1100 + * @tc.name 验证调用hiAppEvent.addWatcher,设置domain,eventType为SECURITY,事件订阅成功 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub11', 3, async function (done) { + console.info('testHiAppEventSub11 start') + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + domain: "default", + eventTypes: [HiAppEvent.EventType.SECURITY] + } + ], + triggerCondition: { + size: 1 + }, + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event11", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub11 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub11 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event11", HiAppEvent.EventType.STATISTIC, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub11 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub11 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event11", HiAppEvent.EventType.SECURITY, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub09 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub11 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event11", HiAppEvent.EventType.BEHAVIOR, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub11 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub11 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub11 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_1200 + * 验证调用hiAppEvent.addWatcher,设置domain,eventType为BEHAVIOR,事件订阅成功 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub12', 3, async function (done) { + console.info('testHiAppEventSub12 start') + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + domain: "default", + eventTypes: [HiAppEvent.EventType.BEHAVIOR] + } + ], + triggerCondition: { + size: 1 + }, + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event12", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub12 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub12 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event12", HiAppEvent.EventType.STATISTIC, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub12 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub12 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event12", HiAppEvent.EventType.SECURITY, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub09 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub12 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event12", HiAppEvent.EventType.BEHAVIOR, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub12 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub12 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub12 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_1300 + * @tc.name 验证调用hiAppEvent.addWatcher,设置domain,eventType为4种枚举类型,事件订阅成功 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub13', 3, async function (done) { + console.info('testHiAppEventSub13 start') + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + domain: "default", + eventTypes: [HiAppEvent.EventType.FAULT,HiAppEvent.EventType.STATISTIC, + HiAppEvent.EventType.SECURITY,HiAppEvent.EventType.BEHAVIOR] + } + ], + triggerCondition: { + row: 1 + }, + + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + // expect().assertFail() + console.info("HiAppEventSub_result13:" + eventPkg) + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event13", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub13 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub13 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event13", HiAppEvent.EventType.STATISTIC, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub13 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub13 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event13", HiAppEvent.EventType.SECURITY, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub13 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub13 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event13", HiAppEvent.EventType.BEHAVIOR, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub13 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub13 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub13 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_1400 + * @tc.name 验证调用hiAppEvent.addWatcher,未设置domain,eventType为4种枚举类型,事件订阅失败 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub14', 3, async function (done) { + console.info('testHiAppEventSub14 start') + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + eventTypes: [HiAppEvent.EventType.FAULT,HiAppEvent.EventType.STATISTIC, + HiAppEvent.EventType.SECURITY,HiAppEvent.EventType.BEHAVIOR] + } + ], + triggerCondition: { + row: 1 + }, + + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result == null).assertTrue(); + HiAppEvent.write("test_event14", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub14 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub14 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event14", HiAppEvent.EventType.STATISTIC, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub14 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub14 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event14", HiAppEvent.EventType.SECURITY, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub14 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub14 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event14", HiAppEvent.EventType.BEHAVIOR, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub14 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub14 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub14 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_1500 + * @tc.name 验证调用hiAppEvent.addWatcher,eventType为非法,事件订阅成功 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub15', 3, async function (done) { + console.info('testHiAppEventSub15 start') + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + domain: "default", + eventTypes: [HiAppEvent.EventType.BEHAVIOR+1] + } + ], + triggerCondition: { + row: 1 + }, + + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + return; + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event15", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub15 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub15 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event15", HiAppEvent.EventType.STATISTIC, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub15 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub15 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event15", HiAppEvent.EventType.SECURITY, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub15 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub15 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event15", HiAppEvent.EventType.BEHAVIOR, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub15 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub15 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub15 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_1600 + * @tc.name 验证调用hiAppEvent.addWatcher,设置domain,过滤行数等于打点行数,事件订阅成功 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub16', 3, async function (done) { + console.info('testHiAppEventSub16 start') + function sleep(numberMillis) { + var now = new Date(); + var exitTime = now.getTime() + numberMillis; + while (true) { + now = new Date(); + if (now.getTime() > exitTime) + return; + } + } + let result = HiAppEvent.addWatcher({ + name: "watcher1", + triggerCondition: { + row: 3 + }, + + onTrigger: function (curRow, curSize, holder) { + expect(holder != null).assertTrue(); + + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + return; + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + console.info("HiAppEventSub_result" + result) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event16", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub16 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub16 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event16", HiAppEvent.EventType.STATISTIC, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub16 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub16 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event16", HiAppEvent.EventType.SECURITY, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub16 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub16 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + sleep(3000) + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub16 end') + }, 1000) + }) + + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_1700 + * @tc.name 验证调用hiAppEvent.addWatcher,过滤行数大于打点行数,事件订阅失败 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub17', 3, async function (done) { + console.info('testHiAppEventSub17 start') + function sleep(numberMillis) { + var now = new Date(); + var exitTime = now.getTime() + numberMillis; + while (true) { + now = new Date(); + if (now.getTime() > exitTime) + return; + } + } + let result = HiAppEvent.addWatcher({ + name: "watcher1", + triggerCondition: { + row: 4 + }, + + onTrigger: function (curRow, curSize, holder) { + expect(holder != null).assertTrue(); + + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + return; + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + console.info("HiAppEventSub_result" + result) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event17", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub17 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub17 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event17", HiAppEvent.EventType.STATISTIC, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub17 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub17 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + HiAppEvent.write("test_event1", HiAppEvent.EventType.SECURITY, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub17 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub17 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + sleep(3000) + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub17 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_1800 + * @tc.name 验证调用hiAppEvent.addWatcher,触发条件仅row有效,事件订阅成功 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub18', 3, async function (done) { + console.info('testHiAppEventSub18 start') + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + domain: "default", + eventTypes: [HiAppEvent.EventType.FAULT] + } + ], + triggerCondition: { + row: 1, + size: 0, + timeOut: 0 + }, + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event18", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub18 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub18 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub18 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_1900 + * @tc.name 验证调用hiAppEvent.addWatcher,size=1,事件订阅成功 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub19', 3, async function (done) { + console.info('testHiAppEventSub19 start') + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + domain: "default" + } + ], + triggerCondition: { + size: 1 + }, + + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event19", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub19 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub19 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub19 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_2000 + * @tc.name 验证调用hiAppEvent.addWatcher,size=0,事件订阅失败 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub20', 3, async function (done) { + console.info('testHiAppEventSub20 start') + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + domain: "default" + } + ], + triggerCondition: { + size: 1 + }, + + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event20", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub20 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub20 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub20 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_2100 + * @tc.name 验证调用hiAppEvent.addWatcher,触发条件仅size有效,事件订阅成功 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub21', 3, async function (done) { + console.info('testHiAppEventSub21 start') + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + domain: "default", + eventTypes: [HiAppEvent.EventType.FAULT] + } + ], + triggerCondition: { + row: 0, + size: 1, + timeOut: 0 + }, + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event21", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub21 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub21 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub21 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_2200 + * @tc.name 验证调用hiAppEvent.addWatcher,timeout=1,事件订阅成功 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub22', 3, async function (done) { + console.info('testHiAppEventSub22 start') + function sleep(numberMillis) { + var now = new Date(); + var exitTime = now.getTime() + numberMillis; + while (true) { + now = new Date(); + if (now.getTime() > exitTime) + return; + } + } + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + domain: "default", + eventTypes: [HiAppEvent.EventType.FAULT] + } + ], + triggerCondition: { + timeOut: 1 + }, + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event22", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub22 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub22 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + sleep(30000) + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub22 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_2300 + * @tc.name 验证调用hiAppEvent.addWatcher,timeout=0,事件订阅失败 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub23', 3, async function (done) { + console.info('testHiAppEventSub23 start') + function sleep(numberMillis) { + var now = new Date(); + var exitTime = now.getTime() + numberMillis; + while (true) { + now = new Date(); + if (now.getTime() > exitTime) + return; + } + } + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + domain: "default", + eventTypes: [HiAppEvent.EventType.FAULT] + } + ], + triggerCondition: { + timeOut: 0 + }, + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event23", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub23 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub23 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + sleep(1000) + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub23 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_2400 + * @tc.name 验证调用hiAppEvent.addWatcher,未设置触发条件,事件订阅失败 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub24', 3, async function (done) { + console.info('testHiAppEventSub24 start') + function sleep(numberMillis) { + var now = new Date(); + var exitTime = now.getTime() + numberMillis; + while (true) { + now = new Date(); + if (now.getTime() > exitTime) + return; + } + } + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + domain: "default", + eventTypes: [HiAppEvent.EventType.FAULT] + } + ], + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event24", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub24 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub24 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + sleep(1000) + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub24 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_2800 + * @tc.name 验证调用hiAppEvent.addWatcher,触发条件仅timeout有效,事件订阅成功 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub28', 3, async function (done) { + console.info('testHiAppEventSub28 start') + function sleep(numberMillis) { + var now = new Date(); + var exitTime = now.getTime() + numberMillis; + while (true) { + now = new Date(); + if (now.getTime() > exitTime) + return; + } + } + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + domain: "default", + eventTypes: [HiAppEvent.EventType.FAULT] + } + ], + triggerCondition: { + row: 0, + size: 0, + timeOut: 1 + }, + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event28", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub28 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub28 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + sleep(30000) + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub28 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_2900 + * @tc.name 验证调用hiAppEvent.addWatcher,size=1,事件订阅成功 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub29', 3, async function (done) { + console.info('testHiAppEventSub29 start') + let result = HiAppEvent.addWatcher({ + name: "watcher1", + appEventFilters: [ + { + domain: "default" + } + ], + triggerCondition: { + size: 0 + }, + + onTrigger: function (curRow, curSize, holder) { + let eventPkg = holder.takeNext(); + if (eventPkg == null) { + expect().assertFail() + } + console.info("eventPkg.packageId=" + eventPkg.packageId); + console.info("eventPkg.row=" + eventPkg.row); + console.info("eventPkg.size=" + eventPkg.size); + for (const eventInfo of eventPkg.data) { + console.info("eventPkg.data=" + eventInfo); + } + expect(true).assertTrue() + } + }) + expect(result != null).assertTrue(); + HiAppEvent.write("test_event29", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub29 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub29 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + console.info('HiAppEventSub29 end') + }, 1000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_2500 + * @tc.name 验证调用removeWatcher,watcher为已有watcher,订阅者、相关订阅事件删除成功 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub25', 3, async function (done) { + console.info('testHiAppEventSub25 start') + let holder = HiAppEvent.addWatcher({ + name: "watcher1", + }); + setTimeout(() => { + HiAppEvent.write("test_event25", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub25 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub25 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + done() + }, 500) + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher1"}) + done() + }, 1000) + + setTimeout(() => { + expect(holder == null).assertTrue(); + done() + console.info('HiAppEventSub25 end') + }, 2000) + + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_2600 + * @tc.name 验证调用removeWatcher,watcher无效,订阅者、相关订阅事件删除失败 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub26', 3, async function (done) { + console.info('testHiAppEventSub26 start') + let holder = HiAppEvent.addWatcher({ + name: "watcher1", + }); + setTimeout(() => { + HiAppEvent.write("test_event26", HiAppEvent.EventType.FAULT, {"key_int":100}, + (err, value) => { + console.log('HiAppEvent into json-callback'); + if (err) { + console.error(`HiAppEventSub26 json-callback-error code=${err.code}`); + expect(err.code == -1).assertFail(); + } else { + console.log(`HiAppEventSub26 json-callback-success value=${value}`); + expect(value == 0).assertTrue(); + } + }); + done() + }, 500) + + setTimeout(() => { + HiAppEvent.removeWatcher({"name":"watcher2"}) + done() + }, 1000) + + setTimeout(() => { + expect(holder != null).assertTrue(); + done() + console.info('HiAppEventSub26 end') + }, 2000) + }) + + /** + * @tc.number DFX_DFT_HiAppEvent_Sub_2700 + * @tc.name 验证清理接口功能 + * @tc.desc HiAppEvent write interface test. + */ + it('HiAppEventSub27', 3, function () { + console.info('testHiAppEventSub27 start') + HiAppEvent.clearData() + expect(true).assertTrue() + console.info('HiAppEventSub27 end') + }) +}) +} \ No newline at end of file diff --git a/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/test/List.test.js b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/js/test/List.test.js new file mode 100755 index 0000000000000000000000000000000000000000..54d8f5ec188ada4642f0a8c59211bc0526949cff --- /dev/null +++ b/hiviewdfx/hiappeventtest/hiappeventsubjstest/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 HiAppEventSubTest from './HiAppEventSub.test.js' +export default function testsuite() { +HiAppEventSubTest() +} diff --git a/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/resources/base/element/string.json b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..891c0242dbcf38cf419253886e5e8bcea23ef339 --- /dev/null +++ b/hiviewdfx/hiappeventtest/hiappeventsubjstest/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/hiappeventtest/hiappeventsubjstest/src/main/resources/base/media/icon.png b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/hiviewdfx/hiappeventtest/hiappeventsubjstest/src/main/resources/base/media/icon.png differ diff --git a/hiviewdfx/hicheckertest/hicheckerjstest/src/main/config.json b/hiviewdfx/hicheckertest/hicheckerjstest/src/main/config.json index 9f0f79c18674d362860690ca5cd65269c11ef023..af38e2640854fe73bb1363b5647f0fa2c9b63b36 100644 --- a/hiviewdfx/hicheckertest/hicheckerjstest/src/main/config.json +++ b/hiviewdfx/hicheckertest/hicheckerjstest/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.hichecker.test", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/hiviewdfx/hidebugtest/hidebugtestjstest/src/main/config.json b/hiviewdfx/hidebugtest/hidebugtestjstest/src/main/config.json index efb3a56fd14fe4302aabb179add8560b6b8e6acd..fdffa7e5a6f0fb1eb6ef7320d6483eac78e8682a 100644 --- a/hiviewdfx/hidebugtest/hidebugtestjstest/src/main/config.json +++ b/hiviewdfx/hidebugtest/hidebugtestjstest/src/main/config.json @@ -16,6 +16,7 @@ "package": "com.hidebug.test", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/hiviewdfx/hilogtest/hilogdomainofftest/BUILD.gn b/hiviewdfx/hilogtest/hilogdomainofftest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..cf5e3685283d66e25b13e3a86fbff470fbedddb8 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/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("ActsHilogDomainOffJsTest") { + hap_profile = "./src/main/config.json" + deps = [ + ":hilog_js_assets", + ":hilog_resources", + ] + + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsHilogDomainOffJsTest" +} +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/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..579abdb22b78bfbba7e9a42fc8eebbd4cd76b9a5 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/config.json @@ -0,0 +1,94 @@ +{ + "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": [ + "default", + "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/hilogdomainofftest/src/main/js/MainAbility/app.js b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..4b241cccbaa71f0c5cbd9e7dc437a0feb224c7d5 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/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/hilogdomainofftest/src/main/js/MainAbility/i18n/en-US.json b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/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/hilogdomainofftest/src/main/js/MainAbility/i18n/zh-CN.json b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/time/TimeTest_js/src/main/js/default/pages/index/index.css b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/pages/index/index.css similarity index 100% rename from time/TimeTest_js/src/main/js/default/pages/index/index.css rename to hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/pages/index/index.css diff --git a/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/pages/index/index.hml b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $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/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/app.js b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..d5ee271df29e516d1c8929054283e5f2bf5c981c --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/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/hilogdomainofftest/src/main/js/TestAbility/i18n/en-US.json b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/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/hilogdomainofftest/src/main/js/TestAbility/i18n/zh-CN.json b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/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/hilogdomainofftest/src/main/js/TestAbility/pages/index/index.css b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b21c92c6290ea747bd891e2ab673721afc5521ed --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/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/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/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/pages/index/index.js b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d94b75c085fa1c16a0b2721609b18c57a7295476 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/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/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 0000000000000000000000000000000000000000..b9e78ce7cf73f1ade6ba52a408a44e33f5430f0d --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/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/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/hiviewdfx/hilogtest/hilogdomainofftest/src/main/resources/base/element/string.json b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..8ebd2d726f1e3f1c99efda585ced2c2c18ca3857 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainofftest/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/hilogdomainofftest/src/main/resources/base/media/icon.png b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/hiviewdfx/hilogtest/hilogdomainofftest/src/main/resources/base/media/icon.png differ 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..540f2b2a48d0597c8267d5f79b8f50252f016dbe --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/src/main/config.json @@ -0,0 +1,94 @@ +{ + "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": [ + "default", + "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/time/TimerTest_js/src/main/js/default/pages/index/index.css b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/pages/index/index.css similarity index 100% rename from time/TimerTest_js/src/main/js/default/pages/index/index.css rename to hiviewdfx/hilogtest/hilogdomainontest/src/main/js/MainAbility/pages/index/index.css 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/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/pages/index/index.js b/hiviewdfx/hilogtest/hilogdomainontest/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d94b75c085fa1c16a0b2721609b18c57a7295476 --- /dev/null +++ b/hiviewdfx/hilogtest/hilogdomainontest/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/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/hiviewdfx/hilogtest/hilogjstest/src/main/config.json b/hiviewdfx/hilogtest/hilogjstest/src/main/config.json index ad5d56e253b6662e4897d2593f9a94c05aded131..fb41df3dda2777cb3b6aa5037942bc7967cdc1f9 100755 --- a/hiviewdfx/hilogtest/hilogjstest/src/main/config.json +++ b/hiviewdfx/hilogtest/hilogjstest/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.hiviewdfx.hilog.function", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/hiviewdfx/hilogtest/hilogjstest/src/main/js/test/HilogJsTest.js b/hiviewdfx/hilogtest/hilogjstest/src/main/js/test/HilogJsTest.js index d66ab9915373d59470058a28cac8c6e18f16668e..a14697daeb358713b854ef3002703385b38b0814 100644 --- a/hiviewdfx/hilogtest/hilogjstest/src/main/js/test/HilogJsTest.js +++ b/hiviewdfx/hilogtest/hilogjstest/src/main/js/test/HilogJsTest.js @@ -119,7 +119,7 @@ describe('HilogJsTest', function () { */ it('testHilogJsApi06', 2, function () { console.info('testHilogJsApi06 start'); - const res = hilog.isLoggable(0xD001400, "HILOGTEST", hilog.LogLevel.DEBUG); + const res = hilog.isLoggable(0x3200, "HILOGTEST", hilog.LogLevel.DEBUG); expect(res).assertEqual(false); console.info('testHilogJsApi06 end'); }) @@ -131,7 +131,7 @@ describe('HilogJsTest', function () { */ it('testHilogJsApi07', 2, function () { console.info('testHilogJsApi07 start'); - const res = hilog.isLoggable(0xD001400, "HILOGTEST", hilog.LogLevel.DEBUG); + const res = hilog.isLoggable(0x3200, "HILOGTEST", hilog.LogLevel.DEBUG); var tag = ""; for (var i = 0; i < 1000; i++){ tag += "HILOGTEST" @@ -147,7 +147,7 @@ describe('HilogJsTest', function () { */ it('testHilogJsApi08', 2, function () { console.info('testHilogJsApi08 start'); - const res = hilog.isLoggable(0xD001400, "", hilog.LogLevel.DEBUG); + const res = hilog.isLoggable(0x3200, "", hilog.LogLevel.DEBUG); expect(res).assertEqual(false); console.info('testHilogJsApi08 end'); }) @@ -159,7 +159,7 @@ describe('HilogJsTest', function () { */ it('testHilogJsApi09', 2, function () { console.info('testHilogJsApi09 start'); - const res = hilog.isLoggable(0xD001400, "HILOGTEST", hilog.LogLevel.ERROR); + const res = hilog.isLoggable(0x3200, "HILOGTEST", hilog.LogLevel.ERROR); expect(res).assertEqual(true); console.info('testHilogJsApi09 end'); }) @@ -171,7 +171,7 @@ describe('HilogJsTest', function () { */ it('testHilogJsApi10', 2, function () { console.info('testHilogJsApi10 start'); - const res = hilog.isLoggable(0xD001400, "HILOGTEST", hilog.LogLevel.FATAL); + const res = hilog.isLoggable(0x3200, "HILOGTEST", hilog.LogLevel.FATAL); expect(res).assertEqual(true); console.info('testHilogJsApi10 end'); }) @@ -183,7 +183,7 @@ describe('HilogJsTest', function () { */ it('testHilogJsApi11', 2, function () { console.info('testHilogJsApi11 start'); - const res = hilog.isLoggable(0xD001400, "HILOGTEST", hilog.LogLevel.INFO); + const res = hilog.isLoggable(0x3200, "HILOGTEST", hilog.LogLevel.INFO); expect(res).assertEqual(true); console.info('testHilogJsApi11 end'); }) @@ -195,7 +195,7 @@ describe('HilogJsTest', function () { */ it('testHilogJsApi12', 2, function () { console.info('testHilogJsApi12 start'); - const res = hilog.isLoggable(0xD001400, "HILOGTEST", hilog.LogLevel.WARN); + const res = hilog.isLoggable(0x3200, "HILOGTEST", hilog.LogLevel.WARN); expect(res).assertEqual(true); console.info('testHilogJsApi12 end'); }) @@ -207,7 +207,7 @@ describe('HilogJsTest', function () { */ it('testHilogJsApi13', 2, function () { console.info('testHilogJsApi13 start'); - const res = hilog.isLoggable(0xD001400, "HILOGTEST", 100); + const res = hilog.isLoggable(0x3200, "HILOGTEST", 100); expect(res).assertEqual(false); console.info('testHilogJsApi13 end'); }) @@ -231,7 +231,7 @@ describe('HilogJsTest', function () { */ it('testHilogJsApi15', 2, function () { console.info('testHilogJsApi15 start'); - const res = hilog.isLoggable(0xFFFFFFF, "HILOGTEST", hilog.LogLevel.WARN); + const res = hilog.isLoggable(0x3200, "HILOGTEST", hilog.LogLevel.WARN); expect(res).assertEqual(true); console.info('testHilogJsApi15 end'); }) @@ -244,7 +244,7 @@ describe('HilogJsTest', function () { it('testHilogJsApi16', 2, function () { console.info('testHilogJsApi16 start'); try{ - hilog.info(0x3200, "HILOGTEST", "%{public}s", ['hilogJs1800']) + hilog.debug(0x3200, "HILOGTEST", "%{public}s", ['hilogJs1800']) }catch(error){ console.log(`testHilogJsApi16 got an error: ${JSON.stringify(error)}`) expect().assertFail(); @@ -260,7 +260,7 @@ describe('HilogJsTest', function () { it('testHilogJsApi17', 2, function () { console.info('testHilogJsApi17 start'); try{ - hilog.info(x3200, "HILOGTEST", "%{public}f", [2.1]) + hilog.debug(0x3200, "HILOGTEST", "%{public}d", [2.1]) }catch(error){ console.log(`testHilogJsApi17 got an error: ${JSON.stringify(error)}`) expect().assertFail(); @@ -276,7 +276,7 @@ describe('HilogJsTest', function () { it('testHilogJsApi18', 2, function () { console.info('testHilogJsApi18 start'); try{ - hilog.info(x3200, "HILOGTEST", "%{public}d", [65535]) + hilog.debug(0x3200, "HILOGTEST", "%{public}d", [65535]) }catch(error){ console.log(`testHilogJsApi18 got an error: ${JSON.stringify(error)}`) expect().assertFail(); @@ -292,7 +292,7 @@ describe('HilogJsTest', function () { it('testHilogJsApi19', 2, function () { console.info('testHilogJsApi19 start'); try{ - hilog.info(x3200, "HILOGTEST", "%{public}s", ["hilog info"]) + hilog.debug(0x3200, "HILOGTEST", "%{public}s", ["hilog info"]) }catch(error){ console.log(`testHilogJsApi19 got an error: ${JSON.stringify(error)}`) expect().assertFail(); @@ -308,7 +308,7 @@ describe('HilogJsTest', function () { it('testHilogJsApi20', 2, function () { console.info('testHilogJsApi20 start'); try{ - hilog.info(0x3200, "HILOGTEST", "%{public}d", [2147483647]) + hilog.debug(0x3200, "HILOGTEST", "%{public}d", [2147483647]) }catch(error){ console.log(`testHilogJsApi20 got an error: ${JSON.stringify(error)}`) expect().assertFail(); @@ -324,7 +324,7 @@ describe('HilogJsTest', function () { it('testHilogJsApi21', 2, function () { console.info('testHilogJsApi21 start'); try{ - hilog.info(0x3200, "HILOGTEST", "%{public}s", ["100%s%d%x%f"]) + hilog.debug(0x3200, "HILOGTEST", "%{public}s", ["100%s%d%x%f"]) }catch(error){ console.log(`testHilogJsApi21 got an error: ${JSON.stringify(error)}`) expect().assertFail(); @@ -341,7 +341,7 @@ describe('HilogJsTest', function () { it('testHilogJsApi22', 2, function () { console.info('testHilogJsApi22 start'); try{ - hilog.info(0x3200, "HILOGTEST", "%{public}s", ["65536"]) + hilog.debug(0x3200, "HILOGTEST", "%{public}s", ["65536"]) }catch(error){ console.log(`testHilogJsApi22 got an error: ${JSON.stringify(error)}`) expect().assertFail(); @@ -357,8 +357,8 @@ describe('HilogJsTest', function () { it('testHilogJsApi23', 2, function () { console.info('testHilogJsApi23 start'); try{ - hilog.info(0x3200, "HILOGTEST", "username:%{public}s, password:%{private}s.", ["username", "password"]) - hilog.info(0x3200, "HILOGTEST", "username:%{public}s, password:%s.", ["username123", "password"]) + hilog.debug(0x3200, "HILOGTEST", "username:%{public}s, password:%{private}s.", ["username", "password"]) + hilog.debug(0x3200, "HILOGTEST", "username:%{public}s, password:%s.", ["username123", "password"]) }catch(error){ console.log(`testHilogJsApi23 got an error: ${JSON.stringify(error)}`) expect().assertFail(); @@ -374,7 +374,7 @@ describe('HilogJsTest', function () { it('testHilogJsApi24', 2, function () { console.info('testHilogJsApi24 start'); try{ - hilog.info(0x3200, "HILOGTEST", "%{public}s", ["hilog public"]) + hilog.debug(0x3200, "HILOGTEST", "%{public}s", ["hilog public"]) }catch(error){ console.log(`testHilogJsApi24 got an error: ${JSON.stringify(error)}`) expect().assertFail(); @@ -390,7 +390,7 @@ describe('HilogJsTest', function () { it('testHilogJsApi25', 2, function () { console.info('testHilogJsApi25 start'); try{ - hilog.info(0x3200, "HILOGTEST", "%{nopublic}s", ["Hilogtest"]) + hilog.debug(0x3200, "HILOGTEST", "%{nopublic}s", ["Hilogtest"]) }catch(error){ console.log(`testHilogJsApi25 got an error: ${JSON.stringify(error)}`) expect().assertFail(); diff --git a/hiviewdfx/hilogtest/hilogndktest/BUILD.gn b/hiviewdfx/hilogtest/hilogndktest/BUILD.gn index 430677e4dc09ab973d9decaa83f7511f29d19e36..133a0b8e45e2a366a8496420f7d505a445851a5d 100755 --- a/hiviewdfx/hilogtest/hilogndktest/BUILD.gn +++ b/hiviewdfx/hilogtest/hilogndktest/BUILD.gn @@ -24,10 +24,10 @@ config("hilogndktest_config") { ohos_moduletest_suite("ActsHilogndkTest") { module_out_path = module_output_path sources = [ "hilogndktest.cpp" ] + external_deps = [ "c_utils:utils" ] deps = [ "//base/hiviewdfx/hilog/frameworks/hilog_ndk:hilog_ndk", "//base/hiviewdfx/hilog/interfaces/native/kits:libhilog_ndk", - "//commonlibrary/c_utils/base:utils", "//third_party/googletest:gtest_main", ] configs = [ ":hilogndktest_config" ] diff --git a/hiviewdfx/hisyseventtest/hisyseventjstest/src/main/config.json b/hiviewdfx/hisyseventtest/hisyseventjstest/src/main/config.json index 03c95fd371d2ad069cb698c6b6577ae978e67be3..8ed0cece157840c76b63bee66cc4239b381a474b 100755 --- a/hiviewdfx/hisyseventtest/hisyseventjstest/src/main/config.json +++ b/hiviewdfx/hisyseventtest/hisyseventjstest/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.hiviewdfx.hisysevent.function", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/hiviewdfx/hisyseventtest/hisyseventjstest/src/main/js/test/HiSysEvent.test.js b/hiviewdfx/hisyseventtest/hisyseventjstest/src/main/js/test/HiSysEvent.test.js index 723cb93332ec1309c4dea6cefc6da7c1d4791215..952b1a079b81a190f978da99b0e03538da5dcfc3 100644 --- a/hiviewdfx/hisyseventtest/hisyseventjstest/src/main/js/test/HiSysEvent.test.js +++ b/hiviewdfx/hisyseventtest/hisyseventjstest/src/main/js/test/HiSysEvent.test.js @@ -48,7 +48,7 @@ describe('hiSysEventJsTest', function () { console.log('HiSysEvent into json-callback'); if (err) { console.error(`HiSysEvent json-callback-error code=${err.code}`); - expect().assertFail(); + expect(err.code == 0).assertFail(); done(); } else { console.log(`HiSysEvent json-callback-success value=${value}`); @@ -76,6 +76,11 @@ describe('hiSysEventJsTest', function () { expect(value == 0).assertTrue(); done(); } + ).catch( + (err) => { + console.error(`HiSysEvent json-callback-error code=${err.code}`); + expect(err.code == 0).assertFail(); + } ) console.info('testHiSysEventApi02 end') }) @@ -95,7 +100,7 @@ describe('hiSysEventJsTest', function () { console.log('HiSysEvent into json-callback'); if (err) { console.error(`HiSysEvent json-callback-error code=${err.code}`); - expect().assertFail(); + expect(err.code == 0).assertFail(); done(); } else { console.log(`HiSysEvent json-callback-success value=${value}`); @@ -114,14 +119,14 @@ describe('hiSysEventJsTest', function () { it('testHiSysEventApi05', 3, async function (done) { console.info('testHiSysEventApi05 start') hiSysEvent.write({ - domain: "RELIABILITY", - name: "STACK", + domain: "HIVIEWDFX", + name: "PLUGIN_STATS", eventType: hiSysEvent.EventType.STATISTIC, },(err, value) => { console.log('HiSysEvent into json-callback'); if (err) { console.error(`HiSysEvent json-callback-error code=${err.code}`); - expect().assertFail(); + expect(err.code == 0).assertFail(); done(); } else { console.log(`HiSysEvent json-callback-success value=${value}`); @@ -140,14 +145,14 @@ describe('hiSysEventJsTest', function () { it('testHiSysEventApi06', 3, async function (done) { console.info('testHiSysEventApi06 start') hiSysEvent.write({ - domain: "RELIABILITY", - name: "STACK", + domain: "ACCOUNT", + name: "PERMISSION_EXCEPTION", eventType: hiSysEvent.EventType.SECURITY, },(err, value) => { console.log('HiSysEvent into json-callback'); if (err) { console.error(`HiSysEvent json-callback-error code=${err.code}`); - expect().assertFail(); + expect(err.code == 0).assertFail(); done(); } else { console.log(`HiSysEvent json-callback-success value=${value}`); @@ -166,14 +171,14 @@ describe('hiSysEventJsTest', function () { it('testHiSysEventApi07', 3, async function (done) { console.info('testHiSysEventApi07 start') hiSysEvent.write({ - domain: "RELIABILITY", - name: "STACK", + domain: "HIVIEWDFX", + name: "PLUGIN_LOAD", eventType: hiSysEvent.EventType.BEHAVIOR, },(err, value) => { console.log('HiSysEvent into json-callback'); if (err) { console.error(`HiSysEvent json-callback-error code=${err.code}`); - expect().assertFail(); + expect(err.code == 0).assertFail(); done(); } else { console.log(`HiSysEvent json-callback-success value=${value}`); @@ -206,7 +211,7 @@ describe('hiSysEventJsTest', function () { console.log('HiSysEvent into json-callback'); if (err) { console.error(`HiSysEvent json-callback-error code=${err.code}`); - expect().assertFail(); + expect(err.code == 0).assertFail(); done(); } else { console.log(`HiSysEvent json-callback-success value=${value}`); @@ -225,8 +230,8 @@ describe('hiSysEventJsTest', function () { it('testHiSysEventApi09', 3, async function (done) { console.info('testHiSysEventApi09 start') hiSysEvent.write({ - domain: "RELIABILITY", - name: "STACK", + domain: "HIVIEWDFX", + name: "PLUGIN_STATS", eventType: hiSysEvent.EventType.STATISTIC, params: { PID: 487, @@ -239,7 +244,7 @@ describe('hiSysEventJsTest', function () { console.log('HiSysEvent into json-callback'); if (err) { console.error(`HiSysEvent json-callback-error code=${err.code}`); - expect().assertFail(); + expect(err.code == 0).assertFail(); done(); } else { console.log(`HiSysEvent json-callback-success value=${value}`); @@ -258,8 +263,8 @@ describe('hiSysEventJsTest', function () { it('testHiSysEventApi10', 3, async function (done) { console.info('testHiSysEventApi10 start') hiSysEvent.write({ - domain: "RELIABILITY", - name: "STACK", + domain: "ACCOUNT", + name: "PERMISSION_EXCEPTION", eventType: hiSysEvent.EventType.SECURITY, params: { PID: 487, @@ -272,7 +277,7 @@ describe('hiSysEventJsTest', function () { console.log('testHiSysEventApi10 into json-callback'); if (err) { console.error(`testHiSysEventApi10 json-callback-error code=${err.code}`); - expect().assertFail(); + expect(err.code == 0).assertFail(); done(); } else { console.log(`testHiSysEventApi10 json-callback-success value=${value}`); @@ -291,8 +296,8 @@ describe('hiSysEventJsTest', function () { it('testHiSysEventApi11', 3, async function (done) { console.info('testHiSysEventApi11 start') hiSysEvent.write({ - domain: "RELIABILITY", - name: "STACK", + domain: "HIVIEWDFX", + name: "PLUGIN_LOAD", eventType: hiSysEvent.EventType.BEHAVIOR, params: { PID: 487, @@ -305,7 +310,7 @@ describe('hiSysEventJsTest', function () { console.log('testHiSysEventApi11 into json-callback'); if (err) { console.error(`testHiSysEventApi11 json-callback-error code=${err.code}`); - expect().assertFail(); + expect(err.code == 0).assertFail(); done(); } else { console.log(`testHiSysEventApi11 json-callback-success value=${value}`); @@ -768,8 +773,8 @@ describe('hiSysEventJsTest', function () { it('testHiSysEventApi24', 1, async function (done) { console.info('testHiSysEventApi24 start') hiSysEvent.write({ - domain: "RELIABILITY", - name: "STACK", + domain: "ACCOUNT", + name: "PERMISSION_EXCEPTION", eventType: hiSysEvent.EventType.SECURITY, params: { PID: 487, @@ -794,8 +799,8 @@ describe('hiSysEventJsTest', function () { endTime: -1, maxEvents: 1, }, [{ - domain: "RELIABILITY", - names: ["STACK"], + domain: "ACCOUNT", + names: ["PERMISSION_EXCEPTION"], }], { onQuery: function (infos, seqs) { console.info(`testHiSysEventApi24: onQuery...`) @@ -840,22 +845,8 @@ describe('hiSysEventJsTest', function () { it('testHiSysEventApi25', 1, async function (done) { console.info('testHiSysEventApi25 start') hiSysEvent.write({ - domain: "AAFWK", - name: "JS_ERROR", - eventType: hiSysEvent.EventType.SECURITY, - },(err, value) => { - console.log('testHiSysEventApi25 into json-callback'); - if (err) { - console.error('in testHiSysEventApi25 test callback: err.code = ' + err.code) - result = err.code - } else { - console.info('in testHiSysEventApi25 test callback: result = ' + value) - result = value; - } - }); - hiSysEvent.write({ - domain: "AAFWK", - name: "LIFECYCLE_TIMEOUT", + domain: "HIVIEWDFX", + name: "SYS_USAGE", eventType: hiSysEvent.EventType.STATISTIC, },(err, value) => { console.log('testHiSysEventApi25 into json-callback'); @@ -867,14 +858,31 @@ describe('hiSysEventJsTest', function () { result = value; } }); + console.info('add second..') + setTimeout(() => { + hiSysEvent.write({ + domain: "HIVIEWDFX", + name: "PLUGIN_STATS", + eventType: hiSysEvent.EventType.STATISTIC, + },(err, value) => { + console.log('testHiSysEventApi25 into json-callback'); + if (err) { + console.error('in testHiSysEventApi25 test callback: err.code = ' + err.code) + result = err.code + } else { + console.info('in testHiSysEventApi25 test callback: result = ' + value) + result = value; + } + }) + },1000) setTimeout(() => { let ret = hiSysEvent.query({ beginTime: -1, endTime: -1, maxEvents: 5, }, [{ - domain: "AAFWK", - names: ["JS_ERROR","LIFECYCLE_TIMEOUT"], + domain: "HIVIEWDFX", + names: ["SYS_USAGE","PLUGIN_STATS"], }], { onQuery: function (infos, seqs) { console.info(`testHiSysEventApi25: onQuery...`) diff --git a/hiviewdfx/hitracechainjstest/src/main/config.json b/hiviewdfx/hitracechainjstest/src/main/config.json index e367dcc620cbee73b33433b8a0e9f21385167edf..65514e171857d6362346fa0b992979b20ef0adf0 100755 --- a/hiviewdfx/hitracechainjstest/src/main/config.json +++ b/hiviewdfx/hitracechainjstest/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.hiviewdfx.hitracechain.function", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/hiviewdfx/hitracechainjstest/src/main/js/test/HiTraceChainJs.test.js b/hiviewdfx/hitracechainjstest/src/main/js/test/HiTraceChainJs.test.js index fd0ffd2e27ee083d527dd625ca0cafcc393f6d61..a83df1c1a2a340e27008d4e9cad8718432e87534 100644 --- a/hiviewdfx/hitracechainjstest/src/main/js/test/HiTraceChainJs.test.js +++ b/hiviewdfx/hitracechainjstest/src/main/js/test/HiTraceChainJs.test.js @@ -264,7 +264,6 @@ describe('HiTraceJsTest', function () { * @tc.feature DFX_DFT_Hitrace * @tc.level Level3 * @tc.type FUNC - * @tc.author chenxuhui */ it('testHitraceApi10', 0, async function (done) { console.info('testHitraceApi10 start') @@ -295,7 +294,6 @@ describe('HiTraceJsTest', function () { * @tc.feature DFX_DFT_Hitrace * @tc.level Level3 * @tc.type FUNC - * @tc.author chenxuhui */ it('testHitraceApi11', 0, async function (done) { console.info('testHitraceApi11 start') @@ -330,7 +328,6 @@ describe('HiTraceJsTest', function () { * @tc.feature DFX_DFT_Hitrace * @tc.level Level3 * @tc.type FUNC - * @tc.author chenxuhui */ it('testHitraceApi12', 0, async function (done) { console.info('testHitraceApi12 start') diff --git a/hiviewdfx/hitracechaintest/BUILD.gn b/hiviewdfx/hitracechaintest/BUILD.gn index 7fed38c28565547960f17a3efa3b92220e92e41a..7c7e241a4b6812a97ebe0fa1ed9b0172283c6f67 100644 --- a/hiviewdfx/hitracechaintest/BUILD.gn +++ b/hiviewdfx/hitracechaintest/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/hiviewdfx/hitracechaintest/entry/src/main/config.json b/hiviewdfx/hitracechaintest/entry/src/main/config.json index 57f59d14c7acf6a11edf8adabad6d3fde348c326..4a4bb148dc248d2be5422962fb437594f2d89c7b 100644 --- a/hiviewdfx/hitracechaintest/entry/src/main/config.json +++ b/hiviewdfx/hitracechaintest/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/hiviewdfx/hiview/faultlogger/faultloggerjs/src/main/config.json b/hiviewdfx/hiview/faultlogger/faultloggerjs/src/main/config.json index e3a7da23520448f8a37cb9d5d53db4e8e7b99248..1de6b86ab3944486799c1c50acbb1811ab592dc5 100644 --- a/hiviewdfx/hiview/faultlogger/faultloggerjs/src/main/config.json +++ b/hiviewdfx/hiview/faultlogger/faultloggerjs/src/main/config.json @@ -18,6 +18,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/hiviewdfx/hiview/faultlogger/faultloggerjs/src/main/js/test/faultlogger.test.js b/hiviewdfx/hiview/faultlogger/faultloggerjs/src/main/js/test/faultlogger.test.js index 3d424ce67b5b801f4d4536a912e1c95532b81b07..910c81513810eb1ffc88f79880f51cdb02b2680d 100644 --- a/hiviewdfx/hiview/faultlogger/faultloggerjs/src/main/js/test/faultlogger.test.js +++ b/hiviewdfx/hiview/faultlogger/faultloggerjs/src/main/js/test/faultlogger.test.js @@ -13,7 +13,7 @@ * limitations under the License. */ import faultlogger from '@ohos.faultLogger' - +import hiSysEvent from '@ohos.hiSysEvent' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' export default function FaultlogJsTest() { @@ -47,7 +47,6 @@ describe("FaultlogJsTest", function () { * @tc.name: DFX_DFR_Faultlogger_Interface_0200 * @tc.desc: 检验函数参数输入错误时程序是否会崩溃 * @tc.require: AR000GICT2 - * @tc.author: */ it('DFX_DFR_Faultlogger_Interface_0200', 0, async function (done) { console.info("---------------------------DFX_DFR_Faultlogger_Interface_0200----------------------------------"); @@ -79,7 +78,6 @@ describe("FaultlogJsTest", function () { * @tc.name: DFX_DFR_Faultlogger_Interface_0400 * @tc.desc: 检验promise同步方式获取faultlog CPP_CRASH日志 * @tc.require: AR000GICT2 - * @tc.author: */ it('DFX_DFR_Faultlogger_Interface_0400', 0, async function (done) { console.info("---------------------------DFX_DFR_Faultlogger_Interface_0400----------------------------------"); @@ -138,32 +136,28 @@ describe("FaultlogJsTest", function () { * @tc.name: DFX_DFR_Faultlogger_Interface_0500 * @tc.desc: 检验promise同步方式获取faultlog JS_CRASH日志 * @tc.require: AR000GICT2 - * @tc.author: */ it('DFX_DFR_Faultlogger_Interface_0500', 0, async function (done) { console.info("---------------------------DFX_DFR_Faultlogger_Interface_0500----------------------------------"); try { let now = Date.now(); console.info("DFX_DFR_Faultlogger_Interface_0500 2 + " + now); - const loopTimes = 2; - let i = 0; - let pro = new Promise( - (r, e) => { - setTimeout(function run() { - if (i < loopTimes) { - setTimeout(run, 1001); - } else { - r("done!") - return - } - console.info("--------DFX_DFR_Faultlogger_Interface_0500 3 + " + i + "----------"); - ++i; - let dataStr = ["1", "2"] - console.info(dataStr[2].test); - }, 1001); + hiSysEvent.write({ + domain: "ACE", + name: "JS_ERROR", + eventType: hiSysEvent.EventType.FAULT, + params: { + PID: 487, + UID:103, + PACKAGE_NAME: "com.ohos.faultlogger.test", + PROCESS_NAME: "com.ohos.faultlogger.test", + MSG: "faultlogger testcase test.", + REASON: "faultlogger testcase test." } - ); - await pro; + }).then( + (value) => { + console.log(`HiSysEvent json-callback-success value=${value}`); + }) await msleep(1000); console.info("--------DFX_DFR_Faultlogger_Interface_0500 4" + "----------"); @@ -193,7 +187,6 @@ describe("FaultlogJsTest", function () { * @tc.name: DFX_DFR_Faultlogger_Interface_0300 * @tc.desc: 检验promise同步方式获取faultlog APP_FREEZE日志 * @tc.require: AR000GICT2 - * @tc.author: */ it('DFX_DFR_Faultlogger_Interface_0300', 0, async function (done) { console.info("---------------------------DFX_DFR_Faultlogger_Interface_0300----------------------------------"); @@ -239,7 +232,6 @@ describe("FaultlogJsTest", function () { * @tc.name: DFX_DFR_Faultlogger_Interface_0100 * @tc.desc: 检验通过回调方式获取faultlog日志 * @tc.require: AR000GICT2 - * @tc.author: */ it('DFX_DFR_Faultlogger_Interface_0100', 0, async function (done) { console.info("---------------------------DFX_DFR_Faultlogger_Interface_0100----------------------------------"); @@ -285,4 +277,4 @@ describe("FaultlogJsTest", function () { done(); }) }) -} \ No newline at end of file +} diff --git a/hiviewdfx/utils/native/BUILD.gn b/hiviewdfx/utils/native/BUILD.gn index bea199ec010d9aed056c3fe8398ddf41cfe81b08..f11114e8c3e1b7af7f106396e63c623938abddf0 100755 --- a/hiviewdfx/utils/native/BUILD.gn +++ b/hiviewdfx/utils/native/BUILD.gn @@ -30,9 +30,9 @@ ohos_static_library("utilskit") { configs = [ ":utils_config" ] #external_deps = [ "hilog:libhilog" ] + external_deps = [ "c_utils:utils" ] deps = [ "//base/hiviewdfx/hilog/interfaces/native/innerkits:libhilog", "//base/hiviewdfx/hiview/base:hiviewbase", - "//commonlibrary/c_utils/base:utils", ] } diff --git a/inputmethod/BUILD.gn b/inputmethod/BUILD.gn index 621923e1c1e31e117351a00a9843987e24155314..c14bb038ca6de1cdf73711743ae8c6b9810c86b0 100644 --- a/inputmethod/BUILD.gn +++ b/inputmethod/BUILD.gn @@ -14,5 +14,8 @@ import("//build/ohos_var.gni") group("inputmethod") { testonly = true - deps = [ "InputMethodTest_ets:ActsInputMethodEtsTest" ] + deps = [ + "InputMethodTest_Stage:ActsImeAbilityTest", + "InputMethodTest_ets:ActsInputMethodEtsTest", + ] } diff --git a/inputmethod/InputMethodTest_Stage/AppScope/app.json b/inputmethod/InputMethodTest_Stage/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..154fc890f254298cb556553301ac498d7b308873 --- /dev/null +++ b/inputmethod/InputMethodTest_Stage/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app":{ + "bundleName":"com.acts.imeability.test", + "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":8, + "targetAPIVersion":8, + "car":{ + "apiCompatibleVersion":8, + "singleUser":false + } + } +} diff --git a/inputmethod/InputMethodTest_Stage/AppScope/resources/base/element/string.json b/inputmethod/InputMethodTest_Stage/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ee69f9a861d9dc269ed6638735d52674583498e1 --- /dev/null +++ b/inputmethod/InputMethodTest_Stage/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/inputmethod/InputMethodTest_Stage/AppScope/resources/base/media/app_icon.png b/inputmethod/InputMethodTest_Stage/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/inputmethod/InputMethodTest_Stage/AppScope/resources/base/media/app_icon.png differ diff --git a/inputmethod/InputMethodTest_Stage/BUILD.gn b/inputmethod/InputMethodTest_Stage/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..22bcaf9aff7356c62d2e4f70e75bb1aa64f6639f --- /dev/null +++ b/inputmethod/InputMethodTest_Stage/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsImeAbilityTest") { + hap_profile = "entry/src/main/module.json" + js_build_mode = "debug" + deps = [ + ":IMExtAbility_ets_assets", + ":IMExtAbility_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsImeAbilityTest" + subsystem_name = "inputmethod" + part_name = "imf" +} + +ohos_app_scope("IMExtAbility_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("IMExtAbility_ets_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("IMExtAbility_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":IMExtAbility_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/inputmethod/InputMethodTest_Stage/Test.json b/inputmethod/InputMethodTest_Stage/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..e8d752ab0812ca9d28ef0f4b8a07a50384955e46 --- /dev/null +++ b/inputmethod/InputMethodTest_Stage/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "180000", + "bundle-name": "com.acts.imeability.test", + "module-name": "phone", + "shell-timeout": "600000", + "testcase-timeout": 70000 + }, + "kits": [{ + "test-file-name": [ + "ActsImeAbilityTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }] +} diff --git a/inputmethod/InputMethodTest_Stage/entry/src/main/ets/Application/AbilityStage.ts b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..36a8a495dd6e3323415a2787786eb52eb840a229 --- /dev/null +++ b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("MyAbilityStage onCreate"); + globalThis.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} diff --git a/inputmethod/InputMethodTest_Stage/entry/src/main/ets/ImExtAbility/ImExtAbility.ets b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/ImExtAbility/ImExtAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..91c399cdc4eea149d4fbe98619d67eb3358220f5 --- /dev/null +++ b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/ImExtAbility/ImExtAbility.ets @@ -0,0 +1,80 @@ +/* + * 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 inputMethodExtensionAbility from '@ohos.inputmethodextensionability' + +export default class ImExtAbility extends inputMethodExtensionAbility { + + onCreate(want) { + console.info("inputMethodExtensionAbility onCreate"); + let options = { + windowMode: 0 + } + console.info("inputMethodExtensionAbility want.bundleName is: " + want.bundleName); + console.info("inputMethodExtensionAbility want.moduleName is: " + want.moduleName); + console.info("inputMethodExtensionAbility want.abilityName is: " + want.abilityName); + + console.info("---------------------------1-----------------------------"); + this.context.startAbility(want, (data)=>{ + console.info("startAbility001 inputMethodExtensionAbility start successfully." + JSON.stringify(data)); + }) + + this.context.terminateSelf((err) => { + console.info('startAbility001 terminateSelf success' + JSON.stringify(err)); + }); + + + console.info("---------------------------2-----------------------------"); + this.context.startAbility(want,options,(data) => { + console.info("startAbility002 inputMethodExtensionAbility start successfully." + JSON.stringify(data)); + }) + + this.context.terminateSelf().then((data) => { + console.info("startAbility002 terminateSelf success:." + JSON.stringify(data)); + }).catch((err) => { + console.info('startAbility002 terminateSelf fail: ' + JSON.stringify(err)); + }) + + console.info("---------------------------3-----------------------------"); + this.context.startAbility(want).then((data) => { + console.info("startAbility003 inputMethodExtensionAbility start successfully." + JSON.stringify(data)); + }).catch((err) => { + console.info('startAbility003 failed:' + JSON.stringify(err)); + }) + + this.context.terminateSelf().then((data) => { + console.info("startAbility003 terminateSelf success:." + JSON.stringify(data)); + }).catch((err) => { + console.info('startAbility003 terminateSelf fail: ' + JSON.stringify(err)); + }) + + console.info("---------------------------4-----------------------------"); + this.context.startAbility(want, options).then((data) => { + console.info("startAbility004 inputMethodExtensionAbility start successfully." + JSON.stringify(data)); + }).catch((err) => { + console.info('startAbility004 failed:' + JSON.stringify(err)); + }) + + this.context.terminateSelf().then((data) => { + console.info("startAbility004 terminateSelf success:." + JSON.stringify(data)); + }).catch((err) => { + console.info('startAbility004 terminateSelf fail: ' + JSON.stringify(err)); + }) + + } + + onDestroy() { + console.info("onDestroy: inputMethodExtensionAbility destroy."); + } +} \ No newline at end of file diff --git a/inputmethod/InputMethodTest_Stage/entry/src/main/ets/MainAbility/MainAbility.ts b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..1ddf22a980cb10cd610cc35669519f20c21a59ef --- /dev/null +++ b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want,launchParam){ + // Ability is creating, initialize resources for this ability + console.info("ImExtAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.info("ImExtAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.info("ImExtAbility onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) + console.info("ImExtAbility onWindowStageCreate finish") + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.info("ImExtAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.info("ImExtAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.info("ImExtAbility onBackground") + } +}; \ No newline at end of file diff --git a/inputmethod/InputMethodTest_Stage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..57aad0b6a9e2d137c5a225f15eb3476ad229b74a --- /dev/null +++ b/inputmethod/InputMethodTest_Stage/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.acts.imeability.test.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/inputmethod/InputMethodTest_Stage/entry/src/main/ets/pages/index/index.ets b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..e1942ec72fc60a6c599964b5145e31b564bac3a7 --- /dev/null +++ b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,51 @@ +/* + * 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' + +@Entry +@Component +struct Index { + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => {}) + } + .width('100%') + .height('100%') + } + + aboutToAppear(){ + let abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + let abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } +} \ No newline at end of file diff --git a/inputmethod/InputMethodTest_Stage/entry/src/main/ets/pages/second/second.ets b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/pages/second/second.ets new file mode 100644 index 0000000000000000000000000000000000000000..f9009a3e8567d1f4557ebc11dded54c7e27c0b0d --- /dev/null +++ b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/pages/second/second.ets @@ -0,0 +1,43 @@ +/* + * 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 router from '@system.router'; + +@Entry +@Component +struct Second { + private content: string = "Second Page" + + build() { + Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('back to index') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + router.back() + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/List.test.ets b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f4b5df5861b928b81c17be1480103d8c980c0b02 --- /dev/null +++ b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,19 @@ +/* + * 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 imeAbilityTest from './imeAbilityTest.test' + +export default function testsuite() { + imeAbilityTest(globalThis.abilityContext) +} \ No newline at end of file diff --git a/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/imeAbilityTest.test.ets b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/imeAbilityTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f1afcc58d215c3977d6f48ad2232c7b7f08cbb3e --- /dev/null +++ b/inputmethod/InputMethodTest_Stage/entry/src/main/ets/test/imeAbilityTest.test.ets @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium" +import inputMethod from '@ohos.inputmethod' + +export default function imeAbilityTest(abilityContext) { + describe('imeAbilityTest', function () { + /** + * sleep function. + */ + function sleep(date, time){ + while(Date.now() - date <= time); + } + + + /** + * beforeEach: Prerequisites at the test case level, which are executed before each test case is executed. + */ + beforeEach(function () { + console.info('beforeEach: switchInputMethod to kikakeyboard.'); + let serviceAbilityProperty = { + packageName: "com.example.kikakeyboard", + methodId: "ServiceExtAbility" + } + + inputMethod.switchInputMethod(serviceAbilityProperty).then((data)=>{ + console.info('SUB_InputMethod_IMEAbility_0001 switchInputMethod to Kika :' + data); + expect(data == true).assertTrue(); + }) + + }); + + /** + * afterEach: Test case-level clearance conditions, which are executed after each test case is executed. + */ + afterEach(function () { + console.info('afterEach: Test case-level clearance conditions is executed.'); + }); + + /** + * @tc.number SUB_InputMethod_IMEAbility_0001 + * @tc.desc Start a inputMethodExtension ability session. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('SUB_InputMethod_IMEAbility_0001', 0, async function (done) { + console.info('----------SUB_InputMethod_IMEAbility_0001 start-------------'); + let imExtAbilityProperty = { + packageName : "com.acts.imeability.test", + methodId : "com.acts.imeability.test.ImExtAbility", + } + + inputMethod.switchInputMethod(imExtAbilityProperty).then((data)=>{ + console.info('SUB_InputMethod_IMEAbility_0004 switchInputMethod to IME :' + data); + expect(data == true).assertTrue(); + }); + sleep(Date.now(), 3000); + console.info('----------SUB_InputMethod_IMEAbility_0001 end-------------'); + + done(); + }) + + /** + * @tc.number SUB_InputMethod_IMEAbility_0002 + * @tc.desc Start a inputMethodExtension ability session + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('SUB_InputMethod_IMEAbility_0002', 0, async function (done) { + console.info('-----------SUB_InputMethod_IMEAbility_0002 start-------------'); + + let imExtAbilityProperty = { + packageName : "com.acts.imeability.test", + methodId : "com.acts.imeability.test.ImExtAbility", + } + + inputMethod.switchInputMethod(imExtAbilityProperty).then((data)=>{ + console.info('SUB_InputMethod_IMEAbility_0004 switchInputMethod to IME :' + data); + expect(data == true).assertTrue(); + }); + sleep(Date.now(), 2500); + console.info('-----------SUB_InputMethod_IMEAbility_0002 end-------------'); + done(); + }) + }) +} \ No newline at end of file diff --git a/inputmethod/InputMethodTest_Stage/entry/src/main/module.json b/inputmethod/InputMethodTest_Stage/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..dca1411321793117777c88609ee1e1167bb1d09e --- /dev/null +++ b/inputmethod/InputMethodTest_Stage/entry/src/main/module.json @@ -0,0 +1,54 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "com.acts.imeability.test.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "visible": true, + "orientation": "portrait", + "launchType": "singleton", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities":[ + "entity.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "name": "com.acts.imeability.test.ImExtAbility", + "srcEntrance": "./ets/ImExtAbility/ImExtAbility.ets", + "label": "$string:ime_label", + "description": "$string:ime_description", + "type": "inputMethod" + } + ], + "requestPermissions": [ + { + "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + } + ] + } +} diff --git a/inputmethod/InputMethodTest_Stage/entry/src/main/resources/base/element/string.json b/inputmethod/InputMethodTest_Stage/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ea8ffb9ce5faaafb968771c65a5ac50db871e1ff --- /dev/null +++ b/inputmethod/InputMethodTest_Stage/entry/src/main/resources/base/element/string.json @@ -0,0 +1,36 @@ +{ + "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": "ActsImeAbilityTest" + }, + { + "name": "ime_description", + "value": "input method extension ability." + }, + { + "name": "ime_label", + "value": "inputMethod extension ability services." + }, + { + "name": "ime_label_1", + "value": "inputMethod extension ability services_1." + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" + } + ] +} diff --git a/inputmethod/InputMethodTest_Stage/entry/src/main/resources/base/media/icon.png b/inputmethod/InputMethodTest_Stage/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/inputmethod/InputMethodTest_Stage/entry/src/main/resources/base/media/icon.png differ diff --git a/inputmethod/InputMethodTest_Stage/entry/src/main/resources/base/profile/main_pages.json b/inputmethod/InputMethodTest_Stage/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/inputmethod/InputMethodTest_Stage/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/notification/ans_standard/actsansnotificationcancel/signature/openharmony_sx.p7b b/inputmethod/InputMethodTest_Stage/signature/openharmony_sx.p7b similarity index 100% rename from notification/ans_standard/actsansnotificationcancel/signature/openharmony_sx.p7b rename to inputmethod/InputMethodTest_Stage/signature/openharmony_sx.p7b diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/config.json b/inputmethod/InputMethodTest_ets/entry/src/main/config.json index 75e3d2529139888ae4fae8e14878aa22fb785696..fd4a0dd38d76277900d626aaaf3af193b5498cdb 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/config.json +++ b/inputmethod/InputMethodTest_ets/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".MyApplication", "mainAbility": "com.acts.inputmethodtest.MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/List.test.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/List.test.ets index 36ea14d85c83d7286045fd20ecf9f4a092c2a110..1321a1d7f4b4b3f1d74213703ca46f1a17abd26e 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/List.test.ets +++ b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/List.test.ets @@ -12,16 +12,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import inputMethodJSUnit from './inputMethodJSUnit.ets'; -import inputMethodEngineJSUnit from './inputMethodEngineJSUnit.ets'; -import inputRequestJSUnit from './inputRequestJSUnit.ets'; -import requestJSUnit from './requestJSUnit.ets'; -import requestDownloadJSUnit from './requestDownloadJSUnit.ets'; +import inputMethodJSUnit from './inputMethodJSUnit'; +import inputMethodEngineJSUnit from './inputMethodEngineJSUnit'; export default function testsuite() { inputMethodJSUnit(); inputMethodEngineJSUnit(); - inputRequestJSUnit(); - requestDownloadJSUnit(); - requestJSUnit(); } \ No newline at end of file diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodEngineJSUnit.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodEngineJSUnit.ets index 72cd89649d89b379e4f43c9377325a6315c0c59f..9ff5e35363e7e5e5e663e03077570f68a0e33ef4 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodEngineJSUnit.ets +++ b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodEngineJSUnit.ets @@ -25,6 +25,7 @@ export default function inputMethodEngineJSUnit() { let inputMethodEngineObject = inputMethodEngine.getInputMethodEngine(); let textInputClient = null; let kbController = null; + let KeyboardDelegate = null; console.info("************* inputMethodEngine Test start*************"); beforeEach(async function (done) { @@ -49,6 +50,50 @@ export default function inputMethodEngineJSUnit() { await Utils.sleep(1000); }); + it('inputMethodEngine_testOff_000', 0 , async function (done) { + inputMethodEngineObject.off('inputStart', (kbController, textInputClient) => { + console.info("inputMethodEngine beforeEach inputStart:" + JSON.stringify(kbController)); + console.info("inputMethodEngine beforeEach inputStart:" + JSON.stringify(textInputClient)); + }); + inputMethodEngineObject.off('keyboardShow', (err) => { + console.info("inputMethodEngine beforeEach keyboardShow:" + err); + }); + inputMethodEngineObject.off('keyboardHide', (err) => { + console.info("inputMethodEngine beforeEach keyboardHide:" + err); + }); + KeyboardDelegate = inputMethodEngine.createKeyboardDelegate(); + KeyboardDelegate.off('keyDown', (keyEvent) => { + console.info("inputMethodEngine beforeEach keyDown:" + keyEvent.keyCode); + expect(keyEvent.keyCode).assertEqual('1'); + + console.info("inputMethodEngine beforeEach keyDown:" + keyEvent.keyAction); + expect(keyEvent.keyAction).assertEqual('1'); + + }); + KeyboardDelegate.off('keyUp', (keyEvent) => { + console.info("inputMethodEngine beforeEach keyUp:" + keyEvent.keyCode); + expect(keyEvent.keyCode).assertEqual('1'); + console.info("inputMethodEngine beforeEach keyDown:" + keyEvent.keyAction); + expect(keyEvent.keyAction).assertEqual('0'); + + }); + KeyboardDelegate.off('cursorContextChange', (x, y, height) => { + console.info("inputMethodEngine beforeEach cursorContextChange x:" + x); + console.info("inputMethodEngine beforeEach cursorContextChange y:" + y); + console.info("inputMethodEngine beforeEach cursorContextChange height:" + height); + }); + KeyboardDelegate.off('selectionChange', (oldBegin, oldEnd, newBegin, newEnd) => { + console.info("inputMethodEngine beforeEach selectionChange oldBegin:" + oldBegin); + console.info("inputMethodEngine beforeEach selectionChange oldEnd:" + oldEnd); + console.info("inputMethodEngine beforeEach selectionChange newBegin:" + newBegin); + console.info("inputMethodEngine beforeEach selectionChange newEnd:" + newEnd); + }); + KeyboardDelegate.off('textChange', (text) => { + console.info("inputMethodEngine beforeEach textChange:" + text); + }); + done(); + }); + it('inputMethodEngine_test_000', 0, async function (done) { inputMethodEngineObject.on('inputStart', (kbController, textInputClient) => { console.info("inputMethodEngine beforeEach inputStart:" + JSON.stringify(kbController)); @@ -528,7 +573,7 @@ export default function inputMethodEngineJSUnit() { it('inputMethodEngine_test_044', 0, async function (done) { let keyType = inputMethodEngine.WINDOW_TYPE_INPUT_METHOD_FLOAT; console.error("inputMethodEngine_test_044 result:" + keyType); - expect(keyType == null).assertTrue(); + expect(keyType == 2105).assertTrue(); done(); }); @@ -536,8 +581,8 @@ export default function inputMethodEngineJSUnit() { if (textInputClient == null) { expect(textInputClient == null).assertEqual(true); } else { - textInputClient.moveCursor(1, (value) => { - console.info("inputMethodEngine_test_045 getBackward:" + value); + textInputClient.moveCursor(inputMethodEngine.CURSOR_UP, (value) => { + console.info("inputMethodEngine_test_045 moveCursor:" + value); expect(value == null).assertEqual(true); }); } @@ -548,12 +593,38 @@ export default function inputMethodEngineJSUnit() { if (textInputClient == null) { expect(textInputClient == null).assertEqual(true); } else { - let promise = textInputClient.moveCursor(1); - promise.then(res => { - console.info("inputMethodEngine_test_046 getBackward promise result-----" + JSON.stringify(res)); + textInputClient.moveCursor(inputMethodEngine.CURSOR_DOWN, (value) => { + console.info("inputMethodEngine_test_046 moveCursor:" + value); + expect(value == null).assertEqual(true); + }); + } + done(); + }) + + it('inputMethodEngine_test_047', 0, async function (done) { + if (textInputClient == null) { + expect(textInputClient == null).assertEqual(true); + } else { + textInputClient.moveCursor(inputMethodEngine.CURSOR_LEFT).then(res => { + console.info("inputMethodEngine_test_047 moveCursor promise result-----" + JSON.stringify(res)); + expect(res == null).assertEqual(true); + }).catch(err => { + console.info("inputMethodEngine_test_047 moveCursor promise error----" + JSON.stringify(err)); + expect().assertFail(); + }); + } + done(); + }) + + it('inputMethodEngine_test_048', 0, async function (done) { + if (textInputClient == null) { + expect(textInputClient == null).assertEqual(true); + } else { + textInputClient.moveCursor(inputMethodEngine.CURSOR_RIGHT).then(res => { + console.info("inputMethodEngine_test_048 moveCursor promise result-----" + JSON.stringify(res)); expect(res == null).assertEqual(true); }).catch(err => { - console.info("inputMethodEngine_test_046 getBackward promise error----" + JSON.stringify(err)); + console.info("inputMethodEngine_test_048 moveCursor promise error----" + JSON.stringify(err)); expect().assertFail(); }); } diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodJSUnit.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodJSUnit.ets index 358d696e5b761a3f05d51bb6036dcbc3f0838a39..a1c7caa6caf6e0e6e723bcd3444fc8bf2621e8af 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodJSUnit.ets +++ b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputMethodJSUnit.ets @@ -84,10 +84,10 @@ export default function inputMethodJSUnit() { console.info("inputmethoh_test_006 result:" + JSON.stringify(inputMethodCtrl)); inputMethodCtrl.stopInput().then(data => { console.info("inputmethoh_test_006 stopInput result----" + data); - expect(data == true).assertTrue() + expect(data == true).assertTrue(); }).catch(err => { console.info("inputmethoh_test_006 stopInput is err: " + JSON.stringify(err)); - expect().assertFail() + expect().assertFail(); }); done(); }); @@ -118,12 +118,12 @@ export default function inputMethodJSUnit() { packageName:"com.example.kikakeyboard", methodId:"ServiceExtAbility" } - inputMethod.switchInputMethod(inputMethodProperty).then(data => { console.info("inputmethod_test_switchInputMethod_001 data:" + data) expect(data == true).assertTrue(); }).catch( err=> { console.info("inputmethod_test_switchInputMethod_001 err:" + err) + expect().assertFail(); }) console.info("************* inputmethod_test_switchInputMethod_001 Test end*************"); done(); @@ -144,7 +144,7 @@ export default function inputMethodJSUnit() { inputMethod.switchInputMethod(inputMethodProperty, (err, data)=>{ if(err){ console.info("inputmethod_test_switchInputMethod_002 error:" + err); - expect().assertFail() + expect().assertFail(); } console.info("inputmethod_test_switchInputMethod_002 data:" + data) expect(data == true).assertTrue(); @@ -164,8 +164,10 @@ export default function inputMethodJSUnit() { inputMethodCtrl.showSoftKeyboard((data)=>{ if(data == undefined){ console.info("showSoftKeyboard callbace success" ); + expect(true).assertTrue(); }else{ console.info('showSoftKeyboard callbace failed : ' + JSON.stringify(err)) + expect().assertFail(); } }); console.info("************* inputmethod_test_showSoftKeyboard_001 Test end*************"); @@ -182,8 +184,10 @@ export default function inputMethodJSUnit() { let inputMethodCtrl = inputMethod.getInputMethodController() inputMethodCtrl.showSoftKeyboard().then((data) =>{ console.info("showSoftKeyboard promise success" ); + expect(true).assertTrue(); }).catch((err) => { console.info('showSoftKeyboard promise failed : ' + JSON.stringify(err)) + expect().assertFail(); }) console.info("************* inputmethod_test_showSoftKeyboard_002 Test end*************"); done(); @@ -200,8 +204,10 @@ export default function inputMethodJSUnit() { inputMethodCtrl.hideSoftKeyboard((data)=>{ if(data == undefined){ console.info("hideSoftKeyboard callbace success" ); + expect(true).assertTrue(); }else{ console.info('hideSoftKeyboard callbace failed : ' + JSON.stringify(err)) + expect().assertFail(); } }); console.info("************* inputmethod_test_hideSoftKeyboard_001 Test end*************"); @@ -218,11 +224,72 @@ export default function inputMethodJSUnit() { let inputMethodCtrl = inputMethod.getInputMethodController() inputMethodCtrl.hideSoftKeyboard().then((data) =>{ console.info("hideSoftKeyboard promise success" ); + expect(true).assertTrue(); }).catch((err) => { console.info('hideSoftKeyboard promise failed : ' + JSON.stringify(err)) + expect().assertFail(); }) console.info("************* inputmethod_test_hideSoftKeyboard_002 Test end*************"); done(); }); + + /* + * @tc.number inputmethod_test_getCurrentInputMethod_001 + * @tc.name return The InputMethodProperty object of the current input method. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputmethod_test_getCurrentInputMethod_001', 0, async function (done) { + let currentIme = inputMethod.getCurrentInputMethod(); + console.info("inputmethod_test_getCurrentInputMethod_001 currentIme---" + JSON.stringify(currentIme)); + console.info(currentIme.packageName); + console.info(currentIme.methodId); + expect(currentIme.packageName != null).assertTrue(); + expect(currentIme.methodId != null).assertTrue(); + console.info("************* inputmethod_test_getCurrentInputMethod_001 Test end*************"); + done(); + }); + + /* + * @tc.number inputmethod_test_listInputMethod_001 + * @tc.name param enable : + * if true, collect enabled input methods. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputmethod_test_listInputMethod_001', 0, async function (done) { + let inputMethodSetting = inputMethod.getInputMethodSetting(); + console.info("inputmethod_test_listInputMethod_001 result:" + JSON.stringify(inputMethodSetting)); + inputMethodSetting.listInputMethod(true, (err, arr) => { + if (err) { + console.error("inputmethod_test_listInputMethod_001 failed because: " + JSON.stringify(err)); + expect().assertFail(); + }; + console.info("inputmethod_test_listInputMethod_001 listInputMethod result---" + JSON.stringify(arr)); + expect(arr != null).assertTrue(); + }); + done(); + }); + + /* + * @tc.number inputmethod_test_listInputMethod_002 + * @tc.name param enable : + * if false, collect disabled input methods. + * @tc.desc Function test + * @tc.level 2 + */ + it('inputmethod_test_listInputMethod_002', 0, async function (done) { + let inputMethodSetting = inputMethod.getInputMethodSetting(); + console.info("inputmethod_test_listInputMethod_002 result:" + JSON.stringify(inputMethodSetting)); + inputMethodSetting.listInputMethod(false, (err, arr) => { + if (err) { + console.error("inputmethod_test_listInputMethod_002 failed because: " + JSON.stringify(err)); + expect().assertFail(); + }; + console.info("inputmethod_test_listInputMethod_002 listInputMethod result---" + JSON.stringify(arr)); + expect(arr != null).assertTrue(); + }); + done(); + }); }) } diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputRequestJSUnit.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputRequestJSUnit.ets deleted file mode 100644 index 91eaedfd862fbdc56cce6a682adc4aff0ff67310..0000000000000000000000000000000000000000 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/inputRequestJSUnit.ets +++ /dev/null @@ -1,93 +0,0 @@ -// @ts-nocheck -/** - * 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, it, expect} from 'hypium/index'; -import request from '@ohos.request'; - -export default function inputRequestJSUnit() { - describe('inputRequestTest', function () { - console.log("************* request Test start*************"); - - /** - * @tc.number inputRequest_DownloadConfig_Test_001 - * @tc.name Request DownloadConfig - * @tc.desc interface DownloadConfig - */ - it('inputRequest_DownloadConfig_Test_001', 0, async function (done) { - let caseName: string = "inputRequest_DownloadConfig_Test_001"; - console.log(`==========> ${caseName} Test start ==========>`); - let downloadConfig = { - header: "HTTP", - url: "www.testdownload.com", - enableMetered: false, - enableRoaming: false, - description: "test download", - title: "", - networkType: "", - }; - try { - let promise = request.download(downloadConfig); - expect(promise).assertEqual(undefined); - } catch (err) { - console.log(`${caseName} fail,case success,error:${toString(err)}`); - expect(true).assertTrue(); - done(); - return; - } - console.log(`==========> ${caseName} Test end ==========>`); - done(); - }); - - /** - * @tc.number inputRequest_DownloadInfo_Test_002 - * @tc.name Request DownloadInfo - * @tc.desc interface DownloadInfo - */ - it('inputRequest_DownloadInfo_Test_002', 0, async function (done) { - let caseName: string = "inputRequest_DownloadInfo_Test_002"; - try { - request.download({ - url: "www.testdownload.com" - }).then(downloadTask => { - if (downloadTask !== undefined) { - downloadTask.query((err, downloadInfo) => { - if (downloadInfo !== undefined) { - expect("info").assertEqual(downloadInfo.description); - expect(100).assertEqual(downloadInfo.downloadedBytes); - expect(1).assertEqual(downloadInfo.downloadId); - expect(101).assertEqual(downloadInfo.failedReason); - expect("download.txt").assertEqual(downloadInfo.fileName); - expect("C://").assertEqual(downloadInfo.filePath); - expect(102).assertEqual(downloadInfo.pausedReason); - expect(200).assertEqual(downloadInfo.status); - expect("download url").assertEqual(downloadInfo.targetURI); - expect("download test").assertEqual(downloadInfo.downloadTitle); - expect(1000).assertEqual(downloadInfo.downloadTotalBytes); - } - }); - } - }).catch(err => { - }); - } catch (err) { - console.log(`${caseName} fail,case success,error:${toString(err)}`); - expect(true).assertTrue(); - done(); - return; - } - console.log(`==========> ${caseName} Test end ==========>`); - done(); - }); - }) -} \ No newline at end of file diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/requestDownloadJSUnit.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/requestDownloadJSUnit.ets deleted file mode 100644 index 20f800d2a0d94351de813387808127926e2ad34b..0000000000000000000000000000000000000000 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/requestDownloadJSUnit.ets +++ /dev/null @@ -1,511 +0,0 @@ -// @ts-nocheck -/** - * 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, it, expect} from "deccjsunit/index.ets"; -import request from '@ohos.request'; - -export default function requestDownloadJSUnit() { - describe('requestDownloadTest', function () { - let downloadConfig = { - url: "www.baidu.com" - }; - let file = { - filename: 'text.txt', - name: 'text.txt', - uri: 'C:\\Program Files', - type: 'text' - }; - let uploadConfig = { - url: "www.baidu.com", - header: 'HTTP', - method: 'post', - files: file, - data: 'json/xml' - }; - let receivedSize; - let totalSize; - console.log("************* settings Test start*************"); - - /** - * @tc.number requestDownload_test_001 - * @tc.name Test The request DownloadTask - * @tc.desc Function test - */ - it('requestDownload_test_001', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.on('progress', (receivedSize, totalSize) => { - console.log("downloadTask on_progress:" + JSON.stringify(receivedSize)); - console.log("downloadTask on_progress:" + JSON.stringify(totalSize)); - this.receivedSize = receivedSize; - this.totalSize = totalSize; - expect(true).assertTrue(); - }) - }); - } catch (exception) { - console.log("requestDownload_test_001 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_002 - * @tc.name Test The request DownloadTask - * @tc.desc Function test - */ - it('requestDownload_test_002', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.off('progress', (receivedSize, totalSize) => { - console.log("downloadTask off_progress:" + JSON.stringify(receivedSize)); - console.log("downloadTask off_progress:" + JSON.stringify(totalSize)); - this.receivedSize = receivedSize; - this.totalSize = totalSize; - expect(true).assertTrue(); - }) - }); - } catch (exception) { - console.log("requestDownload_test_002 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_003 - * @tc.name Test The request DownloadTask - * @tc.desc Function test - */ - it('requestDownload_test_003', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.on('complete', (err) => { - console.log("downloadTask on_complete err:" + err); - expect(true).assertTrue(); - }); - }); - } catch (exception) { - console.log("requestDownload_test_003 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_004 - * @tc.name Test The request DownloadTask - * @tc.desc Function test - */ - it('requestDownload_test_004', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.on('pause', (err) => { - console.log("downloadTask on_pause err:" + err); - expect(true).assertTrue(); - }); - }); - } catch (exception) { - console.log("requestDownload_test_004 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_005 - * @tc.name Test The request DownloadTask - * @tc.desc Function test - */ - it('requestDownload_test_005', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.on('remove', (err) => { - console.log("downloadTask on_remove err:" + err); - expect(true).assertTrue(); - }); - }); - } catch (exception) { - console.log("requestDownload_test_005 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_006 - * @tc.name Test The request DownloadTask - * @tc.desc Function test - */ - it('requestDownload_test_006', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)); - downloadTask.off('complete', (err) => { - console.log("downloadTask off_complete err:" + err); - expect(true).assertTrue(); - }); - }); - } catch (exception) { - console.log("requestDownload_test_006 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_007 - * @tc.name Test The request DownloadTask - * @tc.desc Function test - */ - it('requestDownload_test_007', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.off('pause', (err) => { - console.log("downloadTask off_pause err:" + err); - expect(true).assertTrue(); - }); - }); - } catch (exception) { - console.log("requestDownload_test_007 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_007 - * @tc.name Test The request DownloadTask - * @tc.desc Function test - */ - it('requestDownload_test_008', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.off('remove', (err) => { - console.log("downloadTask off_remove err:" + err); - expect(true).assertTrue(); - }); - }); - } catch (exception) { - console.log("requestDownload_test_008 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_009 - * @tc.name Test The request DownloadTask - * @tc.desc Function test - */ - it('requestDownload_test_009', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.on('fail', (err) => { - console.log("downloadTask on_fail err:" + err); - expect(true).assertTrue(); - }); - }); - } catch (exception) { - console.log("requestDownload_test_009 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_010 - * @tc.name Test The request DownloadTask - * @tc.desc Function test - */ - it('requestDownload_test_010', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.off('fail', (err) => { - console.log("downloadTask off_fail err:" + err); - expect(true).assertTrue(); - }); - }); - } catch (exception) { - console.log("requestDownload_test_010 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_011 - * @tc.name Test The request DownloadTask - * @tc.desc Function test - */ - it('requestDownload_test_011', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.remove((err) => { - console.log("downloadTask remove err:" + err); - expect(true).assertTrue(); - }); - }); - } catch (exception) { - console.log("requestDownload_test_011 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_012 - * @tc.name Test The request DownloadTask - * @tc.desc Function test - */ - it('requestDownload_test_012', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.query((err) => { - console.log("downloadTask query err:" + err); - expect(true).assertTrue(); - }); - }); - } catch (err) { - console.log("requestDownload_test_012 invoke download error : " + JSON.stringify(err)); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_013 - * @tc.name Test The request DownloadTask - * @tc.desc Function test - */ - it('requestDownload_test_013', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.queryMimeType((err) => { - console.log("downloadTask queryMimeType err:" + err); - expect(true).assertTrue(); - }); - }); - } catch (exception) { - console.log("requestDownload_test_013 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_007 - * @tc.name Test The request UploadTask - * @tc.desc Function test - */ - it('requestDownload_test_014', 0, async function (done) { - try { - request.upload(uploadConfig, (uploadTask) => { - console.log("downloadConfig result:" + JSON.stringify(uploadTask)) - expect(true).assertTrue(); - }); - } catch (exception) { - console.log("requestDownload_test_014 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_015 - * @tc.name testRequestDownloadTask_015 - * @tc.desc Function test - */ - it('requestDownload_test_015', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.remove().then((result) => { - console.info('requestDownload_test_015 Download task removed result=' + result); - expect(true).assertTrue(); - }).catch ((err) => { - console.log("requestDownload_test_015 downloadTask remove err:" + err); - expect(true).assertTrue(); - }); - }); - } catch (exception) { - console.log("requestDownload_test_015 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_016 - * @tc.name testRequestDownloadTask_016 - * @tc.desc Function test - */ - it('requestDownload_test_016', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.query().then((downloadInfo) => { - console.info('requestDownload_test_016 Data:' + JSON.stringify(downloadInfo)); - expect(true).assertTrue(); - }) .catch((err) => { - console.log("downloadTask query err:" + err); - expect(true).assertTrue(); - }); - }); - } catch (err) { - console.log("requestDownload_test_016 invoke download error : " + JSON.stringify(err)); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_017 - * @tc.name testRequestDownloadTask_017 - * @tc.desc Function test - */ - it('requestDownload_test_017', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.queryMimeType().then((data) => { - console.info('requestDownload_test_017. Data:' + JSON.stringify(data)); - expect(true).assertTrue(); - }).catch((err) => { - console.log("downloadTask queryMimeType err:" + err); - expect(true).assertTrue(); - }); - }); - } catch (exception) { - console.log("requestDownload_test_017 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_018 - * @tc.name testRequestDownloadTask_018 - * @tc.desc Function test - */ - it('requestDownload_test_018', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.pause().then((data) => { - console.info('requestDownload_test_018. Data:' + JSON.stringify(data)); - expect(true).assertTrue(); - }).catch((err) => { - console.log("requestDownload_test_018 err:" + err); - expect(true).assertTrue(); - }); - }); - } catch (exception) { - console.log("requestDownload_test_018 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_019 - * @tc.name testRequestDownloadTask_019 - * @tc.desc Function test - */ - it('requestDownload_test_019', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.pause((err, result)=>{ - if(err) { - console.error('requestDownload_test_019 error:' + JSON.stringify(err)); - expect(true).assertTrue(); - } else { - console.info('requestDownload_test_019. result:' + JSON.stringify(result)); - expect(true).assertTrue(); - } - }); - }); - } catch (exception) { - console.log("requestDownload_test_019 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_020 - * @tc.name testRequestDownloadTask_020 - * @tc.desc Function test - */ - it('requestDownload_test_020', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.resume().then((data) => { - console.info('requestDownload_test_020. Data:' + JSON.stringify(data)); - expect(true).assertTrue(); - }).catch((err) => { - console.log("requestDownload_test_020 err:" + err); - expect(true).assertTrue(); - }); - }); - } catch (exception) { - console.log("requestDownload_test_020 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number requestDownload_test_021 - * @tc.name testRequestDownloadTask_021 - * @tc.desc Function test - */ - it('requestDownload_test_021', 0, async function (done) { - try { - request.download(downloadConfig, (downloadTask) => { - console.log("downloadConfig result:" + JSON.stringify(downloadTask)) - downloadTask.resume((err, result)=>{ - if(err) { - console.error('requestDownload_test_021 error:' + JSON.stringify(err)); - expect(true).assertTrue(); - } else { - console.info('requestDownload_test_021. result:' + JSON.stringify(result)); - expect(true).assertTrue(); - } - }); - }); - } catch (exception) { - console.log("requestDownload_test_021 failed due to execute timeout 5s"); - expect(true).assertTrue(); - } - done(); - }); - }) -} - diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/requestJSUnit.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/requestJSUnit.ets deleted file mode 100644 index 63f91844f5f3edbf873affc8902df1e33612ff06..0000000000000000000000000000000000000000 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/requestJSUnit.ets +++ /dev/null @@ -1,262 +0,0 @@ -// @ts-nocheck -/** - * 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, it, expect} from "deccjsunit/index.ets"; -import request from '@ohos.request'; - -export default function requestJSUnit() { - describe('requestTest', function () { - - /** - * @tc.name: ohos.request_request_0001 - * @tc.desc: NETWORK_MOBILE NETWORK_WIFI ERROR_CANNOT_RESUME ERROR_DEVICE_NOT_FOUND Values detection - * - * @tc.author: kangyuntao - */ - it('request_test_0001', 0, async function (done) { - console.log("-----------------------Request_test_0001 is starting-----------------------"); - try { - request.NETWORK_MOBILE = 1; - console.log("request_test_0001 request.NETWORK_MOBILE:" + request.NETWORK_MOBILE); - expect(request.NETWORK_MOBILE).assertEqual(1); - request.NETWORK_WIFI = 2; - console.log("request_test_0001 request.NETWORK_WIFI:" + request.NETWORK_WIFI); - expect(request.NETWORK_WIFI).assertEqual(2); - request.ERROR_CANNOT_RESUME = 3; - console.log("request_test_0001 request.ERROR_CANNOT_RESUME:" + request.ERROR_CANNOT_RESUME); - expect(request.ERROR_CANNOT_RESUME).assertEqual(3); - request.ERROR_DEVICE_NOT_FOUND = 4; - console.log("request_test_0001 request.ERROR_DEVICE_NOT_FOUND:" + request.ERROR_DEVICE_NOT_FOUND); - expect(request.ERROR_DEVICE_NOT_FOUND).assertEqual(4); - } catch (err) { - expect(true).assertEqual(true); - console.error("request_test_0001 error: " + err); - } - console.log("-----------------------Request_test_0001 end-----------------------"); - done(); - }); - - /** - * @tc.name: ohos.request_request_0002 - * @tc.desc: ERROR_FILE_ALREADY_EXISTS ERROR_FILE_ERROR ERROR_HTTP_DATA_ERROR - * ERROR_INSUFFICIENT_SPACE Values detection - * @tc.author: kangyuntao - */ - it('request_test_0002', 0, async function (done) { - console.log("-----------------------Request_test_0002 is starting-----------------------"); - try { - request.ERROR_FILE_ALREADY_EXISTS = 5; - console.log("request_test_0002 request.ERROR_FILE_ALREADY_EXISTS:" + request.ERROR_FILE_ALREADY_EXISTS); - expect(request.ERROR_FILE_ALREADY_EXISTS).assertEqual(5); - request.ERROR_FILE_ERROR = 6; - console.log("request_test_0002 request.ERROR_FILE_ERROR:" + request.ERROR_FILE_ERROR); - expect(request.ERROR_FILE_ERROR).assertEqual(6); - request.ERROR_HTTP_DATA_ERROR = 7; - console.log("request_test_0002 request.ERROR_HTTP_DATA_ERROR:" + request.ERROR_HTTP_DATA_ERROR); - expect(request.ERROR_HTTP_DATA_ERROR).assertEqual(7); - request.ERROR_INSUFFICIENT_SPACE = 8; - console.log("request_test_0002 request.ERROR_INSUFFICIENT_SPACE:" + request.ERROR_INSUFFICIENT_SPACE); - expect(request.ERROR_INSUFFICIENT_SPACE).assertEqual(8); - } catch (err) { - expect(true).assertEqual(true); - console.error("request_test_0002 error: " + err); - } - console.log("-----------------------Request_test_0002 end-----------------------"); - done(); - }); - - /** - * @tc.name: ohos.request_request_0003 - * @tc.desc: ERROR_TOO_MANY_REDIRECTS ERROR_UNHANDLED_HTTP_CODE ERROR_UNHANDLED_HTTP_CODE - * PAUSED_QUEUED_FOR_WIFI Values detection - * @tc.author: kangyuntao - */ - it('request_test_0003', 0, async function (done) { - console.log("-----------------------Request_test_0003 is starting-----------------------"); - try { - request.ERROR_TOO_MANY_REDIRECTS = 9; - console.log("request_test_0003 request.ERROR_TOO_MANY_REDIRECTS:" + request.ERROR_TOO_MANY_REDIRECTS); - expect(request.ERROR_TOO_MANY_REDIRECTS).assertEqual(9); - request.ERROR_UNHANDLED_HTTP_CODE = 10; - console.log("request_test_0003 request.ERROR_UNHANDLED_HTTP_CODE:" + request.ERROR_UNHANDLED_HTTP_CODE); - expect(request.ERROR_UNHANDLED_HTTP_CODE).assertEqual(10); - request.ERROR_UNKNOWN = 11; - console.log("request_test_0003 request.ERROR_UNKNOWN:" + request.ERROR_UNKNOWN); - expect(request.ERROR_UNKNOWN).assertEqual(11); - request.PAUSED_QUEUED_FOR_WIFI = 12; - console.log("request_test_0003 request.PAUSED_QUEUED_FOR_WIFI:" + request.PAUSED_QUEUED_FOR_WIFI); - expect(request.PAUSED_QUEUED_FOR_WIFI).assertEqual(12); - } catch (err) { - expect(true).assertEqual(true); - console.error("request_test_0003 error: " + err); - } - console.log("-----------------------Request_test_0003 end-----------------------"); - done(); - }); - - /** - * @tc.name: ohos.request_request_0004 - * @tc.desc: PAUSED_UNKNOWN PAUSED_WAITING_FOR_NETWORK PAUSED_WAITING_TO_RETRY ESSION_FAILED Values detection - * @tc.author: kangyuntao - */ - it('request_test_0004', 0, async function (done) { - console.log("-----------------------Request_test_0004 is starting-----------------------"); - try { - request.PAUSED_UNKNOWN = 13; - console.log("request_test_0004 request.PAUSED_UNKNOWN:" + request.PAUSED_UNKNOWN); - expect(request.PAUSED_UNKNOWN).assertEqual(13); - request.PAUSED_WAITING_FOR_NETWORK = 14; - console.log("request_test_0004 request.PAUSED_WAITING_FOR_NETWORK:" + request.PAUSED_WAITING_FOR_NETWORK); - expect(request.PAUSED_WAITING_FOR_NETWORK).assertEqual(14); - request.PAUSED_WAITING_TO_RETRY = 15; - console.log("request_test_0004 request.PAUSED_WAITING_TO_RETRY:" + request.PAUSED_WAITING_TO_RETRY); - expect(request.PAUSED_WAITING_TO_RETRY).assertEqual(15); - request.SESSION_FAILED = 16; - console.log("request_test_0004 request.SESSION_FAILED:" + request.SESSION_FAILED); - expect(request.SESSION_FAILED).assertEqual(16); - } catch (err) { - expect(true).assertEqual(true); - console.error("request_test_0004 error: " + err); - } - console.log("-----------------------Request_test_0004 end-----------------------"); - done(); - }); - - /** - * @tc.name: ohos.request_request_0005 - * @tc.desc: SESSION_PAUSED SESSION_PENDING SESSION_RUNNING SESSION_SUCCESSFUL Values detection - * @tc.author: kangyuntao - */ - it('request_test_0005', 0, async function (done) { - console.log("-----------------------Request_test_0005 is starting-----------------------"); - try { - request.SESSION_PAUSED = 17; - console.log("request_test_0004 request.SESSION_PAUSED:" + request.SESSION_PAUSED); - expect(request.SESSION_PAUSED).assertEqual(17); - request.SESSION_PENDING = 18; - console.log("request_test_0004 request.SESSION_PENDING:" + request.SESSION_PENDING); - expect(request.SESSION_PENDING).assertEqual(18); - request.SESSION_RUNNING = 19; - console.log("request_test_0004 request.SESSION_RUNNING:" + request.SESSION_RUNNING); - expect(request.SESSION_RUNNING).assertEqual(19); - request.SESSION_SUCCESSFUL = 20; - console.log("request_test_0004 request.SESSION_SUCCESSFUL:" + request.SESSION_SUCCESSFUL); - expect(request.SESSION_SUCCESSFUL).assertEqual(20); - } catch (err) { - expect(true).assertEqual(true); - console.error("request_test_0005 error: " + err); - } - console.log("-----------------------Request_test_0005 end-----------------------"); - done(); - }); - - /** - * @tc.name: ohos.request_request_upload - * @tc.desc: request_upload Method detection - * @tc.author: kangyuntao - */ - it('request_upload_0006', 0, async function (done) { - console.log("-----------------------Request_test_0006 is starting-----------------------"); - try { - console.log("request_upload_0006 getUploadConfig() " + getUploadConfig()); - request.upload(getUploadConfig(), (err, uploadTask) => { - if (err) { - expect().assertFail(); - } else { - console.log("request_upload_0006 progress uploadTask =" + JSON.stringify(uploadTask)); - uploadTask.on('progress', function (data1, data2) { - console.log("request_upload_0006 on data1 =" + data1); - console.log("request_upload_0006 on data2 =" + data2); - }) - uploadTask.off('progress', function (data1, data2) { - console.log("request_upload_0006 off data1 =" + data1); - console.log("request_upload_0006 off data2 =" + data2); - }) - uploadTask.remove((err, data) => { - console.log("request_upload_0006 remove =" + data); - }) - } - }) - } catch (err) { - expect(true).assertEqual(true); - console.error("request_upload_0006 error: " + err); - } - console.log("-----------------------request_upload_0006 end-----------------------"); - done(); - }); - - /** - * @tc.number request_upload_0007 - * @tc.name: test_request_upload_0007 - * @tc.desc: request_upload Method detection - */ - it('request_upload_0007', 0, async function (done) { - console.log("-----------------------request_upload_0007 is starting-----------------------"); - try { - console.log("request_upload_0007 getUploadConfig() " + getUploadConfig()); - request.upload(getUploadConfig(), (err, uploadTask) => { - if (err) { - expect().assertFail(); - } else { - console.log("request_upload_0007 progress uploadTask =" + JSON.stringify(uploadTask)); - uploadTask.on('headerReceive', function (data1, data2) { - console.log("request_upload_0007 headerReceive on data1 =" + data1); - console.log("request_upload_0007 headerReceive on data2 =" + data2); - }) - uploadTask.off('headerReceive', function (data1, data2) { - console.log("request_upload_0007 headerReceive off data1 =" + data1); - console.log("request_upload_0007 headerReceive off data2 =" + data2); - }) - uploadTask.remove().then((result) => { - console.log("request_upload_0006 remove =" + result); - }).catch((err) => { - console.error('Failed to remove the upload task. Cause: ' + JSON.stringify(err)); - }); - } - }) - } catch (err) { - expect(true).assertEqual(true); - console.error("request_upload_0007 error: " + err); - } - console.log("-----------------------request_upload_0007 end-----------------------"); - done(); - }) - }); - - function getUploadConfig() { - let file = { - filename: 'test', - name: 'test', - uri: 'internal://cache/test.txt', - type: 'txt' - } - let requestData = [{ - name: 'name', value: '123' - }] - let fileArray = new Array(); - fileArray[0] = file; - let headerHttp = { - headers: 'http' - } - let uploadConfig = { - url: 'http://192.168.112.124/upload_test/', - header: headerHttp, - method: 'POST', - files: fileArray, - data: requestData - } - return uploadConfig - } -} diff --git a/kernel_lite/fs_posix/vfat_storage/Test.json b/kernel_lite/fs_posix/vfat_storage/Test.json index ddf8aafefefe199a10d82160db31191dc4e88e2c..049cb2b07f9fb80fb45ca00601c7e6aed5dc0623 100644 --- a/kernel_lite/fs_posix/vfat_storage/Test.json +++ b/kernel_lite/fs_posix/vfat_storage/Test.json @@ -20,6 +20,6 @@ ], "driver": { "type": "CppTestLite", - "execute": "/test_root/kernel/ActsVFATTest.bin" + "execute": "/test_root/kernel/ActsVFATstorageTest.bin" } -} \ No newline at end of file +} diff --git a/location/geolocation_standard/src/main/config.json b/location/geolocation_standard/src/main/config.json index 3d33a93b172f4f30f7d837632e2afe7cc41d50a2..7a38d52b2d1891b3be286347b49fbdd85363a465 100644 --- a/location/geolocation_standard/src/main/config.json +++ b/location/geolocation_standard/src/main/config.json @@ -18,6 +18,7 @@ "name": ".MyApplication", "mainAbility": "ohos.acts.location.geolocation.function.MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js b/location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js index 236f19a2e99cf9c41383425b7c61753a17d999e9..47537eb0c7d5759a3040f3b821da6a7bfb3d5784 100644 --- a/location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js +++ b/location/geolocation_standard/src/main/js/default/test/GeocoderTest.test.js @@ -101,14 +101,14 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0001 + * @tc.number SUB_HSS_LocationSystem_Geo_0100 * @tc.name testIsGeoServiceAvailable * @tc.desc Check whether address resolution and reverse address resolution are supported. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0001', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_0100', 0, async function (done) { geolocation.isGeoServiceAvailable(async (err, data) => { if (err) { console.info('[lbs_js] getGeoServiceState err is : ' + JSON.stringify(err)); @@ -124,14 +124,14 @@ describe('geolocationTest_geo1', function () { }); /** - * @tc.number SUB_HSS_LocationSystem_Geo_0002 + * @tc.number SUB_HSS_LocationSystem_Geo_0200 * @tc.name TestisGeoServiceAvailable * @tc.desc Check whether address resolution and reverse address resolution are supported. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0002', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_0200', 0, async function (done) { await geolocation.isGeoServiceAvailable().then((result) => { console.info('[lbs_js] isGeoServiceAvailable1 promise result: ' + JSON.stringify(result)); console.info('[lbs_js] not support now'); @@ -144,14 +144,14 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0003 + * @tc.number SUB_HSS_LocationSystem_Geo_0300 * @tc.name TestgetAddressesFromLocation * @tc.desc Address Resolution Test. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0003', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_0300', 0, async function (done) { let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 1, "locale": "zh" }; let promise = new Promise((resolve, reject) => { geolocation.getAddressesFromLocation(reverseGeocodeRequest, (err, data) => { @@ -168,14 +168,14 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0004 + * @tc.number SUB_HSS_LocationSystem_Geo_0400 * @tc.name TestgetAddressesFromLocation * @tc.desc Address Resolution Test. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0004', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_0400', 0, async function (done) { let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 1 }; await geolocation.getAddressesFromLocation(reverseGeocodeRequest).then((data) => { console.info('[lbs_js] getAddressesFromLocation04 promise: ' + JSON.stringify(data)); @@ -199,14 +199,14 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0005 + * @tc.number SUB_HSS_LocationSystem_Geo_0500 * @tc.name TestgetAddressesFromLocation * @tc.desc Obtaining Multiple Addresses Using the Address Resolution Function. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0005', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_0500', 0, async function (done) { let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 121.62771, "maxItems": 5 }; await geolocation.getAddressesFromLocation(reverseGeocodeRequest).then((data) => { console.info('[lbs_js] getAddressesFromLocation05 promise: ' + JSON.stringify(data)); @@ -221,14 +221,14 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0006 + * @tc.number SUB_HSS_LocationSystem_Geo_0600 * @tc.name TestgetAddressesFromLocation * @tc.desc Input parameter boundary test of the address resolution function * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0006', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_0600', 0, async function (done) { let reverseGeocodeRequest1 = { "latitude": 90, "longitude": 121.62771, "maxItems": 1 }; await geolocation.getAddressesFromLocation(reverseGeocodeRequest1).then((data) => { console.info('[lbs_js] getAddressesFromLocation0601 promise: ' + JSON.stringify(data)); @@ -267,14 +267,14 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0007 + * @tc.number SUB_HSS_LocationSystem_Geo_0700 * @tc.name TestgetAddressesFromLocation * @tc.desc Input parameter boundary test of the address resolution function * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0007', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_0700', 0, async function (done) { let reverseGeocodeRequest = { "latitude": 31.265496, "longitude": 180, "maxItems": 1 }; await geolocation.getAddressesFromLocation(reverseGeocodeRequest).then((data) => { console.info('[lbs_js] getAddressesFromLocation0701 promise: ' + JSON.stringify(data)); @@ -313,14 +313,14 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0008 + * @tc.number SUB_HSS_LocationSystem_Geo_0800 * @tc.name TestgetAddressesFromLocation * @tc.desc Reverse address resolution test. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0008', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_0800', 0, async function (done) { let geocodeRequest = { "description": "上海市浦东新区金穗路1800号", "maxItems": 1, @@ -330,56 +330,62 @@ describe('geolocationTest_geo1', function () { "maxLatitude": "", "maxLongitude": "" }; - geolocation.getAddressesFromLocationName(geocodeRequest, (err, data) => { - if (err) { - switch (err) { - case 100: - console.info("NOT_SUPPORTED: " + JSON.stringify(err)); - break; - case 101: - console.info("INPUT_PARAMS_ERROR: " + JSON.stringify(err)); - break; - case 102: - console.info("REVERSE_GEOCODE_ERROR: " + JSON.stringify(err)); - break; - case 103: - console.info("GEOCODE_ERROR: " + JSON.stringify(err)); - break; - case 104: - console.info("LOCATOR_ERROR: " + JSON.stringify(err)); - break; - case 105: - console.info("LOCATION_SWITCH_ERROR: " + JSON.stringify(err)); - break; - case 106: - console.info("LAST_KNOWN_LOCATION_ERROR: " + JSON.stringify(err)); - break; - case 107: - console.info("LOCATION_REQUEST_TIMEOUT_ERROR: " + JSON.stringify(err)); - break; - case 108: - console.info("QUERY_COUNTRY_CODE_ERROR: " + JSON.stringify(err)); - break; - default: - console.info('[lbs_js] getAddressesFromLocationName callback err is : ' + JSON.stringify(err)); + try { + geolocation.getAddressesFromLocationName(geocodeRequest, (err, data) => { + if (err) { + switch (err) { + case 100: + console.info("NOT_SUPPORTED: " + JSON.stringify(err)); + break; + case 101: + console.info("INPUT_PARAMS_ERROR: " + JSON.stringify(err)); + break; + case 102: + console.info("REVERSE_GEOCODE_ERROR: " + JSON.stringify(err)); + break; + case 103: + console.info("GEOCODE_ERROR: " + JSON.stringify(err)); + break; + case 104: + console.info("LOCATOR_ERROR: " + JSON.stringify(err)); + break; + case 105: + console.info("LOCATION_SWITCH_ERROR: " + JSON.stringify(err)); + break; + case 106: + console.info("LAST_KNOWN_LOCATION_ERROR: " + JSON.stringify(err)); + break; + case 107: + console.info("LOCATION_REQUEST_TIMEOUT_ERROR: " + JSON.stringify(err)); + break; + case 108: + console.info("QUERY_COUNTRY_CODE_ERROR: " + JSON.stringify(err)); + break; + default: + console.info('getAddressesFromLocationName callback err: ' + JSON.stringify(err)); + } + } else { + console.info("[lbs_js] getAddressesFromLocationName08 callback data is: " + JSON.stringify(data)); + expect(true).assertEqual((JSON.stringify(data)) != null); } - } else { - console.info("[lbs_js] getAddressesFromLocationName08 callback data is: " + JSON.stringify(data)); - expect(true).assertEqual((JSON.stringify(data)) != null); - } - done(); - }); + done(); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } + done(); }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0009 + * @tc.number SUB_HSS_LocationSystem_Geo_0900 * @tc.name TestgetAddressesFromLocation * @tc.desc Reverse address resolution test. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0009', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_0900', 0, async function (done) { let geocodeRequest = { "description": "上海市浦东新区金穗路1800号", "maxItems": 1 }; await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => { console.info("[lbs_js] getAddressesFromLocation callback data is: " + JSON.stringify(result)); @@ -392,14 +398,14 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0010 + * @tc.number SUB_HSS_LocationSystem_Geo_1000 * @tc.name TestgetAddressesFromLocation * @tc.desc Obtaining Multiple Locations Using the Reverse Address Resolution Function. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0010', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_1000', 0, async function (done) { let geocodeRequest = { "description": "上海市浦东新区金穗路1800号", "maxItems": 5 }; await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => { console.info("[lbs_js] getAddressesFromLocation m callback data is: " + JSON.stringify(result)); @@ -413,44 +419,54 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0011 + * @tc.number SUB_HSS_LocationSystem_Geo_1100 * @tc.name TestgetAddressesFromLocation * @tc.desc Invalid parameter input test for the reverse address resolution function. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0011', 0, async function (done) { - let geocodeRequest = { "description": "", "maxItems": 1 }; - await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => { - console.info("[lbs_js] getAddressesFromLocation promise data is: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); - }); + it('SUB_HSS_LocationSystem_Geo_1100', 0, async function (done) { + try { + + let geocodeRequest = { "description": "", "maxItems": 1 }; + await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => { + console.info("[lbs_js] getAddressesFromLocation promise data is: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + console.info('[lbs_js] not support now'); + expect(true).assertEqual(JSON.stringify(error) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest1 = { "description": null, "maxItems": 1 }; - await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => { - console.info("[lbs_js] getAddressesFromLocation promise data is: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); - }); + try { + await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => { + console.info("[lbs_js] getAddressesFromLocation callback data is: " + JSON.stringify(result)); + expect(result.length == 0).assertTrue(); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(true).assertEqual((JSON.stringify(error)) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } done(); }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0012 + * @tc.number SUB_HSS_LocationSystem_Geo_1200 * @tc.name TestgetAddressesFromLocation * @tc.desc Test the reverse address resolution function in the specified range.. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0012', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_1200', 0, async function (done) { let geocodeRequest = { "description": "上海金穗路1800号", "maxItems": 1, @@ -471,7 +487,7 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0013 + * @tc.number SUB_HSS_LocationSystem_Geo_1300 * @tc.name TestgetAddressesFromLocation * @tc.desc Invalid input parameter test for the reverse address resolution function in the specified range * -Invalid location name. @@ -479,7 +495,7 @@ describe('geolocationTest_geo1', function () { * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0013', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_1300', 0, async function (done) { let geocodeRequest = { "description": "", "maxItems": 1, @@ -488,13 +504,18 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 31.1537977881, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => { - console.info("[lbs_js] getAddressesFromLocation callback data is: " + JSON.stringify(result)); - expect(result.length == 0).assertTrue(); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); - }); + try { + await geolocation.getAddressesFromLocationName(geocodeRequest).then((result) => { + console.info("[lbs_js] getAddressesFromLocation callback data is: " + JSON.stringify(result)); + expect(result.length == 0).assertTrue(); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(true).assertEqual((JSON.stringify(error)) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest1 = { "description": null, "maxItems": 1, @@ -503,18 +524,23 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 31.1537977881, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => { - console.info("[lbs_js] getAddressesFromLocation callback data is: " + JSON.stringify(result)); - expect(result.length == 0).assertTrue(); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); - }); + try { + await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => { + console.info("[lbs_js] getAddressesFromLocation callback data is: " + JSON.stringify(result)); + expect(result.length == 0).assertTrue(); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(true).assertEqual((JSON.stringify(error)) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } done(); }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0014 + * @tc.number SUB_HSS_LocationSystem_Geo_1400 * @tc.name TestgetAddressesFromLocation * @tc.desc Invalid input parameter test for the reverse address resolution function in the specified range * - the address is not in the range. @@ -522,7 +548,7 @@ describe('geolocationTest_geo1', function () { * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0014', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_1400', 0, async function (done) { let geocodeRequest = { "description": "北京天安门", "maxItems": 1, @@ -543,7 +569,7 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0015 + * @tc.number SUB_HSS_LocationSystem_Geo_1500 * @tc.name TestgetAddressesFromLocation * @tc.desc Invalid longitude and latitude entered for the reverse address resolution * function in the specified range. The longitude and latitude range boundary is inverted.. @@ -551,7 +577,7 @@ describe('geolocationTest_geo1', function () { * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0015', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_1500', 0, async function (done) { let geocodeRequest = { "description": "北京天安门", "maxItems": 1, @@ -572,14 +598,14 @@ describe('geolocationTest_geo1', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0016 + * @tc.number SUB_HSS_LocationSystem_Geo_1600 * @tc.name TestgetAddressesFromLocation * @tc.desc Input parameter boundary test for the reverse address resolution function in a specified range. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0016', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_1600', 0, async function (done) { let geocodeRequest1 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -588,14 +614,19 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 31.1537977881, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise1: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise1: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + console.info('[lbs_js] not support now'); + expect(true).assertEqual(JSON.stringify(error) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest2 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -604,14 +635,19 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 31.1537977881, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest2).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise2: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest2).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise2: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + console.info('[lbs_js] not support now'); + expect(true).assertEqual(JSON.stringify(error) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest3 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -620,13 +656,18 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 31.1537977881, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest3).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise3: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) == null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest3).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise3: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) == null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(true).assertEqual((JSON.stringify(error)) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest4 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -635,14 +676,19 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 31.1537977881, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest4).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise4: " + JSON.stringify(result)); - console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest4).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise4: " + JSON.stringify(result)); + console.info('[lbs_js] not support now'); + expect(true).assertEqual(JSON.stringify(error) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(true).assertEqual((JSON.stringify(error)) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest5 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -651,14 +697,19 @@ describe('geolocationTest_geo1', function () { "maxLatitude": -90, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest5).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise5: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); - }); + try { + await geolocation.getAddressesFromLocationName(geocodeRequest5).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise5: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + console.info('[lbs_js] not support now'); + expect(true).assertEqual(JSON.stringify(error) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest6 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -667,14 +718,19 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 90, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest6).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise6: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest6).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise6: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + console.info('[lbs_js] not support now'); + expect(true).assertEqual(JSON.stringify(error) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest7 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -683,13 +739,18 @@ describe('geolocationTest_geo1', function () { "maxLatitude": -90.1, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest7).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise7: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) == null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest7).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise7: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) == null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(true).assertEqual((JSON.stringify(error)) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest8 = { "description": "上海金穗路1800号", "maxItems": 1, @@ -698,25 +759,30 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 90.1, "maxLongitude": 121.8026736943 }; - await geolocation.getAddressesFromLocationName(geocodeRequest8).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise8: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) == null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(true).assertEqual((JSON.stringify(error)) != null); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest8).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise8: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) == null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(true).assertEqual((JSON.stringify(error)) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } done() }) /** - * @tc.number SUB_HSS_LocationSystem_Geo_0017 + * @tc.number SUB_HSS_LocationSystem_Geo_1700 * @tc.name TestgetAddressesFromLocation * @tc.desc Longitude input parameter boundary test for the reverse address resolution function in a specified range * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Geo_0017', 0, async function (done) { + it('SUB_HSS_LocationSystem_Geo_1700', 0, async function (done) { let geocodeRequest1 = { "description": "北京天安门", "maxItems": 1, @@ -725,14 +791,19 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 39.95, "maxLongitude": 116.45 }; - await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise1: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - console.info('[lbs_js] not support now'); - expect(true).assertEqual(JSON.stringify(error) != null); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest1).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise1: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + console.info('[lbs_js] not support now'); + expect(true).assertEqual(JSON.stringify(error) != null); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest2 = { "description": "北京天安门", "maxItems": 1, @@ -741,13 +812,18 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 39.95, "maxLongitude": 116.45 }; - await geolocation.getAddressesFromLocationName(geocodeRequest2).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise2: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest2).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise2: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(error.length != 0).assertTrue(); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest3 = { "description": "北京天安门", "maxItems": 1, @@ -756,13 +832,18 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 39.95, "maxLongitude": 116.45 }; - await geolocation.getAddressesFromLocationName(geocodeRequest3).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise3: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest3).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise3: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(error.length != 0).assertTrue(); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest4 = { "description": "北京天安门", "maxItems": 1, @@ -771,13 +852,18 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 39.95, "maxLongitude": 116.45 }; - await geolocation.getAddressesFromLocationName(geocodeRequest4).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise4: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest4).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise4: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(error.length != 0).assertTrue(); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest5 = { "description": "北京天安门", "maxItems": 1, @@ -786,13 +872,18 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 39.95, "maxLongitude": -180 }; - await geolocation.getAddressesFromLocationName(geocodeRequest5).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise5: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest5).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise5: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(error.length != 0).assertTrue(); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest6 = { "description": "北京天安门", "maxItems": 1, @@ -801,13 +892,18 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 39.95, "maxLongitude": 180 }; - await geolocation.getAddressesFromLocationName(geocodeRequest6).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise6: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest6).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise6: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(error.length != 0).assertTrue(); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest7 = { "description": "北京天安门", "maxItems": 1, @@ -816,13 +912,18 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 39.95, "maxLongitude": -180.1 }; - await geolocation.getAddressesFromLocationName(geocodeRequest7).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise7: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest7).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise7: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(error.length != 0).assertTrue(); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } let geocodeRequest8 = { "description": "北京天安门", "maxItems": 1, @@ -831,13 +932,19 @@ describe('geolocationTest_geo1', function () { "maxLatitude": 39.95, "maxLongitude": 180.1 }; - await geolocation.getAddressesFromLocationName(geocodeRequest8).then((result) => { - console.info("[lbs_js]getAddressesFromLocation promise8: " + JSON.stringify(result)); - expect(true).assertEqual((JSON.stringify(result)) != null); - }).catch((error) => { - console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); - expect(error.length != 0).assertTrue(); - }); + try{ + await geolocation.getAddressesFromLocationName(geocodeRequest8).then((result) => { + console.info("[lbs_js]getAddressesFromLocation promise8: " + JSON.stringify(result)); + expect(true).assertEqual((JSON.stringify(result)) != null); + }).catch((error) => { + console.info("[lbs_js] getAddressesFromLocationName promise then error." + JSON.stringify(error)); + expect(error.length != 0).assertTrue(); + }); + }catch(error){ + console.info("[lbs_js] getAddressesFromLocationName message." + JSON.stringify(error.message)); + expect(true).assertEqual((JSON.stringify(error.message)) != null); + } done(); }) }) + diff --git a/location/geolocation_standard/src/main/js/default/test/GetCountryCode.test.js b/location/geolocation_standard/src/main/js/default/test/GetCountryCode.test.js index adcc564f0d8228a5ad552df8c7b500af7e731cdc..574640c402b3c9bf883acaf7c909086cab8c8605 100644 --- a/location/geolocation_standard/src/main/js/default/test/GetCountryCode.test.js +++ b/location/geolocation_standard/src/main/js/default/test/GetCountryCode.test.js @@ -90,13 +90,13 @@ describe('geolocationTest_4', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_CountryCode_0001 + * @tc.number SUB_HSS_LocationSystem_CountryCode_0100 * @tc.name Test getCountryCode * @tc.desc Obtaining Country Code Information * @tc.type Function * @tc.level since 9 */ - it('SUB_HSS_LocationSystem_CountryCode_0001', 0, async function (done) { + it('SUB_HSS_LocationSystem_CountryCode_0100', 0, async function (done) { await geolocation.getCountryCode().then((result) => { console.info("[lbs_js] getCountryCode promise result: " + JSON.stringify(result)); console.info("[lbs_js] country :" + result.country); @@ -113,20 +113,21 @@ describe('geolocationTest_4', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_CountryCode_0002 + * @tc.number SUB_HSS_LocationSystem_CountryCode_0200 * @tc.name Test getCountryCode * @tc.desc Obtaining Country Code Information * @tc.type Function * @tc.level since 9 */ - it('SUB_HSS_LocationSystem_CountryCode_0002', 0, async function (done) { + it('SUB_HSS_LocationSystem_CountryCode_0200', 0, async function (done) { function getCountryCodeCallback() { return new Promise((resolve, reject) => { - geolocation.getCountryCode((err) => { + geolocation.getCountryCode((err,data) => { if (err) { return console.info("getCountryCode callback err: " + JSON.stringify(err)); } else { - console.info("getCountryCode callback success"); + console.info("getCountryCode callback success"+ JSON.stringify(data)); + expect(true).assertEqual(data != null); } resolve(); }) @@ -137,13 +138,13 @@ describe('geolocationTest_4', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_CountryCode_0003 + * @tc.number SUB_HSS_LocationSystem_CountryCode_0300 * @tc.name getCountryCode_on_off * @tc.desc The interception country code is changed. * @tc.type Function * @tc.level since 9 */ - it('SUB_HSS_LocationSystem_CountryCode_0003', 0, async function (done) { + it('SUB_HSS_LocationSystem_CountryCode_0300', 0, async function (done) { console.info("[lbs_js]countryCodeChange"); geolocation.on('countryCodeChange', function (data) { console.info('[lbs_js] countryCodeChange' +JSON.stringify(data) ); diff --git a/location/geolocation_standard/src/main/js/default/test/LocationTest.test.js b/location/geolocation_standard/src/main/js/default/test/LocationTest.test.js index 154c321cfc67e77ca2cda94766a73c8962b21801..2c95b73039342374bbd0c0f82dc404cfa1f8ede4 100644 --- a/location/geolocation_standard/src/main/js/default/test/LocationTest.test.js +++ b/location/geolocation_standard/src/main/js/default/test/LocationTest.test.js @@ -111,14 +111,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number LocSwitch_0003 - * @tc.name SUB_HSS_LocationSystem_LocSwitch_0003 - * @tc.desc Test requestrequestEnableLocation api . + * @tc.number SUB_HSS_LocationSystem_LocSwitch_0300 + * @tc.name Test requestrequestEnableLocation api + * @tc.desc Enabling the Location Service Function for a Third-Party App - Callback * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocSwitch_0003', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocSwitch_0300', 0, async function (done) { geolocation.isLocationEnabled(async (err, data) => { if (err) { console.info('[lbs_js] getLocationSwitchState callback err is : ' + JSON.stringify(err)); @@ -132,14 +132,14 @@ describe('geolocationTest_geo3', function () { }); /** - * @tc.number LocSwitch_0004 - * @tc.name SUB_HSS_LocationSystem_LocSwitch_0004 - * @tc.desc Test requestrequestEnableLocation api . + * @tc.number LocSwitch_0400 + * @tc.name Test requestrequestEnableLocation api. + * @tc.desc Enabling the Location Service Function for a Third-Party Application -Promise Mode * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocSwitch_0004', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocSwitch_0400', 0, async function (done) { await geolocation.isLocationEnabled().then((result1) => { console.info('[lbs_js] getLocationSwitchStateLocSwitch_0004 result: ' + JSON.stringify(result1)); expect(result1).assertTrue(); @@ -150,32 +150,33 @@ describe('geolocationTest_geo3', function () { }); /** - * @tc.number LocSwitch_0005 - * @tc.name SUB_HSS_LocationSystem_LocSwitch_0005 - * @tc.desc Test locationServiceState api . + * @tc.number SUB_HSS_LocationSystem_LocSwitch_0500 + * @tc.name Test locationServiceState api . + * @tc.desc Subscribe to the location service status change. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocSwitch_0005', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocSwitch_0500', 0, async function (done) { console.log('just for overwriting,locationServiceState test need system api '); var locationServiceState = (state) => { console.log('locationServiceState: state: ' + JSON.stringify(state)); } geolocation.on('locationServiceState', locationServiceState); geolocation.off('locationServiceState', locationServiceState); + expect(true).assertTrue(); done(); }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0001 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0100 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request in a specified scenario and set the navigation scenario.. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0001', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0100', 0, async function (done) { let currentLocationRequest = { "priority": 0x200, "scenario": 0x301, "timeoutMs": 1000, "maxAccuracy": 0 }; function getCurrentLocationCallback() { return new Promise((resolve, reject) => { @@ -193,24 +194,25 @@ describe('geolocationTest_geo3', function () { }) } console.info('getCurrentLocationCallback start'); - await getCurrentLocationCallback().then(() => { - console.info('getCurrentLocationCallback resolve'); - }, () => { - console.info('getCurrentLocationCallback reject'); - }); - console.info('getCurrentLocationCallback end'); + await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { + console.info("getCurrentLocation callback_0003, result: " + JSON.stringify(result)); + expect(true).assertEqual(result != null); + }).catch(error => { + console.info('getCurrentLocation callback_0003:' + JSON.stringify(error)); + expect(true).assertEqual(JSON.stringify(error) != null); + }) done(); }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0002 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0200 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request in a specified scenario and set the navigation scenario.. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0002', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0200', 0, async function (done) { let currentLocationRequest = { "priority": 0x203, "scenario": 0x301, "timeoutMs": 1000, "maxAccuracy": 0 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { console.info('[lbs_js] getCurrentLocation promise result ' + JSON.stringify(result)); @@ -223,14 +225,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0003 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0300 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request in a specified scenario and set the track tracing scenario. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0003', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0300', 0, async function (done) { let currentLocationRequest = { "priority": 0x200, "scenario": 0x302, "timeoutMs": 1000, "maxAccuracy": 10 }; function getCurrentLocationCallback() { return new Promise((resolve, reject) => { @@ -248,24 +250,25 @@ describe('geolocationTest_geo3', function () { }) } console.info('getCurrentLocationCallback start'); - await getCurrentLocationCallback().then(() => { - console.info('getCurrentLocationCallback resolve'); - }, () => { - console.info('getCurrentLocationCallback reject'); - }); - console.info('getCurrentLocationCallback end'); + await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { + console.info("getCurrentLocation callback_0003, result: " + JSON.stringify(result)); + expect(true).assertEqual(result != null); + }).catch(error => { + console.info('getCurrentLocation callback_0003:' + JSON.stringify(error)); + expect(true).assertEqual(JSON.stringify(error) != null); + }) done(); }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0004 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0400 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request in a specified scenario and set a car-sharing scenario. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0004', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0400', 0, async function (done) { let currentLocationRequest = { "priority": 0x200, "scenario": 0x303, "timeoutMs": 1000, "maxAccuracy": 10 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { console.info('[lbs_js] getCurrentLocation promise result004 ' + JSON.stringify(result)); @@ -278,14 +281,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0005 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0500 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request in a specified scenario and set the life service scenario.. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0005', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0500', 0, async function (done) { let currentLocationRequest = { "priority": 0x200, "scenario": 0x304, "timeoutMs": 1000, "maxAccuracy": 0 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { console.info('[lbs_js] getCurrentLocation promise result005 ' + JSON.stringify(result)); @@ -298,7 +301,7 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0006 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0600 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request in a specified scenario * and set the scenario with no power consumption. @@ -306,7 +309,7 @@ describe('geolocationTest_geo3', function () { * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0006', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0600', 0, async function (done) { let currentLocationRequest1 = { "priority": 0x200, "scenario": 0x305, "timeoutMs": 1000, "maxAccuracy": 10 }; let currentLocationRequest2 = { "priority": 0x200, "scenario": 0x301, "timeoutMs": 1000, "maxAccuracy": 10 }; await geolocation.getCurrentLocation(currentLocationRequest1).then((result) => { @@ -326,14 +329,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0007 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0700 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request with the parameter set to high-precision priority location request. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0007', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0700', 0, async function (done) { let currentLocationRequest = { "priority": 0x0201, "scenario": 0x0300, "timeoutMs": 1000, "maxAccuracy": 10 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { console.info('[lbs_js] getCurrentLocation promise result007 ' + JSON.stringify(result)); @@ -346,14 +349,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0008 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0800 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request with parameters set to fast location and priority location request. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0008', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0800', 0, async function (done) { let currentLocationRequest = { "priority": 0x0203, "scenario": 0x0300, "timeoutMs": 1000, "maxAccuracy": 10 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { console.info('[lbs_js] getCurrentLocation promise result010 ' + JSON.stringify(result)); @@ -366,14 +369,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0009 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_0900 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request with parameters set to low power consumption. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0009', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_0900', 0, async function (done) { let currentLocationRequest = { "priority": 0x0202, "scenario": 0x0300, "timeoutMs": 1000, "maxAccuracy": 0 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { console.info('[lbs_js] getCurrentLocation promise result009 ' + JSON.stringify(result)); @@ -386,14 +389,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0010 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_1000 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request and set the location reporting precision. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0010', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_1000', 0, async function (done) { let currentLocationRequest = { "priority": 0x0200, "scenario": 0x0300, "timeoutMs": 1000, "maxAccuracy": 5 }; let currentLocationRequest1 = { "priority": 0x0200, "scenario": 0x0300, "timeoutMs": 1000, "maxAccuracy": 2 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { @@ -412,7 +415,7 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0011 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_1100 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request for specific configuration * and set the reporting precision of abnormal location. @@ -420,7 +423,7 @@ describe('geolocationTest_geo3', function () { * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0011', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_1100', 0, async function (done) { let currentLocationRequest = { "priority": 0x0201, "scenario": 0x0300, "timeoutMs": 1000, "maxAccuracy": 0 }; let currentLocationRequest1 = { "priority": 0x0201, "scenario": 0x0300, "timeoutMs": 1000, "maxAccuracy": -1 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { @@ -440,14 +443,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0012 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_1200 * @tc.name Test getCurrentLocation * @tc.desc Initiate a single location request and set the location timeout interval. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0012', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_1200', 0, async function (done) { let currentLocationRequest = { "priority": 0x0201, "scenario": 0x0301, "timeoutMs": 1000, "maxAccuracy": 0 }; let currentLocationRequest1 = { "priority": 0x0201, "scenario": 0x0301, "timeoutMs": 1000, "maxAccuracy": 0 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { @@ -467,14 +470,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_SingleLoc_0013 + * @tc.number SUB_HSS_LocationSystem_SingleLoc_1300 * @tc.name Test getCurrentLocation * @tc.desc Initiate a specified single location request and set the exception location timeout interval. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_SingleLoc_0013', 0, async function (done) { + it('SUB_HSS_LocationSystem_SingleLoc_1300', 0, async function (done) { let currentLocationRequest = { "priority": 0x0201, "scenario": 0x0302, "timeoutMs": 0, "maxAccuracy": 0 }; let currentLocationRequest1 = { "priority": 0x0201, "scenario": 0x0302, "timeoutMs": -1000, "maxAccuracy": 0 }; await geolocation.getCurrentLocation(currentLocationRequest).then((result) => { @@ -496,14 +499,14 @@ describe('geolocationTest_geo3', function () { /** - * @tc.number SUB_HSS_SendCommand_callback + * @tc.number SUB_HSS_SendCommand_0100 * @tc.name Test sendCommand * @tc.desc Test sendCommand api . * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_SendCommand_callback', 0, async function (done) { + it('SUB_HSS_SendCommand_0100', 0, async function (done) { let requestInfo = { 'scenairo': 0x301, 'command': "command_1" }; await geolocation.sendCommand(requestInfo, (err, result) => { if (err) { @@ -516,14 +519,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_SendCommand_promise + * @tc.number SUB_HSS_SendCommand_0200 * @tc.name Test sendCommand * @tc.desc Test sendCommand1 api . * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_SendCommand_promise', 0, async function (done) { + it('SUB_HSS_SendCommand_0200', 0, async function (done) { let requestInfo = { 'scenairo': 0x301, 'command': "command_1" }; geolocation.sendCommand(requestInfo).then((result) => { console.info('sendCommand promise result:' + result); @@ -536,14 +539,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0001 + * @tc.number SUB_HSS_LocationSystem_LocRequest_0100 * @tc.name Test locationChange * @tc.desc Initiate a request for continuous positioning in a specified scenario and set the navigation scenario. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0001', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_0100', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x301, "timeInterval":5, "distanceInterval": 0, "maxAccuracy": 0}; @@ -557,14 +560,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0002 + * @tc.number SUB_HSS_LocationSystem_LocRequest_0200 * @tc.name Test locationChange * @tc.desc Initiate a request for continuous positioning in a specified scenario and set a track tracing scenario. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0002', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_0200', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x302, "timeInterval":1, "distanceInterval": 5, "maxAccuracy": 10}; @@ -578,14 +581,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0003 + * @tc.number SUB_HSS_LocationSystem_LocRequest_0300 * @tc.name Test locationChange * @tc.desc Initiate a continuous location request in a specified scenario and set a car-sharing scenario. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0003', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_0300', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x303, "timeInterval":5, "distanceInterval": 5, "maxAccuracy": 10}; @@ -599,14 +602,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0004 + * @tc.number SUB_HSS_LocationSystem_LocRequest_0400 * @tc.name Test locationChange * @tc.desc Initiate a continuous location request in a specified scenario and set a life service scenario. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0004', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_0400', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x303, "timeInterval":1, "distanceInterval": 5, "maxAccuracy": 0}; @@ -620,7 +623,7 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0005 + * @tc.number SUB_HSS_LocationSystem_LocRequest_0500 * @tc.name Test locationChange * @tc.desc Initiate a continuous location request in a specified scenario * and set the scenario with no power consumption. @@ -628,7 +631,7 @@ describe('geolocationTest_geo3', function () { * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0005', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_0500', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x305, "timeInterval":1, "distanceInterval": 5, "maxAccuracy": 10}; @@ -648,7 +651,7 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0007 + * @tc.number SUB_HSS_LocationSystem_LocRequest_0700 * @tc.name Test locationChange * @tc.desc Initiate a specified continuous positioning request and * set the parameter to high-precision priority positioning request. @@ -656,7 +659,7 @@ describe('geolocationTest_geo3', function () { * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0007', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_0700', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x201, "scenario":0x300, "timeInterval":1, "distanceInterval": 5, "maxAccuracy": 10}; @@ -670,7 +673,7 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0008 + * @tc.number SUB_HSS_LocationSystem_LocRequest_0800 * @tc.name Test locationChange * @tc.desc Initiate a specified continuous positioning request with the parameter * set to fast positioning and priority positioning request. @@ -678,7 +681,7 @@ describe('geolocationTest_geo3', function () { * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0008', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_0800', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x203, "scenario":0x300, "timeInterval":5, "distanceInterval": 5, "maxAccuracy": 10}; @@ -692,7 +695,7 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0009 + * @tc.number SUB_HSS_LocationSystem_LocRequest_0900 * @tc.name Test locationChange * @tc.desc Initiate a specified continuous positioning request with the parameter * set to low power consumption type. @@ -700,7 +703,7 @@ describe('geolocationTest_geo3', function () { * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0009', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_0900', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x202, "scenario":0x300, "timeInterval":1, "distanceInterval": 5, "maxAccuracy": 10} @@ -714,14 +717,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0010 + * @tc.number SUB_HSS_LocationSystem_LocRequest_1000 * @tc.name Test locationChange * @tc.desc Initiate a specified continuous location request and set the reporting interval. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0010', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_1000', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x301, "timeInterval":3, "distanceInterval": 0, "maxAccuracy": 0}; @@ -735,14 +738,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0011 + * @tc.number SUB_HSS_LocationSystem_LocRequest_1100 * @tc.name Test locationChange * @tc.desc Initiate a specified continuous location request and set the location reporting interval. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0011', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_1100', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x301, "timeInterval":5, "distanceInterval": 0, "maxAccuracy": 0}; @@ -756,14 +759,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0012 + * @tc.number SUB_HSS_LocationSystem_LocRequest_1200 * @tc.name Test locationChange * @tc.desc Initiate a specified continuous location request and set the interval for reporting exceptions. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0012', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_1200', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x301, "timeInterval":0, "distanceInterval": 0, "maxAccuracy": 0}; @@ -777,14 +780,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0013 + * @tc.number SUB_HSS_LocationSystem_LocRequest_1300 * @tc.name Test locationChange * @tc.desc Initiate a specified continuous location request and set the interval for reporting abnormal locations. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0013', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_1300', 0, async function (done) { enableLocationSwitch(); let requestInfo1 = {"priority":0x200, "scenario":0x301, "timeInterval":0, "distanceInterval": 0, "maxAccuracy": 0}; @@ -806,14 +809,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0014 + * @tc.number SUB_HSS_LocationSystem_LocRequest_1400 * @tc.name Test locationChange * @tc.desc Initiate a specified continuous positioning request and set the positioning reporting precision. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0014', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_1400', 0, async function (done) { enableLocationSwitch(); let requestInfo1 = {"priority":0x200, "scenario":0x301, "timeInterval":0, "distanceInterval": 0, "maxAccuracy": 5}; @@ -835,14 +838,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LocRequest_0015 + * @tc.number SUB_HSS_LocationSystem_LocRequest_1500 * @tc.name Test locationChange * @tc.desc Initiate a specified continuous location request and set the reporting precision of abnormal location. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LocRequest_0015', 0, async function (done) { + it('SUB_HSS_LocationSystem_LocRequest_1500', 0, async function (done) { enableLocationSwitch(); let requestInfo1 = {"priority":0x200, "scenario":0x301, "timeInterval":0, "distanceInterval": 0, "maxAccuracy": 0}; @@ -864,14 +867,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LastLoc_0001 + * @tc.number SUB_HSS_LocationSystem_LastLoc_0100 * @tc.name Test getLastLocation * @tc.desc Obtain the last location after a single location. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LastLoc_0001', 0, async function(done) { + it('SUB_HSS_LocationSystem_LastLoc_0100', 0, async function(done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x301, "timeInterval":0, "distanceInterval": 0, "maxAccuracy": 0}; @@ -888,7 +891,8 @@ describe('geolocationTest_geo3', function () { ' longitude: ' + result.longitude +' altitude: ' + result.altitude +' accuracy: ' + result.accuracy+' speed: ' + result.speed + 'timeStamp: ' + result.timeStamp+'direction:' + result.direction+' timeSinceBoot: ' - + result.timeSinceBoot +'additions: ' + result.additions+' additionSize' + result.additionSize); + + result.timeSinceBoot +'additions: ' + result.additions+' additionSize' + result.additionSize + + 'isFromMock' +result.isFromMock); }).catch((error) => { console.info("[lbs_js] getLastLocation promise then error:" + JSON.stringify(error)); console.info('[lbs_js] not support now'); @@ -898,14 +902,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_LastLoc_0002 + * @tc.number SUB_HSS_LocationSystem_LastLoc_0200 * @tc.name Test getLastLocation * @tc.desc Obtain the last location after continuous positioning. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_LastLoc_0002', 0, async function (done) { + it('SUB_HSS_LocationSystem_LastLoc_0200', 0, async function (done) { enableLocationSwitch(); let requestInfo = {"priority":0x200, "scenario":0x301, "timeInterval":0, "distanceInterval": 0, "maxAccuracy": 0}; @@ -915,27 +919,34 @@ describe('geolocationTest_geo3', function () { }; geolocation.on('locationChange', requestInfo, locationChange); geolocation.off('locationChange', locationChange); - geolocation.getLastLocation(async (err, data) => { - if (err) { - console.info('[LastLoc_0002] getLastLocation callback err is : ' + JSON.stringify(err)); - } else { - console.info('[LastLoc_0002] getLastLocation callback result: ' + JSON.stringify(data)); - expect(data).assertTrue(); - } - done() - }) + + function getLastLocationCallback(){ + return new Promise((resolve, reject)=>{ + geolocation.getLastLocation((err, data) => { + if (err) { + console.info('[LastLoc_0002] getLastLocation callback err is : ' + JSON.stringify(err)); + expect(true).assertEqual(err !=null); + } else { + console.info('[LastLoc_0002] getLastLocation callback result: ' + JSON.stringify(data)); + expect(true).assertEqual(data !=null); + } + resolve(); + }); + }) + } + await getLastLocationCallback(); done(); }) /** - * @tc.number SUB_HSS_LocationSystem_Gnss_0001 + * @tc.number SUB_HSS_LocationSystem_Gnss_0100 * @tc.name Test gnssStatusChange * @tc.desc Monitoring Satellite Information Reporting * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Gnss_0001', 0, async function (done) { + it('SUB_HSS_LocationSystem_Gnss_0100', 0, async function (done) { await changedLocationMode(); var gnssStatusCb = (satelliteStatusInfo) => { console.info('gnssStatusChange: ' + satelliteStatusInfo); @@ -960,14 +971,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Gnss_0002 + * @tc.number SUB_HSS_LocationSystem_Gnss_0200 * @tc.name Test nmeaMessageChange * @tc.desc Monitoring NMEA Information Reporting * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Gnss_0002', 0, async function (done) { + it('SUB_HSS_LocationSystem_Gnss_0200', 0, async function (done) { await changedLocationMode(); let requestInfo = {"priority":0x200, "scenario":0x301, "timeInterval":0, "distanceInterval": 0, "maxAccuracy": 0}; @@ -986,14 +997,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Batching_0001 + * @tc.number SUB_HSS_LocationSystem_Batching_0100 * @tc.name Test cachedGnssLocationsReporting * @tc.desc Setting the Gnss Batching Reporting Interval * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Batching_0001', 0, async function (done) { + it('SUB_HSS_LocationSystem_Batching_0100', 0, async function (done) { var cachedLocationsCb1 = (locations) => { console.log('cachedGnssLocationsReporting: locations: ' + JSON.stringify(locations)); expect(true).assertEqual(locations !=null); @@ -1012,14 +1023,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Batching_0002 + * @tc.number SUB_HSS_LocationSystem_Batching_0200 * @tc.name Test cachedGnssLocationsReporting * @tc.desc Setting the Gnss Batching Cache Queue to Be Reported When the Gnss Batching Cache Queue Is Full * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Batching_0002', 0, async function (done) { + it('SUB_HSS_LocationSystem_Batching_0200', 0, async function (done) { var cachedLocationsCb = (locations) => { console.log('cachedGnssLocationsReporting: locations: ' + JSON.stringify(locations)); expect(true).assertEqual(locations !=null); @@ -1033,14 +1044,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Batching_0003 + * @tc.number SUB_HSS_LocationSystem_Batching_0300 * @tc.name Test getCachedGnssLocationsSize * @tc.desc Obtains the number of GNSS data records in the batching process. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Batching_0003', 0, async function (done) { + it('SUB_HSS_LocationSystem_Batching_0300', 0, async function (done) { var cachedLocationsCb = (locations) => { console.log('cachedGnssLocationsReporting: locations: ' + JSON.stringify(locations)); expect(true).assertEqual(locations !=null); @@ -1050,29 +1061,33 @@ describe('geolocationTest_geo3', function () { "distanceInterval": 0, "maxAccuracy": 0}; geolocation.on('cachedGnssLocationsReporting', CachedGnssLoactionsRequest, cachedLocationsCb); geolocation.off('cachedGnssLocationsReporting',cachedLocationsCb); - geolocation.getCachedGnssLocationsSize((err, data) => { - if (err) { - console.info('[lbs_js] getCachedGnssLocationsSize callback err is : ' + err); - expect(true).assertTrue(err != null); - done(); - }else { - console.info("[lbs_js] getCachedGnssLocationsSize callback data is: " + JSON.stringify(data)); - expect(true).assertTrue(data != null); - done() - } - }); + function getCachedGnssLocationsSizeCallback(){ + return new Promise((resolve, reject)=>{ + geolocation.getCachedGnssLocationsSize((err, data) => { + if (err) { + console.info('[lbs_js] getCachedGnssLocationsSize callback err is : ' + JSON.stringify(err)); + expect(true).assertTrue(err != null); + }else { + console.info("[lbs_js] getCachedGnssLocationsSize callback data is: " + JSON.stringify(data)); + expect(true).assertTrue(data != null); + } + resolve(); + }); + }) + } + await getCachedGnssLocationsSizeCallback(); done(); }) /** - * @tc.number SUB_HSS_LocationSystem_Batching_0004 + * @tc.number SUB_HSS_LocationSystem_Batching_0400 * @tc.name Test getCachedGnssLocationsSize * @tc.desc Obtains the number of GNSS data records in the batching process. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Batching_0004', 0, async function (done) { + it('SUB_HSS_LocationSystem_Batching_0400', 0, async function (done) { var cachedLocationsCb = (locations) => { console.log('cachedGnssLocationsReporting: locations: ' + JSON.stringify(locations)); expect(true).assertEqual(locations !=null); @@ -1094,14 +1109,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_Batching_0005 + * @tc.number SUB_HSS_LocationSystem_Batching_0500 * @tc.name Test flushCachedGnssLocations * @tc.desc Obtains the GNSS data of the current batching. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Batching_0005', 0, async function (done) { + it('SUB_HSS_LocationSystem_Batching_0500', 0, async function (done) { var cachedLocationsCb = (locations) => { console.log('cachedGnssLocationsReporting: locations: ' + JSON.stringify(locations)); expect(true).assertEqual(locations !=null); @@ -1111,29 +1126,33 @@ describe('geolocationTest_geo3', function () { "distanceInterval": 0, "maxAccuracy": 0}; geolocation.on('cachedGnssLocationsReporting', CachedGnssLoactionsRequest, cachedLocationsCb); geolocation.off('cachedGnssLocationsReporting',cachedLocationsCb); - geolocation.flushCachedGnssLocations((err, data) => { - if (err) { - console.info('[lbs_js] flushCachedGnssLocations callback err is : ' + err); - expect(true).assertTrue(err != null); - done(); - }else { - console.info("[lbs_js] flushCachedGnssLocations callback data is: " + JSON.stringify(data)); - expect(true).assertTrue(data); - done(); - } - }); + function flushCachedGnssLocationsCallback(){ + return new Promise((resolve, reject)=>{ + geolocation.flushCachedGnssLocations((err, data) => { + if (err) { + console.info('[lbs_js] flushCachedGnssLocations callback err is : ' + JSON.stringify(err)); + expect(true).assertTrue(err != null); + }else { + console.info("[lbs_js] flushCachedGnssLocations callback data is: " + JSON.stringify(data)); + expect(true).assertTrue(data); + } + resolve(); + }); + }) + } + await flushCachedGnssLocationsCallback(); done(); }) /** - * @tc.number SUB_HSS_LocationSystem_Batching_0006 + * @tc.number SUB_HSS_LocationSystem_Batching_0600 * @tc.name Test flushCachedGnssLocations * @tc.desc Obtain the GNSS data of the current batching. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_Batching_0006', 0, async function (done) { + it('SUB_HSS_LocationSystem_Batching_0600', 0, async function (done) { var cachedLocationsCb = (locations) => { console.log('cachedGnssLocationsReporting: locations: ' + JSON.stringify(locations)); expect(true).assertEqual(locations !=null); @@ -1156,14 +1175,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_GeoFence_0001 + * @tc.number SUB_HSS_LocationSystem_GeoFence_0100 * @tc.name Test fenceStatusChange * @tc.desc Gnss fence function test * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('SUB_HSS_LocationSystem_GeoFence_0001', 0, async function (done) { + it('SUB_HSS_LocationSystem_GeoFence_0100', 0, async function (done) { await changedLocationMode(); let geofence = {"latitude": 31.12, "longitude": 121.11, "radius": 1,"expiration": ""}; let geofenceRequest = {"priority":0x200, "scenario":0x301, "geofence": geofence}; @@ -1193,14 +1212,14 @@ describe('geolocationTest_geo3', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_GeoFence_0005 + * @tc.number SUB_HSS_LocationSystem_GeoFence_0500 * @tc.name Test fenceStatusChange * @tc.desc Test the function of locating the validity period of the fence. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 1 */ - it('SUB_HSS_LocationSystem_GeoFence_0005', 0, async function (done) { + it('SUB_HSS_LocationSystem_GeoFence_0500', 0, async function (done) { await changedLocationMode(); let geofence = {"latitude": 31.12, "longitude": 121.11, "radius": 1,"expiration": ""}; let geofenceRequest = {"priority":0x203, "scenario":0x301, "geofence": geofence}; diff --git a/location/geolocation_standard/src/main/js/default/test/SystemLocation.test.js b/location/geolocation_standard/src/main/js/default/test/SystemLocation.test.js index 0e416e6536acf7463ce575b43c315842a8a249c5..cb4abac83a06440461a88bacecdc539ec387eb1d 100644 --- a/location/geolocation_standard/src/main/js/default/test/SystemLocation.test.js +++ b/location/geolocation_standard/src/main/js/default/test/SystemLocation.test.js @@ -81,16 +81,16 @@ describe('geolocationTest_geo2', function () { }) afterEach(function () { }) - + /** - * @tc.number SUB_HSS_LocationSystem_systemapi_0001 + * @tc.number SUB_HSS_LocationSystem_systemapi_0100 * @tc.name Test getLocation * @tc.desc Obtains the geographical location of a device.. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_systemapi_0001', 0, async function (done) { + it('SUB_HSS_LocationSystem_systemapi_0100', 0, async function (done) { geolocations.getLocation({ timeout:30000, coordType:'wgs84', @@ -127,14 +127,14 @@ describe('geolocationTest_geo2', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_systemapi_0002 + * @tc.number SUB_HSS_LocationSystem_systemapi_0200 * @tc.name Test subscribe and unsubscribe * @tc.desc Test subscribe api . * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_systemapi_0002', 0, async function (done) { + it('SUB_HSS_LocationSystem_systemapi_0200', 0, async function (done) { geolocations.subscribe({ coordType:'wgs84', success: function(data) { @@ -152,14 +152,14 @@ describe('geolocationTest_geo2', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_systemapi_0003 + * @tc.number SUB_HSS_LocationSystem_systemapi_0300 * @tc.name test getLocationType * @tc.desc Subscribing to geographical location information . * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_systemapi_0003', 0, async function (done) { + it('SUB_HSS_LocationSystem_systemapi_0300', 0, async function (done) { geolocations.getLocationType({ success: function(data) { console.log('success get location type:' + JSON.stringify(data)); @@ -178,14 +178,14 @@ describe('geolocationTest_geo2', function () { }) /** - * @tc.number SUB_HSS_LocationSystem_systemapi_0004 + * @tc.number SUB_HSS_LocationSystem_systemapi_0400 * @tc.name Test getSupportedCoordTypes * @tc.desc Obtains the geographical location of a device.. * @tc.size MEDIUM * @tc.type Function * @tc.level Level 2 */ - it('SUB_HSS_LocationSystem_systemapi_0004', 0, function () { + it('SUB_HSS_LocationSystem_systemapi_0400', 0, function () { let types = geolocations.getSupportedCoordTypes(); console.info('[lbs_js] getSupportedCoordTypes result: ' + JSON.stringify(types)); expect(true).assertEqual(types.length !=0); @@ -196,9 +196,3 @@ describe('geolocationTest_geo2', function () { - - - - - - diff --git a/multimedia/BUILD.gn b/multimedia/BUILD.gn index 50ae5c0130e5152c97765fcbe49d9ddb2a432ef3..cce2a5eb49ea675ab32f629f833a3819ff4a3e10 100644 --- a/multimedia/BUILD.gn +++ b/multimedia/BUILD.gn @@ -17,13 +17,14 @@ group("multimedia") { testonly = true if (is_standard_system) { deps = [ + "audio/audio_js_standard/AudioCapturer:audio_capturer_js_hap", + "audio/audio_js_standard/AudioCapturerChangeInfo:audio_capturerchangeInfo_js_hap", + "audio/audio_js_standard/AudioEventManagement:audio_eventmanagement_js_hap", + "audio/audio_js_standard/AudioRendererChangeInfo:audio_rendererchangeInfo_js_hap", "audio/audio_js_standard/audioManager:audio_manager_js_hap", - "camera/cameraDepthOffield:camera_depthoffield_ets_hap", - "camera/cameraExceedWideAngle:camera_exceedwideangle_ets_hap", - "camera/cameraLongFocus:camera_longfocus_ets_hap", - "camera/cameraUnspc:camera_unspc_ets_hap", - "camera/cameraWideAngle:camera_wideangle_ets_hap", - "camera/cameraWideAngleRK:camera_wideanglerk_ets_hap", + "audio/audio_js_standard/audioRenderer:audio_renderer_js_hap", + "audio/audio_js_standard/audioVoip:audio_voip_js_hap", + "camera/camera_js_standard:camera_framework_ets_hap", "image/image_js_standard/image:image_js_hap", "image/image_js_standard/imageColorspace:image_colorspace_js_hap", "image/image_js_standard/imageCreator:image_creator_js_hap", @@ -33,14 +34,16 @@ group("multimedia") { "image/image_js_standard/imagePacking:image_packing_js_hap", "image/image_js_standard/imagePixelMapFramework:image_pixelmapframework_js_hap", "image/image_js_standard/imageRGBA:image_rgba_js_hap", + "image/image_js_standard/imageRaw:image_raw_js_hap", "image/image_js_standard/imageReceiver:image_receiver_js_hap", "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_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", @@ -51,6 +54,7 @@ group("multimedia") { "medialibrary/mediaLibrary_fileResult:mediaLibrary_fileResult_hap", "medialibrary/mediaLibrary_getThumbnail:mediaLibrary_getThumbnail_hap", "medialibrary/mediaLibrary_mediafetchoptions:mediaLibrary_mediafetchoptions_hap", + "medialibrary/mediaLibrary_trash:mediaLibrary_trash_js_hap", ] } else { deps = [ diff --git a/multimedia/audio/audio_js_standard/AudioCapturer/BUILD.gn b/multimedia/audio/audio_js_standard/AudioCapturer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..32c2eeb71f95f28f7a7c0b9aa2874d0599b81d01 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturer/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("audio_capturer_js_hap") { + hap_profile = "./src/main/config.json" + deps = [ + ":audio_capturer_js_assets", + ":audio_capturer_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAudioCapturerJsTest" + subsystem_name = "multimedia" + part_name = "multimedia_audio_framework" +} +ohos_js_assets("audio_capturer_js_assets") { + source_dir = "./src/main/js/default" +} +ohos_resources("audio_capturer_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/multimedia/audio/audio_js_standard/AudioCapturer/Test.json b/multimedia/audio/audio_js_standard/AudioCapturer/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..293b46d11ce0c3f5d2d159b69c7389648aeac40e --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturer/Test.json @@ -0,0 +1,50 @@ +{ + "description": "Configuration for audio manager Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "1500000", + "package": "ohos.acts.multimedia.audio.audiocapturer", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAudioCapturerJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/media" + ], + "cleanup-apps": true + }, + { + "type": "PushKit", + "pre-push": [], + "push": [ + "./resource/audio/audioManager/Believer.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/", + "./resource/audio/audioManager/Believer60s.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-1C-8000-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-1C-16000-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-1C-32000-1SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-1C-44100-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-1C-64000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-1C-96000-4SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-2C-11025-1SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-2C-12000-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-2C-16000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-2C-22050-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-2C-24000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-2C-48000-4SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/", + "./resource/audio/audioManager/Believer.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/media", + "./resource/audio/audioManager/file_example_WAV_1MG.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/media", + "./resource/audio/audioManager/safe_and_sound_32.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/media", + "./resource/audio/audioManager/test.mp3 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/media", + "./resource/audio/audioManager/test.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiocapturer/haps/entry/files/media" + ] + } + ] +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioCapturer/signature/openharmony_sx.p7b b/multimedia/audio/audio_js_standard/AudioCapturer/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..0e9c4376f4c0ea2f256882a2170cd4e81ac135d7 Binary files /dev/null and b/multimedia/audio/audio_js_standard/AudioCapturer/signature/openharmony_sx.p7b differ diff --git a/multimedia/audio/audio_js_standard/AudioCapturer/src/main/config.json b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..929f06c7b51de8c497a079f72e071d8f0e996f80 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/config.json @@ -0,0 +1,86 @@ +{ + "app": { + "apiVersion": { + "compatible": 6, + "releaseType": "Beta1", + "target": 7 + }, + "vendor": "acts", + "bundleName": "ohos.acts.multimedia.audio.audiocapturer", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": { + "default": { + "debug": true + } + }, + "module": { + "abilities": [ + { + "iconId": 16777218, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "descriptionId": 16777217, + "visible": true, + "labelId": 16777216, + "icon": "$media:icon", + "name": "ohos.acts.multimedia.audio.audiocapturer.MainAbility", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "homeAbility": true, + "launchType": "standard" + } + ], + "deviceType": [ + "default", + "phone", + "tablet", + "tv", + "wearable" + ], + "mainAbility": "ohos.acts.multimedia.audio.audiocapturer.MainAbility", + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "ohos.acts.multimedia.audio.audiocapturer", + "name": ".MyApplication", + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", + "reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS" + }, + { + "name": "ohos.permission.MICROPHONE", + "reason": "use ohos.permission.MICROPHONE" + } + + ] + } +} \ No newline at end of file diff --git a/startup/startup_standard/systemparamter/src/main/js/MainAbility/app.js b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/default/app.js similarity index 100% rename from startup/startup_standard/systemparamter/src/main/js/MainAbility/app.js rename to multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/default/app.js diff --git a/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/default/i18n/en-US.json b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/default/i18n/zh-CN.json b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/default/pages/index/index.css b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..5bd7567028568bd522193b2519d545ca6dcf397d --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/default/pages/index/index.css @@ -0,0 +1,46 @@ +.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/audio/audio_js_standard/AudioCapturer/src/main/js/default/pages/index/index.hml b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/default/pages/index/index.js b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a0719cee588ac4b0f56efbf784b19647bc6645de --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/default/pages/index/index.js @@ -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 {Core, ExpectExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + const configService = core.getDefaultService('config') + this.timeout = 60000 + configService.setConfig(this) + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturer.test.js b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturer.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e65b8cc614ded6f1b054d39891cb73b745f6b05d --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/AudioCapturer.test.js @@ -0,0 +1,6236 @@ +/* + * 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 audio from '@ohos.multimedia.audio'; +import fileio from '@ohos.fileio'; +import featureAbility from '@ohos.ability.featureAbility' +import * as audioTestBase from '../../../../../AudioTestBase' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; + +describe('audioCapturer', function () { + let audioCapCallBack; + let audioCapPromise; + let dirPath; + async function getFd(fileName) { + let context = await featureAbility.getContext(); + await context.getFilesDir().then((data) => { + dirPath = data + '/' + fileName; + console.info('case2 dirPath is ' + dirPath); + }) + } + async function closeFileDescriptor() { + await resourceManager.getResourceManager().then(async (mgr) => { + await mgr.closeRawFileDescriptor(dirPath).then(value => { + console.log('AudioFrameworkRenderLog:case closeRawFileDescriptor success for file:' + dirPath); + }).catch(error => { + console.log('AudioFrameworkRenderLog:case closeRawFileDescriptor err: ' + error); + }); + }); + } + const AUDIOMANAGERREC = audio.getAudioManager(); + console.info('AudioFrameworkRecLog: Create AudioManger Object JS Framework'); + beforeAll(async function () { + console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level'); + let permissionName1 = 'ohos.permission.MICROPHONE'; + let permissionNameList = [permissionName1]; + let appName = 'ohos.acts.multimedia.audio.audiocapturer'; + await audioTestBase.applyPermission(appName, permissionNameList); + await sleep(100); + console.info('AudioFrameworkTest: beforeAll: END'); + }) + + beforeEach(async function () { + console.info('AudioFrameworkTest: beforeEach: Prerequisites at the test case level'); + await sleep(1000); + }) + + afterEach(function () { + console.info('AudioFrameworkTest: afterEach: Test case-level clearance conditions'); + closeFileDescriptor(); + }) + + afterAll(async function () { + await sleep(1000); + console.info('AudioFrameworkTest: afterAll: Test suite-level cleanup condition'); + }) + + function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); + } + + + async function recPromise(AudioCapturerOptions, dirPath, AudioScene) { + + let resultFlag = 'new'; + console.info('AudioFrameworkRecLog: Promise : Audio Recording Function'); + + let audioCap; + let isPass = false; + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCap = data; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + return resultFlag; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + return resultFlag; + } + + console.info('AudioFrameworkRecLog: AudioCapturer : Path : ' + dirPath); + + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); + + await audioCap.getStreamInfo().then(async function (audioParamsGet) { + if (audioParamsGet != undefined) { + console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); + console.info('AudioFrameworkRecLog: Capturer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRecLog: Capturer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); + } else { + console.info('AudioFrameworkRecLog: audioParamsGet is : ' + audioParamsGet); + console.info('AudioFrameworkRecLog: audioParams getStreamInfo are incorrect: '); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); + resultFlag = false; + }); + if (resultFlag == false) { + console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); + return resultFlag; + } + + await audioCap.getCapturerInfo().then(async function (audioParamsGet) { + if (audioParamsGet != undefined) { + console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); + console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); + console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); + } else { + console.info('AudioFrameworkRecLog: audioParamsGet is : ' + audioParamsGet); + console.info('AudioFrameworkRecLog: audioParams getCapturerInfo are incorrect: '); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); + resultFlag = false; + }); + if (resultFlag == false) { + console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); + return resultFlag; + } + + await audioCap.start().then(async function () { + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + resultFlag = false; + }); + if (resultFlag == false) { + console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); + return resultFlag; + } + + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); + + let bufferSize = await audioCap.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + + let fd = fileio.openSync(dirPath, 0o102, 0o777); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd created'); + } + else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); + resultFlag = false; + return resultFlag; + } + + fd = fileio.openSync(dirPath, 0o2002, 0o666); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); + } + else { + console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); + resultFlag = false; + return resultFlag; + } + await sleep(100); + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info('AudioFrameworkRecLog: ---------READ BUFFER---------'); + let buffer = await audioCap.read(bufferSize, true); + await sleep(50); + console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); + let number = fileio.writeSync(fd, buffer); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); + await sleep(50); + numBuffersToCapture--; + } + await sleep(1000); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); + + await audioCap.stop().then(async function () { + console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + resultFlag = true; + console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + resultFlag = false; + }); + + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); + + await audioCap.release().then(async function () { + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + resultFlag = false; + }); + + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); + + return resultFlag; + + } + + + async function recCallBack(AudioCapturerOptions, dirPath, AudioScene) { + + let resultFlag = true; + console.info('AudioFrameworkRecLog: CallBack : Audio Recording Function'); + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + AUDIOMANAGERREC.getAudioScene((err, getValue) => { + console.info('AudioFrameworkRecLog: ---------GET AUDIO SCENE---------'); + if (err) { + console.info('AudioFrameworkRecLog: getAudioScene : ERROR : ' + err.message); + resultFlag = false; + } else { + console.info('AudioFrameworkRecLog: getAudioScene : Value : ' + getValue); + } + }); + await sleep(1000); + + audioCapCallBack.getStreamInfo(async (err, audioParamsGet) => { + console.info('AudioFrameworkRecLog: ---------GET STREAM INFO---------'); + console.log('AudioFrameworkRecLog: Entered getStreamInfo'); + if (err) { + console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); + resultFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); + console.info('AudioFrameworkRecLog: Capturer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRecLog: Capturer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); + } + }); + await sleep(1000); + audioCapCallBack.getCapturerInfo((err, audioParamsGet) => { + console.info('AudioFrameworkRecLog: ---------GET CAPTURER INFO---------'); + if (err) { + console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); + resultFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); + console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); + console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); + } + }); + await sleep(1000); + audioCapCallBack.start((err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + resultFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + } + }); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapCallBack.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); + let fd = fileio.openSync(dirPath, 0o102, 0o777); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd created'); + } else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR '); + resultFlag = false; + return resultFlag; + } + console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); + fd = fileio.openSync(dirPath, 0o2002, 0o666); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); + } else { + console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); + resultFlag = false; + return resultFlag; + } + + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info('AudioFrameworkRecLog: ---------READ BUFFER---------'); + let buffer = await audioCapCallBack.read(bufferSize, true); + await sleep(50); + console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); + let number = fileio.writeSync(fd, buffer); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); + await sleep(50); + numBuffersToCapture--; + } + //await sleep(3000); + audioCapCallBack.stop(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + resultFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + resultFlag = true; + console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); + } + }); + await sleep(1000); + + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + resultFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + resultFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + //return resultFlag; + } + }); + //await sleep(3000); + console.info('AudioFrameworkRenderLog: After all check resultFlag : ' + resultFlag); + return resultFlag; + } + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_PREPARED_STATE_0100 + *@tc.name + *@tc.desc + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_PREPARED_STATE_0100', 1, async function (done) { + let stateFlag; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: INVALID:' + audio.AudioState.STATE_INVALID); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: NEW:' + audio.AudioState.STATE_NEW); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: PREPARED:' + audio.AudioState.STATE_PREPARED); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: START:' + audio.AudioState.STATE_START); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: STOP:' + audio.AudioState.STATE_STOPPED); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: RELEASE:' + audio.AudioState.STATE_RELEASED); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: RUNNING:' + audio.AudioState.STATE_RUNNING); + if ((audioCapCallBack.state == audio.AudioState.STATE_PREPARED)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); + stateFlag = true; + expect(stateFlag).assertTrue(); + done(); + } + } + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_PREPARED_STATE_EUNM_0100 + *@tc.name : AudioCapturer-Check-STATE-PREPARED-ENUM + *@tc.desc : AudioCapturer with state prepared + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_PREPARED_STATE_EUNM_0100', 0, async function (done) { + let stateFlag; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + + if ((audioCapCallBack.state == 1)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); + stateFlag = true; + expect(stateFlag).assertTrue(); + done(); + } + + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_RUNNING_STATE_0100 + *@tc.name : AudioCapturer-Check-STATE-RUNNING + *@tc.desc : AudioCapturer with state running + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_RUNNING_STATE_0100', 1, async function (done) { + let stateFlag; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RUNNING STATE---------'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + await sleep(1000); + if ((audioCapCallBack.state == audio.AudioState.STATE_RUNNING)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RUNNING STATE : PASS---------'); + stateFlag = true; + } + } + }); + await sleep(1000); + await audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + //return resultFlag; + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_RUNNING_STATE_EUNM_0100 + *@tc.name : AudioCapturer-Check-STATE-RUNNING-ENUM + *@tc.desc : AudioCapturer with state running + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_RUNNING_STATE_EUNM_0100', 1, async function (done) { + let stateFlag; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + await audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RUNNING STATE---------'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + await sleep(1000); + if ((audioCapCallBack.state == 2)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RUNNING STATE : PASS---------'); + stateFlag == true; + } + } + }); + await sleep(1000); + await audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + //return resultFlag; + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_STOPPED_STATE_0100 + *@tc.name : AudioCapturer-Check-STATE-STOPPED + *@tc.desc : AudioCapturer with state stopped + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_STOPPED_STATE_0100', 1, async function (done) { + let stateFlag; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + await sleep(1000); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + audioCapCallBack.stop(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO STOPPED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == audio.AudioState.STATE_STOPPED)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO STOPPED STATE---------'); + stateFlag = true; + } + console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); + } + }); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + //return resultFlag; + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_STOPPED_STATE_EUNM_0100 + *@tc.name : AudioCapturer-Check-STATE-STOPPED-ENUM + *@tc.desc : AudioCapturer with state stopped + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_STOPPED_STATE_EUNM_0100', 1, async function (done) { + let stateFlag; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + stateFlag == true; + } + }); + await sleep(1000); + audioCapCallBack.stop(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO STOPPED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 3)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO STOPPED STATE---------'); + stateFlag = true; + } + console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); + } + }); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + //return resultFlag; + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_RELEASED_STATE_0100 + *@tc.name : AudioCapturer-Check-STATE-RELEASED + *@tc.desc : AudioCapturer with state released + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_RELEASED_STATE_0100', 2, async function (done) { + let stateFlag; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + await sleep(1000); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + audioCapCallBack.stop(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 3)) { + stateFlag = true; + } + console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); + } + }); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == audio.AudioState.STATE_RELEASED)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_RELEASED_STATE_EUNM_0100 + *@tc.name : AudioCapturer-Check-STATE-RELEASED + *@tc.desc : AudioCapturer with state released + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_RELEASED_STATE_EUNM_0100', 1, async function (done) { + let stateFlag; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + await sleep(1000); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + audioCapCallBack.stop(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 3)) { + stateFlag = true; + } + console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); + } + }); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_GET_BUFFER_SIZE_0100 + *@tc.name : AudioCapturer-get_buffer_size + *@tc.desc : AudioCapturer with state stopped + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_GET_BUFFER_SIZE_0100', 1, async function (done) { + let stateFlag; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + await sleep(1000); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapCallBack.getBufferSize(async (err, cbbufferSize) => { + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK BUFFER SIZE---------'); + console.info('AudioFrameworkRecLog: buffer size: ' + cbbufferSize); + stateFlag = true + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); + console.info('AudioFrameworkRecLog: ---------AFTER CHECK BUFFER SIZE : PASS---------') + } + }); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + //return resultFlag; + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_0100 + *@tc.name : AudioCapturer-Check-READ_BUFFER + *@tc.desc : AudioCapturer with read buffer + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_0100', 1, async function (done) { + let stateFlag; + await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapCallBack.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); + let fd = fileio.openSync(dirPath, 0o102, 0o777); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd created'); + } else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); + stateFlag = false; + } + console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); + fd = fileio.openSync(dirPath, 0o2002, 0o666); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); + } else { + console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); + stateFlag = false; + } + await sleep(1000); + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); + await new Promise((resolve, reject) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + reject(err); + } else { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); + await sleep(50); + console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); + let number = fileio.writeSync(fd, buffer); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); + await sleep(100); + stateFlag = true; + resolve(); + } + }); + }) + + numBuffersToCapture--; + } + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMOISE_PREPARED_STATE_0100 + *@tc.name : AudioCapturer-Check-STATE-PREPARED + *@tc.desc : AudioCapturer with state prepared + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMOISE_PREPARED_STATE_0100', 0, async function (done) { + let stateFlag; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCapPromise = data; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + return stateFlag; + }); + + if ((audioCapPromise.state == audio.AudioState.STATE_PREPARED)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); + stateFlag = true; + expect(stateFlag).assertTrue(); + done(); + } + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMOISE_PREPARED_STATE_ENUM_0100 + *@tc.name : AudioCapturer-Check-STATE-PREPARED-ENUM + *@tc.desc : AudioCapturer with state prepared + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMOISE_PREPARED_STATE_ENUM_0100', 0, async function (done) { + let stateFlag; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCapPromise = data; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + return stateFlag; + }); + + if ((audioCapPromise.state == 1)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); + stateFlag = true; + expect(stateFlag).assertTrue(); + done(); + } + + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_RUNNING_STATE_0100 + *@tc.name : AudioCapturer-Check-STATE-RUNNING + *@tc.desc : AudioCapturer with state running + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_RUNNING_STATE_0100', 0, async function (done) { + let stateFlag; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCapPromise = data; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + return stateFlag; + }); + + await audioCapPromise.start().then(async function () { + console.info('AudioFrameworkRecLog: ---------START---------'); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapPromise.state == audio.AudioState.STATE_RUNNING)) { + stateFlag = true; + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + + await audioCapPromise.release().then(async function () { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + //return resultFlag; + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_RUNNING_STATE_ENUM_0100 + *@tc.name : AudioCapturer-Check-STATE-RUNNING-ENUM + *@tc.desc : AudioCapturer with state running + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_RUNNING_STATE_ENUM_0100', 0, async function (done) { + let stateFlag; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCapPromise = data; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + return stateFlag; + }); + + await audioCapPromise.start().then(async function () { + console.info('AudioFrameworkRecLog: ---------START---------'); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapPromise.state == 2)) { + stateFlag = true; + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + + await audioCapPromise.release().then(async function () { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + //return resultFlag; + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_STOPPED_STATE_0100 + *@tc.name : AudioCapturer-Check-STATE-STOPPED + *@tc.desc : AudioCapturer with state stopped + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_STOPPED_STATE_0100', 2, async function (done) { + let stateFlag; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCapPromise = data; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + return stateFlag; + }); + + await audioCapPromise.start().then(async function () { + console.info('AudioFrameworkRecLog: ---------START---------'); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapPromise.state == audio.AudioState.STATE_STOPPED)) { + stateFlag = true; + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + + await audioCapPromise.stop().then(async function () { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + if ((audioCapPromise.state == audioCapPromise.AudioState.STATE_STOPPED)) { + stateFlag = true; + console.info('AudioFrameworkRecLog: resultFlag : ' + stateFlag); + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + await audioCapPromise.release().then(async function () { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_STOPPED_STATE_ENUM_0100 + *@tc.name : AudioCapturer-Check-STATE-STOPPED + *@tc.desc : AudioCapturer with state stopped + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_STOPPED_STATE_ENUM_0100', 2, async function (done) { + let stateFlag; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCapPromise = data; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + return stateFlag; + }); + + await audioCapPromise.start().then(async function () { + console.info('AudioFrameworkRecLog: ---------START---------'); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapPromise.state == audio.AudioState.STATE_STOPPED)) { + stateFlag = true; + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + + await audioCapPromise.stop().then(async function () { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + if ((audioCapPromise.state == 3)) { + stateFlag = true; + console.info('AudioFrameworkRecLog: resultFlag : ' + stateFlag); + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + await audioCapPromise.release().then(async function () { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + //return resultFlag; + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_RELEASED_STATE_0100 + *@tc.name : AudioCapturer-Check-STATE-RELEASED + *@tc.desc : AudioCapturer with state released + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_RELEASED_STATE_0100', 2, async function (done) { + let stateFlag; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCapPromise = data; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + }); + + await audioCapPromise.start().then(async function () { + console.info('AudioFrameworkRecLog: ---------START---------'); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + stateFlag = true; + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + + await audioCapPromise.stop().then(async function () { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + stateFlag = true; + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + await audioCapPromise.release().then(async function () { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + if ((audioCapPromise.state == audio.AudioState.STATE_RELEASED)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + await sleep(1000); + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_RELEASED_STATE_ENUM_0100 + *@tc.name : AudioCapturer-Check-STATE-RELEASED-ENUM + *@tc.desc : AudioCapturer with state released + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_RELEASED_STATE_ENUM_0100', 2, async function (done) { + let stateFlag; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCapPromise = data; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + return stateFlag; + }); + + await audioCapPromise.start().then(async function () { + console.info('AudioFrameworkRecLog: ---------START---------'); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + stateFlag = true; + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + + await audioCapPromise.stop().then(async function () { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + stateFlag = true; + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + await audioCapPromise.release().then(async function () { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + if ((audioCapPromise.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_BUFFER_SIZE_0100 + *@tc.name : AudioCapturer-get_buffer_size + *@tc.desc : AudioCapturer with state stopped + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_BUFFER_SIZE_0100', 2, async function (done) { + let stateFlag; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCapPromise = data; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + return stateFlag; + }); + await sleep(1000); + await audioCapPromise.start().then(async function () { + console.info('AudioFrameworkRecLog: ---------START---------'); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapPromise.state == 2)) { + stateFlag = true; + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapPromise.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + stateFlag = true; + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + await sleep(1000); + + await audioCapPromise.release().then(async function () { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + if ((audioCapPromise.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_READ_BUFFER_0100 + *@tc.name : AudioCapturer-Check-READ_BUFFER + *@tc.desc : AudioCapturer with read buffer + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_READ_BUFFER_0100', 2, async function (done) { + let stateFlag; + await getFd("capture_CB_js-44100-2C-S16LE-checkpromisereadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCapPromise = data; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + return stateFlag; + }); + await sleep(1000); + await audioCapPromise.start().then(async function () { + console.info('AudioFrameworkRecLog: ---------START---------'); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapPromise.state == 2)) { + stateFlag = true; + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapPromise.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + stateFlag = true; + + console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); + let fd = fileio.openSync(dirPath, 0o102, 0o777); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd created'); + } else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); + stateFlag = false; + } + console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); + fd = fileio.openSync(dirPath, 0o2002, 0o666); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); + } else { + console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); + stateFlag = false; + } + //await sleep(1000); + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info('AudioFrameworkRecLog: ---------BEFORE PROMISE READ ---------'); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + let buffer = await audioCapPromise.read(bufferSize, true); + console.info('AudioFrameworkRecLog: ---------AFTER PROMISE READ ---------'); + //await sleep(50); + let number = fileio.writeSync(fd, buffer); + console.info('BufferRecLog: data written: ' + number); + console.info('AudioFrameworkRecLog: ---------AFTER PROMISE WRITE ---------'); + //await sleep(100); + numBuffersToCapture--; + } + //await sleep(3000); + + await audioCapPromise.release().then(async function () { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + if ((audioCapPromise.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_CB_0100 + *@tc.name : AudioCapturer-Set1-Media + *@tc.desc : AudioCapturer with parameter set 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_CB_0100', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + await getFd("capture_CB_js-44100-2C-16B.pcm"); + let resultFlag = await recCallBack(AudioCapturerOptions, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(1000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_CB_ENUM_0100 + *@tc.name : AudioCapturer-Set1-Media + *@tc.desc : AudioCapturer with parameter set 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_CB_ENUM_0100', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: 44100, + channels: 1, + sampleFormat: 1, + encodingType: 0 + } + + let AudioCapturerInfo = { + source: 1, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + await getFd("capture_CB_js-44100-2C-16B.pcm"); + let resultFlag = await recCallBack(AudioCapturerOptions, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(1000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_0100 + *@tc.name : AudioCapturer-Set1-Media + *@tc.desc : AudioCapturer with parameter set 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_0100', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + await getFd("capture_js-44100-2C-16B.pcm"); + let resultFlag = await recPromise(AudioCapturerOptions, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_0100 + *@tc.name : AudioCapturer-Set1-Media + *@tc.desc : AudioCapturer with parameter set 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_0100', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: 44100, + channels: 1, + sampleFormat: 1, + encodingType: 0 + } + + let AudioCapturerInfo = { + source: 1, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + await getFd("capture_js-44100-2C-16B.pcm"); + let resultFlag = await recPromise(AudioCapturerOptions, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_0200 + *@tc.name : AudioRec-Set1 + *@tc.desc : record audio with parameter set 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_0200', 2, async function (done) { + let audioStreamInfo44100 = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, + }; + let audioCapturerInfo44100 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let audioCapturerOptions44100 = { + streamInfo: audioStreamInfo44100, + capturerInfo: audioCapturerInfo44100, + } + + await getFd("capture_js-44100-1C-16LE.pcm"); + let resultFlag = await recPromise(audioCapturerOptions44100, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_0200 + *@tc.name : AudioRec-Set1 + *@tc.desc : record audio with parameter set 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_0200', 2, async function (done) { + let audioStreamInfo44100 = { + samplingRate: 44100, + channels: 1, + sampleFormat: 1, + encodingType: 0, + }; + let audioCapturerInfo44100 = { + source: 1, + capturerFlags: 0 + } + let audioCapturerOptions44100 = { + streamInfo: audioStreamInfo44100, + capturerInfo: audioCapturerInfo44100, + } + + await getFd("capture_js-44100-1C-16LE.pcm"); + + let resultFlag = await recPromise(audioCapturerOptions44100, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_0300 + *@tc.name : AudioRec-Set2 + *@tc.desc : record audio with parameter set 2 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_0300', 2, async function (done) { + let audioStreamInfo96000 = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_96000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, + }; + let audioCapturerInfo96000 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let audioCapturerOptions96000 = { + streamInfo: audioStreamInfo96000, + capturerInfo: audioCapturerInfo96000, + } + + await getFd("capture_js-96000-1C-S24LE.pcm"); + let resultFlag = await recPromise(audioCapturerOptions96000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_0300 + *@tc.name : AudioRec-Set2 + *@tc.desc : record audio with parameter set 2 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_0300', 2, async function (done) { + let audioStreamInfo96000 = { + samplingRate: 96000, + channels: 1, + sampleFormat: 2, + encodingType: 0, + }; + let audioCapturerInfo96000 = { + source: 1, + capturerFlags: 0 + } + let audioCapturerOptions96000 = { + streamInfo: audioStreamInfo96000, + capturerInfo: audioCapturerInfo96000, + } + + await getFd("capture_js-96000-1C-S24LE.pcm"); + let resultFlag = await recPromise(audioCapturerOptions96000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_0400 + *@tc.name : AudioRec-Set3 + *@tc.desc : record audio with parameter set 3 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_0400', 2, async function (done) { + let audioStreamInfo48000 = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, + }; + let audioCapturerInfo48000 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let audioCapturerOptions48000 = { + streamInfo: audioStreamInfo48000, + capturerInfo: audioCapturerInfo48000, + } + + await getFd("capture_js-48000-2C-1S32LE.pcm"); + let resultFlag = await recPromise(audioCapturerOptions48000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_0400 + *@tc.name : AudioRec-Set3 + *@tc.desc : record audio with parameter set 3 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_0400', 2, async function (done) { + let audioStreamInfo48000 = { + samplingRate: 48000, + channels: 2, + sampleFormat: 1, + encodingType: 0, + }; + let audioCapturerInfo48000 = { + source: 1, + capturerFlags: 0 + } + let audioCapturerOptions48000 = { + streamInfo: audioStreamInfo48000, + capturerInfo: audioCapturerInfo48000, + } + + await getFd("capture_js-48000-2C-1S32LE.pcm"); + let resultFlag = await recPromise(audioCapturerOptions48000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_0500 + *@tc.name : AudioRec-Set4 + *@tc.desc : record audio with parameter set 4 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_0500', 2, async function (done) { + let audioStreamInfo8000 = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_8000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, + }; + let audioCapturerInfo8000 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let audioCapturerOptions8000 = { + streamInfo: audioStreamInfo8000, + capturerInfo: audioCapturerInfo8000, + } + + await getFd("capture_js-8000-1C-8B.pcm"); + let resultFlag = await recPromise(audioCapturerOptions8000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_0500 + *@tc.name : AudioRec-Set4 + *@tc.desc : record audio with parameter set 4 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_0500', 2, async function (done) { + let audioStreamInfo8000 = { + samplingRate: 8000, + channels: 1, + sampleFormat: 0, + encodingType: 0, + }; + let audioCapturerInfo8000 = { + source: 1, + capturerFlags: 0 + } + let audioCapturerOptions8000 = { + streamInfo: audioStreamInfo8000, + capturerInfo: audioCapturerInfo8000, + } + + await getFd("capture_js-8000-1C-8B.pcm"); + let resultFlag = await recPromise(audioCapturerOptions8000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_0600 + *@tc.name : AudioRec-Set5 + *@tc.desc : record audio with parameter set 5 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_0600', 2, async function (done) { + let audioStreamInfo11025 = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_11025, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, + }; + let audioCapturerInfo11025 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let audioCapturerOptions11025 = { + streamInfo: audioStreamInfo11025, + capturerInfo: audioCapturerInfo11025, + } + + await getFd("capture_js-11025-2C-16B.pcm"); + let resultFlag = await recPromise(audioCapturerOptions11025, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_0600 + *@tc.name : AudioRec-Set5 + *@tc.desc : record audio with parameter set 5 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_0600', 2, async function (done) { + let audioStreamInfo11025 = { + samplingRate: 11025, + channels: 2, + sampleFormat: 1, + encodingType: 0, + }; + let audioCapturerInfo11025 = { + source: 1, + capturerFlags: 0 + } + let audioCapturerOptions11025 = { + streamInfo: audioStreamInfo11025, + capturerInfo: audioCapturerInfo11025, + } + + await getFd("capture_js-11025-2C-16B.pcm"); + + let resultFlag = await recPromise(audioCapturerOptions11025, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_0700 + *@tc.name : AudioRec-Set6 + *@tc.desc : record audio with parameter set 6 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_0700', 2, async function (done) { + let audioStreamInfo12000 = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_12000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, + }; + let audioCapturerInfo12000 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let audioCapturerOptions12000 = { + streamInfo: audioStreamInfo12000, + capturerInfo: audioCapturerInfo12000, + } + + await getFd("capture_js-12000-1C-24B.pcm"); + let resultFlag = await recPromise(audioCapturerOptions12000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_0700 + *@tc.name : AudioRec-Set6 + *@tc.desc : record audio with parameter set 6 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_0700', 2, async function (done) { + let audioStreamInfo12000 = { + samplingRate: 12000, + channels: 1, + sampleFormat: 2, + encodingType: 0 + }; + let audioCapturerInfo12000 = { + source: 1, + capturerFlags: 0 + } + let audioCapturerOptions12000 = { + streamInfo: audioStreamInfo12000, + capturerInfo: audioCapturerInfo12000, + } + + await getFd("capture_js-12000-1C-24B.pcm"); + let resultFlag = await recPromise(audioCapturerOptions12000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_0800 + *@tc.name : AudioRec-Set7 + *@tc.desc : record audio with parameter set 7 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_0800', 2, async function (done) { + let audioStreamInfo16000 = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, + }; + let audioCapturerInfo16000 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let audioCapturerOptions16000 = { + streamInfo: audioStreamInfo16000, + capturerInfo: audioCapturerInfo16000, + } + + await getFd("capture_js-16000-2C-32B.pcm"); + let resultFlag = await recPromise(audioCapturerOptions16000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_0800 + *@tc.name : AudioRec-Set7 + *@tc.desc : record audio with parameter set 7 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_0800', 2, async function (done) { + let audioStreamInfo16000 = { + samplingRate: 16000, + channels: 2, + sampleFormat: 3, + encodingType: 0, + }; + let audioCapturerInfo16000 = { + source: 1, + capturerFlags: 0 + } + let audioCapturerOptions16000 = { + streamInfo: audioStreamInfo16000, + capturerInfo: audioCapturerInfo16000, + } + + await getFd("capture_js-16000-2C-32B.pcm"); + let resultFlag = await recPromise(audioCapturerOptions16000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_0900 + *@tc.name : AudioRec-Set8 + *@tc.desc : record audio with parameter set 8 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_0900', 2, async function (done) { + let audioStreamInfo22050 = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_22050, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, + }; + let audioCapturerInfo22050 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let audioCapturerOptions22050 = { + streamInfo: audioStreamInfo22050, + capturerInfo: audioCapturerInfo22050, + } + + await getFd("capture_js-22050-1C-8B.pcm"); + let resultFlag = await recPromise(audioCapturerOptions22050, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_0900 + *@tc.name : AudioRec-Set8 + *@tc.desc : record audio with parameter set 8 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_0900', 2, async function (done) { + let audioStreamInfo22050 = { + samplingRate: 22050, + channels: 1, + sampleFormat: 0, + encodingType: 0, + }; + let audioCapturerInfo22050 = { + source: 1, + capturerFlags: 0 + } + let audioCapturerOptions22050 = { + streamInfo: audioStreamInfo22050, + capturerInfo: audioCapturerInfo22050, + } + + await getFd("capture_js-22050-1C-8B.pcm"); + + let resultFlag = await recPromise(audioCapturerOptions22050, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_1000 + *@tc.name : AudioRec-Set9 + *@tc.desc : record audio with parameter set 9 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_1000', 2, async function (done) { + let audioStreamInfo24000 = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, + }; + let audioCapturerInfo24000 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let audioCapturerOptions24000 = { + streamInfo: audioStreamInfo24000, + capturerInfo: audioCapturerInfo24000, + } + + await getFd("capture_js-24000-2C-16B.pcm"); + + let resultFlag = await recPromise(audioCapturerOptions24000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_1000 + *@tc.name : AudioRec-Set9 + *@tc.desc : record audio with parameter set 9 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_1000', 2, async function (done) { + let audioStreamInfo24000 = { + samplingRate: 24000, + channels: 2, + sampleFormat: 1, + encodingType: 0, + }; + let audioCapturerInfo24000 = { + source: 1, + capturerFlags: 0 + } + let audioCapturerOptions24000 = { + streamInfo: audioStreamInfo24000, + capturerInfo: audioCapturerInfo24000, + } + + await getFd("capture_js-24000-2C-16B.pcm"); + + let resultFlag = await recPromise(audioCapturerOptions24000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_1100 + *@tc.name : AudioRec-Set10 + *@tc.desc : record audio with parameter set 010 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_1100', 2, async function (done) { + let audioStreamInfo32000 = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_32000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, + }; + let audioCapturerInfo32000 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let audioCapturerOptions32000 = { + streamInfo: audioStreamInfo32000, + capturerInfo: audioCapturerInfo32000, + } + + await getFd("capture_js-32000-1C-24B.pcm"); + + let resultFlag = await recPromise(audioCapturerOptions32000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_1100 + *@tc.name : AudioRec-Set10 + *@tc.desc : record audio with parameter set 010 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_1100', 2, async function (done) { + let audioStreamInfo32000 = { + samplingRate: 32000, + channels: 1, + sampleFormat: 2, + encodingType: 0, + }; + let audioCapturerInfo32000 = { + source: 1, + capturerFlags: 0 + } + let audioCapturerOptions32000 = { + streamInfo: audioStreamInfo32000, + capturerInfo: audioCapturerInfo32000, + } + + await getFd("capture_js-32000-1C-24B.pcm"); + + let resultFlag = await recPromise(audioCapturerOptions32000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_1200 + *@tc.name : AudioRec-Set11 + *@tc.desc : record audio with parameter set 011 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_1200', 2, async function (done) { + let audioStreamInfo64000 = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_64000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, + }; + let audioCapturerInfo64000 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let audioCapturerOptions64000 = { + streamInfo: audioStreamInfo64000, + capturerInfo: audioCapturerInfo64000, + } + + await getFd("capture_js-64000-2C-32B.pcm"); + + let resultFlag = await recPromise(audioCapturerOptions64000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_1200 + *@tc.name : AudioRec-Set11 + *@tc.desc : record audio with parameter set 011 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_VOICE_CHAT_PROMISE_ENUM_1200', 2, async function (done) { + let audioStreamInfo64000 = { + samplingRate: 64000, + channels: 2, + sampleFormat: 3, + encodingType: 0, + }; + let audioCapturerInfo64000 = { + source: 1, + capturerFlags: 0 + } + let audioCapturerOptions64000 = { + streamInfo: audioStreamInfo64000, + capturerInfo: audioCapturerInfo64000, + } + + await getFd("capture_js-64000-2C-32B.pcm"); + + let resultFlag = await recPromise(audioCapturerOptions64000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_RECORD_PROMISE_AUDIO_SCENE_DEFAULT_0100 + *@tc.name : AudioRec-Set1 + *@tc.desc : record audio with parameter set 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RECORD_PROMISE_AUDIO_SCENE_DEFAULT_0100', 2, async function (done) { + let audioStreamInfo44100 = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, + }; + let audioCapturerInfo44100 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let audioCapturerOptions44100 = { + streamInfo: audioStreamInfo44100, + capturerInfo: audioCapturerInfo44100, + } + + await getFd("capture_js-44100-1C-16LE.pcm"); + + let resultFlag = await recPromise(audioCapturerOptions44100, dirPath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_RECORD_PROMISE_AUDIO_SCENE_DEFAULT_ENUM_0100 + *@tc.name : AudioRec-Set1 + *@tc.desc : record audio with parameter set 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RECORD_PROMISE_AUDIO_SCENE_DEFAULT_ENUM_0100', 2, async function (done) { + let audioStreamInfo44100 = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, + }; + let audioCapturerInfo44100 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let audioCapturerOptions44100 = { + streamInfo: audioStreamInfo44100, + capturerInfo: audioCapturerInfo44100, + } + + await getFd("capture_js-44100-1C-16LE.pcm"); + + let resultFlag = await recPromise(audioCapturerOptions44100, dirPath, 0); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_START_0100 + *@tc.name : AudioCapturer-GET_AUDIO_TIME + *@tc.desc : AudioCapturer GET_AUDIO_TIME + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_START_0100', 2, async function (done) { + let stateFlag; + await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + await audioCapCallBack.getAudioTime().then(async function (audioTime) { + console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER START : Success' + audioTime); + if (audioTime != 0) { + stateFlag = true; + expect(stateFlag).assertTrue(); + } else { + stateFlag = false; + expect(stateFlag).assertTrue(); + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + }); + await sleep(1000); + await audioCapCallBack.getAudioTime().then(async function (audioTime) { + console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime : Success' + audioTime); + if (audioTime != 0) { + stateFlag = true; + expect(stateFlag).assertTrue(); + } else { + stateFlag = false; + expect(stateFlag).assertTrue(); + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + }); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_READ_WRITE_0100 + *@tc.name : AudioCapturer-GET_AUDIO_TIME + *@tc.desc : AudioCapturer GET_AUDIO_TIME + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_READ_WRITE_0100', 2, async function (done) { + let stateFlag; + await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + await audioCapCallBack.getAudioTime().then(async function (audioTime) { + console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime); + if (audioTime != 0) { + stateFlag = true; + } else { + stateFlag = false; + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + }); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapCallBack.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); + let fd = fileio.openSync(dirPath, 0o102, 0o777); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd created'); + } else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); + stateFlag = false; + } + console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); + fd = fileio.openSync(dirPath, 0o2002, 0o666); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); + } else { + console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); + stateFlag = false; + } + await sleep(1000); + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); + await new Promise((resolve, reject) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + reject(err); + } else { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); + await audioCapCallBack.getAudioTime().then(async function (audioTime1) { + console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime1); + if (audioTime1 != 0) { + stateFlag = true; + } else { + stateFlag = false; + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + }); + await sleep(50); + console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); + let number = fileio.writeSync(fd, buffer); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); + await sleep(100); + stateFlag = true; + resolve(); + } + }); + }) + numBuffersToCapture--; + } + await sleep(3000); + + await audioCapCallBack.getAudioTime().then(async function (audioTime2) { + console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime2); + if (audioTime2 != 0) { + stateFlag = true; + } else { + stateFlag = false; + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + }); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_STOP_0100 + *@tc.name : AudioCapturer-GET_AUDIO_TIME + *@tc.desc : AudioCapturer GET_AUDIO_TIME + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_STOP_0100', 2, async function (done) { + let stateFlag; + await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + await audioCapCallBack.getAudioTime().then(async function (audioTime) { + console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime); + if (audioTime != 0) { + stateFlag = true; + } else { + stateFlag = false; + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + }); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapCallBack.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); + let fd = fileio.openSync(dirPath, 0o102, 0o777); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd created'); + } else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); + stateFlag = false; + } + console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); + fd = fileio.openSync(dirPath, 0o2002, 0o666); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); + } else { + console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); + stateFlag = false; + } + await sleep(1000); + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); + await new Promise((resolve, reject) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + reject(err); + } else { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); + await audioCapCallBack.getAudioTime().then(async function (audioTime1) { + console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime1); + if (audioTime1 != 0) { + stateFlag = true; + } else { + stateFlag = false; + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + }); + await sleep(50); + console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); + let number = fileio.writeSync(fd, buffer); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); + await sleep(100); + stateFlag = true; + resolve(); + } + }); + }) + numBuffersToCapture--; + } + await sleep(3000); + audioCapCallBack.stop(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO STOP STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 3)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO STOP STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + done(); + } + } + }); + await sleep(1000); + await audioCapCallBack.getAudioTime().then(async function (audioTime2) { + console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime2); + if (audioTime2 != 0) { + stateFlag == true; + } else { + stateFlag == false; + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + }); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } else { + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + }) + + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_GET_AUDIO_TIME_0100 + *@tc.name : AudioCapturer-GET_AUDIO_TIME + *@tc.desc : AudioCapturer GET_AUDIO_TIME + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_GET_AUDIO_TIME_0100', 2, async function (done) { + let stateFlag; + let audioCapCallBack; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + await audioCapCallBack.start().then(async function () { + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + await audioCapCallBack.getAudioTime(async (err, audioTime) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime : Success' + audioTime); + if (audioTime != 0) { + stateFlag = true; + } else { + stateFlag = false; + } + } + }); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } else { + stateFlag = false; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + + + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_STOP_BEFORE_START_0100 + *@tc.name : AudioCapturer-GET_AUDIO_TIME + *@tc.desc : AudioCapturer GET_AUDIO_TIME + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_STOP_BEFORE_START_0100', 2, async function (done) { + let stateFlag; + let audioCapPromise; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCapPromise = data; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO NEW STATE---------'); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + stateFlag == true; + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + }); + await sleep(1000); + await audioCapPromise.stop().then(async function () { + console.info('AudioFrameworkRecLog: AudioCapturer STOPED : UNSUCCESS' + audioCapCallBack.state); + if (audioCapCallBack.state == 1) { + stateFlag = true; + } else { + stateFlag = false; + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer stop :ERROR : ' + err.message); + stateFlag = false; + }); + await sleep(1000); + audioCapPromise.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_RELEASE_BEFORE_START_0100 + *@tc.name : AudioCapturer-GET_AUDIO_TIME + *@tc.desc : AudioCapturer GET_AUDIO_TIME + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_PROMISE_RELEASE_BEFORE_START_0100', 2, async function (done) { + let stateFlag; + let audioCapPromise; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCapPromise = data; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO NEW STATE---------'); + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + stateFlag = true; + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + }); + await sleep(1000); + await audioCapPromise.release().then(async function () { + console.info('AudioFrameworkRecLog: Capturer released :SUCCESS '); + stateFlag = true; + }).catch((err) => { + console.info('AudioFrameworkRecLog: Capturer stop :ERROR : ' + err.message); + stateFlag = false; + expect(stateFlag).assertTrue(); + }); + await sleep(1000); + audioCapPromise.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); + if ((audioCapPromise.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + }) + + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_STREAM_INFO_0100 + *@tc.name : AudioRec-Set1 + *@tc.desc : record audio with parameter set 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_STREAM_INFO_0100', 2, async function (done) { + let audioCapGetgetStreamInfo; + let setFlag; + let audioStreamInfo44100 = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let audioCapturerInfo44100 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let AudioCapturerOptionsInvalid = { + streamInfo: audioStreamInfo44100, + capturerInfo: audioCapturerInfo44100, + } + + await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { + if (data != undefined) { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); + audioCapGetgetStreamInfo = data; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + done(); + }); + await sleep(1000); + await audioCapGetgetStreamInfo.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); + console.info('AudioFrameworkRecLog: Capturer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRecLog: Capturer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); + setFlag = true; + if (setFlag) { + console.info('AudioFrameworkRecLog: Capturer getStreamInfo: PASS'); + } + }).catch((err) => { + console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); + setFlag = false + }); + await sleep(1000); + audioCapGetgetStreamInfo.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + setFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapGetgetStreamInfo.state); + if ((audioCapGetgetStreamInfo.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + setFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + setFlag); + expect(setFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_STREAM_INFO_ENUM_0100 + *@tc.name : AudioRec-Set1 + *@tc.desc : record audio with parameter set 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_STREAM_INFO_ENUM_0100', 2, async function (done) { + let audioCapGetgetStreamInfo; + let setFlag; + let audioStreamInfo44100 = { + samplingRate: 44100, + channels: 1, + sampleFormat: 1, + encodingType: 0, + }; + let audioCapturerInfo44100 = { + source: 1, + capturerFlags: 0 + } + let AudioCapturerOptionsInvalid = { + streamInfo: audioStreamInfo44100, + capturerInfo: audioCapturerInfo44100, + } + + await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { + if (data != undefined) { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); + audioCapGetgetStreamInfo = data; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + done(); + }); + await sleep(1000); + await audioCapGetgetStreamInfo.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); + console.info('AudioFrameworkRecLog: Capturer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRecLog: Capturer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); + setFlag = true; + if (setFlag) { + console.info('AudioFrameworkRecLog: Capturer getStreamInfo: PASS'); + } + }).catch((err) => { + console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); + setFlag = false; + expect(setFlag).assertTrue(); + }); + await sleep(1000); + audioCapGetgetStreamInfo.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + setFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapGetgetStreamInfo.state); + if ((audioCapGetgetStreamInfo.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + setFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + setFlag); + expect(setFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + + + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_REC_CB_VOICE_CHAT_GET_STREAM_INFO_0200 + *@tc.name : AudioRec-Set1 + *@tc.desc : record audio with parameter set 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_REC_CB_VOICE_CHAT_GET_STREAM_INFO_0200', 2, async function (done) { + let audioCapGetgetStreamInfo; + let setFlag; + let audioStreamInfo44100 = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let audioCapturerInfo44100 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let AudioCapturerOptionsInvalid = { + streamInfo: audioStreamInfo44100, + capturerInfo: audioCapturerInfo44100, + } + + await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { + if (data != undefined) { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); + audioCapGetgetStreamInfo = data; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + done(); + }); + await sleep(1000); + audioCapGetgetStreamInfo.getStreamInfo(async (err, audioParamsGet) => { + console.info('AudioFrameworkRecLog: ---------GET STREAM INFO---------'); + console.log('AudioFrameworkRecLog: Entered getStreamInfo'); + if (err) { + console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); + setFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); + console.info('AudioFrameworkRecLog: Capturer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRecLog: Capturer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); + setFlag = true; + } + await sleep(100); + done(); + }); + + audioCapGetgetStreamInfo.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + setFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapGetgetStreamInfo.state); + if ((audioCapGetgetStreamInfo.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + setFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + setFlag); + expect(setFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_REC_CB_VOICE_CHAT_GET_STREAM_INFO_ENUM_0200 + *@tc.name : AudioRec-Set1 + *@tc.desc : record audio with parameter set 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_REC_CB_VOICE_CHAT_GET_STREAM_INFO_ENUM_0200', 2, async function (done) { + let audioCapGetgetStreamInfo; + let setFlag; + let audioStreamInfo44100 = { + samplingRate: 44100, + channels: 1, + sampleFormat: 1, + encodingType: 0, + }; + let audioCapturerInfo44100 = { + source: 1, + capturerFlags: 0 + } + let AudioCapturerOptionsInvalid = { + streamInfo: audioStreamInfo44100, + capturerInfo: audioCapturerInfo44100, + } + + await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { + if (data != undefined) { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); + audioCapGetgetStreamInfo = data; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + done(); + }); + await sleep(1000); + audioCapGetgetStreamInfo.getStreamInfo(async (err, audioParamsGet) => { + console.info('AudioFrameworkRecLog: ---------GET STREAM INFO---------'); + console.log('AudioFrameworkRecLog: Entered getStreamInfo'); + if (err) { + console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); + setFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); + console.info('AudioFrameworkRecLog: Capturer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRecLog: Capturer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); + setFlag = true; + } + await sleep(1000); + }); + + audioCapGetgetStreamInfo.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + setFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapGetgetStreamInfo.state); + if ((audioCapGetgetStreamInfo.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + setFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + setFlag); + expect(setFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + + }) + + + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_INFO_0300 + *@tc.name : AudioRec-Set1 + *@tc.desc : record audio with parameter set 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_INFO_0300', 2, async function (done) { + let audioCapGetgetCapturerInfo; + let setFlag; + let audioStreamInfo44100 = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let audioCapturerInfo44100 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let AudioCapturerOptionsInvalid = { + streamInfo: audioStreamInfo44100, + capturerInfo: audioCapturerInfo44100, + } + + await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { + if (data != undefined) { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); + audioCapGetgetCapturerInfo = data; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + done(); + }); + await sleep(1000); + await audioCapGetgetCapturerInfo.getCapturerInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); + console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); + console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); + setFlag = true; + }).catch((err) => { + console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); + setFlag = false; + }); + await sleep(1000); + audioCapGetgetCapturerInfo.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + setFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapGetgetCapturerInfo.state); + if ((audioCapGetgetCapturerInfo.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + setFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + setFlag); + expect(setFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + + + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_INFO_ENUM_0300 + *@tc.name : AudioRec-Set1 + *@tc.desc : record audio with parameter set 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_REC_PR_VOICE_CHAT_GET_CAPTURER_INFO_ENUM_0300', 2, async function (done) { + let audioCapGetgetCapturerInfo; + let setFlag; + let audioStreamInfo44100 = { + samplingRate: 44100, + channels: 1, + sampleFormat: 1, + encodingType: 0, + }; + let audioCapturerInfo44100 = { + source: 1, + capturerFlags: 0 + } + let AudioCapturerOptionsInvalid = { + streamInfo: audioStreamInfo44100, + capturerInfo: audioCapturerInfo44100, + } + + await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { + if (data != undefined) { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); + audioCapGetgetCapturerInfo = data; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + done(); + }); + await sleep(1000); + await audioCapGetgetCapturerInfo.getCapturerInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); + console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); + console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); + setFlag = true; + }).catch((err) => { + setFlag = false; + console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); + }); + await sleep(1000); + audioCapGetgetCapturerInfo.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + setFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapGetgetCapturerInfo.state); + if ((audioCapGetgetCapturerInfo.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + setFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + setFlag); + expect(setFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + + + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_REC_CB_VOICE_CHAT_GET_CAPTURER_INFO_0400 + *@tc.name : AudioRec-Set1 + *@tc.desc : record audio with parameter set 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_REC_CB_VOICE_CHAT_GET_CAPTURER_INFO_0400', 2, async function (done) { + let audioCapGetgetCapturerInfo; + let setFlag; + let audioStreamInfo44100 = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let audioCapturerInfo44100 = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let AudioCapturerOptionsInvalid = { + streamInfo: audioStreamInfo44100, + capturerInfo: audioCapturerInfo44100, + } + + await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { + if (data != undefined) { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); + audioCapGetgetCapturerInfo = data; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + done(); + }); + await sleep(1000); + audioCapGetgetCapturerInfo.getCapturerInfo(async (err, audioParamsGet) => { + console.info('AudioFrameworkRecLog: ---------GET CAPTURER INFO---------'); + if (err) { + console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); + setFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); + console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); + console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); + setFlag = true; + await sleep(100); + done(); + } + }); + await sleep(1000); + audioCapGetgetCapturerInfo.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + setFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapGetgetCapturerInfo.state); + if ((audioCapGetgetCapturerInfo.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + setFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + setFlag); + expect(setFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_REC_CB_VOICE_CHAT_GET_STREAM_INFO_ENUM_0400 + *@tc.name : AudioRec-Set1 + *@tc.desc : record audio with parameter set 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_REC_CB_VOICE_CHAT_GET_STREAM_INFO_ENUM_0400', 2, async function (done) { + let audioCapGetgetCapturerInfo; + let setFlag; + let audioStreamInfo44100 = { + samplingRate: 44100, + channels: 1, + sampleFormat: 1, + encodingType: 0, + }; + let audioCapturerInfo44100 = { + source: 1, + capturerFlags: 0 + } + let AudioCapturerOptionsInvalid = { + streamInfo: audioStreamInfo44100, + capturerInfo: audioCapturerInfo44100, + } + + await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { + if (data != undefined) { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); + audioCapGetgetCapturerInfo = data; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + done(); + }); + await sleep(1000); + audioCapGetgetCapturerInfo.getCapturerInfo(async (err, audioParamsGet) => { + console.info('AudioFrameworkRecLog: ---------GET CAPTURER INFO---------'); + if (err) { + console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); + setFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); + console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); + console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); + setFlag = true; + await sleep(1000); + done(); + } + }); + + audioCapGetgetCapturerInfo.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + setFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapGetgetCapturerInfo.state); + if ((audioCapGetgetCapturerInfo.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + setFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + setFlag); + expect(setFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_REC_VOICE_CHAT_PR_ENUM_AUDIO_STREAM_INFO_INVALID_0100 + *@tc.name : AudioRec-Set1 + *@tc.desc : record audio with parameter set 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_REC_VOICE_CHAT_PR_ENUM_AUDIO_STREAM_INFO_INVALID_0100', 2, async function (done) { + let audioStreamInfo44100 = { + samplingRate: 0, + channels: 1, + sampleFormat: 1, + encodingType: 0, + }; + let audioCapturerInfo44100 = { + source: 1, + capturerFlags: 0 + } + let AudioCapturerOptionsInvalid = { + streamInfo: audioStreamInfo44100, + capturerInfo: audioCapturerInfo44100, + } + + let audioCap; + + await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { + if (data == undefined) { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); + } + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + }); + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_REC_VOICE_CHAT_PR_ENUM_AUDIO_CAPTURER_INFO_INVALID_0100 + *@tc.name : AudioRec-Set1 + *@tc.desc : record audio with parameter set 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_REC_VOICE_CHAT_PR_ENUM_AUDIO_CAPTURER_INFO_INVALID_0100', 2, async function (done) { + let audioStreamInfo44100 = { + samplingRate: 44100, + channels: 1, + sampleFormat: 1, + encodingType: 0, + }; + let audioCapturerInfo44100 = { + source: 1000, + capturerFlags: 0 + } + let AudioCapturerOptionsInvalid = { + streamInfo: audioStreamInfo44100, + capturerInfo: audioCapturerInfo44100, + } + + await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { + if (data == undefined) { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); + } + + }).catch((err) => { + console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); + }); + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_ON_0100 + *@tc.name : AudioCapturer-Check-STATE-STOPPED + *@tc.desc : AudioCapturer with state stopped + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_ON_0100', 2, async function (done) { + let stateFlag; + let audioCapCallBack; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.on('stateChange', (AudioState) => { + console.info('AudioCapturerLog: Changed State to : ' + AudioState) + switch (AudioState) { + case audio.AudioState.STATE_NEW: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------NEW--------------'); + console.info('AudioFrameworkTest: Audio State is : New'); + break; + case audio.AudioState.STATE_PREPARED: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------PREPARED--------------'); + console.info('AudioFrameworkTest: Audio State is : Prepared'); + break; + case audio.AudioState.STATE_RUNNING: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------RUNNING--------------'); + console.info('AudioFrameworkTest: Audio State is : Running'); + break; + case audio.AudioState.STATE_STOPPED: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------STOPPED--------------'); + console.info('AudioFrameworkTest: Audio State is : stopped'); + break; + case audio.AudioState.STATE_RELEASED: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------RELEASED--------------'); + console.info('AudioFrameworkTest: Audio State is : released'); + break; + default: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------INVALID--------------'); + console.info('AudioFrameworkTest: Audio State is : invalid'); + break; + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + await sleep(1000); + if ((audioCapCallBack.state == 2)) { + stateFlag == true; + } + } + }); + await sleep(1000); + + audioCapCallBack.stop(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO STOPPED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == audio.AudioState.STATE_STOPPED)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO STOPPED STATE---------'); + stateFlag == true; + } + console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); + } + }); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_ON_0200 + *@tc.name : AudioCapturer-Check-STATE-STOPPED + *@tc.desc : AudioCapturer with state stopped + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_ON_0200', 2, async function (done) { + let stateFlag; + let audioCapCallBack; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.on('stateChange', (AudioState) => { + console.info('AudioCapturerLog: Changed State to : ' + AudioState) + switch (AudioState) { + case audio.AudioState.STATE_NEW: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------NEW--------------'); + console.info('AudioFrameworkTest: Audio State is : New'); + break; + case audio.AudioState.STATE_PREPARED: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------PREPARED--------------'); + console.info('AudioFrameworkTest: Audio State is : Prepared'); + break; + case audio.AudioState.STATE_RUNNING: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------RUNNING--------------'); + console.info('AudioFrameworkTest: Audio State is : Running'); + break; + case audio.AudioState.STATE_STOPPED: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------STOPPED--------------'); + console.info('AudioFrameworkTest: Audio State is : stopped'); + break; + case audio.AudioState.STATE_RELEASED: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------RELEASED--------------'); + console.info('AudioFrameworkTest: Audio State is : released'); + break; + default: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------INVALID--------------'); + console.info('AudioFrameworkTest: Audio State is : invalid'); + break; + } + }); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_ON_0300 + *@tc.name : AudioCapturer-Check-STATE-STOPPED + *@tc.desc : AudioCapturer with state stopped + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_ON_0300', 2, async function (done) { + let stateFlag; + let audioCapCallBack; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.on('stateChange', (AudioState) => { + console.info('AudioCapturerLog: Changed State to : ' + AudioState) + switch (AudioState) { + case audio.AudioState.STATE_NEW: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------NEW--------------'); + console.info('AudioFrameworkTest: Audio State is : New'); + break; + case audio.AudioState.STATE_PREPARED: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------PREPARED--------------'); + console.info('AudioFrameworkTest: Audio State is : Prepared'); + break; + case audio.AudioState.STATE_RUNNING: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------RUNNING--------------'); + console.info('AudioFrameworkTest: Audio State is : Running'); + break; + case audio.AudioState.STATE_STOPPED: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------STOPPED--------------'); + console.info('AudioFrameworkTest: Audio State is : stopped'); + break; + case audio.AudioState.STATE_RELEASED: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------RELEASED--------------'); + console.info('AudioFrameworkTest: Audio State is : released'); + break; + default: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------INVALID--------------'); + console.info('AudioFrameworkTest: Audio State is : invalid'); + break; + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + await sleep(1000); + if ((audioCapCallBack.state == 2)) { + stateFlag == true; + } + } + }); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_ON_0400 + *@tc.name : AudioCapturer-Check-STATE-STOPPED + *@tc.desc : AudioCapturer with state stopped + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_ON_0400', 2, async function (done) { + let stateFlag; + let audioCapCallBack; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.on('stateChange', (AudioState) => { + console.info('AudioCapturerLog: Changed State to : ' + AudioState) + switch (AudioState) { + case audio.AudioState.STATE_NEW: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------NEW--------------'); + console.info('AudioFrameworkTest: Audio State is : New'); + break; + case audio.AudioState.STATE_PREPARED: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------PREPARED--------------'); + console.info('AudioFrameworkTest: Audio State is : Prepared'); + break; + case audio.AudioState.STATE_RUNNING: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------RUNNING--------------'); + console.info('AudioFrameworkTest: Audio State is : Running'); + break; + case audio.AudioState.STATE_STOPPED: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------STOPPED--------------'); + console.info('AudioFrameworkTest: Audio State is : stopped'); + break; + case audio.AudioState.STATE_RELEASED: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------RELEASED--------------'); + console.info('AudioFrameworkTest: Audio State is : released'); + break; + default: + console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------INVALID--------------'); + console.info('AudioFrameworkTest: Audio State is : invalid'); + break; + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + await sleep(1000); + if ((audioCapCallBack.state == 2)) { + stateFlag == true; + } + } + }); + await sleep(1000); + + audioCapCallBack.stop(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO STOPPED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == audio.AudioState.STATE_STOPPED)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO STOPPED STATE---------'); + stateFlag == true; + } + console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); + } + }); + + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + stateFlag = true; + console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_REACH_0100 + *@tc.name : AudioCapturer-Check-READ_BUFFER + *@tc.desc : AudioCapturer with read buffer + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_REACH_0100', 2, async function (done) { + let stateFlag; + await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.on('markReach', 5000, (position) => { + if (position == 5000) { + console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); + console.info('AudioRenderLog: mark reached: ' + position); + stateFlag = true; + } else { + stateFlag = false; + expect(stateFlag).assertTrue(); + done(); + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapCallBack.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); + let fd = fileio.openSync(dirPath, 0o102, 0o777); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd created'); + } else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); + stateFlag = false; + } + console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); + fd = fileio.openSync(dirPath, 0o2002, 0o666); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); + } else { + console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); + stateFlag = false; + } + await sleep(1000); + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); + await new Promise((resolve, reject) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + reject(err); + } else { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); + await sleep(50); + console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); + let number = fileio.writeSync(fd, buffer); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); + await sleep(100); + stateFlag = true; + resolve(); + } + }); + }) + numBuffersToCapture--; + } + await sleep(3000); + audioCapCallBack.off('markReach'); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } else { + stateFlag = false; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_REACH_0200 + *@tc.name : AudioCapturer-Check-READ_BUFFER + *@tc.desc : AudioCapturer with read buffer + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_REACH_0200', 2, async function (done) { + let stateFlag; + await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.on('markReach', 1000, (position) => { + if (position == 1000) { + console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); + console.info('AudioRenderLog: mark reached: ' + position); + stateFlag = true; + } else { + stateFlag = false; + expect(stateFlag).assertTrue(); + done(); + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapCallBack.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); + let fd = fileio.openSync(dirPath, 0o102, 0o777); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd created'); + } else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); + stateFlag = false; + } + console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); + fd = fileio.openSync(dirPath, 0o2002, 0o666); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); + } else { + console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); + stateFlag = false; + } + await sleep(1000); + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); + await new Promise((resolve, reject) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + reject(err); + } else { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); + await sleep(50); + console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); + let number = fileio.writeSync(fd, buffer); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); + await sleep(100); + stateFlag = true; + resolve(); + } + }); + }) + numBuffersToCapture--; + } + await sleep(3000); + audioCapCallBack.off('markReach'); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_REACH_0300 + *@tc.name : AudioCapturer-Check-READ_BUFFER + *@tc.desc : AudioCapturer with read buffer + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_REACH_0300', 2, async function (done) { + let stateFlag; + await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.on('markReach', 10000, (position) => { + if (position == 10000) { + console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); + console.info('AudioRenderLog: mark reached: ' + position); + stateFlag = true; + } else { + stateFlag = false; + expect(stateFlag).assertTrue(); + done(); + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapCallBack.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); + let fd = fileio.openSync(dirPath, 0o102, 0o777); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd created'); + } else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); + stateFlag = false; + } + console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); + fd = fileio.openSync(dirPath, 0o2002, 0o666); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); + } else { + console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); + stateFlag = false; + } + await sleep(1000); + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); + await new Promise((resolve, reject) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + reject(err); + } else { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); + await sleep(50); + console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); + let number = fileio.writeSync(fd, buffer); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); + await sleep(100); + stateFlag = true; + resolve(); + } + }); + }) + numBuffersToCapture--; + } + await sleep(3000); + audioCapCallBack.off('markReach'); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_REACH_0400 + *@tc.name : AudioCapturer-Check-READ_BUFFER + *@tc.desc : AudioCapturer with read buffer + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_REACH_0400', 2, async function (done) { + let stateFlag; + await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.on('markReach', 100, (position) => { + if (position == 100) { + console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); + console.info('AudioRenderLog: mark reached: ' + position); + stateFlag = true; + } else { + stateFlag = false; + expect(stateFlag).assertTrue(); + done(); + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapCallBack.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); + let fd = fileio.openSync(dirPath, 0o102, 0o777); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd created'); + } else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); + stateFlag = false; + } + console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); + fd = fileio.openSync(dirPath, 0o2002, 0o666); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); + } else { + console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); + stateFlag = false; + } + await sleep(1000); + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); + await new Promise((resolve, reject) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + reject(err); + } else { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); + await sleep(50); + console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); + let number = fileio.writeSync(fd, buffer); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); + await sleep(100); + stateFlag = true; + resolve(); + } + }); + }) + numBuffersToCapture--; + } + await sleep(3000); + audioCapCallBack.off('markReach'); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_REACH_0500 + *@tc.name : AudioCapturer-Check-READ_BUFFER + *@tc.desc : AudioCapturer with read buffer + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_REACH_0500', 2, async function (done) { + let stateFlag; + await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.on('markReach', 1, (position) => { + if (position == 1) { + console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); + console.info('AudioRenderLog: mark reached: ' + position); + stateFlag = true; + } else { + stateFlag = false; + expect(stateFlag).assertTrue(); + done(); + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapCallBack.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); + let fd = fileio.openSync(dirPath, 0o102, 0o777); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd created'); + } else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); + stateFlag = false; + } + console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); + fd = fileio.openSync(dirPath, 0o2002, 0o666); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); + } else { + console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); + stateFlag = false; + } + await sleep(1000); + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); + await new Promise((resolve, reject) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + reject(err); + } else { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); + await sleep(50); + console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); + let number = fileio.writeSync(fd, buffer); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); + await sleep(100); + stateFlag = true; + resolve(); + } + }); + }) + numBuffersToCapture--; + } + await sleep(3000); + audioCapCallBack.off('markReach'); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + }) + + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_REACH_0600 + *@tc.name : AudioCapturer-Check-READ_BUFFER + *@tc.desc : AudioCapturer with read buffer + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_REACH_0600', 2, async function (done) { + let stateFlag; + await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.on('markReach', 0, (position) => { + if (position == 0) { + console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); + console.info('AudioRenderLog: mark reached: ' + position); + stateFlag = true; + } else { + stateFlag = false; + expect(stateFlag).assertTrue(); + done(); + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapCallBack.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); + let fd = fileio.openSync(dirPath, 0o102, 0o777); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd created'); + } else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); + stateFlag = false; + } + console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); + fd = fileio.openSync(dirPath, 0o2002, 0o666); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); + } else { + console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); + stateFlag = false; + } + await sleep(1000); + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); + await new Promise((resolve, reject) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + reject(err); + } else { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); + await sleep(50); + console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); + let number = fileio.writeSync(fd, buffer); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); + await sleep(100); + stateFlag = true; + resolve(); + } + }); + }) + numBuffersToCapture--; + } + await sleep(3000); + audioCapCallBack.off('markReach'); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + }) + + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_REACH_0700 + *@tc.name : AudioCapturer-Check-READ_BUFFER + *@tc.desc : AudioCapturer with read buffer + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_REACH_0700', 2, async function (done) { + let stateFlag; + await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.on('markReach', 1234567890, (position) => { + if (position == 1234567890) { + console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); + console.info('AudioRenderLog: mark reached: ' + position); + stateFlag = true; + } else { + stateFlag = false; + expect(stateFlag).assertTrue(); + done(); + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapCallBack.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); + let fd = fileio.openSync(dirPath, 0o102, 0o777); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd created'); + } else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); + stateFlag = false; + } + console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); + fd = fileio.openSync(dirPath, 0o2002, 0o666); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); + } else { + console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); + stateFlag = false; + } + await sleep(1000); + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); + await new Promise((resolve, reject) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + reject(err); + } else { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); + await sleep(50); + console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); + let number = fileio.writeSync(fd, buffer); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); + await sleep(100); + stateFlag = true; + resolve(); + } + }); + }) + numBuffersToCapture--; + } + await sleep(3000); + audioCapCallBack.off('markReach'); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_REACH_0800 + *@tc.name : AudioCapturer-Check-READ_BUFFER + *@tc.desc : AudioCapturer with read buffer + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_REACH_0800', 2, async function (done) { + let stateFlag; + await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.on('markReach', -2, (position) => { + if (position == -2) { + console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); + console.info('AudioRenderLog: mark reached: ' + position); + stateFlag = true; + } else { + stateFlag = false; + expect(stateFlag).assertTrue(); + done(); + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapCallBack.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); + let fd = fileio.openSync(dirPath, 0o102, 0o777); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd created'); + } else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); + stateFlag = false; + } + console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); + fd = fileio.openSync(dirPath, 0o2002, 0o666); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); + } else { + console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); + stateFlag = false; + } + await sleep(1000); + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); + await new Promise((resolve, reject) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + reject(err); + } else { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); + await sleep(50); + console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); + let number = fileio.writeSync(fd, buffer); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); + await sleep(100); + stateFlag = true; + resolve(); + } + }); + }) + numBuffersToCapture--; + } + await sleep(3000); + audioCapCallBack.off('markReach'); + await sleep(1000); + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_0100 + *@tc.name : AudioCapturer-Check-READ_BUFFER + *@tc.desc : AudioCapturer with read buffer + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_0100', 2, async function (done) { + let stateFlag; + await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.on('periodReach', 1000, (position) => { + if (position == 1000) { + console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); + console.info('AudioRenderLog: mark reached: ' + position); + stateFlag = true; + } else { + stateFlag = false; + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapCallBack.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); + let fd = fileio.openSync(dirPath, 0o102, 0o777); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd created'); + } else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); + stateFlag = false; + } + console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); + fd = fileio.openSync(dirPath, 0o2002, 0o666); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); + } else { + console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); + stateFlag = false; + } + await sleep(1000); + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); + await new Promise((resolve, reject) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + reject(err); + } else { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); + await sleep(50); + console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); + let number = fileio.writeSync(fd, buffer); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); + await sleep(100); + stateFlag = true; + resolve(); + } + }); + }) + numBuffersToCapture--; + } + await sleep(3000); + audioCapCallBack.off('periodReach'); + await sleep(1000); + if (stateFlag == true) { + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + } else { + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + expect(stateFlag).assertTrue(); + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + stateFlag = false; + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + } + + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_0200 + *@tc.name : AudioCapturer-Check-READ_BUFFER + *@tc.desc : AudioCapturer with read buffer + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_0200', 2, async function (done) { + let stateFlag; + await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.on('periodReach', 1, (position) => { + if (position == 1) { + console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); + console.info('AudioRenderLog: mark reached: ' + position); + stateFlag = true; + } else { + stateFlag = false; + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapCallBack.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); + let fd = fileio.openSync(dirPath, 0o102, 0o777); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd created'); + } else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); + stateFlag = false; + } + console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); + fd = fileio.openSync(dirPath, 0o2002, 0o666); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); + } else { + console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); + stateFlag = false; + } + await sleep(1000); + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); + await new Promise((resolve, reject) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + reject(err); + } else { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); + await sleep(50); + console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); + let number = fileio.writeSync(fd, buffer); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); + await sleep(100); + stateFlag = true; + resolve(); + } + }); + }) + numBuffersToCapture--; + } + await sleep(3000); + audioCapCallBack.off('periodReach'); + await sleep(1000); + if (stateFlag == true) { + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + } else { + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + expect(stateFlag).assertTrue(); + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + stateFlag = false; + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + } + + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_0300 + *@tc.name : AudioCapturer-Check-READ_BUFFER + *@tc.desc : AudioCapturer with read buffer + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_0300', 2, async function (done) { + let stateFlag; + await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.on('periodReach', -2, (position) => { + if (position == -2) { + console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); + console.info('AudioRenderLog: mark reached: ' + position); + stateFlag = true; + } else { + stateFlag = false; + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapCallBack.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); + let fd = fileio.openSync(dirPath, 0o102, 0o777); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd created'); + } else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); + stateFlag = false; + } + console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); + fd = fileio.openSync(dirPath, 0o2002, 0o666); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); + } else { + console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); + stateFlag = false; + } + await sleep(1000); + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); + await new Promise((resolve, reject) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + reject(err); + } else { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); + await sleep(50); + console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); + let number = fileio.writeSync(fd, buffer); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); + await sleep(100); + stateFlag = true; + resolve(); + } + }); + }) + numBuffersToCapture--; + } + await sleep(3000); + audioCapCallBack.off('periodReach'); + await sleep(1000); + if (stateFlag == true) { + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + } else { + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + expect(stateFlag).assertTrue(); + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + stateFlag = false; + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + } + + }) + + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_0400 + *@tc.name : AudioCapturer-Check-READ_BUFFER + *@tc.desc : AudioCapturer with read buffer + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_0400', 2, async function (done) { + let stateFlag; + await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { + if (err) { + console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); + } else { + audioCapCallBack = value; + console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); + } + }); + await sleep(1000); + audioCapCallBack.on('periodReach', 223750, (position) => { + if (position == 223750) { + console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); + console.info('AudioRenderLog: periodReach: ' + position); + stateFlag = true; + } else { + stateFlag = false; + } + }); + await sleep(1000); + audioCapCallBack.start(async (err, value) => { + console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); + console.info('AudioFrameworkRecLog: ---------START---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); + if ((audioCapCallBack.state == 2)) { + stateFlag = true; + } + } + }); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); + let bufferSize = await audioCapCallBack.getBufferSize(); + console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); + await sleep(1000); + console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); + let fd = fileio.openSync(dirPath, 0o102, 0o777); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd created'); + } else { + console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); + stateFlag = false; + } + console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); + fd = fileio.openSync(dirPath, 0o2002, 0o666); + if (fd !== null) { + console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); + } else { + console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); + stateFlag = false; + } + await sleep(1000); + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); + await new Promise((resolve, reject) => { + audioCapCallBack.read(bufferSize, true, async (err, buffer) => { + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + reject(err); + } else { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); + console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); + await sleep(50); + console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); + let number = fileio.writeSync(fd, buffer); + console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); + await sleep(100); + stateFlag = true; + resolve(); + } + }); + }) + numBuffersToCapture--; + } + await sleep(3000); + audioCapCallBack.off('periodReach'); + await sleep(1000); + if (stateFlag == true) { + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + stateFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + } else { + audioCapCallBack.release(async (err, value) => { + console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); + if (err) { + console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); + stateFlag = false; + expect(stateFlag).assertTrue(); + } else { + console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); + console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); + console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); + if ((audioCapCallBack.state == 4)) { + console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); + console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); + stateFlag = false; + expect(stateFlag).assertTrue(); + done(); + } + } + }); + await sleep(1000); + } + + }) +}) diff --git a/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/List.test.js b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..06119e6f7eeb5793a0d289f5045a353a04356f9c --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturer/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. + */ + +require('./AudioCapturer.test.js') + + diff --git a/multimedia/audio/audio_js_standard/AudioCapturer/src/main/resources/base/element/string.json b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0bae6bd40f7360d5d818998221b199d3ec0f69c0 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioCapturer/src/main/resources/base/media/icon.png b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/audio/audio_js_standard/AudioCapturer/src/main/resources/base/media/icon.png differ diff --git a/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/BUILD.gn b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..b6ee79713059adee41fb37161796f8ed9535fa63 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/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("audio_capturerchangeInfo_js_hap") { + hap_profile = "./src/main/config.json" + deps = [ + ":audio_capturerchangeInfo_js_assets", + ":audio_capturerchangeInfo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAudioCapturerChangeInfoJsTest" + subsystem_name = "multimedia" + part_name = "multimedia_audio_framework" +} +ohos_js_assets("audio_capturerchangeInfo_js_assets") { + source_dir = "./src/main/js/default" +} +ohos_resources("audio_capturerchangeInfo_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/Test.json b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..124200ba9f94ead457c0686c9d3a4161a814d47d --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for audio manager Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "1500000", + "package": "ohos.acts.multimedia.audio.audiocapturerchangeInfo", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAudioCapturerChangeInfoJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/signature/openharmony_sx.p7b b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..0e9c4376f4c0ea2f256882a2170cd4e81ac135d7 Binary files /dev/null and b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/signature/openharmony_sx.p7b differ diff --git a/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/config.json b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..32901185131d75f4ec0bb5d43f9fcaa0ae182a1c --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/config.json @@ -0,0 +1,85 @@ +{ + "app": { + "apiVersion": { + "compatible": 6, + "releaseType": "Beta1", + "target": 7 + }, + "vendor": "acts", + "bundleName": "ohos.acts.multimedia.audio.audiocapturerchangeInfo", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": { + "default": { + "debug": true + } + }, + "module": { + "abilities": [ + { + "iconId": 16777218, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "descriptionId": 16777217, + "visible": true, + "labelId": 16777216, + "icon": "$media:icon", + "name": "ohos.acts.multimedia.audio.audiocapturerchangeInfo.MainAbility", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "homeAbility": true, + "launchType": "standard" + } + ], + "deviceType": [ + "default", + "phone", + "tablet", + "tv", + "wearable" + ], + "mainAbility": "ohos.acts.multimedia.audio.audiocapturerchangeInfo.MainAbility", + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "ohos.acts.multimedia.audio.audiocapturerchangeInfo", + "name": ".MyApplication", + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", + "reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS" + }, + { + "name": "ohos.permission.MICROPHONE", + "reason": "use ohos.permission.MICROPHONE" + } + ] + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/default/app.js b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* + * 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/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/default/i18n/en-US.json b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/default/i18n/zh-CN.json b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/default/pages/index/index.css b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..5bd7567028568bd522193b2519d545ca6dcf397d --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/default/pages/index/index.css @@ -0,0 +1,46 @@ +.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/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/default/pages/index/index.hml b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/default/pages/index/index.js b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a0719cee588ac4b0f56efbf784b19647bc6645de --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/default/pages/index/index.js @@ -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 {Core, ExpectExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + const configService = core.getDefaultService('config') + this.timeout = 60000 + configService.setConfig(this) + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/test/AudioCapturerChangeInfo.test.js b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/test/AudioCapturerChangeInfo.test.js new file mode 100644 index 0000000000000000000000000000000000000000..246876b1f5cf2e71b4058bd96f65e74c42f2b799 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/test/AudioCapturerChangeInfo.test.js @@ -0,0 +1,1972 @@ +/* + * 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 audio from '@ohos.multimedia.audio'; +import * as audioTestBase from '../../../../../AudioTestBase' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; + +describe('audioCapturerChange', function () { + let audioStreamManager; + let audioStreamManagerCB; + let Tag = "AFCapLog : "; + + const audioManager = audio.getAudioManager(); + console.info(Tag + 'Create AudioManger Object JS Framework'); + + beforeAll(async function () { + console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level'); + let permissionName1 = 'ohos.permission.MICROPHONE'; + let permissionNameList = [permissionName1]; + let appName = 'ohos.acts.multimedia.audio.audiocapturerchangeInfo'; + await audioTestBase.applyPermission(appName, permissionNameList); + await sleep(100); + console.info('AudioFrameworkTest: beforeAll: END'); + await sleep(100); + await audioManager.getStreamManager().then(async function (data) { + audioStreamManager = data; + console.info(Tag + ' Get AudioStream Manager : Success '); + }).catch((err) => { + console.info(Tag + ' Get AudioStream Manager : ERROR : ' + err.message); + }); + + audioManager.getStreamManager((err, data) => { + if (err) { + console.error(Tag + ' Get AudioStream Manager : ERROR : ' + err.message); + } + else { + audioStreamManagerCB = data; + console.info(Tag + ' Get AudioStream Manager : Success '); + } + }); + await sleep(1000); + console.info(Tag + ' beforeAll: END'); + }) + + beforeEach(async function () { + console.info(Tag + ' beforeEach: Prerequisites at the test case level'); + await sleep(1000); + }) + + afterEach(function () { + console.info(Tag + ' afterEach: Test case-level clearance conditions'); + }) + + afterAll(async function () { + await sleep(1000); + console.info(Tag + ' afterAll: Test suite-level cleanup condition'); + }) + + function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); + } + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ON_CAPTURER_CHANGE_0100 + *@tc.name : AudioCapturerChange - ON_STATE_PREPARED + *@tc.desc : AudioCapturerChange - ON_STATE_PREPARED + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_ON_CAPTURER_CHANGE_0100', 1, async function (done) { + let audioCap; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audioStreamManager.on('audioCapturerChange', async (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + let devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + if (AudioCapturerChangeInfoArray[i].capturerState == 1 && devDescriptor != null) { + audioStreamManager.off('audioCapturerChange'); + await audioCap.release(); + expect(true).assertTrue(); + done(); + } + } + }); + try { + audioCap = await audio.createAudioCapturer(AudioCapturerOptions); + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + } + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ON_CAPTURER_CHANGE_0200 + *@tc.name : AudioCapturerChange - ON_STATE_RUNNING + *@tc.desc : AudioCapturerChange - ON_STATE_RUNNING + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ON_CAPTURER_CHANGE_0200', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + let resultFlag = false; + + let audioCap; + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCap = data; + console.info(Tag + 'AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info(Tag + 'AudioCapturer Created : ERROR : ' + err.message); + }); + + audioStreamManagerCB.on('audioCapturerChange', async (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + let devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + if (AudioCapturerChangeInfoArray[i].capturerState == 2 && devDescriptor != null) { + resultFlag = true; + console.info(Tag + '[CAPTURER-CHANGE-ON-002] ResultFlag for element ' + i + ' is: ' + resultFlag); + audioStreamManagerCB.off('audioCapturerChange'); + console.info(Tag + '[CAPTURER-CHANGE-ON-002] ######### CapturerChange Off is called #########'); + + await audioCap.release().then(async function () { + console.info(Tag + 'Capturer release : SUCCESS'); + done(); + }).catch((err) => { + console.info(Tag + 'Capturer release :ERROR : ' + err.message); + }); + } + } + }); + + await audioCap.start().then(async function () { + console.info(Tag + 'Capturer started :SUCCESS '); + }).catch((err) => { + console.info(Tag + 'Capturer start :ERROR : ' + err.message); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ON_CAPTURER_CHANGE_0300 + *@tc.name : AudioCapturerChange - ON_STATE_STOPPED + *@tc.desc : AudioCapturerChange - ON_STATE_STOPPED + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ON_CAPTURER_CHANGE_0300', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + let resultFlag = false; + + let audioCap; + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCap = data; + console.info(Tag + 'AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info(Tag + 'AudioCapturer Created : ERROR : ' + err.message); + }); + + await audioCap.start().then(async function () { + console.info(Tag + 'Capturer started :SUCCESS '); + }).catch((err) => { + console.info(Tag + 'Capturer start :ERROR : ' + err.message); + }); + + await sleep(100); + + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + let devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + if (AudioCapturerChangeInfoArray[i].capturerState == 3 && devDescriptor != null) { + resultFlag = true; + console.info(Tag + '[CAPTURER-CHANGE-ON-003] ResultFlag for element ' + i + ' is: ' + resultFlag); + } + } + }); + + await sleep(100); + + await audioCap.stop().then(async function () { + console.info(Tag + 'Capturer stopped : SUCCESS'); + }).catch((err) => { + console.info(Tag + 'Capturer stop:ERROR : ' + err.message); + }); + + await sleep(100); + + audioStreamManager.off('audioCapturerChange'); + await sleep(100); + console.info(Tag + '[CAPTURER-CHANGE-ON-003] ######### CapturerChange Off is called #########'); + + await audioCap.release().then(async function () { + console.info(Tag + 'Capturer release : SUCCESS'); + }).catch((err) => { + console.info(Tag + 'Capturer release :ERROR : ' + err.message); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ON_CAPTURER_CHANGE_0400 + *@tc.name : AudioCapturerChange - ON_STATE_RELEASED + *@tc.desc : AudioCapturerChange - ON_STATE_RELEASED + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ON_CAPTURER_CHANGE_0400', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + let resultFlag = false; + + let audioCap; + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCap = data; + console.info(Tag + 'AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info(Tag + 'AudioCapturer Created : ERROR : ' + err.message); + }); + + await audioCap.start().then(async function () { + console.info(Tag + 'Capturer started :SUCCESS '); + }).catch((err) => { + console.info(Tag + 'Capturer start :ERROR : ' + err.message); + }); + + await audioCap.stop().then(async function () { + console.info(Tag + 'Capturer stopped : SUCCESS'); + }).catch((err) => { + console.info(Tag + 'Capturer stop:ERROR : ' + err.message); + }); + + await sleep(100); + + audioStreamManagerCB.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + let devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + if (AudioCapturerChangeInfoArray[i].capturerState == 4 && devDescriptor != null) { + resultFlag = true; + console.info(Tag + '[CAPTURER-CHANGE-ON-004] ResultFlag for element ' + i + ' is: ' + resultFlag); + } + } + }); + await sleep(100); + + await audioCap.release().then(async function () { + console.info(Tag + 'Capturer release : SUCCESS'); + }).catch((err) => { + console.info(Tag + 'Capturer release :ERROR : ' + err.message); + }); + + await sleep(100); + + audioStreamManagerCB.off('audioCapturerChange'); + await sleep(100); + console.info(Tag + '[CAPTURER-CHANGE-ON-004] ######### CapturerChange Off is called #########'); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ON_CAPTURER_CHANGE_0500 + *@tc.name : AudioCapturerChange - ON_SOURCE_TYPE_MIC + *@tc.desc : AudioCapturerChange - ON_SOURCE_TYPE_MIC + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_ON_CAPTURER_CHANGE_0500', 0, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + let audioCap; + + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + let devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + if (AudioCapturerChangeInfoArray[i].capturerInfo.source == 0 && devDescriptor != null) { + audioStreamManager.off('audioCapturerChange'); + expect(true).assertTrue(); + done(); + } + } + }); + try { + audioCap = await audio.createAudioCapturer(AudioCapturerOptions); + await audioCap.release(); + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + } + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ON_CAPTURER_CHANGE_0600 + *@tc.name : AudioCapturerChange - ON_SOURCE_TYPE_VOICE_COMMUNICATION + *@tc.desc : AudioCapturerChange - ON_SOURCE_TYPE_VOICE_COMMUNICATION + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_ON_CAPTURER_CHANGE_0600', 0, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_VOICE_COMMUNICATION, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + let resultFlag = false; + + let audioCap; + + audioStreamManagerCB.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + let devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + if (AudioCapturerChangeInfoArray[i].capturerInfo.source == 7 && devDescriptor != null) { + resultFlag = true; + console.info(Tag + '[CAPTURER-CHANGE-ON-006] ResultFlag for element ' + i + ' is: ' + resultFlag); + } + } + }); + await sleep(100); + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCap = data; + console.info(Tag + 'AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info(Tag + 'AudioCapturer Created : ERROR : ' + err.message); + }); + + await sleep(100); + + audioStreamManagerCB.off('audioCapturerChange'); + await sleep(100); + console.info(Tag + '[CAPTURER-CHANGE-ON-006] ######### CapturerChange Off is called #########'); + + + await audioCap.release().then(async function () { + console.info(Tag + 'Capturer release : SUCCESS'); + }).catch((err) => { + console.info(Tag + 'Capturer release :ERROR : ' + err.message); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ON_CAPTURER_CHANGE_0700 + *@tc.name : AudioCapturerChange - STREAMID + *@tc.desc : AudioCapturerChange - STREAMID + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_ON_CAPTURER_CHANGE_0700', 0, async function (done) { + let audioCap; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + let devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + if (AudioCapturerChangeInfoArray[i].streamId != undefined && devDescriptor != null) { + audioStreamManager.off('audioCapturerChange'); + expect(true).assertTrue(); + done(); + } + } + }); + try { + audioCap = await audio.createAudioCapturer(AudioCapturerOptions); + await audioCap.release(); + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + } + }) + + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ON_CAPTURER_CHANGE_0800 + *@tc.name : AudioCapturerChange - CLIENTUID AND CAPTURERFLAG + *@tc.desc : AudioCapturerChange - CLIENTUID AND CAPTURERFLAG + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ON_CAPTURER_CHANGE_0800', 2, async function (done) { + let audioCap; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + let clientUid = AudioCapturerChangeInfoArray[i].clientUid; + let capFlags = AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags; + let devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + if (clientUid != undefined && capFlags == 0 && devDescriptor != null) { + audioStreamManager.off('audioCapturerChange'); + expect(true).assertTrue(); + done(); + } + } + }); + try { + audioCap = await audio.createAudioCapturer(AudioCapturerOptions); + await audioCap.release(); + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + } + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ON_CAPTURER_CHANGE_0900 + *@tc.name : AudioCapturerChange - DeviceDescriptor + *@tc.desc : AudioCapturerChange - DeviceDescriptor + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ON_CAPTURER_CHANGE_0900', 2, async function (done) { + let audioCap; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + let Id = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id; + let dType = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType; + let dRole = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole; + let sRate = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]; + let cCount = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]; + let cMask = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks; + console.info(Tag + 'Id:' + i + ':' + Id); + console.info(Tag + 'Type:' + i + ':' + dType); + console.info(Tag + 'Role:' + i + ':' + dRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + sRate); + console.info(Tag + 'CC:' + i + ':' + cCount); + console.info(Tag + 'CM:' + i + ':' + cMask); + if (Id > 0 && dType == 15 && dRole == 1 && sRate != null && cCount != null && cMask != null) { + audioStreamManager.off('audioCapturerChange'); + expect(true).assertTrue(); + done(); + } + } + } + }); + try { + audioCap = await audio.createAudioCapturer(AudioCapturerOptions); + await audioCap.release(); + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + } + }) + + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_OFF_CAPTURER_CHANGE_0100 + *@tc.name : AudioCapturerChange - OFF_STATE_PREPARED + *@tc.desc : AudioCapturerChange - OFF_STATE_PREPARED + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_OFF_CAPTURER_CHANGE_0100', 1, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + let audioCap; + + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + audioStreamManager.off('audioCapturerChange'); + expect(true).assertTrue(); + done(); + } + }); + + try { + audioCap = await audio.createAudioCapturer(AudioCapturerOptions); + await audioCap.release(); + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + } + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_OFF_CAPTURER_CHANGE_0200 + *@tc.name : AudioCapturerChange - OFF_STATE_RUNNING + *@tc.desc : AudioCapturerChange - OFF_STATE_RUNNING + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_OFF_CAPTURER_CHANGE_0200', 1, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + let audioCap; + try { + audioCap = await audio.createAudioCapturer(AudioCapturerOptions); + await audioCap.start(); + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + } + + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + audioStreamManager.off('audioCapturerChange'); + expect(true).assertTrue(); + done(); + } + }); + await sleep(100); + await audioCap.release().then(async function () { + console.info(Tag + 'Capturer release : SUCCESS'); + }).catch((err) => { + console.info(Tag + 'Capturer release :ERROR : ' + err.message); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_OFF_CAPTURER_CHANGE_0300 + *@tc.name : AudioCapturerChange - OFF_STATE_STOPPED + *@tc.desc : AudioCapturerChange - OFF_STATE_STOPPED + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_OFF_CAPTURER_CHANGE_0300', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + let audioCap; + + try { + audioCap = await audio.createAudioCapturer(AudioCapturerOptions); + await audioCap.start(); + await audioCap.stop(); + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + } + + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + audioStreamManager.off('audioCapturerChange'); + expect(true).assertTrue(); + done(); + } + }); + await sleep(100); + + await audioCap.release().then(async function () { + console.info(Tag + 'Capturer release : SUCCESS'); + }).catch((err) => { + console.info(Tag + 'Capturer release :ERROR : ' + err.message); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_OFF_CAPTURER_CHANGE_0400 + *@tc.name : AudioCapturerChange - OFF_STATE_RELEASED + *@tc.desc : AudioCapturerChange - OFF_STATE_RELEASED + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_OFF_CAPTURER_CHANGE_0400', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + let audioCap; + + try { + audioCap = await audio.createAudioCapturer(AudioCapturerOptions); + await audioCap.start(); + await audioCap.stop(); + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + } + + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + audioStreamManager.off('audioCapturerChange'); + expect(true).assertTrue(); + done(); + } + }); + await sleep(100); + + await audioCap.release().then(async function () { + console.info(Tag + 'Capturer release : SUCCESS'); + }).catch((err) => { + console.info(Tag + 'Capturer release :ERROR : ' + err.message); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_OFF_CAPTURER_CHANGE_0500 + *@tc.name : AudioCapturerChange - DeviceDescriptor + *@tc.desc : AudioCapturerChange - DeviceDescriptor + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_OFF_CAPTURER_CHANGE_0500', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + let audioCap; + + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + let Id = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id; + let dType = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType; + let dRole = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole; + let sRate = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]; + let cCount = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]; + let cMask = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks; + console.info(Tag + 'Id:' + i + ':' + Id); + console.info(Tag + 'Type:' + i + ':' + dType); + console.info(Tag + 'Role:' + i + ':' + dRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + sRate); + console.info(Tag + 'CC:' + i + ':' + cCount); + console.info(Tag + 'CM:' + i + ':' + cMask); + if (Id > 0 && dType == 15 && dRole == 1 && sRate != null && cCount != null && cMask != null) { + audioStreamManager.off('audioCapturerChange'); + expect(true).assertTrue(); + done(); + } + } + } + }); + try { + audioCap = await audio.createAudioCapturer(AudioCapturerOptions); + await audioCap.release(); + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + } + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_GET_CAPTURER_CHANGE_PROMISE_0100 + *@tc.name : AudioCapturerChange - GET_STATE_PREPARED + *@tc.desc : AudioCapturerChange - GET_STATE_PREPARED + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_GET_CAPTURER_CHANGE_PROMISE_0100', 2, async function (done) { + let audioCap; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + audioStreamManagerCB.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + } + }); + await sleep(100); + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCap = data; + console.info(Tag + 'AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info(Tag + 'AudioCapturer Created : ERROR : ' + err.message); + expect(false).assertTrue(); + done(); + }); + + await sleep(100); + + await audioStreamManagerCB.getCurrentAudioCapturerInfoArray().then(function (AudioCapturerChangeInfoArray) { + console.info('AFCapturerChangeLog: [GET_CAP_STA_1_PR] **** Get Promise Called ****'); + if (AudioCapturerChangeInfoArray != null) { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + let devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + if (AudioCapturerChangeInfoArray[i].capturerState == 1 && devDescriptor != null) { + audioStreamManagerCB.off('audioCapturerChange'); + console.info('audioCapturerChange off success '); + expect(true).assertTrue(); + done(); + } + } + } + }).catch((err) => { + console.info('err : ' + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + }); + + await audioCap.release().then(async function () { + console.info(Tag + 'Capturer release : SUCCESS'); + }).catch((err) => { + console.info(Tag + 'Capturer release :ERROR : ' + err.message); + expect(false).assertTrue(); + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_GET_CAPTURER_CHANGE_PROMISE_0200 + *@tc.name : AudioCapturerChange - GET_STATE_RUNNING + *@tc.desc : AudioCapturerChange - GET_STATE_RUNNING + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_GET_CAPTURER_CHANGE_PROMISE_0200', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + let audioCap; + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCap = data; + console.info(Tag + 'AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info(Tag + 'AudioCapturer Created : ERROR : ' + err.message); + }); + + await sleep(100); + + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + } + }); + + await sleep(100); + await audioCap.start().then(async function () { + console.info(Tag + 'Capturer started :SUCCESS '); + }).catch((err) => { + console.info(Tag + 'Capturer start :ERROR : ' + err.message); + expect(false).assertTrue(); + done(); + }); + + await sleep(100); + + await audioStreamManager.getCurrentAudioCapturerInfoArray().then(function (AudioCapturerChangeInfoArray) { + console.info(Tag + '[GET_CAPTURER_STATE_2_PROMISE] **** Get Promise Called ****'); + if (AudioCapturerChangeInfoArray != null) { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + let devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + if (AudioCapturerChangeInfoArray[i].capturerState == 2 && devDescriptor != null) { + audioStreamManager.off('audioCapturerChange'); + expect(true).assertTrue(); + done(); + } + } + } + }).catch((err) => { + console.info('err : ' + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + }); + + await audioCap.release().then(async function () { + console.info(Tag + 'Capturer release : SUCCESS'); + }).catch((err) => { + console.info(Tag + 'Capturer release :ERROR : ' + err.message); + expect(false).assertTrue(); + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_GET_CAPTURER_CHANGE_PROMISE_0300 + *@tc.name : AudioCapturerChange - GET_STATE_STOPPED + *@tc.desc : AudioCapturerChange - GET_STATE_STOPPED + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_GET_CAPTURER_CHANGE_PROMISE_0300', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + let audioCap; + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCap = data; + console.info(Tag + 'AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info(Tag + 'AudioCapturer Created : ERROR : ' + err.message); + }); + + await audioCap.start().then(async function () { + console.info(Tag + 'Capturer started :SUCCESS '); + }).catch((err) => { + console.info(Tag + 'Capturer start :ERROR : ' + err.message); + }); + + await sleep(100); + + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + } + }); + + await sleep(100); + + await audioCap.stop().then(async function () { + console.info(Tag + 'Capturer stopped : SUCCESS'); + }).catch((err) => { + console.info(Tag + 'Capturer stop:ERROR : ' + err.message); + }); + + await sleep(100); + + await audioStreamManager.getCurrentAudioCapturerInfoArray().then(function (AudioCapturerChangeInfoArray) { + console.info(Tag + '[GET_CAPTURER_STATE_3_PROMISE] **** Get Promise Called ****'); + if (AudioCapturerChangeInfoArray != null) { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + let devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + if (AudioCapturerChangeInfoArray[i].capturerState == 3 && devDescriptor != null) { + audioStreamManager.off('audioCapturerChange'); + expect(true).assertTrue(); + done(); + } + } + } + }).catch((err) => { + console.info('err : ' + JSON.stringify(err)); + expect(false).assertTrue(); + done(); + }); + + await audioCap.release().then(async function () { + console.info(Tag + 'Capturer release : SUCCESS'); + }).catch((err) => { + console.info(Tag + 'Capturer release :ERROR : ' + err.message); + expect(false).assertTrue(); + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_GET_CAPTURER_CHANGE_PROMISE_0400 + *@tc.name : AudioCapturerChange - DEVICE DESCRIPTOR + *@tc.desc : AudioCapturerChange - DEVICE DESCRIPTOR + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_GET_CAPTURER_CHANGE_PROMISE_0400', 2, async function (done) { + let audioCap; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + let resultFlag = false; + audioStreamManagerCB.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + } + }); + await sleep(100); + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCap = data; + console.info(Tag + 'AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info(Tag + 'AudioCapturer Created : ERROR : ' + err.message); + }); + + await sleep(100); + + await audioStreamManagerCB.getCurrentAudioCapturerInfoArray().then(function (AudioCapturerChangeInfoArray) { + console.info('AFCapturerChangeLog: [GET_CAP_DD_PR] **** Get Promise Called ****'); + if (AudioCapturerChangeInfoArray != null) { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + let Id = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id; + let dType = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType; + let dRole = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole; + let sRate = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]; + let cCount = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]; + let cMask = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks; + console.info(Tag + 'Id:' + i + ':' + Id); + console.info(Tag + 'Type:' + i + ':' + dType); + console.info(Tag + 'Role:' + i + ':' + dRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + sRate); + console.info(Tag + 'CC:' + i + ':' + cCount); + console.info(Tag + 'CM:' + i + ':' + cMask); + if (Id > 0 && dType == 15 && dRole == 1 && sRate != null && cCount != null && cMask != null) { + audioStreamManagerCB.off('audioCapturerChange'); + expect(true).assertTrue(); + done(); + } + } + } + } + }).catch((err) => { + console.log(Tag + 'getCurrentAudioCapturerInfoArray :ERROR: ' + err.message); + resultFlag = false; + }); + + await audioCap.release().then(async function () { + console.info(Tag + 'Capturer release : SUCCESS'); + }).catch((err) => { + console.info(Tag + 'Capturer release :ERROR : ' + err.message); + }); + + expect(resultFlag).assertTrue(); + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_GET_CAPTURER_CHANGE_CALLBACK_0100 + *@tc.name : AudioCapturerChange - GET_STATE_PREPARED + *@tc.desc : AudioCapturerChange - GET_STATE_PREPARED + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_GET_CAPTURER_CHANGE_CALLBACK_0100', 2, async function (done) { + let audioCap; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + let resultFlag = false; + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + } + }); + await sleep(100); + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCap = data; + console.info(Tag + 'AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info(Tag + 'AudioCapturer Created : ERROR : ' + err.message); + }); + + await sleep(100); + + audioStreamManager.getCurrentAudioCapturerInfoArray(async (err, AudioCapturerChangeInfoArray) => { + console.info(Tag + '[GET_CAPTURER_STATE_1_CALLBACK] **** Get Callback Called ****'); + await sleep(100); + if (err) { + console.log(Tag + 'getCurrentAudioCapturerInfoArray :ERROR: ' + err.message); + resultFlag = false; + } + else { + if (AudioCapturerChangeInfoArray != null) { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + let devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + if (AudioCapturerChangeInfoArray[i].capturerState == 1 && devDescriptor != null) { + audioStreamManager.off('audioCapturerChange'); + await audioCap.release().then(async function () { + console.info(Tag + 'Capturer release : SUCCESS'); + done(); + }).catch((err) => { + console.info(Tag + 'Capturer release :ERROR : ' + err.message); + expect(false).assertTrue(); + done(); + }); + } + } + } + } + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_GET_CAPTURER_CHANGE_CALLBACK_0200 + *@tc.name : AudioCapturerChange - GET_STATE_RUNNING + *@tc.desc : AudioCapturerChange - GET_STATE_RUNNING + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_GET_CAPTURER_CHANGE_CALLBACK_0200', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + let resultFlag = false; + + let audioCap; + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCap = data; + console.info(Tag + 'AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info(Tag + 'AudioCapturer Created : ERROR : ' + err.message); + }); + + await sleep(100); + + audioStreamManagerCB.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + } + }); + + await sleep(100); + await audioCap.start().then(async function () { + console.info(Tag + 'Capturer started :SUCCESS '); + }).catch((err) => { + console.info(Tag + 'Capturer start :ERROR : ' + err.message); + }); + + await sleep(100); + + audioStreamManagerCB.getCurrentAudioCapturerInfoArray(async (err, AudioCapturerChangeInfoArray) => { + console.info(Tag + '[GET_CAPTURER_STATE_2_CALLBACK] **** Get Callback Called ****'); + await sleep(100); + if (err) { + console.log(Tag + 'getCurrentAudioCapturerInfoArray :ERROR: ' + err.message); + resultFlag = false; + } + else { + if (AudioCapturerChangeInfoArray != null) { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + let devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + if (AudioCapturerChangeInfoArray[i].capturerState == 2 && devDescriptor != null) { + audioStreamManagerCB.off('audioCapturerChange'); + await audioCap.release().then(async function () { + console.info(Tag + 'Capturer release : SUCCESS'); + done(); + }).catch((err) => { + console.info(Tag + 'Capturer release :ERROR : ' + err.message); + expect(false).assertTrue(); + done(); + }); + } + } + } + } + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_GET_CAPTURER_CHANGE_CALLBACK_0300 + *@tc.name : AudioCapturerChange - GET_STATE_STOPPED + *@tc.desc : AudioCapturerChange - GET_STATE_STOPPED + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_GET_CAPTURER_CHANGE_CALLBACK_0300', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + let resultFlag = false; + + let audioCap; + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCap = data; + console.info(Tag + 'AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info(Tag + 'AudioCapturer Created : ERROR : ' + err.message); + }); + + await audioCap.start().then(async function () { + console.info(Tag + 'Capturer started :SUCCESS '); + }).catch((err) => { + console.info(Tag + 'Capturer start :ERROR : ' + err.message); + }); + + await sleep(100); + + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + } + }); + + await sleep(100); + + await audioCap.stop().then(async function () { + console.info(Tag + 'Capturer stopped : SUCCESS'); + }).catch((err) => { + console.info(Tag + 'Capturer stop:ERROR : ' + err.message); + }); + + await sleep(100); + + audioStreamManager.getCurrentAudioCapturerInfoArray(async (err, AudioCapturerChangeInfoArray) => { + console.info(Tag + '[GET_CAPTURER_STATE_3_CALLBACK] **** Get Callback Called ****'); + await sleep(100); + if (err) { + console.log(Tag + 'getCurrentAudioCapturerInfoArray :ERROR: ' + err.message); + resultFlag = false; + } + else { + if (AudioCapturerChangeInfoArray != null) { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + let devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + if (AudioCapturerChangeInfoArray[i].capturerState == 3 && devDescriptor != null) { + audioStreamManager.off('audioCapturerChange'); + await audioCap.release().then(async function () { + console.info(Tag + 'Capturer release : SUCCESS'); + done(); + }).catch((err) => { + console.info(Tag + 'Capturer release :ERROR : ' + err.message); + expect(false).assertTrue(); + done(); + }); + } + } + } + } + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_GET_CAPTURER_CHANGE_CALLBACK_0400 + *@tc.name : AudioCapturerChange - DEVICE DESCRIPTOR + *@tc.desc : AudioCapturerChange - DEVICE DESCRIPTOR + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_GET_CAPTURER_CHANGE_CALLBACK_0400', 2, async function (done) { + let audioCap; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + ' ## CapChange on is called for element ' + i + ' ##'); + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(Tag + 'Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); + console.info(Tag + 'Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); + console.info(Tag + 'Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); + console.info(Tag + 'Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + 'Addr:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); + console.info(Tag + 'C' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); + console.info(Tag + 'CM:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); + } + } + }); + await sleep(100); + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCap = data; + console.info(Tag + 'AudioCapturer Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info(Tag + 'AudioCapturer Created : ERROR : ' + err.message); + expect(false).assertTrue(); + done(); + }); + + await sleep(100); + + audioStreamManager.getCurrentAudioCapturerInfoArray(async (err, AudioCapturerChangeInfoArray) => { + console.info(Tag + '[GET_CAPTURER_DD_CALLBACK] **** Get Callback Called ****'); + await sleep(100); + if (err) { + console.log(Tag + 'getCurrentAudioCapturerInfoArray :ERROR: ' + err.message); + resultFlag = false; + } + else { + if (AudioCapturerChangeInfoArray != null) { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(Tag + 'StrId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); + console.info(Tag + 'CUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); + console.info(Tag + 'Src for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); + console.info(Tag + 'Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); + console.info(Tag + 'State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + let Id = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id; + let dType = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType; + let dRole = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole; + let sRate = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]; + let cCount = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]; + let cMask = AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks; + console.info(Tag + 'Id:' + i + ':' + Id); + console.info(Tag + 'Type:' + i + ':' + dType); + console.info(Tag + 'Role:' + i + ':' + dRole); + console.info(Tag + 'Nam:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); + console.info(Tag + '' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); + console.info(Tag + 'SR:' + i + ':' + sRate); + console.info(Tag + 'CC:' + i + ':' + cCount); + console.info(Tag + 'CM:' + i + ':' + cMask); + if (Id > 0 && dType == 15 && dRole == 1 && sRate != null && cCount != null && cMask != null) { + audioStreamManager.off('audioCapturerChange'); + await audioCap.release().then(async function () { + console.info(Tag + 'Capturer release : SUCCESS'); + done(); + }).catch((err) => { + console.info(Tag + 'Capturer release :ERROR : ' + err.message); + expect(false).assertTrue(); + done(); + }); + } + } + } + } + } + }); + }) + +}) diff --git a/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/test/List.test.js b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..d664ed8bcca4fe77ea187c94822f4f408a2a536a --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/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. + */ + +require('./AudioCapturerChangeInfo.test.js') + + diff --git a/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/resources/base/element/string.json b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0bae6bd40f7360d5d818998221b199d3ec0f69c0 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/resources/base/media/icon.png b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/audio/audio_js_standard/AudioCapturerChangeInfo/src/main/resources/base/media/icon.png differ diff --git a/multimedia/audio/audio_js_standard/AudioEventManagement/BUILD.gn b/multimedia/audio/audio_js_standard/AudioEventManagement/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..8a7c237bb5ebc9cb4d907d5478d12600842e0721 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioEventManagement/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("audio_eventmanagement_js_hap") { + hap_profile = "./src/main/config.json" + deps = [ + ":audio_eventmanagement_js_assets", + ":audio_eventmanagement_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAudioEventManagementJsTest" + subsystem_name = "multimedia" + part_name = "multimedia_audio_framework" +} +ohos_js_assets("audio_eventmanagement_js_assets") { + source_dir = "./src/main/js/default" +} +ohos_resources("audio_eventmanagement_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/multimedia/audio/audio_js_standard/AudioEventManagement/Test.json b/multimedia/audio/audio_js_standard/AudioEventManagement/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4a214ead0f269411bdce0a374dda9c4fa1605cfd --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioEventManagement/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for audio manager Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "1500000", + "package": "ohos.acts.multimedia.audio.audioeventmanagement", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAudioEventManagementJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioEventManagement/signature/openharmony_sx.p7b b/multimedia/audio/audio_js_standard/AudioEventManagement/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..0e9c4376f4c0ea2f256882a2170cd4e81ac135d7 Binary files /dev/null and b/multimedia/audio/audio_js_standard/AudioEventManagement/signature/openharmony_sx.p7b differ diff --git a/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/config.json b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..c9fc00bb745ee526a0ffc4fd1bf00a540d53f4c8 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/config.json @@ -0,0 +1,75 @@ +{ + "app": { + "apiVersion": { + "compatible": 6, + "releaseType": "Beta1", + "target": 7 + }, + "vendor": "acts", + "bundleName": "ohos.acts.multimedia.audio.audioeventmanagement", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": { + "default": { + "debug": true + } + }, + "module": { + "abilities": [ + { + "iconId": 16777218, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "descriptionId": 16777217, + "visible": true, + "labelId": 16777216, + "icon": "$media:icon", + "name": "ohos.acts.multimedia.audio.audioeventmanagement.MainAbility", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "homeAbility": true, + "launchType": "standard" + } + ], + "deviceType": [ + "default", + "phone", + "tablet", + "tv", + "wearable" + ], + "mainAbility": "ohos.acts.multimedia.audio.audioeventmanagement.MainAbility", + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "ohos.acts.multimedia.audio.audioeventmanagement", + "name": ".MyApplication", + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/default/app.js b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* + * 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/audio/audio_js_standard/AudioEventManagement/src/main/js/default/i18n/en-US.json b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/default/i18n/zh-CN.json b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/default/pages/index/index.css b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..5bd7567028568bd522193b2519d545ca6dcf397d --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/default/pages/index/index.css @@ -0,0 +1,46 @@ +.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/audio/audio_js_standard/AudioEventManagement/src/main/js/default/pages/index/index.hml b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/default/pages/index/index.js b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a0719cee588ac4b0f56efbf784b19647bc6645de --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/default/pages/index/index.js @@ -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 {Core, ExpectExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + const configService = core.getDefaultService('config') + this.timeout = 60000 + configService.setConfig(this) + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/test/AudioEventManagement.test.js b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/test/AudioEventManagement.test.js new file mode 100644 index 0000000000000000000000000000000000000000..0dd54c2763834c25c8292ddad6e7568d170180c4 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/test/AudioEventManagement.test.js @@ -0,0 +1,734 @@ +/* + * 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 audio from '@ohos.multimedia.audio'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; + +describe('audioEventManagement', function () { + console.info('AudioFrameworkTest: Create AudioManger Object JS Framework'); + let audioManager = null; + let deviceRoleValue = null; + let deviceTypeValue = null; + function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); + } + function getAudioManager() { + audioManager = audio.getAudioManager(); + if (audioManager != null) { + console.info('AudioFrameworkTest: getAudioManger : PASS'); + } + else { + console.info('AudioFrameworkTest: getAudioManger : FAIL'); + } + } + function displayDeviceProp(value, index, array) { + let devRoleName; + let devTypeName; + if (value.deviceRole == 1) { + devRoleName = 'INPUT_DEVICE'; + } + else if (value.deviceRole == 2) { + devRoleName = 'OUTPUT_DEVICE '; + } + else { + devRoleName = 'ERROR : UNKNOWN : ' + value.deviceRole; + } + + if (value.deviceType == 1) { + devTypeName = 'EARPIECE'; + } + else if (value.deviceType == 2) { + devTypeName = 'SPEAKER'; + } + else if (value.deviceType == 3) { + devTypeName = 'WIRED_HEADSET'; + } + else if (value.deviceType == 8) { + devTypeName = 'BLUETOOTH_A2DP'; + } + else if (value.deviceType == 15) { + devTypeName = 'MIC'; + } + else { + devTypeName = 'ERROR : UNKNOWN :' + value.deviceType; + } + + console.info(`AudioFrameworkTest: device role: ${devRoleName}`); + deviceRoleValue = value.deviceRole; + console.info(`AudioFrameworkTest: device type: ${devTypeName}`); + deviceTypeValue = value.deviceType; + + } + + beforeAll(async function () { + console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level'); + await getAudioManager(); + }) + + beforeEach(function () { + console.info('AudioFrameworkTest: beforeEach: Prerequisites at the test case level'); + }) + + afterEach(async function () { + console.info('AudioFrameworkTest: afterEach: Test case-level clearance conditions'); + await sleep(1000); + }) + + afterAll(async function () { + console.info('AudioFrameworkTest: afterAll: Test suite-level cleanup condition'); + + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0100 + *@tc.name : getDevices - Output device - Promise - ENAME + *@tc.desc : getDevices - Output device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0100', 0, async function (done) { + const PROMISE = audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG) + PROMISE.then(function (value) { + + console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG'); + value.forEach(displayDeviceProp); + if (deviceTypeValue != null && deviceRoleValue != null) { + console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS'); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); + expect(false).assertTrue(); + } + }); + await PROMISE; + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_PR_GETDEVICES_OUTPUT_ENUM_0100 + *@tc.name : getDevices - Output device - Promise - ENAME - + *@tc.desc : getDevices - Output device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_PR_GETDEVICES_OUTPUT_ENUM_0100', 0, async function (done) { + const PROMISE = audioManager.getDevices(1) + PROMISE.then(function (value) { + console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG'); + value.forEach(displayDeviceProp); + if (deviceTypeValue != null && deviceRoleValue != null) { + console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS'); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); + expect(false).assertTrue(); + } + }); + await PROMISE; + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_PR_GETDEVICES_INPUT_0100 + *@tc.name : getDevices - Input device - Promise - ENAME + *@tc.desc : getDevices - Input device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_PR_GETDEVICES_INPUT_0100', 0, async function (done) { + const PROMISE = audioManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG); + PROMISE.then(function (value) { + console.info('AudioFrameworkTest: Promise: getDevices INPUT_DEVICES_FLAG'); + value.forEach(displayDeviceProp); + if (deviceTypeValue != null && deviceRoleValue != null) { + console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS'); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : FAIL'); + expect(false).assertTrue(); + } + }); + await PROMISE; + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_PR_GETDEVICES_INTPUT_ENUM_0100 + *@tc.name : getDevices - Input device - Promise - ENAME + *@tc.desc : getDevices - Input device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_PR_GETDEVICES_INTPUT_ENUM_0100', 0, async function (done) { + const PROMISE = audioManager.getDevices(2); + PROMISE.then(function (value) { + console.info('AudioFrameworkTest: Promise: getDevices INPUT_DEVICES_FLAG'); + value.forEach(displayDeviceProp); + + if (deviceTypeValue != null && deviceRoleValue != null) { + console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS'); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : FAIL'); + expect(false).assertTrue(); + } + }); + await PROMISE; + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_PR_GETDEVICES_ALL_0100 + *@tc.name : getDevices - ALL device - Promise - ENAME + *@tc.desc : getDevices - ALL device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_PR_GETDEVICES_ALL_0100', 0, async function (done) { + const PROMISE = audioManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG); + PROMISE.then(function (value) { + console.info('AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG'); + value.forEach(displayDeviceProp); + + if (deviceTypeValue != null && deviceRoleValue != null) { + console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : PASS'); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : FAIL'); + expect(false).assertTrue(); + } + }); + await PROMISE; + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_PR_GETDEVICES_ALL_ENUM_0100 + *@tc.name : getDevices - ALL device - Promise - ENAME + *@tc.desc : getDevices - ALL device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_PR_GETDEVICES_ALL_ENUM_0100', 0, async function (done) { + const PROMISE = audioManager.getDevices(3); + PROMISE.then(function (value) { + console.info('AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG'); + value.forEach(displayDeviceProp); + + if (deviceTypeValue != null && deviceRoleValue != null) { + console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : PASS'); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : FAIL'); + expect(false).assertTrue(); + } + }); + await PROMISE; + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_CB_GETDEVICES_OUTPUT_0100 + *@tc.name : getDevices - Output device - Callback - ENAME + *@tc.desc : getDevices - Output device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_CB_GETDEVICES_OUTPUT_0100', 0, async function (done) { + audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value) => { + console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); + if (err) { + console.error(`AudioFrameworkTest: Callback: OUTPUT_DEVICES_FLAG: failed to get devices ${err.message}`); + expect().assertFail(); + } + else { + console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); + value.forEach(displayDeviceProp); + if (deviceTypeValue != null && deviceRoleValue != null) { + console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS'); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); + expect(false).assertTrue(); + } + } + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_CB_GETDEVICES_OUTPUT_ENUM_0100 + *@tc.name : getDevices - Output device - Callback - ENAME + *@tc.desc : getDevices - Output device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_CB_GETDEVICES_OUTPUT_ENUM_0100', 2, async function (done) { + audioManager.getDevices(1, (err, value) => { + console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); + if (err) { + console.error(`AudioFrameworkTest: Callback: OUTPUT_DEVICES_FLAG: failed to get devices ${err.message}`); + expect().assertFail(); + } + else { + console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); + value.forEach(displayDeviceProp); + if (deviceTypeValue != null && deviceRoleValue != null) { + console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS'); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); + expect(false).assertTrue(); + } + } + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_CB_GETDEVICES_INPUT_0100 + *@tc.name : getDevices - Input device - Callback - ENAME + *@tc.desc : getDevices - Input device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_CB_GETDEVICES_INPUT_0100', 0, async function (done) { + audioManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG, (err, value) => { + console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); + if (err) { + console.error(`AudioFrameworkTest: Callback: INPUT_DEVICES_FLAG: failed to get devices ${err.message}`); + expect().assertFail(); + } + else { + console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); + value.forEach(displayDeviceProp); + + if (deviceTypeValue != null && deviceRoleValue != null) { + console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS'); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL'); + expect(false).assertTrue(); + } + } + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_CB_GETDEVICES_INPUT_ENUM_0100 + *@tc.name : getDevices - Input device - Callback - ENAME + *@tc.desc : getDevices - Input device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_CB_GETDEVICES_INPUT_ENUM_0100', 0, async function (done) { + audioManager.getDevices(2, (err, value) => { + console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); + if (err) { + console.error(`AudioFrameworkTest: Callback: INPUT_DEVICES_FLAG: failed to get devices ${err.message}`); + expect().assertFail(); + } + else { + console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); + value.forEach(displayDeviceProp); + + if (deviceTypeValue != null && deviceRoleValue != null) { + console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS'); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL'); + expect(false).assertTrue(); + } + } + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_CB_GETDEVICES_ALL_0100 + *@tc.name : getDevices - ALL device - Callback - ENAME + *@tc.desc : getDevices - ALL device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_CB_GETDEVICES_ALL_0100', 0, async function (done) { + audioManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG, (err, value) => { + console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); + if (err) { + console.error(`AudioFrameworkTest: Callback: ALL_DEVICES_FLAG: failed to get devices ${err.message}`); + expect().assertFail(); + } + else { + console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); + value.forEach(displayDeviceProp); + if (deviceTypeValue != null && deviceRoleValue != null) { + console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS'); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL'); + expect(false).assertTrue(); + } + } + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_CB_GETDEVICES_ALL_ENUM_0100 + *@tc.name : getDevices - ALL device - Callback - ENAME + *@tc.desc : getDevices - ALL device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_CB_GETDEVICES_ALL_ENUM_0100', 2, async function (done) { + audioManager.getDevices(3, (err, value) => { + console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); + if (err) { + console.error(`AudioFrameworkTest: Callback: ALL_DEVICES_FLAG: failed to get devices ${err.message}`); + expect().assertFail(); + } + else { + console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); + value.forEach(displayDeviceProp); + if (deviceTypeValue != null && deviceRoleValue != null) { + console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS'); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL'); + expect(false).assertTrue(); + } + } + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_SETDEVICEACTIVE_PR_DEACTIVATE_0100 + *@tc.name : setDeviceActive - SPEAKER - deactivate - Promise + *@tc.desc : Deactivate speaker - Promise + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_SETDEVICEACTIVE_PR_DEACTIVATE_0100', 2, async function (done) { + await audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, false).then(function () { + // Setting device active ENUM 2 = SPEAKER + console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Deactivate'); + audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER).then(function (value) { + if (value == false) { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : PASS :' + value); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL :' + value); + expect(false).assertTrue(); + } + }); + }).catch((err) => { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL : Error :' + err.message); + expect(false).assertTrue(); + }); + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_SETDEVICEACTIVE_PR_DEACTIVATE_ENUM_0100 + *@tc.name : setDeviceActive - SPEAKER - deactivate - Promise + *@tc.desc : Deactivate speaker - Promise + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_SETDEVICEACTIVE_PR_DEACTIVATE_ENUM_0100', 2, async function (done) { + await audioManager.setDeviceActive(2, true).then(function () { + console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Active'); + }); + await audioManager.setDeviceActive(2, false).then(function () { + // Setting device active ENUM 2 = SPEAKER + console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Deactivate'); + audioManager.isDeviceActive(2).then(function (value) { + if (value == false) { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : PASS :' + value); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL :' + value); + expect(false).assertTrue(); + } + }); + }).catch((err) => { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL : Error :' + err.message); + expect(false).assertTrue(); + }); + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_SETDEVICEACTIVE_PR_ACTIVATE_0100 + *@tc.name : setDeviceActive - SPEAKER - Activate - Promise + *@tc.desc : Activate speaker - Promise + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_SETDEVICEACTIVE_PR_ACTIVATE_0100', 2, async function (done) { + await audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, true).then(function () { + console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Activate'); + audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER).then(function (value) { + if (value == true) { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : PASS :' + value); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :' + value); + expect(false).assertTrue(); + } + }); + }).catch((err) => { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :Error :' + err.message); + expect(false).assertTrue(); + }); + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_SETDEVICEACTIVE_PR_ACTIVATE_ENUM_0100 + *@tc.name : setDeviceActive - SPEAKER - Activate - Promise + *@tc.desc : Activate speaker - Promise + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_SETDEVICEACTIVE_PR_ACTIVATE_ENUM_0100', 2, async function (done) { + await audioManager.setDeviceActive(2, true).then(function () { + console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Activate'); + audioManager.isDeviceActive(2).then(function (value) { + if (value == true) { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : PASS :' + value); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :' + value); + expect(false).assertTrue(); + } + }); + }).catch((err) => { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :Error :' + err.message); + expect(false).assertTrue(); + }); + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_SETDEVICEACTIVE_CB_DEACTIVATE_0100 + *@tc.name : setDeviceActive - SPEAKER - deactivate - Callback + *@tc.desc : Deactivate speaker - Callback + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_SETDEVICEACTIVE_CB_DEACTIVATE_0100', 2, async function (done) { + audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, false, (err) => { + if (err) { + console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`); + expect(false).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); + audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER, (err, value) => { + if (err) { + console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`); + expect(false).assertTrue(); + } + else if (value == false) { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :' + value); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : FAIL :' + value); + expect(false).assertTrue(); + } + done(); + }); + } + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_SETDEVICEACTIVE_CB_DEACTIVATE_ENUM_0100 + *@tc.name : setDeviceActive - SPEAKER - deactivate - Callback + *@tc.desc : Deactivate speaker - Callback + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_SETDEVICEACTIVE_CB_DEACTIVATE_ENUM_0100', 2, async function (done) { + await audioManager.setDeviceActive(2, true).then(function () { + console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER : Active'); + }); + audioManager.setDeviceActive(2, false, (err) => { + if (err) { + console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`); + expect(false).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); + audioManager.isDeviceActive(2, (err, value) => { + if (err) { + console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`); + expect(false).assertTrue(); + } + else if (value == false) { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :' + value); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : FAIL :' + value); + expect(false).assertTrue(); + } + done(); + }); + } + done(); + }); + }) + + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_SETDEVICEACTIVE_CB_ACTIVATE_0100 + *@tc.name : setDeviceActive - SPEAKER - activate - Callback + *@tc.desc : Activate speaker - Callback + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_SETDEVICEACTIVE_CB_ACTIVATE_0100', 2, async function (done) { + audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, true, (err) => { + if (err) { + console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active: Error: ${err.message}`); + expect(false).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); + audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER, (err, value) => { + if (err) { + console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active: Error: ${err.message}`); + expect(false).assertTrue(); + } + else if (value == true) { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : PASS :' + value); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : FAIL :' + value); + expect(false).assertTrue(); + } + done(); + }); + } + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_SETDEVICEACTIVE_CB_ACTIVATE_ENUM_0100 + *@tc.name : setDeviceActive - SPEAKER - activate - Callback + *@tc.desc : Activate speaker - Callback + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_AUDIO_MANAGER_SETDEVICEACTIVE_CB_ACTIVATE_ENUM_0100 ', 2, async function (done) { + audioManager.setDeviceActive(2, true, (err) => { + if (err) { + console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active: Error: ${err.message}`); + expect(false).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); + audioManager.isDeviceActive(2, (err, value) => { + if (err) { + console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active: Error: ${err.message}`); + expect(false).assertTrue(); + } + else if (value == true) { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : PASS :' + value); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : FAIL :' + value); + expect(false).assertTrue(); + } + done(); + }); + } + done(); + }); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_DEVICECHANGETYPE_0100 + *@tc.name : DeviceChangeType - CONNECT + *@tc.desc : DeviceChangeType - CONNECT + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_DEVICECHANGETYPE_0100', 2, async function (done) { + expect(audio.DeviceChangeType.CONNECT).assertEqual(0); + await sleep(50); + done(); + }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_DEVICECHANGETYPE_0200 + *@tc.name : DeviceChangeType - DISCONNECT + *@tc.desc : DeviceChangeType - DISCONNECT + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_DEVICECHANGETYPE_0200', 2, async function (done) { + expect(audio.DeviceChangeType.DISCONNECT).assertEqual(1); + await sleep(50); + done(); + }) +}) \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/test/List.test.js b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..5532470855f8f7cbbe7f96bfe0105ae9ef766276 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioEventManagement/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. + */ + +require('./AudioEventManagement.test.js') + + diff --git a/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/resources/base/element/string.json b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0bae6bd40f7360d5d818998221b199d3ec0f69c0 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/resources/base/media/icon.png b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/audio/audio_js_standard/AudioEventManagement/src/main/resources/base/media/icon.png differ diff --git a/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/BUILD.gn b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..dbbe80ad9face20f9a96b32a4e5a773217d64776 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/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("audio_rendererchangeInfo_js_hap") { + hap_profile = "./src/main/config.json" + deps = [ + ":audio_rendererchangeInfo_js_assets", + ":audio_rendererchangeInfo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAudioRendererChangeInfoJsTest" + subsystem_name = "multimedia" + part_name = "multimedia_audio_framework" +} +ohos_js_assets("audio_rendererchangeInfo_js_assets") { + source_dir = "./src/main/js/default" +} +ohos_resources("audio_rendererchangeInfo_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/Test.json b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..005c59d5bcdfa3f4ac8b959977a6d9f6aeee8ae9 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for audio manager Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "1500000", + "package": "ohos.acts.multimedia.audio.audiorendererchangeInfo", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAudioRendererChangeInfoJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/signature/openharmony_sx.p7b b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..0e9c4376f4c0ea2f256882a2170cd4e81ac135d7 Binary files /dev/null and b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/signature/openharmony_sx.p7b differ diff --git a/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/config.json b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..a703d4d273a812c774a511a32a49950044be5298 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/config.json @@ -0,0 +1,75 @@ +{ + "app": { + "apiVersion": { + "compatible": 6, + "releaseType": "Beta1", + "target": 7 + }, + "vendor": "acts", + "bundleName": "ohos.acts.multimedia.audio.audiorendererchangeInfo", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": { + "default": { + "debug": true + } + }, + "module": { + "abilities": [ + { + "iconId": 16777218, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "descriptionId": 16777217, + "visible": true, + "labelId": 16777216, + "icon": "$media:icon", + "name": "ohos.acts.multimedia.audio.audiorendererchangeInfo.MainAbility", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "homeAbility": true, + "launchType": "standard" + } + ], + "deviceType": [ + "default", + "phone", + "tablet", + "tv", + "wearable" + ], + "mainAbility": "ohos.acts.multimedia.audio.audiorendererchangeInfo.MainAbility", + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "ohos.acts.multimedia.audio.audiorendererchangeInfo", + "name": ".MyApplication", + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/default/app.js b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* + * 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/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/default/i18n/en-US.json b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/default/i18n/zh-CN.json b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/default/pages/index/index.css b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..5bd7567028568bd522193b2519d545ca6dcf397d --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/default/pages/index/index.css @@ -0,0 +1,46 @@ +.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/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/default/pages/index/index.hml b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/default/pages/index/index.js b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a0719cee588ac4b0f56efbf784b19647bc6645de --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/default/pages/index/index.js @@ -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 {Core, ExpectExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + const configService = core.getDefaultService('config') + this.timeout = 60000 + configService.setConfig(this) + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/test/AudioRendererChangeInfo.test.js b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/test/AudioRendererChangeInfo.test.js new file mode 100644 index 0000000000000000000000000000000000000000..0493fd1f4538a01e38075e838b15da6d4f5dff40 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/test/AudioRendererChangeInfo.test.js @@ -0,0 +1,3351 @@ +/* + * 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 audio from '@ohos.multimedia.audio'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; + +describe('audioRendererChange', function () { + + let audioStreamManager; + let audioStreamManagerCB; + let Tag = 'AFRenLog : '; + const AUDIOMANAGER = audio.getAudioManager(); + console.info(`${Tag} : 'Create AudioManger Object JS Framework`); + + beforeAll(async function () { + await AUDIOMANAGER.getStreamManager().then(async function (data) { + audioStreamManager = data; + console.info(`${Tag} : 'Get AudioStream Manager : Success `); + }).catch((err) => { + console.info(`${Tag} : 'Get AudioStream Manager : ERROR : ${err.message}`); + }); + + AUDIOMANAGER.getStreamManager((err, data) => { + if (err) { + console.error(`${Tag} : 'Get AudioStream Manager : ERROR : ${err.message}`); + } + else { + audioStreamManagerCB = data; + console.info(`${Tag} : 'Get AudioStream Manager : Success `); + } + }); + await sleep(1000); + + console.info(`${Tag} : 'beforeAll: Prerequisites at the test suite level`); + }) + + beforeEach(async function () { + console.info(`${Tag} : 'beforeEach: Prerequisites at the test case level`); + await sleep(1000); + }) + + afterEach(function () { + console.info(`${Tag} : 'afterEach: Test case-level clearance conditions`); + }) + + afterAll(async function () { + console.info(`${Tag} : 'afterAll: Test suite-level cleanup condition`); + }) + + function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); + } + + /** + * @tc.number : SUB_MULTIMEDIA_ON_RENDERER_CHANGE_0100 + * @tc.name : AudioRendererChange - ON_STATE_PREPARED + * @tc.desc : AudioRendererChange - ON_STATE_PREPARED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_ON_RENDERER_CHANGE_0100', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + + audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererState == 1 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : [RENDERER-CHANGE-ON-001] ResultFlag for ${i} is: ${resultFlag}`); + } + } + }); + await sleep(100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManagerCB.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-ON-001] ######### RendererChange Off is called #########`); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_ON_RENDERER_CHANGE_0200 + * @tc.name : AudioRendererChange - ON_STATE_RUNNING + * @tc.desc : AudioRendererChange - ON_STATE_RUNNING + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_ON_RENDERER_CHANGE_0200', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = false; + + let audioRen; + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererState == 2 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : [RENDERER-CHANGE-ON-002] ResultFlag for ${i} is: ${resultFlag}`); + } + } + }); + + await sleep(100); + + await audioRen.start().then(async function () { + console.info(`${Tag} : renderInstant started :SUCCESS `); + }).catch((err) => { + console.info(`${Tag} : renderInstant start :ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-ON-002] ######### RendererChange Off is called #########`); + + + await audioRen.stop().then(async function () { + console.info(`${Tag} : Renderer stopped : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer stop:ERROR : ${err.message}`); + }); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : 'Renderer release :ERROR : ${err.message}`); + }); + expect(resultFlag).assertTrue(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_ON_RENDERER_CHANGE_0300 + * @tc.name : AudioRendererChange - ON_STATE_STOPPED + * @tc.desc : AudioRendererChange - ON_STATE_STOPPED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_ON_RENDERER_CHANGE_0300', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = false; + + let audioRen; + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await audioRen.start().then(async function () { + console.info(`${Tag} : renderInstant started :SUCCESS `); + }).catch((err) => { + console.info(`${Tag} : renderInstant start :ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererState == 3 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : [RENDERER-CHANGE-ON-003] ResultFlag for ${i} is: ${resultFlag}`); + } + } + }); + + await sleep(100); + + await audioRen.stop().then(async function () { + console.info(`${Tag} : Renderer stopped : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer stop:ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-ON-003] ######### RendererChange Off is called #########`); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_ON_RENDERER_CHANGE_0400 + * @tc.name : AudioRendererChange - ON_STATE_RELEASED + * @tc.desc : AudioRendererChange - ON_STATE_RELEASED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_ON_RENDERER_CHANGE_0400', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = false; + + let audioRen; + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await audioRen.start().then(async function () { + console.info(`${Tag} : renderInstant started :SUCCESS }`); + }).catch((err) => { + console.info(`${Tag} : renderInstant start :ERROR : ${err.message}`); + }); + + await audioRen.stop().then(async function () { + console.info(`${Tag} : Renderer stopped : SUCCESS}`); + }).catch((err) => { + console.info(`${Tag} : Renderer stop:ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##}`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererState == 4 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : [RENDERER-CHANGE-ON-004] ResultFlag for ${i} is: ${resultFlag}`); + } + } + }); + + await sleep(100); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-ON-004] ######### RendererChange Off is called #########`); + + expect(resultFlag).assertTrue(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_ON_RENDERER_CHANGE_0500 + * @tc.name : AudioRendererChange - ON_STATE_PAUSED + * @tc.desc : AudioRendererChange - ON_STATE_PAUSED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_ON_RENDERER_CHANGE_0500', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = false; + + let audioRen; + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await audioRen.start().then(async function () { + console.info(`${Tag} : renderInstant started :SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : renderInstant start :ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##}`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererState == 5 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : [RENDERER-CHANGE-ON-005] ResultFlag for ${i} is: ${resultFlag}`); + } + } + }); + + await sleep(100); + + await audioRen.pause().then(async function () { + console.info(`${Tag} : renderInstant Pause :SUCCESS `); + }).catch((err) => { + console.info(`${Tag} : renderInstant Pause :ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-ON-005] ######### RendererChange Off is called #########`); + + await audioRen.stop().then(async function () { + console.info(`${Tag} : Renderer stopped : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer stop:ERROR : ${err.message}`); + }); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_ON_RENDERER_CHANGE_0600 + * @tc.name : AudioRendererChange - ON_CONTENT_TYPE_RINGTONE + * @tc.desc : AudioRendererChange - ON_CONTENT_TYPE_RINGTONE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_ON_RENDERER_CHANGE_0600', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + + audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererInfo.content == 5 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : [RENDERER-CHANGE-ON-006] ResultFlag for ${i} is: ${resultFlag}`); + } + } + }); + await sleep(100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await sleep(100); + audioStreamManagerCB.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-ON-006] ######### RendererChange Off is called #########`); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_ON_RENDERER_CHANGE_0700 + * @tc.name : AudioRendererChange - ON_CONTENT_TYPE_UNKNOWN + * @tc.desc : AudioRendererChange - ON_CONTENT_TYPE_UNKNOWN + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_ON_RENDERER_CHANGE_0700', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererInfo.content == 0 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : [RENDERER-CHANGE-ON-007] ResultFlag for ${i} is: ${resultFlag}`); + } + } + }); + await sleep(100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await sleep(100); + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-ON-007] ######### RendererChange Off is called #########`); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_ON_RENDERER_CHANGE_0800 + * @tc.name : AudioRendererChange - ON_CONTENT_TYPE_SPEECH + * @tc.desc : AudioRendererChange - ON_CONTENT_TYPE_SPEECH + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_ON_RENDERER_CHANGE_0800', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererInfo.content == 1 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : [RENDERER-CHANGE-ON-008] ResultFlag for ${i} is: ${resultFlag}`); + } + } + }); + await sleep(100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await sleep(100); + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-ON-008] ######### RendererChange Off is called #########`); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_ON_RENDERER_CHANGE_0900 + * @tc.name : AudioRendererChange - ON_CONTENT_TYPE_MUSIC + * @tc.desc : AudioRendererChange - ON_CONTENT_TYPE_MUSIC + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_ON_RENDERER_CHANGE_0900', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererInfo.content == 2 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : [RENDERER-CHANGE-ON-009] ResultFlag for ${i} is: ${resultFlag}`); + } + } + }); + await sleep(100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await sleep(100); + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-ON-009] ######### RendererChange Off is called #########`); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_ON_RENDERER_CHANGE_1000 + * @tc.name : AudioRendererChange - ON_CONTENT_TYPE_MOVIES + * @tc.desc : AudioRendererChange - ON_CONTENT_TYPE_MOVIES + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_ON_RENDERER_CHANGE_1000', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererInfo.content == 3 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : [RENDERER-CHANGE-ON-010] ResultFlag for ${i} is: ${resultFlag}`); + } + } + }); + await sleep(100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-ON-010] ######### RendererChange Off is called #########`); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_ON_RENDERER_CHANGE_1100 + * @tc.name : AudioRendererChange - ON_CONTENT_TYPE_SONIFICATION + * @tc.desc : AudioRendererChange - ON_CONTENT_TYPE_SONIFICATION + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_ON_RENDERER_CHANGE_1100', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererInfo.content == 4 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : [RENDERER-CHANGE-ON-011] ResultFlag for ${i} is: ${resultFlag}`); + } + } + }); + await sleep(100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-ON-011] ######### RendererChange Off is called #########`); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_ON_RENDERER_CHANGE_1200 + * @tc.name : AudioRendererChange - ON_STREAM_USAGE_UNKNOWN + * @tc.desc : AudioRendererChange - ON_STREAM_USAGE_UNKNOWN + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_ON_RENDERER_CHANGE_1200', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + + audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererInfo.usage == 0 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : [RENDERER-CHANGE-ON-012] ResultFlag for ${i} is: ${resultFlag}`); + } + } + }); + await sleep(100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManagerCB.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-ON-012] ######### RendererChange Off is called #########`); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_ON_RENDERER_CHANGE_1300 + * @tc.name : AudioRendererChange - ON_STREAM_USAGE_MEDIA + * @tc.desc : AudioRendererChange - ON_STREAM_USAGE_MEDIA + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_ON_RENDERER_CHANGE_1300', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererInfo.usage == 1 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : [RENDERER-CHANGE-ON-013] ResultFlag for ${i} is: ${resultFlag}`); + } + } + }); + await sleep(100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-ON-013] ######### RendererChange Off is called #########`); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_ON_RENDERER_CHANGE_1400 + * @tc.name : AudioRendererChange - ON_STREAM_USAGE_MEDIA + * @tc.desc : AudioRendererChange - ON_STREAM_USAGE_MEDIA + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_ON_RENDERER_CHANGE_1400', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererInfo.usage == 2 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : [RENDERER-CHANGE-ON-014] ResultFlag for ${i} is: ${resultFlag}`); + } + } + }); + await sleep(100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-ON-014] ######### RendererChange Off is called #########`); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_ON_RENDERER_CHANGE_1500 + * @tc.name : AudioRendererChange - ON_STREAM_USAGE_MEDIA + * @tc.desc : AudioRendererChange - ON_STREAM_USAGE_MEDIA + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_ON_RENDERER_CHANGE_1500', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererInfo.usage == 6 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : [RENDERER-CHANGE-ON-015] ResultFlag for ${i} is: ${resultFlag}`); + } + } + }); + await sleep(100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await sleep(100); + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-ON-015] ######### RendererChange Off is called #########`); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_ON_RENDERER_CHANGE_1600 + * @tc.name : AudioRendererChange - STREAMID + * @tc.desc : AudioRendererChange - STREAMID + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_ON_RENDERER_CHANGE_1600', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].streamId != undefined && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : [RENDERER-CHANGE-ON-016] StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + } + } + }); + await sleep(100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await sleep(100); + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-ON-015] ######### RendererChange Off is called #########`); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_ON_RENDERER_CHANGE_1700 + * @tc.name : AudioRendererChange - CLIENTUID & RENDERERFLAG + * @tc.desc : AudioRendererChange - CLIENTUID & RENDERERFLAG + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_ON_RENDERER_CHANGE_1700', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let clientUid = AudioRendererChangeInfoArray[i].clientUid; + let renFlags = AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags; + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (clientUid != undefined && renFlags == 0 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : [RENDERER-CHANGE-ON-017] ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : [RENDERER-CHANGE-ON-017] Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + } + } + }); + await sleep(100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await sleep(100); + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-ON-015] ######### RendererChange Off is called #########`); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_ON_RENDERER_CHANGE_1800 + * @tc.name : AudioRendererChange - DEVICE DESCRIPTOR + * @tc.desc : AudioRendererChange - DEVICE DESCRIPTOR + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_ON_RENDERER_CHANGE_1800', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + + audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + let Id = AudioRendererChangeInfoArray[i].deviceDescriptors[j].id; + let dType = AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType; + let dRole = AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole; + let sRate = AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]; + let cCount = AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]; + let cMask = AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks; + console.info(`${Tag} : Id: ${i} ${Id}`); + console.info(`${Tag} : Type: ${i} ${dType}`); + console.info(`${Tag} : Role: ${i} ${dRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${sRate}`); + console.info(`${Tag} : CC: ${i} ${cCount}`); + console.info(`${Tag} : CM: ${i} ${cMask}`); + if (Id > 0 && dType == 2 && dRole == 2 && sRate != null && cCount != null && cMask != null) { + resultFlag = true; + } + } + } + }); + await sleep(100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManagerCB.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-ON-018] ######### RendererChange Off is called #########`); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_OFF_RENDERER_CHANGE_0100 + * @tc.name : AudioRendererChange - OFF_STATE_PREPARED + * @tc.desc : AudioRendererChange - OFF_STATE_PREPARED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_OFF_RENDERER_CHANGE_0100', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_32000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + let audioRen; + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + resultFlag = false; + } + }); + await sleep(100); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-OFF-001] ######### RendererChange Off is called #########`); + console.info(`${Tag} : [RENDERER-CHANGE-OFF-001] ResultFlag is: ${resultFlag}`); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_OFF_RENDERER_CHANGE_0200 + * @tc.name : AudioRendererChange - OFF_STATE_RUNNING + * @tc.desc : AudioRendererChange - OFF_STATE_RUNNING + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_OFF_RENDERER_CHANGE_0200', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_96000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = true; + let audioRen; + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + resultFlag = false; + } + }); + await sleep(100); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-OFF-002] ######### RendererChange Off is called #########`); + console.info(`${Tag} : [RENDERER-CHANGE-OFF-002] ResultFlag is: ${resultFlag}`); + + await audioRen.start().then(async function () { + console.info(`${Tag} : renderInstant started :SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : renderInstant start :ERROR : ${err.message}`); + }); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_OFF_RENDERER_CHANGE_0300 + * @tc.name : AudioRenderer - OFF_STATE_STOPPED + * @tc.desc : AudioRenderer - OFF_STATE_STOPPED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_OFF_RENDERER_CHANGE_0300', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = true; + let audioRen; + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await audioRen.start().then(async function () { + console.info(`${Tag} : renderInstant started :SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : renderInstant start :ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + resultFlag = false; + } + }); + await sleep(100); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-OFF-003] ######### RendererChange Off is called #########`); + console.info(`${Tag} : [RENDERER-CHANGE-OFF-003] ResultFlag is: ${resultFlag}`); + + await audioRen.stop().then(async function () { + console.info(`${Tag} : Renderer stopped : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer stop:ERROR : ${err.message}`); + }); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_OFF_RENDERER_CHANGE_0400 + * @tc.name : AudioRendererChange - OFF_STATE_RELEASED + * @tc.desc : AudioRendererChange - OFF_STATE_RELEASED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_OFF_RENDERER_CHANGE_0400', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_8000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + let audioRen; + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await audioRen.start().then(async function () { + console.info(`${Tag} : renderInstant started :SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : renderInstant start :ERROR : ${err.message}`); + }); + + await audioRen.stop().then(async function () { + console.info(`${Tag} : Renderer stopped : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer stop:ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : [RENDERER-CHANGE-OFF-004] ######### RendererChange on is called for ${i} ##########`); + console.info(`${Tag} : [RENDERER-CHANGE-OFF-004] StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : [RENDERER-CHANGE-OFF-004] ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : [RENDERER-CHANGE-OFF-004] Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : [RENDERER-CHANGE-OFF-004] Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : [RENDERER-CHANGE-OFF-004] Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : [RENDERER-CHANGE-OFF-004] State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + resultFlag = false; + } + }); + await sleep(100); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-OFF-004] ######### RendererChange Off is called #########`); + console.info(`${Tag} : [RENDERER-CHANGE-OFF-004] ResultFlag is: ${resultFlag}`); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_OFF_RENDERER_CHANGE_0500 + * @tc.name : AudioRendererChange - OFF_STATE_PAUSED + * @tc.desc : AudioRendererChange - OFF_STATE_PAUSED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_OFF_RENDERER_CHANGE_0500', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_8000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + let audioRen; + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await audioRen.start().then(async function () { + console.info(`${Tag} : renderInstant started :SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : renderInstant start :ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + resultFlag = false; + } + }); + await sleep(100); + + audioStreamManagerCB.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-OFF-005] ######### RendererChange Off is called #########`); + console.info(`${Tag} : [RENDERER-CHANGE-OFF-005] ResultFlag is: ${resultFlag}`); + + await audioRen.pause().then(async function () { + console.info(`${Tag} : renderInstant Pause :SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : renderInstant Pause :ERROR : ${err.message}`); + }); + + await audioRen.stop().then(async function () { + console.info(`${Tag} : Renderer stopped : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer stop:ERROR : ${err.message}`); + }); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_OFF_RENDERER_CHANGE_0600 + * @tc.name : AudioRendererChange - DEVICE DESCRIPTOR + * @tc.desc : AudioRendererChange - DEVICE DESCRIPTOR + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_OFF_RENDERER_CHANGE_0600', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_32000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + let audioRen; + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + let Id = AudioRendererChangeInfoArray[i].deviceDescriptors[j].id; + let dType = AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType; + let dRole = AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole; + let sRate = AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]; + let cCount = AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]; + let cMask = AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks; + console.info(`${Tag} : Id: ${i} ${Id}`); + console.info(`${Tag} : Type: ${i} ${dType}`); + console.info(`${Tag} : Role: ${i} ${dRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${sRate}`); + console.info(`${Tag} : CC: ${i} ${cCount}`); + console.info(`${Tag} : CM: ${i} ${cMask}`); + if (Id > 0 && dType == 2 && dRole == 2 && sRate != null && cCount != null && cMask != null) { + resultFlag = false; + } + } + } + }); + await sleep(100); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [RENDERER-CHANGE-OFF-006] ######### RendererChange Off is called #########`); + console.info(`${Tag} : [RENDERER-CHANGE-OFF-006] ResultFlag is: ${resultFlag}`); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_GET_RENDERER_CHANGE_PROMISE_0100 + * @tc.name : AudioRendererChange - GET_STATE_PREPARED + * @tc.desc : AudioRendererChange - GET_STATE_PREPARED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_GET_RENDERER_CHANGE_PROMISE_0100', 2, async function (done) { + let audioCap; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = false; + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + } + }); + await sleep(100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioCap = data; + console.info(`${Tag} : AudioRenderer Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRenderer Created : ERROR : ${err.message}`); + }); + + await sleep(100); + + await audioStreamManager.getCurrentAudioRendererInfoArray().then(function (AudioRendererChangeInfoArray) { + console.info(`${Tag} : [GET_RENDERER_STATE_1_PROMISE] ######### Get Promise is called ##########`); + if (AudioRendererChangeInfoArray != null) { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Con ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererState == 1 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : State : ${AudioRendererChangeInfoArray[i].rendererState}`); + } + } + } + }).catch((err) => { + console.log(`${Tag} : getCurrentAudioRendererInfoArray :ERROR: ${err.message}`); + resultFlag = false; + }); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [GET_RENDERER_STATE_1_PROMISE] ######### RendererChange Off is called #########`); + + await audioCap.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_GET_RENDERER_CHANGE_PROMISE_0200 + * @tc.name : AudioRendererChange - GET_STATE_RUNNING + * @tc.desc : AudioRendererChange - GET_STATE_RUNNING + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_GET_RENDERER_CHANGE_PROMISE_0200', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = false; + + let audioCap; + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioCap = data; + console.info(`${Tag} : AudioRenderer Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRenderer Created : ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + } + }); + + await sleep(100); + await audioCap.start().then(async function () { + console.info(`${Tag} : Renderer started :SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer start :ERROR : ${err.message}`); + }); + + await sleep(100); + + await audioStreamManagerCB.getCurrentAudioRendererInfoArray().then(function (AudioRendererChangeInfoArray) { + console.info(`${Tag} : [GET_RENDERER_STATE_2_PROMISE] ######### Get Promise is called ##########`); + if (AudioRendererChangeInfoArray != null) { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Con ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererState == 2 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : State : ${AudioRendererChangeInfoArray[i].rendererState}`); + } + } + } + }).catch((err) => { + console.log(`${Tag} : getCurrentAudioRendererInfoArray :ERROR: ${err.message}`); + resultFlag = false; + }); + + audioStreamManagerCB.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [GET_RENDERER_STATE_2_PROMISE] ######### RendererChange Off is called #########`); + + await audioCap.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_GET_RENDERER_CHANGE_PROMISE_0300 + * @tc.name : AudioRendererChange - GET_STATE_STOPPED + * @tc.desc : AudioRendererChange - GET_STATE_STOPPED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_GET_RENDERER_CHANGE_PROMISE_0300', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = false; + + let audioCap; + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioCap = data; + console.info(`${Tag} : AudioRenderer Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRenderer Created : ERROR : ${err.message}`); + }); + + await audioCap.start().then(async function () { + console.info(`${Tag} : Renderer started :SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer start :ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + } + }); + + await sleep(100); + + await audioCap.stop().then(async function () { + console.info(`${Tag} : Renderer stopped : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer stop:ERROR : ${err.message}`); + }); + + await sleep(100); + + await audioStreamManager.getCurrentAudioRendererInfoArray().then(function (AudioRendererChangeInfoArray) { + console.info(`${Tag} : [GET_RENDERER_STATE_3_PROMISE] ######### Get Promise is called ##########`); + if (AudioRendererChangeInfoArray != null) { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Con ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererState == 3 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : State : ${AudioRendererChangeInfoArray[i].rendererState}`); + } + } + } + }).catch((err) => { + console.log(`${Tag} : getCurrentAudioRendererInfoArray :ERROR: ${err.message}`); + resultFlag = false; + }); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [GET_RENDERER_STATE_3_PROMISE] ######### RendererChange Off is called #########`); + + await audioCap.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_GET_RENDERER_CHANGE_PROMISE_0400 + * @tc.name : AudioRendererChange - GET_STATE_PAUSED + * @tc.desc : AudioRendererChange - GET_STATE_PAUSED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_GET_RENDERER_CHANGE_PROMISE_0400', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = false; + + let audioRen; + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await audioRen.start().then(async function () { + console.info(`${Tag} : renderInstant started :SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : renderInstant start :ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + } + }); + + await sleep(100); + + await audioRen.pause().then(async function () { + console.info(`${Tag} : renderInstant Pause :SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : renderInstant Pause :ERROR : ${err.message}`); + }); + + await sleep(100); + + await audioStreamManager.getCurrentAudioRendererInfoArray().then(function (AudioRendererChangeInfoArray) { + console.info(`${Tag} : [GET_RENDERER_STATE_5_PROMISE] ######### Get Promise is called ##########`); + if (AudioRendererChangeInfoArray != null) { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Con ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererState == 5 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : State : ${AudioRendererChangeInfoArray[i].rendererState}`); + } + } + } + }).catch((err) => { + console.log(`${Tag} : getCurrentAudioRendererInfoArray :ERROR: ${err.message}`); + resultFlag = false; + }); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [GET_RENDERER_STATE_5_PROMISE] ######### RendererChange Off is called #########`); + + await audioRen.stop().then(async function () { + console.info(`${Tag} : Renderer stopped : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer stop:ERROR : ${err.message}`); + }); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_GET_RENDERER_CHANGE_PROMISE_0500 + * @tc.name : AudioRendererChange - DEVICE DESCRIPTOR + * @tc.desc : AudioRendererChange - DEVICE DESCRIPTOR + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_GET_RENDERER_CHANGE_PROMISE_0500', 2, async function (done) { + let audioCap; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = false; + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + } + }); + await sleep(100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioCap = data; + console.info(`${Tag} : AudioRenderer Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRenderer Created : ERROR : ${err.message}`); + }); + + await sleep(100); + + await audioStreamManager.getCurrentAudioRendererInfoArray().then(function (AudioRendererChangeInfoArray) { + console.info(`${Tag} : '[GET_RENDERER_DD_PROMISE] ######### Get Promise is called ##########`); + if (AudioRendererChangeInfoArray != null) { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Con ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + let Id = AudioRendererChangeInfoArray[i].deviceDescriptors[j].id; + let dType = AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType; + let dRole = AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole; + let sRate = AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]; + let cCount = AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]; + let cMask = AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks; + console.info(`${Tag} : Id: ${i} ${Id}`); + console.info(`${Tag} : Type: ${i} ${dType}`); + console.info(`${Tag} : Role: ${i} ${dRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${sRate}`); + console.info(`${Tag} : CC: ${i} ${cCount}`); + console.info(`${Tag} : CM: ${i} ${cMask}`); + if (Id > 0 && dType == 2 && dRole == 2 && sRate != null && cCount != null && cMask != null) { + resultFlag = true; + } + } + } + } + }).catch((err) => { + console.log(`${Tag} : getCurrentAudioRendererInfoArray :ERROR: ${err.message}`); + resultFlag = false; + }); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : '[GET_RENDERER_DD_PROMISE] ######### RendererChange Off is called #########`); + + await audioCap.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_GET_RENDERER_CHANGE_CALLBACK_0100 + * @tc.name : AudioRendererChange - GET_STATE_PREPARED + * @tc.desc : AudioRendererChange - GET_STATE_PREPARED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_GET_RENDERER_CHANGE_CALLBACK_0100', 2, async function (done) { + let audioCap; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = false; + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + } + }); + await sleep(100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioCap = data; + console.info(`${Tag} : AudioRenderer Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRenderer Created : ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => { + console.info(`${Tag} : [GET_RENDERER_STATE_1_CALLBACK] **** Get Callback Called ****`); + await sleep(100); + if (err) { + console.log(`${Tag} : getCurrentAudioRendererInfoArray :ERROR: ${err.message}`); + resultFlag = false; + } + else { + if (AudioRendererChangeInfoArray != null) { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Con ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererState == 1 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : State : ${AudioRendererChangeInfoArray[i].rendererState}`); + } + } + } + } + }); + + await sleep(1000); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [GET_RENDERER_STATE_1_CALLBACK] ######### RendererChange Off is called #########`); + + await audioCap.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_GET_RENDERER_CHANGE_CALLBACK_0200 + * @tc.name : AudioRendererChange - GET_STATE_RUNNING + * @tc.desc : AudioRendererChange - GET_STATE_RUNNING + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_GET_RENDERER_CHANGE_CALLBACK_0200', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = false; + + let audioCap; + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioCap = data; + console.info(`${Tag} : AudioRenderer Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRenderer Created : ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + } + }); + + await sleep(100); + await audioCap.start().then(async function () { + console.info(`${Tag} : Renderer started :SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer start :ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManagerCB.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => { + console.info(`${Tag} : [GET_RENDERER_STATE_2_CALLBACK] **** Get Callback Called ****`); + await sleep(100); + if (err) { + console.log(`${Tag} : getCurrentAudioRendererInfoArray :ERROR: ${err.message}`); + resultFlag = false; + } + else { + if (AudioRendererChangeInfoArray != null) { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Con ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererState == 2 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : State : ${AudioRendererChangeInfoArray[i].rendererState}`); + } + } + } + } + }); + + await sleep(1000); + + audioStreamManagerCB.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [GET_RENDERER_STATE_2_CALLBACK] ######### RendererChange Off is called #########`); + + await audioCap.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_GET_RENDERER_CHANGE_CALLBACK_0300 + * @tc.name : AudioRendererChange - GET_STATE_STOPPED + * @tc.desc : AudioRendererChange - GET_STATE_STOPPED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_GET_RENDERER_CHANGE_CALLBACK_0300', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = false; + + let audioCap; + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioCap = data; + console.info(`${Tag} : AudioRenderer Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRenderer Created : ERROR : ${err.message}`); + }); + + await audioCap.start().then(async function () { + console.info(`${Tag} : Renderer started :SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer start :ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + } + }); + + await sleep(100); + + await audioCap.stop().then(async function () { + console.info(`${Tag} : Renderer stopped : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer stop:ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => { + console.info(`${Tag} : [GET_RENDERER_STATE_3_CALLBACK] **** Get Callback Called ****`); + await sleep(100); + if (err) { + console.log(`${Tag} : getCurrentAudioRendererInfoArray :ERROR: ${err.message}`); + resultFlag = false; + } + else { + if (AudioRendererChangeInfoArray != null) { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Con ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererState == 3 && devDescriptor != null) { + resultFlag = true; + console.info(`${Tag} : State : ${AudioRendererChangeInfoArray[i].rendererState}`); + } + } + } + } + }); + + await sleep(1000); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : [GET_RENDERER_STATE_3_CALLBACK] ######### RendererChange Off is called #########`); + + await audioCap.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_GET_RENDERER_CHANGE_CALLBACK_0400 + * @tc.name : AudioRendererChange - GET_STATE_PAUSED + * @tc.desc : AudioRendererChange - GET_STATE_PAUSED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_GET_RENDERER_CHANGE_CALLBACK_0400', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = false; + + let audioRen; + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${Tag} : AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRender Created : ERROR : ${err.message}`); + }); + + await audioRen.start().then(async function () { + console.info(`${Tag} : renderInstant started :SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : renderInstant start :ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + } + }); + + await sleep(100); + + await audioRen.pause().then(async function () { + console.info(`${Tag} : renderInstant Pause :SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : renderInstant Pause :ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => { + console.info(`${Tag} : [GET_RENDERER_STATE_5_CALLBACK] **** Get Callback Called ****`); + await sleep(100); + if (err) { + console.log(`${Tag} : getCurrentAudioRendererInfoArray :ERROR: ${err.message}`); + resultFlag = false; + } + else { + if (AudioRendererChangeInfoArray != null) { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Con ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + let devDescriptor = AudioRendererChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + if (AudioRendererChangeInfoArray[i].rendererState == 5 && devDescriptor != null) { + resultFlag = true; + console.info(`AFRenLog: RenSta : ${AudioRendererChangeInfoArray[i].rendererState}`); + } + } + } + } + }); + + await sleep(1000); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info('AFRendLog: [GET_REN_STA_5_CB] ## RenCh Off is called ##'); + + await audioRen.stop().then(async function () { + console.info(`${Tag} : Renderer stopped : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer stop:ERROR : ${err.message}`); + }); + + await audioRen.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_GET_RENDERER_CHANGE_CALLBACK_0500 + * @tc.name : AudioRendererChange - DEVICE DESCRIPTOR + * @tc.desc : AudioRendererChange - DEVICE DESCRIPTOR + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_GET_RENDERER_CHANGE_CALLBACK_0500', 2, async function (done) { + let audioCap; + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = false; + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : ## RendererChange on is called for ${i} ##`); + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Content for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream for ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : Flag ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`${Tag} : Id: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`${Tag} : Type: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`${Tag} : Role: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`${Tag} : Name: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : Addr: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`${Tag} : C: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`${Tag} : CM: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + } + }); + await sleep(100); + + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioCap = data; + console.info(`${Tag} : AudioRenderer Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : AudioRenderer Created : ERROR : ${err.message}`); + }); + + await sleep(100); + + audioStreamManager.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => { + console.info(`${Tag} : '[GET_RENDERER_DD_CALLBACK] **** Get Callback Called ****`); + await sleep(100); + if (err) { + console.log(`${Tag} : getCurrentAudioRendererInfoArray :ERROR: ${err.message}`); + resultFlag = false; + } + else { + if (AudioRendererChangeInfoArray != null) { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + console.info(`${Tag} : StreamId for ${i} is: ${AudioRendererChangeInfoArray[i].streamId}`); + console.info(`${Tag} : ClientUid for ${i} is: ${AudioRendererChangeInfoArray[i].clientUid}`); + console.info(`${Tag} : Con ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.content}`); + console.info(`${Tag} : Stream ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.usage}`); + console.info(`${Tag} : ${i} is: ${AudioRendererChangeInfoArray[i].rendererInfo.rendererFlags}`); + console.info(`${Tag} : State for ${i} is: ${AudioRendererChangeInfoArray[i].rendererState}`); + for (let j = 0; j < AudioRendererChangeInfoArray[i].deviceDescriptors.length; j++) { + let Id = AudioRendererChangeInfoArray[i].deviceDescriptors[j].id; + let dType = AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceType; + let dRole = AudioRendererChangeInfoArray[i].deviceDescriptors[j].deviceRole; + let sRate = AudioRendererChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]; + let cCount = AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]; + let cMask = AudioRendererChangeInfoArray[i].deviceDescriptors[j].channelMasks; + console.info(`${Tag} : Id: ${i} ${Id}`); + console.info(`${Tag} : Type: ${i} ${dType}`); + console.info(`${Tag} : Role: ${i} ${dRole}`); + console.info(`${Tag} : Nam: ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`${Tag} : ${i} ${AudioRendererChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`${Tag} : SR: ${i} ${sRate}`); + console.info(`${Tag} : CC: ${i} ${cCount}`); + console.info(`${Tag} : CM: ${i} ${cMask}`); + if (Id > 0 && dType == 2 && dRole == 2 && sRate != null && cCount != null && cMask != null) { + resultFlag = true; + } + } + } + } + } + }); + + await sleep(1000); + + audioStreamManager.off('audioRendererChange'); + await sleep(100); + console.info(`${Tag} : '[GET_RENDERER_DD_CALLBACK] ######### RendererChange Off is called #########`); + + await audioCap.release().then(async function () { + console.info(`${Tag} : Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${Tag} : Renderer release :ERROR : ${err.message}`); + }); + + expect(resultFlag).assertTrue(); + done(); + }) + + +}) \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/test/List.test.js b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..4f787f44feb8539e64f858046bf417c0227ff50e --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/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. + */ + +require('./AudioRendererChangeInfo.test.js') + + diff --git a/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/resources/base/element/string.json b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0bae6bd40f7360d5d818998221b199d3ec0f69c0 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/resources/base/media/icon.png b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/audio/audio_js_standard/AudioRendererChangeInfo/src/main/resources/base/media/icon.png differ diff --git a/multimedia/audio/audio_js_standard/AudioTestBase.js b/multimedia/audio/audio_js_standard/AudioTestBase.js new file mode 100644 index 0000000000000000000000000000000000000000..83200678b17c85e0bb244420497a0f9a4e78a749 --- /dev/null +++ b/multimedia/audio/audio_js_standard/AudioTestBase.js @@ -0,0 +1,40 @@ +/* + * 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 abilityAccessCtrl from '@ohos.abilityAccessCtrl'; +import bundle from '@ohos.bundle'; +import account from '@ohos.account.osAccount'; + + +// apply permission for test hap +export async function applyPermission(applictionName, permissionNames) { + let userId = await account.getAccountManager().getOsAccountLocalIdFromProcess(); + console.info('userid is :' + userId) + let appInfo = await bundle.getApplicationInfo(applictionName, 0, userId); + let atManager = abilityAccessCtrl.createAtManager(); + if (atManager != null) { + let tokenID = appInfo.accessTokenId; + console.info('[permission] case accessTokenID is ' + tokenID); + for (let i = 0; i < permissionNames.length; i++) { + await atManager.grantUserGrantedPermission(tokenID, permissionNames[i], 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + } + } else { + console.info('[permission] case apply permission failed, createAtManager failed'); + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/Test.json b/multimedia/audio/audio_js_standard/audioManager/Test.json index f2a05ca8207349be8d49614b61d2f61c7bf59518..5c21d26eee605d67561a1c015b1a07fee19aad97 100755 --- a/multimedia/audio/audio_js_standard/audioManager/Test.json +++ b/multimedia/audio/audio_js_standard/audioManager/Test.json @@ -2,7 +2,7 @@ "description": "Configuration for audio manager Tests", "driver": { "type": "JSUnitTest", - "test-timeout": "5500000", + "test-timeout": "1500000", "package": "ohos.acts.multimedia.audio.audiomanager", "shell-timeout": "60000" }, @@ -13,38 +13,6 @@ ], "type": "AppInstallKit", "cleanup-apps": true - }, - { - "type": "ShellKit", - "run-command": [ - "mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media" - ], - "cleanup-apps": true - }, - { - "type": "PushKit", - "pre-push": [], - "push": [ - "./resource/audio/audioManager/Believer.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", - "./resource/audio/audioManager/Believer60s.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", - "./resource/audio/audioManager/StarWars10s-1C-8000-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", - "./resource/audio/audioManager/StarWars10s-1C-16000-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", - "./resource/audio/audioManager/StarWars10s-1C-32000-1SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", - "./resource/audio/audioManager/StarWars10s-1C-44100-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", - "./resource/audio/audioManager/StarWars10s-1C-64000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", - "./resource/audio/audioManager/StarWars10s-1C-96000-4SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", - "./resource/audio/audioManager/StarWars10s-2C-11025-1SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", - "./resource/audio/audioManager/StarWars10s-2C-12000-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", - "./resource/audio/audioManager/StarWars10s-2C-16000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", - "./resource/audio/audioManager/StarWars10s-2C-22050-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", - "./resource/audio/audioManager/StarWars10s-2C-24000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", - "./resource/audio/audioManager/StarWars10s-2C-48000-4SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/", - "./resource/audio/audioManager/Believer.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media", - "./resource/audio/audioManager/file_example_WAV_1MG.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media", - "./resource/audio/audioManager/safe_and_sound_32.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media", - "./resource/audio/audioManager/test.mp3 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media", - "./resource/audio/audioManager/test.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media" - ] } ] } \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/config.json b/multimedia/audio/audio_js_standard/audioManager/src/main/config.json index 9bed2c59168670f7c510219a77d6a6ee70ca30cc..b12f9271f0937c6c6c20f42a6695df9c43ed366d 100755 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/config.json +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/config.json @@ -44,6 +44,7 @@ } ], "deviceType": [ + "default", "phone", "tablet", "tv", @@ -71,34 +72,11 @@ } ], "reqPermissions": [ - { - "name": "ohos.permission.GET_BUNDLE_INFO", - "reason": "use ohos.permission.GET_BUNDLE_INFO" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason": "use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, + { "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" - }, { "name": "ohos.permission.MICROPHONE", "reason": "use ohos.permission.MICROPHONE" diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCall.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCall.test.js deleted file mode 100644 index a7c09b429126316418caf3cd14136e4d0055d8d2..0000000000000000000000000000000000000000 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCall.test.js +++ /dev/null @@ -1,489 +0,0 @@ -// @ts-nocheck -/* - * 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 audio from '@ohos.multimedia.audio'; -import fileio from '@ohos.fileio'; -import featureAbility from '@ohos.ability.featureAbility' -import resourceManager from '@ohos.resourceManager'; - -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; - -describe('audioCall', function () { - var mediaDir; - let fdRead; - let readpath; - var resultFlagRec; - var resultFlagRen; - let fdPath; - let filePath; - const audioManager = audio.getAudioManager(); - console.info('AudioFrameworkRenderLog: Create AudioManger Object JS Framework'); - - beforeAll(async function () { - console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level'); - //mediaDir = '/data/storage/el2/base/haps/entry/cache'; - }) - - beforeEach(async function () { - console.info('AudioFrameworkTest: beforeEach: Prerequisites at the test case level'); - await sleep(500); - }) - - afterEach(async function () { - console.info('AudioFrameworkTest: afterEach: Test case-level clearance conditions'); - await sleep(1000); - }) - - afterAll(async function () { - console.info('AudioFrameworkTest: afterAll: Test suite-level cleanup condition'); - - }) - - function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function getAbilityInfo(fileName) { - let context = await featureAbility.getContext(); - console.info("case0 context is " + context); - await context.getFilesDir().then((data) => { - console.info("case1 getFilesDir is path " + data); - mediaDir = data + '/' + fileName; - console.info('case2 mediaDir is ' + mediaDir); - }) - } - async function closeFileDescriptor(fileName) { - await resourceManager.getResourceManager().then(async (mgr) => { - await mgr.closeRawFileDescriptor(fileName).then(value => { - console.log('AudioFrameworkRenderLog:case closeRawFileDescriptor success for file:' + fileName); - }).catch(error => { - console.log('AudioFrameworkRenderLog:case closeRawFileDescriptor err: ' + error); - }); - }); - } - async function getFdRead(pathName) { - let context = await featureAbility.getContext(); - console.info("case0 context is " + context); - await context.getFilesDir().then((data) => { - console.info("case1 getFilesDir is path " + data); - filePath = data + '/' + pathName; - console.info('case4 filePath is ' + filePath); - - }) - fdPath = 'fd://'; - await fileio.open(filePath).then((fdNumber) => { - fdPath = fdPath + '' + fdNumber; - fdRead = fdNumber; - console.info('[fileIO]case open fd success,fdPath is ' + fdPath); - console.info('[fileIO]case open fd success,fdRead is ' + fdRead); - - }, (err) => { - console.info('[fileIO]case open fd failed'); - }).catch((err) => { - console.info('[fileIO]case catch open fd failed'); - }); - } - - async function playbackPromise(AudioRendererOptions, pathName, AudioScene) { - resultFlagRen = 'new'; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - resultFlagRen = false; - return resultFlagRen; - }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); - resultFlagRen = false; - }); - if (resultFlagRen == false) { - console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen); - return resultFlagRen; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlagRen = false; - }); - if (resultFlagRen == false) { - console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen); - return resultFlagRen; - } - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlagRen = false; - }); - if (resultFlagRen == false) { - console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen); - return resultFlagRen; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - var bufferSize; - await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); - bufferSize = data; - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); - resultFlagRen = false; - }); - if (resultFlagRen == false) { - console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen); - return resultFlagRen; - } - - let ss = fileio.fdopenStreamSync(fdRead, 'r'); - console.info('AudioFrameworkRenderLog:case2: File Path: ' + ss); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.fstatSync(fdRead).size; - console.info('AudioFrameworkRenderLog:case3: File totalSize size: ' + totalSize); - totalSize = totalSize - 44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); - let rlen = 0; - while (rlen < totalSize / 4) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); - await audioRen.write(buf); - if (rlen > (totalSize / 2)) { - await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : Value : ' + data); - }).catch((err) => { - console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); - resultFlagRen = false; - }); - } - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); - resultFlagRen = false; - }); - if (resultFlagRen == false) { - console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen); - return resultFlagRen; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - resultFlagRen = true; - console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - resultFlagRen = false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - resultFlagRen = false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen); - - return resultFlagRen; - } - - async function recPromise(AudioCapturerOptions, fpath, AudioScene) { - - resultFlagRec = 'new'; - console.info('AudioFrameworkRecLog: Promise : Audio Recording Function'); - - var audioCap; - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCap = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - return resultFlagRec; - }); - - console.info('AudioFrameworkRecLog: AudioCapturer : Path : ' + fpath); - - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); - - - await audioCap.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); - console.info('AudioFrameworkRecLog: Capturer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRecLog: Capturer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); - resultFlagRec = false; - }); - if (resultFlagRec == false) { - console.info('AudioFrameworkRecLog: resultFlagRec : ' + resultFlagRec); - return resultFlagRec; - } - - await audioCap.getCapturerInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); - console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); - console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); - }).catch((err) => { - console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); - resultFlagRec = false; - }); - if (resultFlagRec == false) { - console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlagRec); - return resultFlagRec; - } - - await audioCap.start().then(async function () { - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - resultFlagRec = false; - }); - if (resultFlagRec == false) { - console.info('AudioFrameworkRecLog: resultFlagRec : ' + resultFlagRec); - return resultFlagRec; - } - - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); - - var bufferSize = await audioCap.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - - var fd = fileio.openSync(fpath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } - else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - resultFlagRec = false; - return resultFlagRec; - } - - fd = fileio.openSync(fpath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } - else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - resultFlagRec = false; - return resultFlagRec; - } - - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - var buffer = await audioCap.read(bufferSize, true); - var number = fileio.writeSync(fd, buffer); - console.info('BufferRecLog: data written: ' + number); - numBuffersToCapture--; - } - - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); - - await audioCap.stop().then(async function () { - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - resultFlagRec = true; - console.info('AudioFrameworkRecLog: resultFlagRec : ' + resultFlagRec); - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); - resultFlagRec = false; - }); - - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); - - await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - resultFlagRec = false; - }); - - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); - - return resultFlagRec; - - } - - - /* * - * @tc.number : SUB_AUDIO_VOIP_Play_001 - * @tc.name : - * @tc.desc : - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_Play_001', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - await getFdRead("StarWars10s-1C-44100-2SW.wav"); - var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(filePath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_001 - * @tc.name : - * @tc.desc : - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_Rec_001', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - await getAbilityInfo("capture_js-44100-2C-16B.pcm"); - var resultFlag = await recPromise(AudioCapturerOptions, mediaDir, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - done(); - }) - - - /* * - * @tc.number : SUB_AUDIO_VOIP_RecPlay_001 - * @tc.name : - * @tc.desc : - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_CALL_RecPlay_001', 0, async function (done) { - - var AudioStreamInfoCap = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfoCap, - capturerInfo: AudioCapturerInfo - } - - var AudioStreamInfoRen = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfoRen, - rendererInfo: AudioRendererInfo - } - await getAbilityInfo("capture_js-44100-2C-16B-2.pcm"); - await recPromise(AudioCapturerOptions, mediaDir, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(500); - readpath = 'StarWars10s-1C-44100-2SW.wav'; - await getFdRead(readpath, done); - await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(1000); - console.info('AudioFrameworkRecLog: resultFlag : Capturer : ' + resultFlagRec); - console.info('AudioFrameworkRenderLog: resultFlag : Renderer : ' + resultFlagRen); - - if (resultFlagRec == true) { - expect(resultFlagRen).assertTrue(); - } - else { - expect(false).assertTrue(); - } - await closeFileDescriptor(readpath); - done(); - }) - -}) \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturer.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturer.test.js deleted file mode 100644 index f2c753ad08a19fbe91bf2fc3be958ffc69ef26da..0000000000000000000000000000000000000000 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturer.test.js +++ /dev/null @@ -1,6262 +0,0 @@ -/* - * 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 audio from '@ohos.multimedia.audio'; -import fileio from '@ohos.fileio'; -import featureAbility from '@ohos.ability.featureAbility' - -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; - -describe('audioCapturer', function () { - var audioCapCallBack; - var audioCapPromise; - var dirPath; - async function getFd(fileName) { - let context = await featureAbility.getContext(); - await context.getFilesDir().then((data) => { - dirPath = data + '/' + fileName; - console.info('case2 dirPath is ' + dirPath); - }) - } - async function closeFileDescriptor() { - await resourceManager.getResourceManager().then(async (mgr) => { - await mgr.closeRawFileDescriptor(dirPath).then(value => { - console.log('AudioFrameworkRenderLog:case closeRawFileDescriptor success for file:' + dirPath); - }).catch(error => { - console.log('AudioFrameworkRenderLog:case closeRawFileDescriptor err: ' + error); - }); - }); - } - const audioManagerRec = audio.getAudioManager(); - console.info('AudioFrameworkRecLog: Create AudioManger Object JS Framework'); - beforeAll(async function () { - console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level'); - await sleep(100); - console.info('AudioFrameworkTest: beforeAll: END'); - }) - - beforeEach(async function () { - console.info('AudioFrameworkTest: beforeEach: Prerequisites at the test case level'); - await sleep(1000); - }) - - afterEach(function () { - console.info('AudioFrameworkTest: afterEach: Test case-level clearance conditions'); - closeFileDescriptor(); - }) - - afterAll(async function () { - await sleep(1000); - console.info('AudioFrameworkTest: afterAll: Test suite-level cleanup condition'); - }) - - function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); - } - - - async function recPromise(AudioCapturerOptions, dirPath, AudioScene) { - - var resultFlag = 'new'; - console.info('AudioFrameworkRecLog: Promise : Audio Recording Function'); - - var audioCap; - let isPass = false; - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCap = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - return resultFlag; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - return resultFlag; - } - - console.info('AudioFrameworkRecLog: AudioCapturer : Path : ' + dirPath); - - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); - - await audioCap.getStreamInfo().then(async function (audioParamsGet) { - if (audioParamsGet != undefined) { - console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); - console.info('AudioFrameworkRecLog: Capturer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRecLog: Capturer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); - } else { - console.info('AudioFrameworkRecLog: audioParamsGet is : ' + audioParamsGet); - console.info('AudioFrameworkRecLog: audioParams getStreamInfo are incorrect: '); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); - resultFlag = false; - }); - if (resultFlag == false) { - console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - await audioCap.getCapturerInfo().then(async function (audioParamsGet) { - if (audioParamsGet != undefined) { - console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); - console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); - console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); - } else { - console.info('AudioFrameworkRecLog: audioParamsGet is : ' + audioParamsGet); - console.info('AudioFrameworkRecLog: audioParams getCapturerInfo are incorrect: '); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); - resultFlag = false; - }); - if (resultFlag == false) { - console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - await audioCap.start().then(async function () { - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - resultFlag = false; - }); - if (resultFlag == false) { - console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); - - var bufferSize = await audioCap.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - - var fd = fileio.openSync(dirPath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } - else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - resultFlag = false; - return resultFlag; - } - - fd = fileio.openSync(dirPath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } - else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - resultFlag = false; - return resultFlag; - } - await sleep(100); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------READ BUFFER---------'); - var buffer = await audioCap.read(bufferSize, true); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); - await sleep(50); - numBuffersToCapture--; - } - await sleep(1000); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); - - await audioCap.stop().then(async function () { - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - resultFlag = true; - console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); - resultFlag = false; - }); - - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); - - await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - resultFlag = false; - }); - - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); - - return resultFlag; - - } - - - async function recCallBack(AudioCapturerOptions, dirPath, AudioScene) { - - var resultFlag = true; - console.info('AudioFrameworkRecLog: CallBack : Audio Recording Function'); - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioManagerRec.getAudioScene(async (err, getValue) => { - console.info('AudioFrameworkRecLog: ---------GET AUDIO SCENE---------'); - if (err) { - console.info('AudioFrameworkRecLog: getAudioScene : ERROR : ' + err.message); - resultFlag = false; - } else { - console.info('AudioFrameworkRecLog: getAudioScene : Value : ' + getValue); - } - }); - await sleep(1000); - - audioCapCallBack.getStreamInfo(async (err, audioParamsGet) => { - console.info('AudioFrameworkRecLog: ---------GET STREAM INFO---------'); - console.log('AudioFrameworkRecLog: Entered getStreamInfo'); - if (err) { - console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); - resultFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); - console.info('AudioFrameworkRecLog: Capturer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRecLog: Capturer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); - } - }); - await sleep(1000); - audioCapCallBack.getCapturerInfo(async (err, audioParamsGet) => { - console.info('AudioFrameworkRecLog: ---------GET CAPTURER INFO---------'); - if (err) { - console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); - resultFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); - console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); - console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - resultFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - await sleep(1000); - } - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(dirPath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR '); - resultFlag = false; - return resultFlag; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(dirPath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - resultFlag = false; - return resultFlag; - } - - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------READ BUFFER---------'); - var buffer = await audioCapCallBack.read(bufferSize, true); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); - await sleep(50); - numBuffersToCapture--; - } - //await sleep(3000); - audioCapCallBack.stop(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); - resultFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - resultFlag = true; - console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); - } - }); - await sleep(1000); - - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - resultFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - resultFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - //return resultFlag; - } - }); - //await sleep(3000); - console.info('AudioFrameworkRenderLog: After all check resultFlag : ' + resultFlag); - return resultFlag; - } - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_PREPARED_STATE_001 - * @tc.name : AudioCapturer-Check-STATE-PREPARED - * @tc.desc : AudioCapturer with state prepared - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_PREPARED_STATE_001', 0, async function (done) { - var stateFlag; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: INVALID:' + audio.AudioState.STATE_INVALID); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: NEW:' + audio.AudioState.STATE_NEW); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: PREPARED:' + audio.AudioState.STATE_PREPARED); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: START:' + audio.AudioState.STATE_START); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: STOP:' + audio.AudioState.STATE_STOPPED); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: RELEASE:' + audio.AudioState.STATE_RELEASED); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: RUNNING:' + audio.AudioState.STATE_RUNNING); - if ((audioCapCallBack.state == audio.AudioState.STATE_PREPARED)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); - stateFlag = true; - expect(stateFlag).assertTrue(); - done(); - } - } - }); - - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_PREPARED_STATE_ENUM_002 - * @tc.name : AudioCapturer-Check-STATE-PREPARED-ENUM - * @tc.desc : AudioCapturer with state prepared - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_PREPARED_STATE_ENUM_002', 0, async function (done) { - var stateFlag; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - - if ((audioCapCallBack.state == 1)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); - stateFlag = true; - expect(stateFlag).assertTrue(); - done(); - } - - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_RUNNING_STATE_003 - * @tc.name : AudioCapturer-Check-STATE-RUNNING - * @tc.desc : AudioCapturer with state running - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_RUNNING_STATE_003', 0, async function (done) { - var stateFlag; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RUNNING STATE---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - await sleep(1000); - if ((audioCapCallBack.state == audio.AudioState.STATE_RUNNING)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RUNNING STATE : PASS---------'); - stateFlag = true; - } - } - }); - await sleep(1000); - await audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - stateFlag = true; - console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - //return resultFlag; - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_RUNNING_STATE_EUNM_004 - * @tc.name : AudioCapturer-Check-STATE-RUNNING-ENUM - * @tc.desc : AudioCapturer with state running - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_RUNNING_STATE_EUNM_004', 0, async function (done) { - var stateFlag; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - await audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RUNNING STATE---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - await sleep(1000); - if ((audioCapCallBack.state == 2)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RUNNING STATE : PASS---------'); - stateFlag == true; - } - } - }); - await sleep(1000); - await audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - stateFlag = true; - console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - //return resultFlag; - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_STOPPED_STATE_005 - * @tc.name : AudioCapturer-Check-STATE-STOPPED - * @tc.desc : AudioCapturer with state stopped - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_STOPPED_STATE_005', 0, async function (done) { - var stateFlag; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - await sleep(1000); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - audioCapCallBack.stop(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO STOPPED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == audio.AudioState.STATE_STOPPED)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO STOPPED STATE---------'); - stateFlag = true; - } - console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); - } - }); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - stateFlag = true; - console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - //return resultFlag; - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_STOPPED_STATE_ENUM_006 - * @tc.name : AudioCapturer-Check-STATE-STOPPED-ENUM - * @tc.desc : AudioCapturer with state stopped - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_STOPPED_STATE_ENUM_006', 0, async function (done) { - var stateFlag; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - stateFlag == true; - } - }); - await sleep(1000); - audioCapCallBack.stop(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO STOPPED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 3)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO STOPPED STATE---------'); - stateFlag = true; - } - console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); - } - }); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - stateFlag = true; - console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - //return resultFlag; - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_RELEASED_STATE_007 - * @tc.name : AudioCapturer-Check-STATE-RELEASED - * @tc.desc : AudioCapturer with state released - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_RELEASED_STATE_007', 0, async function (done) { - var stateFlag; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - await sleep(1000); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - audioCapCallBack.stop(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 3)) { - stateFlag = true; - } - console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); - } - }); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == audio.AudioState.STATE_RELEASED)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_RELEASED_STATE_ENUM_008 - * @tc.name : AudioCapturer-Check-STATE-RELEASED - * @tc.desc : AudioCapturer with state released - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_RELEASED_STATE_ENUM_008', 0, async function (done) { - var stateFlag; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - await sleep(1000); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - audioCapCallBack.stop(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 3)) { - stateFlag = true; - } - console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); - } - }); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_GET_BUFFER_SIZE_009 - * @tc.name : AudioCapturer-get_buffer_size - * @tc.desc : AudioCapturer with state stopped - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_GET_BUFFER_SIZE_009', 0, async function (done) { - var stateFlag; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - await sleep(1000); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(async (err, cbbufferSize) => { - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK BUFFER SIZE---------'); - console.info('AudioFrameworkRecLog: buffer size: ' + cbbufferSize); - stateFlag = true - console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); - console.info('AudioFrameworkRecLog: ---------AFTER CHECK BUFFER SIZE : PASS---------') - } - }); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - stateFlag = true; - console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - //return resultFlag; - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_010 - * @tc.name : AudioCapturer-Check-READ_BUFFER - * @tc.desc : AudioCapturer with read buffer - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_010', 0, async function (done) { - var stateFlag; - await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(dirPath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag = false; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(dirPath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag = false; - } - await sleep(1000); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - await new Promise((resolve,reject)=>{ - audioCapCallBack.read(bufferSize, true, async (err, buffer) => { - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - reject(err); - } else { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); - await sleep(100); - stateFlag = true; - resolve(); - } - }); - }) - - numBuffersToCapture--; - } - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_PROMOISE_PREPARED_STATE_011 - * @tc.name : AudioCapturer-Check-STATE-PREPARED - * @tc.desc : AudioCapturer with state prepared - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_PROMOISE_PREPARED_STATE_011', 0, async function (done) { - var stateFlag; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCapPromise = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - return stateFlag; - }); - - if ((audioCapPromise.state == audio.AudioState.STATE_PREPARED)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); - stateFlag = true; - expect(stateFlag).assertTrue(); - done(); - } - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_PROMOISE_PREPARED_STATE_ENUM_012 - * @tc.name : AudioCapturer-Check-STATE-PREPARED-ENUM - * @tc.desc : AudioCapturer with state prepared - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_PROMOISE_PREPARED_STATE_ENUM_012', 0, async function (done) { - var stateFlag; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCapPromise = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - return stateFlag; - }); - - if ((audioCapPromise.state == 1)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO PREPARED STATE : PASS---------'); - stateFlag = true; - expect(stateFlag).assertTrue(); - done(); - } - - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_PROMISE_RUNNING_STATE_013 - * @tc.name : AudioCapturer-Check-STATE-RUNNING - * @tc.desc : AudioCapturer with state running - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_PROMISE_RUNNING_STATE_013', 0, async function (done) { - var stateFlag; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCapPromise = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - return stateFlag; - }); - - await audioCapPromise.start().then(async function () { - console.info('AudioFrameworkRecLog: ---------START---------'); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapPromise.state == audio.AudioState.STATE_RUNNING)) { - stateFlag = true; - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - - await audioCapPromise.release().then(async function () { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); - stateFlag = true; - console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - //return resultFlag; - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_PROMISE_RUNNING_STATE_ENUM_014 - * @tc.name : AudioCapturer-Check-STATE-RUNNING-ENUM - * @tc.desc : AudioCapturer with state running - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_PROMISE_RUNNING_STATE_ENUM_014', 0, async function (done) { - var stateFlag; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCapPromise = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - return stateFlag; - }); - - await audioCapPromise.start().then(async function () { - console.info('AudioFrameworkRecLog: ---------START---------'); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapPromise.state == 2)) { - stateFlag = true; - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - - await audioCapPromise.release().then(async function () { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); - stateFlag = true; - console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - //return resultFlag; - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_PROMISE_STOPPED_STATE_015 - * @tc.name : AudioCapturer-Check-STATE-STOPPED - * @tc.desc : AudioCapturer with state stopped - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_PROMISE_STOPPED_STATE_015', 0, async function (done) { - var stateFlag; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCapPromise = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - return stateFlag; - }); - - await audioCapPromise.start().then(async function () { - console.info('AudioFrameworkRecLog: ---------START---------'); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapPromise.state == audio.AudioState.STATE_STOPPED)) { - stateFlag = true; - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - - await audioCapPromise.stop().then(async function () { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - if ((audioCapPromise.state == audioCapPromise.AudioState.STATE_STOPPED)) { - stateFlag = true; - console.info('AudioFrameworkRecLog: resultFlag : ' + stateFlag); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - await audioCapPromise.release().then(async function () { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); - stateFlag = true; - console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); - stateFlag = false - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_PROMISE_STOPPED_STATE_ENUM_016 - * @tc.name : AudioCapturer-Check-STATE-STOPPED - * @tc.desc : AudioCapturer with state stopped - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_PROMISE_STOPPED_STATE_ENUM_016', 0, async function (done) { - var stateFlag; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCapPromise = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - return stateFlag; - }); - - await audioCapPromise.start().then(async function () { - console.info('AudioFrameworkRecLog: ---------START---------'); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapPromise.state == audio.AudioState.STATE_STOPPED)) { - stateFlag = true; - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - - await audioCapPromise.stop().then(async function () { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - if ((audioCapPromise.state == 3)) { - stateFlag = true; - console.info('AudioFrameworkRecLog: resultFlag : ' + stateFlag); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - await audioCapPromise.release().then(async function () { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); - stateFlag = true; - console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - //return resultFlag; - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_PROMISE_RELEASED_STATE_017 - * @tc.name : AudioCapturer-Check-STATE-RELEASED - * @tc.desc : AudioCapturer with state released - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_PROMISE_RELEASED_STATE_017', 0, async function (done) { - var stateFlag; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCapPromise = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - }); - - await audioCapPromise.start().then(async function () { - console.info('AudioFrameworkRecLog: ---------START---------'); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - stateFlag = true; - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - - await audioCapPromise.stop().then(async function () { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - stateFlag = true; - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - await audioCapPromise.release().then(async function () { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); - if ((audioCapPromise.state == audio.AudioState.STATE_RELEASED)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - await sleep(1000); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); - stateFlag = false; - }); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_PROMISE_RELEASED_STATE_ENUM_018 - * @tc.name : AudioCapturer-Check-STATE-RELEASED-ENUM - * @tc.desc : AudioCapturer with state released - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_PROMISE_RELEASED_STATE_ENUM_018', 0, async function (done) { - var stateFlag; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCapPromise = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - return stateFlag; - }); - - await audioCapPromise.start().then(async function () { - console.info('AudioFrameworkRecLog: ---------START---------'); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - stateFlag = true; - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - - await audioCapPromise.stop().then(async function () { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - stateFlag = true; - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - await audioCapPromise.release().then(async function () { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); - if ((audioCapPromise.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_PROMISE_GET_BUFFER_SIZE_019 - * @tc.name : AudioCapturer-get_buffer_size - * @tc.desc : AudioCapturer with state stopped - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_PROMISE_GET_BUFFER_SIZE_019', 0, async function (done) { - var stateFlag; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCapPromise = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - return stateFlag; - }); - await sleep(1000); - await audioCapPromise.start().then(async function () { - console.info('AudioFrameworkRecLog: ---------START---------'); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapPromise.state == 2)) { - stateFlag = true; - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapPromise.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - stateFlag = true; - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - - await audioCapPromise.release().then(async function () { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); - if ((audioCapPromise.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_PROMISE_READ_BUFFER_020 - * @tc.name : AudioCapturer-Check-READ_BUFFER - * @tc.desc : AudioCapturer with read buffer - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_PROMISE_READ_BUFFER_020', 0, async function (done) { - var stateFlag; - await getFd("capture_CB_js-44100-2C-S16LE-checkpromisereadbuffer.pcm"); - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCapPromise = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - return stateFlag; - }); - await sleep(1000); - await audioCapPromise.start().then(async function () { - console.info('AudioFrameworkRecLog: ---------START---------'); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapPromise.state == 2)) { - stateFlag = true; - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapPromise.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - stateFlag = true; - - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(dirPath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag = false; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(dirPath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag = false; - } - //await sleep(1000); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------BEFORE PROMISE READ ---------'); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - var buffer = await audioCapPromise.read(bufferSize, true); - console.info('AudioFrameworkRecLog: ---------AFTER PROMISE READ ---------'); - //await sleep(50); - var number = fileio.writeSync(fd, buffer); - console.info('BufferRecLog: data written: ' + number); - console.info('AudioFrameworkRecLog: ---------AFTER PROMISE WRITE ---------'); - //await sleep(100); - numBuffersToCapture--; - } - //await sleep(3000); - - await audioCapPromise.release().then(async function () { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); - if ((audioCapPromise.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_CB_021 - * @tc.name : AudioCapturer-Set1-Media - * @tc.desc : AudioCapturer with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_CB_021', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - await getFd("capture_CB_js-44100-2C-16B.pcm"); - var resultFlag = await recCallBack(AudioCapturerOptions, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(1000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_CB_ENUM_022 - * @tc.name : AudioCapturer-Set1-Media - * @tc.desc : AudioCapturer with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_CB_ENUM_022', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: 44100, - channels: 1, - sampleFormat: 1, - encodingType: 0 - } - - var AudioCapturerInfo = { - source: 1, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - await getFd("capture_CB_js-44100-2C-16B.pcm"); - var resultFlag = await recCallBack(AudioCapturerOptions, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(1000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_023 - * @tc.name : AudioCapturer-Set1-Media - * @tc.desc : AudioCapturer with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - * */ - - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_023', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - await getFd("capture_js-44100-2C-16B.pcm"); - var resultFlag = await recPromise(AudioCapturerOptions, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_024 - * @tc.name : AudioCapturer-Set1-Media - * @tc.desc : AudioCapturer with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - * */ - - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_024', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: 44100, - channels: 1, - sampleFormat: 1, - encodingType: 0 - } - - var AudioCapturerInfo = { - source: 1, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - await getFd("capture_js-44100-2C-16B.pcm"); - var resultFlag = await recPromise(AudioCapturerOptions, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_025 - * @tc.name : AudioRec-Set1 - * @tc.desc : record audio with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_025', 0, async function (done) { - var audioStreamInfo44100 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo44100 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var audioCapturerOptions44100 = { - streamInfo: audioStreamInfo44100, - capturerInfo: audioCapturerInfo44100, - } - - await getFd("capture_js-44100-1C-16LE.pcm"); - var resultFlag = await recPromise(audioCapturerOptions44100, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_026 - * @tc.name : AudioRec-Set1 - * @tc.desc : record audio with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_026', 0, async function (done) { - var audioStreamInfo44100 = { - samplingRate: 44100, - channels: 1, - sampleFormat: 1, - encodingType: 0, - }; - var audioCapturerInfo44100 = { - source: 1, - capturerFlags: 0 - } - var audioCapturerOptions44100 = { - streamInfo: audioStreamInfo44100, - capturerInfo: audioCapturerInfo44100, - } - - await getFd("capture_js-44100-1C-16LE.pcm"); - - var resultFlag = await recPromise(audioCapturerOptions44100, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_027 - * @tc.name : AudioRec-Set2 - * @tc.desc : record audio with parameter set 2 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_027', 0, async function (done) { - var audioStreamInfo96000 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_96000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo96000 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var audioCapturerOptions96000 = { - streamInfo: audioStreamInfo96000, - capturerInfo: audioCapturerInfo96000, - } - - await getFd("capture_js-96000-1C-S24LE.pcm"); - var resultFlag = await recPromise(audioCapturerOptions96000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_028 - * @tc.name : AudioRec-Set2 - * @tc.desc : record audio with parameter set 2 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_028', 0, async function (done) { - var audioStreamInfo96000 = { - samplingRate: 96000, - channels: 1, - sampleFormat: 2, - encodingType: 0, - }; - var audioCapturerInfo96000 = { - source: 1, - capturerFlags: 0 - } - var audioCapturerOptions96000 = { - streamInfo: audioStreamInfo96000, - capturerInfo: audioCapturerInfo96000, - } - - await getFd("capture_js-96000-1C-S24LE.pcm"); - var resultFlag = await recPromise(audioCapturerOptions96000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_029 - * @tc.name : AudioRec-Set3 - * @tc.desc : record audio with parameter set 3 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_029', 0, async function (done) { - var audioStreamInfo48000 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo48000 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var audioCapturerOptions48000 = { - streamInfo: audioStreamInfo48000, - capturerInfo: audioCapturerInfo48000, - } - - await getFd("capture_js-48000-2C-1S32LE.pcm"); - var resultFlag = await recPromise(audioCapturerOptions48000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_30 - * @tc.name : AudioRec-Set3 - * @tc.desc : record audio with parameter set 3 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_30', 0, async function (done) { - var audioStreamInfo48000 = { - samplingRate: 48000, - channels: 2, - sampleFormat: 1, - encodingType: 0, - }; - var audioCapturerInfo48000 = { - source: 1, - capturerFlags: 0 - } - var audioCapturerOptions48000 = { - streamInfo: audioStreamInfo48000, - capturerInfo: audioCapturerInfo48000, - } - - await getFd("capture_js-48000-2C-1S32LE.pcm"); - var resultFlag = await recPromise(audioCapturerOptions48000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_031 - * @tc.name : AudioRec-Set4 - * @tc.desc : record audio with parameter set 4 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_031', 0, async function (done) { - var audioStreamInfo8000 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_8000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo8000 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var audioCapturerOptions8000 = { - streamInfo: audioStreamInfo8000, - capturerInfo: audioCapturerInfo8000, - } - - await getFd("capture_js-8000-1C-8B.pcm"); - var resultFlag = await recPromise(audioCapturerOptions8000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_032 - * @tc.name : AudioRec-Set4 - * @tc.desc : record audio with parameter set 4 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_032', 0, async function (done) { - var audioStreamInfo8000 = { - samplingRate: 8000, - channels: 1, - sampleFormat: 0, - encodingType: 0, - }; - var audioCapturerInfo8000 = { - source: 1, - capturerFlags: 0 - } - var audioCapturerOptions8000 = { - streamInfo: audioStreamInfo8000, - capturerInfo: audioCapturerInfo8000, - } - - await getFd("capture_js-8000-1C-8B.pcm"); - var resultFlag = await recPromise(audioCapturerOptions8000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_33 - * @tc.name : AudioRec-Set5 - * @tc.desc : record audio with parameter set 5 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_33', 0, async function (done) { - var audioStreamInfo11025 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_11025, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo11025 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var audioCapturerOptions11025 = { - streamInfo: audioStreamInfo11025, - capturerInfo: audioCapturerInfo11025, - } - - await getFd("capture_js-11025-2C-16B.pcm"); - var resultFlag = await recPromise(audioCapturerOptions11025, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_034 - * @tc.name : AudioRec-Set5 - * @tc.desc : record audio with parameter set 5 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_034', 0, async function (done) { - var audioStreamInfo11025 = { - samplingRate: 11025, - channels: 2, - sampleFormat: 1, - encodingType: 0, - }; - var audioCapturerInfo11025 = { - source: 1, - capturerFlags: 0 - } - var audioCapturerOptions11025 = { - streamInfo: audioStreamInfo11025, - capturerInfo: audioCapturerInfo11025, - } - - await getFd("capture_js-11025-2C-16B.pcm"); - - var resultFlag = await recPromise(audioCapturerOptions11025, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_035 - * @tc.name : AudioRec-Set6 - * @tc.desc : record audio with parameter set 6 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_028', 0, async function (done) { - var audioStreamInfo12000 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_12000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo12000 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var audioCapturerOptions12000 = { - streamInfo: audioStreamInfo12000, - capturerInfo: audioCapturerInfo12000, - } - - await getFd("capture_js-12000-1C-24B.pcm"); - var resultFlag = await recPromise(audioCapturerOptions12000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_036 - * @tc.name : AudioRec-Set6 - * @tc.desc : record audio with parameter set 6 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_036', 0, async function (done) { - var audioStreamInfo12000 = { - samplingRate: 12000, - channels: 1, - sampleFormat: 2, - encodingType: 0 - }; - var audioCapturerInfo12000 = { - source: 1, - capturerFlags: 0 - } - var audioCapturerOptions12000 = { - streamInfo: audioStreamInfo12000, - capturerInfo: audioCapturerInfo12000, - } - - await getFd("capture_js-12000-1C-24B.pcm"); - var resultFlag = await recPromise(audioCapturerOptions12000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_037 - * @tc.name : AudioRec-Set7 - * @tc.desc : record audio with parameter set 7 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_037', 0, async function (done) { - var audioStreamInfo16000 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo16000 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var audioCapturerOptions16000 = { - streamInfo: audioStreamInfo16000, - capturerInfo: audioCapturerInfo16000, - } - - await getFd("capture_js-16000-2C-32B.pcm"); - var resultFlag = await recPromise(audioCapturerOptions16000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_038 - * @tc.name : AudioRec-Set7 - * @tc.desc : record audio with parameter set 7 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_038', 0, async function (done) { - var audioStreamInfo16000 = { - samplingRate: 16000, - channels: 2, - sampleFormat: 3, - encodingType: 0, - }; - var audioCapturerInfo16000 = { - source: 1, - capturerFlags: 0 - } - var audioCapturerOptions16000 = { - streamInfo: audioStreamInfo16000, - capturerInfo: audioCapturerInfo16000, - } - - await getFd("capture_js-16000-2C-32B.pcm"); - var resultFlag = await recPromise(audioCapturerOptions16000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_039 - * @tc.name : AudioRec-Set8 - * @tc.desc : record audio with parameter set 8 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_039', 0, async function (done) { - var audioStreamInfo22050 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_22050, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo22050 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var audioCapturerOptions22050 = { - streamInfo: audioStreamInfo22050, - capturerInfo: audioCapturerInfo22050, - } - - await getFd("capture_js-22050-1C-8B.pcm"); - var resultFlag = await recPromise(audioCapturerOptions22050, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_040 - * @tc.name : AudioRec-Set8 - * @tc.desc : record audio with parameter set 8 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_040', 0, async function (done) { - var audioStreamInfo22050 = { - samplingRate: 22050, - channels: 1, - sampleFormat: 0, - encodingType: 0, - }; - var audioCapturerInfo22050 = { - source: 1, - capturerFlags: 0 - } - var audioCapturerOptions22050 = { - streamInfo: audioStreamInfo22050, - capturerInfo: audioCapturerInfo22050, - } - - await getFd("capture_js-22050-1C-8B.pcm"); - - var resultFlag = await recPromise(audioCapturerOptions22050, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_041 - * @tc.name : AudioRec-Set9 - * @tc.desc : record audio with parameter set 9 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_041', 0, async function (done) { - var audioStreamInfo24000 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo24000 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var audioCapturerOptions24000 = { - streamInfo: audioStreamInfo24000, - capturerInfo: audioCapturerInfo24000, - } - - await getFd("capture_js-24000-2C-16B.pcm"); - - var resultFlag = await recPromise(audioCapturerOptions24000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_042 - * @tc.name : AudioRec-Set9 - * @tc.desc : record audio with parameter set 9 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_042', 0, async function (done) { - var audioStreamInfo24000 = { - samplingRate: 24000, - channels: 2, - sampleFormat: 1, - encodingType: 0, - }; - var audioCapturerInfo24000 = { - source: 1, - capturerFlags: 0 - } - var audioCapturerOptions24000 = { - streamInfo: audioStreamInfo24000, - capturerInfo: audioCapturerInfo24000, - } - - await getFd("capture_js-24000-2C-16B.pcm"); - - var resultFlag = await recPromise(audioCapturerOptions24000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_043 - * @tc.name : AudioRec-Set10 - * @tc.desc : record audio with parameter set 010 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_043', 0, async function (done) { - var audioStreamInfo32000 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_32000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo32000 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var audioCapturerOptions32000 = { - streamInfo: audioStreamInfo32000, - capturerInfo: audioCapturerInfo32000, - } - - await getFd("capture_js-32000-1C-24B.pcm"); - - var resultFlag = await recPromise(audioCapturerOptions32000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_044 - * @tc.name : AudioRec-Set10 - * @tc.desc : record audio with parameter set 010 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_044', 0, async function (done) { - var audioStreamInfo32000 = { - samplingRate: 32000, - channels: 1, - sampleFormat: 2, - encodingType: 0, - }; - var audioCapturerInfo32000 = { - source: 1, - capturerFlags: 0 - } - var audioCapturerOptions32000 = { - streamInfo: audioStreamInfo32000, - capturerInfo: audioCapturerInfo32000, - } - - await getFd("capture_js-32000-1C-24B.pcm"); - - var resultFlag = await recPromise(audioCapturerOptions32000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - - /* - * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_045 - * @tc.name : AudioRec-Set11 - * @tc.desc : record audio with parameter set 011 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 -*/ - - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_045', 0, async function (done) { - var audioStreamInfo64000 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_64000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo64000 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var audioCapturerOptions64000 = { - streamInfo: audioStreamInfo64000, - capturerInfo: audioCapturerInfo64000, - } - - await getFd("capture_js-64000-2C-32B.pcm"); - - var resultFlag = await recPromise(audioCapturerOptions64000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_046 - * @tc.name : AudioRec-Set11 - * @tc.desc : record audio with parameter set 011 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - - it('SUB_AUDIO_VOIP_Rec_VOICE_CHAT_Promise_ENUM_046', 0, async function (done) { - var audioStreamInfo64000 = { - samplingRate: 64000, - channels: 2, - sampleFormat: 3, - encodingType: 0, - }; - var audioCapturerInfo64000 = { - source: 1, - capturerFlags: 0 - } - var audioCapturerOptions64000 = { - streamInfo: audioStreamInfo64000, - capturerInfo: audioCapturerInfo64000, - } - - await getFd("capture_js-64000-2C-32B.pcm"); - - var resultFlag = await recPromise(audioCapturerOptions64000, dirPath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RECORD_Promise_AUDIO_SCENE_DEFAULT_047 - * @tc.name : AudioRec-Set1 - * @tc.desc : record audio with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - - it('SUB_AUDIO_RECORD_Promise_AUDIO_SCENE_DEFAULT_047', 0, async function (done) { - var audioStreamInfo44100 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo44100 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var audioCapturerOptions44100 = { - streamInfo: audioStreamInfo44100, - capturerInfo: audioCapturerInfo44100, - } - - await getFd("capture_js-44100-1C-16LE.pcm"); - - var resultFlag = await recPromise(audioCapturerOptions44100, dirPath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RECORD_Promise_AUDIO_SCENE_DEFAULT_ENUM_048 - * @tc.name : AudioRec-Set1 - * @tc.desc : record audio with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - - it('SUB_AUDIO_RECORD_Promise_AUDIO_SCENE_DEFAULT_ENUM_048', 0, async function (done) { - var audioStreamInfo44100 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW, - }; - var audioCapturerInfo44100 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var audioCapturerOptions44100 = { - streamInfo: audioStreamInfo44100, - capturerInfo: audioCapturerInfo44100, - } - - await getFd("capture_js-44100-1C-16LE.pcm"); - - var resultFlag = await recPromise(audioCapturerOptions44100, dirPath, 0); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - - done(); - }) - - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_START_055 - * @tc.name : AudioCapturer-GET_AUDIO_TIME - * @tc.desc : AudioCapturer GET_AUDIO_TIME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_START_055', 0, async function (done) { - var stateFlag; - await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - await audioCapCallBack.getAudioTime().then(async function (audioTime) { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER START : Success' + audioTime); - if (audioTime != 0) { - stateFlag = true; - expect(stateFlag).assertTrue(); - } else { - stateFlag = false; - expect(stateFlag).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - }); - await sleep(1000); - await audioCapCallBack.getAudioTime().then(async function (audioTime) { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime : Success' + audioTime); - if (audioTime != 0) { - stateFlag = true; - expect(stateFlag).assertTrue(); - } else { - stateFlag = false; - expect(stateFlag).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - }); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_READ_WRITE_056 - * @tc.name : AudioCapturer-GET_AUDIO_TIME - * @tc.desc : AudioCapturer GET_AUDIO_TIME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_READ_WRITE_056', 0, async function (done) { - var stateFlag; - await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - await audioCapCallBack.getAudioTime().then(async function (audioTime) { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime); - if (audioTime != 0) { - stateFlag = true; - } else { - stateFlag = false; - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(dirPath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag = false; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(dirPath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag = false; - } - await sleep(1000); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - await new Promise((resolve,reject)=>{ - audioCapCallBack.read(bufferSize, true, async (err, buffer) => { - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - reject(err); - } else { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - await audioCapCallBack.getAudioTime().then(async function (audioTime1) { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime1); - if (audioTime1 != 0) { - stateFlag = true; - } else { - stateFlag = false; - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - }); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); - await sleep(100); - stateFlag = true; - resolve(); - } - }); - }) - numBuffersToCapture--; - } - await sleep(3000); - - await audioCapCallBack.getAudioTime().then(async function (audioTime2) { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime2); - if (audioTime2 != 0) { - stateFlag = true; - } else { - stateFlag = false; - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - }); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_STOP_057 - * @tc.name : AudioCapturer-GET_AUDIO_TIME - * @tc.desc : AudioCapturer GET_AUDIO_TIME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_PROMISE_GET_AUDIO_TIME_AFTER_STOP_057', 0, async function (done) { - var stateFlag; - await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - await audioCapCallBack.getAudioTime().then(async function (audioTime) { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime); - if (audioTime != 0) { - stateFlag = true; - } else { - stateFlag = false; - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(dirPath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag = false; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(dirPath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag = false; - } - await sleep(1000); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - await new Promise((resolve,reject)=>{ - audioCapCallBack.read(bufferSize, true, async (err, buffer) => { - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - reject(err); - } else { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - await audioCapCallBack.getAudioTime().then(async function (audioTime1) { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime1); - if (audioTime1 != 0) { - stateFlag = true; - } else { - stateFlag = false; - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - }); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); - await sleep(100); - stateFlag = true; - resolve(); - } - }); - }) - numBuffersToCapture--; - } - await sleep(3000); - audioCapCallBack.stop(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO STOP STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 3)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO STOP STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - done(); - } - } - }); - await sleep(1000); - await audioCapCallBack.getAudioTime().then(async function (audioTime2) { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime AFTER WRITE : Success' + audioTime2); - if (audioTime2 != 0) { - stateFlag == true; - } else { - stateFlag == false; - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - }); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } else { - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - }) - - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_GET_AUDIO_TIME_058 - * @tc.name : AudioCapturer-GET_AUDIO_TIME - * @tc.desc : AudioCapturer GET_AUDIO_TIME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_GET_AUDIO_TIME_058', 0, async function (done) { - var stateFlag; - var audioCapCallBack; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - await audioCapCallBack.start().then(async function () { - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - await audioCapCallBack.getAudioTime(async (err, audioTime) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - console.info('AudioFrameworkRecLog: AudioCapturer getAudioTime : Success' + audioTime); - if (audioTime != 0) { - stateFlag = true; - } else { - stateFlag = false; - } - } - }); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } else { - stateFlag = false; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - - - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_PROMISE_STOP_BEFORE_START_059 - * @tc.name : AudioCapturer-GET_AUDIO_TIME - * @tc.desc : AudioCapturer GET_AUDIO_TIME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_PROMISE_STOP_BEFORE_START_059', 0, async function (done) { - var stateFlag; - var audioCapPromise; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCapPromise = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO NEW STATE---------'); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - stateFlag == true; - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - }); - await sleep(1000); - await audioCapPromise.stop().then(async function () { - console.info('AudioFrameworkRecLog: AudioCapturer STOPED : UNSUCCESS' + audioCapCallBack.state); - if (audioCapCallBack.state == 1) { - stateFlag = true; - } else { - stateFlag = false; - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop :ERROR : ' + err.message); - stateFlag = false; - }); - await sleep(1000); - audioCapPromise.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - }) - - /** - * @tc.number : SUB_AUDIO_VOIP_CAP_PROMISE_RELEASE_BEFORE_START_060 - * @tc.name : AudioCapturer-GET_AUDIO_TIME - * @tc.desc : AudioCapturer GET_AUDIO_TIME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_PROMISE_RELEASE_BEFORE_START_060', 0, async function (done) { - var stateFlag; - var audioCapPromise; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCapPromise = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO NEW STATE---------'); - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - stateFlag = true; - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - }); - await sleep(1000); - await audioCapPromise.release().then(async function () { - console.info('AudioFrameworkRecLog: Capturer released :SUCCESS '); - stateFlag = true; - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop :ERROR : ' + err.message); - stateFlag = false; - expect(stateFlag).assertTrue(); - }); - await sleep(1000); - audioCapPromise.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapPromise.state); - if ((audioCapPromise.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - }) - - - /* * - * @tc.number : SUB_AUDIO_Rec_PR_VOICE_CHAT_GET_STREAM_INFO_061 - * @tc.name : AudioRec-Set1 - * @tc.desc : record audio with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - - it('SUB_AUDIO_Rec_PR_VOICE_CHAT_GET_STREAM_INFO_061', 0, async function (done) { - var audioCapGetgetStreamInfo; - var setFlag; - var audioStreamInfo44100 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var audioCapturerInfo44100 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var AudioCapturerOptionsInvalid = { - streamInfo: audioStreamInfo44100, - capturerInfo: audioCapturerInfo44100, - } - - await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { - if (data != undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); - audioCapGetgetStreamInfo = data; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - done(); - }); - await sleep(1000); - await audioCapGetgetStreamInfo.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); - console.info('AudioFrameworkRecLog: Capturer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRecLog: Capturer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); - setFlag = true; - if (setFlag) { - console.info('AudioFrameworkRecLog: Capturer getStreamInfo: PASS'); - } - }).catch((err) => { - console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); - setFlag = false - }); - await sleep(1000); - audioCapGetgetStreamInfo.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - setFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapGetgetStreamInfo.state); - if ((audioCapGetgetStreamInfo.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - setFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + setFlag); - expect(setFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - - }) - - /* * - * @tc.number : SUB_AUDIO_Rec_PR_VOICE_CHAT_GET_STREAM_INFO_ENUM_062 - * @tc.name : AudioRec-Set1 - * @tc.desc : record audio with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - - it('SUB_AUDIO_Rec_PR_VOICE_CHAT_GET_STREAM_INFO_ENUM_062', 0, async function (done) { - var audioCapGetgetStreamInfo; - var setFlag; - var audioStreamInfo44100 = { - samplingRate: 44100, - channels: 1, - sampleFormat: 1, - encodingType: 0, - }; - var audioCapturerInfo44100 = { - source: 1, - capturerFlags: 0 - } - var AudioCapturerOptionsInvalid = { - streamInfo: audioStreamInfo44100, - capturerInfo: audioCapturerInfo44100, - } - - await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { - if (data != undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); - audioCapGetgetStreamInfo = data; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - done(); - }); - await sleep(1000); - await audioCapGetgetStreamInfo.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); - console.info('AudioFrameworkRecLog: Capturer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRecLog: Capturer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); - setFlag = true; - if (setFlag) { - console.info('AudioFrameworkRecLog: Capturer getStreamInfo: PASS'); - } - }).catch((err) => { - console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); - setFlag = false; - expect(setFlag).assertTrue(); - }); - await sleep(1000); - audioCapGetgetStreamInfo.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - setFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapGetgetStreamInfo.state); - if ((audioCapGetgetStreamInfo.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - setFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + setFlag); - expect(setFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - - - }) - - /* * - * @tc.number : SUB_AUDIO_Rec_CB_VOICE_CHAT_GET_STREAM_INFO_063 - * @tc.name : AudioRec-Set1 - * @tc.desc : record audio with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - - it('SUB_AUDIO_Rec_CB_VOICE_CHAT_GET_STREAM_INFO_063', 0, async function (done) { - var audioCapGetgetStreamInfo; - var setFlag; - var audioStreamInfo44100 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var audioCapturerInfo44100 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var AudioCapturerOptionsInvalid = { - streamInfo: audioStreamInfo44100, - capturerInfo: audioCapturerInfo44100, - } - - await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { - if (data != undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); - audioCapGetgetStreamInfo = data; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - done(); - }); - await sleep(1000); - audioCapGetgetStreamInfo.getStreamInfo(async (err, audioParamsGet) => { - console.info('AudioFrameworkRecLog: ---------GET STREAM INFO---------'); - console.log('AudioFrameworkRecLog: Entered getStreamInfo'); - if (err) { - console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); - setFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); - console.info('AudioFrameworkRecLog: Capturer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRecLog: Capturer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); - setFlag = true; - } - await sleep(100); - done(); - }); - - audioCapGetgetStreamInfo.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - setFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapGetgetStreamInfo.state); - if ((audioCapGetgetStreamInfo.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - setFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + setFlag); - expect(setFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - - }) - - /* * - * @tc.number : SUB_AUDIO_Rec_CB_VOICE_CHAT_GET_STREAM_INFO_ENUM_064 - * @tc.name : AudioRec-Set1 - * @tc.desc : record audio with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - - it('SUB_AUDIO_Rec_CB_VOICE_CHAT_GET_STREAM_INFO_ENUM_064', 0, async function (done) { - var audioCapGetgetStreamInfo; - var setFlag; - var audioStreamInfo44100 = { - samplingRate: 44100, - channels: 1, - sampleFormat: 1, - encodingType: 0, - }; - var audioCapturerInfo44100 = { - source: 1, - capturerFlags: 0 - } - var AudioCapturerOptionsInvalid = { - streamInfo: audioStreamInfo44100, - capturerInfo: audioCapturerInfo44100, - } - - await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { - if (data != undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); - audioCapGetgetStreamInfo = data; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - done(); - }); - await sleep(1000); - audioCapGetgetStreamInfo.getStreamInfo(async (err, audioParamsGet) => { - console.info('AudioFrameworkRecLog: ---------GET STREAM INFO---------'); - console.log('AudioFrameworkRecLog: Entered getStreamInfo'); - if (err) { - console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); - setFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); - console.info('AudioFrameworkRecLog: Capturer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRecLog: Capturer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); - setFlag = true; - } - await sleep(1000); - }); - - audioCapGetgetStreamInfo.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - setFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapGetgetStreamInfo.state); - if ((audioCapGetgetStreamInfo.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - setFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + setFlag); - expect(setFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - - }) - - - - /* * - * @tc.number : SUB_AUDIO_Rec_PR_VOICE_CHAT_GET_CAPTURER_INFO_065 - * @tc.name : AudioRec-Set1 - * @tc.desc : record audio with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - - it('SUB_AUDIO_Rec_PR_VOICE_CHAT_GET_CAPTURER_INFO_065', 0, async function (done) { - var audioCapGetgetCapturerInfo; - var setFlag; - var audioStreamInfo44100 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var audioCapturerInfo44100 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var AudioCapturerOptionsInvalid = { - streamInfo: audioStreamInfo44100, - capturerInfo: audioCapturerInfo44100, - } - - await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { - if (data != undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); - audioCapGetgetCapturerInfo = data; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - done(); - }); - await sleep(1000); - await audioCapGetgetCapturerInfo.getCapturerInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); - console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); - console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); - setFlag = true; - }).catch((err) => { - console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); - setFlag = false; - }); - await sleep(1000); - audioCapGetgetCapturerInfo.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - setFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapGetgetCapturerInfo.state); - if ((audioCapGetgetCapturerInfo.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - setFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + setFlag); - expect(setFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - - - }) - - /* * - * @tc.number : SUB_AUDIO_Rec_PR_VOICE_CHAT_GET_CAPTURER_INFO_ENUM_066 - * @tc.name : AudioRec-Set1 - * @tc.desc : record audio with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - - it('SUB_AUDIO_Rec_PR_VOICE_CHAT_GET_CAPTURER_INFO_ENUM_65', 0, async function (done) { - var audioCapGetgetCapturerInfo; - var setFlag; - var audioStreamInfo44100 = { - samplingRate: 44100, - channels: 1, - sampleFormat: 1, - encodingType: 0, - }; - var audioCapturerInfo44100 = { - source: 1, - capturerFlags: 0 - } - var AudioCapturerOptionsInvalid = { - streamInfo: audioStreamInfo44100, - capturerInfo: audioCapturerInfo44100, - } - - await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { - if (data != undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); - audioCapGetgetCapturerInfo = data; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - done(); - }); - await sleep(1000); - await audioCapGetgetCapturerInfo.getCapturerInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); - console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); - console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); - setFlag = true; - }).catch((err) => { - setFlag = false; - console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); - }); - await sleep(1000); - audioCapGetgetCapturerInfo.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - setFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapGetgetCapturerInfo.state); - if ((audioCapGetgetCapturerInfo.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - setFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + setFlag); - expect(setFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - - - }) - - /* * - * @tc.number : SUB_AUDIO_Rec_CB_VOICE_CHAT_GET_CAPTURER_INFO_067 - * @tc.name : AudioRec-Set1 - * @tc.desc : record audio with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - - it('SUB_AUDIO_Rec_CB_VOICE_CHAT_GET_CAPTURER_INFO_067', 0, async function (done) { - var audioCapGetgetCapturerInfo; - var setFlag; - var audioStreamInfo44100 = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var audioCapturerInfo44100 = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var AudioCapturerOptionsInvalid = { - streamInfo: audioStreamInfo44100, - capturerInfo: audioCapturerInfo44100, - } - - await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { - if (data != undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); - audioCapGetgetCapturerInfo = data; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - done(); - }); - await sleep(1000); - audioCapGetgetCapturerInfo.getCapturerInfo(async (err, audioParamsGet) => { - console.info('AudioFrameworkRecLog: ---------GET CAPTURER INFO---------'); - if (err) { - console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); - setFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); - console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); - console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); - setFlag = true; - await sleep(100); - done(); - } - }); - await sleep(1000); - audioCapGetgetCapturerInfo.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - setFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapGetgetCapturerInfo.state); - if ((audioCapGetgetCapturerInfo.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - setFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + setFlag); - expect(setFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - - }) - - /* * - * @tc.number : SUB_AUDIO_Rec_CB_VOICE_CHAT_GET_STREAM_INFO_ENUM_068 - * @tc.name : AudioRec-Set1 - * @tc.desc : record audio with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - - it('SUB_AUDIO_Rec_CB_VOICE_CHAT_GET_STREAM_INFO_ENUM_068', 0, async function (done) { - var audioCapGetgetCapturerInfo; - var setFlag; - var audioStreamInfo44100 = { - samplingRate: 44100, - channels: 1, - sampleFormat: 1, - encodingType: 0, - }; - var audioCapturerInfo44100 = { - source: 1, - capturerFlags: 0 - } - var AudioCapturerOptionsInvalid = { - streamInfo: audioStreamInfo44100, - capturerInfo: audioCapturerInfo44100, - } - - await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { - if (data != undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); - audioCapGetgetCapturerInfo = data; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - done(); - }); - await sleep(1000); - audioCapGetgetCapturerInfo.getCapturerInfo(async (err, audioParamsGet) => { - console.info('AudioFrameworkRecLog: ---------GET CAPTURER INFO---------'); - if (err) { - console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); - setFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); - console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); - console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); - setFlag = true; - await sleep(1000); - done(); - } - }); - - audioCapGetgetCapturerInfo.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - setFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapGetgetCapturerInfo.state); - if ((audioCapGetgetCapturerInfo.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - setFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + setFlag); - expect(setFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_Rec_VOICE_CHAT_PR_ENUM_AUDIO_STREAM_INFO_INVALID_069 - * @tc.name : AudioRec-Set1 - * @tc.desc : record audio with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - - it('SUB_AUDIO_Rec_VOICE_CHAT_PR_ENUM_AUDIO_STREAM_INFO_INVALID_069', 0, async function (done) { - var audioStreamInfo44100 = { - samplingRate: 0, - channels: 1, - sampleFormat: 1, - encodingType: 0, - }; - var audioCapturerInfo44100 = { - source: 1, - capturerFlags: 0 - } - var AudioCapturerOptionsInvalid = { - streamInfo: audioStreamInfo44100, - capturerInfo: audioCapturerInfo44100, - } - - var audioCap; - - await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { - if (data == undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); - expect(true).assertTrue(); - } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); - } - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_Rec_VOICE_CHAT_PR_ENUM_AUDIO_CAPTURER_INFO_INVALID_070 - * @tc.name : AudioRec-Set1 - * @tc.desc : record audio with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - - it('SUB_AUDIO_Rec_VOICE_CHAT_PR_ENUM_AUDIO_CAPTURER_INFO_INVALID_070', 0, async function (done) { - var audioStreamInfo44100 = { - samplingRate: 44100, - channels: 1, - sampleFormat: 1, - encodingType: 0, - }; - var audioCapturerInfo44100 = { - source: 1000, - capturerFlags: 0 - } - var AudioCapturerOptionsInvalid = { - streamInfo: audioStreamInfo44100, - capturerInfo: audioCapturerInfo44100, - } - - await audio.createAudioCapturer(AudioCapturerOptionsInvalid).then(async function (data) { - if (data == undefined) { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Unsuccess :' + data); - expect(true).assertTrue(); - } else { - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success:' + data.state); - } - - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_ON_ALL_CASES_071 - * @tc.name : AudioCapturer-Check-STATE-STOPPED - * @tc.desc : AudioCapturer with state stopped - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_ON_ALL_CASES_070', 0, async function (done) { - var stateFlag; - var audioCapCallBack; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.on('stateChange', (AudioState) => { - console.info('AudioCapturerLog: Changed State to : ' + AudioState) - switch (AudioState) { - case audio.AudioState.STATE_NEW: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------NEW--------------'); - console.info('AudioFrameworkTest: Audio State is : New'); - break; - case audio.AudioState.STATE_PREPARED: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------PREPARED--------------'); - console.info('AudioFrameworkTest: Audio State is : Prepared'); - break; - case audio.AudioState.STATE_RUNNING: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------RUNNING--------------'); - console.info('AudioFrameworkTest: Audio State is : Running'); - break; - case audio.AudioState.STATE_STOPPED: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------STOPPED--------------'); - console.info('AudioFrameworkTest: Audio State is : stopped'); - break; - case audio.AudioState.STATE_RELEASED: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------RELEASED--------------'); - console.info('AudioFrameworkTest: Audio State is : released'); - break; - default: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------INVALID--------------'); - console.info('AudioFrameworkTest: Audio State is : invalid'); - break; - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - await sleep(1000); - if ((audioCapCallBack.state == 2)) { - stateFlag == true; - } - } - }); - await sleep(1000); - - audioCapCallBack.stop(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO STOPPED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == audio.AudioState.STATE_STOPPED)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO STOPPED STATE---------'); - stateFlag == true; - } - console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); - } - }); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - stateFlag = true; - console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_ON_PREPARED_072 - * @tc.name : AudioCapturer-Check-STATE-STOPPED - * @tc.desc : AudioCapturer with state stopped - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_ON_PREPARED_072', 0, async function (done) { - var stateFlag; - var audioCapCallBack; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.on('stateChange', (AudioState) => { - console.info('AudioCapturerLog: Changed State to : ' + AudioState) - switch (AudioState) { - case audio.AudioState.STATE_NEW: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------NEW--------------'); - console.info('AudioFrameworkTest: Audio State is : New'); - break; - case audio.AudioState.STATE_PREPARED: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------PREPARED--------------'); - console.info('AudioFrameworkTest: Audio State is : Prepared'); - break; - case audio.AudioState.STATE_RUNNING: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------RUNNING--------------'); - console.info('AudioFrameworkTest: Audio State is : Running'); - break; - case audio.AudioState.STATE_STOPPED: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------STOPPED--------------'); - console.info('AudioFrameworkTest: Audio State is : stopped'); - break; - case audio.AudioState.STATE_RELEASED: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------RELEASED--------------'); - console.info('AudioFrameworkTest: Audio State is : released'); - break; - default: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------INVALID--------------'); - console.info('AudioFrameworkTest: Audio State is : invalid'); - break; - } - }); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - stateFlag = true; - console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_ON_START_073 - * @tc.name : AudioCapturer-Check-STATE-STOPPED - * @tc.desc : AudioCapturer with state stopped - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_ON_START_073', 0, async function (done) { - var stateFlag; - var audioCapCallBack; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.on('stateChange', (AudioState) => { - console.info('AudioCapturerLog: Changed State to : ' + AudioState) - switch (AudioState) { - case audio.AudioState.STATE_NEW: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------NEW--------------'); - console.info('AudioFrameworkTest: Audio State is : New'); - break; - case audio.AudioState.STATE_PREPARED: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------PREPARED--------------'); - console.info('AudioFrameworkTest: Audio State is : Prepared'); - break; - case audio.AudioState.STATE_RUNNING: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------RUNNING--------------'); - console.info('AudioFrameworkTest: Audio State is : Running'); - break; - case audio.AudioState.STATE_STOPPED: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------STOPPED--------------'); - console.info('AudioFrameworkTest: Audio State is : stopped'); - break; - case audio.AudioState.STATE_RELEASED: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------RELEASED--------------'); - console.info('AudioFrameworkTest: Audio State is : released'); - break; - default: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------INVALID--------------'); - console.info('AudioFrameworkTest: Audio State is : invalid'); - break; - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - await sleep(1000); - if ((audioCapCallBack.state == 2)) { - stateFlag == true; - } - } - }); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - stateFlag = true; - console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_ON_STOP_074 - * @tc.name : AudioCapturer-Check-STATE-STOPPED - * @tc.desc : AudioCapturer with state stopped - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_ON_STOP_074', 0, async function (done) { - var stateFlag; - var audioCapCallBack; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.on('stateChange', (AudioState) => { - console.info('AudioCapturerLog: Changed State to : ' + AudioState) - switch (AudioState) { - case audio.AudioState.STATE_NEW: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------NEW--------------'); - console.info('AudioFrameworkTest: Audio State is : New'); - break; - case audio.AudioState.STATE_PREPARED: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------PREPARED--------------'); - console.info('AudioFrameworkTest: Audio State is : Prepared'); - break; - case audio.AudioState.STATE_RUNNING: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------RUNNING--------------'); - console.info('AudioFrameworkTest: Audio State is : Running'); - break; - case audio.AudioState.STATE_STOPPED: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------STOPPED--------------'); - console.info('AudioFrameworkTest: Audio State is : stopped'); - break; - case audio.AudioState.STATE_RELEASED: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------RELEASED--------------'); - console.info('AudioFrameworkTest: Audio State is : released'); - break; - default: - console.info('AudioFrameworkTest:--------CHANGE IN AUDIO STATE----------INVALID--------------'); - console.info('AudioFrameworkTest: Audio State is : invalid'); - break; - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - await sleep(1000); - if ((audioCapCallBack.state == 2)) { - stateFlag == true; - } - } - }); - await sleep(1000); - - audioCapCallBack.stop(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------STOP RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO STOPPED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == audio.AudioState.STATE_STOPPED)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO STOPPED STATE---------'); - stateFlag == true; - } - console.info('AudioFrameworkRecLog: stateFlag : ' + stateFlag); - } - }); - - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - stateFlag = true; - console.info('AudioFrameworkRenderLog: stateFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_5000_REACH_075 - * @tc.name : AudioCapturer-Check-READ_BUFFER - * @tc.desc : AudioCapturer with read buffer - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_5000_REACH_075', 0, async function (done) { - var stateFlag; - await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.on('markReach', 5000, (position) => { - if (position == 5000) { - console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); - console.info('AudioRenderLog: mark reached: ' + position); - stateFlag = true; - } else { - stateFlag = false; - expect(stateFlag).assertTrue(); - done(); - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(dirPath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag = false; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(dirPath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag = false; - } - await sleep(1000); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - await new Promise((resolve,reject)=>{ - audioCapCallBack.read(bufferSize, true, async (err, buffer) => { - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - reject(err); - } else { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); - await sleep(100); - stateFlag = true; - resolve(); - } - }); - }) - numBuffersToCapture--; - } - await sleep(3000); - audioCapCallBack.off('markReach'); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } else { - stateFlag = false; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_1000_REACH_076 - * @tc.name : AudioCapturer-Check-READ_BUFFER - * @tc.desc : AudioCapturer with read buffer - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_1000_REACH_076', 0, async function (done) { - var stateFlag; - await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.on('markReach', 1000, (position) => { - if (position == 1000) { - console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); - console.info('AudioRenderLog: mark reached: ' + position); - stateFlag = true; - } else { - stateFlag = false; - expect(stateFlag).assertTrue(); - done(); - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(dirPath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag = false; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(dirPath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag = false; - } - await sleep(1000); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - await new Promise((resolve,reject)=>{ - audioCapCallBack.read(bufferSize, true, async (err, buffer) => { - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - reject(err); - } else { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); - await sleep(100); - stateFlag = true; - resolve(); - } - }); - }) - numBuffersToCapture--; - } - await sleep(3000); - audioCapCallBack.off('markReach'); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_10000_REACH_077 - * @tc.name : AudioCapturer-Check-READ_BUFFER - * @tc.desc : AudioCapturer with read buffer - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_10000_REACH_077', 0, async function (done) { - var stateFlag; - await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.on('markReach', 10000, (position) => { - if (position == 10000) { - console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); - console.info('AudioRenderLog: mark reached: ' + position); - stateFlag = true; - } else { - stateFlag = false; - expect(stateFlag).assertTrue(); - done(); - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(dirPath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag = false; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(dirPath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag = false; - } - await sleep(1000); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - await new Promise((resolve,reject)=>{ - audioCapCallBack.read(bufferSize, true, async (err, buffer) => { - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - reject(err); - } else { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); - await sleep(100); - stateFlag = true; - resolve(); - } - }); - }) - numBuffersToCapture--; - } - await sleep(3000); - audioCapCallBack.off('markReach'); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_100_REACH_078 - * @tc.name : AudioCapturer-Check-READ_BUFFER - * @tc.desc : AudioCapturer with read buffer - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_100_REACH_078', 0, async function (done) { - var stateFlag; - await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.on('markReach', 100, (position) => { - if (position == 100) { - console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); - console.info('AudioRenderLog: mark reached: ' + position); - stateFlag = true; - } else { - stateFlag = false; - expect(stateFlag).assertTrue(); - done(); - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(dirPath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag = false; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(dirPath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag = false; - } - await sleep(1000); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - await new Promise((resolve,reject)=>{ - audioCapCallBack.read(bufferSize, true, async (err, buffer) => { - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - reject(err); - } else { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); - await sleep(100); - stateFlag = true; - resolve(); - } - }); - }) - numBuffersToCapture--; - } - await sleep(3000); - audioCapCallBack.off('markReach'); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_1_REACH_079 - * @tc.name : AudioCapturer-Check-READ_BUFFER - * @tc.desc : AudioCapturer with read buffer - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_1_REACH_079', 0, async function (done) { - var stateFlag; - await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.on('markReach', 1, (position) => { - if (position == 1) { - console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); - console.info('AudioRenderLog: mark reached: ' + position); - stateFlag = true; - } else { - stateFlag = false; - expect(stateFlag).assertTrue(); - done(); - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(dirPath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag = false; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(dirPath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag = false; - } - await sleep(1000); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - await new Promise((resolve,reject)=>{ - audioCapCallBack.read(bufferSize, true, async (err, buffer) => { - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - reject(err); - } else { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); - await sleep(100); - stateFlag = true; - resolve(); - } - }); - }) - numBuffersToCapture--; - } - await sleep(3000); - audioCapCallBack.off('markReach'); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - }) - - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_0_REACH_080 - * @tc.name : AudioCapturer-Check-READ_BUFFER - * @tc.desc : AudioCapturer with read buffer - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_0_REACH_080', 0, async function (done) { - var stateFlag; - await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.on('markReach', 0, (position) => { - if (position == 0) { - console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); - console.info('AudioRenderLog: mark reached: ' + position); - stateFlag = true; - } else { - stateFlag = false; - expect(stateFlag).assertTrue(); - done(); - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(dirPath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag = false; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(dirPath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag = false; - } - await sleep(1000); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - await new Promise((resolve,reject)=>{ - audioCapCallBack.read(bufferSize, true, async (err, buffer) => { - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - reject(err); - } else { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); - await sleep(100); - stateFlag = true; - resolve(); - } - }); - }) - numBuffersToCapture--; - } - await sleep(3000); - audioCapCallBack.off('markReach'); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - }) - - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_LARGEVALUE_REACH_081 - * @tc.name : AudioCapturer-Check-READ_BUFFER - * @tc.desc : AudioCapturer with read buffer - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_LARGEVALUE_REACH_081', 0, async function (done) { - var stateFlag; - await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.on('markReach', 1234567890, (position) => { - if (position == 1234567890) { - console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); - console.info('AudioRenderLog: mark reached: ' + position); - stateFlag = true; - } else { - stateFlag = false; - expect(stateFlag).assertTrue(); - done(); - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(dirPath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag = false; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(dirPath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag = false; - } - await sleep(1000); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - await new Promise((resolve,reject)=>{ - audioCapCallBack.read(bufferSize, true, async (err, buffer) => { - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - reject(err); - } else { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); - await sleep(100); - stateFlag = true; - resolve(); - } - }); - }) - numBuffersToCapture--; - } - await sleep(3000); - audioCapCallBack.off('markReach'); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_NEGATIVEVALUE_REACH_082 - * @tc.name : AudioCapturer-Check-READ_BUFFER - * @tc.desc : AudioCapturer with read buffer - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_MARK_NEGATIVEVALUE_REACH_082', 0, async function (done) { - var stateFlag; - await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.on('markReach', -2, (position) => { - if (position == -2) { - console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); - console.info('AudioRenderLog: mark reached: ' + position); - stateFlag = true; - } else { - stateFlag = false; - expect(stateFlag).assertTrue(); - done(); - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(dirPath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag = false; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(dirPath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag = false; - } - await sleep(1000); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - await new Promise((resolve,reject)=>{ - audioCapCallBack.read(bufferSize, true, async (err, buffer) => { - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - reject(err); - } else { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); - await sleep(100); - stateFlag = true; - resolve(); - } - }); - }) - numBuffersToCapture--; - } - await sleep(3000); - audioCapCallBack.off('markReach'); - await sleep(1000); - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_1000_084 - * @tc.name : AudioCapturer-Check-READ_BUFFER - * @tc.desc : AudioCapturer with read buffer - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_1000_084', 0, async function (done) { - var stateFlag; - await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.on('periodReach', 1000, (position) => { - if (position == 1000) { - console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); - console.info('AudioRenderLog: mark reached: ' + position); - stateFlag = true; - } else { - stateFlag = false; - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(dirPath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag = false; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(dirPath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag = false; - } - await sleep(1000); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - await new Promise((resolve,reject)=>{ - audioCapCallBack.read(bufferSize, true, async (err, buffer) => { - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - reject(err); - } else { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); - await sleep(100); - stateFlag = true; - resolve(); - } - }); - }) - numBuffersToCapture--; - } - await sleep(3000); - audioCapCallBack.off('periodReach'); - await sleep(1000); - if (stateFlag == true) { - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - } else { - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - expect(stateFlag).assertTrue(); - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - stateFlag = false; - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - } - - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_1_085 - * @tc.name : AudioCapturer-Check-READ_BUFFER - * @tc.desc : AudioCapturer with read buffer - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_1_085', 0, async function (done) { - var stateFlag; - await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.on('periodReach', 1, (position) => { - if (position == 1) { - console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); - console.info('AudioRenderLog: mark reached: ' + position); - stateFlag = true; - } else { - stateFlag = false; - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(dirPath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag = false; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(dirPath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag = false; - } - await sleep(1000); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - await new Promise((resolve,reject)=>{ - audioCapCallBack.read(bufferSize, true, async (err, buffer) => { - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - reject(err); - } else { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); - await sleep(100); - stateFlag = true; - resolve(); - } - }); - }) - numBuffersToCapture--; - } - await sleep(3000); - audioCapCallBack.off('periodReach'); - await sleep(1000); - if (stateFlag == true) { - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - } else { - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - expect(stateFlag).assertTrue(); - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - stateFlag = false; - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - } - - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_NEGATIVE_086 - * @tc.name : AudioCapturer-Check-READ_BUFFER - * @tc.desc : AudioCapturer with read buffer - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_NEGATIVE_086', 0, async function (done) { - var stateFlag; - await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.on('periodReach', -2, (position) => { - if (position == -2) { - console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); - console.info('AudioRenderLog: mark reached: ' + position); - stateFlag = true; - } else { - stateFlag = false; - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(dirPath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag = false; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(dirPath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag = false; - } - await sleep(1000); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - await new Promise((resolve,reject)=>{ - audioCapCallBack.read(bufferSize, true, async (err, buffer) => { - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - reject(err); - } else { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); - await sleep(100); - stateFlag = true; - resolve(); - } - }); - }) - numBuffersToCapture--; - } - await sleep(3000); - audioCapCallBack.off('periodReach'); - await sleep(1000); - if (stateFlag == true) { - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - } else { - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - expect(stateFlag).assertTrue(); - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - stateFlag = false; - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - } - - }) - - - /* * - * @tc.number : SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_223750_087 - * @tc.name : AudioCapturer-Check-READ_BUFFER - * @tc.desc : AudioCapturer with read buffer - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_VOIP_CAP_CB_READ_BUFFER_PERIOD_REACH_223750_087', 0, async function (done) { - var stateFlag; - await getFd("capture_CB_js-44100-2C-S16LE-checkcbreadbuffer.pcm"); - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - audio.createAudioCapturer(AudioCapturerOptions, async (err, value) => { - if (err) { - console.info('AudioFrameworkRecLog: AudioCapturer Not Created : Fail : Stream Type: FAIL'); - } else { - audioCapCallBack = value; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS' + audioCapCallBack.state); - } - }); - await sleep(1000); - audioCapCallBack.on('periodReach', 223750, (position) => { - if (position == 223750) { - console.info('AudioFrameworkRecLog: ---------ON TRIGGERED SUCCESSFULLY---------'); - console.info('AudioRenderLog: periodReach: ' + position); - stateFlag = true; - } else { - stateFlag = false; - } - }); - await sleep(1000); - audioCapCallBack.start(async (err, value) => { - console.info('AudioFrameworkRecLog: AudioCapturer : START SUCCESS'); - console.info('AudioFrameworkRecLog: ---------START---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - if ((audioCapCallBack.state == 2)) { - stateFlag = true; - } - } - }); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------GET BUFFER SIZE---------'); - var bufferSize = await audioCapCallBack.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - await sleep(1000); - console.info('AudioFrameworkRecLog: ---------OPEN FILE---------'); - var fd = fileio.openSync(dirPath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - stateFlag = false; - } - console.info('AudioFrameworkRecLog: ---------OPEN FILE IN APPEND MODE---------'); - fd = fileio.openSync(dirPath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - stateFlag = false; - } - await sleep(1000); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK CB READ BUFFER---------'); - await new Promise((resolve,reject)=>{ - audioCapCallBack.read(bufferSize, true, async (err, buffer) => { - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - reject(err); - } else { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK CB READ BUFFER---------'); - console.info('AudioFrameworkRecLog: AudioCapturer : readvalue : ' + buffer); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); - await sleep(100); - stateFlag = true; - resolve(); - } - }); - }) - numBuffersToCapture--; - } - await sleep(3000); - audioCapCallBack.off('periodReach'); - await sleep(1000); - if (stateFlag == true) { - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - stateFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - } else { - audioCapCallBack.release(async (err, value) => { - console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------'); - if (err) { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - stateFlag = false; - expect(stateFlag).assertTrue(); - } else { - console.info('AudioFrameworkRecLog: ---------BEFORE CHECK AUDIO RELASED STATE---------'); - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCapCallBack.state); - if ((audioCapCallBack.state == 4)) { - console.info('AudioFrameworkRecLog: ---------AFTER CHECK AUDIO RELEASED STATE---------'); - console.info('AudioFrameworkRenderLog: resultFlag : ' + stateFlag); - stateFlag = false; - expect(stateFlag).assertTrue(); - done(); - } - } - }); - await sleep(1000); - } - - }) -}) diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturerChangeInfo.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturerChangeInfo.test.js deleted file mode 100644 index a161d04d5b51e63fdd904c537d6651ba89a06e55..0000000000000000000000000000000000000000 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioCapturerChangeInfo.test.js +++ /dev/null @@ -1,2214 +0,0 @@ -/* - * 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 audio from '@ohos.multimedia.audio'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -describe('audioCapturerChange', function () { - var audioStreamManager; - var audioStreamManagerCB; - var dirPath; - var fpath; - var Tag = "AFCapLog : "; - - const audioManager = audio.getAudioManager(); - console.info(Tag+'Create AudioManger Object JS Framework'); - - beforeAll(async function () { - console.info(Tag+' beforeAll: Prerequisites at the test suite level'); - dirPath = '/data/storage/el2/base/haps/entry/cache' - console.info(Tag+'Recording files Path: '+dirPath); - fpath = dirPath+'/capture_js.pcm'; - await sleep(100); - await audioManager.getStreamManager().then(async function (data) { - audioStreamManager = data; - console.info(Tag+' Get AudioStream Manager : Success '); - }).catch((err) => { - console.info(Tag+' Get AudioStream Manager : ERROR : '+err.message); - }); - - audioManager.getStreamManager((err, data) => { - if (err) { - console.error(Tag+' Get AudioStream Manager : ERROR : '+err.message); - } - else { - audioStreamManagerCB = data; - console.info(Tag+' Get AudioStream Manager : Success '); - } - }); - await sleep(1000); - console.info(Tag+' beforeAll: END'); - }) - - beforeEach(async function () { - console.info(Tag+' beforeEach: Prerequisites at the test case level'); - await sleep(1000); - }) - - afterEach(function () { - console.info(Tag+' afterEach: Test case-level clearance conditions'); - }) - - afterAll(async function () { - await sleep(1000); - console.info(Tag+' afterAll: Test suite-level cleanup condition'); - }) - - function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); - } - - /* * - * @tc.number : SUB_AUDIO_ON_CAPTURER_CHANGE_001 - * @tc.name : AudioCapturerChange - ON_STATE_PREPARED - * @tc.desc : AudioCapturerChange - ON_STATE_PREPARED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_ON_CAPTURER_CHANGE_001', 0, async function (done) { - var audioCap ; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = false; - audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.off('audioCapturerChange'); - await sleep(100); - console.info(Tag+'[CAPTURER-CHANGE-ON-001] ######### CapturerChange Off is called #########'); - - await audioCap.release().then(async function () { - console.info(Tag+'Capturer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_ON_CAPTURER_CHANGE_002 - * @tc.name : AudioCapturerChange - ON_STATE_RUNNING - * @tc.desc : AudioCapturerChange - ON_STATE_RUNNING - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - * */ - - - it('SUB_AUDIO_ON_CAPTURER_CHANGE_002', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = false; - - var audioCap; - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCap = data; - console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManagerCB.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'Capturer start :ERROR : '+err.message); - }); - - await sleep(100); - audioStreamManagerCB.off('audioCapturerChange'); - await sleep(100); - console.info(Tag+'[CAPTURER-CHANGE-ON-002] ######### CapturerChange Off is called #########'); - - await audioCap.release().then(async function () { - console.info(Tag+'Capturer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_ON_CAPTURER_CHANGE_003 - * @tc.name : AudioCapturerChange - ON_STATE_STOPPED - * @tc.desc : AudioCapturerChange - ON_STATE_STOPPED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - * */ - - - it('SUB_AUDIO_ON_CAPTURER_CHANGE_003', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = false; - - var audioCap; - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCap = data; - console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await audioCap.start().then(async function () { - console.info(Tag+'Capturer started :SUCCESS '); - }).catch((err) => { - console.info(Tag+'Capturer start :ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'Capturer stop:ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.off('audioCapturerChange'); - await sleep(100); - console.info(Tag+'[CAPTURER-CHANGE-ON-003] ######### CapturerChange Off is called #########'); - - await audioCap.release().then(async function () { - console.info(Tag+'Capturer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_ON_CAPTURER_CHANGE_004 - * @tc.name : AudioCapturerChange - ON_STATE_RELEASED - * @tc.desc : AudioCapturerChange - ON_STATE_RELEASED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_ON_CAPTURER_CHANGE_004', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = false; - - var audioCap; - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCap = data; - console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await audioCap.start().then(async function () { - console.info(Tag+'Capturer started :SUCCESS '); - }).catch((err) => { - console.info(Tag+'Capturer start :ERROR : '+err.message); - }); - - await audioCap.stop().then(async function () { - console.info(Tag+'Capturer stopped : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer stop:ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManagerCB.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManagerCB.off('audioCapturerChange'); - await sleep(100); - console.info(Tag+'[CAPTURER-CHANGE-ON-004] ######### CapturerChange Off is called #########'); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /** - * @tc.number : SUB_AUDIO_ON_CAPTURER_CHANGE_005 - * @tc.name : AudioCapturerChange - ON_SOURCE_TYPE_MIC - * @tc.desc : AudioCapturerChange - ON_SOURCE_TYPE_MIC - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 -**/ - - it('SUB_AUDIO_ON_CAPTURER_CHANGE_005', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = false; - - var audioCap; - - audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.off('audioCapturerChange'); - await sleep(100); - console.info(Tag+'[CAPTURER-CHANGE-ON-005] ######### CapturerChange Off is called #########'); - - await audioCap.release().then(async function () { - console.info(Tag+'Capturer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /** - * @tc.number : SUB_AUDIO_ON_CAPTURER_CHANGE_006 - * @tc.name : AudioCapturerChange - ON_SOURCE_TYPE_VOICE_COMMUNICATION - * @tc.desc : AudioCapturerChange - ON_SOURCE_TYPE_VOICE_COMMUNICATION - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 -**/ - - it('SUB_AUDIO_ON_CAPTURER_CHANGE_006', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_VOICE_COMMUNICATION, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = false; - - var audioCap; - - audioStreamManagerCB.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManagerCB.off('audioCapturerChange'); - await sleep(100); - console.info(Tag+'[CAPTURER-CHANGE-ON-006] ######### CapturerChange Off is called #########'); - - - await audioCap.release().then(async function () { - console.info(Tag+'Capturer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_ON_CAPTURER_CHANGE_007 - * @tc.name : AudioCapturerChange - STREAMID - * @tc.desc : AudioCapturerChange - STREAMID - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_ON_CAPTURER_CHANGE_007', 0, async function (done) { - var audioCap ; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = false; - audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.off('audioCapturerChange'); - await sleep(100); - console.info(Tag+'[CAPTURER-CHANGE-ON-007] ######### CapturerChange Off is called #########'); - - await audioCap.release().then(async function () { - console.info(Tag+'Capturer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - - /* * - * @tc.number : SUB_AUDIO_ON_CAPTURER_CHANGE_008 - * @tc.name : AudioCapturerChange - CLIENTUID AND CAPTURERFLAG - * @tc.desc : AudioCapturerChange - CLIENTUID AND CAPTURERFLAG - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_ON_CAPTURER_CHANGE_008', 0, async function (done) { - var audioCap ; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = false; - audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.off('audioCapturerChange'); - await sleep(100); - console.info(Tag+'[CAPTURER-CHANGE-ON-008] ######### CapturerChange Off is called #########'); - - await audioCap.release().then(async function () { - console.info(Tag+'Capturer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_ON_CAPTURER_CHANGE_009 - * @tc.name : AudioCapturerChange - DeviceDescriptor - * @tc.desc : AudioCapturerChange - DeviceDescriptor - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_ON_CAPTURER_CHANGE_009', 0, async function (done) { - var audioCap ; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = false; - audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i 0 && dType == 15 && dRole == 1 && sRate!= null && cCount != null && cMask != null) { - resultFlag = true; - } - } - } - }); - await sleep (100); - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCap = data; - console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.off('audioCapturerChange'); - await sleep(100); - console.info(Tag+'[CAPTURER-CHANGE-ON-009] ######### CapturerChange Off is called #########'); - - await audioCap.release().then(async function () { - console.info(Tag+'Capturer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - - /* * - * @tc.number : SUB_AUDIO_OFF_CAPTURER_CHANGE_001 - * @tc.name : AudioCapturerChange - OFF_STATE_PREPARED - * @tc.desc : AudioCapturerChange - OFF_STATE_PREPARED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - * */ - - - it('SUB_AUDIO_OFF_CAPTURER_CHANGE_001', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = true; - - var audioCap; - - audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await audioCap.release().then(async function () { - console.info(Tag+'Capturer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_OFF_CAPTURER_CHANGE_002 - * @tc.name : AudioCapturerChange - OFF_STATE_RUNNING - * @tc.desc : AudioCapturerChange - OFF_STATE_RUNNING - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - * */ - - - it('SUB_AUDIO_OFF_CAPTURER_CHANGE_002', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = true; - var audioCap; - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCap = data; - console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'Capturer start :ERROR : '+err.message); - }); - - await audioCap.release().then(async function () { - console.info(Tag+'Capturer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_OFF_CAPTURER_CHANGE_003 - * @tc.name : AudioCapturerChange - OFF_STATE_STOPPED - * @tc.desc : AudioCapturerChange - OFF_STATE_STOPPED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - * */ - - - it('SUB_AUDIO_OFF_CAPTURER_CHANGE_003', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = true; - var audioCap; - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCap = data; - console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await audioCap.start().then(async function () { - console.info(Tag+'Capturer started :SUCCESS '); - }).catch((err) => { - console.info(Tag+'Capturer start :ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'Capturer stop:ERROR : '+err.message); - }); - - await audioCap.release().then(async function () { - console.info(Tag+'Capturer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - - }) - - /* * - * @tc.number : SUB_AUDIO_OFF_CAPTURER_CHANGE_004 - * @tc.name : AudioCapturerChange - OFF_STATE_RELEASED - * @tc.desc : AudioCapturerChange - OFF_STATE_RELEASED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - * */ - - - it('SUB_AUDIO_OFF_CAPTURER_CHANGE_004', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = true; - var audioCap; - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCap = data; - console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await audioCap.start().then(async function () { - console.info(Tag+'Capturer started :SUCCESS '); - }).catch((err) => { - console.info(Tag+'Capturer start :ERROR : '+err.message); - }); - - await audioCap.stop().then(async function () { - console.info(Tag+'Capturer stopped : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer stop:ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_OFF_CAPTURER_CHANGE_005 - * @tc.name : AudioCapturerChange - DeviceDescriptor - * @tc.desc : AudioCapturerChange - DeviceDescriptor - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - * */ - - - it('SUB_AUDIO_OFF_CAPTURER_CHANGE_005', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = true; - - var audioCap; - - audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i 0 && dType == 15 && dRole == 1 && sRate!= null && cCount != null && cMask != null) { - resultFlag = false; - } - } - } - }); - - await sleep (100); - - audioStreamManager.off('audioCapturerChange'); - await sleep(100); - console.info(Tag+'[CAPTURER-CHANGE-OFF-005] ######### CapturerChange Off is called #########'); - console.info(Tag+'[CAPTURER-CHANGE-OFF-005] ResultFlag is: '+ resultFlag); - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCap = data; - console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await audioCap.release().then(async function () { - console.info(Tag+'Capturer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_GET_CAPTURER_CHANGE_PROMISE_001 - * @tc.name : AudioCapturerChange - GET_STATE_PREPARED - * @tc.desc : AudioCapturerChange - GET_STATE_PREPARED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_GET_CAPTURER_CHANGE_PROMISE_001', 0, async function (done) { - var audioCap ; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = false; - audioStreamManagerCB.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await sleep(100); - - await audioStreamManagerCB.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) { - console.info('AFCapturerChangeLog: [GET_CAP_STA_1_PR] **** Get Promise Called ****'); - if (AudioCapturerChangeInfoArray!=null) { - for (let i=0;i { - console.log(Tag+'getCurrentAudioCapturerInfoArray :ERROR: '+err.message); - resultFlag = false; - }); - - audioStreamManagerCB.off('audioCapturerChange'); - await sleep(100); - console.info(Tag+'[GET_CAPTURER_STATE_1_PR] ## CapCh Off is called ##'); - - await audioCap.release().then(async function () { - console.info(Tag+'Capturer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_GET_CAPTURER_CHANGE_PROMISE_002 - * @tc.name : AudioCapturerChange - GET_STATE_RUNNING - * @tc.desc : AudioCapturerChange - GET_STATE_RUNNING - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - * */ - - - it('SUB_AUDIO_GET_CAPTURER_CHANGE_PROMISE_002', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = false; - - var audioCap; - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCap = data; - console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'Capturer start :ERROR : '+err.message); - }); - - await sleep(100); - - await audioStreamManager.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) { - console.info(Tag+'[GET_CAPTURER_STATE_2_PROMISE] **** Get Promise Called ****'); - if (AudioCapturerChangeInfoArray!=null) { - for (let i=0;i { - console.log(Tag+'getCurrentAudioCapturerInfoArray :ERROR: '+err.message); - resultFlag = false; - }); - - audioStreamManager.off('audioCapturerChange'); - await sleep(100); - console.info(Tag+'[GET_CAPTURER_STATE_2_PROMISE] ######### CapturerChange Off is called #########'); - - await audioCap.release().then(async function () { - console.info(Tag+'Capturer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_GET_CAPTURER_CHANGE_PROMISE_003 - * @tc.name : AudioCapturerChange - GET_STATE_STOPPED - * @tc.desc : AudioCapturerChange - GET_STATE_STOPPED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - * */ - - - it('SUB_AUDIO_GET_CAPTURER_CHANGE_PROMISE_003', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = false; - - var audioCap; - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCap = data; - console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await audioCap.start().then(async function () { - console.info(Tag+'Capturer started :SUCCESS '); - }).catch((err) => { - console.info(Tag+'Capturer start :ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'Capturer stop:ERROR : '+err.message); - }); - - await sleep(100); - - await audioStreamManager.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) { - console.info(Tag+'[GET_CAPTURER_STATE_3_PROMISE] **** Get Promise Called ****'); - if (AudioCapturerChangeInfoArray!=null) { - for (let i=0;i { - console.log(Tag+'getCurrentAudioCapturerInfoArray :ERROR: '+err.message); - resultFlag = false; - }); - - audioStreamManager.off('audioCapturerChange'); - await sleep(100); - console.info(Tag+'[GET_CAPTURER_STATE_3_PROMISE] ######### CapturerChange Off is called #########'); - - await audioCap.release().then(async function () { - console.info(Tag+'Capturer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_GET_CAPTURER_CHANGE_PROMISE_004 - * @tc.name : AudioCapturerChange - DEVICE DESCRIPTOR - * @tc.desc : AudioCapturerChange - DEVICE DESCRIPTOR - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_GET_CAPTURER_CHANGE_PROMISE_004', 0, async function (done) { - var audioCap ; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = false; - audioStreamManagerCB.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await sleep(100); - - await audioStreamManagerCB.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) { - console.info('AFCapturerChangeLog: [GET_CAP_DD_PR] **** Get Promise Called ****'); - if (AudioCapturerChangeInfoArray!=null) { - for (let i=0;i 0 && dType == 15 && dRole == 1 && sRate!= null && cCount != null && cMask != null) { - resultFlag = true; - } - } - } - } - }).catch((err) => { - console.log(Tag+'getCurrentAudioCapturerInfoArray :ERROR: '+err.message); - resultFlag = false; - }); - - audioStreamManagerCB.off('audioCapturerChange'); - await sleep(100); - console.info(Tag+'[GET_CAPTURER_DD_PR] ## CapCh Off is called ##'); - - await audioCap.release().then(async function () { - console.info(Tag+'Capturer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_GET_CAPTURER_CHANGE_CALLBACK_001 - * @tc.name : AudioCapturerChange - GET_STATE_PREPARED - * @tc.desc : AudioCapturerChange - GET_STATE_PREPARED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_GET_CAPTURER_CHANGE_CALLBACK_001', 0, async function (done) { - var audioCap ; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = false; - audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.getCurrentAudioCapturerInfoArray(async (err, AudioCapturerChangeInfoArray) => { - console.info(Tag+'[GET_CAPTURER_STATE_1_CALLBACK] **** Get Callback Called ****'); - await sleep(100); - if (err) { - console.log(Tag+'getCurrentAudioCapturerInfoArray :ERROR: '+err.message); - resultFlag = false; - } - else { - if (AudioCapturerChangeInfoArray !=null) { - for (let i=0;i { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_GET_CAPTURER_CHANGE_CALLBACK_002 - * @tc.name : AudioCapturerChange - GET_STATE_RUNNING - * @tc.desc : AudioCapturerChange - GET_STATE_RUNNING - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - * */ - - - it('SUB_AUDIO_GET_CAPTURER_CHANGE_CALLBACK_002', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = false; - - var audioCap; - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCap = data; - console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManagerCB.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'Capturer start :ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManagerCB.getCurrentAudioCapturerInfoArray(async (err, AudioCapturerChangeInfoArray) => { - console.info(Tag+'[GET_CAPTURER_STATE_2_CALLBACK] **** Get Callback Called ****'); - await sleep(100); - if (err) { - console.log(Tag+'getCurrentAudioCapturerInfoArray :ERROR: '+err.message); - resultFlag = false; - } - else { - if (AudioCapturerChangeInfoArray !=null) { - for (let i=0;i { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_GET_CAPTURER_CHANGE_CALLBACK_003 - * @tc.name : AudioCapturerChange - GET_STATE_STOPPED - * @tc.desc : AudioCapturerChange - GET_STATE_STOPPED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - * */ - - - it('SUB_AUDIO_GET_CAPTURER_CHANGE_CALLBACK_003', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = false; - - var audioCap; - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCap = data; - console.info(Tag+'AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await audioCap.start().then(async function () { - console.info(Tag+'Capturer started :SUCCESS '); - }).catch((err) => { - console.info(Tag+'Capturer start :ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'Capturer stop:ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.getCurrentAudioCapturerInfoArray(async (err, AudioCapturerChangeInfoArray) => { - console.info(Tag+'[GET_CAPTURER_STATE_3_CALLBACK] **** Get Callback Called ****'); - await sleep(100); - if (err) { - console.log(Tag+'getCurrentAudioCapturerInfoArray :ERROR: '+err.message); - resultFlag = false; - } - else { - if (AudioCapturerChangeInfoArray !=null) { - for (let i=0;i { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_GET_CAPTURER_CHANGE_CALLBACK_004 - * @tc.name : AudioCapturerChange - DEVICE DESCRIPTOR - * @tc.desc : AudioCapturerChange - DEVICE DESCRIPTOR - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_GET_CAPTURER_CHANGE_CALLBACK_004', 0, async function (done) { - var audioCap ; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - var resultFlag = false; - audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioCapturer Created : ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.getCurrentAudioCapturerInfoArray(async (err, AudioCapturerChangeInfoArray) => { - console.info(Tag+'[GET_CAPTURER_DD_CALLBACK] **** Get Callback Called ****'); - await sleep(100); - if (err) { - console.log(Tag+'getCurrentAudioCapturerInfoArray :ERROR: '+err.message); - resultFlag = false; - } - else { - if (AudioCapturerChangeInfoArray !=null) { - for (let i=0;i 0 && dType == 15 && dRole == 1 && sRate!= null && cCount != null && cMask!=null){ - resultFlag = true; - } - } - } - } - } - }); - - await sleep(1000); - - audioStreamManager.off('audioCapturerChange'); - await sleep(100); - console.info(Tag+'[GET_CAPTURER_DD_CALLBACK] ######### CapturerChange Off is called #########'); - - await audioCap.release().then(async function () { - console.info(Tag+'Capturer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Capturer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - -}) diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioEventManagement.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioEventManagement.test.js deleted file mode 100644 index cd4fd7f9c9fd7c8d1f612a0b80fdb2d12209c64a..0000000000000000000000000000000000000000 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioEventManagement.test.js +++ /dev/null @@ -1,774 +0,0 @@ -/* - * 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 audio from '@ohos.multimedia.audio'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -describe('audioEM', function () { - console.info('AudioFrameworkTest: Create AudioManger Object JS Framework'); - const audioManager = audio.getAudioManager(); - var deviceRoleValue = null; - var deviceTypeValue = null; - function sleep (ms) { - return new Promise(resolve => setTimeout(resolve, ms)); - } - - function displayDeviceProp(value, index, array) { - var devRoleName; - var devTypeName; - if (value.deviceRole==1) { - devRoleName = 'INPUT_DEVICE'; - } - else if (value.deviceRole==2) { - devRoleName = 'OUTPUT_DEVICE '; - } - else { - devRoleName = 'ERROR : UNKNOWN : '+value.deviceRole; - } - - if (value.deviceType == 1) { - devTypeName = 'EARPIECE'; - } - else if (value.deviceType == 2){ - devTypeName = 'SPEAKER'; - } - else if (value.deviceType == 3){ - devTypeName = 'WIRED_HEADSET'; - } - else if (value.deviceType == 8){ - devTypeName = 'BLUETOOTH_A2DP'; - } - else if (value.deviceType == 15){ - devTypeName = 'MIC'; - } - else { - devTypeName = 'ERROR : UNKNOWN :'+value.deviceType; - } - - console.info(`AudioFrameworkTest: device role: ${devRoleName}`); - deviceRoleValue = value.deviceRole; - console.info(`AudioFrameworkTest: device type: ${devTypeName}`); - deviceTypeValue = value.deviceType; - - } - - beforeAll(function () { - console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level'); - }) - - beforeEach(function () { - console.info('AudioFrameworkTest: beforeEach: Prerequisites at the test case level'); - }) - - afterEach(async function () { - console.info('AudioFrameworkTest: afterEach: Test case-level clearance conditions'); - await sleep(1000); - }) - - afterAll(async function () { - console.info('AudioFrameworkTest: afterAll: Test suite-level cleanup condition'); - - }) - - - /* * - * @tc.number : SUB_AUDIO_MANAGER_getAudioManger_001 - * @tc.name : getAudioManger is Not returned Empty - * @tc.desc : Check getAudioManger is not empty - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getAudioManger_001', 0, function (done) { - if(audioManager!=null){ - console.info('AudioFrameworkTest: getAudioManger : PASS'); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: getAudioManger : FAIL'); - expect(false).assertTrue(); - } - done(); - }) - - - /* * - * @tc.number : SUB_AUDIO_MANAGER_PR_getDevices_output_001 - * @tc.name : getDevices - Output device - Promise - ENAME - * @tc.desc : getDevices - Output device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_PR_getDevices_output_001', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; - const promise = audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG) - promise.then(function (value) { - - console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG'); - value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ - console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS'); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); - expect(false).assertTrue(); - } - }); - await promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_PR_getDevices_output_enum_002 - * @tc.name : getDevices - Output device - Promise - ENAME - - * @tc.desc : getDevices - Output device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_PR_getDevices_output_enum_002', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; - const promise = audioManager.getDevices(1) - promise.then(function (value) { - - console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG'); - value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ - console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS'); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); - expect(false).assertTrue(); - } - }); - await promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_PR_getDevices_input_003 - * @tc.name : getDevices - Input device - Promise - ENAME - * @tc.desc : getDevices - Input device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_PR_getDevices_input_003', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; - const promise = audioManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG); - promise.then(function (value) { - console.info('AudioFrameworkTest: Promise: getDevices INPUT_DEVICES_FLAG'); - value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ - console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS'); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : FAIL'); - expect(false).assertTrue(); - } - }); - await promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_PR_getDevices_input_enum_004 - * @tc.name : getDevices - Input device - Promise - ENAME - * @tc.desc : getDevices - Input device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_PR_getDevices_input_enum_004', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; - const promise = audioManager.getDevices(2); - promise.then(function (value) { - console.info('AudioFrameworkTest: Promise: getDevices INPUT_DEVICES_FLAG'); - value.forEach(displayDeviceProp); - - if (deviceTypeValue != null && deviceRoleValue != null){ - console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS'); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : FAIL'); - expect(false).assertTrue(); - } - }); - await promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_PR_getDevices_all_005 - * @tc.name : getDevices - ALL device - Promise - ENAME - * @tc.desc : getDevices - ALL device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_PR_getDevices_all_005', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; - const promise = audioManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG); - promise.then(function (value) { - console.info('AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG'); - value.forEach(displayDeviceProp); - - if (deviceTypeValue != null && deviceRoleValue != null){ - console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : PASS'); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : FAIL'); - expect(false).assertTrue(); - } - }); - await promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_PR_getDevices_all_enum_006 - * @tc.name : getDevices - ALL device - Promise - ENAME - * @tc.desc : getDevices - ALL device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_PR_getDevices_all_enum_006', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; - const promise = audioManager.getDevices(3); - promise.then(function (value) { - console.info('AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG'); - value.forEach(displayDeviceProp); - - if (deviceTypeValue != null && deviceRoleValue != null){ - console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : PASS'); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : FAIL'); - expect(false).assertTrue(); - } - }); - await promise; - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_CB_getDevices_OUT_007 - * @tc.name : getDevices - Output device - Callback - ENAME - * @tc.desc : getDevices - Output device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_CB_getDevices_OUT_007', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; - audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value) => { - console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); - if (err) { - console.error(`AudioFrameworkTest: Callback: OUTPUT_DEVICES_FLAG: failed to get devices ${err.message}`); - expect().assertFail(); - } - else{ - console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); - value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ - console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS'); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); - expect(false).assertTrue(); - } - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_CB_getDevices_OUT_ENUM_008 - * @tc.name : getDevices - Output device - Callback - ENAME - * @tc.desc : getDevices - Output device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_CB_getDevices_OUT_ENUM_008', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; - audioManager.getDevices(1, (err, value) => { - console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); - if (err) { - console.error(`AudioFrameworkTest: Callback: OUTPUT_DEVICES_FLAG: failed to get devices ${err.message}`); - expect().assertFail(); - } - else{ - console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); - value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ - console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS'); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); - expect(false).assertTrue(); - } - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_CB_getDevices_INPUT_009 - * @tc.name : getDevices - Input device - Callback - ENAME - * @tc.desc : getDevices - Input device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_CB_getDevices_INPUT_009', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; - audioManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG, (err, value) => { - console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); - if (err) { - console.error(`AudioFrameworkTest: Callback: INPUT_DEVICES_FLAG: failed to get devices ${err.message}`); - expect().assertFail(); - } - else{ - console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); - value.forEach(displayDeviceProp); - - if (deviceTypeValue != null && deviceRoleValue != null){ - console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS'); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL'); - expect(false).assertTrue(); - } - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_CB_getDevices_INPUT_ENUM_010 - * @tc.name : getDevices - Input device - Callback - ENAME - * @tc.desc : getDevices - Input device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_CB_getDevices_INPUT_ENUM_010', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; - audioManager.getDevices(2, (err, value) => { - console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); - if (err) { - console.error(`AudioFrameworkTest: Callback: INPUT_DEVICES_FLAG: failed to get devices ${err.message}`); - expect().assertFail(); - } - else{ - console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); - value.forEach(displayDeviceProp); - - if (deviceTypeValue != null && deviceRoleValue != null){ - console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS'); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL'); - expect(false).assertTrue(); - } - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_CB_getDevices_All_011 - * @tc.name : getDevices - ALL device - Callback - ENAME - * @tc.desc : getDevices - ALL device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getDevices_All_011', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; - audioManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG, (err, value) => { - console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); - if (err) { - console.error(`AudioFrameworkTest: Callback: ALL_DEVICES_FLAG: failed to get devices ${err.message}`); - expect().assertFail(); - } - else{ - console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); - value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ - console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS'); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL'); - expect(false).assertTrue(); - } - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_CB_getDevices_All_ENUM_012 - * @tc.name : getDevices - ALL device - Callback - ENAME - * @tc.desc : getDevices - ALL device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_CB_getDevices_All_ENUM_012', 0, async function (done) { - deviceRoleValue = null; - deviceTypeValue = null; - audioManager.getDevices(3, (err, value) => { - console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); - if (err) { - console.error(`AudioFrameworkTest: Callback: ALL_DEVICES_FLAG: failed to get devices ${err.message}`); - expect().assertFail(); - } - else{ - console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); - value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ - console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS'); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL'); - expect(false).assertTrue(); - } - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_PR_Deactivate_015 - * @tc.name : setDeviceActive - SPEAKER - deactivate - Promise - * @tc.desc : Deactivate speaker - Promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_PR_Deactivate_015', 0, async function (done) { - await audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER,false).then(function (){ - // Setting device active ENUM 2 = SPEAKER - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Deactivate'); - audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER).then(function (value){ - if(value==false){ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL :' +value); - expect(false).assertTrue(); - } - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL : Error :' + err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_PR_Deactivate_ENUM_016 - * @tc.name : setDeviceActive - SPEAKER - deactivate - Promise - * @tc.desc : Deactivate speaker - Promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_PR_Deactivate_ENUM_016', 0, async function (done) { - await audioManager.setDeviceActive(2,true).then(function (){ - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Active'); - }); - await audioManager.setDeviceActive(2,false).then(function (){ - // Setting device active ENUM 2 = SPEAKER - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Deactivate'); - audioManager.isDeviceActive(2).then(function (value){ - if(value==false){ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL :' +value); - expect(false).assertTrue(); - } - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL : Error :' + err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_PR_Activate_017 - * @tc.name : setDeviceActive - SPEAKER - Activate - Promise - * @tc.desc : Activate speaker - Promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_PR_Activate_017', 0, async function (done) { - await audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER,true).then(function (){ - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Activate'); - audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER).then(function (value){ - if(value==true){ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :' +value); - expect(false).assertTrue(); - } - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :Error :' + err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_PR_Activate_ENUM_018 - * @tc.name : setDeviceActive - SPEAKER - Activate - Promise - * @tc.desc : Activate speaker - Promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_PR_Activate_ENUM_018', 0, async function (done) { - await audioManager.setDeviceActive(2,true).then(function (){ - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Activate'); - audioManager.isDeviceActive(2).then(function (value){ - if(value==true){ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :' +value); - expect(false).assertTrue(); - } - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :Error :' + err.message); - expect(false).assertTrue(); - }); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_CB_DEACTIVATE_023 - * @tc.name : setDeviceActive - SPEAKER - deactivate - Callback - * @tc.desc : Deactivate speaker - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_CB_DEACTIVATE_023', 0, async function (done) { - audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER,false, (err) => { - if (err) { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`); - expect(false).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); - audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER,(err, value) => { - if (err) { - console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`); - expect(false).assertTrue(); - } - else if(value==false){ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : FAIL :' +value); - expect(false).assertTrue(); - } - done(); - }); - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_CB_DEACTIVATE_ENUM_024 - * @tc.name : setDeviceActive - SPEAKER - deactivate - Callback - * @tc.desc : Deactivate speaker - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_CB_DEACTIVATE_ENUM_024', 0, async function (done) { - await audioManager.setDeviceActive(2,true).then(function (){ - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER : Active'); - }); - audioManager.setDeviceActive(2,false, (err) => { - if (err) { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`); - expect(false).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); - audioManager.isDeviceActive(2,(err, value) => { - if (err) { - console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`); - expect(false).assertTrue(); - } - else if(value==false){ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : FAIL :' +value); - expect(false).assertTrue(); - } - done(); - }); - } - done(); - }); - }) - - - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_CB_ACTIVATE_025 - * @tc.name : setDeviceActive - SPEAKER - activate - Callback - * @tc.desc : Activate speaker - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_CB_ACTIVATE_025', 0, async function (done) { - audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER,true, (err) => { - if (err) { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active: Error: ${err.message}`); - expect(false).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); - audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER,(err, value) => { - if (err) { - console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active: Error: ${err.message}`); - expect(false).assertTrue(); - } - else if(value==true){ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : FAIL :' +value); - expect(false).assertTrue(); - } - done(); - }); - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_CB_ACTIVATE_ENUM_026 - * @tc.name : setDeviceActive - SPEAKER - activate - Callback - * @tc.desc : Activate speaker - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_CB_ACTIVATE_ENUM_026 ', 0, async function (done) { - audioManager.setDeviceActive(2,true, (err) => { - if (err) { - console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active: Error: ${err.message}`); - expect(false).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); - audioManager.isDeviceActive(2,(err, value) => { - if (err) { - console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active: Error: ${err.message}`); - expect(false).assertTrue(); - } - else if(value==true){ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : FAIL :' +value); - expect(false).assertTrue(); - } - done(); - }); - } - done(); - }); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_DeviceChangeType_001 - * @tc.name : DeviceChangeType - CONNECT - * @tc.desc : DeviceChangeType - CONNECT - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_DeviceChangeType_001', 0, async function (done) { - expect(audio.DeviceChangeType.CONNECT).assertEqual(0); - await sleep(50); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_DeviceChangeType_002 - * @tc.name : DeviceChangeType - DISCONNECT - * @tc.desc : DeviceChangeType - DISCONNECT - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_DeviceChangeType_002', 0, async function (done) { - expect(audio.DeviceChangeType.DISCONNECT).assertEqual(1); - await sleep(50); - done(); - }) - - -}) \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js index ad76e4642c9897e71222af5b6609e7d88456f524..f2f86107d6dac714bf8b24039f70da9a607e3505 100755 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js @@ -13,38 +13,45 @@ * limitations under the License. */ - import audio from '@ohos.multimedia.audio'; - +import * as audioTestBase from '../../../../../AudioTestBase' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; -describe('audioManager', function () { +describe('audioFramework', function () { console.info('AudioFrameworkTest: Create AudioManger Object JS Framework'); - const audioManager = audio.getAudioManager(); - var dRValue = null; - var dTValue = null; - var devId = null; - var devName = null; - var devAddr = null; - var sRate = null; - var cCount = null; - var cMask = null; - var audioMedia = 3; - var audioRingtone = 2; - var minVol = 0; - var maxVol = 15; - var lowVol = 5; - var highVol = 14; - var outOfRangeVol = 28; - var longValue = '28374837458743875804735081439085918459801437584738967509184509813904850914375904790589104801843'; - + let audioManager = null; + let dRValue = null; + let dTValue = null; + let devId = null; + let devName = null; + let devAddr = null; + let sRate = null; + let cCount = null; + let cMask = null; + let audioMedia = 3; + let audioRingtone = 2; + let minVol = 0; + let maxVol = 15; + let lowVol = 5; + let highVol = 14; + let outOfRangeVol = 28; + let longValue = '28374837458743875804735081439085918459801437584738967509184509813904850914375904790589104801843'; + function getAudioManager() { + audioManager = audio.getAudioManager(); + if (audioManager != null) { + console.info('AudioFrameworkTest: getAudioManger : PASS'); + } + else { + console.info('AudioFrameworkTest: getAudioManger : FAIL'); + } + } function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } function displayDeviceProp(value, index, array) { - var devRoleName; - var devTypeName; + let devRoleName; + let devTypeName; if (value.deviceRole == 1) { devRoleName = 'INPUT_DEVICE'; } @@ -92,8 +99,17 @@ describe('audioManager', function () { cMask = value.channelMasks; } - beforeAll(function () { + beforeAll(async function () { console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level'); + let permissionName1 = 'ohos.permission.MICROPHONE'; + let permissionName2 = 'ohos.permission.ACCESS_NOTIFICATION_POLICY'; + let permissionName3 = 'ohos.permission.MODIFY_AUDIO_SETTINGS'; + let permissionNameList = [permissionName1, permissionName2, permissionName3]; + let appName = 'ohos.acts.multimedia.audio.audiomanager'; + await audioTestBase.applyPermission(appName, permissionNameList); + await sleep(100); + await getAudioManager(); + console.info('AudioFrameworkTest: beforeAll: END'); }) beforeEach(async function () { @@ -110,177 +126,151 @@ describe('audioManager', function () { console.info('AudioFrameworkTest: afterAll: Test suite-level cleanup condition'); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getAudioManger_001 - * @tc.name : getAudioManger is Not returned Empty - * @tc.desc : Check getAudioManger is not empty - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getAudioManger_001', 0, function (done) { - if (audioManager != null) { - console.info('AudioFrameworkTest: getAudioManger : PASS'); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: getAudioManger : FAIL'); - expect(false).assertTrue(); - } - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_getAudioManger_002 - * @tc.name : getAudioManger - Multiple instance - * @tc.desc : multiple times with different instance - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getAudioManger_002', 0, async function (done) { - const audioManager1 = audio.getAudioManager(); - const audioManager2 = audio.getAudioManager(); - const audioManager3 = audio.getAudioManager(); - const audioManager4 = audio.getAudioManager(); - const audioManager5 = audio.getAudioManager(); - const audioManager6 = audio.getAudioManager(); - const audioManager7 = audio.getAudioManager(); - const audioManager8 = audio.getAudioManager(); - const audioManager9 = audio.getAudioManager(); - const audioManager10 = audio.getAudioManager(); - const promise = audioManager.setVolume(audioMedia, lowVol); - promise.then(function () { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOMANAGER_0200 + *@tc.name : getAudioManger - Multiple instance + *@tc.desc : multiple times with different instance + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOMANAGER_0200', 1, async function (done) { + try { + const AUDIOMANAGER1 = audio.getAudioManager(); + const AUDIOMANAGER2 = audio.getAudioManager(); + const AUDIOMANAGER3 = audio.getAudioManager(); + const AUDIOMANAGER4 = audio.getAudioManager(); + const AUDIOMANAGER5 = audio.getAudioManager(); + const AUDIOMANAGER6 = audio.getAudioManager(); + const AUDIOMANAGER7 = audio.getAudioManager(); + const AUDIOMANAGER8 = audio.getAudioManager(); + const AUDIOMANAGER9 = audio.getAudioManager(); + const AUDIOMANAGER10 = audio.getAudioManager(); + await audioManager.setVolume(audioMedia, lowVol); console.info('AudioFrameworkTest: Media setVolume promise: successful'); - audioManager1.setVolume(audioMedia, highVol); + await AUDIOMANAGER1.setVolume(audioMedia, highVol); console.info('AudioFrameworkTest:audioManager1 : Media setVolume promise: successful'); - audioManager2.setVolume(audioMedia, highVol); + await AUDIOMANAGER2.setVolume(audioMedia, highVol); console.info('AudioFrameworkTest:audioManager2 : Media setVolume promise: successful'); - audioManager3.setVolume(audioMedia, highVol); + await AUDIOMANAGER3.setVolume(audioMedia, highVol); console.info('AudioFrameworkTest:audioManager3 : Media setVolume promise: successful'); - audioManager4.setVolume(audioMedia, lowVol); + await AUDIOMANAGER4.setVolume(audioMedia, lowVol); console.info('AudioFrameworkTest:audioManager4 : Media setVolume promise: successful'); - audioManager5.setVolume(audioMedia, highVol); + await AUDIOMANAGER5.setVolume(audioMedia, highVol); console.info('AudioFrameworkTest:audioManager5 : Media setVolume promise: successful'); - audioManager6.setVolume(audioMedia, lowVol); + await AUDIOMANAGER6.setVolume(audioMedia, lowVol); console.info('AudioFrameworkTest:audioManager6 : Media setVolume promise: successful'); - audioManager7.setVolume(audioMedia, highVol); + await AUDIOMANAGER7.setVolume(audioMedia, highVol); console.info('AudioFrameworkTest:audioManager7 : Media setVolume promise: successful'); - audioManager8.setVolume(audioMedia, lowVol); + await AUDIOMANAGER8.setVolume(audioMedia, lowVol); console.info('AudioFrameworkTest:audioManager8 : Media setVolume promise: successful'); - audioManager9.setVolume(audioMedia, highVol); + await AUDIOMANAGER9.setVolume(audioMedia, highVol); console.info('AudioFrameworkTest:audioManager9 : Media setVolume promise: successful'); - audioManager10.setVolume(audioMedia, lowVol); + await AUDIOMANAGER10.setVolume(audioMedia, lowVol); console.info('AudioFrameworkTest:audioManager10 : Media setVolume promise: successful'); - audioManager.getVolume(audioMedia).then(function (data) { - if (data == lowVol) { - console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data); - expect(false).assertTrue(); - } - }).catch((err) => { - console.info('AudioFrameworkTest: Media getVolume Promise: Error :' + err.message); - }); - }); - await promise; + let data = await audioManager.getVolume(audioMedia); + if (data == lowVol) { + console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data); + expect(false).assertTrue(); + } + } catch (err) { + console.info('AudioFrameworkTest: Media getVolume Promise: Error :' + err.message); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_001 - * @tc.name : setVolume - Media - Promise - * @tc.desc : Setvol to 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_001', 0, async function (done) { - const promise = audioManager.setVolume(audioMedia, lowVol); - promise.then(function () { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0100 + *@tc.name : setVolume - Media - Promise + *@tc.desc : Setvol to 1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0100', 1, async function (done) { + try { + await audioManager.setVolume(audioMedia, lowVol); console.info('AudioFrameworkTest: Media setVolume promise: successful'); - audioManager.getVolume(audioMedia).then(function (data) { - if (data == lowVol) { - console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data); - expect(false).assertTrue(); - } - }); - }); - await promise; + let data = await audioManager.getVolume(audioMedia); + if (data == lowVol) { + console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_002 - * @tc.name : setVolume - Media - Promise - MAX Volume - * @tc.desc : Setvol to 15 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_002', 0, async function (done) { - const promise = audioManager.setVolume(audioMedia, maxVol); - promise.then(function () { - console.info('AudioFrameworkTest: Media setVolume promise: successful'); - audioManager.getVolume(audioMedia).then(function (data) { - if (data == maxVol) { - console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0200 + *@tc.name : setVolume - Media - Promise - MAX Volume + *@tc.desc : Setvol to 15 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0200', 2, async function (done) { + try { + await audioManager.setVolume(audioMedia, maxVol); + let data = await audioManager.getVolume(audioMedia); + if (data == maxVol) { + console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_003 - * @tc.name : setVolume - Media - Promise - Mute Volume - * @tc.desc : Setvol to 0 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_003', 0, async function (done) { - const promise = audioManager.setVolume(audioMedia, minVol); - promise.then(function () { - console.info('AudioFrameworkTest: Media setVolume promise: successful'); - - audioManager.getVolume(audioMedia).then(function (data) { - if (data == minVol) { - console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0300 + *@tc.name : setVolume - Media - Promise - Mute Volume + *@tc.desc : Setvol to 0 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0300', 2, async function (done) { + try { + await audioManager.setVolume(audioMedia, minVol); + let data = await audioManager.getVolume(audioMedia); + if (data == minVol) { + console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_004 - * @tc.name : setVolume - Media - Promise - Out of range Volume - * @tc.desc : Setvol to 28 (More than 15) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_004', 0, async function (done) { - console.info('AudioFrameworkTest: Media setVolume Promise:Out of range: Setvol 100'); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0400 + *@tc.name : setVolume - Media - Promise - Out of range Volume + *@tc.desc : Setvol to 28 (More than 15) + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0400', 2, async function (done) { await audioManager.setVolume(audioMedia, outOfRangeVol).then(() => { console.info('AudioFrameworkTest: Media setVolume Promise:Out of range: FAIL'); expect(false).assertTrue(); @@ -291,129 +281,119 @@ describe('audioManager', function () { done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_005 - * @tc.name : setVolume - Media - Callback - * @tc.desc : Setvol to 14 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_005', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0500 + *@tc.name : setVolume - Media - Callback + *@tc.desc : Setvol to 14 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0500', 2, async function (done) { audioManager.setVolume(audioMedia, highVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`); expect(false).assertTrue(); - } - else { + done(); + } else { console.info(`AudioFrameworkTest: callback : Media setVolume successful `); audioManager.getVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media: failed to get volume ${err.message}`); expect(false).assertTrue(); - } - else if (value == highVol) { + } else if (value == highVol) { console.info('AudioFrameworkTest: callback : Media getVolume: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Media getVolume: FAIL :' + value); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_006 - * @tc.name : setVolume - Media - Callback - MAX Volume - * @tc.desc : Setvol to 15 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_006', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0600 + *@tc.name : setVolume - Media - Callback - MAX Volume + *@tc.desc : Setvol to 15 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0600', 2, async function (done) { audioManager.setVolume(audioMedia, maxVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`); expect(false).assertTrue(); - } - else { + done(); + } else { console.info(`AudioFrameworkTest: callback : Media setVolume successful `); audioManager.getVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media: failed to get volume ${err.message}`); expect(false).assertTrue(); - } - else if (value == maxVol) { + } else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Media getVolume: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Media getVolume: FAIL :' + value); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_007 - * @tc.name : setVolume - Media - Callback - Mute Volume - * @tc.desc : Setvol to 0 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_007', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0700 + *@tc.name : setVolume - Media - Callback - Mute Volume + *@tc.desc : Setvol to 0 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0700', 2, async function (done) { audioManager.setVolume(audioMedia, minVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`); expect(false).assertTrue(); - } - else { + done(); + } else { console.info(`AudioFrameworkTest: callback : Media setVolume successful `); audioManager.getVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media: failed to get volume ${err.message}`); expect(false).assertTrue(); - } - else if (value == minVol) { + } else if (value == minVol) { console.info('AudioFrameworkTest: callback : Media getVolume: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Media getVolume: FAIL :' + value); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_008 - * @tc.name : setVolume - Media - Callback - Out of range Volume - * @tc.desc : Setvol to 20 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_008', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0800 + *@tc.name : setVolume - Media - Callback - Out of range Volume + *@tc.desc : Setvol to 20 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0800', 2, async function (done) { audioManager.setVolume(audioMedia, outOfRangeVol, (err) => { if (err) { console.error(`AudioFrameworkTest: setVolume: Out of range: Callback: PASS: ${err.message}`); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: setVolume: callback : Media Out of range: FAIL'); expect(false).assertTrue(); } @@ -421,96 +401,93 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_009 - * @tc.name : setVolume - Ringtone - Promise - * @tc.desc : Setvol to 5 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_009', 0, async function (done) { - const promise = audioManager.setVolume(audioRingtone, lowVol); - promise.then(function () { - console.info('AudioFrameworkTest: Ringtone setVolume promise: successful'); - audioManager.getVolume(audioRingtone).then(function (data) { - if (data == lowVol) { - console.info('AudioFrameworkTest: Ringtone getVolume Promise: PASS :' + data); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Ringtone getVolume Promise: FAIL :' + data); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0900 + *@tc.name : setVolume - Ringtone - Promise + *@tc.desc : Setvol to 5 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_0900', 2, async function (done) { + try { + await audioManager.setVolume(audioRingtone, lowVol); + let data = await audioManager.getVolume(audioRingtone); + if (data == lowVol) { + console.info('AudioFrameworkTest: Ringtone getVolume Promise: PASS :' + data); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Ringtone getVolume Promise: FAIL :' + data); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_010 - * @tc.name : setVolume - Ringtone - Promise - MAX Volume - * @tc.desc : Setvol to 15 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_010', 0, async function (done) { - const promise = audioManager.setVolume(audioRingtone, maxVol); - promise.then(function () { - console.info('AudioFrameworkTest: Ringtone setVolume promise: successful'); - audioManager.getVolume(audioRingtone).then(function (data) { - if (data == maxVol) { - console.info('AudioFrameworkTest: Ringtone getVolume Promise: PASS :' + data); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Ringtone getVolume Promise: FAIL :' + data); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1000 + *@tc.name : setVolume - Ringtone - Promise - MAX Volume + *@tc.desc : Setvol to 15 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1000', 2, async function (done) { + try { + await audioManager.setVolume(audioRingtone, maxVol); + let data = await audioManager.getVolume(audioRingtone); + if (data == maxVol) { + console.info('AudioFrameworkTest: Ringtone getVolume Promise: PASS :' + data); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Ringtone getVolume Promise: FAIL :' + data); + expect(false).assertTrue(); + } + } catch (err) { + console.info('err :' + err); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_011 - * @tc.name : setVolume - Ringtone - Promise - Mute Volume - * @tc.desc : Setvol to 0 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_011', 0, async function (done) { - const promise = audioManager.setVolume(audioRingtone, minVol); - promise.then(function () { - console.info('AudioFrameworkTest: Ringtone setVolume promise: successful'); - audioManager.getVolume(audioRingtone).then(function (data) { - if (data == minVol) { - console.info('AudioFrameworkTest: Ringtone getVolume Promise: PASS :' + data); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Ringtone getVolume Promise: FAIL :' + data); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1100 + *@tc.name : setVolume - Ringtone - Promise - Mute Volume + *@tc.desc : Setvol to 0 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1100', 2, async function (done) { + try { + await audioManager.setVolume(audioRingtone, minVol); + let data = await audioManager.getVolume(audioRingtone); + if (data == minVol) { + console.info('AudioFrameworkTest: Ringtone getVolume Promise: PASS :' + data); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Ringtone getVolume Promise: FAIL :' + data); + expect(false).assertTrue(); + } + } catch (err) { + console.info('err :' + err); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_012 - * @tc.name : setVolume - Ringtone - Promise - Out of range Volume - * @tc.desc : Setvol to 30 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_012', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1200 + *@tc.name : setVolume - Ringtone - Promise - Out of range Volume + *@tc.desc : Setvol to 30 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1200', 2, async function (done) { console.info('AudioFrameworkTest: Ringtone setVolume Promise: Out of range: Setvol 30'); await audioManager.setVolume(audioRingtone, outOfRangeVol).then(() => { console.info('AudioFrameworkTest: Ringtone setVolume Promise:Out of range: FAIL'); @@ -522,19 +499,20 @@ describe('audioManager', function () { done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_013 - * @tc.name : setVolume - Ringtone - Callback - * @tc.desc : Setvol to 7 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_013', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1300 + *@tc.name : setVolume - Ringtone - Callback + *@tc.desc : Setvol to 7 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1300', 2, async function (done) { audioManager.setVolume(audioRingtone, highVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`); expect(false).assertTrue(); + done(); } else { console.info(`AudioFrameworkTest: callback : Ringtone setVolume successful `); @@ -542,110 +520,99 @@ describe('audioManager', function () { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone: failed to get volume ${err.message}`); expect(false).assertTrue(); - } - else if (value == highVol) { + } else if (value == highVol) { console.info('AudioFrameworkTest: callback : Ringtone getVolume: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Ringtone getVolume: FAIL :' + value); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_014 - * @tc.name : setVolume - Ringtone - Callback - MAX Volume - * @tc.desc : Setvol to 15 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_014', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1400 + *@tc.name : setVolume - Ringtone - Callback - MAX Volume + *@tc.desc : Setvol to 15 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1400', 2, async function (done) { audioManager.setVolume(audioRingtone, maxVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`); expect(false).assertTrue(); - } - - else { + done(); + } else { console.info(`AudioFrameworkTest: callback : Ringtone setVolume successful `); audioManager.getVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone: failed to get volume ${err.message}`); expect(false).assertTrue(); - } - else if (value == maxVol) { + } else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Ringtone getVolume: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Ringtone getVolume: FAIL :' + value); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_015 - * @tc.name : setVolume - Ringtone - Callback - Mute Volume - * @tc.desc : Setvol to 0 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_015', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1500 + *@tc.name : setVolume - Ringtone - Callback - Mute Volume + *@tc.desc : Setvol to 0 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1500', 2, async function (done) { audioManager.setVolume(audioRingtone, minVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`); expect(false).assertTrue(); - } - else { + done(); + } else { console.info(`AudioFrameworkTest: callback : Ringtone setVolume successful `); audioManager.getVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone: failed to get volume ${err.message}`); expect(false).assertTrue(); - } - else if (value == minVol) { + } else if (value == minVol) { console.info('AudioFrameworkTest: callback : Ringtone getVolume: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Ringtone getVolume: FAIL :' + value); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_016 - * @tc.name : setVolume - Ringtone - Callback - Out of range Volume - * @tc.desc : Setvol to 28 (more than max volume 15) - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_016', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1600 + *@tc.name : setVolume - Ringtone - Callback - Out of range Volume + *@tc.desc : Setvol to 28 (more than max volume 15) + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1600', 2, async function (done) { audioManager.setVolume(audioRingtone, outOfRangeVol, (err) => { if (err) { console.error(`AudioFrameworkTest: Out of range Volume: Callback: ${err.message}`); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Out of range Volume: callback : Ringtone set volume: FAIL'); expect(false).assertTrue(); } @@ -653,15 +620,15 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_017 - * @tc.name : setVolume - Media - Promise - Negative Value - * @tc.desc : Setvol to -1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_017', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1700 + *@tc.name : setVolume - Media - Promise - Negative Value + *@tc.desc : Setvol to -1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1700', 2, async function (done) { console.info('AudioFrameworkTest: Media setVolume promise: Negative Value -1'); await audioManager.setVolume(audioMedia, -1).then(() => { // Setting negative audio volume for error Scenario @@ -674,22 +641,21 @@ describe('audioManager', function () { done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_018 - * @tc.name : setVolume - Media - Callback - Negative Value - * @tc.desc : Setvol to -1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_018', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1800 + *@tc.name : setVolume - Media - Callback - Negative Value + *@tc.desc : Setvol to -1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1800', 2, async function (done) { audioManager.setVolume(audioMedia, -1, (err) => { // Setting negative audio volume for error Scenario if (err) { console.error(`AudioFrameworkTest: setVolume Callback: Negative: PASS: ${err.message}`); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: setVolume callback : Media Negative: FAIL'); expect(false).assertTrue(); } @@ -697,15 +663,15 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_019 - * @tc.name : setVolume - Ringtone - Promise - Negative Value - * @tc.desc : Setvol to -1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_019', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1900 + *@tc.name : setVolume - Ringtone - Promise - Negative Value + *@tc.desc : Setvol to -1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_1900', 2, async function (done) { console.info('AudioFrameworkTest: Ringtone setVolume promise: Negative'); await audioManager.setVolume(audioRingtone, -1).then(() => { // Setting negative audio volume for error Scenario @@ -718,22 +684,21 @@ describe('audioManager', function () { done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_020 - * @tc.name : setVolume - Ringtone - Callback - Negative Value - * @tc.desc : Setvol to -1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_020', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2000 + *@tc.name : setVolume - Ringtone - Callback - Negative Value + *@tc.desc : Setvol to -1 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2000', 2, async function (done) { audioManager.setVolume(audioRingtone, -1, (err) => { // Setting negative audio volume for error Scenario if (err) { console.error(`AudioFrameworkTest:Ringtone setVolume Callback:Negative: PASS : ${err.message}`); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: setVolume: Negative: callback : Ringtone set volume: FAIL'); expect(false).assertTrue(); } @@ -741,303 +706,301 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_021 - * @tc.name : setVolume - Media - Promise - ENAME - * @tc.desc : Setvol to 5 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_021', 0, async function (done) { - const promise = audioManager.setVolume(audio.AudioVolumeType.MEDIA, lowVol); - promise.then(function () { - audioManager.getVolume(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == lowVol) { - console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : PASS :' + data); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : FAIL :' + data); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2100 + *@tc.name : setVolume - Media - Promise - ENAME + *@tc.desc : Setvol to 5 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2100', 2, async function (done) { + try { + await audioManager.setVolume(audio.AudioVolumeType.MEDIA, lowVol); + let data = await audioManager.getVolume(audio.AudioVolumeType.MEDIA); + if (data == lowVol) { + console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : PASS :' + data); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : FAIL :' + data); + expect(false).assertTrue(); + } + } catch (err) { + console.info('err :' + err); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_022 - * @tc.name : setVolume - Media - Callback - ENAME - * @tc.desc : Setvol to 14 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_022', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2200 + *@tc.name : setVolume - Media - Callback - ENAME + *@tc.desc : Setvol to 14 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2200', 2, async function (done) { audioManager.setVolume(audio.AudioVolumeType.MEDIA, highVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ENAME : ${err.message}`); expect(false).assertTrue(); - } - else { + done(); + } else { console.info(`AudioFrameworkTest: callback : ENAME : Media setVolume successful `); audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media: ENAME : Error ${err.message}`); expect(false).assertTrue(); - } - else if (value == highVol) { + } else if (value == highVol) { console.info('AudioFrameworkTest: callback : Media getVolume: ENAME : PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Media getVolume: ENAME : FAIL :' + value); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_023 - * @tc.name : setVolume - Ringtone - Promise - ENAME - * @tc.desc : Setvol to 14 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_023', 0, async function (done) { - const promise = audioManager.setVolume(audio.AudioVolumeType.RINGTONE, highVol); - promise.then(function () { - console.info('AudioFrameworkTest: Ringtone setVolume promise: ENAME: successful'); - audioManager.getVolume(audio.AudioVolumeType.RINGTONE).then(function (data) { - if (data == highVol) { - console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: PASS :' + data); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: FAIL :' + data); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2300 + *@tc.name : setVolume - Ringtone - Promise - ENAME + *@tc.desc : Setvol to 14 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2300', 2, async function (done) { + try { + await audioManager.setVolume(audio.AudioVolumeType.RINGTONE, highVol); + let data = await audioManager.getVolume(audio.AudioVolumeType.RINGTONE); + if (data == highVol) { + console.info('AudioFrameworkTest: RINGTONE getVolume Promise: ENAME : PASS :' + data); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: RINGTONE getVolume Promise: ENAME : FAIL :' + data); + expect(false).assertTrue(); + } + } catch (err) { + console.info('err :' + err); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_024 - * @tc.name : setVolume - Ringtone - Callback - ENAME - * @tc.desc : Setvol to 5 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_024', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2400 + *@tc.name : setVolume - Ringtone - Callback - ENAME + *@tc.desc : Setvol to 5 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2400', 2, async function (done) { audioManager.setVolume(audio.AudioVolumeType.RINGTONE, lowVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ENAME: ${err.message}`); expect(false).assertTrue(); - } - else { + done(); + } else { console.info(`AudioFrameworkTest: callback : ENAME: Ringtone setVolume successful `); audioManager.getVolume(audio.AudioVolumeType.RINGTONE, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone: ENAME: failed to get volume ${err.message}`); expect(false).assertTrue(); - } - else if (value == lowVol) { + } else if (value == lowVol) { console.info('AudioFrameworkTest: callback : Ringtone getVolume: ENAME: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Ringtone getVolume: ENAME: FAIL :' + value); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_025 - * @tc.name : setVolume - Media - Promise - Change Ringtone vol - * @tc.desc : Setvol to 5 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_025', 0, async function (done) { - const promise = audioManager.setVolume(audio.AudioVolumeType.MEDIA, lowVol); - promise.then(function () { - audioManager.setVolume(audio.AudioVolumeType.RINGTONE, maxVol); - audioManager.getVolume(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == lowVol) { - console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : PASS :' + data); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : FAIL :' + data); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2500 + *@tc.name : setVolume - Media - Promise - Change Ringtone vol + *@tc.desc : Setvol to 5 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2500', 2, async function (done) { + try { + await audioManager.setVolume(audio.AudioVolumeType.MEDIA, lowVol); + await audioManager.setVolume(audio.AudioVolumeType.RINGTONE, maxVol) + let data = await audioManager.getVolume(audio.AudioVolumeType.MEDIA); + if (data == lowVol) { + console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : PASS :' + data); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : FAIL :' + data); + expect(false).assertTrue(); + } + } catch (err) { + console.info('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_026 - * @tc.name : setVolume - Media - Callback - Change Ringtone vol - * @tc.desc : Setvol to 14 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_026', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2600 + *@tc.name : setVolume - Media - Callback - Change Ringtone vol + *@tc.desc : Setvol to 14 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2600', 2, async function (done) { audioManager.setVolume(audio.AudioVolumeType.MEDIA, highVol, (err) => { if (err) { - console.error(`AudioFrameworkTest: failed to set volume: Callback: ENAME : ${err.message}`); + console.error(`AudioFrameworkTest: failed to set volume MEDIA: Callback: ENAME : ${err.message}`); expect(false).assertTrue(); - } - else { + done(); + } else { console.info(`AudioFrameworkTest: callback : ENAME : Media setVolume successful `); - audioManager.setVolume(audio.AudioVolumeType.RINGTONE, lowVol); - audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => { + audioManager.setVolume(audio.AudioVolumeType.RINGTONE, lowVol, (err) => { if (err) { - console.error(`AudioFrameworkTest: callback : Media: ENAME : Error: ${err.message}`); - expect(false).assertTrue(); - } - else if (value == highVol) { - console.info('AudioFrameworkTest: callback : Media getVolume: ENAME : PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: callback : Media getVolume: ENAME : FAIL :' + value); + console.error(`AudioFrameworkTest: failed to set volume RINGTONE: Callback: ENAME : ${err.message}`); expect(false).assertTrue(); + done(); + } else { + audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => { + if (err) { + console.error(`AudioFrameworkTest: callback : Media: ENAME : Error: ${err.message}`); + expect(false).assertTrue(); + } else if (value == highVol) { + console.info('AudioFrameworkTest: callback : Media getVolume: ENAME : PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: callback : Media getVolume: ENAME : FAIL :' + value); + expect(false).assertTrue(); + } + done(); + }); } - done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_027 - * @tc.name : setVolume - Ringtone - Promise - Change Media vol - * @tc.desc : Setvol to 14 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_027', 0, async function (done) { - const promise = audioManager.setVolume(audio.AudioVolumeType.RINGTONE, highVol); - promise.then(function () { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2700 + *@tc.name : setVolume - Ringtone - Promise - Change Media vol + *@tc.desc : Setvol to 14 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2700', 2, async function (done) { + try { + await audioManager.setVolume(audio.AudioVolumeType.RINGTONE, highVol); console.info('AudioFrameworkTest: Ringtone setVolume promise: ENAME: successful'); - audioManager.setVolume(audio.AudioVolumeType.MEDIA, lowVol); - audioManager.getVolume(audio.AudioVolumeType.RINGTONE).then(function (data) { - if (data == highVol) { - console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: PASS :' + data); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: FAIL :' + data); - expect(false).assertTrue(); - } - }); - }); - await promise; + await audioManager.setVolume(audio.AudioVolumeType.MEDIA, lowVol); + let data = await audioManager.getVolume(audio.AudioVolumeType.RINGTONE); + if (data == highVol) { + console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: PASS :' + data); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: FAIL :' + data); + expect(false).assertTrue(); + } + } catch (err) { + console.info('err=' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_SetVolume_028 - * @tc.name : setVolume - Ringtone - Callback - Change Media vol - * @tc.desc : Setvol to 5 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_SetVolume_028', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2800 + *@tc.name : setVolume - Ringtone - Callback - Change Media vol + *@tc.desc : Setvol to 5 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETVOLUME_2800', 2, async function (done) { audioManager.setVolume(audio.AudioVolumeType.RINGTONE, lowVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ENAME: ${err.message}`); expect(false).assertTrue(); - } - else { + done(); + } else { console.info(`AudioFrameworkTest: callback : ENAME: Ringtone setVolume successful `); - audioManager.setVolume(audio.AudioVolumeType.MEDIA, highVol); - audioManager.getVolume(audio.AudioVolumeType.RINGTONE, (err, value) => { + audioManager.setVolume(audio.AudioVolumeType.MEDIA, highVol, (err) => { if (err) { - console.error(`AudioFrameworkTest: callback : Ringtone: ENAME: failed to get volume ${err.message}`); - expect(false).assertTrue(); - } - else if (value == lowVol) { - console.info('AudioFrameworkTest: callback : Ringtone getVolume: ENAME: PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: callback : Ringtone getVolume: ENAME: FAIL :' + value); + console.error(`AudioFrameworkTest: failed to setVolume: Callback: ENAME: ${err.message}`); expect(false).assertTrue(); + done(); + } else { + audioManager.getVolume(audio.AudioVolumeType.RINGTONE, (err, value) => { + if (err) { + console.error(`AudioFrameworkTest: callback : Ringtone: ENAME: failed to get volume ${err.message}`); + expect(false).assertTrue(); + } else if (value == lowVol) { + console.info('AudioFrameworkTest: callback : Ringtone getVolume: ENAME: PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: callback : Ringtone getVolume: ENAME: FAIL :' + value); + expect(false).assertTrue(); + } + done(); + }); } - done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMaxVolume_001 - * @tc.name : getMaxVolume - Media - Promise - * @tc.desc : getMaxVolume for Media - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMaxVolume_001', 0, async function (done) { - const promise = audioManager.getMaxVolume(audioMedia); - promise.then(function (data) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0100 + *@tc.name : getMaxVolume - Media - Promise + *@tc.desc : getMaxVolume for Media + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0100', 1, async function (done) { + const PROMISE = audioManager.getMaxVolume(audioMedia); + PROMISE.then(function (data) { if (data == maxVol) { console.info('AudioFrameworkTest: Media getMaxVolume promise : PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Media getMaxVolume promise : FAIL: ' + data); expect(false).assertTrue(); } }); - await promise; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMaxVolume_002 - * @tc.name : getMaxVolume - Media - Callback - * @tc.desc : getMaxVolume for Media - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMaxVolume_002', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0200 + *@tc.name : getMaxVolume - Media - Callback + *@tc.desc : getMaxVolume for Media + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0200', 1, async function (done) { audioManager.getMaxVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media : failed to getMaxVolume ${err.message}`); expect(false).assertTrue(); - } - else if (value == maxVol) { + } else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Media: getMaxVolume : PASS:' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Media: getMaxVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1045,49 +1008,49 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMaxVolume_003 - * @tc.name : getMaxVolume - Ringtone - Promise - * @tc.desc : getMaxVolume for Ringtone - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMaxVolume_003', 0, async function (done) { - const promise = audioManager.getMaxVolume(audioRingtone); - promise.then(function (data) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0300 + *@tc.name : getMaxVolume - Ringtone - Promise + *@tc.desc : getMaxVolume for Ringtone + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0300', 2, async function (done) { + const PROMISE = audioManager.getMaxVolume(audioRingtone); + PROMISE.then(function (data) { if (data == maxVol) { console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : FAIL: ' + data); expect(false).assertTrue(); } + }).catch(err => { + console.info('err :' + JSON.stringify(err)); + expect(false).assertTrue(); }); - await promise; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMaxVolume_004 - * @tc.name : getMaxVolume - Ringtone - Callback - * @tc.desc : getMaxVolume for Ringtone - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMaxVolume_004', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0400 + *@tc.name : getMaxVolume - Ringtone - Callback + *@tc.desc : getMaxVolume for Ringtone + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0400', 2, async function (done) { audioManager.getMaxVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMaxVolume ${err.message}`); expect(false).assertTrue(); - } - else if (value == maxVol) { + } else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : PASS:' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1095,78 +1058,77 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMaxVolume_005 - * @tc.name : getMaxVolume - Media - Promise - Change Ringtone Volume and check - * @tc.desc : getMaxVolume for Media - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMaxVolume_005', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0500 + *@tc.name : getMaxVolume - Media - Promise - Change Ringtone Volume and check + *@tc.desc : getMaxVolume for Media + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0500', 2, async function (done) { audioManager.setVolume(audioRingtone, lowVol); - const promise = audioManager.getMaxVolume(audioMedia); - promise.then(function (data) { + const PROMISE = audioManager.getMaxVolume(audioMedia); + PROMISE.then(function (data) { if (data == maxVol) { console.info('AudioFrameworkTest: Media getMaxVolume promise : PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Media getMaxVolume promise : FAIL: ' + data); expect(false).assertTrue(); } - }); - await promise; + }).catch(err => { + console.info('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + });; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMaxVolume_006 - * @tc.name : getMaxVolume - Ringtone - Promise - Change Media Volume and check - * @tc.desc : getMaxVolume for Media - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMaxVolume_006', 0, async function (done) { - audioManager.setVolume(audioMedia, lowVol); - const promise = audioManager.getMaxVolume(audioRingtone); - promise.then(function (data) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0600 + *@tc.name : getMaxVolume - Ringtone - Promise - Change Media Volume and check + *@tc.desc : getMaxVolume for Media + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0600', 2, async function (done) { + try { + await audioManager.setVolume(audioMedia, lowVol); + let data = await audioManager.getMaxVolume(audioRingtone); if (data == maxVol) { console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : FAIL: ' + data); expect(false).assertTrue(); } - - }); - await promise; + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMaxVolume_007 - * @tc.name : getMaxVolume - Media - Callback- Change Ringtone Volume and check - * @tc.desc : getMaxVolume for Media - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMaxVolume_007', 0, async function (done) { - audioManager.setVolume(audioRingtone, lowVol); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0700 + *@tc.name : getMaxVolume - Media - Callback- Change Ringtone Volume and check + *@tc.desc : getMaxVolume for Media + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0700', 2, async function (done) { + await audioManager.setVolume(audioRingtone, lowVol); audioManager.getMaxVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media : failed to getMaxVolume ${err.message}`); expect(false).assertTrue(); - - } - else if (value == maxVol) { + } else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Media: getMaxVolume : PASS:' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Media: getMaxVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1174,26 +1136,24 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMaxVolume_008 - * @tc.name : getMaxVolume - Ringtone - Callback - Callback- Change media Volume and check - * @tc.desc : getMaxVolume for Ringtone - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMaxVolume_008', 0, async function (done) { - audioManager.setVolume(audioMedia, lowVol); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0800 + *@tc.name : getMaxVolume - Ringtone - Callback - Callback- Change media Volume and check + *@tc.desc : getMaxVolume for Ringtone + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0800', 2, async function (done) { + await audioManager.setVolume(audioMedia, lowVol); audioManager.getMaxVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMaxVolume ${err.message}`); expect(false).assertTrue(); - } - else if (value == maxVol) { + } else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : PASS:' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1201,76 +1161,76 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMaxVolume_009 - * @tc.name : getMaxVolume - Media - Promise - Change media Volume and check - * @tc.desc : getMaxVolume for Media - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMaxVolume_009', 0, async function (done) { - audioManager.setVolume(audioMedia, lowVol); - const promise = audioManager.getMaxVolume(audioMedia); - promise.then(function (data) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0900 + *@tc.name : getMaxVolume - Media - Promise - Change media Volume and check + *@tc.desc : getMaxVolume for Media + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_0900', 2, async function (done) { + try { + await audioManager.setVolume(audioMedia, lowVol); + let data = await audioManager.getMaxVolume(audioMedia); if (data == maxVol) { console.info('AudioFrameworkTest: Media getMaxVolume promise : PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Media getMaxVolume promise : FAIL: ' + data); expect(false).assertTrue(); } - }); - await promise; + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMaxVolume_010 - * @tc.name : getMaxVolume - Ringtone - Promise - Change Ringtone Volume and check - * @tc.desc : getMaxVolume for Media - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMaxVolume_010', 0, async function (done) { - audioManager.setVolume(audioRingtone, lowVol); - const promise = audioManager.getMaxVolume(audioRingtone); - promise.then(function (data) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_1000 + *@tc.name : getMaxVolume - Ringtone - Promise - Change Ringtone Volume and check + *@tc.desc : getMaxVolume for Media + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_1000', 2, async function (done) { + try { + await audioManager.setVolume(audioRingtone, lowVol); + let data = await audioManager.getMaxVolume(audioRingtone); if (data == maxVol) { console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : FAIL: ' + data); expect(false).assertTrue(); } - }); - await promise; + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMaxVolume_011 - * @tc.name : getMaxVolume - Media - Callback- Change media Volume and check - * @tc.desc : getMaxVolume for Media - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMaxVolume_011', 0, async function (done) { - audioManager.setVolume(audioMedia, highVol); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_1100 + *@tc.name : getMaxVolume - Media - Callback- Change media Volume and check + *@tc.desc : getMaxVolume for Media + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_1100', 2, async function (done) { + await audioManager.setVolume(audioMedia, highVol); audioManager.getMaxVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media : failed to getMaxVolume ${err.message}`); expect(false).assertTrue(); - } - else if (value == maxVol) { + } else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Media: getMaxVolume : PASS:' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Media: getMaxVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1278,26 +1238,24 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMaxVolume_012 - * @tc.name : getMaxVolume - Ringtone - Callback - Callback- Change ringtone Volume and check - * @tc.desc : getMaxVolume for Ringtone - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMaxVolume_012', 0, async function (done) { - audioManager.setVolume(audioRingtone, highVol); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_1200 + *@tc.name : getMaxVolume - Ringtone - Callback - Callback- Change ringtone Volume and check + *@tc.desc : getMaxVolume for Ringtone + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMAXVOLUME_1200', 2, async function (done) { + await audioManager.setVolume(audioRingtone, highVol); audioManager.getMaxVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMaxVolume ${err.message}`); expect(false).assertTrue(); - } - else if (value == maxVol) { + } else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : PASS:' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1305,49 +1263,49 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMinVolume_001 - * @tc.name : getMinVolume - Media - Promise - * @tc.desc : getMinVolume for Media - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMinVolume_001', 0, async function (done) { - const promise = audioManager.getMinVolume(audioMedia); - promise.then(function (data) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0100 + *@tc.name : getMinVolume - Media - Promise + *@tc.desc : getMinVolume for Media + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0100', 1, async function (done) { + const PROMISE = audioManager.getMinVolume(audioMedia); + PROMISE.then(function (data) { if (data == minVol) { console.info('AudioFrameworkTest: Media getMinVolume promise : PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Media getMinVolume promise : FAIL: ' + data); expect(false).assertTrue(); } + }).catch(err => { + console.info('err :' + JSON.stringify(err)); + expect(false).assertTrue(); }); - await promise; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMinVolume_002 - * @tc.name : getMinVolume - Media - Callback - * @tc.desc : getMinVolume for Media - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMinVolume_002', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0200 + *@tc.name : getMinVolume - Media - Callback + *@tc.desc : getMinVolume for Media + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0200', 1, async function (done) { audioManager.getMinVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media : failed to getMinVolume ${err.message}`); expect().assertFail(); - } - else if (value == minVol) { + } else if (value == minVol) { console.info('AudioFrameworkTest: callback : Media: getMinVolume : PASS:' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Media: getMinVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1355,50 +1313,49 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMinVolume_003 - * @tc.name : getMinVolume - Ringtone - Promise - * @tc.desc : getMinVolume for Ringtone - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMinVolume_003', 0, async function (done) { - const promise = audioManager.getMinVolume(audioRingtone); - promise.then(function (data) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0300 + *@tc.name : getMinVolume - Ringtone - Promise + *@tc.desc : getMinVolume for Ringtone + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0300', 2, async function (done) { + const PROMISE = audioManager.getMinVolume(audioRingtone); + PROMISE.then(function (data) { if (data == minVol) { console.info('AudioFrameworkTest: Ringtone getMinVolume promise : PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Ringtone getMinVolume promise : FAIL: ' + data); expect(false).assertTrue(); } - + }).catch(err => { + console.info('err :' + JSON.stringify(err)); + expect(false).assertTrue(); }); - await promise; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMinVolume_004 - * @tc.name : getMinVolume - Ringtone - Callback - * @tc.desc : getMinVolume for Ringtone - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMinVolume_004', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0400 + *@tc.name : getMinVolume - Ringtone - Callback + *@tc.desc : getMinVolume for Ringtone + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0400', 2, async function (done) { audioManager.getMinVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMinVolume ${err.message}`); expect().assertFail(); - } - else if (value == minVol) { + } else if (value == minVol) { console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : PASS:' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1406,51 +1363,63 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMinVolume_005 - * @tc.name : getMinVolume - Media - Promise - Change Ringtone Volume and check - * @tc.desc : getMinVolume for Media - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMinVolume_005', 0, async function (done) { - audioManager.setVolume(audioRingtone, lowVol); - const promise = audioManager.getMinVolume(audioMedia); - promise.then(function (data) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0500 + *@tc.name : getMinVolume - Media - Promise - Change Ringtone Volume and check + *@tc.desc : getMinVolume for Media + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0500', 2, async function (done) { + try { + await audioManager.setVolume(audioRingtone, lowVol); + } catch (err) { + console.log('err :' + JSON.stringify(err)) + expect(false).assertTrue(); + return done(); + } + const PROMISE = audioManager.getMinVolume(audioMedia); + PROMISE.then(function (data) { if (data == minVol) { console.info('AudioFrameworkTest: Media getMinVolume promise : PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Media getMinVolume promise : FAIL: ' + data); expect(false).assertTrue(); } + }).catch(err => { + console.info('err :' + JSON.stringify(err)); + expect(false).assertTrue(); }); - await promise; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMinVolume_006 - * @tc.name : getMinVolume - Media - Callback - Change Ringtone Volume and check - * @tc.desc : getMinVolume for Media - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMinVolume_006', 0, async function (done) { - audioManager.setVolume(audioRingtone, lowVol); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0600 + *@tc.name : getMinVolume - Media - Callback - Change Ringtone Volume and check + *@tc.desc : getMinVolume for Media + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0600', 2, async function (done) { + try { + await audioManager.setVolume(audioRingtone, lowVol); + } catch (err) { + console.log('err :' + JSON.stringify(err)) + expect(false).assertTrue(); + return done(); + } audioManager.getMinVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media : failed to getMinVolume ${err.message}`); expect().assertFail(); - } - else if (value == minVol) { + } else if (value == minVol) { console.info('AudioFrameworkTest: callback : Media: getMinVolume : PASS:' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Media: getMinVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1458,51 +1427,63 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMinVolume_007 - * @tc.name : getMinVolume - Ringtone - Promise - Change Media Volume and check - * @tc.desc : getMinVolume for Ringtone - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMinVolume_007', 0, async function (done) { - audioManager.setVolume(audioMedia, highVol); - const promise = audioManager.getMinVolume(audioRingtone); - promise.then(function (data) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0700 + *@tc.name : getMinVolume - Ringtone - Promise - Change Media Volume and check + *@tc.desc : getMinVolume for Ringtone + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0700', 2, async function (done) { + try { + await audioManager.setVolume(audioMedia, highVol); + } catch (err) { + console.log('err :' + JSON.stringify(err)) + expect(false).assertTrue(); + return done(); + } + const PROMISE = audioManager.getMinVolume(audioRingtone); + PROMISE.then(function (data) { if (data == minVol) { console.info('AudioFrameworkTest: Ringtone getMinVolume promise : PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Ringtone getMinVolume promise : FAIL: ' + data); expect(false).assertTrue(); } + }).catch(err => { + console.info('err :' + JSON.stringify(err)); + expect(false).assertTrue(); }); - await promise; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMinVolume_008 - * @tc.name : getMinVolume - Ringtone - Callback - Change Media Volume and check - * @tc.desc : getMinVolume for Ringtone - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMinVolume_008', 0, async function (done) { - audioManager.setVolume(audioMedia, lowVol); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0800 + *@tc.name : getMinVolume - Ringtone - Callback - Change Media Volume and check + *@tc.desc : getMinVolume for Ringtone + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0800', 2, async function (done) { + try { + await audioManager.setVolume(audioMedia, lowVol); + } catch (err) { + console.log('err :' + JSON.stringify(err)) + expect(false).assertTrue(); + return done(); + } audioManager.getMinVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMinVolume ${err.message}`); expect().assertFail(); - } - else if (value == minVol) { + } else if (value == minVol) { console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : PASS:' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1510,51 +1491,63 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMinVolume_009 - * @tc.name : getMinVolume - Media - Promise - Change Media Volume and check - * @tc.desc : getMinVolume for Media - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMinVolume_009', 0, async function (done) { - audioManager.setVolume(audioMedia, lowVol); - const promise = audioManager.getMinVolume(audioMedia); - promise.then(function (data) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0900 + *@tc.name : getMinVolume - Media - Promise - Change Media Volume and check + *@tc.desc : getMinVolume for Media + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_0900', 2, async function (done) { + try { + await audioManager.setVolume(audioMedia, lowVol); + } catch (err) { + console.log('err :' + JSON.stringify(err)) + expect(false).assertTrue(); + return done(); + } + const PROMISE = audioManager.getMinVolume(audioMedia); + PROMISE.then(function (data) { if (data == minVol) { console.info('AudioFrameworkTest: Media getMinVolume promise : PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Media getMinVolume promise : FAIL: ' + data); expect(false).assertTrue(); } + }).catch(err => { + console.info('err :' + JSON.stringify(err)); + expect(false).assertTrue(); }); - await promise; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMinVolume_010 - * @tc.name : getMinVolume - Media - Callback - Change Media Volume and check - * @tc.desc : getMinVolume for Media - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMinVolume_010', 0, async function (done) { - audioManager.setVolume(audioMedia, highVol); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_1000 + *@tc.name : getMinVolume - Media - Callback - Change Media Volume and check + *@tc.desc : getMinVolume for Media + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_1000', 2, async function (done) { + try { + await audioManager.setVolume(audioMedia, highVol); + } catch (err) { + console.log('err :' + JSON.stringify(err)) + expect(false).assertTrue(); + return done(); + } audioManager.getMinVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media : failed to getMinVolume ${err.message}`); expect().assertFail(); - } - else if (value == minVol) { + } else if (value == minVol) { console.info('AudioFrameworkTest: callback : Media: getMinVolume : PASS:' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Media: getMinVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1562,18 +1555,24 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMinVolume_011 - * @tc.name : getMinVolume - Ringtone - Promise - Change Ringtone Volume and check - * @tc.desc : getMinVolume for Ringtone - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMinVolume_011', 0, async function (done) { - audioManager.setVolume(audioRingtone, lowVol); - const promise = audioManager.getMinVolume(audioRingtone) - promise.then(function (data) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_1100 + *@tc.name : getMinVolume - Ringtone - Promise - Change Ringtone Volume and check + *@tc.desc : getMinVolume for Ringtone + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_1100', 2, async function (done) { + try { + await audioManager.setVolume(audioRingtone, lowVol); + } catch (err) { + console.log('err :' + JSON.stringify(err)) + expect(false).assertTrue(); + return done(); + } + const PROMISE = audioManager.getMinVolume(audioRingtone) + PROMISE.then(function (data) { if (data == minVol) { console.info('AudioFrameworkTest: Ringtone getMinVolume promise : PASS:' + data); expect(true).assertTrue(); @@ -1582,21 +1581,30 @@ describe('audioManager', function () { console.info('AudioFrameworkTest: Ringtone getMinVolume promise : FAIL: ' + data); expect(false).assertTrue(); } + }).catch(err => { + console.info('err :' + JSON.stringify(err)); + expect(false).assertTrue(); }); - await promise; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getMinVolume_012 - * @tc.name : getMinVolume - Ringtone - Callback - Change Ringtone Volume and check - * @tc.desc : getMinVolume for Ringtone - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getMinVolume_012', 0, async function (done) { - audioManager.setVolume(audioRingtone, lowVol); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_1200 + *@tc.name : getMinVolume - Ringtone - Callback - Change Ringtone Volume and check + *@tc.desc : getMinVolume for Ringtone + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETMINVOLUME_1200', 2, async function (done) { + try { + await audioManager.setVolume(audioRingtone, lowVol); + } catch (err) { + console.log('err :' + JSON.stringify(err)) + expect(false).assertTrue(); + return done(); + } audioManager.getMinVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMinVolume ${err.message}`); @@ -1605,8 +1613,7 @@ describe('audioManager', function () { else if (value == minVol) { console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : PASS:' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1614,147 +1621,115 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getDevices_001 - * @tc.name : getDevices - Output device - Promise - * @tc.desc : getDevices - Output device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getDevices_001', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; - const promise = audioManager.getDevices(1); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0100 + *@tc.name : getDevices - Output device - Promise + *@tc.desc : getDevices - Output device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0100', 1, async function (done) { + const PROMISE = audioManager.getDevices(1); // Getting all Output devices Enumb 1 = OUTPUT_DEVICES_FLAG - promise.then(function (value) { + PROMISE.then(function (value) { console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } + }).catch(err => { + console.info('err :' + JSON.stringify(err)); + expect(false).assertTrue(); }); - await promise; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getDevices_002 - * @tc.name : getDevices - Input device - Promise - * @tc.desc : getDevices - Input device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getDevices_002', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; - const promise = audioManager.getDevices(2); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0200 + *@tc.name : getDevices - Input device - Promise + *@tc.desc : getDevices - Input device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0200', 1, async function (done) { + const PROMISE = audioManager.getDevices(2); // Getting all Input Devices ENUM 2 = INPUT_DEVICES_FLAG - promise.then(function (value) { + PROMISE.then(function (value) { console.info('AudioFrameworkTest: Promise: getDevices INPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } + }).catch(err => { + console.info('err :' + JSON.stringify(err)); + expect(false).assertTrue(); }); - await promise; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getDevices_003 - * @tc.name : getDevices - ALL device - Promise - * @tc.desc : getDevices - ALL device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getDevices_003', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; - const promise = audioManager.getDevices(3); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0300 + *@tc.name : getDevices - ALL device - Promise + *@tc.desc : getDevices - ALL device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0300', 2, async function (done) { + const PROMISE = audioManager.getDevices(3); // Getting all devies connected 3 = ALL_DEVICES_FLAG - promise.then(function (value) { - + PROMISE.then(function (value) { console.info('AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } + }).catch(err => { + console.info('err :' + JSON.stringify(err)); + expect(false).assertTrue(); }); - await promise; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getDevices_004 - * @tc.name : getDevices - Output device - Callback - * @tc.desc : getDevices - Output device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getDevices_004', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0400 + *@tc.name : getDevices - Output device - Callback + *@tc.desc : getDevices - Output device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0400', 2, async function (done) { audioManager.getDevices(1, (err, value) => { // Getting all Output devices Enumb 1 = OUTPUT_DEVICES_FLAG console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); - if (err) { console.error(`AudioFrameworkTest: Callback: OUTPUT_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -1763,28 +1738,18 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getDevices_005 - * @tc.name : getDevices - Input device - Callback - * @tc.desc : getDevices - Input device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getDevices_005', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0500 + *@tc.name : getDevices - Input device - Callback + *@tc.desc : getDevices - Input device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0500', 2, async function (done) { audioManager.getDevices(2, (err, value) => { // Getting all Input Devices ENUM 2 = INPUT_DEVICES_FLAG - console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); - if (err) { console.error(`AudioFrameworkTest: Callback: INPUT_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); @@ -1792,12 +1757,10 @@ describe('audioManager', function () { else { console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL'); expect(false).assertTrue(); } @@ -1806,28 +1769,18 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getDevices_006 - * @tc.name : getDevices - ALL device - Callback - * @tc.desc : getDevices - ALL device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getDevices_006', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0600 + *@tc.name : getDevices - ALL device - Callback + *@tc.desc : getDevices - ALL device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0600', 2, async function (done) { audioManager.getDevices(3, (err, value) => { // Getting all devies connected 3 = ALL_DEVICES_FLAG - console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); - if (err) { console.error(`AudioFrameworkTest: Callback: ALL_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); @@ -1839,8 +1792,7 @@ describe('audioManager', function () { if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL'); expect(false).assertTrue(); } @@ -1849,142 +1801,112 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getDevices_007 - * @tc.name : getDevices - Output device - Promise - ENAME - * @tc.desc : getDevices - Output device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getDevices_007', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; - const promise = audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG) - promise.then(function (value) { - + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0700 + *@tc.name : getDevices - Output device - Promise - ENAME + *@tc.desc : getDevices - Output device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0700', 2, async function (done) { + const PROMISE = audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG) + PROMISE.then(function (value) { console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } + }).catch(err => { + console.info('err :' + JSON.stringify(err)); + expect(false).assertTrue(); }); - await promise; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getDevices_008 - * @tc.name : getDevices - Input device - Promise - ENAME - * @tc.desc : getDevices - Input device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getDevices_008', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; - const promise = audioManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG); - promise.then(function (value) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0800 + *@tc.name : getDevices - Input device - Promise - ENAME + *@tc.desc : getDevices - Input device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0800', 2, async function (done) { + const PROMISE = audioManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG); + PROMISE.then(function (value) { console.info('AudioFrameworkTest: Promise: getDevices INPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } + }).catch(err => { + console.info('err :' + JSON.stringify(err)); + expect(false).assertTrue(); }); - await promise; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getDevices_009 - * @tc.name : getDevices - ALL device - Promise - ENAME - * @tc.desc : getDevices - ALL device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getDevices_009', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; - const promise = audioManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG); - promise.then(function (value) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0900 + *@tc.name : getDevices - ALL device - Promise - ENAME + *@tc.desc : getDevices - ALL device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_0900', 2, async function (done) { + const PROMISE = audioManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG); + PROMISE.then(function (value) { console.info('AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG'); value.forEach(displayDeviceProp); if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } + }).catch(err => { + console.info('err :' + JSON.stringify(err)); + expect(false).assertTrue(); }); - await promise; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getDevices_010 - * @tc.name : getDevices - Output device - Callback - ENAME - * @tc.desc : getDevices - Output device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getDevices_010', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_1000 + *@tc.name : getDevices - Output device - Callback - ENAME + *@tc.desc : getDevices - Output device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_1000', 2, async function (done) { audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value) => { console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); if (err) { console.error(`AudioFrameworkTest: Callback: OUTPUT_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -1993,38 +1915,27 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getDevices_011 - * @tc.name : getDevices - Input device - Callback - ENAME - * @tc.desc : getDevices - Input device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getDevices_011', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_1100 + *@tc.name : getDevices - Input device - Callback - ENAME + *@tc.desc : getDevices - Input device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_1100', 2, async function (done) { audioManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG, (err, value) => { console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); if (err) { console.error(`AudioFrameworkTest: Callback: INPUT_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL'); expect(false).assertTrue(); } @@ -2033,37 +1944,27 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getDevices_012 - * @tc.name : getDevices - ALL device - Callback - ENAME - * @tc.desc : getDevices - ALL device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getDevices_012', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_1200 + *@tc.name : getDevices - ALL device - Callback - ENAME + *@tc.desc : getDevices - ALL device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETDEVICES_1200', 2, async function (done) { audioManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG, (err, value) => { console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); if (err) { console.error(`AudioFrameworkTest: Callback: ALL_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); value.forEach(displayDeviceProp); if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL'); expect(false).assertTrue(); } @@ -2072,1454 +1973,1299 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setRingerMode_001 - * @tc.name : setRingerMode - Normal Mode - Promise - * @tc.desc : setRingerMode - Set Ring more to Normal Mode - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setRingerMode_001', 0, async function (done) { - const promise = audioManager.setRingerMode(2); - // Setting Ringtone Mode to Normal ENUM 2 = RINGER_MODE_NORMAL - promise.then(function () { - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL'); - audioManager.getRingerMode().then(function (value) { - if (value == 2) { - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: FAIL :' + value); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0100 + *@tc.name : setRingerMode - Normal Mode - Promise + *@tc.desc : setRingerMode - Set Ring more to Normal Mode + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0100', 1, async function (done) { + try { + await audioManager.setRingerMode(2); + let value = await audioManager.getRingerMode(); + if (value == 2) { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setRingerMode_002 - * @tc.name : setRingerMode - Silent Mode - Promise - * @tc.desc : setRingerMode - Set Ring more to Silent Mode - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setRingerMode_002', 0, async function (done) { - const promise = audioManager.setRingerMode(0); - // Setting Ringtone Mode to Silent ENUM 0 = RINGER_MODE_SILENT - promise.then(function () { - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT'); - audioManager.getRingerMode().then(function (value) { - if (value == 0) { - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: FAIL :' + value); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0200 + *@tc.name : setRingerMode - Silent Mode - Promise + *@tc.desc : setRingerMode - Set Ring more to Silent Mode + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0200', 1, async function (done) { + try { + await audioManager.setRingerMode(0); + let value = await audioManager.getRingerMode(); + if (value == 0) { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setRingerMode_003 - * @tc.name : setRingerMode - Vibration Mode - Promise - * @tc.desc : setRingerMode - Set Ring more to Vibration Mode - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setRingerMode_003', 0, async function (done) { - const promise = audioManager.setRingerMode(1); - // Setting Ringtone Mode to Vibration ENUM 1 = RINGER_MODE_VIBRATE - promise.then(function () { - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE'); - audioManager.getRingerMode().then(function (value) { - if (value == 1) { - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: FAIL :' + value); - expect(false).assertTrue(); - } - }); - }); - await promise; - done(); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0300 + *@tc.name : setRingerMode - Vibration Mode - Promise + *@tc.desc : setRingerMode - Set Ring more to Vibration Mode + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0300', 2, async function (done) { + try { + await audioManager.setRingerMode(1); + let value = await audioManager.getRingerMode(); + if (value == 1) { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } + done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setRingerMode_004 - * @tc.name : setRingerMode - Normal Mode - Callback - * @tc.desc : setRingerMode - Set Ring more to Normal Mode - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setRingerMode_004', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0400 + *@tc.name : setRingerMode - Normal Mode - Callback + *@tc.desc : setRingerMode - Set Ring more to Normal Mode + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0400', 2, async function (done) { audioManager.setRingerMode(2, (err) => { // Setting Ringtone Mode to Normal ENUM 2 = RINGER_MODE_NORMAL console.info('AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_NORMAL'); if (err) { console.error(`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_NORMAL: Error: ${err.message}`); expect().assertFail(); - } - else { + done(); + } else { audioManager.getRingerMode((err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : RINGER_MODE_NORMAL: Error: ${err.message}`); expect().assertFail(); - } - else if (value == 2) { + } else if (value == 2) { console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: FAIL :' + value); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setRingerMode_005 - * @tc.name : setRingerMode - Silent Mode - Callback - * @tc.desc : setRingerMode - Set Ring more to Silent Mode - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setRingerMode_005', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0500 + *@tc.name : setRingerMode - Silent Mode - Callback + *@tc.desc : setRingerMode - Set Ring more to Silent Mode + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0500', 2, async function (done) { audioManager.setRingerMode(0, (err) => { // Setting Ringtone Mode to Silent ENUM 0 = RINGER_MODE_SILENT console.info('AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_SILENT'); if (err) { console.error(`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_SILENT: Error: ${err.message}`); expect().assertFail(); - } - else { + done(); + } else { audioManager.getRingerMode((err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : RINGER_MODE_SILENT: Error: ${err.message}`); expect().assertFail(); } - if (value == 0) { console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: FAIL :' + value); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setRingerMode_006 - * @tc.name : setRingerMode - Vibration Mode - Callback - * @tc.desc : setRingerMode - Set Ring more to Vibration Mode - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setRingerMode_006', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0600 + *@tc.name : setRingerMode - Vibration Mode - Callback + *@tc.desc : setRingerMode - Set Ring more to Vibration Mode + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0600', 2, async function (done) { audioManager.setRingerMode(1, (err) => { // Setting Ringtone Mode to Vibration ENUM 1 = RINGER_MODE_VIBRATE console.info('AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_VIBRATE'); if (err) { console.error(`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_VIBRATE: Error: ${err.message}`); expect().assertFail(); - } - else { + done(); + } else { audioManager.getRingerMode((err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : RINGER_MODE_VIBRATE: Error: ${err.message}`); expect().assertFail(); } - if (value == 1) { console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: FAIL :' + value); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setRingerMode_007 - * @tc.name : setRingerMode - Normal Mode - Promise - ENAME - * @tc.desc : setRingerMode - Set Ring more to Normal Mode - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setRingerMode_007', 0, async function (done) { - const promise = audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL); - promise.then(function () { - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL'); - audioManager.getRingerMode().then(function (value) { - if (value == audio.AudioRingMode.RINGER_MODE_NORMAL) { - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: FAIL :' + value); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0700 + *@tc.name : setRingerMode - Normal Mode - Promise - ENAME + *@tc.desc : setRingerMode - Set Ring more to Normal Mode + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0700', 2, async function (done) { + try { + await audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL); + let value = await audioManager.getRingerMode(); + if (value == audio.AudioRingMode.RINGER_MODE_NORMAL) { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setRingerMode_008 - * @tc.name : setRingerMode - Silent Mode - Promise - ENAME - * @tc.desc : setRingerMode - Set Ring more to Silent Mode - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setRingerMode_008', 0, async function (done) { - const promise = audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_SILENT); - promise.then(function () { - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT'); - audioManager.getRingerMode().then(function (value) { - if (value == audio.AudioRingMode.RINGER_MODE_SILENT) { - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: FAIL :' + value); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0800 + *@tc.name : setRingerMode - Silent Mode - Promise - ENAME + *@tc.desc : setRingerMode - Set Ring more to Silent Mode + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0800', 2, async function (done) { + try { + await audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_SILENT); + let value = await audioManager.getRingerMode(); + if (value == audio.AudioRingMode.RINGER_MODE_SILENT) { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setRingerMode_009 - * @tc.name : setRingerMode - Vibration Mode - Promise - NAME - * @tc.desc : setRingerMode - Set Ring more to Vibration Mode - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setRingerMode_009', 0, async function (done) { - const promise = audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_VIBRATE); - promise.then(function () { - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE'); - audioManager.getRingerMode().then(function (value) { - if (value == audio.AudioRingMode.RINGER_MODE_VIBRATE) { - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: FAIL :' + value); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0900 + *@tc.name : setRingerMode - Vibration Mode - Promise - NAME + *@tc.desc : setRingerMode - Set Ring more to Vibration Mode + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_0900', 2, async function (done) { + try { + await audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_VIBRATE); + let value = await audioManager.getRingerMode(); + if (value == audio.AudioRingMode.RINGER_MODE_VIBRATE) { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setRingerMode_010 - * @tc.name : setRingerMode - Normal Mode - Callback - ENAME - * @tc.desc : setRingerMode - Set Ring more to Normal Mode - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setRingerMode_010', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_1000 + *@tc.name : setRingerMode - Normal Mode - Callback - ENAME + *@tc.desc : setRingerMode - Set Ring more to Normal Mode + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_1000', 2, async function (done) { audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL, (err) => { console.info('AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_NORMAL'); if (err) { console.error(`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_NORMAL: Error: ${err.message}`); expect().assertFail(); - } - else { + done(); + } else { audioManager.getRingerMode((err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : RINGER_MODE_NORMAL: Error: ${err.message}`); expect().assertFail(); - } - else if (value == audio.AudioRingMode.RINGER_MODE_NORMAL) { + } else if (value == audio.AudioRingMode.RINGER_MODE_NORMAL) { console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: FAIL :' + value); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setRingerMode_0011 - * @tc.name : setRingerMode - Silent Mode - Callback - ENAME - * @tc.desc : setRingerMode - Set Ring more to Silent Mode - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setRingerMode_011', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_1100 + *@tc.name : setRingerMode - Silent Mode - Callback - ENAME + *@tc.desc : setRingerMode - Set Ring more to Silent Mode + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_1100', 2, async function (done) { audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_SILENT, (err) => { console.info('AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_SILENT'); if (err) { console.error(`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_SILENT: Error: ${err.message}`); expect().assertFail(); - } - else { + done(); + } else { audioManager.getRingerMode((err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : RINGER_MODE_SILENT: Error: ${err.message}`); expect().assertFail(); } - if (value == audio.AudioRingMode.RINGER_MODE_SILENT) { console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: FAIL :' + value); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setRingerMode_012 - * @tc.name : setRingerMode - Vibration Mode - Callback - * @tc.desc : setRingerMode - Set Ring more to Vibration Mode - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setRingerMode_012', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_1200 + *@tc.name : setRingerMode - Vibration Mode - Callback + *@tc.desc : setRingerMode - Set Ring more to Vibration Mode + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETRINGERMODE_1200', 2, async function (done) { audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_VIBRATE, (err, value) => { console.info('AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_VIBRATE'); if (err) { console.error(`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_VIBRATE: Error: ${err.message}`); expect().assertFail(); - } - else { + done(); + } else { audioManager.getRingerMode((err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : RINGER_MODE_VIBRATE: Error: ${err.message}`); expect().assertFail(); } - if (value == audio.AudioRingMode.RINGER_MODE_VIBRATE) { console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: FAIL :' + value); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_006 - * @tc.name : mute - Media - callback - * @tc.desc : mute - Media - callback - Disable mute - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_006', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0100 + *@tc.name : mute - Media - callback + *@tc.desc : mute - Media - callback - Disable mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0100', 1, async function (done) { await audioManager.setVolume(audioMedia, highVol); audioManager.mute(audioMedia, true, (err) => { if (err) { console.error(`AudioFrameworkTest: Failed to mute the stream. ${err.message}`); expect(false).assertTrue(); done(); + return; } console.log('AudioFrameworkTest: Callback invoked to indicate that the stream is muted.'); audioManager.mute(audioMedia, false, (err) => { if (err) { console.error(`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error : ${err.message}`); expect(false).assertTrue(); - } - else { + done(); + } else { audioManager.getVolume(audioMedia, (err, value) => { if (err) { console.error(`Failed to obtain the volume. ${err.message}`); expect(false).assertTrue(); - } - else if (value == highVol) { - console.info("AudioFrameworkTest: value is " + value); - expect(true).assertTrue(); - } - else { - console.info("AudioFrameworkTest: mute fail"); + done(); + } else if (value == highVol) { + audioManager.isMute(audioMedia, (err, data) => { + if (err) { + console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: ' + data); + expect(true).assertTrue(); + } else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); + } else { + console.info(`AudioFrameworkTest: mute fail: value ${value}`); expect(false).assertTrue(); + done(); } }); - audioManager.isMute(audioMedia, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: ' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: ' + data); - expect(false).assertTrue(); - } - done(); - }); } - done(); }); }); - }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_005 - * @tc.name : mute - Media - Promise - * @tc.desc : mute - Media - Promise - Disable mute - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_005', 0, async function (done) { - await audioManager.setVolume(audioMedia, lowVol); - await audioManager.mute(audioMedia, true).then(() => { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0200 + *@tc.name : mute - Media - Promise + *@tc.desc : mute - Media - Promise - Disable mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0200', 1, async function (done) { + try { + await audioManager.setVolume(audioMedia, lowVol); + await audioManager.mute(audioMedia, true) console.log('AudioFrameworkTest: Promise returned to indicate that the stream is muted.'); - }) - .catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream isMute Media: FALSE: ERROR:' + err.message); - expect(false).assertTrue(); - }); - await audioManager.mute(audioMedia, false).then(async function () { + await audioManager.mute(audioMedia, false) console.log('AudioFrameworkTest: Set Stream Mute: Media: Promise: FALSE'); - await audioManager.getVolume(audioMedia).then((value) => { - console.info("AudioFrameworkTest: value is " + value); - if (value == lowVol) { - expect(true).assertTrue(); - } - else { - expect(false).assertTrue(); - } - }); - await audioManager.isMute(audioMedia).then(function (data) { - if (data == false) { - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: PASS:' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: FAIL: ' + data); - expect(false).assertTrue(); - } - }) - .catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream isMute Media: FALSE: ERROR:' + err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: ERROR:' + err.message); + let value = await audioManager.getVolume(audioMedia) + console.info("AudioFrameworkTest: value is " + value); + if (value == lowVol) { + expect(true).assertTrue(); + } else { + expect(false).assertTrue(); + } + let data = await audioManager.isMute(audioMedia) + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: PASS:' + data); + expect(true).assertTrue(); + } else { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: FAIL: ' + data); + expect(false).assertTrue(); + } + } catch (err) { + console.info('err :' + JSON.stringify(err)); expect(false).assertTrue(); - }); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_008 - * @tc.name : mute - Ringtone - callback - * @tc.desc : mute - Ringtone - callback - Disable mute - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_008', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0300 + *@tc.name : mute - Ringtone - callback + *@tc.desc : mute - Ringtone - callback - Disable mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0300', 2, async function (done) { await audioManager.setVolume(audioRingtone, highVol); audioManager.mute(audioRingtone, true, (err) => { if (err) { console.error(`AudioFrameworkTest: Failed to mute the stream. ${err.message}`); expect(false).assertTrue(); + done(); + return; } console.log('AudioFrameworkTest: Callback invoked to indicate that the stream is muted.'); audioManager.mute(audioRingtone, false, (err) => { if (err) { console.error(`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error : ${err.message}`); expect(false).assertTrue(); - } - else { + done(); + } else { audioManager.getVolume(audioRingtone, (err, value) => { if (err) { console.error(`Failed to obtain the volume. ${err.message}`); expect(false).assertTrue(); - } - else if (value == highVol) { - console.info("AudioFrameworkTest: value is " + value); - expect(true).assertTrue(); - } - else { - console.info("AudioFrameworkTest: mute fail"); + done(); + } else if (value == highVol) { + audioManager.isMute(audioRingtone, (err, data) => { + if (err) { + console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: ' + data); + expect(true).assertTrue(); + } else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); + } else { + console.info(`AudioFrameworkTest: mute fail: value ${value}`); expect(false).assertTrue(); + done(); } }); - audioManager.isMute(audioRingtone, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: ' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: ' + data); - expect(false).assertTrue(); - } - done(); - }); } - done(); }); }); - }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_007 - * @tc.name : mute - Ringtone - Promise - * @tc.desc : mute - Ringtone - Promise - disable mute - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_007', 0, async function (done) { - await audioManager.setVolume(audioRingtone, lowVol); - await audioManager.mute(audioRingtone, true).then(() => { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0400 + *@tc.name : mute - Ringtone - Promise + *@tc.desc : mute - Ringtone - Promise - disable mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0400', 2, async function (done) { + try { + await audioManager.setVolume(audioRingtone, lowVol); + await audioManager.mute(audioRingtone, true); console.log('AudioFrameworkTest: Promise returned to indicate that the stream is muted.'); - }) - .catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: ERROR:' + err.message); + await audioManager.mute(audioRingtone, false); + let value = await audioManager.getVolume(audioRingtone); + console.info("AudioFrameworkTest: value is " + value); + if (value == lowVol) { + expect(true).assertTrue(); + } else { expect(false).assertTrue(); - }); - await audioManager.mute(audioRingtone, false).then(async function () { - console.log('AudioFrameworkTest: Set Stream Mute: Ringtone: Promise: FALSE'); - await audioManager.getVolume(audioRingtone).then((value) => { - console.info("AudioFrameworkTest: value is " + value); - if (value == lowVol) { - expect(true).assertTrue(); - } - else { - expect(false).assertTrue(); - } - }); - await audioManager.isMute(audioRingtone).then(function (data) { - if (data == false) { - console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: PASS:' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: FAIL: ' + data); - expect(false).assertTrue(); - } - }) - .catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream isMute Ringtone: FALSE: ERROR:' + err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: ERROR:' + err.message); + } + let data = await audioManager.isMute(audioRingtone); + console.info("AudioFrameworkTest: value is " + value); + if (value == lowVol) { + expect(true).assertTrue(); + } else { + expect(false).assertTrue(); + } + } catch (err) { + console.info('err:' + JSON.stringify(err)); expect(false).assertTrue(); - }); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_015 - * @tc.name : mute - Media - callback - ENAME - * @tc.desc : mute - Media - callback - Disable mute - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_015', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0500 + *@tc.name : mute - Media - callback - ENAME + *@tc.desc : mute - Media - callback - Disable mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0500', 2, async function (done) { await audioManager.setVolume(audio.AudioVolumeType.MEDIA, highVol); audioManager.mute(audio.AudioVolumeType.MEDIA, true, (err) => { if (err) { console.error(`AudioFrameworkTest: Failed to mute the stream. ${err.message}`); expect(false).assertTrue(); + done(); + return; } console.log('AudioFrameworkTest: Callback invoked to indicate that the stream is muted.'); audioManager.mute(audio.AudioVolumeType.MEDIA, false, (err) => { if (err) { console.error(`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error : ${err.message}`); expect(false).assertTrue(); - } - else { + done(); + } else { audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => { if (err) { console.error(`Failed to obtain the volume. ${err.message}`); expect(false).assertTrue(); - } - else if (value == highVol) { - console.info("AudioFrameworkTest: value is " + value); - expect(true).assertTrue(); - } - else { - console.info("AudioFrameworkTest: mute fail"); - expect(false).assertTrue(); - } - }); - audioManager.isMute(audio.AudioVolumeType.MEDIA, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: ' + data); - expect(true).assertTrue(); + done(); + } else if (value == highVol) { + audioManager.isMute(audio.AudioVolumeType.MEDIA, (err, data) => { + if (err) { + console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: ' + data); + expect(true).assertTrue(); + } else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); } else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: ' + data); + console.info(`AudioFrameworkTest: mute fail: value ${value}`); expect(false).assertTrue(); + done(); } - done(); }); } - done(); }); }); - }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_011 - * @tc.name : mute - Media - Promise - ENAME - * @tc.desc : mute - Media - Promise - Disable mute - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_011', 0, async function (done) { - await audioManager.setVolume(audio.AudioVolumeType.MEDIA, lowVol); - await audioManager.mute(audio.AudioVolumeType.MEDIA, true).then(() => { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0600 + *@tc.name : mute - Media - Promise - ENAME + *@tc.desc : mute - Media - Promise - Disable mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0600', 2, async function (done) { + try { + await audioManager.setVolume(audio.AudioVolumeType.MEDIA, lowVol); + await audioManager.mute(audio.AudioVolumeType.MEDIA, true); console.log('AudioFrameworkTest: Promise returned to indicate that the stream is muted.'); - }) - .catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream isMute Media: FALSE: ERROR:' + err.message); + await audioManager.mute(audio.AudioVolumeType.MEDIA, false); + let value = await audioManager.getVolume(audio.AudioVolumeType.MEDIA); + console.info("AudioFrameworkTest: value is " + value); + if (value == lowVol) { + expect(true).assertTrue(); + } else { expect(false).assertTrue(); - }); - await audioManager.mute(audio.AudioVolumeType.MEDIA, false).then(async function () { - console.log('AudioFrameworkTest: Set Stream Mute: Media: Promise: FALSE'); - await audioManager.getVolume(audio.AudioVolumeType.MEDIA).then((value) => { - console.info("AudioFrameworkTest: value is " + value); - if (value == lowVol) { - expect(true).assertTrue(); - } - else { - expect(false).assertTrue(); - } - }); - await audioManager.isMute(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == false) { - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: PASS:' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: FAIL: ' + data); - expect(false).assertTrue(); - } - }) - .catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream isMute Media: FALSE: ERROR:' + err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: ERROR:' + err.message); + } + let data = await audioManager.isMute(audio.AudioVolumeType.MEDIA); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: PASS:' + data); + expect(true).assertTrue(); + } + } catch (err) { + console.info('err:' + JSON.stringify(err)); expect(false).assertTrue(); - }); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_016 - * @tc.name : mute - Ringtone - callback - ENAME - * @tc.desc : mute - Ringtone - callback - Disable mute - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_016', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0700 + *@tc.name : mute - Ringtone - callback - ENAME + *@tc.desc : mute - Ringtone - callback - Disable mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0700', 2, async function (done) { await audioManager.setVolume(audio.AudioVolumeType.RINGTONE, highVol); audioManager.mute(audio.AudioVolumeType.RINGTONE, true, (err) => { if (err) { console.error(`AudioFrameworkTest: Failed to mute the stream. ${err.message}`); expect(false).assertTrue(); + done(); + return; } console.log('AudioFrameworkTest: Callback invoked to indicate that the stream is muted.'); audioManager.mute(audio.AudioVolumeType.RINGTONE, false, (err) => { if (err) { console.error(`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error : ${err.message}`); expect(false).assertTrue(); - } - else { + done(); + } else { audioManager.getVolume(audio.AudioVolumeType.RINGTONE, (err, value) => { if (err) { console.error(`Failed to obtain the volume. ${err.message}`); expect(false).assertTrue(); - } - else if (value == highVol) { - console.info("AudioFrameworkTest: value is " + value); - expect(true).assertTrue(); - } - else { - console.info("AudioFrameworkTest: mute fail"); + done(); + } else if (value == highVol) { + audioManager.isMute(audio.AudioVolumeType.RINGTONE, (err, data) => { + if (err) { + console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: ' + data); + expect(true).assertTrue(); + } else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); + } else { + console.info(`AudioFrameworkTest: mute fail: value ${value}`); expect(false).assertTrue(); + done(); } }); - audioManager.isMute(audio.AudioVolumeType.RINGTONE, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: ' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: ' + data); - expect(false).assertTrue(); - } - done(); - }); } - done(); }); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_014 - * @tc.name : mute - RINGTONE - Promise - ENAME: - * @tc.desc : mute - RINGTONE - Promise - Disable mute - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_014', 0, async function (done) { - await audioManager.setVolume(audio.AudioVolumeType.RINGTONE, lowVol); - await audioManager.mute(audio.AudioVolumeType.RINGTONE, true).then(() => { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0800 + *@tc.name : mute - RINGTONE - Promise - ENAME: + *@tc.desc : mute - RINGTONE - Promise - Disable mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0800', 2, async function (done) { + try { + await audioManager.setVolume(audio.AudioVolumeType.RINGTONE, lowVol); + await audioManager.mute(audio.AudioVolumeType.RINGTONE, true); console.log('AudioFrameworkTest: Promise returned to indicate that the stream is muted.'); - }) - .catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream isMute Ringtone: FALSE: ERROR:' + err.message); + await audioManager.mute(audio.AudioVolumeType.RINGTONE, false); + let value = await audioManager.getVolume(audio.AudioVolumeType.RINGTONE); + console.info("AudioFrameworkTest: value is " + value); + if (value == lowVol) { + expect(true).assertTrue(); + } else { expect(false).assertTrue(); - }); - await audioManager.mute(audio.AudioVolumeType.RINGTONE, false).then(async function () { - console.log('AudioFrameworkTest: Set Stream Mute: Ringtone: Promise: FALSE'); - await audioManager.getVolume(audio.AudioVolumeType.RINGTONE).then((value) => { - console.info("AudioFrameworkTest: value is " + value); - if (value == lowVol) { - expect(true).assertTrue(); - } - else { - expect(false).assertTrue(); - } - }); - await audioManager.isMute(audio.AudioVolumeType.RINGTONE).then(function (data) { - if (data == false) { - console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: PASS:' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: FAIL: ' + data); - expect(false).assertTrue(); - } - }) - .catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream isMute Ringtone: FALSE: ERROR:' + err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: ERROR:' + err.message); + } + let data = await audioManager.isMute(audio.AudioVolumeType.RINGTONE) + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: PASS:' + data); + expect(true).assertTrue(); + } + } catch (err) { + console.info('err:' + JSON.stringify(err)); expect(false).assertTrue(); - }); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_021 - * @tc.name : mute - VOICE_CALL - callback - ENAME - * @tc.desc : mute - VOICE_CALL - callback - Disable mute - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_021', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0900 + *@tc.name : mute - VOICE_CALL - callback - ENAME + *@tc.desc : mute - VOICE_CALL - callback - Disable mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_0900', 2, async function (done) { await audioManager.setVolume(audio.AudioVolumeType.VOICE_CALL, highVol); audioManager.mute(audio.AudioVolumeType.VOICE_CALL, true, (err) => { if (err) { console.error(`AudioFrameworkTest: Failed to mute the stream. ${err.message}`); expect(false).assertTrue(); + done(); + return; } console.log('AudioFrameworkTest: Callback invoked to indicate that the stream is muted.'); audioManager.mute(audio.AudioVolumeType.VOICE_CALL, false, (err) => { if (err) { console.error(`AudioFrameworkTest: Set Stream Mute: VOICE_CALL: Callback: Error : ${err.message}`); expect(false).assertTrue(); - } - else { + done(); + } else { audioManager.getVolume(audio.AudioVolumeType.VOICE_CALL, (err, value) => { if (err) { console.error(`Failed to obtain the volume. ${err.message}`); expect(false).assertTrue(); - } - else if (value == highVol) { - console.info("AudioFrameworkTest: value is " + value); - expect(true).assertTrue(); - } - else { - console.info("AudioFrameworkTest: mute fail"); + done(); + } else if (value == highVol) { + audioManager.isMute(audio.AudioVolumeType.VOICE_CALL, (err, data) => { + if (err) { + console.error(`AudioFrameworkTest: Callback : FALSE: VOICE_CALL : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: FALSE: PASS: ' + data); + expect(true).assertTrue(); + } else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: FALSE: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); + } else { + console.info(`AudioFrameworkTest: mute fail: value ${value}`); expect(false).assertTrue(); + done(); } }); - audioManager.isMute(audio.AudioVolumeType.VOICE_CALL, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : FALSE: VOICE_CALL : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: FALSE: PASS: ' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: FALSE: FAIL: ' + data); - expect(false).assertTrue(); - } - done(); - }); } - done(); }); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_022 - * @tc.name : mute - VOICE_CALL - Promise - ENAME - * @tc.desc : mute - VOICE_CALL - Promise - Disable mute - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_022', 0, async function (done) { - await audioManager.setVolume(audio.AudioVolumeType.VOICE_CALL, lowVol); - await audioManager.mute(audio.AudioVolumeType.VOICE_CALL, true).then(() => { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1000 + *@tc.name : mute - VOICE_CALL - Promise - ENAME + *@tc.desc : mute - VOICE_CALL - Promise - Disable mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1000', 2, async function (done) { + try { + await audioManager.setVolume(audio.AudioVolumeType.VOICE_CALL, lowVol); + await audioManager.mute(audio.AudioVolumeType.VOICE_CALL, true); console.log('AudioFrameworkTest: Promise returned to indicate that the stream is muted.'); - }) - .catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream isMute VOICE_CALL: FALSE: ERROR:' + err.message); + await audioManager.mute(audio.AudioVolumeType.VOICE_CALL, false); + let value = await audioManager.getVolume(audio.AudioVolumeType.VOICE_CALL); + console.info("AudioFrameworkTest: value is " + value); + if (value == lowVol) { + expect(true).assertTrue(); + } else { expect(false).assertTrue(); - }); - await audioManager.mute(audio.AudioVolumeType.VOICE_CALL, false).then(async function () { - console.log('AudioFrameworkTest: Set Stream Mute: VOICE_CALL: Promise: FALSE'); - await audioManager.getVolume(audio.AudioVolumeType.VOICE_CALL).then((value) => { - console.info("AudioFrameworkTest: value is " + value); - if (value == lowVol) { - expect(true).assertTrue(); - } - else { - expect(false).assertTrue(); - } - }); - await audioManager.isMute(audio.AudioVolumeType.VOICE_CALL).then(function (data) { - if (data == false) { - console.log('AudioFrameworkTest: Promise: Is Stream Mute VOICE_CALL: FALSE: PASS:' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Promise: Is Stream Mute VOICE_CALL: FALSE: FAIL: ' + data); - expect(false).assertTrue(); - } - }) - .catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream isMute VOICE_CALL: FALSE: ERROR:' + err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream Mute VOICE_CALL: FALSE: ERROR:' + err.message); + } + let data = await audioManager.isMute(audio.AudioVolumeType.VOICE_CALL); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute VOICE_CALL: FALSE: PASS:' + data); + expect(true).assertTrue(); + } + } catch (err) { + console.info('err:' + JSON.stringify(err)); expect(false).assertTrue(); - }); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_023 - * @tc.name : mute - VOICE_ASSISTANT - callback - ENAME - * @tc.desc : mute - VOICE_ASSISTANT - callback - Disable mute - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_023', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1100 + *@tc.name : mute - VOICE_ASSISTANT - callback - ENAME + *@tc.desc : mute - VOICE_ASSISTANT - callback - Disable mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1100', 2, async function (done) { await audioManager.setVolume(audio.AudioVolumeType.VOICE_ASSISTANT, highVol); audioManager.mute(audio.AudioVolumeType.VOICE_ASSISTANT, true, (err) => { if (err) { console.error(`AudioFrameworkTest: Failed to mute the stream. ${err.message}`); expect(false).assertTrue(); + done(); + return; } console.log('AudioFrameworkTest: Callback invoked to indicate that the stream is muted.'); audioManager.mute(audio.AudioVolumeType.VOICE_ASSISTANT, false, (err) => { if (err) { console.error(`AudioFrameworkTest: Set Stream Mute: VOICE_ASSISTANT: Callback: Error : ${err.message}`); expect(false).assertTrue(); + done(); } else { audioManager.getVolume(audio.AudioVolumeType.VOICE_ASSISTANT, (err, value) => { if (err) { console.error(`Failed to obtain the volume. ${err.message}`); expect(false).assertTrue(); + done(); } else if (value == highVol) { - console.info("AudioFrameworkTest: value is " + value); - expect(true).assertTrue(); - } - else { - console.info("AudioFrameworkTest: mute fail"); - expect(false).assertTrue(); - } - }); - audioManager.isMute(audio.AudioVolumeType.VOICE_ASSISTANT, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : FALSE: VOICE_ASSISTANT : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: FALSE: PASS: ' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: FALSE: FAIL: ' + data); + audioManager.isMute(audio.AudioVolumeType.VOICE_ASSISTANT, (err, data) => { + if (err) { + console.error(`AudioFrameworkTest: Callback : FALSE: VOICE_ASSISTANT : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: FALSE: PASS: ' + data); + expect(true).assertTrue(); + } else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: FALSE: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); + } else { + console.info(`AudioFrameworkTest: mute fail: value ${value}`); expect(false).assertTrue(); + done(); } - done(); }); } - done(); }); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_024 - * @tc.name : mute - VOICE_ASSISTANT - Promise - ENAME - * @tc.desc : mute - VOICE_ASSISTANT - Promise - Disable mute - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_024', 0, async function (done) { - await audioManager.setVolume(audio.AudioVolumeType.VOICE_ASSISTANT, lowVol); - await audioManager.mute(audio.AudioVolumeType.VOICE_ASSISTANT, true).then(() => { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1200 + *@tc.name : mute - VOICE_ASSISTANT - Promise - ENAME + *@tc.desc : mute - VOICE_ASSISTANT - Promise - Disable mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1200', 2, async function (done) { + try { + await audioManager.setVolume(audio.AudioVolumeType.VOICE_ASSISTANT, lowVol); + await audioManager.mute(audio.AudioVolumeType.VOICE_ASSISTANT, true); console.log('AudioFrameworkTest: Promise returned to indicate that the stream is muted.'); - }) - .catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream isMute VOICE_ASSISTANT: FALSE: ERROR:' + err.message); + await audioManager.mute(audio.AudioVolumeType.VOICE_ASSISTANT, false); + let value = await audioManager.getVolume(audio.AudioVolumeType.VOICE_ASSISTANT); + console.info("AudioFrameworkTest: value is " + value); + if (value == lowVol) { + expect(true).assertTrue(); + } else { expect(false).assertTrue(); - }); - await audioManager.mute(audio.AudioVolumeType.VOICE_ASSISTANT, false).then(async function () { - console.log('AudioFrameworkTest: Set Stream Mute: VOICE_ASSISTANT: Promise: FALSE'); - await audioManager.getVolume(audio.AudioVolumeType.VOICE_ASSISTANT).then((value) => { - console.info("AudioFrameworkTest: value is " + value); - if (value == lowVol) { - expect(true).assertTrue(); - } - else { - expect(false).assertTrue(); - } - }); - await audioManager.isMute(audio.AudioVolumeType.VOICE_ASSISTANT).then(function (data) { - if (data == false) { - console.log('AudioFrameworkTest: Promise: Is Stream Mute VOICE_ASSISTANT: FALSE: PASS:' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Promise: Is Stream Mute VOICE_ASSISTANT: FALSE: FAIL: ' + data); - expect(false).assertTrue(); - } - }) - .catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream isMute VOICE_ASSISTANT: FALSE: ERROR:' + err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream Mute VOICE_ASSISTANT: FALSE: ERROR:' + err.message); + } + let data = await audioManager.isMute(audio.AudioVolumeType.VOICE_ASSISTANT); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute VOICE_ASSISTANT: FALSE: PASS:' + data); + expect(true).assertTrue(); + } + } catch (err) { + console.info('err :' + JSON.stringify(err)); expect(false).assertTrue(); - }); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_017 - * @tc.name : mute - Media - Promise - SetVolume - * @tc.desc : mute - Media - Promise - Enable mute -SetVolume - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_017', 0, async function (done) { - await audioManager.setVolume(audioMedia, highVol); - await audioManager.mute(audioMedia, true).then(async function () { - console.log('AudioFrameworkTest: Set Stream Mute: Media: Promise: TRUE'); - await audioManager.getVolume(audioMedia).then((value) => { - console.info("AudioFrameworkTest: value is " + value); - if (value == 0) { - expect(true).assertTrue(); - } - else { - expect(false).assertTrue(); - } - }); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1300 + *@tc.name : mute - Media - Promise - SetVolume + *@tc.desc : mute - Media - Promise - Enable mute -SetVolume + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1300', 2, async function (done) { + try { + await audioManager.setVolume(audioMedia, highVol); + await audioManager.mute(audioMedia, true); + let value = await audioManager.getVolume(audioMedia); + console.info("AudioFrameworkTest: value is " + value); + if (value == 0) { + expect(true).assertTrue(); + } else { + expect(false).assertTrue(); + } await audioManager.setVolume(audioMedia, lowVol); - await audioManager.isMute(audioMedia).then(function (data) { - if (data == false) { - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: PASS:' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: FAIL: ' + data); - expect(false).assertTrue(); - } - }) - .catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream isMute Media: SetVolume: ERROR:' + err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: ERROR:' + err.message); + let data = await audioManager.isMute(audioMedia); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: PASS:' + data); + expect(true).assertTrue(); + } else { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: FAIL: ' + data); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); expect(false).assertTrue(); - }); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_018 - * @tc.name : mute - Media - callback - SetVolume - * @tc.desc : mute - Media - callback - Enable mute - SetVolume - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_018', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1400 + *@tc.name : mute - Media - callback - SetVolume + *@tc.desc : mute - Media - callback - Enable mute - SetVolume + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1400', 2, async function (done) { await audioManager.setVolume(audioMedia, lowVol); audioManager.mute(audioMedia, true, async (err) => { if (err) { console.error(`AudioFrameworkTest: Callback : SetVolume: Media : failed to set Mute Status ${err.message}`); expect().assertFail(); - } - else { + done(); + } else { console.log('AudioFrameworkTest: Set Stream Mute: Media: Callback : TRUE'); - audioManager.getVolume(audioMedia, (err, value) => { + audioManager.getVolume(audioMedia, async (err, value) => { if (err) { console.error(`Failed to obtain the volume. ${err.message}`); expect(false).assertTrue(); - } - else if (value == 0) { - console.info("AudioFrameworkTest: value is " + value); - expect(true).assertTrue(); - } - else { - console.info("AudioFrameworkTest: mute fail"); - expect(false).assertTrue(); - } - }); - await audioManager.setVolume(audioMedia, highVol); - audioManager.isMute(audioMedia, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : SetVolume: Media : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: PASS: ' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: FAIL: ' + data); + done(); + } else if (value == 0) { + await audioManager.setVolume(audioMedia, highVol, (err) => { + if (err) { + console.error(`Failed to obtain the volume. ${err.message}`); + expect(false).assertTrue(); + done(); + return; + } + audioManager.isMute(audioMedia, (err, data) => { + if (err) { + console.error(`AudioFrameworkTest: Callback : SetVolume: Media : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: PASS: ' + data); + expect(true).assertTrue(); + } + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); + }); + } else { + console.info(`AudioFrameworkTest: mute fail: value ${value}`); expect(false).assertTrue(); + done(); } - done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_019 - * @tc.name : mute - Ringtone - Promise - SetVolume - * @tc.desc : mute - Ringtone - Promise - Enable mute - SetVolume - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_019', 0, async function (done) { - await audioManager.setVolume(audioRingtone, lowVol); - await audioManager.mute(audioRingtone, true).then(async function () { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1500 + *@tc.name : mute - Ringtone - Promise - SetVolume + *@tc.desc : mute - Ringtone - Promise - Enable mute - SetVolume + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1500', 2, async function (done) { + try { + await audioManager.setVolume(audioRingtone, lowVol); + await audioManager.mute(audioRingtone, true); console.log('AudioFrameworkTest: Set Stream Mute: Ringtone: Promise: SetVolume'); - await audioManager.getVolume(audioRingtone).then((value) => { - console.info("AudioFrameworkTest: value is " + value); - if (value == 0) { - expect(true).assertTrue(); - } - else { - expect(false).assertTrue(); - } - }); + let value = await audioManager.getVolume(audioRingtone); + console.info("AudioFrameworkTest: value is " + value); + if (value == 0) { + expect(true).assertTrue(); + } + else { + expect(false).assertTrue(); + } await audioManager.setVolume(audioRingtone, highVol); - await audioManager.isMute(audioRingtone).then(function (data) { - if (data == false) { - console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: PASS:' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: FAIL: ' + data); - expect(false).assertTrue(); - } - }) - .catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream isMute Ringtone: SetVolume: ERROR:' + err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: ERROR:' + err.message); + let data = await audioManager.isMute(audioRingtone); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: PASS:' + data); + expect(true).assertTrue(); + } + } catch (err) { + console.info('err :' + JSON.stringify(err)); expect(false).assertTrue(); - }); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_020 - * @tc.name : mute - Ringtone - callback - SetVolume - * @tc.desc : mute - Ringtone - callback - Enable mute - SetVolume - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_020', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1600 + *@tc.name : mute - Ringtone - callback - SetVolume + *@tc.desc : mute - Ringtone - callback - Enable mute - SetVolume + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1600', 2, async function (done) { await audioManager.setVolume(audioRingtone, highVol); audioManager.mute(audioRingtone, true, async (err) => { if (err) { console.error(`AudioFrameworkTest: Callback : SetVolume: Ringtone : failed to set Mute Status ${err.message}`); expect().assertFail(); - } - else { + done(); + } else { console.log('AudioFrameworkTest: Set Stream Mute: Ringtone: Callback : SetVolume'); - audioManager.getVolume(audioRingtone, (err, value) => { + audioManager.getVolume(audioRingtone, async (err, value) => { if (err) { console.error(`Failed to obtain the volume. ${err.message}`); expect(false).assertTrue(); - } - else if (value == 0) { - console.info("AudioFrameworkTest: value is " + value); - expect(true).assertTrue(); - } - else { - console.info("AudioFrameworkTest: mute fail"); - expect(false).assertTrue(); - } - }); - await audioManager.setVolume(audioRingtone, lowVol); - audioManager.isMute(audioRingtone, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : SetVolume: Ringtone : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: PASS: ' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: FAIL: ' + data); + done(); + } else if (value == 0) { + await audioManager.setVolume(audioRingtone, lowVol); + audioManager.isMute(audioRingtone, (err, data) => { + if (err) { + console.error(`AudioFrameworkTest: Callback : SetVolume: Ringtone : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: PASS: ' + data); + expect(true).assertTrue(); + } else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); + } else { + console.info(`AudioFrameworkTest: mute fail: value ${value}`); expect(false).assertTrue(); + done(); } - done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_025 - * @tc.name : mute - VOICE_CALL - Promise - SetVolume - * @tc.desc : mute - VOICE_CALL - Promise - Enable mute -SetVolume - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_025', 0, async function (done) { - await audioManager.setVolume(audio.AudioVolumeType.VOICE_CALL, highVol); - await audioManager.mute(audio.AudioVolumeType.VOICE_CALL, true).then(async function () { - console.log('AudioFrameworkTest: Set Stream Mute: VOICE_CALL: Promise: TRUE'); - await audioManager.getVolume(audio.AudioVolumeType.VOICE_CALL).then((value) => { - console.info("AudioFrameworkTest: value is " + value); - if (value == 0) { - expect(true).assertTrue(); - } - else { - expect(false).assertTrue(); - } - }); - await audioManager.setVolume(audio.AudioVolumeType.VOICE_CALL, lowVol); - await audioManager.isMute(audio.AudioVolumeType.VOICE_CALL).then(function (data) { - if (data == false) { - console.log('AudioFrameworkTest: Promise: Is Stream Mute VOICE_CALL: SetVolume: PASS:' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Promise: Is Stream Mute VOICE_CALL: SetVolume: FAIL: ' + data); - expect(false).assertTrue(); - } - }) - .catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream isMute VOICE_CALL: SetVolume: ERROR:' + err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream Mute VOICE_CALL: SetVolume: ERROR:' + err.message); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1700 + *@tc.name : mute - VOICE_CALL - Promise - SetVolume + *@tc.desc : mute - VOICE_CALL - Promise - Enable mute -SetVolume + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1700', 2, async function (done) { + try { + await audioManager.setVolume(audio.AudioVolumeType.VOICE_CALL, highVol); + await audioManager.mute(audio.AudioVolumeType.VOICE_CALL, true); + let value = await audioManager.getVolume(audio.AudioVolumeType.VOICE_CALL) + console.info("AudioFrameworkTest: value is " + value); + if (value == 0) { + expect(true).assertTrue(); + } else { + expect(false).assertTrue(); + } + await audioManager.setVolume(audio.AudioVolumeType.VOICE_CALL, lowVol); + let data = await audioManager.isMute(audio.AudioVolumeType.VOICE_CALL); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute VOICE_CALL: SetVolume: PASS:' + data); + expect(true).assertTrue(); + } + } catch (err) { + console.info('err:' + JSON.stringify(err)); expect(false).assertTrue(); - }); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_026 - * @tc.name : mute - VOICE_CALL - callback - SetVolume - * @tc.desc : mute - VOICE_CALL - callback - Enable mute - SetVolume - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_026', 0, async function (done) { - await audioManager.setVolume(audio.AudioVolumeType.VOICE_CALL, highVol); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1800 + *@tc.name : mute - VOICE_CALL - callback - SetVolume + *@tc.desc : mute - VOICE_CALL - callback - Enable mute - SetVolume + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1800', 2, async function (done) { + try { + await audioManager.setVolume(audio.AudioVolumeType.VOICE_CALL, highVol); + } catch (err) { + console.error(`setVolume : failed to set Mute Status ${err.message}`); + expect().assertFail(); + done(); + return; + } audioManager.mute(audio.AudioVolumeType.VOICE_CALL, true, async (err) => { if (err) { console.error(`AudioFrameworkTest: Callback : SetVolume: VOICE_CALL : failed to set Mute Status ${err.message}`); expect().assertFail(); + done(); } else { console.log('AudioFrameworkTest: Set Stream Mute: VOICE_CALL: Callback : SetVolume'); - audioManager.getVolume(audio.AudioVolumeType.VOICE_CALL, (err, value) => { + audioManager.getVolume(audio.AudioVolumeType.VOICE_CALL, async (err, value) => { if (err) { console.error(`Failed to obtain the volume. ${err.message}`); expect(false).assertTrue(); - } - else if (value == 0) { - console.info("AudioFrameworkTest: value is " + value); - expect(true).assertTrue(); - } - else { - console.info("AudioFrameworkTest: mute fail"); - expect(false).assertTrue(); - } - }); - await audioManager.setVolume(audio.AudioVolumeType.VOICE_CALL, lowVol); - audioManager.isMute(audio.AudioVolumeType.VOICE_CALL, (err, data) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : SetVolume: VOICE_CALL : failed to get Mute Status ${err.message}`); - expect().assertFail(); - } - else if (data == false) { - console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: SetVolume: PASS: ' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: SetVolume: FAIL: ' + data); + done(); + } else if (value == 0) { + try { + await audioManager.setVolume(audio.AudioVolumeType.VOICE_CALL, lowVol); + } catch (err) { + console.error(`setVolume : failed to set Mute Status ${err.message}`); + expect().assertFail(); + done(); + return; + } + audioManager.isMute(audio.AudioVolumeType.VOICE_CALL, (err, data) => { + if (err) { + console.error(`AudioFrameworkTest: Callback : SetVolume: VOICE_CALL : failed to get Mute Status ${err.message}`); + expect().assertFail(); + } else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: SetVolume: PASS: ' + data); + expect(true).assertTrue(); + } else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_CALL: SetVolume: FAIL: ' + data); + expect(false).assertTrue(); + } + done(); + }); + } else { + console.info(`AudioFrameworkTest: mute fail: value ${value}`); expect(false).assertTrue(); + done(); } - done(); }); } - done(); + }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_027 - * @tc.name : mute - VOICE_ASSISTANT - Promise - SetVolume - * @tc.desc : mute - VOICE_ASSISTANT - Promise - Enable mute -SetVolume - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_027', 0, async function (done) { - await audioManager.setVolume(audio.AudioVolumeType.VOICE_ASSISTANT, highVol); - await audioManager.mute(audio.AudioVolumeType.VOICE_ASSISTANT, true).then(async function () { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1900 + *@tc.name : mute - VOICE_ASSISTANT - Promise - SetVolume + *@tc.desc : mute - VOICE_ASSISTANT - Promise - Enable mute -SetVolume + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_1900', 2, async function (done) { + try { + await audioManager.setVolume(audio.AudioVolumeType.VOICE_ASSISTANT, highVol); + await audioManager.mute(audio.AudioVolumeType.VOICE_ASSISTANT, true); console.log('AudioFrameworkTest: Set Stream Mute: VOICE_ASSISTANT: Promise: TRUE'); - await audioManager.getVolume(audio.AudioVolumeType.VOICE_ASSISTANT).then((value) => { - console.info("AudioFrameworkTest: value is " + value); - if (value == 0) { - expect(true).assertTrue(); - } - else { - expect(false).assertTrue(); - } - }); + let value = await audioManager.getVolume(audio.AudioVolumeType.VOICE_ASSISTANT); + console.info("AudioFrameworkTest: value is " + value); + if (value == 0) { + expect(true).assertTrue(); + } else { + expect(false).assertTrue(); + } await audioManager.setVolume(audio.AudioVolumeType.VOICE_ASSISTANT, lowVol); - await audioManager.isMute(audio.AudioVolumeType.VOICE_ASSISTANT).then(function (data) { - if (data == false) { - console.log('AudioFrameworkTest: Promise: Is Stream Mute VOICE_ASSISTANT: SetVolume: PASS:' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Promise: Is Stream Mute VOICE_ASSISTANT: SetVolume: FAIL: ' + data); - expect(false).assertTrue(); - } - }) - .catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream isMute VOICE_ASSISTANT: SetVolume: ERROR:' + err.message); - expect(false).assertTrue(); - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Promise: Is Stream Mute VOICE_ASSISTANT: SetVolume: ERROR:' + err.message); + let data = await audioManager.isMute(audio.AudioVolumeType.VOICE_ASSISTANT); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute VOICE_ASSISTANT: SetVolume: PASS:' + data); + expect(true).assertTrue(); + } + } catch (err) { + console.info('err :' + JSON.stringify(err)); expect(false).assertTrue(); - }); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_mute_028 - * @tc.name : mute - VOICE_ASSISTANT - callback - SetVolume - * @tc.desc : mute - VOICE_ASSISTANT - callback - Enable mute - SetVolume - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_mute_028', 0, async function (done) { - await audioManager.setVolume(audio.AudioVolumeType.VOICE_ASSISTANT, highVol); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_2000 + *@tc.name : mute - VOICE_ASSISTANT - callback - SetVolume + *@tc.desc : mute - VOICE_ASSISTANT - callback - Enable mute - SetVolume + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_MUTE_2000', 2, async function (done) { + try { + await audioManager.setVolume(audio.AudioVolumeType.VOICE_ASSISTANT, highVol); + } catch (err) { + console.log('setVolume err :' + JSON.stringify(err)); + expect().assertFail(); + done(); + return; + } audioManager.mute(audio.AudioVolumeType.VOICE_ASSISTANT, true, async (err) => { if (err) { console.error(`AudioFrameworkTest: Callback : SetVolume: VOICE_ASSISTANT : failed to set Mute Status ${err.message}`); expect().assertFail(); - } - else { + done(); + } else { console.log('AudioFrameworkTest: Set Stream Mute: VOICE_ASSISTANT: Callback : SetVolume'); - await audioManager.getVolume(audio.AudioVolumeType.VOICE_ASSISTANT).then((value) => { + try { + let value = await audioManager.getVolume(audio.AudioVolumeType.VOICE_ASSISTANT); if (value == 0) { console.info("AudioFrameworkTest: value is " + value); expect(true).assertTrue(); - } - else { + } else { expect(false).assertTrue(); } - }); - await audioManager.setVolume(audio.AudioVolumeType.VOICE_ASSISTANT, lowVol); + await audioManager.setVolume(audio.AudioVolumeType.VOICE_ASSISTANT, lowVol); + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect().assertFail(); + done(); + return; + } audioManager.isMute(audio.AudioVolumeType.VOICE_ASSISTANT, (err, data) => { if (err) { console.error(`AudioFrameworkTest: Callback : SetVolume: VOICE_ASSISTANT : failed to get Mute Status ${err.message}`); expect().assertFail(); - } - else if (data == false) { + } else if (data == false) { console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: SetVolume: PASS: ' + data); expect(true).assertTrue(); - } - else { + } else { console.log('AudioFrameworkTest: Callback : Is Stream Mute VOICE_ASSISTANT: SetVolume: FAIL: ' + data); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_isActive_005 - * @tc.name : isActive - Media - Promise - * @tc.desc : isActive - Media - Promise - When stream is NOT playing - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_isActive_005', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0100 + *@tc.name : isActive - Media - Promise + *@tc.desc : isActive - Media - Promise - When stream is NOT playing + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0100', 1, async function (done) { console.log('AudioFrameworkTest: Promise : isActive Media: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS'); - const promise = audioManager.isActive(audioMedia); - promise.then(function (data) { + const PROMISE = audioManager.isActive(audioMedia); + PROMISE.then(function (data) { if (data == false) { console.log('AudioFrameworkTest: Promise: isActive: Media: TRUE: PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.log('AudioFrameworkTest: Promise: isActive: Media: TRUE: FAIL: ' + data); expect(false).assertTrue(); } + }).catch(err => { + console.log('err :' + JSON.stringify(err)); + expect().assertFail(); }); - await promise; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_isActive_006 - * @tc.name : isActive - Media - Callback - * @tc.desc : isActive - Media - Callback - When stream is NOT playing - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_isActive_006', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0200 + *@tc.name : isActive - Media - Callback + *@tc.desc : isActive - Media - Callback - When stream is NOT playing + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0200', 1, async function (done) { console.log('AudioFrameworkTest: Callback : isActive Media: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS'); audioManager.isActive(audioMedia, (err, data) => { if (err) { console.error(`AudioFrameworkTest: Callback : Media : isActive: failed ${err.message}`); expect().assertFail(); - } - else if (data == false) { + } else if (data == false) { console.log('AudioFrameworkTest: Callback: isActive: Media: TRUE: PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.log('AudioFrameworkTest: Callback: isActive: Media: TRUE: FAIL: ' + data); expect(false).assertTrue(); } @@ -3527,51 +3273,51 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_isActive_007 - * @tc.name : isActive - Ringtone - Promise - * @tc.desc : isActive - Ringtone - Promise - When stream is NOT playing - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_isActive_007', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0300 + *@tc.name : isActive - Ringtone - Promise + *@tc.desc : isActive - Ringtone - Promise - When stream is NOT playing + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0300', 2, async function (done) { console.log('AudioFrameworkTest: Promise : isActive Ringtone: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS'); - const promise = audioManager.isActive(audioRingtone); - promise.then(function (data) { + const PROMISE = audioManager.isActive(audioRingtone); + PROMISE.then(function (data) { if (data == false) { console.log('AudioFrameworkTest: Promise: isActive: Ringtone: TRUE: PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.log('AudioFrameworkTest: Promise: isActive: Ringtone: TRUE: FAIL: ' + data); expect(false).assertTrue(); } + }).catch(err => { + console.log('err :' + JSON.stringify(err)); + expect().assertFail(); }); - await promise; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_isActive_008 - * @tc.name : isActive - Ringtone - Callback - * @tc.desc : isActive - Ringtone - Callback - When stream is NOT playing - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_isActive_008', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0400 + *@tc.name : isActive - Ringtone - Callback + *@tc.desc : isActive - Ringtone - Callback - When stream is NOT playing + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0400', 2, async function (done) { console.log('AudioFrameworkTest: Callback : isActive Ringtone: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS'); audioManager.isActive(audioRingtone, (err, data) => { if (err) { console.error(`AudioFrameworkTest: Callback : Ringtone : isActive: failed ${err.message}`); expect().assertFail(); - } - else if (data == false) { + } else if (data == false) { console.log('AudioFrameworkTest: Callback: isActive: Ringtone: TRUE: PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.log('AudioFrameworkTest: Callback: isActive: Ringtone: TRUE: FAIL: ' + data); expect(false).assertTrue(); } @@ -3579,51 +3325,50 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_isActive_013 - * @tc.name : isActive - Media - Promise - ENAME: - * @tc.desc : isActive - Media - Promise - When stream is NOT playing - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_isActive_013', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0500 + *@tc.name : isActive - Media - Promise - ENAME: + *@tc.desc : isActive - Media - Promise - When stream is NOT playing + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0500', 2, async function (done) { console.log('AudioFrameworkTest: Promise : isActive Media: ENAME: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS'); - const promise = audioManager.isActive(audio.AudioVolumeType.MEDIA); - promise.then(function (data) { + const PROMISE = audioManager.isActive(audio.AudioVolumeType.MEDIA); + PROMISE.then(function (data) { if (data == false) { console.log('AudioFrameworkTest: Promise: isActive: Media: ENAME: TRUE: PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.log('AudioFrameworkTest: Promise: isActive: Media: ENAME: TRUE: FAIL: ' + data); expect(false).assertTrue(); } + }).catch(err => { + console.log('err :' + JSON.stringify(err)); + expect().assertFail(); }); - await promise; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_isActive_014 - * @tc.name : isActive - Media - Callback - ENAME - * @tc.desc : isActive - Media - Callback - When stream is NOT playing - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_isActive_014', 0, async function (done) { - console.log('AudioFrameworkTest: Callback : isActive Media: ENAME: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS'); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0600 + *@tc.name : isActive - Media - Callback - ENAME + *@tc.desc : isActive - Media - Callback - When stream is NOT playing + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0600', 2, async function (done) { audioManager.isActive(audio.AudioVolumeType.MEDIA, (err, data) => { if (err) { console.error(`AudioFrameworkTest: Callback : Media : ENAME: isActive: failed ${err.message}`); expect().assertFail(); - } - else if (data == false) { + } else if (data == false) { console.log('AudioFrameworkTest: Callback: isActive: Media: ENAME: TRUE: PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.log('AudioFrameworkTest: Callback: isActive: Media: ENAME: TRUE: FAIL: ' + data); expect(false).assertTrue(); } @@ -3631,51 +3376,51 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_isActive_015 - * @tc.name : isActive - Ringtone - Promise - ENAME - * @tc.desc : isActive - Ringtone - Promise - When stream is NOT playing - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_isActive_015', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0700 + *@tc.name : isActive - Ringtone - Promise - ENAME + *@tc.desc : isActive - Ringtone - Promise - When stream is NOT playing + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0700', 2, async function (done) { console.log('AudioFrameworkTest: Promise : isActive Ringtone: ENAME: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS'); - const promise = audioManager.isActive(audio.AudioVolumeType.RINGTONE); - promise.then(function (data) { + const PROMISE = audioManager.isActive(audio.AudioVolumeType.RINGTONE); + PROMISE.then(function (data) { if (data == false) { console.log('AudioFrameworkTest: Promise: isActive: Ringtone: ENAME: TRUE: PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.log('AudioFrameworkTest: Promise: isActive: Ringtone: ENAME: TRUE: FAIL: ' + data); expect(false).assertTrue(); } + }).catch(err => { + console.log('err :' + JSON.stringify(err)); + expect().assertFail(); }); - await promise; + await PROMISE; done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_isActive_016 - * @tc.name : isActive - Ringtone - Callback - ENAME - * @tc.desc : isActive - Ringtone - Callback - When stream is NOT playing - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_isActive_016', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0800 + *@tc.name : isActive - Ringtone - Callback - ENAME + *@tc.desc : isActive - Ringtone - Callback - When stream is NOT playing + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_ISACTIVE_0800', 2, async function (done) { console.log('AudioFrameworkTest: Callback : isActive Ringtone: ENAME: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS'); audioManager.isActive(audio.AudioVolumeType.RINGTONE, (err, data) => { if (err) { console.error(`AudioFrameworkTest: Callback : Ringtone : ENAME: isActive: failed ${err.message}`); expect().assertFail(); - } - else if (data == false) { + } else if (data == false) { console.log('AudioFrameworkTest: Callback: isActive: Ringtone: ENAME: TRUE: PASS:' + data); expect(true).assertTrue(); - } - else { + } else { console.log('AudioFrameworkTest: Callback: isActive: Ringtone: ENAME: TRUE: FAIL: ' + data); expect(false).assertTrue(); } @@ -3683,75 +3428,72 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setMicrophoneMute_001 - * @tc.name : setMicrophoneMute - true - Promise - * @tc.desc : Enable mic mute - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setMicrophoneMute_001', 0, async function (done) { - await audioManager.setMicrophoneMute(true).then(function () { - console.log('AudioFrameworkTest: setMicrophoneMute: Promise: TRUE'); - audioManager.isMicrophoneMute().then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise: isMicrophoneMute: TRUE: PASS:' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Promise: isMicrophoneMute: TRUE: FAIL: ' + data); - expect(false).assertTrue(); - } - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Promise: setMicrophoneMute: TRUE: FAIL: Error :' + err.message); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETMICROPHONEMUTE_0100 + *@tc.name : setMicrophoneMute - true - Promise + *@tc.desc : Enable mic mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETMICROPHONEMUTE_0100', 1, async function (done) { + try { + await audioManager.setMicrophoneMute(true); + let data = await audioManager.isMicrophoneMute(); + if (data == true) { + console.log('AudioFrameworkTest: Promise: isMicrophoneMute: TRUE: PASS:' + data); + expect(true).assertTrue(); + } else { + console.log('AudioFrameworkTest: Promise: isMicrophoneMute: TRUE: FAIL: ' + data); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); expect(false).assertTrue(); - }); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setMicrophoneMute_002 - * @tc.name : setMicrophoneMute - false - Promise - * @tc.desc : Disable mic mute - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setMicrophoneMute_002', 0, async function (done) { - await audioManager.setMicrophoneMute(false).then(function () { - console.log('AudioFrameworkTest: setMicrophoneMute: Promise: FALSE'); - audioManager.isMicrophoneMute().then(function (data) { - if (data == false) { - console.log('AudioFrameworkTest: Promise: isMicrophoneMute: FALSE: PASS:' + data); - expect(true).assertTrue(); - } - else { - console.log('AudioFrameworkTest: Promise: isMicrophoneMute: FALSE: FAIL: ' + data); - expect(false).assertTrue(); - } - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Promise: setMicrophoneMute: FALSE: FAIL: Error :' + err.message); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETMICROPHONEMUTE_0200 + *@tc.name : setMicrophoneMute - false - Promise + *@tc.desc : Disable mic mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETMICROPHONEMUTE_0200', 1, async function (done) { + try { + await audioManager.setMicrophoneMute(false); + let data = await audioManager.isMicrophoneMute(); + if (data == false) { + console.log('AudioFrameworkTest: Promise: isMicrophoneMute: FALSE: PASS:' + data); + expect(true).assertTrue(); + } else { + console.log('AudioFrameworkTest: Promise: isMicrophoneMute: FALSE: FAIL: ' + data); + expect(false).assertTrue(); + } + } catch (err) { + console.info('Error :' + err.message); expect(false).assertTrue(); - }); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setMicrophoneMute_003 - * @tc.name : setMicrophoneMute - true - Callback - * @tc.desc : Enable mic mute - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setMicrophoneMute_003', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETMICROPHONEMUTE_0300 + *@tc.name : setMicrophoneMute - true - Callback + *@tc.desc : Enable mic mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETMICROPHONEMUTE_0300', 1, async function (done) { audioManager.setMicrophoneMute(true, (err) => { if (err) { console.error(`AudioFrameworkTest: setMicrophoneMute: Callback : TRUE: Error : ${err.message}`); expect(false).assertTrue(); + done(); } else { console.log('AudioFrameworkTest: setMicrophoneMute: Callback : TRUE'); @@ -3759,35 +3501,33 @@ describe('audioManager', function () { if (err) { console.error(`AudioFrameworkTest: Callback : TRUE: isMicrophoneMute : Error ${err.message}`); expect(false).assertTrue(); - } - else if (data == true) { + } else if (data == true) { console.log('AudioFrameworkTest: Callback : isMicrophoneMute: TRUE: PASS: ' + data); expect(true).assertTrue(); - } - else { + } else { console.log('AudioFrameworkTest: Callback : isMicrophoneMute: TRUE: FAIL: ' + data); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setMicrophoneMute_004 - * @tc.name : setMicrophoneMute - false - Callback - * @tc.desc : Disable mic mute - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setMicrophoneMute_004', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETMICROPHONEMUTE_0400 + *@tc.name : setMicrophoneMute - false - Callback + *@tc.desc : Disable mic mute + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETMICROPHONEMUTE_0400', 1, async function (done) { audioManager.setMicrophoneMute(false, (err) => { if (err) { console.error(`AudioFrameworkTest: setMicrophoneMute: Callback : FALSE: Error : ${err.message}`); expect(false).assertTrue(); + done(); } else { console.log('AudioFrameworkTest: setMicrophoneMute: Callback : FALSE'); @@ -3795,129 +3535,146 @@ describe('audioManager', function () { if (err) { console.error(`AudioFrameworkTest: Callback : FALSE: isMicrophoneMute : Error ${err.message}`); expect(false).assertTrue(); - } - else if (data == false) { + } else if (data == false) { console.log('AudioFrameworkTest: Callback : isMicrophoneMute: FALSE: PASS: ' + data); expect(true).assertTrue(); - } - else { + } else { console.log('AudioFrameworkTest: Callback : isMicrophoneMute: FALSE: FAIL: ' + data); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_002 - * @tc.name : setDeviceActive - SPEAKER - deactivate - Promise - * @tc.desc : Deactivate speaker - Promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_002', 0, async function (done) { - await audioManager.setDeviceActive(2, false).then(function () { - // Setting device active ENUM 2 = SPEAKER - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Deactivate'); - audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER).then(function (value) { - if (value == false) { - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : PASS :' + value); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100 + *@tc.name : setDeviceActive - SPEAKER - deactivate - Promise + *@tc.desc : Deactivate speaker - Promise + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100', 1, async function (done) { + try { + let flag = true; + let outputDeviceDescription = await audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG); + console.info('SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100 outputDeviceDescription is ' + JSON.stringify(outputDeviceDescription)); + if (outputDeviceDescription.length == 1 && outputDeviceDescription[0].deviceType == audio.DeviceType.SPEAKER) { + flag = false; + } + await audioManager.setDeviceActive(2, false).then(() => { + console.info('SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100 Promise returned to indicate that the device is set to the active status.'); + }); + await audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER).then(function (value) { + if (flag == true && value == false) { + console.info('SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100 isDeviceActive : SPEAKER: Deactivate : PASS :' + value + 'flag is ' + flag); + expect(true).assertTrue(); + } + else if (flag == false && value == true) { + console.info('SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100 isDeviceActive : SPEAKER: Deactivate : PASS :' + value + 'flag is ' + flag); expect(true).assertTrue(); } else { - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL :' + value); + console.info('SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0100 isDeviceActive : SPEAKER: Deactivate : fail :' + value + 'flag is ' + flag); expect(false).assertTrue(); } + }).catch((err) => { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); }); - }).catch((err) => { - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL : Error :' + err.message); + } catch (err) { + console.log('err :' + JSON.stringify(err)); expect(false).assertTrue(); - }); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_003 - * @tc.name : setDeviceActive - SPEAKER - Activate - Promise - * @tc.desc : Activate speaker - Promise - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_003', 0, async function (done) { - await audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, true).then(function () { - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Activate'); - audioManager.isDeviceActive(2).then(function (value) { - if (value == true) { - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :' + value); - expect(false).assertTrue(); - } - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :Error :' + err.message); + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0200 + *@tc.name : setDeviceActive - SPEAKER - Activate - Promise + *@tc.desc : Activate speaker - Promise + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0200', 1, async function (done) { + try { + await audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, true); + let value = await audioManager.isDeviceActive(2); + if (value == true) { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); expect(false).assertTrue(); - }); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_006 - * @tc.name : setDeviceActive - SPEAKER - deactivate - Callback - * @tc.desc : Deactivate speaker - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_006', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0300 + *@tc.name : setDeviceActive - SPEAKER - deactivate - Callback + *@tc.desc : Deactivate speaker - Callback + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0300', 2, async function (done) { + let flag = true + let outputDeviceDescription = await audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG); + console.info('SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0300 outputDeviceDescription is ' + JSON.stringify(outputDeviceDescription)); + if (outputDeviceDescription.length == 1 && outputDeviceDescription[0].deviceType == audio.DeviceType.SPEAKER) { + flag = false; + } audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, false, (err) => { if (err) { console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`); expect(false).assertTrue(); - } - else { + done(); + } else { console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); audioManager.isDeviceActive(2, (err, value) => { if (err) { console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`); expect(false).assertTrue(); - } - else if (value == false) { - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :' + value); + } else if (value == false && flag == true) { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :' + value + 'flag is ' + flag); + expect(true).assertTrue(); + } else if (value == true && flag == false) { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :' + value + 'flag is ' + flag);//1�? expect(true).assertTrue(); } else { - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : FAIL :' + value); + console.info('SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0300 AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : FAIL :value' + value + 'flag is ' + flag); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_007 - * @tc.name : setDeviceActive - SPEAKER - deactivate - Callback - * @tc.desc : Activate speaker - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setDeviceActive_007', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0400 + *@tc.name : setDeviceActive - SPEAKER - deactivate - Callback + *@tc.desc : Activate speaker - Callback + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETDEVICEACTIVE_0400', 2, async function (done) { audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, true, (err) => { if (err) { console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active: Error: ${err.message}`); expect(false).assertTrue(); + done(); } else { console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); @@ -3925,201 +3682,196 @@ describe('audioManager', function () { if (err) { console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active: Error: ${err.message}`); expect(false).assertTrue(); - } - else if (value == true) { + } else if (value == true) { console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : FAIL :' + value); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setAudioParameter_001 - * @tc.name : setAudioParameter - Promise - Character & Number - * @tc.desc : setAudioParameter - Promise - Character & Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setAudioParameter_001', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '8 bit'); - promise.then(function () { - console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { - if (value == '8 bit') { - console.info('AudioFrameworkTest: Promise: getAudioParameter: Bits per sample : PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Promise: getAudioParameter : Bits per sample : FAIL :' + value); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0100 + *@tc.name : setAudioParameter - Promise - Character & Number + *@tc.desc : setAudioParameter - Promise - Character & Number + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0100', 1, async function (done) { + try { + await audioManager.setAudioParameter('VOICE_PHONE_STATUS', '8 bit'); + let value = await audioManager.getAudioParameter('VOICE_PHONE_STATUS'); + if (value == '8 bit') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: Bits per sample : PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : Bits per sample : FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setAudioParameter_002 - * @tc.name : setAudioParameter - Promise - Number - * @tc.desc : setAudioParameter - Promise - Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setAudioParameter_002', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '4800'); - promise.then(function () { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0200 + *@tc.name : setAudioParameter - Promise - Number + *@tc.desc : setAudioParameter - Promise - Number + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0200', 1, async function (done) { + try { + await audioManager.setAudioParameter('VOICE_PHONE_STATUS', '4800'); console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { - if (value == '4800') { - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); - expect(false).assertTrue(); - } - }); - }); - await promise; + let value = await audioManager.getAudioParameter('VOICE_PHONE_STATUS'); + if (value == '4800') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setAudioParameter_003 - * @tc.name : setAudioParameter - Promise - Long Number - * @tc.desc : setAudioParameter - Promise - Long Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setAudioParameter_003', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', longValue); - promise.then(function () { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0300 + *@tc.name : setAudioParameter - Promise - Long Number + *@tc.desc : setAudioParameter - Promise - Long Number + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0300', 2, async function (done) { + try { + await audioManager.setAudioParameter('VOICE_PHONE_STATUS', longValue); console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { - if (value == longValue) { - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); - expect(false).assertTrue(); - } - }); - }); - await promise; + let value = await audioManager.getAudioParameter('VOICE_PHONE_STATUS'); + if (value == longValue) { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setAudioParameter_004 - * @tc.name : setAudioParameter - Promise - Decimal - * @tc.desc : setAudioParameter - Promise - Decimal - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setAudioParameter_004', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '10.000000234324324324'); - promise.then(function () { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0400 + *@tc.name : setAudioParameter - Promise - Decimal + *@tc.desc : setAudioParameter - Promise - Decimal + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0400', 2, async function (done) { + try { + await audioManager.setAudioParameter('VOICE_PHONE_STATUS', '10.000000234324324324'); console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { - if (value == '10.000000234324324324') { - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); - expect(false).assertTrue(); - } - }); - }); - await promise; + let value = await audioManager.getAudioParameter('VOICE_PHONE_STATUS'); + if (value == '10.000000234324324324') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setAudioParameter_005 - * @tc.name : setAudioParameter - Promise - Parameter name Number - * @tc.desc : setAudioParameter - Promise - Parameter name Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setAudioParameter_005', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', 'PPNumber'); - promise.then(function () { - console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { - if (value == 'PPNumber') { - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0500 + *@tc.name : setAudioParameter - Promise - Parameter name Number + *@tc.desc : setAudioParameter - Promise - Parameter name Number + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0500', 2, async function (done) { + try { + await audioManager.setAudioParameter('VOICE_PHONE_STATUS', 'PPNumber'); + let value = await audioManager.getAudioParameter('VOICE_PHONE_STATUS'); + if (value == 'PPNumber') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setAudioParameter_006 - * @tc.name : setAudioParameter - Promise - Special Characters - * @tc.desc : setAudioParameter - Promise - Special Characters - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setAudioParameter_006', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '[]\:";<>?,./~!@#$%^*()_+-={}|'); - promise.then(function () { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0600 + *@tc.name : setAudioParameter - Promise - Special Characters + *@tc.desc : setAudioParameter - Promise - Special Characters + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0600', 2, async function (done) { + try { + await audioManager.setAudioParameter('VOICE_PHONE_STATUS', '[]\:";<>?,./~!@#$%^*()_+-={}|'); console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { - if (value == '[]\:";<>?,./~!@#$%^*()_+-={}|') { - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); - expect(false).assertTrue(); - } - }); - }); - await promise; + let value = await audioManager.getAudioParameter('VOICE_PHONE_STATUS'); + if (value == '[]\:";<>?,./~!@#$%^*()_+-={}|') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setAudioParameter_007 - * @tc.name : setAudioParameter - Callback - Character & Number - * @tc.desc : setAudioParameter - Callback - Character & Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setAudioParameter_007', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0700 + *@tc.name : setAudioParameter - Callback - Character & Number + *@tc.desc : setAudioParameter - Callback - Character & Number + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0700', 2, async function (done) { audioManager.setAudioParameter('VOICE_PHONE_STATUS', '16 bit', (err) => { console.info('AudioFrameworkTest: Audio Parameter Test: Callback : setAudioParameter'); if (err) { console.error(`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error: ${err.message}`); - expect(false).assertTrue(); - } - else { + expect(false).assertTrue(); + done(); + } else { audioManager.getAudioParameter('VOICE_PHONE_STATUS', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error: ${err.message}`); @@ -4136,569 +3888,542 @@ describe('audioManager', function () { done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setAudioParameter_008 - * @tc.name : setAudioParameter - Callback - Special Character - * @tc.desc : setAudioParameter - Callback - Special Character - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setAudioParameter_008', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0800 + *@tc.name : setAudioParameter - Callback - Special Character + *@tc.desc : setAudioParameter - Callback - Special Character + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0800', 2, async function (done) { audioManager.setAudioParameter('VOICE_PHONE_STATUS', '~!@#$%^*()_+-={}|[]\:";<>?,./', (err) => { console.info('AudioFrameworkTest: Audio Parameter Test: Callback : setAudioParameter'); if (err) { console.error(`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error: ${err.message}`); expect(false).assertTrue(); - } - else { + done(); + } else { audioManager.getAudioParameter('VOICE_PHONE_STATUS', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : getAudioParam: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); - } - else if (value == '~!@#$%^*()_+-={}|[]\:";<>?,./') { + } else if (value == '~!@#$%^*()_+-={}|[]\:";<>?,./') { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setAudioParameter_009 - * @tc.name : setAudioParameter - Callback - Decimal - * @tc.desc : setAudioParameter - Callback - Decimal - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setAudioParameter_009', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0900 + *@tc.name : setAudioParameter - Callback - Decimal + *@tc.desc : setAudioParameter - Callback - Decimal + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_0900', 2, async function (done) { audioManager.setAudioParameter('VOICE_PHONE_STATUS', '10000.21321432432432', (err) => { console.info('AudioFrameworkTest: Audio Parameter Test: Callback : setAudioParameter'); if (err) { console.error(`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error: ${err.message}`); expect(false).assertTrue(); - } - else { + done(); + } else { audioManager.getAudioParameter('VOICE_PHONE_STATUS', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback :getAudioParm: VOICE_PHONE_STATUS:Error: ${err.message}`); expect(false).assertTrue(); - } - else if (value == '10000.21321432432432') { + } else if (value == '10000.21321432432432') { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setAudioParameter_010 - * @tc.name : setAudioParameter - Callback - Number - * @tc.desc : setAudioParameter - Callback - Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setAudioParameter_010', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_1000 + *@tc.name : setAudioParameter - Callback - Number + *@tc.desc : setAudioParameter - Callback - Number + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_1000', 2, async function (done) { audioManager.setAudioParameter('VOICE_PHONE_STATUS', '5454', (err) => { console.info('AudioFrameworkTest: Audio Parameter Test: Callback :VOICE_PHONE_STATUS : setAudioParameter'); if (err) { console.error(`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error: ${err.message}`); expect(false).assertTrue(); - } - else { + done(); + } else { audioManager.getAudioParameter('VOICE_PHONE_STATUS', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : getAudioParam: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); - } - else if (value == '5454') { + } else if (value == '5454') { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); }); } - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setAudioParameter_011 - * @tc.name : setAudioParameter - Callback - Long Number - * @tc.desc : setAudioParameter - Callback - Long Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setAudioParameter_011', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_1100 + *@tc.name : setAudioParameter - Callback - Long Number + *@tc.desc : setAudioParameter - Callback - Long Number + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_1100', 2, async function (done) { audioManager.setAudioParameter('VOICE_PHONE_STATUS', longValue, (err) => { console.info('AudioFrameworkTest: Audio Parameter Test: Callback :VOICE_PHONE_STATUS : setAudioParameter'); if (err) { console.error(`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error: ${err.message}`); expect(false).assertTrue(); + done(); } audioManager.getAudioParameter('VOICE_PHONE_STATUS', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); - } - else if (value == longValue) { + } else if (value == longValue) { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); }); - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setAudioParameter_012 - * @tc.name : setAudioParameter - Callback - Parameter name Number - * @tc.desc : setAudioParameter - Callback - Parameter name Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setAudioParameter_012', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_1200 + *@tc.name : setAudioParameter - Callback - Parameter name Number + *@tc.desc : setAudioParameter - Callback - Parameter name Number + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_SETAUDIOPARAMETER_1200', 2, async function (done) { audioManager.setAudioParameter('VOICE_PHONE_STATUS', 'xyza', (err) => { console.info('AudioFrameworkTest: Audio Parameter Test: Callback :VOICE_PHONE_STATUS : setAudioParameter'); if (err) { console.error(`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error: ${err.message}`); expect(false).assertTrue(); + done(); } audioManager.getAudioParameter('VOICE_PHONE_STATUS', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); - } - else if (value == 'xyza') { + } else if (value == 'xyza') { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); }); - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getAudioParameter_001 - * @tc.name : getAudioParameter - Promise - Character & Number - * @tc.desc : getAudioParameter - Promise - Character & Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getAudioParameter_001', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '8 bit'); - promise.then(function () { - console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { - if (value == '8 bit') { - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0100 + *@tc.name : getAudioParameter - Promise - Character & Number + *@tc.desc : getAudioParameter - Promise - Character & Number + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0100', 2, async function (done) { + try { + await audioManager.setAudioParameter('VOICE_PHONE_STATUS', '8 bit'); + let value = await audioManager.getAudioParameter('VOICE_PHONE_STATUS'); + if (value == '8 bit') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getAudioParameter_002 - * @tc.name : getAudioParameter - Promise - Number - * @tc.desc : getAudioParameter - Promise - Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getAudioParameter_002', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '4800'); - promise.then(function () { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0200 + *@tc.name : getAudioParameter - Promise - Number + *@tc.desc : getAudioParameter - Promise - Number + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0200', 2, async function (done) { + try { + await audioManager.setAudioParameter('VOICE_PHONE_STATUS', '4800'); console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { - if (value == '4800') { - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); - expect(false).assertTrue(); - } - }); - }); - await promise; + let value = await audioManager.getAudioParameter('VOICE_PHONE_STATUS'); + if (value == '4800') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getAudioParameter_003 - * @tc.name : getAudioParameter - Promise - Long Number - * @tc.desc : getAudioParameter - Promise - Long Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getAudioParameter_003', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', longValue); - promise.then(function () { - console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { - if (value == longValue) { - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0300 + *@tc.name : getAudioParameter - Promise - Long Number + *@tc.desc : getAudioParameter - Promise - Long Number + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0300', 2, async function (done) { + try { + await audioManager.setAudioParameter('VOICE_PHONE_STATUS', longValue); + let value = await audioManager.getAudioParameter('VOICE_PHONE_STATUS'); + if (value == longValue) { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getAudioParameter_004 - * @tc.name : getAudioParameter - Promise - Decimal - * @tc.desc : getAudioParameter - Promise - Decimal - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getAudioParameter_004', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '10.0000000000234'); - promise.then(function () { - console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { - if (value == '10.0000000000234') { - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0400 + *@tc.name : getAudioParameter - Promise - Decimal + *@tc.desc : getAudioParameter - Promise - Decimal + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0400', 2, async function (done) { + try { + await audioManager.setAudioParameter('VOICE_PHONE_STATUS', '10.0000000000234'); + let value = await audioManager.getAudioParameter('VOICE_PHONE_STATUS'); + if (value == '10.0000000000234') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getAudioParameter_005 - * @tc.name : getAudioParameter - Promise - Parameter name Number - * @tc.desc : getAudioParameter - Promise - Parameter name Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getAudioParameter_005', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', 'PPNumber'); - promise.then(function () { - console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { - if (value == 'PPNumber') { - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); - expect(false).assertTrue(); - } - }); - }); - await promise; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0500 + *@tc.name : getAudioParameter - Promise - Parameter name Number + *@tc.desc : getAudioParameter - Promise - Parameter name Number + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0500', 2, async function (done) { + try { + await audioManager.setAudioParameter('VOICE_PHONE_STATUS', 'PPNumber'); + let value = await audioManager.getAudioParameter('VOICE_PHONE_STATUS'); + if (value == 'PPNumber') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getAudioParameter_006 - * @tc.name : getAudioParameter - Promise - Special Characters - * @tc.desc : getAudioParameter - Promise - Special Characters - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getAudioParameter_006', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '[]\:";<>?,./~!@#$%^*()_+-={}|'); - promise.then(function () { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0600 + *@tc.name : getAudioParameter - Promise - Special Characters + *@tc.desc : getAudioParameter - Promise - Special Characters + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0600', 2, async function (done) { + try { + await audioManager.setAudioParameter('VOICE_PHONE_STATUS', '[]\:";<>?,./~!@#$%^*()_+-={}|'); console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { - if (value == '[]\:";<>?,./~!@#$%^*()_+-={}|') { - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); - expect(true).assertTrue(); - } - else { - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); - expect(false).assertTrue(); - } - }); - }); - await promise; + let value = await audioManager.getAudioParameter('VOICE_PHONE_STATUS'); + if (value == '[]\:";<>?,./~!@#$%^*()_+-={}|') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); + expect(true).assertTrue(); + } else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); + expect(false).assertTrue(); + } + } catch (err) { + console.log('err :' + JSON.stringify(err)); + expect(false).assertTrue(); + } done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getAudioParameter_007 - * @tc.name : getAudioParameter - Callback - Character & Number - * @tc.desc : getAudioParameter - Callback - Character & Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getAudioParameter_007', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0700 + *@tc.name : getAudioParameter - Callback - Character & Number + *@tc.desc : getAudioParameter - Callback - Character & Number + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0700', 2, async function (done) { audioManager.setAudioParameter('VOICE_PHONE_STATUS', '16 bit', (err) => { console.info('AudioFrameworkTest: Audio Parameter Test: Callback :VOICE_PHONE_STATUS : setAudioParameter'); if (err) { console.error(`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error: ${err.message}`); expect(false).assertTrue(); + done(); + return; } audioManager.getAudioParameter('VOICE_PHONE_STATUS', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); - } - else if (value == '16 bit') { + } else if (value == '16 bit') { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); }); - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getAudioParameter_008 - * @tc.name : getAudioParameter - Callback - Special Character ~!@#$%^*()_+-={}|[]\:";<>?,./ - * @tc.desc : getAudioParameter - Callback - Special Character - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getAudioParameter_008', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0800 + *@tc.name : getAudioParameter - Callback - Special Character ~!@#$%^*()_+-={}|[]\:";<>?,./ + *@tc.desc : getAudioParameter - Callback - Special Character + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0800', 2, async function (done) { audioManager.setAudioParameter('VOICE_PHONE_STATUS', '~!@#$%^*()_+-={}|[]\:";<>?,./', (err) => { console.info('AudioFrameworkTest: Audio Parameter Test: Callback :VOICE_PHONE_STATUS : setAudioParameter'); if (err) { console.error(`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error: ${err.message}`); expect(false).assertTrue(); + done(); + return; } audioManager.getAudioParameter('VOICE_PHONE_STATUS', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); - } - else if (value == '~!@#$%^*()_+-={}|[]\:";<>?,./') { + } else if (value == '~!@#$%^*()_+-={}|[]\:";<>?,./') { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); }); - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getAudioParameter_009 - * @tc.name : getAudioParameter - Callback - Decimal - * @tc.desc : getAudioParameter - Callback - Decimal 10000.21321432432432 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getAudioParameter_009', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0900 + *@tc.name : getAudioParameter - Callback - Decimal + *@tc.desc : getAudioParameter - Callback - Decimal 10000.21321432432432 + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_0900', 2, async function (done) { audioManager.setAudioParameter('VOICE_PHONE_STATUS', '10000.21321432432432', (err) => { console.info('AudioFrameworkTest: Audio Parameter Test: Callback :VOICE_PHONE_STATUS : setAudioParameter'); if (err) { console.error(`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error: ${err.message}`); expect(false).assertTrue(); + done(); + return; } audioManager.getAudioParameter('VOICE_PHONE_STATUS', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); - } - else if (value == '10000.21321432432432') { + } else if (value == '10000.21321432432432') { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); }); - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getAudioParameter_010 - * @tc.name : getAudioParameter - Callback - Number 5454 - * @tc.desc : getAudioParameter - Callback - Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getAudioParameter_010', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_1000 + *@tc.name : getAudioParameter - Callback - Number 5454 + *@tc.desc : getAudioParameter - Callback - Number + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_1000', 2, async function (done) { audioManager.setAudioParameter('VOICE_PHONE_STATUS', '5454', (err) => { console.info('AudioFrameworkTest: Audio Parameter Test: Callback :VOICE_PHONE_STATUS : setAudioParameter'); if (err) { console.error(`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error: ${err.message}`); expect(false).assertTrue(); + done(); + return; } audioManager.getAudioParameter('VOICE_PHONE_STATUS', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); - } - else if (value == '5454') { + } else if (value == '5454') { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); }); - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getAudioParameter_011 - * @tc.name : getAudioParameter - Callback - Long Number longValue - * @tc.desc : getAudioParameter - Callback - Long Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getAudioParameter_011', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_1100 + *@tc.name : getAudioParameter - Callback - Long Number longValue + *@tc.desc : getAudioParameter - Callback - Long Number + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_1100', 2, async function (done) { audioManager.setAudioParameter('VOICE_PHONE_STATUS', longValue, (err) => { console.info('AudioFrameworkTest: Audio Parameter Test: Callback :VOICE_PHONE_STATUS : setAudioParameter'); if (err) { console.error(`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error: ${err.message}`); expect(false).assertTrue(); + done(); + return; } audioManager.getAudioParameter('VOICE_PHONE_STATUS', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); - } - else if (value == longValue) { + } else if (value == longValue) { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); }); - done(); }); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getAudioParameter_012 - * @tc.name : getAudioParameter - Callback - Parameter name Number - * @tc.desc : getAudioParameter - Callback - Parameter name Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_1200 + *@tc.name : getAudioParameter - Callback - Parameter name Number + *@tc.desc : getAudioParameter - Callback - Parameter name Number + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ - it('SUB_AUDIO_MANAGER_getAudioParameter_012', 0, async function (done) { + it('SUB_MULTIMEDIA_AUDIO_MANAGER_GETAUDIOPARAMETER_1200', 2, async function (done) { audioManager.setAudioParameter('VOICE_PHONE_STATUS', 'xyza', (err) => { console.info('AudioFrameworkTest: Audio Parameter Test: Callback :VOICE_PHONE_STATUS : setAudioParameter'); if (err) { console.error(`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error: ${err.message}`); expect(false).assertTrue(); + done(); + return; } audioManager.getAudioParameter('VOICE_PHONE_STATUS', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); - } - else if (value == 'xyza') { + } else if (value == 'xyza') { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); }); - done(); }); }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_onVolumeChange_001 - * @tc.name : OnVolumeChange - setVolume - MEDIA - * @tc.desc : OnVolumeChange - setVolume - MEDIA - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_onVolumeChange_001', 0, async function (done) { - + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_ONVOLUMECHANGE_0100 + *@tc.name : OnVolumeChange - setVolume - MEDIA + *@tc.desc : OnVolumeChange - setVolume - MEDIA + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_ONVOLUMECHANGE_0100', 1, async function (done) { + audioManager = audio.getAudioManager(); audioManager.on('volumeChange', (VolumeEvent) => { - console.log('AudioFrameworkTest: Volume Change Event is called'); - switch (VolumeEvent.volumeType) { case audio.AudioVolumeType.MEDIA: console.info('AudioFrameworkTest: Audio Volume Type : MEDIA'); @@ -4716,25 +4441,30 @@ describe('audioManager', function () { expect(false).assertTrue(); break; } + done(); }); - await audioManager.setVolume(audioMedia, lowVol); - done(); + try { + await audioManager.setVolume(audioMedia, lowVol); + console.info('setVolume success') + } catch (err) { + console.log('err :' + JSON.stringify(err)) + expect(false).assertTrue(); + done(); + } }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_onVolumeChange_002 - * @tc.name : OnVolumeChange - setVolume - RINGTONE - * @tc.desc : OnVolumeChange - setVolume - RINGTONE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_onVolumeChange_002', 0, async function (done) { - + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_ONVOLUMECHANGE_0200 + *@tc.name : OnVolumeChange - setVolume - RINGTONE + *@tc.desc : OnVolumeChange - setVolume - RINGTONE + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_ONVOLUMECHANGE_0200', 1, async function (done) { + audioManager = audio.getAudioManager(); audioManager.on('volumeChange', (VolumeEvent) => { - console.log('AudioFrameworkTest: Volume Change Event is called'); - switch (VolumeEvent.volumeType) { case audio.AudioVolumeType.RINGTONE: console.info('AudioFrameworkTest: Audio Volume Type : RINGTONE'); @@ -4752,25 +4482,30 @@ describe('audioManager', function () { expect(false).assertTrue(); break; } + done(); }); - await audioManager.setVolume(audioRingtone, lowVol); - done(); + try { + await audioManager.setVolume(audioRingtone, lowVol); + console.info('setVolume success') + } catch (err) { + console.log('err :' + JSON.stringify(err)) + expect(false).assertTrue(); + done(); + } }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_onVolumeChange_003 - * @tc.name : OnVolumeChange - setVolume - VOICE_CALL - * @tc.desc : OnVolumeChange - setVolume - VOICE_CALL - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_onVolumeChange_003', 0, async function (done) { - + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_ONVOLUMECHANGE_0300 + *@tc.name : OnVolumeChange - setVolume - VOICE_CALL + *@tc.desc : OnVolumeChange - setVolume - VOICE_CALL + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_ONVOLUMECHANGE_0300', 2, async function (done) { + audioManager = audio.getAudioManager(); audioManager.on('volumeChange', (VolumeEvent) => { - console.log('AudioFrameworkTest: Volume Change Event is called'); - switch (VolumeEvent.volumeType) { case audio.AudioVolumeType.VOICE_CALL: console.info('AudioFrameworkTest: Audio Volume Type : VOICE_CALL'); @@ -4788,25 +4523,30 @@ describe('audioManager', function () { expect(false).assertTrue(); break; } + done(); }); - await audioManager.setVolume(audio.AudioVolumeType.VOICE_CALL, lowVol); - done(); + try { + await audioManager.setVolume(audio.AudioVolumeType.VOICE_CALL, lowVol); + console.info('setVolume success') + } catch (err) { + console.log('err :' + JSON.stringify(err)) + expect(false).assertTrue(); + done(); + } }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_onVolumeChange_004 - * @tc.name : OnVolumeChange - setVolume - VOICE_ASSISTANT - * @tc.desc : OnVolumeChange - setVolume - VOICE_ASSISTANT - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_onVolumeChange_004', 0, async function (done) { - + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_ONVOLUMECHANGE_0400 + *@tc.name : OnVolumeChange - setVolume - VOICE_ASSISTANT + *@tc.desc : OnVolumeChange - setVolume - VOICE_ASSISTANT + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_ONVOLUMECHANGE_0400', 2, async function (done) { + audioManager = audio.getAudioManager(); audioManager.on('volumeChange', (VolumeEvent) => { - console.log('AudioFrameworkTest: Volume Change Event is called'); - switch (VolumeEvent.volumeType) { case audio.AudioVolumeType.VOICE_ASSISTANT: console.info('AudioFrameworkTest: Audio Volume Type : VOICE_ASSISTANT'); @@ -4824,25 +4564,30 @@ describe('audioManager', function () { expect(false).assertTrue(); break; } + done(); }); - await audioManager.setVolume(audio.AudioVolumeType.VOICE_ASSISTANT, lowVol); - done(); - }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingerModeChange_001 - * @tc.name : RingerModeChange - RINGER_MODE_SILENT - * @tc.desc : RingerModeChange - RINGER_MODE_SILENT - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingerModeChange_001', 0, async function (done) { + try { + await audioManager.setVolume(audio.AudioVolumeType.VOICE_ASSISTANT, lowVol); + console.info('setVolume success') + } catch (err) { + console.log('err :' + JSON.stringify(err)) + expect(false).assertTrue(); + done(); + } + }) + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_RINGERMODECHANGE_0100 + *@tc.name : RingerModeChange - RINGER_MODE_SILENT + *@tc.desc : RingerModeChange - RINGER_MODE_SILENT + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_RINGERMODECHANGE_0100', 1, async function (done) { audioManager.on('ringerModeChange', (ringerMode) => { - console.log('AudioFrameworkTest: RingerModeChange is called'); - switch (ringerMode) { case audio.AudioRingMode.RINGER_MODE_SILENT: console.info('AudioFrameworkTest: Ringer Mode Changed to : RINGER_MODE_SILENT : ' + ringerMode); @@ -4858,20 +4603,17 @@ describe('audioManager', function () { done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingerModeChange_002 - * @tc.name : RingerModeChange - RINGER_MODE_VIBRATE - * @tc.desc : RingerModeChange - RINGER_MODE_VIBRATE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingerModeChange_002', 0, async function (done) { - + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_RINGERMODECHANGE_0200 + *@tc.name : RingerModeChange - RINGER_MODE_VIBRATE + *@tc.desc : RingerModeChange - RINGER_MODE_VIBRATE + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 1 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_RINGERMODECHANGE_0200', 1, async function (done) { audioManager.on('ringerModeChange', (ringerMode) => { - console.log('AudioFrameworkTest: RingerModeChange is called'); - switch (ringerMode) { case audio.AudioRingMode.RINGER_MODE_VIBRATE: console.info('AudioFrameworkTest: Ringer Mode Changed to : RINGER_MODE_VIBRATE : ' + ringerMode); @@ -4882,21 +4624,27 @@ describe('audioManager', function () { expect(false).assertTrue(); break; } + done(); }); - await audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_VIBRATE); - done(); - }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_RingerModeChange_001 - * @tc.name : RingerModeChange - RINGER_MODE_SILENT - * @tc.desc : RingerModeChange - RINGER_MODE_SILENT - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_RingerModeChange_001', 0, async function (done) { + try { + await audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_VIBRATE); + } catch (err) { + console.log('err :' + JSON.stringify(err)) + expect(false).assertTrue(); + done(); + } + }) + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_RINGERMODECHANGE_0300 + *@tc.name : RingerModeChange - RINGER_MODE_SILENT + *@tc.desc : RingerModeChange - RINGER_MODE_SILENT + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_RINGERMODECHANGE_0300', 2, async function (done) { audioManager.on('ringerModeChange', (ringerMode) => { console.log('AudioFrameworkTest: RingerModeChange is called'); switch (ringerMode) { @@ -4909,277 +4657,275 @@ describe('audioManager', function () { expect(false).assertTrue(); break; } + done(); }); - await audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL); - done(); + + try { + await audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL); + } catch (err) { + console.log('err :' + JSON.stringify(err)) + expect(false).assertTrue(); + done(); + } }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_INTERRUPT_001 - * @tc.name : InterruptType - INTERRUPT_TYPE_BEGIN - * @tc.desc : InterruptType - INTERRUPT_TYPE_BEGIN - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_INTERRUPT_001', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_0100 + *@tc.name : InterruptType - INTERRUPT_TYPE_BEGIN + *@tc.desc : InterruptType - INTERRUPT_TYPE_BEGIN + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_0100', 2, async function (done) { expect(audio.InterruptType.INTERRUPT_TYPE_BEGIN).assertEqual(1); await sleep(50); done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_INTERRUPT_002 - * @tc.name : InterruptType - INTERRUPT_TYPE_END - * @tc.desc : InterruptType - INTERRUPT_TYPE_END - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_INTERRUPT_002', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_0200 + *@tc.name : InterruptType - INTERRUPT_TYPE_END + *@tc.desc : InterruptType - INTERRUPT_TYPE_END + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_0200', 2, async function (done) { expect(audio.InterruptType.INTERRUPT_TYPE_END).assertEqual(2); await sleep(50); done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_INTERRUPT_003 - * @tc.name : InterruptHint - INTERRUPT_HINT_NONE - * @tc.desc : InterruptHint - INTERRUPT_HINT_NONE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_INTERRUPT_003', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_0300 + *@tc.name : InterruptHint - INTERRUPT_HINT_NONE + *@tc.desc : InterruptHint - INTERRUPT_HINT_NONE + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_0300', 2, async function (done) { expect(audio.InterruptHint.INTERRUPT_HINT_NONE).assertEqual(0); await sleep(50); done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_INTERRUPT_004 - * @tc.name : InterruptHint - INTERRUPT_HINT_RESUME - * @tc.desc : InterruptHint - INTERRUPT_HINT_RESUME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_INTERRUPT_004', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_0400 + *@tc.name : InterruptHint - INTERRUPT_HINT_RESUME + *@tc.desc : InterruptHint - INTERRUPT_HINT_RESUME + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_0400', 2, async function (done) { expect(audio.InterruptHint.INTERRUPT_HINT_RESUME).assertEqual(1); await sleep(50); done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_INTERRUPT_005 - * @tc.name : InterruptHint - INTERRUPT_HINT_PAUSE - * @tc.desc : InterruptHint - INTERRUPT_HINT_PAUSE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_INTERRUPT_005', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_0500 + *@tc.name : InterruptHint - INTERRUPT_HINT_PAUSE + *@tc.desc : InterruptHint - INTERRUPT_HINT_PAUSE + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_0500', 2, async function (done) { expect(audio.InterruptHint.INTERRUPT_HINT_PAUSE).assertEqual(2); await sleep(50); done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_INTERRUPT_006 - * @tc.name : InterruptHint - INTERRUPT_HINT_STOP - * @tc.desc : InterruptHint - INTERRUPT_HINT_STOP - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_INTERRUPT_006', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_0600 + *@tc.name : InterruptHint - INTERRUPT_HINT_STOP + *@tc.desc : InterruptHint - INTERRUPT_HINT_STOP + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_0600', 2, async function (done) { expect(audio.InterruptHint.INTERRUPT_HINT_STOP).assertEqual(3); await sleep(50); done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_INTERRUPT_007 - * @tc.name : InterruptHint - INTERRUPT_HINT_DUCK - * @tc.desc : InterruptHint - INTERRUPT_HINT_DUCK - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_INTERRUPT_007', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_0700 + *@tc.name : InterruptHint - INTERRUPT_HINT_DUCK + *@tc.desc : InterruptHint - INTERRUPT_HINT_DUCK + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_0700', 2, async function (done) { expect(audio.InterruptHint.INTERRUPT_HINT_DUCK).assertEqual(4); await sleep(50); done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_INTERRUPT_008 - * @tc.name : InterruptHint - INTERRUPT_HINT_UNDUCK - * @tc.desc : InterruptHint - INTERRUPT_HINT_UNDUCK - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_INTERRUPT_008', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_0800 + *@tc.name : InterruptHint - INTERRUPT_HINT_UNDUCK + *@tc.desc : InterruptHint - INTERRUPT_HINT_UNDUCK + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_0800', 2, async function (done) { expect(audio.InterruptHint.INTERRUPT_HINT_UNDUCK).assertEqual(5); await sleep(50); done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_INTERRUPT_009 - * @tc.name : InterruptForceType - INTERRUPT_FORCE - * @tc.desc : InterruptForceType - INTERRUPT_FORCE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_INTERRUPT_009', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_0900 + *@tc.name : InterruptForceType - INTERRUPT_FORCE + *@tc.desc : InterruptForceType - INTERRUPT_FORCE + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_0900', 2, async function (done) { expect(audio.InterruptForceType.INTERRUPT_FORCE).assertEqual(0); await sleep(50); done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_INTERRUPT_010 - * @tc.name : InterruptForceType - INTERRUPT_SHARE - * @tc.desc : InterruptForceType - INTERRUPT_SHARE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_INTERRUPT_010', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_1000 + *@tc.name : InterruptForceType - INTERRUPT_SHARE + *@tc.desc : InterruptForceType - INTERRUPT_SHARE + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_1000', 2, async function (done) { expect(audio.InterruptForceType.INTERRUPT_SHARE).assertEqual(1); await sleep(50); done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_INTERRUPT_011 - * @tc.name : ActiveDeviceType - BLUETOOTH_SCO - * @tc.desc : ActiveDeviceType - BLUETOOTH_SCO - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_INTERRUPT_011', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_1100 + *@tc.name : ActiveDeviceType - BLUETOOTH_SCO + *@tc.desc : ActiveDeviceType - BLUETOOTH_SCO + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_1100', 2, async function (done) { expect(audio.ActiveDeviceType.BLUETOOTH_SCO).assertEqual(7); await sleep(50); done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_INTERRUPT_012 - * @tc.name : ActiveDeviceType - SPEAKER - * @tc.desc : ActiveDeviceType - SPEAKER - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_INTERRUPT_012', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_1200 + *@tc.name : ActiveDeviceType - SPEAKER + *@tc.desc : ActiveDeviceType - SPEAKER + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPT_1200', 2, async function (done) { expect(audio.ActiveDeviceType.SPEAKER).assertEqual(2); await sleep(50); done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_InterruptActionType_001 - * @tc.name : InterruptActionType - TYPE_ACTIVATED - * @tc.desc : InterruptActionType - TYPE_ACTIVATED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_InterruptActionType_001', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPTACTIONTYPE_0100 + *@tc.name : InterruptActionType - TYPE_ACTIVATED + *@tc.desc : InterruptActionType - TYPE_ACTIVATED + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPTACTIONTYPE_0100', 2, async function (done) { expect(audio.InterruptActionType.TYPE_ACTIVATED).assertEqual(0); await sleep(50); done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_InterruptActionType_002 - * @tc.name : InterruptActionType - TYPE_INTERRUPT - * @tc.desc : InterruptActionType - TYPE_INTERRUPT - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPTACTIONTYPE_0200 + *@tc.name : InterruptActionType - TYPE_INTERRUPT + *@tc.desc : InterruptActionType - TYPE_INTERRUPT + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 */ - it('SUB_AUDIO_MANAGER_InterruptActionType_002', 0, async function (done) { + it('SUB_MULTIMEDIA_AUDIO_MANAGER_INTERRUPTACTIONTYPE_0200', 2, async function (done) { expect(audio.InterruptActionType.TYPE_INTERRUPT).assertEqual(1); await sleep(50); done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_DeviceType_001 - * @tc.name : DeviceType - ALL Device Type - * @tc.desc : DeviceType - ALL Device Type - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_DeviceType_001', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_DEVICETYPE_0100 + *@tc.name : DeviceType - ALL Device Type + *@tc.desc : DeviceType - ALL Device Type + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_DEVICETYPE_0100', 2, async function (done) { expect(audio.DeviceType.INVALID).assertEqual(0); - console.info("audio.DeviceType.INVALID:"+audio.DeviceType.INVALID); + console.info("audio.DeviceType.INVALID:" + audio.DeviceType.INVALID); expect(audio.DeviceType.EARPIECE).assertEqual(1); - console.info("audio.DeviceType.EARPIECE:"+audio.DeviceType.EARPIECE); + console.info("audio.DeviceType.EARPIECE:" + audio.DeviceType.EARPIECE); expect(audio.DeviceType.SPEAKER).assertEqual(2); - console.info("audio.DeviceType.SPEAKER:"+audio.DeviceType.SPEAKER); + console.info("audio.DeviceType.SPEAKER:" + audio.DeviceType.SPEAKER); expect(audio.DeviceType.WIRED_HEADSET).assertEqual(3); - console.info("audio.DeviceType.WIRED_HEADSET:"+audio.DeviceType.WIRED_HEADSET); + console.info("audio.DeviceType.WIRED_HEADSET:" + audio.DeviceType.WIRED_HEADSET); expect(audio.DeviceType.WIRED_HEADPHONES).assertEqual(4); - console.info("audio.DeviceType.WIRED_HEADPHONES:"+audio.DeviceType.WIRED_HEADPHONES); + console.info("audio.DeviceType.WIRED_HEADPHONES:" + audio.DeviceType.WIRED_HEADPHONES); expect(audio.DeviceType.BLUETOOTH_SCO).assertEqual(7); - console.info("audio.DeviceType.BLUETOOTH_SCO:"+audio.DeviceType.BLUETOOTH_SCO); + console.info("audio.DeviceType.BLUETOOTH_SCO:" + audio.DeviceType.BLUETOOTH_SCO); expect(audio.DeviceType.BLUETOOTH_A2DP).assertEqual(8); - console.info("audio.DeviceType.BLUETOOTH_A2DP:"+audio.DeviceType.BLUETOOTH_A2DP); + console.info("audio.DeviceType.BLUETOOTH_A2DP:" + audio.DeviceType.BLUETOOTH_A2DP); expect(audio.DeviceType.MIC).assertEqual(15); - console.info("audio.DeviceType.MIC:"+audio.DeviceType.MIC); + console.info("audio.DeviceType.MIC:" + audio.DeviceType.MIC); expect(audio.DeviceType.USB_HEADSET).assertEqual(22); - console.info("audio.DeviceType.USB_HEADSET:"+audio.DeviceType.USB_HEADSET); + console.info("audio.DeviceType.USB_HEADSET:" + audio.DeviceType.USB_HEADSET); await sleep(50); done(); }) - - /* * - * @tc.number : SUB_AUDIO_MANAGER_DeviceRole_001 - * @tc.name : DeviceRole - ALL Device Role - * @tc.desc : DeviceRole - ALL Device Role - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_DeviceRole_001', 0, async function (done) { + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_MANAGER_DEVICEROLE_0100 + *@tc.name : DeviceRole - ALL Device Role + *@tc.desc : DeviceRole - ALL Device Role + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_MANAGER_DEVICEROLE_0100', 2, async function (done) { expect(audio.DeviceRole.INPUT_DEVICE).assertEqual(1); - console.info("audio.DeviceRole.INPUT_DEVICE :"+audio.DeviceRole.INPUT_DEVICE); + console.info("audio.DeviceRole.INPUT_DEVICE :" + audio.DeviceRole.INPUT_DEVICE); expect(audio.DeviceRole.OUTPUT_DEVICE).assertEqual(2); - console.info("audio.DeviceRole.OUTPUT_DEVICE :"+audio.DeviceRole.OUTPUT_DEVICE); + console.info("audio.DeviceRole.OUTPUT_DEVICE :" + audio.DeviceRole.OUTPUT_DEVICE); await sleep(50); done(); }) - - /* * - * @tc.number : SUB_AUDIO_ROUTING_MANAGER_getDevices_001 - * @tc.name : getDevices - Output device - Callback - * @tc.desc : getDevices - Output device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ROUTING_MANAGER_getDevices_001', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0100 + *@tc.name : getDevices - Output device - Callback + *@tc.desc : getDevices - Output device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0100', 2, async function (done) { let AudioRoutingManager = await audioManager.getRoutingManager(); AudioRoutingManager.getDevices(1, (err, value) => { // Getting all Output devices Enumb 1 = OUTPUT_DEVICES_FLAG console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); - if (err) { console.error(`AudioFrameworkTest:Callback: OUTPUT_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); @@ -5189,11 +4935,10 @@ describe('audioManager', function () { value.forEach(displayDeviceProp); if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && - cMask != null) { + cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -5202,29 +4947,19 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_ROUTING_MANAGER_getDevices_002 - * @tc.name : getDevices - Input device - Callback - * @tc.desc : getDevices - Input device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ROUTING_MANAGER_getDevices_002', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0200 + *@tc.name : getDevices - Input device - Callback + *@tc.desc : getDevices - Input device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0200', 2, async function (done) { let AudioRoutingManager = await audioManager.getRoutingManager(); AudioRoutingManager.getDevices(2, (err, value) => { // Getting all Input Devices ENUM 2 = INPUT_DEVICES_FLAG - console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); - if (err) { console.error(`AudioFrameworkTest:Callback:INPUT_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); @@ -5232,13 +4967,11 @@ describe('audioManager', function () { else { console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - - if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL'); expect(false).assertTrue(); } @@ -5247,43 +4980,31 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_ROUTING_MANAGER_getDevices_003 - * @tc.name : getDevices - ALL device - Callback - * @tc.desc : getDevices - ALL device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ROUTING_MANAGER_getDevices_003', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0300 + *@tc.name : getDevices - ALL device - Callback + *@tc.desc : getDevices - ALL device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0300', 2, async function (done) { let AudioRoutingManager = await audioManager.getRoutingManager(); AudioRoutingManager.getDevices(3, (err, value) => { // Getting all devies connected 3 = ALL_DEVICES_FLAG - console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); - if (err) { console.error(`AudioFrameworkTest:Callback:ALL_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL'); expect(false).assertTrue(); } @@ -5292,23 +5013,15 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_ROUTING_MANAGER_getDevices_004 - * @tc.name : getDevices - Output device - Callback - ENAME - * @tc.desc : getDevices - Output device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ROUTING_MANAGER_getDevices_004', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0400 + *@tc.name : getDevices - Output device - Callback - ENAME + *@tc.desc : getDevices - Output device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0400', 2, async function (done) { let AudioRoutingManager = await audioManager.getRoutingManager(); AudioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (err, value) => { console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); @@ -5319,12 +5032,11 @@ describe('audioManager', function () { else { console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -5333,40 +5045,29 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_ROUTING_MANAGER_getDevices_005 - * @tc.name : getDevices - Input device - Callback - ENAME - * @tc.desc : getDevices - Input device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ROUTING_MANAGER_getDevices_005', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0500 + *@tc.name : getDevices - Input device - Callback - ENAME + *@tc.desc : getDevices - Input device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0500', 2, async function (done) { let AudioRoutingManager = await audioManager.getRoutingManager(); AudioRoutingManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG, (err, value) => { console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); if (err) { console.error(`AudioFrameworkTest:Callback:INPUT_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - - if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL'); expect(false).assertTrue(); } @@ -5375,39 +5076,29 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_ROUTING_MANAGER_getDevices_006 - * @tc.name : getDevices - ALL device - Callback - ENAME - * @tc.desc : getDevices - ALL device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ROUTING_MANAGER_getDevices_006', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0600 + *@tc.name : getDevices - ALL device - Callback - ENAME + *@tc.desc : getDevices - ALL device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0600', 2, async function (done) { let AudioRoutingManager = await audioManager.getRoutingManager(); AudioRoutingManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG, (err, value) => { console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); if (err) { console.error(`AudioFrameworkTest: Callback: ALL_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && + if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && cMask != null) { console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL'); expect(false).assertTrue(); } @@ -5415,58 +5106,41 @@ describe('audioManager', function () { done(); }); }) - - /* * - * @tc.number : SUB_AUDIO_ROUTING_MANAGER_getDevices_008 - * @tc.name : getDevices - OUTPUT device - Promise - ENAME - * @tc.desc : getDevices - OUTPUT device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ROUTING_MANAGER_getDevices_008', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0700 + *@tc.name : getDevices - OUTPUT device - Promise - ENAME + *@tc.desc : getDevices - OUTPUT device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0700', 2, async function (done) { let AudioRoutingManager = await audioManager.getRoutingManager(); let value = await AudioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG); console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && - cMask != null) { + cMask != null) { console.info('AudioFrameworkTest: Promise: getDevices:OUTPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Promise: getDevices:OUTPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } done(); }) - /* * - * @tc.number : SUB_AUDIO_ROUTING_MANAGER_getDevices_009 - * @tc.name : getDevices - INPUT device - Promise - ENAME - * @tc.desc : getDevices - INPUT device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ROUTING_MANAGER_getDevices_009', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; - audioManager.getRoutingManager(async (err,AudioRoutingManager)=>{ + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0800 + *@tc.name : getDevices - INPUT device - Promise - ENAME + *@tc.desc : getDevices - INPUT device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0800', 2, async function (done) { + audioManager.getRoutingManager(async (err, AudioRoutingManager) => { if (err) { console.error(`AudioFrameworkTest: Callback: failed to get RoutingManager ${err.message}`); expect().assertFail(); @@ -5476,11 +5150,10 @@ describe('audioManager', function () { value.forEach(displayDeviceProp); if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && - cMask != null) { + cMask != null) { console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); - } - else { + } else { console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -5489,34 +5162,26 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_ROUTING_MANAGER_getDevices_010 - * @tc.name : getDevices - ALL device - Promise - ENAME - * @tc.desc : getDevices - ALL device - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ROUTING_MANAGER_getDevices_010', 0, async function (done) { - dRValue = null; - dTValue = null; - devId = null; - devName = null; - devAddr = null; - sRate = null; - cCount = null; - cMask = null; - audioManager.getRoutingManager(async (err,AudioRoutingManager)=>{ + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0900 + *@tc.name : getDevices - ALL device - Promise - ENAME + *@tc.desc : getDevices - ALL device + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_ROUTING_MANAGER_GETDEVICES_0900', 2, async function (done) { + audioManager.getRoutingManager(async (err, AudioRoutingManager) => { if (err) { console.error(`AudioFrameworkTest:Callback:failed to get RoutingManager ${err.message}`); - expect().assertFail(); + expect().assertFail(); } else { let value = await AudioRoutingManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG) console.info('AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG'); value.forEach(displayDeviceProp); if (dTValue != null && dRValue != null && devId > 0 && sRate != null && cCount != null && - cMask != null) { + cMask != null) { console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } @@ -5529,19 +5194,33 @@ describe('audioManager', function () { }); }) - /* * - * @tc.number : SUB_AUDIO_DeviceFlag_001 - * @tc.name : NONE_DEVICES_FLAG - * @tc.desc : NONE_DEVICES_FLAG - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_DeviceFlag_001', 0, async function (done) { + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_DEVICEFALG_0100 + *@tc.name : NONE_DEVICES_FLAG + *@tc.desc : NONE_DEVICES_FLAG + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_DEVICEFALG_0100', 2, async function (done) { expect(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).assertEqual(1); expect(audio.DeviceFlag.INPUT_DEVICES_FLAG).assertEqual(2); expect(audio.DeviceFlag.ALL_DEVICES_FLAG).assertEqual(3); await sleep(50); done(); }) + + /** + *@tc.number : SUB_MULTIMEDIA_AUDIO_SAMPLE_FORMAT_F32LE_0100 + *@tc.name : SAMPLE_FORMAT_F32LE + *@tc.desc : SAMPLE_FORMAT_F32LE + *@tc.size : MEDIUM + *@tc.type : Function + *@tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_SAMPLE_FORMAT_F32LE_0100', 2, async function (done) { + expect(audio.AudioSampleFormat.SAMPLE_FORMAT_F32LE).assertEqual(4); + await sleep(50); + done(); + }) }) \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRenderer.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRenderer.test.js deleted file mode 100644 index 736a03a96791ca022d0996e229e3a7ec7908f592..0000000000000000000000000000000000000000 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRenderer.test.js +++ /dev/null @@ -1,7581 +0,0 @@ -/* - * 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 audio from '@ohos.multimedia.audio'; -import fileio from '@ohos.fileio'; -import resourceManager from '@ohos.resourceManager'; -import featureAbility from '@ohos.ability.featureAbility' -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; - -describe('audioRenderer', function () { - - let fdRead; - let readPath; - const audioManager = audio.getAudioManager(); - console.info('AudioFrameworkRenderLog: Create AudioManger Object JS Framework'); - let fdPath; - let filePath; - - beforeAll(async function () { - console.info('AudioFrameworkRenderLog: beforeAll: Prerequisites at the test suite level'); - }) - - beforeEach(async function () { - console.info('AudioFrameworkRenderLog: beforeEach: Prerequisites at the test case level'); - await sleep(1000); - }) - - afterEach(function () { - console.info('AudioFrameworkRenderLog: afterEach: Test case-level clearance conditions'); - }) - - afterAll(async function () { - console.info('AudioFrameworkRenderLog: afterAll: Test suite-level cleanup condition'); - }) - - function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); - } - async function closeFileDescriptor(fileName) { - await resourceManager.getResourceManager().then(async (mgr) => { - await mgr.closeRawFileDescriptor(fileName).then(value => { - console.log('AudioFrameworkRenderLog:case closeRawFileDescriptor success for file:' + fileName); - }).catch(error => { - console.log('AudioFrameworkRenderLog:case closeRawFileDescriptor err: ' + error); - }); - }); - } - - async function getFdRead(pathName, done) { - let context = await featureAbility.getContext(); - console.info("case0 context is " + context); - await context.getFilesDir().then((data) => { - console.info("case1 getFilesDir is path " + data); - filePath = data + '/' + pathName; - console.info('case4 filePath is ' + filePath); - - }) - fdPath = 'fd://'; - await fileio.open(filePath).then((fdNumber) => { - fdPath = fdPath + '' + fdNumber; - fdRead = fdNumber; - console.info('[fileIO]case open fd success,fdPath is ' + fdPath); - console.info('[fileIO]case open fd success,fdRead is ' + fdRead); - - }, (err) => { - console.info('[fileIO]case open fd failed'); - }).catch((err) => { - console.info('[fileIO]case catch open fd failed'); - }); - } - - async function playbackPromise(AudioRendererOptions, pathName, AudioScene) { - var resultFlag = 'new'; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data state: ' + Object.keys(data)); - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data value: ' + JSON.stringify(data)); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - return resultFlag; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - return resultFlag; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : ' + pathName); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); - resultFlag = false; - }); - if (resultFlag == false) { - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - if (resultFlag == false) { - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - if (resultFlag == false) { - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - var bufferSize; - await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); - bufferSize = data; - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); - resultFlag = false; - }); - if (resultFlag == false) { - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - let ss = fileio.fdopenStreamSync(fdRead, 'r'); - console.info('AudioFrameworkRenderLog:case2: File Path: ' + ss); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.fstatSync(fdRead).size; - console.info('AudioFrameworkRenderLog:case3: File totalSize size: ' + totalSize); - totalSize = totalSize - 44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); - let rlen = 0; - while (rlen < totalSize / 4) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); - await audioRen.write(buf); - if (rlen > (totalSize / 2)) { - await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : Value : ' + data); - }).catch((err) => { - console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); - resultFlag = false; - }); - } - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); - resultFlag = false; - }); - if (resultFlag == false) { - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - resultFlag = true; - console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlag); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - resultFlag = false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - resultFlag = false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - return resultFlag; - } - - async function playbackPromise_93(AudioRendererOptions, pathName, AudioScene) { - var resultFlag = true; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - return resultFlag; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - //let audioTime = Date.now(); - let audioTimeStart; - /*let audioTimeEnd; - let audioTimeMiddle;*/ - // console.info('AudioFrameworkRenderLog: Current Time in NANOSeconds : '+audioTime); - - await audioRen.getAudioTime().then(async function (data) { - // audioTime = Date.now(); - audioTimeStart = data / 1000000000;//-audioTime)/1000000000; - console.info('AudioFrameworkRenderLog: getAudioTime : After Start : Converted: ' + audioTimeStart); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : ' + err.message); - resultFlag = false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - var bufferSize = await audioRen.getBufferSize(); - console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); - - let ss = fileio.fdopenStreamSync(fdRead, 'r'); - console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.fstatSync(fdRead).size; - console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); - totalSize = totalSize - 44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); - let rlen = 0; - while (rlen < totalSize / 4) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); - await audioRen.write(buf); - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - //var gettime = audioTimeMiddle-audioTimeStart; - if (audioTimeStart != 0) { - console.info('AudioFrameworkRenderLog: getAudioTime : PASS : ' + audioTimeStart); - } - else { - console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : ' + audioTimeStart); - resultFlag = false; - } - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - async function playbackPromise_94(AudioRendererOptions, pathName, AudioScene) { - var resultFlag = true; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - return resultFlag; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - // let audioTime = Date.now(); - let audioTimeStart; - //let audioTimeEnd; - //let audioTimeMiddle; - //console.info('AudioFrameworkRenderLog: Current Time in NANOSeconds : '+audioTime); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - var bufferSize = await audioRen.getBufferSize(); - console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); - - let ss = fileio.fdopenStreamSync(fdRead, 'r'); - console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.fstatSync(fdRead).size; - console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); - totalSize = totalSize - 44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); - let rlen = 0; - var gettime = 0; - while (rlen < totalSize / 4) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); - await audioRen.write(buf); - await audioRen.getAudioTime().then(async function (data) { - audioTimeStart = data / 1000000000; - console.info('AudioFrameworkRenderLog: getAudioTime : After Start : Converted: ' + audioTimeStart); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : ' + err.message); - resultFlag = false; - }); - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - - if (audioTimeStart != 0) { - console.info('AudioFrameworkRenderLog: getAudioTime : PASS : ' + audioTimeStart); - } - else { - console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : ' + audioTimeStart); - resultFlag = false; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - async function playbackPromise_95(AudioRendererOptions, pathName, AudioScene) { - var resultFlag = true; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - return resultFlag; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - let audioTimeStart; - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - var bufferSize = await audioRen.getBufferSize(); - console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); - - let ss = fileio.fdopenStreamSync(fdRead, 'r'); - console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.fstatSync(fdRead).size; - console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); - totalSize = totalSize - 44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); - let rlen = 0; - while (rlen < totalSize / 4) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); - await audioRen.write(buf); - } - - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - - await audioRen.getAudioTime().then(async function (data) { - audioTimeStart = data / 1000000000; - console.info('AudioFrameworkRenderLog: getAudioTime : After Start : Converted: ' + audioTimeStart); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : ' + err.message); - resultFlag = false; - }); - - if (audioTimeStart != 0) { - console.info('AudioFrameworkRenderLog: getAudioTime : PASS : ' + audioTimeStart); - } - else { - console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : ' + audioTimeStart); - resultFlag = false; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - async function playbackPromise_102(AudioRendererOptions, pathName) { - var resultFlag = false; - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - return resultFlag; - } - audioRen.on('markReach', 55, (position) => { - console.log('AudioFrameworkTest: markReach Event is called : ' + position); - resultFlag = true; - }) - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - var bufferSize; - await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); - bufferSize = data; - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); - resultFlag = false; - }); - - let ss = fileio.fdopenStreamSync(fdRead, 'r'); - console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); - let discardHeader = new ArrayBuffer(44); - console.info('AudioFrameworkRenderLog:case 2-1:AudioFrameworkRenderLog: File Path: '); - ss.readSync(discardHeader); - console.info('AudioFrameworkRenderLog:case 2-2:AudioFrameworkRenderLog: File Path: '); - let totalSize = fileio.fstatSync(fdRead).size; - console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); - totalSize = totalSize - 44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); - let rlen = 0; - while (rlen < totalSize / 4) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); - await audioRen.write(buf); - } - - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - return resultFlag; - } - - async function playbackPromise_103(AudioRendererOptions, pathName) { - var resultFlag = false; - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - return resultFlag; - } - audioRen.on('markReach', 55, (position) => { - console.log('AudioFrameworkTest: markReach Event is called : ' + position); - audioRen.off('markReach'); - audioRen.on('markReach', 100, (position) => { - console.log('AudioFrameworkTest: markReach Event is called : ' + position); - resultFlag = true; - }); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - var bufferSize; - await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); - bufferSize = data; - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); - resultFlag = false; - }); - - let ss = fileio.fdopenStreamSync(fdRead, 'r'); - console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.fstatSync(fdRead).size; - console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); - totalSize = totalSize - 44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); - let rlen = 0; - while (rlen < totalSize / 4) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); - await audioRen.write(buf); - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - return resultFlag; - } - - async function playbackPromise_104(AudioRendererOptions, pathName) { - var resultFlag = false; - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - return resultFlag; - } - audioRen.on('markReach', 55, (position) => { - console.log('AudioFrameworkTest: markReach Event is called : ' + position); - resultFlag = true; - audioRen.on('markReach', 73, (position) => { - console.log('AudioFrameworkTest: markReach Event is called : ' + position); - resultFlag = false; - }); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - var bufferSize; - await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); - bufferSize = data; - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); - resultFlag = false; - }); - - let ss = fileio.fdopenStreamSync(fdRead, 'r'); - console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.fstatSync(fdRead).size; - console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); - totalSize = totalSize - 44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); - let rlen = 0; - while (rlen < totalSize / 4) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); - await audioRen.write(buf); - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - return resultFlag; - } - - async function playbackPromise_105(AudioRendererOptions, pathName) { - var resultFlag = false; - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - return resultFlag; - } - audioRen.on('periodReach', 55, (position) => { - console.log('AudioFrameworkTest: periodReach Event is called : ' + position); - resultFlag = true; - audioRen.off('periodReach'); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - var bufferSize; - await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); - bufferSize = data; - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); - resultFlag = false; - }); - - let ss = fileio.fdopenStreamSync(fdRead, 'r'); - console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.fstatSync(fdRead).size; - console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); - totalSize = totalSize - 44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); - let rlen = 0; - while (rlen < totalSize / 4) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); - await audioRen.write(buf); - } - - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - return resultFlag; - } - - async function playbackPromise_106(AudioRendererOptions, pathName) { - var resultFlag = false; - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - return resultFlag; - } - audioRen.on('periodReach', 55, (position) => { - console.log('AudioFrameworkTest: periodReach Event is called : ' + position); - // resultFlag = true; - audioRen.off('periodReach'); - audioRen.on('periodReach', 100, (position) => { - console.log('AudioFrameworkTest: periodReach Event is called : ' + position); - resultFlag = true; - audioRen.off('periodReach'); - }); - - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - var bufferSize; - await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); - bufferSize = data; - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); - resultFlag = false; - }); - - let ss = fileio.fdopenStreamSync(fdRead, 'r'); - console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.fstatSync(fdRead).size; - console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); - totalSize = totalSize - 44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); - let rlen = 0; - while (rlen < totalSize / 4) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); - await audioRen.write(buf); - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - return resultFlag; - } - - async function playbackPromise_107(AudioRendererOptions, pathName) { - var resultFlag = false; - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - return resultFlag; - } - audioRen.on('periodReach', 55, (position) => { - console.log('AudioFrameworkTest: periodReach Event is called : ' + position); - resultFlag = true; - audioRen.on('periodReach', 73, (position) => { - console.log('AudioFrameworkTest: periodReach Event is called : ' + position); - resultFlag = false; - }); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - var bufferSize; - await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); - bufferSize = data; - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); - resultFlag = false; - }); - - let ss = fileio.fdopenStreamSync(fdRead, 'r'); - console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.fstatSync(fdRead).size; - console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); - totalSize = totalSize - 44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); - let rlen = 0; - while (rlen < totalSize / 4) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); - await audioRen.write(buf); - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - return resultFlag; - } - - async function playbackPromise_113(AudioRendererOptions, pathName) { - var resultFlag = true; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - resultFlag = false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - var bufferSize = await audioRen.getBufferSize(); - console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); - - let ss = fileio.fdopenStreamSync(fdRead, 'r'); - console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.fstatSync(fdRead).size; - console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); - totalSize = totalSize - 44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); - let rlen = 0; - while (rlen < totalSize / 4) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); - await audioRen.write(buf); - if (rlen > (totalSize / 8)) { - await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkAudioScene: getAudioScene : Value : ' + data); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); - resultFlag = false; - }); - } - if (rlen > (totalSize / 8)) { - - audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_DOUBLE, (err) => { - if (err) { - console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_DOUBLE : ERROR : ' + err.message); - resultFlag = false; - } - else { - console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_DOUBLE : SUCCESS'); - } - }); - } - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - audioRen.getRenderRate((err, data) => { - if (err) { - console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_DOUBLE : ERROR : ' + err.message); - resultFlag = false; - } - else if (data == audio.AudioRendererRate.RENDER_RATE_DOUBLE) { - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : PASS : ' + data); - } - else { - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : FAIL : ' + data); - resultFlag = false; - } - }); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - async function playbackCB(AudioRendererOptions, pathName) { - - var resultFlag = 'new'; - - console.info('AudioFrameworkRenderLog: CALLBACK : Audio Playback Function'); - - var audioRen; - - audio.createAudioRenderer(AudioRendererOptions, (err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: AudioRender Created : Error: ${err.message}`); - resultFlag = false; - } - else { - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : SUCCESS'); - audioRen = data; - } - }); - if (resultFlag == false) { - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - await sleep(100); - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : ' + pathName); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - console.info('AudioFrameworkRenderLog: Callback : Audio Playback Function'); - - audioRen.start((err) => { - if (err) { - console.error(`AudioFrameworkRenderLog: Renderer start failed: Error: ${err.message}`); - resultFlag = false; - } - else { - console.info('AudioFrameworkRenderLog: Renderer started'); - } - }); - await sleep(100); - if (resultFlag == false) { - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - var samplingRate; - audioRen.getStreamInfo(async (err, audioParamsGet) => { - await sleep(100); - if (err) { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); - resultFlag = false; - } - else { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - samplingRate = audioParamsGet.samplingRate; - } - }); - if (resultFlag == false) { - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - audioRen.getRendererInfo(async (err, audioParamsGet) => { - await sleep(100); - if (err) { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - } - else { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - } - }); - await sleep(100); - if (resultFlag == false) { - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - var bufferSize; - await audioRen.getBufferSize((err, data) => { - if (err) { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); - resultFlag = false; - } - else { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); - bufferSize = data; - } - }); - await sleep(100); - if (resultFlag == false) { - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - let ss = fileio.fdopenStreamSync(fdRead, 'r'); - console.info('AudioFrameworkRenderLog:case 4: File Path: ' + ss); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.fstatSync(fdRead).size; - let aa = fileio.fstatSync(fdRead); - console.log('case 6 : ' + aa); - console.info('AudioFrameworkRenderLog: File totalSize size: ' + totalSize); - totalSize = totalSize - 44; - let rlen = 0; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); - await sleep(100); - // var waitTime = (totalSize/88200); - var waitTime; - switch (samplingRate) { - case 44100: - waitTime = 45; - break; - case 8000: - waitTime = 60; - break; - case 32000: - waitTime = 45; - break; - case 64000: - waitTime = 45; - break; - case 96000: - waitTime = 45; - break; - case 11025: - waitTime = 45; - break; - case 12000: - waitTime = 45; - break; - case 16000: - waitTime = 45; - break; - case 22050: - waitTime = 45; - break; - case 24000: - waitTime = 45; - break; - case 48000: - waitTime = 45; - break; - default: - waitTime = 45; - break - } - - await sleep(100); - console.info('AudioFrameworkRenderLog: waitTime : ' + waitTime); - while (rlen < totalSize / 10) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('BufferAudioFramework: bytes read from file: ' + rlen); - await audioRen.write(buf, (err, data) => { - if (err) { - console.error(`AudioFrameworkRenderLog: Buff write: Error: ${err.message}`); - resultFlag = false; - } - else { - console.info('BufferAudioFramework: Buff write successful : '); - resultFlag = true; - } - }); - await sleep(waitTime); - } - await sleep(100); - if (resultFlag == false) { - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - ss.closeSync(); - audioRen.drain((err, state) => { - if (err) { - console.error(`AudioFrameworkRenderLog: Renderer drain failed: Error: ${err.message}`); - resultFlag = false; - } - else { - console.info('AudioFrameworkRenderLog: Renderer drained'); - } - }); - await sleep(100); - if (resultFlag == false) { - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - audioRen.stop((err, state) => { - if (err) { - console.error(`AudioFrameworkRenderLog: Renderer stop failed: Error: ${err.message}`); - resultFlag = false; - } - else { - console.info('AudioFrameworkRenderLog: Renderer stopped'); - resultFlag = true; - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - } - }); - await sleep(100); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - if (resultFlag == false) { - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - audioRen.release((err, state) => { - if (err) { - console.error(`AudioFrameworkRenderLog: Renderer release failed: Error: ${err.message}`); - resultFlag = false; - } - else { - console.info('AudioFrameworkRenderLog: Renderer released'); - } - }); - await sleep(100); - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - return resultFlag; - - } - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_001 - * @tc.name : AudioRenderer-Set1-Media - * @tc.desc : AudioRenderer with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_001', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - readPath = 'StarWars10s-1C-44100-2SW.wav' - await getFdRead(readPath, done); - var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_093 - * @tc.name : AudioRenderer - getAudioTime -Before Play - * @tc.desc : AudioRenderer - getAudioTime -Before Play - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_093', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - readPath = 'StarWars10s-2C-24000-3SW.wav' - await getFdRead(readPath, done); - var resultFlag = await playbackPromise_93(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100) - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_094 - * @tc.name : AudioRenderer - getAudioTime - During Play - * @tc.desc : AudioRenderer - getAudioTime - During Play - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_094', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - readPath = 'StarWars10s-2C-24000-3SW.wav' - await getFdRead(readPath, done); - var resultFlag = await playbackPromise_94(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100) - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_095 - * @tc.name : AudioRenderer - getAudioTime - after Play - * @tc.desc : AudioRenderer - getAudioTime - after Play - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_095', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - readPath = 'StarWars10s-2C-24000-3SW.wav' - await getFdRead(readPath, done); - var resultFlag = await playbackPromise_95(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100) - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_102 - * @tc.name : AudioRenderer - markReached - On - * @tc.desc : AudioRenderer - markReached - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_102', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - var resultFlag = await playbackPromise_102(AudioRendererOptions, filePath); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_103 - * @tc.name : AudioRenderer - markReached - On - off -on - * @tc.desc : AudioRenderer - markReached - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_103', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - var resultFlag = await playbackPromise_103(AudioRendererOptions, filePath); - await sleep(100) - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_104 - * @tc.name : AudioRenderer - markReached - on - on - * @tc.desc : AudioRenderer - markReached - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_104', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - readPath = 'StarWars10s-2C-48000-4SW.wav'; - await getFdRead(readPath, done); - var resultFlag = await playbackPromise_104(AudioRendererOptions, filePath); - await sleep(100) - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_105 - * @tc.name : AudioRenderer - periodReach - On - * @tc.desc : AudioRenderer - periodReach - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_105', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - readPath = 'StarWars10s-2C-48000-4SW.wav'; - await getFdRead(readPath, done); - var resultFlag = await playbackPromise_105(AudioRendererOptions, filePath); - await sleep(100) - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_106 - * @tc.name : AudioRenderer - periodReach - On - off -on - * @tc.desc : AudioRenderer - periodReach - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_106', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - readPath = 'StarWars10s-2C-48000-4SW.wav'; - await getFdRead(readPath, done); - var resultFlag = await playbackPromise_106(AudioRendererOptions, filePath); - await sleep(100) - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_107 - * @tc.name : AudioRenderer - periodReach - on - on - * @tc.desc : AudioRenderer - periodReach - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_107', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - readPath = 'StarWars10s-2C-48000-4SW.wav'; - await getFdRead(readPath, done); - var resultFlag = await playbackPromise_107(AudioRendererOptions, filePath); - await sleep(100) - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_002 - * @tc.name : AudioRenderer-Set2-Media - * @tc.desc : AudioRenderer with parameter set 2 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_002', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_8000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - readPath = 'StarWars10s-1C-8000-2SW.wav' - await getFdRead(readPath, done); - var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_003 - * @tc.name : AudioRenderer-Set3-Media - * @tc.desc : AudioRenderer with parameter set 3 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_003', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_32000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - readPath = 'StarWars10s-1C-32000-1SW.wav' - await getFdRead(readPath, done); - var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_004 - * @tc.name : AudioRenderer-Set4-Media - * @tc.desc : AudioRenderer with parameter set 4 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_004', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_64000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - readPath = 'StarWars10s-1C-64000-3SW.wav' - await getFdRead(readPath, done); - var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_005 - * @tc.name : AudioRenderer-Set5-Media - * @tc.desc : AudioRenderer with parameter set 5 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_005', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_96000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - readPath = 'StarWars10s-1C-96000-4SW.wav' - await getFdRead(readPath, done); - var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_006 - * @tc.name : AudioRenderer-Set6-Media - * @tc.desc : AudioRenderer with parameter set 6 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_006', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_11025, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - readPath = 'StarWars10s-2C-11025-1SW.wav' - await getFdRead(readPath, done); - var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_007 - * @tc.name : AudioRenderer-Set7-Media - * @tc.desc : AudioRenderer with parameter set 7 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_007', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_12000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - readPath = 'StarWars10s-2C-12000-2SW.wav' - await getFdRead(readPath, done); - var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_011 - * @tc.name : AudioRenderer-Set11-Media - * @tc.desc : AudioRenderer with parameter set 11 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_011', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_012 - * @tc.name : AudioRenderer-isStreamActive - UNKNOWN - UNKNOWN - * @tc.desc : AudioRenderer-isStreamActive - UNKNOWN - UNKNOWN - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_012', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_013 - * @tc.name : AudioRenderer-isStreamActive - SPEECH - UNKNOWN - * @tc.desc : AudioRenderer-isStreamActive - SPEECH - UNKNOWN - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_013', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_014 - * @tc.name : AudioRenderer-isStreamActive - MUSIC - UNKNOWN - * @tc.desc : AudioRenderer-isStreamActive - MUSIC - UNKNOWN - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_014', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_015 - * @tc.name : AudioRenderer-isStreamActive - MOVIE - UNKNOWN - * @tc.desc : AudioRenderer-isStreamActive - MOVIE - UNKNOWN - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_015', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MOVIE, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_016 - * @tc.name : AudioRenderer-isStreamActive - SONIFICATION - UNKNOWN - * @tc.desc : AudioRenderer-isStreamActive - SONIFICATION - UNKNOWN - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_016', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_017 - * @tc.name : AudioRenderer-isStreamActive - RINGTONE - UNKNOWN - * @tc.desc : AudioRenderer-isStreamActive - RINGTONE - UNKNOWN - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_017', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_018 - * @tc.name : AudioRenderer-isStreamActive - UNKNOWN - MEDIA - * @tc.desc : AudioRenderer-isStreamActive - UNKNOWN - MEDIA - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_018', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_019 - * @tc.name : AudioRenderer-isStreamActive - SPEECH - MEDIA - * @tc.desc : AudioRenderer-isStreamActive - SPEECH - MEDIA - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_019', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.VOICE_ASSISTANT).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive VOICE_ASSISTANT: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive VOICE_ASSISTANT: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_020 - * @tc.name : AudioRenderer-isStreamActive - MUSIC - MEDIA - * @tc.desc : AudioRenderer-isStreamActive - MUSIC - MEDIA - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_020', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_021 - * @tc.name : AudioRenderer-isStreamActive - MOVIE - MEDIA - * @tc.desc : AudioRenderer-isStreamActive - MOVIE - MEDIA - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_021', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MOVIE, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_022 - * @tc.name : AudioRenderer-isStreamActive - SONIFICATION - MEDIA - * @tc.desc : AudioRenderer-isStreamActive - SONOTIFICATION - MEDIA - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_022', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_023 - * @tc.name : AudioRenderer-isStreamActive - RINGTONE - MEDIA - * @tc.desc : AudioRenderer-isStreamActive - RINGTONE - MEDIA - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_023', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_024 - * @tc.name : AudioRenderer-isStreamActive - UNKNOWN - VOICE_COMMUNICATION - * @tc.desc : AudioRenderer-isStreamActive - UNKNOWN - VOICE_COMMUNICATION - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_024', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_025 - * @tc.name : AudioRenderer-isStreamActive - SPEECH - VOICE_COMMUNICATION - * @tc.desc : AudioRenderer-isStreamActive - SPEECH - VOICE_COMMUNICATION - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_025', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.VOICE_CALL).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive VOICE_CALL: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive VOICE_CALL: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_026 - * @tc.name : AudioRenderer-isStreamActive - MUSIC - VOICE_COMMUNICATION - * @tc.desc : AudioRenderer-isStreamActive - MUSIC - VOICE_COMMUNICATION - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_026', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_027 - * @tc.name : AudioRenderer-isStreamActive - MOVIE - VOICE_COMMUNICATION - * @tc.desc : AudioRenderer-isStreamActive - MOVIE - VOICE_COMMUNICATION - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_027', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MOVIE, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_028 - * @tc.name : AudioRenderer-isStreamActive - SONOTIFICATION - VOICE_COMMUNICATION - * @tc.desc : AudioRenderer-isStreamActive - SONOTIFICATION - VOICE_COMMUNICATION - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_028', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_029 - * @tc.name : AudioRenderer-isStreamActive - RINGTONE - VOICE_COMMUNICATION - * @tc.desc : AudioRenderer-isStreamActive - RINGTONE - VOICE_COMMUNICATION - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_029', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_030 - * @tc.name : AudioRenderer-isStreamActive - UNKNOWN - NOTIFICATION_RINGTONE - * @tc.desc : AudioRenderer-isStreamActive - UNKNOWN - NOTIFICATION_RINGTONE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_030', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_031 - * @tc.name : AudioRenderer-isStreamActive - SPEECH - NOTIFICATION_RINGTONE - * @tc.desc : AudioRenderer-isStreamActive - SPEECH - NOTIFICATION_RINGTONE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_031', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_032 - * @tc.name : AudioRenderer-isStreamActive - MUSIC - NOTIFICATION_RINGTONE - * @tc.desc : AudioRenderer-isStreamActive - MUSIC - NOTIFICATION_RINGTONE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_032', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive RENGITONE: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_033 - * @tc.name : AudioRenderer-isStreamActive - MOVIE - NOTIFICATION_RINGTONE - * @tc.desc : AudioRenderer-isStreamActive - MOVIE - NOTIFICATION_RINGTONE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_033', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MOVIE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_034 - * @tc.name : AudioRenderer-isStreamActive - SONOTIFICATION - NOTIFICATION_RINGTONE - * @tc.desc : AudioRenderer-isStreamActive - SONOTIFICATION - NOTIFICATION_RINGTONE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_034', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_035 - * @tc.name : AudioRenderer-isStreamActive - RINGTONE - NOTIFICATION_RINGTONE - * @tc.desc : AudioRenderer-isStreamActive - RINGTONE - NOTIFICATION_RINGTONE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_035', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - readPath = 'StarWars10s-2C-48000-4SW.wav' - await getFdRead(readPath, done); - playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); - await sleep(2000); - audioManager.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { - if (data == true) { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :' + data); - } - else { - console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :' + data); - } - }); - await sleep(9000); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_042 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set1 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_042', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_043 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set2 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set2 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_043', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_044 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set3 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set3 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_044', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_045 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set4 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set4 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_045', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MOVIE, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_046 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set5 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set5 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_046', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_047 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set6 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set6 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_047', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_048 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set7 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set7 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_048', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_049 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set8 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set8 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_049', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_050 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set9 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set9 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_050', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_051 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set10 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set10 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_051', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MOVIE, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_052 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set11 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set11 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_052', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_053 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set12 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set12 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_053', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_054 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set13 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set13 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_054', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_055 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set14 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set14 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_055', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_056 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set15 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set15 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_056', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_057 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set16 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set16 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_057', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MOVIE, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_058 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set17 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set17 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_058', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_059 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set18 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set18 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_059', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_060 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set19 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set19 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_060', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_061 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set20 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set20 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_061', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_062 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set21 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set21 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_062', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_063 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set22 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set22 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_063', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MOVIE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_064 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set23 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set23 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_064', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_065 - * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set24 - * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set24 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_065', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - if (audioParamsGet.content == AudioRendererInfo.content) { - console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); - } - else { - console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); - resultFlag = false; - } - if (audioParamsGet.usage == AudioRendererInfo.usage) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); - resultFlag = false; - } - if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { - console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); - } - else { - console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_073 - * @tc.name : AudioRenderer - STATE_PREPARED - * @tc.desc : AudioRenderer - STATE_PREPARED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_073', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - if (audioRen.state == audio.AudioState.STATE_PREPARED) { - console.info('AudioFrameworkRenderLog: Audio State : STATE_PREPARED : PASS : ' + audioRen.state); - } - else { - console.info('AudioFrameworkRenderLog: Audio State : STATE_PREPARED : FAIL : ' + audioRen.state); - resultFlag = false; - } - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_074 - * @tc.name : AudioRenderer - STATE_RUNNING - * @tc.desc : AudioRenderer - STATE_RUNNING - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_074', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - await sleep(500); - - if (audioRen.state == audio.AudioState.STATE_RUNNING) { - console.info('AudioFrameworkRenderLog: Audio State : STATE_RUNNING : PASS : ' + audioRen.state); - } - else { - console.info('AudioFrameworkRenderLog: Audio State : STATE_RUNNING : FAIL : ' + audioRen.state); - resultFlag = false; - } - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_075 - * @tc.name : AudioRenderer - STATE_STOPPED - * @tc.desc : AudioRenderer - STATE_STOPPED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_075', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - await sleep(500); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - resultFlag = false; - }); - await sleep(500); - - if (audioRen.state == audio.AudioState.STATE_STOPPED) { - console.info('AudioFrameworkRenderLog: Audio State : STATE_STOPPED : PASS : ' + audioRen.state); - } - else { - console.info('AudioFrameworkRenderLog: Audio State : STATE_STOPPED : FAIL : ' + audioRen.state); - resultFlag = false; - } - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_076 - * @tc.name : AudioRenderer - STATE_RELEASED - * @tc.desc : AudioRenderer - STATE_RELEASED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_076', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - await sleep(500); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - resultFlag = false; - }); - await sleep(500); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - await sleep(500); - - if (audioRen.state == audio.AudioState.STATE_RELEASED) { - console.info('AudioFrameworkRenderLog: Audio State : STATE_RELEASED : PASS : ' + audioRen.state); - } - else { - console.info('AudioFrameworkRenderLog: Audio State : STATE_RELEASED : FAIL : ' + audioRen.state); - resultFlag = false; - } - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_077 - * @tc.name : AudioRenderer - STATE_PAUSED - * @tc.desc : AudioRenderer - STATE_PAUSED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_077', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = true; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - await sleep(500); - - await audioRen.pause().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant Pause :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant Pause :ERROR : ' + err.message); - resultFlag = false; - }); - - await sleep(500); - - if (audioRen.state == audio.AudioState.STATE_PAUSED) { - console.info('AudioFrameworkRenderLog: Audio State : STATE_PAUSED : PASS : ' + audioRen.state); - } - else { - console.info('AudioFrameworkRenderLog: Audio State : STATE_PAUSED : FAIL : ' + audioRen.state); - resultFlag = false; - } - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - await sleep(500); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - await sleep(500) - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_078 - * @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE - * @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_078', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - // var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - readPath = 'StarWars10s-2C-48000-4SW.wav'; - await getFdRead(readPath, done); - var AudioScene = audio.AudioScene.AUDIO_SCENE_DEFAULT; - - var resultFlag = true; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : ' + readPath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - var bufferSize = await audioRen.getBufferSize(); - console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); - - let ss = fileio.fdopenStreamSync(fdRead, 'r'); - console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.fstatSync(fdRead).size; - console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); - totalSize = totalSize - 44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); - let rlen = 0; - while (rlen < totalSize / 4) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); - await audioRen.write(buf); - if (rlen > (totalSize / 8)) { - await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkAudioScene: getAudioScene : Value : ' + data); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); - resultFlag = false; - }); - } - if (rlen > (totalSize / 8)) { - await audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_DOUBLE).then(async function () { - console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_DOUBLE : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_DOUBLE : ERROR : ' + err.message); - resultFlag = false; - }); - } - } - - console.info('AudioFrameworkRenderLog: Renderer after read'); - await audioRen.getRenderRate().then(async function (data) { - if (data == audio.AudioRendererRate.RENDER_RATE_DOUBLE) { - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : PASS : ' + data); - } - else { - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : FAIL : ' + data); - resultFlag = false; - } - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_DOUBLE : ERROR : ' + err.message); - resultFlag = false; - }); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - await sleep(500) - - expect(resultFlag).assertTrue(); - - await closeFileDescriptor(readPath); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_079 - * @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_HALF - * @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_HALF - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_079', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - readPath = 'StarWars10s-2C-24000-3SW.wav' - await getFdRead(readPath, done); - var AudioScene = audio.AudioScene.AUDIO_SCENE_DEFAULT; - - var resultFlag = true; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : ' + readPath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - var bufferSize = await audioRen.getBufferSize(); - console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); - - let ss = fileio.fdopenStreamSync(fdRead, 'r'); - console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.fstatSync(fdRead).size; - console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); - totalSize = totalSize - 44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); - let rlen = 0; - while (rlen < totalSize / 4) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); - await audioRen.write(buf); - if (rlen > (totalSize / 8)) { - await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkAudioScene: getAudioScene : Value : ' + data); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); - resultFlag = false; - }); - } - if (rlen > (totalSize / 8)) { - await audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_HALF).then(async function () { - console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_HALF : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_HALF : ERROR : ' + err.message); - resultFlag = false; - }); - } - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - await audioRen.getRenderRate().then(async function (data) { - if (data == audio.AudioRendererRate.RENDER_RATE_HALF) { - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_HALF : PASS : ' + data); - } - else { - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_HALF : FAIL : ' + data); - resultFlag = false; - } - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_HALF : ERROR : ' + err.message); - resultFlag = false; - }); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - await sleep(500) - - expect(resultFlag).assertTrue(); - - await closeFileDescriptor(readPath); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_080 - * @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_NORMAL - * @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_NORMAL - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_080', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - readPath = 'StarWars10s-1C-44100-2SW.wav' - await getFdRead(readPath, done); - var AudioScene = audio.AudioScene.AUDIO_SCENE_DEFAULT; - - var resultFlag = true; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - resultFlag = false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : ' + readPath); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - var bufferSize = await audioRen.getBufferSize(); - console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); - - let ss = fileio.fdopenStreamSync(fdRead, 'r'); - console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.fstatSync(fdRead).size; - console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); - totalSize = totalSize - 44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); - let rlen = 0; - while (rlen < totalSize / 4) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); - await audioRen.write(buf); - if (rlen > (totalSize / 8)) { - await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkAudioScene: getAudioScene : Value : ' + data); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); - resultFlag = false; - }); - } - if (rlen > (totalSize / 8)) { - await audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_DOUBLE).then(async function () { - console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_DOUBLE : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_DOUBLE : ERROR : ' + err.message); - resultFlag = false; - }); - } - } - await audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_NORMAL).then(async function () { - console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_NORMAL : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_NORMAL : ERROR : ' + err.message); - resultFlag = false; - }); - - console.info('AudioFrameworkRenderLog: Renderer after read'); - await audioRen.getRenderRate().then(async function (data) { - if (data == audio.AudioRendererRate.RENDER_RATE_NORMAL) { - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_NORMAL : PASS : ' + data); - } - else { - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_NORMAL : FAIL : ' + data); - resultFlag = false; - } - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_NORMAL : ERROR : ' + err.message); - resultFlag = false; - }); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - await sleep(500) - - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_081 - * @tc.name : AudioRenderer - SetRenderRate - DEFAULT - RENDER_RATE_NORMAL - * @tc.desc : AudioRenderer - SetRenderRate - DEFAULT - RENDER_RATE_NORMAL - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_081', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_96000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - // var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - readPath = 'StarWars10s-1C-96000-4SW.wav' - await getFdRead(readPath, done); - var AudioScene = audio.AudioScene.AUDIO_SCENE_DEFAULT; - - var resultFlag = true; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : ' + readPath); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - - await audioRen.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - var bufferSize = await audioRen.getBufferSize(); - console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); - - let ss = fileio.fdopenStreamSync(fdRead, 'r'); - console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.fstatSync(fdRead).size; - console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); - totalSize = totalSize - 44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); - let rlen = 0; - while (rlen < totalSize / 4) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); - await audioRen.write(buf); - if (rlen > (totalSize / 2)) { - await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkAudioScene: getAudioScene : Value : ' + data); - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); - resultFlag = false; - }); - } - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - await audioRen.getRenderRate().then(async function (data) { - if (data == audio.AudioRendererRate.RENDER_RATE_NORMAL) { - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_NORMAL : PASS : ' + data); - } - else { - console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_NORMAL : FAIL : ' + data); - resultFlag = false; - } - }).catch((err) => { - console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_NORMAL : ERROR : ' + err.message); - resultFlag = false; - }); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - await sleep(500) - - expect(resultFlag).assertTrue(); - - await closeFileDescriptor(readPath); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_113 - * @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE - Callback - * @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_113', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_32000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - readPath = 'StarWars10s-1C-32000-1SW.wav' - await getFdRead(readPath, done); - var resultFlag = await playbackPromise_113(AudioRendererOptions, filePath); - await sleep(100) - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_096 - * @tc.name : AudioRenderer - getAudioTime - Error - * @tc.desc : AudioRenderer - getAudioTime - Error - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_096', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - //var fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; - - readPath = 'StarWars10s-2C-48000-4SW.wav'; - await getFdRead(readPath, done); - var resultFlag = true; - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : ' + readPath); - - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - await audioRen.getAudioTime().then(async function (data) { - console.info('AudioFrameworkRenderLog: getAudioTime : Value : ' + data); - resultFlag = true; - if (data > 0) { - console.info('AudioFrameworkRenderLog: getAudioTime : PASS : ' + data); - } - else { - console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : ' + data); - } - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : ' + err.message); - }); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - await sleep(500); - - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readPath); - done(); - - }) - - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_097 - * @tc.name : AudioRenderer - STATE_PREPARED -Callback - * @tc.desc : AudioRenderer - STATE_PREPARED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_097', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - audioRen.on('stateChange', (AudioState) => { - - console.log('AudioFrameworkTest: Volume Change Event is called'); - - switch (AudioState) { - case audio.AudioState.STATE_PREPARED: - console.info('AudioFrameworkTest: state : STATE_NEW'); - resultFlag = true; - break; - default: - console.info('AudioFrameworkTest: state : ' + AudioState); - break; - } - }); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - await sleep(1000); - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_098 - * @tc.name : AudioRenderer - STATE_RUNNING - Callback - * @tc.desc : AudioRenderer - STATE_RUNNING - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_098', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - audioRen.on('stateChange', (AudioState) => { - - console.log('AudioFrameworkTest: Volume Change Event is called'); - - switch (AudioState) { - case audio.AudioState.STATE_RUNNING: - console.info('AudioFrameworkTest: state : STATE_RUNNING'); - resultFlag = true; - break; - default: - console.info('AudioFrameworkTest: state : ' + AudioState); - break; - } - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - await sleep(500); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - await sleep(1000); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_099 - * @tc.name : AudioRenderer - STATE_STOPPED - Callback - * @tc.desc : AudioRenderer - STATE_STOPPED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_099', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - audioRen.on('stateChange', (AudioState) => { - - console.log('AudioFrameworkTest: Volume Change Event is called'); - - switch (AudioState) { - case audio.AudioState.STATE_STOPPED: - console.info('AudioFrameworkTest: state : STATE_STOPPED'); - resultFlag = true; - break; - default: - console.info('AudioFrameworkTest: state : ' + AudioState); - break; - } - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - await sleep(500); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - resultFlag = false; - }); - await sleep(500); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - await sleep(500); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_100 - * @tc.name : AudioRenderer - STATE_RELEASED - Callback - * @tc.desc : AudioRenderer - STATE_RELEASED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_100', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - - audioRen.on('stateChange', (AudioState) => { - - console.log('AudioFrameworkTest: Volume Change Event is called'); - - switch (AudioState) { - case audio.AudioState.STATE_RELEASED: - console.info('AudioFrameworkTest: state : STATE_RELEASED'); - resultFlag = true; - break; - default: - console.info('AudioFrameworkTest: state : ' + AudioState); - break; - } - }); - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - await sleep(500); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - resultFlag = false; - }); - await sleep(500); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - await sleep(500); - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_101 - * @tc.name : AudioRenderer - STATE_PAUSED - Callback - * @tc.desc : AudioRenderer - STATE_PAUSED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_101', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - audioRen.on('stateChange', (AudioState) => { - - console.log('AudioFrameworkTest: Volume Change Event is called'); - - switch (AudioState) { - case audio.AudioState.STATE_PAUSED: - console.info('AudioFrameworkTest: state : STATE_PAUSED'); - resultFlag = true; - break; - default: - console.info('AudioFrameworkTest: state : ' + AudioState); - break; - } - }); - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - await sleep(500); - - await audioRen.pause().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant Pause :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant Pause :ERROR : ' + err.message); - resultFlag = false; - }); - - await sleep(500); - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - await sleep(500); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - await sleep(500) - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_108 - * @tc.name : AudioState - STATE_INVALID - * @tc.desc : AudioState - STATE_INVALID - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_108', 0, async function (done) { - - expect(audio.AudioState.STATE_INVALID).assertEqual(-1); - await sleep(50); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_109 - * @tc.name : AudioState - STATE_NEW - * @tc.desc : AudioState - STATE_NEW - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_109', 0, async function (done) { - - expect(audio.AudioState.STATE_NEW).assertEqual(0); - await sleep(50); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_110 - * @tc.name : AudioSampleFormat - STATE_FORMAT_INVALID - * @tc.desc : AudioSampleFormat - STATE_FORMAT_INVALID - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_110', 0, async function (done) { - - expect(audio.AudioSampleFormat.SAMPLE_FORMAT_INVALID).assertEqual(-1); - await sleep(50); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_111 - * @tc.name : SourceType - SOURCE_TYPE_INVALID - * @tc.desc : SourceType - SOURCE_TYPE_INVALID - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_111', 0, async function (done) { - - expect(audio.SourceType.SOURCE_TYPE_INVALID).assertEqual(-1); - await sleep(50); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_112 - * @tc.name : AudioRenderer - Pause - Callback - * @tc.desc : AudioRenderer - Pause - Callback - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_112', 0, async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - let isPass = false; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; - LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; - let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; - if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { - isPass = true; - return; - } - resultFlag = false; - }); - console.log("isPass:" + isPass); - if (isPass) { - resultFlag = true; - expect(resultFlag).assertTrue(); - done(); - return; - } - audioRen.on('stateChange', (AudioState) => { - - console.log('AudioFrameworkTest: Volume Change Event is called'); - - switch (AudioState) { - case audio.AudioState.STATE_PAUSED: - console.info('AudioFrameworkTest: state : STATE_PAUSED'); - resultFlag = true; - break; - default: - console.info('AudioFrameworkTest: state : ' + AudioState); - break; - } - }); - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - - await sleep(2000); - - audioRen.pause((err) => { - if (err) { - console.info('AudioFrameworkRenderLog: renderInstant Pause :ERROR : ' + err.message); - resultFlag = false; - } - else { - console.info('AudioFrameworkRenderLog: renderInstant Pause :SUCCESS '); - } - }); - await sleep(500); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - }); - await sleep(500); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - }); - await sleep(500) - - expect(resultFlag).assertTrue(); - - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_RENDERER_Play_audio_114 - * @tc.name : AudioEncodingType - ENCODING_TYPE_INVALID - * @tc.desc : AudioEncodingType - ENCODING_TYPE_INVALID - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_RENDERER_Play_audio_114', 0, async function (done) { - - expect(audio.AudioEncodingType.ENCODING_TYPE_INVALID).assertEqual(-1); - await sleep(50); - done(); - }) - - /* - * @tc.name:SetInterruptMode_001 - * @tc.desc:SetInterruptMode mode 0 callback,is public share mode - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("SetInterruptMode_001", 0,async function (done) { - var audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - var audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - var audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); - let mode = 0; - audioRenderer.setInterruptMode(mode,(err,data)=>{ - if(err){ - expect(true).assertEqual(false); - return done(); - } - expect(true).assertEqual(true); - done(); - }) - }) - - /* - * @tc.name:SetInterruptMode_002 - * @tc.desc:SetInterruptMode mode 1 callback,is independent mode - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("SetInterruptMode_002", 0,async function (done) { - var audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - var audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - var audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); - let mode = 1; - audioRenderer.setInterruptMode(mode,(err,data)=>{ - if(err){ - expect(true).assertEqual(false); - return done(); - } - expect(true).assertEqual(true); - done(); - }) - }) - - /* - * @tc.name:SetInterruptMode_003 - * @tc.desc:SetInterruptMode mode 0 promise,is public share mode - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("SetInterruptMode_003", 0,async function (done) { - var audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - var audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - var audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); - let mode = 0; - audioRenderer.setInterruptMode(mode).then(data=>{ - expect(true).assertEqual(true); - done(); - }).catch(err=>{ - expect(true).assertEqual(false); - done(); - }) - }) - - /* - * @tc.name:SetInterruptMode_004 - * @tc.desc:SetInterruptMode mode 1 promise,is independent mode - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("SetInterruptMode_004", 0,async function (done) { - var audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - var audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - var audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); - let mode = 1; - audioRenderer.setInterruptMode(mode).then(data=>{ - expect(true).assertEqual(true); - done(); - }).catch(err=>{ - expect(true).assertEqual(false); - done(); - }) - }) - - /* - * @tc.name:SetInterruptMode_005 - * @tc.desc:SetInterruptMode mode '1',will catch error with type error - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("SetInterruptMode_005", 0,async function (done) { - var audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - var audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - var audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); - let mode = '1'; - try{ - let data = await audioRenderer.setInterruptMode(mode); - expect(false).assertEqual(false); - done(); - }catch(err){ - expect('assertion (false) failed: type mismatch').assertEqual(err.message); - done(); - } - }) - - /* - * @tc.name:SetInterruptMode_006 - * @tc.desc:SetInterruptMode mode 2,will catch error with out of border - * @tc.type: FUNC - * @tc.require: Issue Number - */ - it("SetInterruptMode_006", 0,async function (done) { - var audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - var audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - var audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); - let mode = 2; - try{ - let data = await audioRenderer.setInterruptMode(mode) - expect(true).assertEqual(true); - done(); - }catch(err){ - expect(err).assertEqual(undefined); - done(); - } - }) -}) \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRendererChangeInfo.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRendererChangeInfo.test.js deleted file mode 100644 index 8d015a7333bd81793e2b0df41259fdfc588945a1..0000000000000000000000000000000000000000 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioRendererChangeInfo.test.js +++ /dev/null @@ -1,3412 +0,0 @@ -/* - * 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 audio from '@ohos.multimedia.audio'; -import resourceManager from '@ohos.resourceManager'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -describe('audioRendererChange', function () { - - var audioStreamManager; - var audioStreamManagerCB; - let fdRead; - var Tag = "AFRenLog : "; - const audioManager = audio.getAudioManager(); - console.info(Tag+'Create AudioManger Object JS Framework'); - - beforeAll(async function () { - await audioManager.getStreamManager().then(async function (data) { - audioStreamManager = data; - console.info(Tag+'Get AudioStream Manager : Success '); - }).catch((err) => { - console.info(Tag+'Get AudioStream Manager : ERROR : '+err.message); - }); - - audioManager.getStreamManager((err, data) => { - if (err) { - console.error(Tag+'Get AudioStream Manager : ERROR : '+err.message); - } - else { - audioStreamManagerCB = data; - console.info(Tag+'Get AudioStream Manager : Success '); - } - }); - await sleep(1000); - - console.info(Tag+'beforeAll: Prerequisites at the test suite level'); - }) - - beforeEach(async function () { - console.info(Tag+'beforeEach: Prerequisites at the test case level'); - await sleep(1000); - }) - - afterEach(function () { - console.info(Tag+'afterEach: Test case-level clearance conditions'); - }) - - afterAll(async function () { - console.info(Tag+'afterAll: Test suite-level cleanup condition'); - }) - - function sleep (ms) { - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function getFileDescriptor(fileName) { - let fileDescriptor = undefined; - await resourceManager.getResourceManager().then(async (mgr) => { - await mgr.getRawFileDescriptor(fileName).then(value => { - fileDescriptor = { fd: value.fd, offset: value.offset, length: value.length }; - }).catch(error => { - console.log(Tag+'case getRawFileDescriptor err: '+error); - }); - }); - return fileDescriptor; - } - - async function closeFileDescriptor(fileName) { - await resourceManager.getResourceManager().then(async (mgr) => { - await mgr.closeRawFileDescriptor(fileName).then(value => { - console.log(Tag+'case closeRawFileDescriptor success for file:'+fileName); - }).catch(error => { - console.log(Tag+'case closeRawFileDescriptor err: '+error); - }); - }); - } - async function getFdRead(pathName, done) { - await getFileDescriptor(pathName).then((res) => { - if (res == undefined) { - expect().assertFail(); - console.info(Tag+'case error fileDescriptor undefined, open file fail'); - done(); - } else { - fdRead = res.fd; - console.info("AFRenLog:case 0 fdRead is: "+fdRead); - } - }) - } - - /* * - * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_001 - * @tc.name : AudioRendererChange - ON_STATE_PREPARED - * @tc.desc : AudioRendererChange - ON_STATE_PREPARED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ON_RENDERER_CHANGE_001', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - - audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManagerCB.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-ON-001] ######### RendererChange Off is called #########'); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_002 - * @tc.name : AudioRendererChange - ON_STATE_RUNNING - * @tc.desc : AudioRendererChange - ON_STATE_RUNNING - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ON_RENDERER_CHANGE_002', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = false; - - var audioRen; - - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'renderInstant start :ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-ON-002] ######### RendererChange Off is called #########'); - - - await audioRen.stop().then(async function () { - console.info(Tag+'Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer stop:ERROR : '+err.message); - }); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_003 - * @tc.name : AudioRendererChange - ON_STATE_STOPPED - * @tc.desc : AudioRendererChange - ON_STATE_STOPPED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ON_RENDERER_CHANGE_003', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = false; - - var audioRen; - - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await audioRen.start().then(async function () { - console.info(Tag+'renderInstant started :SUCCESS '); - }).catch((err) => { - console.info(Tag+'renderInstant start :ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'Renderer stop:ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-ON-003] ######### RendererChange Off is called #########'); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_004 - * @tc.name : AudioRendererChange - ON_STATE_RELEASED - * @tc.desc : AudioRendererChange - ON_STATE_RELEASED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ON_RENDERER_CHANGE_004', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = false; - - var audioRen; - - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await audioRen.start().then(async function () { - console.info(Tag+'renderInstant started :SUCCESS '); - }).catch((err) => { - console.info(Tag+'renderInstant start :ERROR : '+err.message); - }); - - await audioRen.stop().then(async function () { - console.info(Tag+'Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer stop:ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-ON-004] ######### RendererChange Off is called #########'); - - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_005 - * @tc.name : AudioRendererChange - ON_STATE_PAUSED - * @tc.desc : AudioRendererChange - ON_STATE_PAUSED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ON_RENDERER_CHANGE_005', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = false; - - var audioRen; - - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await audioRen.start().then(async function () { - console.info(Tag+'renderInstant started :SUCCESS '); - }).catch((err) => { - console.info(Tag+'renderInstant start :ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'renderInstant Pause :ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-ON-005] ######### RendererChange Off is called #########'); - - await audioRen.stop().then(async function () { - console.info(Tag+'Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer stop:ERROR : '+err.message); - }); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_006 - * @tc.name : AudioRendererChange - ON_CONTENT_TYPE_RINGTONE - * @tc.desc : AudioRendererChange - ON_CONTENT_TYPE_RINGTONE - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ON_RENDERER_CHANGE_006', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - - audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await sleep(100); - audioStreamManagerCB.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-ON-006] ######### RendererChange Off is called #########'); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - -/* * - * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_007 - * @tc.name : AudioRendererChange - ON_CONTENT_TYPE_UNKNOWN - * @tc.desc : AudioRendererChange - ON_CONTENT_TYPE_UNKNOWN - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ON_RENDERER_CHANGE_007', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await sleep (100); - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-ON-007] ######### RendererChange Off is called #########'); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - - - - -/* * - * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_008 - * @tc.name : AudioRendererChange - ON_CONTENT_TYPE_SPEECH - * @tc.desc : AudioRendererChange - ON_CONTENT_TYPE_SPEECH - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ON_RENDERER_CHANGE_008', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await sleep (100); - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-ON-008] ######### RendererChange Off is called #########'); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - - -/* * - * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_009 - * @tc.name : AudioRendererChange - ON_CONTENT_TYPE_MUSIC - * @tc.desc : AudioRendererChange - ON_CONTENT_TYPE_MUSIC - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ON_RENDERER_CHANGE_009', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await sleep (100); - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-ON-009] ######### RendererChange Off is called #########'); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - -/* * - * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_010 - * @tc.name : AudioRendererChange - ON_CONTENT_TYPE_MOVIES - * @tc.desc : AudioRendererChange - ON_CONTENT_TYPE_MOVIES - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ON_RENDERER_CHANGE_010', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MOVIE, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-ON-010] ######### RendererChange Off is called #########'); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - - -/* * - * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_011 - * @tc.name : AudioRendererChange - ON_CONTENT_TYPE_SONIFICATION - * @tc.desc : AudioRendererChange - ON_CONTENT_TYPE_SONIFICATION - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ON_RENDERER_CHANGE_011', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-ON-011] ######### RendererChange Off is called #########'); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - -/* * - * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_012 - * @tc.name : AudioRendererChange - ON_STREAM_USAGE_UNKNOWN - * @tc.desc : AudioRendererChange - ON_STREAM_USAGE_UNKNOWN - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ON_RENDERER_CHANGE_012', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - - audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManagerCB.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-ON-012] ######### RendererChange Off is called #########'); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - -/* * - * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_013 - * @tc.name : AudioRendererChange - ON_STREAM_USAGE_MEDIA - * @tc.desc : AudioRendererChange - ON_STREAM_USAGE_MEDIA - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ON_RENDERER_CHANGE_013', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-ON-013] ######### RendererChange Off is called #########'); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - - -/* * - * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_014 - * @tc.name : AudioRendererChange - ON_STREAM_USAGE_MEDIA - * @tc.desc : AudioRendererChange - ON_STREAM_USAGE_MEDIA - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ON_RENDERER_CHANGE_014', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MOVIE, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-ON-014] ######### RendererChange Off is called #########'); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - -/* * - * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_015 - * @tc.name : AudioRendererChange - ON_STREAM_USAGE_MEDIA - * @tc.desc : AudioRendererChange - ON_STREAM_USAGE_MEDIA - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ON_RENDERER_CHANGE_015', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await sleep(100); - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-ON-015] ######### RendererChange Off is called #########'); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - -/* * - * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_016 - * @tc.name : AudioRendererChange - STREAMID - * @tc.desc : AudioRendererChange - STREAMID - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ON_RENDERER_CHANGE_016', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await sleep(100); - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-ON-015] ######### RendererChange Off is called #########'); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - - /* * - * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_017 - * @tc.name : AudioRendererChange - CLIENTUID & RENDERERFLAG - * @tc.desc : AudioRendererChange - CLIENTUID & RENDERERFLAG - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ON_RENDERER_CHANGE_017', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SONIFICATION, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await sleep(100); - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-ON-015] ######### RendererChange Off is called #########'); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_ON_RENDERER_CHANGE_018 - * @tc.name : AudioRendererChange - DEVICE DESCRIPTOR - * @tc.desc : AudioRendererChange - DEVICE DESCRIPTOR - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_ON_RENDERER_CHANGE_018', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = false; - - var audioRen; - - audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i 0 && dType == 2 && dRole == 2 && sRate!= null && cCount != null && cMask != null) { - resultFlag = true; - } - } - } - }); - await sleep (100); - - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManagerCB.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-ON-018] ######### RendererChange Off is called #########'); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_OFF_RENDERER_CHANGE_001 - * @tc.name : AudioRendererChange - OFF_STATE_PREPARED - * @tc.desc : AudioRendererChange - OFF_STATE_PREPARED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_OFF_RENDERER_CHANGE_001', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_32000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - var audioRen; - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_OFF_RENDERER_CHANGE_002 - * @tc.name : AudioRendererChange - OFF_STATE_RUNNING - * @tc.desc : AudioRendererChange - OFF_STATE_RUNNING - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_OFF_RENDERER_CHANGE_002', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_96000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_ASSISTANT, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = true; - var audioRen; - - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'renderInstant start :ERROR : '+err.message); - }); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_OFF_RENDERER_CHANGE_003 - * @tc.name : AudioRenderer - OFF_STATE_STOPPED - * @tc.desc : AudioRenderer - OFF_STATE_STOPPED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_OFF_RENDERER_CHANGE_003', 0,async function (done) { - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - var resultFlag = true; - var audioRen; - - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await audioRen.start().then(async function () { - console.info(Tag+'renderInstant started :SUCCESS '); - }).catch((err) => { - console.info(Tag+'renderInstant start :ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'Renderer stop:ERROR : '+err.message); - }); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_OFF_RENDERER_CHANGE_004 - * @tc.name : AudioRendererChange - OFF_STATE_RELEASED - * @tc.desc : AudioRendererChange - OFF_STATE_RELEASED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_OFF_RENDERER_CHANGE_004', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_8000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - var audioRen; - - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await audioRen.start().then(async function () { - console.info(Tag+'renderInstant started :SUCCESS '); - }).catch((err) => { - console.info(Tag+'renderInstant start :ERROR : '+err.message); - }); - - await audioRen.stop().then(async function () { - console.info(Tag+'Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer stop:ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_OFF_RENDERER_CHANGE_005 - * @tc.name : AudioRendererChange - OFF_STATE_PAUSED - * @tc.desc : AudioRendererChange - OFF_STATE_PAUSED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_OFF_RENDERER_CHANGE_005', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_8000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_UNKNOWN, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - var audioRen; - - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await audioRen.start().then(async function () { - console.info(Tag+'renderInstant started :SUCCESS '); - }).catch((err) => { - console.info(Tag+'renderInstant start :ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'renderInstant Pause :ERROR : '+err.message); - }); - - await audioRen.stop().then(async function () { - console.info(Tag+'Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer stop:ERROR : '+err.message); - }); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_OFF_RENDERER_CHANGE_006 - * @tc.name : AudioRendererChange - DEVICE DESCRIPTOR - * @tc.desc : AudioRendererChange - DEVICE DESCRIPTOR - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_OFF_RENDERER_CHANGE_006', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_32000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = true; - var audioRen; - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i 0 && dType == 2 && dRole == 2 && sRate!= null && cCount != null && cMask != null) { - resultFlag = false; - } - } - } - }); - await sleep (100); - - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[RENDERER-CHANGE-OFF-006] ######### RendererChange Off is called #########'); - console.info(Tag+'[RENDERER-CHANGE-OFF-006] ResultFlag is:'+resultFlag); - - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_GET_RENDERER_CHANGE_PROMISE_001 - * @tc.name : AudioRendererChange - GET_STATE_PREPARED - * @tc.desc : AudioRendererChange - GET_STATE_PREPARED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_GET_RENDERER_CHANGE_PROMISE_001', 0, async function (done) { - var audioCap ; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = false; - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioRenderer Created : ERROR : '+err.message); - }); - - await sleep(100); - - await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) { - console.info(Tag+'[GET_RENDERER_STATE_1_PROMISE] ######### Get Promise is called ##########'); - if (AudioRendererChangeInfoArray!=null) { - for (let i=0;i { - console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); - resultFlag = false; - }); - - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[GET_RENDERER_STATE_1_PROMISE] ######### RendererChange Off is called #########'); - - await audioCap.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_GET_RENDERER_CHANGE_PROMISE_002 - * @tc.name : AudioRendererChange - GET_STATE_RUNNING - * @tc.desc : AudioRendererChange - GET_STATE_RUNNING - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - * */ - - - it('SUB_AUDIO_GET_RENDERER_CHANGE_PROMISE_002', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = false; - - var audioCap; - - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioCap = data; - console.info(Tag+'AudioRenderer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioRenderer Created : ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'Renderer start :ERROR : '+err.message); - }); - - await sleep(100); - - await audioStreamManagerCB.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) { - console.info(Tag+'[GET_RENDERER_STATE_2_PROMISE] ######### Get Promise is called ##########'); - if (AudioRendererChangeInfoArray!=null) { - for (let i=0;i { - console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); - resultFlag = false; - }); - - audioStreamManagerCB.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[GET_RENDERER_STATE_2_PROMISE] ######### RendererChange Off is called #########'); - - await audioCap.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_GET_RENDERER_CHANGE_PROMISE_003 - * @tc.name : AudioRendererChange - GET_STATE_STOPPED - * @tc.desc : AudioRendererChange - GET_STATE_STOPPED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - * */ - - - it('SUB_AUDIO_GET_RENDERER_CHANGE_PROMISE_003', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = false; - - var audioCap; - - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioCap = data; - console.info(Tag+'AudioRenderer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioRenderer Created : ERROR : '+err.message); - }); - - await audioCap.start().then(async function () { - console.info(Tag+'Renderer started :SUCCESS '); - }).catch((err) => { - console.info(Tag+'Renderer start :ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'Renderer stop:ERROR : '+err.message); - }); - - await sleep(100); - - await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) { - console.info(Tag+'[GET_RENDERER_STATE_3_PROMISE] ######### Get Promise is called ##########'); - if (AudioRendererChangeInfoArray!=null) { - for (let i=0;i { - console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); - resultFlag = false; - }); - - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[GET_RENDERER_STATE_3_PROMISE] ######### RendererChange Off is called #########'); - - await audioCap.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_GET_RENDERER_CHANGE_PROMISE_004 - * @tc.name : AudioRendererChange - GET_STATE_PAUSED - * @tc.desc : AudioRendererChange - GET_STATE_PAUSED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_GET_RENDERER_CHANGE_PROMISE_004', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = false; - - var audioRen; - - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await audioRen.start().then(async function () { - console.info(Tag+'renderInstant started :SUCCESS '); - }).catch((err) => { - console.info(Tag+'renderInstant start :ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'renderInstant Pause :ERROR : '+err.message); - }); - - await sleep (100); - - await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) { - console.info(Tag+'[GET_RENDERER_STATE_5_PROMISE] ######### Get Promise is called ##########'); - if (AudioRendererChangeInfoArray!=null) { - for (let i=0;i { - console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); - resultFlag = false; - }); - - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[GET_RENDERER_STATE_5_PROMISE] ######### RendererChange Off is called #########'); - - await audioRen.stop().then(async function () { - console.info(Tag+'Renderer stopped : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer stop:ERROR : '+err.message); - }); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - -/* * - * @tc.number : SUB_AUDIO_GET_RENDERER_CHANGE_PROMISE_005 - * @tc.name : AudioRendererChange - DEVICE DESCRIPTOR - * @tc.desc : AudioRendererChange - DEVICE DESCRIPTOR - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_GET_RENDERER_CHANGE_PROMISE_005', 0, async function (done) { - var audioCap ; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = false; - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioRenderer Created : ERROR : '+err.message); - }); - - await sleep(100); - - await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) { - console.info(Tag+'[GET_RENDERER_DD_PROMISE] ######### Get Promise is called ##########'); - if (AudioRendererChangeInfoArray!=null) { - for (let i=0;i 0 && dType == 2 && dRole == 2 && sRate!= null && cCount != null && cMask != null) { - resultFlag = true; - } - } - } - } - }).catch((err) => { - console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); - resultFlag = false; - }); - - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[GET_RENDERER_DD_PROMISE] ######### RendererChange Off is called #########'); - - await audioCap.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_GET_RENDERER_CHANGE_CALLBACK_001 - * @tc.name : AudioRendererChange - GET_STATE_PREPARED - * @tc.desc : AudioRendererChange - GET_STATE_PREPARED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_GET_RENDERER_CHANGE_CALLBACK_001', 0, async function (done) { - var audioCap ; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = false; - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioRenderer Created : ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => { - console.info(Tag+'[GET_RENDERER_STATE_1_CALLBACK] **** Get Callback Called ****'); - await sleep(100); - if (err) { - console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); - resultFlag = false; - } - else { - if (AudioRendererChangeInfoArray !=null) { - for (let i=0;i { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_GET_RENDERER_CHANGE_CALLBACK_002 - * @tc.name : AudioRendererChange - GET_STATE_RUNNING - * @tc.desc : AudioRendererChange - GET_STATE_RUNNING - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - * */ - - - it('SUB_AUDIO_GET_RENDERER_CHANGE_CALLBACK_002', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = false; - - var audioCap; - - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioCap = data; - console.info(Tag+'AudioRenderer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioRenderer Created : ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManagerCB.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'Renderer start :ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManagerCB.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => { - console.info(Tag+'[GET_RENDERER_STATE_2_CALLBACK] **** Get Callback Called ****'); - await sleep(100); - if (err) { - console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); - resultFlag = false; - } - else { - if (AudioRendererChangeInfoArray !=null) { - for (let i=0;i { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_GET_RENDERER_CHANGE_CALLBACK_003 - * @tc.name : AudioRendererChange - GET_STATE_STOPPED - * @tc.desc : AudioRendererChange - GET_STATE_STOPPED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - * */ - - - it('SUB_AUDIO_GET_RENDERER_CHANGE_CALLBACK_003', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = false; - - var audioCap; - - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioCap = data; - console.info(Tag+'AudioRenderer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioRenderer Created : ERROR : '+err.message); - }); - - await audioCap.start().then(async function () { - console.info(Tag+'Renderer started :SUCCESS '); - }).catch((err) => { - console.info(Tag+'Renderer start :ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'Renderer stop:ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => { - console.info(Tag+'[GET_RENDERER_STATE_3_CALLBACK] **** Get Callback Called ****'); - await sleep(100); - if (err) { - console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); - resultFlag = false; - } - else { - if (AudioRendererChangeInfoArray !=null) { - for (let i=0;i { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - - }) - - /* * - * @tc.number : SUB_AUDIO_GET_RENDERER_CHANGE_CALLBACK_004 - * @tc.name : AudioRendererChange - GET_STATE_PAUSED - * @tc.desc : AudioRendererChange - GET_STATE_PAUSED - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_GET_RENDERER_CHANGE_CALLBACK_004', 0,async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = false; - - var audioRen; - - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info(Tag+'AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info(Tag+'AudioRender Created : ERROR : '+err.message); - }); - - await audioRen.start().then(async function () { - console.info(Tag+'renderInstant started :SUCCESS '); - }).catch((err) => { - console.info(Tag+'renderInstant start :ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'renderInstant Pause :ERROR : '+err.message); - }); - - await sleep (100); - - audioStreamManager.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => { - console.info(Tag+'[GET_RENDERER_STATE_5_CALLBACK] **** Get Callback Called ****'); - await sleep(100); - if (err) { - console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); - resultFlag = false; - } - else { - if (AudioRendererChangeInfoArray !=null) { - for (let i=0;i { - console.info(Tag+'Renderer stop:ERROR : '+err.message); - }); - - await audioRen.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_GET_RENDERER_CHANGE_CALLBACK_005 - * @tc.name : AudioRendererChange - DEVICE DESCRIPTOR - * @tc.desc : AudioRendererChange - DEVICE DESCRIPTOR - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0*/ - - it('SUB_AUDIO_GET_RENDERER_CHANGE_CALLBACK_005', 0, async function (done) { - var audioCap ; - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_RINGTONE, - usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - var resultFlag = false; - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i=0;i { - console.info(Tag+'AudioRenderer Created : ERROR : '+err.message); - }); - - await sleep(100); - - audioStreamManager.getCurrentAudioRendererInfoArray(async (err, AudioRendererChangeInfoArray) => { - console.info(Tag+'[GET_RENDERER_DD_CALLBACK] **** Get Callback Called ****'); - await sleep(100); - if (err) { - console.log(Tag+'getCurrentAudioRendererInfoArray :ERROR: '+err.message); - resultFlag = false; - } - else { - if (AudioRendererChangeInfoArray !=null) { - for (let i=0;i 0 && dType == 2 && dRole == 2 && sRate!= null && cCount != null && cMask!=null){ - resultFlag = true; - } - } - } - } - } - }); - - await sleep(1000); - - audioStreamManager.off('audioRendererChange'); - await sleep(100); - console.info(Tag+'[GET_RENDERER_DD_CALLBACK] ######### RendererChange Off is called #########'); - - await audioCap.release().then(async function () { - console.info(Tag+'Renderer release : SUCCESS'); - }).catch((err) => { - console.info(Tag+'Renderer release :ERROR : '+err.message); - }); - - expect(resultFlag).assertTrue(); - done(); - }) - - -}) \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioVOIP.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioVOIP.test.js deleted file mode 100644 index 053d449cfd60f17540a33f8f121f6337fe0dde4c..0000000000000000000000000000000000000000 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioVOIP.test.js +++ /dev/null @@ -1,495 +0,0 @@ -// @ts-nocheck -/* - * 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 audio from '@ohos.multimedia.audio'; -import fileio from '@ohos.fileio'; -import featureAbility from '@ohos.ability.featureAbility' -import resourceManager from '@ohos.resourceManager'; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; - -describe('audioVoip', function () { - var mediaDir; - let fdRead; - let readpath; - let fdPath; - let filePath; - const audioManager = audio.getAudioManager(); - console.info('AudioFrameworkRenderLog: Create AudioManger Object JS Framework'); - - beforeAll(async function () { - console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level'); - //mediaDir = '/data/storage/el2/base/haps/entry/cache'; - }) - - beforeEach(async function () { - console.info('AudioFrameworkTest: beforeEach: Prerequisites at the test case level'); - await sleep(1000); - }) - - afterEach(function () { - console.info('AudioFrameworkTest: afterEach: Test case-level clearance conditions'); - }) - - afterAll(async function () { - console.info('AudioFrameworkTest: afterAll: Test suite-level cleanup condition'); - }) - - function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function getAbilityInfo(fileName) { - let context = await featureAbility.getContext(); - console.info("case0 context is " + context); - await context.getFilesDir().then((data) => { - console.info("case1 getFilesDir is path " + data); - mediaDir = data + '/' + fileName; - console.info('case2 mediaDir is ' + mediaDir); - }) - } - async function closeFileDescriptor(fileName) { - await resourceManager.getResourceManager().then(async (mgr) => { - await mgr.closeRawFileDescriptor(fileName).then(value => { - console.log('AudioFrameworkRenderLog:case closeRawFileDescriptor success for file:' + fileName); - }).catch(error => { - console.log('AudioFrameworkRenderLog:case closeRawFileDescriptor err: ' + error); - }); - }); - } - async function getFdRead(pathName) { - let context = await featureAbility.getContext(); - console.info("case0 context is " + context); - await context.getFilesDir().then((data) => { - console.info("case1 getFilesDir is path " + data); - filePath = data + '/' + pathName; - console.info('case4 filePath is ' + filePath); - - }) - fdPath = 'fd://'; - await fileio.open(filePath).then((fdNumber) => { - fdPath = fdPath + '' + fdNumber; - fdRead = fdNumber; - console.info('[fileIO]case open fd success,fdPath is ' + fdPath); - console.info('[fileIO]case open fd success,fdRead is ' + fdRead); - - }, (err) => { - console.info('[fileIO]case open fd failed'); - }).catch((err) => { - console.info('[fileIO]case catch open fd failed'); - }); - } - - async function playbackPromise(AudioRendererOptions, pathName, AudioScene) { - var resultFlag = 'new'; - console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); - - var audioRen; - await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { - audioRen = data; - console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); - return resultFlag; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : Path : ' + pathName); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.getStreamInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); - console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); - resultFlag = false; - }); - if (resultFlag == false) { - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - await audioRen.getRendererInfo().then(async function (audioParamsGet) { - console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); - console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); - console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); - console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); - }).catch((err) => { - console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); - resultFlag = false; - }); - if (resultFlag == false) { - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - await audioRen.start().then(async function () { - console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); - resultFlag = false; - }); - if (resultFlag == false) { - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - var bufferSize; - await audioRen.getBufferSize().then(async function (data) { - console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); - bufferSize = data; - }).catch((err) => { - console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); - resultFlag = false; - }); - if (resultFlag == false) { - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - let ss = fileio.fdopenStreamSync(fdRead, 'r'); - console.info('AudioFrameworkRenderLog:case2: File Path: ' + ss); - let discardHeader = new ArrayBuffer(44); - ss.readSync(discardHeader); - let totalSize = fileio.fstatSync(fdRead).size; - console.info('AudioFrameworkRenderLog:case3: File totalSize size: ' + totalSize); - totalSize = totalSize - 44; - console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); - let rlen = 0; - while (rlen < totalSize / 4) { - let buf = new ArrayBuffer(bufferSize); - rlen += ss.readSync(buf); - console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); - await audioRen.write(buf); - if (rlen > (totalSize / 2)) { - await audioManager.getAudioScene().then(async function (data) { - console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : Value : ' + data); - }).catch((err) => { - console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); - resultFlag = false; - }); - } - } - console.info('AudioFrameworkRenderLog: Renderer after read'); - - await audioRen.drain().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); - }).catch((err) => { - console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); - resultFlag = false; - }); - if (resultFlag == false) { - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.stop().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); - resultFlag = true; - console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlag); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); - resultFlag = false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - await audioRen.release().then(async function () { - console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); - resultFlag = false; - }); - - console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); - - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - - return resultFlag; - } - - async function recPromise(AudioCapturerOptions, fpath, AudioScene) { - - var resultFlag = 'new'; - console.info('AudioFrameworkRecLog: Promise : Audio Recording Function'); - - var audioCap; - - await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { - audioCap = data; - console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message); - return resultFlag; - }); - - console.info('AudioFrameworkRecLog: AudioCapturer : Path : ' + fpath); - - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); - - await audioCap.getStreamInfo().then(async function (audioParamsGet) { - if (audioParamsGet != undefined) { - console.info('AudioFrameworkRecLog: Capturer getStreamInfo:'); - console.info('AudioFrameworkRecLog: Capturer sampleFormat:' + audioParamsGet.sampleFormat); - console.info('AudioFrameworkRecLog: Capturer samplingRate:' + audioParamsGet.samplingRate); - console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); - console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); - } else { - console.info('AudioFrameworkRecLog: audioParamsGet is : ' + audioParamsGet); - console.info('AudioFrameworkRecLog: audioParams getStreamInfo are incorrect: '); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message); - resultFlag = false; - }); - if (resultFlag == false) { - console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - await audioCap.getCapturerInfo().then(async function (audioParamsGet) { - if (audioParamsGet != undefined) { - console.info('AudioFrameworkRecLog: Capturer CapturerInfo:'); - console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); - console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); - } else { - console.info('AudioFrameworkRecLog: audioParamsGet is : ' + audioParamsGet); - console.info('AudioFrameworkRecLog: audioParams getCapturerInfo are incorrect: '); - resultFlag = false; - } - }).catch((err) => { - console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message); - resultFlag = false; - }); - if (resultFlag == false) { - console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - await audioCap.start().then(async function () { - console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message); - resultFlag = false; - }); - if (resultFlag == false) { - console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); - return resultFlag; - } - - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); - - var bufferSize = await audioCap.getBufferSize(); - console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); - - var fd = fileio.openSync(fpath, 0o102, 0o777); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd created'); - } - else { - console.info('AudioFrameworkRecLog: Capturer start :ERROR : '); - resultFlag = false; - return resultFlag; - } - - fd = fileio.openSync(fpath, 0o2002, 0o666); - if (fd !== null) { - console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); - } - else { - console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); - resultFlag = false; - return resultFlag; - } - await sleep(100); - var numBuffersToCapture = 45; - while (numBuffersToCapture) { - console.info('AudioFrameworkRecLog: ---------READ BUFFER---------'); - var buffer = await audioCap.read(bufferSize, true); - await sleep(50); - console.info('AudioFrameworkRecLog: ---------WRITE BUFFER---------'); - var number = fileio.writeSync(fd, buffer); - console.info('AudioFrameworkRecLog:BufferRecLog: data written: ' + number); - await sleep(50); - numBuffersToCapture--; - } - await sleep(1000); - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); - - await audioCap.stop().then(async function () { - console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); - resultFlag = true; - console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlag); - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message); - resultFlag = false; - }); - - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); - - await audioCap.release().then(async function () { - console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); - }).catch((err) => { - console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message); - resultFlag = false; - }); - - console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state); - - return resultFlag; - - } - - /* * - * @tc.number : SUB_AUDIO_VOIP_Play_001 - * @tc.name : AudioRenderer-Set1-Media - * @tc.desc : AudioRenderer with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_VOIP_Play_001', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfo, - rendererInfo: AudioRendererInfo - } - - await getFdRead("StarWars10s-1C-44100-2SW.wav"); - var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(filePath); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_Rec_001 - * @tc.name : AudioCapturer-Set1-Media - * @tc.desc : AudioCapturer with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_VOIP_Rec_001', 0, async function (done) { - - var AudioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_VOICE_COMMUNICATION, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfo, - capturerInfo: AudioCapturerInfo - } - - await getAbilityInfo("capture_js-44100-2C-16B.pcm"); - var resultFlag = await recPromise(AudioCapturerOptions, mediaDir, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - done(); - }) - - /* * - * @tc.number : SUB_AUDIO_VOIP_RecPlay_001 - * @tc.name : AudioCapturer-Set1-Media - * @tc.desc : AudioCapturer with parameter set 1 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_VOIP_RecPlay_001', 0, async function (done) { - - var AudioStreamInfoCap = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_2, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_VOICE_COMMUNICATION, - capturerFlags: 0 - } - - var AudioCapturerOptions = { - streamInfo: AudioStreamInfoCap, - capturerInfo: AudioCapturerInfo - } - - var AudioStreamInfoRen = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var AudioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 - } - - var AudioRendererOptions = { - streamInfo: AudioStreamInfoRen, - rendererInfo: AudioRendererInfo - } - - await getAbilityInfo("capture_js-44100-2C-16B-2.pcm"); - await recPromise(AudioCapturerOptions, mediaDir, audio.AudioScene.AUDIO_SCENE_PHONE_CHAT); - await sleep(500); - - readpath = 'StarWars10s-1C-44100-2SW.wav'; - await getFdRead(readpath); - var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); - await sleep(100); - console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); - expect(resultFlag).assertTrue(); - await closeFileDescriptor(readpath); - done(); - }) - - -}) \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js index 309d6321d95292f62b04e75c1630afeedfffecfc..c9fb777cb497c7690ffaa8fa3edc9e4522259b98 100644 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/List.test.js @@ -13,13 +13,5 @@ * limitations under the License. */ -require('./getPermission.test.js') -require('./AudioRendererChangeInfo.test.js') -require('./AudioCapturerChangeInfo.test.js') require('./AudioFramework.test.js') -require('./AudioVOIP.test.js') -require('./AudioCall.test.js') -require('./AudioCapturer.test.js') -require('./AudioEventManagement.test.js') -require('./AudioRenderer.test.js') diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/getPermission.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/getPermission.test.js deleted file mode 100644 index 31d080975f8e50f3b12538958c45a8ea1b6c3413..0000000000000000000000000000000000000000 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/getPermission.test.js +++ /dev/null @@ -1,78 +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 { describe, beforeAll,afterAll, it, expect } from 'deccjsunit/index'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; -import bundle from '@ohos.bundle'; -import account from '@ohos.account.osAccount'; -describe("get_permission", function () { - let userId ; - async function getUserId () { - await account.getAccountManager().getOsAccountLocalIdFromProcess().then(account => { - console.info("getOsAccountLocalIdFromProcess userid ==========" + account); - userId = account; - }).catch(err=>{ - console.info("getOsAccountLocalIdFromProcess err ==========" + JSON.stringify(err)); - }) - } - /** - * @tc.number SUB_DF_GRANT_USER_GRANTED_PERMISSION_0000 - * @tc.name grant_user_granted_permission_async_000 - * @tc.desc Test grantUserGrantedPermission() interfaces, grant permission. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 0 - * @tc.require - */ - it("grant_user_granted_permission_async_000", 0, async function (done) { - await getUserId(); - let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.audiomanager', 0, userId); - let tokenID = appInfo.accessTokenId; - let atManager = abilityAccessCtrl.createAtManager(); - let result1 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.MEDIA_LOCATION",1); - let result2 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.READ_MEDIA",1); - let result3 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.WRITE_MEDIA",1); - let result4 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",1); - let result5 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS",1); - let result6 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.MICROPHONE",1); - let result7 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.ACCESS_NOTIFICATION_POLICY",1); - let result8 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.MODIFY_AUDIO_SETTINGS",1); - let isGranted1 = await atManager.verifyAccessToken(tokenID, "ohos.permission.MEDIA_LOCATION"); - let isGranted2 = await atManager.verifyAccessToken(tokenID, "ohos.permission.READ_MEDIA"); - let isGranted3 = await atManager.verifyAccessToken(tokenID, "ohos.permission.WRITE_MEDIA"); - let isGranted4 = await atManager.verifyAccessToken(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS"); - let isGranted5 = await atManager.verifyAccessToken(tokenID, "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"); - let isGranted6 = await atManager.verifyAccessToken(tokenID, "ohos.permission.MICROPHONE"); - let isGranted7 = await atManager.verifyAccessToken(tokenID, "ohos.permission.ACCESS_NOTIFICATION_POLICY"); - let isGranted8 = await atManager.verifyAccessToken(tokenID, "ohos.permission.MODIFY_AUDIO_SETTINGS"); - console.info("AudioManagerLog: Perm1:"+result1); - console.info("AudioManagerLog: Perm2:"+result2); - console.info("AudioManagerLog: Perm3:"+result3); - console.info("AudioManagerLog: Perm1G:"+isGranted1); - console.info("AudioManagerLog: Perm2G:"+isGranted2); - console.info("AudioManagerLog: Perm3G:"+isGranted3); - console.info("AudioManagerLog: Perm4:"+result4); - console.info("AudioManagerLog: Perm5:"+result5); - console.info("AudioManagerLog: Perm6:"+result6); - console.info("AudioManagerLog: Perm4G:"+isGranted4); - console.info("AudioManagerLog: Perm5G:"+isGranted5); - console.info("AudioManagerLog: Perm6G:"+isGranted6); - console.info("AudioManagerLog: Perm7:"+result7); - console.info("AudioManagerLog: Perm8:"+result8); - console.info("AudioManagerLog: Perm7G:"+isGranted7); - console.info("AudioManagerLog: Perm8G:"+isGranted8); - done(); - }); -}); \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-1C-16000-2SW.wav b/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-1C-16000-2SW.wav deleted file mode 100644 index 5dcdb4004a5c40c02ad178018d3e375133f380e9..0000000000000000000000000000000000000000 Binary files a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-1C-16000-2SW.wav and /dev/null differ diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-1C-32000-1SW.wav b/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-1C-32000-1SW.wav deleted file mode 100644 index 61d9393b79f2c32f836203522c29174943c5d3fa..0000000000000000000000000000000000000000 Binary files a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-1C-32000-1SW.wav and /dev/null differ diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-1C-44100-2SW.wav b/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-1C-44100-2SW.wav deleted file mode 100644 index 25fb78622a6440fe2d8175b496ba0021b02b28dc..0000000000000000000000000000000000000000 Binary files a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-1C-44100-2SW.wav and /dev/null differ diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-1C-64000-3SW.wav b/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-1C-64000-3SW.wav deleted file mode 100644 index 9bec09e5d63ea27d2a944e9cebf6a239f8239745..0000000000000000000000000000000000000000 Binary files a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-1C-64000-3SW.wav and /dev/null differ diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-1C-8000-2SW.wav b/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-1C-8000-2SW.wav deleted file mode 100644 index 708a6b49099ecbde34cbd04f4089c7bc8b9938d2..0000000000000000000000000000000000000000 Binary files a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-1C-8000-2SW.wav and /dev/null differ diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-1C-96000-4SW.wav b/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-1C-96000-4SW.wav deleted file mode 100644 index 5c483b7b7474d8d8190b2e146f9457fba273d850..0000000000000000000000000000000000000000 Binary files a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-1C-96000-4SW.wav and /dev/null differ diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-2C-11025-1SW.wav b/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-2C-11025-1SW.wav deleted file mode 100644 index 523db76990b8fe912800a0133acd6852b74acb3c..0000000000000000000000000000000000000000 Binary files a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-2C-11025-1SW.wav and /dev/null differ diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-2C-12000-2SW.wav b/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-2C-12000-2SW.wav deleted file mode 100644 index ea2234f5436d22ef4ca2f0dca2d7e675eea40524..0000000000000000000000000000000000000000 Binary files a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-2C-12000-2SW.wav and /dev/null differ diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-2C-16000-3SW.wav b/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-2C-16000-3SW.wav deleted file mode 100644 index 1c37c84b41e622e250020e08eb2be3b0ab04ffb6..0000000000000000000000000000000000000000 Binary files a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-2C-16000-3SW.wav and /dev/null differ diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-2C-22050-2SW.wav b/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-2C-22050-2SW.wav deleted file mode 100644 index fe07a3ba102bb6b2ab582a91d2a19f52ba881601..0000000000000000000000000000000000000000 Binary files a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-2C-22050-2SW.wav and /dev/null differ diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-2C-24000-3SW.wav b/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-2C-24000-3SW.wav deleted file mode 100644 index 062f5346c7c1e63d7b8e46cfc6b521ba98ed9b25..0000000000000000000000000000000000000000 Binary files a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-2C-24000-3SW.wav and /dev/null differ diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-2C-48000-4SW.wav b/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-2C-48000-4SW.wav deleted file mode 100644 index 2cb88e7a083279328e06067a033c951dabd531d3..0000000000000000000000000000000000000000 Binary files a/multimedia/audio/audio_js_standard/audioManager/src/main/resources/rawfile/StarWars10s-2C-48000-4SW.wav and /dev/null differ diff --git a/multimedia/audio/audio_js_standard/audioRenderer/BUILD.gn b/multimedia/audio/audio_js_standard/audioRenderer/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..fd59cccb73e67ba85e6078af6768b822ea3c7198 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioRenderer/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("audio_renderer_js_hap") { + hap_profile = "./src/main/config.json" + deps = [ + ":audio_renderer_js_assets", + ":audio_renderer_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAudioRendererJsTest" + subsystem_name = "multimedia" + part_name = "multimedia_audio_framework" +} +ohos_js_assets("audio_renderer_js_assets") { + source_dir = "./src/main/js/default" +} +ohos_resources("audio_renderer_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/multimedia/audio/audio_js_standard/audioRenderer/Test.json b/multimedia/audio/audio_js_standard/audioRenderer/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..5b7fd2ae572c8ac4a99e119b74d5802ef2b68fbf --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioRenderer/Test.json @@ -0,0 +1,46 @@ +{ + "description": "Configuration for audio manager Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "1500000", + "package": "ohos.acts.multimedia.audio.audiorenderer", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAudioRendererJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files", + "chmod 777 -R /data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry" + ], + "cleanup-apps": true + }, + { + "type": "PushKit", + "pre-push": [], + "push": [ + "./resource/audio/audioManager/Believer.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/", + "./resource/audio/audioManager/Believer60s.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-1C-8000-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-1C-16000-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-1C-32000-1SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-1C-44100-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-1C-64000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-1C-96000-4SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-2C-11025-1SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-2C-12000-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-2C-16000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-2C-22050-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-2C-24000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/", + "./resource/audio/audioManager/StarWars10s-2C-48000-4SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiorenderer/haps/entry/files/" + ] + } + ] +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioRenderer/signature/openharmony_sx.p7b b/multimedia/audio/audio_js_standard/audioRenderer/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..0e9c4376f4c0ea2f256882a2170cd4e81ac135d7 Binary files /dev/null and b/multimedia/audio/audio_js_standard/audioRenderer/signature/openharmony_sx.p7b differ diff --git a/multimedia/audio/audio_js_standard/audioRenderer/src/main/config.json b/multimedia/audio/audio_js_standard/audioRenderer/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..1cd9f2c1b6d23053b0eb93599ce38758cde78ac8 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioRenderer/src/main/config.json @@ -0,0 +1,75 @@ +{ + "app": { + "apiVersion": { + "compatible": 6, + "releaseType": "Beta1", + "target": 7 + }, + "vendor": "acts", + "bundleName": "ohos.acts.multimedia.audio.audiorenderer", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": { + "default": { + "debug": true + } + }, + "module": { + "abilities": [ + { + "iconId": 16777218, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "descriptionId": 16777217, + "visible": true, + "labelId": 16777216, + "icon": "$media:icon", + "name": "ohos.acts.multimedia.audio.audiorenderer.MainAbility", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "homeAbility": true, + "launchType": "standard" + } + ], + "deviceType": [ + "default", + "phone", + "tablet", + "tv", + "wearable" + ], + "mainAbility": "ohos.acts.multimedia.audio.audiorenderer.MainAbility", + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "ohos.acts.multimedia.audio.audiorenderer", + "name": ".MyApplication", + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/default/app.js b/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* + * 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/audio/audio_js_standard/audioRenderer/src/main/js/default/i18n/en-US.json b/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/default/i18n/zh-CN.json b/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/default/pages/index/index.css b/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..5bd7567028568bd522193b2519d545ca6dcf397d --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/default/pages/index/index.css @@ -0,0 +1,46 @@ +.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/audio/audio_js_standard/audioRenderer/src/main/js/default/pages/index/index.hml b/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/default/pages/index/index.js b/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a0719cee588ac4b0f56efbf784b19647bc6645de --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/default/pages/index/index.js @@ -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 {Core, ExpectExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + const configService = core.getDefaultService('config') + this.timeout = 60000 + configService.setConfig(this) + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/test/AudioRenderer.test.js b/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/test/AudioRenderer.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e81dbf72055f1a4b2ef6502026941909456cc3a4 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/test/AudioRenderer.test.js @@ -0,0 +1,7592 @@ +/* + * 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 audio from '@ohos.multimedia.audio'; +import fileio from '@ohos.fileio'; +import resourceManager from '@ohos.resourceManager'; +import featureAbility from '@ohos.ability.featureAbility' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; + +describe('audioRenderer', function () { + + let fdRead; + let readPath; + const AUDIOMANAGER = audio.getAudioManager(); + console.info('AudioFrameworkRenderLog: Create AudioManger Object JS Framework'); + let fdPath; + let filePath; + + beforeAll(async function () { + console.info('AudioFrameworkRenderLog: beforeAll: Prerequisites at the test suite level'); + }) + + beforeEach(async function () { + console.info('AudioFrameworkRenderLog: beforeEach: Prerequisites at the test case level'); + await sleep(1000); + }) + + afterEach(function () { + console.info('AudioFrameworkRenderLog: afterEach: Test case-level clearance conditions'); + }) + + afterAll(async function () { + console.info('AudioFrameworkRenderLog: afterAll: Test suite-level cleanup condition'); + }) + + function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); + } + async function closeFileDescriptor(fileName) { + await resourceManager.getResourceManager().then(async (mgr) => { + await mgr.closeRawFileDescriptor(fileName).then(value => { + console.log('AudioFrameworkRenderLog:case closeRawFileDescriptor success for file:' + fileName); + }).catch(error => { + console.log('AudioFrameworkRenderLog:case closeRawFileDescriptor err: ' + error); + }); + }); + } + + async function getFdRead(pathName, done) { + let context = await featureAbility.getContext(); + console.info("case0 context is " + context); + await context.getFilesDir().then((data) => { + console.info("case1 getFilesDir is path " + data); + filePath = data + '/' + pathName; + console.info('case4 filePath is ' + filePath); + + }) + fdPath = 'fd://'; + await fileio.open(filePath).then((fdNumber) => { + fdPath = fdPath + '' + fdNumber; + fdRead = fdNumber; + console.info('[fileIO]case open fd success,fdPath is ' + fdPath); + console.info('[fileIO]case open fd success,fdRead is ' + fdRead); + + }, (err) => { + console.info('[fileIO]case open fd failed'); + }).catch((err) => { + console.info('[fileIO]case catch open fd failed'); + }); + } + + async function playbackPromise(AudioRendererOptions, pathName, AudioScene) { + let resultFlag = 'new'; + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data state: ' + Object.keys(data)); + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS data value: ' + JSON.stringify(data)); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + return resultFlag; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + return resultFlag; + } + + console.info('AudioFrameworkRenderLog: AudioRenderer : Path : ' + pathName); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); + resultFlag = false; + }); + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + return resultFlag; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + return resultFlag; + } + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + return resultFlag; + } + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + let bufferSize; + await audioRen.getBufferSize().then(async function (data) { + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); + resultFlag = false; + }); + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + return resultFlag; + } + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case2: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case3: File totalSize size: ' + totalSize); + totalSize = totalSize - 44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); + let rlen = 0; + while (rlen < totalSize / 4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); + await audioRen.write(buf); + if (rlen > (totalSize / 2)) { + await AUDIOMANAGER.getAudioScene().then(async function (data) { + console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : Value : ' + data); + }).catch((err) => { + console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); + resultFlag = false; + }); + } + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); + resultFlag = false; + }); + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + return resultFlag; + } + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + resultFlag = true; + console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlag); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + resultFlag = false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + resultFlag = false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + return resultFlag; + } + + async function playbackPromise_93(AudioRendererOptions, pathName, AudioScene) { + let resultFlag = true; + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + return resultFlag; + } + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + //let audioTime = Date.now(); + let audioTimeStart; + /*let audioTimeEnd; + let audioTimeMiddle;*/ + // console.info('AudioFrameworkRenderLog: Current Time in NANOSeconds : '+audioTime); + + await audioRen.getAudioTime().then(async function (data) { + // audioTime = Date.now(); + audioTimeStart = data / 1000000000;//-audioTime)/1000000000; + console.info('AudioFrameworkRenderLog: getAudioTime : After Start : Converted: ' + audioTimeStart); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : ' + err.message); + resultFlag = false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + let bufferSize = await audioRen.getBufferSize(); + console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); + totalSize = totalSize - 44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); + let rlen = 0; + while (rlen < totalSize / 4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); + await audioRen.write(buf); + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + + //let gettime = audioTimeMiddle-audioTimeStart; + if (audioTimeStart != 0) { + console.info('AudioFrameworkRenderLog: getAudioTime : PASS : ' + audioTimeStart); + } + else { + console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : ' + audioTimeStart); + resultFlag = false; + } + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + return resultFlag; + } + + async function playbackPromise_94(AudioRendererOptions, pathName, AudioScene) { + let resultFlag = true; + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + return resultFlag; + } + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + // let audioTime = Date.now(); + let audioTimeStart; + //let audioTimeEnd; + //let audioTimeMiddle; + //console.info('AudioFrameworkRenderLog: Current Time in NANOSeconds : '+audioTime); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + let bufferSize = await audioRen.getBufferSize(); + console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); + totalSize = totalSize - 44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); + let rlen = 0; + let gettime = 0; + while (rlen < totalSize / 4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); + await audioRen.write(buf); + await audioRen.getAudioTime().then(async function (data) { + audioTimeStart = data / 1000000000; + console.info('AudioFrameworkRenderLog: getAudioTime : After Start : Converted: ' + audioTimeStart); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : ' + err.message); + resultFlag = false; + }); + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + + if (audioTimeStart != 0) { + console.info('AudioFrameworkRenderLog: getAudioTime : PASS : ' + audioTimeStart); + } + else { + console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : ' + audioTimeStart); + resultFlag = false; + } + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + return resultFlag; + } + + async function playbackPromise_95(AudioRendererOptions, pathName, AudioScene) { + let resultFlag = true; + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + return resultFlag; + } + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + let audioTimeStart; + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + let bufferSize = await audioRen.getBufferSize(); + console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); + totalSize = totalSize - 44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); + let rlen = 0; + while (rlen < totalSize / 4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); + await audioRen.write(buf); + } + + console.info('AudioFrameworkRenderLog: Renderer after read'); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + + await audioRen.getAudioTime().then(async function (data) { + audioTimeStart = data / 1000000000; + console.info('AudioFrameworkRenderLog: getAudioTime : After Start : Converted: ' + audioTimeStart); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : ' + err.message); + resultFlag = false; + }); + + if (audioTimeStart != 0) { + console.info('AudioFrameworkRenderLog: getAudioTime : PASS : ' + audioTimeStart); + } + else { + console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : ' + audioTimeStart); + resultFlag = false; + } + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + return resultFlag; + } + + async function playbackPromise_102(AudioRendererOptions, pathName) { + let resultFlag = false; + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + return resultFlag; + } + audioRen.on('markReach', 55, (position) => { + console.log('AudioFrameworkTest: markReach Event is called : ' + position); + resultFlag = true; + }) + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + let bufferSize; + await audioRen.getBufferSize().then(async function (data) { + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); + resultFlag = false; + }); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + console.info('AudioFrameworkRenderLog:case 2-1:AudioFrameworkRenderLog: File Path: '); + ss.readSync(discardHeader); + console.info('AudioFrameworkRenderLog:case 2-2:AudioFrameworkRenderLog: File Path: '); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); + totalSize = totalSize - 44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); + let rlen = 0; + while (rlen < totalSize / 4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); + await audioRen.write(buf); + } + + console.info('AudioFrameworkRenderLog: Renderer after read'); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + return resultFlag; + } + + async function playbackPromise_103(AudioRendererOptions, pathName) { + let resultFlag = false; + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + return resultFlag; + } + audioRen.on('markReach', 55, (position) => { + console.log('AudioFrameworkTest: markReach Event is called : ' + position); + audioRen.off('markReach'); + audioRen.on('markReach', 100, (position) => { + console.log('AudioFrameworkTest: markReach Event is called : ' + position); + resultFlag = true; + }); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + let bufferSize; + await audioRen.getBufferSize().then(async function (data) { + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); + resultFlag = false; + }); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); + totalSize = totalSize - 44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); + let rlen = 0; + while (rlen < totalSize / 4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); + await audioRen.write(buf); + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + return resultFlag; + } + + async function playbackPromise_104(AudioRendererOptions, pathName) { + let resultFlag = false; + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + return resultFlag; + } + audioRen.on('markReach', 55, (position) => { + console.log('AudioFrameworkTest: markReach Event is called : ' + position); + resultFlag = true; + audioRen.on('markReach', 73, (position) => { + console.log('AudioFrameworkTest: markReach Event is called : ' + position); + resultFlag = false; + }); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + let bufferSize; + await audioRen.getBufferSize().then(async function (data) { + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); + resultFlag = false; + }); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); + totalSize = totalSize - 44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); + let rlen = 0; + while (rlen < totalSize / 4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); + await audioRen.write(buf); + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + return resultFlag; + } + + async function playbackPromise_105(AudioRendererOptions, pathName) { + let resultFlag = false; + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + return resultFlag; + } + audioRen.on('periodReach', 55, (position) => { + console.log('AudioFrameworkTest: periodReach Event is called : ' + position); + resultFlag = true; + audioRen.off('periodReach'); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + let bufferSize; + await audioRen.getBufferSize().then(async function (data) { + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); + resultFlag = false; + }); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); + totalSize = totalSize - 44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); + let rlen = 0; + while (rlen < totalSize / 4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); + await audioRen.write(buf); + } + + console.info('AudioFrameworkRenderLog: Renderer after read'); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + return resultFlag; + } + + async function playbackPromise_106(AudioRendererOptions, pathName) { + let resultFlag = false; + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + return resultFlag; + } + audioRen.on('periodReach', 55, (position) => { + console.log('AudioFrameworkTest: periodReach Event is called : ' + position); + // resultFlag = true; + audioRen.off('periodReach'); + audioRen.on('periodReach', 100, (position) => { + console.log('AudioFrameworkTest: periodReach Event is called : ' + position); + resultFlag = true; + audioRen.off('periodReach'); + }); + + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + let bufferSize; + await audioRen.getBufferSize().then(async function (data) { + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); + resultFlag = false; + }); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); + totalSize = totalSize - 44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); + let rlen = 0; + while (rlen < totalSize / 4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); + await audioRen.write(buf); + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + return resultFlag; + } + + async function playbackPromise_107(AudioRendererOptions, pathName) { + let resultFlag = false; + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + return resultFlag; + } + audioRen.on('periodReach', 55, (position) => { + console.log('AudioFrameworkTest: periodReach Event is called : ' + position); + resultFlag = true; + audioRen.on('periodReach', 73, (position) => { + console.log('AudioFrameworkTest: periodReach Event is called : ' + position); + resultFlag = false; + }); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + let bufferSize; + await audioRen.getBufferSize().then(async function (data) { + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); + bufferSize = data; + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); + resultFlag = false; + }); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); + totalSize = totalSize - 44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); + let rlen = 0; + while (rlen < totalSize / 4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); + await audioRen.write(buf); + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + return resultFlag; + } + + async function playbackPromise_113(AudioRendererOptions, pathName) { + let resultFlag = true; + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + let audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + resultFlag = false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + let bufferSize = await audioRen.getBufferSize(); + console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); + totalSize = totalSize - 44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); + let rlen = 0; + while (rlen < totalSize / 4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); + await audioRen.write(buf); + if (rlen > (totalSize / 8)) { + await AUDIOMANAGER.getAudioScene().then(async function (data) { + console.info('AudioFrameworkAudioScene: getAudioScene : Value : ' + data); + }).catch((err) => { + console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); + resultFlag = false; + }); + } + if (rlen > (totalSize / 8)) { + + audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_DOUBLE, (err) => { + if (err) { + console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_DOUBLE : ERROR : ' + err.message); + resultFlag = false; + } + else { + console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_DOUBLE : SUCCESS'); + } + }); + } + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + + audioRen.getRenderRate((err, data) => { + if (err) { + console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_DOUBLE : ERROR : ' + err.message); + resultFlag = false; + } + else if (data == audio.AudioRendererRate.RENDER_RATE_DOUBLE) { + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : PASS : ' + data); + } + else { + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : FAIL : ' + data); + resultFlag = false; + } + }); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + return resultFlag; + } + + async function playbackCB(AudioRendererOptions, pathName) { + + let resultFlag = 'new'; + + console.info('AudioFrameworkRenderLog: CALLBACK : Audio Playback Function'); + + let audioRen; + + audio.createAudioRenderer(AudioRendererOptions, (err, data) => { + if (err) { + console.error(`AudioFrameworkRenderLog: AudioRender Created : Error: ${err.message}`); + resultFlag = false; + } + else { + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : SUCCESS'); + audioRen = data; + } + }); + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + return resultFlag; + } + + await sleep(100); + + console.info('AudioFrameworkRenderLog: AudioRenderer : Path : ' + pathName); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + console.info('AudioFrameworkRenderLog: Callback : Audio Playback Function'); + + audioRen.start((err) => { + if (err) { + console.error(`AudioFrameworkRenderLog: Renderer start failed: Error: ${err.message}`); + resultFlag = false; + } + else { + console.info('AudioFrameworkRenderLog: Renderer started'); + } + }); + await sleep(100); + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + return resultFlag; + } + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + let samplingRate; + audioRen.getStreamInfo(async (err, audioParamsGet) => { + await sleep(100); + if (err) { + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); + resultFlag = false; + } + else { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); + samplingRate = audioParamsGet.samplingRate; + } + }); + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + return resultFlag; + } + + audioRen.getRendererInfo(async (err, audioParamsGet) => { + await sleep(100); + if (err) { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + } + else { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + } + }); + await sleep(100); + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + return resultFlag; + } + + let bufferSize; + await audioRen.getBufferSize((err, data) => { + if (err) { + console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message); + resultFlag = false; + } + else { + console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data); + bufferSize = data; + } + }); + await sleep(100); + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + return resultFlag; + } + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 4: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + let aa = fileio.fstatSync(fdRead); + console.log('case 6 : ' + aa); + console.info('AudioFrameworkRenderLog: File totalSize size: ' + totalSize); + totalSize = totalSize - 44; + let rlen = 0; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); + await sleep(100); + // let waitTime = (totalSize/88200); + let waitTime; + switch (samplingRate) { + case 44100: + waitTime = 45; + break; + case 8000: + waitTime = 60; + break; + case 32000: + waitTime = 45; + break; + case 64000: + waitTime = 45; + break; + case 96000: + waitTime = 45; + break; + case 11025: + waitTime = 45; + break; + case 12000: + waitTime = 45; + break; + case 16000: + waitTime = 45; + break; + case 22050: + waitTime = 45; + break; + case 24000: + waitTime = 45; + break; + case 48000: + waitTime = 45; + break; + default: + waitTime = 45; + break + } + + await sleep(100); + console.info('AudioFrameworkRenderLog: waitTime : ' + waitTime); + while (rlen < totalSize / 10) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('BufferAudioFramework: bytes read from file: ' + rlen); + await audioRen.write(buf, (err, data) => { + if (err) { + console.error(`AudioFrameworkRenderLog: Buff write: Error: ${err.message}`); + resultFlag = false; + } + else { + console.info('BufferAudioFramework: Buff write successful : '); + resultFlag = true; + } + }); + await sleep(waitTime); + } + await sleep(100); + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + return resultFlag; + } + ss.closeSync(); + audioRen.drain((err, state) => { + if (err) { + console.error(`AudioFrameworkRenderLog: Renderer drain failed: Error: ${err.message}`); + resultFlag = false; + } + else { + console.info('AudioFrameworkRenderLog: Renderer drained'); + } + }); + await sleep(100); + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + return resultFlag; + } + audioRen.stop((err, state) => { + if (err) { + console.error(`AudioFrameworkRenderLog: Renderer stop failed: Error: ${err.message}`); + resultFlag = false; + } + else { + console.info('AudioFrameworkRenderLog: Renderer stopped'); + resultFlag = true; + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + } + }); + await sleep(100); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + if (resultFlag == false) { + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + return resultFlag; + } + audioRen.release((err, state) => { + if (err) { + console.error(`AudioFrameworkRenderLog: Renderer release failed: Error: ${err.message}`); + resultFlag = false; + } + else { + console.info('AudioFrameworkRenderLog: Renderer released'); + } + }); + await sleep(100); + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + return resultFlag; + + } + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_0100 + * @tc.name : AudioRenderer-Set1-Media + * @tc.desc : AudioRenderer with parameter set 1 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_0100', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readPath = 'StarWars10s-1C-44100-2SW.wav' + await getFdRead(readPath, done); + let resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_0200 + * @tc.name : AudioRenderer - getAudioTime -Before Play + * @tc.desc : AudioRenderer - getAudioTime -Before Play + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_0200', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readPath = 'StarWars10s-2C-24000-3SW.wav' + await getFdRead(readPath, done); + let resultFlag = await playbackPromise_93(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100) + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_0300 + * @tc.name : AudioRenderer - getAudioTime - During Play + * @tc.desc : AudioRenderer - getAudioTime - During Play + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_0300', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readPath = 'StarWars10s-2C-24000-3SW.wav' + await getFdRead(readPath, done); + let resultFlag = await playbackPromise_94(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100) + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_0400 + * @tc.name : AudioRenderer - getAudioTime - after Play + * @tc.desc : AudioRenderer - getAudioTime - after Play + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_0400', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readPath = 'StarWars10s-2C-24000-3SW.wav' + await getFdRead(readPath, done); + let resultFlag = await playbackPromise_95(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100) + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_0500 + * @tc.name : AudioRenderer - markReached - On + * @tc.desc : AudioRenderer - markReached + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_0500', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + //let fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + let resultFlag = await playbackPromise_102(AudioRendererOptions, filePath); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_0600 + * @tc.name : AudioRenderer - markReached - On - off -on + * @tc.desc : AudioRenderer - markReached + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_0600', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + //let fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + let resultFlag = await playbackPromise_103(AudioRendererOptions, filePath); + await sleep(100) + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_0700 + * @tc.name : AudioRenderer - markReached - on - on + * @tc.desc : AudioRenderer - markReached + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_0700', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + //let fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readPath = 'StarWars10s-2C-48000-4SW.wav'; + await getFdRead(readPath, done); + let resultFlag = await playbackPromise_104(AudioRendererOptions, filePath); + await sleep(100) + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_0800 + * @tc.name : AudioRenderer - periodReach - On + * @tc.desc : AudioRenderer - periodReach + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_0800', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + readPath = 'StarWars10s-2C-48000-4SW.wav'; + await getFdRead(readPath, done); + let resultFlag = await playbackPromise_105(AudioRendererOptions, filePath); + await sleep(100) + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_0900 + * @tc.name : AudioRenderer - periodReach - On - off -on + * @tc.desc : AudioRenderer - periodReach + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_0900', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + //let fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readPath = 'StarWars10s-2C-48000-4SW.wav'; + await getFdRead(readPath, done); + let resultFlag = await playbackPromise_106(AudioRendererOptions, filePath); + await sleep(100) + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1000 + * @tc.name : AudioRenderer - periodReach - on - on + * @tc.desc : AudioRenderer - periodReach + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1000', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + //let fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readPath = 'StarWars10s-2C-48000-4SW.wav'; + await getFdRead(readPath, done); + let resultFlag = await playbackPromise_107(AudioRendererOptions, filePath); + await sleep(100) + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1100 + * @tc.name : AudioRenderer-Set2-Media + * @tc.desc : AudioRenderer with parameter set 2 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1100', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_8000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readPath = 'StarWars10s-1C-8000-2SW.wav' + await getFdRead(readPath, done); + let resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1200 + * @tc.name : AudioRenderer-Set3-Media + * @tc.desc : AudioRenderer with parameter set 3 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1200', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_32000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readPath = 'StarWars10s-1C-32000-1SW.wav' + await getFdRead(readPath, done); + let resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1300 + * @tc.name : AudioRenderer-Set4-Media + * @tc.desc : AudioRenderer with parameter set 4 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1300', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_64000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readPath = 'StarWars10s-1C-64000-3SW.wav' + await getFdRead(readPath, done); + let resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1400 + * @tc.name : AudioRenderer-Set5-Media + * @tc.desc : AudioRenderer with parameter set 5 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1400', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_96000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readPath = 'StarWars10s-1C-96000-4SW.wav' + await getFdRead(readPath, done); + let resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1500 + * @tc.name : AudioRenderer-Set6-Media + * @tc.desc : AudioRenderer with parameter set 6 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1500', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_11025, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readPath = 'StarWars10s-2C-11025-1SW.wav' + await getFdRead(readPath, done); + let resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1600 + * @tc.name : AudioRenderer-Set7-Media + * @tc.desc : AudioRenderer with parameter set 7 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1600', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_12000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readPath = 'StarWars10s-2C-12000-2SW.wav' + await getFdRead(readPath, done); + let resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1700 + * @tc.name : AudioRenderer-Set11-Media + * @tc.desc : AudioRenderer with parameter set 11 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1700', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + let resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(100); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1800 + * @tc.name : AudioRenderer-isStreamActive - UNKNOWN - UNKNOWN + * @tc.desc : AudioRenderer-isStreamActive - UNKNOWN - UNKNOWN + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1800', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1900 + * @tc.name : AudioRenderer-isStreamActive - SPEECH - UNKNOWN + * @tc.desc : AudioRenderer-isStreamActive - SPEECH - UNKNOWN + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_1900', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2000 + * @tc.name : AudioRenderer-isStreamActive - MUSIC - UNKNOWN + * @tc.desc : AudioRenderer-isStreamActive - MUSIC - UNKNOWN + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2000', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2100 + * @tc.name : AudioRenderer-isStreamActive - MOVIE - UNKNOWN + * @tc.desc : AudioRenderer-isStreamActive - MOVIE - UNKNOWN + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2100', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2200 + * @tc.name : AudioRenderer-isStreamActive - SONIFICATION - UNKNOWN + * @tc.desc : AudioRenderer-isStreamActive - SONIFICATION - UNKNOWN + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2200', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2300 + * @tc.name : AudioRenderer-isStreamActive - RINGTONE - UNKNOWN + * @tc.desc : AudioRenderer-isStreamActive - RINGTONE - UNKNOWN + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2300', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2400 + * @tc.name : AudioRenderer-isStreamActive - UNKNOWN - MEDIA + * @tc.desc : AudioRenderer-isStreamActive - UNKNOWN - MEDIA + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2400', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2500 + * @tc.name : AudioRenderer-isStreamActive - SPEECH - MEDIA + * @tc.desc : AudioRenderer-isStreamActive - SPEECH - MEDIA + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2500', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.VOICE_ASSISTANT).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive VOICE_ASSISTANT: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive VOICE_ASSISTANT: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2600 + * @tc.name : AudioRenderer-isStreamActive - MUSIC - MEDIA + * @tc.desc : AudioRenderer-isStreamActive - MUSIC - MEDIA + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2600', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2700 + * @tc.name : AudioRenderer-isStreamActive - MOVIE - MEDIA + * @tc.desc : AudioRenderer-isStreamActive - MOVIE - MEDIA + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2700', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2800 + * @tc.name : AudioRenderer-isStreamActive - SONIFICATION - MEDIA + * @tc.desc : AudioRenderer-isStreamActive - SONOTIFICATION - MEDIA + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2800', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2900 + * @tc.name : AudioRenderer-isStreamActive - RINGTONE - MEDIA + * @tc.desc : AudioRenderer-isStreamActive - RINGTONE - MEDIA + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_2900', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3000 + * @tc.name : AudioRenderer-isStreamActive - UNKNOWN - VOICE_COMMUNICATION + * @tc.desc : AudioRenderer-isStreamActive - UNKNOWN - VOICE_COMMUNICATION + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3000', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3100 + * @tc.name : AudioRenderer-isStreamActive - SPEECH - VOICE_COMMUNICATION + * @tc.desc : AudioRenderer-isStreamActive - SPEECH - VOICE_COMMUNICATION + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3100', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.VOICE_CALL).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive VOICE_CALL: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive VOICE_CALL: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3200 + * @tc.name : AudioRenderer-isStreamActive - MUSIC - VOICE_COMMUNICATION + * @tc.desc : AudioRenderer-isStreamActive - MUSIC - VOICE_COMMUNICATION + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3200', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3300 + * @tc.name : AudioRenderer-isStreamActive - MOVIE - VOICE_COMMUNICATION + * @tc.desc : AudioRenderer-isStreamActive - MOVIE - VOICE_COMMUNICATION + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3300', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3400 + * @tc.name : AudioRenderer-isStreamActive - SONOTIFICATION - VOICE_COMMUNICATION + * @tc.desc : AudioRenderer-isStreamActive - SONOTIFICATION - VOICE_COMMUNICATION + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3400', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3500 + * @tc.name : AudioRenderer-isStreamActive - RINGTONE - VOICE_COMMUNICATION + * @tc.desc : AudioRenderer-isStreamActive - RINGTONE - VOICE_COMMUNICATION + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3500', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3600 + * @tc.name : AudioRenderer-isStreamActive - UNKNOWN - NOTIFICATION_RINGTONE + * @tc.desc : AudioRenderer-isStreamActive - UNKNOWN - NOTIFICATION_RINGTONE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3600', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3700 + * @tc.name : AudioRenderer-isStreamActive - SPEECH - NOTIFICATION_RINGTONE + * @tc.desc : AudioRenderer-isStreamActive - SPEECH - NOTIFICATION_RINGTONE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3700', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3800 + * @tc.name : AudioRenderer-isStreamActive - MUSIC - NOTIFICATION_RINGTONE + * @tc.desc : AudioRenderer-isStreamActive - MUSIC - NOTIFICATION_RINGTONE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3800', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive RENGITONE: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3900 + * @tc.name : AudioRenderer-isStreamActive - MOVIE - NOTIFICATION_RINGTONE + * @tc.desc : AudioRenderer-isStreamActive - MOVIE - NOTIFICATION_RINGTONE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_3900', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4000 + * @tc.name : AudioRenderer-isStreamActive - SONOTIFICATION - NOTIFICATION_RINGTONE + * @tc.desc : AudioRenderer-isStreamActive - SONOTIFICATION - NOTIFICATION_RINGTONE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4000', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.MEDIA).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive Media: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive Media: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4100 + * @tc.name : AudioRenderer-isStreamActive - RINGTONE - NOTIFICATION_RINGTONE + * @tc.desc : AudioRenderer-isStreamActive - RINGTONE - NOTIFICATION_RINGTONE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4100', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + readPath = 'StarWars10s-2C-48000-4SW.wav' + await getFdRead(readPath, done); + playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_DEFAULT); + await sleep(2000); + AUDIOMANAGER.isActive(audio.AudioVolumeType.RINGTONE).then(function (data) { + if (data == true) { + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: PASS :' + data); + } + else { + console.log('AudioFrameworkTest: Promise : isActive RINGTONE: FAIL :' + data); + } + }); + await sleep(9000); + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4200 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set1 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set1 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4200', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4300 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set2 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set2 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4300', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4400 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set3 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set3 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4400', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4500 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set4 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set4 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4500', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4600 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set5 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set5 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4600', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4700 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set6 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set6 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4700', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_UNKNOWN, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4800 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set7 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set7 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4800', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4900 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set8 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set8 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_4900', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5000 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set9 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set9 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5000', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5100 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set10 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set10 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5100', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5200 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set11 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set11 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5200', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5300 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set12 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set12 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5300', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5400 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set13 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set13 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5400', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5500 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set14 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set14 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5500', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5600 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set15 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set15 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5600', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5700 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set16 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set16 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5700', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5800 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set17 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set17 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5800', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5900 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set18 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set18 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_5900', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6000 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set19 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set19 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6000', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_UNKNOWN, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6100 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set20 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set20 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6100', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6200 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set21 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set21 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6200', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6300 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set22 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set22 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6300', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MOVIE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6400 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set23 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set23 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6400', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6500 + * @tc.name : AudioRenderer-SET & GET AudioRendererInfo - Set24 + * @tc.desc : AudioRenderer-SET & GET AudioRendererInfo - Set24 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6500', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + if (audioParamsGet.content == AudioRendererInfo.content) { + console.info('AudioFrameworkRenderLog: Renderer content type: PASS: ' + audioParamsGet.content); + } + else { + console.info('AudioFrameworkRenderLog: Renderer content type: FAIL: ' + audioParamsGet.content); + resultFlag = false; + } + if (audioParamsGet.usage == AudioRendererInfo.usage) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.usage); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.usage); + resultFlag = false; + } + if (audioParamsGet.rendererFlags == AudioRendererInfo.rendererFlags) { + console.info('AudioFrameworkRenderLog: Renderer usage type: PASS: ' + audioParamsGet.rendererFlags); + } + else { + console.info('AudioFrameworkRenderLog: Renderer usage type: FAIL: ' + audioParamsGet.rendererFlags); + resultFlag = false; + } + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6600 + * @tc.name : AudioRenderer - STATE_PREPARED + * @tc.desc : AudioRenderer - STATE_PREPARED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6600', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + if (audioRen.state == audio.AudioState.STATE_PREPARED) { + console.info('AudioFrameworkRenderLog: Audio State : STATE_PREPARED : PASS : ' + audioRen.state); + } + else { + console.info('AudioFrameworkRenderLog: Audio State : STATE_PREPARED : FAIL : ' + audioRen.state); + resultFlag = false; + } + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6700 + * @tc.name : AudioRenderer - STATE_RUNNING + * @tc.desc : AudioRenderer - STATE_RUNNING + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6700', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + await sleep(500); + + if (audioRen.state == audio.AudioState.STATE_RUNNING) { + console.info('AudioFrameworkRenderLog: Audio State : STATE_RUNNING : PASS : ' + audioRen.state); + } + else { + console.info('AudioFrameworkRenderLog: Audio State : STATE_RUNNING : FAIL : ' + audioRen.state); + resultFlag = false; + } + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6800 + * @tc.name : AudioRenderer - STATE_STOPPED + * @tc.desc : AudioRenderer - STATE_STOPPED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6800', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + await sleep(500); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + resultFlag = false; + }); + await sleep(500); + + if (audioRen.state == audio.AudioState.STATE_STOPPED) { + console.info('AudioFrameworkRenderLog: Audio State : STATE_STOPPED : PASS : ' + audioRen.state); + } + else { + console.info('AudioFrameworkRenderLog: Audio State : STATE_STOPPED : FAIL : ' + audioRen.state); + resultFlag = false; + } + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6900 + * @tc.name : AudioRenderer - STATE_RELEASED + * @tc.desc : AudioRenderer - STATE_RELEASED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_6900', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + await sleep(500); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + resultFlag = false; + }); + await sleep(500); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + await sleep(500); + + if (audioRen.state == audio.AudioState.STATE_RELEASED) { + console.info('AudioFrameworkRenderLog: Audio State : STATE_RELEASED : PASS : ' + audioRen.state); + } + else { + console.info('AudioFrameworkRenderLog: Audio State : STATE_RELEASED : FAIL : ' + audioRen.state); + resultFlag = false; + } + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7000 + * @tc.name : AudioRenderer - STATE_PAUSED + * @tc.desc : AudioRenderer - STATE_PAUSED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7000', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = true; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + await sleep(500); + + await audioRen.pause().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant Pause :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant Pause :ERROR : ' + err.message); + resultFlag = false; + }); + + await sleep(500); + + if (audioRen.state == audio.AudioState.STATE_PAUSED) { + console.info('AudioFrameworkRenderLog: Audio State : STATE_PAUSED : PASS : ' + audioRen.state); + } + else { + console.info('AudioFrameworkRenderLog: Audio State : STATE_PAUSED : FAIL : ' + audioRen.state); + resultFlag = false; + } + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + await sleep(500); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + await sleep(500) + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7100 + * @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE + * @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7100', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + // let fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readPath = 'StarWars10s-2C-48000-4SW.wav'; + await getFdRead(readPath, done); + let AudioScene = audio.AudioScene.AUDIO_SCENE_DEFAULT; + + let resultFlag = true; + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + console.info('AudioFrameworkRenderLog: AudioRenderer : Path : ' + readPath); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + let bufferSize = await audioRen.getBufferSize(); + console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); + totalSize = totalSize - 44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); + let rlen = 0; + while (rlen < totalSize / 4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); + await audioRen.write(buf); + if (rlen > (totalSize / 8)) { + await AUDIOMANAGER.getAudioScene().then(async function (data) { + console.info('AudioFrameworkAudioScene: getAudioScene : Value : ' + data); + }).catch((err) => { + console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); + resultFlag = false; + }); + } + if (rlen > (totalSize / 8)) { + await audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_DOUBLE).then(async function () { + console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_DOUBLE : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_DOUBLE : ERROR : ' + err.message); + resultFlag = false; + }); + } + } + + console.info('AudioFrameworkRenderLog: Renderer after read'); + await audioRen.getRenderRate().then(async function (data) { + if (data == audio.AudioRendererRate.RENDER_RATE_DOUBLE) { + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : PASS : ' + data); + } + else { + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_DOUBLE : FAIL : ' + data); + resultFlag = false; + } + }).catch((err) => { + console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_DOUBLE : ERROR : ' + err.message); + resultFlag = false; + }); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + await sleep(500) + + expect(resultFlag).assertTrue(); + + await closeFileDescriptor(readPath); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7200 + * @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_HALF + * @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_HALF + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7200', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + //let fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readPath = 'StarWars10s-2C-24000-3SW.wav' + await getFdRead(readPath, done); + let AudioScene = audio.AudioScene.AUDIO_SCENE_DEFAULT; + + let resultFlag = true; + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + console.info('AudioFrameworkRenderLog: AudioRenderer : Path : ' + readPath); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + let bufferSize = await audioRen.getBufferSize(); + console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); + totalSize = totalSize - 44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); + let rlen = 0; + while (rlen < totalSize / 4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); + await audioRen.write(buf); + if (rlen > (totalSize / 8)) { + await AUDIOMANAGER.getAudioScene().then(async function (data) { + console.info('AudioFrameworkAudioScene: getAudioScene : Value : ' + data); + }).catch((err) => { + console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); + resultFlag = false; + }); + } + if (rlen > (totalSize / 8)) { + await audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_HALF).then(async function () { + console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_HALF : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_HALF : ERROR : ' + err.message); + resultFlag = false; + }); + } + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + await audioRen.getRenderRate().then(async function (data) { + if (data == audio.AudioRendererRate.RENDER_RATE_HALF) { + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_HALF : PASS : ' + data); + } + else { + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_HALF : FAIL : ' + data); + resultFlag = false; + } + }).catch((err) => { + console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_HALF : ERROR : ' + err.message); + resultFlag = false; + }); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + await sleep(500) + + expect(resultFlag).assertTrue(); + + await closeFileDescriptor(readPath); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7300 + * @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_NORMAL + * @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_NORMAL + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7300', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + //let fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readPath = 'StarWars10s-1C-44100-2SW.wav' + await getFdRead(readPath, done); + let AudioScene = audio.AudioScene.AUDIO_SCENE_DEFAULT; + + let resultFlag = true; + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + let audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + resultFlag = false; + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : Path : ' + readPath); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + let bufferSize = await audioRen.getBufferSize(); + console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); + totalSize = totalSize - 44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); + let rlen = 0; + while (rlen < totalSize / 4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); + await audioRen.write(buf); + if (rlen > (totalSize / 8)) { + await AUDIOMANAGER.getAudioScene().then(async function (data) { + console.info('AudioFrameworkAudioScene: getAudioScene : Value : ' + data); + }).catch((err) => { + console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); + resultFlag = false; + }); + } + if (rlen > (totalSize / 8)) { + await audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_DOUBLE).then(async function () { + console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_DOUBLE : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_DOUBLE : ERROR : ' + err.message); + resultFlag = false; + }); + } + } + await audioRen.setRenderRate(audio.AudioRendererRate.RENDER_RATE_NORMAL).then(async function () { + console.info('AudioFrameworkRenderLog: setRenderRate : RENDER_RATE_NORMAL : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkAudioScene: setRenderRate : RENDER_RATE_NORMAL : ERROR : ' + err.message); + resultFlag = false; + }); + + console.info('AudioFrameworkRenderLog: Renderer after read'); + await audioRen.getRenderRate().then(async function (data) { + if (data == audio.AudioRendererRate.RENDER_RATE_NORMAL) { + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_NORMAL : PASS : ' + data); + } + else { + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_NORMAL : FAIL : ' + data); + resultFlag = false; + } + }).catch((err) => { + console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_NORMAL : ERROR : ' + err.message); + resultFlag = false; + }); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + await sleep(500) + + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7400 + * @tc.name : AudioRenderer - SetRenderRate - DEFAULT - RENDER_RATE_NORMAL + * @tc.desc : AudioRenderer - SetRenderRate - DEFAULT - RENDER_RATE_NORMAL + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7400', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_96000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + // let fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readPath = 'StarWars10s-1C-96000-4SW.wav' + await getFdRead(readPath, done); + let AudioScene = audio.AudioScene.AUDIO_SCENE_DEFAULT; + + let resultFlag = true; + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + console.info('AudioFrameworkRenderLog: AudioRenderer : Path : ' + readPath); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + + await audioRen.getStreamInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); + console.info('AudioFrameworkRenderLog: Renderer sampleFormat:' + audioParamsGet.sampleFormat); + console.info('AudioFrameworkRenderLog: Renderer samplingRate:' + audioParamsGet.samplingRate); + console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); + console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info('AudioFrameworkRenderLog: Renderer RendererInfo:'); + console.info('AudioFrameworkRenderLog: Renderer content type:' + audioParamsGet.content); + console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); + console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); + }).catch((err) => { + console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message); + resultFlag = false; + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + let bufferSize = await audioRen.getBufferSize(); + console.info('AudioFrameworkRenderLog: buffer size: ' + bufferSize); + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info('AudioFrameworkRenderLog:case 2:AudioFrameworkRenderLog: File Path: ' + ss); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info('AudioFrameworkRenderLog:case 3 : AudioFrameworkRenderLog: File totalSize size: ' + totalSize); + totalSize = totalSize - 44; + console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize); + let rlen = 0; + while (rlen < totalSize / 4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen); + await audioRen.write(buf); + if (rlen > (totalSize / 2)) { + await AUDIOMANAGER.getAudioScene().then(async function (data) { + console.info('AudioFrameworkAudioScene: getAudioScene : Value : ' + data); + }).catch((err) => { + console.info('AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message); + resultFlag = false; + }); + } + } + console.info('AudioFrameworkRenderLog: Renderer after read'); + await audioRen.getRenderRate().then(async function (data) { + if (data == audio.AudioRendererRate.RENDER_RATE_NORMAL) { + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_NORMAL : PASS : ' + data); + } + else { + console.info('AudioFrameworkRenderLog: getRenderRate : RENDER_RATE_NORMAL : FAIL : ' + data); + resultFlag = false; + } + }).catch((err) => { + console.info('AudioFrameworkAudioScene: getRenderRate : RENDER_RATE_NORMAL : ERROR : ' + err.message); + resultFlag = false; + }); + + await audioRen.drain().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); + }).catch((err) => { + console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + await sleep(500) + + expect(resultFlag).assertTrue(); + + await closeFileDescriptor(readPath); + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7500 + * @tc.name : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE - Callback + * @tc.desc : AudioRenderer - SetRenderRate - RENDER_RATE_DOUBLE - Callback + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7500', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_32000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + //let fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + readPath = 'StarWars10s-1C-32000-1SW.wav' + await getFdRead(readPath, done); + let resultFlag = await playbackPromise_113(AudioRendererOptions, filePath); + await sleep(100) + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7600 + * @tc.name : AudioRenderer - getAudioTime - Error + * @tc.desc : AudioRenderer - getAudioTime - Error + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7600', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + //let fpath = mediaDir+'/StarWars10s-2C-48000-4SW.wav'; + + readPath = 'StarWars10s-2C-48000-4SW.wav'; + await getFdRead(readPath, done); + let resultFlag = true; + console.info('AudioFrameworkRenderLog: AudioRenderer : Path : ' + readPath); + + console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + await audioRen.getAudioTime().then(async function (data) { + console.info('AudioFrameworkRenderLog: getAudioTime : Value : ' + data); + resultFlag = true; + if (data > 0) { + console.info('AudioFrameworkRenderLog: getAudioTime : PASS : ' + data); + } + else { + console.info('AudioFrameworkRenderLog: getAudioTime : FAIL : ' + data); + } + }).catch((err) => { + console.info('AudioFrameworkRenderLog: getAudioTime : ERROR : ' + err.message); + }); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + + console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state); + + console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag); + + await sleep(500); + + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readPath); + done(); + + }) + + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7700 + * @tc.name : AudioRenderer - STATE_PREPARED -Callback + * @tc.desc : AudioRenderer - STATE_PREPARED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7700', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + audioRen.on('stateChange', (AudioState) => { + + console.log('AudioFrameworkTest: Volume Change Event is called'); + + switch (AudioState) { + case audio.AudioState.STATE_PREPARED: + console.info('AudioFrameworkTest: state : STATE_NEW'); + resultFlag = true; + break; + default: + console.info('AudioFrameworkTest: state : ' + AudioState); + break; + } + }); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + await sleep(1000); + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7800 + * @tc.name : AudioRenderer - STATE_RUNNING - Callback + * @tc.desc : AudioRenderer - STATE_RUNNING + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7800', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + audioRen.on('stateChange', (AudioState) => { + + console.log('AudioFrameworkTest: Volume Change Event is called'); + + switch (AudioState) { + case audio.AudioState.STATE_RUNNING: + console.info('AudioFrameworkTest: state : STATE_RUNNING'); + resultFlag = true; + break; + default: + console.info('AudioFrameworkTest: state : ' + AudioState); + break; + } + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + await sleep(500); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + await sleep(1000); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7900 + * @tc.name : AudioRenderer - STATE_STOPPED - Callback + * @tc.desc : AudioRenderer - STATE_STOPPED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_7900', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + audioRen.on('stateChange', (AudioState) => { + + console.log('AudioFrameworkTest: Volume Change Event is called'); + + switch (AudioState) { + case audio.AudioState.STATE_STOPPED: + console.info('AudioFrameworkTest: state : STATE_STOPPED'); + resultFlag = true; + break; + default: + console.info('AudioFrameworkTest: state : ' + AudioState); + break; + } + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + await sleep(500); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + resultFlag = false; + }); + await sleep(500); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + await sleep(500); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8000 + * @tc.name : AudioRenderer - STATE_RELEASED - Callback + * @tc.desc : AudioRenderer - STATE_RELEASED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8000', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + + audioRen.on('stateChange', (AudioState) => { + + console.log('AudioFrameworkTest: Volume Change Event is called'); + + switch (AudioState) { + case audio.AudioState.STATE_RELEASED: + console.info('AudioFrameworkTest: state : STATE_RELEASED'); + resultFlag = true; + break; + default: + console.info('AudioFrameworkTest: state : ' + AudioState); + break; + } + }); + + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + await sleep(500); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + resultFlag = false; + }); + await sleep(500); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + await sleep(500); + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8100 + * @tc.name : AudioRenderer - STATE_PAUSED - Callback + * @tc.desc : AudioRenderer - STATE_PAUSED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8100', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + audioRen.on('stateChange', (AudioState) => { + + console.log('AudioFrameworkTest: Volume Change Event is called'); + + switch (AudioState) { + case audio.AudioState.STATE_PAUSED: + console.info('AudioFrameworkTest: state : STATE_PAUSED'); + resultFlag = true; + break; + default: + console.info('AudioFrameworkTest: state : ' + AudioState); + break; + } + }); + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + await sleep(500); + + await audioRen.pause().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant Pause :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant Pause :ERROR : ' + err.message); + resultFlag = false; + }); + + await sleep(500); + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + await sleep(500); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + await sleep(500) + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8200 + * @tc.name : AudioState - STATE_INVALID + * @tc.desc : AudioState - STATE_INVALID + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8200', 2, async function (done) { + expect(audio.AudioState.STATE_INVALID).assertEqual(-1); + await sleep(50); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8300 + * @tc.name : AudioState - STATE_NEW + * @tc.desc : AudioState - STATE_NEW + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8300', 2, async function (done) { + expect(audio.AudioState.STATE_NEW).assertEqual(0); + await sleep(50); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8400 + * @tc.name : AudioSampleFormat - STATE_FORMAT_INVALID + * @tc.desc : AudioSampleFormat - STATE_FORMAT_INVALID + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8400', 2, async function (done) { + expect(audio.AudioSampleFormat.SAMPLE_FORMAT_INVALID).assertEqual(-1); + await sleep(50); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8500 + * @tc.name : SourceType - SOURCE_TYPE_INVALID + * @tc.desc : SourceType - SOURCE_TYPE_INVALID + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8500', 2, async function (done) { + expect(audio.SourceType.SOURCE_TYPE_INVALID).assertEqual(-1); + await sleep(50); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8600 + * @tc.name : AudioRenderer - Pause - Callback + * @tc.desc : AudioRenderer - Pause - Callback + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8600', 2, async function (done) { + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_RINGTONE, + usage: audio.StreamUsage.STREAM_USAGE_NOTIFICATION_RINGTONE, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + let resultFlag = false; + + let audioRen; + let isPass = false; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message); + LE24 = audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE; + LE32 = audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE; + let sampleFormat = AudioRendererOptions.streamInfo.sampleFormat; + if ((sampleFormat == LE24 || sampleFormat == LE32) && err.code == 202) { + isPass = true; + return; + } + resultFlag = false; + }); + console.log("isPass:" + isPass); + if (isPass) { + resultFlag = true; + expect(resultFlag).assertTrue(); + done(); + return; + } + audioRen.on('stateChange', (AudioState) => { + + console.log('AudioFrameworkTest: Volume Change Event is called'); + + switch (AudioState) { + case audio.AudioState.STATE_PAUSED: + console.info('AudioFrameworkTest: state : STATE_PAUSED'); + resultFlag = true; + break; + default: + console.info('AudioFrameworkTest: state : ' + AudioState); + break; + } + }); + await audioRen.start().then(async function () { + console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message); + resultFlag = false; + }); + + await sleep(2000); + + audioRen.pause((err) => { + if (err) { + console.info('AudioFrameworkRenderLog: renderInstant Pause :ERROR : ' + err.message); + resultFlag = false; + } + else { + console.info('AudioFrameworkRenderLog: renderInstant Pause :SUCCESS '); + } + }); + await sleep(500); + + await audioRen.stop().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message); + }); + await sleep(500); + + await audioRen.release().then(async function () { + console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); + }).catch((err) => { + console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message); + }); + await sleep(500) + + expect(resultFlag).assertTrue(); + + done(); + + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8700 + * @tc.name : AudioEncodingType - ENCODING_TYPE_INVALID + * @tc.desc : AudioEncodingType - ENCODING_TYPE_INVALID + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_RENDERER_PLAY_AUDIO_8700', 2, async function (done) { + expect(audio.AudioEncodingType.ENCODING_TYPE_INVALID).assertEqual(-1); + await sleep(50); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_SETINTERRUPTMODE_0100 + * @tc.name : SetInterruptMode mode 0 callback,is public share mode + * @tc.desc : SetInterruptMode mode 0 callback,is public share mode + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it("SUB_MULTIMEDIA_AUDIO_SETINTERRUPTMODE_0100", 2, async function (done) { + let audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + let audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + let audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo + } + let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); + let mode = audio.InterruptMode.SHARE_MODE; + audioRenderer.setInterruptMode(mode, (err, data) => { + if (err) { + console.info(`AudioFrameworkRenderLog: SetInterruptMode SHARE_MODE CALLBACK: error: ${err.message}`); + expect(false).assertTrue(); + done(); + return; + } + console.info(`AudioFrameworkRenderLog: SetInterruptMode SHARE_MODE CALLBACK: SUCCESS`); + expect(true).assertTrue(); + done(); + }) + }) + + /* + * @tc.name:SUB_MULTIMEDIA_AUDIO_SETINTERRUPTMODE_0200 + * @tc.desc:SetInterruptMode mode 1 callback,is independent mode + * @tc.type: FUNC + * @tc.require: Issue Number + */ + it("SUB_MULTIMEDIA_AUDIO_SETINTERRUPTMODE_0200", 2, async function (done) { + let audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + let audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + let audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo + } + let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); + let mode = audio.InterruptMode.INDEPENDENT_MODE; + audioRenderer.setInterruptMode(mode, (err, data) => { + if (err) { + console.info(`AudioFrameworkRenderLog: SetInterruptMode INDEPENDENT_MODE CALLBACK: error: ${err.message}`); + expect(false).assertTrue(); + done(); + return; + } + console.info(`AudioFrameworkRenderLog: SetInterruptMode INDEPENDENT_MODE CALLBACK: SUCCESS`); + expect(true).assertTrue(); + done(); + }) + }) + + /* + * @tc.name:SUB_MULTIMEDIA_AUDIO_SETINTERRUPTMODE_0300 + * @tc.desc:SetInterruptMode mode 0 promise,is public share mode + * @tc.type: FUNC + * @tc.require: Issue Number + */ + it("SUB_MULTIMEDIA_AUDIO_SETINTERRUPTMODE_0300", 2, async function (done) { + let audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + let audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + let audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo + } + let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); + let mode = audio.InterruptMode.SHARE_MODE; + audioRenderer.setInterruptMode(mode).then(data => { + console.info(`AudioFrameworkRenderLog: SetInterruptMode SHARE_MODE PROMISE: SUCCESS`); + expect(true).assertTrue(); + done(); + }).catch(err => { + console.info(`AudioFrameworkRenderLog: SetInterruptMode SHARE_MODE PROMISE: error: ${err.message}`); + expect(false).assertTrue(); + done(); + }) + }) + + /* + * @tc.name:SUB_MULTIMEDIA_AUDIO_SETINTERRUPTMODE_0400 + * @tc.desc:SetInterruptMode mode 1 promise,is independent mode + * @tc.type: FUNC + * @tc.require: Issue Number + */ + it("SUB_MULTIMEDIA_AUDIO_SETINTERRUPTMODE_0400", 2, async function (done) { + let audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + let audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + let audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo + } + let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); + let mode = audio.InterruptMode.INDEPENDENT_MODE; + audioRenderer.setInterruptMode(mode).then(data => { + console.info(`AudioFrameworkRenderLog: SetInterruptMode INDEPENDENT_MODE PROMISE: SUCCESS`); + expect(true).assertTrue(); + done(); + }).catch(err => { + console.info(`AudioFrameworkRenderLog: SetInterruptMode INDEPENDENT_MODE PROMISE: error: ${err.message}`); + expect(false).assertTrue(); + done(); + }) + }) + + /* + * @tc.name:SUB_MULTIMEDIA_AUDIO_SETINTERRUPTMODE_0500 + * @tc.desc:SetInterruptMode mode '1',will catch error with type error + * @tc.type: FUNC + * @tc.require: Issue Number + */ + it("SUB_MULTIMEDIA_AUDIO_SETINTERRUPTMODE_0500", 2, async function (done) { + let audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + let audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + let audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo + } + let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); + let mode = '1'; + try { + let data = await audioRenderer.setInterruptMode(mode); + console.info(`AudioFrameworkRenderLog: SetInterruptMode STRING PROMISE: SUCCESS`); + expect(false).assertTrue(); + done(); + } catch (err) { + console.info(`AudioFrameworkRenderLog: SetInterruptMode STRING PROMISE: error: ${err.message}`); + expect(true).assertTrue(); + done(); + } + }) + + /* + * @tc.name:SUB_MULTIMEDIA_AUDIO_SETINTERRUPTMODE_0600 + * @tc.desc:SetInterruptMode mode 2,set it to default SHARE_MODE + * @tc.type: FUNC + * @tc.require: Issue Number + */ + it("SUB_MULTIMEDIA_AUDIO_SETINTERRUPTMODE_0600", 2, async function (done) { + let audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + let audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 + } + let audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo + } + let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); + let mode = 2; + try { + let data = await audioRenderer.setInterruptMode(mode); + console.info(`AudioFrameworkRenderLog: SetInterruptMode OUT OF BORDER PROMISE: SUCCESS`); + expect(true).assertTrue(); + done(); + } catch (err) { + console.info(`AudioFrameworkRenderLog: SetInterruptMode OUT OF BORDER PROMISE: ERROR: ${err.message}`); + expect(false).assertTrue(); + done(); + } + }) +}) \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/test/List.test.js b/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b21dd6b9ee1722d6bdfd9c060023e07ddaad2ee2 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioRenderer/src/main/js/test/List.test.js @@ -0,0 +1,17 @@ +/** + * 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. + */ + +require('./AudioRenderer.test.js') + diff --git a/multimedia/audio/audio_js_standard/audioRenderer/src/main/resources/base/element/string.json b/multimedia/audio/audio_js_standard/audioRenderer/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0bae6bd40f7360d5d818998221b199d3ec0f69c0 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioRenderer/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioRenderer/src/main/resources/base/media/icon.png b/multimedia/audio/audio_js_standard/audioRenderer/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/audio/audio_js_standard/audioRenderer/src/main/resources/base/media/icon.png differ diff --git a/multimedia/audio/audio_js_standard/audioVoip/BUILD.gn b/multimedia/audio/audio_js_standard/audioVoip/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..a0acdb0aedb3aae2d1384a657b3cac8132bf319b --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioVoip/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("audio_voip_js_hap") { + hap_profile = "./src/main/config.json" + deps = [ + ":audio_voip_js_assets", + ":audio_voip_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAudioVOIPJsTest" + subsystem_name = "multimedia" + part_name = "multimedia_audio_framework" +} +ohos_js_assets("audio_voip_js_assets") { + source_dir = "./src/main/js/default" +} +ohos_resources("audio_voip_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/multimedia/audio/audio_js_standard/audioVoip/Test.json b/multimedia/audio/audio_js_standard/audioVoip/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..225e6ce9e7ae4c95b2e817d930fe9cfcb0c3455f --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioVoip/Test.json @@ -0,0 +1,33 @@ +{ + "description": "Configuration for audio manager Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "550000", + "package": "ohos.acts.multimedia.audio.audiovoip", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAudioVOIPJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.audio.audiovoip/haps/entry/files", + "chmod 777 -R /data/app/el2/100/base/ohos.acts.multimedia.audio.audiovoip/haps/entry" + ], + "cleanup-apps": true + }, + { + "type": "PushKit", + "pre-push": [], + "push": [ + "./resource/audio/audioManager/StarWars10s-1C-44100-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiovoip/haps/entry/files/" + ] + } + ] +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioVoip/signature/openharmony_sx.p7b b/multimedia/audio/audio_js_standard/audioVoip/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..0e9c4376f4c0ea2f256882a2170cd4e81ac135d7 Binary files /dev/null and b/multimedia/audio/audio_js_standard/audioVoip/signature/openharmony_sx.p7b differ diff --git a/multimedia/audio/audio_js_standard/audioVoip/src/main/config.json b/multimedia/audio/audio_js_standard/audioVoip/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..1ea9beff51f5950aaae36eb0940eedc2925457ba --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioVoip/src/main/config.json @@ -0,0 +1,85 @@ +{ + "app": { + "apiVersion": { + "compatible": 6, + "releaseType": "Beta1", + "target": 7 + }, + "vendor": "acts", + "bundleName": "ohos.acts.multimedia.audio.audiovoip", + "version": { + "code": 1000000, + "name": "1.0.0" + } + }, + "deviceConfig": { + "default": { + "debug": true + } + }, + "module": { + "abilities": [ + { + "iconId": 16777218, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "descriptionId": 16777217, + "visible": true, + "labelId": 16777216, + "icon": "$media:icon", + "name": "ohos.acts.multimedia.audio.audiovoip.MainAbility", + "description": "$string:mainability_description", + "label": "$string:entry_MainAbility", + "type": "page", + "homeAbility": true, + "launchType": "standard" + } + ], + "deviceType": [ + "default", + "phone", + "tablet", + "tv", + "wearable" + ], + "mainAbility": "ohos.acts.multimedia.audio.audiovoip.MainAbility", + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "package": "ohos.acts.multimedia.audio.audiovoip", + "name": ".MyApplication", + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", + "reason": "use ohos.permission.GRANT_SENSITIVE_PERMISSIONS" + }, + { + "name": "ohos.permission.MICROPHONE", + "reason": "use ohos.permission.MICROPHONE" + } + ] + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioVoip/src/main/js/default/app.js b/multimedia/audio/audio_js_standard/audioVoip/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..e423f4bce4698ec1d7dc86c3eea3990a5e7b1085 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioVoip/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* + * 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/audio/audio_js_standard/audioVoip/src/main/js/default/i18n/en-US.json b/multimedia/audio/audio_js_standard/audioVoip/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioVoip/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioVoip/src/main/js/default/i18n/zh-CN.json b/multimedia/audio/audio_js_standard/audioVoip/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioVoip/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioVoip/src/main/js/default/pages/index/index.css b/multimedia/audio/audio_js_standard/audioVoip/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..5bd7567028568bd522193b2519d545ca6dcf397d --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioVoip/src/main/js/default/pages/index/index.css @@ -0,0 +1,46 @@ +.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/audio/audio_js_standard/audioVoip/src/main/js/default/pages/index/index.hml b/multimedia/audio/audio_js_standard/audioVoip/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioVoip/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/multimedia/audio/audio_js_standard/audioVoip/src/main/js/default/pages/index/index.js b/multimedia/audio/audio_js_standard/audioVoip/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..a0719cee588ac4b0f56efbf784b19647bc6645de --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioVoip/src/main/js/default/pages/index/index.js @@ -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 {Core, ExpectExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + const configService = core.getDefaultService('config') + this.timeout = 60000 + configService.setConfig(this) + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioVoip/src/main/js/test/AudioVOIP.test.js b/multimedia/audio/audio_js_standard/audioVoip/src/main/js/test/AudioVOIP.test.js new file mode 100644 index 0000000000000000000000000000000000000000..7c7adee4a8d7c78dee1b6921f4fe8d9df7b43ddf --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioVoip/src/main/js/test/AudioVOIP.test.js @@ -0,0 +1,508 @@ +// @ts-nocheck +/* + * 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 audio from '@ohos.multimedia.audio'; +import fileio from '@ohos.fileio'; +import featureAbility from '@ohos.ability.featureAbility' +import resourceManager from '@ohos.resourceManager'; +import * as audioTestBase from '../../../../../AudioTestBase' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; + +describe('audioVoip', function () { + let mediaDir; + let fdRead; + let readpath; + let fdPath; + let filePath; + let TagRender = "AudioFrameworkRenderLog"; + let TagRec = "AudioFrameworkRecLog"; + const AUDIOMANAGER = audio.getAudioManager(); + console.info(`${TagRender}: Create AudioManger Object JS Framework`); + + beforeAll(async function () { + console.info(`AudioFrameworkTest: beforeAll: Prerequisites at the test suite level`); + let permissionName1 = 'ohos.permission.MICROPHONE'; + let permissionNameList = [permissionName1]; + let appName = 'ohos.acts.multimedia.audio.audiovoip'; + await audioTestBase.applyPermission(appName, permissionNameList); + await sleep(100); + console.info(`AudioFrameworkTest: beforeAll: END`); + }) + + beforeEach(async function () { + console.info(`AudioFrameworkTest: beforeEach: Prerequisites at the test case level`); + await sleep(1000); + }) + + afterEach(function () { + console.info(`AudioFrameworkTest: afterEach: Test case-level clearance conditions`); + }) + + afterAll(async function () { + console.info(`AudioFrameworkTest: afterAll: Test suite-level cleanup condition`); + }) + + function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); + } + + async function getAbilityInfo(fileName) { + let context = await featureAbility.getContext(); + console.info(`case0 context is " ${context}`); + await context.getFilesDir().then((data) => { + console.info(`case1 getFilesDir path is : ${data}`); + mediaDir = data + '/' + fileName; + console.info(`case2 mediaDir is : ${mediaDir}`); + }).catch(error => { + console.log(`${TagRender}:case getFileDir err: ${error}`); + }); + } + async function closeFileDescriptor(fileName) { + await resourceManager.getResourceManager().then(async (mgr) => { + await mgr.closeRawFileDescriptor(fileName).then(value => { + console.log(`${TagRender}:case closeRawFileDescriptor success for file: ${fileName}`); + }).catch(err => { + console.log(`${TagRender}:case closeRawFileDescriptor err: ${err}`); + }); + }).catch(error => { + console.log(`${TagRender}:case getResourceManager err: ${error}`); + }); + } + async function getFdRead(pathName) { + let context = await featureAbility.getContext(); + console.info(`case0 context is ${context}`); + + await context.getFilesDir().then((data) => { + console.info(`case1 getFilesDir path is : ${data}`); + filePath = data + '/' + pathName; + console.info(`case4 filePath is : ${filePath}`); + }).catch(err => { + console.log(`${TagRender}:case getFilesDir err: ${err}`); + }); + fdPath = 'fd://'; + await fileio.open(filePath).then((fdNumber) => { + fdPath = fdPath + '' + fdNumber; + fdRead = fdNumber; + console.info(`[fileIO]case open fd success,fdPath is : ${fdPath}`); + console.info(`[fileIO]case open fd success,fdRead is : ${fdRead}`); + + }, (err) => { + console.info(`[fileIO]case open fd err : ${err}`); + }).catch((error) => { + console.info(`[fileIO]case catch open fd failed : ${error}`); + }); + } + + async function playbackPromise(AudioRendererOptions, pathName) { + let resultFlag = 'new'; + console.info(`${TagRender}: Promise : Audio Playback Function`); + + let audioRen; + await audio.createAudioRenderer(AudioRendererOptions).then(async function (data) { + audioRen = data; + console.info(`${TagRender}: AudioRender Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${TagRender}: AudioRender Created : ERROR : ${err.message}`); + return resultFlag; + }); + + console.info(`${TagRender}: AudioRenderer : Path : ${pathName}`); + + console.info(`${TagRender}: AudioRenderer : STATE : ${audioRen.state}`); + + await audioRen.getStreamInfo().then(async function (audioParamsGet) { + console.info(`${TagRender}: Renderer getStreamInfo:`); + console.info(`${TagRender}: Renderer sampleFormat: ${audioParamsGet.sampleFormat}`); + console.info(`${TagRender}: Renderer samplingRate: ${audioParamsGet.samplingRate}`); + console.info(`${TagRender}: Renderer channels: ${audioParamsGet.channels}`); + console.info(`${TagRender}: Renderer encodingType: ${audioParamsGet.encodingType}`); + }).catch((err) => { + console.log(`${TagRender}: getStreamInfo :ERROR: ${err.message}`); + resultFlag = false; + }); + if (resultFlag == false) { + console.info(`${TagRender}: resultFlag : ${resultFlag}`); + return resultFlag; + } + + await audioRen.getRendererInfo().then(async function (audioParamsGet) { + console.info(`${TagRender}: Renderer RendererInfo:`); + console.info(`${TagRender}: Renderer content type: ${audioParamsGet.content}`); + console.info(`${TagRender}: Renderer usage: ${audioParamsGet.usage}`); + console.info(`${TagRender}: Renderer rendererFlags: ${audioParamsGet.rendererFlags}`); + }).catch((err) => { + console.log(`${TagRender}: RendererInfo :ERROR: ${err.message}`); + resultFlag = false; + }); + if (resultFlag == false) { + console.info(`${TagRender}: resultFlag : ${resultFlag}`); + return resultFlag; + } + + await audioRen.start().then(async function () { + console.info(`${TagRender}: renderInstant started :SUCCESS `); + }).catch((err) => { + console.info(`${TagRender}: renderInstant start :ERROR : ${err.message}`); + resultFlag = false; + }); + if (resultFlag == false) { + console.info(`${TagRender}: resultFlag : ${resultFlag}`); + return resultFlag; + } + + console.info(`${TagRender}: AudioRenderer : STATE : ${audioRen.state}`); + + let bufferSize; + await audioRen.getBufferSize().then(async function (data) { + console.info(`${TagRender}: getBufferSize :SUCCESS ${data}`); + bufferSize = data; + }).catch((err) => { + console.info(`${TagRender}: getBufferSize :ERROR : ${err.message}`); + resultFlag = false; + }); + if (resultFlag == false) { + console.info(`${TagRender}: resultFlag : ${resultFlag}`); + return resultFlag; + } + + let ss = fileio.fdopenStreamSync(fdRead, 'r'); + console.info(`${TagRender}: case2: File Path: ${ss}`); + let discardHeader = new ArrayBuffer(44); + ss.readSync(discardHeader); + let totalSize = fileio.fstatSync(fdRead).size; + console.info(`${TagRender}: case3: File totalSize size: ${totalSize}`); + totalSize = totalSize - 44; + console.info(`${TagRender}: File size : Removing header: ${totalSize}`); + let rlen = 0; + while (rlen < totalSize / 4) { + let buf = new ArrayBuffer(bufferSize); + rlen += ss.readSync(buf); + console.info(`${TagRender}: BufferAudioFramework: bytes read from file: ${rlen}`); + await audioRen.write(buf); + if (rlen > (totalSize / 2)) { + await AUDIOMANAGER.getAudioScene().then(async function (data) { + console.info(`${TagRender}:AudioFrameworkAudioScene: getAudioScene : Value : ${data}`); + }).catch((err) => { + console.info(`${TagRender}:AudioFrameworkAudioScene: getAudioScene : ERROR : ${err.message}`); + resultFlag = false; + }); + } + } + console.info(`${TagRender}: Renderer after read`); + + await audioRen.drain().then(async function () { + console.info(`${TagRender}: Renderer drained : SUCCESS`); + }).catch((err) => { + console.error(`${TagRender}: Renderer drain: ERROR : ${err.message}`); + resultFlag = false; + }); + if (resultFlag == false) { + console.info(`${TagRender}: resultFlag : ${resultFlag}`); + return resultFlag; + } + + console.info(`${TagRender}: AudioRenderer : STATE : ${audioRen.state}`); + + await audioRen.stop().then(async function () { + console.info(`${TagRender}: Renderer stopped : SUCCESS`); + resultFlag = true; + console.info(`${TagRender}: resultFlagRen : ${resultFlag}`); + }).catch((err) => { + console.info(`${TagRender}: Renderer stop:ERROR : ${err.message}`); + resultFlag = false; + }); + + console.info(`${TagRender}: AudioRenderer : STATE : ${audioRen.state}`); + + await audioRen.release().then(async function () { + console.info(`${TagRender}: Renderer release : SUCCESS`); + }).catch((err) => { + console.info(`${TagRender}: Renderer release :ERROR : ${err.message}`); + resultFlag = false; + }); + + console.info(`${TagRender}: AudioRenderer : STATE : ${audioRen.state}`); + console.info(`${TagRender}: resultFlag : ${resultFlag}`); + + return resultFlag; + } + + async function recPromise(AudioCapturerOptions, fpath) { + + let resultFlag = 'new'; + console.info(`${TagRec}: Promise : Audio Recording Function`); + + let audioCap; + + await audio.createAudioCapturer(AudioCapturerOptions).then(async function (data) { + audioCap = data; + console.info(`${TagRec}: AudioCapturer Created : Success : Stream Type: SUCCESS`); + }).catch((err) => { + console.info(`${TagRec}: AudioCapturer Created : ERROR : ${err.message}`); + return resultFlag; + }); + + console.info(`${TagRec}: AudioCapturer : Path : ${fpath}`); + + console.info(`${TagRec}: AudioCapturer : STATE : ${audioCap.state}`); + + await audioCap.getStreamInfo().then(async function (audioParamsGet) { + if (audioParamsGet != undefined) { + console.info(`${TagRec}: Capturer getStreamInfo:`); + console.info(`${TagRec}: Capturer sampleFormat: ${audioParamsGet.sampleFormat}`); + console.info(`${TagRec}: Capturer samplingRate: ${audioParamsGet.samplingRate}`); + console.info(`${TagRec}: Capturer channels: ${audioParamsGet.channels}`); + console.info(`${TagRec}: Capturer encodingType: ${audioParamsGet.encodingType}`); + } else { + console.info(`${TagRec}: audioParamsGet is : ${audioParamsGet}`); + console.info(`${TagRec}: audioParams getStreamInfo are incorrect: `); + resultFlag = false; + } + }).catch((err) => { + console.log(`${TagRec}: getStreamInfo :ERROR: ${err.message}`); + resultFlag = false; + }); + if (resultFlag == false) { + console.info(`${TagRec}: resultFlag : ${resultFlag}`); + return resultFlag; + } + + await audioCap.getCapturerInfo().then(async function (audioParamsGet) { + if (audioParamsGet != undefined) { + console.info(`${TagRec}: Capturer CapturerInfo:`); + console.info(`${TagRec}: Capturer SourceType: ${audioParamsGet.source}`); + console.info(`${TagRec}: Capturer capturerFlags: ${audioParamsGet.capturerFlags}`); + } else { + console.info(`${TagRec}: audioParamsGet is : ${audioParamsGet}`); + console.info(`${TagRec}: audioParams getCapturerInfo are incorrect: `); + resultFlag = false; + } + }).catch((err) => { + console.log(`${TagRec}: CapturerInfo :ERROR: ${err.message}`); + resultFlag = false; + }); + if (resultFlag == false) { + console.info(`${TagRec}: resultFlag : ${esultFlag}`); + return resultFlag; + } + + await audioCap.start().then(async function () { + console.info(`${TagRec}: Capturer started :SUCCESS`); + }).catch((err) => { + console.info(`${TagRec}: Capturer start :ERROR : ${err.message}`); + resultFlag = false; + }); + if (resultFlag == false) { + console.info(`${TagRec}: resultFlag : ${resultFlag}`); + return resultFlag; + } + + console.info(`${TagRec}: AudioCapturer : STATE : ${audioCap.state}`); + + let bufferSize = await audioCap.getBufferSize(); + console.info(`${TagRec}: buffer size: ${bufferSize}`); + + let fd = fileio.openSync(fpath, 0o102, 0o777); + if (fd !== null) { + console.info(`${TagRec}: file fd created`); + } + else { + console.info(`${TagRec}: Capturer start :ERROR : `); + resultFlag = false; + return resultFlag; + } + + fd = fileio.openSync(fpath, 0o2002, 0o666); + if (fd !== null) { + console.info(`${TagRec}: file fd opened : Append Mode :PASS`); + } + else { + console.info(`${TagRec}: file fd Open: Append Mode : FAILED`); + resultFlag = false; + return resultFlag; + } + await sleep(100); + let numBuffersToCapture = 45; + while (numBuffersToCapture) { + console.info(`${TagRec}: ---------READ BUFFER---------`); + let buffer = await audioCap.read(bufferSize, true); + await sleep(50); + console.info(`${TagRec}: ---------WRITE BUFFER---------`); + let number = fileio.writeSync(fd, buffer); + console.info(`${TagRec}:BufferRecLog: data written: ${number}`); + await sleep(50); + numBuffersToCapture--; + } + await sleep(1000); + console.info(`${TagRec}: AudioCapturer : STATE : ${audioCap.state}`); + + await audioCap.stop().then(async function () { + console.info(`${TagRec}: Capturer stopped : SUCCESS`); + resultFlag = true; + console.info(`${TagRec}: resultFlag : ${resultFlag}`); + }).catch((err) => { + console.info(`${TagRec}: Capturer stop:ERROR : ${err.message}`); + resultFlag = false; + }); + + console.info(`${TagRec}: AudioCapturer : STATE : ${audioCap.state}`); + + await audioCap.release().then(async function () { + console.info(`${TagRec}: Capturer release : SUCCESS`); + }).catch((err) => { + console.info(`${TagRec}: Capturer release :ERROR : ${err.message}`); + resultFlag = false; + }); + + console.info(`${TagRec}: AudioCapturer : STATE : ${audioCap.state}`); + + return resultFlag; + + } + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_PLAY_0100 + * @tc.name : AudioRenderer-Set1-Media + * @tc.desc : AudioRenderer with parameter set 1 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_PLAY_0100', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfo, + rendererInfo: AudioRendererInfo + } + + await getFdRead("StarWars10s-1C-44100-2SW.wav"); + let resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); + await sleep(100); + console.info(`${TagRender}: resultFlag : ${resultFlag}`); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(filePath); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_REC_0100 + * @tc.name : AudioCapturer-Set1-Media + * @tc.desc : AudioCapturer with parameter set 1 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_REC_0100', 2, async function (done) { + + let AudioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_VOICE_COMMUNICATION, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfo, + capturerInfo: AudioCapturerInfo + } + + await getAbilityInfo("capture_js-44100-2C-16B.pcm"); + let resultFlag = await recPromise(AudioCapturerOptions, mediaDir); + await sleep(100); + console.info(`${TagRender}: resultFlag : ${resultFlag}`); + expect(resultFlag).assertTrue(); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_AUDIO_VOIP_RECPLAY_0100 + * @tc.name : AudioCapturer-Set1-Media + * @tc.desc : AudioCapturer with parameter set 1 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_MULTIMEDIA_AUDIO_VOIP_RECPLAY_0100', 2, async function (done) { + + let AudioStreamInfoCap = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_VOICE_COMMUNICATION, + capturerFlags: 0 + } + + let AudioCapturerOptions = { + streamInfo: AudioStreamInfoCap, + capturerInfo: AudioCapturerInfo + } + + let AudioStreamInfoRen = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + + let AudioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + } + + let AudioRendererOptions = { + streamInfo: AudioStreamInfoRen, + rendererInfo: AudioRendererInfo + } + + await getAbilityInfo("capture_js-44100-2C-16B-2.pcm"); + recPromise(AudioCapturerOptions, mediaDir); + await sleep(500); + + readpath = 'StarWars10s-1C-44100-2SW.wav'; + await getFdRead(readpath); + let resultFlag = await playbackPromise(AudioRendererOptions, readpath); + await sleep(100); + console.info(`${TagRender}: resultFlag : ${resultFlag}`); + expect(resultFlag).assertTrue(); + await closeFileDescriptor(readpath); + done(); + }) + + +}) \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioVoip/src/main/js/test/List.test.js b/multimedia/audio/audio_js_standard/audioVoip/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..4caa2d1a844e004b7fa6d4cc4c9c0090f14b1c8e --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioVoip/src/main/js/test/List.test.js @@ -0,0 +1,17 @@ +/** + * 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. + */ + +require('./AudioVOIP.test.js') + diff --git a/multimedia/audio/audio_js_standard/audioVoip/src/main/resources/base/element/string.json b/multimedia/audio/audio_js_standard/audioVoip/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..0bae6bd40f7360d5d818998221b199d3ec0f69c0 --- /dev/null +++ b/multimedia/audio/audio_js_standard/audioVoip/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "mainability_description", + "value": "JS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/multimedia/audio/audio_js_standard/audioVoip/src/main/resources/base/media/icon.png b/multimedia/audio/audio_js_standard/audioVoip/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/audio/audio_js_standard/audioVoip/src/main/resources/base/media/icon.png differ diff --git a/multimedia/camera/cameraDepthOffield/BUILD.gn b/multimedia/camera/cameraDepthOffield/BUILD.gn deleted file mode 100644 index f4a748be058757f3ed7d0d1f828fb5c68ff7022f..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraDepthOffield/BUILD.gn +++ /dev/null @@ -1,34 +0,0 @@ -# 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("camera_depthoffield_ets_hap") { - hap_profile = "./src/main/config.json" - deps = [ - ":camera_ets_assets", - ":camera_ets_resources", - ] - ets2abc = true - - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsCameraDepthOffieldETSTest" - subsystem_name = "multimedia" - part_name = "multimedia_camera_standard" -} -ohos_js_assets("camera_ets_assets") { - source_dir = "./src/main/ets/MainAbility" -} -ohos_resources("camera_ets_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/multimedia/camera/cameraDepthOffield/Test.json b/multimedia/camera/cameraDepthOffield/Test.json deleted file mode 100644 index 9fea4acc6bb6c4accd35c3e4a4888301e3e5e303..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraDepthOffield/Test.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "description": "Configuration for camerastandard DepthOffield Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "1000000", - "package": "com.open.harmony.multimedia.cameradftest", - "shell-timeout": "60000" - }, - "kits": [ - { - "type": "ShellKit", - "run-command": [ - "touch /data/media/01.mp4", - "chmod -R 777 /data/media" - - ], - "teardown-command":[ - - ] - }, - { - "test-file-name": [ - "ActsCameraDepthOffieldETSTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/multimedia/camera/cameraDepthOffield/src/main/config.json b/multimedia/camera/cameraDepthOffield/src/main/config.json deleted file mode 100644 index 5f72095e70a283e57f1253d92f7222abaaf2dcda..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraDepthOffield/src/main/config.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "app": { - "bundleName": "com.open.harmony.multimedia.cameradftest", - "vendor": "open", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.open.harmony.multimedia.cameradftest", - "name": ".MyApplication", - "mainAbility": "com.open.harmony.multimedia.cameradftest.MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "formsEnabled": false, - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "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.CAMERA", - "reason": "use ohos.permission.CAMERA" - }, - { - "name": "ohos.permission.MICROPHONE", - "reason": "use ohos.permission.MICROPHONE" - }, - { - "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" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets b/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets deleted file mode 100644 index b74a9528e3bcdfe491dfe794285f6989d496adf4..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets +++ /dev/null @@ -1,2779 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables - -var cameraManager; -var surfaceId1; -var camerasArray; - -// CAMERA-0 Variables -var camera0Input, camera0InputPosBack, camera0InputPosFront; -var camera0InputPromise, camera0InputPromisePosBack, camera0InputPromisePosFront; -// CAMERA-1 Variables -var camera1Input, camera1InputPosBack, camera1InputPosFront; -var camera1InputPromise, camera1InputPromisePosBack, camera1InputPromisePosFront; -// CAMERA-2 Variables -var camera2Input, camera2InputPosBack, camera2InputPosFront; -var camera2InputPromise, camera2InputPromisePosBack, camera2InputPromisePosFront; -// CAMERA-3 Variables -var camera3Input, camera3InputPosBack, camera3InputPosFront; -var camera3InputPromise, camera3InputPromisePosBack, camera3InputPromisePosFront; - -export default function cameraJSUnitCameraFormat(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJsUnitCameraFormat', function () { - console.info(TAG + '----------CameraJsUnitCameraFormat--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 data is not null || undefined"); - cameraManager = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------"); - var cameraManagerPromise = await cameraObj.getCameraManager(null); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 cameraManagerPromise: " + JSON.stringify(cameraManagerPromise)); - if (cameraManagerPromise != null && cameraManagerPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Get camera from cameramanager to get array of camera async api - * @tc.desc : Get camera from cameramanager to get array of camera async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------"); - cameraManager.getCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 data is not null || undefined"); - camerasArray = data; - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArray[i].cameraPosition; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArray[i].cameraType; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Type: " + cameraType); - var connectionType = camerasArray[i].connectionType - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 - * @tc.name : Get camera from cameramanager to get array of camera promise api - * @tc.desc : Get camera from cameramanager to get array of camera promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100--------------"); - var camerasArrayPromise = await cameraManager.getCameras(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100: " + JSON.stringify(camerasArrayPromise)); - if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 success"); - for (var i = 0; i < camerasArrayPromise.length; i++) { - // Get the variables from camera object - var cameraId = camerasArrayPromise[i].cameraId; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArrayPromise[i].cameraPosition; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArrayPromise[i].cameraType; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 camera" + i + "Type: " + cameraType); - var connectionType = camerasArrayPromise[i].connectionType - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-0 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera0Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[0].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraId promise api - * @tc.desc : Create camerainput from camera-0 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera0InputPromise = await cameraManager.createCameraInput(camerasArray[0].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera0InputPromise: " + JSON.stringify(camera0InputPromise)); - if (camera0InputPromise != null && camera0InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera0InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 - * @tc.name : get camera if from camera-0 input async api - * @tc.desc : get camera if from camera-0 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100', 0, async function (done) { - camera0Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 data is not null || undefined"); - var CameraId0 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 PASSED with CameraID :" + CameraId0); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 - * @tc.name : get camera if from camera-0 input promise api - * @tc.desc : get camera if from camera-0 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100', 0, async function (done) { - var camera0IdPromise = await camera0InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 camera0IdPromise: " + JSON.stringify(camera0IdPromise)); - if (camera0IdPromise != null && camera0IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 camera0IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 PASSED" + camera0IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput async api - * @tc.desc : Get supported preview formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera0InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null && data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromise = await camera0InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromise)); - if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam0FormatPromise: " + cam0FormatPromise[i]); - expect(cam0FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-0 camerainput async api - * @tc.desc : Get supported video formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 success"); - if (data != null && data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 - * @tc.name : Get supported video formats from camera-0 camerainput promise api - * @tc.desc : Get supported video formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromise = await camera0InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromise)); - if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 cam0FormatPromise: " + cam0FormatPromise[i]); - expect(cam0FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-0 camerainput async api - * @tc.desc : Get supported photo format from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-0 camerainput promise api - * @tc.desc : Get supported photo format from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromise = await camera0InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromise)); - if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam0FormatPromise: " + cam0FormatPromise[i]); - expect(cam0FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput async api - * @tc.desc : Get supported preview formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosBack = await camera0InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosBack)); - if (cam0FormatPromisePosBack != null && cam0FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam0FormatPromisePosBack: " + cam0FormatPromisePosBack[i]); - expect(cam0FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-0 camerainput async api - * @tc.desc : Get supported photo format from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-0 camerainput promise api - * @tc.desc : Get supported photo format from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosBack = await camera0InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosBack)); - if (cam0FormatPromisePosBack != null && cam0FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam0FormatPromisePosBack: " + cam0FormatPromisePosBack[i]); - expect(cam0FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput async api - * @tc.desc : Get supported preview formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosFront = await camera0InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosFront)); - if (cam0FormatPromisePosFront != null && cam0FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam0FormatPromisePosFront: " + cam0FormatPromisePosFront[i]); - expect(cam0FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-0 camerainput async api - * @tc.desc : Get supported photo format from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-0 camerainput promise api - * @tc.desc : Get supported photo format from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosFront = await camera0InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosFront)); - if (cam0FormatPromisePosFront != null && cam0FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam0FormatPromisePosFront: " + cam0FormatPromisePosFront[i]); - expect(cam0FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0InputPromise.on("focusStateChange", async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CAMERA-1 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-1 cameraId async api - * @tc.desc : Create camerainput from camera-1 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-1 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[1].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera1Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[1].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-1 cameraId promise api - * @tc.desc : Create camerainput from camera-1 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera1InputPromise = await cameraManager.createCameraInput(camerasArray[1].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera1InputPromise: " + JSON.stringify(camera1InputPromise)); - if (camera1InputPromise != null && camera1InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera1InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 - * @tc.name : get camera ID from camera-1 input async api - * @tc.desc : get camera ID from camera-1 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100', 0, async function (done) { - camera1Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 data is not null || undefined"); - var CameraId1 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 PASSED with CameraID : " + CameraId1); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 - * @tc.name : get camera ID from camera-1 input promise api - * @tc.desc : get camera ID from camera-1 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100', 0, async function (done) { - var camera1IdPromise = await camera1InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 camera1IdPromise: " + JSON.stringify(camera1IdPromise)); - if (camera1IdPromise != null && camera1IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 camera1IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 PASSED" + camera1IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 - * @tc.name : Create camerainput from camera-1 cameraposition & cameratype async api - * @tc.desc : Create camerainput from camera-1 cameraposition & cameratype async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[1].cameraPosition, camerasArray[1].cameraType, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 - * @tc.name : Create camerainput from camera-1 cameraposition & cameratype promise api - * @tc.desc : Create camerainput from camera-1 cameraposition & cameratype promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100--------------"); - var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[1].cameraPosition, camerasArray[1].cameraType); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); - if (cameraInputPromise != null && cameraInputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput async api - * @tc.desc : Get supported preview formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera1InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput promise api - * @tc.desc : Get supported preview formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromise = await camera1InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromise)); - if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam1FormatPromise: " + cam1FormatPromise[i]); - expect(cam1FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-1 camerainput async api - * @tc.desc : Get supported video formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100--------------"); - camera1InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 - * @tc.name : Get supported video formats from camera-1 camerainput promise api - * @tc.desc : Get supported video formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100--------------"); - var cam1FormatPromise = await camera1InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100: " + JSON.stringify(cam1FormatPromise)); - if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 cam1FormatPromise: " + cam1FormatPromise[i]); - expect(cam1FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-1 camerainput async api - * @tc.desc : Get supported photo format from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera1InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-1 camerainput promise api - * @tc.desc : Get supported photo format from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromise = await camera1InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromise)); - if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam1FormatPromise: " + cam1FormatPromise[i]); - expect(cam1FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput async api - * @tc.desc : Get supported preview formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput promise api - * @tc.desc : Get supported preview formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosBack = await camera1InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosBack)); - if (cam1FormatPromisePosBack != null && cam1FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam1FormatPromisePosBack: " + cam1FormatPromisePosBack[i]); - expect(cam1FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-1 camerainput async api - * @tc.desc : Get supported photo format from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-1 camerainput promise api - * @tc.desc : Get supported photo format from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosBack = await camera1InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosBack)); - if (cam1FormatPromisePosBack != null && cam1FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam1FormatPromisePosBack: " + cam1FormatPromisePosBack[i]); - expect(cam1FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput async api - * @tc.desc : Get supported preview formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput promise api - * @tc.desc : Get supported preview formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosFront = await camera1InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosFront)); - if (cam1FormatPromisePosFront != null && cam1FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam1FormatPromisePosFront: " + cam1FormatPromisePosFront[i]); - expect(cam1FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-1 camerainput async api - * @tc.desc : Get supported photo format from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-1 camerainput promise api - * @tc.desc : Get supported photo format from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosFront = await camera1InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosFront)); - if (cam1FormatPromisePosFront != null && cam1FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam1FormatPromisePosFront: " + cam1FormatPromisePosFront[i]); - expect(cam1FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-2 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-2 cameraId async api - * @tc.desc : Create camerainput from camera-2 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-2 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[2].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera2Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[2].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-2 cameraId promise api - * @tc.desc : Create camerainput from camera-2 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera2InputPromise = await cameraManager.createCameraInput(camerasArray[2].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera2InputPromise: " + JSON.stringify(camera2InputPromise)); - if (camera2InputPromise != null && camera2InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera2InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 - * @tc.name : get camera ID from camera-2 input async api - * @tc.desc : get camera ID from camera-2 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100', 0, async function (done) { - camera2Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 data is not null || undefined"); - var CameraId2 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 PASSED with CameraID : " + CameraId2); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 - * @tc.name : get camera ID from camera-2 input promise api - * @tc.desc : get camera ID from camera-2 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100', 0, async function (done) { - var camera2IdPromise = await camera2InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 camera2IdPromise: " + JSON.stringify(camera2IdPromise)); - if (camera2IdPromise != null && camera2IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 camera2IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 PASSED" + camera2IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 - * @tc.name : Create camerainput from camera-2 cameraposition & cameratype async api - * @tc.desc : Create camerainput from camera-2 cameraposition & cameratype async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[2].cameraPosition, camerasArray[2].cameraType, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 - * @tc.name : Create camerainput from camera-2 cameraposition & cameratype promise api - * @tc.desc : Create camerainput from camera-2 cameraposition & cameratype promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100--------------"); - var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[2].cameraPosition, camerasArray[2].cameraType); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); - if (cameraInputPromise != null && cameraInputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput async api - * @tc.desc : Get supported preview formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera2InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput promise api - * @tc.desc : Get supported preview formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromise = await camera2InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromise)); - if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam2FormatPromise: " + cam2FormatPromise[i]); - expect(cam2FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-2 camerainput async api - * @tc.desc : Get supported video formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100--------------"); - camera2InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 - * @tc.name : Get supported video formats from camera-2 camerainput promise api - * @tc.desc : Get supported video formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100--------------"); - var cam2FormatPromise = await camera2InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100: " + JSON.stringify(cam2FormatPromise)); - if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 cam2FormatPromise: " + cam2FormatPromise[i]); - expect(cam2FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-2 camerainput async api - * @tc.desc : Get supported photo format from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera2InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-2 camerainput promise api - * @tc.desc : Get supported photo format from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromise = await camera2InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromise)); - if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam2FormatPromise: " + cam2FormatPromise[i]); - expect(cam2FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput async api - * @tc.desc : Get supported preview formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput promise api - * @tc.desc : Get supported preview formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosBack = await camera2InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosBack)); - if (cam2FormatPromisePosBack != null && cam2FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam2FormatPromisePosBack: " + cam2FormatPromisePosBack[i]); - expect(cam2FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-2 camerainput async api - * @tc.desc : Get supported photo format from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-2 camerainput promise api - * @tc.desc : Get supported photo format from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosBack = await camera2InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosBack)); - if (cam2FormatPromisePosBack != null && cam2FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam2FormatPromisePosBack: " + cam2FormatPromisePosBack[i]); - expect(cam2FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput async api - * @tc.desc : Get supported preview formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput promise api - * @tc.desc : Get supported preview formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosFront = await camera2InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosFront)); - if (cam2FormatPromisePosFront != null && cam2FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam2FormatPromisePosFront: " + cam2FormatPromisePosFront[i]); - expect(cam2FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-2 camerainput async api - * @tc.desc : Get supported photo format from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-2 camerainput promise api - * @tc.desc : Get supported photo format from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosFront = await camera2InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosFront)); - if (cam2FormatPromisePosFront != null && cam2FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam2FormatPromisePosFront: " + cam2FormatPromisePosFront[i]); - expect(cam2FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-3 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-3 cameraId async api - * @tc.desc : Create camerainput from camera-3 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-3 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[3].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera3Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[3].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-3 cameraId promise api - * @tc.desc : Create camerainput from camera-3 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera3InputPromise = await cameraManager.createCameraInput(camerasArray[3].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera3InputPromise: " + JSON.stringify(camera3InputPromise)); - if (camera3InputPromise != null && camera3InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera3InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 - * @tc.name : get camera ID from camera-3 input async api - * @tc.desc : get camera ID from camera-3 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100', 0, async function (done) { - camera3Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 data is not null || undefined"); - var CameraId3 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 PASSED with CameraID : " + CameraId3); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 - * @tc.name : get camera ID from camera-3 input promise api - * @tc.desc : get camera ID from camera-3 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100', 0, async function (done) { - var camera3IdPromise = await camera3InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 camera3IdPromise: " + JSON.stringify(camera3IdPromise)); - if (camera3IdPromise != null && camera3IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 camera3IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 PASSED" + camera3IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 - * @tc.name : Create camerainput from camera-3 cameraposition & cameratype async api - * @tc.desc : Create camerainput from camera-3 cameraposition & cameratype async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[3].cameraPosition, camerasArray[3].cameraType, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 - * @tc.name : Create camerainput from camera-3 cameraposition & cameratype promise api - * @tc.desc : Create camerainput from camera-3 cameraposition & cameratype promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100--------------"); - var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[3].cameraPosition, camerasArray[3].cameraType); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); - if (cameraInputPromise != null && cameraInputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput async api - * @tc.desc : Get supported preview formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera3InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput promise api - * @tc.desc : Get supported preview formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromise = await camera3InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromise)); - if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam3FormatPromise: " + cam3FormatPromise[i]); - expect(cam3FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-3 camerainput async api - * @tc.desc : Get supported video formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100--------------"); - camera3InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 - * @tc.name : Get supported video formats from camera-3 camerainput promise api - * @tc.desc : Get supported video formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100--------------"); - var cam3FormatPromise = await camera3InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100: " + JSON.stringify(cam3FormatPromise)); - if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 cam3FormatPromise: " + cam3FormatPromise[i]); - expect(cam3FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-3 camerainput async api - * @tc.desc : Get supported photo format from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera3InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-3 camerainput promise api - * @tc.desc : Get supported photo format from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromise = await camera3InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromise)); - if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam3FormatPromise: " + cam3FormatPromise[i]); - expect(cam3FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput async api - * @tc.desc : Get supported preview formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput promise api - * @tc.desc : Get supported preview formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosBack = await camera3InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosBack)); - if (cam3FormatPromisePosBack != null && cam3FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam3FormatPromisePosBack: " + cam3FormatPromisePosBack[i]); - expect(cam3FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-3 camerainput async api - * @tc.desc : Get supported photo format from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-3 camerainput promise api - * @tc.desc : Get supported photo format from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosBack = await camera3InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosBack)); - if (cam3FormatPromisePosBack != null && cam3FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam3FormatPromisePosBack: " + cam3FormatPromisePosBack[i]); - expect(cam3FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput async api - * @tc.desc : Get supported preview formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput promise api - * @tc.desc : Get supported preview formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosFront = await camera3InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosFront)); - if (cam3FormatPromisePosFront != null && cam3FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam3FormatPromisePosFront: " + cam3FormatPromisePosFront[i]); - expect(cam3FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-3 camerainput async api - * @tc.desc : Get supported photo format from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-3 camerainput promise api - * @tc.desc : Get supported photo format from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosFront = await camera3InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosFront)); - if (cam3FormatPromisePosFront != null && cam3FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam3FormatPromisePosFront: " + cam3FormatPromisePosFront[i]); - expect(cam3FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE TRUE DEAPTH*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition unspecified & cameratype true deapth async api - * @tc.desc : Create camerainput from cameraposition unspecified & cameratype true deapth async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition unspecified & cameratype true deapth promise api - * @tc.desc : Create camerainput from cameraposition unspecified & cameratype true deapth promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE TRUE DEAPTH*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition back & cameratype true deapth async api - * @tc.desc : Create camerainput from cameraposition back & cameratype true deapth async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition back & cameratype true deapth promise api - * @tc.desc : Create camerainput from cameraposition back & cameratype true deapth promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE TRUE DEAPTH*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition front & cameratype true deapth async api - * @tc.desc : Create camerainput from cameraposition front & cameratype true deapth async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition front & cameratype true deapth promise api - * @tc.desc : Create camerainput from cameraposition front & cameratype true deapth promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets b/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets deleted file mode 100644 index 54de11efdc95e7ad97d972b4081928b1e224b8ef..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets +++ /dev/null @@ -1,508 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables - -var cameraManager; -var surfaceId1; -var camerasArray; - -// CAMERA-0 Variables -var camera0Input, camera0InputPosBack, camera0InputPosFront; -var camera0InputPromise, camera0InputPromisePosBack, camera0InputPromisePosFront; -// CAMERA-1 Variables -var camera1Input, camera1InputPosBack, camera1InputPosFront; -var camera1InputPromise, camera1InputPromisePosBack, camera1InputPromisePosFront; -// CAMERA-2 Variables -var camera2Input, camera2InputPosBack, camera2InputPosFront; -var camera2InputPromise, camera2InputPromisePosBack, camera2InputPromisePosFront; -// CAMERA-3 Variables -var camera3Input, camera3InputPosBack, camera3InputPosFront; -var camera3InputPromise, camera3InputPromisePosBack, camera3InputPromisePosFront; - -export default function cameraJSUnitEnum(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJSUnitEnum', function () { - console.info(TAG + '----------CameraJSUnitEnum--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 data is not null || undefined"); - cameraManager = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Get camera from cameramanager to get array of camera async api - * @tc.desc : Get camera from cameramanager to get array of camera async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------"); - cameraManager.getCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 data is not null || undefined"); - camerasArray = data; - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArray[i].cameraPosition; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArray[i].cameraType; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Type: " + cameraType); - var connectionType = camerasArray[i].connectionType - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100', 0, async function (done) { - console.info("--------------CAMERA-0 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100--------------"); - cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 data is not null || undefined"); - camera0Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 PASSED with CameraID :" + camerasArray[0].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_0100 - * @tc.name : camera status ENAME - * @tc.desc : camera status ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_0100------------"); - console.info(TAG + "CameraStatus CAMERA_STATUS_APPEAR : " + cameraObj.CameraStatus.CAMERA_STATUS_APPEAR); - expect(cameraObj.CameraStatus.CAMERA_STATUS_APPEAR).assertEqual(0); - console.info(TAG + "CameraStatus CAMERA_STATUS_DISAPPEAR : " + cameraObj.CameraStatus.CAMERA_STATUS_DISAPPEAR); - expect(cameraObj.CameraStatus.CAMERA_STATUS_DISAPPEAR).assertEqual(1); - console.info(TAG + "CameraStatus CAMERA_STATUS_AVAILABLE : " + cameraObj.CameraStatus.CAMERA_STATUS_AVAILABLE) - expect(cameraObj.CameraStatus.CAMERA_STATUS_AVAILABLE).assertEqual(2); - console.info(TAG + "CameraStatus CAMERA_STATUS_UNAVAILABLE : " + cameraObj.CameraStatus.CAMERA_STATUS_UNAVAILABLE) - expect(cameraObj.CameraStatus.CAMERA_STATUS_UNAVAILABLE).assertEqual(3); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_POSITION_0100 - * @tc.name : Camera position ENAME - * @tc.desc : Camera position ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_POSITION_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CAMERA_POSITION_0100------------") - console.info(TAG + "CameraPosition CAMERA_POSITION_BACK : " + cameraObj.CameraPosition.CAMERA_POSITION_BACK); - expect(cameraObj.CameraPosition.CAMERA_POSITION_BACK).assertEqual(1); - console.info(TAG + "CameraPosition CAMERA_POSITION_FRONT : " + cameraObj.CameraPosition.CAMERA_POSITION_FRONT); - expect(cameraObj.CameraPosition.CAMERA_POSITION_FRONT).assertEqual(2); - console.info(TAG + "CameraPosition CAMERA_POSITION_UNSPECIFIED : " + cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED); - expect(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED).assertEqual(0); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_TYPE_0100 - * @tc.name : camera type ENAME - * @tc.desc : camera type ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_TYPE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CAMERA_TYPE_0100------------") - console.info(TAG + "CameraType CAMERA_TYPE_UNSPECIFIED : " + cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); - expect(cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED).assertEqual(0); - console.info(TAG + "CameraType CAMERA_TYPE_WIDE_ANGLE : " + cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE); - expect(cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE).assertEqual(1); - console.info(TAG + 'CameraType CAMERA_TYPE_ULTRA_WIDE : ' + cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE); - expect(cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE).assertEqual(2); - console.info(TAG + 'CameraType CAMERA_TYPE_TELEPHOTO : ' + cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO); - expect(cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO).assertEqual(3); - console.info(TAG + 'CameraType CAMERA_TYPE_TRUE_DEPTH : ' + cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH) - expect(cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH).assertEqual(4); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CONNECTION_TYPE_0100 - * @tc.name : connection type ENAME - * @tc.desc : connection type ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CONNECTION_TYPE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CONNECTION_TYPE_0100------------") - console.info(TAG + "ConnectionType CAMERA_CONNECTION_BUILT_IN : " + cameraObj.ConnectionType.CAMERA_CONNECTION_BUILT_IN); - expect(cameraObj.ConnectionType.CAMERA_CONNECTION_BUILT_IN).assertEqual(0); - console.info(TAG + "ConnectionType CAMERA_CONNECTION_USB_PLUGIN : " + cameraObj.ConnectionType.CAMERA_CONNECTION_USB_PLUGIN); - expect(cameraObj.ConnectionType.CAMERA_CONNECTION_USB_PLUGIN).assertEqual(1); - console.info(TAG + "ConnectionType CAMERA_CONNECTION_REMOTE : " + cameraObj.ConnectionType.CAMERA_CONNECTION_REMOTE); - expect(cameraObj.ConnectionType.CAMERA_CONNECTION_REMOTE).assertEqual(2); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FLASHMODE_0100 - * @tc.name : Flash Mode ENAME - * @tc.desc : Flash Mode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FLASHMODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_FLASHMODE_0100------------") - console.info(TAG + "FlashMode FLASH_MODE_CLOSE : " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); - console.info(TAG + "FlashMode FLASH_MODE_OPEN : " + cameraObj.FlashMode.FLASH_MODE_OPEN); - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - console.info(TAG + "FlashMode FLASH_MODE_AUTO : " + cameraObj.FlashMode.FLASH_MODE_AUTO); - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); - console.info(TAG + "FlashMode FLASH_MODE_ALWAYS_OPEN : " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSMODE_0100 - * @tc.name : Focus Mode ENAME - * @tc.desc : Focus Mode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSMODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_FOCUSMODE_0100------------") - console.info(TAG + "FocusMode FOCUS_MODE_MANUAL : " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0); - console.info(TAG + "FocusMode FOCUS_MODE_CONTINUOUS_AUTO : " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); - console.info(TAG + "FocusMode FOCUS_MODE_AUTO : " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); - console.info(TAG + "FocusMode FOCUS_MODE_LOCKED : " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - expect(cameraObj.FocusMode.FOCUS_MODE_LOCKED).assertEqual(3); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATE_0100 - * @tc.name : Focus State ENAME - * @tc.desc : Focus State ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_FOCUSSTATE_0100------------") - console.info(TAG + "FocusState FOCUS_STATE_SCAN : " + cameraObj.FocusState.FOCUS_STATE_SCAN); - expect(cameraObj.FocusState.FOCUS_STATE_SCAN).assertEqual(0); - console.info(TAG + "FocusState FOCUS_STATE_FOCUSED : " + cameraObj.FocusState.FOCUS_STATE_FOCUSED); - expect(cameraObj.FocusState.FOCUS_STATE_FOCUSED).assertEqual(1); - console.info(TAG + "FocusState FOCUS_STATE_UNFOCUSED : " + cameraObj.FocusState.FOCUS_STATE_UNFOCUSED); - expect(cameraObj.FocusState.FOCUS_STATE_UNFOCUSED).assertEqual(2); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IMAGEROTATION_0100 - * @tc.name : Image Rotation ENAME - * @tc.desc : Image Rotation ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IMAGEROTATION_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_IMAGEROTATION_0100------------") - console.info(TAG + "ImageRotation ROTATION_0 : " + cameraObj.ImageRotation.ROTATION_0); - expect(cameraObj.ImageRotation.ROTATION_0).assertEqual(0); - console.info(TAG + "ImageRotation ROTATION_90 : " + cameraObj.ImageRotation.ROTATION_90); - expect(cameraObj.ImageRotation.ROTATION_90).assertEqual(90); - console.info(TAG + "ImageRotation ROTATION_180 : " + cameraObj.ImageRotation.ROTATION_180); - expect(cameraObj.ImageRotation.ROTATION_180).assertEqual(180); - console.info(TAG + "ImageRotation ROTATION_270 : " + cameraObj.ImageRotation.ROTATION_270); - expect(cameraObj.ImageRotation.ROTATION_270).assertEqual(270); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_QUALITYLEVEL_0100 - * @tc.name : Quality Level ENAME - * @tc.desc : Quality Level ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_QUALITYLEVEL_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_QUALITYLEVEL_0100------------") - console.info(TAG + "QualityLevel QUALITY_LEVEL_HIGH : " + cameraObj.QualityLevel.QUALITY_LEVEL_HIGH); - expect(cameraObj.QualityLevel.QUALITY_LEVEL_HIGH).assertEqual(0); - console.info(TAG + "QualityLevel QUALITY_LEVEL_MEDIUM : " + cameraObj.QualityLevel.QUALITY_LEVEL_MEDIUM); - expect(cameraObj.QualityLevel.QUALITY_LEVEL_MEDIUM).assertEqual(1); - console.info(TAG + "QualityLevel QUALITY_LEVEL_LOW : " + cameraObj.QualityLevel.QUALITY_LEVEL_LOW); - expect(cameraObj.QualityLevel.QUALITY_LEVEL_LOW).assertEqual(2); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100 - * @tc.name : CameraInputErrorCode ENAME - * @tc.desc : CameraInputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100 : " + cameraObj.CameraInputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.CameraInputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100 - * @tc.name : CaptureSessionErrorCode ENAME - * @tc.desc : CaptureSessionErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100 : " + cameraObj.CaptureSessionErrorCode.ERROR_UNKNOWN); - expect(cameraObj.CaptureSessionErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100 - * @tc.name : PreviewOutputErrorCode ENAME - * @tc.desc : PreviewOutputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100 : " + cameraObj.PreviewOutputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.PreviewOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100 - * @tc.name : PhotoOutputErrorCode ENAME - * @tc.desc : PhotoOutputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100 : " + cameraObj.PhotoOutputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.PhotoOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100 - * @tc.name : VideoOutputErrorCode ENAME - * @tc.desc : VideoOutputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100 : " + cameraObj.VideoOutputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.VideoOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets b/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets deleted file mode 100644 index 3b990e106f896ed54704bdb813583aa6c359e1fb..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets +++ /dev/null @@ -1,3606 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables -var camera0Input; -var camera1Input; -var cameraManager; -var previewOutputAsync; -var photoOutputAsync; -var captureSession; -var surfaceId1; -var camerasArray; - -var Point1 = { x: 1, y: 1 } -var Point2 = { x: 2, y: 2 } -var Point3 = { x: 3, y: 3 } - -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -export default function cameraJSUnitPhotoAsync(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJsUnitPhotoAsync', function () { - console.info(TAG + '----------CameraJsUnitPhotoAsync--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - console.info(TAG + "----------Camera-Precision Control-Async-------------"); - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Camera Manager success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering Camera Manager data is not null || undefined"); - cameraManager = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManager == null || cameraManager == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManager == null || undefined") - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate") - cameraManager.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManager is success"); - if (data != null || data != undefined) { - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Get camera from cameramanager to get array of camera async api - * @tc.desc : Get camera from cameramanager to get array of camera async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------"); - cameraManager.getCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering GetCameras success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering GetCameras data is not null || undefined"); - camerasArray = data; - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId; - console.info(TAG + "Entering GetCameras camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArray[i].cameraPosition; - console.info(TAG + "Entering GetCameras camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArray[i].cameraType; - console.info(TAG + "Entering GetCameras camera" + i + "Type: " + cameraType); - var connectionType = camerasArray[i].connectionType - console.info(TAG + "Entering GetCameras connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera0Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[0].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 - * @tc.name : Create camerainput from camera-1 cameraId async api - * @tc.desc : Create camerainput from camera-1 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200', 0, async function (done) { - cameraManager.createCameraInput(camerasArray[1].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 data is not null || undefined"); - camera1Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 PASSED with CameraID :" + camerasArray[1].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering CameraInputCallbackOnError cameraInput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 to operate"); - camera0Input.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "cameraInput error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - } - await sleep(1000); - done(); - }) - - /*PreviewOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 - * @tc.name : Create PreviewOutput instance api - * @tc.desc : Create PreviewOutput instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100', 0, async function (done) { - console.info(TAG + " Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 to operate"); - cameraObj.createPreviewOutput(surfaceId, async (err, data) => { - if (!err) { - console.info(TAG + " Entering createPreviewOutput success"); - if (data != null || data != undefined) { - console.info(TAG + " Entering createPreviewOutput data is not null || undefined"); - previewOutputAsync = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 PASSED" + previewOutputAsync); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 FAILED : " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 - * @tc.name : Preview output callback on error api - * @tc.desc : Preview output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering PreviewOutputError callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 to operate"); - previewOutputAsync.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 - * @tc.name : Create PhotoOutput instance api - * @tc.desc : Create PhotoOutput instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1000) - cameraObj.createPhotoOutput(surfaceId1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering createPhotoOutput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering createPhotoOutput data is not null || undefined"); - photoOutputAsync = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 to operate"); - photoOutputAsync.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error during PhotoOutput with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 - * @tc.name : Create CaptureSession instance api - * @tc.desc : Create CaptureSession instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 to operate"); - cameraObj.createCaptureSession(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering createCaptureSession success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering createCaptureSession data is not null || undefined"); - captureSession = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - //Capturesession callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 - * @tc.name : CaptureSession callback on error api - * @tc.desc : CaptureSession callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering captureSession error callback captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 to operate"); - captureSession.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 - * @tc.name : CaptureSession_Begin config api - * @tc.desc : CaptureSession_Begin config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering BeginConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 to operate"); - captureSession.beginConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering beginConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering BeginConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 beginConfig PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 - * @tc.name : Add Input with camera1Input api - * @tc.desc : Add Input with camera1Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering Addinput captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 to operate"); - captureSession.addInput(camera1Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddInput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddInput data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 addInput PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Preview captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 to operate"); - captureSession.addOutput(previewOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Preview : Success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Preview data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 to operate"); - captureSession.removeOutput(previewOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove preview Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove preview Output FAILED" + err.message); - console.info(TAG + "Entering Remove Preview Output ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Preview captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 to operate"); - captureSession.addOutput(previewOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Preview : Success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Preview data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CommitConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 to operate"); - captureSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering commitConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering CommitConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 to operate"); - photoOutputAsync.isMirrorSupported(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 to operate"); - photoOutputAsync.setMirror(true, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 - * @tc.name : setMirror false - * @tc.desc : setMirror false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 to operate"); - photoOutputAsync.setMirror(false, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 is success"); - console.info(TAG + "setMirror is : " + 'false'); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 - * @tc.name : CaptureSession_Begin config api - * @tc.desc : CaptureSession_Begin config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering BeginConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 to operate"); - captureSession.beginConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering beginConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering BeginConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 beginConfig PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 to operate"); - captureSession.removeInput(camera1Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove input success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove Input FAILED" + err.message); - console.info(TAG + "Entering Remove Input ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering Addinput captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 to operate"); - captureSession.addInput(camera0Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddInput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddInput data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 addInput PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 to operate"); - captureSession.removeOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove photo Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove photo Output FAILED" + err.message); - console.info(TAG + "Entering Remove photo Output ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CommitConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 to operate"); - captureSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering commitConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering CommitConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0Input.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0Input.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //preview callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering PreviewStart frameStart Callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 to operate"); - previewOutputAsync.on("frameStart", async (err, data) => { - if (!err) { - console.info(TAG + "PreviewStart frameStart Callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 FAILED : + err.message"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 - * @tc.name : Preview capture callback on frame end api - * @tc.desc : Preview capture callback on frame end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering PreviewOutput frameEnd Callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 to operate"); - previewOutputAsync.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 Callback is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 FAILED : + err.message"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering Photo Capture Callback on CaptureStart photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 to operate"); - photoOutputAsync.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "Photo Capture Callback on CaptureStart is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 to operate"); - photoOutputAsync.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 FAILED' + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 to operate"); - photoOutputAsync.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "frameShutter callback with captureId: " + data.captureId); - console.info(TAG + "frameShutter callback with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 - * @tc.name : capture session start api - * @tc.desc : capture session start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CaptureSession Start captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 to operate"); - captureSession.start(async (err, data) => { - if (!err) { - console.info(TAG + "Entering captureSession.start success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 PASSED"); - } - else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //Location - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - photoOutputAsync.capture(photosettings1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings1"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 - * @tc.name : Photo output capture with photosettings2 api - * @tc.desc : Photo output capture with photosettings2 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 to operate"); - photoOutputAsync.capture(photosettings2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings2 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 to operate"); - photoOutputAsync.capture(photosettings3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings3 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings3 data is not null || undefined"); - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 ends here"); - } - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS with Rotation-270 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 to operate"); - photoOutputAsync.capture(photosettings4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings4 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings4 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 ends here"); - } - }) - await sleep(1000); - done(); - } - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100', 0, async function (done) { - console.info(TAG + "hasFlash called.") - camera0Input.hasFlash(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 is: " + data); - expect(data).assertEqual(true); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 FAILED : " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 ends here"); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 success"); - if (data == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_ALWAYS_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 success"); - if (data == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check if flash mode auto is supported-camera0Input api - * @tc.desc : check if flash mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_AUTO SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 success"); - if (data == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_CLOSE SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 success"); - if (data == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 - * @tc.name : get zoom ratio camera-0 cameraId api - * @tc.desc : get zoom ratio camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100--------------"); - camera0Input.getZoomRatioRange(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 Success " + data) - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(1, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(2, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_0100 PASSED "); - } - else { - expect().assertFail(); - console.info(TAG + "GET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - } else { - expect().assertFail(); - console.info(TAG + "SET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(3, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(4, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(5, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(6, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 - * @tc.name : check if focus mode locked is supported-camera0Input api - * @tc.desc : check if focus mode locked is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Is Focus Mode Locked Supported SUCCESS: " + data); - if (data != null || data != undefined) { - console.info(TAG + "Entering Is Focus Mode Locked Supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_LOCKED_SUPPORTED is: " + data); - expect(data).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 FAILED :" + err.message); - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Mode Locked SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 FAILED : ") - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Mode Locked SUCCESS: " + data); - console.info(TAG + "Get Focus Mode Locked data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 - * @tc.name : get focal length camera0 api - * @tc.desc : get focal length camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 to operate"); - camera0Input.getFocalLength(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focal length SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focal length is: " + JSON.stringify(data)); - expect(data).assertEqual(3.4600000381469727); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_FOCUS_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_FOCUS_0100', 0, async function (done) { - console.info(TAG + "Entering SET_FOCUS_POINT to operate"); - camera0Input.setFocusPoint(Point1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SET_FOCUS_POINT PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SET_FOCUS_POINT FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SET_FOCUS_POINT ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_FOCUS_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_FOCUS_0100', 0, async function (done) { - console.info(TAG + "Entering GET_FOCUS_POINT to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "GET_FOCUS_POINT PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "GET_FOCUS_POINT FAILED : " + err.message); - console.info(TAG + "GET_FOCUS_POINT ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 - * @tc.name : check if focus mode manual is supported-camera0Input api - * @tc.desc : check if focus mode manual is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 FAILED " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 - * @tc.name : set focus Point locked camera0 api - * @tc.desc : set focus Point locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 to operate"); - camera0Input.setFocusPoint(Point2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 - * @tc.name : check if focus mode continuous is supported-camera0Input api - * @tc.desc : check if focus mode continuous is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINOUS_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 to operate"); - camera0Input.setFocusPoint(Point3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : GET_FOCUS_POINT_focus mode auto - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check if focus mode auto is supported-camera0Input api - * @tc.desc : check if focus mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_AUTO_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (data != null || data != undefined) { - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 PASSED") - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 to operate"); - camera0Input.getExposureBiasRange(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias range SUCCESS"); - console.info(TAG + "Current Exposure bias range is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 -4 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 to operate"); - camera0Input.setExposureBias(-4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 mode locked - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 mode auto - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 to operate"); - camera0Input.setExposurePoint(Point1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 mode auto - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure Mode SUCCESS"); - console.info(TAG + "Get Exposure Mode data is not null || undefined: "); - console.info(TAG + "Current ExposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 mode auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 to operate"); - camera0Input.setExposureBias(1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "1"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 mode auto - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 to operate"); - camera0Input.setExposurePoint(Point2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - photoOutputAsync.capture(photosettings1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings1"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 mode auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 to operate"); - camera0Input.setExposureBias(4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 mode continuous auto - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 to operate"); - camera0Input.setExposurePoint(Point3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 to operate"); - photoOutputAsync.capture(photosettings2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings2"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 -5 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 to operate"); - camera0Input.setExposureBias(-5, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 mode locked - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 6 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 to operate"); - camera0Input.setExposureBias(6, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 - * @tc.name : capture session stop api - * @tc.desc : capture session stop api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 to operate"); - captureSession.stop(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 captureSession.stop success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering captureSession.stop data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 captureSession.stop PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 - * @tc.name : capture session release api - * @tc.desc : capture session release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 to operate"); - captureSession.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering captureSession.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering captureSession.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 ends here"); - await sleep(1000); - done(); - } - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 - * @tc.name : photoOutput release api - * @tc.desc : photoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 photoOutputAsync == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 to operate"); - photoOutputAsync.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutputAsync.release success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 FAILED: " + err.message); - console.info(TAG + "Entering photoOutputAsync.release ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 - * @tc.name : previewOutput release api - * @tc.desc : previewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 previewOutputAsync == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 to operate"); - previewOutputAsync.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering previewOutputAsync.release success"); - console.info(TAG + "Entering previewOutputAsync.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 ends here"); - await sleep(1000); - done(); - } - }) - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 - * @tc.name : camera Input release api - * @tc.desc : camera Input release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 camera0Input == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 to operate"); - camera0Input.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering camera0Input.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering camera0Input.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - }) - await sleep(1000); - done(); - } - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets b/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets deleted file mode 100644 index c14442e53bbb82953bb57518e61b1a76791d112c..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets +++ /dev/null @@ -1,3283 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables -var camera0InputPromise; -var cameraManagerPromise; -var previewOutputPromise; -var photoOutputPromise; -var CaptureSessionPromise; -var surfaceId1; -var camerasArrayPromise -var camera1InputPromise; - -var Point1 = { x: 1, y: 1 } -var Point2 = { x: 2, y: 2 } -var Point3 = { x: 3, y: 3 } - -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -export default function cameraJSUnitPhotoPromise(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJsUnitPhotoPromise', function () { - console.info(TAG + '----------CameraJsUnitPhotoPromise--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - console.info(TAG + "----------Camera-PhotoMode-Promise-------------"); - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------"); - cameraManagerPromise = await cameraObj.getCameraManager(null); - console.info(TAG + "Entering Get camera manager cameraManagerPromise: " + JSON.stringify(cameraManagerPromise)); - if (cameraManagerPromise != null && cameraManagerPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManagerPromise == null || cameraManagerPromise == undefined) { - console.info(TAG + 'Entering camera status callback cameraManagerPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate') - cameraManagerPromise.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManagerPromise is success"); - if (data != null || data != undefined) { - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 - * @tc.name : Get camera from cameramanager to get array of camera promise api - * @tc.desc : Get camera from cameramanager to get array of camera promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100--------------"); - camerasArrayPromise = await cameraManagerPromise.getCameras(); - console.info(TAG + "Entering Get Cameras: " + JSON.stringify(camerasArrayPromise)); - if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { - console.info(TAG + "Entering Get Cameras success"); - for (var i = 0; i < camerasArrayPromise.length; i++) { - // Get the variables from camera object - var cameraId = camerasArrayPromise[i].cameraId; - console.info(TAG + "Entering Get Cameras camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArrayPromise[i].cameraPosition; - console.info(TAG + "Entering Get Cameras camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArrayPromise[i].cameraType; - console.info(TAG + "Entering Get Cameras camera" + i + "Type: " + cameraType); - var connectionType = camerasArrayPromise[i].connectionType - console.info(TAG + "Entering Get Cameras connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraId promise api - * @tc.desc : Create camerainput from camera-0 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------CAMERA-0 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera0InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraId); - console.info(TAG + "Entering Create camerainput camera0InputPromise: " + JSON.stringify(camera0InputPromise)); - if (camera0InputPromise != null && camera0InputPromise != undefined) { - console.info(TAG + "Entering Create camerainput camera0InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 - * @tc.name : Create camerainput from camera-1 cameraId promise api - * @tc.desc : Create camerainput from camera-1 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200--------------"); - camera1InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[1].cameraId); - console.info(TAG + "Entering Create camerainput camera1InputPromise: " + JSON.stringify(camera1InputPromise)); - if (camera1InputPromise != null && camera1InputPromise != undefined) { - console.info(TAG + "Entering Create camerainput camera1InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 to operate"); - camera0InputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "camera0InputPromise error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error during camera0InputPromise with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*PreviewOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Create PreviewOutput instance promise api - * @tc.desc : Create PreviewOutput instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - console.info(TAG + " Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - previewOutputPromise = await cameraObj.createPreviewOutput(surfaceId); - console.info(TAG + " Entering createPreviewOutput success"); - if (previewOutputPromise != null || previewOutputPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering createPreviewOutput PASSED: " + JSON.stringify(previewOutputPromise)); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 - * @tc.name : Preview output callback on error api - * @tc.desc : Preview output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview output callback on error previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 to operate"); - previewOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Create PhotoOutput instance promise api - * @tc.desc : Create PhotoOutput instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1000) - photoOutputPromise = await cameraObj.createPhotoOutput(surfaceId1); - console.info(TAG + "Entering createPhotoOutput success"); - if (photoOutputPromise != null || photoOutputPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output callback on error photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 to operate"); - photoOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 - * @tc.name : Create CaptureSession instance promise api - * @tc.desc : Create Capturesession instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 to operate"); - CaptureSessionPromise = await cameraObj.createCaptureSession(null); - console.info(TAG + "Entering createCaptureSession success"); - if (CaptureSessionPromise != null || CaptureSessionPromise != undefined) { - console.info(TAG + "Entering createCaptureSession data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - //Capturesession callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 - * @tc.name : CaptureSession callback on error api - * @tc.desc : CaptureSession callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering CaptureSession callback on error captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 to operate"); - CaptureSessionPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession errorcallback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 - * @tc.name : CaptureSession_Begin config promise api - * @tc.desc : CaptureSession_Begin config promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering CaptureSession_Begin config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 to operate"); - const promise = await CaptureSessionPromise.beginConfig(); - console.info(TAG + "Entering beginConfig success:"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 beginConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add Input captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 to operate"); - const Promise = await CaptureSessionPromise.addInput(camera1InputPromise); - console.info(TAG + "Entering Add Input addInput success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add preview Output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 to operate"); - const promise = await CaptureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering Add preview Output : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Remove preview Output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 to operate"); - const Promise = await CaptureSessionPromise.removeOutput(previewOutputPromise); - console.info(TAG + "Entering Remove preview Output success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add preview Output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 to operate"); - const promise = await CaptureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering Add preview Output : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering commit config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 to operate"); - const promise = await CaptureSessionPromise.commitConfig(); - console.info(TAG + "Entering commit config commitConfig success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 commitConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 commitConfig FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 commitConfig ends here"); - } - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 to operate"); - await photoOutputPromise.isMirrorSupported() - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 FAILED : " + err.message); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 to operate"); - await photoOutputPromise.setMirror(true).then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 FAILED : " + err.message); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 - * @tc.name : setMirror false - * @tc.desc : setMirror false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 to operate"); - await photoOutputPromise.setMirror(false) - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'false'); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 FAILED : " + err.message); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100 - * @tc.name : CaptureSession_Begin config promise api - * @tc.desc : CaptureSession_Begin config promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100 to operate"); - const promise = await CaptureSessionPromise.beginConfig(); - console.info(TAG + "Entering beginConfig success:"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100 beginConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering beginConfig FAILED"); - } - console.info(TAG + "Entering beginConfig ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 to operate"); - const Promise = await CaptureSessionPromise.removeInput(camera1InputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add Input captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 to operate"); - const Promise = await CaptureSessionPromise.addInput(camera0InputPromise); - console.info(TAG + "Entering Add Input addInput success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add output with photo output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 to operate"); - const promise = await CaptureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering Add output with photo output success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 to operate"); - const Promise = await CaptureSessionPromise.removeOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 addInput success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 to operate"); - const promise = await CaptureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering commit config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 to operate"); - const promise = await CaptureSessionPromise.commitConfig(); - console.info(TAG + "Entering commit config commitConfig success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 commitConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 commitConfig FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 commitConfig ends here"); - } - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0InputPromise.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0InputPromise.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - // callback related API - //preview callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview output callback on frame start previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 to operate"); - previewOutputPromise.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 FAILED :" + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 - * @tc.name : Preview capture callback on frame end api - * @tc.desc : Preview capture callback on frame end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview capture callback on frame end previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 to operate"); - previewOutputPromise.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 FAILED : + err.message"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture start photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 to operate"); - photoOutputPromise.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "CaptureStart Callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture end photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 to operate"); - photoOutputPromise.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 FAILED' + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on frame shutter photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 to operate"); - photoOutputPromise.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 with captureId: " + data.captureId); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 - * @tc.name : capture session start api - * @tc.desc : capture session start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering capture session start captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 to operate"); - await CaptureSessionPromise.start(); - console.info(TAG + "Entering captureSession start success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - //Location - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - await photoOutputPromise.capture(photosettings1) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 FAILED:" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 to operate"); - await photoOutputPromise.capture(photosettings2) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 FAILED:" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 to operate"); - await photoOutputPromise.capture(photosettings3) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings3 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 :" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 to operate"); - await photoOutputPromise.capture(photosettings4) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings4 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100--------------"); - console.info(TAG + 'hasFlash called.') - var hasFlashPromise = await camera0InputPromise.hasFlash(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 success"); - if (hasFlashPromise != null || hasFlashPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 is: " + JSON.stringify(hasFlashPromise)); - expect(hasFlashPromise).assertEqual(true); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 FAILED : "); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 ends here"); - await sleep(1000) - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 to operate"); - var isFMOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 SUCCESS "); - if (isFMOpenSupported != null || isFMOpenSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + JSON.stringify(isFMOpenSupported)); - expect(isFMOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 to operate"); - var SetFMOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMOpen)) - if (SetFMOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 to operate"); - var GetFMOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 success: " + JSON.stringify(GetFMOpen)); - if (GetFMOpen == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + JSON.stringify(GetFMOpen)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 to operate"); - var isFMAlwaysOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 SUCCESS "); - if (isFMAlwaysOpenSupported != null || isFMAlwaysOpenSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + isFMAlwaysOpenSupported); - expect(isFMAlwaysOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - var SetFMAlwaysOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMAlwaysOpen)) - if (SetFMAlwaysOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - var GetFMAlwaysOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 success"); - if (GetFMAlwaysOpen == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAlwaysOpen); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 to operate"); - var isFMAutoSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 SUCCESS "); - if (isFMAutoSupported != null || isFMAutoSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_AUTO data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + isFMAutoSupported); - expect(isFMAutoSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 to operate"); - var SetFMAlwaysAuto = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "SetFMAlwaysAuto: " + JSON.stringify(SetFMAlwaysAuto)) - if (SetFMAlwaysAuto == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 to operate"); - var GetFMAuto = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 success"); - if (GetFMAuto == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAuto); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 to operate"); - var isFMCloseSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 SUCCESS "); - if (isFMCloseSupported != null || isFMCloseSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + isFMCloseSupported); - expect(isFMCloseSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 to operate"); - var SetFMClose = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMClose)) - if (SetFMClose == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 - * @tc.name : get flash mode close camera0 api - * @tc.desc : get flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 to operate"); - var GetFMClose = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 success"); - if (GetFMClose == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMClose); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - //ZOOM Function - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 - * @tc.name : get zoom ratio camera-0 cameraId api promise api - * @tc.desc : get zoom ratio camera-0 cameraId api promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100--------------"); - var getZoomRatioPromise = await camera0InputPromise.getZoomRatioRange(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 getZoomRatioPromise: " + JSON.stringify(getZoomRatioPromise)); - if (getZoomRatioPromise != null && getZoomRatioPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 setZoomRatioPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 success: " + JSON.stringify(getZoomRatioPromise)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(1); - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - var getpromise1 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise1); - if (getpromise1 != null && getpromise1 != undefined) { - expect(getpromise1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(2); - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - var getpromise2 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise2); - if (getpromise2 != null && getpromise2 != undefined) { - expect(getpromise2).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(3); - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - var getpromise3 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise3); - if (getpromise3 != null && getpromise3 != undefined) { - expect(getpromise3).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(4); - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - var getpromise4 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise4); - if (getpromise4 != null && getpromise4 != undefined) { - expect(getpromise4).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(5); - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - var getpromise5 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise5); - if (getpromise5 != null && getpromise5 != undefined) { - expect(getpromise5).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(6); - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - var getpromise6 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise6); - if (getpromise6 != null && getpromise6 != undefined) { - expect(getpromise6).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - // FOCUS promise API's - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 - * @tc.name : check is focus mode locked supported-camera0Input api - * @tc.desc : check is focus mode locked supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 to operate"); - var isFMLockedSupported = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering is focus mode locked supported SUCCESS "); - if (isFMLockedSupported != null || isFMLockedSupported != undefined) { - console.info(TAG + "Entering is focus mode locked supported data is not null || undefined"); - console.info(TAG + "is focus mode locked supported : " + isFMLockedSupported); - expect(isFMLockedSupported).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED) - .then(function (data) { - console.info(TAG + "SetFMLocked: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode locked SUCCESS, current focusmode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 FAILED : ") - expect().assertFail(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode locked success: "); - if (data == 0) { - console.info(TAG + "Current focusmode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 - * @tc.name : get focal length camera0 api - * @tc.desc : get focal length camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 to operate"); - await camera0InputPromise.getFocalLength() - .then(function (data) { - console.info(TAG + "Current focallength is: " + JSON.stringify(data)); - expect(data).assertEqual(3.4600000381469727); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 - * @tc.name : is focusmode manual supported - * @tc.desc : is focusmode manual supported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 to operate"); - var isFMmanualSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL); - if (isFMmanualSupportedpromise != null || isFMmanualSupportedpromise != undefined) { - console.info(TAG + "Entering is focusmode manual supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMmanualSupportedpromise); - expect(isFMmanualSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL) - .then(function (data) { - console.info(TAG + "setFocusManual: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode manual SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode manual SUCCESS"); - if (data == 0) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 FAILED " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 - * @tc.name : check is focus mode continuous supported-camera0Input api - * @tc.desc : check is focus mode continuous supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 to operate"); - var isFMContinuousSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - if (isFMContinuousSupportedpromise != null || isFMContinuousSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode continuous supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINUOUS_SUPPORTED is: " + isFMContinuousSupportedpromise); - expect(isFMContinuousSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) - .then(function (data) { - console.info(TAG + "setFocusCont: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode continuous SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode continuous SUCCESS"); - if (data == 1) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check is focus mode auto supported-camera0Input api - * @tc.desc : check is focus mode auto supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 to operate"); - var isFMAutoSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (isFMAutoSupportedpromise != null || isFMAutoSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode auto supported data is not null || undefined"); - console.info(TAG + "is focus mode auto supported is: " + isFMAutoSupportedpromise); - expect(isFMAutoSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 to operate"); - var setFocusAuto = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO) - .then(function () { - console.info(TAG + "setFocusAuto: " + JSON.stringify(setFocusAuto)) - console.info(TAG + "Entering set focus mode auto SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode auto SUCCESS " + JSON.stringify(data)); - if (data == 2) { - console.info(TAG + "Current FocusMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 PASSED"); - } - }) - .catch((err) => { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode locked SUCCESS"); - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 to operate"); - await camera0InputPromise.getExposureBiasRange() - .then(function (data) { - console.info(TAG + "Entering getExposureBiasRange SUCCESS"); - console.info(TAG + "Current ExposureBiasRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100-4 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 to operate"); - await camera0InputPromise.setExposureBias(-4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 to operate"); - await camera0InputPromise.setExposurePoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 FAILED: " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 to operate"); - await camera0InputPromise.setExposureBias(1) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "1"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 to operate"); - await camera0InputPromise.setExposurePoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 to operate"); - await photoOutputPromise.capture(photosettings1) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with Rotation-0 & Quality-0 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 FAILED:" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 to operate"); - await camera0InputPromise.setExposureBias(4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 to operate"); - await camera0InputPromise.setExposurePoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - await photoOutputPromise.capture(photosettings2) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with location settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400-5 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 to operate"); - await camera0InputPromise.setExposureBias(-5) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 to operate"); - await camera0InputPromise.setExposureBias(6) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 ends here"); - await sleep(1000); - done(); - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 - * @tc.name : capture session stop api - * @tc.desc : capture session stop api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering capture session stop captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 to operate"); - await CaptureSessionPromise.stop(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 captureSession.stop PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 captureSession.stop ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : capture session release api - * @tc.desc : capture session release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering capture session release captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await CaptureSessionPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : PreviewOutput release api - * @tc.desc : PreviewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering previewOutputPromise.release previewOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await previewOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : PhotoOutput release api - * @tc.desc : PhotoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering PhotoOutput release photoOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await photoOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : cameraInput release api - * @tc.desc : cameraInput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering cameraInput release camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await camera0InputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - }); -} \ No newline at end of file diff --git a/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets b/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets deleted file mode 100644 index 571ca690ff89ac2fbd3becb18f81fc97bc447bf8..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets +++ /dev/null @@ -1,3800 +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 cameraObj from '@ohos.multimedia.camera'; -import media from '@ohos.multimedia.media' -import image from '@ohos.multimedia.image'; -import mediaLibrary from '@ohos.multimedia.mediaLibrary' -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' - -// @ts-nocheck -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -let TAG = "CameraModuleTest: "; -var cameraManager -var camerasArray -var camera0Input -var previewOutput -var photoOutputAsync -var videoRecorder -var surfaceId1 - -var minFrameRate_Grp0=12; -var maxFrameRate_Grp0=12; -var minFrameRate_Mix=14; -var maxFrameRate_Mix=15; -var minFrameRate_Err1=11; -var maxFrameRate_Err1=31; -var minFrameRate_Err2=14; -var maxFrameRate_Err2=28; -var minFrameRate_Err3=16; -var maxFrameRate_Err3=25; -var minFrameRate_Grp20=30; -var maxFrameRate_Grp20=30; - -var Point = { x: 1, y: 1 } -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -let fdPath; -let fileAsset; -let fdNumber; -let configFile = { - audioBitrate: 48000, - audioChannels: 2, - audioCodec: 'audio/mp4a-latm', - audioSampleRate: 48000, - durationTime: 1000, - fileFormat: 'mp4', - videoBitrate: 48000, - videoCodec: 'video/mp4v-es', - videoFrameWidth: 640, - videoFrameHeight: 480, - videoFrameRate: 30 -} - -let videoConfig = { - audioSourceType: 1, - videoSourceType: 0, - profile: configFile, - url: 'file:///data/media/02.mp4', - orientationHint: 0, - location: { latitude: 30, longitude: 130 }, - maxSize: 100, - maxDuration: 500 -} -var videoId -var videoOutput -var captureSession - -export default function cameraJSUnitVideoAsync(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(time) { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(1) - }, time * 1000) - }).then(() => { - console.info(`sleep ${time} over...`) - }) - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - async function getFd(pathName) { - let displayName = pathName; - const mediaTest = mediaLibrary.getMediaLibrary(); - let fileKeyObj = mediaLibrary.FileKey; - let mediaType = mediaLibrary.MediaType.VIDEO; - let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); - let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); - if (dataUri != undefined) { - let args = dataUri.id.toString(); - let fetchOp = { - selections: fileKeyObj.ID + "=?", - selectionArgs: [args], - } - let fetchFileResult = await mediaTest.getFileAssets(fetchOp); - fileAsset = await fetchFileResult.getAllObject(); - fdNumber = await fileAsset[0].open('Rw'); - fdPath = "fd://" + fdNumber.toString(); - } - } - - async function closeFd() { - if (fileAsset != null) { - await fileAsset[0].close(fdNumber).then(() => { - console.info('[mediaLibrary] case close fd success'); - }).catch((err) => { - console.info('[mediaLibrary] case close fd failed'); - }); - } else { - console.info('[mediaLibrary] case fileAsset is null'); - } - } - - async function getvideosurface() { - await getFd('02.mp4'); - videoConfig.url = fdPath; - media.createVideoRecorder((err, recorder) => { - console.info(TAG + 'createVideoRecorder called') - videoRecorder = recorder - console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder)) - console.info(TAG + 'videoRecorder.prepare called.') - videoRecorder.prepare(videoConfig, (err) => { - console.info(TAG + 'videoRecorder.prepare success.') - }) - videoRecorder.getInputSurface((err, id) => { - console.info(TAG + 'getInputSurface called') - videoId = id - console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoId)) - }) - }) - } - - describe('VideoModeAsync', function () { - console.info(TAG + '----------Camera-VideoMode-Async--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5); - console.info('beforeEach case'); - }) - - afterEach(async function () { - await closeFd(); - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100--------------') - await sleep(1) - cameraObj.getCameraManager(null, (err, data) => { - if (!err) { - console.info(TAG + 'Entering Get Camera manager success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Get Camera Manager data is not null || undefined') - cameraManager = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 PASSED') - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManager == null || cameraManager == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManager == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate') - cameraManager.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManager is success"); - if (data != null || data != undefined) { - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Camera status Callback FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------') - await sleep(1) - cameraManager.getCameras((err, data) => { - if (!err) { - console.info(TAG + 'Entering Get Cameras success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Get Cameras data is not null || undefined') - camerasArray = data - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId - console.info(TAG + 'Entering Get Cameras camera' + i + 'Id: ' + cameraId) - var cameraPosition = camerasArray[i].cameraPosition - console.info(TAG + 'Entering Get Cameras camera' + i + 'Position: ' + cameraPosition) - var cameraType = camerasArray[i].cameraType - console.info(TAG + 'Entering Get Cameras camera' + i + 'Type: ' + cameraType) - var connectionType = camerasArray[i].connectionType - console.info(TAG + 'Entering Get Cameras connection' + i + 'Type: ' + connectionType) - } - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined') - } - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info('--------------CAMERA-0 STARTS HERE--------------') - console.info('--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------') - await sleep(1) - cameraManager.createCameraInput(camerasArray[0].cameraId, (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + 'Entering Create camera input data is not null || undefined') - camera0Input = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :' + camerasArray[0].cameraId) - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering Camera Input callback camera0Input == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 to operate"); - camera0Input.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "camera0Input error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 - * @tc.name : Create previewoutput async api - * @tc.desc : Create previewoutput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 to operate') - await sleep(1) - cameraObj.createPreviewOutput(surfaceId, (err, data) => { - if (!err) { - console.info(TAG + 'Entering Create preview output success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Create preview output data is not null || undefined') - previewOutput = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 PASSED') - } - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Preview output callback on error api - * @tc.desc : Preview output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering PreviewOutput callback on error previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 to operate"); - previewOutput.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Create PhotoOutput instance api - * @tc.desc : Create PhotoOutput instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1) - cameraObj.createPhotoOutput(surfaceId1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering createPhotoOutput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering createPhotoOutput data is not null || undefined"); - photoOutputAsync = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate"); - photoOutputAsync.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error during PhotoOutput with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 - * @tc.name : Create videooutput async api - * @tc.desc : Create videooutput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 to operate') - await getvideosurface() - await sleep(2) - cameraObj.createVideoOutput(videoId, (err, data) => { - if (!err) { - console.info(TAG + 'Entering Create videooutput success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Create videooutput data is not null || undefined') - videoOutput = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 PASSED') - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : VideoOutput callback onerror async api - * @tc.desc : VideoOutput callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 videoOutput == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - videoOutput.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "VideoOutput Errorcallback is success") - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1) - done() - }) - await sleep(1) - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 - * @tc.name : Create capturesession async api - * @tc.desc : Create capturesession async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 to operate') - await sleep(1) - cameraObj.createCaptureSession(null, async (err, data) => { - if (!err) { - console.info(TAG + 'Entering Create capturesession success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Create capturesession data is not null || undefined') - captureSession = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 PASSED') - } - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail() - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 - * @tc.name : CaptureSession callback on error api - * @tc.desc : CaptureSession callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 to operate"); - captureSession.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession errorcallback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 - * @tc.name : Begin Config async api - * @tc.desc : Begin Config async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering Begin Config captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 to operate') - await sleep(1) - captureSession.beginConfig((err, data) => { - if (!err) { - console.info(TAG + 'Entering Begin Config success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 - * @tc.name : AddInput async api - * @tc.desc : AddInput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddInput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 to operate') - await sleep(1) - captureSession.addInput(camera0Input, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddInput success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 - * @tc.name : AddOutput preview async api - * @tc.desc : AddOutput preview async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput preview captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 to operate') - await sleep(1) - captureSession.addOutput(previewOutput, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput preview success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 ends here"); - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 - * @tc.name : AddOutput video async api - * @tc.desc : AddOutput video async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput video captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 to operate') - await sleep(1) - captureSession.addOutput(videoOutput, async (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput video success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 ends here') - await sleep(1); - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeInput(camera0Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove input success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering Remove Input FAILED" + err.message); - console.info(TAG + "Entering Remove Input ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeOutput(previewOutput, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove preview Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering Remove preview Output FAILED" + err.message); - console.info(TAG + "Entering Remove Preview Output ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove photo Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove photo Output FAILED" + err.message); - console.info(TAG + "Entering Remove photo Output ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Remove video Output api - * @tc.desc : Remove video Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeOutput(videoOutput, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove video Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering Remove video Output FAILED" + err.message); - console.info(TAG + "Entering Remove video Output ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 - * @tc.name : AddInput async api - * @tc.desc : AddInput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddInput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 to operate') - await sleep(1) - captureSession.addInput(camera0Input, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddInput success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 - * @tc.name : AddOutput preview async api - * @tc.desc : AddOutput preview async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 to operate') - await sleep(1) - captureSession.addOutput(previewOutput, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput success') - console.info(TAG + 'Entering AddOutput data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 ends here"); - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 - * @tc.name : AddOutput video async api - * @tc.desc : AddOutput video async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 to operate') - await sleep(1) - captureSession.addOutput(videoOutput, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput success') - console.info(TAG + 'Entering AddOutput data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 ends here') - done() - }) - await sleep(1) - done() - } - }) - - //framerate - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 - * @tc.name : get frame rate range camera0 api - * @tc.desc : get frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 to operate"); - videoOutput.getFrameRateRange(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get frame rate range success"); - expect(true).assertTrue(); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Grp0,maxFrameRate_Grp0, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range PASSED") - expect(true).assertTrue(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Mix,maxFrameRate_Mix, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED") - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api_err - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Err1,maxFrameRate_Err1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED") - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Err2,maxFrameRate_Err2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED"); - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Err3,maxFrameRate_Err3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED"); - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Grp20,maxFrameRate_Grp20, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range PASSED") - expect(true).assertTrue(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeOff - * @tc.desc : getVideoStabilizationModeOff async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode Off success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeLow - * @tc.desc : getVideoStabilizationModeLOw async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode low success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(1) - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeMedium - * @tc.desc : getVideoStabilizationModeMedium async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode medium success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeHigh - * @tc.desc : getVideoStabilizationModeHigh async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode High success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeAuto - * @tc.desc : getVideoStabilizationModeAuto async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode Auto success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 - * @tc.name : CommitConfig async api - * @tc.desc : CommitConfig async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering CommitConfig captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 to operate') - await sleep(1) - captureSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + 'Entering CommitConfig success') - console.info(TAG + 'Entering CommitConfig data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0Input.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0Input.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //callback API - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering Preview output callback on frame start previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate"); - previewOutput.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : Preview capture callback on frame end api - * @tc.desc : Preview capture callback on frame end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering Preview capture callback on frame end previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate"); - previewOutput.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering Photo Capture Callback on CaptureStart photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 to operate"); - photoOutputAsync.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "Photo Capture Callback on CaptureStart is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 to operate"); - photoOutputAsync.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 FAILED' + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 to operate"); - photoOutputAsync.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "frameShutter callback with captureId: " + data.captureId); - console.info(TAG + "frameShutter callback with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : VideoOutput callback onframestart async api - * @tc.desc : VideoOutput callback onframestart async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + "Entering VideoOutput callback onframestart videoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate"); - videoOutput.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 is FAILED : " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : VideoOutput callback onframeend async api - * @tc.desc : VideoOutput callback onframeend async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + 'Entering VideoOutput callback onframeend videoOutput == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate') - await sleep(1) - videoOutput.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 is success'); - if (data != null || data != undefined) { - expect(true).assertTrue() - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED' + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 - * @tc.name : CaptureSession start async api - * @tc.desc : CaptureSession start async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CaptureSession start captureSession == null || undefined") - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 to operate") - await sleep(1) - captureSession.start(async (err, data) => { - if (!err) { - console.info(TAG + "Entering CaptureSession start success") - expect(true).assertTrue() - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 PASSED") - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "hasFlash called.") - camera0Input.hasFlash(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 is: " + data); - expect(data).assertEqual(true); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 ends here"); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 success"); - if (data == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_ALWAYS_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 success"); - if (data == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode auto is supported-camera0Input api - * @tc.desc : check if flash mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_AUTO SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 success"); - if (data == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_CLOSE SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 success"); - if (data == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 - * @tc.name : get zoom ratio camera-0 cameraId api - * @tc.desc : get zoom ratio camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100--------------"); - camera0Input.getZoomRatioRange(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 Success " + data) - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 ends here"); - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(1, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(2, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_CALLBACK_0100 PASSED "); - } - else { - expect().assertFail(); - console.info(TAG + "GET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - } else { - expect().assertFail(); - console.info(TAG + "SET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(3, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(4, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(5, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(6, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode locked is supported-camera0Input api - * @tc.desc : check if focus mode locked is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Is Focus Mode Locked Supported SUCCESS: " + data); - if (data != null || data != undefined) { - console.info(TAG + "Entering Is Focus Mode Locked Supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_LOCKED_SUPPORTED is: " + data); - expect(data).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 FAILED :" + err.message); - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Mode Locked SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 FAILED : ") - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Mode Locked SUCCESS: " + data); - console.info(TAG + "Get Focus Mode Locked data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode manual is supported-camera0Input api - * @tc.desc : check if focus mode manual is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 FAILED " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 to operate"); - camera0Input.setFocusPoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode continuous is supported-camera0Input api - * @tc.desc : check if focus mode continuous is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINOUS_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 - * @tc.name : set focus Point locked camera0 api - * @tc.desc : set focus Point locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 to operate"); - camera0Input.setFocusPoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode auto is supported-camera0Input api - * @tc.desc : check if focus mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_AUTO_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (data != null || data != undefined) { - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 PASSED") - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 to operate"); - camera0Input.setFocusPoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 to operate"); - camera0Input.setExposurePoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100_exposure mode continuous auto - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 to operate"); - camera0Input.getExposureBiasRange(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias range SUCCESS"); - console.info(TAG + "Current Exposure bias range is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 to operate"); - camera0Input.setExposureBias(-4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure Mode SUCCESS"); - console.info(TAG + "Get Exposure Mode data is not null || undefined: "); - console.info(TAG + "Current ExposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 to operate"); - camera0Input.setExposurePoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 to operate"); - camera0Input.setExposureBias(1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "1"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 to operate"); - camera0Input.setExposurePoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 to operate"); - camera0Input.setExposureBias(4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100 to operate"); - photoOutputAsync.isMirrorSupported(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100 to operate"); - photoOutputAsync.setMirror(true, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 - * @tc.name : VideoOutput start async api - * @tc.desc : VideoOutput start async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 videoOutput == null || undefined") - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 to operate") - await sleep(1) - videoOutput.start(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 success: " + JSON.stringify(data)) - if (data == undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 FAILED: " + err.message) - } - }) - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 - * @tc.name : VideoRecorder start async api - * @tc.desc : VideoRecorder start async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100', 0, async function (done) { - if (videoRecorder == null || videoRecorder == undefined) { - console.info(TAG + 'Entering VideoRecorder start videoRecorder == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 to operate') - videoRecorder.start() - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 called'); - sleep(3); - console.info(TAG + 'Capture with photosettings1 during video - Start & setMirror: true') - photoOutputAsync.capture(photosettings1) - console.info(TAG + 'Capture during Video - End.') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 - * @tc.name : VideoOutput stop async api - * @tc.desc : VideoOutput stop async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + 'Entering VideoOutput stop videoOutput == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 to operate') - videoOutput.stop(async (err, data) => { - if (!err) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 success: ' + JSON.stringify(data)) - if (data == undefined) { - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100 - * @tc.name : VideoRecorder stop async api - * @tc.desc : VideoRecorder stop async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100', 0, async function (done) { - if (videoRecorder == null || videoRecorder == undefined) { - console.info(TAG + 'Entering VideoRecorder stop videoRecorder == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100 to operate') - videoRecorder.stop() - console.info(TAG + 'VideoRecorder stop stopVideo done.') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100 PASSED') - expect(true).assertTrue() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 - * @tc.name : CaptureSession stop async api - * @tc.desc : CaptureSession stop async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering CaptureSession stop captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 to operate') - await sleep(1) - captureSession.stop((err, data) => { - if (!err) { - console.info(TAG + 'Entering CaptureSession stop success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 - * @tc.name : CaptureSession release async api - * @tc.desc : CaptureSession release async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering CaptureSession release captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 to operate') - await sleep(1) - captureSession.release(async (err, data) => { - if (!err) { - console.info(TAG + 'Entering CaptureSession release success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering CaptureSession release data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 PASSED') - } - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 - * @tc.name : videooutput release api - * @tc.desc : videooutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + "Entering videooutput.release previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 to operate"); - videoOutput.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering videooutput.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering videooutput.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 ends here"); - await sleep(1); - done(); - } - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 - * @tc.name : previewOutput release api - * @tc.desc : previewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 to operate"); - previewOutput.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering previewOutput.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering previewOutput.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering previewOutput.release PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering previewOutput.release ends here"); - await sleep(1); - done(); - } - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 - * @tc.name : photoOutput release api - * @tc.desc : photoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 photoOutputAsync == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 to operate"); - photoOutputAsync.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutputAsync.release success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering photoOutputAsync.release ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 - * @tc.name : camera Input release api - * @tc.desc : camera Input release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering camera0Input.release camera0Input == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 to operate"); - camera0Input.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering camera0Input.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering camera0Input.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 ends here"); - await sleep(1); - done(); - } - }) - await sleep(1); - done(); - } - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets b/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets deleted file mode 100644 index aa4466c90fbcc0482aff18bd91e25e3ae39d7b27..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets +++ /dev/null @@ -1,3367 +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 cameraObj from '@ohos.multimedia.camera' -import media from '@ohos.multimedia.media' -import image from '@ohos.multimedia.image'; -import mediaLibrary from '@ohos.multimedia.mediaLibrary' -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' - -// @ts-nocheck -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -let TAG = 'CameraModuleTest: ' -var cameraManagerPromise -var camerasArrayPromise -var camera0InputPromise -var previewOutputPromise -var videoRecorder -var photoOutputPromise -let fdPath; -let fileAsset; -let fdNumber; - -var minFrameRate_Grp0=12; -var maxFrameRate_Grp0=12; -var minFrameRate_Mix=14; -var maxFrameRate_Mix=15; -var minFrameRate_Err1=11; -var maxFrameRate_Err1=31; -var minFrameRate_Err2=14; -var maxFrameRate_Err2=28; -var minFrameRate_Err3=16; -var maxFrameRate_Err3=25; -var minFrameRate_Grp20=30; -var maxFrameRate_Grp20=30; - -var Point1 = { x: 1, y: 1 } -var Point2 = { x: 2, y: 2 } -var Point3 = { x: 3, y: 3 } -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -var photosettings5 = { - rotation: 270, -} -let configFile = { - audioBitrate: 48000, - audioChannels: 2, - audioCodec: 'audio/mp4a-latm', - audioSampleRate: 48000, - durationTime: 1000, - fileFormat: 'mp4', - videoBitrate: 48000, - videoCodec: 'video/mp4v-es', - videoFrameWidth: 640, - videoFrameHeight: 480, - videoFrameRate: 30 -} - -let videoConfig = { - audioSourceType: 1, - videoSourceType: 0, - profile: configFile, - url: 'file:///data/media/01.mp4', - orientationHint: 0, - location: { latitude: 30, longitude: 130 }, - maxSize: 100, - maxDuration: 500 -} -var surfaceId1 -var videoId -var videoOutputPromise -var captureSessionPromise - -export default function cameraJSUnitVideoPromise(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(time) { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(1) - }, time * 1000) - }).then(() => { - console.info(`sleep ${time} over...`) - }) - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - async function getFd(pathName) { - let displayName = pathName; - const mediaTest = mediaLibrary.getMediaLibrary(); - let fileKeyObj = mediaLibrary.FileKey; - let mediaType = mediaLibrary.MediaType.VIDEO; - let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); - let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); - if (dataUri != undefined) { - let args = dataUri.id.toString(); - let fetchOp = { - selections: fileKeyObj.ID + "=?", - selectionArgs: [args], - } - let fetchFileResult = await mediaTest.getFileAssets(fetchOp); - fileAsset = await fetchFileResult.getAllObject(); - fdNumber = await fileAsset[0].open('Rw'); - fdPath = "fd://" + fdNumber.toString(); - } - } - - async function closeFd() { - if (fileAsset != null) { - await fileAsset[0].close(fdNumber).then(() => { - console.info('[mediaLibrary] case close fd success'); - }).catch((err) => { - console.info('[mediaLibrary] case close fd failed'); - }); - } else { - console.info('[mediaLibrary] case fileAsset is null'); - } - } - - async function getvideosurface() { - await getFd('01.mp4'); - videoConfig.url = fdPath; - media.createVideoRecorder((err, recorder) => { - console.info(TAG + 'createVideoRecorder called') - videoRecorder = recorder - console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder)) - console.info(TAG + 'videoRecorder.prepare called.') - videoRecorder.prepare(videoConfig, (err) => { - console.info(TAG + 'videoRecorder.prepare success.') - }) - videoRecorder.getInputSurface((err, id) => { - console.info(TAG + 'getInputSurface called') - videoId = id - console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoId)) - }) - }) - } - - describe('VideoModePromise', function () { - console.info(TAG + '----------Camera-VideoMode-Promise--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5); - console.info('beforeEach case'); - }) - - afterEach(async function () { - await closeFd(); - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------') - cameraManagerPromise = await cameraObj.getCameraManager(null) - console.info(TAG + 'Entering Get cameraManagerPromise cameraManagerPromise: ' + cameraManagerPromise) - if (cameraManagerPromise != null && cameraManagerPromise != undefined) { - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManagerPromise == null || cameraManagerPromise == undefined) { - console.info(TAG + 'Entering Camera status Callback cameraManagerPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate') - await sleep(1) - cameraManagerPromise.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManagerPromise is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100--------------') - camerasArrayPromise = await cameraManagerPromise.getCameras() - console.info(TAG + 'Entering Get Cameras Promise: ' + JSON.stringify(camerasArrayPromise)) - if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { - console.info(TAG + 'Entering Get Cameras Promise success') - for (var i = 0; i < camerasArrayPromise.length; i++) { - // Get the variables from camera object - var cameraId = camerasArrayPromise[i].cameraId - console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Id: ' + cameraId) - var cameraPosition = camerasArrayPromise[i].cameraPosition - console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Position: ' + cameraPosition) - var cameraType = camerasArrayPromise[i].cameraType - console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Type: ' + cameraType) - var connectionType = camerasArrayPromise[i].connectionType - console.info(TAG + 'Entering Get Cameras Promise connection' + i + 'Type: ' + connectionType) - } - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraId promise api - * @tc.desc : Create camerainput from camera-0 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------') - camera0InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraId) - console.info(TAG + 'Entering Create camera input promise camera0InputPromise: ' + JSON.stringify(camera0InputPromise)) - if (camera0InputPromise != null && camera0InputPromise != undefined) { - console.info(TAG + 'Entering Create camera input promise camera0InputPromise is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering Camera input error callback camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 to operate"); - camera0InputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "camera0InputPromise error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 - * @tc.name : Create previewoutput promise api - * @tc.desc : Create previewoutput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100--------------') - previewOutputPromise = await cameraObj.createPreviewOutput(surfaceId) - console.info(TAG + 'Entering Create previewOutputPromise: ' + JSON.stringify(previewOutputPromise)) - if (previewOutputPromise != null && previewOutputPromise != undefined) { - console.info(TAG + 'Entering Create previewOutputPromise is not null || undefined') - expect(true).assertTrue(); - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 PASSED') - } else { - expect().assertFail(); - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0InputPromise.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is : " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0InputPromise.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : PreviewOutput callback onerror async api - * @tc.desc : PreviewOutput callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + 'Entering PreviewOutputError callback previewOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - previewOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 - * @tc.name : Create videooutput promise api - * @tc.desc : Create videooutput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 to operate') - await getvideosurface() - await sleep(2) - videoOutputPromise = await cameraObj.createVideoOutput(videoId) - console.info(TAG + 'Entering Create videoOutputPromise: ' + videoOutputPromise) - if (videoOutputPromise != null && videoOutputPromise != undefined) { - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 PASSED') - } else { - expect().assertFail(); - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 ends here'); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : VideoOutput callback onerror async api - * @tc.desc : VideoOutput callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - videoOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + 'VideoOutput Errorcallback is success') - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1) - done() - }) - await sleep(1) - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Create PhotoOutput instance promise api - * @tc.desc : Create PhotoOutput instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1) - photoOutputPromise = await cameraObj.createPhotoOutput(surfaceId1); - console.info(TAG + "Entering createPhotoOutput success"); - if (photoOutputPromise != null || photoOutputPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output callback on error photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate"); - photoOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 - * @tc.name : Create capturesession promise api - * @tc.desc : Create capturesession promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 to operate') - captureSessionPromise = await cameraObj.createCaptureSession(null) - console.info(TAG + 'Entering Create captureSessionPromise: ' + captureSessionPromise) - if (captureSessionPromise != null && captureSessionPromise != undefined) { - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 ends here'); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 - * @tc.name : CaptureSession callback onerror async api - * @tc.desc : CaptureSession callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + 'Entering captureSession errorcallback captureSessionPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - captureSessionPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession errorcallback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 - * @tc.name : CaptureSession_Begin config promise api - * @tc.desc : CaptureSession_Begin config promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Create captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.beginConfig(); - console.info(TAG + "Entering beginConfig success:"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 beginConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add Input captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.addInput(camera0InputPromise); - console.info(TAG + "Entering Add Input success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add preview output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering Add preview output : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 - * @tc.name : Add output with video output api - * @tc.desc : Add output with video output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add video output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(videoOutputPromise); - console.info(TAG + "Entering Add video output success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add output with photo output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering Add output with photo output success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeInput(camera0InputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeOutput(previewOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 addInput success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Remove video Output api - * @tc.desc : Remove video Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeOutput(videoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 to operate"); - const Promise = await captureSessionPromise.addInput(camera0InputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 addInput success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 to operate"); - const promise = await captureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 - * @tc.name : Add output with video output api - * @tc.desc : Add output with video output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 to operate"); - const promise = await captureSessionPromise.addOutput(videoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 - * @tc.name : get frame rate range camera0 api - * @tc.desc : get frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 to operate"); - await videoOutputPromise.getFrameRateRange() - .then(function (data) { - console.info(TAG + "Entering get frame rate range SUCCESS "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 PASSED : " + JSON.stringify(data)) - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Grp0,maxFrameRate_Grp0) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Mix,maxFrameRate_Mix) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Err1,maxFrameRate_Err1) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Err2,maxFrameRate_Err2) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Err3,maxFrameRate_Err3) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Grp20,maxFrameRate_Grp20) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 - * @tc.name : getVideoStabilizationModeOff - * @tc.desc : getVideoStabilizationModeOff promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeOff SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 - * @tc.name : getVideoStabilizationModeLow - * @tc.desc : getVideoStabilizationModeLow promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeLow SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 - * @tc.name : getVideoStabilizationModeMIDDLE - * @tc.desc : getVideoStabilizationModeMIDDLE promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeMIDDLE SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 - * @tc.name : getVideoStabilizationModeHigh - * @tc.desc : getVideoStabilizationModeHigh promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeHigh SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 - * @tc.name : getVideoStabilizationModeAuto - * @tc.desc : getVideoStabilizationModeAuto promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeAuto SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Commit config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.commitConfig(); - console.info(TAG + "Entering commitConfig success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 commitConfig PASSED"); - } - else { - expect().assertFail() - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 commitConfig FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 commitConfig ends here"); - } - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview Output callback on frame start previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate"); - previewOutputPromise.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : PreviewOutput callback onframeend async api - * @tc.desc : PreviewOutput callback onframeend async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 previewOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate') - await sleep(1) - previewOutputPromise.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewStop frameEnd Callback is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : VideoOutput callback onframestart async api - * @tc.desc : VideoOutput callback onframestart async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video frameStart Callback videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate') - await sleep(1) - videoOutputPromise.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "Video frameStart Callback is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 is FAILED : " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : VideoOutput callback onframeend async api - * @tc.desc : VideoOutput callback onframeend async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video frameEnd callback videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate') - await sleep(1) - videoOutputPromise.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 is success') - if (data != null || data != undefined) { - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED' + err.message) - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture start photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 to operate"); - photoOutputPromise.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "CaptureStart Callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture end photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 to operate"); - photoOutputPromise.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 FAILED' + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on frame shutter photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 to operate"); - photoOutputPromise.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 with captureId: " + data.captureId); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 - * @tc.name : capture session start api - * @tc.desc : capture session start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering capture session start captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 to operate"); - await captureSessionPromise.start(); - console.info(TAG + "Entering captureSession start success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 to operate"); - await photoOutputPromise.isMirrorSupported() - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 FAILED : " + err.message); - }); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 to operate"); - await photoOutputPromise.setMirror(true) - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 FAILED : " + err.message); - }); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100--------------"); - console.info(TAG + 'hasFlash called.') - var hasFlashPromise = await camera0InputPromise.hasFlash(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 success"); - if (hasFlashPromise != null || hasFlashPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 is: " + JSON.stringify(hasFlashPromise)); - expect(hasFlashPromise).assertEqual(true); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 FAILED : "); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 ends here"); - await sleep(1) - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 to operate"); - var isFMOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMOpenSupported != null || isFMOpenSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + JSON.stringify(isFMOpenSupported)); - expect(isFMOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 to operate"); - var SetFMOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMOpen)) - if (SetFMOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 to operate"); - var GetFMOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 success: " + JSON.stringify(GetFMOpen)); - if (GetFMOpen == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + JSON.stringify(GetFMOpen)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 to operate"); - var isFMAlwaysOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMAlwaysOpenSupported != null || isFMAlwaysOpenSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + isFMAlwaysOpenSupported); - expect(isFMAlwaysOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 to operate"); - var SetFMAlwaysOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMAlwaysOpen)) - if (SetFMAlwaysOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 to operate"); - var GetFMAlwaysOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 success"); - if (GetFMAlwaysOpen == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAlwaysOpen); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 to operate"); - var isFMAutoSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMAutoSupported != null || isFMAutoSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_AUTO data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + isFMAutoSupported); - expect(isFMAutoSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 to operate"); - var SetFMAlwaysAuto = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "SetFMAlwaysAuto: " + JSON.stringify(SetFMAlwaysAuto)) - if (SetFMAlwaysAuto == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 to operate"); - var GetFMAuto = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 success"); - if (GetFMAuto == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAuto); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 to operate"); - var isFMCloseSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMCloseSupported != null || isFMCloseSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + isFMCloseSupported); - expect(isFMCloseSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 to operate"); - var SetFMClose = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMClose)) - if (SetFMClose == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 - * @tc.name : get flash mode close camera0 api - * @tc.desc : get flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 to operate"); - var GetFMClose = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 success"); - if (GetFMClose == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMClose); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - //ZOOM Function - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 - * @tc.name : get zoom ratio camera-0 cameraId api promise api - * @tc.desc : get zoom ratio camera-0 cameraId api promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100--------------"); - var getZoomRatioPromise = await camera0InputPromise.getZoomRatioRange(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 getZoomRatioPromise: " + JSON.stringify(getZoomRatioPromise)); - if (getZoomRatioPromise != null && getZoomRatioPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 setZoomRatioPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 success: " + JSON.stringify(getZoomRatioPromise)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(1); - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - var getpromise1 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise1); - if (getpromise1 != null && getpromise1 != undefined) { - expect(getpromise1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(2); - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - var getpromise2 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise2); - if (getpromise2 != null && getpromise2 != undefined) { - expect(getpromise2).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(3); - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - var getpromise3 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise3); - if (getpromise3 != null && getpromise3 != undefined) { - expect(getpromise3).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(4); - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - var getpromise4 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise4); - if (getpromise4 != null && getpromise4 != undefined) { - expect(getpromise4).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(5); - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - var getpromise5 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise5); - if (getpromise5 != null && getpromise5 != undefined) { - expect(getpromise5).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(6); - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - var getpromise6 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise6); - if (getpromise6 != null && getpromise6 != undefined) { - expect(getpromise6).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - // FOCUS promise API's - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 - * @tc.name : check is focus mode locked supported-camera0Input api - * @tc.desc : check is focus mode locked supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 to operate"); - var isFMLockedSupported = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering is focus mode locked supported SUCCESS "); - if (isFMLockedSupported != null || isFMLockedSupported != undefined) { - console.info(TAG + "Entering is focus mode locked supported data is not null || undefined"); - console.info(TAG + "is focus mode locked supported : " + isFMLockedSupported); - expect(isFMLockedSupported).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED) - .then(function (data) { - console.info(TAG + "SetFMLocked: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode locked SUCCESS, current focusmode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 FAILED : ") - expect().assertFail(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 ends here"); - }); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode locked success: "); - if (data == 0) { - console.info(TAG + "Current focusmode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 ends here"); - }); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 - * @tc.name : get focal length camera0 api - * @tc.desc : get focal length camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 to operate"); - await camera0InputPromise.getFocalLength() - .then(function (data) { - console.info(TAG + "Current focallength is: " + JSON.stringify(data)); - expect(data).assertEqual(3.4600000381469727); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 - * @tc.name : is focusmode manual supported - * @tc.desc : is focusmode manual supported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 to operate"); - var isFMmanualSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL); - if (isFMmanualSupportedpromise != null || isFMmanualSupportedpromise != undefined) { - console.info(TAG + "Entering is focusmode manual supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMmanualSupportedpromise); - expect(isFMmanualSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL) - .then(function (data) { - console.info(TAG + "setFocusManual: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode manual SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode manual SUCCESS"); - if (data == 0) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 ends here"); - }); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 FAILED " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 - * @tc.name : check is focus mode continuous supported-camera0Input api - * @tc.desc : check is focus mode continuous supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 to operate"); - var isFMContinuousSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - if (isFMContinuousSupportedpromise != null || isFMContinuousSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode continuous supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINUOUS_SUPPORTED is: " + isFMContinuousSupportedpromise); - expect(isFMContinuousSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) - .then(function (data) { - console.info(TAG + "setFocusCont: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode continuous SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode continuous SUCCESS"); - if (data == 1) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 - * @tc.name : check is focus mode auto supported-camera0Input api - * @tc.desc : check is focus mode auto supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 to operate"); - var isFMAutoSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (isFMAutoSupportedpromise != null || isFMAutoSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode auto supported data is not null || undefined"); - console.info(TAG + "is focus mode auto supported is: " + isFMAutoSupportedpromise); - expect(isFMAutoSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 to operate"); - var setFocusAuto = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO) - .then(function () { - console.info(TAG + "setFocusAuto: " + JSON.stringify(setFocusAuto)) - console.info(TAG + "Entering set focus mode auto SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 FAILED : "); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 to operate"); - var getfocusmodepromise = await camera0InputPromise.getFocusMode(); - console.info(TAG + "Entering get focus mode auto SUCCESS"); - if (getfocusmodepromise == 2) { - console.info(TAG + "Current FocusMode is: " + getfocusmodepromise); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode locked SUCCESS"); - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 mode locked - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 to operate"); - await camera0InputPromise.setExposurePoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 mode locked - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100_exposure mode locked - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureBiasRange() - .then(function (data) { - console.info(TAG + "Entering getExposureBiasRange SUCCESS"); - console.info(TAG + "Current ExposureBiasRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 mode locked - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 to operate"); - await camera0InputPromise.setExposureBias(-4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 mode locked - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 mode auto - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 to operate"); - await camera0InputPromise.setExposurePoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 FAILED: " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 mode auto - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 mode auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 to operate"); - await camera0InputPromise.setExposureBias(1) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 mode auto - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 to operate"); - await camera0InputPromise.setExposurePoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 mode continuous auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 to operate"); - await camera0InputPromise.setExposureBias(4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 - * @tc.name : VideoOutput start promise api - * @tc.desc : VideoOutput start promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video Output start videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 to operate') - await videoOutputPromise.start() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 - * @tc.name : VideoOutput stop promise api - * @tc.desc : VideoOutput stop promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video Output Stop videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 to operate') - await videoOutputPromise.stop() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 - * @tc.name : CaptureSession stop promise api - * @tc.desc : CaptureSession stop promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + 'Entering Capture Session Stop captureSessionPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 to operate') - await captureSessionPromise.stop() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 - * @tc.name : CaptureSession release promise api - * @tc.desc : CaptureSession release promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + 'Entering Capture session release captureSessionPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 to operate') - await captureSessionPromise.release() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : videoOutput release api - * @tc.desc : videoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + "Entering Video Output release previewOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await videoOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : PreviewOutput release api - * @tc.desc : PreviewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering previewOutputPromise.release previewOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await previewOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : cameraInput release api - * @tc.desc : cameraInput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering camera0InputPromise.release camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await camera0InputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1) - done() - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraExceedWideAngle/BUILD.gn b/multimedia/camera/cameraExceedWideAngle/BUILD.gn deleted file mode 100644 index 1d0613e5b069bbce8004813d92a64bd3fe1bd7dd..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraExceedWideAngle/BUILD.gn +++ /dev/null @@ -1,34 +0,0 @@ -# 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("camera_exceedwideangle_ets_hap") { - hap_profile = "./src/main/config.json" - deps = [ - ":camera_ets_assets", - ":camera_ets_resources", - ] - ets2abc = true - - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsCameraExceedWideAngleETSTest" - subsystem_name = "multimedia" - part_name = "multimedia_camera_standard" -} -ohos_js_assets("camera_ets_assets") { - source_dir = "./src/main/ets/MainAbility" -} -ohos_resources("camera_ets_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/multimedia/camera/cameraExceedWideAngle/Test.json b/multimedia/camera/cameraExceedWideAngle/Test.json deleted file mode 100644 index ce558e4540f05ec6691299f5ffe1f5fc3b723883..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraExceedWideAngle/Test.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "description": "Configuration for camerastandard ExceedWideAngle Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "1000000", - "package": "com.open.harmony.multimedia.cameraewatest", - "shell-timeout": "60000" - }, - "kits": [ - { - "type": "ShellKit", - "run-command": [ - "touch /data/media/01.mp4", - "chmod -R 777 /data/media" - - ], - "teardown-command":[ - - ] - }, - { - "test-file-name": [ - "ActsCameraExceedWideAngleETSTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/multimedia/camera/cameraExceedWideAngle/signature/openharmony_sx.p7b b/multimedia/camera/cameraExceedWideAngle/signature/openharmony_sx.p7b deleted file mode 100644 index 0625db92101ca16c7becfaf2d4008ea2e96078e1..0000000000000000000000000000000000000000 Binary files a/multimedia/camera/cameraExceedWideAngle/signature/openharmony_sx.p7b and /dev/null differ diff --git a/multimedia/camera/cameraExceedWideAngle/src/main/config.json b/multimedia/camera/cameraExceedWideAngle/src/main/config.json deleted file mode 100644 index 11d48a86f5e159efc215ce9bfe5fe678298a4561..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraExceedWideAngle/src/main/config.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "app": { - "bundleName": "com.open.harmony.multimedia.cameraewatest", - "vendor": "open", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.open.harmony.multimedia.cameraewatest", - "name": ".MyApplication", - "mainAbility": "com.open.harmony.multimedia.cameraewatest.MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "formsEnabled": false, - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "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.CAMERA", - "reason": "use ohos.permission.CAMERA" - }, - { - "name": "ohos.permission.MICROPHONE", - "reason": "use ohos.permission.MICROPHONE" - }, - { - "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" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/app.ets b/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/app.ets deleted file mode 100644 index a9f8218978fad817d4519aa1b715da0e3f8ebbfc..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('Application onCreate') - }, - onDestroy() { - console.info('Application onDestroy') - }, -} diff --git a/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/pages/index.ets b/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index ca96b03e80e49976adf3f876fadb4d82d574c6ef..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,74 +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 {Core, ExpectExtend} from "deccjsunit/index" -import cameraKit from "../test/Camera.test" -import featureAbility from "@ohos.ability.featureAbility" - -let TAG = 'CameraModuleTest: ' -var mXComponentController: XComponentController = new XComponentController() -var surfaceId: any - -@Entry -@Component -struct CameraIndex { - @State isShowSettings: boolean = false - @State previewSize: string = '75%' - - aboutToAppear() { - console.info('--------------aboutToAppear--------------') - } - - build() { - Flex() { - XComponent({ - id: '', - type: 'surface', - libraryname: '', - controller: mXComponentController - }) - .onLoad(() => { - console.info('CameraModuleTest: OnLoad() is called!') - mXComponentController.setXComponentSurfaceSize({ surfaceWidth: 1920, surfaceHeight: 1080 }); - surfaceId = mXComponentController.getXComponentSurfaceId() - console.info('CameraModuleTest: XComponent onLoad surfaceId: ' + surfaceId) - featureAbility.getWant() - .then((Want) => { - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - console.info(TAG + 'Entering expectExtend') - core.addService('expect', expectExtend) - console.info(TAG + 'Entering addService') - core.init() - console.info(TAG + 'Entering core.init()') - console.info(TAG + 'Entering subscribeEvent') - const configService = core.getDefaultService('config') - configService.setConfig(Want.parameters) - console.info(TAG + 'Entering configService') - cameraKit(surfaceId) - core.execute() - console.info(TAG + 'Operation successful. Data: ' + JSON.stringify(Want)); - }) - .catch((error) => { - console.error(TAG + 'Operation failed. Cause: ' + JSON.stringify(error)); - }) - }) - .width('1920px') - .height('1080px') - } - } -} diff --git a/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/Camera.test.ets b/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/Camera.test.ets deleted file mode 100644 index 2743a3a6f94f359e98785fa0a21bf1518e7a9859..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/Camera.test.ets +++ /dev/null @@ -1,35 +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 cameraJSUnitEnum from './CameraJSUnitEnum.test.ets' -import cameraJSUnitCameraFormat from './CameraJSUnitCameraFormat.test.ets' -import cameraJSUnitPhotoAsync from './CameraJSUnitPhotoAsync.test.ets' -import cameraJSUnitPhotoPromise from './CameraJSUnitPhotoPromise.test.ets' -import cameraJSUnitVideoAsync from './CameraJSUnitVideoAsync.test.ets' -import cameraJSUnitVideoPromise from './CameraJSUnitVideoPromise.test.ets' - -let TAG = 'CameraModuleTest: ' - -export default function cameraKit(surfaceId: any) { - console.info(TAG + 'Entering cameraKit') - console.info(TAG + 'surfaceId: ' + surfaceId) - - cameraJSUnitEnum(surfaceId) - cameraJSUnitCameraFormat(surfaceId) - cameraJSUnitPhotoAsync(surfaceId) - cameraJSUnitPhotoPromise(surfaceId) - cameraJSUnitVideoAsync(surfaceId) - cameraJSUnitVideoPromise(surfaceId) -} \ No newline at end of file diff --git a/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets b/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets deleted file mode 100644 index b5631b504db4526f32d15ccbf90e1f857b315dbb..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets +++ /dev/null @@ -1,2779 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables - -var cameraManager; -var surfaceId1; -var camerasArray; - -// CAMERA-0 Variables -var camera0Input, camera0InputPosBack, camera0InputPosFront; -var camera0InputPromise, camera0InputPromisePosBack, camera0InputPromisePosFront; -// CAMERA-1 Variables -var camera1Input, camera1InputPosBack, camera1InputPosFront; -var camera1InputPromise, camera1InputPromisePosBack, camera1InputPromisePosFront; -// CAMERA-2 Variables -var camera2Input, camera2InputPosBack, camera2InputPosFront; -var camera2InputPromise, camera2InputPromisePosBack, camera2InputPromisePosFront; -// CAMERA-3 Variables -var camera3Input, camera3InputPosBack, camera3InputPosFront; -var camera3InputPromise, camera3InputPromisePosBack, camera3InputPromisePosFront; - -export default function cameraJSUnitCameraFormat(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJsUnitCameraFormat', function () { - console.info(TAG + '----------CameraJsUnitCameraFormat--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 data is not null || undefined"); - cameraManager = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------"); - var cameraManagerPromise = await cameraObj.getCameraManager(null); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 cameraManagerPromise: " + JSON.stringify(cameraManagerPromise)); - if (cameraManagerPromise != null && cameraManagerPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Get camera from cameramanager to get array of camera async api - * @tc.desc : Get camera from cameramanager to get array of camera async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------"); - cameraManager.getCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 data is not null || undefined"); - camerasArray = data; - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArray[i].cameraPosition; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArray[i].cameraType; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Type: " + cameraType); - var connectionType = camerasArray[i].connectionType - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 - * @tc.name : Get camera from cameramanager to get array of camera promise api - * @tc.desc : Get camera from cameramanager to get array of camera promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100--------------"); - var camerasArrayPromise = await cameraManager.getCameras(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100: " + JSON.stringify(camerasArrayPromise)); - if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 success"); - for (var i = 0; i < camerasArrayPromise.length; i++) { - // Get the variables from camera object - var cameraId = camerasArrayPromise[i].cameraId; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArrayPromise[i].cameraPosition; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArrayPromise[i].cameraType; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 camera" + i + "Type: " + cameraType); - var connectionType = camerasArrayPromise[i].connectionType - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-0 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera0Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[0].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraId promise api - * @tc.desc : Create camerainput from camera-0 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera0InputPromise = await cameraManager.createCameraInput(camerasArray[0].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera0InputPromise: " + JSON.stringify(camera0InputPromise)); - if (camera0InputPromise != null && camera0InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera0InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 - * @tc.name : get camera if from camera-0 input async api - * @tc.desc : get camera if from camera-0 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100', 0, async function (done) { - camera0Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 data is not null || undefined"); - var CameraId0 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 PASSED with CameraID :" + CameraId0); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 - * @tc.name : get camera if from camera-0 input promise api - * @tc.desc : get camera if from camera-0 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100', 0, async function (done) { - var camera0IdPromise = await camera0InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 camera0IdPromise: " + JSON.stringify(camera0IdPromise)); - if (camera0IdPromise != null && camera0IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 camera0IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 PASSED" + camera0IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput async api - * @tc.desc : Get supported preview formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera0InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null && data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromise = await camera0InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromise)); - if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam0FormatPromise: " + cam0FormatPromise[i]); - expect(cam0FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-0 camerainput async api - * @tc.desc : Get supported video formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 success"); - if (data != null && data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 - * @tc.name : Get supported video formats from camera-0 camerainput promise api - * @tc.desc : Get supported video formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromise = await camera0InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromise)); - if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 cam0FormatPromise: " + cam0FormatPromise[i]); - expect(cam0FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-0 camerainput async api - * @tc.desc : Get supported photo format from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-0 camerainput promise api - * @tc.desc : Get supported photo format from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromise = await camera0InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromise)); - if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam0FormatPromise: " + cam0FormatPromise[i]); - expect(cam0FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput async api - * @tc.desc : Get supported preview formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosBack = await camera0InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosBack)); - if (cam0FormatPromisePosBack != null && cam0FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam0FormatPromisePosBack: " + cam0FormatPromisePosBack[i]); - expect(cam0FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-0 camerainput async api - * @tc.desc : Get supported photo format from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-0 camerainput promise api - * @tc.desc : Get supported photo format from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosBack = await camera0InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosBack)); - if (cam0FormatPromisePosBack != null && cam0FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam0FormatPromisePosBack: " + cam0FormatPromisePosBack[i]); - expect(cam0FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput async api - * @tc.desc : Get supported preview formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosFront = await camera0InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosFront)); - if (cam0FormatPromisePosFront != null && cam0FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam0FormatPromisePosFront: " + cam0FormatPromisePosFront[i]); - expect(cam0FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-0 camerainput async api - * @tc.desc : Get supported photo format from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-0 camerainput promise api - * @tc.desc : Get supported photo format from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosFront = await camera0InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosFront)); - if (cam0FormatPromisePosFront != null && cam0FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam0FormatPromisePosFront: " + cam0FormatPromisePosFront[i]); - expect(cam0FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0InputPromise.on("focusStateChange", async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CAMERA-1 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-1 cameraId async api - * @tc.desc : Create camerainput from camera-1 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-1 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[1].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera1Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[1].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-1 cameraId promise api - * @tc.desc : Create camerainput from camera-1 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera1InputPromise = await cameraManager.createCameraInput(camerasArray[1].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera1InputPromise: " + JSON.stringify(camera1InputPromise)); - if (camera1InputPromise != null && camera1InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera1InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 - * @tc.name : get camera ID from camera-1 input async api - * @tc.desc : get camera ID from camera-1 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100', 0, async function (done) { - camera1Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 data is not null || undefined"); - var CameraId1 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 PASSED with CameraID : " + CameraId1); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 - * @tc.name : get camera ID from camera-1 input promise api - * @tc.desc : get camera ID from camera-1 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100', 0, async function (done) { - var camera1IdPromise = await camera1InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 camera1IdPromise: " + JSON.stringify(camera1IdPromise)); - if (camera1IdPromise != null && camera1IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 camera1IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 PASSED" + camera1IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 - * @tc.name : Create camerainput from camera-1 cameraposition & cameratype async api - * @tc.desc : Create camerainput from camera-1 cameraposition & cameratype async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[1].cameraPosition, camerasArray[1].cameraType, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 - * @tc.name : Create camerainput from camera-1 cameraposition & cameratype promise api - * @tc.desc : Create camerainput from camera-1 cameraposition & cameratype promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100--------------"); - var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[1].cameraPosition, camerasArray[1].cameraType); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); - if (cameraInputPromise != null && cameraInputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput async api - * @tc.desc : Get supported preview formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera1InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput promise api - * @tc.desc : Get supported preview formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromise = await camera1InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromise)); - if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam1FormatPromise: " + cam1FormatPromise[i]); - expect(cam1FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-1 camerainput async api - * @tc.desc : Get supported video formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100--------------"); - camera1InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 - * @tc.name : Get supported video formats from camera-1 camerainput promise api - * @tc.desc : Get supported video formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100--------------"); - var cam1FormatPromise = await camera1InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100: " + JSON.stringify(cam1FormatPromise)); - if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 cam1FormatPromise: " + cam1FormatPromise[i]); - expect(cam1FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-1 camerainput async api - * @tc.desc : Get supported photo format from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera1InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-1 camerainput promise api - * @tc.desc : Get supported photo format from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromise = await camera1InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromise)); - if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam1FormatPromise: " + cam1FormatPromise[i]); - expect(cam1FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput async api - * @tc.desc : Get supported preview formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput promise api - * @tc.desc : Get supported preview formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosBack = await camera1InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosBack)); - if (cam1FormatPromisePosBack != null && cam1FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam1FormatPromisePosBack: " + cam1FormatPromisePosBack[i]); - expect(cam1FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-1 camerainput async api - * @tc.desc : Get supported photo format from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-1 camerainput promise api - * @tc.desc : Get supported photo format from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosBack = await camera1InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosBack)); - if (cam1FormatPromisePosBack != null && cam1FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam1FormatPromisePosBack: " + cam1FormatPromisePosBack[i]); - expect(cam1FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput async api - * @tc.desc : Get supported preview formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput promise api - * @tc.desc : Get supported preview formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosFront = await camera1InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosFront)); - if (cam1FormatPromisePosFront != null && cam1FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam1FormatPromisePosFront: " + cam1FormatPromisePosFront[i]); - expect(cam1FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-1 camerainput async api - * @tc.desc : Get supported photo format from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-1 camerainput promise api - * @tc.desc : Get supported photo format from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosFront = await camera1InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosFront)); - if (cam1FormatPromisePosFront != null && cam1FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam1FormatPromisePosFront: " + cam1FormatPromisePosFront[i]); - expect(cam1FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-2 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-2 cameraId async api - * @tc.desc : Create camerainput from camera-2 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-2 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[2].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera2Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[2].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-2 cameraId promise api - * @tc.desc : Create camerainput from camera-2 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera2InputPromise = await cameraManager.createCameraInput(camerasArray[2].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera2InputPromise: " + JSON.stringify(camera2InputPromise)); - if (camera2InputPromise != null && camera2InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera2InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 - * @tc.name : get camera ID from camera-2 input async api - * @tc.desc : get camera ID from camera-2 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100', 0, async function (done) { - camera2Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 data is not null || undefined"); - var CameraId2 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 PASSED with CameraID : " + CameraId2); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 - * @tc.name : get camera ID from camera-2 input promise api - * @tc.desc : get camera ID from camera-2 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100', 0, async function (done) { - var camera2IdPromise = await camera2InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 camera2IdPromise: " + JSON.stringify(camera2IdPromise)); - if (camera2IdPromise != null && camera2IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 camera2IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 PASSED" + camera2IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 - * @tc.name : Create camerainput from camera-2 cameraposition & cameratype async api - * @tc.desc : Create camerainput from camera-2 cameraposition & cameratype async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[2].cameraPosition, camerasArray[2].cameraType, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 - * @tc.name : Create camerainput from camera-2 cameraposition & cameratype promise api - * @tc.desc : Create camerainput from camera-2 cameraposition & cameratype promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100--------------"); - var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[2].cameraPosition, camerasArray[2].cameraType); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); - if (cameraInputPromise != null && cameraInputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput async api - * @tc.desc : Get supported preview formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera2InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput promise api - * @tc.desc : Get supported preview formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromise = await camera2InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromise)); - if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam2FormatPromise: " + cam2FormatPromise[i]); - expect(cam2FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-2 camerainput async api - * @tc.desc : Get supported video formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100--------------"); - camera2InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 - * @tc.name : Get supported video formats from camera-2 camerainput promise api - * @tc.desc : Get supported video formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100--------------"); - var cam2FormatPromise = await camera2InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100: " + JSON.stringify(cam2FormatPromise)); - if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 cam2FormatPromise: " + cam2FormatPromise[i]); - expect(cam2FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-2 camerainput async api - * @tc.desc : Get supported photo format from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera2InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-2 camerainput promise api - * @tc.desc : Get supported photo format from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromise = await camera2InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromise)); - if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam2FormatPromise: " + cam2FormatPromise[i]); - expect(cam2FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput async api - * @tc.desc : Get supported preview formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput promise api - * @tc.desc : Get supported preview formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosBack = await camera2InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosBack)); - if (cam2FormatPromisePosBack != null && cam2FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam2FormatPromisePosBack: " + cam2FormatPromisePosBack[i]); - expect(cam2FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-2 camerainput async api - * @tc.desc : Get supported photo format from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-2 camerainput promise api - * @tc.desc : Get supported photo format from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosBack = await camera2InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosBack)); - if (cam2FormatPromisePosBack != null && cam2FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam2FormatPromisePosBack: " + cam2FormatPromisePosBack[i]); - expect(cam2FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput async api - * @tc.desc : Get supported preview formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput promise api - * @tc.desc : Get supported preview formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosFront = await camera2InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosFront)); - if (cam2FormatPromisePosFront != null && cam2FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam2FormatPromisePosFront: " + cam2FormatPromisePosFront[i]); - expect(cam2FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-2 camerainput async api - * @tc.desc : Get supported photo format from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-2 camerainput promise api - * @tc.desc : Get supported photo format from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosFront = await camera2InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosFront)); - if (cam2FormatPromisePosFront != null && cam2FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam2FormatPromisePosFront: " + cam2FormatPromisePosFront[i]); - expect(cam2FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-3 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-3 cameraId async api - * @tc.desc : Create camerainput from camera-3 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-3 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[3].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera3Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[3].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-3 cameraId promise api - * @tc.desc : Create camerainput from camera-3 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera3InputPromise = await cameraManager.createCameraInput(camerasArray[3].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera3InputPromise: " + JSON.stringify(camera3InputPromise)); - if (camera3InputPromise != null && camera3InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera3InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 - * @tc.name : get camera ID from camera-3 input async api - * @tc.desc : get camera ID from camera-3 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100', 0, async function (done) { - camera3Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 data is not null || undefined"); - var CameraId3 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 PASSED with CameraID : " + CameraId3); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 - * @tc.name : get camera ID from camera-3 input promise api - * @tc.desc : get camera ID from camera-3 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100', 0, async function (done) { - var camera3IdPromise = await camera3InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 camera3IdPromise: " + JSON.stringify(camera3IdPromise)); - if (camera3IdPromise != null && camera3IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 camera3IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 PASSED" + camera3IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 - * @tc.name : Create camerainput from camera-3 cameraposition & cameratype async api - * @tc.desc : Create camerainput from camera-3 cameraposition & cameratype async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[3].cameraPosition, camerasArray[3].cameraType, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 - * @tc.name : Create camerainput from camera-3 cameraposition & cameratype promise api - * @tc.desc : Create camerainput from camera-3 cameraposition & cameratype promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100--------------"); - var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[3].cameraPosition, camerasArray[3].cameraType); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); - if (cameraInputPromise != null && cameraInputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput async api - * @tc.desc : Get supported preview formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera3InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput promise api - * @tc.desc : Get supported preview formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromise = await camera3InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromise)); - if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam3FormatPromise: " + cam3FormatPromise[i]); - expect(cam3FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-3 camerainput async api - * @tc.desc : Get supported video formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100--------------"); - camera3InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 - * @tc.name : Get supported video formats from camera-3 camerainput promise api - * @tc.desc : Get supported video formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100--------------"); - var cam3FormatPromise = await camera3InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100: " + JSON.stringify(cam3FormatPromise)); - if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 cam3FormatPromise: " + cam3FormatPromise[i]); - expect(cam3FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-3 camerainput async api - * @tc.desc : Get supported photo format from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera3InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-3 camerainput promise api - * @tc.desc : Get supported photo format from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromise = await camera3InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromise)); - if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam3FormatPromise: " + cam3FormatPromise[i]); - expect(cam3FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput async api - * @tc.desc : Get supported preview formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput promise api - * @tc.desc : Get supported preview formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosBack = await camera3InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosBack)); - if (cam3FormatPromisePosBack != null && cam3FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam3FormatPromisePosBack: " + cam3FormatPromisePosBack[i]); - expect(cam3FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-3 camerainput async api - * @tc.desc : Get supported photo format from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-3 camerainput promise api - * @tc.desc : Get supported photo format from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosBack = await camera3InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosBack)); - if (cam3FormatPromisePosBack != null && cam3FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam3FormatPromisePosBack: " + cam3FormatPromisePosBack[i]); - expect(cam3FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput async api - * @tc.desc : Get supported preview formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput promise api - * @tc.desc : Get supported preview formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosFront = await camera3InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosFront)); - if (cam3FormatPromisePosFront != null && cam3FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam3FormatPromisePosFront: " + cam3FormatPromisePosFront[i]); - expect(cam3FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-3 camerainput async api - * @tc.desc : Get supported photo format from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-3 camerainput promise api - * @tc.desc : Get supported photo format from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosFront = await camera3InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosFront)); - if (cam3FormatPromisePosFront != null && cam3FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam3FormatPromisePosFront: " + cam3FormatPromisePosFront[i]); - expect(cam3FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE ULTRA ANGLE*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition unspecified & cameratype ultra wide async api - * @tc.desc : Create camerainput from cameraposition unspecified & cameratype ultra wide async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition unspecified & cameratype ultra wide promise api - * @tc.desc : Create camerainput from cameraposition unspecified & cameratype ultra wide promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE) - .then(function () { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_0100 FAILED"); - expect().assertFail(); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE ULTRA ANGLE*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition back & cameratype ultra wide async api - * @tc.desc : Create camerainput from cameraposition back & cameratype ultra wide async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition back & cameratype ultra wide promise api - * @tc.desc : Create camerainput from cameraposition back & cameratype ultra wide promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE ULTRA ANGLE*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition front & cameratype ultra wide async api - * @tc.desc : Create camerainput from cameraposition front & cameratype ultra wide async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition front & cameratype ultra wide promise api - * @tc.desc : Create camerainput from cameraposition front & cameratype ultra wide promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets b/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets deleted file mode 100644 index 4a9e9e966b0eeccaf6558cb55c79fcdf91ce2c07..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets +++ /dev/null @@ -1,508 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables - -var cameraManager; -var surfaceId1; -var camerasArray; - -// CAMERA-0 Variables -var camera0Input, camera0InputPosBack, camera0InputPosFront; -var camera0InputPromise, camera0InputPromisePosBack, camera0InputPromisePosFront; -// CAMERA-1 Variables -var camera1Input, camera1InputPosBack, camera1InputPosFront; -var camera1InputPromise, camera1InputPromisePosBack, camera1InputPromisePosFront; -// CAMERA-2 Variables -var camera2Input, camera2InputPosBack, camera2InputPosFront; -var camera2InputPromise, camera2InputPromisePosBack, camera2InputPromisePosFront; -// CAMERA-3 Variables -var camera3Input, camera3InputPosBack, camera3InputPosFront; -var camera3InputPromise, camera3InputPromisePosBack, camera3InputPromisePosFront; - -export default function cameraJSUnitEnum(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJSUnitEnum', function () { - console.info(TAG + '----------CameraJSUnitEnum--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 data is not null || undefined"); - cameraManager = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Get camera from cameramanager to get array of camera async api - * @tc.desc : Get camera from cameramanager to get array of camera async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------"); - cameraManager.getCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 data is not null || undefined"); - camerasArray = data; - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArray[i].cameraPosition; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArray[i].cameraType; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Type: " + cameraType); - var connectionType = camerasArray[i].connectionType - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100', 0, async function (done) { - console.info("--------------CAMERA-0 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100--------------"); - cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 data is not null || undefined"); - camera0Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 PASSED with CameraID :" + camerasArray[0].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_0100 - * @tc.name : camera status ENAME - * @tc.desc : camera status ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_0100------------"); - console.info(TAG + "CameraStatus CAMERA_STATUS_APPEAR : " + cameraObj.CameraStatus.CAMERA_STATUS_APPEAR); - expect(cameraObj.CameraStatus.CAMERA_STATUS_APPEAR).assertEqual(0); - console.info(TAG + "CameraStatus CAMERA_STATUS_DISAPPEAR : " + cameraObj.CameraStatus.CAMERA_STATUS_DISAPPEAR); - expect(cameraObj.CameraStatus.CAMERA_STATUS_DISAPPEAR).assertEqual(1); - console.info(TAG + "CameraStatus CAMERA_STATUS_AVAILABLE : " + cameraObj.CameraStatus.CAMERA_STATUS_AVAILABLE) - expect(cameraObj.CameraStatus.CAMERA_STATUS_AVAILABLE).assertEqual(2); - console.info(TAG + "CameraStatus CAMERA_STATUS_UNAVAILABLE : " + cameraObj.CameraStatus.CAMERA_STATUS_UNAVAILABLE) - expect(cameraObj.CameraStatus.CAMERA_STATUS_UNAVAILABLE).assertEqual(3); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_POSITION_0100 - * @tc.name : Camera position ENAME - * @tc.desc : Camera position ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_POSITION_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CAMERA_POSITION_0100------------") - console.info(TAG + "CameraPosition CAMERA_POSITION_BACK : " + cameraObj.CameraPosition.CAMERA_POSITION_BACK); - expect(cameraObj.CameraPosition.CAMERA_POSITION_BACK).assertEqual(1); - console.info(TAG + "CameraPosition CAMERA_POSITION_FRONT : " + cameraObj.CameraPosition.CAMERA_POSITION_FRONT); - expect(cameraObj.CameraPosition.CAMERA_POSITION_FRONT).assertEqual(2); - console.info(TAG + "CameraPosition CAMERA_POSITION_UNSPECIFIED : " + cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED); - expect(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED).assertEqual(0); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_TYPE_0100 - * @tc.name : camera type ENAME - * @tc.desc : camera type ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_TYPE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CAMERA_TYPE_0100------------") - console.info(TAG + "CameraType CAMERA_TYPE_UNSPECIFIED : " + cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); - expect(cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED).assertEqual(0); - console.info(TAG + "CameraType CAMERA_TYPE_WIDE_ANGLE : " + cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE); - expect(cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE).assertEqual(1); - console.info(TAG + 'CameraType CAMERA_TYPE_ULTRA_WIDE : ' + cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE); - expect(cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE).assertEqual(2); - console.info(TAG + 'CameraType CAMERA_TYPE_TELEPHOTO : ' + cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO); - expect(cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO).assertEqual(3); - console.info(TAG + 'CameraType CAMERA_TYPE_TRUE_DEPTH : ' + cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH) - expect(cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH).assertEqual(4); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CONNECTION_TYPE_0100 - * @tc.name : connection type ENAME - * @tc.desc : connection type ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CONNECTION_TYPE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CONNECTION_TYPE_0100------------") - console.info(TAG + "ConnectionType CAMERA_CONNECTION_BUILT_IN : " + cameraObj.ConnectionType.CAMERA_CONNECTION_BUILT_IN); - expect(cameraObj.ConnectionType.CAMERA_CONNECTION_BUILT_IN).assertEqual(0); - console.info(TAG + "ConnectionType CAMERA_CONNECTION_USB_PLUGIN : " + cameraObj.ConnectionType.CAMERA_CONNECTION_USB_PLUGIN); - expect(cameraObj.ConnectionType.CAMERA_CONNECTION_USB_PLUGIN).assertEqual(1); - console.info(TAG + "ConnectionType CAMERA_CONNECTION_REMOTE : " + cameraObj.ConnectionType.CAMERA_CONNECTION_REMOTE); - expect(cameraObj.ConnectionType.CAMERA_CONNECTION_REMOTE).assertEqual(2); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FLASHMODE_0100 - * @tc.name : Flash Mode ENAME - * @tc.desc : Flash Mode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FLASHMODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_FLASHMODE_0100------------") - console.info(TAG + "FlashMode FLASH_MODE_CLOSE : " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); - console.info(TAG + "FlashMode FLASH_MODE_OPEN : " + cameraObj.FlashMode.FLASH_MODE_OPEN); - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - console.info(TAG + "FlashMode FLASH_MODE_AUTO : " + cameraObj.FlashMode.FLASH_MODE_AUTO); - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); - console.info(TAG + "FlashMode FLASH_MODE_ALWAYS_OPEN : " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSMODE_0100 - * @tc.name : Focus Mode ENAME - * @tc.desc : Focus Mode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSMODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_FOCUSMODE_0100------------") - console.info(TAG + "FocusMode FOCUS_MODE_MANUAL : " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0); - console.info(TAG + "FocusMode FOCUS_MODE_CONTINUOUS_AUTO : " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); - console.info(TAG + "FocusMode FOCUS_MODE_AUTO : " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); - console.info(TAG + "FocusMode FOCUS_MODE_LOCKED : " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - expect(cameraObj.FocusMode.FOCUS_MODE_LOCKED).assertEqual(3); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATE_0100 - * @tc.name : Focus State ENAME - * @tc.desc : Focus State ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_FOCUSSTATE_0100------------") - console.info(TAG + "FocusState FOCUS_STATE_SCAN : " + cameraObj.FocusState.FOCUS_STATE_SCAN); - expect(cameraObj.FocusState.FOCUS_STATE_SCAN).assertEqual(0); - console.info(TAG + "FocusState FOCUS_STATE_FOCUSED : " + cameraObj.FocusState.FOCUS_STATE_FOCUSED); - expect(cameraObj.FocusState.FOCUS_STATE_FOCUSED).assertEqual(1); - console.info(TAG + "FocusState FOCUS_STATE_UNFOCUSED : " + cameraObj.FocusState.FOCUS_STATE_UNFOCUSED); - expect(cameraObj.FocusState.FOCUS_STATE_UNFOCUSED).assertEqual(2); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IMAGEROTATION_0100 - * @tc.name : Image Rotation ENAME - * @tc.desc : Image Rotation ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IMAGEROTATION_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_IMAGEROTATION_0100------------") - console.info(TAG + "ImageRotation ROTATION_0 : " + cameraObj.ImageRotation.ROTATION_0); - expect(cameraObj.ImageRotation.ROTATION_0).assertEqual(0); - console.info(TAG + "ImageRotation ROTATION_90 : " + cameraObj.ImageRotation.ROTATION_90); - expect(cameraObj.ImageRotation.ROTATION_90).assertEqual(90); - console.info(TAG + "ImageRotation ROTATION_180 : " + cameraObj.ImageRotation.ROTATION_180); - expect(cameraObj.ImageRotation.ROTATION_180).assertEqual(180); - console.info(TAG + "ImageRotation ROTATION_270 : " + cameraObj.ImageRotation.ROTATION_270); - expect(cameraObj.ImageRotation.ROTATION_270).assertEqual(270); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_QUALITYLEVEL_0100 - * @tc.name : Quality Level ENAME - * @tc.desc : Quality Level ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_QUALITYLEVEL_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_QUALITYLEVEL_0100------------") - console.info(TAG + "QualityLevel QUALITY_LEVEL_HIGH : " + cameraObj.QualityLevel.QUALITY_LEVEL_HIGH); - expect(cameraObj.QualityLevel.QUALITY_LEVEL_HIGH).assertEqual(0); - console.info(TAG + "QualityLevel QUALITY_LEVEL_MEDIUM : " + cameraObj.QualityLevel.QUALITY_LEVEL_MEDIUM); - expect(cameraObj.QualityLevel.QUALITY_LEVEL_MEDIUM).assertEqual(1); - console.info(TAG + "QualityLevel QUALITY_LEVEL_LOW : " + cameraObj.QualityLevel.QUALITY_LEVEL_LOW); - expect(cameraObj.QualityLevel.QUALITY_LEVEL_LOW).assertEqual(2); - await sleep(1000); - done(); - }) - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100 - * @tc.name : CameraInputErrorCode ENAME - * @tc.desc : CameraInputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100 : " + cameraObj.CameraInputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.CameraInputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100 - * @tc.name : CaptureSessionErrorCode ENAME - * @tc.desc : CaptureSessionErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100 : " + cameraObj.CaptureSessionErrorCode.ERROR_UNKNOWN); - expect(cameraObj.CaptureSessionErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100 - * @tc.name : PreviewOutputErrorCode ENAME - * @tc.desc : PreviewOutputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100 : " + cameraObj.PreviewOutputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.PreviewOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100 - * @tc.name : PhotoOutputErrorCode ENAME - * @tc.desc : PhotoOutputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100 : " + cameraObj.PhotoOutputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.PhotoOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100 - * @tc.name : VideoOutputErrorCode ENAME - * @tc.desc : VideoOutputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100 : " + cameraObj.VideoOutputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.VideoOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets b/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets deleted file mode 100644 index 3b990e106f896ed54704bdb813583aa6c359e1fb..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets +++ /dev/null @@ -1,3606 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables -var camera0Input; -var camera1Input; -var cameraManager; -var previewOutputAsync; -var photoOutputAsync; -var captureSession; -var surfaceId1; -var camerasArray; - -var Point1 = { x: 1, y: 1 } -var Point2 = { x: 2, y: 2 } -var Point3 = { x: 3, y: 3 } - -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -export default function cameraJSUnitPhotoAsync(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJsUnitPhotoAsync', function () { - console.info(TAG + '----------CameraJsUnitPhotoAsync--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - console.info(TAG + "----------Camera-Precision Control-Async-------------"); - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Camera Manager success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering Camera Manager data is not null || undefined"); - cameraManager = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManager == null || cameraManager == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManager == null || undefined") - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate") - cameraManager.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManager is success"); - if (data != null || data != undefined) { - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Get camera from cameramanager to get array of camera async api - * @tc.desc : Get camera from cameramanager to get array of camera async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------"); - cameraManager.getCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering GetCameras success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering GetCameras data is not null || undefined"); - camerasArray = data; - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId; - console.info(TAG + "Entering GetCameras camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArray[i].cameraPosition; - console.info(TAG + "Entering GetCameras camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArray[i].cameraType; - console.info(TAG + "Entering GetCameras camera" + i + "Type: " + cameraType); - var connectionType = camerasArray[i].connectionType - console.info(TAG + "Entering GetCameras connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera0Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[0].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 - * @tc.name : Create camerainput from camera-1 cameraId async api - * @tc.desc : Create camerainput from camera-1 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200', 0, async function (done) { - cameraManager.createCameraInput(camerasArray[1].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 data is not null || undefined"); - camera1Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 PASSED with CameraID :" + camerasArray[1].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering CameraInputCallbackOnError cameraInput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 to operate"); - camera0Input.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "cameraInput error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - } - await sleep(1000); - done(); - }) - - /*PreviewOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 - * @tc.name : Create PreviewOutput instance api - * @tc.desc : Create PreviewOutput instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100', 0, async function (done) { - console.info(TAG + " Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 to operate"); - cameraObj.createPreviewOutput(surfaceId, async (err, data) => { - if (!err) { - console.info(TAG + " Entering createPreviewOutput success"); - if (data != null || data != undefined) { - console.info(TAG + " Entering createPreviewOutput data is not null || undefined"); - previewOutputAsync = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 PASSED" + previewOutputAsync); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 FAILED : " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 - * @tc.name : Preview output callback on error api - * @tc.desc : Preview output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering PreviewOutputError callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 to operate"); - previewOutputAsync.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 - * @tc.name : Create PhotoOutput instance api - * @tc.desc : Create PhotoOutput instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1000) - cameraObj.createPhotoOutput(surfaceId1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering createPhotoOutput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering createPhotoOutput data is not null || undefined"); - photoOutputAsync = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 to operate"); - photoOutputAsync.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error during PhotoOutput with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 - * @tc.name : Create CaptureSession instance api - * @tc.desc : Create CaptureSession instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 to operate"); - cameraObj.createCaptureSession(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering createCaptureSession success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering createCaptureSession data is not null || undefined"); - captureSession = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - //Capturesession callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 - * @tc.name : CaptureSession callback on error api - * @tc.desc : CaptureSession callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering captureSession error callback captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 to operate"); - captureSession.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 - * @tc.name : CaptureSession_Begin config api - * @tc.desc : CaptureSession_Begin config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering BeginConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 to operate"); - captureSession.beginConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering beginConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering BeginConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 beginConfig PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 - * @tc.name : Add Input with camera1Input api - * @tc.desc : Add Input with camera1Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering Addinput captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 to operate"); - captureSession.addInput(camera1Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddInput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddInput data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 addInput PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Preview captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 to operate"); - captureSession.addOutput(previewOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Preview : Success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Preview data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 to operate"); - captureSession.removeOutput(previewOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove preview Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove preview Output FAILED" + err.message); - console.info(TAG + "Entering Remove Preview Output ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Preview captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 to operate"); - captureSession.addOutput(previewOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Preview : Success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Preview data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CommitConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 to operate"); - captureSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering commitConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering CommitConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 to operate"); - photoOutputAsync.isMirrorSupported(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 to operate"); - photoOutputAsync.setMirror(true, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 - * @tc.name : setMirror false - * @tc.desc : setMirror false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 to operate"); - photoOutputAsync.setMirror(false, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 is success"); - console.info(TAG + "setMirror is : " + 'false'); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 - * @tc.name : CaptureSession_Begin config api - * @tc.desc : CaptureSession_Begin config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering BeginConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 to operate"); - captureSession.beginConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering beginConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering BeginConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 beginConfig PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 to operate"); - captureSession.removeInput(camera1Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove input success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove Input FAILED" + err.message); - console.info(TAG + "Entering Remove Input ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering Addinput captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 to operate"); - captureSession.addInput(camera0Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddInput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddInput data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 addInput PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 to operate"); - captureSession.removeOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove photo Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove photo Output FAILED" + err.message); - console.info(TAG + "Entering Remove photo Output ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CommitConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 to operate"); - captureSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering commitConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering CommitConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0Input.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0Input.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //preview callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering PreviewStart frameStart Callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 to operate"); - previewOutputAsync.on("frameStart", async (err, data) => { - if (!err) { - console.info(TAG + "PreviewStart frameStart Callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 FAILED : + err.message"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 - * @tc.name : Preview capture callback on frame end api - * @tc.desc : Preview capture callback on frame end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering PreviewOutput frameEnd Callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 to operate"); - previewOutputAsync.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 Callback is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 FAILED : + err.message"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering Photo Capture Callback on CaptureStart photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 to operate"); - photoOutputAsync.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "Photo Capture Callback on CaptureStart is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 to operate"); - photoOutputAsync.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 FAILED' + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 to operate"); - photoOutputAsync.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "frameShutter callback with captureId: " + data.captureId); - console.info(TAG + "frameShutter callback with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 - * @tc.name : capture session start api - * @tc.desc : capture session start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CaptureSession Start captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 to operate"); - captureSession.start(async (err, data) => { - if (!err) { - console.info(TAG + "Entering captureSession.start success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 PASSED"); - } - else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //Location - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - photoOutputAsync.capture(photosettings1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings1"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 - * @tc.name : Photo output capture with photosettings2 api - * @tc.desc : Photo output capture with photosettings2 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 to operate"); - photoOutputAsync.capture(photosettings2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings2 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 to operate"); - photoOutputAsync.capture(photosettings3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings3 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings3 data is not null || undefined"); - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 ends here"); - } - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS with Rotation-270 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 to operate"); - photoOutputAsync.capture(photosettings4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings4 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings4 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 ends here"); - } - }) - await sleep(1000); - done(); - } - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100', 0, async function (done) { - console.info(TAG + "hasFlash called.") - camera0Input.hasFlash(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 is: " + data); - expect(data).assertEqual(true); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 FAILED : " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 ends here"); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 success"); - if (data == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_ALWAYS_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 success"); - if (data == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check if flash mode auto is supported-camera0Input api - * @tc.desc : check if flash mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_AUTO SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 success"); - if (data == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_CLOSE SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 success"); - if (data == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 - * @tc.name : get zoom ratio camera-0 cameraId api - * @tc.desc : get zoom ratio camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100--------------"); - camera0Input.getZoomRatioRange(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 Success " + data) - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(1, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(2, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_0100 PASSED "); - } - else { - expect().assertFail(); - console.info(TAG + "GET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - } else { - expect().assertFail(); - console.info(TAG + "SET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(3, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(4, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(5, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(6, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 - * @tc.name : check if focus mode locked is supported-camera0Input api - * @tc.desc : check if focus mode locked is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Is Focus Mode Locked Supported SUCCESS: " + data); - if (data != null || data != undefined) { - console.info(TAG + "Entering Is Focus Mode Locked Supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_LOCKED_SUPPORTED is: " + data); - expect(data).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 FAILED :" + err.message); - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Mode Locked SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 FAILED : ") - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Mode Locked SUCCESS: " + data); - console.info(TAG + "Get Focus Mode Locked data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 - * @tc.name : get focal length camera0 api - * @tc.desc : get focal length camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 to operate"); - camera0Input.getFocalLength(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focal length SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focal length is: " + JSON.stringify(data)); - expect(data).assertEqual(3.4600000381469727); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_FOCUS_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_FOCUS_0100', 0, async function (done) { - console.info(TAG + "Entering SET_FOCUS_POINT to operate"); - camera0Input.setFocusPoint(Point1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SET_FOCUS_POINT PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SET_FOCUS_POINT FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SET_FOCUS_POINT ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_FOCUS_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_FOCUS_0100', 0, async function (done) { - console.info(TAG + "Entering GET_FOCUS_POINT to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "GET_FOCUS_POINT PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "GET_FOCUS_POINT FAILED : " + err.message); - console.info(TAG + "GET_FOCUS_POINT ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 - * @tc.name : check if focus mode manual is supported-camera0Input api - * @tc.desc : check if focus mode manual is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 FAILED " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 - * @tc.name : set focus Point locked camera0 api - * @tc.desc : set focus Point locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 to operate"); - camera0Input.setFocusPoint(Point2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 - * @tc.name : check if focus mode continuous is supported-camera0Input api - * @tc.desc : check if focus mode continuous is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINOUS_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 to operate"); - camera0Input.setFocusPoint(Point3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : GET_FOCUS_POINT_focus mode auto - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check if focus mode auto is supported-camera0Input api - * @tc.desc : check if focus mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_AUTO_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (data != null || data != undefined) { - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 PASSED") - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 to operate"); - camera0Input.getExposureBiasRange(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias range SUCCESS"); - console.info(TAG + "Current Exposure bias range is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 -4 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 to operate"); - camera0Input.setExposureBias(-4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 mode locked - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 mode auto - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 to operate"); - camera0Input.setExposurePoint(Point1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 mode auto - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure Mode SUCCESS"); - console.info(TAG + "Get Exposure Mode data is not null || undefined: "); - console.info(TAG + "Current ExposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 mode auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 to operate"); - camera0Input.setExposureBias(1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "1"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 mode auto - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 to operate"); - camera0Input.setExposurePoint(Point2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - photoOutputAsync.capture(photosettings1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings1"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 mode auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 to operate"); - camera0Input.setExposureBias(4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 mode continuous auto - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 to operate"); - camera0Input.setExposurePoint(Point3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 to operate"); - photoOutputAsync.capture(photosettings2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings2"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 -5 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 to operate"); - camera0Input.setExposureBias(-5, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 mode locked - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 6 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 to operate"); - camera0Input.setExposureBias(6, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 - * @tc.name : capture session stop api - * @tc.desc : capture session stop api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 to operate"); - captureSession.stop(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 captureSession.stop success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering captureSession.stop data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 captureSession.stop PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 - * @tc.name : capture session release api - * @tc.desc : capture session release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 to operate"); - captureSession.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering captureSession.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering captureSession.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 ends here"); - await sleep(1000); - done(); - } - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 - * @tc.name : photoOutput release api - * @tc.desc : photoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 photoOutputAsync == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 to operate"); - photoOutputAsync.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutputAsync.release success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 FAILED: " + err.message); - console.info(TAG + "Entering photoOutputAsync.release ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 - * @tc.name : previewOutput release api - * @tc.desc : previewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 previewOutputAsync == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 to operate"); - previewOutputAsync.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering previewOutputAsync.release success"); - console.info(TAG + "Entering previewOutputAsync.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 ends here"); - await sleep(1000); - done(); - } - }) - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 - * @tc.name : camera Input release api - * @tc.desc : camera Input release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 camera0Input == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 to operate"); - camera0Input.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering camera0Input.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering camera0Input.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - }) - await sleep(1000); - done(); - } - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets b/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets deleted file mode 100644 index c14442e53bbb82953bb57518e61b1a76791d112c..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets +++ /dev/null @@ -1,3283 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables -var camera0InputPromise; -var cameraManagerPromise; -var previewOutputPromise; -var photoOutputPromise; -var CaptureSessionPromise; -var surfaceId1; -var camerasArrayPromise -var camera1InputPromise; - -var Point1 = { x: 1, y: 1 } -var Point2 = { x: 2, y: 2 } -var Point3 = { x: 3, y: 3 } - -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -export default function cameraJSUnitPhotoPromise(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJsUnitPhotoPromise', function () { - console.info(TAG + '----------CameraJsUnitPhotoPromise--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - console.info(TAG + "----------Camera-PhotoMode-Promise-------------"); - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------"); - cameraManagerPromise = await cameraObj.getCameraManager(null); - console.info(TAG + "Entering Get camera manager cameraManagerPromise: " + JSON.stringify(cameraManagerPromise)); - if (cameraManagerPromise != null && cameraManagerPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManagerPromise == null || cameraManagerPromise == undefined) { - console.info(TAG + 'Entering camera status callback cameraManagerPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate') - cameraManagerPromise.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManagerPromise is success"); - if (data != null || data != undefined) { - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 - * @tc.name : Get camera from cameramanager to get array of camera promise api - * @tc.desc : Get camera from cameramanager to get array of camera promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100--------------"); - camerasArrayPromise = await cameraManagerPromise.getCameras(); - console.info(TAG + "Entering Get Cameras: " + JSON.stringify(camerasArrayPromise)); - if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { - console.info(TAG + "Entering Get Cameras success"); - for (var i = 0; i < camerasArrayPromise.length; i++) { - // Get the variables from camera object - var cameraId = camerasArrayPromise[i].cameraId; - console.info(TAG + "Entering Get Cameras camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArrayPromise[i].cameraPosition; - console.info(TAG + "Entering Get Cameras camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArrayPromise[i].cameraType; - console.info(TAG + "Entering Get Cameras camera" + i + "Type: " + cameraType); - var connectionType = camerasArrayPromise[i].connectionType - console.info(TAG + "Entering Get Cameras connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraId promise api - * @tc.desc : Create camerainput from camera-0 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------CAMERA-0 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera0InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraId); - console.info(TAG + "Entering Create camerainput camera0InputPromise: " + JSON.stringify(camera0InputPromise)); - if (camera0InputPromise != null && camera0InputPromise != undefined) { - console.info(TAG + "Entering Create camerainput camera0InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 - * @tc.name : Create camerainput from camera-1 cameraId promise api - * @tc.desc : Create camerainput from camera-1 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200--------------"); - camera1InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[1].cameraId); - console.info(TAG + "Entering Create camerainput camera1InputPromise: " + JSON.stringify(camera1InputPromise)); - if (camera1InputPromise != null && camera1InputPromise != undefined) { - console.info(TAG + "Entering Create camerainput camera1InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 to operate"); - camera0InputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "camera0InputPromise error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error during camera0InputPromise with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*PreviewOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Create PreviewOutput instance promise api - * @tc.desc : Create PreviewOutput instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - console.info(TAG + " Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - previewOutputPromise = await cameraObj.createPreviewOutput(surfaceId); - console.info(TAG + " Entering createPreviewOutput success"); - if (previewOutputPromise != null || previewOutputPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering createPreviewOutput PASSED: " + JSON.stringify(previewOutputPromise)); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 - * @tc.name : Preview output callback on error api - * @tc.desc : Preview output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview output callback on error previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 to operate"); - previewOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Create PhotoOutput instance promise api - * @tc.desc : Create PhotoOutput instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1000) - photoOutputPromise = await cameraObj.createPhotoOutput(surfaceId1); - console.info(TAG + "Entering createPhotoOutput success"); - if (photoOutputPromise != null || photoOutputPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output callback on error photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 to operate"); - photoOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 - * @tc.name : Create CaptureSession instance promise api - * @tc.desc : Create Capturesession instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 to operate"); - CaptureSessionPromise = await cameraObj.createCaptureSession(null); - console.info(TAG + "Entering createCaptureSession success"); - if (CaptureSessionPromise != null || CaptureSessionPromise != undefined) { - console.info(TAG + "Entering createCaptureSession data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - //Capturesession callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 - * @tc.name : CaptureSession callback on error api - * @tc.desc : CaptureSession callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering CaptureSession callback on error captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 to operate"); - CaptureSessionPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession errorcallback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 - * @tc.name : CaptureSession_Begin config promise api - * @tc.desc : CaptureSession_Begin config promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering CaptureSession_Begin config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 to operate"); - const promise = await CaptureSessionPromise.beginConfig(); - console.info(TAG + "Entering beginConfig success:"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 beginConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add Input captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 to operate"); - const Promise = await CaptureSessionPromise.addInput(camera1InputPromise); - console.info(TAG + "Entering Add Input addInput success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add preview Output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 to operate"); - const promise = await CaptureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering Add preview Output : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Remove preview Output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 to operate"); - const Promise = await CaptureSessionPromise.removeOutput(previewOutputPromise); - console.info(TAG + "Entering Remove preview Output success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add preview Output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 to operate"); - const promise = await CaptureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering Add preview Output : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering commit config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 to operate"); - const promise = await CaptureSessionPromise.commitConfig(); - console.info(TAG + "Entering commit config commitConfig success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 commitConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 commitConfig FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 commitConfig ends here"); - } - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 to operate"); - await photoOutputPromise.isMirrorSupported() - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 FAILED : " + err.message); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 to operate"); - await photoOutputPromise.setMirror(true).then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 FAILED : " + err.message); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 - * @tc.name : setMirror false - * @tc.desc : setMirror false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 to operate"); - await photoOutputPromise.setMirror(false) - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'false'); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 FAILED : " + err.message); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100 - * @tc.name : CaptureSession_Begin config promise api - * @tc.desc : CaptureSession_Begin config promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100 to operate"); - const promise = await CaptureSessionPromise.beginConfig(); - console.info(TAG + "Entering beginConfig success:"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100 beginConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering beginConfig FAILED"); - } - console.info(TAG + "Entering beginConfig ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 to operate"); - const Promise = await CaptureSessionPromise.removeInput(camera1InputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add Input captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 to operate"); - const Promise = await CaptureSessionPromise.addInput(camera0InputPromise); - console.info(TAG + "Entering Add Input addInput success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add output with photo output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 to operate"); - const promise = await CaptureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering Add output with photo output success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 to operate"); - const Promise = await CaptureSessionPromise.removeOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 addInput success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 to operate"); - const promise = await CaptureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering commit config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 to operate"); - const promise = await CaptureSessionPromise.commitConfig(); - console.info(TAG + "Entering commit config commitConfig success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 commitConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 commitConfig FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 commitConfig ends here"); - } - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0InputPromise.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0InputPromise.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - // callback related API - //preview callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview output callback on frame start previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 to operate"); - previewOutputPromise.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 FAILED :" + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 - * @tc.name : Preview capture callback on frame end api - * @tc.desc : Preview capture callback on frame end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview capture callback on frame end previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 to operate"); - previewOutputPromise.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 FAILED : + err.message"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture start photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 to operate"); - photoOutputPromise.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "CaptureStart Callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture end photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 to operate"); - photoOutputPromise.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 FAILED' + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on frame shutter photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 to operate"); - photoOutputPromise.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 with captureId: " + data.captureId); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 - * @tc.name : capture session start api - * @tc.desc : capture session start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering capture session start captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 to operate"); - await CaptureSessionPromise.start(); - console.info(TAG + "Entering captureSession start success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - //Location - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - await photoOutputPromise.capture(photosettings1) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 FAILED:" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 to operate"); - await photoOutputPromise.capture(photosettings2) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 FAILED:" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 to operate"); - await photoOutputPromise.capture(photosettings3) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings3 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 :" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 to operate"); - await photoOutputPromise.capture(photosettings4) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings4 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100--------------"); - console.info(TAG + 'hasFlash called.') - var hasFlashPromise = await camera0InputPromise.hasFlash(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 success"); - if (hasFlashPromise != null || hasFlashPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 is: " + JSON.stringify(hasFlashPromise)); - expect(hasFlashPromise).assertEqual(true); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 FAILED : "); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 ends here"); - await sleep(1000) - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 to operate"); - var isFMOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 SUCCESS "); - if (isFMOpenSupported != null || isFMOpenSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + JSON.stringify(isFMOpenSupported)); - expect(isFMOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 to operate"); - var SetFMOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMOpen)) - if (SetFMOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 to operate"); - var GetFMOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 success: " + JSON.stringify(GetFMOpen)); - if (GetFMOpen == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + JSON.stringify(GetFMOpen)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 to operate"); - var isFMAlwaysOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 SUCCESS "); - if (isFMAlwaysOpenSupported != null || isFMAlwaysOpenSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + isFMAlwaysOpenSupported); - expect(isFMAlwaysOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - var SetFMAlwaysOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMAlwaysOpen)) - if (SetFMAlwaysOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - var GetFMAlwaysOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 success"); - if (GetFMAlwaysOpen == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAlwaysOpen); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 to operate"); - var isFMAutoSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 SUCCESS "); - if (isFMAutoSupported != null || isFMAutoSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_AUTO data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + isFMAutoSupported); - expect(isFMAutoSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 to operate"); - var SetFMAlwaysAuto = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "SetFMAlwaysAuto: " + JSON.stringify(SetFMAlwaysAuto)) - if (SetFMAlwaysAuto == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 to operate"); - var GetFMAuto = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 success"); - if (GetFMAuto == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAuto); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 to operate"); - var isFMCloseSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 SUCCESS "); - if (isFMCloseSupported != null || isFMCloseSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + isFMCloseSupported); - expect(isFMCloseSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 to operate"); - var SetFMClose = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMClose)) - if (SetFMClose == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 - * @tc.name : get flash mode close camera0 api - * @tc.desc : get flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 to operate"); - var GetFMClose = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 success"); - if (GetFMClose == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMClose); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - //ZOOM Function - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 - * @tc.name : get zoom ratio camera-0 cameraId api promise api - * @tc.desc : get zoom ratio camera-0 cameraId api promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100--------------"); - var getZoomRatioPromise = await camera0InputPromise.getZoomRatioRange(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 getZoomRatioPromise: " + JSON.stringify(getZoomRatioPromise)); - if (getZoomRatioPromise != null && getZoomRatioPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 setZoomRatioPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 success: " + JSON.stringify(getZoomRatioPromise)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(1); - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - var getpromise1 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise1); - if (getpromise1 != null && getpromise1 != undefined) { - expect(getpromise1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(2); - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - var getpromise2 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise2); - if (getpromise2 != null && getpromise2 != undefined) { - expect(getpromise2).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(3); - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - var getpromise3 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise3); - if (getpromise3 != null && getpromise3 != undefined) { - expect(getpromise3).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(4); - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - var getpromise4 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise4); - if (getpromise4 != null && getpromise4 != undefined) { - expect(getpromise4).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(5); - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - var getpromise5 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise5); - if (getpromise5 != null && getpromise5 != undefined) { - expect(getpromise5).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(6); - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - var getpromise6 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise6); - if (getpromise6 != null && getpromise6 != undefined) { - expect(getpromise6).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - // FOCUS promise API's - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 - * @tc.name : check is focus mode locked supported-camera0Input api - * @tc.desc : check is focus mode locked supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 to operate"); - var isFMLockedSupported = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering is focus mode locked supported SUCCESS "); - if (isFMLockedSupported != null || isFMLockedSupported != undefined) { - console.info(TAG + "Entering is focus mode locked supported data is not null || undefined"); - console.info(TAG + "is focus mode locked supported : " + isFMLockedSupported); - expect(isFMLockedSupported).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED) - .then(function (data) { - console.info(TAG + "SetFMLocked: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode locked SUCCESS, current focusmode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 FAILED : ") - expect().assertFail(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode locked success: "); - if (data == 0) { - console.info(TAG + "Current focusmode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 - * @tc.name : get focal length camera0 api - * @tc.desc : get focal length camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 to operate"); - await camera0InputPromise.getFocalLength() - .then(function (data) { - console.info(TAG + "Current focallength is: " + JSON.stringify(data)); - expect(data).assertEqual(3.4600000381469727); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 - * @tc.name : is focusmode manual supported - * @tc.desc : is focusmode manual supported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 to operate"); - var isFMmanualSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL); - if (isFMmanualSupportedpromise != null || isFMmanualSupportedpromise != undefined) { - console.info(TAG + "Entering is focusmode manual supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMmanualSupportedpromise); - expect(isFMmanualSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL) - .then(function (data) { - console.info(TAG + "setFocusManual: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode manual SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode manual SUCCESS"); - if (data == 0) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 FAILED " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 - * @tc.name : check is focus mode continuous supported-camera0Input api - * @tc.desc : check is focus mode continuous supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 to operate"); - var isFMContinuousSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - if (isFMContinuousSupportedpromise != null || isFMContinuousSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode continuous supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINUOUS_SUPPORTED is: " + isFMContinuousSupportedpromise); - expect(isFMContinuousSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) - .then(function (data) { - console.info(TAG + "setFocusCont: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode continuous SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode continuous SUCCESS"); - if (data == 1) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check is focus mode auto supported-camera0Input api - * @tc.desc : check is focus mode auto supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 to operate"); - var isFMAutoSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (isFMAutoSupportedpromise != null || isFMAutoSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode auto supported data is not null || undefined"); - console.info(TAG + "is focus mode auto supported is: " + isFMAutoSupportedpromise); - expect(isFMAutoSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 to operate"); - var setFocusAuto = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO) - .then(function () { - console.info(TAG + "setFocusAuto: " + JSON.stringify(setFocusAuto)) - console.info(TAG + "Entering set focus mode auto SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode auto SUCCESS " + JSON.stringify(data)); - if (data == 2) { - console.info(TAG + "Current FocusMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 PASSED"); - } - }) - .catch((err) => { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode locked SUCCESS"); - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 to operate"); - await camera0InputPromise.getExposureBiasRange() - .then(function (data) { - console.info(TAG + "Entering getExposureBiasRange SUCCESS"); - console.info(TAG + "Current ExposureBiasRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100-4 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 to operate"); - await camera0InputPromise.setExposureBias(-4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 to operate"); - await camera0InputPromise.setExposurePoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 FAILED: " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 to operate"); - await camera0InputPromise.setExposureBias(1) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "1"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 to operate"); - await camera0InputPromise.setExposurePoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 to operate"); - await photoOutputPromise.capture(photosettings1) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with Rotation-0 & Quality-0 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 FAILED:" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 to operate"); - await camera0InputPromise.setExposureBias(4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 to operate"); - await camera0InputPromise.setExposurePoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - await photoOutputPromise.capture(photosettings2) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with location settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400-5 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 to operate"); - await camera0InputPromise.setExposureBias(-5) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 to operate"); - await camera0InputPromise.setExposureBias(6) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 ends here"); - await sleep(1000); - done(); - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 - * @tc.name : capture session stop api - * @tc.desc : capture session stop api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering capture session stop captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 to operate"); - await CaptureSessionPromise.stop(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 captureSession.stop PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 captureSession.stop ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : capture session release api - * @tc.desc : capture session release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering capture session release captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await CaptureSessionPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : PreviewOutput release api - * @tc.desc : PreviewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering previewOutputPromise.release previewOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await previewOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : PhotoOutput release api - * @tc.desc : PhotoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering PhotoOutput release photoOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await photoOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : cameraInput release api - * @tc.desc : cameraInput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering cameraInput release camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await camera0InputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - }); -} \ No newline at end of file diff --git a/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets b/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets deleted file mode 100644 index 571ca690ff89ac2fbd3becb18f81fc97bc447bf8..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets +++ /dev/null @@ -1,3800 +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 cameraObj from '@ohos.multimedia.camera'; -import media from '@ohos.multimedia.media' -import image from '@ohos.multimedia.image'; -import mediaLibrary from '@ohos.multimedia.mediaLibrary' -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' - -// @ts-nocheck -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -let TAG = "CameraModuleTest: "; -var cameraManager -var camerasArray -var camera0Input -var previewOutput -var photoOutputAsync -var videoRecorder -var surfaceId1 - -var minFrameRate_Grp0=12; -var maxFrameRate_Grp0=12; -var minFrameRate_Mix=14; -var maxFrameRate_Mix=15; -var minFrameRate_Err1=11; -var maxFrameRate_Err1=31; -var minFrameRate_Err2=14; -var maxFrameRate_Err2=28; -var minFrameRate_Err3=16; -var maxFrameRate_Err3=25; -var minFrameRate_Grp20=30; -var maxFrameRate_Grp20=30; - -var Point = { x: 1, y: 1 } -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -let fdPath; -let fileAsset; -let fdNumber; -let configFile = { - audioBitrate: 48000, - audioChannels: 2, - audioCodec: 'audio/mp4a-latm', - audioSampleRate: 48000, - durationTime: 1000, - fileFormat: 'mp4', - videoBitrate: 48000, - videoCodec: 'video/mp4v-es', - videoFrameWidth: 640, - videoFrameHeight: 480, - videoFrameRate: 30 -} - -let videoConfig = { - audioSourceType: 1, - videoSourceType: 0, - profile: configFile, - url: 'file:///data/media/02.mp4', - orientationHint: 0, - location: { latitude: 30, longitude: 130 }, - maxSize: 100, - maxDuration: 500 -} -var videoId -var videoOutput -var captureSession - -export default function cameraJSUnitVideoAsync(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(time) { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(1) - }, time * 1000) - }).then(() => { - console.info(`sleep ${time} over...`) - }) - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - async function getFd(pathName) { - let displayName = pathName; - const mediaTest = mediaLibrary.getMediaLibrary(); - let fileKeyObj = mediaLibrary.FileKey; - let mediaType = mediaLibrary.MediaType.VIDEO; - let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); - let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); - if (dataUri != undefined) { - let args = dataUri.id.toString(); - let fetchOp = { - selections: fileKeyObj.ID + "=?", - selectionArgs: [args], - } - let fetchFileResult = await mediaTest.getFileAssets(fetchOp); - fileAsset = await fetchFileResult.getAllObject(); - fdNumber = await fileAsset[0].open('Rw'); - fdPath = "fd://" + fdNumber.toString(); - } - } - - async function closeFd() { - if (fileAsset != null) { - await fileAsset[0].close(fdNumber).then(() => { - console.info('[mediaLibrary] case close fd success'); - }).catch((err) => { - console.info('[mediaLibrary] case close fd failed'); - }); - } else { - console.info('[mediaLibrary] case fileAsset is null'); - } - } - - async function getvideosurface() { - await getFd('02.mp4'); - videoConfig.url = fdPath; - media.createVideoRecorder((err, recorder) => { - console.info(TAG + 'createVideoRecorder called') - videoRecorder = recorder - console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder)) - console.info(TAG + 'videoRecorder.prepare called.') - videoRecorder.prepare(videoConfig, (err) => { - console.info(TAG + 'videoRecorder.prepare success.') - }) - videoRecorder.getInputSurface((err, id) => { - console.info(TAG + 'getInputSurface called') - videoId = id - console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoId)) - }) - }) - } - - describe('VideoModeAsync', function () { - console.info(TAG + '----------Camera-VideoMode-Async--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5); - console.info('beforeEach case'); - }) - - afterEach(async function () { - await closeFd(); - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100--------------') - await sleep(1) - cameraObj.getCameraManager(null, (err, data) => { - if (!err) { - console.info(TAG + 'Entering Get Camera manager success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Get Camera Manager data is not null || undefined') - cameraManager = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 PASSED') - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManager == null || cameraManager == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManager == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate') - cameraManager.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManager is success"); - if (data != null || data != undefined) { - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Camera status Callback FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------') - await sleep(1) - cameraManager.getCameras((err, data) => { - if (!err) { - console.info(TAG + 'Entering Get Cameras success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Get Cameras data is not null || undefined') - camerasArray = data - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId - console.info(TAG + 'Entering Get Cameras camera' + i + 'Id: ' + cameraId) - var cameraPosition = camerasArray[i].cameraPosition - console.info(TAG + 'Entering Get Cameras camera' + i + 'Position: ' + cameraPosition) - var cameraType = camerasArray[i].cameraType - console.info(TAG + 'Entering Get Cameras camera' + i + 'Type: ' + cameraType) - var connectionType = camerasArray[i].connectionType - console.info(TAG + 'Entering Get Cameras connection' + i + 'Type: ' + connectionType) - } - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined') - } - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info('--------------CAMERA-0 STARTS HERE--------------') - console.info('--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------') - await sleep(1) - cameraManager.createCameraInput(camerasArray[0].cameraId, (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + 'Entering Create camera input data is not null || undefined') - camera0Input = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :' + camerasArray[0].cameraId) - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering Camera Input callback camera0Input == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 to operate"); - camera0Input.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "camera0Input error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 - * @tc.name : Create previewoutput async api - * @tc.desc : Create previewoutput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 to operate') - await sleep(1) - cameraObj.createPreviewOutput(surfaceId, (err, data) => { - if (!err) { - console.info(TAG + 'Entering Create preview output success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Create preview output data is not null || undefined') - previewOutput = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 PASSED') - } - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Preview output callback on error api - * @tc.desc : Preview output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering PreviewOutput callback on error previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 to operate"); - previewOutput.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Create PhotoOutput instance api - * @tc.desc : Create PhotoOutput instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1) - cameraObj.createPhotoOutput(surfaceId1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering createPhotoOutput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering createPhotoOutput data is not null || undefined"); - photoOutputAsync = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate"); - photoOutputAsync.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error during PhotoOutput with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 - * @tc.name : Create videooutput async api - * @tc.desc : Create videooutput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 to operate') - await getvideosurface() - await sleep(2) - cameraObj.createVideoOutput(videoId, (err, data) => { - if (!err) { - console.info(TAG + 'Entering Create videooutput success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Create videooutput data is not null || undefined') - videoOutput = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 PASSED') - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : VideoOutput callback onerror async api - * @tc.desc : VideoOutput callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 videoOutput == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - videoOutput.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "VideoOutput Errorcallback is success") - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1) - done() - }) - await sleep(1) - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 - * @tc.name : Create capturesession async api - * @tc.desc : Create capturesession async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 to operate') - await sleep(1) - cameraObj.createCaptureSession(null, async (err, data) => { - if (!err) { - console.info(TAG + 'Entering Create capturesession success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Create capturesession data is not null || undefined') - captureSession = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 PASSED') - } - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail() - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 - * @tc.name : CaptureSession callback on error api - * @tc.desc : CaptureSession callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 to operate"); - captureSession.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession errorcallback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 - * @tc.name : Begin Config async api - * @tc.desc : Begin Config async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering Begin Config captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 to operate') - await sleep(1) - captureSession.beginConfig((err, data) => { - if (!err) { - console.info(TAG + 'Entering Begin Config success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 - * @tc.name : AddInput async api - * @tc.desc : AddInput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddInput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 to operate') - await sleep(1) - captureSession.addInput(camera0Input, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddInput success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 - * @tc.name : AddOutput preview async api - * @tc.desc : AddOutput preview async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput preview captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 to operate') - await sleep(1) - captureSession.addOutput(previewOutput, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput preview success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 ends here"); - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 - * @tc.name : AddOutput video async api - * @tc.desc : AddOutput video async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput video captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 to operate') - await sleep(1) - captureSession.addOutput(videoOutput, async (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput video success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 ends here') - await sleep(1); - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeInput(camera0Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove input success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering Remove Input FAILED" + err.message); - console.info(TAG + "Entering Remove Input ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeOutput(previewOutput, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove preview Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering Remove preview Output FAILED" + err.message); - console.info(TAG + "Entering Remove Preview Output ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove photo Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove photo Output FAILED" + err.message); - console.info(TAG + "Entering Remove photo Output ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Remove video Output api - * @tc.desc : Remove video Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeOutput(videoOutput, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove video Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering Remove video Output FAILED" + err.message); - console.info(TAG + "Entering Remove video Output ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 - * @tc.name : AddInput async api - * @tc.desc : AddInput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddInput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 to operate') - await sleep(1) - captureSession.addInput(camera0Input, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddInput success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 - * @tc.name : AddOutput preview async api - * @tc.desc : AddOutput preview async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 to operate') - await sleep(1) - captureSession.addOutput(previewOutput, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput success') - console.info(TAG + 'Entering AddOutput data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 ends here"); - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 - * @tc.name : AddOutput video async api - * @tc.desc : AddOutput video async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 to operate') - await sleep(1) - captureSession.addOutput(videoOutput, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput success') - console.info(TAG + 'Entering AddOutput data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 ends here') - done() - }) - await sleep(1) - done() - } - }) - - //framerate - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 - * @tc.name : get frame rate range camera0 api - * @tc.desc : get frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 to operate"); - videoOutput.getFrameRateRange(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get frame rate range success"); - expect(true).assertTrue(); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Grp0,maxFrameRate_Grp0, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range PASSED") - expect(true).assertTrue(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Mix,maxFrameRate_Mix, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED") - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api_err - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Err1,maxFrameRate_Err1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED") - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Err2,maxFrameRate_Err2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED"); - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Err3,maxFrameRate_Err3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED"); - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Grp20,maxFrameRate_Grp20, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range PASSED") - expect(true).assertTrue(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeOff - * @tc.desc : getVideoStabilizationModeOff async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode Off success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeLow - * @tc.desc : getVideoStabilizationModeLOw async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode low success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(1) - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeMedium - * @tc.desc : getVideoStabilizationModeMedium async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode medium success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeHigh - * @tc.desc : getVideoStabilizationModeHigh async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode High success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeAuto - * @tc.desc : getVideoStabilizationModeAuto async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode Auto success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 - * @tc.name : CommitConfig async api - * @tc.desc : CommitConfig async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering CommitConfig captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 to operate') - await sleep(1) - captureSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + 'Entering CommitConfig success') - console.info(TAG + 'Entering CommitConfig data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0Input.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0Input.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //callback API - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering Preview output callback on frame start previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate"); - previewOutput.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : Preview capture callback on frame end api - * @tc.desc : Preview capture callback on frame end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering Preview capture callback on frame end previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate"); - previewOutput.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering Photo Capture Callback on CaptureStart photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 to operate"); - photoOutputAsync.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "Photo Capture Callback on CaptureStart is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 to operate"); - photoOutputAsync.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 FAILED' + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 to operate"); - photoOutputAsync.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "frameShutter callback with captureId: " + data.captureId); - console.info(TAG + "frameShutter callback with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : VideoOutput callback onframestart async api - * @tc.desc : VideoOutput callback onframestart async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + "Entering VideoOutput callback onframestart videoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate"); - videoOutput.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 is FAILED : " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : VideoOutput callback onframeend async api - * @tc.desc : VideoOutput callback onframeend async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + 'Entering VideoOutput callback onframeend videoOutput == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate') - await sleep(1) - videoOutput.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 is success'); - if (data != null || data != undefined) { - expect(true).assertTrue() - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED' + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 - * @tc.name : CaptureSession start async api - * @tc.desc : CaptureSession start async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CaptureSession start captureSession == null || undefined") - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 to operate") - await sleep(1) - captureSession.start(async (err, data) => { - if (!err) { - console.info(TAG + "Entering CaptureSession start success") - expect(true).assertTrue() - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 PASSED") - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "hasFlash called.") - camera0Input.hasFlash(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 is: " + data); - expect(data).assertEqual(true); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 ends here"); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 success"); - if (data == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_ALWAYS_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 success"); - if (data == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode auto is supported-camera0Input api - * @tc.desc : check if flash mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_AUTO SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 success"); - if (data == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_CLOSE SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 success"); - if (data == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 - * @tc.name : get zoom ratio camera-0 cameraId api - * @tc.desc : get zoom ratio camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100--------------"); - camera0Input.getZoomRatioRange(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 Success " + data) - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 ends here"); - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(1, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(2, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_CALLBACK_0100 PASSED "); - } - else { - expect().assertFail(); - console.info(TAG + "GET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - } else { - expect().assertFail(); - console.info(TAG + "SET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(3, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(4, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(5, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(6, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode locked is supported-camera0Input api - * @tc.desc : check if focus mode locked is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Is Focus Mode Locked Supported SUCCESS: " + data); - if (data != null || data != undefined) { - console.info(TAG + "Entering Is Focus Mode Locked Supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_LOCKED_SUPPORTED is: " + data); - expect(data).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 FAILED :" + err.message); - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Mode Locked SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 FAILED : ") - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Mode Locked SUCCESS: " + data); - console.info(TAG + "Get Focus Mode Locked data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode manual is supported-camera0Input api - * @tc.desc : check if focus mode manual is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 FAILED " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 to operate"); - camera0Input.setFocusPoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode continuous is supported-camera0Input api - * @tc.desc : check if focus mode continuous is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINOUS_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 - * @tc.name : set focus Point locked camera0 api - * @tc.desc : set focus Point locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 to operate"); - camera0Input.setFocusPoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode auto is supported-camera0Input api - * @tc.desc : check if focus mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_AUTO_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (data != null || data != undefined) { - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 PASSED") - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 to operate"); - camera0Input.setFocusPoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 to operate"); - camera0Input.setExposurePoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100_exposure mode continuous auto - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 to operate"); - camera0Input.getExposureBiasRange(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias range SUCCESS"); - console.info(TAG + "Current Exposure bias range is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 to operate"); - camera0Input.setExposureBias(-4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure Mode SUCCESS"); - console.info(TAG + "Get Exposure Mode data is not null || undefined: "); - console.info(TAG + "Current ExposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 to operate"); - camera0Input.setExposurePoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 to operate"); - camera0Input.setExposureBias(1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "1"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 to operate"); - camera0Input.setExposurePoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 to operate"); - camera0Input.setExposureBias(4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100 to operate"); - photoOutputAsync.isMirrorSupported(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100 to operate"); - photoOutputAsync.setMirror(true, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 - * @tc.name : VideoOutput start async api - * @tc.desc : VideoOutput start async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 videoOutput == null || undefined") - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 to operate") - await sleep(1) - videoOutput.start(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 success: " + JSON.stringify(data)) - if (data == undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 FAILED: " + err.message) - } - }) - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 - * @tc.name : VideoRecorder start async api - * @tc.desc : VideoRecorder start async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100', 0, async function (done) { - if (videoRecorder == null || videoRecorder == undefined) { - console.info(TAG + 'Entering VideoRecorder start videoRecorder == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 to operate') - videoRecorder.start() - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 called'); - sleep(3); - console.info(TAG + 'Capture with photosettings1 during video - Start & setMirror: true') - photoOutputAsync.capture(photosettings1) - console.info(TAG + 'Capture during Video - End.') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 - * @tc.name : VideoOutput stop async api - * @tc.desc : VideoOutput stop async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + 'Entering VideoOutput stop videoOutput == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 to operate') - videoOutput.stop(async (err, data) => { - if (!err) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 success: ' + JSON.stringify(data)) - if (data == undefined) { - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100 - * @tc.name : VideoRecorder stop async api - * @tc.desc : VideoRecorder stop async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100', 0, async function (done) { - if (videoRecorder == null || videoRecorder == undefined) { - console.info(TAG + 'Entering VideoRecorder stop videoRecorder == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100 to operate') - videoRecorder.stop() - console.info(TAG + 'VideoRecorder stop stopVideo done.') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100 PASSED') - expect(true).assertTrue() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 - * @tc.name : CaptureSession stop async api - * @tc.desc : CaptureSession stop async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering CaptureSession stop captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 to operate') - await sleep(1) - captureSession.stop((err, data) => { - if (!err) { - console.info(TAG + 'Entering CaptureSession stop success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 - * @tc.name : CaptureSession release async api - * @tc.desc : CaptureSession release async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering CaptureSession release captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 to operate') - await sleep(1) - captureSession.release(async (err, data) => { - if (!err) { - console.info(TAG + 'Entering CaptureSession release success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering CaptureSession release data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 PASSED') - } - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 - * @tc.name : videooutput release api - * @tc.desc : videooutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + "Entering videooutput.release previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 to operate"); - videoOutput.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering videooutput.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering videooutput.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 ends here"); - await sleep(1); - done(); - } - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 - * @tc.name : previewOutput release api - * @tc.desc : previewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 to operate"); - previewOutput.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering previewOutput.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering previewOutput.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering previewOutput.release PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering previewOutput.release ends here"); - await sleep(1); - done(); - } - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 - * @tc.name : photoOutput release api - * @tc.desc : photoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 photoOutputAsync == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 to operate"); - photoOutputAsync.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutputAsync.release success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering photoOutputAsync.release ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 - * @tc.name : camera Input release api - * @tc.desc : camera Input release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering camera0Input.release camera0Input == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 to operate"); - camera0Input.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering camera0Input.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering camera0Input.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 ends here"); - await sleep(1); - done(); - } - }) - await sleep(1); - done(); - } - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets b/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets deleted file mode 100644 index aa4466c90fbcc0482aff18bd91e25e3ae39d7b27..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraExceedWideAngle/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets +++ /dev/null @@ -1,3367 +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 cameraObj from '@ohos.multimedia.camera' -import media from '@ohos.multimedia.media' -import image from '@ohos.multimedia.image'; -import mediaLibrary from '@ohos.multimedia.mediaLibrary' -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' - -// @ts-nocheck -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -let TAG = 'CameraModuleTest: ' -var cameraManagerPromise -var camerasArrayPromise -var camera0InputPromise -var previewOutputPromise -var videoRecorder -var photoOutputPromise -let fdPath; -let fileAsset; -let fdNumber; - -var minFrameRate_Grp0=12; -var maxFrameRate_Grp0=12; -var minFrameRate_Mix=14; -var maxFrameRate_Mix=15; -var minFrameRate_Err1=11; -var maxFrameRate_Err1=31; -var minFrameRate_Err2=14; -var maxFrameRate_Err2=28; -var minFrameRate_Err3=16; -var maxFrameRate_Err3=25; -var minFrameRate_Grp20=30; -var maxFrameRate_Grp20=30; - -var Point1 = { x: 1, y: 1 } -var Point2 = { x: 2, y: 2 } -var Point3 = { x: 3, y: 3 } -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -var photosettings5 = { - rotation: 270, -} -let configFile = { - audioBitrate: 48000, - audioChannels: 2, - audioCodec: 'audio/mp4a-latm', - audioSampleRate: 48000, - durationTime: 1000, - fileFormat: 'mp4', - videoBitrate: 48000, - videoCodec: 'video/mp4v-es', - videoFrameWidth: 640, - videoFrameHeight: 480, - videoFrameRate: 30 -} - -let videoConfig = { - audioSourceType: 1, - videoSourceType: 0, - profile: configFile, - url: 'file:///data/media/01.mp4', - orientationHint: 0, - location: { latitude: 30, longitude: 130 }, - maxSize: 100, - maxDuration: 500 -} -var surfaceId1 -var videoId -var videoOutputPromise -var captureSessionPromise - -export default function cameraJSUnitVideoPromise(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(time) { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(1) - }, time * 1000) - }).then(() => { - console.info(`sleep ${time} over...`) - }) - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - async function getFd(pathName) { - let displayName = pathName; - const mediaTest = mediaLibrary.getMediaLibrary(); - let fileKeyObj = mediaLibrary.FileKey; - let mediaType = mediaLibrary.MediaType.VIDEO; - let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); - let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); - if (dataUri != undefined) { - let args = dataUri.id.toString(); - let fetchOp = { - selections: fileKeyObj.ID + "=?", - selectionArgs: [args], - } - let fetchFileResult = await mediaTest.getFileAssets(fetchOp); - fileAsset = await fetchFileResult.getAllObject(); - fdNumber = await fileAsset[0].open('Rw'); - fdPath = "fd://" + fdNumber.toString(); - } - } - - async function closeFd() { - if (fileAsset != null) { - await fileAsset[0].close(fdNumber).then(() => { - console.info('[mediaLibrary] case close fd success'); - }).catch((err) => { - console.info('[mediaLibrary] case close fd failed'); - }); - } else { - console.info('[mediaLibrary] case fileAsset is null'); - } - } - - async function getvideosurface() { - await getFd('01.mp4'); - videoConfig.url = fdPath; - media.createVideoRecorder((err, recorder) => { - console.info(TAG + 'createVideoRecorder called') - videoRecorder = recorder - console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder)) - console.info(TAG + 'videoRecorder.prepare called.') - videoRecorder.prepare(videoConfig, (err) => { - console.info(TAG + 'videoRecorder.prepare success.') - }) - videoRecorder.getInputSurface((err, id) => { - console.info(TAG + 'getInputSurface called') - videoId = id - console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoId)) - }) - }) - } - - describe('VideoModePromise', function () { - console.info(TAG + '----------Camera-VideoMode-Promise--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5); - console.info('beforeEach case'); - }) - - afterEach(async function () { - await closeFd(); - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------') - cameraManagerPromise = await cameraObj.getCameraManager(null) - console.info(TAG + 'Entering Get cameraManagerPromise cameraManagerPromise: ' + cameraManagerPromise) - if (cameraManagerPromise != null && cameraManagerPromise != undefined) { - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManagerPromise == null || cameraManagerPromise == undefined) { - console.info(TAG + 'Entering Camera status Callback cameraManagerPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate') - await sleep(1) - cameraManagerPromise.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManagerPromise is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100--------------') - camerasArrayPromise = await cameraManagerPromise.getCameras() - console.info(TAG + 'Entering Get Cameras Promise: ' + JSON.stringify(camerasArrayPromise)) - if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { - console.info(TAG + 'Entering Get Cameras Promise success') - for (var i = 0; i < camerasArrayPromise.length; i++) { - // Get the variables from camera object - var cameraId = camerasArrayPromise[i].cameraId - console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Id: ' + cameraId) - var cameraPosition = camerasArrayPromise[i].cameraPosition - console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Position: ' + cameraPosition) - var cameraType = camerasArrayPromise[i].cameraType - console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Type: ' + cameraType) - var connectionType = camerasArrayPromise[i].connectionType - console.info(TAG + 'Entering Get Cameras Promise connection' + i + 'Type: ' + connectionType) - } - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraId promise api - * @tc.desc : Create camerainput from camera-0 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------') - camera0InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraId) - console.info(TAG + 'Entering Create camera input promise camera0InputPromise: ' + JSON.stringify(camera0InputPromise)) - if (camera0InputPromise != null && camera0InputPromise != undefined) { - console.info(TAG + 'Entering Create camera input promise camera0InputPromise is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering Camera input error callback camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 to operate"); - camera0InputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "camera0InputPromise error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 - * @tc.name : Create previewoutput promise api - * @tc.desc : Create previewoutput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100--------------') - previewOutputPromise = await cameraObj.createPreviewOutput(surfaceId) - console.info(TAG + 'Entering Create previewOutputPromise: ' + JSON.stringify(previewOutputPromise)) - if (previewOutputPromise != null && previewOutputPromise != undefined) { - console.info(TAG + 'Entering Create previewOutputPromise is not null || undefined') - expect(true).assertTrue(); - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 PASSED') - } else { - expect().assertFail(); - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0InputPromise.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is : " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0InputPromise.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : PreviewOutput callback onerror async api - * @tc.desc : PreviewOutput callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + 'Entering PreviewOutputError callback previewOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - previewOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 - * @tc.name : Create videooutput promise api - * @tc.desc : Create videooutput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 to operate') - await getvideosurface() - await sleep(2) - videoOutputPromise = await cameraObj.createVideoOutput(videoId) - console.info(TAG + 'Entering Create videoOutputPromise: ' + videoOutputPromise) - if (videoOutputPromise != null && videoOutputPromise != undefined) { - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 PASSED') - } else { - expect().assertFail(); - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 ends here'); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : VideoOutput callback onerror async api - * @tc.desc : VideoOutput callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - videoOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + 'VideoOutput Errorcallback is success') - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1) - done() - }) - await sleep(1) - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Create PhotoOutput instance promise api - * @tc.desc : Create PhotoOutput instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1) - photoOutputPromise = await cameraObj.createPhotoOutput(surfaceId1); - console.info(TAG + "Entering createPhotoOutput success"); - if (photoOutputPromise != null || photoOutputPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output callback on error photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate"); - photoOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 - * @tc.name : Create capturesession promise api - * @tc.desc : Create capturesession promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 to operate') - captureSessionPromise = await cameraObj.createCaptureSession(null) - console.info(TAG + 'Entering Create captureSessionPromise: ' + captureSessionPromise) - if (captureSessionPromise != null && captureSessionPromise != undefined) { - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 ends here'); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 - * @tc.name : CaptureSession callback onerror async api - * @tc.desc : CaptureSession callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + 'Entering captureSession errorcallback captureSessionPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - captureSessionPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession errorcallback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 - * @tc.name : CaptureSession_Begin config promise api - * @tc.desc : CaptureSession_Begin config promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Create captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.beginConfig(); - console.info(TAG + "Entering beginConfig success:"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 beginConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add Input captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.addInput(camera0InputPromise); - console.info(TAG + "Entering Add Input success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add preview output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering Add preview output : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 - * @tc.name : Add output with video output api - * @tc.desc : Add output with video output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add video output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(videoOutputPromise); - console.info(TAG + "Entering Add video output success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add output with photo output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering Add output with photo output success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeInput(camera0InputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeOutput(previewOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 addInput success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Remove video Output api - * @tc.desc : Remove video Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeOutput(videoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 to operate"); - const Promise = await captureSessionPromise.addInput(camera0InputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 addInput success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 to operate"); - const promise = await captureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 - * @tc.name : Add output with video output api - * @tc.desc : Add output with video output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 to operate"); - const promise = await captureSessionPromise.addOutput(videoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 - * @tc.name : get frame rate range camera0 api - * @tc.desc : get frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 to operate"); - await videoOutputPromise.getFrameRateRange() - .then(function (data) { - console.info(TAG + "Entering get frame rate range SUCCESS "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 PASSED : " + JSON.stringify(data)) - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Grp0,maxFrameRate_Grp0) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Mix,maxFrameRate_Mix) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Err1,maxFrameRate_Err1) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Err2,maxFrameRate_Err2) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Err3,maxFrameRate_Err3) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Grp20,maxFrameRate_Grp20) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 - * @tc.name : getVideoStabilizationModeOff - * @tc.desc : getVideoStabilizationModeOff promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeOff SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 - * @tc.name : getVideoStabilizationModeLow - * @tc.desc : getVideoStabilizationModeLow promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeLow SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 - * @tc.name : getVideoStabilizationModeMIDDLE - * @tc.desc : getVideoStabilizationModeMIDDLE promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeMIDDLE SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 - * @tc.name : getVideoStabilizationModeHigh - * @tc.desc : getVideoStabilizationModeHigh promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeHigh SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 - * @tc.name : getVideoStabilizationModeAuto - * @tc.desc : getVideoStabilizationModeAuto promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeAuto SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Commit config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.commitConfig(); - console.info(TAG + "Entering commitConfig success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 commitConfig PASSED"); - } - else { - expect().assertFail() - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 commitConfig FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 commitConfig ends here"); - } - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview Output callback on frame start previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate"); - previewOutputPromise.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : PreviewOutput callback onframeend async api - * @tc.desc : PreviewOutput callback onframeend async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 previewOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate') - await sleep(1) - previewOutputPromise.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewStop frameEnd Callback is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : VideoOutput callback onframestart async api - * @tc.desc : VideoOutput callback onframestart async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video frameStart Callback videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate') - await sleep(1) - videoOutputPromise.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "Video frameStart Callback is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 is FAILED : " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : VideoOutput callback onframeend async api - * @tc.desc : VideoOutput callback onframeend async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video frameEnd callback videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate') - await sleep(1) - videoOutputPromise.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 is success') - if (data != null || data != undefined) { - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED' + err.message) - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture start photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 to operate"); - photoOutputPromise.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "CaptureStart Callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture end photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 to operate"); - photoOutputPromise.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 FAILED' + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on frame shutter photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 to operate"); - photoOutputPromise.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 with captureId: " + data.captureId); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 - * @tc.name : capture session start api - * @tc.desc : capture session start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering capture session start captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 to operate"); - await captureSessionPromise.start(); - console.info(TAG + "Entering captureSession start success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 to operate"); - await photoOutputPromise.isMirrorSupported() - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 FAILED : " + err.message); - }); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 to operate"); - await photoOutputPromise.setMirror(true) - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 FAILED : " + err.message); - }); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100--------------"); - console.info(TAG + 'hasFlash called.') - var hasFlashPromise = await camera0InputPromise.hasFlash(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 success"); - if (hasFlashPromise != null || hasFlashPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 is: " + JSON.stringify(hasFlashPromise)); - expect(hasFlashPromise).assertEqual(true); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 FAILED : "); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 ends here"); - await sleep(1) - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 to operate"); - var isFMOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMOpenSupported != null || isFMOpenSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + JSON.stringify(isFMOpenSupported)); - expect(isFMOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 to operate"); - var SetFMOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMOpen)) - if (SetFMOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 to operate"); - var GetFMOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 success: " + JSON.stringify(GetFMOpen)); - if (GetFMOpen == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + JSON.stringify(GetFMOpen)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 to operate"); - var isFMAlwaysOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMAlwaysOpenSupported != null || isFMAlwaysOpenSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + isFMAlwaysOpenSupported); - expect(isFMAlwaysOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 to operate"); - var SetFMAlwaysOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMAlwaysOpen)) - if (SetFMAlwaysOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 to operate"); - var GetFMAlwaysOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 success"); - if (GetFMAlwaysOpen == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAlwaysOpen); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 to operate"); - var isFMAutoSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMAutoSupported != null || isFMAutoSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_AUTO data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + isFMAutoSupported); - expect(isFMAutoSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 to operate"); - var SetFMAlwaysAuto = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "SetFMAlwaysAuto: " + JSON.stringify(SetFMAlwaysAuto)) - if (SetFMAlwaysAuto == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 to operate"); - var GetFMAuto = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 success"); - if (GetFMAuto == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAuto); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 to operate"); - var isFMCloseSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMCloseSupported != null || isFMCloseSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + isFMCloseSupported); - expect(isFMCloseSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 to operate"); - var SetFMClose = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMClose)) - if (SetFMClose == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 - * @tc.name : get flash mode close camera0 api - * @tc.desc : get flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 to operate"); - var GetFMClose = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 success"); - if (GetFMClose == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMClose); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - //ZOOM Function - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 - * @tc.name : get zoom ratio camera-0 cameraId api promise api - * @tc.desc : get zoom ratio camera-0 cameraId api promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100--------------"); - var getZoomRatioPromise = await camera0InputPromise.getZoomRatioRange(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 getZoomRatioPromise: " + JSON.stringify(getZoomRatioPromise)); - if (getZoomRatioPromise != null && getZoomRatioPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 setZoomRatioPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 success: " + JSON.stringify(getZoomRatioPromise)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(1); - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - var getpromise1 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise1); - if (getpromise1 != null && getpromise1 != undefined) { - expect(getpromise1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(2); - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - var getpromise2 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise2); - if (getpromise2 != null && getpromise2 != undefined) { - expect(getpromise2).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(3); - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - var getpromise3 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise3); - if (getpromise3 != null && getpromise3 != undefined) { - expect(getpromise3).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(4); - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - var getpromise4 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise4); - if (getpromise4 != null && getpromise4 != undefined) { - expect(getpromise4).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(5); - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - var getpromise5 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise5); - if (getpromise5 != null && getpromise5 != undefined) { - expect(getpromise5).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(6); - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - var getpromise6 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise6); - if (getpromise6 != null && getpromise6 != undefined) { - expect(getpromise6).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - // FOCUS promise API's - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 - * @tc.name : check is focus mode locked supported-camera0Input api - * @tc.desc : check is focus mode locked supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 to operate"); - var isFMLockedSupported = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering is focus mode locked supported SUCCESS "); - if (isFMLockedSupported != null || isFMLockedSupported != undefined) { - console.info(TAG + "Entering is focus mode locked supported data is not null || undefined"); - console.info(TAG + "is focus mode locked supported : " + isFMLockedSupported); - expect(isFMLockedSupported).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED) - .then(function (data) { - console.info(TAG + "SetFMLocked: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode locked SUCCESS, current focusmode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 FAILED : ") - expect().assertFail(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 ends here"); - }); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode locked success: "); - if (data == 0) { - console.info(TAG + "Current focusmode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 ends here"); - }); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 - * @tc.name : get focal length camera0 api - * @tc.desc : get focal length camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 to operate"); - await camera0InputPromise.getFocalLength() - .then(function (data) { - console.info(TAG + "Current focallength is: " + JSON.stringify(data)); - expect(data).assertEqual(3.4600000381469727); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 - * @tc.name : is focusmode manual supported - * @tc.desc : is focusmode manual supported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 to operate"); - var isFMmanualSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL); - if (isFMmanualSupportedpromise != null || isFMmanualSupportedpromise != undefined) { - console.info(TAG + "Entering is focusmode manual supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMmanualSupportedpromise); - expect(isFMmanualSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL) - .then(function (data) { - console.info(TAG + "setFocusManual: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode manual SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode manual SUCCESS"); - if (data == 0) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 ends here"); - }); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 FAILED " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 - * @tc.name : check is focus mode continuous supported-camera0Input api - * @tc.desc : check is focus mode continuous supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 to operate"); - var isFMContinuousSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - if (isFMContinuousSupportedpromise != null || isFMContinuousSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode continuous supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINUOUS_SUPPORTED is: " + isFMContinuousSupportedpromise); - expect(isFMContinuousSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) - .then(function (data) { - console.info(TAG + "setFocusCont: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode continuous SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode continuous SUCCESS"); - if (data == 1) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 - * @tc.name : check is focus mode auto supported-camera0Input api - * @tc.desc : check is focus mode auto supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 to operate"); - var isFMAutoSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (isFMAutoSupportedpromise != null || isFMAutoSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode auto supported data is not null || undefined"); - console.info(TAG + "is focus mode auto supported is: " + isFMAutoSupportedpromise); - expect(isFMAutoSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 to operate"); - var setFocusAuto = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO) - .then(function () { - console.info(TAG + "setFocusAuto: " + JSON.stringify(setFocusAuto)) - console.info(TAG + "Entering set focus mode auto SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 FAILED : "); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 to operate"); - var getfocusmodepromise = await camera0InputPromise.getFocusMode(); - console.info(TAG + "Entering get focus mode auto SUCCESS"); - if (getfocusmodepromise == 2) { - console.info(TAG + "Current FocusMode is: " + getfocusmodepromise); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode locked SUCCESS"); - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 mode locked - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 to operate"); - await camera0InputPromise.setExposurePoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 mode locked - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100_exposure mode locked - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureBiasRange() - .then(function (data) { - console.info(TAG + "Entering getExposureBiasRange SUCCESS"); - console.info(TAG + "Current ExposureBiasRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 mode locked - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 to operate"); - await camera0InputPromise.setExposureBias(-4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 mode locked - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 mode auto - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 to operate"); - await camera0InputPromise.setExposurePoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 FAILED: " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 mode auto - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 mode auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 to operate"); - await camera0InputPromise.setExposureBias(1) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 mode auto - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 to operate"); - await camera0InputPromise.setExposurePoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 mode continuous auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 to operate"); - await camera0InputPromise.setExposureBias(4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 - * @tc.name : VideoOutput start promise api - * @tc.desc : VideoOutput start promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video Output start videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 to operate') - await videoOutputPromise.start() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 - * @tc.name : VideoOutput stop promise api - * @tc.desc : VideoOutput stop promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video Output Stop videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 to operate') - await videoOutputPromise.stop() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 - * @tc.name : CaptureSession stop promise api - * @tc.desc : CaptureSession stop promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + 'Entering Capture Session Stop captureSessionPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 to operate') - await captureSessionPromise.stop() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 - * @tc.name : CaptureSession release promise api - * @tc.desc : CaptureSession release promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + 'Entering Capture session release captureSessionPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 to operate') - await captureSessionPromise.release() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : videoOutput release api - * @tc.desc : videoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + "Entering Video Output release previewOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await videoOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : PreviewOutput release api - * @tc.desc : PreviewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering previewOutputPromise.release previewOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await previewOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : cameraInput release api - * @tc.desc : cameraInput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering camera0InputPromise.release camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await camera0InputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1) - done() - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraExceedWideAngle/src/main/resources/base/element/string.json b/multimedia/camera/cameraExceedWideAngle/src/main/resources/base/element/string.json deleted file mode 100644 index b93f540e29265a34f883a977c442fa85349b94ca..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraExceedWideAngle/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "description_mainability", - "value": "eTS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/multimedia/camera/cameraLongFocus/BUILD.gn b/multimedia/camera/cameraLongFocus/BUILD.gn deleted file mode 100644 index 04b2d4d4572f7d4e28ef1d0ff8e5bc4ef8fff23c..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraLongFocus/BUILD.gn +++ /dev/null @@ -1,34 +0,0 @@ -# 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("camera_longfocus_ets_hap") { - hap_profile = "./src/main/config.json" - deps = [ - ":camera_ets_assets", - ":camera_ets_resources", - ] - ets2abc = true - - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsCameraLongFocusETSTest" - subsystem_name = "multimedia" - part_name = "multimedia_camera_standard" -} -ohos_js_assets("camera_ets_assets") { - source_dir = "./src/main/ets/MainAbility" -} -ohos_resources("camera_ets_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/multimedia/camera/cameraLongFocus/Test.json b/multimedia/camera/cameraLongFocus/Test.json deleted file mode 100644 index 096aad2898d094c26b18d14006473ca8996e6921..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraLongFocus/Test.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "description": "Configuration for camerastandard LongFocus Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "1000000", - "package": "com.open.harmony.multimedia.cameralftest", - "shell-timeout": "60000" - }, - "kits": [ - { - "type": "ShellKit", - "run-command": [ - "touch /data/media/01.mp4", - "chmod -R 777 /data/media" - - ], - "teardown-command":[ - - ] - }, - { - "test-file-name": [ - "ActsCameraLongFocusETSTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/multimedia/camera/cameraLongFocus/signature/openharmony_sx.p7b b/multimedia/camera/cameraLongFocus/signature/openharmony_sx.p7b deleted file mode 100644 index 0625db92101ca16c7becfaf2d4008ea2e96078e1..0000000000000000000000000000000000000000 Binary files a/multimedia/camera/cameraLongFocus/signature/openharmony_sx.p7b and /dev/null differ diff --git a/multimedia/camera/cameraLongFocus/src/main/config.json b/multimedia/camera/cameraLongFocus/src/main/config.json deleted file mode 100644 index acc3652c309d3f7a36fc16d24d8ad28f44699329..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraLongFocus/src/main/config.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "app": { - "bundleName": "com.open.harmony.multimedia.cameralftest", - "vendor": "open", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.open.harmony.multimedia.cameralftest", - "name": ".MyApplication", - "mainAbility": "com.open.harmony.multimedia.cameralftest.MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "formsEnabled": false, - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "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.CAMERA", - "reason": "use ohos.permission.CAMERA" - }, - { - "name": "ohos.permission.MICROPHONE", - "reason": "use ohos.permission.MICROPHONE" - }, - { - "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" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/app.ets b/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/app.ets deleted file mode 100644 index a9f8218978fad817d4519aa1b715da0e3f8ebbfc..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('Application onCreate') - }, - onDestroy() { - console.info('Application onDestroy') - }, -} diff --git a/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/pages/index.ets b/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index ca96b03e80e49976adf3f876fadb4d82d574c6ef..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,74 +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 {Core, ExpectExtend} from "deccjsunit/index" -import cameraKit from "../test/Camera.test" -import featureAbility from "@ohos.ability.featureAbility" - -let TAG = 'CameraModuleTest: ' -var mXComponentController: XComponentController = new XComponentController() -var surfaceId: any - -@Entry -@Component -struct CameraIndex { - @State isShowSettings: boolean = false - @State previewSize: string = '75%' - - aboutToAppear() { - console.info('--------------aboutToAppear--------------') - } - - build() { - Flex() { - XComponent({ - id: '', - type: 'surface', - libraryname: '', - controller: mXComponentController - }) - .onLoad(() => { - console.info('CameraModuleTest: OnLoad() is called!') - mXComponentController.setXComponentSurfaceSize({ surfaceWidth: 1920, surfaceHeight: 1080 }); - surfaceId = mXComponentController.getXComponentSurfaceId() - console.info('CameraModuleTest: XComponent onLoad surfaceId: ' + surfaceId) - featureAbility.getWant() - .then((Want) => { - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - console.info(TAG + 'Entering expectExtend') - core.addService('expect', expectExtend) - console.info(TAG + 'Entering addService') - core.init() - console.info(TAG + 'Entering core.init()') - console.info(TAG + 'Entering subscribeEvent') - const configService = core.getDefaultService('config') - configService.setConfig(Want.parameters) - console.info(TAG + 'Entering configService') - cameraKit(surfaceId) - core.execute() - console.info(TAG + 'Operation successful. Data: ' + JSON.stringify(Want)); - }) - .catch((error) => { - console.error(TAG + 'Operation failed. Cause: ' + JSON.stringify(error)); - }) - }) - .width('1920px') - .height('1080px') - } - } -} diff --git a/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/Camera.test.ets b/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/Camera.test.ets deleted file mode 100644 index 2743a3a6f94f359e98785fa0a21bf1518e7a9859..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/Camera.test.ets +++ /dev/null @@ -1,35 +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 cameraJSUnitEnum from './CameraJSUnitEnum.test.ets' -import cameraJSUnitCameraFormat from './CameraJSUnitCameraFormat.test.ets' -import cameraJSUnitPhotoAsync from './CameraJSUnitPhotoAsync.test.ets' -import cameraJSUnitPhotoPromise from './CameraJSUnitPhotoPromise.test.ets' -import cameraJSUnitVideoAsync from './CameraJSUnitVideoAsync.test.ets' -import cameraJSUnitVideoPromise from './CameraJSUnitVideoPromise.test.ets' - -let TAG = 'CameraModuleTest: ' - -export default function cameraKit(surfaceId: any) { - console.info(TAG + 'Entering cameraKit') - console.info(TAG + 'surfaceId: ' + surfaceId) - - cameraJSUnitEnum(surfaceId) - cameraJSUnitCameraFormat(surfaceId) - cameraJSUnitPhotoAsync(surfaceId) - cameraJSUnitPhotoPromise(surfaceId) - cameraJSUnitVideoAsync(surfaceId) - cameraJSUnitVideoPromise(surfaceId) -} \ No newline at end of file diff --git a/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets b/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets deleted file mode 100644 index 5986ddb31181d4715851f02c0487eddfbb306e1b..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets +++ /dev/null @@ -1,2778 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables - -var cameraManager; -var surfaceId1; -var camerasArray; - -// CAMERA-0 Variables -var camera0Input, camera0InputPosBack, camera0InputPosFront; -var camera0InputPromise, camera0InputPromisePosBack, camera0InputPromisePosFront; -// CAMERA-1 Variables -var camera1Input, camera1InputPosBack, camera1InputPosFront; -var camera1InputPromise, camera1InputPromisePosBack, camera1InputPromisePosFront; -// CAMERA-2 Variables -var camera2Input, camera2InputPosBack, camera2InputPosFront; -var camera2InputPromise, camera2InputPromisePosBack, camera2InputPromisePosFront; -// CAMERA-3 Variables -var camera3Input, camera3InputPosBack, camera3InputPosFront; -var camera3InputPromise, camera3InputPromisePosBack, camera3InputPromisePosFront; - -export default function cameraJSUnitCameraFormat(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJsUnitCameraFormat', function () { - console.info(TAG + '----------CameraJsUnitCameraFormat--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 data is not null || undefined"); - cameraManager = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------"); - var cameraManagerPromise = await cameraObj.getCameraManager(null); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 cameraManagerPromise: " + JSON.stringify(cameraManagerPromise)); - if (cameraManagerPromise != null && cameraManagerPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Get camera from cameramanager to get array of camera async api - * @tc.desc : Get camera from cameramanager to get array of camera async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------"); - cameraManager.getCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 data is not null || undefined"); - camerasArray = data; - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArray[i].cameraPosition; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArray[i].cameraType; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Type: " + cameraType); - var connectionType = camerasArray[i].connectionType - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 - * @tc.name : Get camera from cameramanager to get array of camera promise api - * @tc.desc : Get camera from cameramanager to get array of camera promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100--------------"); - var camerasArrayPromise = await cameraManager.getCameras(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100: " + JSON.stringify(camerasArrayPromise)); - if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 success"); - for (var i = 0; i < camerasArrayPromise.length; i++) { - // Get the variables from camera object - var cameraId = camerasArrayPromise[i].cameraId; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArrayPromise[i].cameraPosition; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArrayPromise[i].cameraType; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 camera" + i + "Type: " + cameraType); - var connectionType = camerasArrayPromise[i].connectionType - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-0 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera0Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[0].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraId promise api - * @tc.desc : Create camerainput from camera-0 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera0InputPromise = await cameraManager.createCameraInput(camerasArray[0].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera0InputPromise: " + JSON.stringify(camera0InputPromise)); - if (camera0InputPromise != null && camera0InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera0InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 - * @tc.name : get camera if from camera-0 input async api - * @tc.desc : get camera if from camera-0 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100', 0, async function (done) { - camera0Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 data is not null || undefined"); - var CameraId0 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 PASSED with CameraID :" + CameraId0); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 - * @tc.name : get camera if from camera-0 input promise api - * @tc.desc : get camera if from camera-0 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100', 0, async function (done) { - var camera0IdPromise = await camera0InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 camera0IdPromise: " + JSON.stringify(camera0IdPromise)); - if (camera0IdPromise != null && camera0IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 camera0IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 PASSED" + camera0IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput async api - * @tc.desc : Get supported preview formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera0InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null && data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromise = await camera0InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromise)); - if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam0FormatPromise: " + cam0FormatPromise[i]); - expect(cam0FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-0 camerainput async api - * @tc.desc : Get supported video formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 success"); - if (data != null && data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 - * @tc.name : Get supported video formats from camera-0 camerainput promise api - * @tc.desc : Get supported video formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromise = await camera0InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromise)); - if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 cam0FormatPromise: " + cam0FormatPromise[i]); - expect(cam0FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-0 camerainput async api - * @tc.desc : Get supported photo format from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-0 camerainput promise api - * @tc.desc : Get supported photo format from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromise = await camera0InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromise)); - if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam0FormatPromise: " + cam0FormatPromise[i]); - expect(cam0FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput async api - * @tc.desc : Get supported preview formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosBack = await camera0InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosBack)); - if (cam0FormatPromisePosBack != null && cam0FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam0FormatPromisePosBack: " + cam0FormatPromisePosBack[i]); - expect(cam0FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-0 camerainput async api - * @tc.desc : Get supported photo format from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-0 camerainput promise api - * @tc.desc : Get supported photo format from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosBack = await camera0InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosBack)); - if (cam0FormatPromisePosBack != null && cam0FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam0FormatPromisePosBack: " + cam0FormatPromisePosBack[i]); - expect(cam0FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput async api - * @tc.desc : Get supported preview formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosFront = await camera0InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosFront)); - if (cam0FormatPromisePosFront != null && cam0FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam0FormatPromisePosFront: " + cam0FormatPromisePosFront[i]); - expect(cam0FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-0 camerainput async api - * @tc.desc : Get supported photo format from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-0 camerainput promise api - * @tc.desc : Get supported photo format from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosFront = await camera0InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosFront)); - if (cam0FormatPromisePosFront != null && cam0FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam0FormatPromisePosFront: " + cam0FormatPromisePosFront[i]); - expect(cam0FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0InputPromise.on("focusStateChange", async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CAMERA-1 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-1 cameraId async api - * @tc.desc : Create camerainput from camera-1 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-1 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[1].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera1Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[1].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-1 cameraId promise api - * @tc.desc : Create camerainput from camera-1 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera1InputPromise = await cameraManager.createCameraInput(camerasArray[1].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera1InputPromise: " + JSON.stringify(camera1InputPromise)); - if (camera1InputPromise != null && camera1InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera1InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 - * @tc.name : get camera ID from camera-1 input async api - * @tc.desc : get camera ID from camera-1 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100', 0, async function (done) { - camera1Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 data is not null || undefined"); - var CameraId1 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 PASSED with CameraID : " + CameraId1); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 - * @tc.name : get camera ID from camera-1 input promise api - * @tc.desc : get camera ID from camera-1 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100', 0, async function (done) { - var camera1IdPromise = await camera1InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 camera1IdPromise: " + JSON.stringify(camera1IdPromise)); - if (camera1IdPromise != null && camera1IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 camera1IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 PASSED" + camera1IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 - * @tc.name : Create camerainput from camera-1 cameraposition & cameratype async api - * @tc.desc : Create camerainput from camera-1 cameraposition & cameratype async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[1].cameraPosition, camerasArray[1].cameraType, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 - * @tc.name : Create camerainput from camera-1 cameraposition & cameratype promise api - * @tc.desc : Create camerainput from camera-1 cameraposition & cameratype promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100--------------"); - var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[1].cameraPosition, camerasArray[1].cameraType); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); - if (cameraInputPromise != null && cameraInputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput async api - * @tc.desc : Get supported preview formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera1InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput promise api - * @tc.desc : Get supported preview formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromise = await camera1InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromise)); - if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam1FormatPromise: " + cam1FormatPromise[i]); - expect(cam1FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-1 camerainput async api - * @tc.desc : Get supported video formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100--------------"); - camera1InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 - * @tc.name : Get supported video formats from camera-1 camerainput promise api - * @tc.desc : Get supported video formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100--------------"); - var cam1FormatPromise = await camera1InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100: " + JSON.stringify(cam1FormatPromise)); - if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 cam1FormatPromise: " + cam1FormatPromise[i]); - expect(cam1FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-1 camerainput async api - * @tc.desc : Get supported photo format from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera1InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-1 camerainput promise api - * @tc.desc : Get supported photo format from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromise = await camera1InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromise)); - if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam1FormatPromise: " + cam1FormatPromise[i]); - expect(cam1FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput async api - * @tc.desc : Get supported preview formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput promise api - * @tc.desc : Get supported preview formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosBack = await camera1InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosBack)); - if (cam1FormatPromisePosBack != null && cam1FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam1FormatPromisePosBack: " + cam1FormatPromisePosBack[i]); - expect(cam1FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-1 camerainput async api - * @tc.desc : Get supported photo format from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-1 camerainput promise api - * @tc.desc : Get supported photo format from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosBack = await camera1InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosBack)); - if (cam1FormatPromisePosBack != null && cam1FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam1FormatPromisePosBack: " + cam1FormatPromisePosBack[i]); - expect(cam1FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput async api - * @tc.desc : Get supported preview formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput promise api - * @tc.desc : Get supported preview formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosFront = await camera1InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosFront)); - if (cam1FormatPromisePosFront != null && cam1FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam1FormatPromisePosFront: " + cam1FormatPromisePosFront[i]); - expect(cam1FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-1 camerainput async api - * @tc.desc : Get supported photo format from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-1 camerainput promise api - * @tc.desc : Get supported photo format from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosFront = await camera1InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosFront)); - if (cam1FormatPromisePosFront != null && cam1FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam1FormatPromisePosFront: " + cam1FormatPromisePosFront[i]); - expect(cam1FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-2 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-2 cameraId async api - * @tc.desc : Create camerainput from camera-2 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-2 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[2].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera2Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[2].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-2 cameraId promise api - * @tc.desc : Create camerainput from camera-2 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera2InputPromise = await cameraManager.createCameraInput(camerasArray[2].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera2InputPromise: " + JSON.stringify(camera2InputPromise)); - if (camera2InputPromise != null && camera2InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera2InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 - * @tc.name : get camera ID from camera-2 input async api - * @tc.desc : get camera ID from camera-2 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100', 0, async function (done) { - camera2Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 data is not null || undefined"); - var CameraId2 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 PASSED with CameraID : " + CameraId2); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 - * @tc.name : get camera ID from camera-2 input promise api - * @tc.desc : get camera ID from camera-2 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100', 0, async function (done) { - var camera2IdPromise = await camera2InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 camera2IdPromise: " + JSON.stringify(camera2IdPromise)); - if (camera2IdPromise != null && camera2IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 camera2IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 PASSED" + camera2IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 - * @tc.name : Create camerainput from camera-2 cameraposition & cameratype async api - * @tc.desc : Create camerainput from camera-2 cameraposition & cameratype async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[2].cameraPosition, camerasArray[2].cameraType, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 - * @tc.name : Create camerainput from camera-2 cameraposition & cameratype promise api - * @tc.desc : Create camerainput from camera-2 cameraposition & cameratype promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100--------------"); - var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[2].cameraPosition, camerasArray[2].cameraType); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); - if (cameraInputPromise != null && cameraInputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput async api - * @tc.desc : Get supported preview formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera2InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput promise api - * @tc.desc : Get supported preview formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromise = await camera2InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromise)); - if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam2FormatPromise: " + cam2FormatPromise[i]); - expect(cam2FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-2 camerainput async api - * @tc.desc : Get supported video formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100--------------"); - camera2InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 - * @tc.name : Get supported video formats from camera-2 camerainput promise api - * @tc.desc : Get supported video formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100--------------"); - var cam2FormatPromise = await camera2InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100: " + JSON.stringify(cam2FormatPromise)); - if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 cam2FormatPromise: " + cam2FormatPromise[i]); - expect(cam2FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-2 camerainput async api - * @tc.desc : Get supported photo format from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera2InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-2 camerainput promise api - * @tc.desc : Get supported photo format from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromise = await camera2InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromise)); - if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam2FormatPromise: " + cam2FormatPromise[i]); - expect(cam2FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput async api - * @tc.desc : Get supported preview formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput promise api - * @tc.desc : Get supported preview formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosBack = await camera2InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosBack)); - if (cam2FormatPromisePosBack != null && cam2FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam2FormatPromisePosBack: " + cam2FormatPromisePosBack[i]); - expect(cam2FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-2 camerainput async api - * @tc.desc : Get supported photo format from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-2 camerainput promise api - * @tc.desc : Get supported photo format from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosBack = await camera2InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosBack)); - if (cam2FormatPromisePosBack != null && cam2FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam2FormatPromisePosBack: " + cam2FormatPromisePosBack[i]); - expect(cam2FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput async api - * @tc.desc : Get supported preview formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput promise api - * @tc.desc : Get supported preview formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosFront = await camera2InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosFront)); - if (cam2FormatPromisePosFront != null && cam2FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam2FormatPromisePosFront: " + cam2FormatPromisePosFront[i]); - expect(cam2FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-2 camerainput async api - * @tc.desc : Get supported photo format from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-2 camerainput promise api - * @tc.desc : Get supported photo format from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosFront = await camera2InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosFront)); - if (cam2FormatPromisePosFront != null && cam2FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam2FormatPromisePosFront: " + cam2FormatPromisePosFront[i]); - expect(cam2FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-3 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-3 cameraId async api - * @tc.desc : Create camerainput from camera-3 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-3 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[3].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera3Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[3].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-3 cameraId promise api - * @tc.desc : Create camerainput from camera-3 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera3InputPromise = await cameraManager.createCameraInput(camerasArray[3].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera3InputPromise: " + JSON.stringify(camera3InputPromise)); - if (camera3InputPromise != null && camera3InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera3InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 - * @tc.name : get camera ID from camera-3 input async api - * @tc.desc : get camera ID from camera-3 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100', 0, async function (done) { - camera3Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 data is not null || undefined"); - var CameraId3 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 PASSED with CameraID : " + CameraId3); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 - * @tc.name : get camera ID from camera-3 input promise api - * @tc.desc : get camera ID from camera-3 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100', 0, async function (done) { - var camera3IdPromise = await camera3InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 camera3IdPromise: " + JSON.stringify(camera3IdPromise)); - if (camera3IdPromise != null && camera3IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 camera3IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 PASSED" + camera3IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 - * @tc.name : Create camerainput from camera-3 cameraposition & cameratype async api - * @tc.desc : Create camerainput from camera-3 cameraposition & cameratype async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[3].cameraPosition, camerasArray[3].cameraType, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 - * @tc.name : Create camerainput from camera-3 cameraposition & cameratype promise api - * @tc.desc : Create camerainput from camera-3 cameraposition & cameratype promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100--------------"); - var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[3].cameraPosition, camerasArray[3].cameraType); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); - if (cameraInputPromise != null && cameraInputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput async api - * @tc.desc : Get supported preview formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera3InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput promise api - * @tc.desc : Get supported preview formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromise = await camera3InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromise)); - if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam3FormatPromise: " + cam3FormatPromise[i]); - expect(cam3FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-3 camerainput async api - * @tc.desc : Get supported video formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100--------------"); - camera3InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 - * @tc.name : Get supported video formats from camera-3 camerainput promise api - * @tc.desc : Get supported video formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100--------------"); - var cam3FormatPromise = await camera3InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100: " + JSON.stringify(cam3FormatPromise)); - if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 cam3FormatPromise: " + cam3FormatPromise[i]); - expect(cam3FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-3 camerainput async api - * @tc.desc : Get supported photo format from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera3InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-3 camerainput promise api - * @tc.desc : Get supported photo format from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromise = await camera3InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromise)); - if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam3FormatPromise: " + cam3FormatPromise[i]); - expect(cam3FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput async api - * @tc.desc : Get supported preview formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput promise api - * @tc.desc : Get supported preview formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosBack = await camera3InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosBack)); - if (cam3FormatPromisePosBack != null && cam3FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam3FormatPromisePosBack: " + cam3FormatPromisePosBack[i]); - expect(cam3FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-3 camerainput async api - * @tc.desc : Get supported photo format from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-3 camerainput promise api - * @tc.desc : Get supported photo format from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosBack = await camera3InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosBack)); - if (cam3FormatPromisePosBack != null && cam3FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam3FormatPromisePosBack: " + cam3FormatPromisePosBack[i]); - expect(cam3FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput async api - * @tc.desc : Get supported preview formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput promise api - * @tc.desc : Get supported preview formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosFront = await camera3InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosFront)); - if (cam3FormatPromisePosFront != null && cam3FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam3FormatPromisePosFront: " + cam3FormatPromisePosFront[i]); - expect(cam3FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-3 camerainput async api - * @tc.desc : Get supported photo format from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-3 camerainput promise api - * @tc.desc : Get supported photo format from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosFront = await camera3InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosFront)); - if (cam3FormatPromisePosFront != null && cam3FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam3FormatPromisePosFront: " + cam3FormatPromisePosFront[i]); - expect(cam3FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE TELEPHOTO*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition unspecified & cameratype telephoto async api - * @tc.desc : Create camerainput from cameraposition unspecified & cameratype telephoto async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition unspecified & cameratype telephoto promise api - * @tc.desc : Create camerainput from cameraposition unspecified & cameratype telephoto promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE TELEPHOTO*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition back & cameratype telephoto async api - * @tc.desc : Create camerainput from cameraposition back & cameratype telephoto async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition back & cameratype telephoto promise api - * @tc.desc : Create camerainput from cameraposition back & cameratype telephoto promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE TELEPHOTO*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition front & cameratype telephoto async api - * @tc.desc : Create camerainput from cameraposition front & cameratype telephoto async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_CALLBACK_0100 FAILED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition front & cameratype telephoto promise api - * @tc.desc : Create camerainput from cameraposition front & cameratype telephoto promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets b/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets deleted file mode 100644 index 54de11efdc95e7ad97d972b4081928b1e224b8ef..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets +++ /dev/null @@ -1,508 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables - -var cameraManager; -var surfaceId1; -var camerasArray; - -// CAMERA-0 Variables -var camera0Input, camera0InputPosBack, camera0InputPosFront; -var camera0InputPromise, camera0InputPromisePosBack, camera0InputPromisePosFront; -// CAMERA-1 Variables -var camera1Input, camera1InputPosBack, camera1InputPosFront; -var camera1InputPromise, camera1InputPromisePosBack, camera1InputPromisePosFront; -// CAMERA-2 Variables -var camera2Input, camera2InputPosBack, camera2InputPosFront; -var camera2InputPromise, camera2InputPromisePosBack, camera2InputPromisePosFront; -// CAMERA-3 Variables -var camera3Input, camera3InputPosBack, camera3InputPosFront; -var camera3InputPromise, camera3InputPromisePosBack, camera3InputPromisePosFront; - -export default function cameraJSUnitEnum(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJSUnitEnum', function () { - console.info(TAG + '----------CameraJSUnitEnum--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 data is not null || undefined"); - cameraManager = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Get camera from cameramanager to get array of camera async api - * @tc.desc : Get camera from cameramanager to get array of camera async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------"); - cameraManager.getCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 data is not null || undefined"); - camerasArray = data; - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArray[i].cameraPosition; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArray[i].cameraType; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Type: " + cameraType); - var connectionType = camerasArray[i].connectionType - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100', 0, async function (done) { - console.info("--------------CAMERA-0 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100--------------"); - cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 data is not null || undefined"); - camera0Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 PASSED with CameraID :" + camerasArray[0].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_0100 - * @tc.name : camera status ENAME - * @tc.desc : camera status ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_0100------------"); - console.info(TAG + "CameraStatus CAMERA_STATUS_APPEAR : " + cameraObj.CameraStatus.CAMERA_STATUS_APPEAR); - expect(cameraObj.CameraStatus.CAMERA_STATUS_APPEAR).assertEqual(0); - console.info(TAG + "CameraStatus CAMERA_STATUS_DISAPPEAR : " + cameraObj.CameraStatus.CAMERA_STATUS_DISAPPEAR); - expect(cameraObj.CameraStatus.CAMERA_STATUS_DISAPPEAR).assertEqual(1); - console.info(TAG + "CameraStatus CAMERA_STATUS_AVAILABLE : " + cameraObj.CameraStatus.CAMERA_STATUS_AVAILABLE) - expect(cameraObj.CameraStatus.CAMERA_STATUS_AVAILABLE).assertEqual(2); - console.info(TAG + "CameraStatus CAMERA_STATUS_UNAVAILABLE : " + cameraObj.CameraStatus.CAMERA_STATUS_UNAVAILABLE) - expect(cameraObj.CameraStatus.CAMERA_STATUS_UNAVAILABLE).assertEqual(3); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_POSITION_0100 - * @tc.name : Camera position ENAME - * @tc.desc : Camera position ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_POSITION_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CAMERA_POSITION_0100------------") - console.info(TAG + "CameraPosition CAMERA_POSITION_BACK : " + cameraObj.CameraPosition.CAMERA_POSITION_BACK); - expect(cameraObj.CameraPosition.CAMERA_POSITION_BACK).assertEqual(1); - console.info(TAG + "CameraPosition CAMERA_POSITION_FRONT : " + cameraObj.CameraPosition.CAMERA_POSITION_FRONT); - expect(cameraObj.CameraPosition.CAMERA_POSITION_FRONT).assertEqual(2); - console.info(TAG + "CameraPosition CAMERA_POSITION_UNSPECIFIED : " + cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED); - expect(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED).assertEqual(0); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_TYPE_0100 - * @tc.name : camera type ENAME - * @tc.desc : camera type ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_TYPE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CAMERA_TYPE_0100------------") - console.info(TAG + "CameraType CAMERA_TYPE_UNSPECIFIED : " + cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); - expect(cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED).assertEqual(0); - console.info(TAG + "CameraType CAMERA_TYPE_WIDE_ANGLE : " + cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE); - expect(cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE).assertEqual(1); - console.info(TAG + 'CameraType CAMERA_TYPE_ULTRA_WIDE : ' + cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE); - expect(cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE).assertEqual(2); - console.info(TAG + 'CameraType CAMERA_TYPE_TELEPHOTO : ' + cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO); - expect(cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO).assertEqual(3); - console.info(TAG + 'CameraType CAMERA_TYPE_TRUE_DEPTH : ' + cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH) - expect(cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH).assertEqual(4); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CONNECTION_TYPE_0100 - * @tc.name : connection type ENAME - * @tc.desc : connection type ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CONNECTION_TYPE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CONNECTION_TYPE_0100------------") - console.info(TAG + "ConnectionType CAMERA_CONNECTION_BUILT_IN : " + cameraObj.ConnectionType.CAMERA_CONNECTION_BUILT_IN); - expect(cameraObj.ConnectionType.CAMERA_CONNECTION_BUILT_IN).assertEqual(0); - console.info(TAG + "ConnectionType CAMERA_CONNECTION_USB_PLUGIN : " + cameraObj.ConnectionType.CAMERA_CONNECTION_USB_PLUGIN); - expect(cameraObj.ConnectionType.CAMERA_CONNECTION_USB_PLUGIN).assertEqual(1); - console.info(TAG + "ConnectionType CAMERA_CONNECTION_REMOTE : " + cameraObj.ConnectionType.CAMERA_CONNECTION_REMOTE); - expect(cameraObj.ConnectionType.CAMERA_CONNECTION_REMOTE).assertEqual(2); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FLASHMODE_0100 - * @tc.name : Flash Mode ENAME - * @tc.desc : Flash Mode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FLASHMODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_FLASHMODE_0100------------") - console.info(TAG + "FlashMode FLASH_MODE_CLOSE : " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); - console.info(TAG + "FlashMode FLASH_MODE_OPEN : " + cameraObj.FlashMode.FLASH_MODE_OPEN); - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - console.info(TAG + "FlashMode FLASH_MODE_AUTO : " + cameraObj.FlashMode.FLASH_MODE_AUTO); - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); - console.info(TAG + "FlashMode FLASH_MODE_ALWAYS_OPEN : " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSMODE_0100 - * @tc.name : Focus Mode ENAME - * @tc.desc : Focus Mode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSMODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_FOCUSMODE_0100------------") - console.info(TAG + "FocusMode FOCUS_MODE_MANUAL : " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0); - console.info(TAG + "FocusMode FOCUS_MODE_CONTINUOUS_AUTO : " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); - console.info(TAG + "FocusMode FOCUS_MODE_AUTO : " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); - console.info(TAG + "FocusMode FOCUS_MODE_LOCKED : " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - expect(cameraObj.FocusMode.FOCUS_MODE_LOCKED).assertEqual(3); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATE_0100 - * @tc.name : Focus State ENAME - * @tc.desc : Focus State ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_FOCUSSTATE_0100------------") - console.info(TAG + "FocusState FOCUS_STATE_SCAN : " + cameraObj.FocusState.FOCUS_STATE_SCAN); - expect(cameraObj.FocusState.FOCUS_STATE_SCAN).assertEqual(0); - console.info(TAG + "FocusState FOCUS_STATE_FOCUSED : " + cameraObj.FocusState.FOCUS_STATE_FOCUSED); - expect(cameraObj.FocusState.FOCUS_STATE_FOCUSED).assertEqual(1); - console.info(TAG + "FocusState FOCUS_STATE_UNFOCUSED : " + cameraObj.FocusState.FOCUS_STATE_UNFOCUSED); - expect(cameraObj.FocusState.FOCUS_STATE_UNFOCUSED).assertEqual(2); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IMAGEROTATION_0100 - * @tc.name : Image Rotation ENAME - * @tc.desc : Image Rotation ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IMAGEROTATION_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_IMAGEROTATION_0100------------") - console.info(TAG + "ImageRotation ROTATION_0 : " + cameraObj.ImageRotation.ROTATION_0); - expect(cameraObj.ImageRotation.ROTATION_0).assertEqual(0); - console.info(TAG + "ImageRotation ROTATION_90 : " + cameraObj.ImageRotation.ROTATION_90); - expect(cameraObj.ImageRotation.ROTATION_90).assertEqual(90); - console.info(TAG + "ImageRotation ROTATION_180 : " + cameraObj.ImageRotation.ROTATION_180); - expect(cameraObj.ImageRotation.ROTATION_180).assertEqual(180); - console.info(TAG + "ImageRotation ROTATION_270 : " + cameraObj.ImageRotation.ROTATION_270); - expect(cameraObj.ImageRotation.ROTATION_270).assertEqual(270); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_QUALITYLEVEL_0100 - * @tc.name : Quality Level ENAME - * @tc.desc : Quality Level ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_QUALITYLEVEL_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_QUALITYLEVEL_0100------------") - console.info(TAG + "QualityLevel QUALITY_LEVEL_HIGH : " + cameraObj.QualityLevel.QUALITY_LEVEL_HIGH); - expect(cameraObj.QualityLevel.QUALITY_LEVEL_HIGH).assertEqual(0); - console.info(TAG + "QualityLevel QUALITY_LEVEL_MEDIUM : " + cameraObj.QualityLevel.QUALITY_LEVEL_MEDIUM); - expect(cameraObj.QualityLevel.QUALITY_LEVEL_MEDIUM).assertEqual(1); - console.info(TAG + "QualityLevel QUALITY_LEVEL_LOW : " + cameraObj.QualityLevel.QUALITY_LEVEL_LOW); - expect(cameraObj.QualityLevel.QUALITY_LEVEL_LOW).assertEqual(2); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100 - * @tc.name : CameraInputErrorCode ENAME - * @tc.desc : CameraInputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100 : " + cameraObj.CameraInputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.CameraInputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100 - * @tc.name : CaptureSessionErrorCode ENAME - * @tc.desc : CaptureSessionErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100 : " + cameraObj.CaptureSessionErrorCode.ERROR_UNKNOWN); - expect(cameraObj.CaptureSessionErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100 - * @tc.name : PreviewOutputErrorCode ENAME - * @tc.desc : PreviewOutputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100 : " + cameraObj.PreviewOutputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.PreviewOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100 - * @tc.name : PhotoOutputErrorCode ENAME - * @tc.desc : PhotoOutputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100 : " + cameraObj.PhotoOutputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.PhotoOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100 - * @tc.name : VideoOutputErrorCode ENAME - * @tc.desc : VideoOutputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100 : " + cameraObj.VideoOutputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.VideoOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets b/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets deleted file mode 100644 index 3b990e106f896ed54704bdb813583aa6c359e1fb..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets +++ /dev/null @@ -1,3606 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables -var camera0Input; -var camera1Input; -var cameraManager; -var previewOutputAsync; -var photoOutputAsync; -var captureSession; -var surfaceId1; -var camerasArray; - -var Point1 = { x: 1, y: 1 } -var Point2 = { x: 2, y: 2 } -var Point3 = { x: 3, y: 3 } - -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -export default function cameraJSUnitPhotoAsync(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJsUnitPhotoAsync', function () { - console.info(TAG + '----------CameraJsUnitPhotoAsync--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - console.info(TAG + "----------Camera-Precision Control-Async-------------"); - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Camera Manager success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering Camera Manager data is not null || undefined"); - cameraManager = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManager == null || cameraManager == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManager == null || undefined") - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate") - cameraManager.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManager is success"); - if (data != null || data != undefined) { - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Get camera from cameramanager to get array of camera async api - * @tc.desc : Get camera from cameramanager to get array of camera async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------"); - cameraManager.getCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering GetCameras success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering GetCameras data is not null || undefined"); - camerasArray = data; - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId; - console.info(TAG + "Entering GetCameras camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArray[i].cameraPosition; - console.info(TAG + "Entering GetCameras camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArray[i].cameraType; - console.info(TAG + "Entering GetCameras camera" + i + "Type: " + cameraType); - var connectionType = camerasArray[i].connectionType - console.info(TAG + "Entering GetCameras connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera0Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[0].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 - * @tc.name : Create camerainput from camera-1 cameraId async api - * @tc.desc : Create camerainput from camera-1 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200', 0, async function (done) { - cameraManager.createCameraInput(camerasArray[1].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 data is not null || undefined"); - camera1Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 PASSED with CameraID :" + camerasArray[1].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering CameraInputCallbackOnError cameraInput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 to operate"); - camera0Input.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "cameraInput error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - } - await sleep(1000); - done(); - }) - - /*PreviewOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 - * @tc.name : Create PreviewOutput instance api - * @tc.desc : Create PreviewOutput instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100', 0, async function (done) { - console.info(TAG + " Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 to operate"); - cameraObj.createPreviewOutput(surfaceId, async (err, data) => { - if (!err) { - console.info(TAG + " Entering createPreviewOutput success"); - if (data != null || data != undefined) { - console.info(TAG + " Entering createPreviewOutput data is not null || undefined"); - previewOutputAsync = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 PASSED" + previewOutputAsync); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 FAILED : " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 - * @tc.name : Preview output callback on error api - * @tc.desc : Preview output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering PreviewOutputError callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 to operate"); - previewOutputAsync.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 - * @tc.name : Create PhotoOutput instance api - * @tc.desc : Create PhotoOutput instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1000) - cameraObj.createPhotoOutput(surfaceId1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering createPhotoOutput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering createPhotoOutput data is not null || undefined"); - photoOutputAsync = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 to operate"); - photoOutputAsync.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error during PhotoOutput with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 - * @tc.name : Create CaptureSession instance api - * @tc.desc : Create CaptureSession instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 to operate"); - cameraObj.createCaptureSession(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering createCaptureSession success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering createCaptureSession data is not null || undefined"); - captureSession = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - //Capturesession callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 - * @tc.name : CaptureSession callback on error api - * @tc.desc : CaptureSession callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering captureSession error callback captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 to operate"); - captureSession.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 - * @tc.name : CaptureSession_Begin config api - * @tc.desc : CaptureSession_Begin config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering BeginConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 to operate"); - captureSession.beginConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering beginConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering BeginConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 beginConfig PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 - * @tc.name : Add Input with camera1Input api - * @tc.desc : Add Input with camera1Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering Addinput captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 to operate"); - captureSession.addInput(camera1Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddInput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddInput data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 addInput PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Preview captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 to operate"); - captureSession.addOutput(previewOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Preview : Success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Preview data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 to operate"); - captureSession.removeOutput(previewOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove preview Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove preview Output FAILED" + err.message); - console.info(TAG + "Entering Remove Preview Output ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Preview captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 to operate"); - captureSession.addOutput(previewOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Preview : Success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Preview data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CommitConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 to operate"); - captureSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering commitConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering CommitConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 to operate"); - photoOutputAsync.isMirrorSupported(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 to operate"); - photoOutputAsync.setMirror(true, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 - * @tc.name : setMirror false - * @tc.desc : setMirror false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 to operate"); - photoOutputAsync.setMirror(false, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 is success"); - console.info(TAG + "setMirror is : " + 'false'); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 - * @tc.name : CaptureSession_Begin config api - * @tc.desc : CaptureSession_Begin config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering BeginConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 to operate"); - captureSession.beginConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering beginConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering BeginConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 beginConfig PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 to operate"); - captureSession.removeInput(camera1Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove input success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove Input FAILED" + err.message); - console.info(TAG + "Entering Remove Input ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering Addinput captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 to operate"); - captureSession.addInput(camera0Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddInput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddInput data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 addInput PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 to operate"); - captureSession.removeOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove photo Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove photo Output FAILED" + err.message); - console.info(TAG + "Entering Remove photo Output ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CommitConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 to operate"); - captureSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering commitConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering CommitConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0Input.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0Input.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //preview callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering PreviewStart frameStart Callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 to operate"); - previewOutputAsync.on("frameStart", async (err, data) => { - if (!err) { - console.info(TAG + "PreviewStart frameStart Callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 FAILED : + err.message"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 - * @tc.name : Preview capture callback on frame end api - * @tc.desc : Preview capture callback on frame end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering PreviewOutput frameEnd Callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 to operate"); - previewOutputAsync.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 Callback is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 FAILED : + err.message"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering Photo Capture Callback on CaptureStart photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 to operate"); - photoOutputAsync.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "Photo Capture Callback on CaptureStart is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 to operate"); - photoOutputAsync.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 FAILED' + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 to operate"); - photoOutputAsync.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "frameShutter callback with captureId: " + data.captureId); - console.info(TAG + "frameShutter callback with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 - * @tc.name : capture session start api - * @tc.desc : capture session start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CaptureSession Start captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 to operate"); - captureSession.start(async (err, data) => { - if (!err) { - console.info(TAG + "Entering captureSession.start success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 PASSED"); - } - else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //Location - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - photoOutputAsync.capture(photosettings1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings1"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 - * @tc.name : Photo output capture with photosettings2 api - * @tc.desc : Photo output capture with photosettings2 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 to operate"); - photoOutputAsync.capture(photosettings2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings2 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 to operate"); - photoOutputAsync.capture(photosettings3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings3 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings3 data is not null || undefined"); - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 ends here"); - } - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS with Rotation-270 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 to operate"); - photoOutputAsync.capture(photosettings4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings4 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings4 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 ends here"); - } - }) - await sleep(1000); - done(); - } - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100', 0, async function (done) { - console.info(TAG + "hasFlash called.") - camera0Input.hasFlash(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 is: " + data); - expect(data).assertEqual(true); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 FAILED : " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 ends here"); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 success"); - if (data == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_ALWAYS_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 success"); - if (data == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check if flash mode auto is supported-camera0Input api - * @tc.desc : check if flash mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_AUTO SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 success"); - if (data == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_CLOSE SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 success"); - if (data == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 - * @tc.name : get zoom ratio camera-0 cameraId api - * @tc.desc : get zoom ratio camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100--------------"); - camera0Input.getZoomRatioRange(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 Success " + data) - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(1, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(2, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_0100 PASSED "); - } - else { - expect().assertFail(); - console.info(TAG + "GET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - } else { - expect().assertFail(); - console.info(TAG + "SET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(3, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(4, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(5, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(6, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 - * @tc.name : check if focus mode locked is supported-camera0Input api - * @tc.desc : check if focus mode locked is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Is Focus Mode Locked Supported SUCCESS: " + data); - if (data != null || data != undefined) { - console.info(TAG + "Entering Is Focus Mode Locked Supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_LOCKED_SUPPORTED is: " + data); - expect(data).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 FAILED :" + err.message); - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Mode Locked SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 FAILED : ") - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Mode Locked SUCCESS: " + data); - console.info(TAG + "Get Focus Mode Locked data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 - * @tc.name : get focal length camera0 api - * @tc.desc : get focal length camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 to operate"); - camera0Input.getFocalLength(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focal length SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focal length is: " + JSON.stringify(data)); - expect(data).assertEqual(3.4600000381469727); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_FOCUS_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_FOCUS_0100', 0, async function (done) { - console.info(TAG + "Entering SET_FOCUS_POINT to operate"); - camera0Input.setFocusPoint(Point1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SET_FOCUS_POINT PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SET_FOCUS_POINT FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SET_FOCUS_POINT ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_FOCUS_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_FOCUS_0100', 0, async function (done) { - console.info(TAG + "Entering GET_FOCUS_POINT to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "GET_FOCUS_POINT PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "GET_FOCUS_POINT FAILED : " + err.message); - console.info(TAG + "GET_FOCUS_POINT ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 - * @tc.name : check if focus mode manual is supported-camera0Input api - * @tc.desc : check if focus mode manual is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 FAILED " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 - * @tc.name : set focus Point locked camera0 api - * @tc.desc : set focus Point locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 to operate"); - camera0Input.setFocusPoint(Point2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 - * @tc.name : check if focus mode continuous is supported-camera0Input api - * @tc.desc : check if focus mode continuous is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINOUS_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 to operate"); - camera0Input.setFocusPoint(Point3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : GET_FOCUS_POINT_focus mode auto - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check if focus mode auto is supported-camera0Input api - * @tc.desc : check if focus mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_AUTO_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (data != null || data != undefined) { - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 PASSED") - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 to operate"); - camera0Input.getExposureBiasRange(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias range SUCCESS"); - console.info(TAG + "Current Exposure bias range is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 -4 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 to operate"); - camera0Input.setExposureBias(-4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 mode locked - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 mode auto - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 to operate"); - camera0Input.setExposurePoint(Point1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 mode auto - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure Mode SUCCESS"); - console.info(TAG + "Get Exposure Mode data is not null || undefined: "); - console.info(TAG + "Current ExposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 mode auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 to operate"); - camera0Input.setExposureBias(1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "1"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 mode auto - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 to operate"); - camera0Input.setExposurePoint(Point2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - photoOutputAsync.capture(photosettings1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings1"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 mode auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 to operate"); - camera0Input.setExposureBias(4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 mode continuous auto - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 to operate"); - camera0Input.setExposurePoint(Point3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 to operate"); - photoOutputAsync.capture(photosettings2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings2"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 -5 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 to operate"); - camera0Input.setExposureBias(-5, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 mode locked - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 6 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 to operate"); - camera0Input.setExposureBias(6, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 - * @tc.name : capture session stop api - * @tc.desc : capture session stop api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 to operate"); - captureSession.stop(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 captureSession.stop success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering captureSession.stop data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 captureSession.stop PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 - * @tc.name : capture session release api - * @tc.desc : capture session release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 to operate"); - captureSession.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering captureSession.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering captureSession.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 ends here"); - await sleep(1000); - done(); - } - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 - * @tc.name : photoOutput release api - * @tc.desc : photoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 photoOutputAsync == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 to operate"); - photoOutputAsync.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutputAsync.release success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 FAILED: " + err.message); - console.info(TAG + "Entering photoOutputAsync.release ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 - * @tc.name : previewOutput release api - * @tc.desc : previewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 previewOutputAsync == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 to operate"); - previewOutputAsync.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering previewOutputAsync.release success"); - console.info(TAG + "Entering previewOutputAsync.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 ends here"); - await sleep(1000); - done(); - } - }) - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 - * @tc.name : camera Input release api - * @tc.desc : camera Input release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 camera0Input == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 to operate"); - camera0Input.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering camera0Input.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering camera0Input.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - }) - await sleep(1000); - done(); - } - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets b/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets deleted file mode 100644 index c14442e53bbb82953bb57518e61b1a76791d112c..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets +++ /dev/null @@ -1,3283 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables -var camera0InputPromise; -var cameraManagerPromise; -var previewOutputPromise; -var photoOutputPromise; -var CaptureSessionPromise; -var surfaceId1; -var camerasArrayPromise -var camera1InputPromise; - -var Point1 = { x: 1, y: 1 } -var Point2 = { x: 2, y: 2 } -var Point3 = { x: 3, y: 3 } - -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -export default function cameraJSUnitPhotoPromise(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJsUnitPhotoPromise', function () { - console.info(TAG + '----------CameraJsUnitPhotoPromise--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - console.info(TAG + "----------Camera-PhotoMode-Promise-------------"); - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------"); - cameraManagerPromise = await cameraObj.getCameraManager(null); - console.info(TAG + "Entering Get camera manager cameraManagerPromise: " + JSON.stringify(cameraManagerPromise)); - if (cameraManagerPromise != null && cameraManagerPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManagerPromise == null || cameraManagerPromise == undefined) { - console.info(TAG + 'Entering camera status callback cameraManagerPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate') - cameraManagerPromise.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManagerPromise is success"); - if (data != null || data != undefined) { - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 - * @tc.name : Get camera from cameramanager to get array of camera promise api - * @tc.desc : Get camera from cameramanager to get array of camera promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100--------------"); - camerasArrayPromise = await cameraManagerPromise.getCameras(); - console.info(TAG + "Entering Get Cameras: " + JSON.stringify(camerasArrayPromise)); - if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { - console.info(TAG + "Entering Get Cameras success"); - for (var i = 0; i < camerasArrayPromise.length; i++) { - // Get the variables from camera object - var cameraId = camerasArrayPromise[i].cameraId; - console.info(TAG + "Entering Get Cameras camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArrayPromise[i].cameraPosition; - console.info(TAG + "Entering Get Cameras camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArrayPromise[i].cameraType; - console.info(TAG + "Entering Get Cameras camera" + i + "Type: " + cameraType); - var connectionType = camerasArrayPromise[i].connectionType - console.info(TAG + "Entering Get Cameras connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraId promise api - * @tc.desc : Create camerainput from camera-0 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------CAMERA-0 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera0InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraId); - console.info(TAG + "Entering Create camerainput camera0InputPromise: " + JSON.stringify(camera0InputPromise)); - if (camera0InputPromise != null && camera0InputPromise != undefined) { - console.info(TAG + "Entering Create camerainput camera0InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 - * @tc.name : Create camerainput from camera-1 cameraId promise api - * @tc.desc : Create camerainput from camera-1 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200--------------"); - camera1InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[1].cameraId); - console.info(TAG + "Entering Create camerainput camera1InputPromise: " + JSON.stringify(camera1InputPromise)); - if (camera1InputPromise != null && camera1InputPromise != undefined) { - console.info(TAG + "Entering Create camerainput camera1InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 to operate"); - camera0InputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "camera0InputPromise error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error during camera0InputPromise with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*PreviewOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Create PreviewOutput instance promise api - * @tc.desc : Create PreviewOutput instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - console.info(TAG + " Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - previewOutputPromise = await cameraObj.createPreviewOutput(surfaceId); - console.info(TAG + " Entering createPreviewOutput success"); - if (previewOutputPromise != null || previewOutputPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering createPreviewOutput PASSED: " + JSON.stringify(previewOutputPromise)); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 - * @tc.name : Preview output callback on error api - * @tc.desc : Preview output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview output callback on error previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 to operate"); - previewOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Create PhotoOutput instance promise api - * @tc.desc : Create PhotoOutput instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1000) - photoOutputPromise = await cameraObj.createPhotoOutput(surfaceId1); - console.info(TAG + "Entering createPhotoOutput success"); - if (photoOutputPromise != null || photoOutputPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output callback on error photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 to operate"); - photoOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 - * @tc.name : Create CaptureSession instance promise api - * @tc.desc : Create Capturesession instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 to operate"); - CaptureSessionPromise = await cameraObj.createCaptureSession(null); - console.info(TAG + "Entering createCaptureSession success"); - if (CaptureSessionPromise != null || CaptureSessionPromise != undefined) { - console.info(TAG + "Entering createCaptureSession data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - //Capturesession callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 - * @tc.name : CaptureSession callback on error api - * @tc.desc : CaptureSession callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering CaptureSession callback on error captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 to operate"); - CaptureSessionPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession errorcallback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 - * @tc.name : CaptureSession_Begin config promise api - * @tc.desc : CaptureSession_Begin config promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering CaptureSession_Begin config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 to operate"); - const promise = await CaptureSessionPromise.beginConfig(); - console.info(TAG + "Entering beginConfig success:"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 beginConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add Input captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 to operate"); - const Promise = await CaptureSessionPromise.addInput(camera1InputPromise); - console.info(TAG + "Entering Add Input addInput success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add preview Output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 to operate"); - const promise = await CaptureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering Add preview Output : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Remove preview Output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 to operate"); - const Promise = await CaptureSessionPromise.removeOutput(previewOutputPromise); - console.info(TAG + "Entering Remove preview Output success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add preview Output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 to operate"); - const promise = await CaptureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering Add preview Output : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering commit config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 to operate"); - const promise = await CaptureSessionPromise.commitConfig(); - console.info(TAG + "Entering commit config commitConfig success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 commitConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 commitConfig FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 commitConfig ends here"); - } - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 to operate"); - await photoOutputPromise.isMirrorSupported() - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 FAILED : " + err.message); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 to operate"); - await photoOutputPromise.setMirror(true).then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 FAILED : " + err.message); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 - * @tc.name : setMirror false - * @tc.desc : setMirror false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 to operate"); - await photoOutputPromise.setMirror(false) - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'false'); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 FAILED : " + err.message); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100 - * @tc.name : CaptureSession_Begin config promise api - * @tc.desc : CaptureSession_Begin config promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100 to operate"); - const promise = await CaptureSessionPromise.beginConfig(); - console.info(TAG + "Entering beginConfig success:"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100 beginConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering beginConfig FAILED"); - } - console.info(TAG + "Entering beginConfig ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 to operate"); - const Promise = await CaptureSessionPromise.removeInput(camera1InputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add Input captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 to operate"); - const Promise = await CaptureSessionPromise.addInput(camera0InputPromise); - console.info(TAG + "Entering Add Input addInput success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add output with photo output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 to operate"); - const promise = await CaptureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering Add output with photo output success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 to operate"); - const Promise = await CaptureSessionPromise.removeOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 addInput success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 to operate"); - const promise = await CaptureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering commit config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 to operate"); - const promise = await CaptureSessionPromise.commitConfig(); - console.info(TAG + "Entering commit config commitConfig success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 commitConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 commitConfig FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 commitConfig ends here"); - } - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0InputPromise.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0InputPromise.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - // callback related API - //preview callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview output callback on frame start previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 to operate"); - previewOutputPromise.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 FAILED :" + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 - * @tc.name : Preview capture callback on frame end api - * @tc.desc : Preview capture callback on frame end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview capture callback on frame end previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 to operate"); - previewOutputPromise.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 FAILED : + err.message"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture start photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 to operate"); - photoOutputPromise.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "CaptureStart Callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture end photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 to operate"); - photoOutputPromise.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 FAILED' + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on frame shutter photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 to operate"); - photoOutputPromise.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 with captureId: " + data.captureId); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 - * @tc.name : capture session start api - * @tc.desc : capture session start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering capture session start captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 to operate"); - await CaptureSessionPromise.start(); - console.info(TAG + "Entering captureSession start success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - //Location - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - await photoOutputPromise.capture(photosettings1) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 FAILED:" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 to operate"); - await photoOutputPromise.capture(photosettings2) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 FAILED:" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 to operate"); - await photoOutputPromise.capture(photosettings3) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings3 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 :" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 to operate"); - await photoOutputPromise.capture(photosettings4) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings4 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100--------------"); - console.info(TAG + 'hasFlash called.') - var hasFlashPromise = await camera0InputPromise.hasFlash(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 success"); - if (hasFlashPromise != null || hasFlashPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 is: " + JSON.stringify(hasFlashPromise)); - expect(hasFlashPromise).assertEqual(true); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 FAILED : "); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 ends here"); - await sleep(1000) - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 to operate"); - var isFMOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 SUCCESS "); - if (isFMOpenSupported != null || isFMOpenSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + JSON.stringify(isFMOpenSupported)); - expect(isFMOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 to operate"); - var SetFMOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMOpen)) - if (SetFMOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 to operate"); - var GetFMOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 success: " + JSON.stringify(GetFMOpen)); - if (GetFMOpen == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + JSON.stringify(GetFMOpen)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 to operate"); - var isFMAlwaysOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 SUCCESS "); - if (isFMAlwaysOpenSupported != null || isFMAlwaysOpenSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + isFMAlwaysOpenSupported); - expect(isFMAlwaysOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - var SetFMAlwaysOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMAlwaysOpen)) - if (SetFMAlwaysOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - var GetFMAlwaysOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 success"); - if (GetFMAlwaysOpen == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAlwaysOpen); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 to operate"); - var isFMAutoSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 SUCCESS "); - if (isFMAutoSupported != null || isFMAutoSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_AUTO data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + isFMAutoSupported); - expect(isFMAutoSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 to operate"); - var SetFMAlwaysAuto = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "SetFMAlwaysAuto: " + JSON.stringify(SetFMAlwaysAuto)) - if (SetFMAlwaysAuto == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 to operate"); - var GetFMAuto = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 success"); - if (GetFMAuto == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAuto); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 to operate"); - var isFMCloseSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 SUCCESS "); - if (isFMCloseSupported != null || isFMCloseSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + isFMCloseSupported); - expect(isFMCloseSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 to operate"); - var SetFMClose = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMClose)) - if (SetFMClose == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 - * @tc.name : get flash mode close camera0 api - * @tc.desc : get flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 to operate"); - var GetFMClose = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 success"); - if (GetFMClose == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMClose); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - //ZOOM Function - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 - * @tc.name : get zoom ratio camera-0 cameraId api promise api - * @tc.desc : get zoom ratio camera-0 cameraId api promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100--------------"); - var getZoomRatioPromise = await camera0InputPromise.getZoomRatioRange(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 getZoomRatioPromise: " + JSON.stringify(getZoomRatioPromise)); - if (getZoomRatioPromise != null && getZoomRatioPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 setZoomRatioPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 success: " + JSON.stringify(getZoomRatioPromise)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(1); - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - var getpromise1 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise1); - if (getpromise1 != null && getpromise1 != undefined) { - expect(getpromise1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(2); - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - var getpromise2 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise2); - if (getpromise2 != null && getpromise2 != undefined) { - expect(getpromise2).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(3); - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - var getpromise3 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise3); - if (getpromise3 != null && getpromise3 != undefined) { - expect(getpromise3).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(4); - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - var getpromise4 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise4); - if (getpromise4 != null && getpromise4 != undefined) { - expect(getpromise4).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(5); - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - var getpromise5 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise5); - if (getpromise5 != null && getpromise5 != undefined) { - expect(getpromise5).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(6); - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - var getpromise6 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise6); - if (getpromise6 != null && getpromise6 != undefined) { - expect(getpromise6).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - // FOCUS promise API's - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 - * @tc.name : check is focus mode locked supported-camera0Input api - * @tc.desc : check is focus mode locked supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 to operate"); - var isFMLockedSupported = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering is focus mode locked supported SUCCESS "); - if (isFMLockedSupported != null || isFMLockedSupported != undefined) { - console.info(TAG + "Entering is focus mode locked supported data is not null || undefined"); - console.info(TAG + "is focus mode locked supported : " + isFMLockedSupported); - expect(isFMLockedSupported).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED) - .then(function (data) { - console.info(TAG + "SetFMLocked: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode locked SUCCESS, current focusmode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 FAILED : ") - expect().assertFail(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode locked success: "); - if (data == 0) { - console.info(TAG + "Current focusmode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 - * @tc.name : get focal length camera0 api - * @tc.desc : get focal length camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 to operate"); - await camera0InputPromise.getFocalLength() - .then(function (data) { - console.info(TAG + "Current focallength is: " + JSON.stringify(data)); - expect(data).assertEqual(3.4600000381469727); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 - * @tc.name : is focusmode manual supported - * @tc.desc : is focusmode manual supported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 to operate"); - var isFMmanualSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL); - if (isFMmanualSupportedpromise != null || isFMmanualSupportedpromise != undefined) { - console.info(TAG + "Entering is focusmode manual supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMmanualSupportedpromise); - expect(isFMmanualSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL) - .then(function (data) { - console.info(TAG + "setFocusManual: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode manual SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode manual SUCCESS"); - if (data == 0) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 FAILED " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 - * @tc.name : check is focus mode continuous supported-camera0Input api - * @tc.desc : check is focus mode continuous supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 to operate"); - var isFMContinuousSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - if (isFMContinuousSupportedpromise != null || isFMContinuousSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode continuous supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINUOUS_SUPPORTED is: " + isFMContinuousSupportedpromise); - expect(isFMContinuousSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) - .then(function (data) { - console.info(TAG + "setFocusCont: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode continuous SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode continuous SUCCESS"); - if (data == 1) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check is focus mode auto supported-camera0Input api - * @tc.desc : check is focus mode auto supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 to operate"); - var isFMAutoSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (isFMAutoSupportedpromise != null || isFMAutoSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode auto supported data is not null || undefined"); - console.info(TAG + "is focus mode auto supported is: " + isFMAutoSupportedpromise); - expect(isFMAutoSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 to operate"); - var setFocusAuto = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO) - .then(function () { - console.info(TAG + "setFocusAuto: " + JSON.stringify(setFocusAuto)) - console.info(TAG + "Entering set focus mode auto SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode auto SUCCESS " + JSON.stringify(data)); - if (data == 2) { - console.info(TAG + "Current FocusMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 PASSED"); - } - }) - .catch((err) => { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode locked SUCCESS"); - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 to operate"); - await camera0InputPromise.getExposureBiasRange() - .then(function (data) { - console.info(TAG + "Entering getExposureBiasRange SUCCESS"); - console.info(TAG + "Current ExposureBiasRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100-4 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 to operate"); - await camera0InputPromise.setExposureBias(-4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 to operate"); - await camera0InputPromise.setExposurePoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 FAILED: " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 to operate"); - await camera0InputPromise.setExposureBias(1) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "1"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 to operate"); - await camera0InputPromise.setExposurePoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 to operate"); - await photoOutputPromise.capture(photosettings1) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with Rotation-0 & Quality-0 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 FAILED:" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 to operate"); - await camera0InputPromise.setExposureBias(4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 to operate"); - await camera0InputPromise.setExposurePoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - await photoOutputPromise.capture(photosettings2) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with location settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400-5 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 to operate"); - await camera0InputPromise.setExposureBias(-5) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 to operate"); - await camera0InputPromise.setExposureBias(6) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 ends here"); - await sleep(1000); - done(); - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 - * @tc.name : capture session stop api - * @tc.desc : capture session stop api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering capture session stop captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 to operate"); - await CaptureSessionPromise.stop(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 captureSession.stop PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 captureSession.stop ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : capture session release api - * @tc.desc : capture session release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering capture session release captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await CaptureSessionPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : PreviewOutput release api - * @tc.desc : PreviewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering previewOutputPromise.release previewOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await previewOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : PhotoOutput release api - * @tc.desc : PhotoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering PhotoOutput release photoOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await photoOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : cameraInput release api - * @tc.desc : cameraInput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering cameraInput release camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await camera0InputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - }); -} \ No newline at end of file diff --git a/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets b/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets deleted file mode 100644 index 571ca690ff89ac2fbd3becb18f81fc97bc447bf8..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets +++ /dev/null @@ -1,3800 +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 cameraObj from '@ohos.multimedia.camera'; -import media from '@ohos.multimedia.media' -import image from '@ohos.multimedia.image'; -import mediaLibrary from '@ohos.multimedia.mediaLibrary' -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' - -// @ts-nocheck -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -let TAG = "CameraModuleTest: "; -var cameraManager -var camerasArray -var camera0Input -var previewOutput -var photoOutputAsync -var videoRecorder -var surfaceId1 - -var minFrameRate_Grp0=12; -var maxFrameRate_Grp0=12; -var minFrameRate_Mix=14; -var maxFrameRate_Mix=15; -var minFrameRate_Err1=11; -var maxFrameRate_Err1=31; -var minFrameRate_Err2=14; -var maxFrameRate_Err2=28; -var minFrameRate_Err3=16; -var maxFrameRate_Err3=25; -var minFrameRate_Grp20=30; -var maxFrameRate_Grp20=30; - -var Point = { x: 1, y: 1 } -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -let fdPath; -let fileAsset; -let fdNumber; -let configFile = { - audioBitrate: 48000, - audioChannels: 2, - audioCodec: 'audio/mp4a-latm', - audioSampleRate: 48000, - durationTime: 1000, - fileFormat: 'mp4', - videoBitrate: 48000, - videoCodec: 'video/mp4v-es', - videoFrameWidth: 640, - videoFrameHeight: 480, - videoFrameRate: 30 -} - -let videoConfig = { - audioSourceType: 1, - videoSourceType: 0, - profile: configFile, - url: 'file:///data/media/02.mp4', - orientationHint: 0, - location: { latitude: 30, longitude: 130 }, - maxSize: 100, - maxDuration: 500 -} -var videoId -var videoOutput -var captureSession - -export default function cameraJSUnitVideoAsync(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(time) { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(1) - }, time * 1000) - }).then(() => { - console.info(`sleep ${time} over...`) - }) - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - async function getFd(pathName) { - let displayName = pathName; - const mediaTest = mediaLibrary.getMediaLibrary(); - let fileKeyObj = mediaLibrary.FileKey; - let mediaType = mediaLibrary.MediaType.VIDEO; - let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); - let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); - if (dataUri != undefined) { - let args = dataUri.id.toString(); - let fetchOp = { - selections: fileKeyObj.ID + "=?", - selectionArgs: [args], - } - let fetchFileResult = await mediaTest.getFileAssets(fetchOp); - fileAsset = await fetchFileResult.getAllObject(); - fdNumber = await fileAsset[0].open('Rw'); - fdPath = "fd://" + fdNumber.toString(); - } - } - - async function closeFd() { - if (fileAsset != null) { - await fileAsset[0].close(fdNumber).then(() => { - console.info('[mediaLibrary] case close fd success'); - }).catch((err) => { - console.info('[mediaLibrary] case close fd failed'); - }); - } else { - console.info('[mediaLibrary] case fileAsset is null'); - } - } - - async function getvideosurface() { - await getFd('02.mp4'); - videoConfig.url = fdPath; - media.createVideoRecorder((err, recorder) => { - console.info(TAG + 'createVideoRecorder called') - videoRecorder = recorder - console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder)) - console.info(TAG + 'videoRecorder.prepare called.') - videoRecorder.prepare(videoConfig, (err) => { - console.info(TAG + 'videoRecorder.prepare success.') - }) - videoRecorder.getInputSurface((err, id) => { - console.info(TAG + 'getInputSurface called') - videoId = id - console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoId)) - }) - }) - } - - describe('VideoModeAsync', function () { - console.info(TAG + '----------Camera-VideoMode-Async--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5); - console.info('beforeEach case'); - }) - - afterEach(async function () { - await closeFd(); - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100--------------') - await sleep(1) - cameraObj.getCameraManager(null, (err, data) => { - if (!err) { - console.info(TAG + 'Entering Get Camera manager success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Get Camera Manager data is not null || undefined') - cameraManager = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 PASSED') - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManager == null || cameraManager == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManager == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate') - cameraManager.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManager is success"); - if (data != null || data != undefined) { - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Camera status Callback FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------') - await sleep(1) - cameraManager.getCameras((err, data) => { - if (!err) { - console.info(TAG + 'Entering Get Cameras success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Get Cameras data is not null || undefined') - camerasArray = data - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId - console.info(TAG + 'Entering Get Cameras camera' + i + 'Id: ' + cameraId) - var cameraPosition = camerasArray[i].cameraPosition - console.info(TAG + 'Entering Get Cameras camera' + i + 'Position: ' + cameraPosition) - var cameraType = camerasArray[i].cameraType - console.info(TAG + 'Entering Get Cameras camera' + i + 'Type: ' + cameraType) - var connectionType = camerasArray[i].connectionType - console.info(TAG + 'Entering Get Cameras connection' + i + 'Type: ' + connectionType) - } - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined') - } - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info('--------------CAMERA-0 STARTS HERE--------------') - console.info('--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------') - await sleep(1) - cameraManager.createCameraInput(camerasArray[0].cameraId, (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + 'Entering Create camera input data is not null || undefined') - camera0Input = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :' + camerasArray[0].cameraId) - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering Camera Input callback camera0Input == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 to operate"); - camera0Input.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "camera0Input error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 - * @tc.name : Create previewoutput async api - * @tc.desc : Create previewoutput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 to operate') - await sleep(1) - cameraObj.createPreviewOutput(surfaceId, (err, data) => { - if (!err) { - console.info(TAG + 'Entering Create preview output success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Create preview output data is not null || undefined') - previewOutput = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 PASSED') - } - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Preview output callback on error api - * @tc.desc : Preview output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering PreviewOutput callback on error previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 to operate"); - previewOutput.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Create PhotoOutput instance api - * @tc.desc : Create PhotoOutput instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1) - cameraObj.createPhotoOutput(surfaceId1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering createPhotoOutput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering createPhotoOutput data is not null || undefined"); - photoOutputAsync = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate"); - photoOutputAsync.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error during PhotoOutput with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 - * @tc.name : Create videooutput async api - * @tc.desc : Create videooutput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 to operate') - await getvideosurface() - await sleep(2) - cameraObj.createVideoOutput(videoId, (err, data) => { - if (!err) { - console.info(TAG + 'Entering Create videooutput success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Create videooutput data is not null || undefined') - videoOutput = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 PASSED') - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : VideoOutput callback onerror async api - * @tc.desc : VideoOutput callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 videoOutput == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - videoOutput.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "VideoOutput Errorcallback is success") - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1) - done() - }) - await sleep(1) - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 - * @tc.name : Create capturesession async api - * @tc.desc : Create capturesession async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 to operate') - await sleep(1) - cameraObj.createCaptureSession(null, async (err, data) => { - if (!err) { - console.info(TAG + 'Entering Create capturesession success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Create capturesession data is not null || undefined') - captureSession = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 PASSED') - } - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail() - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 - * @tc.name : CaptureSession callback on error api - * @tc.desc : CaptureSession callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 to operate"); - captureSession.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession errorcallback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 - * @tc.name : Begin Config async api - * @tc.desc : Begin Config async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering Begin Config captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 to operate') - await sleep(1) - captureSession.beginConfig((err, data) => { - if (!err) { - console.info(TAG + 'Entering Begin Config success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 - * @tc.name : AddInput async api - * @tc.desc : AddInput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddInput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 to operate') - await sleep(1) - captureSession.addInput(camera0Input, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddInput success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 - * @tc.name : AddOutput preview async api - * @tc.desc : AddOutput preview async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput preview captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 to operate') - await sleep(1) - captureSession.addOutput(previewOutput, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput preview success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 ends here"); - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 - * @tc.name : AddOutput video async api - * @tc.desc : AddOutput video async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput video captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 to operate') - await sleep(1) - captureSession.addOutput(videoOutput, async (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput video success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 ends here') - await sleep(1); - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeInput(camera0Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove input success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering Remove Input FAILED" + err.message); - console.info(TAG + "Entering Remove Input ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeOutput(previewOutput, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove preview Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering Remove preview Output FAILED" + err.message); - console.info(TAG + "Entering Remove Preview Output ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove photo Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove photo Output FAILED" + err.message); - console.info(TAG + "Entering Remove photo Output ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Remove video Output api - * @tc.desc : Remove video Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeOutput(videoOutput, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove video Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering Remove video Output FAILED" + err.message); - console.info(TAG + "Entering Remove video Output ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 - * @tc.name : AddInput async api - * @tc.desc : AddInput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddInput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 to operate') - await sleep(1) - captureSession.addInput(camera0Input, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddInput success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 - * @tc.name : AddOutput preview async api - * @tc.desc : AddOutput preview async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 to operate') - await sleep(1) - captureSession.addOutput(previewOutput, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput success') - console.info(TAG + 'Entering AddOutput data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 ends here"); - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 - * @tc.name : AddOutput video async api - * @tc.desc : AddOutput video async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 to operate') - await sleep(1) - captureSession.addOutput(videoOutput, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput success') - console.info(TAG + 'Entering AddOutput data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 ends here') - done() - }) - await sleep(1) - done() - } - }) - - //framerate - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 - * @tc.name : get frame rate range camera0 api - * @tc.desc : get frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 to operate"); - videoOutput.getFrameRateRange(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get frame rate range success"); - expect(true).assertTrue(); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Grp0,maxFrameRate_Grp0, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range PASSED") - expect(true).assertTrue(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Mix,maxFrameRate_Mix, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED") - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api_err - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Err1,maxFrameRate_Err1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED") - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Err2,maxFrameRate_Err2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED"); - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Err3,maxFrameRate_Err3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED"); - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Grp20,maxFrameRate_Grp20, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range PASSED") - expect(true).assertTrue(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeOff - * @tc.desc : getVideoStabilizationModeOff async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode Off success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeLow - * @tc.desc : getVideoStabilizationModeLOw async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode low success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(1) - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeMedium - * @tc.desc : getVideoStabilizationModeMedium async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode medium success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeHigh - * @tc.desc : getVideoStabilizationModeHigh async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode High success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeAuto - * @tc.desc : getVideoStabilizationModeAuto async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode Auto success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 - * @tc.name : CommitConfig async api - * @tc.desc : CommitConfig async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering CommitConfig captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 to operate') - await sleep(1) - captureSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + 'Entering CommitConfig success') - console.info(TAG + 'Entering CommitConfig data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0Input.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0Input.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //callback API - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering Preview output callback on frame start previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate"); - previewOutput.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : Preview capture callback on frame end api - * @tc.desc : Preview capture callback on frame end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering Preview capture callback on frame end previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate"); - previewOutput.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering Photo Capture Callback on CaptureStart photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 to operate"); - photoOutputAsync.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "Photo Capture Callback on CaptureStart is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 to operate"); - photoOutputAsync.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 FAILED' + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 to operate"); - photoOutputAsync.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "frameShutter callback with captureId: " + data.captureId); - console.info(TAG + "frameShutter callback with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : VideoOutput callback onframestart async api - * @tc.desc : VideoOutput callback onframestart async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + "Entering VideoOutput callback onframestart videoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate"); - videoOutput.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 is FAILED : " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : VideoOutput callback onframeend async api - * @tc.desc : VideoOutput callback onframeend async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + 'Entering VideoOutput callback onframeend videoOutput == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate') - await sleep(1) - videoOutput.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 is success'); - if (data != null || data != undefined) { - expect(true).assertTrue() - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED' + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 - * @tc.name : CaptureSession start async api - * @tc.desc : CaptureSession start async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CaptureSession start captureSession == null || undefined") - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 to operate") - await sleep(1) - captureSession.start(async (err, data) => { - if (!err) { - console.info(TAG + "Entering CaptureSession start success") - expect(true).assertTrue() - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 PASSED") - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "hasFlash called.") - camera0Input.hasFlash(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 is: " + data); - expect(data).assertEqual(true); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 ends here"); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 success"); - if (data == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_ALWAYS_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 success"); - if (data == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode auto is supported-camera0Input api - * @tc.desc : check if flash mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_AUTO SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 success"); - if (data == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_CLOSE SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 success"); - if (data == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 - * @tc.name : get zoom ratio camera-0 cameraId api - * @tc.desc : get zoom ratio camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100--------------"); - camera0Input.getZoomRatioRange(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 Success " + data) - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 ends here"); - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(1, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(2, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_CALLBACK_0100 PASSED "); - } - else { - expect().assertFail(); - console.info(TAG + "GET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - } else { - expect().assertFail(); - console.info(TAG + "SET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(3, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(4, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(5, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(6, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode locked is supported-camera0Input api - * @tc.desc : check if focus mode locked is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Is Focus Mode Locked Supported SUCCESS: " + data); - if (data != null || data != undefined) { - console.info(TAG + "Entering Is Focus Mode Locked Supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_LOCKED_SUPPORTED is: " + data); - expect(data).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 FAILED :" + err.message); - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Mode Locked SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 FAILED : ") - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Mode Locked SUCCESS: " + data); - console.info(TAG + "Get Focus Mode Locked data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode manual is supported-camera0Input api - * @tc.desc : check if focus mode manual is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 FAILED " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 to operate"); - camera0Input.setFocusPoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode continuous is supported-camera0Input api - * @tc.desc : check if focus mode continuous is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINOUS_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 - * @tc.name : set focus Point locked camera0 api - * @tc.desc : set focus Point locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 to operate"); - camera0Input.setFocusPoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode auto is supported-camera0Input api - * @tc.desc : check if focus mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_AUTO_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (data != null || data != undefined) { - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 PASSED") - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 to operate"); - camera0Input.setFocusPoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 to operate"); - camera0Input.setExposurePoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100_exposure mode continuous auto - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 to operate"); - camera0Input.getExposureBiasRange(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias range SUCCESS"); - console.info(TAG + "Current Exposure bias range is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 to operate"); - camera0Input.setExposureBias(-4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure Mode SUCCESS"); - console.info(TAG + "Get Exposure Mode data is not null || undefined: "); - console.info(TAG + "Current ExposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 to operate"); - camera0Input.setExposurePoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 to operate"); - camera0Input.setExposureBias(1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "1"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 to operate"); - camera0Input.setExposurePoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 to operate"); - camera0Input.setExposureBias(4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100 to operate"); - photoOutputAsync.isMirrorSupported(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100 to operate"); - photoOutputAsync.setMirror(true, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 - * @tc.name : VideoOutput start async api - * @tc.desc : VideoOutput start async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 videoOutput == null || undefined") - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 to operate") - await sleep(1) - videoOutput.start(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 success: " + JSON.stringify(data)) - if (data == undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 FAILED: " + err.message) - } - }) - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 - * @tc.name : VideoRecorder start async api - * @tc.desc : VideoRecorder start async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100', 0, async function (done) { - if (videoRecorder == null || videoRecorder == undefined) { - console.info(TAG + 'Entering VideoRecorder start videoRecorder == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 to operate') - videoRecorder.start() - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 called'); - sleep(3); - console.info(TAG + 'Capture with photosettings1 during video - Start & setMirror: true') - photoOutputAsync.capture(photosettings1) - console.info(TAG + 'Capture during Video - End.') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 - * @tc.name : VideoOutput stop async api - * @tc.desc : VideoOutput stop async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + 'Entering VideoOutput stop videoOutput == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 to operate') - videoOutput.stop(async (err, data) => { - if (!err) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 success: ' + JSON.stringify(data)) - if (data == undefined) { - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100 - * @tc.name : VideoRecorder stop async api - * @tc.desc : VideoRecorder stop async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100', 0, async function (done) { - if (videoRecorder == null || videoRecorder == undefined) { - console.info(TAG + 'Entering VideoRecorder stop videoRecorder == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100 to operate') - videoRecorder.stop() - console.info(TAG + 'VideoRecorder stop stopVideo done.') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100 PASSED') - expect(true).assertTrue() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 - * @tc.name : CaptureSession stop async api - * @tc.desc : CaptureSession stop async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering CaptureSession stop captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 to operate') - await sleep(1) - captureSession.stop((err, data) => { - if (!err) { - console.info(TAG + 'Entering CaptureSession stop success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 - * @tc.name : CaptureSession release async api - * @tc.desc : CaptureSession release async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering CaptureSession release captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 to operate') - await sleep(1) - captureSession.release(async (err, data) => { - if (!err) { - console.info(TAG + 'Entering CaptureSession release success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering CaptureSession release data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 PASSED') - } - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 - * @tc.name : videooutput release api - * @tc.desc : videooutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + "Entering videooutput.release previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 to operate"); - videoOutput.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering videooutput.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering videooutput.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 ends here"); - await sleep(1); - done(); - } - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 - * @tc.name : previewOutput release api - * @tc.desc : previewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 to operate"); - previewOutput.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering previewOutput.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering previewOutput.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering previewOutput.release PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering previewOutput.release ends here"); - await sleep(1); - done(); - } - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 - * @tc.name : photoOutput release api - * @tc.desc : photoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 photoOutputAsync == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 to operate"); - photoOutputAsync.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutputAsync.release success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering photoOutputAsync.release ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 - * @tc.name : camera Input release api - * @tc.desc : camera Input release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering camera0Input.release camera0Input == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 to operate"); - camera0Input.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering camera0Input.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering camera0Input.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 ends here"); - await sleep(1); - done(); - } - }) - await sleep(1); - done(); - } - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets b/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets deleted file mode 100644 index aa4466c90fbcc0482aff18bd91e25e3ae39d7b27..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraLongFocus/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets +++ /dev/null @@ -1,3367 +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 cameraObj from '@ohos.multimedia.camera' -import media from '@ohos.multimedia.media' -import image from '@ohos.multimedia.image'; -import mediaLibrary from '@ohos.multimedia.mediaLibrary' -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' - -// @ts-nocheck -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -let TAG = 'CameraModuleTest: ' -var cameraManagerPromise -var camerasArrayPromise -var camera0InputPromise -var previewOutputPromise -var videoRecorder -var photoOutputPromise -let fdPath; -let fileAsset; -let fdNumber; - -var minFrameRate_Grp0=12; -var maxFrameRate_Grp0=12; -var minFrameRate_Mix=14; -var maxFrameRate_Mix=15; -var minFrameRate_Err1=11; -var maxFrameRate_Err1=31; -var minFrameRate_Err2=14; -var maxFrameRate_Err2=28; -var minFrameRate_Err3=16; -var maxFrameRate_Err3=25; -var minFrameRate_Grp20=30; -var maxFrameRate_Grp20=30; - -var Point1 = { x: 1, y: 1 } -var Point2 = { x: 2, y: 2 } -var Point3 = { x: 3, y: 3 } -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -var photosettings5 = { - rotation: 270, -} -let configFile = { - audioBitrate: 48000, - audioChannels: 2, - audioCodec: 'audio/mp4a-latm', - audioSampleRate: 48000, - durationTime: 1000, - fileFormat: 'mp4', - videoBitrate: 48000, - videoCodec: 'video/mp4v-es', - videoFrameWidth: 640, - videoFrameHeight: 480, - videoFrameRate: 30 -} - -let videoConfig = { - audioSourceType: 1, - videoSourceType: 0, - profile: configFile, - url: 'file:///data/media/01.mp4', - orientationHint: 0, - location: { latitude: 30, longitude: 130 }, - maxSize: 100, - maxDuration: 500 -} -var surfaceId1 -var videoId -var videoOutputPromise -var captureSessionPromise - -export default function cameraJSUnitVideoPromise(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(time) { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(1) - }, time * 1000) - }).then(() => { - console.info(`sleep ${time} over...`) - }) - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - async function getFd(pathName) { - let displayName = pathName; - const mediaTest = mediaLibrary.getMediaLibrary(); - let fileKeyObj = mediaLibrary.FileKey; - let mediaType = mediaLibrary.MediaType.VIDEO; - let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); - let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); - if (dataUri != undefined) { - let args = dataUri.id.toString(); - let fetchOp = { - selections: fileKeyObj.ID + "=?", - selectionArgs: [args], - } - let fetchFileResult = await mediaTest.getFileAssets(fetchOp); - fileAsset = await fetchFileResult.getAllObject(); - fdNumber = await fileAsset[0].open('Rw'); - fdPath = "fd://" + fdNumber.toString(); - } - } - - async function closeFd() { - if (fileAsset != null) { - await fileAsset[0].close(fdNumber).then(() => { - console.info('[mediaLibrary] case close fd success'); - }).catch((err) => { - console.info('[mediaLibrary] case close fd failed'); - }); - } else { - console.info('[mediaLibrary] case fileAsset is null'); - } - } - - async function getvideosurface() { - await getFd('01.mp4'); - videoConfig.url = fdPath; - media.createVideoRecorder((err, recorder) => { - console.info(TAG + 'createVideoRecorder called') - videoRecorder = recorder - console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder)) - console.info(TAG + 'videoRecorder.prepare called.') - videoRecorder.prepare(videoConfig, (err) => { - console.info(TAG + 'videoRecorder.prepare success.') - }) - videoRecorder.getInputSurface((err, id) => { - console.info(TAG + 'getInputSurface called') - videoId = id - console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoId)) - }) - }) - } - - describe('VideoModePromise', function () { - console.info(TAG + '----------Camera-VideoMode-Promise--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5); - console.info('beforeEach case'); - }) - - afterEach(async function () { - await closeFd(); - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------') - cameraManagerPromise = await cameraObj.getCameraManager(null) - console.info(TAG + 'Entering Get cameraManagerPromise cameraManagerPromise: ' + cameraManagerPromise) - if (cameraManagerPromise != null && cameraManagerPromise != undefined) { - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManagerPromise == null || cameraManagerPromise == undefined) { - console.info(TAG + 'Entering Camera status Callback cameraManagerPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate') - await sleep(1) - cameraManagerPromise.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManagerPromise is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100--------------') - camerasArrayPromise = await cameraManagerPromise.getCameras() - console.info(TAG + 'Entering Get Cameras Promise: ' + JSON.stringify(camerasArrayPromise)) - if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { - console.info(TAG + 'Entering Get Cameras Promise success') - for (var i = 0; i < camerasArrayPromise.length; i++) { - // Get the variables from camera object - var cameraId = camerasArrayPromise[i].cameraId - console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Id: ' + cameraId) - var cameraPosition = camerasArrayPromise[i].cameraPosition - console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Position: ' + cameraPosition) - var cameraType = camerasArrayPromise[i].cameraType - console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Type: ' + cameraType) - var connectionType = camerasArrayPromise[i].connectionType - console.info(TAG + 'Entering Get Cameras Promise connection' + i + 'Type: ' + connectionType) - } - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraId promise api - * @tc.desc : Create camerainput from camera-0 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------') - camera0InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraId) - console.info(TAG + 'Entering Create camera input promise camera0InputPromise: ' + JSON.stringify(camera0InputPromise)) - if (camera0InputPromise != null && camera0InputPromise != undefined) { - console.info(TAG + 'Entering Create camera input promise camera0InputPromise is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering Camera input error callback camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 to operate"); - camera0InputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "camera0InputPromise error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 - * @tc.name : Create previewoutput promise api - * @tc.desc : Create previewoutput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100--------------') - previewOutputPromise = await cameraObj.createPreviewOutput(surfaceId) - console.info(TAG + 'Entering Create previewOutputPromise: ' + JSON.stringify(previewOutputPromise)) - if (previewOutputPromise != null && previewOutputPromise != undefined) { - console.info(TAG + 'Entering Create previewOutputPromise is not null || undefined') - expect(true).assertTrue(); - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 PASSED') - } else { - expect().assertFail(); - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0InputPromise.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is : " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0InputPromise.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : PreviewOutput callback onerror async api - * @tc.desc : PreviewOutput callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + 'Entering PreviewOutputError callback previewOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - previewOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 - * @tc.name : Create videooutput promise api - * @tc.desc : Create videooutput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 to operate') - await getvideosurface() - await sleep(2) - videoOutputPromise = await cameraObj.createVideoOutput(videoId) - console.info(TAG + 'Entering Create videoOutputPromise: ' + videoOutputPromise) - if (videoOutputPromise != null && videoOutputPromise != undefined) { - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 PASSED') - } else { - expect().assertFail(); - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 ends here'); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : VideoOutput callback onerror async api - * @tc.desc : VideoOutput callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - videoOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + 'VideoOutput Errorcallback is success') - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1) - done() - }) - await sleep(1) - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Create PhotoOutput instance promise api - * @tc.desc : Create PhotoOutput instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1) - photoOutputPromise = await cameraObj.createPhotoOutput(surfaceId1); - console.info(TAG + "Entering createPhotoOutput success"); - if (photoOutputPromise != null || photoOutputPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output callback on error photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate"); - photoOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 - * @tc.name : Create capturesession promise api - * @tc.desc : Create capturesession promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 to operate') - captureSessionPromise = await cameraObj.createCaptureSession(null) - console.info(TAG + 'Entering Create captureSessionPromise: ' + captureSessionPromise) - if (captureSessionPromise != null && captureSessionPromise != undefined) { - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 ends here'); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 - * @tc.name : CaptureSession callback onerror async api - * @tc.desc : CaptureSession callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + 'Entering captureSession errorcallback captureSessionPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - captureSessionPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession errorcallback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 - * @tc.name : CaptureSession_Begin config promise api - * @tc.desc : CaptureSession_Begin config promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Create captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.beginConfig(); - console.info(TAG + "Entering beginConfig success:"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 beginConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add Input captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.addInput(camera0InputPromise); - console.info(TAG + "Entering Add Input success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add preview output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering Add preview output : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 - * @tc.name : Add output with video output api - * @tc.desc : Add output with video output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add video output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(videoOutputPromise); - console.info(TAG + "Entering Add video output success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add output with photo output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering Add output with photo output success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeInput(camera0InputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeOutput(previewOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 addInput success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Remove video Output api - * @tc.desc : Remove video Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeOutput(videoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 to operate"); - const Promise = await captureSessionPromise.addInput(camera0InputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 addInput success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 to operate"); - const promise = await captureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 - * @tc.name : Add output with video output api - * @tc.desc : Add output with video output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 to operate"); - const promise = await captureSessionPromise.addOutput(videoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 - * @tc.name : get frame rate range camera0 api - * @tc.desc : get frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 to operate"); - await videoOutputPromise.getFrameRateRange() - .then(function (data) { - console.info(TAG + "Entering get frame rate range SUCCESS "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 PASSED : " + JSON.stringify(data)) - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Grp0,maxFrameRate_Grp0) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Mix,maxFrameRate_Mix) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Err1,maxFrameRate_Err1) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Err2,maxFrameRate_Err2) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Err3,maxFrameRate_Err3) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Grp20,maxFrameRate_Grp20) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 - * @tc.name : getVideoStabilizationModeOff - * @tc.desc : getVideoStabilizationModeOff promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeOff SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 - * @tc.name : getVideoStabilizationModeLow - * @tc.desc : getVideoStabilizationModeLow promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeLow SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 - * @tc.name : getVideoStabilizationModeMIDDLE - * @tc.desc : getVideoStabilizationModeMIDDLE promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeMIDDLE SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 - * @tc.name : getVideoStabilizationModeHigh - * @tc.desc : getVideoStabilizationModeHigh promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeHigh SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 - * @tc.name : getVideoStabilizationModeAuto - * @tc.desc : getVideoStabilizationModeAuto promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeAuto SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Commit config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.commitConfig(); - console.info(TAG + "Entering commitConfig success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 commitConfig PASSED"); - } - else { - expect().assertFail() - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 commitConfig FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 commitConfig ends here"); - } - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview Output callback on frame start previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate"); - previewOutputPromise.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : PreviewOutput callback onframeend async api - * @tc.desc : PreviewOutput callback onframeend async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 previewOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate') - await sleep(1) - previewOutputPromise.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewStop frameEnd Callback is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : VideoOutput callback onframestart async api - * @tc.desc : VideoOutput callback onframestart async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video frameStart Callback videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate') - await sleep(1) - videoOutputPromise.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "Video frameStart Callback is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 is FAILED : " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : VideoOutput callback onframeend async api - * @tc.desc : VideoOutput callback onframeend async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video frameEnd callback videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate') - await sleep(1) - videoOutputPromise.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 is success') - if (data != null || data != undefined) { - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED' + err.message) - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture start photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 to operate"); - photoOutputPromise.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "CaptureStart Callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture end photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 to operate"); - photoOutputPromise.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 FAILED' + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on frame shutter photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 to operate"); - photoOutputPromise.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 with captureId: " + data.captureId); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 - * @tc.name : capture session start api - * @tc.desc : capture session start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering capture session start captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 to operate"); - await captureSessionPromise.start(); - console.info(TAG + "Entering captureSession start success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 to operate"); - await photoOutputPromise.isMirrorSupported() - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 FAILED : " + err.message); - }); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 to operate"); - await photoOutputPromise.setMirror(true) - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 FAILED : " + err.message); - }); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100--------------"); - console.info(TAG + 'hasFlash called.') - var hasFlashPromise = await camera0InputPromise.hasFlash(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 success"); - if (hasFlashPromise != null || hasFlashPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 is: " + JSON.stringify(hasFlashPromise)); - expect(hasFlashPromise).assertEqual(true); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 FAILED : "); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 ends here"); - await sleep(1) - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 to operate"); - var isFMOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMOpenSupported != null || isFMOpenSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + JSON.stringify(isFMOpenSupported)); - expect(isFMOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 to operate"); - var SetFMOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMOpen)) - if (SetFMOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 to operate"); - var GetFMOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 success: " + JSON.stringify(GetFMOpen)); - if (GetFMOpen == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + JSON.stringify(GetFMOpen)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 to operate"); - var isFMAlwaysOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMAlwaysOpenSupported != null || isFMAlwaysOpenSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + isFMAlwaysOpenSupported); - expect(isFMAlwaysOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 to operate"); - var SetFMAlwaysOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMAlwaysOpen)) - if (SetFMAlwaysOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 to operate"); - var GetFMAlwaysOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 success"); - if (GetFMAlwaysOpen == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAlwaysOpen); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 to operate"); - var isFMAutoSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMAutoSupported != null || isFMAutoSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_AUTO data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + isFMAutoSupported); - expect(isFMAutoSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 to operate"); - var SetFMAlwaysAuto = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "SetFMAlwaysAuto: " + JSON.stringify(SetFMAlwaysAuto)) - if (SetFMAlwaysAuto == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 to operate"); - var GetFMAuto = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 success"); - if (GetFMAuto == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAuto); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 to operate"); - var isFMCloseSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMCloseSupported != null || isFMCloseSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + isFMCloseSupported); - expect(isFMCloseSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 to operate"); - var SetFMClose = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMClose)) - if (SetFMClose == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 - * @tc.name : get flash mode close camera0 api - * @tc.desc : get flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 to operate"); - var GetFMClose = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 success"); - if (GetFMClose == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMClose); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - //ZOOM Function - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 - * @tc.name : get zoom ratio camera-0 cameraId api promise api - * @tc.desc : get zoom ratio camera-0 cameraId api promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100--------------"); - var getZoomRatioPromise = await camera0InputPromise.getZoomRatioRange(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 getZoomRatioPromise: " + JSON.stringify(getZoomRatioPromise)); - if (getZoomRatioPromise != null && getZoomRatioPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 setZoomRatioPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 success: " + JSON.stringify(getZoomRatioPromise)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(1); - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - var getpromise1 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise1); - if (getpromise1 != null && getpromise1 != undefined) { - expect(getpromise1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(2); - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - var getpromise2 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise2); - if (getpromise2 != null && getpromise2 != undefined) { - expect(getpromise2).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(3); - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - var getpromise3 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise3); - if (getpromise3 != null && getpromise3 != undefined) { - expect(getpromise3).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(4); - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - var getpromise4 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise4); - if (getpromise4 != null && getpromise4 != undefined) { - expect(getpromise4).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(5); - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - var getpromise5 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise5); - if (getpromise5 != null && getpromise5 != undefined) { - expect(getpromise5).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(6); - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - var getpromise6 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise6); - if (getpromise6 != null && getpromise6 != undefined) { - expect(getpromise6).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - // FOCUS promise API's - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 - * @tc.name : check is focus mode locked supported-camera0Input api - * @tc.desc : check is focus mode locked supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 to operate"); - var isFMLockedSupported = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering is focus mode locked supported SUCCESS "); - if (isFMLockedSupported != null || isFMLockedSupported != undefined) { - console.info(TAG + "Entering is focus mode locked supported data is not null || undefined"); - console.info(TAG + "is focus mode locked supported : " + isFMLockedSupported); - expect(isFMLockedSupported).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED) - .then(function (data) { - console.info(TAG + "SetFMLocked: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode locked SUCCESS, current focusmode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 FAILED : ") - expect().assertFail(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 ends here"); - }); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode locked success: "); - if (data == 0) { - console.info(TAG + "Current focusmode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 ends here"); - }); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 - * @tc.name : get focal length camera0 api - * @tc.desc : get focal length camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 to operate"); - await camera0InputPromise.getFocalLength() - .then(function (data) { - console.info(TAG + "Current focallength is: " + JSON.stringify(data)); - expect(data).assertEqual(3.4600000381469727); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 - * @tc.name : is focusmode manual supported - * @tc.desc : is focusmode manual supported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 to operate"); - var isFMmanualSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL); - if (isFMmanualSupportedpromise != null || isFMmanualSupportedpromise != undefined) { - console.info(TAG + "Entering is focusmode manual supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMmanualSupportedpromise); - expect(isFMmanualSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL) - .then(function (data) { - console.info(TAG + "setFocusManual: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode manual SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode manual SUCCESS"); - if (data == 0) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 ends here"); - }); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 FAILED " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 - * @tc.name : check is focus mode continuous supported-camera0Input api - * @tc.desc : check is focus mode continuous supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 to operate"); - var isFMContinuousSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - if (isFMContinuousSupportedpromise != null || isFMContinuousSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode continuous supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINUOUS_SUPPORTED is: " + isFMContinuousSupportedpromise); - expect(isFMContinuousSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) - .then(function (data) { - console.info(TAG + "setFocusCont: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode continuous SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode continuous SUCCESS"); - if (data == 1) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 - * @tc.name : check is focus mode auto supported-camera0Input api - * @tc.desc : check is focus mode auto supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 to operate"); - var isFMAutoSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (isFMAutoSupportedpromise != null || isFMAutoSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode auto supported data is not null || undefined"); - console.info(TAG + "is focus mode auto supported is: " + isFMAutoSupportedpromise); - expect(isFMAutoSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 to operate"); - var setFocusAuto = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO) - .then(function () { - console.info(TAG + "setFocusAuto: " + JSON.stringify(setFocusAuto)) - console.info(TAG + "Entering set focus mode auto SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 FAILED : "); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 to operate"); - var getfocusmodepromise = await camera0InputPromise.getFocusMode(); - console.info(TAG + "Entering get focus mode auto SUCCESS"); - if (getfocusmodepromise == 2) { - console.info(TAG + "Current FocusMode is: " + getfocusmodepromise); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode locked SUCCESS"); - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 mode locked - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 to operate"); - await camera0InputPromise.setExposurePoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 mode locked - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100_exposure mode locked - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureBiasRange() - .then(function (data) { - console.info(TAG + "Entering getExposureBiasRange SUCCESS"); - console.info(TAG + "Current ExposureBiasRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 mode locked - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 to operate"); - await camera0InputPromise.setExposureBias(-4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 mode locked - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 mode auto - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 to operate"); - await camera0InputPromise.setExposurePoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 FAILED: " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 mode auto - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 mode auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 to operate"); - await camera0InputPromise.setExposureBias(1) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 mode auto - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 to operate"); - await camera0InputPromise.setExposurePoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 mode continuous auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 to operate"); - await camera0InputPromise.setExposureBias(4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 - * @tc.name : VideoOutput start promise api - * @tc.desc : VideoOutput start promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video Output start videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 to operate') - await videoOutputPromise.start() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 - * @tc.name : VideoOutput stop promise api - * @tc.desc : VideoOutput stop promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video Output Stop videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 to operate') - await videoOutputPromise.stop() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 - * @tc.name : CaptureSession stop promise api - * @tc.desc : CaptureSession stop promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + 'Entering Capture Session Stop captureSessionPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 to operate') - await captureSessionPromise.stop() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 - * @tc.name : CaptureSession release promise api - * @tc.desc : CaptureSession release promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + 'Entering Capture session release captureSessionPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 to operate') - await captureSessionPromise.release() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : videoOutput release api - * @tc.desc : videoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + "Entering Video Output release previewOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await videoOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : PreviewOutput release api - * @tc.desc : PreviewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering previewOutputPromise.release previewOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await previewOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : cameraInput release api - * @tc.desc : cameraInput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering camera0InputPromise.release camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await camera0InputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1) - done() - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraLongFocus/src/main/resources/base/element/string.json b/multimedia/camera/cameraLongFocus/src/main/resources/base/element/string.json deleted file mode 100644 index b93f540e29265a34f883a977c442fa85349b94ca..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraLongFocus/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "description_mainability", - "value": "eTS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/multimedia/camera/cameraUnspc/BUILD.gn b/multimedia/camera/cameraUnspc/BUILD.gn deleted file mode 100644 index a040b54da269f519f80153ccf05f709769b7ddd5..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraUnspc/BUILD.gn +++ /dev/null @@ -1,34 +0,0 @@ -# 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("camera_unspc_ets_hap") { - hap_profile = "./src/main/config.json" - deps = [ - ":camera_ets_assets", - ":camera_ets_resources", - ] - ets2abc = true - - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsCameraUnspcETSTest" - subsystem_name = "multimedia" - part_name = "multimedia_camera_standard" -} -ohos_js_assets("camera_ets_assets") { - source_dir = "./src/main/ets/MainAbility" -} -ohos_resources("camera_ets_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/multimedia/camera/cameraUnspc/Test.json b/multimedia/camera/cameraUnspc/Test.json deleted file mode 100644 index 33822703896da4c78c8e3680c235e8cb7b269f50..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraUnspc/Test.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "description": "Configuration for camerastandard unspc Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "1000000", - "package": "com.open.harmony.multimedia.cameraunspctest", - "shell-timeout": "60000" - }, - "kits": [ - { - "type": "ShellKit", - "run-command": [ - "touch /data/media/01.mp4", - "chmod -R 777 /data/media" - - ], - "teardown-command":[ - - ] - }, - { - "test-file-name": [ - "ActsCameraUnspcETSTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/multimedia/camera/cameraUnspc/signature/openharmony_sx.p7b b/multimedia/camera/cameraUnspc/signature/openharmony_sx.p7b deleted file mode 100644 index 0625db92101ca16c7becfaf2d4008ea2e96078e1..0000000000000000000000000000000000000000 Binary files a/multimedia/camera/cameraUnspc/signature/openharmony_sx.p7b and /dev/null differ diff --git a/multimedia/camera/cameraUnspc/src/main/config.json b/multimedia/camera/cameraUnspc/src/main/config.json deleted file mode 100644 index 542cbfcaf4349aa233264b4adfe922fd1fe808a7..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraUnspc/src/main/config.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "app": { - "bundleName": "com.open.harmony.multimedia.cameraunspctest", - "vendor": "open", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.open.harmony.multimedia.cameraunspctest", - "name": ".MyApplication", - "mainAbility": "com.open.harmony.multimedia.cameraunspctest.MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "formsEnabled": false, - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "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.CAMERA", - "reason": "use ohos.permission.CAMERA" - }, - { - "name": "ohos.permission.MICROPHONE", - "reason": "use ohos.permission.MICROPHONE" - }, - { - "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" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/app.ets b/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/app.ets deleted file mode 100644 index a9f8218978fad817d4519aa1b715da0e3f8ebbfc..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('Application onCreate') - }, - onDestroy() { - console.info('Application onDestroy') - }, -} diff --git a/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/pages/index.ets b/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index ca96b03e80e49976adf3f876fadb4d82d574c6ef..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,74 +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 {Core, ExpectExtend} from "deccjsunit/index" -import cameraKit from "../test/Camera.test" -import featureAbility from "@ohos.ability.featureAbility" - -let TAG = 'CameraModuleTest: ' -var mXComponentController: XComponentController = new XComponentController() -var surfaceId: any - -@Entry -@Component -struct CameraIndex { - @State isShowSettings: boolean = false - @State previewSize: string = '75%' - - aboutToAppear() { - console.info('--------------aboutToAppear--------------') - } - - build() { - Flex() { - XComponent({ - id: '', - type: 'surface', - libraryname: '', - controller: mXComponentController - }) - .onLoad(() => { - console.info('CameraModuleTest: OnLoad() is called!') - mXComponentController.setXComponentSurfaceSize({ surfaceWidth: 1920, surfaceHeight: 1080 }); - surfaceId = mXComponentController.getXComponentSurfaceId() - console.info('CameraModuleTest: XComponent onLoad surfaceId: ' + surfaceId) - featureAbility.getWant() - .then((Want) => { - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - console.info(TAG + 'Entering expectExtend') - core.addService('expect', expectExtend) - console.info(TAG + 'Entering addService') - core.init() - console.info(TAG + 'Entering core.init()') - console.info(TAG + 'Entering subscribeEvent') - const configService = core.getDefaultService('config') - configService.setConfig(Want.parameters) - console.info(TAG + 'Entering configService') - cameraKit(surfaceId) - core.execute() - console.info(TAG + 'Operation successful. Data: ' + JSON.stringify(Want)); - }) - .catch((error) => { - console.error(TAG + 'Operation failed. Cause: ' + JSON.stringify(error)); - }) - }) - .width('1920px') - .height('1080px') - } - } -} diff --git a/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/Camera.test.ets b/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/Camera.test.ets deleted file mode 100644 index 2743a3a6f94f359e98785fa0a21bf1518e7a9859..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/Camera.test.ets +++ /dev/null @@ -1,35 +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 cameraJSUnitEnum from './CameraJSUnitEnum.test.ets' -import cameraJSUnitCameraFormat from './CameraJSUnitCameraFormat.test.ets' -import cameraJSUnitPhotoAsync from './CameraJSUnitPhotoAsync.test.ets' -import cameraJSUnitPhotoPromise from './CameraJSUnitPhotoPromise.test.ets' -import cameraJSUnitVideoAsync from './CameraJSUnitVideoAsync.test.ets' -import cameraJSUnitVideoPromise from './CameraJSUnitVideoPromise.test.ets' - -let TAG = 'CameraModuleTest: ' - -export default function cameraKit(surfaceId: any) { - console.info(TAG + 'Entering cameraKit') - console.info(TAG + 'surfaceId: ' + surfaceId) - - cameraJSUnitEnum(surfaceId) - cameraJSUnitCameraFormat(surfaceId) - cameraJSUnitPhotoAsync(surfaceId) - cameraJSUnitPhotoPromise(surfaceId) - cameraJSUnitVideoAsync(surfaceId) - cameraJSUnitVideoPromise(surfaceId) -} \ No newline at end of file diff --git a/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets b/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets deleted file mode 100644 index 1d88e45d9ae36d1b43346be7703db2d22ccef9f7..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets +++ /dev/null @@ -1,3783 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables - -var cameraManager; -var surfaceId1; -var camerasArray; - -// CAMERA-0 Variables -var camera0Input, camera0InputPosBack, camera0InputPosFront; -var camera0InputPromise, camera0InputPromisePosBack, camera0InputPromisePosFront; -// CAMERA-1 Variables -var camera1Input, camera1InputPosBack, camera1InputPosFront; -var camera1InputPromise, camera1InputPromisePosBack, camera1InputPromisePosFront; -// CAMERA-2 Variables -var camera2Input, camera2InputPosBack, camera2InputPosFront; -var camera2InputPromise, camera2InputPromisePosBack, camera2InputPromisePosFront; -// CAMERA-3 Variables -var camera3Input, camera3InputPosBack, camera3InputPosFront; -var camera3InputPromise, camera3InputPromisePosBack, camera3InputPromisePosFront; - -export default function cameraJSUnitCameraFormat(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJsUnitCameraFormat', function () { - console.info(TAG + '----------CameraJsUnitCameraFormat--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 data is not null || undefined"); - cameraManager = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------"); - var cameraManagerPromise = await cameraObj.getCameraManager(null); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 cameraManagerPromise: " + JSON.stringify(cameraManagerPromise)); - if (cameraManagerPromise != null && cameraManagerPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Get camera from cameramanager to get array of camera async api - * @tc.desc : Get camera from cameramanager to get array of camera async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------"); - cameraManager.getCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 data is not null || undefined"); - camerasArray = data; - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArray[i].cameraPosition; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArray[i].cameraType; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Type: " + cameraType); - var connectionType = camerasArray[i].connectionType - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 - * @tc.name : Get camera from cameramanager to get array of camera promise api - * @tc.desc : Get camera from cameramanager to get array of camera promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100--------------"); - var camerasArrayPromise = await cameraManager.getCameras(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100: " + JSON.stringify(camerasArrayPromise)); - if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 success"); - for (var i = 0; i < camerasArrayPromise.length; i++) { - // Get the variables from camera object - var cameraId = camerasArrayPromise[i].cameraId; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArrayPromise[i].cameraPosition; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArrayPromise[i].cameraType; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 camera" + i + "Type: " + cameraType); - var connectionType = camerasArrayPromise[i].connectionType - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-0 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera0Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[0].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraId promise api - * @tc.desc : Create camerainput from camera-0 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera0InputPromise = await cameraManager.createCameraInput(camerasArray[0].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera0InputPromise: " + JSON.stringify(camera0InputPromise)); - if (camera0InputPromise != null && camera0InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera0InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 - * @tc.name : get camera if from camera-0 input async api - * @tc.desc : get camera if from camera-0 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100', 0, async function (done) { - camera0Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 data is not null || undefined"); - var CameraId0 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 PASSED with CameraID :" + CameraId0); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 - * @tc.name : get camera if from camera-0 input promise api - * @tc.desc : get camera if from camera-0 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100', 0, async function (done) { - var camera0IdPromise = await camera0InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 camera0IdPromise: " + JSON.stringify(camera0IdPromise)); - if (camera0IdPromise != null && camera0IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 camera0IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 PASSED" + camera0IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput async api - * @tc.desc : Get supported preview formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera0InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null && data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromise = await camera0InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromise)); - if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam0FormatPromise: " + cam0FormatPromise[i]); - expect(cam0FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-0 camerainput async api - * @tc.desc : Get supported video formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 success"); - if (data != null && data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 - * @tc.name : Get supported video formats from camera-0 camerainput promise api - * @tc.desc : Get supported video formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromise = await camera0InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromise)); - if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 cam0FormatPromise: " + cam0FormatPromise[i]); - expect(cam0FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-0 camerainput async api - * @tc.desc : Get supported photo format from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-0 camerainput promise api - * @tc.desc : Get supported photo format from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromise = await camera0InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromise)); - if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam0FormatPromise: " + cam0FormatPromise[i]); - expect(cam0FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraposition back & cameratype unspecified async api - * @tc.desc : Create camerainput from camera-0 cameraposition back & cameratype unspecified async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 data is not null || undefined"); - camera0InputPosBack = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraposition back & cameratype unspecified promise api - * @tc.desc : Create camerainput from camera-0 cameraposition back & cameratype unspecified promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100--------------"); - camera0InputPromisePosBack = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 camera0InputPromisePosBack: " + JSON.stringify(camera0InputPromisePosBack)); - if (camera0InputPromisePosBack != null && camera0InputPromisePosBack != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 camera0InputPromisePosBack is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput async api - * @tc.desc : Get supported preview formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosBack = await camera0InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosBack)); - if (cam0FormatPromisePosBack != null && cam0FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam0FormatPromisePosBack: " + cam0FormatPromisePosBack[i]); - expect(cam0FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-0 camerainput async api - * @tc.desc : Get supported photo format from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-0 camerainput promise api - * @tc.desc : Get supported photo format from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosBack = await camera0InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosBack)); - if (cam0FormatPromisePosBack != null && cam0FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam0FormatPromisePosBack: " + cam0FormatPromisePosBack[i]); - expect(cam0FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE UNSPECIFIED*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraposition front & cameratype unspecified async api - * @tc.desc : Create camerainput from camera-0 cameraposition front & cameratype unspecified async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 data is not null || undefined"); - camera0InputPosFront = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraposition front & cameratype unspecified promise api - * @tc.desc : Create camerainput from camera-0 cameraposition front & cameratype unspecified promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100--------------"); - camera0InputPromisePosFront = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 camera0InputPromisePosFront: " + JSON.stringify(camera0InputPromisePosFront)); - if (camera0InputPromisePosFront != null && camera0InputPromisePosFront != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 camera0InputPromisePosFront is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput async api - * @tc.desc : Get supported preview formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosFront = await camera0InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosFront)); - if (cam0FormatPromisePosFront != null && cam0FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam0FormatPromisePosFront: " + cam0FormatPromisePosFront[i]); - expect(cam0FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-0 camerainput async api - * @tc.desc : Get supported photo format from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-0 camerainput promise api - * @tc.desc : Get supported photo format from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosFront = await camera0InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosFront)); - if (cam0FormatPromisePosFront != null && cam0FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam0FormatPromisePosFront: " + cam0FormatPromisePosFront[i]); - expect(cam0FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0InputPromise.on("focusStateChange", async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CAMERA-1 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-1 cameraId async api - * @tc.desc : Create camerainput from camera-1 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-1 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[1].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera1Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[1].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-1 cameraId promise api - * @tc.desc : Create camerainput from camera-1 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera1InputPromise = await cameraManager.createCameraInput(camerasArray[1].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera1InputPromise: " + JSON.stringify(camera1InputPromise)); - if (camera1InputPromise != null && camera1InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera1InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 - * @tc.name : get camera ID from camera-1 input async api - * @tc.desc : get camera ID from camera-1 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100', 0, async function (done) { - camera1Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 data is not null || undefined"); - var CameraId1 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 PASSED with CameraID : " + CameraId1); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 - * @tc.name : get camera ID from camera-1 input promise api - * @tc.desc : get camera ID from camera-1 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100', 0, async function (done) { - var camera1IdPromise = await camera1InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 camera1IdPromise: " + JSON.stringify(camera1IdPromise)); - if (camera1IdPromise != null && camera1IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 camera1IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 PASSED" + camera1IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 - * @tc.name : Create camerainput from camera-1 cameraposition & cameratype async api - * @tc.desc : Create camerainput from camera-1 cameraposition & cameratype async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[1].cameraPosition, camerasArray[1].cameraType, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 - * @tc.name : Create camerainput from camera-1 cameraposition & cameratype promise api - * @tc.desc : Create camerainput from camera-1 cameraposition & cameratype promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100--------------"); - var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[1].cameraPosition, camerasArray[1].cameraType); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); - if (cameraInputPromise != null && cameraInputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput async api - * @tc.desc : Get supported preview formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera1InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput promise api - * @tc.desc : Get supported preview formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromise = await camera1InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromise)); - if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam1FormatPromise: " + cam1FormatPromise[i]); - expect(cam1FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-1 camerainput async api - * @tc.desc : Get supported video formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100--------------"); - camera1InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 - * @tc.name : Get supported video formats from camera-1 camerainput promise api - * @tc.desc : Get supported video formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100--------------"); - var cam1FormatPromise = await camera1InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100: " + JSON.stringify(cam1FormatPromise)); - if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 cam1FormatPromise: " + cam1FormatPromise[i]); - expect(cam1FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-1 camerainput async api - * @tc.desc : Get supported photo format from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera1InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-1 camerainput promise api - * @tc.desc : Get supported photo format from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromise = await camera1InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromise)); - if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam1FormatPromise: " + cam1FormatPromise[i]); - expect(cam1FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE UNSPECIFIED*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 - * @tc.name : Create camerainput from camera-1 cameraposition back & cameratype unspecified async api - * @tc.desc : Create camerainput from camera-1 cameraposition back & cameratype unspecified async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 data is not null || undefined"); - camera1InputPosBack = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 - * @tc.name : Create camerainput from camera-1 cameraposition back & cameratype unspecified promise api - * @tc.desc : Create camerainput from camera-1 cameraposition back & cameratype unspecified promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100--------------"); - camera1InputPromisePosBack = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 camera1InputPromisePosBack: " + JSON.stringify(camera1InputPromisePosBack)); - if (camera1InputPromisePosBack != null && camera1InputPromisePosBack != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 camera1InputPromisePosBack is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput async api - * @tc.desc : Get supported preview formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput promise api - * @tc.desc : Get supported preview formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosBack = await camera1InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosBack)); - if (cam1FormatPromisePosBack != null && cam1FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam1FormatPromisePosBack: " + cam1FormatPromisePosBack[i]); - expect(cam1FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-1 camerainput async api - * @tc.desc : Get supported photo format from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-1 camerainput promise api - * @tc.desc : Get supported photo format from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosBack = await camera1InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosBack)); - if (cam1FormatPromisePosBack != null && cam1FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam1FormatPromisePosBack: " + cam1FormatPromisePosBack[i]); - expect(cam1FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE UNSPECIFIED*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 - * @tc.name : Create camerainput from camera-1 cameraposition front & cameratype unspecified async api - * @tc.desc : Create camerainput from camera-1 cameraposition front & cameratype unspecified async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 data is not null || undefined"); - camera1InputPosFront = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 - * @tc.name : Create camerainput from camera-1 cameraposition front & cameratype unspecified promise api - * @tc.desc : Create camerainput from camera-1 cameraposition front & cameratype unspecified promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100--------------"); - camera1InputPromisePosFront = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 camera1InputPromisePosFront: " + JSON.stringify(camera1InputPromisePosFront)); - if (camera1InputPromisePosFront != null && camera1InputPromisePosFront != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 camera1InputPromisePosFront is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput async api - * @tc.desc : Get supported preview formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput promise api - * @tc.desc : Get supported preview formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosFront = await camera1InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosFront)); - if (cam1FormatPromisePosFront != null && cam1FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam1FormatPromisePosFront: " + cam1FormatPromisePosFront[i]); - expect(cam1FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-1 camerainput async api - * @tc.desc : Get supported photo format from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-1 camerainput promise api - * @tc.desc : Get supported photo format from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosFront = await camera1InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosFront)); - if (cam1FormatPromisePosFront != null && cam1FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam1FormatPromisePosFront: " + cam1FormatPromisePosFront[i]); - expect(cam1FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-2 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-2 cameraId async api - * @tc.desc : Create camerainput from camera-2 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-2 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[2].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera2Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[2].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-2 cameraId promise api - * @tc.desc : Create camerainput from camera-2 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera2InputPromise = await cameraManager.createCameraInput(camerasArray[2].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera2InputPromise: " + JSON.stringify(camera2InputPromise)); - if (camera2InputPromise != null && camera2InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera2InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 - * @tc.name : get camera ID from camera-2 input async api - * @tc.desc : get camera ID from camera-2 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100', 0, async function (done) { - camera2Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 data is not null || undefined"); - var CameraId2 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 PASSED with CameraID : " + CameraId2); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 - * @tc.name : get camera ID from camera-2 input promise api - * @tc.desc : get camera ID from camera-2 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100', 0, async function (done) { - var camera2IdPromise = await camera2InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 camera2IdPromise: " + JSON.stringify(camera2IdPromise)); - if (camera2IdPromise != null && camera2IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 camera2IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 PASSED" + camera2IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 - * @tc.name : Create camerainput from camera-2 cameraposition & cameratype async api - * @tc.desc : Create camerainput from camera-2 cameraposition & cameratype async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[2].cameraPosition, camerasArray[2].cameraType, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 - * @tc.name : Create camerainput from camera-2 cameraposition & cameratype promise api - * @tc.desc : Create camerainput from camera-2 cameraposition & cameratype promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100--------------"); - var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[2].cameraPosition, camerasArray[2].cameraType); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); - if (cameraInputPromise != null && cameraInputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput async api - * @tc.desc : Get supported preview formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera2InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput promise api - * @tc.desc : Get supported preview formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromise = await camera2InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromise)); - if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam2FormatPromise: " + cam2FormatPromise[i]); - expect(cam2FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-2 camerainput async api - * @tc.desc : Get supported video formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100--------------"); - camera2InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 - * @tc.name : Get supported video formats from camera-2 camerainput promise api - * @tc.desc : Get supported video formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100--------------"); - var cam2FormatPromise = await camera2InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100: " + JSON.stringify(cam2FormatPromise)); - if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 cam2FormatPromise: " + cam2FormatPromise[i]); - expect(cam2FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-2 camerainput async api - * @tc.desc : Get supported photo format from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera2InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-2 camerainput promise api - * @tc.desc : Get supported photo format from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromise = await camera2InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromise)); - if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam2FormatPromise: " + cam2FormatPromise[i]); - expect(cam2FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE UNSPECIFIED*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 - * @tc.name : Create camerainput from camera-2 cameraposition back & cameratype unspecified async api - * @tc.desc : Create camerainput from camera-2 cameraposition back & cameratype unspecified async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 data is not null || undefined"); - camera2InputPosBack = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 - * @tc.name : Create camerainput from camera-2 cameraposition back & cameratype unspecified promise api - * @tc.desc : Create camerainput from camera-2 cameraposition back & cameratype unspecified promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100--------------"); - camera2InputPromisePosBack = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 camera2InputPromisePosBack: " + JSON.stringify(camera2InputPromisePosBack)); - if (camera2InputPromisePosBack != null && camera2InputPromisePosBack != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 camera2InputPromisePosBack is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput async api - * @tc.desc : Get supported preview formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput promise api - * @tc.desc : Get supported preview formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosBack = await camera2InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosBack)); - if (cam2FormatPromisePosBack != null && cam2FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam2FormatPromisePosBack: " + cam2FormatPromisePosBack[i]); - expect(cam2FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-2 camerainput async api - * @tc.desc : Get supported photo format from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-2 camerainput promise api - * @tc.desc : Get supported photo format from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosBack = await camera2InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosBack)); - if (cam2FormatPromisePosBack != null && cam2FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam2FormatPromisePosBack: " + cam2FormatPromisePosBack[i]); - expect(cam2FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE UNSPECIFIED*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 - * @tc.name : Create camerainput from camera-2 cameraposition front & cameratype unspecified async api - * @tc.desc : Create camerainput from camera-2 cameraposition front & cameratype unspecified async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 data is not null || undefined"); - camera2InputPosFront = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 - * @tc.name : Create camerainput from camera-2 cameraposition front & cameratype unspecified promise api - * @tc.desc : Create camerainput from camera-2 cameraposition front & cameratype unspecified promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100--------------"); - camera2InputPromisePosFront = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 camera2InputPromisePosFront: " + JSON.stringify(camera2InputPromisePosFront)); - if (camera2InputPromisePosFront != null && camera2InputPromisePosFront != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 camera2InputPromisePosFront is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput async api - * @tc.desc : Get supported preview formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput promise api - * @tc.desc : Get supported preview formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosFront = await camera2InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosFront)); - if (cam2FormatPromisePosFront != null && cam2FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam2FormatPromisePosFront: " + cam2FormatPromisePosFront[i]); - expect(cam2FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-2 camerainput async api - * @tc.desc : Get supported photo format from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-2 camerainput promise api - * @tc.desc : Get supported photo format from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosFront = await camera2InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosFront)); - if (cam2FormatPromisePosFront != null && cam2FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam2FormatPromisePosFront: " + cam2FormatPromisePosFront[i]); - expect(cam2FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-3 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-3 cameraId async api - * @tc.desc : Create camerainput from camera-3 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-3 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[3].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera3Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[3].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-3 cameraId promise api - * @tc.desc : Create camerainput from camera-3 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera3InputPromise = await cameraManager.createCameraInput(camerasArray[3].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera3InputPromise: " + JSON.stringify(camera3InputPromise)); - if (camera3InputPromise != null && camera3InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera3InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 - * @tc.name : get camera ID from camera-3 input async api - * @tc.desc : get camera ID from camera-3 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100', 0, async function (done) { - camera3Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 data is not null || undefined"); - var CameraId3 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 PASSED with CameraID : " + CameraId3); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 - * @tc.name : get camera ID from camera-3 input promise api - * @tc.desc : get camera ID from camera-3 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100', 0, async function (done) { - var camera3IdPromise = await camera3InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 camera3IdPromise: " + JSON.stringify(camera3IdPromise)); - if (camera3IdPromise != null && camera3IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 camera3IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 PASSED" + camera3IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 - * @tc.name : Create camerainput from camera-3 cameraposition & cameratype async api - * @tc.desc : Create camerainput from camera-3 cameraposition & cameratype async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[3].cameraPosition, camerasArray[3].cameraType, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 - * @tc.name : Create camerainput from camera-3 cameraposition & cameratype promise api - * @tc.desc : Create camerainput from camera-3 cameraposition & cameratype promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100--------------"); - var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[3].cameraPosition, camerasArray[3].cameraType); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); - if (cameraInputPromise != null && cameraInputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput async api - * @tc.desc : Get supported preview formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera3InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput promise api - * @tc.desc : Get supported preview formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromise = await camera3InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromise)); - if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam3FormatPromise: " + cam3FormatPromise[i]); - expect(cam3FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-3 camerainput async api - * @tc.desc : Get supported video formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100--------------"); - camera3InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 - * @tc.name : Get supported video formats from camera-3 camerainput promise api - * @tc.desc : Get supported video formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100--------------"); - var cam3FormatPromise = await camera3InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100: " + JSON.stringify(cam3FormatPromise)); - if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 cam3FormatPromise: " + cam3FormatPromise[i]); - expect(cam3FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-3 camerainput async api - * @tc.desc : Get supported photo format from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera3InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-3 camerainput promise api - * @tc.desc : Get supported photo format from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromise = await camera3InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromise)); - if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam3FormatPromise: " + cam3FormatPromise[i]); - expect(cam3FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE UNSPECIFIED*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 - * @tc.name : Create camerainput from camera-3 cameraposition back & cameratype unspecified async api - * @tc.desc : Create camerainput from camera-3 cameraposition back & cameratype unspecified async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 data is not null || undefined"); - camera3InputPosBack = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 - * @tc.name : Create camerainput from camera-3 cameraposition back & cameratype unspecified promise api - * @tc.desc : Create camerainput from camera-3 cameraposition back & cameratype unspecified promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100--------------"); - camera3InputPromisePosBack = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 camera3InputPromisePosBack: " + JSON.stringify(camera3InputPromisePosBack)); - if (camera3InputPromisePosBack != null && camera3InputPromisePosBack != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 camera3InputPromisePosBack is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput async api - * @tc.desc : Get supported preview formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput promise api - * @tc.desc : Get supported preview formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosBack = await camera3InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosBack)); - if (cam3FormatPromisePosBack != null && cam3FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam3FormatPromisePosBack: " + cam3FormatPromisePosBack[i]); - expect(cam3FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-3 camerainput async api - * @tc.desc : Get supported photo format from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-3 camerainput promise api - * @tc.desc : Get supported photo format from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosBack = await camera3InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosBack)); - if (cam3FormatPromisePosBack != null && cam3FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam3FormatPromisePosBack: " + cam3FormatPromisePosBack[i]); - expect(cam3FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE UNSPECIFIED*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 - * @tc.name : Create camerainput from camera-3 cameraposition front & cameratype unspecified async api - * @tc.desc : Create camerainput from camera-3 cameraposition front & cameratype unspecified async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 data is not null || undefined"); - camera3InputPosFront = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 - * @tc.name : Create camerainput from camera-3 cameraposition front & cameratype unspecified promise api - * @tc.desc : Create camerainput from camera-3 cameraposition front & cameratype unspecified promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100--------------"); - camera3InputPromisePosFront = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 camera3InputPromisePosFront: " + JSON.stringify(camera3InputPromisePosFront)); - if (camera3InputPromisePosFront != null && camera3InputPromisePosFront != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 camera3InputPromisePosFront is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput async api - * @tc.desc : Get supported preview formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput promise api - * @tc.desc : Get supported preview formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosFront = await camera3InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosFront)); - if (cam3FormatPromisePosFront != null && cam3FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam3FormatPromisePosFront: " + cam3FormatPromisePosFront[i]); - expect(cam3FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-3 camerainput async api - * @tc.desc : Get supported photo format from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-3 camerainput promise api - * @tc.desc : Get supported photo format from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosFront = await camera3InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosFront)); - if (cam3FormatPromisePosFront != null && cam3FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam3FormatPromisePosFront: " + cam3FormatPromisePosFront[i]); - expect(cam3FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE UNSPECIFIED*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition unspecified & cameratype unspecified async api - * @tc.desc : Create camerainput from cameraposition unspecified & cameratype unspecified async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_CALLBACK_0100 success: "); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition unspecified & cameratype unspecified promise api - * @tc.desc : Create camerainput from cameraposition unspecified & cameratype unspecified promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED) - .then(function () { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_0100 camInputPromise: "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_0100 FAILED"); - }) - .catch((err) => { - console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_TC PASSED : " + err.message); - expect(true).assertTrue(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE WIDE ANGLE*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition unspecified & cameratype wide angle async api - * @tc.desc : Create camerainput from cameraposition unspecified & cameratype wide angle async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition unspecified & cameratype wide angle promise api - * @tc.desc : Create camerainput from cameraposition unspecified & cameratype wide angle promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE) - .then(function () { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_0100 FAILED"); - expect().assertFail(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_0100 PASSED : " + err.message); - expect(true).assertTrue(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE ULTRA ANGLE*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition unspecified & cameratype ultra wide async api - * @tc.desc : Create camerainput from cameraposition unspecified & cameratype ultra wide async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition unspecified & cameratype ultra wide promise api - * @tc.desc : Create camerainput from cameraposition unspecified & cameratype ultra wide promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE) - .then(function () { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_0100 FAILED"); - expect().assertFail(); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE TELEPHOTO*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition unspecified & cameratype telephoto async api - * @tc.desc : Create camerainput from cameraposition unspecified & cameratype telephoto async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition unspecified & cameratype telephoto promise api - * @tc.desc : Create camerainput from cameraposition unspecified & cameratype telephoto promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE TRUE DEAPTH*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition unspecified & cameratype true deapth async api - * @tc.desc : Create camerainput from cameraposition unspecified & cameratype true deapth async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition unspecified & cameratype true deapth promise api - * @tc.desc : Create camerainput from cameraposition unspecified & cameratype true deapth promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE WIDE ANGLE*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition back & cameratype wide angle async api - * @tc.desc : Create camerainput from cameraposition back & cameratype wide angle async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition back & cameratype wide angle promise api - * @tc.desc : Create camerainput from cameraposition back & cameratype wide angle promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE ULTRA ANGLE*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition back & cameratype ultra wide async api - * @tc.desc : Create camerainput from cameraposition back & cameratype ultra wide async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition back & cameratype ultra wide promise api - * @tc.desc : Create camerainput from cameraposition back & cameratype ultra wide promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE TELEPHOTO*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition back & cameratype telephoto async api - * @tc.desc : Create camerainput from cameraposition back & cameratype telephoto async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition back & cameratype telephoto promise api - * @tc.desc : Create camerainput from cameraposition back & cameratype telephoto promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE TRUE DEAPTH*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition back & cameratype true deapth async api - * @tc.desc : Create camerainput from cameraposition back & cameratype true deapth async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition back & cameratype true deapth promise api - * @tc.desc : Create camerainput from cameraposition back & cameratype true deapth promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE WIDE ANGLE*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition front & cameratype wide angle async api - * @tc.desc : Create camerainput from cameraposition front & cameratype wide angle async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100 FAILED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition front & cameratype wide angle promise api - * @tc.desc : Create camerainput from cameraposition front & cameratype wide angle promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_CALLBACK_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_CALLBACK_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_CALLBACK_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE ULTRA ANGLE*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition front & cameratype ultra wide async api - * @tc.desc : Create camerainput from cameraposition front & cameratype ultra wide async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition front & cameratype ultra wide promise api - * @tc.desc : Create camerainput from cameraposition front & cameratype ultra wide promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE TELEPHOTO*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition front & cameratype telephoto async api - * @tc.desc : Create camerainput from cameraposition front & cameratype telephoto async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_CALLBACK_0100 FAILED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition front & cameratype telephoto promise api - * @tc.desc : Create camerainput from cameraposition front & cameratype telephoto promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE TRUE DEAPTH*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition front & cameratype true deapth async api - * @tc.desc : Create camerainput from cameraposition front & cameratype true deapth async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition front & cameratype true deapth promise api - * @tc.desc : Create camerainput from cameraposition front & cameratype true deapth promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets b/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets deleted file mode 100644 index 54de11efdc95e7ad97d972b4081928b1e224b8ef..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets +++ /dev/null @@ -1,508 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables - -var cameraManager; -var surfaceId1; -var camerasArray; - -// CAMERA-0 Variables -var camera0Input, camera0InputPosBack, camera0InputPosFront; -var camera0InputPromise, camera0InputPromisePosBack, camera0InputPromisePosFront; -// CAMERA-1 Variables -var camera1Input, camera1InputPosBack, camera1InputPosFront; -var camera1InputPromise, camera1InputPromisePosBack, camera1InputPromisePosFront; -// CAMERA-2 Variables -var camera2Input, camera2InputPosBack, camera2InputPosFront; -var camera2InputPromise, camera2InputPromisePosBack, camera2InputPromisePosFront; -// CAMERA-3 Variables -var camera3Input, camera3InputPosBack, camera3InputPosFront; -var camera3InputPromise, camera3InputPromisePosBack, camera3InputPromisePosFront; - -export default function cameraJSUnitEnum(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJSUnitEnum', function () { - console.info(TAG + '----------CameraJSUnitEnum--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 data is not null || undefined"); - cameraManager = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Get camera from cameramanager to get array of camera async api - * @tc.desc : Get camera from cameramanager to get array of camera async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------"); - cameraManager.getCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 data is not null || undefined"); - camerasArray = data; - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArray[i].cameraPosition; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArray[i].cameraType; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Type: " + cameraType); - var connectionType = camerasArray[i].connectionType - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100', 0, async function (done) { - console.info("--------------CAMERA-0 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100--------------"); - cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 data is not null || undefined"); - camera0Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 PASSED with CameraID :" + camerasArray[0].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_0100 - * @tc.name : camera status ENAME - * @tc.desc : camera status ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_0100------------"); - console.info(TAG + "CameraStatus CAMERA_STATUS_APPEAR : " + cameraObj.CameraStatus.CAMERA_STATUS_APPEAR); - expect(cameraObj.CameraStatus.CAMERA_STATUS_APPEAR).assertEqual(0); - console.info(TAG + "CameraStatus CAMERA_STATUS_DISAPPEAR : " + cameraObj.CameraStatus.CAMERA_STATUS_DISAPPEAR); - expect(cameraObj.CameraStatus.CAMERA_STATUS_DISAPPEAR).assertEqual(1); - console.info(TAG + "CameraStatus CAMERA_STATUS_AVAILABLE : " + cameraObj.CameraStatus.CAMERA_STATUS_AVAILABLE) - expect(cameraObj.CameraStatus.CAMERA_STATUS_AVAILABLE).assertEqual(2); - console.info(TAG + "CameraStatus CAMERA_STATUS_UNAVAILABLE : " + cameraObj.CameraStatus.CAMERA_STATUS_UNAVAILABLE) - expect(cameraObj.CameraStatus.CAMERA_STATUS_UNAVAILABLE).assertEqual(3); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_POSITION_0100 - * @tc.name : Camera position ENAME - * @tc.desc : Camera position ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_POSITION_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CAMERA_POSITION_0100------------") - console.info(TAG + "CameraPosition CAMERA_POSITION_BACK : " + cameraObj.CameraPosition.CAMERA_POSITION_BACK); - expect(cameraObj.CameraPosition.CAMERA_POSITION_BACK).assertEqual(1); - console.info(TAG + "CameraPosition CAMERA_POSITION_FRONT : " + cameraObj.CameraPosition.CAMERA_POSITION_FRONT); - expect(cameraObj.CameraPosition.CAMERA_POSITION_FRONT).assertEqual(2); - console.info(TAG + "CameraPosition CAMERA_POSITION_UNSPECIFIED : " + cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED); - expect(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED).assertEqual(0); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_TYPE_0100 - * @tc.name : camera type ENAME - * @tc.desc : camera type ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_TYPE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CAMERA_TYPE_0100------------") - console.info(TAG + "CameraType CAMERA_TYPE_UNSPECIFIED : " + cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); - expect(cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED).assertEqual(0); - console.info(TAG + "CameraType CAMERA_TYPE_WIDE_ANGLE : " + cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE); - expect(cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE).assertEqual(1); - console.info(TAG + 'CameraType CAMERA_TYPE_ULTRA_WIDE : ' + cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE); - expect(cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE).assertEqual(2); - console.info(TAG + 'CameraType CAMERA_TYPE_TELEPHOTO : ' + cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO); - expect(cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO).assertEqual(3); - console.info(TAG + 'CameraType CAMERA_TYPE_TRUE_DEPTH : ' + cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH) - expect(cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH).assertEqual(4); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CONNECTION_TYPE_0100 - * @tc.name : connection type ENAME - * @tc.desc : connection type ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CONNECTION_TYPE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CONNECTION_TYPE_0100------------") - console.info(TAG + "ConnectionType CAMERA_CONNECTION_BUILT_IN : " + cameraObj.ConnectionType.CAMERA_CONNECTION_BUILT_IN); - expect(cameraObj.ConnectionType.CAMERA_CONNECTION_BUILT_IN).assertEqual(0); - console.info(TAG + "ConnectionType CAMERA_CONNECTION_USB_PLUGIN : " + cameraObj.ConnectionType.CAMERA_CONNECTION_USB_PLUGIN); - expect(cameraObj.ConnectionType.CAMERA_CONNECTION_USB_PLUGIN).assertEqual(1); - console.info(TAG + "ConnectionType CAMERA_CONNECTION_REMOTE : " + cameraObj.ConnectionType.CAMERA_CONNECTION_REMOTE); - expect(cameraObj.ConnectionType.CAMERA_CONNECTION_REMOTE).assertEqual(2); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FLASHMODE_0100 - * @tc.name : Flash Mode ENAME - * @tc.desc : Flash Mode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FLASHMODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_FLASHMODE_0100------------") - console.info(TAG + "FlashMode FLASH_MODE_CLOSE : " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); - console.info(TAG + "FlashMode FLASH_MODE_OPEN : " + cameraObj.FlashMode.FLASH_MODE_OPEN); - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - console.info(TAG + "FlashMode FLASH_MODE_AUTO : " + cameraObj.FlashMode.FLASH_MODE_AUTO); - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); - console.info(TAG + "FlashMode FLASH_MODE_ALWAYS_OPEN : " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSMODE_0100 - * @tc.name : Focus Mode ENAME - * @tc.desc : Focus Mode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSMODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_FOCUSMODE_0100------------") - console.info(TAG + "FocusMode FOCUS_MODE_MANUAL : " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0); - console.info(TAG + "FocusMode FOCUS_MODE_CONTINUOUS_AUTO : " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); - console.info(TAG + "FocusMode FOCUS_MODE_AUTO : " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); - console.info(TAG + "FocusMode FOCUS_MODE_LOCKED : " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - expect(cameraObj.FocusMode.FOCUS_MODE_LOCKED).assertEqual(3); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATE_0100 - * @tc.name : Focus State ENAME - * @tc.desc : Focus State ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_FOCUSSTATE_0100------------") - console.info(TAG + "FocusState FOCUS_STATE_SCAN : " + cameraObj.FocusState.FOCUS_STATE_SCAN); - expect(cameraObj.FocusState.FOCUS_STATE_SCAN).assertEqual(0); - console.info(TAG + "FocusState FOCUS_STATE_FOCUSED : " + cameraObj.FocusState.FOCUS_STATE_FOCUSED); - expect(cameraObj.FocusState.FOCUS_STATE_FOCUSED).assertEqual(1); - console.info(TAG + "FocusState FOCUS_STATE_UNFOCUSED : " + cameraObj.FocusState.FOCUS_STATE_UNFOCUSED); - expect(cameraObj.FocusState.FOCUS_STATE_UNFOCUSED).assertEqual(2); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IMAGEROTATION_0100 - * @tc.name : Image Rotation ENAME - * @tc.desc : Image Rotation ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IMAGEROTATION_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_IMAGEROTATION_0100------------") - console.info(TAG + "ImageRotation ROTATION_0 : " + cameraObj.ImageRotation.ROTATION_0); - expect(cameraObj.ImageRotation.ROTATION_0).assertEqual(0); - console.info(TAG + "ImageRotation ROTATION_90 : " + cameraObj.ImageRotation.ROTATION_90); - expect(cameraObj.ImageRotation.ROTATION_90).assertEqual(90); - console.info(TAG + "ImageRotation ROTATION_180 : " + cameraObj.ImageRotation.ROTATION_180); - expect(cameraObj.ImageRotation.ROTATION_180).assertEqual(180); - console.info(TAG + "ImageRotation ROTATION_270 : " + cameraObj.ImageRotation.ROTATION_270); - expect(cameraObj.ImageRotation.ROTATION_270).assertEqual(270); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_QUALITYLEVEL_0100 - * @tc.name : Quality Level ENAME - * @tc.desc : Quality Level ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_QUALITYLEVEL_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_QUALITYLEVEL_0100------------") - console.info(TAG + "QualityLevel QUALITY_LEVEL_HIGH : " + cameraObj.QualityLevel.QUALITY_LEVEL_HIGH); - expect(cameraObj.QualityLevel.QUALITY_LEVEL_HIGH).assertEqual(0); - console.info(TAG + "QualityLevel QUALITY_LEVEL_MEDIUM : " + cameraObj.QualityLevel.QUALITY_LEVEL_MEDIUM); - expect(cameraObj.QualityLevel.QUALITY_LEVEL_MEDIUM).assertEqual(1); - console.info(TAG + "QualityLevel QUALITY_LEVEL_LOW : " + cameraObj.QualityLevel.QUALITY_LEVEL_LOW); - expect(cameraObj.QualityLevel.QUALITY_LEVEL_LOW).assertEqual(2); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100 - * @tc.name : CameraInputErrorCode ENAME - * @tc.desc : CameraInputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100 : " + cameraObj.CameraInputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.CameraInputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100 - * @tc.name : CaptureSessionErrorCode ENAME - * @tc.desc : CaptureSessionErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100 : " + cameraObj.CaptureSessionErrorCode.ERROR_UNKNOWN); - expect(cameraObj.CaptureSessionErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100 - * @tc.name : PreviewOutputErrorCode ENAME - * @tc.desc : PreviewOutputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100 : " + cameraObj.PreviewOutputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.PreviewOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100 - * @tc.name : PhotoOutputErrorCode ENAME - * @tc.desc : PhotoOutputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100 : " + cameraObj.PhotoOutputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.PhotoOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100 - * @tc.name : VideoOutputErrorCode ENAME - * @tc.desc : VideoOutputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100 : " + cameraObj.VideoOutputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.VideoOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets b/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets deleted file mode 100644 index 3b990e106f896ed54704bdb813583aa6c359e1fb..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets +++ /dev/null @@ -1,3606 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables -var camera0Input; -var camera1Input; -var cameraManager; -var previewOutputAsync; -var photoOutputAsync; -var captureSession; -var surfaceId1; -var camerasArray; - -var Point1 = { x: 1, y: 1 } -var Point2 = { x: 2, y: 2 } -var Point3 = { x: 3, y: 3 } - -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -export default function cameraJSUnitPhotoAsync(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJsUnitPhotoAsync', function () { - console.info(TAG + '----------CameraJsUnitPhotoAsync--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - console.info(TAG + "----------Camera-Precision Control-Async-------------"); - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Camera Manager success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering Camera Manager data is not null || undefined"); - cameraManager = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManager == null || cameraManager == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManager == null || undefined") - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate") - cameraManager.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManager is success"); - if (data != null || data != undefined) { - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Get camera from cameramanager to get array of camera async api - * @tc.desc : Get camera from cameramanager to get array of camera async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------"); - cameraManager.getCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering GetCameras success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering GetCameras data is not null || undefined"); - camerasArray = data; - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId; - console.info(TAG + "Entering GetCameras camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArray[i].cameraPosition; - console.info(TAG + "Entering GetCameras camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArray[i].cameraType; - console.info(TAG + "Entering GetCameras camera" + i + "Type: " + cameraType); - var connectionType = camerasArray[i].connectionType - console.info(TAG + "Entering GetCameras connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera0Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[0].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 - * @tc.name : Create camerainput from camera-1 cameraId async api - * @tc.desc : Create camerainput from camera-1 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200', 0, async function (done) { - cameraManager.createCameraInput(camerasArray[1].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 data is not null || undefined"); - camera1Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 PASSED with CameraID :" + camerasArray[1].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering CameraInputCallbackOnError cameraInput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 to operate"); - camera0Input.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "cameraInput error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - } - await sleep(1000); - done(); - }) - - /*PreviewOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 - * @tc.name : Create PreviewOutput instance api - * @tc.desc : Create PreviewOutput instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100', 0, async function (done) { - console.info(TAG + " Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 to operate"); - cameraObj.createPreviewOutput(surfaceId, async (err, data) => { - if (!err) { - console.info(TAG + " Entering createPreviewOutput success"); - if (data != null || data != undefined) { - console.info(TAG + " Entering createPreviewOutput data is not null || undefined"); - previewOutputAsync = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 PASSED" + previewOutputAsync); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 FAILED : " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 - * @tc.name : Preview output callback on error api - * @tc.desc : Preview output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering PreviewOutputError callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 to operate"); - previewOutputAsync.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 - * @tc.name : Create PhotoOutput instance api - * @tc.desc : Create PhotoOutput instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1000) - cameraObj.createPhotoOutput(surfaceId1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering createPhotoOutput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering createPhotoOutput data is not null || undefined"); - photoOutputAsync = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 to operate"); - photoOutputAsync.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error during PhotoOutput with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 - * @tc.name : Create CaptureSession instance api - * @tc.desc : Create CaptureSession instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 to operate"); - cameraObj.createCaptureSession(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering createCaptureSession success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering createCaptureSession data is not null || undefined"); - captureSession = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - //Capturesession callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 - * @tc.name : CaptureSession callback on error api - * @tc.desc : CaptureSession callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering captureSession error callback captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 to operate"); - captureSession.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 - * @tc.name : CaptureSession_Begin config api - * @tc.desc : CaptureSession_Begin config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering BeginConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 to operate"); - captureSession.beginConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering beginConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering BeginConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 beginConfig PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 - * @tc.name : Add Input with camera1Input api - * @tc.desc : Add Input with camera1Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering Addinput captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 to operate"); - captureSession.addInput(camera1Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddInput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddInput data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 addInput PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Preview captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 to operate"); - captureSession.addOutput(previewOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Preview : Success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Preview data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 to operate"); - captureSession.removeOutput(previewOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove preview Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove preview Output FAILED" + err.message); - console.info(TAG + "Entering Remove Preview Output ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Preview captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 to operate"); - captureSession.addOutput(previewOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Preview : Success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Preview data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CommitConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 to operate"); - captureSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering commitConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering CommitConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 to operate"); - photoOutputAsync.isMirrorSupported(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 to operate"); - photoOutputAsync.setMirror(true, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 - * @tc.name : setMirror false - * @tc.desc : setMirror false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 to operate"); - photoOutputAsync.setMirror(false, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 is success"); - console.info(TAG + "setMirror is : " + 'false'); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 - * @tc.name : CaptureSession_Begin config api - * @tc.desc : CaptureSession_Begin config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering BeginConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 to operate"); - captureSession.beginConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering beginConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering BeginConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 beginConfig PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 to operate"); - captureSession.removeInput(camera1Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove input success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove Input FAILED" + err.message); - console.info(TAG + "Entering Remove Input ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering Addinput captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 to operate"); - captureSession.addInput(camera0Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddInput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddInput data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 addInput PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 to operate"); - captureSession.removeOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove photo Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove photo Output FAILED" + err.message); - console.info(TAG + "Entering Remove photo Output ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CommitConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 to operate"); - captureSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering commitConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering CommitConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0Input.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0Input.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //preview callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering PreviewStart frameStart Callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 to operate"); - previewOutputAsync.on("frameStart", async (err, data) => { - if (!err) { - console.info(TAG + "PreviewStart frameStart Callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 FAILED : + err.message"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 - * @tc.name : Preview capture callback on frame end api - * @tc.desc : Preview capture callback on frame end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering PreviewOutput frameEnd Callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 to operate"); - previewOutputAsync.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 Callback is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 FAILED : + err.message"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering Photo Capture Callback on CaptureStart photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 to operate"); - photoOutputAsync.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "Photo Capture Callback on CaptureStart is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 to operate"); - photoOutputAsync.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 FAILED' + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 to operate"); - photoOutputAsync.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "frameShutter callback with captureId: " + data.captureId); - console.info(TAG + "frameShutter callback with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 - * @tc.name : capture session start api - * @tc.desc : capture session start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CaptureSession Start captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 to operate"); - captureSession.start(async (err, data) => { - if (!err) { - console.info(TAG + "Entering captureSession.start success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 PASSED"); - } - else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //Location - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - photoOutputAsync.capture(photosettings1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings1"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 - * @tc.name : Photo output capture with photosettings2 api - * @tc.desc : Photo output capture with photosettings2 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 to operate"); - photoOutputAsync.capture(photosettings2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings2 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 to operate"); - photoOutputAsync.capture(photosettings3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings3 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings3 data is not null || undefined"); - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 ends here"); - } - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS with Rotation-270 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 to operate"); - photoOutputAsync.capture(photosettings4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings4 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings4 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 ends here"); - } - }) - await sleep(1000); - done(); - } - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100', 0, async function (done) { - console.info(TAG + "hasFlash called.") - camera0Input.hasFlash(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 is: " + data); - expect(data).assertEqual(true); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 FAILED : " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 ends here"); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 success"); - if (data == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_ALWAYS_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 success"); - if (data == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check if flash mode auto is supported-camera0Input api - * @tc.desc : check if flash mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_AUTO SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 success"); - if (data == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_CLOSE SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 success"); - if (data == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 - * @tc.name : get zoom ratio camera-0 cameraId api - * @tc.desc : get zoom ratio camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100--------------"); - camera0Input.getZoomRatioRange(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 Success " + data) - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(1, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(2, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_0100 PASSED "); - } - else { - expect().assertFail(); - console.info(TAG + "GET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - } else { - expect().assertFail(); - console.info(TAG + "SET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(3, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(4, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(5, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(6, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 - * @tc.name : check if focus mode locked is supported-camera0Input api - * @tc.desc : check if focus mode locked is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Is Focus Mode Locked Supported SUCCESS: " + data); - if (data != null || data != undefined) { - console.info(TAG + "Entering Is Focus Mode Locked Supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_LOCKED_SUPPORTED is: " + data); - expect(data).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 FAILED :" + err.message); - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Mode Locked SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 FAILED : ") - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Mode Locked SUCCESS: " + data); - console.info(TAG + "Get Focus Mode Locked data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 - * @tc.name : get focal length camera0 api - * @tc.desc : get focal length camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 to operate"); - camera0Input.getFocalLength(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focal length SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focal length is: " + JSON.stringify(data)); - expect(data).assertEqual(3.4600000381469727); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_FOCUS_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_FOCUS_0100', 0, async function (done) { - console.info(TAG + "Entering SET_FOCUS_POINT to operate"); - camera0Input.setFocusPoint(Point1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SET_FOCUS_POINT PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SET_FOCUS_POINT FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SET_FOCUS_POINT ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_FOCUS_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_FOCUS_0100', 0, async function (done) { - console.info(TAG + "Entering GET_FOCUS_POINT to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "GET_FOCUS_POINT PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "GET_FOCUS_POINT FAILED : " + err.message); - console.info(TAG + "GET_FOCUS_POINT ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 - * @tc.name : check if focus mode manual is supported-camera0Input api - * @tc.desc : check if focus mode manual is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 FAILED " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 - * @tc.name : set focus Point locked camera0 api - * @tc.desc : set focus Point locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 to operate"); - camera0Input.setFocusPoint(Point2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 - * @tc.name : check if focus mode continuous is supported-camera0Input api - * @tc.desc : check if focus mode continuous is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINOUS_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 to operate"); - camera0Input.setFocusPoint(Point3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : GET_FOCUS_POINT_focus mode auto - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check if focus mode auto is supported-camera0Input api - * @tc.desc : check if focus mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_AUTO_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (data != null || data != undefined) { - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 PASSED") - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 to operate"); - camera0Input.getExposureBiasRange(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias range SUCCESS"); - console.info(TAG + "Current Exposure bias range is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 -4 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 to operate"); - camera0Input.setExposureBias(-4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 mode locked - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 mode auto - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 to operate"); - camera0Input.setExposurePoint(Point1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 mode auto - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure Mode SUCCESS"); - console.info(TAG + "Get Exposure Mode data is not null || undefined: "); - console.info(TAG + "Current ExposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 mode auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 to operate"); - camera0Input.setExposureBias(1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "1"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 mode auto - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 to operate"); - camera0Input.setExposurePoint(Point2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - photoOutputAsync.capture(photosettings1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings1"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 mode auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 to operate"); - camera0Input.setExposureBias(4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 mode continuous auto - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 to operate"); - camera0Input.setExposurePoint(Point3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 to operate"); - photoOutputAsync.capture(photosettings2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings2"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 -5 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 to operate"); - camera0Input.setExposureBias(-5, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 mode locked - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 6 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 to operate"); - camera0Input.setExposureBias(6, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 - * @tc.name : capture session stop api - * @tc.desc : capture session stop api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 to operate"); - captureSession.stop(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 captureSession.stop success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering captureSession.stop data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 captureSession.stop PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 - * @tc.name : capture session release api - * @tc.desc : capture session release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 to operate"); - captureSession.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering captureSession.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering captureSession.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 ends here"); - await sleep(1000); - done(); - } - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 - * @tc.name : photoOutput release api - * @tc.desc : photoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 photoOutputAsync == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 to operate"); - photoOutputAsync.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutputAsync.release success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 FAILED: " + err.message); - console.info(TAG + "Entering photoOutputAsync.release ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 - * @tc.name : previewOutput release api - * @tc.desc : previewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 previewOutputAsync == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 to operate"); - previewOutputAsync.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering previewOutputAsync.release success"); - console.info(TAG + "Entering previewOutputAsync.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 ends here"); - await sleep(1000); - done(); - } - }) - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 - * @tc.name : camera Input release api - * @tc.desc : camera Input release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 camera0Input == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 to operate"); - camera0Input.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering camera0Input.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering camera0Input.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - }) - await sleep(1000); - done(); - } - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets b/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets deleted file mode 100644 index c14442e53bbb82953bb57518e61b1a76791d112c..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets +++ /dev/null @@ -1,3283 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables -var camera0InputPromise; -var cameraManagerPromise; -var previewOutputPromise; -var photoOutputPromise; -var CaptureSessionPromise; -var surfaceId1; -var camerasArrayPromise -var camera1InputPromise; - -var Point1 = { x: 1, y: 1 } -var Point2 = { x: 2, y: 2 } -var Point3 = { x: 3, y: 3 } - -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -export default function cameraJSUnitPhotoPromise(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJsUnitPhotoPromise', function () { - console.info(TAG + '----------CameraJsUnitPhotoPromise--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - console.info(TAG + "----------Camera-PhotoMode-Promise-------------"); - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------"); - cameraManagerPromise = await cameraObj.getCameraManager(null); - console.info(TAG + "Entering Get camera manager cameraManagerPromise: " + JSON.stringify(cameraManagerPromise)); - if (cameraManagerPromise != null && cameraManagerPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManagerPromise == null || cameraManagerPromise == undefined) { - console.info(TAG + 'Entering camera status callback cameraManagerPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate') - cameraManagerPromise.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManagerPromise is success"); - if (data != null || data != undefined) { - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 - * @tc.name : Get camera from cameramanager to get array of camera promise api - * @tc.desc : Get camera from cameramanager to get array of camera promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100--------------"); - camerasArrayPromise = await cameraManagerPromise.getCameras(); - console.info(TAG + "Entering Get Cameras: " + JSON.stringify(camerasArrayPromise)); - if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { - console.info(TAG + "Entering Get Cameras success"); - for (var i = 0; i < camerasArrayPromise.length; i++) { - // Get the variables from camera object - var cameraId = camerasArrayPromise[i].cameraId; - console.info(TAG + "Entering Get Cameras camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArrayPromise[i].cameraPosition; - console.info(TAG + "Entering Get Cameras camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArrayPromise[i].cameraType; - console.info(TAG + "Entering Get Cameras camera" + i + "Type: " + cameraType); - var connectionType = camerasArrayPromise[i].connectionType - console.info(TAG + "Entering Get Cameras connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraId promise api - * @tc.desc : Create camerainput from camera-0 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------CAMERA-0 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera0InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraId); - console.info(TAG + "Entering Create camerainput camera0InputPromise: " + JSON.stringify(camera0InputPromise)); - if (camera0InputPromise != null && camera0InputPromise != undefined) { - console.info(TAG + "Entering Create camerainput camera0InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 - * @tc.name : Create camerainput from camera-1 cameraId promise api - * @tc.desc : Create camerainput from camera-1 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200--------------"); - camera1InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[1].cameraId); - console.info(TAG + "Entering Create camerainput camera1InputPromise: " + JSON.stringify(camera1InputPromise)); - if (camera1InputPromise != null && camera1InputPromise != undefined) { - console.info(TAG + "Entering Create camerainput camera1InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 to operate"); - camera0InputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "camera0InputPromise error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error during camera0InputPromise with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*PreviewOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Create PreviewOutput instance promise api - * @tc.desc : Create PreviewOutput instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - console.info(TAG + " Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - previewOutputPromise = await cameraObj.createPreviewOutput(surfaceId); - console.info(TAG + " Entering createPreviewOutput success"); - if (previewOutputPromise != null || previewOutputPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering createPreviewOutput PASSED: " + JSON.stringify(previewOutputPromise)); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 - * @tc.name : Preview output callback on error api - * @tc.desc : Preview output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview output callback on error previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 to operate"); - previewOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Create PhotoOutput instance promise api - * @tc.desc : Create PhotoOutput instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1000) - photoOutputPromise = await cameraObj.createPhotoOutput(surfaceId1); - console.info(TAG + "Entering createPhotoOutput success"); - if (photoOutputPromise != null || photoOutputPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output callback on error photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 to operate"); - photoOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 - * @tc.name : Create CaptureSession instance promise api - * @tc.desc : Create Capturesession instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 to operate"); - CaptureSessionPromise = await cameraObj.createCaptureSession(null); - console.info(TAG + "Entering createCaptureSession success"); - if (CaptureSessionPromise != null || CaptureSessionPromise != undefined) { - console.info(TAG + "Entering createCaptureSession data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - //Capturesession callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 - * @tc.name : CaptureSession callback on error api - * @tc.desc : CaptureSession callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering CaptureSession callback on error captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 to operate"); - CaptureSessionPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession errorcallback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 - * @tc.name : CaptureSession_Begin config promise api - * @tc.desc : CaptureSession_Begin config promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering CaptureSession_Begin config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 to operate"); - const promise = await CaptureSessionPromise.beginConfig(); - console.info(TAG + "Entering beginConfig success:"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 beginConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add Input captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 to operate"); - const Promise = await CaptureSessionPromise.addInput(camera1InputPromise); - console.info(TAG + "Entering Add Input addInput success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add preview Output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 to operate"); - const promise = await CaptureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering Add preview Output : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Remove preview Output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 to operate"); - const Promise = await CaptureSessionPromise.removeOutput(previewOutputPromise); - console.info(TAG + "Entering Remove preview Output success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add preview Output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 to operate"); - const promise = await CaptureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering Add preview Output : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering commit config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 to operate"); - const promise = await CaptureSessionPromise.commitConfig(); - console.info(TAG + "Entering commit config commitConfig success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 commitConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 commitConfig FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 commitConfig ends here"); - } - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 to operate"); - await photoOutputPromise.isMirrorSupported() - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 FAILED : " + err.message); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 to operate"); - await photoOutputPromise.setMirror(true).then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 FAILED : " + err.message); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 - * @tc.name : setMirror false - * @tc.desc : setMirror false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 to operate"); - await photoOutputPromise.setMirror(false) - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'false'); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 FAILED : " + err.message); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100 - * @tc.name : CaptureSession_Begin config promise api - * @tc.desc : CaptureSession_Begin config promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100 to operate"); - const promise = await CaptureSessionPromise.beginConfig(); - console.info(TAG + "Entering beginConfig success:"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100 beginConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering beginConfig FAILED"); - } - console.info(TAG + "Entering beginConfig ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 to operate"); - const Promise = await CaptureSessionPromise.removeInput(camera1InputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add Input captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 to operate"); - const Promise = await CaptureSessionPromise.addInput(camera0InputPromise); - console.info(TAG + "Entering Add Input addInput success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add output with photo output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 to operate"); - const promise = await CaptureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering Add output with photo output success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 to operate"); - const Promise = await CaptureSessionPromise.removeOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 addInput success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 to operate"); - const promise = await CaptureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering commit config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 to operate"); - const promise = await CaptureSessionPromise.commitConfig(); - console.info(TAG + "Entering commit config commitConfig success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 commitConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 commitConfig FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 commitConfig ends here"); - } - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0InputPromise.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0InputPromise.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - // callback related API - //preview callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview output callback on frame start previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 to operate"); - previewOutputPromise.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 FAILED :" + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 - * @tc.name : Preview capture callback on frame end api - * @tc.desc : Preview capture callback on frame end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview capture callback on frame end previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 to operate"); - previewOutputPromise.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 FAILED : + err.message"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture start photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 to operate"); - photoOutputPromise.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "CaptureStart Callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture end photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 to operate"); - photoOutputPromise.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 FAILED' + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on frame shutter photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 to operate"); - photoOutputPromise.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 with captureId: " + data.captureId); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 - * @tc.name : capture session start api - * @tc.desc : capture session start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering capture session start captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 to operate"); - await CaptureSessionPromise.start(); - console.info(TAG + "Entering captureSession start success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - //Location - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - await photoOutputPromise.capture(photosettings1) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 FAILED:" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 to operate"); - await photoOutputPromise.capture(photosettings2) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 FAILED:" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 to operate"); - await photoOutputPromise.capture(photosettings3) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings3 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 :" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 to operate"); - await photoOutputPromise.capture(photosettings4) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings4 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100--------------"); - console.info(TAG + 'hasFlash called.') - var hasFlashPromise = await camera0InputPromise.hasFlash(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 success"); - if (hasFlashPromise != null || hasFlashPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 is: " + JSON.stringify(hasFlashPromise)); - expect(hasFlashPromise).assertEqual(true); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 FAILED : "); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 ends here"); - await sleep(1000) - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 to operate"); - var isFMOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 SUCCESS "); - if (isFMOpenSupported != null || isFMOpenSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + JSON.stringify(isFMOpenSupported)); - expect(isFMOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 to operate"); - var SetFMOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMOpen)) - if (SetFMOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 to operate"); - var GetFMOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 success: " + JSON.stringify(GetFMOpen)); - if (GetFMOpen == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + JSON.stringify(GetFMOpen)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 to operate"); - var isFMAlwaysOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 SUCCESS "); - if (isFMAlwaysOpenSupported != null || isFMAlwaysOpenSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + isFMAlwaysOpenSupported); - expect(isFMAlwaysOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - var SetFMAlwaysOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMAlwaysOpen)) - if (SetFMAlwaysOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - var GetFMAlwaysOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 success"); - if (GetFMAlwaysOpen == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAlwaysOpen); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 to operate"); - var isFMAutoSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 SUCCESS "); - if (isFMAutoSupported != null || isFMAutoSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_AUTO data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + isFMAutoSupported); - expect(isFMAutoSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 to operate"); - var SetFMAlwaysAuto = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "SetFMAlwaysAuto: " + JSON.stringify(SetFMAlwaysAuto)) - if (SetFMAlwaysAuto == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 to operate"); - var GetFMAuto = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 success"); - if (GetFMAuto == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAuto); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 to operate"); - var isFMCloseSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 SUCCESS "); - if (isFMCloseSupported != null || isFMCloseSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + isFMCloseSupported); - expect(isFMCloseSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 to operate"); - var SetFMClose = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMClose)) - if (SetFMClose == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 - * @tc.name : get flash mode close camera0 api - * @tc.desc : get flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 to operate"); - var GetFMClose = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 success"); - if (GetFMClose == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMClose); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - //ZOOM Function - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 - * @tc.name : get zoom ratio camera-0 cameraId api promise api - * @tc.desc : get zoom ratio camera-0 cameraId api promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100--------------"); - var getZoomRatioPromise = await camera0InputPromise.getZoomRatioRange(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 getZoomRatioPromise: " + JSON.stringify(getZoomRatioPromise)); - if (getZoomRatioPromise != null && getZoomRatioPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 setZoomRatioPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 success: " + JSON.stringify(getZoomRatioPromise)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(1); - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - var getpromise1 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise1); - if (getpromise1 != null && getpromise1 != undefined) { - expect(getpromise1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(2); - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - var getpromise2 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise2); - if (getpromise2 != null && getpromise2 != undefined) { - expect(getpromise2).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(3); - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - var getpromise3 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise3); - if (getpromise3 != null && getpromise3 != undefined) { - expect(getpromise3).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(4); - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - var getpromise4 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise4); - if (getpromise4 != null && getpromise4 != undefined) { - expect(getpromise4).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(5); - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - var getpromise5 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise5); - if (getpromise5 != null && getpromise5 != undefined) { - expect(getpromise5).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(6); - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - var getpromise6 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise6); - if (getpromise6 != null && getpromise6 != undefined) { - expect(getpromise6).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - // FOCUS promise API's - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 - * @tc.name : check is focus mode locked supported-camera0Input api - * @tc.desc : check is focus mode locked supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 to operate"); - var isFMLockedSupported = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering is focus mode locked supported SUCCESS "); - if (isFMLockedSupported != null || isFMLockedSupported != undefined) { - console.info(TAG + "Entering is focus mode locked supported data is not null || undefined"); - console.info(TAG + "is focus mode locked supported : " + isFMLockedSupported); - expect(isFMLockedSupported).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED) - .then(function (data) { - console.info(TAG + "SetFMLocked: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode locked SUCCESS, current focusmode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 FAILED : ") - expect().assertFail(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode locked success: "); - if (data == 0) { - console.info(TAG + "Current focusmode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 - * @tc.name : get focal length camera0 api - * @tc.desc : get focal length camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 to operate"); - await camera0InputPromise.getFocalLength() - .then(function (data) { - console.info(TAG + "Current focallength is: " + JSON.stringify(data)); - expect(data).assertEqual(3.4600000381469727); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 - * @tc.name : is focusmode manual supported - * @tc.desc : is focusmode manual supported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 to operate"); - var isFMmanualSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL); - if (isFMmanualSupportedpromise != null || isFMmanualSupportedpromise != undefined) { - console.info(TAG + "Entering is focusmode manual supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMmanualSupportedpromise); - expect(isFMmanualSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL) - .then(function (data) { - console.info(TAG + "setFocusManual: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode manual SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode manual SUCCESS"); - if (data == 0) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 FAILED " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 - * @tc.name : check is focus mode continuous supported-camera0Input api - * @tc.desc : check is focus mode continuous supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 to operate"); - var isFMContinuousSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - if (isFMContinuousSupportedpromise != null || isFMContinuousSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode continuous supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINUOUS_SUPPORTED is: " + isFMContinuousSupportedpromise); - expect(isFMContinuousSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) - .then(function (data) { - console.info(TAG + "setFocusCont: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode continuous SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode continuous SUCCESS"); - if (data == 1) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check is focus mode auto supported-camera0Input api - * @tc.desc : check is focus mode auto supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 to operate"); - var isFMAutoSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (isFMAutoSupportedpromise != null || isFMAutoSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode auto supported data is not null || undefined"); - console.info(TAG + "is focus mode auto supported is: " + isFMAutoSupportedpromise); - expect(isFMAutoSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 to operate"); - var setFocusAuto = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO) - .then(function () { - console.info(TAG + "setFocusAuto: " + JSON.stringify(setFocusAuto)) - console.info(TAG + "Entering set focus mode auto SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode auto SUCCESS " + JSON.stringify(data)); - if (data == 2) { - console.info(TAG + "Current FocusMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 PASSED"); - } - }) - .catch((err) => { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode locked SUCCESS"); - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 to operate"); - await camera0InputPromise.getExposureBiasRange() - .then(function (data) { - console.info(TAG + "Entering getExposureBiasRange SUCCESS"); - console.info(TAG + "Current ExposureBiasRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100-4 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 to operate"); - await camera0InputPromise.setExposureBias(-4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 to operate"); - await camera0InputPromise.setExposurePoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 FAILED: " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 to operate"); - await camera0InputPromise.setExposureBias(1) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "1"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 to operate"); - await camera0InputPromise.setExposurePoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 to operate"); - await photoOutputPromise.capture(photosettings1) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with Rotation-0 & Quality-0 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 FAILED:" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 to operate"); - await camera0InputPromise.setExposureBias(4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 to operate"); - await camera0InputPromise.setExposurePoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - await photoOutputPromise.capture(photosettings2) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with location settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400-5 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 to operate"); - await camera0InputPromise.setExposureBias(-5) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 to operate"); - await camera0InputPromise.setExposureBias(6) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 ends here"); - await sleep(1000); - done(); - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 - * @tc.name : capture session stop api - * @tc.desc : capture session stop api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering capture session stop captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 to operate"); - await CaptureSessionPromise.stop(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 captureSession.stop PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 captureSession.stop ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : capture session release api - * @tc.desc : capture session release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering capture session release captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await CaptureSessionPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : PreviewOutput release api - * @tc.desc : PreviewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering previewOutputPromise.release previewOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await previewOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : PhotoOutput release api - * @tc.desc : PhotoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering PhotoOutput release photoOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await photoOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : cameraInput release api - * @tc.desc : cameraInput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering cameraInput release camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await camera0InputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - }); -} \ No newline at end of file diff --git a/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets b/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets deleted file mode 100644 index 571ca690ff89ac2fbd3becb18f81fc97bc447bf8..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets +++ /dev/null @@ -1,3800 +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 cameraObj from '@ohos.multimedia.camera'; -import media from '@ohos.multimedia.media' -import image from '@ohos.multimedia.image'; -import mediaLibrary from '@ohos.multimedia.mediaLibrary' -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' - -// @ts-nocheck -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -let TAG = "CameraModuleTest: "; -var cameraManager -var camerasArray -var camera0Input -var previewOutput -var photoOutputAsync -var videoRecorder -var surfaceId1 - -var minFrameRate_Grp0=12; -var maxFrameRate_Grp0=12; -var minFrameRate_Mix=14; -var maxFrameRate_Mix=15; -var minFrameRate_Err1=11; -var maxFrameRate_Err1=31; -var minFrameRate_Err2=14; -var maxFrameRate_Err2=28; -var minFrameRate_Err3=16; -var maxFrameRate_Err3=25; -var minFrameRate_Grp20=30; -var maxFrameRate_Grp20=30; - -var Point = { x: 1, y: 1 } -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -let fdPath; -let fileAsset; -let fdNumber; -let configFile = { - audioBitrate: 48000, - audioChannels: 2, - audioCodec: 'audio/mp4a-latm', - audioSampleRate: 48000, - durationTime: 1000, - fileFormat: 'mp4', - videoBitrate: 48000, - videoCodec: 'video/mp4v-es', - videoFrameWidth: 640, - videoFrameHeight: 480, - videoFrameRate: 30 -} - -let videoConfig = { - audioSourceType: 1, - videoSourceType: 0, - profile: configFile, - url: 'file:///data/media/02.mp4', - orientationHint: 0, - location: { latitude: 30, longitude: 130 }, - maxSize: 100, - maxDuration: 500 -} -var videoId -var videoOutput -var captureSession - -export default function cameraJSUnitVideoAsync(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(time) { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(1) - }, time * 1000) - }).then(() => { - console.info(`sleep ${time} over...`) - }) - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - async function getFd(pathName) { - let displayName = pathName; - const mediaTest = mediaLibrary.getMediaLibrary(); - let fileKeyObj = mediaLibrary.FileKey; - let mediaType = mediaLibrary.MediaType.VIDEO; - let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); - let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); - if (dataUri != undefined) { - let args = dataUri.id.toString(); - let fetchOp = { - selections: fileKeyObj.ID + "=?", - selectionArgs: [args], - } - let fetchFileResult = await mediaTest.getFileAssets(fetchOp); - fileAsset = await fetchFileResult.getAllObject(); - fdNumber = await fileAsset[0].open('Rw'); - fdPath = "fd://" + fdNumber.toString(); - } - } - - async function closeFd() { - if (fileAsset != null) { - await fileAsset[0].close(fdNumber).then(() => { - console.info('[mediaLibrary] case close fd success'); - }).catch((err) => { - console.info('[mediaLibrary] case close fd failed'); - }); - } else { - console.info('[mediaLibrary] case fileAsset is null'); - } - } - - async function getvideosurface() { - await getFd('02.mp4'); - videoConfig.url = fdPath; - media.createVideoRecorder((err, recorder) => { - console.info(TAG + 'createVideoRecorder called') - videoRecorder = recorder - console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder)) - console.info(TAG + 'videoRecorder.prepare called.') - videoRecorder.prepare(videoConfig, (err) => { - console.info(TAG + 'videoRecorder.prepare success.') - }) - videoRecorder.getInputSurface((err, id) => { - console.info(TAG + 'getInputSurface called') - videoId = id - console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoId)) - }) - }) - } - - describe('VideoModeAsync', function () { - console.info(TAG + '----------Camera-VideoMode-Async--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5); - console.info('beforeEach case'); - }) - - afterEach(async function () { - await closeFd(); - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100--------------') - await sleep(1) - cameraObj.getCameraManager(null, (err, data) => { - if (!err) { - console.info(TAG + 'Entering Get Camera manager success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Get Camera Manager data is not null || undefined') - cameraManager = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 PASSED') - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManager == null || cameraManager == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManager == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate') - cameraManager.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManager is success"); - if (data != null || data != undefined) { - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Camera status Callback FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------') - await sleep(1) - cameraManager.getCameras((err, data) => { - if (!err) { - console.info(TAG + 'Entering Get Cameras success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Get Cameras data is not null || undefined') - camerasArray = data - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId - console.info(TAG + 'Entering Get Cameras camera' + i + 'Id: ' + cameraId) - var cameraPosition = camerasArray[i].cameraPosition - console.info(TAG + 'Entering Get Cameras camera' + i + 'Position: ' + cameraPosition) - var cameraType = camerasArray[i].cameraType - console.info(TAG + 'Entering Get Cameras camera' + i + 'Type: ' + cameraType) - var connectionType = camerasArray[i].connectionType - console.info(TAG + 'Entering Get Cameras connection' + i + 'Type: ' + connectionType) - } - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined') - } - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info('--------------CAMERA-0 STARTS HERE--------------') - console.info('--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------') - await sleep(1) - cameraManager.createCameraInput(camerasArray[0].cameraId, (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + 'Entering Create camera input data is not null || undefined') - camera0Input = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :' + camerasArray[0].cameraId) - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering Camera Input callback camera0Input == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 to operate"); - camera0Input.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "camera0Input error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 - * @tc.name : Create previewoutput async api - * @tc.desc : Create previewoutput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 to operate') - await sleep(1) - cameraObj.createPreviewOutput(surfaceId, (err, data) => { - if (!err) { - console.info(TAG + 'Entering Create preview output success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Create preview output data is not null || undefined') - previewOutput = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 PASSED') - } - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Preview output callback on error api - * @tc.desc : Preview output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering PreviewOutput callback on error previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 to operate"); - previewOutput.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Create PhotoOutput instance api - * @tc.desc : Create PhotoOutput instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1) - cameraObj.createPhotoOutput(surfaceId1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering createPhotoOutput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering createPhotoOutput data is not null || undefined"); - photoOutputAsync = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate"); - photoOutputAsync.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error during PhotoOutput with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 - * @tc.name : Create videooutput async api - * @tc.desc : Create videooutput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 to operate') - await getvideosurface() - await sleep(2) - cameraObj.createVideoOutput(videoId, (err, data) => { - if (!err) { - console.info(TAG + 'Entering Create videooutput success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Create videooutput data is not null || undefined') - videoOutput = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 PASSED') - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : VideoOutput callback onerror async api - * @tc.desc : VideoOutput callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 videoOutput == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - videoOutput.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "VideoOutput Errorcallback is success") - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1) - done() - }) - await sleep(1) - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 - * @tc.name : Create capturesession async api - * @tc.desc : Create capturesession async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 to operate') - await sleep(1) - cameraObj.createCaptureSession(null, async (err, data) => { - if (!err) { - console.info(TAG + 'Entering Create capturesession success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Create capturesession data is not null || undefined') - captureSession = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 PASSED') - } - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail() - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 - * @tc.name : CaptureSession callback on error api - * @tc.desc : CaptureSession callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 to operate"); - captureSession.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession errorcallback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 - * @tc.name : Begin Config async api - * @tc.desc : Begin Config async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering Begin Config captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 to operate') - await sleep(1) - captureSession.beginConfig((err, data) => { - if (!err) { - console.info(TAG + 'Entering Begin Config success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 - * @tc.name : AddInput async api - * @tc.desc : AddInput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddInput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 to operate') - await sleep(1) - captureSession.addInput(camera0Input, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddInput success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 - * @tc.name : AddOutput preview async api - * @tc.desc : AddOutput preview async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput preview captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 to operate') - await sleep(1) - captureSession.addOutput(previewOutput, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput preview success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 ends here"); - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 - * @tc.name : AddOutput video async api - * @tc.desc : AddOutput video async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput video captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 to operate') - await sleep(1) - captureSession.addOutput(videoOutput, async (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput video success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 ends here') - await sleep(1); - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeInput(camera0Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove input success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering Remove Input FAILED" + err.message); - console.info(TAG + "Entering Remove Input ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeOutput(previewOutput, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove preview Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering Remove preview Output FAILED" + err.message); - console.info(TAG + "Entering Remove Preview Output ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove photo Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove photo Output FAILED" + err.message); - console.info(TAG + "Entering Remove photo Output ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Remove video Output api - * @tc.desc : Remove video Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeOutput(videoOutput, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove video Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering Remove video Output FAILED" + err.message); - console.info(TAG + "Entering Remove video Output ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 - * @tc.name : AddInput async api - * @tc.desc : AddInput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddInput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 to operate') - await sleep(1) - captureSession.addInput(camera0Input, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddInput success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 - * @tc.name : AddOutput preview async api - * @tc.desc : AddOutput preview async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 to operate') - await sleep(1) - captureSession.addOutput(previewOutput, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput success') - console.info(TAG + 'Entering AddOutput data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 ends here"); - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 - * @tc.name : AddOutput video async api - * @tc.desc : AddOutput video async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 to operate') - await sleep(1) - captureSession.addOutput(videoOutput, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput success') - console.info(TAG + 'Entering AddOutput data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 ends here') - done() - }) - await sleep(1) - done() - } - }) - - //framerate - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 - * @tc.name : get frame rate range camera0 api - * @tc.desc : get frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 to operate"); - videoOutput.getFrameRateRange(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get frame rate range success"); - expect(true).assertTrue(); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Grp0,maxFrameRate_Grp0, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range PASSED") - expect(true).assertTrue(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Mix,maxFrameRate_Mix, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED") - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api_err - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Err1,maxFrameRate_Err1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED") - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Err2,maxFrameRate_Err2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED"); - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Err3,maxFrameRate_Err3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED"); - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Grp20,maxFrameRate_Grp20, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range PASSED") - expect(true).assertTrue(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeOff - * @tc.desc : getVideoStabilizationModeOff async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode Off success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeLow - * @tc.desc : getVideoStabilizationModeLOw async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode low success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(1) - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeMedium - * @tc.desc : getVideoStabilizationModeMedium async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode medium success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeHigh - * @tc.desc : getVideoStabilizationModeHigh async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode High success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeAuto - * @tc.desc : getVideoStabilizationModeAuto async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode Auto success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 - * @tc.name : CommitConfig async api - * @tc.desc : CommitConfig async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering CommitConfig captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 to operate') - await sleep(1) - captureSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + 'Entering CommitConfig success') - console.info(TAG + 'Entering CommitConfig data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0Input.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0Input.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //callback API - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering Preview output callback on frame start previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate"); - previewOutput.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : Preview capture callback on frame end api - * @tc.desc : Preview capture callback on frame end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering Preview capture callback on frame end previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate"); - previewOutput.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering Photo Capture Callback on CaptureStart photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 to operate"); - photoOutputAsync.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "Photo Capture Callback on CaptureStart is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 to operate"); - photoOutputAsync.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 FAILED' + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 to operate"); - photoOutputAsync.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "frameShutter callback with captureId: " + data.captureId); - console.info(TAG + "frameShutter callback with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : VideoOutput callback onframestart async api - * @tc.desc : VideoOutput callback onframestart async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + "Entering VideoOutput callback onframestart videoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate"); - videoOutput.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 is FAILED : " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : VideoOutput callback onframeend async api - * @tc.desc : VideoOutput callback onframeend async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + 'Entering VideoOutput callback onframeend videoOutput == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate') - await sleep(1) - videoOutput.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 is success'); - if (data != null || data != undefined) { - expect(true).assertTrue() - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED' + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 - * @tc.name : CaptureSession start async api - * @tc.desc : CaptureSession start async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CaptureSession start captureSession == null || undefined") - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 to operate") - await sleep(1) - captureSession.start(async (err, data) => { - if (!err) { - console.info(TAG + "Entering CaptureSession start success") - expect(true).assertTrue() - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 PASSED") - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "hasFlash called.") - camera0Input.hasFlash(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 is: " + data); - expect(data).assertEqual(true); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 ends here"); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 success"); - if (data == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_ALWAYS_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 success"); - if (data == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode auto is supported-camera0Input api - * @tc.desc : check if flash mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_AUTO SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 success"); - if (data == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_CLOSE SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 success"); - if (data == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 - * @tc.name : get zoom ratio camera-0 cameraId api - * @tc.desc : get zoom ratio camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100--------------"); - camera0Input.getZoomRatioRange(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 Success " + data) - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 ends here"); - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(1, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(2, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_CALLBACK_0100 PASSED "); - } - else { - expect().assertFail(); - console.info(TAG + "GET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - } else { - expect().assertFail(); - console.info(TAG + "SET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(3, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(4, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(5, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(6, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode locked is supported-camera0Input api - * @tc.desc : check if focus mode locked is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Is Focus Mode Locked Supported SUCCESS: " + data); - if (data != null || data != undefined) { - console.info(TAG + "Entering Is Focus Mode Locked Supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_LOCKED_SUPPORTED is: " + data); - expect(data).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 FAILED :" + err.message); - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Mode Locked SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 FAILED : ") - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Mode Locked SUCCESS: " + data); - console.info(TAG + "Get Focus Mode Locked data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode manual is supported-camera0Input api - * @tc.desc : check if focus mode manual is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 FAILED " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 to operate"); - camera0Input.setFocusPoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode continuous is supported-camera0Input api - * @tc.desc : check if focus mode continuous is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINOUS_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 - * @tc.name : set focus Point locked camera0 api - * @tc.desc : set focus Point locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 to operate"); - camera0Input.setFocusPoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode auto is supported-camera0Input api - * @tc.desc : check if focus mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_AUTO_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (data != null || data != undefined) { - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 PASSED") - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 to operate"); - camera0Input.setFocusPoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 to operate"); - camera0Input.setExposurePoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100_exposure mode continuous auto - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 to operate"); - camera0Input.getExposureBiasRange(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias range SUCCESS"); - console.info(TAG + "Current Exposure bias range is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 to operate"); - camera0Input.setExposureBias(-4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure Mode SUCCESS"); - console.info(TAG + "Get Exposure Mode data is not null || undefined: "); - console.info(TAG + "Current ExposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 to operate"); - camera0Input.setExposurePoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 to operate"); - camera0Input.setExposureBias(1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "1"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 to operate"); - camera0Input.setExposurePoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 to operate"); - camera0Input.setExposureBias(4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100 to operate"); - photoOutputAsync.isMirrorSupported(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100 to operate"); - photoOutputAsync.setMirror(true, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 - * @tc.name : VideoOutput start async api - * @tc.desc : VideoOutput start async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 videoOutput == null || undefined") - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 to operate") - await sleep(1) - videoOutput.start(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 success: " + JSON.stringify(data)) - if (data == undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 FAILED: " + err.message) - } - }) - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 - * @tc.name : VideoRecorder start async api - * @tc.desc : VideoRecorder start async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100', 0, async function (done) { - if (videoRecorder == null || videoRecorder == undefined) { - console.info(TAG + 'Entering VideoRecorder start videoRecorder == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 to operate') - videoRecorder.start() - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 called'); - sleep(3); - console.info(TAG + 'Capture with photosettings1 during video - Start & setMirror: true') - photoOutputAsync.capture(photosettings1) - console.info(TAG + 'Capture during Video - End.') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 - * @tc.name : VideoOutput stop async api - * @tc.desc : VideoOutput stop async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + 'Entering VideoOutput stop videoOutput == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 to operate') - videoOutput.stop(async (err, data) => { - if (!err) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 success: ' + JSON.stringify(data)) - if (data == undefined) { - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100 - * @tc.name : VideoRecorder stop async api - * @tc.desc : VideoRecorder stop async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100', 0, async function (done) { - if (videoRecorder == null || videoRecorder == undefined) { - console.info(TAG + 'Entering VideoRecorder stop videoRecorder == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100 to operate') - videoRecorder.stop() - console.info(TAG + 'VideoRecorder stop stopVideo done.') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100 PASSED') - expect(true).assertTrue() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 - * @tc.name : CaptureSession stop async api - * @tc.desc : CaptureSession stop async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering CaptureSession stop captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 to operate') - await sleep(1) - captureSession.stop((err, data) => { - if (!err) { - console.info(TAG + 'Entering CaptureSession stop success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 - * @tc.name : CaptureSession release async api - * @tc.desc : CaptureSession release async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering CaptureSession release captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 to operate') - await sleep(1) - captureSession.release(async (err, data) => { - if (!err) { - console.info(TAG + 'Entering CaptureSession release success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering CaptureSession release data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 PASSED') - } - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 - * @tc.name : videooutput release api - * @tc.desc : videooutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + "Entering videooutput.release previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 to operate"); - videoOutput.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering videooutput.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering videooutput.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 ends here"); - await sleep(1); - done(); - } - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 - * @tc.name : previewOutput release api - * @tc.desc : previewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 to operate"); - previewOutput.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering previewOutput.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering previewOutput.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering previewOutput.release PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering previewOutput.release ends here"); - await sleep(1); - done(); - } - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 - * @tc.name : photoOutput release api - * @tc.desc : photoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 photoOutputAsync == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 to operate"); - photoOutputAsync.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutputAsync.release success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering photoOutputAsync.release ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 - * @tc.name : camera Input release api - * @tc.desc : camera Input release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering camera0Input.release camera0Input == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 to operate"); - camera0Input.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering camera0Input.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering camera0Input.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 ends here"); - await sleep(1); - done(); - } - }) - await sleep(1); - done(); - } - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets b/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets deleted file mode 100644 index aa4466c90fbcc0482aff18bd91e25e3ae39d7b27..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraUnspc/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets +++ /dev/null @@ -1,3367 +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 cameraObj from '@ohos.multimedia.camera' -import media from '@ohos.multimedia.media' -import image from '@ohos.multimedia.image'; -import mediaLibrary from '@ohos.multimedia.mediaLibrary' -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' - -// @ts-nocheck -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -let TAG = 'CameraModuleTest: ' -var cameraManagerPromise -var camerasArrayPromise -var camera0InputPromise -var previewOutputPromise -var videoRecorder -var photoOutputPromise -let fdPath; -let fileAsset; -let fdNumber; - -var minFrameRate_Grp0=12; -var maxFrameRate_Grp0=12; -var minFrameRate_Mix=14; -var maxFrameRate_Mix=15; -var minFrameRate_Err1=11; -var maxFrameRate_Err1=31; -var minFrameRate_Err2=14; -var maxFrameRate_Err2=28; -var minFrameRate_Err3=16; -var maxFrameRate_Err3=25; -var minFrameRate_Grp20=30; -var maxFrameRate_Grp20=30; - -var Point1 = { x: 1, y: 1 } -var Point2 = { x: 2, y: 2 } -var Point3 = { x: 3, y: 3 } -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -var photosettings5 = { - rotation: 270, -} -let configFile = { - audioBitrate: 48000, - audioChannels: 2, - audioCodec: 'audio/mp4a-latm', - audioSampleRate: 48000, - durationTime: 1000, - fileFormat: 'mp4', - videoBitrate: 48000, - videoCodec: 'video/mp4v-es', - videoFrameWidth: 640, - videoFrameHeight: 480, - videoFrameRate: 30 -} - -let videoConfig = { - audioSourceType: 1, - videoSourceType: 0, - profile: configFile, - url: 'file:///data/media/01.mp4', - orientationHint: 0, - location: { latitude: 30, longitude: 130 }, - maxSize: 100, - maxDuration: 500 -} -var surfaceId1 -var videoId -var videoOutputPromise -var captureSessionPromise - -export default function cameraJSUnitVideoPromise(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(time) { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(1) - }, time * 1000) - }).then(() => { - console.info(`sleep ${time} over...`) - }) - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - async function getFd(pathName) { - let displayName = pathName; - const mediaTest = mediaLibrary.getMediaLibrary(); - let fileKeyObj = mediaLibrary.FileKey; - let mediaType = mediaLibrary.MediaType.VIDEO; - let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); - let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); - if (dataUri != undefined) { - let args = dataUri.id.toString(); - let fetchOp = { - selections: fileKeyObj.ID + "=?", - selectionArgs: [args], - } - let fetchFileResult = await mediaTest.getFileAssets(fetchOp); - fileAsset = await fetchFileResult.getAllObject(); - fdNumber = await fileAsset[0].open('Rw'); - fdPath = "fd://" + fdNumber.toString(); - } - } - - async function closeFd() { - if (fileAsset != null) { - await fileAsset[0].close(fdNumber).then(() => { - console.info('[mediaLibrary] case close fd success'); - }).catch((err) => { - console.info('[mediaLibrary] case close fd failed'); - }); - } else { - console.info('[mediaLibrary] case fileAsset is null'); - } - } - - async function getvideosurface() { - await getFd('01.mp4'); - videoConfig.url = fdPath; - media.createVideoRecorder((err, recorder) => { - console.info(TAG + 'createVideoRecorder called') - videoRecorder = recorder - console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder)) - console.info(TAG + 'videoRecorder.prepare called.') - videoRecorder.prepare(videoConfig, (err) => { - console.info(TAG + 'videoRecorder.prepare success.') - }) - videoRecorder.getInputSurface((err, id) => { - console.info(TAG + 'getInputSurface called') - videoId = id - console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoId)) - }) - }) - } - - describe('VideoModePromise', function () { - console.info(TAG + '----------Camera-VideoMode-Promise--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5); - console.info('beforeEach case'); - }) - - afterEach(async function () { - await closeFd(); - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------') - cameraManagerPromise = await cameraObj.getCameraManager(null) - console.info(TAG + 'Entering Get cameraManagerPromise cameraManagerPromise: ' + cameraManagerPromise) - if (cameraManagerPromise != null && cameraManagerPromise != undefined) { - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManagerPromise == null || cameraManagerPromise == undefined) { - console.info(TAG + 'Entering Camera status Callback cameraManagerPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate') - await sleep(1) - cameraManagerPromise.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManagerPromise is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100--------------') - camerasArrayPromise = await cameraManagerPromise.getCameras() - console.info(TAG + 'Entering Get Cameras Promise: ' + JSON.stringify(camerasArrayPromise)) - if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { - console.info(TAG + 'Entering Get Cameras Promise success') - for (var i = 0; i < camerasArrayPromise.length; i++) { - // Get the variables from camera object - var cameraId = camerasArrayPromise[i].cameraId - console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Id: ' + cameraId) - var cameraPosition = camerasArrayPromise[i].cameraPosition - console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Position: ' + cameraPosition) - var cameraType = camerasArrayPromise[i].cameraType - console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Type: ' + cameraType) - var connectionType = camerasArrayPromise[i].connectionType - console.info(TAG + 'Entering Get Cameras Promise connection' + i + 'Type: ' + connectionType) - } - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraId promise api - * @tc.desc : Create camerainput from camera-0 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------') - camera0InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraId) - console.info(TAG + 'Entering Create camera input promise camera0InputPromise: ' + JSON.stringify(camera0InputPromise)) - if (camera0InputPromise != null && camera0InputPromise != undefined) { - console.info(TAG + 'Entering Create camera input promise camera0InputPromise is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering Camera input error callback camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 to operate"); - camera0InputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "camera0InputPromise error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 - * @tc.name : Create previewoutput promise api - * @tc.desc : Create previewoutput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100--------------') - previewOutputPromise = await cameraObj.createPreviewOutput(surfaceId) - console.info(TAG + 'Entering Create previewOutputPromise: ' + JSON.stringify(previewOutputPromise)) - if (previewOutputPromise != null && previewOutputPromise != undefined) { - console.info(TAG + 'Entering Create previewOutputPromise is not null || undefined') - expect(true).assertTrue(); - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 PASSED') - } else { - expect().assertFail(); - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0InputPromise.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is : " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0InputPromise.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : PreviewOutput callback onerror async api - * @tc.desc : PreviewOutput callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + 'Entering PreviewOutputError callback previewOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - previewOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 - * @tc.name : Create videooutput promise api - * @tc.desc : Create videooutput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 to operate') - await getvideosurface() - await sleep(2) - videoOutputPromise = await cameraObj.createVideoOutput(videoId) - console.info(TAG + 'Entering Create videoOutputPromise: ' + videoOutputPromise) - if (videoOutputPromise != null && videoOutputPromise != undefined) { - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 PASSED') - } else { - expect().assertFail(); - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 ends here'); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : VideoOutput callback onerror async api - * @tc.desc : VideoOutput callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - videoOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + 'VideoOutput Errorcallback is success') - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1) - done() - }) - await sleep(1) - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Create PhotoOutput instance promise api - * @tc.desc : Create PhotoOutput instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1) - photoOutputPromise = await cameraObj.createPhotoOutput(surfaceId1); - console.info(TAG + "Entering createPhotoOutput success"); - if (photoOutputPromise != null || photoOutputPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output callback on error photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate"); - photoOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 - * @tc.name : Create capturesession promise api - * @tc.desc : Create capturesession promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 to operate') - captureSessionPromise = await cameraObj.createCaptureSession(null) - console.info(TAG + 'Entering Create captureSessionPromise: ' + captureSessionPromise) - if (captureSessionPromise != null && captureSessionPromise != undefined) { - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 ends here'); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 - * @tc.name : CaptureSession callback onerror async api - * @tc.desc : CaptureSession callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + 'Entering captureSession errorcallback captureSessionPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - captureSessionPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession errorcallback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 - * @tc.name : CaptureSession_Begin config promise api - * @tc.desc : CaptureSession_Begin config promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Create captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.beginConfig(); - console.info(TAG + "Entering beginConfig success:"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 beginConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add Input captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.addInput(camera0InputPromise); - console.info(TAG + "Entering Add Input success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add preview output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering Add preview output : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 - * @tc.name : Add output with video output api - * @tc.desc : Add output with video output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add video output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(videoOutputPromise); - console.info(TAG + "Entering Add video output success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add output with photo output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering Add output with photo output success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeInput(camera0InputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeOutput(previewOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 addInput success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Remove video Output api - * @tc.desc : Remove video Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeOutput(videoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 to operate"); - const Promise = await captureSessionPromise.addInput(camera0InputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 addInput success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 to operate"); - const promise = await captureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 - * @tc.name : Add output with video output api - * @tc.desc : Add output with video output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 to operate"); - const promise = await captureSessionPromise.addOutput(videoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 - * @tc.name : get frame rate range camera0 api - * @tc.desc : get frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 to operate"); - await videoOutputPromise.getFrameRateRange() - .then(function (data) { - console.info(TAG + "Entering get frame rate range SUCCESS "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 PASSED : " + JSON.stringify(data)) - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Grp0,maxFrameRate_Grp0) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Mix,maxFrameRate_Mix) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Err1,maxFrameRate_Err1) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Err2,maxFrameRate_Err2) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Err3,maxFrameRate_Err3) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Grp20,maxFrameRate_Grp20) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 - * @tc.name : getVideoStabilizationModeOff - * @tc.desc : getVideoStabilizationModeOff promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeOff SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 - * @tc.name : getVideoStabilizationModeLow - * @tc.desc : getVideoStabilizationModeLow promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeLow SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 - * @tc.name : getVideoStabilizationModeMIDDLE - * @tc.desc : getVideoStabilizationModeMIDDLE promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeMIDDLE SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 - * @tc.name : getVideoStabilizationModeHigh - * @tc.desc : getVideoStabilizationModeHigh promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeHigh SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 - * @tc.name : getVideoStabilizationModeAuto - * @tc.desc : getVideoStabilizationModeAuto promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeAuto SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Commit config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.commitConfig(); - console.info(TAG + "Entering commitConfig success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 commitConfig PASSED"); - } - else { - expect().assertFail() - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 commitConfig FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 commitConfig ends here"); - } - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview Output callback on frame start previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate"); - previewOutputPromise.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : PreviewOutput callback onframeend async api - * @tc.desc : PreviewOutput callback onframeend async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 previewOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate') - await sleep(1) - previewOutputPromise.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewStop frameEnd Callback is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : VideoOutput callback onframestart async api - * @tc.desc : VideoOutput callback onframestart async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video frameStart Callback videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate') - await sleep(1) - videoOutputPromise.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "Video frameStart Callback is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 is FAILED : " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : VideoOutput callback onframeend async api - * @tc.desc : VideoOutput callback onframeend async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video frameEnd callback videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate') - await sleep(1) - videoOutputPromise.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 is success') - if (data != null || data != undefined) { - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED' + err.message) - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture start photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 to operate"); - photoOutputPromise.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "CaptureStart Callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture end photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 to operate"); - photoOutputPromise.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 FAILED' + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on frame shutter photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 to operate"); - photoOutputPromise.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 with captureId: " + data.captureId); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 - * @tc.name : capture session start api - * @tc.desc : capture session start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering capture session start captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 to operate"); - await captureSessionPromise.start(); - console.info(TAG + "Entering captureSession start success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 to operate"); - await photoOutputPromise.isMirrorSupported() - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 FAILED : " + err.message); - }); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 to operate"); - await photoOutputPromise.setMirror(true) - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 FAILED : " + err.message); - }); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100--------------"); - console.info(TAG + 'hasFlash called.') - var hasFlashPromise = await camera0InputPromise.hasFlash(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 success"); - if (hasFlashPromise != null || hasFlashPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 is: " + JSON.stringify(hasFlashPromise)); - expect(hasFlashPromise).assertEqual(true); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 FAILED : "); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 ends here"); - await sleep(1) - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 to operate"); - var isFMOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMOpenSupported != null || isFMOpenSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + JSON.stringify(isFMOpenSupported)); - expect(isFMOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 to operate"); - var SetFMOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMOpen)) - if (SetFMOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 to operate"); - var GetFMOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 success: " + JSON.stringify(GetFMOpen)); - if (GetFMOpen == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + JSON.stringify(GetFMOpen)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 to operate"); - var isFMAlwaysOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMAlwaysOpenSupported != null || isFMAlwaysOpenSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + isFMAlwaysOpenSupported); - expect(isFMAlwaysOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 to operate"); - var SetFMAlwaysOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMAlwaysOpen)) - if (SetFMAlwaysOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 to operate"); - var GetFMAlwaysOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 success"); - if (GetFMAlwaysOpen == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAlwaysOpen); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 to operate"); - var isFMAutoSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMAutoSupported != null || isFMAutoSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_AUTO data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + isFMAutoSupported); - expect(isFMAutoSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 to operate"); - var SetFMAlwaysAuto = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "SetFMAlwaysAuto: " + JSON.stringify(SetFMAlwaysAuto)) - if (SetFMAlwaysAuto == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 to operate"); - var GetFMAuto = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 success"); - if (GetFMAuto == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAuto); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 to operate"); - var isFMCloseSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMCloseSupported != null || isFMCloseSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + isFMCloseSupported); - expect(isFMCloseSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 to operate"); - var SetFMClose = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMClose)) - if (SetFMClose == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 - * @tc.name : get flash mode close camera0 api - * @tc.desc : get flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 to operate"); - var GetFMClose = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 success"); - if (GetFMClose == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMClose); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - //ZOOM Function - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 - * @tc.name : get zoom ratio camera-0 cameraId api promise api - * @tc.desc : get zoom ratio camera-0 cameraId api promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100--------------"); - var getZoomRatioPromise = await camera0InputPromise.getZoomRatioRange(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 getZoomRatioPromise: " + JSON.stringify(getZoomRatioPromise)); - if (getZoomRatioPromise != null && getZoomRatioPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 setZoomRatioPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 success: " + JSON.stringify(getZoomRatioPromise)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(1); - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - var getpromise1 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise1); - if (getpromise1 != null && getpromise1 != undefined) { - expect(getpromise1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(2); - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - var getpromise2 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise2); - if (getpromise2 != null && getpromise2 != undefined) { - expect(getpromise2).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(3); - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - var getpromise3 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise3); - if (getpromise3 != null && getpromise3 != undefined) { - expect(getpromise3).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(4); - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - var getpromise4 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise4); - if (getpromise4 != null && getpromise4 != undefined) { - expect(getpromise4).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(5); - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - var getpromise5 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise5); - if (getpromise5 != null && getpromise5 != undefined) { - expect(getpromise5).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(6); - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - var getpromise6 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise6); - if (getpromise6 != null && getpromise6 != undefined) { - expect(getpromise6).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - // FOCUS promise API's - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 - * @tc.name : check is focus mode locked supported-camera0Input api - * @tc.desc : check is focus mode locked supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 to operate"); - var isFMLockedSupported = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering is focus mode locked supported SUCCESS "); - if (isFMLockedSupported != null || isFMLockedSupported != undefined) { - console.info(TAG + "Entering is focus mode locked supported data is not null || undefined"); - console.info(TAG + "is focus mode locked supported : " + isFMLockedSupported); - expect(isFMLockedSupported).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED) - .then(function (data) { - console.info(TAG + "SetFMLocked: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode locked SUCCESS, current focusmode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 FAILED : ") - expect().assertFail(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 ends here"); - }); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode locked success: "); - if (data == 0) { - console.info(TAG + "Current focusmode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 ends here"); - }); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 - * @tc.name : get focal length camera0 api - * @tc.desc : get focal length camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 to operate"); - await camera0InputPromise.getFocalLength() - .then(function (data) { - console.info(TAG + "Current focallength is: " + JSON.stringify(data)); - expect(data).assertEqual(3.4600000381469727); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 - * @tc.name : is focusmode manual supported - * @tc.desc : is focusmode manual supported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 to operate"); - var isFMmanualSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL); - if (isFMmanualSupportedpromise != null || isFMmanualSupportedpromise != undefined) { - console.info(TAG + "Entering is focusmode manual supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMmanualSupportedpromise); - expect(isFMmanualSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL) - .then(function (data) { - console.info(TAG + "setFocusManual: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode manual SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode manual SUCCESS"); - if (data == 0) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 ends here"); - }); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 FAILED " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 - * @tc.name : check is focus mode continuous supported-camera0Input api - * @tc.desc : check is focus mode continuous supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 to operate"); - var isFMContinuousSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - if (isFMContinuousSupportedpromise != null || isFMContinuousSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode continuous supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINUOUS_SUPPORTED is: " + isFMContinuousSupportedpromise); - expect(isFMContinuousSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) - .then(function (data) { - console.info(TAG + "setFocusCont: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode continuous SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode continuous SUCCESS"); - if (data == 1) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 - * @tc.name : check is focus mode auto supported-camera0Input api - * @tc.desc : check is focus mode auto supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 to operate"); - var isFMAutoSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (isFMAutoSupportedpromise != null || isFMAutoSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode auto supported data is not null || undefined"); - console.info(TAG + "is focus mode auto supported is: " + isFMAutoSupportedpromise); - expect(isFMAutoSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 to operate"); - var setFocusAuto = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO) - .then(function () { - console.info(TAG + "setFocusAuto: " + JSON.stringify(setFocusAuto)) - console.info(TAG + "Entering set focus mode auto SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 FAILED : "); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 to operate"); - var getfocusmodepromise = await camera0InputPromise.getFocusMode(); - console.info(TAG + "Entering get focus mode auto SUCCESS"); - if (getfocusmodepromise == 2) { - console.info(TAG + "Current FocusMode is: " + getfocusmodepromise); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode locked SUCCESS"); - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 mode locked - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 to operate"); - await camera0InputPromise.setExposurePoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 mode locked - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100_exposure mode locked - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureBiasRange() - .then(function (data) { - console.info(TAG + "Entering getExposureBiasRange SUCCESS"); - console.info(TAG + "Current ExposureBiasRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 mode locked - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 to operate"); - await camera0InputPromise.setExposureBias(-4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 mode locked - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 mode auto - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 to operate"); - await camera0InputPromise.setExposurePoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 FAILED: " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 mode auto - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 mode auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 to operate"); - await camera0InputPromise.setExposureBias(1) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 mode auto - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 to operate"); - await camera0InputPromise.setExposurePoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 mode continuous auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 to operate"); - await camera0InputPromise.setExposureBias(4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 - * @tc.name : VideoOutput start promise api - * @tc.desc : VideoOutput start promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video Output start videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 to operate') - await videoOutputPromise.start() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 - * @tc.name : VideoOutput stop promise api - * @tc.desc : VideoOutput stop promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video Output Stop videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 to operate') - await videoOutputPromise.stop() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 - * @tc.name : CaptureSession stop promise api - * @tc.desc : CaptureSession stop promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + 'Entering Capture Session Stop captureSessionPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 to operate') - await captureSessionPromise.stop() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 - * @tc.name : CaptureSession release promise api - * @tc.desc : CaptureSession release promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + 'Entering Capture session release captureSessionPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 to operate') - await captureSessionPromise.release() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : videoOutput release api - * @tc.desc : videoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + "Entering Video Output release previewOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await videoOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : PreviewOutput release api - * @tc.desc : PreviewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering previewOutputPromise.release previewOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await previewOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : cameraInput release api - * @tc.desc : cameraInput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering camera0InputPromise.release camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await camera0InputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1) - done() - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraUnspc/src/main/resources/base/element/string.json b/multimedia/camera/cameraUnspc/src/main/resources/base/element/string.json deleted file mode 100644 index b93f540e29265a34f883a977c442fa85349b94ca..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraUnspc/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "description_mainability", - "value": "eTS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngle/BUILD.gn b/multimedia/camera/cameraWideAngle/BUILD.gn deleted file mode 100644 index 15ec49356991b3b655d39e69da61e9470f029b14..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngle/BUILD.gn +++ /dev/null @@ -1,34 +0,0 @@ -# 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("camera_wideangle_ets_hap") { - hap_profile = "./src/main/config.json" - deps = [ - ":camera_ets_assets", - ":camera_ets_resources", - ] - ets2abc = true - - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsCameraWideAngleETSTest" - subsystem_name = "multimedia" - part_name = "multimedia_camera_standard" -} -ohos_js_assets("camera_ets_assets") { - source_dir = "./src/main/ets/MainAbility" -} -ohos_resources("camera_ets_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/multimedia/camera/cameraWideAngle/Test.json b/multimedia/camera/cameraWideAngle/Test.json deleted file mode 100644 index 558fadf916a24046da66427c70353ab2cc627bf0..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngle/Test.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "description": "Configuration for camerastandard WideAngle Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "1000000", - "package": "com.open.harmony.multimedia.camerawatest", - "shell-timeout": "60000" - }, - "kits": [ - { - "type": "ShellKit", - "run-command": [ - "touch /data/media/01.mp4", - "chmod -R 777 /data/media" - - ], - "teardown-command":[ - - ] - }, - { - "test-file-name": [ - "ActsCameraWideAngleETSTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngle/signature/openharmony_sx.p7b b/multimedia/camera/cameraWideAngle/signature/openharmony_sx.p7b deleted file mode 100644 index 0625db92101ca16c7becfaf2d4008ea2e96078e1..0000000000000000000000000000000000000000 Binary files a/multimedia/camera/cameraWideAngle/signature/openharmony_sx.p7b and /dev/null differ diff --git a/multimedia/camera/cameraWideAngle/src/main/config.json b/multimedia/camera/cameraWideAngle/src/main/config.json deleted file mode 100644 index 39ed1a3a5491a553103e5a38b067daea85f3d1c8..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngle/src/main/config.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "app": { - "bundleName": "com.open.harmony.multimedia.camerawatest", - "vendor": "open", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.open.harmony.multimedia.camerawatest", - "name": ".MyApplication", - "mainAbility": "com.open.harmony.multimedia.camerawatest.MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "formsEnabled": false, - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "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.CAMERA", - "reason": "use ohos.permission.CAMERA" - }, - { - "name": "ohos.permission.MICROPHONE", - "reason": "use ohos.permission.MICROPHONE" - }, - { - "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" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/app.ets b/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/app.ets deleted file mode 100644 index a9f8218978fad817d4519aa1b715da0e3f8ebbfc..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('Application onCreate') - }, - onDestroy() { - console.info('Application onDestroy') - }, -} diff --git a/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/pages/index.ets b/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index ca96b03e80e49976adf3f876fadb4d82d574c6ef..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,74 +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 {Core, ExpectExtend} from "deccjsunit/index" -import cameraKit from "../test/Camera.test" -import featureAbility from "@ohos.ability.featureAbility" - -let TAG = 'CameraModuleTest: ' -var mXComponentController: XComponentController = new XComponentController() -var surfaceId: any - -@Entry -@Component -struct CameraIndex { - @State isShowSettings: boolean = false - @State previewSize: string = '75%' - - aboutToAppear() { - console.info('--------------aboutToAppear--------------') - } - - build() { - Flex() { - XComponent({ - id: '', - type: 'surface', - libraryname: '', - controller: mXComponentController - }) - .onLoad(() => { - console.info('CameraModuleTest: OnLoad() is called!') - mXComponentController.setXComponentSurfaceSize({ surfaceWidth: 1920, surfaceHeight: 1080 }); - surfaceId = mXComponentController.getXComponentSurfaceId() - console.info('CameraModuleTest: XComponent onLoad surfaceId: ' + surfaceId) - featureAbility.getWant() - .then((Want) => { - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - console.info(TAG + 'Entering expectExtend') - core.addService('expect', expectExtend) - console.info(TAG + 'Entering addService') - core.init() - console.info(TAG + 'Entering core.init()') - console.info(TAG + 'Entering subscribeEvent') - const configService = core.getDefaultService('config') - configService.setConfig(Want.parameters) - console.info(TAG + 'Entering configService') - cameraKit(surfaceId) - core.execute() - console.info(TAG + 'Operation successful. Data: ' + JSON.stringify(Want)); - }) - .catch((error) => { - console.error(TAG + 'Operation failed. Cause: ' + JSON.stringify(error)); - }) - }) - .width('1920px') - .height('1080px') - } - } -} diff --git a/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/Camera.test.ets b/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/Camera.test.ets deleted file mode 100644 index 2743a3a6f94f359e98785fa0a21bf1518e7a9859..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/Camera.test.ets +++ /dev/null @@ -1,35 +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 cameraJSUnitEnum from './CameraJSUnitEnum.test.ets' -import cameraJSUnitCameraFormat from './CameraJSUnitCameraFormat.test.ets' -import cameraJSUnitPhotoAsync from './CameraJSUnitPhotoAsync.test.ets' -import cameraJSUnitPhotoPromise from './CameraJSUnitPhotoPromise.test.ets' -import cameraJSUnitVideoAsync from './CameraJSUnitVideoAsync.test.ets' -import cameraJSUnitVideoPromise from './CameraJSUnitVideoPromise.test.ets' - -let TAG = 'CameraModuleTest: ' - -export default function cameraKit(surfaceId: any) { - console.info(TAG + 'Entering cameraKit') - console.info(TAG + 'surfaceId: ' + surfaceId) - - cameraJSUnitEnum(surfaceId) - cameraJSUnitCameraFormat(surfaceId) - cameraJSUnitPhotoAsync(surfaceId) - cameraJSUnitPhotoPromise(surfaceId) - cameraJSUnitVideoAsync(surfaceId) - cameraJSUnitVideoPromise(surfaceId) -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets b/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets deleted file mode 100644 index 92d853350bf5e5587f20cd0d6a2c755309601aea..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets +++ /dev/null @@ -1,2778 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables - -var cameraManager; -var surfaceId1; -var camerasArray; - -// CAMERA-0 Variables -var camera0Input, camera0InputPosBack, camera0InputPosFront; -var camera0InputPromise, camera0InputPromisePosBack, camera0InputPromisePosFront; -// CAMERA-1 Variables -var camera1Input, camera1InputPosBack, camera1InputPosFront; -var camera1InputPromise, camera1InputPromisePosBack, camera1InputPromisePosFront; -// CAMERA-2 Variables -var camera2Input, camera2InputPosBack, camera2InputPosFront; -var camera2InputPromise, camera2InputPromisePosBack, camera2InputPromisePosFront; -// CAMERA-3 Variables -var camera3Input, camera3InputPosBack, camera3InputPosFront; -var camera3InputPromise, camera3InputPromisePosBack, camera3InputPromisePosFront; - -export default function cameraJSUnitCameraFormat(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJsUnitCameraFormat', function () { - console.info(TAG + '----------CameraJsUnitCameraFormat--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 data is not null || undefined"); - cameraManager = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------"); - var cameraManagerPromise = await cameraObj.getCameraManager(null); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 cameraManagerPromise: " + JSON.stringify(cameraManagerPromise)); - if (cameraManagerPromise != null && cameraManagerPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Get camera from cameramanager to get array of camera async api - * @tc.desc : Get camera from cameramanager to get array of camera async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------"); - cameraManager.getCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 data is not null || undefined"); - camerasArray = data; - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArray[i].cameraPosition; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArray[i].cameraType; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Type: " + cameraType); - var connectionType = camerasArray[i].connectionType - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 - * @tc.name : Get camera from cameramanager to get array of camera promise api - * @tc.desc : Get camera from cameramanager to get array of camera promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100--------------"); - var camerasArrayPromise = await cameraManager.getCameras(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100: " + JSON.stringify(camerasArrayPromise)); - if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 success"); - for (var i = 0; i < camerasArrayPromise.length; i++) { - // Get the variables from camera object - var cameraId = camerasArrayPromise[i].cameraId; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArrayPromise[i].cameraPosition; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArrayPromise[i].cameraType; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 camera" + i + "Type: " + cameraType); - var connectionType = camerasArrayPromise[i].connectionType - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-0 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera0Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[0].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraId promise api - * @tc.desc : Create camerainput from camera-0 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera0InputPromise = await cameraManager.createCameraInput(camerasArray[0].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera0InputPromise: " + JSON.stringify(camera0InputPromise)); - if (camera0InputPromise != null && camera0InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera0InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 - * @tc.name : get camera if from camera-0 input async api - * @tc.desc : get camera if from camera-0 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100', 0, async function (done) { - camera0Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 data is not null || undefined"); - var CameraId0 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 PASSED with CameraID :" + CameraId0); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 - * @tc.name : get camera if from camera-0 input promise api - * @tc.desc : get camera if from camera-0 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100', 0, async function (done) { - var camera0IdPromise = await camera0InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 camera0IdPromise: " + JSON.stringify(camera0IdPromise)); - if (camera0IdPromise != null && camera0IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 camera0IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 PASSED" + camera0IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput async api - * @tc.desc : Get supported preview formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera0InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null && data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromise = await camera0InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromise)); - if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam0FormatPromise: " + cam0FormatPromise[i]); - expect(cam0FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-0 camerainput async api - * @tc.desc : Get supported video formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 success"); - if (data != null && data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 - * @tc.name : Get supported video formats from camera-0 camerainput promise api - * @tc.desc : Get supported video formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromise = await camera0InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromise)); - if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 cam0FormatPromise: " + cam0FormatPromise[i]); - expect(cam0FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-0 camerainput async api - * @tc.desc : Get supported photo format from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-0 camerainput promise api - * @tc.desc : Get supported photo format from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromise = await camera0InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromise)); - if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam0FormatPromise: " + cam0FormatPromise[i]); - expect(cam0FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput async api - * @tc.desc : Get supported preview formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosBack = await camera0InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosBack)); - if (cam0FormatPromisePosBack != null && cam0FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam0FormatPromisePosBack: " + cam0FormatPromisePosBack[i]); - expect(cam0FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-0 camerainput async api - * @tc.desc : Get supported photo format from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-0 camerainput promise api - * @tc.desc : Get supported photo format from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosBack = await camera0InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosBack)); - if (cam0FormatPromisePosBack != null && cam0FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam0FormatPromisePosBack: " + cam0FormatPromisePosBack[i]); - expect(cam0FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput async api - * @tc.desc : Get supported preview formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosFront = await camera0InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosFront)); - if (cam0FormatPromisePosFront != null && cam0FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam0FormatPromisePosFront: " + cam0FormatPromisePosFront[i]); - expect(cam0FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-0 camerainput async api - * @tc.desc : Get supported photo format from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-0 camerainput promise api - * @tc.desc : Get supported photo format from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosFront = await camera0InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosFront)); - if (cam0FormatPromisePosFront != null && cam0FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam0FormatPromisePosFront: " + cam0FormatPromisePosFront[i]); - expect(cam0FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0InputPromise.on("focusStateChange", async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CAMERA-1 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-1 cameraId async api - * @tc.desc : Create camerainput from camera-1 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-1 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[1].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera1Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[1].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-1 cameraId promise api - * @tc.desc : Create camerainput from camera-1 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera1InputPromise = await cameraManager.createCameraInput(camerasArray[1].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera1InputPromise: " + JSON.stringify(camera1InputPromise)); - if (camera1InputPromise != null && camera1InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera1InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 - * @tc.name : get camera ID from camera-1 input async api - * @tc.desc : get camera ID from camera-1 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100', 0, async function (done) { - camera1Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 data is not null || undefined"); - var CameraId1 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 PASSED with CameraID : " + CameraId1); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 - * @tc.name : get camera ID from camera-1 input promise api - * @tc.desc : get camera ID from camera-1 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100', 0, async function (done) { - var camera1IdPromise = await camera1InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 camera1IdPromise: " + JSON.stringify(camera1IdPromise)); - if (camera1IdPromise != null && camera1IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 camera1IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 PASSED" + camera1IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT1_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 - * @tc.name : Create camerainput from camera-1 cameraposition & cameratype async api - * @tc.desc : Create camerainput from camera-1 cameraposition & cameratype async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[1].cameraPosition, camerasArray[1].cameraType, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 - * @tc.name : Create camerainput from camera-1 cameraposition & cameratype promise api - * @tc.desc : Create camerainput from camera-1 cameraposition & cameratype promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100--------------"); - var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[1].cameraPosition, camerasArray[1].cameraType); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); - if (cameraInputPromise != null && cameraInputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput async api - * @tc.desc : Get supported preview formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera1InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput promise api - * @tc.desc : Get supported preview formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromise = await camera1InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromise)); - if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam1FormatPromise: " + cam1FormatPromise[i]); - expect(cam1FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-1 camerainput async api - * @tc.desc : Get supported video formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100--------------"); - camera1InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 - * @tc.name : Get supported video formats from camera-1 camerainput promise api - * @tc.desc : Get supported video formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100--------------"); - var cam1FormatPromise = await camera1InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100: " + JSON.stringify(cam1FormatPromise)); - if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 cam1FormatPromise: " + cam1FormatPromise[i]); - expect(cam1FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-1 camerainput async api - * @tc.desc : Get supported photo format from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera1InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-1 camerainput promise api - * @tc.desc : Get supported photo format from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromise = await camera1InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromise)); - if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam1FormatPromise: " + cam1FormatPromise[i]); - expect(cam1FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput async api - * @tc.desc : Get supported preview formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput promise api - * @tc.desc : Get supported preview formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosBack = await camera1InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosBack)); - if (cam1FormatPromisePosBack != null && cam1FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam1FormatPromisePosBack: " + cam1FormatPromisePosBack[i]); - expect(cam1FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-1 camerainput async api - * @tc.desc : Get supported photo format from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-1 camerainput promise api - * @tc.desc : Get supported photo format from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosBack = await camera1InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosBack)); - if (cam1FormatPromisePosBack != null && cam1FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam1FormatPromisePosBack: " + cam1FormatPromisePosBack[i]); - expect(cam1FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput async api - * @tc.desc : Get supported preview formats from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-1 camerainput promise api - * @tc.desc : Get supported preview formats from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosFront = await camera1InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosFront)); - if (cam1FormatPromisePosFront != null && cam1FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam1FormatPromisePosFront: " + cam1FormatPromisePosFront[i]); - expect(cam1FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-1 camerainput async api - * @tc.desc : Get supported photo format from camera-1 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera1InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-1 camerainput promise api - * @tc.desc : Get supported photo format from camera-1 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam1FormatPromisePosFront = await camera1InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam1FormatPromisePosFront)); - if (cam1FormatPromisePosFront != null && cam1FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam1FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam1FormatPromisePosFront: " + cam1FormatPromisePosFront[i]); - expect(cam1FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-2 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-2 cameraId async api - * @tc.desc : Create camerainput from camera-2 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-2 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[2].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera2Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[2].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-2 cameraId promise api - * @tc.desc : Create camerainput from camera-2 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera2InputPromise = await cameraManager.createCameraInput(camerasArray[2].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera2InputPromise: " + JSON.stringify(camera2InputPromise)); - if (camera2InputPromise != null && camera2InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera2InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 - * @tc.name : get camera ID from camera-2 input async api - * @tc.desc : get camera ID from camera-2 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100', 0, async function (done) { - camera2Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 data is not null || undefined"); - var CameraId2 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 PASSED with CameraID : " + CameraId2); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 - * @tc.name : get camera ID from camera-2 input promise api - * @tc.desc : get camera ID from camera-2 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100', 0, async function (done) { - var camera2IdPromise = await camera2InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 camera2IdPromise: " + JSON.stringify(camera2IdPromise)); - if (camera2IdPromise != null && camera2IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 camera2IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 PASSED" + camera2IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT2_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 - * @tc.name : Create camerainput from camera-2 cameraposition & cameratype async api - * @tc.desc : Create camerainput from camera-2 cameraposition & cameratype async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[2].cameraPosition, camerasArray[2].cameraType, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 - * @tc.name : Create camerainput from camera-2 cameraposition & cameratype promise api - * @tc.desc : Create camerainput from camera-2 cameraposition & cameratype promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100--------------"); - var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[2].cameraPosition, camerasArray[2].cameraType); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); - if (cameraInputPromise != null && cameraInputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput async api - * @tc.desc : Get supported preview formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera2InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput promise api - * @tc.desc : Get supported preview formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromise = await camera2InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromise)); - if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam2FormatPromise: " + cam2FormatPromise[i]); - expect(cam2FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-2 camerainput async api - * @tc.desc : Get supported video formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100--------------"); - camera2InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 - * @tc.name : Get supported video formats from camera-2 camerainput promise api - * @tc.desc : Get supported video formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100--------------"); - var cam2FormatPromise = await camera2InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100: " + JSON.stringify(cam2FormatPromise)); - if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 cam2FormatPromise: " + cam2FormatPromise[i]); - expect(cam2FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-2 camerainput async api - * @tc.desc : Get supported photo format from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera2InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-2 camerainput promise api - * @tc.desc : Get supported photo format from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromise = await camera2InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromise)); - if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam2FormatPromise: " + cam2FormatPromise[i]); - expect(cam2FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput async api - * @tc.desc : Get supported preview formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput promise api - * @tc.desc : Get supported preview formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosBack = await camera2InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosBack)); - if (cam2FormatPromisePosBack != null && cam2FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam2FormatPromisePosBack: " + cam2FormatPromisePosBack[i]); - expect(cam2FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-2 camerainput async api - * @tc.desc : Get supported photo format from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-2 camerainput promise api - * @tc.desc : Get supported photo format from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosBack = await camera2InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosBack)); - if (cam2FormatPromisePosBack != null && cam2FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam2FormatPromisePosBack: " + cam2FormatPromisePosBack[i]); - expect(cam2FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput async api - * @tc.desc : Get supported preview formats from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-2 camerainput promise api - * @tc.desc : Get supported preview formats from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosFront = await camera2InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosFront)); - if (cam2FormatPromisePosFront != null && cam2FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam2FormatPromisePosFront: " + cam2FormatPromisePosFront[i]); - expect(cam2FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-2 camerainput async api - * @tc.desc : Get supported photo format from camera-2 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera2InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-2 camerainput promise api - * @tc.desc : Get supported photo format from camera-2 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam2FormatPromisePosFront = await camera2InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam2FormatPromisePosFront)); - if (cam2FormatPromisePosFront != null && cam2FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam2FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam2FormatPromisePosFront: " + cam2FormatPromisePosFront[i]); - expect(cam2FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-3 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-3 cameraId async api - * @tc.desc : Create camerainput from camera-3 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-3 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[3].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera3Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[3].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-3 cameraId promise api - * @tc.desc : Create camerainput from camera-3 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera3InputPromise = await cameraManager.createCameraInput(camerasArray[3].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera3InputPromise: " + JSON.stringify(camera3InputPromise)); - if (camera3InputPromise != null && camera3InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera3InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 - * @tc.name : get camera ID from camera-3 input async api - * @tc.desc : get camera ID from camera-3 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100', 0, async function (done) { - camera3Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 data is not null || undefined"); - var CameraId3 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 PASSED with CameraID : " + CameraId3); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 - * @tc.name : get camera ID from camera-3 input promise api - * @tc.desc : get camera ID from camera-3 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100', 0, async function (done) { - var camera3IdPromise = await camera3InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 camera3IdPromise: " + JSON.stringify(camera3IdPromise)); - if (camera3IdPromise != null && camera3IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 camera3IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 PASSED" + camera3IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CAMINPUT3_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 - * @tc.name : Create camerainput from camera-3 cameraposition & cameratype async api - * @tc.desc : Create camerainput from camera-3 cameraposition & cameratype async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[3].cameraPosition, camerasArray[3].cameraType, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 - * @tc.name : Create camerainput from camera-3 cameraposition & cameratype promise api - * @tc.desc : Create camerainput from camera-3 cameraposition & cameratype promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100--------------"); - var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[3].cameraPosition, camerasArray[3].cameraType); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); - if (cameraInputPromise != null && cameraInputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 cameraInputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput async api - * @tc.desc : Get supported preview formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera3InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput promise api - * @tc.desc : Get supported preview formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromise = await camera3InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromise)); - if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam3FormatPromise: " + cam3FormatPromise[i]); - expect(cam3FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-3 camerainput async api - * @tc.desc : Get supported video formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100--------------"); - camera3InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 - * @tc.name : Get supported video formats from camera-3 camerainput promise api - * @tc.desc : Get supported video formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100--------------"); - var cam3FormatPromise = await camera3InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100: " + JSON.stringify(cam3FormatPromise)); - if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 cam3FormatPromise: " + cam3FormatPromise[i]); - expect(cam3FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-3 camerainput async api - * @tc.desc : Get supported photo format from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera3InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-3 camerainput promise api - * @tc.desc : Get supported photo format from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromise = await camera3InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromise)); - if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam3FormatPromise: " + cam3FormatPromise[i]); - expect(cam3FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput async api - * @tc.desc : Get supported preview formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput promise api - * @tc.desc : Get supported preview formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosBack = await camera3InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosBack)); - if (cam3FormatPromisePosBack != null && cam3FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam3FormatPromisePosBack: " + cam3FormatPromisePosBack[i]); - expect(cam3FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-3 camerainput async api - * @tc.desc : Get supported photo format from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-3 camerainput promise api - * @tc.desc : Get supported photo format from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosBack = await camera3InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosBack)); - if (cam3FormatPromisePosBack != null && cam3FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam3FormatPromisePosBack: " + cam3FormatPromisePosBack[i]); - expect(cam3FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput async api - * @tc.desc : Get supported preview formats from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-3 camerainput promise api - * @tc.desc : Get supported preview formats from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosFront = await camera3InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosFront)); - if (cam3FormatPromisePosFront != null && cam3FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam3FormatPromisePosFront: " + cam3FormatPromisePosFront[i]); - expect(cam3FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-3 camerainput async api - * @tc.desc : Get supported photo format from camera-3 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera3InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-3 camerainput promise api - * @tc.desc : Get supported photo format from camera-3 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam3FormatPromisePosFront = await camera3InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam3FormatPromisePosFront)); - if (cam3FormatPromisePosFront != null && cam3FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam3FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam3FormatPromisePosFront: " + cam3FormatPromisePosFront[i]); - expect(cam3FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE WIDE ANGLE*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition unspecified & cameratype wide angle async api - * @tc.desc : Create camerainput from cameraposition unspecified & cameratype wide angle async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition unspecified & cameratype wide angle promise api - * @tc.desc : Create camerainput from cameraposition unspecified & cameratype wide angle promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE) - .then(function () { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_0100 FAILED"); - expect().assertFail(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_0100 PASSED : " + err.message); - expect(true).assertTrue(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE WIDE ANGLE*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition back & cameratype wide angle async api - * @tc.desc : Create camerainput from cameraposition back & cameratype wide angle async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_CALLBACK_0100 FAILED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_0100 - * @tc.name : Create camerainput from cameraposition back & cameratype wide angle promise api - * @tc.desc : Create camerainput from cameraposition back & cameratype wide angle promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE WIDE ANGLE*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition front & cameratype wide angle async api - * @tc.desc : Create camerainput from cameraposition front & cameratype wide angle async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100 FAILED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition front & cameratype wide angle promise api - * @tc.desc : Create camerainput from cameraposition front & cameratype wide angle promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_CALLBACK_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_CALLBACK_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_CALLBACK_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets b/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets deleted file mode 100644 index 54de11efdc95e7ad97d972b4081928b1e224b8ef..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets +++ /dev/null @@ -1,508 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables - -var cameraManager; -var surfaceId1; -var camerasArray; - -// CAMERA-0 Variables -var camera0Input, camera0InputPosBack, camera0InputPosFront; -var camera0InputPromise, camera0InputPromisePosBack, camera0InputPromisePosFront; -// CAMERA-1 Variables -var camera1Input, camera1InputPosBack, camera1InputPosFront; -var camera1InputPromise, camera1InputPromisePosBack, camera1InputPromisePosFront; -// CAMERA-2 Variables -var camera2Input, camera2InputPosBack, camera2InputPosFront; -var camera2InputPromise, camera2InputPromisePosBack, camera2InputPromisePosFront; -// CAMERA-3 Variables -var camera3Input, camera3InputPosBack, camera3InputPosFront; -var camera3InputPromise, camera3InputPromisePosBack, camera3InputPromisePosFront; - -export default function cameraJSUnitEnum(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJSUnitEnum', function () { - console.info(TAG + '----------CameraJSUnitEnum--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 data is not null || undefined"); - cameraManager = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Get camera from cameramanager to get array of camera async api - * @tc.desc : Get camera from cameramanager to get array of camera async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------"); - cameraManager.getCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 data is not null || undefined"); - camerasArray = data; - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArray[i].cameraPosition; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArray[i].cameraType; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Type: " + cameraType); - var connectionType = camerasArray[i].connectionType - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100', 0, async function (done) { - console.info("--------------CAMERA-0 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100--------------"); - cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 data is not null || undefined"); - camera0Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 PASSED with CameraID :" + camerasArray[0].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_0100 - * @tc.name : camera status ENAME - * @tc.desc : camera status ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_0100------------"); - console.info(TAG + "CameraStatus CAMERA_STATUS_APPEAR : " + cameraObj.CameraStatus.CAMERA_STATUS_APPEAR); - expect(cameraObj.CameraStatus.CAMERA_STATUS_APPEAR).assertEqual(0); - console.info(TAG + "CameraStatus CAMERA_STATUS_DISAPPEAR : " + cameraObj.CameraStatus.CAMERA_STATUS_DISAPPEAR); - expect(cameraObj.CameraStatus.CAMERA_STATUS_DISAPPEAR).assertEqual(1); - console.info(TAG + "CameraStatus CAMERA_STATUS_AVAILABLE : " + cameraObj.CameraStatus.CAMERA_STATUS_AVAILABLE) - expect(cameraObj.CameraStatus.CAMERA_STATUS_AVAILABLE).assertEqual(2); - console.info(TAG + "CameraStatus CAMERA_STATUS_UNAVAILABLE : " + cameraObj.CameraStatus.CAMERA_STATUS_UNAVAILABLE) - expect(cameraObj.CameraStatus.CAMERA_STATUS_UNAVAILABLE).assertEqual(3); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_POSITION_0100 - * @tc.name : Camera position ENAME - * @tc.desc : Camera position ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_POSITION_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CAMERA_POSITION_0100------------") - console.info(TAG + "CameraPosition CAMERA_POSITION_BACK : " + cameraObj.CameraPosition.CAMERA_POSITION_BACK); - expect(cameraObj.CameraPosition.CAMERA_POSITION_BACK).assertEqual(1); - console.info(TAG + "CameraPosition CAMERA_POSITION_FRONT : " + cameraObj.CameraPosition.CAMERA_POSITION_FRONT); - expect(cameraObj.CameraPosition.CAMERA_POSITION_FRONT).assertEqual(2); - console.info(TAG + "CameraPosition CAMERA_POSITION_UNSPECIFIED : " + cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED); - expect(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED).assertEqual(0); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_TYPE_0100 - * @tc.name : camera type ENAME - * @tc.desc : camera type ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_TYPE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CAMERA_TYPE_0100------------") - console.info(TAG + "CameraType CAMERA_TYPE_UNSPECIFIED : " + cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); - expect(cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED).assertEqual(0); - console.info(TAG + "CameraType CAMERA_TYPE_WIDE_ANGLE : " + cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE); - expect(cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE).assertEqual(1); - console.info(TAG + 'CameraType CAMERA_TYPE_ULTRA_WIDE : ' + cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE); - expect(cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE).assertEqual(2); - console.info(TAG + 'CameraType CAMERA_TYPE_TELEPHOTO : ' + cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO); - expect(cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO).assertEqual(3); - console.info(TAG + 'CameraType CAMERA_TYPE_TRUE_DEPTH : ' + cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH) - expect(cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH).assertEqual(4); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CONNECTION_TYPE_0100 - * @tc.name : connection type ENAME - * @tc.desc : connection type ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CONNECTION_TYPE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CONNECTION_TYPE_0100------------") - console.info(TAG + "ConnectionType CAMERA_CONNECTION_BUILT_IN : " + cameraObj.ConnectionType.CAMERA_CONNECTION_BUILT_IN); - expect(cameraObj.ConnectionType.CAMERA_CONNECTION_BUILT_IN).assertEqual(0); - console.info(TAG + "ConnectionType CAMERA_CONNECTION_USB_PLUGIN : " + cameraObj.ConnectionType.CAMERA_CONNECTION_USB_PLUGIN); - expect(cameraObj.ConnectionType.CAMERA_CONNECTION_USB_PLUGIN).assertEqual(1); - console.info(TAG + "ConnectionType CAMERA_CONNECTION_REMOTE : " + cameraObj.ConnectionType.CAMERA_CONNECTION_REMOTE); - expect(cameraObj.ConnectionType.CAMERA_CONNECTION_REMOTE).assertEqual(2); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FLASHMODE_0100 - * @tc.name : Flash Mode ENAME - * @tc.desc : Flash Mode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FLASHMODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_FLASHMODE_0100------------") - console.info(TAG + "FlashMode FLASH_MODE_CLOSE : " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); - console.info(TAG + "FlashMode FLASH_MODE_OPEN : " + cameraObj.FlashMode.FLASH_MODE_OPEN); - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - console.info(TAG + "FlashMode FLASH_MODE_AUTO : " + cameraObj.FlashMode.FLASH_MODE_AUTO); - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); - console.info(TAG + "FlashMode FLASH_MODE_ALWAYS_OPEN : " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSMODE_0100 - * @tc.name : Focus Mode ENAME - * @tc.desc : Focus Mode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSMODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_FOCUSMODE_0100------------") - console.info(TAG + "FocusMode FOCUS_MODE_MANUAL : " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0); - console.info(TAG + "FocusMode FOCUS_MODE_CONTINUOUS_AUTO : " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); - console.info(TAG + "FocusMode FOCUS_MODE_AUTO : " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); - console.info(TAG + "FocusMode FOCUS_MODE_LOCKED : " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - expect(cameraObj.FocusMode.FOCUS_MODE_LOCKED).assertEqual(3); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATE_0100 - * @tc.name : Focus State ENAME - * @tc.desc : Focus State ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_FOCUSSTATE_0100------------") - console.info(TAG + "FocusState FOCUS_STATE_SCAN : " + cameraObj.FocusState.FOCUS_STATE_SCAN); - expect(cameraObj.FocusState.FOCUS_STATE_SCAN).assertEqual(0); - console.info(TAG + "FocusState FOCUS_STATE_FOCUSED : " + cameraObj.FocusState.FOCUS_STATE_FOCUSED); - expect(cameraObj.FocusState.FOCUS_STATE_FOCUSED).assertEqual(1); - console.info(TAG + "FocusState FOCUS_STATE_UNFOCUSED : " + cameraObj.FocusState.FOCUS_STATE_UNFOCUSED); - expect(cameraObj.FocusState.FOCUS_STATE_UNFOCUSED).assertEqual(2); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IMAGEROTATION_0100 - * @tc.name : Image Rotation ENAME - * @tc.desc : Image Rotation ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IMAGEROTATION_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_IMAGEROTATION_0100------------") - console.info(TAG + "ImageRotation ROTATION_0 : " + cameraObj.ImageRotation.ROTATION_0); - expect(cameraObj.ImageRotation.ROTATION_0).assertEqual(0); - console.info(TAG + "ImageRotation ROTATION_90 : " + cameraObj.ImageRotation.ROTATION_90); - expect(cameraObj.ImageRotation.ROTATION_90).assertEqual(90); - console.info(TAG + "ImageRotation ROTATION_180 : " + cameraObj.ImageRotation.ROTATION_180); - expect(cameraObj.ImageRotation.ROTATION_180).assertEqual(180); - console.info(TAG + "ImageRotation ROTATION_270 : " + cameraObj.ImageRotation.ROTATION_270); - expect(cameraObj.ImageRotation.ROTATION_270).assertEqual(270); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_QUALITYLEVEL_0100 - * @tc.name : Quality Level ENAME - * @tc.desc : Quality Level ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_QUALITYLEVEL_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_QUALITYLEVEL_0100------------") - console.info(TAG + "QualityLevel QUALITY_LEVEL_HIGH : " + cameraObj.QualityLevel.QUALITY_LEVEL_HIGH); - expect(cameraObj.QualityLevel.QUALITY_LEVEL_HIGH).assertEqual(0); - console.info(TAG + "QualityLevel QUALITY_LEVEL_MEDIUM : " + cameraObj.QualityLevel.QUALITY_LEVEL_MEDIUM); - expect(cameraObj.QualityLevel.QUALITY_LEVEL_MEDIUM).assertEqual(1); - console.info(TAG + "QualityLevel QUALITY_LEVEL_LOW : " + cameraObj.QualityLevel.QUALITY_LEVEL_LOW); - expect(cameraObj.QualityLevel.QUALITY_LEVEL_LOW).assertEqual(2); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100 - * @tc.name : CameraInputErrorCode ENAME - * @tc.desc : CameraInputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100 : " + cameraObj.CameraInputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.CameraInputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100 - * @tc.name : CaptureSessionErrorCode ENAME - * @tc.desc : CaptureSessionErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100 : " + cameraObj.CaptureSessionErrorCode.ERROR_UNKNOWN); - expect(cameraObj.CaptureSessionErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100 - * @tc.name : PreviewOutputErrorCode ENAME - * @tc.desc : PreviewOutputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100 : " + cameraObj.PreviewOutputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.PreviewOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100 - * @tc.name : PhotoOutputErrorCode ENAME - * @tc.desc : PhotoOutputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100 : " + cameraObj.PhotoOutputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.PhotoOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100 - * @tc.name : VideoOutputErrorCode ENAME - * @tc.desc : VideoOutputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100 : " + cameraObj.VideoOutputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.VideoOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets b/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets deleted file mode 100644 index 3b990e106f896ed54704bdb813583aa6c359e1fb..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets +++ /dev/null @@ -1,3606 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables -var camera0Input; -var camera1Input; -var cameraManager; -var previewOutputAsync; -var photoOutputAsync; -var captureSession; -var surfaceId1; -var camerasArray; - -var Point1 = { x: 1, y: 1 } -var Point2 = { x: 2, y: 2 } -var Point3 = { x: 3, y: 3 } - -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -export default function cameraJSUnitPhotoAsync(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJsUnitPhotoAsync', function () { - console.info(TAG + '----------CameraJsUnitPhotoAsync--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - console.info(TAG + "----------Camera-Precision Control-Async-------------"); - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Camera Manager success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering Camera Manager data is not null || undefined"); - cameraManager = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManager == null || cameraManager == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManager == null || undefined") - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate") - cameraManager.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManager is success"); - if (data != null || data != undefined) { - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Get camera from cameramanager to get array of camera async api - * @tc.desc : Get camera from cameramanager to get array of camera async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------"); - cameraManager.getCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering GetCameras success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering GetCameras data is not null || undefined"); - camerasArray = data; - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId; - console.info(TAG + "Entering GetCameras camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArray[i].cameraPosition; - console.info(TAG + "Entering GetCameras camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArray[i].cameraType; - console.info(TAG + "Entering GetCameras camera" + i + "Type: " + cameraType); - var connectionType = camerasArray[i].connectionType - console.info(TAG + "Entering GetCameras connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera0Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[0].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 - * @tc.name : Create camerainput from camera-1 cameraId async api - * @tc.desc : Create camerainput from camera-1 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200', 0, async function (done) { - cameraManager.createCameraInput(camerasArray[1].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 data is not null || undefined"); - camera1Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 PASSED with CameraID :" + camerasArray[1].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0200 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering CameraInputCallbackOnError cameraInput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 to operate"); - camera0Input.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "cameraInput error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - } - await sleep(1000); - done(); - }) - - /*PreviewOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 - * @tc.name : Create PreviewOutput instance api - * @tc.desc : Create PreviewOutput instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100', 0, async function (done) { - console.info(TAG + " Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 to operate"); - cameraObj.createPreviewOutput(surfaceId, async (err, data) => { - if (!err) { - console.info(TAG + " Entering createPreviewOutput success"); - if (data != null || data != undefined) { - console.info(TAG + " Entering createPreviewOutput data is not null || undefined"); - previewOutputAsync = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 PASSED" + previewOutputAsync); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 FAILED : " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 - * @tc.name : Preview output callback on error api - * @tc.desc : Preview output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering PreviewOutputError callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 to operate"); - previewOutputAsync.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 - * @tc.name : Create PhotoOutput instance api - * @tc.desc : Create PhotoOutput instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1000) - cameraObj.createPhotoOutput(surfaceId1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering createPhotoOutput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering createPhotoOutput data is not null || undefined"); - photoOutputAsync = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 to operate"); - photoOutputAsync.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error during PhotoOutput with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 - * @tc.name : Create CaptureSession instance api - * @tc.desc : Create CaptureSession instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 to operate"); - cameraObj.createCaptureSession(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering createCaptureSession success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering createCaptureSession data is not null || undefined"); - captureSession = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - //Capturesession callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 - * @tc.name : CaptureSession callback on error api - * @tc.desc : CaptureSession callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering captureSession error callback captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 to operate"); - captureSession.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 - * @tc.name : CaptureSession_Begin config api - * @tc.desc : CaptureSession_Begin config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering BeginConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 to operate"); - captureSession.beginConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering beginConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering BeginConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 beginConfig PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 - * @tc.name : Add Input with camera1Input api - * @tc.desc : Add Input with camera1Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering Addinput captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 to operate"); - captureSession.addInput(camera1Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddInput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddInput data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 addInput PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Preview captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 to operate"); - captureSession.addOutput(previewOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Preview : Success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Preview data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 to operate"); - captureSession.removeOutput(previewOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove preview Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove preview Output FAILED" + err.message); - console.info(TAG + "Entering Remove Preview Output ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Preview captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 to operate"); - captureSession.addOutput(previewOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Preview : Success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Preview data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CommitConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 to operate"); - captureSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering commitConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering CommitConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 to operate"); - photoOutputAsync.isMirrorSupported(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 to operate"); - photoOutputAsync.setMirror(true, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 - * @tc.name : setMirror false - * @tc.desc : setMirror false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 to operate"); - photoOutputAsync.setMirror(false, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 is success"); - console.info(TAG + "setMirror is : " + 'false'); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 - * @tc.name : CaptureSession_Begin config api - * @tc.desc : CaptureSession_Begin config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering BeginConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 to operate"); - captureSession.beginConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering beginConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering BeginConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 beginConfig PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 to operate"); - captureSession.removeInput(camera1Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove input success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove Input FAILED" + err.message); - console.info(TAG + "Entering Remove Input ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering Addinput captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 to operate"); - captureSession.addInput(camera0Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddInput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddInput data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 addInput PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 to operate"); - captureSession.removeOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove photo Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove photo Output FAILED" + err.message); - console.info(TAG + "Entering Remove photo Output ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CommitConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 to operate"); - captureSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering commitConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering CommitConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0Input.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0Input.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //preview callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering PreviewStart frameStart Callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 to operate"); - previewOutputAsync.on("frameStart", async (err, data) => { - if (!err) { - console.info(TAG + "PreviewStart frameStart Callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 FAILED : + err.message"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 - * @tc.name : Preview capture callback on frame end api - * @tc.desc : Preview capture callback on frame end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering PreviewOutput frameEnd Callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 to operate"); - previewOutputAsync.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 Callback is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 FAILED : + err.message"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering Photo Capture Callback on CaptureStart photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 to operate"); - photoOutputAsync.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "Photo Capture Callback on CaptureStart is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 to operate"); - photoOutputAsync.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 FAILED' + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 to operate"); - photoOutputAsync.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "frameShutter callback with captureId: " + data.captureId); - console.info(TAG + "frameShutter callback with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 - * @tc.name : capture session start api - * @tc.desc : capture session start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CaptureSession Start captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 to operate"); - captureSession.start(async (err, data) => { - if (!err) { - console.info(TAG + "Entering captureSession.start success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 PASSED"); - } - else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //Location - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - photoOutputAsync.capture(photosettings1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings1"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 - * @tc.name : Photo output capture with photosettings2 api - * @tc.desc : Photo output capture with photosettings2 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 to operate"); - photoOutputAsync.capture(photosettings2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings2 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 to operate"); - photoOutputAsync.capture(photosettings3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings3 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings3 data is not null || undefined"); - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 ends here"); - } - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS with Rotation-270 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 to operate"); - photoOutputAsync.capture(photosettings4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings4 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings4 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 ends here"); - } - }) - await sleep(1000); - done(); - } - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100', 0, async function (done) { - console.info(TAG + "hasFlash called.") - camera0Input.hasFlash(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 is: " + data); - expect(data).assertEqual(true); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 FAILED : " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 ends here"); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 success"); - if (data == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_ALWAYS_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 success"); - if (data == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check if flash mode auto is supported-camera0Input api - * @tc.desc : check if flash mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_AUTO SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 success"); - if (data == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_CLOSE SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 success"); - if (data == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 - * @tc.name : get zoom ratio camera-0 cameraId api - * @tc.desc : get zoom ratio camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100--------------"); - camera0Input.getZoomRatioRange(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 Success " + data) - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(1, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(2, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_0100 PASSED "); - } - else { - expect().assertFail(); - console.info(TAG + "GET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - } else { - expect().assertFail(); - console.info(TAG + "SET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(3, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(4, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(5, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(6, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 - * @tc.name : check if focus mode locked is supported-camera0Input api - * @tc.desc : check if focus mode locked is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Is Focus Mode Locked Supported SUCCESS: " + data); - if (data != null || data != undefined) { - console.info(TAG + "Entering Is Focus Mode Locked Supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_LOCKED_SUPPORTED is: " + data); - expect(data).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 FAILED :" + err.message); - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Mode Locked SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 FAILED : ") - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Mode Locked SUCCESS: " + data); - console.info(TAG + "Get Focus Mode Locked data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 - * @tc.name : get focal length camera0 api - * @tc.desc : get focal length camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 to operate"); - camera0Input.getFocalLength(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focal length SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focal length is: " + JSON.stringify(data)); - expect(data).assertEqual(3.4600000381469727); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_FOCUS_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_FOCUS_0100', 0, async function (done) { - console.info(TAG + "Entering SET_FOCUS_POINT to operate"); - camera0Input.setFocusPoint(Point1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SET_FOCUS_POINT PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SET_FOCUS_POINT FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SET_FOCUS_POINT ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_FOCUS_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_FOCUS_0100', 0, async function (done) { - console.info(TAG + "Entering GET_FOCUS_POINT to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "GET_FOCUS_POINT PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "GET_FOCUS_POINT FAILED : " + err.message); - console.info(TAG + "GET_FOCUS_POINT ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 - * @tc.name : check if focus mode manual is supported-camera0Input api - * @tc.desc : check if focus mode manual is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 FAILED " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 - * @tc.name : set focus Point locked camera0 api - * @tc.desc : set focus Point locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 to operate"); - camera0Input.setFocusPoint(Point2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 - * @tc.name : check if focus mode continuous is supported-camera0Input api - * @tc.desc : check if focus mode continuous is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINOUS_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 to operate"); - camera0Input.setFocusPoint(Point3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : GET_FOCUS_POINT_focus mode auto - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check if focus mode auto is supported-camera0Input api - * @tc.desc : check if focus mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_AUTO_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (data != null || data != undefined) { - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 PASSED") - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 to operate"); - camera0Input.getExposureBiasRange(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias range SUCCESS"); - console.info(TAG + "Current Exposure bias range is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 -4 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 to operate"); - camera0Input.setExposureBias(-4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 mode locked - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 mode auto - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 to operate"); - camera0Input.setExposurePoint(Point1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 mode auto - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure Mode SUCCESS"); - console.info(TAG + "Get Exposure Mode data is not null || undefined: "); - console.info(TAG + "Current ExposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 mode auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 to operate"); - camera0Input.setExposureBias(1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "1"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 mode auto - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 to operate"); - camera0Input.setExposurePoint(Point2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - photoOutputAsync.capture(photosettings1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings1"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 mode auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 to operate"); - camera0Input.setExposureBias(4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 mode continuous auto - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 to operate"); - camera0Input.setExposurePoint(Point3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 to operate"); - photoOutputAsync.capture(photosettings2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings2"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 -5 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 to operate"); - camera0Input.setExposureBias(-5, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 mode locked - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 6 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 to operate"); - camera0Input.setExposureBias(6, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 - * @tc.name : capture session stop api - * @tc.desc : capture session stop api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 to operate"); - captureSession.stop(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 captureSession.stop success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering captureSession.stop data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 captureSession.stop PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 - * @tc.name : capture session release api - * @tc.desc : capture session release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 to operate"); - captureSession.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering captureSession.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering captureSession.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 ends here"); - await sleep(1000); - done(); - } - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 - * @tc.name : photoOutput release api - * @tc.desc : photoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 photoOutputAsync == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 to operate"); - photoOutputAsync.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutputAsync.release success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 FAILED: " + err.message); - console.info(TAG + "Entering photoOutputAsync.release ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 - * @tc.name : previewOutput release api - * @tc.desc : previewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 previewOutputAsync == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 to operate"); - previewOutputAsync.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering previewOutputAsync.release success"); - console.info(TAG + "Entering previewOutputAsync.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 ends here"); - await sleep(1000); - done(); - } - }) - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 - * @tc.name : camera Input release api - * @tc.desc : camera Input release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 camera0Input == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 to operate"); - camera0Input.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering camera0Input.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering camera0Input.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - }) - await sleep(1000); - done(); - } - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets b/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets deleted file mode 100644 index c14442e53bbb82953bb57518e61b1a76791d112c..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets +++ /dev/null @@ -1,3283 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables -var camera0InputPromise; -var cameraManagerPromise; -var previewOutputPromise; -var photoOutputPromise; -var CaptureSessionPromise; -var surfaceId1; -var camerasArrayPromise -var camera1InputPromise; - -var Point1 = { x: 1, y: 1 } -var Point2 = { x: 2, y: 2 } -var Point3 = { x: 3, y: 3 } - -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -export default function cameraJSUnitPhotoPromise(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJsUnitPhotoPromise', function () { - console.info(TAG + '----------CameraJsUnitPhotoPromise--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - console.info(TAG + "----------Camera-PhotoMode-Promise-------------"); - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------"); - cameraManagerPromise = await cameraObj.getCameraManager(null); - console.info(TAG + "Entering Get camera manager cameraManagerPromise: " + JSON.stringify(cameraManagerPromise)); - if (cameraManagerPromise != null && cameraManagerPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManagerPromise == null || cameraManagerPromise == undefined) { - console.info(TAG + 'Entering camera status callback cameraManagerPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate') - cameraManagerPromise.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManagerPromise is success"); - if (data != null || data != undefined) { - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 - * @tc.name : Get camera from cameramanager to get array of camera promise api - * @tc.desc : Get camera from cameramanager to get array of camera promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100--------------"); - camerasArrayPromise = await cameraManagerPromise.getCameras(); - console.info(TAG + "Entering Get Cameras: " + JSON.stringify(camerasArrayPromise)); - if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { - console.info(TAG + "Entering Get Cameras success"); - for (var i = 0; i < camerasArrayPromise.length; i++) { - // Get the variables from camera object - var cameraId = camerasArrayPromise[i].cameraId; - console.info(TAG + "Entering Get Cameras camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArrayPromise[i].cameraPosition; - console.info(TAG + "Entering Get Cameras camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArrayPromise[i].cameraType; - console.info(TAG + "Entering Get Cameras camera" + i + "Type: " + cameraType); - var connectionType = camerasArrayPromise[i].connectionType - console.info(TAG + "Entering Get Cameras connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraId promise api - * @tc.desc : Create camerainput from camera-0 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------CAMERA-0 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera0InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraId); - console.info(TAG + "Entering Create camerainput camera0InputPromise: " + JSON.stringify(camera0InputPromise)); - if (camera0InputPromise != null && camera0InputPromise != undefined) { - console.info(TAG + "Entering Create camerainput camera0InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 - * @tc.name : Create camerainput from camera-1 cameraId promise api - * @tc.desc : Create camerainput from camera-1 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200--------------"); - camera1InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[1].cameraId); - console.info(TAG + "Entering Create camerainput camera1InputPromise: " + JSON.stringify(camera1InputPromise)); - if (camera1InputPromise != null && camera1InputPromise != undefined) { - console.info(TAG + "Entering Create camerainput camera1InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 to operate"); - camera0InputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "camera0InputPromise error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error during camera0InputPromise with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*PreviewOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Create PreviewOutput instance promise api - * @tc.desc : Create PreviewOutput instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - console.info(TAG + " Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - previewOutputPromise = await cameraObj.createPreviewOutput(surfaceId); - console.info(TAG + " Entering createPreviewOutput success"); - if (previewOutputPromise != null || previewOutputPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering createPreviewOutput PASSED: " + JSON.stringify(previewOutputPromise)); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 - * @tc.name : Preview output callback on error api - * @tc.desc : Preview output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview output callback on error previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 to operate"); - previewOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Create PhotoOutput instance promise api - * @tc.desc : Create PhotoOutput instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1000) - photoOutputPromise = await cameraObj.createPhotoOutput(surfaceId1); - console.info(TAG + "Entering createPhotoOutput success"); - if (photoOutputPromise != null || photoOutputPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output callback on error photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 to operate"); - photoOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 - * @tc.name : Create CaptureSession instance promise api - * @tc.desc : Create Capturesession instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 to operate"); - CaptureSessionPromise = await cameraObj.createCaptureSession(null); - console.info(TAG + "Entering createCaptureSession success"); - if (CaptureSessionPromise != null || CaptureSessionPromise != undefined) { - console.info(TAG + "Entering createCaptureSession data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - //Capturesession callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 - * @tc.name : CaptureSession callback on error api - * @tc.desc : CaptureSession callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering CaptureSession callback on error captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 to operate"); - CaptureSessionPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession errorcallback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 - * @tc.name : CaptureSession_Begin config promise api - * @tc.desc : CaptureSession_Begin config promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering CaptureSession_Begin config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 to operate"); - const promise = await CaptureSessionPromise.beginConfig(); - console.info(TAG + "Entering beginConfig success:"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 beginConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add Input captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 to operate"); - const Promise = await CaptureSessionPromise.addInput(camera1InputPromise); - console.info(TAG + "Entering Add Input addInput success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add preview Output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 to operate"); - const promise = await CaptureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering Add preview Output : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Remove preview Output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 to operate"); - const Promise = await CaptureSessionPromise.removeOutput(previewOutputPromise); - console.info(TAG + "Entering Remove preview Output success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add preview Output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 to operate"); - const promise = await CaptureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering Add preview Output : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering commit config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 to operate"); - const promise = await CaptureSessionPromise.commitConfig(); - console.info(TAG + "Entering commit config commitConfig success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 commitConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 commitConfig FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 commitConfig ends here"); - } - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 to operate"); - await photoOutputPromise.isMirrorSupported() - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 FAILED : " + err.message); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 to operate"); - await photoOutputPromise.setMirror(true).then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 FAILED : " + err.message); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 - * @tc.name : setMirror false - * @tc.desc : setMirror false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 to operate"); - await photoOutputPromise.setMirror(false) - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'false'); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 FAILED : " + err.message); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100 - * @tc.name : CaptureSession_Begin config promise api - * @tc.desc : CaptureSession_Begin config promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100 to operate"); - const promise = await CaptureSessionPromise.beginConfig(); - console.info(TAG + "Entering beginConfig success:"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100 beginConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering beginConfig FAILED"); - } - console.info(TAG + "Entering beginConfig ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 to operate"); - const Promise = await CaptureSessionPromise.removeInput(camera1InputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add Input captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 to operate"); - const Promise = await CaptureSessionPromise.addInput(camera0InputPromise); - console.info(TAG + "Entering Add Input addInput success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add output with photo output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 to operate"); - const promise = await CaptureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering Add output with photo output success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 to operate"); - const Promise = await CaptureSessionPromise.removeOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 addInput success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 to operate"); - const promise = await CaptureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering commit config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 to operate"); - const promise = await CaptureSessionPromise.commitConfig(); - console.info(TAG + "Entering commit config commitConfig success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 commitConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 commitConfig FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 commitConfig ends here"); - } - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0InputPromise.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0InputPromise.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - // callback related API - //preview callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview output callback on frame start previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 to operate"); - previewOutputPromise.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 FAILED :" + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 - * @tc.name : Preview capture callback on frame end api - * @tc.desc : Preview capture callback on frame end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview capture callback on frame end previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 to operate"); - previewOutputPromise.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 FAILED : + err.message"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture start photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 to operate"); - photoOutputPromise.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "CaptureStart Callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture end photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 to operate"); - photoOutputPromise.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 FAILED' + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on frame shutter photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 to operate"); - photoOutputPromise.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 with captureId: " + data.captureId); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 - * @tc.name : capture session start api - * @tc.desc : capture session start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering capture session start captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 to operate"); - await CaptureSessionPromise.start(); - console.info(TAG + "Entering captureSession start success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - //Location - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - await photoOutputPromise.capture(photosettings1) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 FAILED:" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 to operate"); - await photoOutputPromise.capture(photosettings2) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 FAILED:" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 to operate"); - await photoOutputPromise.capture(photosettings3) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings3 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 :" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 to operate"); - await photoOutputPromise.capture(photosettings4) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings4 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100--------------"); - console.info(TAG + 'hasFlash called.') - var hasFlashPromise = await camera0InputPromise.hasFlash(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 success"); - if (hasFlashPromise != null || hasFlashPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 is: " + JSON.stringify(hasFlashPromise)); - expect(hasFlashPromise).assertEqual(true); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 FAILED : "); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 ends here"); - await sleep(1000) - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 to operate"); - var isFMOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 SUCCESS "); - if (isFMOpenSupported != null || isFMOpenSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + JSON.stringify(isFMOpenSupported)); - expect(isFMOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 to operate"); - var SetFMOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMOpen)) - if (SetFMOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 to operate"); - var GetFMOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 success: " + JSON.stringify(GetFMOpen)); - if (GetFMOpen == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + JSON.stringify(GetFMOpen)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 to operate"); - var isFMAlwaysOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 SUCCESS "); - if (isFMAlwaysOpenSupported != null || isFMAlwaysOpenSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + isFMAlwaysOpenSupported); - expect(isFMAlwaysOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - var SetFMAlwaysOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMAlwaysOpen)) - if (SetFMAlwaysOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - var GetFMAlwaysOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 success"); - if (GetFMAlwaysOpen == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAlwaysOpen); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 to operate"); - var isFMAutoSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 SUCCESS "); - if (isFMAutoSupported != null || isFMAutoSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_AUTO data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + isFMAutoSupported); - expect(isFMAutoSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 to operate"); - var SetFMAlwaysAuto = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "SetFMAlwaysAuto: " + JSON.stringify(SetFMAlwaysAuto)) - if (SetFMAlwaysAuto == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 to operate"); - var GetFMAuto = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 success"); - if (GetFMAuto == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAuto); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 to operate"); - var isFMCloseSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 SUCCESS "); - if (isFMCloseSupported != null || isFMCloseSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + isFMCloseSupported); - expect(isFMCloseSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 to operate"); - var SetFMClose = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMClose)) - if (SetFMClose == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 - * @tc.name : get flash mode close camera0 api - * @tc.desc : get flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 to operate"); - var GetFMClose = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 success"); - if (GetFMClose == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMClose); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - //ZOOM Function - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 - * @tc.name : get zoom ratio camera-0 cameraId api promise api - * @tc.desc : get zoom ratio camera-0 cameraId api promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100--------------"); - var getZoomRatioPromise = await camera0InputPromise.getZoomRatioRange(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 getZoomRatioPromise: " + JSON.stringify(getZoomRatioPromise)); - if (getZoomRatioPromise != null && getZoomRatioPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 setZoomRatioPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 success: " + JSON.stringify(getZoomRatioPromise)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(1); - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - var getpromise1 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise1); - if (getpromise1 != null && getpromise1 != undefined) { - expect(getpromise1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(2); - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - var getpromise2 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise2); - if (getpromise2 != null && getpromise2 != undefined) { - expect(getpromise2).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(3); - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - var getpromise3 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise3); - if (getpromise3 != null && getpromise3 != undefined) { - expect(getpromise3).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(4); - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - var getpromise4 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise4); - if (getpromise4 != null && getpromise4 != undefined) { - expect(getpromise4).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(5); - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - var getpromise5 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise5); - if (getpromise5 != null && getpromise5 != undefined) { - expect(getpromise5).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(6); - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - var getpromise6 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise6); - if (getpromise6 != null && getpromise6 != undefined) { - expect(getpromise6).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - // FOCUS promise API's - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 - * @tc.name : check is focus mode locked supported-camera0Input api - * @tc.desc : check is focus mode locked supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 to operate"); - var isFMLockedSupported = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering is focus mode locked supported SUCCESS "); - if (isFMLockedSupported != null || isFMLockedSupported != undefined) { - console.info(TAG + "Entering is focus mode locked supported data is not null || undefined"); - console.info(TAG + "is focus mode locked supported : " + isFMLockedSupported); - expect(isFMLockedSupported).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED) - .then(function (data) { - console.info(TAG + "SetFMLocked: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode locked SUCCESS, current focusmode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 FAILED : ") - expect().assertFail(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode locked success: "); - if (data == 0) { - console.info(TAG + "Current focusmode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 - * @tc.name : get focal length camera0 api - * @tc.desc : get focal length camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 to operate"); - await camera0InputPromise.getFocalLength() - .then(function (data) { - console.info(TAG + "Current focallength is: " + JSON.stringify(data)); - expect(data).assertEqual(3.4600000381469727); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 - * @tc.name : is focusmode manual supported - * @tc.desc : is focusmode manual supported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 to operate"); - var isFMmanualSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL); - if (isFMmanualSupportedpromise != null || isFMmanualSupportedpromise != undefined) { - console.info(TAG + "Entering is focusmode manual supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMmanualSupportedpromise); - expect(isFMmanualSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL) - .then(function (data) { - console.info(TAG + "setFocusManual: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode manual SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode manual SUCCESS"); - if (data == 0) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 FAILED " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 - * @tc.name : check is focus mode continuous supported-camera0Input api - * @tc.desc : check is focus mode continuous supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 to operate"); - var isFMContinuousSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - if (isFMContinuousSupportedpromise != null || isFMContinuousSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode continuous supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINUOUS_SUPPORTED is: " + isFMContinuousSupportedpromise); - expect(isFMContinuousSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) - .then(function (data) { - console.info(TAG + "setFocusCont: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode continuous SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode continuous SUCCESS"); - if (data == 1) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check is focus mode auto supported-camera0Input api - * @tc.desc : check is focus mode auto supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 to operate"); - var isFMAutoSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (isFMAutoSupportedpromise != null || isFMAutoSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode auto supported data is not null || undefined"); - console.info(TAG + "is focus mode auto supported is: " + isFMAutoSupportedpromise); - expect(isFMAutoSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 to operate"); - var setFocusAuto = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO) - .then(function () { - console.info(TAG + "setFocusAuto: " + JSON.stringify(setFocusAuto)) - console.info(TAG + "Entering set focus mode auto SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode auto SUCCESS " + JSON.stringify(data)); - if (data == 2) { - console.info(TAG + "Current FocusMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 PASSED"); - } - }) - .catch((err) => { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode locked SUCCESS"); - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 to operate"); - await camera0InputPromise.getExposureBiasRange() - .then(function (data) { - console.info(TAG + "Entering getExposureBiasRange SUCCESS"); - console.info(TAG + "Current ExposureBiasRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100-4 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 to operate"); - await camera0InputPromise.setExposureBias(-4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 to operate"); - await camera0InputPromise.setExposurePoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 FAILED: " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 to operate"); - await camera0InputPromise.setExposureBias(1) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "1"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 to operate"); - await camera0InputPromise.setExposurePoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 to operate"); - await photoOutputPromise.capture(photosettings1) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with Rotation-0 & Quality-0 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 FAILED:" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 to operate"); - await camera0InputPromise.setExposureBias(4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 to operate"); - await camera0InputPromise.setExposurePoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - await photoOutputPromise.capture(photosettings2) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with location settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400-5 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 to operate"); - await camera0InputPromise.setExposureBias(-5) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 to operate"); - await camera0InputPromise.setExposureBias(6) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 ends here"); - await sleep(1000); - done(); - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 - * @tc.name : capture session stop api - * @tc.desc : capture session stop api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering capture session stop captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 to operate"); - await CaptureSessionPromise.stop(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 captureSession.stop PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 captureSession.stop ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : capture session release api - * @tc.desc : capture session release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering capture session release captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await CaptureSessionPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : PreviewOutput release api - * @tc.desc : PreviewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering previewOutputPromise.release previewOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await previewOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : PhotoOutput release api - * @tc.desc : PhotoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering PhotoOutput release photoOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await photoOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : cameraInput release api - * @tc.desc : cameraInput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering cameraInput release camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await camera0InputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - }); -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets b/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets deleted file mode 100644 index 571ca690ff89ac2fbd3becb18f81fc97bc447bf8..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets +++ /dev/null @@ -1,3800 +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 cameraObj from '@ohos.multimedia.camera'; -import media from '@ohos.multimedia.media' -import image from '@ohos.multimedia.image'; -import mediaLibrary from '@ohos.multimedia.mediaLibrary' -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' - -// @ts-nocheck -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -let TAG = "CameraModuleTest: "; -var cameraManager -var camerasArray -var camera0Input -var previewOutput -var photoOutputAsync -var videoRecorder -var surfaceId1 - -var minFrameRate_Grp0=12; -var maxFrameRate_Grp0=12; -var minFrameRate_Mix=14; -var maxFrameRate_Mix=15; -var minFrameRate_Err1=11; -var maxFrameRate_Err1=31; -var minFrameRate_Err2=14; -var maxFrameRate_Err2=28; -var minFrameRate_Err3=16; -var maxFrameRate_Err3=25; -var minFrameRate_Grp20=30; -var maxFrameRate_Grp20=30; - -var Point = { x: 1, y: 1 } -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -let fdPath; -let fileAsset; -let fdNumber; -let configFile = { - audioBitrate: 48000, - audioChannels: 2, - audioCodec: 'audio/mp4a-latm', - audioSampleRate: 48000, - durationTime: 1000, - fileFormat: 'mp4', - videoBitrate: 48000, - videoCodec: 'video/mp4v-es', - videoFrameWidth: 640, - videoFrameHeight: 480, - videoFrameRate: 30 -} - -let videoConfig = { - audioSourceType: 1, - videoSourceType: 0, - profile: configFile, - url: 'file:///data/media/02.mp4', - orientationHint: 0, - location: { latitude: 30, longitude: 130 }, - maxSize: 100, - maxDuration: 500 -} -var videoId -var videoOutput -var captureSession - -export default function cameraJSUnitVideoAsync(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(time) { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(1) - }, time * 1000) - }).then(() => { - console.info(`sleep ${time} over...`) - }) - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - async function getFd(pathName) { - let displayName = pathName; - const mediaTest = mediaLibrary.getMediaLibrary(); - let fileKeyObj = mediaLibrary.FileKey; - let mediaType = mediaLibrary.MediaType.VIDEO; - let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); - let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); - if (dataUri != undefined) { - let args = dataUri.id.toString(); - let fetchOp = { - selections: fileKeyObj.ID + "=?", - selectionArgs: [args], - } - let fetchFileResult = await mediaTest.getFileAssets(fetchOp); - fileAsset = await fetchFileResult.getAllObject(); - fdNumber = await fileAsset[0].open('Rw'); - fdPath = "fd://" + fdNumber.toString(); - } - } - - async function closeFd() { - if (fileAsset != null) { - await fileAsset[0].close(fdNumber).then(() => { - console.info('[mediaLibrary] case close fd success'); - }).catch((err) => { - console.info('[mediaLibrary] case close fd failed'); - }); - } else { - console.info('[mediaLibrary] case fileAsset is null'); - } - } - - async function getvideosurface() { - await getFd('02.mp4'); - videoConfig.url = fdPath; - media.createVideoRecorder((err, recorder) => { - console.info(TAG + 'createVideoRecorder called') - videoRecorder = recorder - console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder)) - console.info(TAG + 'videoRecorder.prepare called.') - videoRecorder.prepare(videoConfig, (err) => { - console.info(TAG + 'videoRecorder.prepare success.') - }) - videoRecorder.getInputSurface((err, id) => { - console.info(TAG + 'getInputSurface called') - videoId = id - console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoId)) - }) - }) - } - - describe('VideoModeAsync', function () { - console.info(TAG + '----------Camera-VideoMode-Async--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5); - console.info('beforeEach case'); - }) - - afterEach(async function () { - await closeFd(); - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100--------------') - await sleep(1) - cameraObj.getCameraManager(null, (err, data) => { - if (!err) { - console.info(TAG + 'Entering Get Camera manager success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Get Camera Manager data is not null || undefined') - cameraManager = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 PASSED') - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManager == null || cameraManager == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManager == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate') - cameraManager.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManager is success"); - if (data != null || data != undefined) { - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Camera status Callback FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------') - await sleep(1) - cameraManager.getCameras((err, data) => { - if (!err) { - console.info(TAG + 'Entering Get Cameras success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Get Cameras data is not null || undefined') - camerasArray = data - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId - console.info(TAG + 'Entering Get Cameras camera' + i + 'Id: ' + cameraId) - var cameraPosition = camerasArray[i].cameraPosition - console.info(TAG + 'Entering Get Cameras camera' + i + 'Position: ' + cameraPosition) - var cameraType = camerasArray[i].cameraType - console.info(TAG + 'Entering Get Cameras camera' + i + 'Type: ' + cameraType) - var connectionType = camerasArray[i].connectionType - console.info(TAG + 'Entering Get Cameras connection' + i + 'Type: ' + connectionType) - } - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined') - } - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info('--------------CAMERA-0 STARTS HERE--------------') - console.info('--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------') - await sleep(1) - cameraManager.createCameraInput(camerasArray[0].cameraId, (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + 'Entering Create camera input data is not null || undefined') - camera0Input = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :' + camerasArray[0].cameraId) - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering Camera Input callback camera0Input == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 to operate"); - camera0Input.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "camera0Input error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 - * @tc.name : Create previewoutput async api - * @tc.desc : Create previewoutput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 to operate') - await sleep(1) - cameraObj.createPreviewOutput(surfaceId, (err, data) => { - if (!err) { - console.info(TAG + 'Entering Create preview output success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Create preview output data is not null || undefined') - previewOutput = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 PASSED') - } - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Preview output callback on error api - * @tc.desc : Preview output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering PreviewOutput callback on error previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 to operate"); - previewOutput.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Create PhotoOutput instance api - * @tc.desc : Create PhotoOutput instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1) - cameraObj.createPhotoOutput(surfaceId1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering createPhotoOutput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering createPhotoOutput data is not null || undefined"); - photoOutputAsync = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate"); - photoOutputAsync.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error during PhotoOutput with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 - * @tc.name : Create videooutput async api - * @tc.desc : Create videooutput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 to operate') - await getvideosurface() - await sleep(2) - cameraObj.createVideoOutput(videoId, (err, data) => { - if (!err) { - console.info(TAG + 'Entering Create videooutput success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Create videooutput data is not null || undefined') - videoOutput = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 PASSED') - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : VideoOutput callback onerror async api - * @tc.desc : VideoOutput callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 videoOutput == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - videoOutput.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "VideoOutput Errorcallback is success") - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1) - done() - }) - await sleep(1) - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 - * @tc.name : Create capturesession async api - * @tc.desc : Create capturesession async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 to operate') - await sleep(1) - cameraObj.createCaptureSession(null, async (err, data) => { - if (!err) { - console.info(TAG + 'Entering Create capturesession success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Create capturesession data is not null || undefined') - captureSession = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 PASSED') - } - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail() - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 - * @tc.name : CaptureSession callback on error api - * @tc.desc : CaptureSession callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 to operate"); - captureSession.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession errorcallback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 - * @tc.name : Begin Config async api - * @tc.desc : Begin Config async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering Begin Config captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 to operate') - await sleep(1) - captureSession.beginConfig((err, data) => { - if (!err) { - console.info(TAG + 'Entering Begin Config success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 - * @tc.name : AddInput async api - * @tc.desc : AddInput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddInput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 to operate') - await sleep(1) - captureSession.addInput(camera0Input, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddInput success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 - * @tc.name : AddOutput preview async api - * @tc.desc : AddOutput preview async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput preview captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 to operate') - await sleep(1) - captureSession.addOutput(previewOutput, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput preview success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 ends here"); - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 - * @tc.name : AddOutput video async api - * @tc.desc : AddOutput video async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput video captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 to operate') - await sleep(1) - captureSession.addOutput(videoOutput, async (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput video success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 ends here') - await sleep(1); - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeInput(camera0Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove input success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering Remove Input FAILED" + err.message); - console.info(TAG + "Entering Remove Input ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeOutput(previewOutput, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove preview Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering Remove preview Output FAILED" + err.message); - console.info(TAG + "Entering Remove Preview Output ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove photo Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove photo Output FAILED" + err.message); - console.info(TAG + "Entering Remove photo Output ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Remove video Output api - * @tc.desc : Remove video Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeOutput(videoOutput, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove video Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering Remove video Output FAILED" + err.message); - console.info(TAG + "Entering Remove video Output ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 - * @tc.name : AddInput async api - * @tc.desc : AddInput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddInput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 to operate') - await sleep(1) - captureSession.addInput(camera0Input, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddInput success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 - * @tc.name : AddOutput preview async api - * @tc.desc : AddOutput preview async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 to operate') - await sleep(1) - captureSession.addOutput(previewOutput, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput success') - console.info(TAG + 'Entering AddOutput data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 ends here"); - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 - * @tc.name : AddOutput video async api - * @tc.desc : AddOutput video async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 to operate') - await sleep(1) - captureSession.addOutput(videoOutput, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput success') - console.info(TAG + 'Entering AddOutput data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 ends here') - done() - }) - await sleep(1) - done() - } - }) - - //framerate - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 - * @tc.name : get frame rate range camera0 api - * @tc.desc : get frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 to operate"); - videoOutput.getFrameRateRange(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get frame rate range success"); - expect(true).assertTrue(); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Grp0,maxFrameRate_Grp0, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range PASSED") - expect(true).assertTrue(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Mix,maxFrameRate_Mix, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED") - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api_err - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Err1,maxFrameRate_Err1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED") - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Err2,maxFrameRate_Err2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED"); - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Err3,maxFrameRate_Err3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED"); - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Grp20,maxFrameRate_Grp20, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range PASSED") - expect(true).assertTrue(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeOff - * @tc.desc : getVideoStabilizationModeOff async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode Off success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeLow - * @tc.desc : getVideoStabilizationModeLOw async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode low success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(1) - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeMedium - * @tc.desc : getVideoStabilizationModeMedium async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode medium success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeHigh - * @tc.desc : getVideoStabilizationModeHigh async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode High success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeAuto - * @tc.desc : getVideoStabilizationModeAuto async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode Auto success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 - * @tc.name : CommitConfig async api - * @tc.desc : CommitConfig async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering CommitConfig captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 to operate') - await sleep(1) - captureSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + 'Entering CommitConfig success') - console.info(TAG + 'Entering CommitConfig data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0Input.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0Input.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //callback API - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering Preview output callback on frame start previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate"); - previewOutput.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : Preview capture callback on frame end api - * @tc.desc : Preview capture callback on frame end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering Preview capture callback on frame end previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate"); - previewOutput.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering Photo Capture Callback on CaptureStart photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 to operate"); - photoOutputAsync.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "Photo Capture Callback on CaptureStart is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 to operate"); - photoOutputAsync.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 FAILED' + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 to operate"); - photoOutputAsync.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "frameShutter callback with captureId: " + data.captureId); - console.info(TAG + "frameShutter callback with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : VideoOutput callback onframestart async api - * @tc.desc : VideoOutput callback onframestart async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + "Entering VideoOutput callback onframestart videoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate"); - videoOutput.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 is FAILED : " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : VideoOutput callback onframeend async api - * @tc.desc : VideoOutput callback onframeend async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + 'Entering VideoOutput callback onframeend videoOutput == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate') - await sleep(1) - videoOutput.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 is success'); - if (data != null || data != undefined) { - expect(true).assertTrue() - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED' + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 - * @tc.name : CaptureSession start async api - * @tc.desc : CaptureSession start async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CaptureSession start captureSession == null || undefined") - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 to operate") - await sleep(1) - captureSession.start(async (err, data) => { - if (!err) { - console.info(TAG + "Entering CaptureSession start success") - expect(true).assertTrue() - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 PASSED") - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "hasFlash called.") - camera0Input.hasFlash(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 is: " + data); - expect(data).assertEqual(true); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 ends here"); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 success"); - if (data == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_ALWAYS_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 success"); - if (data == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode auto is supported-camera0Input api - * @tc.desc : check if flash mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_AUTO SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 success"); - if (data == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_CLOSE SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 success"); - if (data == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 - * @tc.name : get zoom ratio camera-0 cameraId api - * @tc.desc : get zoom ratio camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100--------------"); - camera0Input.getZoomRatioRange(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 Success " + data) - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 ends here"); - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(1, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(2, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_CALLBACK_0100 PASSED "); - } - else { - expect().assertFail(); - console.info(TAG + "GET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - } else { - expect().assertFail(); - console.info(TAG + "SET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(3, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(4, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(5, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(6, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode locked is supported-camera0Input api - * @tc.desc : check if focus mode locked is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Is Focus Mode Locked Supported SUCCESS: " + data); - if (data != null || data != undefined) { - console.info(TAG + "Entering Is Focus Mode Locked Supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_LOCKED_SUPPORTED is: " + data); - expect(data).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 FAILED :" + err.message); - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Mode Locked SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 FAILED : ") - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Mode Locked SUCCESS: " + data); - console.info(TAG + "Get Focus Mode Locked data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode manual is supported-camera0Input api - * @tc.desc : check if focus mode manual is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 FAILED " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 to operate"); - camera0Input.setFocusPoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode continuous is supported-camera0Input api - * @tc.desc : check if focus mode continuous is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINOUS_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 - * @tc.name : set focus Point locked camera0 api - * @tc.desc : set focus Point locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 to operate"); - camera0Input.setFocusPoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode auto is supported-camera0Input api - * @tc.desc : check if focus mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_AUTO_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (data != null || data != undefined) { - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 PASSED") - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 to operate"); - camera0Input.setFocusPoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 to operate"); - camera0Input.setExposurePoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100_exposure mode continuous auto - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 to operate"); - camera0Input.getExposureBiasRange(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias range SUCCESS"); - console.info(TAG + "Current Exposure bias range is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 to operate"); - camera0Input.setExposureBias(-4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure Mode SUCCESS"); - console.info(TAG + "Get Exposure Mode data is not null || undefined: "); - console.info(TAG + "Current ExposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 to operate"); - camera0Input.setExposurePoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 to operate"); - camera0Input.setExposureBias(1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "1"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 to operate"); - camera0Input.setExposurePoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 to operate"); - camera0Input.setExposureBias(4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100 to operate"); - photoOutputAsync.isMirrorSupported(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100 to operate"); - photoOutputAsync.setMirror(true, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 - * @tc.name : VideoOutput start async api - * @tc.desc : VideoOutput start async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 videoOutput == null || undefined") - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 to operate") - await sleep(1) - videoOutput.start(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 success: " + JSON.stringify(data)) - if (data == undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 FAILED: " + err.message) - } - }) - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 - * @tc.name : VideoRecorder start async api - * @tc.desc : VideoRecorder start async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100', 0, async function (done) { - if (videoRecorder == null || videoRecorder == undefined) { - console.info(TAG + 'Entering VideoRecorder start videoRecorder == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 to operate') - videoRecorder.start() - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 called'); - sleep(3); - console.info(TAG + 'Capture with photosettings1 during video - Start & setMirror: true') - photoOutputAsync.capture(photosettings1) - console.info(TAG + 'Capture during Video - End.') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 - * @tc.name : VideoOutput stop async api - * @tc.desc : VideoOutput stop async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + 'Entering VideoOutput stop videoOutput == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 to operate') - videoOutput.stop(async (err, data) => { - if (!err) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 success: ' + JSON.stringify(data)) - if (data == undefined) { - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100 - * @tc.name : VideoRecorder stop async api - * @tc.desc : VideoRecorder stop async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100', 0, async function (done) { - if (videoRecorder == null || videoRecorder == undefined) { - console.info(TAG + 'Entering VideoRecorder stop videoRecorder == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100 to operate') - videoRecorder.stop() - console.info(TAG + 'VideoRecorder stop stopVideo done.') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100 PASSED') - expect(true).assertTrue() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 - * @tc.name : CaptureSession stop async api - * @tc.desc : CaptureSession stop async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering CaptureSession stop captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 to operate') - await sleep(1) - captureSession.stop((err, data) => { - if (!err) { - console.info(TAG + 'Entering CaptureSession stop success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 - * @tc.name : CaptureSession release async api - * @tc.desc : CaptureSession release async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering CaptureSession release captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 to operate') - await sleep(1) - captureSession.release(async (err, data) => { - if (!err) { - console.info(TAG + 'Entering CaptureSession release success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering CaptureSession release data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 PASSED') - } - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 - * @tc.name : videooutput release api - * @tc.desc : videooutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + "Entering videooutput.release previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 to operate"); - videoOutput.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering videooutput.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering videooutput.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 ends here"); - await sleep(1); - done(); - } - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 - * @tc.name : previewOutput release api - * @tc.desc : previewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 to operate"); - previewOutput.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering previewOutput.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering previewOutput.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering previewOutput.release PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering previewOutput.release ends here"); - await sleep(1); - done(); - } - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 - * @tc.name : photoOutput release api - * @tc.desc : photoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 photoOutputAsync == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 to operate"); - photoOutputAsync.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutputAsync.release success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering photoOutputAsync.release ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 - * @tc.name : camera Input release api - * @tc.desc : camera Input release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering camera0Input.release camera0Input == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 to operate"); - camera0Input.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering camera0Input.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering camera0Input.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 ends here"); - await sleep(1); - done(); - } - }) - await sleep(1); - done(); - } - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets b/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets deleted file mode 100644 index aa4466c90fbcc0482aff18bd91e25e3ae39d7b27..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngle/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets +++ /dev/null @@ -1,3367 +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 cameraObj from '@ohos.multimedia.camera' -import media from '@ohos.multimedia.media' -import image from '@ohos.multimedia.image'; -import mediaLibrary from '@ohos.multimedia.mediaLibrary' -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' - -// @ts-nocheck -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -let TAG = 'CameraModuleTest: ' -var cameraManagerPromise -var camerasArrayPromise -var camera0InputPromise -var previewOutputPromise -var videoRecorder -var photoOutputPromise -let fdPath; -let fileAsset; -let fdNumber; - -var minFrameRate_Grp0=12; -var maxFrameRate_Grp0=12; -var minFrameRate_Mix=14; -var maxFrameRate_Mix=15; -var minFrameRate_Err1=11; -var maxFrameRate_Err1=31; -var minFrameRate_Err2=14; -var maxFrameRate_Err2=28; -var minFrameRate_Err3=16; -var maxFrameRate_Err3=25; -var minFrameRate_Grp20=30; -var maxFrameRate_Grp20=30; - -var Point1 = { x: 1, y: 1 } -var Point2 = { x: 2, y: 2 } -var Point3 = { x: 3, y: 3 } -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -var photosettings5 = { - rotation: 270, -} -let configFile = { - audioBitrate: 48000, - audioChannels: 2, - audioCodec: 'audio/mp4a-latm', - audioSampleRate: 48000, - durationTime: 1000, - fileFormat: 'mp4', - videoBitrate: 48000, - videoCodec: 'video/mp4v-es', - videoFrameWidth: 640, - videoFrameHeight: 480, - videoFrameRate: 30 -} - -let videoConfig = { - audioSourceType: 1, - videoSourceType: 0, - profile: configFile, - url: 'file:///data/media/01.mp4', - orientationHint: 0, - location: { latitude: 30, longitude: 130 }, - maxSize: 100, - maxDuration: 500 -} -var surfaceId1 -var videoId -var videoOutputPromise -var captureSessionPromise - -export default function cameraJSUnitVideoPromise(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(time) { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(1) - }, time * 1000) - }).then(() => { - console.info(`sleep ${time} over...`) - }) - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - async function getFd(pathName) { - let displayName = pathName; - const mediaTest = mediaLibrary.getMediaLibrary(); - let fileKeyObj = mediaLibrary.FileKey; - let mediaType = mediaLibrary.MediaType.VIDEO; - let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); - let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); - if (dataUri != undefined) { - let args = dataUri.id.toString(); - let fetchOp = { - selections: fileKeyObj.ID + "=?", - selectionArgs: [args], - } - let fetchFileResult = await mediaTest.getFileAssets(fetchOp); - fileAsset = await fetchFileResult.getAllObject(); - fdNumber = await fileAsset[0].open('Rw'); - fdPath = "fd://" + fdNumber.toString(); - } - } - - async function closeFd() { - if (fileAsset != null) { - await fileAsset[0].close(fdNumber).then(() => { - console.info('[mediaLibrary] case close fd success'); - }).catch((err) => { - console.info('[mediaLibrary] case close fd failed'); - }); - } else { - console.info('[mediaLibrary] case fileAsset is null'); - } - } - - async function getvideosurface() { - await getFd('01.mp4'); - videoConfig.url = fdPath; - media.createVideoRecorder((err, recorder) => { - console.info(TAG + 'createVideoRecorder called') - videoRecorder = recorder - console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder)) - console.info(TAG + 'videoRecorder.prepare called.') - videoRecorder.prepare(videoConfig, (err) => { - console.info(TAG + 'videoRecorder.prepare success.') - }) - videoRecorder.getInputSurface((err, id) => { - console.info(TAG + 'getInputSurface called') - videoId = id - console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoId)) - }) - }) - } - - describe('VideoModePromise', function () { - console.info(TAG + '----------Camera-VideoMode-Promise--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5); - console.info('beforeEach case'); - }) - - afterEach(async function () { - await closeFd(); - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------') - cameraManagerPromise = await cameraObj.getCameraManager(null) - console.info(TAG + 'Entering Get cameraManagerPromise cameraManagerPromise: ' + cameraManagerPromise) - if (cameraManagerPromise != null && cameraManagerPromise != undefined) { - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManagerPromise == null || cameraManagerPromise == undefined) { - console.info(TAG + 'Entering Camera status Callback cameraManagerPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate') - await sleep(1) - cameraManagerPromise.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManagerPromise is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100--------------') - camerasArrayPromise = await cameraManagerPromise.getCameras() - console.info(TAG + 'Entering Get Cameras Promise: ' + JSON.stringify(camerasArrayPromise)) - if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { - console.info(TAG + 'Entering Get Cameras Promise success') - for (var i = 0; i < camerasArrayPromise.length; i++) { - // Get the variables from camera object - var cameraId = camerasArrayPromise[i].cameraId - console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Id: ' + cameraId) - var cameraPosition = camerasArrayPromise[i].cameraPosition - console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Position: ' + cameraPosition) - var cameraType = camerasArrayPromise[i].cameraType - console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Type: ' + cameraType) - var connectionType = camerasArrayPromise[i].connectionType - console.info(TAG + 'Entering Get Cameras Promise connection' + i + 'Type: ' + connectionType) - } - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraId promise api - * @tc.desc : Create camerainput from camera-0 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------') - camera0InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraId) - console.info(TAG + 'Entering Create camera input promise camera0InputPromise: ' + JSON.stringify(camera0InputPromise)) - if (camera0InputPromise != null && camera0InputPromise != undefined) { - console.info(TAG + 'Entering Create camera input promise camera0InputPromise is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering Camera input error callback camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 to operate"); - camera0InputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "camera0InputPromise error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 - * @tc.name : Create previewoutput promise api - * @tc.desc : Create previewoutput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100--------------') - previewOutputPromise = await cameraObj.createPreviewOutput(surfaceId) - console.info(TAG + 'Entering Create previewOutputPromise: ' + JSON.stringify(previewOutputPromise)) - if (previewOutputPromise != null && previewOutputPromise != undefined) { - console.info(TAG + 'Entering Create previewOutputPromise is not null || undefined') - expect(true).assertTrue(); - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 PASSED') - } else { - expect().assertFail(); - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0InputPromise.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is : " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0InputPromise.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : PreviewOutput callback onerror async api - * @tc.desc : PreviewOutput callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + 'Entering PreviewOutputError callback previewOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - previewOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 - * @tc.name : Create videooutput promise api - * @tc.desc : Create videooutput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 to operate') - await getvideosurface() - await sleep(2) - videoOutputPromise = await cameraObj.createVideoOutput(videoId) - console.info(TAG + 'Entering Create videoOutputPromise: ' + videoOutputPromise) - if (videoOutputPromise != null && videoOutputPromise != undefined) { - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 PASSED') - } else { - expect().assertFail(); - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 ends here'); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : VideoOutput callback onerror async api - * @tc.desc : VideoOutput callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - videoOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + 'VideoOutput Errorcallback is success') - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1) - done() - }) - await sleep(1) - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Create PhotoOutput instance promise api - * @tc.desc : Create PhotoOutput instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1) - photoOutputPromise = await cameraObj.createPhotoOutput(surfaceId1); - console.info(TAG + "Entering createPhotoOutput success"); - if (photoOutputPromise != null || photoOutputPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output callback on error photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate"); - photoOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 - * @tc.name : Create capturesession promise api - * @tc.desc : Create capturesession promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 to operate') - captureSessionPromise = await cameraObj.createCaptureSession(null) - console.info(TAG + 'Entering Create captureSessionPromise: ' + captureSessionPromise) - if (captureSessionPromise != null && captureSessionPromise != undefined) { - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 ends here'); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 - * @tc.name : CaptureSession callback onerror async api - * @tc.desc : CaptureSession callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + 'Entering captureSession errorcallback captureSessionPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - captureSessionPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession errorcallback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 - * @tc.name : CaptureSession_Begin config promise api - * @tc.desc : CaptureSession_Begin config promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Create captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.beginConfig(); - console.info(TAG + "Entering beginConfig success:"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 beginConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add Input captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.addInput(camera0InputPromise); - console.info(TAG + "Entering Add Input success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add preview output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering Add preview output : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 - * @tc.name : Add output with video output api - * @tc.desc : Add output with video output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add video output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(videoOutputPromise); - console.info(TAG + "Entering Add video output success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add output with photo output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering Add output with photo output success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeInput(camera0InputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeOutput(previewOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 addInput success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Remove video Output api - * @tc.desc : Remove video Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeOutput(videoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 to operate"); - const Promise = await captureSessionPromise.addInput(camera0InputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 addInput success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 to operate"); - const promise = await captureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 - * @tc.name : Add output with video output api - * @tc.desc : Add output with video output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 to operate"); - const promise = await captureSessionPromise.addOutput(videoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 - * @tc.name : get frame rate range camera0 api - * @tc.desc : get frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 to operate"); - await videoOutputPromise.getFrameRateRange() - .then(function (data) { - console.info(TAG + "Entering get frame rate range SUCCESS "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 PASSED : " + JSON.stringify(data)) - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Grp0,maxFrameRate_Grp0) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Mix,maxFrameRate_Mix) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Err1,maxFrameRate_Err1) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Err2,maxFrameRate_Err2) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Err3,maxFrameRate_Err3) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Grp20,maxFrameRate_Grp20) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 - * @tc.name : getVideoStabilizationModeOff - * @tc.desc : getVideoStabilizationModeOff promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeOff SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 - * @tc.name : getVideoStabilizationModeLow - * @tc.desc : getVideoStabilizationModeLow promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeLow SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 - * @tc.name : getVideoStabilizationModeMIDDLE - * @tc.desc : getVideoStabilizationModeMIDDLE promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeMIDDLE SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 - * @tc.name : getVideoStabilizationModeHigh - * @tc.desc : getVideoStabilizationModeHigh promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeHigh SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 - * @tc.name : getVideoStabilizationModeAuto - * @tc.desc : getVideoStabilizationModeAuto promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeAuto SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Commit config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.commitConfig(); - console.info(TAG + "Entering commitConfig success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 commitConfig PASSED"); - } - else { - expect().assertFail() - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 commitConfig FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 commitConfig ends here"); - } - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview Output callback on frame start previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate"); - previewOutputPromise.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : PreviewOutput callback onframeend async api - * @tc.desc : PreviewOutput callback onframeend async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 previewOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate') - await sleep(1) - previewOutputPromise.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewStop frameEnd Callback is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : VideoOutput callback onframestart async api - * @tc.desc : VideoOutput callback onframestart async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video frameStart Callback videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate') - await sleep(1) - videoOutputPromise.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "Video frameStart Callback is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 is FAILED : " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : VideoOutput callback onframeend async api - * @tc.desc : VideoOutput callback onframeend async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video frameEnd callback videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate') - await sleep(1) - videoOutputPromise.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 is success') - if (data != null || data != undefined) { - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED' + err.message) - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture start photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 to operate"); - photoOutputPromise.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "CaptureStart Callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture end photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 to operate"); - photoOutputPromise.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 FAILED' + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on frame shutter photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 to operate"); - photoOutputPromise.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 with captureId: " + data.captureId); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 - * @tc.name : capture session start api - * @tc.desc : capture session start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering capture session start captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 to operate"); - await captureSessionPromise.start(); - console.info(TAG + "Entering captureSession start success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 to operate"); - await photoOutputPromise.isMirrorSupported() - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 FAILED : " + err.message); - }); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 to operate"); - await photoOutputPromise.setMirror(true) - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 FAILED : " + err.message); - }); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100--------------"); - console.info(TAG + 'hasFlash called.') - var hasFlashPromise = await camera0InputPromise.hasFlash(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 success"); - if (hasFlashPromise != null || hasFlashPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 is: " + JSON.stringify(hasFlashPromise)); - expect(hasFlashPromise).assertEqual(true); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 FAILED : "); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 ends here"); - await sleep(1) - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 to operate"); - var isFMOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMOpenSupported != null || isFMOpenSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + JSON.stringify(isFMOpenSupported)); - expect(isFMOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 to operate"); - var SetFMOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMOpen)) - if (SetFMOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 to operate"); - var GetFMOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 success: " + JSON.stringify(GetFMOpen)); - if (GetFMOpen == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + JSON.stringify(GetFMOpen)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 to operate"); - var isFMAlwaysOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMAlwaysOpenSupported != null || isFMAlwaysOpenSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + isFMAlwaysOpenSupported); - expect(isFMAlwaysOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 to operate"); - var SetFMAlwaysOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMAlwaysOpen)) - if (SetFMAlwaysOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 to operate"); - var GetFMAlwaysOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 success"); - if (GetFMAlwaysOpen == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAlwaysOpen); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 to operate"); - var isFMAutoSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMAutoSupported != null || isFMAutoSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_AUTO data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + isFMAutoSupported); - expect(isFMAutoSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 to operate"); - var SetFMAlwaysAuto = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "SetFMAlwaysAuto: " + JSON.stringify(SetFMAlwaysAuto)) - if (SetFMAlwaysAuto == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 to operate"); - var GetFMAuto = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 success"); - if (GetFMAuto == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAuto); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 to operate"); - var isFMCloseSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMCloseSupported != null || isFMCloseSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + isFMCloseSupported); - expect(isFMCloseSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 to operate"); - var SetFMClose = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMClose)) - if (SetFMClose == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 - * @tc.name : get flash mode close camera0 api - * @tc.desc : get flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 to operate"); - var GetFMClose = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 success"); - if (GetFMClose == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMClose); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - //ZOOM Function - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 - * @tc.name : get zoom ratio camera-0 cameraId api promise api - * @tc.desc : get zoom ratio camera-0 cameraId api promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100--------------"); - var getZoomRatioPromise = await camera0InputPromise.getZoomRatioRange(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 getZoomRatioPromise: " + JSON.stringify(getZoomRatioPromise)); - if (getZoomRatioPromise != null && getZoomRatioPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 setZoomRatioPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 success: " + JSON.stringify(getZoomRatioPromise)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(1); - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - var getpromise1 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise1); - if (getpromise1 != null && getpromise1 != undefined) { - expect(getpromise1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(2); - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - var getpromise2 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise2); - if (getpromise2 != null && getpromise2 != undefined) { - expect(getpromise2).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(3); - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - var getpromise3 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise3); - if (getpromise3 != null && getpromise3 != undefined) { - expect(getpromise3).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(4); - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - var getpromise4 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise4); - if (getpromise4 != null && getpromise4 != undefined) { - expect(getpromise4).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(5); - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - var getpromise5 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise5); - if (getpromise5 != null && getpromise5 != undefined) { - expect(getpromise5).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(6); - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - var getpromise6 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise6); - if (getpromise6 != null && getpromise6 != undefined) { - expect(getpromise6).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - // FOCUS promise API's - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 - * @tc.name : check is focus mode locked supported-camera0Input api - * @tc.desc : check is focus mode locked supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 to operate"); - var isFMLockedSupported = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering is focus mode locked supported SUCCESS "); - if (isFMLockedSupported != null || isFMLockedSupported != undefined) { - console.info(TAG + "Entering is focus mode locked supported data is not null || undefined"); - console.info(TAG + "is focus mode locked supported : " + isFMLockedSupported); - expect(isFMLockedSupported).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED) - .then(function (data) { - console.info(TAG + "SetFMLocked: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode locked SUCCESS, current focusmode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 FAILED : ") - expect().assertFail(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 ends here"); - }); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode locked success: "); - if (data == 0) { - console.info(TAG + "Current focusmode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 ends here"); - }); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 - * @tc.name : get focal length camera0 api - * @tc.desc : get focal length camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 to operate"); - await camera0InputPromise.getFocalLength() - .then(function (data) { - console.info(TAG + "Current focallength is: " + JSON.stringify(data)); - expect(data).assertEqual(3.4600000381469727); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 - * @tc.name : is focusmode manual supported - * @tc.desc : is focusmode manual supported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 to operate"); - var isFMmanualSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL); - if (isFMmanualSupportedpromise != null || isFMmanualSupportedpromise != undefined) { - console.info(TAG + "Entering is focusmode manual supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMmanualSupportedpromise); - expect(isFMmanualSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL) - .then(function (data) { - console.info(TAG + "setFocusManual: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode manual SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode manual SUCCESS"); - if (data == 0) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 ends here"); - }); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 FAILED " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 - * @tc.name : check is focus mode continuous supported-camera0Input api - * @tc.desc : check is focus mode continuous supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 to operate"); - var isFMContinuousSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - if (isFMContinuousSupportedpromise != null || isFMContinuousSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode continuous supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINUOUS_SUPPORTED is: " + isFMContinuousSupportedpromise); - expect(isFMContinuousSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) - .then(function (data) { - console.info(TAG + "setFocusCont: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode continuous SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode continuous SUCCESS"); - if (data == 1) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 - * @tc.name : check is focus mode auto supported-camera0Input api - * @tc.desc : check is focus mode auto supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 to operate"); - var isFMAutoSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (isFMAutoSupportedpromise != null || isFMAutoSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode auto supported data is not null || undefined"); - console.info(TAG + "is focus mode auto supported is: " + isFMAutoSupportedpromise); - expect(isFMAutoSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 to operate"); - var setFocusAuto = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO) - .then(function () { - console.info(TAG + "setFocusAuto: " + JSON.stringify(setFocusAuto)) - console.info(TAG + "Entering set focus mode auto SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 FAILED : "); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 to operate"); - var getfocusmodepromise = await camera0InputPromise.getFocusMode(); - console.info(TAG + "Entering get focus mode auto SUCCESS"); - if (getfocusmodepromise == 2) { - console.info(TAG + "Current FocusMode is: " + getfocusmodepromise); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode locked SUCCESS"); - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 mode locked - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 to operate"); - await camera0InputPromise.setExposurePoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 mode locked - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100_exposure mode locked - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureBiasRange() - .then(function (data) { - console.info(TAG + "Entering getExposureBiasRange SUCCESS"); - console.info(TAG + "Current ExposureBiasRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 mode locked - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 to operate"); - await camera0InputPromise.setExposureBias(-4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 mode locked - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 mode auto - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 to operate"); - await camera0InputPromise.setExposurePoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 FAILED: " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 mode auto - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 mode auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 to operate"); - await camera0InputPromise.setExposureBias(1) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 mode auto - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 to operate"); - await camera0InputPromise.setExposurePoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 mode continuous auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 to operate"); - await camera0InputPromise.setExposureBias(4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 - * @tc.name : VideoOutput start promise api - * @tc.desc : VideoOutput start promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video Output start videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 to operate') - await videoOutputPromise.start() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 - * @tc.name : VideoOutput stop promise api - * @tc.desc : VideoOutput stop promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video Output Stop videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 to operate') - await videoOutputPromise.stop() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 - * @tc.name : CaptureSession stop promise api - * @tc.desc : CaptureSession stop promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + 'Entering Capture Session Stop captureSessionPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 to operate') - await captureSessionPromise.stop() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 - * @tc.name : CaptureSession release promise api - * @tc.desc : CaptureSession release promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + 'Entering Capture session release captureSessionPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 to operate') - await captureSessionPromise.release() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : videoOutput release api - * @tc.desc : videoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + "Entering Video Output release previewOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await videoOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : PreviewOutput release api - * @tc.desc : PreviewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering previewOutputPromise.release previewOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await previewOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : cameraInput release api - * @tc.desc : cameraInput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering camera0InputPromise.release camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await camera0InputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1) - done() - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngle/src/main/resources/base/element/string.json b/multimedia/camera/cameraWideAngle/src/main/resources/base/element/string.json deleted file mode 100644 index b93f540e29265a34f883a977c442fa85349b94ca..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngle/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "description_mainability", - "value": "eTS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngleRK/BUILD.gn b/multimedia/camera/cameraWideAngleRK/BUILD.gn deleted file mode 100644 index 1e1381e93272de16723c5990dbf07c232db3b0a2..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngleRK/BUILD.gn +++ /dev/null @@ -1,34 +0,0 @@ -# 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("camera_wideanglerk_ets_hap") { - hap_profile = "./src/main/config.json" - deps = [ - ":camera_ets_assets", - ":camera_ets_resources", - ] - ets2abc = true - - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsCameraWideAngleRKETSTest" - subsystem_name = "multimedia" - part_name = "multimedia_camera_standard" -} -ohos_js_assets("camera_ets_assets") { - source_dir = "./src/main/ets/MainAbility" -} -ohos_resources("camera_ets_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/multimedia/camera/cameraWideAngleRK/Test.json b/multimedia/camera/cameraWideAngleRK/Test.json deleted file mode 100644 index b83f183916aa5333ab93da1173561e76b4e9241c..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngleRK/Test.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "description": "Configuration for camerastandard WideAngleRK Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "1000000", - "package": "com.open.harmony.multimedia.camerawarktest", - "shell-timeout": "60000" - }, - "kits": [ - { - "type": "ShellKit", - "run-command": [ - "touch /data/media/01.mp4", - "chmod -R 777 /data/media" - - ], - "teardown-command":[ - - ] - }, - { - "test-file-name": [ - "ActsCameraWideAngleRKETSTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngleRK/signature/openharmony_sx.p7b b/multimedia/camera/cameraWideAngleRK/signature/openharmony_sx.p7b deleted file mode 100644 index 0625db92101ca16c7becfaf2d4008ea2e96078e1..0000000000000000000000000000000000000000 Binary files a/multimedia/camera/cameraWideAngleRK/signature/openharmony_sx.p7b and /dev/null differ diff --git a/multimedia/camera/cameraWideAngleRK/src/main/config.json b/multimedia/camera/cameraWideAngleRK/src/main/config.json deleted file mode 100644 index f357f71f1be5e9b272b4f741c22ff78e5198403b..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngleRK/src/main/config.json +++ /dev/null @@ -1,101 +0,0 @@ -{ - "app": { - "bundleName": "com.open.harmony.multimedia.camerawarktest", - "vendor": "open", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.open.harmony.multimedia.camerawarktest", - "name": ".MyApplication", - "mainAbility": "com.open.harmony.multimedia.camerawarktest.MainAbility", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "formsEnabled": false, - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "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.CAMERA", - "reason": "use ohos.permission.CAMERA" - }, - { - "name": "ohos.permission.MICROPHONE", - "reason": "use ohos.permission.MICROPHONE" - }, - { - "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" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/app.ets b/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/app.ets deleted file mode 100644 index a9f8218978fad817d4519aa1b715da0e3f8ebbfc..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('Application onCreate') - }, - onDestroy() { - console.info('Application onDestroy') - }, -} diff --git a/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/pages/index.ets b/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index ca96b03e80e49976adf3f876fadb4d82d574c6ef..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,74 +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 {Core, ExpectExtend} from "deccjsunit/index" -import cameraKit from "../test/Camera.test" -import featureAbility from "@ohos.ability.featureAbility" - -let TAG = 'CameraModuleTest: ' -var mXComponentController: XComponentController = new XComponentController() -var surfaceId: any - -@Entry -@Component -struct CameraIndex { - @State isShowSettings: boolean = false - @State previewSize: string = '75%' - - aboutToAppear() { - console.info('--------------aboutToAppear--------------') - } - - build() { - Flex() { - XComponent({ - id: '', - type: 'surface', - libraryname: '', - controller: mXComponentController - }) - .onLoad(() => { - console.info('CameraModuleTest: OnLoad() is called!') - mXComponentController.setXComponentSurfaceSize({ surfaceWidth: 1920, surfaceHeight: 1080 }); - surfaceId = mXComponentController.getXComponentSurfaceId() - console.info('CameraModuleTest: XComponent onLoad surfaceId: ' + surfaceId) - featureAbility.getWant() - .then((Want) => { - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - console.info(TAG + 'Entering expectExtend') - core.addService('expect', expectExtend) - console.info(TAG + 'Entering addService') - core.init() - console.info(TAG + 'Entering core.init()') - console.info(TAG + 'Entering subscribeEvent') - const configService = core.getDefaultService('config') - configService.setConfig(Want.parameters) - console.info(TAG + 'Entering configService') - cameraKit(surfaceId) - core.execute() - console.info(TAG + 'Operation successful. Data: ' + JSON.stringify(Want)); - }) - .catch((error) => { - console.error(TAG + 'Operation failed. Cause: ' + JSON.stringify(error)); - }) - }) - .width('1920px') - .height('1080px') - } - } -} diff --git a/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/Camera.test.ets b/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/Camera.test.ets deleted file mode 100644 index 2743a3a6f94f359e98785fa0a21bf1518e7a9859..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/Camera.test.ets +++ /dev/null @@ -1,35 +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 cameraJSUnitEnum from './CameraJSUnitEnum.test.ets' -import cameraJSUnitCameraFormat from './CameraJSUnitCameraFormat.test.ets' -import cameraJSUnitPhotoAsync from './CameraJSUnitPhotoAsync.test.ets' -import cameraJSUnitPhotoPromise from './CameraJSUnitPhotoPromise.test.ets' -import cameraJSUnitVideoAsync from './CameraJSUnitVideoAsync.test.ets' -import cameraJSUnitVideoPromise from './CameraJSUnitVideoPromise.test.ets' - -let TAG = 'CameraModuleTest: ' - -export default function cameraKit(surfaceId: any) { - console.info(TAG + 'Entering cameraKit') - console.info(TAG + 'surfaceId: ' + surfaceId) - - cameraJSUnitEnum(surfaceId) - cameraJSUnitCameraFormat(surfaceId) - cameraJSUnitPhotoAsync(surfaceId) - cameraJSUnitPhotoPromise(surfaceId) - cameraJSUnitVideoAsync(surfaceId) - cameraJSUnitVideoPromise(surfaceId) -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets b/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets deleted file mode 100644 index 89d94d2fe68a3bc833bde4c7fca420c21476d022..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets +++ /dev/null @@ -1,874 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables - -var cameraManager; -var surfaceId1; -var camerasArray; - -// CAMERA-0 Variables -var camera0Input; -var camera0InputPromise, camera0InputPromisePosBack, camera0InputPromisePosFront; - -export default function cameraJSUnitCameraFormat(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJsUnitCameraFormat', function () { - console.info(TAG + '----------CameraJsUnitCameraFormat--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 data is not null || undefined"); - cameraManager = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------"); - var cameraManagerPromise = await cameraObj.getCameraManager(null); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 cameraManagerPromise: " + JSON.stringify(cameraManagerPromise)); - if (cameraManagerPromise != null && cameraManagerPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Get camera from cameramanager to get array of camera async api - * @tc.desc : Get camera from cameramanager to get array of camera async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------"); - cameraManager.getCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 data is not null || undefined"); - camerasArray = data; - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArray[i].cameraPosition; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArray[i].cameraType; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Type: " + cameraType); - var connectionType = camerasArray[i].connectionType - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 - * @tc.name : Get camera from cameramanager to get array of camera promise api - * @tc.desc : Get camera from cameramanager to get array of camera promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100--------------"); - var camerasArrayPromise = await cameraManager.getCameras(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100: " + JSON.stringify(camerasArrayPromise)); - if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 success"); - for (var i = 0; i < camerasArrayPromise.length; i++) { - // Get the variables from camera object - var cameraId = camerasArrayPromise[i].cameraId; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArrayPromise[i].cameraPosition; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArrayPromise[i].cameraType; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 camera" + i + "Type: " + cameraType); - var connectionType = camerasArrayPromise[i].connectionType - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info("--------------CAMERA-0 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------"); - cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera0Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[0].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraId promise api - * @tc.desc : Create camerainput from camera-0 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera0InputPromise = await cameraManager.createCameraInput(camerasArray[0].cameraId); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera0InputPromise: " + JSON.stringify(camera0InputPromise)); - if (camera0InputPromise != null && camera0InputPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 camera0InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 - * @tc.name : get camera if from camera-0 input async api - * @tc.desc : get camera if from camera-0 input async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100', 0, async function (done) { - camera0Input.getCameraId(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 data is not null || undefined"); - var CameraId0 = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 PASSED with CameraID :" + CameraId0); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 - * @tc.name : get camera if from camera-0 input promise api - * @tc.desc : get camera if from camera-0 input promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100', 0, async function (done) { - var camera0IdPromise = await camera0InputPromise.getCameraId(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 camera0IdPromise: " + JSON.stringify(camera0IdPromise)); - if (camera0IdPromise != null && camera0IdPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 camera0IdPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 PASSED" + camera0IdPromise); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_ID_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput async api - * @tc.desc : Get supported preview formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera0InputPromise.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null && data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromise = await camera0InputPromise.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromise)); - if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam0FormatPromise: " + cam0FormatPromise[i]); - expect(cam0FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported video formats from camera-0 camerainput async api - * @tc.desc : Get supported video formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromise.getSupportedVideoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 success"); - if (data != null && data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 - * @tc.name : Get supported video formats from camera-0 camerainput promise api - * @tc.desc : Get supported video formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromise = await camera0InputPromise.getSupportedVideoFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromise)); - if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 cam0FormatPromise: " + cam0FormatPromise[i]); - expect(cam0FormatPromise[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_VIDEO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-0 camerainput async api - * @tc.desc : Get supported photo format from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromise.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-0 camerainput promise api - * @tc.desc : Get supported photo format from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromise = await camera0InputPromise.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromise)); - if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromise.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam0FormatPromise: " + cam0FormatPromise[i]); - expect(cam0FormatPromise[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput async api - * @tc.desc : Get supported preview formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosBack = await camera0InputPromisePosBack.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosBack)); - if (cam0FormatPromisePosBack != null && cam0FormatPromisePosBack.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam0FormatPromisePosBack: " + cam0FormatPromisePosBack[i]); - expect(cam0FormatPromisePosBack[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-0 camerainput async api - * @tc.desc : Get supported photo format from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-0 camerainput promise api - * @tc.desc : Get supported photo format from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosBack = await camera0InputPromisePosBack.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosBack)); - if (cam0FormatPromisePosBack != null && cam0FormatPromisePosBack.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosBack.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam0FormatPromisePosBack: " + cam0FormatPromisePosBack[i]); - expect(cam0FormatPromisePosBack[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput async api - * @tc.desc : Get supported preview formats from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 success"); - if (data != null || data.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(1003); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 - * @tc.name : Get supported preview formats from camera-0 camerainput promise api - * @tc.desc : Get supported preview formats from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosFront = await camera0InputPromisePosFront.getSupportedPreviewFormats(); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosFront)); - if (cam0FormatPromisePosFront != null && cam0FormatPromisePosFront.length > 0) { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 cam0FormatPromisePosFront: " + cam0FormatPromisePosFront[i]); - expect(cam0FormatPromisePosFront[i]).assertEqual(1003); - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info("CameraModuleTest: Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 - * @tc.name : Get supported photo format from camera-0 camerainput async api - * @tc.desc : Get supported photo format from camera-0 camerainput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100--------------"); - camera0InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 data is not null || undefined"); - for (var i = 0; i < data.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 cameraFormat: " + data[i]); - expect(data[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 PASSED"); - } - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 FAILED: " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 - * @tc.name : Get supported photo format from camera-0 camerainput promise api - * @tc.desc : Get supported photo format from camera-0 camerainput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100--------------"); - var cam0FormatPromisePosFront = await camera0InputPromisePosFront.getSupportedPhotoFormats(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100: " + JSON.stringify(cam0FormatPromisePosFront)); - if (cam0FormatPromisePosFront != null && cam0FormatPromisePosFront.length > 0) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 is not null || undefined"); - for (var i = 0; i < cam0FormatPromisePosFront.length; i++) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 cam0FormatPromisePosFront: " + cam0FormatPromisePosFront[i]); - expect(cam0FormatPromisePosFront[i]).assertEqual(2000); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_SUPPORTED_PHOTO_FORMATS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0InputPromise.on("focusStateChange", async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE WIDE ANGLE*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition front & cameratype wide angle async api - * @tc.desc : Create camerainput from cameraposition front & cameratype wide angle async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100--------------"); - cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100 success"); - var camInput = data; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100 camInput: " + JSON.stringify(camInput)); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100 FAILED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100 PASSED: " + err.message); - expect(true).assertTrue(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_CALLBACK_0100 - * @tc.name : Create camerainput from cameraposition front & cameratype wide angle promise api - * @tc.desc : Create camerainput from cameraposition front & cameratype wide angle promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_CALLBACK_0100--------------"); - await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE) - .then(function () { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_CALLBACK_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_CALLBACK_0100 PASSED : " + err.message); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets b/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets deleted file mode 100644 index 407b13482e0dcd7b1391e5f98c599b465fdc5bc4..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets +++ /dev/null @@ -1,497 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables - -var cameraManager; -var surfaceId1; -var camerasArray; - -var camera0Input; - -export default function cameraJSUnitEnum(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJSUnitEnum', function () { - console.info(TAG + '----------CameraJSUnitEnum--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 data is not null || undefined"); - cameraManager = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Get camera from cameramanager to get array of camera async api - * @tc.desc : Get camera from cameramanager to get array of camera async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------"); - cameraManager.getCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 data is not null || undefined"); - camerasArray = data; - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArray[i].cameraPosition; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArray[i].cameraType; - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 camera" + i + "Type: " + cameraType); - var connectionType = camerasArray[i].connectionType - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100', 0, async function (done) { - console.info("--------------CAMERA-0 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100--------------"); - cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 data is not null || undefined"); - camera0Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 PASSED with CameraID :" + camerasArray[0].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_0100 - * @tc.name : camera status ENAME - * @tc.desc : camera status ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_0100------------"); - console.info(TAG + "CameraStatus CAMERA_STATUS_APPEAR : " + cameraObj.CameraStatus.CAMERA_STATUS_APPEAR); - expect(cameraObj.CameraStatus.CAMERA_STATUS_APPEAR).assertEqual(0); - console.info(TAG + "CameraStatus CAMERA_STATUS_DISAPPEAR : " + cameraObj.CameraStatus.CAMERA_STATUS_DISAPPEAR); - expect(cameraObj.CameraStatus.CAMERA_STATUS_DISAPPEAR).assertEqual(1); - console.info(TAG + "CameraStatus CAMERA_STATUS_AVAILABLE : " + cameraObj.CameraStatus.CAMERA_STATUS_AVAILABLE) - expect(cameraObj.CameraStatus.CAMERA_STATUS_AVAILABLE).assertEqual(2); - console.info(TAG + "CameraStatus CAMERA_STATUS_UNAVAILABLE : " + cameraObj.CameraStatus.CAMERA_STATUS_UNAVAILABLE) - expect(cameraObj.CameraStatus.CAMERA_STATUS_UNAVAILABLE).assertEqual(3); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_POSITION_0100 - * @tc.name : Camera position ENAME - * @tc.desc : Camera position ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_POSITION_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CAMERA_POSITION_0100------------") - console.info(TAG + "CameraPosition CAMERA_POSITION_BACK : " + cameraObj.CameraPosition.CAMERA_POSITION_BACK); - expect(cameraObj.CameraPosition.CAMERA_POSITION_BACK).assertEqual(1); - console.info(TAG + "CameraPosition CAMERA_POSITION_FRONT : " + cameraObj.CameraPosition.CAMERA_POSITION_FRONT); - expect(cameraObj.CameraPosition.CAMERA_POSITION_FRONT).assertEqual(2); - console.info(TAG + "CameraPosition CAMERA_POSITION_UNSPECIFIED : " + cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED); - expect(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED).assertEqual(0); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_TYPE_0100 - * @tc.name : camera type ENAME - * @tc.desc : camera type ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_TYPE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CAMERA_TYPE_0100------------") - console.info(TAG + "CameraType CAMERA_TYPE_UNSPECIFIED : " + cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); - expect(cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED).assertEqual(0); - console.info(TAG + "CameraType CAMERA_TYPE_WIDE_ANGLE : " + cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE); - expect(cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE).assertEqual(1); - console.info(TAG + 'CameraType CAMERA_TYPE_ULTRA_WIDE : ' + cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE); - expect(cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE).assertEqual(2); - console.info(TAG + 'CameraType CAMERA_TYPE_TELEPHOTO : ' + cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO); - expect(cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO).assertEqual(3); - console.info(TAG + 'CameraType CAMERA_TYPE_TRUE_DEPTH : ' + cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH) - expect(cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH).assertEqual(4); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CONNECTION_TYPE_0100 - * @tc.name : connection type ENAME - * @tc.desc : connection type ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CONNECTION_TYPE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_CONNECTION_TYPE_0100------------") - console.info(TAG + "ConnectionType CAMERA_CONNECTION_BUILT_IN : " + cameraObj.ConnectionType.CAMERA_CONNECTION_BUILT_IN); - expect(cameraObj.ConnectionType.CAMERA_CONNECTION_BUILT_IN).assertEqual(0); - console.info(TAG + "ConnectionType CAMERA_CONNECTION_USB_PLUGIN : " + cameraObj.ConnectionType.CAMERA_CONNECTION_USB_PLUGIN); - expect(cameraObj.ConnectionType.CAMERA_CONNECTION_USB_PLUGIN).assertEqual(1); - console.info(TAG + "ConnectionType CAMERA_CONNECTION_REMOTE : " + cameraObj.ConnectionType.CAMERA_CONNECTION_REMOTE); - expect(cameraObj.ConnectionType.CAMERA_CONNECTION_REMOTE).assertEqual(2); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FLASHMODE_0100 - * @tc.name : Flash Mode ENAME - * @tc.desc : Flash Mode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FLASHMODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_FLASHMODE_0100------------") - console.info(TAG + "FlashMode FLASH_MODE_CLOSE : " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); - console.info(TAG + "FlashMode FLASH_MODE_OPEN : " + cameraObj.FlashMode.FLASH_MODE_OPEN); - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - console.info(TAG + "FlashMode FLASH_MODE_AUTO : " + cameraObj.FlashMode.FLASH_MODE_AUTO); - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); - console.info(TAG + "FlashMode FLASH_MODE_ALWAYS_OPEN : " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSMODE_0100 - * @tc.name : Focus Mode ENAME - * @tc.desc : Focus Mode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSMODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_FOCUSMODE_0100------------") - console.info(TAG + "FocusMode FOCUS_MODE_MANUAL : " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0); - console.info(TAG + "FocusMode FOCUS_MODE_CONTINUOUS_AUTO : " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); - console.info(TAG + "FocusMode FOCUS_MODE_AUTO : " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); - console.info(TAG + "FocusMode FOCUS_MODE_LOCKED : " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - expect(cameraObj.FocusMode.FOCUS_MODE_LOCKED).assertEqual(3); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATE_0100 - * @tc.name : Focus State ENAME - * @tc.desc : Focus State ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_FOCUSSTATE_0100------------") - console.info(TAG + "FocusState FOCUS_STATE_SCAN : " + cameraObj.FocusState.FOCUS_STATE_SCAN); - expect(cameraObj.FocusState.FOCUS_STATE_SCAN).assertEqual(0); - console.info(TAG + "FocusState FOCUS_STATE_FOCUSED : " + cameraObj.FocusState.FOCUS_STATE_FOCUSED); - expect(cameraObj.FocusState.FOCUS_STATE_FOCUSED).assertEqual(1); - console.info(TAG + "FocusState FOCUS_STATE_UNFOCUSED : " + cameraObj.FocusState.FOCUS_STATE_UNFOCUSED); - expect(cameraObj.FocusState.FOCUS_STATE_UNFOCUSED).assertEqual(2); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IMAGEROTATION_0100 - * @tc.name : Image Rotation ENAME - * @tc.desc : Image Rotation ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IMAGEROTATION_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_IMAGEROTATION_0100------------") - console.info(TAG + "ImageRotation ROTATION_0 : " + cameraObj.ImageRotation.ROTATION_0); - expect(cameraObj.ImageRotation.ROTATION_0).assertEqual(0); - console.info(TAG + "ImageRotation ROTATION_90 : " + cameraObj.ImageRotation.ROTATION_90); - expect(cameraObj.ImageRotation.ROTATION_90).assertEqual(90); - console.info(TAG + "ImageRotation ROTATION_180 : " + cameraObj.ImageRotation.ROTATION_180); - expect(cameraObj.ImageRotation.ROTATION_180).assertEqual(180); - console.info(TAG + "ImageRotation ROTATION_270 : " + cameraObj.ImageRotation.ROTATION_270); - expect(cameraObj.ImageRotation.ROTATION_270).assertEqual(270); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_QUALITYLEVEL_0100 - * @tc.name : Quality Level ENAME - * @tc.desc : Quality Level ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_QUALITYLEVEL_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERA_QUALITYLEVEL_0100------------") - console.info(TAG + "QualityLevel QUALITY_LEVEL_HIGH : " + cameraObj.QualityLevel.QUALITY_LEVEL_HIGH); - expect(cameraObj.QualityLevel.QUALITY_LEVEL_HIGH).assertEqual(0); - console.info(TAG + "QualityLevel QUALITY_LEVEL_MEDIUM : " + cameraObj.QualityLevel.QUALITY_LEVEL_MEDIUM); - expect(cameraObj.QualityLevel.QUALITY_LEVEL_MEDIUM).assertEqual(1); - console.info(TAG + "QualityLevel QUALITY_LEVEL_LOW : " + cameraObj.QualityLevel.QUALITY_LEVEL_LOW); - expect(cameraObj.QualityLevel.QUALITY_LEVEL_LOW).assertEqual(2); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100 - * @tc.name : CameraInputErrorCode ENAME - * @tc.desc : CameraInputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100 : " + cameraObj.CameraInputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.CameraInputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100 - * @tc.name : CaptureSessionErrorCode ENAME - * @tc.desc : CaptureSessionErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100 : " + cameraObj.CaptureSessionErrorCode.ERROR_UNKNOWN); - expect(cameraObj.CaptureSessionErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100 - * @tc.name : PreviewOutputErrorCode ENAME - * @tc.desc : PreviewOutputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100 : " + cameraObj.PreviewOutputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.PreviewOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100 - * @tc.name : PhotoOutputErrorCode ENAME - * @tc.desc : PhotoOutputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100 : " + cameraObj.PhotoOutputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.PhotoOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100 - * @tc.name : VideoOutputErrorCode ENAME - * @tc.desc : VideoOutputErrorCode ENAME - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100', 0, async function (done) { - console.info(TAG + "--------------SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100------------") - console.info(TAG + "QualityLevel SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100 : " + cameraObj.VideoOutputErrorCode.ERROR_UNKNOWN); - expect(cameraObj.VideoOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); - await sleep(1000); - done(); - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets b/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets deleted file mode 100644 index 542aec1cb0227074d35be70f9e8bf261419da2af..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets +++ /dev/null @@ -1,3511 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables -var camera0Input; -var camera1Input; -var cameraManager; -var previewOutputAsync; -var photoOutputAsync; -var captureSession; -var surfaceId1; -var camerasArray; - -var Point1 = { x: 1, y: 1 } -var Point2 = { x: 2, y: 2 } -var Point3 = { x: 3, y: 3 } - -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -export default function cameraJSUnitPhotoAsync(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJsUnitPhotoAsync', function () { - console.info(TAG + '----------CameraJsUnitPhotoAsync--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - console.info(TAG + "----------Camera-Precision Control-Async-------------"); - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100--------------"); - cameraObj.getCameraManager(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Camera Manager success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering Camera Manager data is not null || undefined"); - cameraManager = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManager == null || cameraManager == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManager == null || undefined") - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate") - cameraManager.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManager is success"); - if (data != null || data != undefined) { - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Get camera from cameramanager to get array of camera async api - * @tc.desc : Get camera from cameramanager to get array of camera async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------"); - cameraManager.getCameras(async (err, data) => { - if (!err) { - console.info(TAG + "Entering GetCameras success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering GetCameras data is not null || undefined"); - camerasArray = data; - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId; - console.info(TAG + "Entering GetCameras camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArray[i].cameraPosition; - console.info(TAG + "Entering GetCameras camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArray[i].cameraType; - console.info(TAG + "Entering GetCameras camera" + i + "Type: " + cameraType); - var connectionType = camerasArray[i].connectionType - console.info(TAG + "Entering GetCameras connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined"); - } - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 data is not null || undefined"); - camera0Input = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :" + camerasArray[0].cameraId); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering CameraInputCallbackOnError cameraInput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 to operate"); - camera0Input.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "cameraInput error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - } - await sleep(1000); - done(); - }) - - /*PreviewOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 - * @tc.name : Create PreviewOutput instance api - * @tc.desc : Create PreviewOutput instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100', 0, async function (done) { - console.info(TAG + " Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 to operate"); - cameraObj.createPreviewOutput(surfaceId, async (err, data) => { - if (!err) { - console.info(TAG + " Entering createPreviewOutput success"); - if (data != null || data != undefined) { - console.info(TAG + " Entering createPreviewOutput data is not null || undefined"); - previewOutputAsync = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 PASSED" + previewOutputAsync); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 FAILED : " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 - * @tc.name : Preview output callback on error api - * @tc.desc : Preview output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering PreviewOutputError callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 to operate"); - previewOutputAsync.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 - * @tc.name : Create PhotoOutput instance api - * @tc.desc : Create PhotoOutput instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1000) - cameraObj.createPhotoOutput(surfaceId1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering createPhotoOutput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering createPhotoOutput data is not null || undefined"); - photoOutputAsync = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 to operate"); - photoOutputAsync.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error during PhotoOutput with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 - * @tc.name : Create CaptureSession instance api - * @tc.desc : Create CaptureSession instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 to operate"); - cameraObj.createCaptureSession(null, async (err, data) => { - if (!err) { - console.info(TAG + "Entering createCaptureSession success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering createCaptureSession data is not null || undefined"); - captureSession = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - //Capturesession callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 - * @tc.name : CaptureSession callback on error api - * @tc.desc : CaptureSession callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering captureSession error callback captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 to operate"); - captureSession.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Error in SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 - * @tc.name : CaptureSession_Begin config api - * @tc.desc : CaptureSession_Begin config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering BeginConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 to operate"); - captureSession.beginConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering beginConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering BeginConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 beginConfig PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Preview captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 to operate"); - captureSession.addOutput(previewOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Preview : Success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Preview data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 to operate"); - captureSession.removeOutput(previewOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove preview Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove preview Output FAILED" + err.message); - console.info(TAG + "Entering Remove Preview Output ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Preview captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 to operate"); - captureSession.addOutput(previewOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Preview : Success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Preview data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CommitConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 to operate"); - captureSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering commitConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering CommitConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 to operate"); - photoOutputAsync.isMirrorSupported(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 to operate"); - photoOutputAsync.setMirror(true, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 - * @tc.name : setMirror false - * @tc.desc : setMirror false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 to operate"); - photoOutputAsync.setMirror(false, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 is success"); - console.info(TAG + "setMirror is : " + 'false'); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 - * @tc.name : CaptureSession_Begin config api - * @tc.desc : CaptureSession_Begin config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering BeginConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 to operate"); - captureSession.beginConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering beginConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering BeginConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 beginConfig PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering Addinput captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 to operate"); - captureSession.addInput(camera0Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddInput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddInput data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 addInput PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 to operate"); - captureSession.removeOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove photo Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove photo Output FAILED" + err.message); - console.info(TAG + "Entering Remove photo Output ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CommitConfig captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 to operate"); - captureSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + "Entering commitConfig success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering CommitConfig data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0Input.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0Input.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //preview callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering PreviewStart frameStart Callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 to operate"); - previewOutputAsync.on("frameStart", async (err, data) => { - if (!err) { - console.info(TAG + "PreviewStart frameStart Callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 FAILED : + err.message"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 - * @tc.name : Preview capture callback on frame end api - * @tc.desc : Preview capture callback on frame end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering PreviewOutput frameEnd Callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 to operate"); - previewOutputAsync.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 Callback is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 FAILED : + err.message"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering Photo Capture Callback on CaptureStart photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 to operate"); - photoOutputAsync.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "Photo Capture Callback on CaptureStart is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 to operate"); - photoOutputAsync.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 FAILED' + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 to operate"); - photoOutputAsync.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "frameShutter callback with captureId: " + data.captureId); - console.info(TAG + "frameShutter callback with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 - * @tc.name : capture session start api - * @tc.desc : capture session start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CaptureSession Start captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 to operate"); - captureSession.start(async (err, data) => { - if (!err) { - console.info(TAG + "Entering captureSession.start success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 PASSED"); - } - else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //Location - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - photoOutputAsync.capture(photosettings1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings1"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 - * @tc.name : Photo output capture with photosettings2 api - * @tc.desc : Photo output capture with photosettings2 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 to operate"); - photoOutputAsync.capture(photosettings2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings2 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 to operate"); - photoOutputAsync.capture(photosettings3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings3 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings3 data is not null || undefined"); - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 ends here"); - } - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS with Rotation-270 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 to operate"); - photoOutputAsync.capture(photosettings4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings4 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings4 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 ends here"); - } - }) - await sleep(1000); - done(); - } - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100', 0, async function (done) { - console.info(TAG + "hasFlash called.") - camera0Input.hasFlash(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 is: " + data); - expect(data).assertEqual(true); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 FAILED : " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 ends here"); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 success"); - if (data == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_ALWAYS_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 success"); - if (data == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check if flash mode auto is supported-camera0Input api - * @tc.desc : check if flash mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_AUTO SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 success"); - if (data == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_CLOSE SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 success"); - if (data == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 - * @tc.name : get zoom ratio camera-0 cameraId api - * @tc.desc : get zoom ratio camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100--------------"); - camera0Input.getZoomRatioRange(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 Success " + data) - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_0100 ends here"); - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(1, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(2, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_0100 PASSED "); - } - else { - expect().assertFail(); - console.info(TAG + "GET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - } else { - expect().assertFail(); - console.info(TAG + "SET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(3, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(4, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(5, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_0100', 0, async function (done) { - camera0Input.setZoomRatio(6, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 - * @tc.name : check if focus mode locked is supported-camera0Input api - * @tc.desc : check if focus mode locked is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Is Focus Mode Locked Supported SUCCESS: " + data); - if (data != null || data != undefined) { - console.info(TAG + "Entering Is Focus Mode Locked Supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_LOCKED_SUPPORTED is: " + data); - expect(data).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 FAILED :" + err.message); - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Mode Locked SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 FAILED : ") - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Mode Locked SUCCESS: " + data); - console.info(TAG + "Get Focus Mode Locked data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 - * @tc.name : get focal length camera0 api - * @tc.desc : get focal length camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 to operate"); - camera0Input.getFocalLength(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focal length SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focal length is: " + JSON.stringify(data)); - expect(data).assertEqual(3.4600000381469727); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_FOCUS_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_FOCUS_0100', 0, async function (done) { - console.info(TAG + "Entering SET_FOCUS_POINT to operate"); - camera0Input.setFocusPoint(Point1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SET_FOCUS_POINT PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SET_FOCUS_POINT FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SET_FOCUS_POINT ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_FOCUS_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_FOCUS_0100', 0, async function (done) { - console.info(TAG + "Entering GET_FOCUS_POINT to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "GET_FOCUS_POINT PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "GET_FOCUS_POINT FAILED : " + err.message); - console.info(TAG + "GET_FOCUS_POINT ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 - * @tc.name : check if focus mode manual is supported-camera0Input api - * @tc.desc : check if focus mode manual is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 FAILED " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 - * @tc.name : set focus Point locked camera0 api - * @tc.desc : set focus Point locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 to operate"); - camera0Input.setFocusPoint(Point2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 - * @tc.name : check if focus mode continuous is supported-camera0Input api - * @tc.desc : check if focus mode continuous is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINOUS_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 to operate"); - camera0Input.setFocusPoint(Point3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : GET_FOCUS_POINT_focus mode auto - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check if focus mode auto is supported-camera0Input api - * @tc.desc : check if focus mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_AUTO_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (data != null || data != undefined) { - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 PASSED") - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 to operate"); - camera0Input.getExposureBiasRange(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias range SUCCESS"); - console.info(TAG + "Current Exposure bias range is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 -4 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 to operate"); - camera0Input.setExposureBias(-4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 mode locked - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 mode auto - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 to operate"); - camera0Input.setExposurePoint(Point1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 mode auto - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure Mode SUCCESS"); - console.info(TAG + "Get Exposure Mode data is not null || undefined: "); - console.info(TAG + "Current ExposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 mode auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 to operate"); - camera0Input.setExposureBias(1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "1"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 mode auto - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 to operate"); - camera0Input.setExposurePoint(Point2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - photoOutputAsync.capture(photosettings1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings1"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 mode auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 to operate"); - camera0Input.setExposureBias(4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 mode continuous auto - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 to operate"); - camera0Input.setExposurePoint(Point3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 to operate"); - photoOutputAsync.capture(photosettings2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture with photosettings2"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 -5 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 to operate"); - camera0Input.setExposureBias(-5, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 mode locked - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 6 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 to operate"); - camera0Input.setExposureBias(6, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_0500 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 - * @tc.name : capture session stop api - * @tc.desc : capture session stop api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 to operate"); - captureSession.stop(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 captureSession.stop success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering captureSession.stop data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 captureSession.stop PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 - * @tc.name : capture session release api - * @tc.desc : capture session release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 to operate"); - captureSession.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering captureSession.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering captureSession.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_0100 ends here"); - await sleep(1000); - done(); - } - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 - * @tc.name : photoOutput release api - * @tc.desc : photoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 photoOutputAsync == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 to operate"); - photoOutputAsync.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutputAsync.release success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_0100 FAILED: " + err.message); - console.info(TAG + "Entering photoOutputAsync.release ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 - * @tc.name : previewOutput release api - * @tc.desc : previewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100', 0, async function (done) { - if (previewOutputAsync == null || previewOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 previewOutputAsync == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 to operate"); - previewOutputAsync.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering previewOutputAsync.release success"); - console.info(TAG + "Entering previewOutputAsync.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_0100 ends here"); - await sleep(1000); - done(); - } - }) - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 - * @tc.name : camera Input release api - * @tc.desc : camera Input release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 camera0Input == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 to operate"); - camera0Input.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering camera0Input.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering camera0Input.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - }) - await sleep(1000); - done(); - } - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets b/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets deleted file mode 100644 index 080d0e5bf3ea3fb80edb88b704a8ae6078aaefe7..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets +++ /dev/null @@ -1,3195 +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 cameraObj from '@ohos.multimedia.camera'; -import image from '@ohos.multimedia.image'; -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -const TAG = "CameraModuleTest: "; - -// Define global variables -var camera0InputPromise; -var cameraManagerPromise; -var previewOutputPromise; -var photoOutputPromise; -var CaptureSessionPromise; -var surfaceId1; -var camerasArrayPromise; - -var Point1 = { x: 1, y: 1 } -var Point2 = { x: 2, y: 2 } -var Point3 = { x: 3, y: 3 } - -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -export default function cameraJSUnitPhotoPromise(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(ms) { - console.info(TAG + "Entering sleep -> Promise constructor"); - return new Promise(resolve => setTimeout(resolve, ms)); - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - describe('CameraJsUnitPhotoPromise', function () { - console.info(TAG + '----------CameraJsUnitPhotoPromise--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5000); - console.info('beforeEach case'); - }) - - afterEach(async function () { - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - console.info(TAG + "----------Camera-PhotoMode-Promise-------------"); - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------"); - cameraManagerPromise = await cameraObj.getCameraManager(null); - console.info(TAG + "Entering Get camera manager cameraManagerPromise: " + JSON.stringify(cameraManagerPromise)); - if (cameraManagerPromise != null && cameraManagerPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManagerPromise == null || cameraManagerPromise == undefined) { - console.info(TAG + 'Entering camera status callback cameraManagerPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate') - cameraManagerPromise.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManagerPromise is success"); - if (data != null || data != undefined) { - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 - * @tc.name : Get camera from cameramanager to get array of camera promise api - * @tc.desc : Get camera from cameramanager to get array of camera promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100--------------"); - camerasArrayPromise = await cameraManagerPromise.getCameras(); - console.info(TAG + "Entering Get Cameras: " + JSON.stringify(camerasArrayPromise)); - if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { - console.info(TAG + "Entering Get Cameras success"); - for (var i = 0; i < camerasArrayPromise.length; i++) { - // Get the variables from camera object - var cameraId = camerasArrayPromise[i].cameraId; - console.info(TAG + "Entering Get Cameras camera" + i + "Id: " + cameraId); - var cameraPosition = camerasArrayPromise[i].cameraPosition; - console.info(TAG + "Entering Get Cameras camera" + i + "Position: " + cameraPosition); - var cameraType = camerasArrayPromise[i].cameraType; - console.info(TAG + "Entering Get Cameras camera" + i + "Type: " + cameraType); - var connectionType = camerasArrayPromise[i].connectionType - console.info(TAG + "Entering Get Cameras connection" + i + "Type: " + connectionType); - } - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraId promise api - * @tc.desc : Create camerainput from camera-0 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info("--------------CAMERA-0 STARTS HERE--------------"); - console.info("--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------"); - camera0InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraId); - console.info(TAG + "Entering Create camerainput camera0InputPromise: " + JSON.stringify(camera0InputPromise)); - if (camera0InputPromise != null && camera0InputPromise != undefined) { - console.info(TAG + "Entering Create camerainput camera0InputPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 to operate"); - camera0InputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "camera0InputPromise error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error during camera0InputPromise with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*PreviewOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Create PreviewOutput instance promise api - * @tc.desc : Create PreviewOutput instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - console.info(TAG + " Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - previewOutputPromise = await cameraObj.createPreviewOutput(surfaceId); - console.info(TAG + " Entering createPreviewOutput success"); - if (previewOutputPromise != null || previewOutputPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering createPreviewOutput PASSED: " + JSON.stringify(previewOutputPromise)); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 - * @tc.name : Preview output callback on error api - * @tc.desc : Preview output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview output callback on error previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 to operate"); - previewOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Create PhotoOutput instance promise api - * @tc.desc : Create PhotoOutput instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1000) - photoOutputPromise = await cameraObj.createPhotoOutput(surfaceId1); - console.info(TAG + "Entering createPhotoOutput success"); - if (photoOutputPromise != null || photoOutputPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output callback on error photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 to operate"); - photoOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 - * @tc.name : Create CaptureSession instance promise api - * @tc.desc : Create Capturesession instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 to operate"); - CaptureSessionPromise = await cameraObj.createCaptureSession(null); - console.info(TAG + "Entering createCaptureSession success"); - if (CaptureSessionPromise != null || CaptureSessionPromise != undefined) { - console.info(TAG + "Entering createCaptureSession data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - //Capturesession callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 - * @tc.name : CaptureSession callback on error api - * @tc.desc : CaptureSession callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering CaptureSession callback on error captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 to operate"); - CaptureSessionPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession errorcallback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_CALLBACK_ON_ERROR_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 - * @tc.name : CaptureSession_Begin config promise api - * @tc.desc : CaptureSession_Begin config promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering CaptureSession_Begin config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 to operate"); - const promise = await CaptureSessionPromise.beginConfig(); - console.info(TAG + "Entering beginConfig success:"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 beginConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_PROMISE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add preview Output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 to operate"); - const promise = await CaptureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering Add preview Output : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Remove preview Output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 to operate"); - const Promise = await CaptureSessionPromise.removeOutput(previewOutputPromise); - console.info(TAG + "Entering Remove preview Output success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add preview Output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 to operate"); - const promise = await CaptureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering Add preview Output : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_PROMISE_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering commit config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 to operate"); - const promise = await CaptureSessionPromise.commitConfig(); - console.info(TAG + "Entering commit config commitConfig success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 commitConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 commitConfig FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0100 commitConfig ends here"); - } - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 to operate"); - await photoOutputPromise.isMirrorSupported() - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_0100 FAILED : " + err.message); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 to operate"); - await photoOutputPromise.setMirror(true).then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_0100 FAILED : " + err.message); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 - * @tc.name : setMirror false - * @tc.desc : setMirror false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 to operate"); - await photoOutputPromise.setMirror(false) - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'false'); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SETMIRROR_FALSE_0100 FAILED : " + err.message); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100 - * @tc.name : CaptureSession_Begin config promise api - * @tc.desc : CaptureSession_Begin config promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100 to operate"); - const promise = await CaptureSessionPromise.beginConfig(); - console.info(TAG + "Entering beginConfig success:"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_BEGIN_CONFIG_SUCCESS_PROMISE_0100 beginConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering beginConfig FAILED"); - } - console.info(TAG + "Entering beginConfig ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add Input captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 to operate"); - const Promise = await CaptureSessionPromise.addInput(camera0InputPromise); - console.info(TAG + "Entering Add Input addInput success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_PROMISE_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering Add output with photo output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 to operate"); - const promise = await CaptureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering Add output with photo output success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 to operate"); - const Promise = await CaptureSessionPromise.removeOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 addInput success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 to operate"); - const promise = await CaptureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_0200 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering commit config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 to operate"); - const promise = await CaptureSessionPromise.commitConfig(); - console.info(TAG + "Entering commit config commitConfig success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 commitConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 commitConfig FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_0200 commitConfig ends here"); - } - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0InputPromise.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 to operate"); - camera0InputPromise.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - // callback related API - //preview callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview output callback on frame start previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 to operate"); - previewOutputPromise.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START_0100 FAILED :" + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 - * @tc.name : Preview capture callback on frame end api - * @tc.desc : Preview capture callback on frame end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview capture callback on frame end previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 to operate"); - previewOutputPromise.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END_0100 FAILED : + err.message"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture start photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 to operate"); - photoOutputPromise.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "CaptureStart Callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_START_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture end photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 to operate"); - photoOutputPromise.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_CAPTURE_END_0100 FAILED' + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on frame shutter photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 to operate"); - photoOutputPromise.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 with captureId: " + data.captureId); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER_0100 FAILED: " + err.message); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 - * @tc.name : capture session start api - * @tc.desc : capture session start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering capture session start captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 to operate"); - await CaptureSessionPromise.start(); - console.info(TAG + "Entering captureSession start success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - //Location - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0100 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - await photoOutputPromise.capture(photosettings1) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 FAILED:" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 to operate"); - await photoOutputPromise.capture(photosettings2) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 FAILED:" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 to operate"); - await photoOutputPromise.capture(photosettings3) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings3 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 :" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 to operate"); - await photoOutputPromise.capture(photosettings4) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings4 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4_0100 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100--------------"); - console.info(TAG + 'hasFlash called.') - var hasFlashPromise = await camera0InputPromise.hasFlash(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 success"); - if (hasFlashPromise != null || hasFlashPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 is: " + JSON.stringify(hasFlashPromise)); - expect(hasFlashPromise).assertEqual(true); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 FAILED : "); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_0100 ends here"); - await sleep(1000) - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 to operate"); - var isFMOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 SUCCESS "); - if (isFMOpenSupported != null || isFMOpenSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + JSON.stringify(isFMOpenSupported)); - expect(isFMOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 to operate"); - var SetFMOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMOpen)) - if (SetFMOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 to operate"); - var GetFMOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 success: " + JSON.stringify(GetFMOpen)); - if (GetFMOpen == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + JSON.stringify(GetFMOpen)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 to operate"); - var isFMAlwaysOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 SUCCESS "); - if (isFMAlwaysOpenSupported != null || isFMAlwaysOpenSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + isFMAlwaysOpenSupported); - expect(isFMAlwaysOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - var SetFMAlwaysOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMAlwaysOpen)) - if (SetFMAlwaysOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 to operate"); - var GetFMAlwaysOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 success"); - if (GetFMAlwaysOpen == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAlwaysOpen); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 to operate"); - var isFMAutoSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 SUCCESS "); - if (isFMAutoSupported != null || isFMAutoSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_AUTO data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + isFMAutoSupported); - expect(isFMAutoSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 to operate"); - var SetFMAlwaysAuto = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "SetFMAlwaysAuto: " + JSON.stringify(SetFMAlwaysAuto)) - if (SetFMAlwaysAuto == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 to operate"); - var GetFMAuto = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 success"); - if (GetFMAuto == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAuto); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 to operate"); - var isFMCloseSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 SUCCESS "); - if (isFMCloseSupported != null || isFMCloseSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + isFMCloseSupported); - expect(isFMCloseSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 to operate"); - var SetFMClose = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMClose)) - if (SetFMClose == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 - * @tc.name : get flash mode close camera0 api - * @tc.desc : get flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 to operate"); - var GetFMClose = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 success"); - if (GetFMClose == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMClose); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_0100 ends here"); - } - await sleep(1000); - done(); - }) - - //ZOOM Function - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 - * @tc.name : get zoom ratio camera-0 cameraId api promise api - * @tc.desc : get zoom ratio camera-0 cameraId api promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100--------------"); - var getZoomRatioPromise = await camera0InputPromise.getZoomRatioRange(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 getZoomRatioPromise: " + JSON.stringify(getZoomRatioPromise)); - if (getZoomRatioPromise != null && getZoomRatioPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 setZoomRatioPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 success: " + JSON.stringify(getZoomRatioPromise)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(1); - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - var getpromise1 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise1); - if (getpromise1 != null && getpromise1 != undefined) { - expect(getpromise1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(2); - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - var getpromise2 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise2); - if (getpromise2 != null && getpromise2 != undefined) { - expect(getpromise2).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(3); - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - var getpromise3 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise3); - if (getpromise3 != null && getpromise3 != undefined) { - expect(getpromise3).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(4); - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - var getpromise4 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise4); - if (getpromise4 != null && getpromise4 != undefined) { - expect(getpromise4).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(5); - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - var getpromise5 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise5); - if (getpromise5 != null && getpromise5 != undefined) { - expect(getpromise5).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(6); - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - var getpromise6 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise6); - if (getpromise6 != null && getpromise6 != undefined) { - expect(getpromise6).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1000); - done(); - }) - - // FOCUS promise API's - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 - * @tc.name : check is focus mode locked supported-camera0Input api - * @tc.desc : check is focus mode locked supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 to operate"); - var isFMLockedSupported = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering is focus mode locked supported SUCCESS "); - if (isFMLockedSupported != null || isFMLockedSupported != undefined) { - console.info(TAG + "Entering is focus mode locked supported data is not null || undefined"); - console.info(TAG + "is focus mode locked supported : " + isFMLockedSupported); - expect(isFMLockedSupported).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED) - .then(function (data) { - console.info(TAG + "SetFMLocked: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode locked SUCCESS, current focusmode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 FAILED : ") - expect().assertFail(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode locked success: "); - if (data == 0) { - console.info(TAG + "Current focusmode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 - * @tc.name : get focal length camera0 api - * @tc.desc : get focal length camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 to operate"); - await camera0InputPromise.getFocalLength() - .then(function (data) { - console.info(TAG + "Current focallength is: " + JSON.stringify(data)); - expect(data).assertEqual(3.4600000381469727); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 - * @tc.name : is focusmode manual supported - * @tc.desc : is focusmode manual supported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 to operate"); - var isFMmanualSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL); - if (isFMmanualSupportedpromise != null || isFMmanualSupportedpromise != undefined) { - console.info(TAG + "Entering is focusmode manual supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMmanualSupportedpromise); - expect(isFMmanualSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL) - .then(function (data) { - console.info(TAG + "setFocusManual: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode manual SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode manual SUCCESS"); - if (data == 0) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0200 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 FAILED " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 - * @tc.name : check is focus mode continuous supported-camera0Input api - * @tc.desc : check is focus mode continuous supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 to operate"); - var isFMContinuousSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - if (isFMContinuousSupportedpromise != null || isFMContinuousSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode continuous supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINUOUS_SUPPORTED is: " + isFMContinuousSupportedpromise); - expect(isFMContinuousSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) - .then(function (data) { - console.info(TAG + "setFocusCont: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode continuous SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode continuous SUCCESS"); - if (data == 1) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0300 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 - * @tc.name : check is focus mode auto supported-camera0Input api - * @tc.desc : check is focus mode auto supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 to operate"); - var isFMAutoSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (isFMAutoSupportedpromise != null || isFMAutoSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode auto supported data is not null || undefined"); - console.info(TAG + "is focus mode auto supported is: " + isFMAutoSupportedpromise); - expect(isFMAutoSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_0100 ends here"); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 to operate"); - var setFocusAuto = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO) - .then(function () { - console.info(TAG + "setFocusAuto: " + JSON.stringify(setFocusAuto)) - console.info(TAG + "Entering set focus mode auto SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode auto SUCCESS " + JSON.stringify(data)); - if (data == 2) { - console.info(TAG + "Current FocusMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 PASSED"); - } - }) - .catch((err) => { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_0100 ends here"); - }); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0400 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode locked SUCCESS"); - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 to operate"); - await camera0InputPromise.getExposureBiasRange() - .then(function (data) { - console.info(TAG + "Entering getExposureBiasRange SUCCESS"); - console.info(TAG + "Current ExposureBiasRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_RANGE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100-4 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 to operate"); - await camera0InputPromise.setExposureBias(-4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 to operate"); - await camera0InputPromise.setExposurePoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 FAILED: " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_0100 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 to operate"); - photoOutputPromise.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_0500 ends here"); - } - await sleep(1000); - done(); - }) - await sleep(1000); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 to operate"); - await camera0InputPromise.setExposureBias(1) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "1"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 to operate"); - await camera0InputPromise.setExposurePoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0200 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 to operate"); - await photoOutputPromise.capture(photosettings1) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with Rotation-0 & Quality-0 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 FAILED:" + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1_0200 Rotation-0 & Quality-0 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 to operate"); - await camera0InputPromise.setExposureBias(4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 to operate"); - await camera0InputPromise.setExposurePoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_0300 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 - * @tc.name : Photo output capture with photosettings api - * @tc.desc : Photo output capture with photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); - await photoOutputPromise.capture(photosettings2) - .then(function (data) { - console.info(TAG + "Entering photoOutput capture with location settings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 PASSED"); - expect(true).assertTrue(); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2_0200 ends here"); - }); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400-5 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 to operate"); - await camera0InputPromise.setExposureBias(-5) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0400 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0400 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 to operate"); - await camera0InputPromise.setExposureBias(6) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_0500 ends here"); - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIAS_VALUE_0500 ends here"); - await sleep(1000); - done(); - }) - - /*CaptureSession APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 - * @tc.name : capture session stop api - * @tc.desc : capture session stop api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering capture session stop captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 to operate"); - await CaptureSessionPromise.stop(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 captureSession.stop PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_SUCCESS_PROMISE_0100 captureSession.stop ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : capture session release api - * @tc.desc : capture session release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { - console.info(TAG + "Entering capture session release captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await CaptureSessionPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : PreviewOutput release api - * @tc.desc : PreviewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering previewOutputPromise.release previewOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await previewOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : PhotoOutput release api - * @tc.desc : PhotoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering PhotoOutput release photoOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await photoOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : cameraInput release api - * @tc.desc : cameraInput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering cameraInput release camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await camera0InputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1000); - done(); - } - await sleep(1000); - done(); - }) - }); -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets b/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets deleted file mode 100644 index 571ca690ff89ac2fbd3becb18f81fc97bc447bf8..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets +++ /dev/null @@ -1,3800 +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 cameraObj from '@ohos.multimedia.camera'; -import media from '@ohos.multimedia.media' -import image from '@ohos.multimedia.image'; -import mediaLibrary from '@ohos.multimedia.mediaLibrary' -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' - -// @ts-nocheck -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -let TAG = "CameraModuleTest: "; -var cameraManager -var camerasArray -var camera0Input -var previewOutput -var photoOutputAsync -var videoRecorder -var surfaceId1 - -var minFrameRate_Grp0=12; -var maxFrameRate_Grp0=12; -var minFrameRate_Mix=14; -var maxFrameRate_Mix=15; -var minFrameRate_Err1=11; -var maxFrameRate_Err1=31; -var minFrameRate_Err2=14; -var maxFrameRate_Err2=28; -var minFrameRate_Err3=16; -var maxFrameRate_Err3=25; -var minFrameRate_Grp20=30; -var maxFrameRate_Grp20=30; - -var Point = { x: 1, y: 1 } -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -let fdPath; -let fileAsset; -let fdNumber; -let configFile = { - audioBitrate: 48000, - audioChannels: 2, - audioCodec: 'audio/mp4a-latm', - audioSampleRate: 48000, - durationTime: 1000, - fileFormat: 'mp4', - videoBitrate: 48000, - videoCodec: 'video/mp4v-es', - videoFrameWidth: 640, - videoFrameHeight: 480, - videoFrameRate: 30 -} - -let videoConfig = { - audioSourceType: 1, - videoSourceType: 0, - profile: configFile, - url: 'file:///data/media/02.mp4', - orientationHint: 0, - location: { latitude: 30, longitude: 130 }, - maxSize: 100, - maxDuration: 500 -} -var videoId -var videoOutput -var captureSession - -export default function cameraJSUnitVideoAsync(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(time) { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(1) - }, time * 1000) - }).then(() => { - console.info(`sleep ${time} over...`) - }) - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - async function getFd(pathName) { - let displayName = pathName; - const mediaTest = mediaLibrary.getMediaLibrary(); - let fileKeyObj = mediaLibrary.FileKey; - let mediaType = mediaLibrary.MediaType.VIDEO; - let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); - let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); - if (dataUri != undefined) { - let args = dataUri.id.toString(); - let fetchOp = { - selections: fileKeyObj.ID + "=?", - selectionArgs: [args], - } - let fetchFileResult = await mediaTest.getFileAssets(fetchOp); - fileAsset = await fetchFileResult.getAllObject(); - fdNumber = await fileAsset[0].open('Rw'); - fdPath = "fd://" + fdNumber.toString(); - } - } - - async function closeFd() { - if (fileAsset != null) { - await fileAsset[0].close(fdNumber).then(() => { - console.info('[mediaLibrary] case close fd success'); - }).catch((err) => { - console.info('[mediaLibrary] case close fd failed'); - }); - } else { - console.info('[mediaLibrary] case fileAsset is null'); - } - } - - async function getvideosurface() { - await getFd('02.mp4'); - videoConfig.url = fdPath; - media.createVideoRecorder((err, recorder) => { - console.info(TAG + 'createVideoRecorder called') - videoRecorder = recorder - console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder)) - console.info(TAG + 'videoRecorder.prepare called.') - videoRecorder.prepare(videoConfig, (err) => { - console.info(TAG + 'videoRecorder.prepare success.') - }) - videoRecorder.getInputSurface((err, id) => { - console.info(TAG + 'getInputSurface called') - videoId = id - console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoId)) - }) - }) - } - - describe('VideoModeAsync', function () { - console.info(TAG + '----------Camera-VideoMode-Async--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5); - console.info('beforeEach case'); - }) - - afterEach(async function () { - await closeFd(); - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100--------------') - await sleep(1) - cameraObj.getCameraManager(null, (err, data) => { - if (!err) { - console.info(TAG + 'Entering Get Camera manager success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Get Camera Manager data is not null || undefined') - cameraManager = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 PASSED') - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManager == null || cameraManager == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 cameraManager == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate') - cameraManager.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManager is success"); - if (data != null || data != undefined) { - console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Camera status Callback FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 - * @tc.name : Create camera manager instance async api - * @tc.desc : Create camera manager instance async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100--------------') - await sleep(1) - cameraManager.getCameras((err, data) => { - if (!err) { - console.info(TAG + 'Entering Get Cameras success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Get Cameras data is not null || undefined') - camerasArray = data - if (camerasArray != null && camerasArray.length > 0) { - for (var i = 0; i < camerasArray.length; i++) { - // Get the variables from camera object - var cameraId = camerasArray[i].cameraId - console.info(TAG + 'Entering Get Cameras camera' + i + 'Id: ' + cameraId) - var cameraPosition = camerasArray[i].cameraPosition - console.info(TAG + 'Entering Get Cameras camera' + i + 'Position: ' + cameraPosition) - var cameraType = camerasArray[i].cameraType - console.info(TAG + 'Entering Get Cameras camera' + i + 'Type: ' + cameraType) - var connectionType = camerasArray[i].connectionType - console.info(TAG + 'Entering Get Cameras connection' + i + 'Type: ' + connectionType) - } - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED cameraArray is null || undefined') - } - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 - * @tc.name : Create camerainput from camera-0 cameraId async api - * @tc.desc : Create camerainput from camera-0 cameraId async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100', 0, async function (done) { - console.info('--------------CAMERA-0 STARTS HERE--------------') - console.info('--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100--------------') - await sleep(1) - cameraManager.createCameraInput(camerasArray[0].cameraId, (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + 'Entering Create camera input data is not null || undefined') - camera0Input = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 PASSED with CameraID :' + camerasArray[0].cameraId) - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering Camera Input callback camera0Input == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 to operate"); - camera0Input.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "camera0Input error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 - * @tc.name : Create previewoutput async api - * @tc.desc : Create previewoutput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 to operate') - await sleep(1) - cameraObj.createPreviewOutput(surfaceId, (err, data) => { - if (!err) { - console.info(TAG + 'Entering Create preview output success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Create preview output data is not null || undefined') - previewOutput = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 PASSED') - } - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Preview output callback on error api - * @tc.desc : Preview output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering PreviewOutput callback on error previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 to operate"); - previewOutput.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Create PhotoOutput instance api - * @tc.desc : Create PhotoOutput instance api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1) - cameraObj.createPhotoOutput(surfaceId1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering createPhotoOutput success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering createPhotoOutput data is not null || undefined"); - photoOutputAsync = data; - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate"); - photoOutputAsync.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Error during PhotoOutput with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 - * @tc.name : Create videooutput async api - * @tc.desc : Create videooutput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 to operate') - await getvideosurface() - await sleep(2) - cameraObj.createVideoOutput(videoId, (err, data) => { - if (!err) { - console.info(TAG + 'Entering Create videooutput success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Create videooutput data is not null || undefined') - videoOutput = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 PASSED') - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : VideoOutput callback onerror async api - * @tc.desc : VideoOutput callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 videoOutput == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - videoOutput.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "VideoOutput Errorcallback is success") - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1) - done() - }) - await sleep(1) - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 - * @tc.name : Create capturesession async api - * @tc.desc : Create capturesession async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 to operate') - await sleep(1) - cameraObj.createCaptureSession(null, async (err, data) => { - if (!err) { - console.info(TAG + 'Entering Create capturesession success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering Create capturesession data is not null || undefined') - captureSession = data - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 PASSED') - } - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail() - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 - * @tc.name : CaptureSession callback on error api - * @tc.desc : CaptureSession callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 to operate"); - captureSession.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession errorcallback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 - * @tc.name : Begin Config async api - * @tc.desc : Begin Config async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering Begin Config captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 to operate') - await sleep(1) - captureSession.beginConfig((err, data) => { - if (!err) { - console.info(TAG + 'Entering Begin Config success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 - * @tc.name : AddInput async api - * @tc.desc : AddInput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddInput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 to operate') - await sleep(1) - captureSession.addInput(camera0Input, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddInput success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 - * @tc.name : AddOutput preview async api - * @tc.desc : AddOutput preview async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput preview captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 to operate') - await sleep(1) - captureSession.addOutput(previewOutput, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput preview success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_CALLBACK_0100 ends here"); - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 - * @tc.name : AddOutput video async api - * @tc.desc : AddOutput video async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput video captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 to operate') - await sleep(1) - captureSession.addOutput(videoOutput, async (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput video success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0100 ends here') - await sleep(1); - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeInput(camera0Input, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove input success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering Remove Input FAILED" + err.message); - console.info(TAG + "Entering Remove Input ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeOutput(previewOutput, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove preview Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering Remove preview Output FAILED" + err.message); - console.info(TAG + "Entering Remove Preview Output ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove photo Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering Remove photo Output FAILED" + err.message); - console.info(TAG + "Entering Remove photo Output ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - } - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 - * @tc.name : Remove video Output api - * @tc.desc : Remove video Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 to operate"); - captureSession.removeOutput(videoOutput, async (err, data) => { - if (!err) { - console.info(TAG + "Entering remove video Output success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering Remove video Output FAILED" + err.message); - console.info(TAG + "Entering Remove video Output ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 - * @tc.name : AddInput async api - * @tc.desc : AddInput async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddInput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 to operate') - await sleep(1) - captureSession.addInput(camera0Input, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddInput success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_CALLBACK_0200 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 - * @tc.name : AddOutput preview async api - * @tc.desc : AddOutput preview async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 to operate') - await sleep(1) - captureSession.addOutput(previewOutput, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput success') - console.info(TAG + 'Entering AddOutput data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_CALLBACK_0200 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 to operate"); - captureSession.addOutput(photoOutputAsync, async (err, data) => { - if (!err) { - console.info(TAG + "Entering AddOutput_Photo success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_CALLBACK_0100 ends here"); - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 - * @tc.name : AddOutput video async api - * @tc.desc : AddOutput video async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering AddOutput captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 to operate') - await sleep(1) - captureSession.addOutput(videoOutput, (err, data) => { - if (!err) { - console.info(TAG + 'Entering AddOutput success') - console.info(TAG + 'Entering AddOutput data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_CALLBACK_0200 ends here') - done() - }) - await sleep(1) - done() - } - }) - - //framerate - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 - * @tc.name : get frame rate range camera0 api - * @tc.desc : get frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 to operate"); - videoOutput.getFrameRateRange(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get frame rate range success"); - expect(true).assertTrue(); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Grp0,maxFrameRate_Grp0, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range PASSED") - expect(true).assertTrue(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp0_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Mix,maxFrameRate_Mix, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED") - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Mix_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api_err - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Err1,maxFrameRate_Err1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED") - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err1_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Err2,maxFrameRate_Err2, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED"); - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err2_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Err3,maxFrameRate_Err3, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range FAILED"); - expect().assertFail(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Err3_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 to operate"); - videoOutput.setFrameRateRange(minFrameRate_Grp20,maxFrameRate_Grp20, async (err, data) => { - if (!err) { - console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); - console.info(TAG + "Entering set frame rate range PASSED") - expect(true).assertTrue(); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_Grp20_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeOff - * @tc.desc : getVideoStabilizationModeOff async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode Off success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_OFF_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeLow - * @tc.desc : getVideoStabilizationModeLOw async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode low success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(1) - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_LOW_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeMedium - * @tc.desc : getVideoStabilizationModeMedium async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode medium success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_MIDDLE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeHigh - * @tc.desc : getVideoStabilizationModeHigh async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode High success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_HIGH_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 - * @tc.name : getVideoStabilizationModeAuto - * @tc.desc : getVideoStabilizationModeAuto async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 to operate"); - captureSession.getActiveVideoStabilizationMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering get Video Stabilization Mode Auto success"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATION_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 - * @tc.name : CommitConfig async api - * @tc.desc : CommitConfig async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering CommitConfig captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 to operate') - await sleep(1) - captureSession.commitConfig(async (err, data) => { - if (!err) { - console.info(TAG + 'Entering CommitConfig success') - console.info(TAG + 'Entering CommitConfig data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0Input.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0Input.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //callback API - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering Preview output callback on frame start previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate"); - previewOutput.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : Preview capture callback on frame end api - * @tc.desc : Preview capture callback on frame end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering Preview capture callback on frame end previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate"); - previewOutput.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering Photo Capture Callback on CaptureStart photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 to operate"); - photoOutputAsync.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "Photo Capture Callback on CaptureStart is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 to operate"); - photoOutputAsync.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 FAILED' + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 to operate"); - photoOutputAsync.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "frameShutter callback with captureId: " + data.captureId); - console.info(TAG + "frameShutter callback with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : VideoOutput callback onframestart async api - * @tc.desc : VideoOutput callback onframestart async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + "Entering VideoOutput callback onframestart videoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate"); - videoOutput.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 is FAILED : " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : VideoOutput callback onframeend async api - * @tc.desc : VideoOutput callback onframeend async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + 'Entering VideoOutput callback onframeend videoOutput == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate') - await sleep(1) - videoOutput.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 is success'); - if (data != null || data != undefined) { - expect(true).assertTrue() - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED' + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 - * @tc.name : CaptureSession start async api - * @tc.desc : CaptureSession start async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + "Entering CaptureSession start captureSession == null || undefined") - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 to operate") - await sleep(1) - captureSession.start(async (err, data) => { - if (!err) { - console.info(TAG + "Entering CaptureSession start success") - expect(true).assertTrue() - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 PASSED") - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 - * @tc.name : Photo output capture without photosettings api - * @tc.desc : Photo output capture without photosettings api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 to operate"); - photoOutputAsync.capture(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutput capture without photosettings success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 PASSED"); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "hasFlash called.") - camera0Input.hasFlash(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 is: " + data); - expect(data).assertEqual(true); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_CALLBACK_0100 ends here"); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 success"); - if (data == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_ALWAYS_OPEN supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 success"); - if (data == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode auto is supported-camera0Input api - * @tc.desc : check if flash mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_AUTO SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 success"); - if (data == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering FLASH_MODE_CLOSE SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 PASSED"); - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 FAILED :" + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 to operate"); - camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 to operate"); - camera0Input.getFlashMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 success"); - if (data == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 data is not null || undefined: "); - expect(true).assertTrue(); - console.info(TAG + "Current FlashMode is: " + data); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 PASSED"); - } - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 FAILED :" + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 - * @tc.name : get zoom ratio camera-0 cameraId api - * @tc.desc : get zoom ratio camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100--------------"); - camera0Input.getZoomRatioRange(async (err, data) => { - if (!err) { - if (data != null && data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 Success " + data) - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 FAILED: " + err.message); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_CALLBACK_0100 ends here"); - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(1, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_1_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(2, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_ASYNC_CALLBACK_0100 PASSED "); - } - else { - expect().assertFail(); - console.info(TAG + "GET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - } else { - expect().assertFail(); - console.info(TAG + "SET_ZOOM_2_ASYNC FAILED" + err.message); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(3, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_3_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(4, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_4_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(5, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_5_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_CALLBACK_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_CALLBACK_0100', 0, async function (done) { - camera0Input.setZoomRatio(6, (err, data) => { - if (!err) { - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - camera0Input.getZoomRatio((err, data1) => { - if (!err) { - console.info(TAG + "getZoomRatio success : " + data1); - expect(data1).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_ASYNC_CALLBACK_0100 PASSED "); - } - else { - console.info(TAG + "GET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - } else { - console.info(TAG + "SET_ZOOM_6_ASYNC FAILED" + err.message); - expect().assertFail(); - } - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode locked is supported-camera0Input api - * @tc.desc : check if focus mode locked is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Is Focus Mode Locked Supported SUCCESS: " + data); - if (data != null || data != undefined) { - console.info(TAG + "Entering Is Focus Mode Locked Supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_LOCKED_SUPPORTED is: " + data); - expect(data).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 FAILED :" + err.message); - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Mode Locked SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 FAILED : ") - expect().assertFail(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Mode Locked SUCCESS: " + data); - console.info(TAG + "Get Focus Mode Locked data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode manual is supported-camera0Input api - * @tc.desc : check if focus mode manual is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 FAILED " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUALL_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 to operate"); - camera0Input.setFocusPoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode continuous is supported-camera0Input api - * @tc.desc : check if focus mode continuous is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINOUS_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 - * @tc.name : set focus Point locked camera0 api - * @tc.desc : set focus Point locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 to operate"); - camera0Input.setFocusPoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 - * @tc.name : check if focus mode auto is supported-camera0Input api - * @tc.desc : check if focus mode auto is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 to operate"); - camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 SUCCESS "); - if (data != null || data != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_AUTO_SUPPORTED is: " + data); - expect(data).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 PASSED: "); - } - } else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (data != null || data != undefined) { - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 PASSED") - } - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.getFocusMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 SUCCESS"); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 data is not null || undefined: "); - console.info(TAG + "Current FocusMode is: " + data); - expect(data).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 to operate"); - camera0Input.setFocusPoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 to operate"); - camera0Input.getFocusPoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); - console.info(TAG + "Current Focus Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 to operate"); - camera0Input.setExposurePoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100_exposure mode continuous auto - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 to operate"); - camera0Input.getExposureBiasRange(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias range SUCCESS"); - console.info(TAG + "Current Exposure bias range is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 to operate"); - camera0Input.setExposureBias(-4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "-4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure Mode SUCCESS"); - console.info(TAG + "Get Exposure Mode data is not null || undefined: "); - console.info(TAG + "Current ExposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 to operate"); - camera0Input.setExposurePoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 to operate"); - camera0Input.setExposureBias(1, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "1"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0200 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 to operate"); - camera0Input.getExposureMode(async (err, data) => { - if (!err) { - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_CALLBACK_0100 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 to operate"); - camera0Input.setExposurePoint(Point, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 - * @tc.name : get exposure point camera0 api - * @tc.desc : get exposure point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 to operate"); - camera0Input.getExposurePoint(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure point SUCCESS"); - console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 to operate"); - camera0Input.setExposureBias(4, async (err, data) => { - if (!err) { - console.info(TAG + "Entering Set Exposure bias is: " + "4"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 PASSED") - expect(true).assertTrue(); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 FAILED : " + err.message); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 - * @tc.name : get exposure bias value camera0 api - * @tc.desc : get exposure bias value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 to operate"); - camera0Input.getExposureValue(async (err, data) => { - if (!err) { - console.info(TAG + "Entering Get Exposure bias value SUCCESS"); - console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASVALUE_CALLBACK_0300 ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100 to operate"); - photoOutputAsync.isMirrorSupported(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_CALLBACK_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100 to operate"); - photoOutputAsync.setMirror(true, async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_CALLBACK_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - } else { - expect().assertFail(); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 - * @tc.name : VideoOutput start async api - * @tc.desc : VideoOutput start async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 videoOutput == null || undefined") - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 to operate") - await sleep(1) - videoOutput.start(async (err, data) => { - if (!err) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 success: " + JSON.stringify(data)) - if (data == undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_CALLBACK_0100 FAILED: " + err.message) - } - }) - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 - * @tc.name : VideoRecorder start async api - * @tc.desc : VideoRecorder start async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100', 0, async function (done) { - if (videoRecorder == null || videoRecorder == undefined) { - console.info(TAG + 'Entering VideoRecorder start videoRecorder == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 to operate') - videoRecorder.start() - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 called'); - sleep(3); - console.info(TAG + 'Capture with photosettings1 during video - Start & setMirror: true') - photoOutputAsync.capture(photosettings1) - console.info(TAG + 'Capture during Video - End.') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_START_CALLBACK_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 - * @tc.name : VideoOutput stop async api - * @tc.desc : VideoOutput stop async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + 'Entering VideoOutput stop videoOutput == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 to operate') - videoOutput.stop(async (err, data) => { - if (!err) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 success: ' + JSON.stringify(data)) - if (data == undefined) { - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 FAILED: ' + err.message) - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100 - * @tc.name : VideoRecorder stop async api - * @tc.desc : VideoRecorder stop async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100', 0, async function (done) { - if (videoRecorder == null || videoRecorder == undefined) { - console.info(TAG + 'Entering VideoRecorder stop videoRecorder == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100 to operate') - videoRecorder.stop() - console.info(TAG + 'VideoRecorder stop stopVideo done.') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_RECORDER_STOP_CALLBACK_0100 PASSED') - expect(true).assertTrue() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 - * @tc.name : CaptureSession stop async api - * @tc.desc : CaptureSession stop async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering CaptureSession stop captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 to operate') - await sleep(1) - captureSession.stop((err, data) => { - if (!err) { - console.info(TAG + 'Entering CaptureSession stop success') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 PASSED') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_CALLBACK_0100 ends here') - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 - * @tc.name : CaptureSession release async api - * @tc.desc : CaptureSession release async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100', 0, async function (done) { - if (captureSession == null || captureSession == undefined) { - console.info(TAG + 'Entering CaptureSession release captureSession == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 to operate') - await sleep(1) - captureSession.release(async (err, data) => { - if (!err) { - console.info(TAG + 'Entering CaptureSession release success') - if (data != null || data != undefined) { - console.info(TAG + 'Entering CaptureSession release data is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 PASSED') - } - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 FAILED: ' + err.message) - expect().assertFail(); - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_CALLBACK_0100 ends here') - await sleep(1) - done() - }) - await sleep(1) - done() - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 - * @tc.name : videooutput release api - * @tc.desc : videooutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (videoOutput == null || videoOutput == undefined) { - console.info(TAG + "Entering videooutput.release previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 to operate"); - videoOutput.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering videooutput.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering videooutput.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUPUT_RELEASE_SUCCESS_CALLBACK_0100 ends here"); - await sleep(1); - done(); - } - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 - * @tc.name : previewOutput release api - * @tc.desc : previewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (previewOutput == null || previewOutput == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 to operate"); - previewOutput.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering previewOutput.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering previewOutput.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering previewOutput.release PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUPUT_RELEASE_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering previewOutput.release ends here"); - await sleep(1); - done(); - } - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 - * @tc.name : photoOutput release api - * @tc.desc : photoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100', 0, async function (done) { - if (photoOutputAsync == null || photoOutputAsync == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 photoOutputAsync == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 to operate"); - photoOutputAsync.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering photoOutputAsync.release success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 PASSED"); - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTOOUPUT_RELEASE_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering photoOutputAsync.release ends here"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 - * @tc.name : camera Input release api - * @tc.desc : camera Input release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100', 0, async function (done) { - if (camera0Input == null || camera0Input == undefined) { - console.info(TAG + "Entering camera0Input.release camera0Input == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 to operate"); - camera0Input.release(async (err, data) => { - if (!err) { - console.info(TAG + "Entering camera0Input.release success"); - if (data != null || data != undefined) { - console.info(TAG + "Entering camera0Input.release data is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 PASSED"); - } - } else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 FAILED: " + err.message); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_CALLBACK_0100 ends here"); - await sleep(1); - done(); - } - }) - await sleep(1); - done(); - } - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets b/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets deleted file mode 100644 index aa4466c90fbcc0482aff18bd91e25e3ae39d7b27..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngleRK/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets +++ /dev/null @@ -1,3367 +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 cameraObj from '@ohos.multimedia.camera' -import media from '@ohos.multimedia.media' -import image from '@ohos.multimedia.image'; -import mediaLibrary from '@ohos.multimedia.mediaLibrary' -import fileio from '@ohos.fileio'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl' -import bundle from '@ohos.bundle' - -// @ts-nocheck -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; - -let TAG = 'CameraModuleTest: ' -var cameraManagerPromise -var camerasArrayPromise -var camera0InputPromise -var previewOutputPromise -var videoRecorder -var photoOutputPromise -let fdPath; -let fileAsset; -let fdNumber; - -var minFrameRate_Grp0=12; -var maxFrameRate_Grp0=12; -var minFrameRate_Mix=14; -var maxFrameRate_Mix=15; -var minFrameRate_Err1=11; -var maxFrameRate_Err1=31; -var minFrameRate_Err2=14; -var maxFrameRate_Err2=28; -var minFrameRate_Err3=16; -var maxFrameRate_Err3=25; -var minFrameRate_Grp20=30; -var maxFrameRate_Grp20=30; - -var Point1 = { x: 1, y: 1 } -var Point2 = { x: 2, y: 2 } -var Point3 = { x: 3, y: 3 } -var photosettings1 = { - rotation: 0, - quality: 0, - location: { - latitude: 12.9705, - longitude: 77.7329, - altitude: 920.0000, - }, -} -var photosettings2 = { - rotation: 90, - quality: 1, - location: { - latitude: 20, - longitude: 78, - altitude: 8586, - }, -} - -var photosettings3 = { - quality: 2, - location: { - latitude: 0, - longitude: 0, - altitude: 0, - }, -} -var photosettings4 = { - rotation: 180, - location: { - latitude: -1, - longitude: -1, - altitude: -1, - }, -} - -var photosettings5 = { - rotation: 270, -} -let configFile = { - audioBitrate: 48000, - audioChannels: 2, - audioCodec: 'audio/mp4a-latm', - audioSampleRate: 48000, - durationTime: 1000, - fileFormat: 'mp4', - videoBitrate: 48000, - videoCodec: 'video/mp4v-es', - videoFrameWidth: 640, - videoFrameHeight: 480, - videoFrameRate: 30 -} - -let videoConfig = { - audioSourceType: 1, - videoSourceType: 0, - profile: configFile, - url: 'file:///data/media/01.mp4', - orientationHint: 0, - location: { latitude: 30, longitude: 130 }, - maxSize: 100, - maxDuration: 500 -} -var surfaceId1 -var videoId -var videoOutputPromise -var captureSessionPromise - -export default function cameraJSUnitVideoPromise(surfaceId: any) { - - async function getImageReceiverSurfaceId() { - console.log(TAG + 'Entering create Image receiver') - var receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before receiver check') - if (receiver !== undefined) { - console.log(TAG + 'Receiver is ok') - surfaceId1 = await receiver.getReceivingSurfaceId() - console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) - } else { - console.log(TAG + 'Receiver is not ok') - } - } - - function sleep(time) { - return new Promise((resolve, reject) => { - setTimeout(() => { - resolve(1) - }, time * 1000) - }).then(() => { - console.info(`sleep ${time} over...`) - }) - } - - async function applyPermission() { - let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); - let atManager = abilityAccessCtrl.createAtManager(); - if (atManager != null) { - let tokenID = appInfo.accessTokenId; - console.info('[permission] case accessTokenID is ' + tokenID); - let permissionName1 = 'ohos.permission.CAMERA'; - let permissionName2 = 'ohos.permission.MICROPHONE'; - let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; - let permissionName4 = 'ohos.permission.READ_MEDIA'; - let permissionName5 = 'ohos.permission.WRITE_MEDIA'; - await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { - console.info('[permission] case grantUserGrantedPermission success :' + result); - }).catch((err) => { - console.info('[permission] case grantUserGrantedPermission failed :' + err); - }); - } else { - console.info('[permission] case apply permission failed, createAtManager failed'); - } - } - - async function getFd(pathName) { - let displayName = pathName; - const mediaTest = mediaLibrary.getMediaLibrary(); - let fileKeyObj = mediaLibrary.FileKey; - let mediaType = mediaLibrary.MediaType.VIDEO; - let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); - let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); - if (dataUri != undefined) { - let args = dataUri.id.toString(); - let fetchOp = { - selections: fileKeyObj.ID + "=?", - selectionArgs: [args], - } - let fetchFileResult = await mediaTest.getFileAssets(fetchOp); - fileAsset = await fetchFileResult.getAllObject(); - fdNumber = await fileAsset[0].open('Rw'); - fdPath = "fd://" + fdNumber.toString(); - } - } - - async function closeFd() { - if (fileAsset != null) { - await fileAsset[0].close(fdNumber).then(() => { - console.info('[mediaLibrary] case close fd success'); - }).catch((err) => { - console.info('[mediaLibrary] case close fd failed'); - }); - } else { - console.info('[mediaLibrary] case fileAsset is null'); - } - } - - async function getvideosurface() { - await getFd('01.mp4'); - videoConfig.url = fdPath; - media.createVideoRecorder((err, recorder) => { - console.info(TAG + 'createVideoRecorder called') - videoRecorder = recorder - console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder)) - console.info(TAG + 'videoRecorder.prepare called.') - videoRecorder.prepare(videoConfig, (err) => { - console.info(TAG + 'videoRecorder.prepare success.') - }) - videoRecorder.getInputSurface((err, id) => { - console.info(TAG + 'getInputSurface called') - videoId = id - console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoId)) - }) - }) - } - - describe('VideoModePromise', function () { - console.info(TAG + '----------Camera-VideoMode-Promise--------------') - - beforeAll(async function () { - await applyPermission(); - console.info('beforeAll case'); - }) - - beforeEach(function () { - sleep(5); - console.info('beforeEach case'); - }) - - afterEach(async function () { - await closeFd(); - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100--------------') - cameraManagerPromise = await cameraObj.getCameraManager(null) - console.info(TAG + 'Entering Get cameraManagerPromise cameraManagerPromise: ' + cameraManagerPromise) - if (cameraManagerPromise != null && cameraManagerPromise != undefined) { - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERA_MANAGER_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 - * @tc.name : camera status callback on CameraManager async api - * @tc.desc : camera status callback on CameraManager async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100', 0, async function (done) { - if (cameraManagerPromise == null || cameraManagerPromise == undefined) { - console.info(TAG + 'Entering Camera status Callback cameraManagerPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 to operate') - await sleep(1) - cameraManagerPromise.on('cameraStatus', async (err, data) => { - if (!err) { - console.info(TAG + "Camera status Callback on cameraManagerPromise is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 CameraStatusInfo_Camera: " + data.camera); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 CameraStatusInfo_Status: " + data.status); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_STATUS_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 - * @tc.name : Create camera manager instance promise api - * @tc.desc : Create camera manager instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100--------------') - camerasArrayPromise = await cameraManagerPromise.getCameras() - console.info(TAG + 'Entering Get Cameras Promise: ' + JSON.stringify(camerasArrayPromise)) - if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { - console.info(TAG + 'Entering Get Cameras Promise success') - for (var i = 0; i < camerasArrayPromise.length; i++) { - // Get the variables from camera object - var cameraId = camerasArrayPromise[i].cameraId - console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Id: ' + cameraId) - var cameraPosition = camerasArrayPromise[i].cameraPosition - console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Position: ' + cameraPosition) - var cameraType = camerasArrayPromise[i].cameraType - console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Type: ' + cameraType) - var connectionType = camerasArrayPromise[i].connectionType - console.info(TAG + 'Entering Get Cameras Promise connection' + i + 'Type: ' + connectionType) - } - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_GET_CAMERAS_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /*CAMERA-0 Scripts*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 - * @tc.name : Create camerainput from camera-0 cameraId promise api - * @tc.desc : Create camerainput from camera-0 cameraId promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100--------------') - camera0InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraId) - console.info(TAG + 'Entering Create camera input promise camera0InputPromise: ' + JSON.stringify(camera0InputPromise)) - if (camera0InputPromise != null && camera0InputPromise != undefined) { - console.info(TAG + 'Entering Create camera input promise camera0InputPromise is not null || undefined') - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAMERA_INPUT_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering Camera input error callback camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 to operate"); - camera0InputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "camera0InputPromise error callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAMERA_INPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 - * @tc.name : Create previewoutput promise api - * @tc.desc : Create previewoutput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100', 0, async function (done) { - console.info('--------------SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100--------------') - previewOutputPromise = await cameraObj.createPreviewOutput(surfaceId) - console.info(TAG + 'Entering Create previewOutputPromise: ' + JSON.stringify(previewOutputPromise)) - if (previewOutputPromise != null && previewOutputPromise != undefined) { - console.info(TAG + 'Entering Create previewOutputPromise is not null || undefined') - expect(true).assertTrue(); - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 PASSED') - } else { - expect().assertFail(); - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_PREVIEW_OUTPUT_PROMISE_0100 ends here') - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : FocusStateChange callback api - * @tc.desc : FocusStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0InputPromise.on('focusStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "FocusState callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current FocusState is : " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_FOCUSSTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 - * @tc.name : ExposureStateChange callback api - * @tc.desc : ExposureStateChange callback api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 to operate"); - camera0InputPromise.on('exposureStateChange', async (err, data) => { - if (!err) { - console.info(TAG + "ExposureStateChange callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "Current ExposureStateChange is: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_EXPOSURESTATECHANGE_ON_CAMERAINPUT_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : PreviewOutput callback onerror async api - * @tc.desc : PreviewOutput callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + 'Entering PreviewOutputError callback previewOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - previewOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 - * @tc.name : Create videooutput promise api - * @tc.desc : Create videooutput promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 to operate') - await getvideosurface() - await sleep(2) - videoOutputPromise = await cameraObj.createVideoOutput(videoId) - console.info(TAG + 'Entering Create videoOutputPromise: ' + videoOutputPromise) - if (videoOutputPromise != null && videoOutputPromise != undefined) { - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 PASSED') - } else { - expect().assertFail(); - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_VIDEO_OUTPUT_PROMISE_0100 ends here'); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : VideoOutput callback onerror async api - * @tc.desc : VideoOutput callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - videoOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + 'VideoOutput Errorcallback is success') - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1) - done() - }) - await sleep(1) - done(); - } - }) - - /*PhotoOutput APIs test script*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Create PhotoOutput instance promise api - * @tc.desc : Create PhotoOutput instance promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - console.info(TAG + 'Entering getImageReceiverSurfaceId') - await getImageReceiverSurfaceId() - await sleep(1) - photoOutputPromise = await cameraObj.createPhotoOutput(surfaceId1); - console.info(TAG + "Entering createPhotoOutput success"); - if (photoOutputPromise != null || photoOutputPromise != undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 FAILED : "); - console.info(TAG + "Entering createPhotoOutput ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 - * @tc.name : Photo output callback on error api - * @tc.desc : Photo output callback on error api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo output callback on error photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 to operate"); - photoOutputPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + "PhotoOutputError callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_OUTPUT_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 - * @tc.name : Create capturesession promise api - * @tc.desc : Create capturesession promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100', 0, async function (done) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 to operate') - captureSessionPromise = await cameraObj.createCaptureSession(null) - console.info(TAG + 'Entering Create captureSessionPromise: ' + captureSessionPromise) - if (captureSessionPromise != null && captureSessionPromise != undefined) { - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 PASSED') - } else { - expect().assertFail() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 FAILED') - } - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CREATE_CAPTURE_SESSION_PROMISE_0100 ends here'); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 - * @tc.name : CaptureSession callback onerror async api - * @tc.desc : CaptureSession callback onerror async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + 'Entering captureSession errorcallback captureSessionPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 to operate') - await sleep(1) - captureSessionPromise.on('error', async (err, data) => { - if (!err) { - console.info(TAG + " captureSession errorcallback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 with ErrorCode: " + data.code); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_CAP_SES_ON_ERROR_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /*CaptureSession APIs*/ - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 - * @tc.name : CaptureSession_Begin config promise api - * @tc.desc : CaptureSession_Begin config promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Create captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.beginConfig(); - console.info(TAG + "Entering beginConfig success:"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 beginConfig PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_BEGIN_CONFIG_SUCCESS_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add Input captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.addInput(camera0InputPromise); - console.info(TAG + "Entering Add Input success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add preview output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering Add preview output : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 FAILED : "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 - * @tc.name : Add output with video output api - * @tc.desc : Add output with video output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add video output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(videoOutputPromise); - console.info(TAG + "Entering Add video output success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Add output with photo output captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering Add output with photo output success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 - * @tc.name : remove input api - * @tc.desc : remove input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeInput(camera0InputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_INPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Remove preview Output api - * @tc.desc : Remove preview Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeOutput(previewOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PREVIEW_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Remove photo Output api - * @tc.desc : Remove photo Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 addInput success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_PHOTO_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 - * @tc.name : Remove video Output api - * @tc.desc : Remove video Output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 to operate"); - const Promise = await captureSessionPromise.removeOutput(videoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 success " + Promise); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_REMOVE_VIDEO_OUTPUT_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 - * @tc.name : Add Input with camera0Input api - * @tc.desc : Add Input with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 to operate"); - const Promise = await captureSessionPromise.addInput(camera0InputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 addInput success"); - if (Promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 addInput PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_INPUT_SUCCESS_PROMISE_0200 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 - * @tc.name : Add output with camera0Input api - * @tc.desc : Add output with camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 to operate"); - const promise = await captureSessionPromise.addOutput(previewOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 : Success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 FAILED"); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE_0200 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 - * @tc.name : Add output with photo output api - * @tc.desc : Add output with photo output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.addOutput(photoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 FAILED "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_PHOTO_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 - * @tc.name : Add output with video output api - * @tc.desc : Add output with video output api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 to operate"); - const promise = await captureSessionPromise.addOutput(videoOutputPromise); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 FAILED: "); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ADD_OUTPUT_VIDEO_SUCCESS_PROMISE_0200 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 - * @tc.name : get frame rate range camera0 api - * @tc.desc : get frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 to operate"); - await videoOutputPromise.getFrameRateRange() - .then(function (data) { - console.info(TAG + "Entering get frame rate range SUCCESS "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 PASSED : " + JSON.stringify(data)) - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FRAME_RATE_RANGE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Grp0,maxFrameRate_Grp0) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP0_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Mix,maxFrameRate_Mix) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_MIX_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Err1,maxFrameRate_Err1) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR1_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Err2,maxFrameRate_Err2) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR2_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Err3,maxFrameRate_Err3) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 FAILED"); - }) - .catch((err) => { - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 PASSED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_ERR3_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 - * @tc.name : set frame rate range camera0 api - * @tc.desc : set frame rate range promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 to operate"); - await videoOutputPromise.setFrameRateRange(minFrameRate_Grp20,maxFrameRate_Grp20) - .then(function (data) { - console.info(TAG + "Entering setFrameRateRange SUCCESS"); - console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_FRAME_RATE_RANGE_GRP20_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 - * @tc.name : getVideoStabilizationModeOff - * @tc.desc : getVideoStabilizationModeOff promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeOff SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(0); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEOFF_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 - * @tc.name : getVideoStabilizationModeLow - * @tc.desc : getVideoStabilizationModeLow promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeLow SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODELOW_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 - * @tc.name : getVideoStabilizationModeMIDDLE - * @tc.desc : getVideoStabilizationModeMIDDLE promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeMIDDLE SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEMIDDLE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 - * @tc.name : getVideoStabilizationModeHigh - * @tc.desc : getVideoStabilizationModeHigh promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeHigh SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEHIGH_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 - * @tc.name : getVideoStabilizationModeAuto - * @tc.desc : getVideoStabilizationModeAuto promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 to operate"); - await captureSessionPromise.getActiveVideoStabilizationMode() - .then(function (data){ - console.info(TAG + "Entering getVideoStabilizationModeAuto SUCCESS"); - console.info(TAG + "Current VideoStabilizationMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_VIDEOSTABILIZATIONMODEAUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 - * @tc.name : commit config api - * @tc.desc : commit config api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering Commit config captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 to operate"); - const promise = await captureSessionPromise.commitConfig(); - console.info(TAG + "Entering commitConfig success"); - if (promise == undefined) { - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 commitConfig PASSED"); - } - else { - expect().assertFail() - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 commitConfig FAILED : "); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_COMMIT_CONFIG_SUCCESS_PROMISE_0100 commitConfig ends here"); - } - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : Preview output callback on frame start api - * @tc.desc : Preview output callback on frame start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering Preview Output callback on frame start previewOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate"); - previewOutputPromise.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_START_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : PreviewOutput callback onframeend async api - * @tc.desc : PreviewOutput callback onframeend async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 previewOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate') - await sleep(1) - previewOutputPromise.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + "PreviewStop frameEnd Callback is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PREVIEW_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED : + err.message"); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 - * @tc.name : VideoOutput callback onframestart async api - * @tc.desc : VideoOutput callback onframestart async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video frameStart Callback videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 to operate') - await sleep(1) - videoOutputPromise.on('frameStart', async (err, data) => { - if (!err) { - console.info(TAG + "Video frameStart Callback is success"); - if (data != null || data != undefined) { - expect(true).assertTrue(); - } - } else { - expect().assertFail() - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_START_CALLBACK_0100 is FAILED : " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 - * @tc.name : VideoOutput callback onframeend async api - * @tc.desc : VideoOutput callback onframeend async api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video frameEnd callback videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 to operate') - await sleep(1) - videoOutputPromise.on('frameEnd', async (err, data) => { - if (!err) { - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 is success') - if (data != null || data != undefined) { - expect(true).assertTrue() - } - } else { - expect().assertFail() - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_ON_FRAME_END_CALLBACK_0100 FAILED' + err.message) - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - //Capture callback - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 - * @tc.name : Photo capture callback on capture start api - * @tc.desc : Photo capture callback on capture start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture start photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 to operate"); - photoOutputPromise.on('captureStart', async (err, data) => { - if (!err) { - console.info(TAG + "CaptureStart Callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 with captureId: " + data); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_START_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 - * @tc.name : Photo capture callback on capture end api - * @tc.desc : Photo capture callback on capture end api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on capture end photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 to operate"); - photoOutputPromise.on('captureEnd', async (err, data) => { - if (!err) { - console.info(TAG + "captureEnd callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "captureEnd callback with captureId: " + data.captureId); - console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + 'SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_CAPTURE_END_CALLBACK_0100 FAILED' + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 - * @tc.name : Photo capture callback on frame shutter api - * @tc.desc : Photo capture callback on frame shutter api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "Entering Photo capture callback on frame shutter photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 to operate"); - photoOutputPromise.on('frameShutter', async (err, data) => { - if (!err) { - console.info(TAG + "frameShutter callback is success"); - if (data != null || data != undefined) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 with captureId: " + data.captureId); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 with timestamp: " + data.timestamp); - expect(true).assertTrue(); - } - } else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_PHOTO_CAP_ON_FRAME_SHUTTER_CALLBACK_0100 FAILED: " + err.message); - } - await sleep(1); - done(); - }) - await sleep(1); - done(); - } - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 - * @tc.name : capture session start api - * @tc.desc : capture session start api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + "Entering capture session start captureSession == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 to operate"); - await captureSessionPromise.start(); - console.info(TAG + "Entering captureSession start success"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_START_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 - * @tc.name : isMirrorSupported - * @tc.desc : isMirrorSupported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 to operate"); - await photoOutputPromise.isMirrorSupported() - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 is success"); - console.info(TAG + "isMirrorSupported : " + data); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_ISMIRRORSUPPORTED_PHOTO_OUTPUT_PROMISE_0100 FAILED : " + err.message); - }); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 - * @tc.name : setMirror true - * @tc.desc : setMirror true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100', 0, async function (done) { - if (photoOutputPromise == null || photoOutputPromise == undefined) { - console.info(TAG + "photoOutput == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 to operate"); - await photoOutputPromise.setMirror(true) - .then(function (data) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 is success:"); - console.info(TAG + "setMirror is : " + 'True'); - expect(true).assertTrue(); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SETMIRROR_TRUE_PROMISE_0100 FAILED : " + err.message); - }); - await sleep(1); - done(); - } - await sleep(1); - done(); - }) - - //FLASH Function API scripts - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 - * @tc.name : check if has flash-camera0Input api - * @tc.desc : check if has flash-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100--------------"); - console.info(TAG + 'hasFlash called.') - var hasFlashPromise = await camera0InputPromise.hasFlash(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 success"); - if (hasFlashPromise != null || hasFlashPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 data is not null || undefined"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 PASSED with SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 is: " + JSON.stringify(hasFlashPromise)); - expect(hasFlashPromise).assertEqual(true); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 FAILED : "); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_HAS_FLASH_PROMISE_0100 ends here"); - await sleep(1) - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode open is supported-camera0Input api - * @tc.desc : check if flash mode open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 to operate"); - var isFMOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMOpenSupported != null || isFMOpenSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + JSON.stringify(isFMOpenSupported)); - expect(isFMOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_OPEN_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 - * @tc.name : set flash mode open camera0 api - * @tc.desc : set flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 to operate"); - var SetFMOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMOpen)) - if (SetFMOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 - * @tc.name : get flash mode open camera0 api - * @tc.desc : get flash mode open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 to operate"); - var GetFMOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 success: " + JSON.stringify(GetFMOpen)); - if (GetFMOpen == 1) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + JSON.stringify(GetFMOpen)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 to operate"); - var isFMAlwaysOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMAlwaysOpenSupported != null || isFMAlwaysOpenSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN data is not null || undefined"); - console.info(TAG + "FLASH_MODE_OPEN supported is: " + isFMAlwaysOpenSupported); - expect(isFMAlwaysOpenSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 - * @tc.name : set flash mode always open camera0 api - * @tc.desc : set flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 to operate"); - var SetFMAlwaysOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMAlwaysOpen)) - if (SetFMAlwaysOpen == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 - * @tc.name : get flash mode always open camera0 api - * @tc.desc : get flash mode always open camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 to operate"); - var GetFMAlwaysOpen = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 success"); - if (GetFMAlwaysOpen == 3) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAlwaysOpen); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_ALWAYS_OPEN_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode always open is supported-camera0Input api - * @tc.desc : check if flash mode always open is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 to operate"); - var isFMAutoSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMAutoSupported != null || isFMAutoSupported != undefined) { - console.info(TAG + "Entering FLASH_MODE_AUTO data is not null || undefined"); - console.info(TAG + "FLASH_MODE_AUTO supported is: " + isFMAutoSupported); - expect(isFMAutoSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_AUTO_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 - * @tc.name : set flash mode auto camera0 api - * @tc.desc : set flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 to operate"); - var SetFMAlwaysAuto = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "SetFMAlwaysAuto: " + JSON.stringify(SetFMAlwaysAuto)) - if (SetFMAlwaysAuto == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_AUTO_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 - * @tc.name : get flash mode auto camera0 api - * @tc.desc : get flash mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 to operate"); - var GetFMAuto = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 success"); - if (GetFMAuto == 2) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMAuto); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_AUTO_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 - * @tc.name : check if flash mode close is supported-camera0Input api - * @tc.desc : check if flash mode close is supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 to operate"); - var isFMCloseSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 SUCCESS "); - if (isFMCloseSupported != null || isFMCloseSupported != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 data is not null || undefined"); - console.info(TAG + "FLASH_MODE_CLOSE supported is: " + isFMCloseSupported); - expect(isFMCloseSupported).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FLASH_MODE_CLOSE_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 - * @tc.name : set flash mode close camera0 api - * @tc.desc : set flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 to operate"); - var SetFMClose = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMClose)) - if (SetFMClose == undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 PASSED") - expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0) - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FLASH_MODE_CLOSE_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 - * @tc.name : get flash mode close camera0 api - * @tc.desc : get flash mode close camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 to operate"); - var GetFMClose = await camera0InputPromise.getFlashMode(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 success"); - if (GetFMClose == 0) { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 data is not null || undefined: "); - console.info(TAG + "Current FlashMode is: " + GetFMClose); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FLASH_MODE_CLOSE_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - //ZOOM Function - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 - * @tc.name : get zoom ratio camera-0 cameraId api promise api - * @tc.desc : get zoom ratio camera-0 cameraId api promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100', 0, async function (done) { - console.info("--------------SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100--------------"); - var getZoomRatioPromise = await camera0InputPromise.getZoomRatioRange(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 getZoomRatioPromise: " + JSON.stringify(getZoomRatioPromise)); - if (getZoomRatioPromise != null && getZoomRatioPromise != undefined) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 setZoomRatioPromise is not null || undefined"); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 success: " + JSON.stringify(getZoomRatioPromise)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 PASSED"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 FAILED"); - expect().assertFail(); - } - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_ZOOM_RATIO_PROMISEE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(1); - console.info(TAG + "setZoomRatio success: 1"); - console.info(TAG + "getZoomRatio called") - var getpromise1 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise1); - if (getpromise1 != null && getpromise1 != undefined) { - expect(getpromise1).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_1_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(2); - console.info(TAG + "setZoomRatio success: 2"); - console.info(TAG + "getZoomRatio called") - var getpromise2 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise2); - if (getpromise2 != null && getpromise2 != undefined) { - expect(getpromise2).assertEqual(2); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_2_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(3); - console.info(TAG + "setZoomRatio success: 3"); - console.info(TAG + "getZoomRatio called") - var getpromise3 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise3); - if (getpromise3 != null && getpromise3 != undefined) { - expect(getpromise3).assertEqual(3); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_3_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(4); - console.info(TAG + "setZoomRatio success: 4"); - console.info(TAG + "getZoomRatio called") - var getpromise4 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise4); - if (getpromise4 != null && getpromise4 != undefined) { - expect(getpromise4).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_4_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(5); - console.info(TAG + "setZoomRatio success: 5"); - console.info(TAG + "getZoomRatio called") - var getpromise5 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise5); - if (getpromise5 != null && getpromise5 != undefined) { - expect(getpromise5).assertEqual(5); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_5_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 - * @tc.name : Zoom camera-0 cameraId api - * @tc.desc : Zoom camera-0 cameraId api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100', 0, async function (done) { - var setpromise = await camera0InputPromise.setZoomRatio(6); - console.info(TAG + "setZoomRatio success: 6"); - console.info(TAG + "getZoomRatio called") - var getpromise6 = await camera0InputPromise.getZoomRatio(); - console.info(TAG + "getZoomRatio success: " + getpromise6); - if (getpromise6 != null && getpromise6 != undefined) { - expect(getpromise6).assertEqual(6); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 PASSED "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_SET_GET_ZOOM_6_PROMISE_0100 FAILED"); - expect().assertFail(); - } - await sleep(1); - done(); - }) - - // FOCUS promise API's - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 - * @tc.name : check is focus mode locked supported-camera0Input api - * @tc.desc : check is focus mode locked supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 to operate"); - var isFMLockedSupported = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering is focus mode locked supported SUCCESS "); - if (isFMLockedSupported != null || isFMLockedSupported != undefined) { - console.info(TAG + "Entering is focus mode locked supported data is not null || undefined"); - console.info(TAG + "is focus mode locked supported : " + isFMLockedSupported); - expect(isFMLockedSupported).assertEqual(false); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 PASSED"); - } - else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_LOCKED_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 - * @tc.name : set focus mode locked camera0 api - * @tc.desc : set focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED) - .then(function (data) { - console.info(TAG + "SetFMLocked: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode locked SUCCESS, current focusmode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 FAILED : ") - expect().assertFail(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 PASSED : " + err.message); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_LOCKED_PROMISE_0100 ends here"); - }); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 - * @tc.name : get focus mode locked camera0 api - * @tc.desc : get focus mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode locked success: "); - if (data == 0) { - console.info(TAG + "Current focusmode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_LOCKED_PROMISE_0100 ends here"); - }); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 - * @tc.name : get focal length camera0 api - * @tc.desc : get focal length camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 to operate"); - await camera0InputPromise.getFocalLength() - .then(function (data) { - console.info(TAG + "Current focallength is: " + JSON.stringify(data)); - expect(data).assertEqual(3.4600000381469727); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCAL_LENGTH_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 - * @tc.name : is focusmode manual supported - * @tc.desc : is focusmode manual supported - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 to operate"); - var isFMmanualSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL); - if (isFMmanualSupportedpromise != null || isFMmanualSupportedpromise != undefined) { - console.info(TAG + "Entering is focusmode manual supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMmanualSupportedpromise); - expect(isFMmanualSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_MANUAL_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 - * @tc.name : set focus mode manual camera0 api - * @tc.desc : set focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL) - .then(function (data) { - console.info(TAG + "setFocusManual: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode manual SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_MANUAL_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 - * @tc.name : get focus mode manual camera0 api - * @tc.desc : get focus mode manual camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode manual SUCCESS"); - if (data == 0) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 FAILED : " + err.message); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_MANUAL_PROMISE_0100 ends here"); - }); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 FAILED " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 - * @tc.name : check is focus mode continuous supported-camera0Input api - * @tc.desc : check is focus mode continuous supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 to operate"); - var isFMContinuousSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - if (isFMContinuousSupportedpromise != null || isFMContinuousSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode continuous supported data is not null || undefined"); - console.info(TAG + "FOCUS_MODE_CONTINUOUS_SUPPORTED is: " + isFMContinuousSupportedpromise); - expect(isFMContinuousSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_CONTINUOUS_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 - * @tc.name : set focus mode continuous camera0 api - * @tc.desc : set focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 to operate"); - await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) - .then(function (data) { - console.info(TAG + "setFocusCont: " + JSON.stringify(data)) - console.info(TAG + "Entering set focus mode continuous SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 - * @tc.name : get focus mode continuous camera0 api - * @tc.desc : get focus mode continuous camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 to operate"); - await camera0InputPromise.getFocusMode() - .then(function (data) { - console.info(TAG + "Entering get focus mode continuous SUCCESS"); - if (data == 1) { - console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 PASSED"); - } - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_CONTINUOUS_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 - * @tc.name : check is focus mode auto supported-camera0Input api - * @tc.desc : check is focus mode auto supported-camera0Input api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 to operate"); - var isFMAutoSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); - if (isFMAutoSupportedpromise != null || isFMAutoSupportedpromise != undefined) { - console.info(TAG + "Entering is focus mode auto supported data is not null || undefined"); - console.info(TAG + "is focus mode auto supported is: " + isFMAutoSupportedpromise); - expect(isFMAutoSupportedpromise).assertEqual(true); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 PASSED: "); - } - else { - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 FAILED : "); - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_IS_FOCUS_MODE_AUTO_SUPPORTED_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 - * @tc.name : set focus mode auto camera0 api - * @tc.desc : set focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 to operate"); - var setFocusAuto = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO) - .then(function () { - console.info(TAG + "setFocusAuto: " + JSON.stringify(setFocusAuto)) - console.info(TAG + "Entering set focus mode auto SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 PASSED") - expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2) - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 FAILED : "); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_MODE_AUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 - * @tc.name : get focus mode auto camera0 api - * @tc.desc : get focus mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 to operate"); - var getfocusmodepromise = await camera0InputPromise.getFocusMode(); - console.info(TAG + "Entering get focus mode auto SUCCESS"); - if (getfocusmodepromise == 2) { - console.info(TAG + "Current FocusMode is: " + getfocusmodepromise); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 PASSED"); - } - else { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 FAILED : "); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_MODE_AUTO_PROMISE_0100 ends here"); - } - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 - * @tc.name : set focus Point camera0 api - * @tc.desc : set focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering set focus mode locked to operate"); - await camera0InputPromise.setFocusPoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 PASSED"); - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_FOCUS_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 - * @tc.name : get focus Point camera0 api - * @tc.desc : get focus Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 to operate"); - await camera0InputPromise.getFocusPoint() - .then(function (data) { - console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_FOCUS_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 - * @tc.name : get exposure mode locked camera0 api - * @tc.desc : get exposure mode locked camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode locked SUCCESS"); - console.info(TAG + "Current ExposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_LOCKED_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 mode locked - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 to operate"); - await camera0InputPromise.setExposurePoint(Point1) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 mode locked - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100_exposure mode locked - * @tc.name : get exposure bias range camera0 api - * @tc.desc : get exposure bias range camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureBiasRange() - .then(function (data) { - console.info(TAG + "Entering getExposureBiasRange SUCCESS"); - console.info(TAG + "Current ExposureBiasRange is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_BIASRANGE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 mode locked - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 to operate"); - await camera0InputPromise.setExposureBias(-4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 mode locked - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(-4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 - * @tc.name : get exposure mode auto camera0 api - * @tc.desc : get exposure mode auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_AUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 mode auto - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 to operate"); - await camera0InputPromise.setExposurePoint(Point2) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 FAILED: " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 mode auto - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 FAILED: " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 mode auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 to operate"); - await camera0InputPromise.setExposureBias(1) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 mode auto - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(1); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0200 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 - * @tc.name : get exposure mode continuous auto camera0 api - * @tc.desc : get exposure mode continuous auto camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 to operate"); - await camera0InputPromise.getExposureMode() - .then(function (data) { - console.info(TAG + "Entering get exposure mode auto SUCCESS"); - console.info(TAG + "Current exposureMode is: " + data); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_MODE_CONTINUOUS_AUTO_PROMISE_0100 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 - * @tc.name : set exposure Point camera0 api - * @tc.desc : set exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 to operate"); - await camera0InputPromise.setExposurePoint(Point3) - .then(function (data) { - console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 - * @tc.name : get exposure Point camera0 api - * @tc.desc : get exposure Point camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 to operate"); - await camera0InputPromise.getExposurePoint() - .then(function (data) { - console.info(TAG + "Entering getExposurePoint SUCCESS"); - console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); - expect(true).assertTrue(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_POINT_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 mode continuous auto - * @tc.name : set exposure bias camera0 api - * @tc.desc : set exposure bias camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 to operate"); - await camera0InputPromise.setExposureBias(4) - .then(function (data) { - console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 PASSED") - expect(true).assertTrue(); - }) - .catch((err) => { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 FAILED : " + err.message); - expect().assertFail(); - }); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_SET_EXPOSURE_BIAS_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 - * @tc.name : get exposure value camera0 api - * @tc.desc : get exposure value camera0 api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300', 0, async function (done) { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 to operate"); - await camera0InputPromise.getExposureValue() - .then(function (data) { - console.info(TAG + "Entering getExposureValue SUCCESS"); - console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); - expect(data).assertEqual(4); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 PASSED"); - }) - .catch((err) => { - expect().assertFail(); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 FAILED : " + err.message); - }); - console.info(TAG + "SUB_MULTIMEDIA_CAMERA_GET_EXPOSURE_VALUE_PROMISE_0300 ends here"); - await sleep(1); - done(); - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 - * @tc.name : VideoOutput start promise api - * @tc.desc : VideoOutput start promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video Output start videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 to operate') - await videoOutputPromise.start() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_START_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 - * @tc.name : VideoOutput stop promise api - * @tc.desc : VideoOutput stop promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + 'Entering Video Output Stop videoOutputPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 to operate') - await videoOutputPromise.stop() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_VIDEO_OUTPUT_STOP_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 - * @tc.name : CaptureSession stop promise api - * @tc.desc : CaptureSession stop promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + 'Entering Capture Session Stop captureSessionPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 to operate') - await captureSessionPromise.stop() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_STOP_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 - * @tc.name : CaptureSession release promise api - * @tc.desc : CaptureSession release promise api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100', 0, async function (done) { - if (captureSessionPromise == null || captureSessionPromise == undefined) { - console.info(TAG + 'Entering Capture session release captureSessionPromise == null || undefined') - } else { - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 to operate') - await captureSessionPromise.release() - expect(true).assertTrue() - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 PASSED') - console.info(TAG + 'Entering SUB_MULTIMEDIA_CAMERA_CAPTURE_SESSION_RELEASE_PROMISE_0100 ends here') - await sleep(1) - done() - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : videoOutput release api - * @tc.desc : videoOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (videoOutputPromise == null || videoOutputPromise == undefined) { - console.info(TAG + "Entering Video Output release previewOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await videoOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : PreviewOutput release api - * @tc.desc : PreviewOutput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (previewOutputPromise == null || previewOutputPromise == undefined) { - console.info(TAG + "Entering previewOutputPromise.release previewOutputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await previewOutputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1) - done() - }) - - /** - * @tc.number : SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 - * @tc.name : cameraInput release api - * @tc.desc : cameraInput release api - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100', 0, async function (done) { - if (camera0InputPromise == null || camera0InputPromise == undefined) { - console.info(TAG + "Entering camera0InputPromise.release camera0InputPromise == null || undefined"); - } else { - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 to operate"); - await camera0InputPromise.release(); - expect(true).assertTrue(); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 PASSED"); - console.info(TAG + "Entering SUB_MULTIMEDIA_CAMERA_CAMERAINPUT_RELEASE_SUCCESS_PROMISE_0100 ends here"); - await sleep(1); - done(); - } - await sleep(1) - done() - }) - }) -} \ No newline at end of file diff --git a/multimedia/camera/cameraWideAngleRK/src/main/resources/base/element/string.json b/multimedia/camera/cameraWideAngleRK/src/main/resources/base/element/string.json deleted file mode 100644 index b93f540e29265a34f883a977c442fa85349b94ca..0000000000000000000000000000000000000000 --- a/multimedia/camera/cameraWideAngleRK/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "description_mainability", - "value": "eTS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/BUILD.gn b/multimedia/camera/camera_js_standard/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..1f123ad1a7796fb71fa4bfba44bc4a5a675fe359 --- /dev/null +++ b/multimedia/camera/camera_js_standard/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("camera_framework_ets_hap") { + hap_profile = "./src/main/config.json" + deps = [ + ":camera_ets_assets", + ":camera_ets_resources", + ] + ets2abc = true + + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsCameraStandardETSTest" + subsystem_name = "multimedia" + part_name = "multimedia_camera_framework" +} +ohos_js_assets("camera_ets_assets") { + source_dir = "./src/main/ets/MainAbility" +} +ohos_resources("camera_ets_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/multimedia/camera/camera_js_standard/Test.json b/multimedia/camera/camera_js_standard/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..3fd2d5eef616abf4458239e7f0dfea64939c35f7 --- /dev/null +++ b/multimedia/camera/camera_js_standard/Test.json @@ -0,0 +1,27 @@ +{ + "description": "Configuration for camerastandard Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "1000000", + "package": "com.open.harmony.multimedia.cameratest", + "shell-timeout": "60000" + }, + "kits": [ + { + "type": "ShellKit", + "run-command": [ + "rm -rf /storage/media/100/local/files/Videos/*" + ], + "teardown-command":[ + + ] + }, + { + "test-file-name": [ + "ActsCameraStandardETSTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/multimedia/camera/cameraDepthOffield/signature/openharmony_sx.p7b b/multimedia/camera/camera_js_standard/signature/openharmony_sx.p7b similarity index 100% rename from multimedia/camera/cameraDepthOffield/signature/openharmony_sx.p7b rename to multimedia/camera/camera_js_standard/signature/openharmony_sx.p7b diff --git a/multimedia/camera/camera_js_standard/src/main/config.json b/multimedia/camera/camera_js_standard/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..ab8efa25c2692adabc97663751cdee58ee0866e1 --- /dev/null +++ b/multimedia/camera/camera_js_standard/src/main/config.json @@ -0,0 +1,102 @@ +{ + "app": { + "bundleName": "com.open.harmony.multimedia.cameratest", + "vendor": "open", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.open.harmony.multimedia.cameratest", + "name": ".MyApplication", + "mainAbility": "com.open.harmony.multimedia.cameratest.MainAbility", + "deviceType": [ + "default", + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "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.CAMERA", + "reason": "use ohos.permission.CAMERA" + }, + { + "name": "ohos.permission.MICROPHONE", + "reason": "use ohos.permission.MICROPHONE" + }, + { + "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" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/app.ets b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/app.ets similarity index 100% rename from multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/app.ets rename to multimedia/camera/camera_js_standard/src/main/ets/MainAbility/app.ets diff --git a/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/pages/index.ets b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/pages/index.ets similarity index 100% rename from multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/pages/index.ets rename to multimedia/camera/camera_js_standard/src/main/ets/MainAbility/pages/index.ets diff --git a/multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/Camera.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/Camera.test.ets similarity index 100% rename from multimedia/camera/cameraDepthOffield/src/main/ets/MainAbility/test/Camera.test.ets rename to multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/Camera.test.ets diff --git a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..182488137831939e02e00be5f7c09e189b2fc8ff --- /dev/null +++ b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitCameraFormat.test.ets @@ -0,0 +1,5382 @@ +/* + * 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 cameraObj from '@ohos.multimedia.camera'; +import image from '@ohos.multimedia.image'; +import fileio from '@ohos.fileio'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl' +import bundle from '@ohos.bundle' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; + +const TAG = "CameraModuleTest: "; + +// Define global variables + +var cameraManager; +var surfaceId1; +var camerasArray; + +// CAMERA-0 Variables +var camera0Input, camera0InputPosBack, camera0InputPosFront; +var camera0InputPromise, camera0InputPromisePosBack, camera0InputPromisePosFront; +// CAMERA-1 Variables +var camera1Input, camera1InputPosBack, camera1InputPosFront; +var camera1InputPromise, camera1InputPromisePosBack, camera1InputPromisePosFront; +// CAMERA-2 Variables +var camera2Input, camera2InputPosBack, camera2InputPosFront; +var camera2InputPromise, camera2InputPromisePosBack, camera2InputPromisePosFront; +// CAMERA-3 Variables +var camera3Input, camera3InputPosBack, camera3InputPosFront; +var camera3InputPromise, camera3InputPromisePosBack, camera3InputPromisePosFront; + +export default function cameraJSUnitCameraFormat(surfaceId: any) { + + async function getImageReceiverSurfaceId() { + console.log(TAG + 'Entering create Image receiver') + var receiver = image.createImageReceiver(640, 480, 4, 8) + console.log(TAG + 'before receiver check') + if (receiver !== undefined) { + console.log(TAG + 'Receiver is ok') + surfaceId1 = await receiver.getReceivingSurfaceId() + console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) + } else { + console.log(TAG + 'Receiver is not ok') + } + } + + function sleep(ms) { + console.info(TAG + "Entering sleep -> Promise constructor"); + return new Promise(resolve => setTimeout(resolve, ms)); + } + + async function applyPermission() { + let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); + let atManager = abilityAccessCtrl.createAtManager(); + if (atManager != null) { + let tokenID = appInfo.accessTokenId; + console.info('[permission] case accessTokenID is ' + tokenID); + let permissionName1 = 'ohos.permission.CAMERA'; + let permissionName2 = 'ohos.permission.MICROPHONE'; + let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; + let permissionName4 = 'ohos.permission.READ_MEDIA'; + let permissionName5 = 'ohos.permission.WRITE_MEDIA'; + await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + } else { + console.info('[permission] case apply permission failed, createAtManager failed'); + } + } + + describe('CameraJsUnitCameraFormat', function () { + console.info(TAG + '----------CameraJsUnitCameraFormat--------------') + + beforeAll(async function () { + await applyPermission(); + console.info('beforeAll case'); + }) + + beforeEach(function () { + sleep(5000); + console.info('beforeEach case'); + }) + + afterEach(async function () { + console.info('afterEach case'); + }) + + afterAll(function () { + console.info('afterAll case'); + }) + + /** + * @tc.number : GET_CAMERA_MANAGER_TC_001 + * @tc.name : Create camera manager instance async api + * @tc.desc : Create camera manager instance async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_MANAGER_TC_001', 0, async function (done) { + console.info("--------------GET_CAMERA_MANAGER_TC_001--------------"); + cameraObj.getCameraManager(null, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 data is not null || undefined"); + cameraManager = data; + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_CAMERA_MANAGER_PROMISE_TC_002 + * @tc.name : Create camera manager instance promise api + * @tc.desc : Create camera manager instance promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_MANAGER_PROMISE_TC_002', 0, async function (done) { + console.info("--------------GET_CAMERA_MANAGER_PROMISE_TC_002--------------"); + var cameraManagerPromise = await cameraObj.getCameraManager(null); + console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE_TC_002 cameraManagerPromise: " + JSON.stringify(cameraManagerPromise)); + if (cameraManagerPromise != null && cameraManagerPromise != undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE_TC_002 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE_TC_002 FAILED"); + } + console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE_TC_002 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_CAMERAS_TC_003 + * @tc.name : Get camera from cameramanager to get array of camera async api + * @tc.desc : Get camera from cameramanager to get array of camera async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERAS_TC_003', 0, async function (done) { + console.info("--------------GET_CAMERAS_TC_003--------------"); + cameraManager.getCameras(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_CAMERAS_TC_003 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_CAMERAS_TC_003 data is not null || undefined"); + camerasArray = data; + if (camerasArray != null && camerasArray.length > 0) { + for (var i = 0; i < camerasArray.length; i++) { + // Get the variables from camera object + var cameraId = camerasArray[i].cameraId; + console.info(TAG + "Entering GET_CAMERAS_TC_003 camera" + i + "Id: " + cameraId); + var cameraPosition = camerasArray[i].cameraPosition; + console.info(TAG + "Entering GET_CAMERAS_TC_003 camera" + i + "Position: " + cameraPosition); + var cameraType = camerasArray[i].cameraType; + console.info(TAG + "Entering GET_CAMERAS_TC_003 camera" + i + "Type: " + cameraType); + var connectionType = camerasArray[i].connectionType + console.info(TAG + "Entering GET_CAMERAS_TC_003 connection" + i + "Type: " + connectionType); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERAS_TC_003 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERAS_TC_003 FAILED cameraArray is null || undefined"); + } + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERAS_TC_003 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_CAMERAS_TC_003 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_CAMERAS_PROMISE_TC_004 + * @tc.name : Get camera from cameramanager to get array of camera promise api + * @tc.desc : Get camera from cameramanager to get array of camera promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERAS_PROMISE_TC_004', 0, async function (done) { + console.info("--------------GET_CAMERAS_PROMISE_TC_004--------------"); + var camerasArrayPromise = await cameraManager.getCameras(); + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_004: " + JSON.stringify(camerasArrayPromise)); + if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_004 success"); + for (var i = 0; i < camerasArrayPromise.length; i++) { + // Get the variables from camera object + var cameraId = camerasArrayPromise[i].cameraId; + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_004 camera" + i + "Id: " + cameraId); + var cameraPosition = camerasArrayPromise[i].cameraPosition; + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_004 camera" + i + "Position: " + cameraPosition); + var cameraType = camerasArrayPromise[i].cameraType; + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_004 camera" + i + "Type: " + cameraType); + var connectionType = camerasArrayPromise[i].connectionType + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_004 connection" + i + "Type: " + connectionType); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_004 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_004 FAILED"); + } + console.info(TAG + "Entering GET_CAMERAS_PROMISE_TC_004 ends here"); + await sleep(1000); + done(); + }) + + /*CAMERA-0 Scripts*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_TC_005 + * @tc.name : Create camerainput from camera-0 cameraId async api + * @tc.desc : Create camerainput from camera-0 cameraId async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_TC_005', 0, async function (done) { + console.info("--------------CAMERA-0 STARTS HERE--------------"); + console.info("--------------CREATE_CAMERA_INPUT_TC_005--------------"); + cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_005 data is not null || undefined"); + camera0Input = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_005 PASSED with CameraID :" + camerasArray[0].cameraId); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_005 FAILED: " + err.message); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_005 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_PROMISE_TC_006 + * @tc.name : Create camerainput from camera-0 cameraId promise api + * @tc.desc : Create camerainput from camera-0 cameraId promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_PROMISE_TC_006', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_PROMISE_TC_006--------------"); + camera0InputPromise = await cameraManager.createCameraInput(camerasArray[0].cameraId); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_006 camera0InputPromise: " + JSON.stringify(camera0InputPromise)); + if (camera0InputPromise != null && camera0InputPromise != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_006 camera0InputPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_006 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_006 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_006 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_CAMERA_ID_TC_007 + * @tc.name : get camera if from camera-0 input async api + * @tc.desc : get camera if from camera-0 input async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_ID_TC_007', 0, async function (done) { + camera0Input.getCameraId(async (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering GET_CAMERA_ID_TC_007 data is not null || undefined"); + var CameraId0 = data; + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERA_ID_TC_007 PASSED with CameraID :" + CameraId0); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERA_ID_TC_007 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_CAMERA_ID_TC_007 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_CAMERA_ID_PROMISE_TC_008 + * @tc.name : get camera if from camera-0 input promise api + * @tc.desc : get camera if from camera-0 input promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_ID_PROMISE_TC_008', 0, async function (done) { + var camera0IdPromise = await camera0InputPromise.getCameraId(); + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_TC_008 camera0IdPromise: " + JSON.stringify(camera0IdPromise)); + if (camera0IdPromise != null && camera0IdPromise != undefined) { + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_TC_008 camera0IdPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_TC_008 PASSED" + camera0IdPromise); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_TC_008 FAILED"); + } + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_TC_008 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_011 + * @tc.name : Get supported preview formats from camera-0 camerainput async api + * @tc.desc : Get supported preview formats from camera-0 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_011', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_011--------------"); + camera0InputPromise.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_011 success"); + if (data != null && data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_011 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_011 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(1003); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_011 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_011 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_011 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_012 + * @tc.name : Get supported preview formats from camera-0 camerainput promise api + * @tc.desc : Get supported preview formats from camera-0 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_012', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_012--------------"); + var cam0FormatPromise = await camera0InputPromise.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_012: " + JSON.stringify(cam0FormatPromise)); + if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_012 is not null || undefined"); + for (var i = 0; i < cam0FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_012 cam0FormatPromise: " + cam0FormatPromise[i]); + expect(cam0FormatPromise[i]).assertEqual(1003); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_012 PASSED"); + } + } else { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_012 FAILED"); + expect().assertFail(); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_012 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_VIDEO_FORMATS_TC_013 + * @tc.name : Get supported video formats from camera-0 camerainput async api + * @tc.desc : Get supported video formats from camera-0 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_VIDEO_FORMATS_TC_013', 0, async function (done) { + console.info("--------------GET_SUPPORTED_VIDEO_FORMATS_TC_013--------------"); + camera0InputPromise.getSupportedVideoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_TC_013 success"); + if (data != null && data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_TC_013 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_TC_013 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(1003); + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_TC_013 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_TC_013 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_TC_013 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_VIDEO_FORMATS_PROMISE_TC_014 + * @tc.name : Get supported video formats from camera-0 camerainput promise api + * @tc.desc : Get supported video formats from camera-0 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_VIDEO_FORMATS_PROMISE_TC_014', 0, async function (done) { + console.info("--------------GET_SUPPORTED_VIDEO_FORMATS_PROMISE_TC_014--------------"); + var cam0FormatPromise = await camera0InputPromise.getSupportedVideoFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_TC_014: " + JSON.stringify(cam0FormatPromise)); + if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_TC_014 is not null || undefined"); + for (var i = 0; i < cam0FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_TC_014 cam0FormatPromise: " + cam0FormatPromise[i]); + expect(cam0FormatPromise[i]).assertEqual(1003); + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_TC_014 PASSED"); + } + } else { + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_TC_014 FAILED"); + expect().assertFail(); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_TC_014 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_015 + * @tc.name : Get supported sizes using camera-0 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-0 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_015', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_015--------------"); + camera0InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_015 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_015 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_015 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_015 PASSED"); + } + } else { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_015 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_015 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_016 + * @tc.name : Get supported sizes using camera-0 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-0 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_016', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_016--------------"); + var sizeArrayPromise = await camera0InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_016 sizeArrayPromise"); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_016 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_016 size0ArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_016 PASSED"); + } else { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_016 FAILED"); + expect().assertFail(); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_016 ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_017 + * @tc.name : Get supported photo format from camera-0 camerainput async api + * @tc.desc : Get supported photo format from camera-0 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_017', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_017--------------"); + camera0InputPromise.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_017 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_017 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_017 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_017 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_017 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_017 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_018 + * @tc.name : Get supported photo format from camera-0 camerainput promise api + * @tc.desc : Get supported photo format from camera-0 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_018', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_018--------------"); + var cam0FormatPromise = await camera0InputPromise.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_018: " + JSON.stringify(cam0FormatPromise)); + if (cam0FormatPromise != null && cam0FormatPromise.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_018 is not null || undefined"); + for (var i = 0; i < cam0FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_018 cam0FormatPromise: " + cam0FormatPromise[i]); + expect(cam0FormatPromise[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_018 PASSED"); + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_018 FAILED"); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_018 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_019 + * @tc.name : Get supported sizes from camera-0 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-0 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_019', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_019--------------"); + camera0InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_019 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_019 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_019 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_019 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_019 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_019 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_020 + * @tc.name : Get supported sizes from camera-0 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-0 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_020', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_020--------------"); + var sizeArrayPromise = await camera0InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_020: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_020 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_020 sizeArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_020 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_020 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_020 ends here"); + await sleep(1000); + done(); + }) + */ + + /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE UNSPECIFIED*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_021 + * @tc.name : Create camerainput from camera-0 cameraposition back & cameratype unspecified async api + * @tc.desc : Create camerainput from camera-0 cameraposition back & cameratype unspecified async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_021', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_021--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_021 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_021 data is not null || undefined"); + camera0InputPosBack = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_021 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_021 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_021 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_022 + * @tc.name : Create camerainput from camera-0 cameraposition back & cameratype unspecified promise api + * @tc.desc : Create camerainput from camera-0 cameraposition back & cameratype unspecified promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_022', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_022--------------"); + camera0InputPromisePosBack = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_022 camera0InputPromisePosBack: " + JSON.stringify(camera0InputPromisePosBack)); + if (camera0InputPromisePosBack != null && camera0InputPromisePosBack != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_022 camera0InputPromisePosBack is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_022 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_022 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_022 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_023 + * @tc.name : Get supported preview formats from camera-0 camerainput async api + * @tc.desc : Get supported preview formats from camera-0 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_023', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_023--------------"); + camera0InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_023 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_023 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_023 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(1003); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_023 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_023 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_023 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_024 + * @tc.name : Get supported preview formats from camera-0 camerainput promise api + * @tc.desc : Get supported preview formats from camera-0 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_024', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_024--------------"); + var cam0FormatPromisePosBack = await camera0InputPromisePosBack.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_024: " + JSON.stringify(cam0FormatPromisePosBack)); + if (cam0FormatPromisePosBack != null && cam0FormatPromisePosBack.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_024 is not null || undefined"); + for (var i = 0; i < cam0FormatPromisePosBack.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_024 cam0FormatPromisePosBack: " + cam0FormatPromisePosBack[i]); + expect(cam0FormatPromisePosBack[i]).assertEqual(1003); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_024 PASSED"); + } + } else { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_024 FAILED"); + expect().assertFail(); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_024 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_025 + * @tc.name : Get supported sizes using camera-0 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-0 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_025', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_025--------------"); + camera0InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_025 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_025 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_025 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_025 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_025 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_025 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_026 + * @tc.name : Get supported sizes using camera-0 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-0 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_026', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_026--------------"); + var sizeArrayPromise = await camera0InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_026 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_026 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_026 size0ArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_026 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_026 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_026 ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_027 + * @tc.name : Get supported photo format from camera-0 camerainput async api + * @tc.desc : Get supported photo format from camera-0 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_027', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_027--------------"); + camera0InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_027 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_027 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_027 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_027 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_027 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_027 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_028 + * @tc.name : Get supported photo format from camera-0 camerainput promise api + * @tc.desc : Get supported photo format from camera-0 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_028', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_028--------------"); + var cam0FormatPromisePosBack = await camera0InputPromisePosBack.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_028: " + JSON.stringify(cam0FormatPromisePosBack)); + if (cam0FormatPromisePosBack != null && cam0FormatPromisePosBack.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_028 is not null || undefined"); + for (var i = 0; i < cam0FormatPromisePosBack.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_028 cam0FormatPromisePosBack: " + cam0FormatPromisePosBack[i]); + expect(cam0FormatPromisePosBack[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_028 PASSED"); + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_028 FAILED"); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_028 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_029 + * @tc.name : Get supported sizes from camera-0 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-0 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_029', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_029--------------"); + camera0InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_029 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_029 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_029 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_029 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_029 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_029 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_030 + * @tc.name : Get supported sizes from camera-0 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-0 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_030', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_030--------------"); + var sizeArrayPromise = await camera0InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_030: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_030 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_030 sizeArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_030 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_030 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_030 ends here"); + await sleep(1000); + done(); + }) + */ + + /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE UNSPECIFIED*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_031 + * @tc.name : Create camerainput from camera-0 cameraposition front & cameratype unspecified async api + * @tc.desc : Create camerainput from camera-0 cameraposition front & cameratype unspecified async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_031', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_031--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_031 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_031 data is not null || undefined"); + camera0InputPosFront = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_031 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_031 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_031 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_032 + * @tc.name : Create camerainput from camera-0 cameraposition front & cameratype unspecified promise api + * @tc.desc : Create camerainput from camera-0 cameraposition front & cameratype unspecified promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_032', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_032--------------"); + camera0InputPromisePosFront = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_032 camera0InputPromisePosFront: " + JSON.stringify(camera0InputPromisePosFront)); + if (camera0InputPromisePosFront != null && camera0InputPromisePosFront != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_032 camera0InputPromisePosFront is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_032 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_032 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_032 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_033 + * @tc.name : Get supported preview formats from camera-0 camerainput async api + * @tc.desc : Get supported preview formats from camera-0 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_033', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_033--------------"); + camera0InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_033 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_033 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_033 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(1003); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_033 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_033 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_033 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_034 + * @tc.name : Get supported preview formats from camera-0 camerainput promise api + * @tc.desc : Get supported preview formats from camera-0 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_034', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_034--------------"); + var cam0FormatPromisePosFront = await camera0InputPromisePosFront.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_034: " + JSON.stringify(cam0FormatPromisePosFront)); + if (cam0FormatPromisePosFront != null && cam0FormatPromisePosFront.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_034 is not null || undefined"); + for (var i = 0; i < cam0FormatPromisePosFront.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_034 cam0FormatPromisePosFront: " + cam0FormatPromisePosFront[i]); + expect(cam0FormatPromisePosFront[i]).assertEqual(1003); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_034 PASSED"); + } + } else { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_034 FAILED"); + expect().assertFail(); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_034 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_035 + * @tc.name : Get supported sizes using camera-0 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-0 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_035', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_035--------------"); + camera0InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_035 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_035 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_035 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_035 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_035 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_035 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_036 + * @tc.name : Get supported sizes using camera-0 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-0 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_036', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_036--------------"); + var sizeArrayPromise = await camera0InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_036 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_036 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_036 size0ArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_036 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_036 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_036 ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_037 + * @tc.name : Get supported photo format from camera-0 camerainput async api + * @tc.desc : Get supported photo format from camera-0 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_037', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_037--------------"); + camera0InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_037 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_037 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_037 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_037 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_037 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_037 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_038 + * @tc.name : Get supported photo format from camera-0 camerainput promise api + * @tc.desc : Get supported photo format from camera-0 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_038', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_038--------------"); + var cam0FormatPromisePosFront = await camera0InputPromisePosFront.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_038: " + JSON.stringify(cam0FormatPromisePosFront)); + if (cam0FormatPromisePosFront != null && cam0FormatPromisePosFront.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_038 is not null || undefined"); + for (var i = 0; i < cam0FormatPromisePosFront.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_038 cam0FormatPromisePosFront: " + cam0FormatPromisePosFront[i]); + expect(cam0FormatPromisePosFront[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_038 PASSED"); + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_038 FAILED"); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_038 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_039 + * @tc.name : Get supported sizes from camera-0 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-0 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_039', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_039--------------"); + camera0InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_039 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_039 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_039 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_039 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_039 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_039 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_040 + * @tc.name : Get supported sizes from camera-0 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-0 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_040', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_040--------------"); + var sizeArrayPromise = await camera0InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_040: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_040 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_040 sizeArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_040 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_040 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_040 ends here"); + console.info("--------------CAMERA-0 ENDS HERE--------------"); + await sleep(1000); + done(); + }) + */ + + it('FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT', 0, async function (done) { + if (camera0InputPromise == null || camera0InputPromise == undefined) { + console.info(TAG + "Entering FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT to operate"); + camera0InputPromise.on("focusStateChange", async (err, data) => { + if (!err) { + console.info(TAG + "FocusState callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Current FocusState is: " + data); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /*CAMERA-1 Scripts*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_TC_041 + * @tc.name : Create camerainput from camera-1 cameraId async api + * @tc.desc : Create camerainput from camera-1 cameraId async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_TC_041', 0, async function (done) { + console.info("--------------CAMERA-1 STARTS HERE--------------"); + console.info("--------------CREATE_CAMERA_INPUT_TC_041--------------"); + cameraManager.createCameraInput(camerasArray[1].cameraId, async (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_041 data is not null || undefined"); + camera1Input = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_041 PASSED with CameraID :" + camerasArray[1].cameraId); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_041 FAILED: " + err.message); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_041 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_PROMISE_TC_042 + * @tc.name : Create camerainput from camera-1 cameraId promise api + * @tc.desc : Create camerainput from camera-1 cameraId promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_PROMISE_TC_042', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_PROMISE_TC_042--------------"); + camera1InputPromise = await cameraManager.createCameraInput(camerasArray[1].cameraId); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_042 camera1InputPromise: " + JSON.stringify(camera1InputPromise)); + if (camera1InputPromise != null && camera1InputPromise != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_042 camera1InputPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_042 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_042 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_042 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_CAMERA_ID_CAMINPUT1_TC_43 + * @tc.name : get camera ID from camera-1 input async api + * @tc.desc : get camera ID from camera-1 input async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_ID_CAMINPUT1_TC_43', 0, async function (done) { + camera1Input.getCameraId(async (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering GET_CAMERA_ID_CAMINPUT1_TC_43 data is not null || undefined"); + var CameraId1 = data; + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERA_ID_CAMINPUT1_TC_43 PASSED with CameraID : " + CameraId1); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERA_ID_CAMINPUT1_TC_43 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_CAMERA_ID_CAMINPUT1_TC_43 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_CAMERA_ID_PROMISE_CAMINPUT1_TC_44 + * @tc.name : get camera ID from camera-1 input promise api + * @tc.desc : get camera ID from camera-1 input promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_ID_PROMISE_CAMINPUT1_TC_44', 0, async function (done) { + var camera1IdPromise = await camera1InputPromise.getCameraId(); + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_CAMINPUT1_TC_44 camera1IdPromise: " + JSON.stringify(camera1IdPromise)); + if (camera1IdPromise != null && camera1IdPromise != undefined) { + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_CAMINPUT1_TC_44 camera1IdPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_CAMINPUT1_TC_44 PASSED" + camera1IdPromise); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_CAMINPUT1_TC_44 FAILED"); + } + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_CAMINPUT1_TC_44 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POSITION_TYPE_TC_045 + * @tc.name : Create camerainput from camera-1 cameraposition & cameratype async api + * @tc.desc : Create camerainput from camera-1 cameraposition & cameratype async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POSITION_TYPE_TC_045', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POSITION_TYPE_TC_045--------------"); + cameraManager.createCameraInput(camerasArray[1].cameraPosition, camerasArray[1].cameraType, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_045 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_045 data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_045 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_045 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_045 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_046 + * @tc.name : Create camerainput from camera-1 cameraposition & cameratype promise api + * @tc.desc : Create camerainput from camera-1 cameraposition & cameratype promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_046', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_046--------------"); + var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[1].cameraPosition, camerasArray[1].cameraType); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_046 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); + if (cameraInputPromise != null && cameraInputPromise != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_046 cameraInputPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_046 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_046 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_046 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_047 + * @tc.name : Get supported preview formats from camera-1 camerainput async api + * @tc.desc : Get supported preview formats from camera-1 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_047', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_047--------------"); + camera1InputPromise.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_047 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_047 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_047 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(1003); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_047 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_047 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_047 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_048 + * @tc.name : Get supported preview formats from camera-1 camerainput promise api + * @tc.desc : Get supported preview formats from camera-1 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_048', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_048--------------"); + var cam1FormatPromise = await camera1InputPromise.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_048: " + JSON.stringify(cam1FormatPromise)); + if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_048 is not null || undefined"); + for (var i = 0; i < cam1FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_048 cam1FormatPromise: " + cam1FormatPromise[i]); + expect(cam1FormatPromise[i]).assertEqual(1003); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_048 PASSED"); + } + } else { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_048 FAILED"); + expect().assertFail(); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_048 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_TC_049 + * @tc.name : Get supported video formats from camera-1 camerainput async api + * @tc.desc : Get supported video formats from camera-1 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_TC_049', 0, async function (done) { + console.info("--------------GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_TC_049--------------"); + camera1InputPromise.getSupportedVideoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_TC_049 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_TC_049 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_TC_049 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(1003); + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_TC_049 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_TC_049 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT1_TC_049 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT1_TC_050 + * @tc.name : Get supported video formats from camera-1 camerainput promise api + * @tc.desc : Get supported video formats from camera-1 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT1_TC_050', 0, async function (done) { + console.info("--------------GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT1_TC_050--------------"); + var cam1FormatPromise = await camera1InputPromise.getSupportedVideoFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT1_TC_050: " + JSON.stringify(cam1FormatPromise)); + if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT1_TC_050 is not null || undefined"); + for (var i = 0; i < cam1FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT1_TC_050 cam1FormatPromise: " + cam1FormatPromise[i]); + expect(cam1FormatPromise[i]).assertEqual(1003); + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT1_TC_050 PASSED"); + } + } else { + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT1_TC_050 FAILED"); + expect().assertFail(); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT1_TC_050 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_051 + * @tc.name : Get supported sizes using camera-1 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-1 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_051', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_051--------------"); + camera1InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_051 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_051 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_051 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_051 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_051 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_051 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_052 + * @tc.name : Get supported sizes using camera-1 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-1 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_052', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_052--------------"); + var sizeArrayPromise = await camera1InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_052 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_052 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_052 sizeArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_052 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_052 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_052 ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_053 + * @tc.name : Get supported photo format from camera-1 camerainput async api + * @tc.desc : Get supported photo format from camera-1 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_053', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_053--------------"); + camera1InputPromise.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_053 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_053 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_053 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_053 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_053 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_053 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_054 + * @tc.name : Get supported photo format from camera-1 camerainput promise api + * @tc.desc : Get supported photo format from camera-1 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_054', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_054--------------"); + var cam1FormatPromise = await camera1InputPromise.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_054: " + JSON.stringify(cam1FormatPromise)); + if (cam1FormatPromise != null && cam1FormatPromise.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_054 is not null || undefined"); + for (var i = 0; i < cam1FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_054 cam1FormatPromise: " + cam1FormatPromise[i]); + expect(cam1FormatPromise[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_054 PASSED"); + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_054 FAILED"); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_054 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_055 + * @tc.name : Get supported sizes from camera-1 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-1 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_055', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_055--------------"); + camera1InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_055 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_055 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_055 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_055 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_055 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_055 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_056 + * @tc.name : Get supported sizes from camera-1 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-1 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_056', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_056--------------"); + var sizeArrayPromise = await camera1InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_056: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_056 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_056 sizeArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_056 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_056 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_056 ends here"); + await sleep(1000); + done(); + }) + */ + + /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE UNSPECIFIED*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_057 + * @tc.name : Create camerainput from camera-1 cameraposition back & cameratype unspecified async api + * @tc.desc : Create camerainput from camera-1 cameraposition back & cameratype unspecified async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_057', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_057--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_057 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_057 data is not null || undefined"); + camera1InputPosBack = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_057 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_057 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_057 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_058 + * @tc.name : Create camerainput from camera-1 cameraposition back & cameratype unspecified promise api + * @tc.desc : Create camerainput from camera-1 cameraposition back & cameratype unspecified promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_058', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_058--------------"); + camera1InputPromisePosBack = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_058 camera1InputPromisePosBack: " + JSON.stringify(camera1InputPromisePosBack)); + if (camera1InputPromisePosBack != null && camera1InputPromisePosBack != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_058 camera1InputPromisePosBack is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_058 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_058 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_058 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_059 + * @tc.name : Get supported preview formats from camera-1 camerainput async api + * @tc.desc : Get supported preview formats from camera-1 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_059', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_059--------------"); + camera1InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_059 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_059 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_059 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(1003); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_059 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_059 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_059 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_060 + * @tc.name : Get supported preview formats from camera-1 camerainput promise api + * @tc.desc : Get supported preview formats from camera-1 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_060', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_060--------------"); + var cam1FormatPromisePosBack = await camera1InputPromisePosBack.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_060: " + JSON.stringify(cam1FormatPromisePosBack)); + if (cam1FormatPromisePosBack != null && cam1FormatPromisePosBack.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_060 is not null || undefined"); + for (var i = 0; i < cam1FormatPromisePosBack.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_060 cam1FormatPromisePosBack: " + cam1FormatPromisePosBack[i]); + expect(cam1FormatPromisePosBack[i]).assertEqual(1003); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_060 PASSED"); + } + } else { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_060 FAILED"); + expect().assertFail(); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_060 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_061 + * @tc.name : Get supported sizes using camera-1 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-1 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_061', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_061--------------"); + camera1InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_061 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_061 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_061 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_061 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_061 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_061 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_062 + * @tc.name : Get supported sizes using camera-1 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-1 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_062', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_062--------------"); + var sizeArrayPromise = await camera1InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_062 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_062 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_062 size0ArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_062 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_062 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_062 ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_063 + * @tc.name : Get supported photo format from camera-1 camerainput async api + * @tc.desc : Get supported photo format from camera-1 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_063', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_063--------------"); + camera1InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_063 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_063 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_063 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_063 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_063 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_063 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_064 + * @tc.name : Get supported photo format from camera-1 camerainput promise api + * @tc.desc : Get supported photo format from camera-1 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_064', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_064--------------"); + var cam1FormatPromisePosBack = await camera1InputPromisePosBack.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_064: " + JSON.stringify(cam1FormatPromisePosBack)); + if (cam1FormatPromisePosBack != null && cam1FormatPromisePosBack.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_064 is not null || undefined"); + for (var i = 0; i < cam1FormatPromisePosBack.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_064 cam1FormatPromisePosBack: " + cam1FormatPromisePosBack[i]); + expect(cam1FormatPromisePosBack[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_064 PASSED"); + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_064 FAILED"); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_064 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_065 + * @tc.name : Get supported sizes from camera-1 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-1 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_065', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_065--------------"); + camera1InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_065 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_065 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_065 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_065 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_065 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_065 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_066 + * @tc.name : Get supported sizes from camera-1 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-1 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_066', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_066--------------"); + var sizeArrayPromise = await camera1InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_066: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_066 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_066 sizeArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_066 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_066 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_066 ends here"); + await sleep(1000); + done(); + }) + */ + + /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE UNSPECIFIED*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_067 + * @tc.name : Create camerainput from camera-1 cameraposition front & cameratype unspecified async api + * @tc.desc : Create camerainput from camera-1 cameraposition front & cameratype unspecified async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_067', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_067--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_067 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_067 data is not null || undefined"); + camera1InputPosFront = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_067 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_067 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_067 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_068 + * @tc.name : Create camerainput from camera-1 cameraposition front & cameratype unspecified promise api + * @tc.desc : Create camerainput from camera-1 cameraposition front & cameratype unspecified promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_068', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_068--------------"); + camera1InputPromisePosFront = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_068 camera1InputPromisePosFront: " + JSON.stringify(camera1InputPromisePosFront)); + if (camera1InputPromisePosFront != null && camera1InputPromisePosFront != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_068 camera1InputPromisePosFront is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_068 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_068 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_068 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_069 + * @tc.name : Get supported preview formats from camera-1 camerainput async api + * @tc.desc : Get supported preview formats from camera-1 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_069', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_069--------------"); + camera1InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_069 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_069 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_069 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(1003); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_069 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_069 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_069 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_070 + * @tc.name : Get supported preview formats from camera-1 camerainput promise api + * @tc.desc : Get supported preview formats from camera-1 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_070', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_070--------------"); + var cam1FormatPromisePosFront = await camera1InputPromisePosFront.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_070: " + JSON.stringify(cam1FormatPromisePosFront)); + if (cam1FormatPromisePosFront != null && cam1FormatPromisePosFront.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_070 is not null || undefined"); + for (var i = 0; i < cam1FormatPromisePosFront.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_070 cam1FormatPromisePosFront: " + cam1FormatPromisePosFront[i]); + expect(cam1FormatPromisePosFront[i]).assertEqual(1003); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_070 PASSED"); + } + } else { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_070 FAILED"); + expect().assertFail(); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_070 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_071 + * @tc.name : Get supported sizes using camera-1 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-1 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_071', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_071--------------"); + camera1InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_071 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_071 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_071 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_071 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_071 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_071 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_072 + * @tc.name : Get supported sizes using camera-1 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-1 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_072', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_072--------------"); + var sizeArrayPromise = await camera1InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_072 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_072 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_072 size0ArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_072 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_072 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_072 ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_073 + * @tc.name : Get supported photo format from camera-1 camerainput async api + * @tc.desc : Get supported photo format from camera-1 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_073', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_073--------------"); + camera1InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_073 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_073 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_073 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_073 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_073 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_073 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_074 + * @tc.name : Get supported photo format from camera-1 camerainput promise api + * @tc.desc : Get supported photo format from camera-1 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_074', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_074--------------"); + var cam1FormatPromisePosFront = await camera1InputPromisePosFront.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_074: " + JSON.stringify(cam1FormatPromisePosFront)); + if (cam1FormatPromisePosFront != null && cam1FormatPromisePosFront.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_074 is not null || undefined"); + for (var i = 0; i < cam1FormatPromisePosFront.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_074 cam1FormatPromisePosFront: " + cam1FormatPromisePosFront[i]); + expect(cam1FormatPromisePosFront[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_074 PASSED"); + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_074 FAILED"); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_074 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_075 + * @tc.name : Get supported sizes from camera-1 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-1 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_075', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_075--------------"); + camera1InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_075 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_075 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_075 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_075 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_075 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_075 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_076 + * @tc.name : Get supported sizes from camera-1 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-1 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_076', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_076--------------"); + var sizeArrayPromise = await camera1InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_076: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_076 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_076 sizeArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_076 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_076 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_076 ends here"); + console.info("--------------CAMERA-1 ENDS HERE--------------"); + await sleep(1000); + done(); + }) + */ + + /*CAMERA-2 Scripts*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_TC_077 + * @tc.name : Create camerainput from camera-2 cameraId async api + * @tc.desc : Create camerainput from camera-2 cameraId async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_TC_077', 0, async function (done) { + console.info("--------------CAMERA-2 STARTS HERE--------------"); + console.info("--------------CREATE_CAMERA_INPUT_TC_077--------------"); + cameraManager.createCameraInput(camerasArray[2].cameraId, async (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_077 data is not null || undefined"); + camera2Input = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_077 PASSED with CameraID :" + camerasArray[2].cameraId); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_077 FAILED: " + err.message); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_077 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_PROMISE_TC_078 + * @tc.name : Create camerainput from camera-2 cameraId promise api + * @tc.desc : Create camerainput from camera-2 cameraId promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_PROMISE_TC_078', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_PROMISE_TC_078--------------"); + camera2InputPromise = await cameraManager.createCameraInput(camerasArray[2].cameraId); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_078 camera2InputPromise: " + JSON.stringify(camera2InputPromise)); + if (camera2InputPromise != null && camera2InputPromise != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_078 camera2InputPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_078 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_078 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_078 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_CAMERA_ID_CAMINPUT2_TC_079 + * @tc.name : get camera ID from camera-2 input async api + * @tc.desc : get camera ID from camera-2 input async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_ID_CAMINPUT2_TC_079', 0, async function (done) { + camera2Input.getCameraId(async (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering GET_CAMERA_ID_CAMINPUT2_TC_079 data is not null || undefined"); + var CameraId2 = data; + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERA_ID_CAMINPUT2_TC_079 PASSED with CameraID : " + CameraId2); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERA_ID_CAMINPUT2_TC_079 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_CAMERA_ID_CAMINPUT2_TC_079 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_CAMERA_ID_PROMISE_CAMINPUT2_TC_080 + * @tc.name : get camera ID from camera-2 input promise api + * @tc.desc : get camera ID from camera-2 input promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_ID_PROMISE_CAMINPUT2_TC_080', 0, async function (done) { + var camera2IdPromise = await camera2InputPromise.getCameraId(); + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_CAMINPUT2_TC_080 camera2IdPromise: " + JSON.stringify(camera2IdPromise)); + if (camera2IdPromise != null && camera2IdPromise != undefined) { + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_CAMINPUT2_TC_080 camera2IdPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_CAMINPUT2_TC_080 PASSED" + camera2IdPromise); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_CAMINPUT2_TC_080 FAILED"); + } + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_CAMINPUT2_TC_080 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POSITION_TYPE_TC_081 + * @tc.name : Create camerainput from camera-2 cameraposition & cameratype async api + * @tc.desc : Create camerainput from camera-2 cameraposition & cameratype async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POSITION_TYPE_TC_081', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POSITION_TYPE_TC_081--------------"); + cameraManager.createCameraInput(camerasArray[2].cameraPosition, camerasArray[2].cameraType, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_081 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_081 data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_081 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_081 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_081 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_082 + * @tc.name : Create camerainput from camera-2 cameraposition & cameratype promise api + * @tc.desc : Create camerainput from camera-2 cameraposition & cameratype promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_082', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_082--------------"); + var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[2].cameraPosition, camerasArray[2].cameraType); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_082 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); + if (cameraInputPromise != null && cameraInputPromise != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_082 cameraInputPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_082 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_082 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_082 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_083 + * @tc.name : Get supported preview formats from camera-2 camerainput async api + * @tc.desc : Get supported preview formats from camera-2 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_083', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_083--------------"); + camera2InputPromise.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_083 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_083 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_083 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(1003); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_083 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_083 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_083 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_084 + * @tc.name : Get supported preview formats from camera-2 camerainput promise api + * @tc.desc : Get supported preview formats from camera-2 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_084', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_084--------------"); + var cam2FormatPromise = await camera2InputPromise.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_084: " + JSON.stringify(cam2FormatPromise)); + if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_084 is not null || undefined"); + for (var i = 0; i < cam2FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_084 cam2FormatPromise: " + cam2FormatPromise[i]); + expect(cam2FormatPromise[i]).assertEqual(1003); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_084 PASSED"); + } + } else { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_084 FAILED"); + expect().assertFail(); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_084 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_TC_85 + * @tc.name : Get supported video formats from camera-2 camerainput async api + * @tc.desc : Get supported video formats from camera-2 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_TC_85', 0, async function (done) { + console.info("--------------GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_TC_85--------------"); + camera2InputPromise.getSupportedVideoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_TC_85 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_TC_85 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_TC_85 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(1003); + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_TC_85 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_TC_85 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT2_TC_85 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT2_TC_086 + * @tc.name : Get supported video formats from camera-2 camerainput promise api + * @tc.desc : Get supported video formats from camera-2 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT2_TC_086', 0, async function (done) { + console.info("--------------GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT2_TC_086--------------"); + var cam2FormatPromise = await camera2InputPromise.getSupportedVideoFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT2_TC_086: " + JSON.stringify(cam2FormatPromise)); + if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT2_TC_086 is not null || undefined"); + for (var i = 0; i < cam2FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT2_TC_086 cam2FormatPromise: " + cam2FormatPromise[i]); + expect(cam2FormatPromise[i]).assertEqual(1003); + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT2_TC_086 PASSED"); + } + } else { + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT2_TC_086 FAILED"); + expect().assertFail(); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT2_TC_086 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_087 + * @tc.name : Get supported sizes using camera-2 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-2 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_087', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_087--------------"); + camera2InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_087 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_087 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_087 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_087 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_087 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_087 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_088 + * @tc.name : Get supported sizes using camera-2 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-2 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_088', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_088--------------"); + var sizeArrayPromise = await camera2InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_088 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_088 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_088 sizeArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_088 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_088 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_088 ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_089 + * @tc.name : Get supported photo format from camera-2 camerainput async api + * @tc.desc : Get supported photo format from camera-2 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_089', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_089--------------"); + camera2InputPromise.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_089 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_089 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_089 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_089 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_089 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_089 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_090 + * @tc.name : Get supported photo format from camera-2 camerainput promise api + * @tc.desc : Get supported photo format from camera-2 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_090', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_090--------------"); + var cam2FormatPromise = await camera2InputPromise.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_090: " + JSON.stringify(cam2FormatPromise)); + if (cam2FormatPromise != null && cam2FormatPromise.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_090 is not null || undefined"); + for (var i = 0; i < cam2FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_090 cam2FormatPromise: " + cam2FormatPromise[i]); + expect(cam2FormatPromise[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_090 PASSED"); + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_090 FAILED"); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_090 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_091 + * @tc.name : Get supported sizes from camera-2 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-2 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_091', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_091--------------"); + camera2InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_091 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_091 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_091 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_091 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_091 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_091 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_092 + * @tc.name : Get supported sizes from camera-2 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-2 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_092', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_092--------------"); + var sizeArrayPromise = await camera2InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_092: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_092 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_092 sizeArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_092 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_092 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_092 ends here"); + await sleep(1000); + done(); + }) + */ + + /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE UNSPECIFIED*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_093 + * @tc.name : Create camerainput from camera-2 cameraposition back & cameratype unspecified async api + * @tc.desc : Create camerainput from camera-2 cameraposition back & cameratype unspecified async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_093', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_093--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_093 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_093 data is not null || undefined"); + camera2InputPosBack = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_093 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_093 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_093 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_094 + * @tc.name : Create camerainput from camera-2 cameraposition back & cameratype unspecified promise api + * @tc.desc : Create camerainput from camera-2 cameraposition back & cameratype unspecified promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_094', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_094--------------"); + camera2InputPromisePosBack = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_094 camera2InputPromisePosBack: " + JSON.stringify(camera2InputPromisePosBack)); + if (camera2InputPromisePosBack != null && camera2InputPromisePosBack != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_094 camera2InputPromisePosBack is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_094 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_094 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_094 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_095 + * @tc.name : Get supported preview formats from camera-2 camerainput async api + * @tc.desc : Get supported preview formats from camera-2 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_095', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_095--------------"); + camera2InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_095 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_095 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_095 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(1003); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_095 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_095 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_095 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_096 + * @tc.name : Get supported preview formats from camera-2 camerainput promise api + * @tc.desc : Get supported preview formats from camera-2 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_096', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_096--------------"); + var cam2FormatPromisePosBack = await camera2InputPromisePosBack.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_096: " + JSON.stringify(cam2FormatPromisePosBack)); + if (cam2FormatPromisePosBack != null && cam2FormatPromisePosBack.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_096 is not null || undefined"); + for (var i = 0; i < cam2FormatPromisePosBack.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_096 cam2FormatPromisePosBack: " + cam2FormatPromisePosBack[i]); + expect(cam2FormatPromisePosBack[i]).assertEqual(1003); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_096 PASSED"); + } + } else { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_096 FAILED"); + expect().assertFail(); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_096 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_097 + * @tc.name : Get supported sizes using camera-2 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-2 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_097', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_097--------------"); + camera2InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_097 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_097 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_097 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_097 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_097 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_097 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_098 + * @tc.name : Get supported sizes using camera-2 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-2 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_098', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_098--------------"); + var sizeArrayPromise = await camera2InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_098 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_098 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_098 size0ArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_098 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_098 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_098 ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_099 + * @tc.name : Get supported photo format from camera-2 camerainput async api + * @tc.desc : Get supported photo format from camera-2 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_099', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_099--------------"); + camera2InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_099 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_099 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_099 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_099 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_099 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_099 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_100 + * @tc.name : Get supported photo format from camera-2 camerainput promise api + * @tc.desc : Get supported photo format from camera-2 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_100', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_100--------------"); + var cam2FormatPromisePosBack = await camera2InputPromisePosBack.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_100: " + JSON.stringify(cam2FormatPromisePosBack)); + if (cam2FormatPromisePosBack != null && cam2FormatPromisePosBack.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_100 is not null || undefined"); + for (var i = 0; i < cam2FormatPromisePosBack.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_100 cam2FormatPromisePosBack: " + cam2FormatPromisePosBack[i]); + expect(cam2FormatPromisePosBack[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_100 PASSED"); + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_100 FAILED"); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_100 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_101 + * @tc.name : Get supported sizes from camera-2 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-2 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_101', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_101--------------"); + camera2InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_101 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_101 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_101 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_101 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_101 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_101 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_102 + * @tc.name : Get supported sizes from camera-2 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-2 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_102', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_102--------------"); + var sizeArrayPromise = await camera2InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_102: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_102 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_102 sizeArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_102 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_102 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_102 ends here"); + await sleep(1000); + done(); + }) + */ + + /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE UNSPECIFIED*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_103 + * @tc.name : Create camerainput from camera-2 cameraposition front & cameratype unspecified async api + * @tc.desc : Create camerainput from camera-2 cameraposition front & cameratype unspecified async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_103', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_103--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_103 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_103 data is not null || undefined"); + camera2InputPosFront = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_103 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_103 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_103 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_104 + * @tc.name : Create camerainput from camera-2 cameraposition front & cameratype unspecified promise api + * @tc.desc : Create camerainput from camera-2 cameraposition front & cameratype unspecified promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_104', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_104--------------"); + camera2InputPromisePosFront = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_104 camera2InputPromisePosFront: " + JSON.stringify(camera2InputPromisePosFront)); + if (camera2InputPromisePosFront != null && camera2InputPromisePosFront != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_104 camera2InputPromisePosFront is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_104 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_104 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_104 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_105 + * @tc.name : Get supported preview formats from camera-2 camerainput async api + * @tc.desc : Get supported preview formats from camera-2 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_105', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_105--------------"); + camera2InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_105 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_105 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_105 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(1003); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_105 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_105 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_105 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_106 + * @tc.name : Get supported preview formats from camera-2 camerainput promise api + * @tc.desc : Get supported preview formats from camera-2 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_106', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_106--------------"); + var cam2FormatPromisePosFront = await camera2InputPromisePosFront.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_106: " + JSON.stringify(cam2FormatPromisePosFront)); + if (cam2FormatPromisePosFront != null && cam2FormatPromisePosFront.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_106 is not null || undefined"); + for (var i = 0; i < cam2FormatPromisePosFront.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_106 cam2FormatPromisePosFront: " + cam2FormatPromisePosFront[i]); + expect(cam2FormatPromisePosFront[i]).assertEqual(1003); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_106 PASSED"); + } + } else { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_106 FAILED"); + expect().assertFail(); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_106 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_107 + * @tc.name : Get supported sizes using camera-2 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-2 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_107', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_107--------------"); + camera2InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_107 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_107 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_107 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_107 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_107 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_107 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_108 + * @tc.name : Get supported sizes using camera-2 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-2 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_108', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_108--------------"); + var sizeArrayPromise = await camera2InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_108 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_108 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_108 size0ArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_108 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_108 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_108 ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_109 + * @tc.name : Get supported photo format from camera-2 camerainput async api + * @tc.desc : Get supported photo format from camera-2 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_109', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_109--------------"); + camera2InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_109 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_109 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_109 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_109 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_109 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_109 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_110 + * @tc.name : Get supported photo format from camera-2 camerainput promise api + * @tc.desc : Get supported photo format from camera-2 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_110', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_110--------------"); + var cam2FormatPromisePosFront = await camera2InputPromisePosFront.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_110: " + JSON.stringify(cam2FormatPromisePosFront)); + if (cam2FormatPromisePosFront != null && cam2FormatPromisePosFront.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_110 is not null || undefined"); + for (var i = 0; i < cam2FormatPromisePosFront.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_110 cam2FormatPromisePosFront: " + cam2FormatPromisePosFront[i]); + expect(cam2FormatPromisePosFront[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_110 PASSED"); + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_110 FAILED"); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_110 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_111 + * @tc.name : Get supported sizes from camera-2 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-2 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_013', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_111--------------"); + camera2InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_111 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_111 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_111 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_111 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_111 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_111 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_112 + * @tc.name : Get supported sizes from camera-2 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-2 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_112', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_112--------------"); + var sizeArrayPromise = await camera2InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_112: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_112 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_112 sizeArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_112 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_112 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_112 ends here"); + console.info("--------------CAMERA-2 ENDS HERE--------------"); + await sleep(1000); + done(); + }) + */ + + /*CAMERA-3 Scripts*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_TC_113 + * @tc.name : Create camerainput from camera-3 cameraId async api + * @tc.desc : Create camerainput from camera-3 cameraId async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_TC_113', 0, async function (done) { + console.info("--------------CAMERA-3 STARTS HERE--------------"); + console.info("--------------CREATE_CAMERA_INPUT_TC_113--------------"); + cameraManager.createCameraInput(camerasArray[3].cameraId, async (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_113 data is not null || undefined"); + camera3Input = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_113 PASSED with CameraID :" + camerasArray[3].cameraId); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_113 FAILED: " + err.message); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_113 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_PROMISE_TC_114 + * @tc.name : Create camerainput from camera-3 cameraId promise api + * @tc.desc : Create camerainput from camera-3 cameraId promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_PROMISE_TC_114', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_PROMISE_TC_114--------------"); + camera3InputPromise = await cameraManager.createCameraInput(camerasArray[3].cameraId); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_114 camera3InputPromise: " + JSON.stringify(camera3InputPromise)); + if (camera3InputPromise != null && camera3InputPromise != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_114 camera3InputPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_114 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_114 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE_TC_114 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_CAMERA_ID_CAMINPUT3_TC_115 + * @tc.name : get camera ID from camera-3 input async api + * @tc.desc : get camera ID from camera-3 input async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_ID_CAMINPUT3_TC_115', 0, async function (done) { + camera3Input.getCameraId(async (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering GET_CAMERA_ID_CAMINPUT3_TC_115 data is not null || undefined"); + var CameraId3 = data; + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERA_ID_CAMINPUT3_TC_115 PASSED with CameraID : " + CameraId3); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERA_ID_CAMINPUT3_TC_115 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_CAMERA_ID_CAMINPUT3_TC_115 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_CAMERA_ID_PROMISE_CAMINPUT3_TC_116 + * @tc.name : get camera ID from camera-3 input promise api + * @tc.desc : get camera ID from camera-3 input promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_ID_PROMISE_CAMINPUT3_TC_116', 0, async function (done) { + var camera3IdPromise = await camera3InputPromise.getCameraId(); + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_CAMINPUT3_TC_116 camera3IdPromise: " + JSON.stringify(camera3IdPromise)); + if (camera3IdPromise != null && camera3IdPromise != undefined) { + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_CAMINPUT3_TC_116 camera3IdPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_CAMINPUT3_TC_116 PASSED" + camera3IdPromise); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_CAMINPUT3_TC_116 FAILED"); + } + console.info(TAG + "Entering GET_CAMERA_ID_PROMISE_CAMINPUT3_TC_116 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POSITION_TYPE_TC_117 + * @tc.name : Create camerainput from camera-3 cameraposition & cameratype async api + * @tc.desc : Create camerainput from camera-3 cameraposition & cameratype async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POSITION_TYPE_TC_117', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POSITION_TYPE_TC_117--------------"); + cameraManager.createCameraInput(camerasArray[3].cameraPosition, camerasArray[3].cameraType, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_117 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_117 data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_117 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_117 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_TC_117 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_118 + * @tc.name : Create camerainput from camera-3 cameraposition & cameratype promise api + * @tc.desc : Create camerainput from camera-3 cameraposition & cameratype promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_118', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_118--------------"); + var cameraInputPromise = await cameraManager.createCameraInput(camerasArray[3].cameraPosition, camerasArray[3].cameraType); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_118 cameraInputPromise: " + JSON.stringify(cameraInputPromise)); + if (cameraInputPromise != null && cameraInputPromise != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_118 cameraInputPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_118 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_118 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POSITION_TYPE_PROMISE_TC_118 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_VIDEO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_119 + * @tc.name : Get supported preview formats from camera-3 camerainput async api + * @tc.desc : Get supported preview formats from camera-3 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_119', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_119--------------"); + camera3InputPromise.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_119 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_119 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_119 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(1003); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_119 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_119 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_119 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_120 + * @tc.name : Get supported preview formats from camera-3 camerainput promise api + * @tc.desc : Get supported preview formats from camera-3 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_120', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_120--------------"); + var cam3FormatPromise = await camera3InputPromise.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_120: " + JSON.stringify(cam3FormatPromise)); + if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_120 is not null || undefined"); + for (var i = 0; i < cam3FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_120 cam3FormatPromise: " + cam3FormatPromise[i]); + expect(cam3FormatPromise[i]).assertEqual(1003); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_120 PASSED"); + } + } else { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_120 FAILED"); + expect().assertFail(); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_120 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_121 + * @tc.name : Get supported sizes using camera-3 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-3 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_121', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_121--------------"); + camera3InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_121 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_121 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_121 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_121 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_121 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_121 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_TC_122 + * @tc.name : Get supported video formats from camera-3 camerainput async api + * @tc.desc : Get supported video formats from camera-3 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_TC_122', 0, async function (done) { + console.info("--------------GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_TC_122--------------"); + camera3InputPromise.getSupportedVideoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_TC_122 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_TC_122 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_TC_122 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(1003); + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_TC_122 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_TC_122 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_CAMINPUT3_TC_122 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT3_TC_123 + * @tc.name : Get supported video formats from camera-3 camerainput promise api + * @tc.desc : Get supported video formats from camera-3 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT3_TC_123', 0, async function (done) { + console.info("--------------GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT3_TC_123--------------"); + var cam3FormatPromise = await camera3InputPromise.getSupportedVideoFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT3_TC_123: " + JSON.stringify(cam3FormatPromise)); + if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT3_TC_123 is not null || undefined"); + for (var i = 0; i < cam3FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT3_TC_123 cam3FormatPromise: " + cam3FormatPromise[i]); + expect(cam3FormatPromise[i]).assertEqual(1003); + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT3_TC_123 PASSED"); + } + } else { + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT3_TC_123 FAILED"); + expect().assertFail(); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_VIDEO_FORMATS_PROMISE_CAMINPUT3_TC_123 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_121 + * @tc.name : Get supported sizes using camera-3 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-3 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_121', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_121--------------"); + camera3InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_121 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_121 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_121 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_121 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_121 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_121 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_125 + * @tc.name : Get supported sizes using camera-3 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-3 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_125', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_125--------------"); + var sizeArrayPromise = await camera3InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_125 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_125 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_125 sizeArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_125 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_125 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_125 ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_126 + * @tc.name : Get supported photo format from camera-3 camerainput async api + * @tc.desc : Get supported photo format from camera-3 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_126', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_126--------------"); + camera3InputPromise.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_126 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_126 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_126 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_126 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_126 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_126 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_127 + * @tc.name : Get supported photo format from camera-3 camerainput promise api + * @tc.desc : Get supported photo format from camera-3 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_127', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_127--------------"); + var cam3FormatPromise = await camera3InputPromise.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_127: " + JSON.stringify(cam3FormatPromise)); + if (cam3FormatPromise != null && cam3FormatPromise.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_127 is not null || undefined"); + for (var i = 0; i < cam3FormatPromise.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_127 cam3FormatPromise: " + cam3FormatPromise[i]); + expect(cam3FormatPromise[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_127 PASSED"); + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_127 FAILED"); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_127 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_128 + * @tc.name : Get supported sizes from camera-3 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-3 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_128', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_128--------------"); + camera3InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_128 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_128 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_128 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_128 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_128 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_128 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_129 + * @tc.name : Get supported sizes from camera-3 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-3 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_129', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_129--------------"); + var sizeArrayPromise = await camera3InputPromise.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_129: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_129 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_129 sizeArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_129 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_129 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_129 ends here"); + await sleep(1000); + done(); + }) + */ + + /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE UNSPECIFIED*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_130 + * @tc.name : Create camerainput from camera-3 cameraposition back & cameratype unspecified async api + * @tc.desc : Create camerainput from camera-3 cameraposition back & cameratype unspecified async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_130', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_130--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_130 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_130 data is not null || undefined"); + camera3InputPosBack = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_130 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_130 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_TC_130 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_131 + * @tc.name : Create camerainput from camera-3 cameraposition back & cameratype unspecified promise api + * @tc.desc : Create camerainput from camera-3 cameraposition back & cameratype unspecified promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_131', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_131--------------"); + camera3InputPromisePosBack = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_131 camera3InputPromisePosBack: " + JSON.stringify(camera3InputPromisePosBack)); + if (camera3InputPromisePosBack != null && camera3InputPromisePosBack != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_131 camera3InputPromisePosBack is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_131 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_131 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_UNSPECIFIED_PROMISE_TC_131 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_132 + * @tc.name : Get supported preview formats from camera-3 camerainput async api + * @tc.desc : Get supported preview formats from camera-3 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_132', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_132--------------"); + camera3InputPromisePosBack.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_132 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_132 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_132 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(1003); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_132 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_132 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_132 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_133 + * @tc.name : Get supported preview formats from camera-3 camerainput promise api + * @tc.desc : Get supported preview formats from camera-3 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_133', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_133--------------"); + var cam3FormatPromisePosBack = await camera3InputPromisePosBack.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_133: " + JSON.stringify(cam3FormatPromisePosBack)); + if (cam3FormatPromisePosBack != null && cam3FormatPromisePosBack.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_133 is not null || undefined"); + for (var i = 0; i < cam3FormatPromisePosBack.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_133 cam3FormatPromisePosBack: " + cam3FormatPromisePosBack[i]); + expect(cam3FormatPromisePosBack[i]).assertEqual(1003); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_133 PASSED"); + } + } else { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_133 FAILED"); + expect().assertFail(); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_133 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_134 + * @tc.name : Get supported sizes using camera-3 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-3 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_134', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_134--------------"); + camera3InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_134 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_134 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_134 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_134 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_134 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_134 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_135 + * @tc.name : Get supported sizes using camera-3 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-3 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_135', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_135--------------"); + var sizeArrayPromise = await camera3InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_135 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_135 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_135 size0ArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_135 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_135 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_135 ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_136 + * @tc.name : Get supported photo format from camera-3 camerainput async api + * @tc.desc : Get supported photo format from camera-3 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_136', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_136--------------"); + camera3InputPromisePosBack.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_136 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_136 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_136 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_136 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_136 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_136 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_137 + * @tc.name : Get supported photo format from camera-3 camerainput promise api + * @tc.desc : Get supported photo format from camera-3 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_137', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_137--------------"); + var cam3FormatPromisePosBack = await camera3InputPromisePosBack.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_137: " + JSON.stringify(cam3FormatPromisePosBack)); + if (cam3FormatPromisePosBack != null && cam3FormatPromisePosBack.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_137 is not null || undefined"); + for (var i = 0; i < cam3FormatPromisePosBack.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_137 cam3FormatPromisePosBack: " + cam3FormatPromisePosBack[i]); + expect(cam3FormatPromisePosBack[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_137 PASSED"); + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_137 FAILED"); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_137 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_138 + * @tc.name : Get supported sizes from camera-3 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-3 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_138', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_138--------------"); + camera3InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_138 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_138 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_138 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_138 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_138 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_138 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_139 + * @tc.name : Get supported sizes from camera-3 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-3 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_139', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_139--------------"); + var sizeArrayPromise = await camera3InputPromisePosBack.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_139: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_139 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_139 sizeArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_139 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_139 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_139 ends here"); + await sleep(1000); + done(); + }) + */ + + /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE UNSPECIFIED*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_140 + * @tc.name : Create camerainput from camera-3 cameraposition front & cameratype unspecified async api + * @tc.desc : Create camerainput from camera-3 cameraposition front & cameratype unspecified async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_140', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_140--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_140 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_140 data is not null || undefined"); + camera3InputPosFront = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_140 PASSED"); + } + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_140 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_TC_140 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_141 + * @tc.name : Create camerainput from camera-3 cameraposition front & cameratype unspecified promise api + * @tc.desc : Create camerainput from camera-3 cameraposition front & cameratype unspecified promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_141', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_141--------------"); + camera3InputPromisePosFront = await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_141 camera3InputPromisePosFront: " + JSON.stringify(camera3InputPromisePosFront)); + if (camera3InputPromisePosFront != null && camera3InputPromisePosFront != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_141 camera3InputPromisePosFront is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_141 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_141 FAILED"); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_UNSPECIFIED_PROMISE_TC_141 ends here"); + await sleep(1000); + done(); + }) + + /*GET_SUPPORTED_PREVIEW_PHOTO_FORMATS_SIZE_TC*/ + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_TC_142 + * @tc.name : Get supported preview formats from camera-3 camerainput async api + * @tc.desc : Get supported preview formats from camera-3 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_TC_142', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_TC_142--------------"); + camera3InputPromisePosFront.getSupportedPreviewFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_142 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_142 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_142 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(1003); + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_142 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_142 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_TC_142 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_143 + * @tc.name : Get supported preview formats from camera-3 camerainput promise api + * @tc.desc : Get supported preview formats from camera-3 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_143', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_143--------------"); + var cam3FormatPromisePosFront = await camera3InputPromisePosFront.getSupportedPreviewFormats(); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_143: " + JSON.stringify(cam3FormatPromisePosFront)); + if (cam3FormatPromisePosFront != null && cam3FormatPromisePosFront.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_143 is not null || undefined"); + for (var i = 0; i < cam3FormatPromisePosFront.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_143 cam3FormatPromisePosFront: " + cam3FormatPromisePosFront[i]); + expect(cam3FormatPromisePosFront[i]).assertEqual(1003); + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_143 PASSED"); + } + } else { + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_143 FAILED"); + expect().assertFail(); + } + console.info("CameraModuleTest: Entering GET_SUPPORTED_PREVIEW_FORMATS_PROMISE_TC_143 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_144 + * @tc.name : Get supported sizes using camera-3 cameraformat & camerainput async api + * @tc.desc : Get supported sizes using camera-3 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_144', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_144--------------"); + camera3InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_144 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_144 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_144 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_144 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_144 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_TC_144 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_145 + * @tc.name : Get supported sizes using camera-3 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes using camera-3 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_145', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_145--------------"); + var sizeArrayPromise = await camera3InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_145 sizeArrayPromise: "); + if (sizeArrayPromise != null && sizeArrayPromise.length > 0) { + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_145 size0ArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_145 size0ArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_145 PASSED"); + } else { + expect().assertFail(); + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_145 FAILED"); + } + console.info("CameraModuleTest: Entering GET_SUPP_SIZES_CAMERA_FORMAT_YUV_420_SP_PROMISE_TC_145 ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_TC_146 + * @tc.name : Get supported photo format from camera-3 camerainput async api + * @tc.desc : Get supported photo format from camera-3 camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_TC_146', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_TC_146--------------"); + camera3InputPromisePosFront.getSupportedPhotoFormats(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_146 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_146 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_146 cameraFormat: " + data[i]); + expect(data[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_146 PASSED"); + } + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_146 FAILED: " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_TC_146 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_147 + * @tc.name : Get supported photo format from camera-3 camerainput promise api + * @tc.desc : Get supported photo format from camera-3 camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_147', 0, async function (done) { + console.info("--------------GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_147--------------"); + var cam3FormatPromisePosFront = await camera3InputPromisePosFront.getSupportedPhotoFormats(); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_147: " + JSON.stringify(cam3FormatPromisePosFront)); + if (cam3FormatPromisePosFront != null && cam3FormatPromisePosFront.length > 0) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_147 is not null || undefined"); + for (var i = 0; i < cam3FormatPromisePosFront.length; i++) { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_147 cam3FormatPromisePosFront: " + cam3FormatPromisePosFront[i]); + expect(cam3FormatPromisePosFront[i]).assertEqual(2000); + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_147 PASSED"); + } + } else { + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_147 FAILED"); + expect().assertFail(); + } + console.info(TAG + "Entering GET_SUPPORTED_PHOTO_FORMATS_PROMISE_TC_147 ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_148 + * @tc.name : Get supported sizes from camera-3 cameraformat & camerainput async api + * @tc.desc : Get supported sizes from camera-3 cameraformat & camerainput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_148', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_148--------------"); + camera3InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_148 success"); + if (data != null || data.length > 0) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_148 data is not null || undefined"); + for (var i = 0; i < data.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_148 sizeArray: width * height - " + data[i].width + " * " + data[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_148 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_148 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_TC_148 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_149 + * @tc.name : Get supported sizes from camera-3 cameraformat & camerainput promise api + * @tc.desc : Get supported sizes from camera-3 cameraformat & camerainput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_149', 0, async function (done) { + console.info("--------------GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_149--------------"); + var sizeArrayPromise = await camera3InputPromisePosFront.getSupportedSizes(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_149: "); + if (sizeArrayPromise != null && sizeArrayPromise != undefined) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_149 sizeArrayPromise is not null || undefined"); + for (var i = 0; i < sizeArrayPromise.length; i++) { + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_149 sizeArrayPromise: width * height - " + sizeArrayPromise[i].width + " * " + sizeArrayPromise[i].height); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_149 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_149 FAILED"); + } + console.info(TAG + "Entering GET_SUPP_SIZES_CAMERA_FORMAT_JPEG_PROMISE_TC_149 ends here"); + console.info("--------------CAMERA-3 ENDS HERE--------------"); + await sleep(1000); + done(); + }) + */ + + /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE UNSPECIFIED*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_TC_150 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype unspecified async api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype unspecified async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_TC_150', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_TC_150--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_TC_150 success: "); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_TC_150 camInput: " + JSON.stringify(camInput)); + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_TC_150 FAILED"); + } + else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_TC_150 PASSED: " + err.message); + expect(true).assertTrue(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_TC_150 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_TC_151 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype unspecified promise api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype unspecified promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_TC_151', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_TC_151--------------"); + await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED) + .then(function () { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_TC_151 camInputPromise: "); + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_TC_151 FAILED"); + }) + .catch((err) => { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_TC PASSED : " + err.message); + expect(true).assertTrue(); + }); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_UNSPECIFIED_PROMISE_TC_151 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE WIDE ANGLE*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_TC_152 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype wide angle async api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype wide angle async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_TC_152', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_TC_152--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_TC_152 success"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_TC_152 camInput: " + JSON.stringify(camInput)); + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_TC_152 FAILED"); + } + else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_TC_152 PASSED: " + err.message); + expect(true).assertTrue(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_TC_152 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_TC_153 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype wide angle promise api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype wide angle promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_TC_153', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_TC_153--------------"); + await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE) + .then(function () { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_TC_153 FAILED"); + expect().assertFail(); + }) + .catch((err) => { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_TC_153 PASSED : " + err.message); + expect(true).assertTrue(); + }); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_WIDE_ANGLE_PROMISE_TC_153 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE ULTRA ANGLE*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_TC_154 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype ultra wide async api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype ultra wide async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_TC_154', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_TC_154--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_TC_154 success"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_TC_154 camInput: " + JSON.stringify(camInput)); + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_TC_154 FAILED"); + } + else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_TC_154 PASSED: " + err.message); + expect(true).assertTrue(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_TC_154 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_TC_155 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype ultra wide promise api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype ultra wide promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_TC_155', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_TC_155--------------"); + await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE) + .then(function () { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_TC_155 FAILED"); + expect().assertFail(); + }) + .catch((err) => { + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_TC_155 PASSED : " + err.message); + }); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_ULTRA_WIDE_PROMISE_TC_155 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE TELEPHOTO*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_TC_156 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype telephoto async api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype telephoto async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_TC_156', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_TC_156--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_TC_156 success"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_TC_156 camInput: " + JSON.stringify(camInput)); + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_TC_156 FAILED"); + } + else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_TC_156 PASSED: " + err.message); + expect(true).assertTrue(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_TC_156 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_TC_157 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype telephoto promise api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype telephoto promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_TC_157', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_TC_157--------------"); + await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO) + .then(function () { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_TC_157 FAILED"); + }) + .catch((err) => { + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_TC_157 PASSED : " + err.message); + }); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TELEPHOTO_PROMISE_TC_157 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION UNSPECIFIED & TYPE TRUE DEAPTH*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_TC_158 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype true deapth async api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype true deapth async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_TC_158', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_TC_158--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_TC_158 success"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_TC_158 camInput: " + JSON.stringify(camInput)); + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_TC_158 FAILED"); + } + else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_TC_158 PASSED: " + err.message); + expect(true).assertTrue(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_TC_158 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_TC_159 + * @tc.name : Create camerainput from cameraposition unspecified & cameratype true deapth promise api + * @tc.desc : Create camerainput from cameraposition unspecified & cameratype true deapth promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_TC_159', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_TC_159--------------"); + await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH) + .then(function () { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_TC_159 FAILED"); + }) + .catch((err) => { + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_TC_159 PASSED : " + err.message); + }); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_UNSPECIFIED_TYPE_TRUE_DEAPTH_PROMISE_TC_159 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE WIDE ANGLE*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_TC_160 + * @tc.name : Create camerainput from cameraposition back & cameratype wide angle async api + * @tc.desc : Create camerainput from cameraposition back & cameratype wide angle async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_TC_160', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_TC_160--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_TC_160 success"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_TC_160 camInput: " + JSON.stringify(camInput)); + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_TC_160 FAILED"); + } + else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_TC_160 PASSED: " + err.message); + expect(true).assertTrue(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_TC_160 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_TC_161 + * @tc.name : Create camerainput from cameraposition back & cameratype wide angle promise api + * @tc.desc : Create camerainput from cameraposition back & cameratype wide angle promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_TC_161', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_TC_161--------------"); + await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE) + .then(function () { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_TC_161 FAILED"); + }) + .catch((err) => { + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_TC_161 PASSED : " + err.message); + }); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_WIDE_ANGLE_PROMISE_TC_161 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE ULTRA ANGLE*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_TC_162 + * @tc.name : Create camerainput from cameraposition back & cameratype ultra wide async api + * @tc.desc : Create camerainput from cameraposition back & cameratype ultra wide async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_TC_162', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_TC_162--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_TC_162 success"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_TC_162 camInput: " + JSON.stringify(camInput)); + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_TC_162 FAILED"); + } + else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_TC_162 PASSED: " + err.message); + expect(true).assertTrue(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_TC_162 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_TC_163 + * @tc.name : Create camerainput from cameraposition back & cameratype ultra wide promise api + * @tc.desc : Create camerainput from cameraposition back & cameratype ultra wide promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_TC_163', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_TC_163--------------"); + await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE) + .then(function () { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_TC_163 FAILED"); + }) + .catch((err) => { + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_TC_163 PASSED : " + err.message); + }); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_ULTRA_WIDE_PROMISE_TC_163 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE TELEPHOTO*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_TC_164 + * @tc.name : Create camerainput from cameraposition back & cameratype telephoto async api + * @tc.desc : Create camerainput from cameraposition back & cameratype telephoto async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_TC_164', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_TC_164--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_TC_164 success"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_TC_164 camInput: " + JSON.stringify(camInput)); + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_TC_164 FAILED"); + } + else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_TC_164 PASSED: " + err.message); + expect(true).assertTrue(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_TC_164 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_TC_165 + * @tc.name : Create camerainput from cameraposition back & cameratype telephoto promise api + * @tc.desc : Create camerainput from cameraposition back & cameratype telephoto promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_TC_165', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_TC_165--------------"); + await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO) + .then(function () { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_TC_165 FAILED"); + }) + .catch((err) => { + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_TC_165 PASSED : " + err.message); + }); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TELEPHOTO_PROMISE_TC_165 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION BACK & TYPE TRUE DEAPTH*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_TC_166 + * @tc.name : Create camerainput from cameraposition back & cameratype true deapth async api + * @tc.desc : Create camerainput from cameraposition back & cameratype true deapth async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_TC_166', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_TC_166--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_TC_166 success"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_TC_166 camInput: " + JSON.stringify(camInput)); + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_TC_166 FAILED"); + } + else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_TC_166 PASSED: " + err.message); + expect(true).assertTrue(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_TC_166 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_TC_167 + * @tc.name : Create camerainput from cameraposition back & cameratype true deapth promise api + * @tc.desc : Create camerainput from cameraposition back & cameratype true deapth promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_TC_167', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_TC_167--------------"); + await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_BACK, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH) + .then(function () { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_TC_167 FAILED"); + }) + .catch((err) => { + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_TC_167 PASSED : " + err.message); + }); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_BACK_TYPE_TRUE_DEAPTH_PROMISE_TC_167 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE WIDE ANGLE*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_TC_168 + * @tc.name : Create camerainput from cameraposition front & cameratype wide angle async api + * @tc.desc : Create camerainput from cameraposition front & cameratype wide angle async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_TC_168', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_TC_168--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_TC_168 success"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_TC_168 camInput: " + JSON.stringify(camInput)); + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_TC_168 FAILED"); + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_TC_168 PASSED: " + err.message); + expect(true).assertTrue(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_TC_168 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_TC_169 + * @tc.name : Create camerainput from cameraposition front & cameratype wide angle promise api + * @tc.desc : Create camerainput from cameraposition front & cameratype wide angle promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_TC_169', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_TC_169--------------"); + await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE) + .then(function () { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_TC_169 FAILED"); + }) + .catch((err) => { + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_TC_169 PASSED : " + err.message); + }); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_WIDE_ANGLE_PROMISE_TC_169 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE ULTRA ANGLE*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_TC_170 + * @tc.name : Create camerainput from cameraposition front & cameratype ultra wide async api + * @tc.desc : Create camerainput from cameraposition front & cameratype ultra wide async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_TC_170', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_TC_170--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_TC_170 success"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_TC_170 camInput: " + JSON.stringify(camInput)); + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_TC_170 FAILED"); + } + else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_TC_170 PASSED: " + err.message); + expect(true).assertTrue(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_TC_170 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_TC_171 + * @tc.name : Create camerainput from cameraposition front & cameratype ultra wide promise api + * @tc.desc : Create camerainput from cameraposition front & cameratype ultra wide promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_TC_171', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_TC_171--------------"); + await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE) + .then(function () { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_TC_171 FAILED"); + }) + .catch((err) => { + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_TC_171 PASSED : " + err.message); + }); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_ULTRA_WIDE_PROMISE_TC_171 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE TELEPHOTO*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_TC_172 + * @tc.name : Create camerainput from cameraposition front & cameratype telephoto async api + * @tc.desc : Create camerainput from cameraposition front & cameratype telephoto async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_TC_172', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_TC_172--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_TC_172 success"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_TC_172 camInput: " + JSON.stringify(camInput)); + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_TC_172 FAILED"); + } else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_TC_172 PASSED: " + err.message); + expect(true).assertTrue(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_TC_172 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_TC_173 + * @tc.name : Create camerainput from cameraposition front & cameratype telephoto promise api + * @tc.desc : Create camerainput from cameraposition front & cameratype telephoto promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_TC_173', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_TC_173--------------"); + await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO) + .then(function () { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_TC_173 FAILED"); + }) + .catch((err) => { + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_TC_173 PASSED : " + err.message); + }); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TELEPHOTO_PROMISE_TC_173 ends here"); + await sleep(1000); + done(); + }) + + /*CREATE CAMERAINPUT WITH POSITION FRONT & TYPE TRUE DEAPTH*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_TC_174 + * @tc.name : Create camerainput from cameraposition front & cameratype true deapth async api + * @tc.desc : Create camerainput from cameraposition front & cameratype true deapth async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_TC_174', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_TC_174--------------"); + cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH, async (err, data) => { + if (!err) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_TC_174 success"); + var camInput = data; + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_TC_174 camInput: " + JSON.stringify(camInput)); + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_TC_174 FAILED"); + } + else { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_TC_174 PASSED: " + err.message); + expect(true).assertTrue(); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_TC_174 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_TC_175 + * @tc.name : Create camerainput from cameraposition front & cameratype true deapth promise api + * @tc.desc : Create camerainput from cameraposition front & cameratype true deapth promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_TC_175', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_TC_175--------------"); + await cameraManager.createCameraInput(cameraObj.CameraPosition.CAMERA_POSITION_FRONT, cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH) + .then(function () { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_TC_175 FAILED"); + }) + .catch((err) => { + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_TC_175 PASSED : " + err.message); + }); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_POS_FRONT_TYPE_TRUE_DEAPTH_PROMISE_TC_175 ends here"); + await sleep(1000); + done(); + }) + }) +} \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2fb65dc96f93b0bd2c91ad29709b85b17b899ebb --- /dev/null +++ b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitEnum.test.ets @@ -0,0 +1,595 @@ +/* + * 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 cameraObj from '@ohos.multimedia.camera'; +import image from '@ohos.multimedia.image'; +import fileio from '@ohos.fileio'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl' +import bundle from '@ohos.bundle' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; + +const TAG = "CameraModuleTest: "; + +// Define global variables + +var cameraManager; +var surfaceId1; +var camerasArray; + +// CAMERA-0 Variables +var camera0Input, camera0InputPosBack, camera0InputPosFront; +var camera0InputPromise, camera0InputPromisePosBack, camera0InputPromisePosFront; +// CAMERA-1 Variables +var camera1Input, camera1InputPosBack, camera1InputPosFront; +var camera1InputPromise, camera1InputPromisePosBack, camera1InputPromisePosFront; +// CAMERA-2 Variables +var camera2Input, camera2InputPosBack, camera2InputPosFront; +var camera2InputPromise, camera2InputPromisePosBack, camera2InputPromisePosFront; +// CAMERA-3 Variables +var camera3Input, camera3InputPosBack, camera3InputPosFront; +var camera3InputPromise, camera3InputPromisePosBack, camera3InputPromisePosFront; + +export default function cameraJSUnitEnum(surfaceId: any) { + + async function getImageReceiverSurfaceId() { + console.log(TAG + 'Entering create Image receiver') + var receiver = image.createImageReceiver(640, 480, 4, 8) + console.log(TAG + 'before receiver check') + if (receiver !== undefined) { + console.log(TAG + 'Receiver is ok') + surfaceId1 = await receiver.getReceivingSurfaceId() + console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) + } else { + console.log(TAG + 'Receiver is not ok') + } + } + + function sleep(ms) { + console.info(TAG + "Entering sleep -> Promise constructor"); + return new Promise(resolve => setTimeout(resolve, ms)); + } + + async function applyPermission() { + let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); + let atManager = abilityAccessCtrl.createAtManager(); + if (atManager != null) { + let tokenID = appInfo.accessTokenId; + console.info('[permission] case accessTokenID is ' + tokenID); + let permissionName1 = 'ohos.permission.CAMERA'; + let permissionName2 = 'ohos.permission.MICROPHONE'; + let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; + let permissionName4 = 'ohos.permission.READ_MEDIA'; + let permissionName5 = 'ohos.permission.WRITE_MEDIA'; + await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + } else { + console.info('[permission] case apply permission failed, createAtManager failed'); + } + } + + describe('CameraJSUnitEnum', function () { + console.info(TAG + '----------CameraJSUnitEnum--------------') + + beforeAll(async function () { + await applyPermission(); + console.info('beforeAll case'); + }) + + beforeEach(function () { + sleep(5000); + console.info('beforeEach case'); + }) + + afterEach(async function () { + console.info('afterEach case'); + }) + + afterAll(function () { + console.info('afterAll case'); + }) + + /** + * @tc.number : GET_CAMERA_MANAGER_TC_001 + * @tc.name : Create camera manager instance async api + * @tc.desc : Create camera manager instance async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_MANAGER_TC_001', 0, async function (done) { + console.info("--------------GET_CAMERA_MANAGER_TC_001--------------"); + cameraObj.getCameraManager(null, async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 data is not null || undefined"); + cameraManager = data; + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_CAMERA_MANAGER_TC_001 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_CAMERAS_TC_002 + * @tc.name : Get camera from cameramanager to get array of camera async api + * @tc.desc : Get camera from cameramanager to get array of camera async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERAS_TC_002', 0, async function (done) { + console.info("--------------GET_CAMERAS_TC_002--------------"); + cameraManager.getCameras(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_CAMERAS_TC_002 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GET_CAMERAS_TC_002 data is not null || undefined"); + camerasArray = data; + if (camerasArray != null && camerasArray.length > 0) { + for (var i = 0; i < camerasArray.length; i++) { + // Get the variables from camera object + var cameraId = camerasArray[i].cameraId; + console.info(TAG + "Entering GET_CAMERAS_TC_002 camera" + i + "Id: " + cameraId); + var cameraPosition = camerasArray[i].cameraPosition; + console.info(TAG + "Entering GET_CAMERAS_TC_002 camera" + i + "Position: " + cameraPosition); + var cameraType = camerasArray[i].cameraType; + console.info(TAG + "Entering GET_CAMERAS_TC_002 camera" + i + "Type: " + cameraType); + var connectionType = camerasArray[i].connectionType + console.info(TAG + "Entering GET_CAMERAS_TC_002 connection" + i + "Type: " + connectionType); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERAS_TC_002 PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERAS_TC_002 FAILED cameraArray is null || undefined"); + } + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERAS_TC_002 FAILED: " + err.message); + } + console.info(TAG + "Entering GET_CAMERAS_TC_002 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /*CAMERA-0 Scripts*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_TC_003 + * @tc.name : Create camerainput from camera-0 cameraId async api + * @tc.desc : Create camerainput from camera-0 cameraId async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_TC_003', 0, async function (done) { + console.info("--------------CAMERA-0 STARTS HERE--------------"); + console.info("--------------CREATE_CAMERA_INPUT_TC_003--------------"); + cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_003 data is not null || undefined"); + camera0Input = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_003 PASSED with CameraID :" + camerasArray[0].cameraId); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_003 FAILED: " + err.message); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_TC_003 ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CAMERA_STATUS + * @tc.name : camera status ENAME + * @tc.desc : camera status ENAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAMERA_STATUS', 0, async function (done) { + console.info(TAG + "--------------CameraStatus ------------"); + console.info(TAG + "CameraStatus CAMERA_STATUS_APPEAR : " + cameraObj.CameraStatus.CAMERA_STATUS_APPEAR); + expect(cameraObj.CameraStatus.CAMERA_STATUS_APPEAR).assertEqual(0); + console.info(TAG + "CameraStatus CAMERA_STATUS_DISAPPEAR : " + cameraObj.CameraStatus.CAMERA_STATUS_DISAPPEAR); + expect(cameraObj.CameraStatus.CAMERA_STATUS_DISAPPEAR).assertEqual(1); + console.info(TAG + "CameraStatus CAMERA_STATUS_AVAILABLE : " + cameraObj.CameraStatus.CAMERA_STATUS_AVAILABLE) + expect(cameraObj.CameraStatus.CAMERA_STATUS_AVAILABLE).assertEqual(2); + console.info(TAG + "CameraStatus CAMERA_STATUS_UNAVAILABLE : " + cameraObj.CameraStatus.CAMERA_STATUS_UNAVAILABLE) + expect(cameraObj.CameraStatus.CAMERA_STATUS_UNAVAILABLE).assertEqual(3); + await sleep(1000); + done(); + }) + + /** + * @tc.number : CAMERA_POSITION + * @tc.name : Camera position ENAME + * @tc.desc : Camera position ENAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAMERA_POSITION', 0, async function (done) { + console.info(TAG + "--------------CameraPosition ------------") + console.info(TAG + "CameraPosition CAMERA_POSITION_BACK : " + cameraObj.CameraPosition.CAMERA_POSITION_BACK); + expect(cameraObj.CameraPosition.CAMERA_POSITION_BACK).assertEqual(1); + console.info(TAG + "CameraPosition CAMERA_POSITION_FRONT : " + cameraObj.CameraPosition.CAMERA_POSITION_FRONT); + expect(cameraObj.CameraPosition.CAMERA_POSITION_FRONT).assertEqual(2); + console.info(TAG + "CameraPosition CAMERA_POSITION_UNSPECIFIED : " + cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED); + expect(cameraObj.CameraPosition.CAMERA_POSITION_UNSPECIFIED).assertEqual(0); + await sleep(1000); + done(); + }) + + /** + * @tc.number : CAMERA_TYPE + * @tc.name : camera type ENAME + * @tc.desc : camera type ENAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAMERA_TYPE', 0, async function (done) { + console.info(TAG + "--------------CameraType ------------") + console.info(TAG + "CameraType CAMERA_TYPE_UNSPECIFIED : " + cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED); + expect(cameraObj.CameraType.CAMERA_TYPE_UNSPECIFIED).assertEqual(0); + console.info(TAG + "CameraType CAMERA_TYPE_WIDE_ANGLE : " + cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE); + expect(cameraObj.CameraType.CAMERA_TYPE_WIDE_ANGLE).assertEqual(1); + console.info(TAG + 'CameraType CAMERA_TYPE_ULTRA_WIDE : ' + cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE); + expect(cameraObj.CameraType.CAMERA_TYPE_ULTRA_WIDE).assertEqual(2); + console.info(TAG + 'CameraType CAMERA_TYPE_TELEPHOTO : ' + cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO); + expect(cameraObj.CameraType.CAMERA_TYPE_TELEPHOTO).assertEqual(3); + console.info(TAG + 'CameraType CAMERA_TYPE_TRUE_DEPTH : ' + cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH) + expect(cameraObj.CameraType.CAMERA_TYPE_TRUE_DEPTH).assertEqual(4); + await sleep(1000); + done(); + }) + + /** + * @tc.number : CONNECTION_TYPE + * @tc.name : connection type ENAME + * @tc.desc : connection type ENAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CONNECTION_TYPE', 0, async function (done) { + console.info(TAG + "--------------ConnectionType ------------") + console.info(TAG + "ConnectionType CAMERA_CONNECTION_BUILT_IN : " + cameraObj.ConnectionType.CAMERA_CONNECTION_BUILT_IN); + expect(cameraObj.ConnectionType.CAMERA_CONNECTION_BUILT_IN).assertEqual(0); + console.info(TAG + "ConnectionType CAMERA_CONNECTION_USB_PLUGIN : " + cameraObj.ConnectionType.CAMERA_CONNECTION_USB_PLUGIN); + expect(cameraObj.ConnectionType.CAMERA_CONNECTION_USB_PLUGIN).assertEqual(1); + console.info(TAG + "ConnectionType CAMERA_CONNECTION_REMOTE : " + cameraObj.ConnectionType.CAMERA_CONNECTION_REMOTE); + expect(cameraObj.ConnectionType.CAMERA_CONNECTION_REMOTE).assertEqual(2); + await sleep(1000); + done(); + }) + + /** + * @tc.number : CAMERA_FORMAT + * @tc.name : Camera Format ENAME + * @tc.desc : Camera Format ENAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* CameraFormat Interface will be change + it('CAMERA_FORMAT', 0, async function (done) { + console.info(TAG + "--------------CameraFormat ------------") + console.info(TAG + "CameraFormat CAMERA_FORMAT_YUV_420_SP : " + cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP); + expect(cameraObj.CameraFormat.CAMERA_FORMAT_YUV_420_SP).assertEqual(1003); + console.info(TAG + "CameraFormat CAMERA_FORMAT_JPEG : " + cameraObj.CameraFormat.CAMERA_FORMAT_JPEG); + expect(cameraObj.CameraFormat.CAMERA_FORMAT_JPEG).assertEqual(2000); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : FLASHMODE + * @tc.name : Flash Mode ENAME + * @tc.desc : Flash Mode ENAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('FLASHMODE', 0, async function (done) { + console.info(TAG + "--------------FlashMode ------------") + console.info(TAG + "FlashMode FLASH_MODE_CLOSE : " + cameraObj.FlashMode.FLASH_MODE_CLOSE); + expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); + console.info(TAG + "FlashMode FLASH_MODE_OPEN : " + cameraObj.FlashMode.FLASH_MODE_OPEN); + expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); + console.info(TAG + "FlashMode FLASH_MODE_AUTO : " + cameraObj.FlashMode.FLASH_MODE_AUTO); + expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); + console.info(TAG + "FlashMode FLASH_MODE_ALWAYS_OPEN : " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); + await sleep(1000); + done(); + }) + + /** + * @tc.number : FOCUSMODE + * @tc.name : Focus Mode ENAME + * @tc.desc : Focus Mode ENAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('FOCUSMODE', 0, async function (done) { + console.info(TAG + "--------------FocusMode ------------") + console.info(TAG + "FocusMode FOCUS_MODE_MANUAL : " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); + expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0); + console.info(TAG + "FocusMode FOCUS_MODE_CONTINUOUS_AUTO : " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); + console.info(TAG + "FocusMode FOCUS_MODE_AUTO : " + cameraObj.FocusMode.FOCUS_MODE_AUTO); + expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); + console.info(TAG + "FocusMode FOCUS_MODE_LOCKED : " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); + expect(cameraObj.FocusMode.FOCUS_MODE_LOCKED).assertEqual(3); + await sleep(1000); + done(); + }) + + /** + * @tc.number : FOCUSSTATE + * @tc.name : Focus State ENAME + * @tc.desc : Focus State ENAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('FOCUSSTATE', 0, async function (done) { + console.info(TAG + "--------------FocusState ------------") + console.info(TAG + "FocusState FOCUS_STATE_SCAN : " + cameraObj.FocusState.FOCUS_STATE_SCAN); + expect(cameraObj.FocusState.FOCUS_STATE_SCAN).assertEqual(0); + console.info(TAG + "FocusState FOCUS_STATE_FOCUSED : " + cameraObj.FocusState.FOCUS_STATE_FOCUSED); + expect(cameraObj.FocusState.FOCUS_STATE_FOCUSED).assertEqual(1); + console.info(TAG + "FocusState FOCUS_STATE_UNFOCUSED : " + cameraObj.FocusState.FOCUS_STATE_UNFOCUSED); + expect(cameraObj.FocusState.FOCUS_STATE_UNFOCUSED).assertEqual(2); + await sleep(1000); + done(); + }) + + /** + * @tc.number : EXPOSUREMODE + * @tc.name : Exposure Mode ENAME + * @tc.desc : Exposure Mode ENAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('EXPOSUREMODE', 0, async function (done) { + console.info(TAG + "--------------ExposureMode ------------") + console.info(TAG + "ExposureMode EXPOSURE_MODE_LOCKED : " + cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED); + expect(cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED).assertEqual(0); + console.info(TAG + "ExposureMode EXPOSURE_MODE_AUTO : " + cameraObj.ExposureMode.EXPOSURE_MODE_AUTO); + expect(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO).assertEqual(1); + console.info(TAG + "ExposureMode EXPOSURE_MODE_CONTINUOUS_AUTO : " + cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO); + expect(cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO).assertEqual(2); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : ExposureState + * @tc.name : Exposure State ENAME + * @tc.desc : Exposure State ENAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* ExposureState Interface will be change + it('ExposureState', 0, async function (done) { + console.info(TAG + "--------------ExposureState ------------") + console.info(TAG + "ExposureState EXPOSURE_STATE_SCAN : " + cameraObj.ExposureState.EXPOSURE_STATE_SCAN); + expect(cameraObj.ExposureState.EXPOSURE_STATE_SCAN).assertEqual(0); + console.info(TAG + "ExposureState EXPOSURE_STATE_CONVERGED : " + cameraObj.ExposureState.EXPOSURE_STATE_CONVERGED); + expect(cameraObj.ExposureState.EXPOSURE_STATE_CONVERGED).assertEqual(1); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : ImageRotation + * @tc.name : Image Rotation ENAME + * @tc.desc : Image Rotation ENAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ImageRotation', 0, async function (done) { + console.info(TAG + "--------------ImageRotation ------------") + console.info(TAG + "ImageRotation ROTATION_0 : " + cameraObj.ImageRotation.ROTATION_0); + expect(cameraObj.ImageRotation.ROTATION_0).assertEqual(0); + console.info(TAG + "ImageRotation ROTATION_90 : " + cameraObj.ImageRotation.ROTATION_90); + expect(cameraObj.ImageRotation.ROTATION_90).assertEqual(90); + console.info(TAG + "ImageRotation ROTATION_180 : " + cameraObj.ImageRotation.ROTATION_180); + expect(cameraObj.ImageRotation.ROTATION_180).assertEqual(180); + console.info(TAG + "ImageRotation ROTATION_270 : " + cameraObj.ImageRotation.ROTATION_270); + expect(cameraObj.ImageRotation.ROTATION_270).assertEqual(270); + await sleep(1000); + done(); + }) + + /** + * @tc.number : QualityLevel + * @tc.name : Quality Level ENAME + * @tc.desc : Quality Level ENAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('QualityLevel', 0, async function (done) { + console.info(TAG + "--------------QualityLevel ------------") + console.info(TAG + "QualityLevel QUALITY_LEVEL_HIGH : " + cameraObj.QualityLevel.QUALITY_LEVEL_HIGH); + expect(cameraObj.QualityLevel.QUALITY_LEVEL_HIGH).assertEqual(0); + console.info(TAG + "QualityLevel QUALITY_LEVEL_MEDIUM : " + cameraObj.QualityLevel.QUALITY_LEVEL_MEDIUM); + expect(cameraObj.QualityLevel.QUALITY_LEVEL_MEDIUM).assertEqual(1); + console.info(TAG + "QualityLevel QUALITY_LEVEL_LOW : " + cameraObj.QualityLevel.QUALITY_LEVEL_LOW); + expect(cameraObj.QualityLevel.QUALITY_LEVEL_LOW).assertEqual(2); + await sleep(1000); + done(); + }) + +/** + * @tc.number : VIDEOSTABILIZATION_ENUM + * @tc.name : VIDEOSTABILIZATION ENAME + * @tc.desc : VIDEOSTABILIZATION ENAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('VideoStabilization', 0, async function (done) { + console.info(TAG + "--------------VideoStabilization ------------") + console.info(TAG + "VideoStabilization OFF : " + cameraObj.VideoStabilizationMode.OFF); + expect(cameraObj.VideoStabilizationMode.OFF).assertEqual(0); + console.info(TAG + "VideoStabilization LOW : " + cameraObj.VideoStabilizationMode.LOW); + expect(cameraObj.VideoStabilizationMode.LOW).assertEqual(1); + console.info(TAG + "VideoStabilization MIDDLE : " + cameraObj.VideoStabilizationMode.MIDDLE); + expect(cameraObj.VideoStabilizationMode.MIDDLE).assertEqual(2); + console.info(TAG + "VideoStabilization HIGH : " + cameraObj.VideoStabilizationMode.HIGH); + expect(cameraObj.VideoStabilizationMode.HIGH).assertEqual(3); + console.info(TAG + "VideoStabilization AUTO : " + cameraObj.VideoStabilizationMode.AUTO); + expect(cameraObj.VideoStabilizationMode.AUTO).assertEqual(4); + await sleep(1000); + done(); + }) + */ + }) + /** + * @tc.number : SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100 + * @tc.name : CameraInputErrorCode ENAME + * @tc.desc : CameraInputErrorCode ENAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100', 0, async function (done) { + console.info(TAG + "--------------SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100------------") + console.info(TAG + "QualityLevel SUB_MULTIMEDIA_CAMERAINPUTERRORCODE_0100 : " + cameraObj.CameraInputErrorCode.ERROR_UNKNOWN); + expect(cameraObj.CameraInputErrorCode.ERROR_UNKNOWN).assertEqual(-1); + await sleep(1000); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100 + * @tc.name : CaptureSessionErrorCode ENAME + * @tc.desc : CaptureSessionErrorCode ENAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100', 0, async function (done) { + console.info(TAG + "--------------SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100------------") + console.info(TAG + "QualityLevel SUB_MULTIMEDIA_CAPTURESESSIONERRORCODE_0100 : " + cameraObj.CaptureSessionErrorCode.ERROR_UNKNOWN); + expect(cameraObj.CaptureSessionErrorCode.ERROR_UNKNOWN).assertEqual(-1); + await sleep(1000); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100 + * @tc.name : PreviewOutputErrorCode ENAME + * @tc.desc : PreviewOutputErrorCode ENAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100', 0, async function (done) { + console.info(TAG + "--------------SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100------------") + console.info(TAG + "QualityLevel SUB_MULTIMEDIA_PREVIEWOUTPUTERRORCODE_0100 : " + cameraObj.PreviewOutputErrorCode.ERROR_UNKNOWN); + expect(cameraObj.PreviewOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); + await sleep(1000); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100 + * @tc.name : PhotoOutputErrorCode ENAME + * @tc.desc : PhotoOutputErrorCode ENAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100', 0, async function (done) { + console.info(TAG + "--------------SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100------------") + console.info(TAG + "QualityLevel SUB_MULTIMEDIA_PHOTOOUTPUTERRORCODE_0100 : " + cameraObj.PhotoOutputErrorCode.ERROR_UNKNOWN); + expect(cameraObj.PhotoOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); + await sleep(1000); + done(); + }) + + /** + * @tc.number : SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100 + * @tc.name : VideoOutputErrorCode ENAME + * @tc.desc : VideoOutputErrorCode ENAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100', 0, async function (done) { + console.info(TAG + "--------------SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100------------") + console.info(TAG + "QualityLevel SUB_MULTIMEDIA_VIDEOOUTPUTERRORCODE_0100 : " + cameraObj.VideoOutputErrorCode.ERROR_UNKNOWN); + expect(cameraObj.VideoOutputErrorCode.ERROR_UNKNOWN).assertEqual(-1); + await sleep(1000); + done(); + }) +} \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4de926233207a220a5357c5ee53796fe53ed5827 --- /dev/null +++ b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitPhotoAsync.test.ets @@ -0,0 +1,3796 @@ +/* + * 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 cameraObj from '@ohos.multimedia.camera'; +import image from '@ohos.multimedia.image'; +import fileio from '@ohos.fileio'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl' +import bundle from '@ohos.bundle' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; + +const TAG = "CameraModuleTest: "; + +// Define global variables +var camera0Input; +var camera1Input; +var cameraManager; +var previewOutputAsync; +var photoOutputAsync; +var captureSession; +var surfaceId1; +var camerasArray; + +var Point1 = { x: 1, y: 1 } +var Point2 = { x: 2, y: 2 } +var Point3 = { x: 3, y: 3 } + +var photosettings1 = { + rotation: 0, + quality: 0, + location: { + latitude: 12.9705, + longitude: 77.7329, + altitude: 920.0000, + }, +} +var photosettings2 = { + rotation: 90, + quality: 1, + location: { + latitude: 20, + longitude: 78, + altitude: 8586, + }, +} + +var photosettings3 = { + quality: 2, + location: { + latitude: 0, + longitude: 0, + altitude: 0, + }, +} +var photosettings4 = { + rotation: 180, + location: { + latitude: -1, + longitude: -1, + altitude: -1, + }, +} + +export default function cameraJSUnitPhotoAsync(surfaceId: any) { + + async function getImageReceiverSurfaceId() { + console.log(TAG + 'Entering create Image receiver') + var receiver = image.createImageReceiver(640, 480, 4, 8) + console.log(TAG + 'before receiver check') + if (receiver !== undefined) { + console.log(TAG + 'Receiver is ok') + surfaceId1 = await receiver.getReceivingSurfaceId() + console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) + } else { + console.log(TAG + 'Receiver is not ok') + } + } + + function sleep(ms) { + console.info(TAG + "Entering sleep -> Promise constructor"); + return new Promise(resolve => setTimeout(resolve, ms)); + } + + async function applyPermission() { + let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); + let atManager = abilityAccessCtrl.createAtManager(); + if (atManager != null) { + let tokenID = appInfo.accessTokenId; + console.info('[permission] case accessTokenID is ' + tokenID); + let permissionName1 = 'ohos.permission.CAMERA'; + let permissionName2 = 'ohos.permission.MICROPHONE'; + let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; + let permissionName4 = 'ohos.permission.READ_MEDIA'; + let permissionName5 = 'ohos.permission.WRITE_MEDIA'; + await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + } else { + console.info('[permission] case apply permission failed, createAtManager failed'); + } + } + + describe('CameraJsUnitPhotoAsync', function () { + console.info(TAG + '----------CameraJsUnitPhotoAsync--------------') + + beforeAll(async function () { + await applyPermission(); + console.info('beforeAll case'); + }) + + beforeEach(function () { + sleep(5000); + console.info('beforeEach case'); + }) + + afterEach(async function () { + console.info('afterEach case'); + }) + + afterAll(function () { + console.info('afterAll case'); + }) + + console.info(TAG + "----------Camera-Precision Control-Async-------------"); + /** + * @tc.number : GET_CAMERA_MANAGER + * @tc.name : Create camera manager instance async api + * @tc.desc : Create camera manager instance async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_MANAGER', 0, async function (done) { + console.info("--------------GET_CAMERA_MANAGER--------------"); + cameraObj.getCameraManager(null, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Camera Manager success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering Camera Manager data is not null || undefined"); + cameraManager = data; + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERA_MANAGER PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERA_MANAGER FAILED: " + err.message); + } + console.info(TAG + "Entering GET_CAMERA_MANAGER ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CAMERA_STATUS_CALLBACK + * @tc.name : camera status callback on CameraManager async api + * @tc.desc : camera status callback on CameraManager async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAMERA_STATUS_CALLBACK', 0, async function (done) { + if (cameraManager == null || cameraManager == undefined) { + console.info(TAG + "Entering CAMERA_STATUS_CALLBACK cameraManager == null || undefined") + } else { + console.info(TAG + "Entering CAMERA_STATUS_CALLBACK to operate") + cameraManager.on('cameraStatus', async (err, data) => { + if (!err) { + console.info(TAG + "Camera status Callback on cameraManager is success"); + if (data != null || data != undefined) { + console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); + console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "CAMERA_STATUS_CALLBACK FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_CAMERAS + * @tc.name : Get camera from cameramanager to get array of camera async api + * @tc.desc : Get camera from cameramanager to get array of camera async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERAS', 0, async function (done) { + console.info("--------------GET_CAMERAS--------------"); + cameraManager.getCameras(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GetCameras success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering GetCameras data is not null || undefined"); + camerasArray = data; + if (camerasArray != null && camerasArray.length > 0) { + for (var i = 0; i < camerasArray.length; i++) { + // Get the variables from camera object + var cameraId = camerasArray[i].cameraId; + console.info(TAG + "Entering GetCameras camera" + i + "Id: " + cameraId); + var cameraPosition = camerasArray[i].cameraPosition; + console.info(TAG + "Entering GetCameras camera" + i + "Position: " + cameraPosition); + var cameraType = camerasArray[i].cameraType; + console.info(TAG + "Entering GetCameras camera" + i + "Type: " + cameraType); + var connectionType = camerasArray[i].connectionType + console.info(TAG + "Entering GetCameras connection" + i + "Type: " + connectionType); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERAS PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERAS FAILED cameraArray is null || undefined"); + } + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERAS FAILED: " + err.message); + } + console.info(TAG + "Entering GET_CAMERAS ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /*CAMERA-0 Scripts*/ + /** + * @tc.number : CREATE_CAMERA_INPUT + * @tc.name : Create camerainput from camera-0 cameraId async api + * @tc.desc : Create camerainput from camera-0 cameraId async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT', 0, async function (done) { + cameraManager.createCameraInput(camerasArray[0].cameraId, async (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT data is not null || undefined"); + camera0Input = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT PASSED with CameraID :" + camerasArray[0].cameraId); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT FAILED: " + err.message); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT + * @tc.name : Create camerainput from camera-1 cameraId async api + * @tc.desc : Create camerainput from camera-1 cameraId async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT', 0, async function (done) { + cameraManager.createCameraInput(camerasArray[1].cameraId, async (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering CREATE_CAMERA_INPUT data is not null || undefined"); + camera1Input = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT PASSED with CameraID :" + camerasArray[1].cameraId); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT FAILED: " + err.message); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : CAMERA_INPUT_CALLBACK_ON_ERROR + * @tc.name : Photo output callback on error api + * @tc.desc : Photo output callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAMERA_INPUT_CALLBACK_ON_ERROR', 0, async function (done) { + if (camera0Input == null || camera0Input == undefined) { + console.info(TAG + "Entering CameraInputCallbackOnError cameraInput == null || undefined"); + } else { + console.info(TAG + "Entering CAMERA_INPUT_CALLBACK_ON_ERROR to operate"); + camera0Input.on('error', async (err, data) => { + if (!err) { + console.info(TAG + "cameraInput error callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "CAMERA_INPUT_CALLBACK_ON_ERROR with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Error in CAMERA_INPUT_CALLBACK_ON_ERROR FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + } + await sleep(1000); + done(); + }) + + /*PreviewOutput APIs test script*/ + /** + * @tc.number : CREATE_PREVIEW_OUTPUT_SUCCESS + * @tc.name : Create PreviewOutput instance api + * @tc.desc : Create PreviewOutput instance api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_PREVIEW_OUTPUT_SUCCESS', 0, async function (done) { + console.info(TAG + " Entering CREATE_PREVIEW_OUTPUT_SUCCESS to operate"); + cameraObj.createPreviewOutput(surfaceId, async (err, data) => { + if (!err) { + console.info(TAG + " Entering createPreviewOutput success"); + if (data != null || data != undefined) { + console.info(TAG + " Entering createPreviewOutput data is not null || undefined"); + previewOutputAsync = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_PREVIEW_OUTPUT_SUCCESS PASSED" + previewOutputAsync); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_PREVIEW_OUTPUT_SUCCESS FAILED : " + err.message); + } + console.info(TAG + "Entering CREATE_PREVIEW_OUTPUT_SUCCESS ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_ERROR + * @tc.name : Preview output callback on error api + * @tc.desc : Preview output callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_ERROR', 0, async function (done) { + if (previewOutputAsync == null || previewOutputAsync == undefined) { + console.info(TAG + "Entering PreviewOutputError callback previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR to operate"); + previewOutputAsync.on('error', async (err, data) => { + if (!err) { + console.info(TAG + "PreviewOutputError callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_ERROR with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_ERROR FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /*PhotoOutput APIs test script*/ + /** + * @tc.number : CREATE_PHOTO_OUTPUT_SUCCESS + * @tc.name : Create PhotoOutput instance api + * @tc.desc : Create PhotoOutput instance api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_PHOTO_OUTPUT_SUCCESS', 0, async function (done) { + console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS to operate"); + console.info(TAG + 'Entering getImageReceiverSurfaceId') + await getImageReceiverSurfaceId() + await sleep(1000) + cameraObj.createPhotoOutput(surfaceId1, async (err, data) => { + if (!err) { + console.info(TAG + "Entering createPhotoOutput success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering createPhotoOutput data is not null || undefined"); + photoOutputAsync = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS FAILED : " + err.message); + console.info(TAG + "Entering createPhotoOutput ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : PHOTO_OUTPUT_CALLBACK_ON_ERROR + * @tc.name : Photo output callback on error api + * @tc.desc : Photo output callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_OUTPUT_CALLBACK_ON_ERROR', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTO_OUTPUT_CALLBACK_ON_ERROR photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_OUTPUT_CALLBACK_ON_ERROR to operate"); + photoOutputAsync.on('error', async (err, data) => { + if (!err) { + console.info(TAG + "PhotoOutputError callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Error during PhotoOutput with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PHOTO_OUTPUT_CALLBACK_ON_ERROR FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /*CaptureSession APIs test script*/ + /** + * @tc.number : CREATE_CAPTURE_SESSION_SUCCESS + * @tc.name : Create CaptureSession instance api + * @tc.desc : Create CaptureSession instance api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAPTURE_SESSION_SUCCESS', 0, async function (done) { + console.info(TAG + "Entering CREATE_CAPTURE_SESSION_SUCCESS to operate"); + cameraObj.createCaptureSession(null, async (err, data) => { + if (!err) { + console.info(TAG + "Entering createCaptureSession success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering createCaptureSession data is not null || undefined"); + captureSession = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAPTURE_SESSION_SUCCESS PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAPTURE_SESSION_SUCCESS FAILED : " + err.message); + console.info(TAG + "Entering CREATE_CAPTURE_SESSION_SUCCESS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + //Capturesession callback + /** + * @tc.number : CAP_SES_CALLBACK_ON_ERROR + * @tc.name : CaptureSession callback on error api + * @tc.desc : CaptureSession callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAP_SES_CALLBACK_ON_ERROR', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering captureSession error callback captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAP_SES_CALLBACK_ON_ERROR to operate"); + captureSession.on('error', async (err, data) => { + if (!err) { + console.info(TAG + " captureSession error callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "CAP_SES_CALLBACK_ON_ERROR with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Error in CAP_SES_CALLBACK_ON_ERROR FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /*CaptureSession APIs*/ + /** + * @tc.number : BEGIN_CONFIG_SUCCESS + * @tc.name : CaptureSession_Begin config api + * @tc.desc : CaptureSession_Begin config api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('BEGIN_CONFIG_SUCCESS', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering BeginConfig captureSession == null || undefined"); + } else { + console.info(TAG + "Entering BEGIN_CONFIG_SUCCESS to operate"); + captureSession.beginConfig(async (err, data) => { + if (!err) { + console.info(TAG + "Entering beginConfig success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering BeginConfig data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering BEGIN_CONFIG_SUCCESS beginConfig PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering BEGIN_CONFIG_SUCCESS FAILED : " + err.message); + console.info(TAG + "Entering BEGIN_CONFIG_SUCCESS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : ADD_INPUT_SUCCESS + * @tc.name : Add Input with camera1Input api + * @tc.desc : Add Input with camera1Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_INPUT_SUCCESS', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering Addinput captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_INPUT_SUCCESS to operate"); + captureSession.addInput(camera1Input, async (err, data) => { + if (!err) { + console.info(TAG + "Entering AddInput success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering AddInput data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_INPUT_SUCCESS addInput PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering ADD_INPUT_SUCCESS FAILED: " + err.message); + console.info(TAG + "Entering ADD_INPUT_SUCCESS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : ADD_OUTPUT_PREVIEW_SUCCESS + * @tc.name : Add output with camera0Input api + * @tc.desc : Add output with camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PREVIEW_SUCCESS', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering AddOutput_Preview captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS to operate"); + captureSession.addOutput(previewOutputAsync, async (err, data) => { + if (!err) { + console.info(TAG + "Entering AddOutput_Preview : Success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering AddOutput_Preview data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS FAILED : " + err.message); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS ends here"); + } + await sleep(1000); + done(); + }) + } + }) + + /** + * @tc.number : REMOVE_PREVIEW_OUTPUT_SUCCESS + * @tc.name : Remove preview Output api + * @tc.desc : Remove preview Output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('REMOVE_PREVIEW_OUTPUT_SUCCESS', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS to operate"); + captureSession.removeOutput(previewOutputAsync, async (err, data) => { + if (!err) { + console.info(TAG + "Entering remove preview Output success"); + expect(true).assertTrue(); + console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering Remove preview Output FAILED" + err.message); + console.info(TAG + "Entering Remove Preview Output ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : ADD_OUTPUT_PREVIEW_SUCCESS + * @tc.name : Add output with camera0Input api + * @tc.desc : Add output with camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PREVIEW_SUCCESS', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering AddOutput_Preview captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS to operate"); + captureSession.addOutput(previewOutputAsync, async (err, data) => { + if (!err) { + console.info(TAG + "Entering AddOutput_Preview : Success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering AddOutput_Preview data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS FAILED : " + err.message); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS ends here"); + } + await sleep(1000); + done(); + }) + } + }) + + /** + * @tc.number : COMMIT_CONFIG_SUCCESS + * @tc.name : commit config api + * @tc.desc : commit config api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('COMMIT_CONFIG_SUCCESS', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering CommitConfig captureSession == null || undefined"); + } else { + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS to operate"); + captureSession.commitConfig(async (err, data) => { + if (!err) { + console.info(TAG + "Entering commitConfig success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CommitConfig data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS FAILED : " + err.message); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : isMirrorSupported_PHOTO_OUTPUT + * @tc.name : isMirrorSupported + * @tc.desc : isMirrorSupported + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('isMirrorSupported_PHOTO_OUTPUT', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering isMirrorSupported_PHOTO_OUTPUT to operate"); + photoOutputAsync.isMirrorSupported(async (err, data) => { + if (!err) { + console.info(TAG + "Entering isMirrorSupported_PHOTO_OUTPUT is success"); + console.info(TAG + "isMirrorSupported : " + data); + expect(true).assertTrue(); + } else { + expect().assertFail(); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : setMirror_true + * @tc.name : setMirror true + * @tc.desc : setMirror true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('setMirror_true', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering setMirror_true to operate"); + photoOutputAsync.setMirror(true, async (err, data) => { + if (!err) { + console.info(TAG + "Entering setMirror_true is success:"); + console.info(TAG + "setMirror is : " + 'True'); + expect(true).assertTrue(); + } else { + expect().assertFail(); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : setMirror_false + * @tc.name : setMirror false + * @tc.desc : setMirror false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('setMirror_false', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering setMirror_false to operate"); + photoOutputAsync.setMirror(false, async (err, data) => { + if (!err) { + console.info(TAG + "Entering setMirror_false is success"); + console.info(TAG + "setMirror is : " + 'false'); + expect(true).assertTrue(); + } else { + expect().assertFail(); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /*CaptureSession APIs*/ + /** + * @tc.number : BEGIN_CONFIG_SUCCESS + * @tc.name : CaptureSession_Begin config api + * @tc.desc : CaptureSession_Begin config api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('BEGIN_CONFIG_SUCCESS', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering BeginConfig captureSession == null || undefined"); + } else { + console.info(TAG + "Entering BEGIN_CONFIG_SUCCESS to operate"); + captureSession.beginConfig(async (err, data) => { + if (!err) { + console.info(TAG + "Entering beginConfig success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering BeginConfig data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering BEGIN_CONFIG_SUCCESS beginConfig PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering BEGIN_CONFIG_SUCCESS FAILED : " + err.message); + console.info(TAG + "Entering BEGIN_CONFIG_SUCCESS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : REMOVE_INPUT_SUCCESS + * @tc.name : remove input api + * @tc.desc : remove input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('REMOVE_INPUT_SUCCESS', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS to operate"); + captureSession.removeInput(camera1Input, async (err, data) => { + if (!err) { + console.info(TAG + "Entering remove input success"); + expect(true).assertTrue(); + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering Remove Input FAILED" + err.message); + console.info(TAG + "Entering Remove Input ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + } + done(); + }) + + /** + * @tc.number : ADD_INPUT_SUCCESS + * @tc.name : Add Input with camera0Input api + * @tc.desc : Add Input with camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_INPUT_SUCCESS', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering Addinput captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_INPUT_SUCCESS to operate"); + captureSession.addInput(camera0Input, async (err, data) => { + if (!err) { + console.info(TAG + "Entering AddInput success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering AddInput data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_INPUT_SUCCESS addInput PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering ADD_INPUT_SUCCESS FAILED: " + err.message); + console.info(TAG + "Entering ADD_INPUT_SUCCESS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : ADD_OUTPUT_PHOTO_SUCCESS + * @tc.name : Add output with photo output api + * @tc.desc : Add output with photo output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PHOTO_SUCCESS', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS to operate"); + captureSession.addOutput(photoOutputAsync, async (err, data) => { + if (!err) { + console.info(TAG + "Entering AddOutput_Photo success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS FAILED: " + err.message); + } + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : REMOVE_PHOTO_OUTPUT_SUCCESS + * @tc.name : Remove photo Output api + * @tc.desc : Remove photo Output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('REMOVE_PHOTO_OUTPUT_SUCCESS', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering REMOVE_PHOTO_OUTPUT_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering REMOVE_PHOTO_OUTPUT_SUCCESS to operate"); + captureSession.removeOutput(photoOutputAsync, async (err, data) => { + if (!err) { + console.info(TAG + "Entering remove photo Output success"); + expect(true).assertTrue(); + console.info(TAG + "Entering REMOVE_PHOTO_OUTPUT_SUCCESS PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering Remove photo Output FAILED" + err.message); + console.info(TAG + "Entering Remove photo Output ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + } + done(); + }) + + /** + * @tc.number : ADD_OUTPUT_PHOTO_SUCCESS + * @tc.name : Add output with photo output api + * @tc.desc : Add output with photo output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PHOTO_SUCCESS', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS to operate"); + captureSession.addOutput(photoOutputAsync, async (err, data) => { + if (!err) { + console.info(TAG + "Entering AddOutput_Photo success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS FAILED: " + err.message); + } + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : COMMIT_CONFIG_SUCCESS + * @tc.name : commit config api + * @tc.desc : commit config api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('COMMIT_CONFIG_SUCCESS', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering CommitConfig captureSession == null || undefined"); + } else { + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS to operate"); + captureSession.commitConfig(async (err, data) => { + if (!err) { + console.info(TAG + "Entering commitConfig success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering CommitConfig data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS FAILED : " + err.message); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT + * @tc.name : FocusStateChange callback api + * @tc.desc : FocusStateChange callback api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT', 0, async function (done) { + if (camera0Input == null || camera0Input == undefined) { + console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT to operate"); + camera0Input.on('focusStateChange', async (err, data) => { + if (!err) { + console.info(TAG + "FocusState callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Current FocusState is: " + data); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT + * @tc.name : ExposureStateChange callback api + * @tc.desc : ExposureStateChange callback api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT', 0, async function (done) { + if (camera0Input == null || camera0Input == undefined) { + console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT to operate"); + camera0Input.on('exposureStateChange', async (err, data) => { + if (!err) { + console.info(TAG + "ExposureStateChange callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Current ExposureStateChange is: " + data); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + //preview callback + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START + * @tc.name : Preview output callback on frame start api + * @tc.desc : Preview output callback on frame start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START', 0, async function (done) { + if (previewOutputAsync == null || previewOutputAsync == undefined) { + console.info(TAG + "Entering PreviewStart frameStart Callback previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START to operate"); + previewOutputAsync.on("frameStart", async (err, data) => { + if (!err) { + console.info(TAG + "PreviewStart frameStart Callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START FAILED : + err.message"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END + * @tc.name : Preview capture callback on frame end api + * @tc.desc : Preview capture callback on frame end api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END', 0, async function (done) { + if (previewOutputAsync == null || previewOutputAsync == undefined) { + console.info(TAG + "Entering PreviewOutput frameEnd Callback previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END to operate"); + previewOutputAsync.on('frameEnd', async (err, data) => { + if (!err) { + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END Callback is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END FAILED : + err.message"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + //Capture callback + /** + * @tc.number : PHOTO_CAP_CALLBACK_ON_CAPTURE_START + * @tc.name : Photo capture callback on capture start api + * @tc.desc : Photo capture callback on capture start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_CAP_CALLBACK_ON_CAPTURE_START', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering Photo Capture Callback on CaptureStart photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_START to operate"); + photoOutputAsync.on('captureStart', async (err, data) => { + if (!err) { + console.info(TAG + "Photo Capture Callback on CaptureStart is success"); + if (data != null || data != undefined) { + console.info(TAG + "PHOTO_CAP_CALLBACK_ON_CAPTURE_START with captureId: " + data); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PHOTO_CAP_CALLBACK_ON_CAPTURE_START FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PHOTO_CAP_CALLBACK_ON_CAPTURE_END + * @tc.name : Photo capture callback on capture end api + * @tc.desc : Photo capture callback on capture end api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_CAP_CALLBACK_ON_CAPTURE_END', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_END photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_END to operate"); + photoOutputAsync.on('captureEnd', async (err, data) => { + if (!err) { + console.info(TAG + "captureEnd callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "captureEnd callback with captureId: " + data.captureId); + console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + 'PHOTO_CAP_CALLBACK_ON_CAPTURE_END FAILED' + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER + * @tc.name : Photo capture callback on frame shutter api + * @tc.desc : Photo capture callback on frame shutter api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER to operate"); + photoOutputAsync.on('frameShutter', async (err, data) => { + if (!err) { + console.info(TAG + "frameShutter callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "frameShutter callback with captureId: " + data.captureId); + console.info(TAG + "frameShutter callback with timestamp: " + data.timestamp); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : CAPTURE_SESSION_START + * @tc.name : capture session start api + * @tc.desc : capture session start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_START', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering CaptureSession Start captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAPTURE_SESSION_START to operate"); + captureSession.start(async (err, data) => { + if (!err) { + console.info(TAG + "Entering captureSession.start success"); + expect(true).assertTrue(); + console.info(TAG + "Entering CAPTURE_SESSION_START PASSED"); + } + else { + console.info(TAG + 'Entering CAPTURE_SESSION_START FAILED: ' + err.message) + expect().assertFail(); + } + console.info(TAG + "Entering CAPTURE_SESSION_START ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + //Location + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS + * @tc.name : Photo output capture without photosettings api + * @tc.desc : Photo output capture without photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS to operate"); + photoOutputAsync.capture(async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture without photosettings success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS PASSED"); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); + photoOutputAsync.capture(photosettings1, async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture with photosettings1"); + if (data != null || data != undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1 PASSED"); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1 FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1 ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 + * @tc.name : Photo output capture with photosettings2 api + * @tc.desc : Photo output capture with photosettings2 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 to operate"); + photoOutputAsync.capture(photosettings2, async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture with photosettings2 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 PASSED"); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3 to operate"); + photoOutputAsync.capture(photosettings3, async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture with photosettings3 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture with photosettings3 data is not null || undefined"); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS PASSED"); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3 FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3 ends here"); + } + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS with Rotation-270 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4 to operate"); + photoOutputAsync.capture(photosettings4, async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture with photosettings4 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture with photosettings4 data is not null || undefined"); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4 PASSED"); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4 FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4 ends here"); + } + }) + await sleep(1000); + done(); + } + }) + + //FLASH Function API scripts + /** + * @tc.number : HAS_FLASH + * @tc.name : check if has flash-camera0Input api + * @tc.desc : check if has flash-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('HAS_FLASH', 0, async function (done) { + console.info(TAG + "hasFlash called.") + camera0Input.hasFlash(async (err, data) => { + if (!err) { + console.info(TAG + "Entering HAS_FLASH success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering HAS_FLASH data is not null || undefined"); + console.info(TAG + "Entering HAS_FLASH PASSED with HAS_FLASH is: " + data); + expect(data).assertEqual(true); + } + } else { + console.info(TAG + "Entering HAS_FLASH FAILED : " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering HAS_FLASH ends here"); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_OPEN_SUPPORTED + * @tc.name : check if flash mode open is supported-camera0Input api + * @tc.desc : check if flash mode open is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_OPEN_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED to operate"); + camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED data is not null || undefined"); + console.info(TAG + "FLASH_MODE_OPEN supported is: " + data); + expect(data).assertEqual(true); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED PASSED"); + } + } else { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_OPEN + * @tc.name : set flash mode open camera0 api + * @tc.desc : set flash mode open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_OPEN', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN to operate"); + camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); + console.info(TAG + "Entering SET_FLASH_MODE_OPEN PASSED") + expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); + } + else { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_OPEN ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_OPEN + * @tc.name : get flash mode open camera0 api + * @tc.desc : get flash mode open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FLASH_MODE_OPEN', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_OPEN to operate"); + camera0Input.getFlashMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FLASH_MODE_OPEN success"); + if (data == 1) { + console.info(TAG + "GET_FLASH_MODE_OPEN data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_OPEN PASSED"); + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_OPEN FAILED : " + err.message); + console.info(TAG + "GET_FLASH_MODE_OPEN ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED + * @tc.name : check if flash mode always open is supported-camera0Input api + * @tc.desc : check if flash mode always open is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED to operate"); + camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { + if (!err) { + console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED data is not null || undefined"); + console.info(TAG + "FLASH_MODE_ALWAYS_OPEN supported is: " + data); + expect(data).assertEqual(true); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED PASSED"); + } + } else { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_ALWAYS_OPEN + * @tc.name : set flash mode always open camera0 api + * @tc.desc : set flash mode always open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_ALWAYS_OPEN', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN to operate"); + camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN PASSED") + expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); + } + else { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_ALWAYS_OPEN + * @tc.name : get flash mode always open camera0 api + * @tc.desc : get flash mode always open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FLASH_MODE_ALWAYS_OPEN', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN to operate"); + camera0Input.getFlashMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN success"); + if (data == 3) { + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN data is not null || undefined: "); + expect(true).assertTrue(); + console.info(TAG + "Current FlashMode is: " + data); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN PASSED"); + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN FAILED : " + err.message); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_AUTO_SUPPORTED + * @tc.name : check if flash mode auto is supported-camera0Input api + * @tc.desc : check if flash mode auto is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_AUTO_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED to operate"); + camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering FLASH_MODE_AUTO SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED data is not null || undefined"); + console.info(TAG + "FLASH_MODE_AUTO supported is: " + data); + expect(data).assertEqual(true); + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED PASSED"); + } + } else { + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED FAILED :" + err.message); + expect().assertFail(); + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_AUTO + * @tc.name : set flash mode auto camera0 api + * @tc.desc : set flash mode auto open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_AUTO to operate"); + camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FLASH_MODE_AUTO SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); + console.info(TAG + "Entering SET_FLASH_MODE_AUTO PASSED") + expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); + } + else { + console.info(TAG + "Entering SET_FLASH_MODE_AUTO FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_AUTO ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_AUTO + * @tc.name : get flash mode auto camera0 api + * @tc.desc : get flash mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FLASH_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_AUTO to operate"); + camera0Input.getFlashMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FLASH_MODE_AUTO success"); + if (data == 2) { + console.info(TAG + "GET_FLASH_MODE_AUTO data is not null || undefined: "); + expect(true).assertTrue(); + console.info(TAG + "Current FlashMode is: " + data); + console.info(TAG + "GET_FLASH_MODE_AUTO PASSED"); + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_AUTO FAILED :" + err.message); + console.info(TAG + "GET_FLASH_MODE_AUTO ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_CLOSE_SUPPORTED + * @tc.name : check if flash mode close is supported-camera0Input api + * @tc.desc : check if flash mode close is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_CLOSE_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED to operate"); + camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering FLASH_MODE_CLOSE SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED data is not null || undefined"); + console.info(TAG + "FLASH_MODE_CLOSE supported is: " + data); + expect(data).assertEqual(true); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED PASSED"); + } + } else { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED FAILED :" + err.message); + expect().assertFail(); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_CLOSE + * @tc.name : set flash mode close camera0 api + * @tc.desc : set flash mode close open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_CLOSE', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE to operate"); + camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE PASSED") + expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); + } + else { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_CLOSE + * @tc.name : get flash mode auto camera0 api + * @tc.desc : get flash mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FLASH_MODE_CLOSE', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_CLOSE to operate"); + camera0Input.getFlashMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FLASH_MODE_CLOSE success"); + if (data == 0) { + console.info(TAG + "GET_FLASH_MODE_CLOSE data is not null || undefined: "); + expect(true).assertTrue(); + console.info(TAG + "Current FlashMode is: " + data); + console.info(TAG + "GET_FLASH_MODE_CLOSE PASSED"); + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_CLOSE FAILED :" + err.message); + console.info(TAG + "GET_FLASH_MODE_CLOSE ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_ZOOM_RATIO + * @tc.name : get zoom ratio camera-0 cameraId api + * @tc.desc : get zoom ratio camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_ZOOM_RATIO', 0, async function (done) { + console.info("--------------GET_ZOOM_RATIO--------------"); + camera0Input.getZoomRatioRange(async (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering GET_ZOOM_RATIO data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering GET_ZOOM_RATIO Success " + data) + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_ZOOM_RATIO FAILED: " + err.message); + } + console.info(TAG + "Entering GET_ZOOM_RATIO ends here"); + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_1_ASYNC + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_1_ASYNC', 0, async function (done) { + camera0Input.setZoomRatio(1, (err, data) => { + if (!err) { + console.info(TAG + "setZoomRatio success: 1"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err, data1) => { + if (!err) { + console.info(TAG + "getZoomRatio success : " + data1); + expect(data1).assertEqual(1); + console.info(TAG + "SET_GET_ZOOM_1_ASYNC PASSED "); + } + else { + console.info(TAG + "GET_ZOOM_1_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + } else { + console.info(TAG + "SET_ZOOM_1_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_2_ASYNC + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_2_ASYNC', 0, async function (done) { + camera0Input.setZoomRatio(2, (err, data) => { + if (!err) { + console.info(TAG + "setZoomRatio success: 2"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err, data1) => { + if (!err) { + console.info(TAG + "getZoomRatio success : " + data1); + expect(data1).assertEqual(2); + console.info(TAG + "SET_GET_ZOOM_2_ASYNC PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "GET_ZOOM_2_ASYNC FAILED" + err.message); + } + }) + } else { + expect().assertFail(); + console.info(TAG + "SET_ZOOM_2_ASYNC FAILED" + err.message); + } + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_3_ASYNC + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_3_ASYNC', 0, async function (done) { + camera0Input.setZoomRatio(3, (err, data) => { + if (!err) { + console.info(TAG + "setZoomRatio success: 3"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err, data1) => { + if (!err) { + console.info(TAG + "getZoomRatio success : " + data1); + expect(data1).assertEqual(3); + console.info(TAG + "SET_GET_ZOOM_3_ASYNC PASSED "); + } + else { + console.info(TAG + "GET_ZOOM_3_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + } else { + console.info(TAG + "SET_ZOOM_3_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_4_ASYNC + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_4_ASYNC', 0, async function (done) { + camera0Input.setZoomRatio(4, (err, data) => { + if (!err) { + console.info(TAG + "setZoomRatio success: 4"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err, data1) => { + if (!err) { + console.info(TAG + "getZoomRatio success : " + data1); + expect(data1).assertEqual(4); + console.info(TAG + "SET_GET_ZOOM_4_ASYNC PASSED "); + } + else { + console.info(TAG + "GET_ZOOM_4_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + } else { + console.info(TAG + "SET_ZOOM_4_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_5_ASYNC + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_5_ASYNC', 0, async function (done) { + camera0Input.setZoomRatio(5, (err, data) => { + if (!err) { + console.info(TAG + "setZoomRatio success: 5"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err, data1) => { + if (!err) { + console.info(TAG + "getZoomRatio success : " + data1); + expect(data1).assertEqual(5); + console.info(TAG + "SET_GET_ZOOM_5_ASYNC PASSED "); + } + else { + console.info(TAG + "GET_ZOOM_5_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + } else { + console.info(TAG + "SET_ZOOM_5_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_6_ASYNC + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_6_ASYNC', 0, async function (done) { + camera0Input.setZoomRatio(6, (err, data) => { + if (!err) { + console.info(TAG + "setZoomRatio success: 6"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err, data1) => { + if (!err) { + console.info(TAG + "getZoomRatio success : " + data1); + expect(data1).assertEqual(6); + console.info(TAG + "SET_GET_ZOOM_6_ASYNC PASSED "); + } + else { + console.info(TAG + "GET_ZOOM_6_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + } else { + console.info(TAG + "SET_ZOOM_6_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_LOCKED_SUPPORTED + * @tc.name : check if focus mode locked is supported-camera0Input api + * @tc.desc : check if focus mode locked is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_LOCKED_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED to operate"); + camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Is Focus Mode Locked Supported SUCCESS: " + data); + if (data != null || data != undefined) { + console.info(TAG + "Entering Is Focus Mode Locked Supported data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_LOCKED_SUPPORTED is: " + data); + expect(data).assertEqual(false); + console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED PASSED: "); + } + } else { + console.info(TAG + "IS_FOCUS_MODE_LOCKED_SUPPORTED FAILED :" + err.message); + expect().assertFail() + console.info(TAG + "IS_FOCUS_MODE_LOCKED_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_LOCKED + * @tc.name : set focus mode locked camera0 api + * @tc.desc : set focus mode locked camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_LOCKED', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED to operate"); + camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SetFocus Mode Locked SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); + console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED FAILED : ") + expect().assertFail(); + } else { + console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED PASSED : " + err.message); + expect(true).assertTrue(); + console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_LOCKED + * @tc.name : get focus mode locked camera0 api + * @tc.desc : get focus mode locked camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_MODE_LOCKED', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_LOCKED to operate"); + camera0Input.getFocusMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Focus Mode Locked SUCCESS: " + data); + console.info(TAG + "Get Focus Mode Locked data is not null || undefined: "); + console.info(TAG + "Current FocusMode is: " + data); + expect(data).assertEqual(0); + console.info(TAG + "GET_FOCUS_MODE_LOCKED PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_LOCKED FAILED : " + err.message); + console.info(TAG + "GET_FOCUS_MODE_LOCKED ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCAL_LENGTH + * @tc.name : get focal length camera0 api + * @tc.desc : get focal length camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCAL_LENGTH', 0, async function (done) { + console.info(TAG + "Entering GET_FOCAL_LENGTH to operate"); + camera0Input.getFocalLength(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Focal length SUCCESS: " + JSON.stringify(data)); + console.info(TAG + "Current Focal length is: " + JSON.stringify(data)); + expect(data).assertEqual(3.4600000381469727); + console.info(TAG + "GET_FOCAL_LENGTH PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCAL_LENGTH FAILED : " + err.message); + console.info(TAG + "GET_FOCAL_LENGTH ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FOCUS_POINT_focus mode manual + * @tc.name : set focus Point camera0 api + * @tc.desc : set focus Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_POINT_focus mode manual', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_POINT to operate"); + camera0Input.setFocusPoint(Point1, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_FOCUS_POINT PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_FOCUS_POINT FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_POINT ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_POINT_focus mode manual + * @tc.name : get focus Point camera0 api + * @tc.desc : get focus point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_POINT_focus mode manual', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_POINT to operate"); + camera0Input.getFocusPoint(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); + console.info(TAG + "Current Focus Point is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_POINT PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_POINT FAILED : " + err.message); + console.info(TAG + "GET_FOCUS_POINT ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_MANUAL_SUPPORTED + * @tc.name : check if focus mode manual is supported-camera0Input api + * @tc.desc : check if focus mode manual is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_MANUAL_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED to operate"); + camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + data); + expect(data).assertEqual(true); + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED PASSED: "); + } + } else { + console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED FAILED " + err.message); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_MANUAL + * @tc.name : set focus mode manual camera0 api + * @tc.desc : set focus mode manual camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_MANUAL', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL to operate"); + camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL PASSED") + expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) + } + else { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_MANUAL + * @tc.name : get focus mode manual camera0 api + * @tc.desc : get focus mode manual camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_MODE_MANUAL', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL to operate"); + camera0Input.getFocusMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL SUCCESS"); + console.info(TAG + "GET_FOCUS_MODE_MANUAL data is not null || undefined: "); + console.info(TAG + "Current FocusMode is: " + data); + expect(data).assertEqual(0); + console.info(TAG + "GET_FOCUS_MODE_MANUAL PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_MANUAL FAILED : " + err.message); + console.info(TAG + "GET_FOCUS_MODE_MANUAL ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE + * @tc.name : Photo output capture without photosettings api + * @tc.desc : Photo output capture without photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE to operate"); + photoOutputAsync.capture(async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture without photosettings success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE PASSED"); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : SET_FOCUS_POINT_focus mode continuous + * @tc.name : set focus Point locked camera0 api + * @tc.desc : set focus Point locked camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_POINT to operate"); + camera0Input.setFocusPoint(Point2, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_FOCUS_POINT PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_FOCUS_POINT FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_POINT ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_POINT_focus mode continuous + * @tc.name : get focus Point camera0 api + * @tc.desc : get focus point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_POINT to operate"); + camera0Input.getFocusPoint(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); + console.info(TAG + "Current Focus Point is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_POINT PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_POINT FAILED : " + err.message); + console.info(TAG + "GET_FOCUS_POINT ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_CONTINUOUS_SUPPORTED + * @tc.name : check if focus mode continuous is supported-camera0Input api + * @tc.desc : check if focus mode continuous is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_CONTINUOUS_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED to operate"); + camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_CONTINOUS_SUPPORTED is: " + data); + expect(data).assertEqual(true); + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED PASSED: "); + } + } else { + console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_CONTINUOUS + * @tc.name : set focus mode continuous camera0 api + * @tc.desc : set focus mode continuous camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_CONTINUOUS', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS to operate"); + camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS PASSED"); + } + else { + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_CONTINUOUS + * @tc.name : get focus mode continuous camera0 api + * @tc.desc : get focus mode continuous camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_MODE_CONTINUOUS', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS to operate"); + camera0Input.getFocusMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS SUCCESS"); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS data is not null || undefined: "); + console.info(TAG + "Current FocusMode is: " + data); + expect(data).assertEqual(1); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS FAILED : " + err.message); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE + * @tc.name : Photo output capture without photosettings api + * @tc.desc : Photo output capture without photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE to operate"); + photoOutputAsync.capture(async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture without photosettings success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE PASSED"); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : SET_FOCUS_POINT_focus mode auto + * @tc.name : set focus Point camera0 api + * @tc.desc : set focus Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_POINT to operate"); + camera0Input.setFocusPoint(Point3, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_FOCUS_POINT PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_FOCUS_POINT FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_POINT ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_POINT_focus mode auto + * @tc.name : get focus Point camera0 api + * @tc.desc : get focus point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_POINT to operate"); + camera0Input.getFocusPoint(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); + console.info(TAG + "Current Focus Point is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_POINT PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_POINT FAILED : " + err.message); + console.info(TAG + "GET_FOCUS_POINT ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_AUTO_SUPPORTED + * @tc.name : check if focus mode auto is supported-camera0Input api + * @tc.desc : check if focus mode auto is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_AUTO_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED to operate"); + camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_AUTO_SUPPORTED is: " + data); + expect(data).assertEqual(true); + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED PASSED: "); + } + } else { + console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_AUTO + * @tc.name : set focus mode auto camera0 api + * @tc.desc : set focus mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO to operate"); + camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); + if (data != null || data != undefined) { + expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO PASSED") + } + } else { + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_AUTO + * @tc.name : get focus mode auto camera0 api + * @tc.desc : get focus mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_AUTO to operate"); + camera0Input.getFocusMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FOCUS_MODE_AUTO SUCCESS"); + console.info(TAG + "GET_FOCUS_MODE_AUTO data is not null || undefined: "); + console.info(TAG + "Current FocusMode is: " + data); + expect(data).assertEqual(2); + console.info(TAG + "GET_FOCUS_MODE_AUTO PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_AUTO FAILED : " + err.message); + console.info(TAG + "GET_FOCUS_MODE_AUTO ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE + * @tc.name : Photo output capture without photosettings api + * @tc.desc : Photo output capture without photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE to operate"); + photoOutputAsync.capture(async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture without photosettings success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE PASSED"); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : IS_EXPOSURE_MODE_LOCKED_SUPPORTED + * @tc.name : check if exposure mode locked is supported-camera0Input api + * @tc.desc : check if exposure mode locked is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('IS_EXPOSURE_MODE_LOCKED_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_EXPOSURE_MODE_LOCKED_SUPPORTED to operate"); + camera0Input.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Is Exposure Mode Locked supported SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering Is Exposure Mode Locked supported data is not null || undefined"); + console.info(TAG + "Exposure_Mode_Locked_Supported is: " + data); + expect(data).assertEqual(false); + console.info(TAG + "Entering IS_EXPOSURE_MODE_LOCKED_SUPPORTED PASSED: "); + } + } else { + console.info(TAG + "IS_EXPOSURE_MODE_LOCKED_SUPPORTED FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "IS_EXPOSURE_MODE_LOCKED_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : SET_EXPOSURE_MODE_LOCKED + * @tc.name : set exposure mode locked camera0 api + * @tc.desc : set exposure mode locked camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('SET_EXPOSURE_MODE_LOCKED', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_MODE_LOCKED to operate"); + camera0Input.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure Mode Locked, current ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED); + console.info(TAG + "Entering SET_EXPOSURE_MODE_LOCKED FAILED") + expect().AssertFail(); + } else { + console.info(TAG + "Entering SET_EXPOSURE_MODE_LOCKED PASSED : " + err.message); + expect(true).assertTrue(); + console.info(TAG + "Entering SET_EXPOSURE_MODE_LOCKED ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_EXPOSURE_MODE_LOCKED + * @tc.name : get exposure mode locked camera0 api + * @tc.desc : get exposure mode locked camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_MODE_LOCKED', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_MODE_LOCKED to operate"); + camera0Input.getExposureMode(async (err, data) => { + if (!err) { + console.info(TAG + "Current ExposureMode is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_MODE_LOCKED PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_MODE_LOCKED FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_MODE_LOCKED ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_EXPOSURE_MODE_CONTINUOUS_AUTO_SUPPORTED + * @tc.name : check if exposure mode continuous auto is supported-camera0Input api + * @tc.desc : check if exposure mode continuous auto is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('IS_EXPOSURE_MODE_CONTINUOUS_AUTO_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_EXPOSURE_MODE_CONTINUOUS_AUTO_SUPPORTED to operate"); + camera0Input.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Is Exposure Mode continuous Auto supported SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering Is Exposure Mode continuous Auto supported data is not null || undefined"); + console.info(TAG + "Exposure_Mode_continuous_Auto_Supported is: " + data); + expect(data).assertEqual(false); + console.info(TAG + "Entering IS_EXPOSURE_MODE_CONTINUOUS_AUTO_SUPPORTED PASSED: "); + } + } else { + console.info(TAG + "IS_EXPOSURE_MODE_CONTINUOUS_AUTO_SUPPORTED FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "IS_EXPOSURE_MODE_CONTINUOUS_AUTO_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : SET_EXPOSURE_MODE_CONTINUOUS_AUTO + * @tc.name : set exposure mode continuous auto camera0 api + * @tc.desc : set exposure mode continuous auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('SET_EXPOSURE_MODE_CONTINUOUS_AUTO', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_MODE_CONTINUOUS_AUTO to operate"); + camera0Input.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure Mode continuous auto,current ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO); + console.info(TAG + "Entering SET_EXPOSURE_MODE_CONTINUOUS_AUTO FAILED") + expect().AssertFail(); + } else { + console.info(TAG + "Entering SET_EXPOSURE_MODE_CONTINUOUS_AUTO PASSED : " + err.message); + expect(true).assertTrue(); + console.info(TAG + "Entering SET_EXPOSURE_MODE_CONTINUOUS_AUTO ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_EXPOSURE_MODE_CONTINUOUS_AUTO + * @tc.name : get exposure mode continuous auto camera0 api + * @tc.desc : get exposure mode continuous auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_MODE_CONTINUOUS_AUTO', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_MODE_CONTINUOUS_AUTO to operate"); + camera0Input.getExposureMode(async (err, data) => { + if (!err) { + console.info(TAG + "Current ExposureMode is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_MODE_CONTINUOUS_AUTO PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_MODE_CONTINUOUS_AUTO FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_MODE_CONTINUOUS_AUTO ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_BIASRANGE + * @tc.name : get exposure bias range camera0 api + * @tc.desc : get exposure bias range camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_BIASRANGE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_BIASRANGE to operate"); + camera0Input.getExposureBiasRange(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Exposure bias range SUCCESS"); + console.info(TAG + "Current Exposure bias range is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_BIASRANGE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_BIASRANGE FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_BIASRANGE ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_BIAS_exposure -4 + * @tc.name : set exposure bias camera0 api + * @tc.desc : set exposure bias camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_BIAS', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_BIAS to operate"); + camera0Input.setExposureBias(-4, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure bias is: " + "-4"); + console.info(TAG + "Entering SET_EXPOSURE_BIAS PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_EXPOSURE_BIAS FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_EXPOSURE_BIAS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_BIASVALUE_exposure mode locked + * @tc.name : get exposure bias value camera0 api + * @tc.desc : get exposure bias value camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_BIASVALUE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_BIASVALUE to operate"); + camera0Input.getExposureValue(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Exposure bias value SUCCESS"); + console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); + expect(data).assertEqual(-4); + console.info(TAG + "GET_EXPOSURE_BIASVALUE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_BIASVALUE FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_BIASVALUE ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_POINT_exposure mode auto + * @tc.name : set exposure Point camera0 api + * @tc.desc : set exposure Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_POINT to operate"); + camera0Input.setExposurePoint(Point1, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_EXPOSURE_POINT PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_EXPOSURE_POINT FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_EXPOSURE_POINT ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_POINT_exposure mode auto + * @tc.name : get exposure point camera0 api + * @tc.desc : get exposure point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_POINT to operate"); + camera0Input.getExposurePoint(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Exposure point SUCCESS"); + console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_POINT PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_POINT FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_POINT ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_EXPOSURE_MODE_AUTO_SUPPORTED + * @tc.name : check if exposure mode auto is supported-camera0Input api + * @tc.desc : check if exposure mode auto is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('IS_EXPOSURE_MODE_AUTO_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_EXPOSURE_MODE_AUTO_SUPPORTED to operate"); + camera0Input.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Is Exposure Mode Auto supported SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering Is Exposure Mode Auto supported data is not null || undefined"); + console.info(TAG + "Exposure_Mode_Auto_Supported is: " + data); + expect(data).assertEqual(true); + console.info(TAG + "Entering IS_EXPOSURE_MODE_AUTO_SUPPORTED PASSED: "); + } + } else { + console.info(TAG + "IS_EXPOSURE_MODE_AUTO_SUPPORTED FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "IS_EXPOSURE_MODE_AUTO_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : SET_EXPOSURE_MODE_AUTO + * @tc.name : set exposure mode auto camera0 api + * @tc.desc : set exposure mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('SET_EXPOSURE_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_MODE_AUTO to operate"); + camera0Input.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure Mode auto,current ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_AUTO); + if (data != null || data != undefined) { + expect(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO).assertEqual(1); + console.info(TAG + "Entering SET_EXPOSURE_MODE_AUTO PASSED") + } + } else { + console.info(TAG + "Entering SET_EXPOSURE_MODE_AUTO FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_EXPOSURE_MODE_AUTO ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_EXPOSURE_MODE_AUTO + * @tc.name : get exposure mode auto camera0 api + * @tc.desc : get exposure mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('GET_EXPOSURE_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_MODE_AUTO to operate"); + camera0Input.getExposureMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Exposure Mode SUCCESS"); + console.info(TAG + "Get Exposure Mode data is not null || undefined: "); + console.info(TAG + "Current ExposureMode is: " + data); + expect(data).assertEqual(1); + console.info(TAG + "GET_EXPOSURE_MODE_AUTO PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_MODE_AUTO FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_MODE_AUTO ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE + * @tc.name : Photo output capture without photosettings api + * @tc.desc : Photo output capture without photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PhotoOutputCapture photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE to operate"); + photoOutputAsync.capture(async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture without photosettings success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE PASSED"); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : SET_EXPOSURE_BIAS_exposure mode auto + * @tc.name : set exposure bias camera0 api + * @tc.desc : set exposure bias camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_BIAS', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_BIAS to operate"); + camera0Input.setExposureBias(1, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure bias is: " + "1"); + console.info(TAG + "Entering SET_EXPOSURE_BIAS PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_EXPOSURE_BIAS FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_EXPOSURE_BIAS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_BIASVALUE_exposure mode auto + * @tc.name : get exposure bias value camera0 api + * @tc.desc : get exposure bias value camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_BIASVALUE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_BIASVALUE to operate"); + camera0Input.getExposureValue(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Exposure bias value SUCCESS"); + console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); + expect(data).assertEqual(1); + console.info(TAG + "GET_EXPOSURE_BIASVALUE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_BIASVALUE FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_BIASVALUE ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_POINT_exposure + * @tc.name : set exposure Point camera0 api + * @tc.desc : set exposure Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_POINT to operate"); + camera0Input.setExposurePoint(Point2, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_EXPOSURE_POINT PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_EXPOSURE_POINT FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_EXPOSURE_POINT ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_POINT_ + * @tc.name : get exposure point camera0 api + * @tc.desc : get exposure point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_POINT to operate"); + camera0Input.getExposurePoint(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Exposure point SUCCESS"); + console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_POINT PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_POINT FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_POINT ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); + photoOutputAsync.capture(photosettings1, async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture with photosettings1"); + if (data != null || data != undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1 PASSED"); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1 FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1 ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : SET_EXPOSURE_BIAS_exposure mode auto + * @tc.name : set exposure bias camera0 api + * @tc.desc : set exposure bias camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_BIAS', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_BIAS to operate"); + camera0Input.setExposureBias(4, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure bias is: " + "4"); + console.info(TAG + "Entering SET_EXPOSURE_BIAS PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_EXPOSURE_BIAS FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_EXPOSURE_BIAS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_BIASVALUE_exposure mode continuous auto + * @tc.name : get exposure bias value camera0 api + * @tc.desc : get exposure bias value camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_BIASVALUE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_BIASVALUE to operate"); + camera0Input.getExposureValue(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Exposure bias value SUCCESS"); + console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); + expect(data).assertEqual(4); + console.info(TAG + "GET_EXPOSURE_BIASVALUE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_BIASVALUE FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_BIASVALUE ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_POINT + * @tc.name : set exposure Point camera0 api + * @tc.desc : set exposure Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_POINT to operate"); + camera0Input.setExposurePoint(Point3, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_EXPOSURE_POINT PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_EXPOSURE_POINT FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_EXPOSURE_POINT ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_POINT + * @tc.name : get exposure point camera0 api + * @tc.desc : get exposure point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_POINT to operate"); + camera0Input.getExposurePoint(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Exposure point SUCCESS"); + console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_POINT PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_POINT FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_POINT ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 to operate"); + photoOutputAsync.capture(photosettings2, async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture with photosettings2"); + if (data != null || data != undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 PASSED"); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : SET_EXPOSURE_BIAS_exposure -5 + * @tc.name : set exposure bias camera0 api + * @tc.desc : set exposure bias camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_BIAS', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_BIAS to operate"); + camera0Input.setExposureBias(-5, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure bias is: " + "-4"); + console.info(TAG + "Entering SET_EXPOSURE_BIAS PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_EXPOSURE_BIAS FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_EXPOSURE_BIAS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_BIASVALUE_exposure mode locked + * @tc.name : get exposure bias value camera0 api + * @tc.desc : get exposure bias value camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_BIASVALUE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_BIASVALUE to operate"); + camera0Input.getExposureValue(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Exposure bias value SUCCESS"); + console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); + expect(data).assertEqual(-4); + console.info(TAG + "GET_EXPOSURE_BIASVALUE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_BIASVALUE FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_BIASVALUE ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_BIAS_exposure 6 + * @tc.name : set exposure bias camera0 api + * @tc.desc : set exposure bias camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_BIAS', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_BIAS to operate"); + camera0Input.setExposureBias(6, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure bias is: " + "4"); + console.info(TAG + "Entering SET_EXPOSURE_BIAS PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_EXPOSURE_BIAS FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_EXPOSURE_BIAS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_BIASVALUE + * @tc.name : get exposure bias value camera0 api + * @tc.desc : get exposure bias value camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_BIASVALUE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_BIASVALUE to operate"); + camera0Input.getExposureValue(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Exposure bias value SUCCESS"); + console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); + expect(data).assertEqual(4); + console.info(TAG + "GET_EXPOSURE_BIASVALUE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_BIASVALUE FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_BIASVALUE ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + }) + + /*CaptureSession APIs test script*/ + /** + * @tc.number : CAPTURE_SESSION_STOP + * @tc.name : capture session stop api + * @tc.desc : capture session stop api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_STOP', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering CAPTURE_SESSION_STOP captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAPTURE_SESSION_STOP to operate"); + captureSession.stop(async (err, data) => { + if (!err) { + console.info(TAG + "Entering CAPTURE_SESSION_STOP captureSession.stop success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering captureSession.stop data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CAPTURE_SESSION_STOP captureSession.stop PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CAPTURE_SESSION_STOP FAILED : " + err.message); + console.info(TAG + "Entering CAPTURE_SESSION_STOP ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : CAPTURE_SESSION_RELEASE + * @tc.name : capture session release api + * @tc.desc : capture session release api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_RELEASE', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering CAPTURE_SESSION_RELEASE captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAPTURE_SESSION_RELEASE to operate"); + captureSession.release(async (err, data) => { + if (!err) { + console.info(TAG + "Entering captureSession.release success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering captureSession.release data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CAPTURE_SESSION_RELEASE PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CAPTURE_SESSION_RELEASE FAILED: " + err.message); + console.info(TAG + "Entering CAPTURE_SESSION_RELEASE ends here"); + await sleep(1000); + done(); + } + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PHOTOOUPUT_RELEASE + * @tc.name : photoOutput release api + * @tc.desc : photoOutput release api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUPUT_RELEASE', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTOOUPUT_RELEASE photoOutputAsync == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUPUT_RELEASE to operate"); + photoOutputAsync.release(async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutputAsync.release success"); + expect(true).assertTrue(); + console.info(TAG + "Entering PHOTOOUPUT_RELEASE PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUPUT_RELEASE FAILED: " + err.message); + console.info(TAG + "Entering photoOutputAsync.release ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PREVIEWOUPUT_RELEASE + * @tc.name : previewOutput release api + * @tc.desc : previewOutput release api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEWOUPUT_RELEASE', 0, async function (done) { + if (previewOutputAsync == null || previewOutputAsync == undefined) { + console.info(TAG + "Entering PREVIEWOUPUT_RELEASE previewOutputAsync == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEWOUPUT_RELEASE to operate"); + previewOutputAsync.release(async (err, data) => { + if (!err) { + console.info(TAG + "Entering previewOutputAsync.release success"); + console.info(TAG + "Entering previewOutputAsync.release data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering PREVIEWOUPUT_RELEASE PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering PREVIEWOUPUT_RELEASE FAILED: " + err.message); + console.info(TAG + "Entering PREVIEWOUPUT_RELEASE ends here"); + await sleep(1000); + done(); + } + }) + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : CAMERAINPUT_RELEASE_SUCCESS + * @tc.name : camera Input release api + * @tc.desc : camera Input release api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAMERAINPUT_RELEASE_SUCCESS', 0, async function (done) { + if (camera0Input == null || camera0Input == undefined) { + console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS camera0Input == null || undefined"); + } else { + console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS to operate"); + camera0Input.release(async (err, data) => { + if (!err) { + console.info(TAG + "Entering camera0Input.release success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering camera0Input.release data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS FAILED: " + err.message); + console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS ends here"); + await sleep(1000); + done(); + } + }) + await sleep(1000); + done(); + } + }) + }) +} \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4680dc1b4070664a0e21024b08088133c2486b44 --- /dev/null +++ b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitPhotoPromise.test.ets @@ -0,0 +1,3444 @@ +/* + * 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 cameraObj from '@ohos.multimedia.camera'; +import image from '@ohos.multimedia.image'; +import fileio from '@ohos.fileio'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl' +import bundle from '@ohos.bundle' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; + +const TAG = "CameraModuleTest: "; + +// Define global variables +var camera0InputPromise; +var cameraManagerPromise; +var previewOutputPromise; +var photoOutputPromise; +var CaptureSessionPromise; +var surfaceId1; +var camerasArrayPromise +var camera1InputPromise; + +var Point1 = { x: 1, y: 1 } +var Point2 = { x: 2, y: 2 } +var Point3 = { x: 3, y: 3 } + +var photosettings1 = { + rotation: 0, + quality: 0, + location: { + latitude: 12.9705, + longitude: 77.7329, + altitude: 920.0000, + }, +} +var photosettings2 = { + rotation: 90, + quality: 1, + location: { + latitude: 20, + longitude: 78, + altitude: 8586, + }, +} + +var photosettings3 = { + quality: 2, + location: { + latitude: 0, + longitude: 0, + altitude: 0, + }, +} +var photosettings4 = { + rotation: 180, + location: { + latitude: -1, + longitude: -1, + altitude: -1, + }, +} + +export default function cameraJSUnitPhotoPromise(surfaceId: any) { + + async function getImageReceiverSurfaceId() { + console.log(TAG + 'Entering create Image receiver') + var receiver = image.createImageReceiver(640, 480, 4, 8) + console.log(TAG + 'before receiver check') + if (receiver !== undefined) { + console.log(TAG + 'Receiver is ok') + surfaceId1 = await receiver.getReceivingSurfaceId() + console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) + } else { + console.log(TAG + 'Receiver is not ok') + } + } + + function sleep(ms) { + console.info(TAG + "Entering sleep -> Promise constructor"); + return new Promise(resolve => setTimeout(resolve, ms)); + } + + async function applyPermission() { + let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); + let atManager = abilityAccessCtrl.createAtManager(); + if (atManager != null) { + let tokenID = appInfo.accessTokenId; + console.info('[permission] case accessTokenID is ' + tokenID); + let permissionName1 = 'ohos.permission.CAMERA'; + let permissionName2 = 'ohos.permission.MICROPHONE'; + let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; + let permissionName4 = 'ohos.permission.READ_MEDIA'; + let permissionName5 = 'ohos.permission.WRITE_MEDIA'; + await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + } else { + console.info('[permission] case apply permission failed, createAtManager failed'); + } + } + + describe('CameraJsUnitPhotoPromise', function () { + console.info(TAG + '----------CameraJsUnitPhotoPromise--------------') + + beforeAll(async function () { + await applyPermission(); + console.info('beforeAll case'); + }) + + beforeEach(function () { + sleep(5000); + console.info('beforeEach case'); + }) + + afterEach(async function () { + console.info('afterEach case'); + }) + + afterAll(function () { + console.info('afterAll case'); + }) + + console.info(TAG + "----------Camera-PhotoMode-Promise-------------"); + /** + * @tc.number : GET_CAMERA_MANAGER_PROMISE + * @tc.name : Create camera manager instance promise api + * @tc.desc : Create camera manager instance promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_MANAGER_PROMISE', 0, async function (done) { + console.info("--------------GET_CAMERA_MANAGER_PROMISE--------------"); + cameraManagerPromise = await cameraObj.getCameraManager(null); + console.info(TAG + "Entering Get camera manager cameraManagerPromise: " + JSON.stringify(cameraManagerPromise)); + if (cameraManagerPromise != null && cameraManagerPromise != undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE FAILED : "); + } + console.info(TAG + "Entering GET_CAMERA_MANAGER_PROMISE ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : CAMERA_STATUS_CALLBACK + * @tc.name : camera status callback on CameraManager async api + * @tc.desc : camera status callback on CameraManager async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAMERA_STATUS_CALLBACK', 0, async function (done) { + if (cameraManagerPromise == null || cameraManagerPromise == undefined) { + console.info(TAG + 'Entering camera status callback cameraManagerPromise == null || undefined') + } else { + console.info(TAG + 'Entering CAMERA_STATUS_CALLBACK to operate') + cameraManagerPromise.on('cameraStatus', async (err, data) => { + if (!err) { + console.info(TAG + "CAMERA_STATUS_CALLBACK cameraManagerPromise is success"); + if (data != null || data != undefined) { + console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); + console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "CAMERA_STATUS_CALLBACK FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : GET_CAMERAS_PROMISE + * @tc.name : Get camera from cameramanager to get array of camera promise api + * @tc.desc : Get camera from cameramanager to get array of camera promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERAS_PROMISE', 0, async function (done) { + console.info("--------------GET_CAMERAS_PROMISE--------------"); + camerasArrayPromise = await cameraManagerPromise.getCameras(); + console.info(TAG + "Entering Get Cameras: " + JSON.stringify(camerasArrayPromise)); + if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { + console.info(TAG + "Entering Get Cameras success"); + for (var i = 0; i < camerasArrayPromise.length; i++) { + // Get the variables from camera object + var cameraId = camerasArrayPromise[i].cameraId; + console.info(TAG + "Entering Get Cameras camera" + i + "Id: " + cameraId); + var cameraPosition = camerasArrayPromise[i].cameraPosition; + console.info(TAG + "Entering Get Cameras camera" + i + "Position: " + cameraPosition); + var cameraType = camerasArrayPromise[i].cameraType; + console.info(TAG + "Entering Get Cameras camera" + i + "Type: " + cameraType); + var connectionType = camerasArrayPromise[i].connectionType + console.info(TAG + "Entering Get Cameras connection" + i + "Type: " + connectionType); + } + expect(true).assertTrue(); + console.info(TAG + "Entering GET_CAMERAS_PROMISE PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_CAMERAS_PROMISE FAILED : "); + } + console.info(TAG + "Entering GET_CAMERAS_PROMISE ends here"); + await sleep(1000); + done(); + }) + + /*CAMERA-0 Scripts*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_PROMISE + * @tc.name : Create camerainput from camera-0 cameraId promise api + * @tc.desc : Create camerainput from camera-0 cameraId promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_PROMISE', 0, async function (done) { + console.info("--------------CAMERA-0 STARTS HERE--------------"); + console.info("--------------CREATE_CAMERA_INPUT_PROMISE--------------"); + camera0InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraId); + console.info(TAG + "Entering Create camerainput camera0InputPromise: " + JSON.stringify(camera0InputPromise)); + if (camera0InputPromise != null && camera0InputPromise != undefined) { + console.info(TAG + "Entering Create camerainput camera0InputPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE FAILED : "); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_CAMERA_INPUT_PROMISE_Camera1 + * @tc.name : Create camerainput from camera-1 cameraId promise api + * @tc.desc : Create camerainput from camera-1 cameraId promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_PROMISE_Camera1', 0, async function (done) { + console.info("--------------CREATE_CAMERA_INPUT_PROMISE--------------"); + camera1InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[1].cameraId); + console.info(TAG + "Entering Create camerainput camera1InputPromise: " + JSON.stringify(camera1InputPromise)); + if (camera1InputPromise != null && camera1InputPromise != undefined) { + console.info(TAG + "Entering Create camerainput camera1InputPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE FAILED : "); + } + console.info(TAG + "Entering CREATE_CAMERA_INPUT_PROMISE ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : CAMERA_INPUT_CALLBACK_ON_ERROR + * @tc.name : Photo output callback on error api + * @tc.desc : Photo output callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAMERA_INPUT_CALLBACK_ON_ERROR', 0, async function (done) { + if (camera0InputPromise == null || camera0InputPromise == undefined) { + console.info(TAG + "Entering CAMERA_INPUT_CALLBACK_ON_ERROR camera0InputPromise == null || undefined"); + } else { + console.info(TAG + "Entering CAMERA_INPUT_CALLBACK_ON_ERROR to operate"); + camera0InputPromise.on('error', async (err, data) => { + if (!err) { + console.info(TAG + "camera0InputPromise error callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Error during camera0InputPromise with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "CAMERA_INPUT_CALLBACK_ON_ERROR FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /*PreviewOutput APIs test script*/ + /** + * @tc.number : CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE + * @tc.name : Create PreviewOutput instance promise api + * @tc.desc : Create PreviewOutput instance promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE', 0, async function (done) { + console.info(TAG + " Entering CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE to operate"); + previewOutputPromise = await cameraObj.createPreviewOutput(surfaceId); + console.info(TAG + " Entering createPreviewOutput success"); + if (previewOutputPromise != null || previewOutputPromise != undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering createPreviewOutput PASSED: " + JSON.stringify(previewOutputPromise)); + } + else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE FAILED : "); + console.info(TAG + "Entering CREATE_PREVIEW_OUTPUT_SUCCESS_PROMISE ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_ERROR + * @tc.name : Preview output callback on error api + * @tc.desc : Preview output callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_ERROR', 0, async function (done) { + if (previewOutputPromise == null || previewOutputPromise == undefined) { + console.info(TAG + "Entering Preview output callback on error previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR to operate"); + previewOutputPromise.on('error', async (err, data) => { + if (!err) { + console.info(TAG + "PreviewOutputError callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_ERROR with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_ERROR FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /*PhotoOutput APIs test script*/ + /** + * @tc.number : CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE + * @tc.name : Create PhotoOutput instance promise api + * @tc.desc : Create PhotoOutput instance promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE', 0, async function (done) { + console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE to operate"); + console.info(TAG + 'Entering getImageReceiverSurfaceId') + await getImageReceiverSurfaceId() + await sleep(1000) + photoOutputPromise = await cameraObj.createPhotoOutput(surfaceId1); + console.info(TAG + "Entering createPhotoOutput success"); + if (photoOutputPromise != null || photoOutputPromise != undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE FAILED : "); + console.info(TAG + "Entering createPhotoOutput ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : PHOTO_OUTPUT_CALLBACK_ON_ERROR + * @tc.name : Photo output callback on error api + * @tc.desc : Photo output callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_OUTPUT_CALLBACK_ON_ERROR', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering Photo output callback on error photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_OUTPUT_CALLBACK_ON_ERROR to operate"); + photoOutputPromise.on('error', async (err, data) => { + if (!err) { + console.info(TAG + "PhotoOutputError callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "PHOTO_OUTPUT_CALLBACK_ON_ERROR with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PHOTO_OUTPUT_CALLBACK_ON_ERROR FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /*CaptureSession APIs test script*/ + /** + * @tc.number : CREATE_CAPTURE_SESSION_PROMISE + * @tc.name : Create CaptureSession instance promise api + * @tc.desc : Create Capturesession instance promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAPTURE_SESSION_PROMISE', 0, async function (done) { + console.info(TAG + "Entering CREATE_CAPTURE_SESSION_PROMISE to operate"); + CaptureSessionPromise = await cameraObj.createCaptureSession(null); + console.info(TAG + "Entering createCaptureSession success"); + if (CaptureSessionPromise != null || CaptureSessionPromise != undefined) { + console.info(TAG + "Entering createCaptureSession data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_CAPTURE_SESSION_PROMISE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_CAPTURE_SESSION_PROMISE FAILED : "); + console.info(TAG + "Entering CREATE_CAPTURE_SESSION_PROMISE ends here"); + } + await sleep(1000); + done(); + }) + + //Capturesession callback + /** + * @tc.number : CAP_SES_CALLBACK_ON_ERROR + * @tc.name : CaptureSession callback on error api + * @tc.desc : CaptureSession callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAP_SES_CALLBACK_ON_ERROR', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering CaptureSession callback on error captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAP_SES_CALLBACK_ON_ERROR to operate"); + CaptureSessionPromise.on('error', async (err, data) => { + if (!err) { + console.info(TAG + " captureSession errorcallback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Error CAP_SES_CALLBACK_ON_ERROR with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "CAP_SES_CALLBACK_ON_ERROR FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /*CaptureSession APIs*/ + /** + * @tc.number : CREATE_BEGIN_CONFIG_PROMISE + * @tc.name : CaptureSession_Begin config promise api + * @tc.desc : CaptureSession_Begin config promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_BEGIN_CONFIG_PROMISE', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering CaptureSession_Begin config captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CREATE_BEGIN_CONFIG_PROMISE to operate"); + const promise = await CaptureSessionPromise.beginConfig(); + console.info(TAG + "Entering beginConfig success:"); + if (promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_BEGIN_CONFIG_PROMISE beginConfig PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_BEGIN_CONFIG_PROMISE FAILED : "); + } + console.info(TAG + "Entering CREATE_BEGIN_CONFIG_PROMISE ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : ADD_INPUT_PROMISE + * @tc.name : Add Input with camera0Input api + * @tc.desc : Add Input with camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_INPUT_PROMISE', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering Add Input captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_INPUT_PROMISE to operate"); + const Promise = await CaptureSessionPromise.addInput(camera1InputPromise); + console.info(TAG + "Entering Add Input addInput success"); + if (Promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_INPUT_PROMISE addInput PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering ADD_INPUT_PROMISE FAILED: "); + } + console.info(TAG + "Entering ADD_INPUT_PROMISE ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : ADD_OUTPUT_PREVIEW_PROMISE + * @tc.name : Add output with camera0Input api + * @tc.desc : Add output with camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PREVIEW_PROMISE', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering Add preview Output captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_PROMISE to operate"); + const promise = await CaptureSessionPromise.addOutput(previewOutputPromise); + console.info(TAG + "Entering Add preview Output : Success"); + if (promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_PROMISE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_PROMISE FAILED : "); + } + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_PROMISE ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : REMOVE_PREVIEW_OUTPUT_SUCCESS + * @tc.name : Remove preview Output api + * @tc.desc : Remove preview Output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('REMOVE_PREVIEW_OUTPUT_SUCCESS', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering Remove preview Output captureSession == null || undefined"); + } else { + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS to operate"); + const Promise = await CaptureSessionPromise.removeOutput(previewOutputPromise); + console.info(TAG + "Entering Remove preview Output success " + Promise); + if (Promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS FAILED: "); + } + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : ADD_OUTPUT_PREVIEW_PROMISE + * @tc.name : Add output with camera0Input api + * @tc.desc : Add output with camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PREVIEW_PROMISE', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering Add preview Output captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_PROMISE to operate"); + const promise = await CaptureSessionPromise.addOutput(previewOutputPromise); + console.info(TAG + "Entering Add preview Output : Success"); + if (promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_PROMISE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_PROMISE FAILED : "); + } + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_PROMISE ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : COMMIT_CONFIG_SUCCESS + * @tc.name : commit config api + * @tc.desc : commit config api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('COMMIT_CONFIG_SUCCESS', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering commit config captureSession == null || undefined"); + } else { + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS to operate"); + const promise = await CaptureSessionPromise.commitConfig(); + console.info(TAG + "Entering commit config commitConfig success"); + if (promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS commitConfig PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS commitConfig FAILED : "); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS commitConfig ends here"); + } + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : isMirrorSupported_PHOTO_OUTPUT + * @tc.name : isMirrorSupported + * @tc.desc : isMirrorSupported + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('isMirrorSupported_PHOTO_OUTPUT', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering isMirrorSupported_PHOTO_OUTPUT to operate"); + await photoOutputPromise.isMirrorSupported() + .then(function (data) { + console.info(TAG + "Entering isMirrorSupported_PHOTO_OUTPUT is success"); + console.info(TAG + "isMirrorSupported : " + data); + expect(true).assertTrue(); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "isMirrorSupported_PHOTO_OUTPUT FAILED : " + err.message); + }); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : setMirror_true + * @tc.name : setMirror true + * @tc.desc : setMirror true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('setMirror_true', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering setMirror_true to operate"); + await photoOutputPromise.setMirror(true).then(function (data) { + console.info(TAG + "Entering setMirror_true is success:"); + console.info(TAG + "setMirror is : " + 'True'); + expect(true).assertTrue(); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "setMirror_true FAILED : " + err.message); + }); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : setMirror_false + * @tc.name : setMirror false + * @tc.desc : setMirror false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('setMirror_false', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering setMirror_false to operate"); + await photoOutputPromise.setMirror(false) + .then(function (data) { + console.info(TAG + "Entering setMirror_false is success:"); + console.info(TAG + "setMirror is : " + 'false'); + expect(true).assertTrue(); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "setMirror_false FAILED : " + err.message); + }); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : CREATE_BEGIN_CONFIG_SUCCESS_PROMISE + * @tc.name : CaptureSession_Begin config promise api + * @tc.desc : CaptureSession_Begin config promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_BEGIN_CONFIG_SUCCESS_PROMISE', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS_PROMISE to operate"); + const promise = await CaptureSessionPromise.beginConfig(); + console.info(TAG + "Entering beginConfig success:"); + if (promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_BEGIN_CONFIG_SUCCESS_PROMISE beginConfig PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering beginConfig FAILED"); + } + console.info(TAG + "Entering beginConfig ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : REMOVE_INPUT_SUCCESS + * @tc.name : remove input api + * @tc.desc : remove input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('REMOVE_INPUT_SUCCESS', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS to operate"); + const Promise = await CaptureSessionPromise.removeInput(camera1InputPromise); + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS success " + Promise); + if (Promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS FAILED: "); + } + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : ADD_INPUT_PROMISE + * @tc.name : Add Input with camera0Input api + * @tc.desc : Add Input with camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_INPUT_PROMISE', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering Add Input captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_INPUT_PROMISE to operate"); + const Promise = await CaptureSessionPromise.addInput(camera0InputPromise); + console.info(TAG + "Entering Add Input addInput success"); + if (Promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_INPUT_PROMISE addInput PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering ADD_INPUT_PROMISE FAILED: "); + } + console.info(TAG + "Entering ADD_INPUT_PROMISE ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : ADD_OUTPUT_PHOTO_SUCCESS + * @tc.name : Add output with photo output api + * @tc.desc : Add output with photo output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PHOTO_SUCCESS', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering Add output with photo output captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS to operate"); + const promise = await CaptureSessionPromise.addOutput(photoOutputPromise); + console.info(TAG + "Entering Add output with photo output success"); + if (promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS FAILED "); + } + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : REMOVE_PHOTO_OUTPUT_SUCCESS + * @tc.name : Remove photo Output api + * @tc.desc : Remove photo Output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('REMOVE_PHOTO_OUTPUT_SUCCESS', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS to operate"); + const Promise = await CaptureSessionPromise.removeOutput(photoOutputPromise); + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS addInput success " + Promise); + if (Promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS addInput PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS FAILED: "); + } + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : ADD_OUTPUT_PHOTO_SUCCESS + * @tc.name : Add output with photo output api + * @tc.desc : Add output with photo output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PHOTO_SUCCESS', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS to operate"); + const promise = await CaptureSessionPromise.addOutput(photoOutputPromise); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS success"); + if (promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS FAILED "); + } + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : COMMIT_CONFIG_SUCCESS + * @tc.name : commit config api + * @tc.desc : commit config api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('COMMIT_CONFIG_SUCCESS', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering commit config captureSession == null || undefined"); + } else { + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS to operate"); + const promise = await CaptureSessionPromise.commitConfig(); + console.info(TAG + "Entering commit config commitConfig success"); + if (promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS commitConfig PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS commitConfig FAILED : "); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS commitConfig ends here"); + } + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT + * @tc.name : FocusStateChange callback api + * @tc.desc : FocusStateChange callback api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT', 0, async function (done) { + if (camera0InputPromise == null || camera0InputPromise == undefined) { + console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT to operate"); + camera0InputPromise.on('focusStateChange', async (err, data) => { + if (!err) { + console.info(TAG + "FocusState callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Current FocusState is: " + data); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT + * @tc.name : ExposureStateChange callback api + * @tc.desc : ExposureStateChange callback api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT', 0, async function (done) { + if (camera0InputPromise == null || camera0InputPromise == undefined) { + console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT to operate"); + camera0InputPromise.on('exposureStateChange', async (err, data) => { + if (!err) { + console.info(TAG + "ExposureStateChange callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Current ExposureStateChange is: " + data); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + // callback related API + //preview callback + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START + * @tc.name : Preview output callback on frame start api + * @tc.desc : Preview output callback on frame start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START', 0, async function (done) { + if (previewOutputPromise == null || previewOutputPromise == undefined) { + console.info(TAG + "Entering Preview output callback on frame start previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START to operate"); + previewOutputPromise.on('frameStart', async (err, data) => { + if (!err) { + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START FAILED :" + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END + * @tc.name : Preview capture callback on frame end api + * @tc.desc : Preview capture callback on frame end api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END', 0, async function (done) { + if (previewOutputPromise == null || previewOutputPromise == undefined) { + console.info(TAG + "Entering Preview capture callback on frame end previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END to operate"); + previewOutputPromise.on('frameEnd', async (err, data) => { + if (!err) { + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END FAILED : + err.message"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + //Capture callback + /** + * @tc.number : PHOTO_CAP_CALLBACK_ON_CAPTURE_START + * @tc.name : Photo capture callback on capture start api + * @tc.desc : Photo capture callback on capture start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_CAP_CALLBACK_ON_CAPTURE_START', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering Photo capture callback on capture start photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_START to operate"); + photoOutputPromise.on('captureStart', async (err, data) => { + if (!err) { + console.info(TAG + "CaptureStart Callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "PHOTO_CAP_CALLBACK_ON_CAPTURE_START with captureId: " + data); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PHOTO_CAP_CALLBACK_ON_CAPTURE_START FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PHOTO_CAP_CALLBACK_ON_CAPTURE_END + * @tc.name : Photo capture callback on capture end api + * @tc.desc : Photo capture callback on capture end api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_CAP_CALLBACK_ON_CAPTURE_END', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering Photo capture callback on capture end photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_END to operate"); + photoOutputPromise.on('captureEnd', async (err, data) => { + if (!err) { + console.info(TAG + "captureEnd callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "captureEnd callback with captureId: " + data.captureId); + console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + 'PHOTO_CAP_CALLBACK_ON_CAPTURE_END FAILED' + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER + * @tc.name : Photo capture callback on frame shutter api + * @tc.desc : Photo capture callback on frame shutter api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering Photo capture callback on frame shutter photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER to operate"); + photoOutputPromise.on('frameShutter', async (err, data) => { + if (!err) { + console.info(TAG + "frameShutter callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER with captureId: " + data.captureId); + console.info(TAG + "PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER with timestamp: " + data.timestamp); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER FAILED: " + err.message); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : CAPTURE_SESSION_START_SUCCESS + * @tc.name : capture session start api + * @tc.desc : capture session start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_START_SUCCESS', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering capture session start captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS to operate"); + await CaptureSessionPromise.start(); + console.info(TAG + "Entering captureSession start success"); + expect(true).assertTrue(); + console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS PASSED"); + console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + //Location + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS + * @tc.name : Photo output capture without photosettings api + * @tc.desc : Photo output capture without photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS to operate"); + photoOutputPromise.capture(async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture without photosettings success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS PASSED"); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); + await photoOutputPromise.capture(photosettings1) + .then(function (data) { + console.info(TAG + "Entering photoOutput capture with settings success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined"); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1 PASSED"); + expect(true).assertTrue(); + } + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1 FAILED:" + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1 ends here"); + }); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 to operate"); + await photoOutputPromise.capture(photosettings2) + .then(function (data) { + console.info(TAG + "Entering photoOutput capture with settings success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 PASSED"); + expect(true).assertTrue(); + } + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 FAILED:" + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 ends here"); + }); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering Photo output capture with photosettings photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3 to operate"); + await photoOutputPromise.capture(photosettings3) + .then(function (data) { + console.info(TAG + "Entering photoOutput capture with settings success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture with photosettings3 data is not null || undefined"); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3 PASSED"); + expect(true).assertTrue(); + } + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3 :" + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS3 ends here"); + }); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4 to operate"); + await photoOutputPromise.capture(photosettings4) + .then(function (data) { + console.info(TAG + "Entering photoOutput capture with settings success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture with photosettings4 data is not null || undefined"); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4 PASSED"); + expect(true).assertTrue(); + } + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4 FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS4 ends here"); + }); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + //FLASH Function API scripts + /** + * @tc.number : HAS_FLASH + * @tc.name : check if has flash-camera0Input api + * @tc.desc : check if has flash-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('HAS_FLASH', 0, async function (done) { + console.info("--------------HAS_FLASH--------------"); + console.info(TAG + 'hasFlash called.') + var hasFlashPromise = await camera0InputPromise.hasFlash(); + console.info(TAG + "Entering HAS_FLASH success"); + if (hasFlashPromise != null || hasFlashPromise != undefined) { + console.info(TAG + "Entering HAS_FLASH data is not null || undefined"); + console.info(TAG + "Entering HAS_FLASH PASSED with HAS_FLASH is: " + JSON.stringify(hasFlashPromise)); + expect(hasFlashPromise).assertEqual(true); + } + else { + console.info(TAG + "Entering HAS_FLASH FAILED : "); + expect().assertFail(); + } + console.info(TAG + "Entering HAS_FLASH ends here"); + await sleep(1000) + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_OPEN_SUPPORTED + * @tc.name : check if flash mode open is supported-camera0Input api + * @tc.desc : check if flash mode open is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_OPEN_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED to operate"); + var isFMOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED SUCCESS "); + if (isFMOpenSupported != null || isFMOpenSupported != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED data is not null || undefined"); + console.info(TAG + "FLASH_MODE_OPEN supported is: " + JSON.stringify(isFMOpenSupported)); + expect(isFMOpenSupported).assertEqual(true); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED PASSED"); + } + else { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED FAILED : "); + expect().assertFail(); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_OPEN + * @tc.name : set flash mode open camera0 api + * @tc.desc : set flash mode open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_OPEN', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN to operate"); + var SetFMOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN); + console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMOpen)) + if (SetFMOpen == undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); + console.info(TAG + "Entering SET_FLASH_MODE_OPEN PASSED") + expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); + } else { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN FAILED : "); + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_OPEN ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_OPEN + * @tc.name : get flash mode open camera0 api + * @tc.desc : get flash mode open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FLASH_MODE_OPEN', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_OPEN to operate"); + var GetFMOpen = await camera0InputPromise.getFlashMode(); + console.info(TAG + "Entering GET_FLASH_MODE_OPEN success: " + JSON.stringify(GetFMOpen)); + if (GetFMOpen == 1) { + console.info(TAG + "GET_FLASH_MODE_OPEN data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " + JSON.stringify(GetFMOpen)); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_OPEN PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_OPEN FAILED : "); + console.info(TAG + "GET_FLASH_MODE_OPEN ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED + * @tc.name : check if flash mode always open is supported-camera0Input api + * @tc.desc : check if flash mode always open is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED to operate"); + var isFMAlwaysOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED SUCCESS "); + if (isFMAlwaysOpenSupported != null || isFMAlwaysOpenSupported != undefined) { + console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN data is not null || undefined"); + console.info(TAG + "FLASH_MODE_OPEN supported is: " + isFMAlwaysOpenSupported); + expect(isFMAlwaysOpenSupported).assertEqual(true); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED PASSED"); + } + else { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED FAILED : "); + expect().assertFail(); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_ALWAYS_OPEN + * @tc.name : set flash mode always open camera0 api + * @tc.desc : set flash mode always open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_ALWAYS_OPEN', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN to operate"); + var SetFMAlwaysOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMAlwaysOpen)) + if (SetFMAlwaysOpen == undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN PASSED") + expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3) + } else { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN FAILED : "); + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_ALWAYS_OPEN + * @tc.name : get flash mode always open camera0 api + * @tc.desc : get flash mode always open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FLASH_MODE_ALWAYS_OPEN', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN to operate"); + var GetFMAlwaysOpen = await camera0InputPromise.getFlashMode(); + console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN success"); + if (GetFMAlwaysOpen == 3) { + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " + GetFMAlwaysOpen); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN FAILED : "); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_AUTO_SUPPORTED + * @tc.name : check if flash mode always open is supported-camera0Input api + * @tc.desc : check if flash mode always open is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_AUTO_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED to operate"); + var isFMAutoSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO); + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED SUCCESS "); + if (isFMAutoSupported != null || isFMAutoSupported != undefined) { + console.info(TAG + "Entering FLASH_MODE_AUTO data is not null || undefined"); + console.info(TAG + "FLASH_MODE_AUTO supported is: " + isFMAutoSupported); + expect(isFMAutoSupported).assertEqual(true); + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED PASSED"); + } + else { + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED FAILED : "); + expect().assertFail(); + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_AUTO + * @tc.name : set flash mode auto camera0 api + * @tc.desc : set flash mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_AUTO to operate"); + var SetFMAlwaysAuto = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO); + console.info(TAG + "SetFMAlwaysAuto: " + JSON.stringify(SetFMAlwaysAuto)) + if (SetFMAlwaysAuto == undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_AUTO SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); + console.info(TAG + "Entering SET_FLASH_MODE_AUTO PASSED") + expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2) + } else { + console.info(TAG + "Entering SET_FLASH_MODE_AUTO FAILED : "); + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_AUTO ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_AUTO + * @tc.name : get flash mode auto camera0 api + * @tc.desc : get flash mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FLASH_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_AUTO to operate"); + var GetFMAuto = await camera0InputPromise.getFlashMode(); + console.info(TAG + "Entering GET_FLASH_MODE_AUTO success"); + if (GetFMAuto == 2) { + console.info(TAG + "GET_FLASH_MODE_AUTO data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " + GetFMAuto); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_AUTO PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_AUTO FAILED : "); + console.info(TAG + "GET_FLASH_MODE_AUTO ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_CLOSE_SUPPORTED + * @tc.name : check if flash mode close is supported-camera0Input api + * @tc.desc : check if flash mode close is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_CLOSE_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED to operate"); + var isFMCloseSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED SUCCESS "); + if (isFMCloseSupported != null || isFMCloseSupported != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED data is not null || undefined"); + console.info(TAG + "FLASH_MODE_CLOSE supported is: " + isFMCloseSupported); + expect(isFMCloseSupported).assertEqual(true); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED PASSED"); + } + else { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED FAILED : "); + expect().assertFail(); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_CLOSE + * @tc.name : set flash mode close camera0 api + * @tc.desc : set flash mode close camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_CLOSE', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE to operate"); + var SetFMClose = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE); + console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMClose)) + if (SetFMClose == undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE PASSED") + expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0) + } else { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE FAILED : "); + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_CLOSE + * @tc.name : get flash mode close camera0 api + * @tc.desc : get flash mode close camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FLASH_MODE_CLOSE', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_CLOSE to operate"); + var GetFMClose = await camera0InputPromise.getFlashMode(); + console.info(TAG + "Entering GET_FLASH_MODE_CLOSE success"); + if (GetFMClose == 0) { + console.info(TAG + "GET_FLASH_MODE_CLOSE data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " + GetFMClose); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_CLOSE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_CLOSE FAILED : "); + console.info(TAG + "GET_FLASH_MODE_CLOSE ends here"); + } + await sleep(1000); + done(); + }) + + //ZOOM Function + /** + * @tc.number : GET_ZOOM_RATIO_PROMISE + * @tc.name : get zoom ratio camera-0 cameraId api promise api + * @tc.desc : get zoom ratio camera-0 cameraId api promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_ZOOM_RATIO_PROMISE', 0, async function (done) { + console.info("--------------GET_ZOOM_RATIO_PROMISE--------------"); + var getZoomRatioPromise = await camera0InputPromise.getZoomRatioRange(); + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE getZoomRatioPromise: " + JSON.stringify(getZoomRatioPromise)); + if (getZoomRatioPromise != null && getZoomRatioPromise != undefined) { + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE setZoomRatioPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE success: " + JSON.stringify(getZoomRatioPromise)); + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE FAILED"); + } + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_1_PROMISE + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_1_PROMISE', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(1); + console.info(TAG + "setZoomRatio success: 1"); + console.info(TAG + "getZoomRatio called") + var getpromise1 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: " + getpromise1); + if (getpromise1 != null && getpromise1 != undefined) { + expect(getpromise1).assertEqual(1); + console.info(TAG + "SET_GET_ZOOM_1_PROMISE PASSED "); + } + else { + console.info(TAG + "SET_GET_ZOOM_1_PROMISE FAILED"); + expect().assertFail(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_2_PROMISE + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_2_PROMISE', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(2); + console.info(TAG + "setZoomRatio success: 2"); + console.info(TAG + "getZoomRatio called") + var getpromise2 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: " + getpromise2); + if (getpromise2 != null && getpromise2 != undefined) { + expect(getpromise2).assertEqual(2); + console.info(TAG + "SET_GET_ZOOM_2_PROMISE PASSED "); + } + else { + console.info(TAG + "SET_GET_ZOOM_2_PROMISE FAILED"); + expect().assertFail(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_3_PROMISE + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_3_PROMISE', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(3); + console.info(TAG + "setZoomRatio success: 3"); + console.info(TAG + "getZoomRatio called") + var getpromise3 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: " + getpromise3); + if (getpromise3 != null && getpromise3 != undefined) { + expect(getpromise3).assertEqual(3); + console.info(TAG + "SET_GET_ZOOM_3_PROMISE PASSED "); + } + else { + console.info(TAG + "SET_GET_ZOOM_3_PROMISE FAILED"); + expect().assertFail(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_4_PROMISE + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_4_PROMISE', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(4); + console.info(TAG + "setZoomRatio success: 4"); + console.info(TAG + "getZoomRatio called") + var getpromise4 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: " + getpromise4); + if (getpromise4 != null && getpromise4 != undefined) { + expect(getpromise4).assertEqual(4); + console.info(TAG + "SET_GET_ZOOM_4_PROMISE PASSED "); + } + else { + console.info(TAG + "SET_GET_ZOOM_4_PROMISE FAILED"); + expect().assertFail(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_5_PROMISE + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_5_PROMISE', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(5); + console.info(TAG + "setZoomRatio success: 5"); + console.info(TAG + "getZoomRatio called") + var getpromise5 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: " + getpromise5); + if (getpromise5 != null && getpromise5 != undefined) { + expect(getpromise5).assertEqual(5); + console.info(TAG + "SET_GET_ZOOM_5_PROMISE PASSED "); + } + else { + console.info(TAG + "SET_GET_ZOOM_5_PROMISE FAILED"); + expect().assertFail(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_6_PROMISE + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_6_PROMISE', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(6); + console.info(TAG + "setZoomRatio success: 6"); + console.info(TAG + "getZoomRatio called") + var getpromise6 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: " + getpromise6); + if (getpromise6 != null && getpromise6 != undefined) { + expect(getpromise6).assertEqual(6); + console.info(TAG + "SET_GET_ZOOM_6_PROMISE PASSED "); + } + else { + console.info(TAG + "SET_GET_ZOOM_6_PROMISE FAILED"); + expect().assertFail(); + } + await sleep(1000); + done(); + }) + + // FOCUS promise API's + /** + * @tc.number : IS_FOCUS_MODE_LOCKED_SUPPORTED + * @tc.name : check is focus mode locked supported-camera0Input api + * @tc.desc : check is focus mode locked supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_LOCKED_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED to operate"); + var isFMLockedSupported = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED); + console.info(TAG + "Entering is focus mode locked supported SUCCESS "); + if (isFMLockedSupported != null || isFMLockedSupported != undefined) { + console.info(TAG + "Entering is focus mode locked supported data is not null || undefined"); + console.info(TAG + "is focus mode locked supported : " + isFMLockedSupported); + expect(isFMLockedSupported).assertEqual(false); + console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED PASSED"); + } + else { + console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED FAILED : "); + expect().assertFail(); + console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_LOCKED + * @tc.name : set focus mode locked camera0 api + * @tc.desc : set focus mode locked camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_LOCKED', 0, async function (done) { + console.info(TAG + "Entering set focus mode locked to operate"); + await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED) + .then(function (data) { + console.info(TAG + "SetFMLocked: " + JSON.stringify(data)) + console.info(TAG + "Entering set focus mode locked SUCCESS, current focusmode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); + console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED FAILED : ") + expect().assertFail(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED PASSED : " + err.message); + expect(true).assertTrue(); + console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED ends here"); + }); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_LOCKED + * @tc.name : get focus mode locked camera0 api + * @tc.desc : get focus mode locked camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_MODE_LOCKED', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_LOCKED to operate"); + await camera0InputPromise.getFocusMode() + .then(function (data) { + console.info(TAG + "Entering get focus mode locked success: "); + if (data == 0) { + console.info(TAG + "Current focusmode is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_LOCKED PASSED"); + } + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_LOCKED FAILED : " + err.message); + console.info(TAG + "GET_FOCUS_MODE_LOCKED ends here"); + }); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCAL_LENGTH + * @tc.name : get focal length camera0 api + * @tc.desc : get focal length camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCAL_LENGTH', 0, async function (done) { + console.info(TAG + "Entering GET_FOCAL_LENGTH to operate"); + await camera0InputPromise.getFocalLength() + .then(function (data) { + console.info(TAG + "Current focallength is: " + JSON.stringify(data)); + expect(data).assertEqual(3.4600000381469727); + console.info(TAG + "GET_FOCAL_LENGTH PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_FOCAL_LENGTH FAILED : " + err.message); + }); + console.info(TAG + "GET_FOCAL_LENGTH ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FOCUS_POINT + * @tc.name : set focus Point camera0 api + * @tc.desc : set focus Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering set focus mode locked to operate"); + await camera0InputPromise.setFocusPoint(Point1) + .then(function (data) { + console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); + console.info(TAG + "Entering SET_FOCUS_POINT PASSED"); + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_FOCUS_POINT FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_FOCUS_POINT ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_POINT + * @tc.name : get focus Point camera0 api + * @tc.desc : get focus Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_POINT to operate"); + await camera0InputPromise.getFocusPoint() + .then(function (data) { + console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_POINT PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_POINT FAILED: " + err.message); + }); + console.info(TAG + "GET_FOCUS_POINT ends here"); + await sleep(1000); + done(); + }) + + + /** + * @tc.number : IS_FOCUS_MODE_MANUAL_SUPPORTED + * @tc.name : is focusmode manual supported + * @tc.desc : is focusmode manual supported + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_MANUAL_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED to operate"); + var isFMmanualSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL); + if (isFMmanualSupportedpromise != null || isFMmanualSupportedpromise != undefined) { + console.info(TAG + "Entering is focusmode manual supported data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMmanualSupportedpromise); + expect(isFMmanualSupportedpromise).assertEqual(true); + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED PASSED: "); + } + else { + console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED FAILED : "); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_MANUAL + * @tc.name : set focus mode manual camera0 api + * @tc.desc : set focus mode manual camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_MANUAL', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL to operate"); + await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL) + .then(function (data) { + console.info(TAG + "setFocusManual: " + JSON.stringify(data)) + console.info(TAG + "Entering set focus mode manual SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL PASSED") + expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) + }) + .catch((err) => { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_MANUAL + * @tc.name : get focus mode manual camera0 api + * @tc.desc : get focus mode manual camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_MODE_MANUAL', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL to operate"); + await camera0InputPromise.getFocusMode() + .then(function (data) { + console.info(TAG + "Entering get focus mode manual SUCCESS"); + if (data == 0) { + console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_MANUAL PASSED"); + } + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_MANUAL FAILED : " + err.message); + console.info(TAG + "GET_FOCUS_MODE_MANUAL ends here"); + }); + await sleep(1000); + done(); + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS + * @tc.name : Photo output capture without photosettings api + * @tc.desc : Photo output capture without photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS to operate"); + photoOutputPromise.capture(async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture without photosettings success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS PASSED"); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : SET_FOCUS_POINT + * @tc.name : set focus Point camera0 api + * @tc.desc : set focus Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering set focus mode locked to operate"); + await camera0InputPromise.setFocusPoint(Point2) + .then(function (data) { + console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_FOCUS_POINT PASSED"); + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_FOCUS_POINT FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_FOCUS_POINT ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_POINT + * @tc.name : get focus Point camera0 api + * @tc.desc : get focus Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_POINT to operate"); + await camera0InputPromise.getFocusPoint() + .then(function (data) { + console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_POINT PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_POINT FAILED " + err.message); + }); + console.info(TAG + "GET_FOCUS_POINT ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_CONTINUOUS_SUPPORTED + * @tc.name : check is focus mode continuous supported-camera0Input api + * @tc.desc : check is focus mode continuous supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_CONTINUOUS_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED to operate"); + var isFMContinuousSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + if (isFMContinuousSupportedpromise != null || isFMContinuousSupportedpromise != undefined) { + console.info(TAG + "Entering is focus mode continuous supported data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_CONTINUOUS_SUPPORTED is: " + isFMContinuousSupportedpromise); + expect(isFMContinuousSupportedpromise).assertEqual(true); + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED PASSED: "); + } + else { + console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED FAILED : "); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_CONTINUOUS + * @tc.name : set focus mode continuous camera0 api + * @tc.desc : set focus mode continuous camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_CONTINUOUS', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS to operate"); + await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) + .then(function (data) { + console.info(TAG + "setFocusCont: " + JSON.stringify(data)) + console.info(TAG + "Entering set focus mode continuous SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS PASSED") + expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1) + }) + .catch((err) => { + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_CONTINUOUS + * @tc.name : get focus mode continuous camera0 api + * @tc.desc : get focus mode continuous camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_MODE_CONTINUOUS', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS to operate"); + await camera0InputPromise.getFocusMode() + .then(function (data) { + console.info(TAG + "Entering get focus mode continuous SUCCESS"); + if (data == 1) { + console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS PASSED"); + } + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS FAILED: " + err.message); + }); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS + * @tc.name : Photo output capture without photosettings api + * @tc.desc : Photo output capture without photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS to operate"); + photoOutputPromise.capture(async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture without photosettings success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS PASSED"); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : SET_FOCUS_POINT + * @tc.name : set focus Point camera0 api + * @tc.desc : set focus Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering set focus mode locked to operate"); + await camera0InputPromise.setFocusPoint(Point3) + .then(function (data) { + console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); + console.info(TAG + "Entering SET_FOCUS_POINT PASSED"); + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_FOCUS_POINT FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_FOCUS_POINT ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_POINT + * @tc.name : get focus Point camera0 api + * @tc.desc : get focus Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_POINT to operate"); + await camera0InputPromise.getFocusPoint() + .then(function (data) { + console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_POINT PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_POINT FAILED: " + err.message); + }); + console.info(TAG + "GET_FOCUS_POINT ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_AUTO_SUPPORTED + * @tc.name : check is focus mode auto supported-camera0Input api + * @tc.desc : check is focus mode auto supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_AUTO_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED to operate"); + var isFMAutoSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); + if (isFMAutoSupportedpromise != null || isFMAutoSupportedpromise != undefined) { + console.info(TAG + "Entering is focus mode auto supported data is not null || undefined"); + console.info(TAG + "is focus mode auto supported is: " + isFMAutoSupportedpromise); + expect(isFMAutoSupportedpromise).assertEqual(true); + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED PASSED: "); + } + else { + console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED FAILED : "); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED ends here"); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_AUTO + * @tc.name : set focus mode auto camera0 api + * @tc.desc : set focus mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO to operate"); + var setFocusAuto = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO) + .then(function () { + console.info(TAG + "setFocusAuto: " + JSON.stringify(setFocusAuto)) + console.info(TAG + "Entering set focus mode auto SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO PASSED") + expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2) + }) + .catch((err) => { + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_AUTO + * @tc.name : get focus mode auto camera0 api + * @tc.desc : get focus mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_AUTO to operate"); + await camera0InputPromise.getFocusMode() + .then(function (data) { + console.info(TAG + "Entering get focus mode auto SUCCESS " + JSON.stringify(data)); + if (data == 2) { + console.info(TAG + "Current FocusMode is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_AUTO PASSED"); + } + }) + .catch((err) => { + console.info(TAG + "GET_FOCUS_MODE_AUTO FAILED : "); + console.info(TAG + "GET_FOCUS_MODE_AUTO ends here"); + }); + await sleep(1000); + done(); + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS + * @tc.name : Photo output capture without photosettings api + * @tc.desc : Photo output capture without photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS to operate"); + photoOutputPromise.capture(async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture without photosettings success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS PASSED"); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : IS_EXPOSURE_MODE_LOCKED_SUPPORTED + * @tc.name : check is exposure mode locked supported-camera0Input api + * @tc.desc : check is exposure mode locked supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('IS_EXPOSURE_MODE_LOCKED_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_EXPOSURE_MODE_LOCKED_SUPPORTED to operate"); + await camera0InputPromise.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED) + .then(function (data) { + console.info(TAG + "Entering IS_EXPOSURE_MODE_LOCKED_SUPPORTED PASSED: " + data); + expect(data).assertEqual(false); + }) + .catch((err) => { + console.info(TAG + "IS_EXPOSURE_MODE_LOCKED_SUPPORTED FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "IS_EXPOSURE_MODE_LOCKED_SUPPORTED ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : SET_EXPOSURE_MODE_LOCKED + * @tc.name : set exposure mode locked camera0 api + * @tc.desc : set exposure mode locked camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('SET_EXPOSURE_MODE_LOCKED', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_MODE_Locked to operate"); + await camera0InputPromise.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED) + .then(function () { + console.info(TAG + "Entering set exposure mode auto SUCCESS, current ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED); + console.info(TAG + "Entering SET_EXPOSURE_MODE_Locked FAILED") + expect().assertFail() + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_MODE_LOCKED PASSED : " + err.message); + expect(true).assertTrue(); + }); + console.info(TAG + "Entering SET_EXPOSURE_MODE_LOCKED ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_EXPOSURE_MODE_LOCKED + * @tc.name : get exposure mode locked camera0 api + * @tc.desc : get exposure mode locked camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_MODE_LOCKED', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_MODE_LOCKED to operate"); + await camera0InputPromise.getExposureMode() + .then(function (data) { + console.info(TAG + "Entering get exposure mode locked SUCCESS"); + console.info(TAG + "Current ExposureMode is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_MODE_LOCKED PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_MODE_LOCKED FAILED : " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_MODE_LOCKED ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_EXPOSURE_MODE_CONTINUOUS_AUTO_SUPPORTED + * @tc.name : check is exposure mode continuous auto supported-camera0Input api + * @tc.desc : check is exposure mode continuous auto supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('IS_EXPOSURE_MODE_CONTINUOUS_AUTO_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_EXPOSURE_MODE_CONTINUOUS_AUTO_SUPPORTED to operate"); + await camera0InputPromise.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO) + .then(function (data) { + console.info(TAG + "Entering IS_EXPOSURE_MODE_CONTINUOUS_AUTO_SUPPORTED PASSED: " + data); + expect(data).assertEqual(false); + }) + .catch((err) => { + console.info(TAG + "IS_EXPOSURE_MODE_CONTINUOUS_AUTO_SUPPORTED FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "IS_EXPOSURE_MODE_CONTINUOUS_AUTO_SUPPORTED ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : SET_EXPOSURE_MODE_CONTINUOUS_AUTO + * @tc.name : set exposure mode continuous auto camera0 api + * @tc.desc : set exposure mode continuous auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('SET_EXPOSURE_MODE_CONTINUOUS_AUTO', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_MODE_CONTINUOUS_AUTO to operate"); + await camera0InputPromise.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO) + .then(function () { + console.info(TAG + "Entering set exposure mode auto SUCCESS, current ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO); + console.info(TAG + "Entering SET_EXPOSURE_MODE_CONTINUOUS_AUTO FAILED") + expect().assertFail(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_MODE_CONTINUOUS_AUTO PASSED : " + err.message); + expect(true).assertTrue(); + }); + console.info(TAG + "Entering SET_EXPOSURE_MODE_CONTINUOUS_AUTO ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_EXPOSURE_MODE_CONTINUOUS_AUTO + * @tc.name : get exposure mode continuous auto camera0 api + * @tc.desc : get exposure mode continuous auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_MODE_CONTINUOUS_AUTO', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_MODE_CONTINUOUS_AUTO to operate"); + await camera0InputPromise.getExposureMode() + .then(function (data) { + console.info(TAG + "Entering get exposure mode auto SUCCESS"); + console.info(TAG + "Current exposureMode is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_MODE_CONTINUOUS_AUTO PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_MODE_CONTINUOUS_AUTO FAILED : " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_MODE_CONTINUOUS_AUTO ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_BIAS_RANGE + * @tc.name : get exposure bias range camera0 api + * @tc.desc : get exposure bias range camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_BIAS_RANGE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_BIAS_RANGE to operate"); + await camera0InputPromise.getExposureBiasRange() + .then(function (data) { + console.info(TAG + "Entering getExposureBiasRange SUCCESS"); + console.info(TAG + "Current ExposureBiasRange is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_BIAS_RANGE PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_BIAS_RANGE FAILED : " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_BIAS_RANGE ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_BIAS_-4 + * @tc.name : set exposure bias camera0 api + * @tc.desc : set exposure bias camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_BIAS', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_BIAS to operate"); + await camera0InputPromise.setExposureBias(-4) + .then(function (data) { + console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "-4"); + console.info(TAG + "Entering SET_EXPOSURE_BIAS PASSED") + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_BIAS FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_EXPOSURE_BIAS ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_BIAS_VALUE + * @tc.name : get exposure value camera0 api + * @tc.desc : get exposure value camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_BIAS_VALUE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_BIAS_VALUE to operate"); + await camera0InputPromise.getExposureValue() + .then(function (data) { + console.info(TAG + "Entering getExposureValue SUCCESS"); + console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); + expect(data).assertEqual(-4); + console.info(TAG + "GET_EXPOSURE_BIAS_VALUE PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_BIAS_VALUE FAILED : " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_BIAS_VALUE ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_POINT + * @tc.name : set exposure Point camera0 api + * @tc.desc : set exposure Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_POINT to operate"); + await camera0InputPromise.setExposurePoint(Point1) + .then(function (data) { + console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_EXPOSURE_POINT PASSED") + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_POINT FAILED: " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_EXPOSURE_POINT ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_POINT + * @tc.name : get exposure Point camera0 api + * @tc.desc : get exposure Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_POINT to operate"); + await camera0InputPromise.getExposurePoint() + .then(function (data) { + console.info(TAG + "Entering getExposurePoint SUCCESS"); + console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_POINT PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_POINT FAILED: " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_POINT ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : IS_EXPOSURE_MODE_AUTO_SUPPORTED + * @tc.name : check is exposure mode auto supported-camera0Input api + * @tc.desc : check is exposure mode auto supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('IS_EXPOSURE_MODE_AUTO_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_EXPOSURE_MODE_AUTO_SUPPORTED to operate"); + await camera0InputPromise.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO) + .then(function (data) { + console.info(TAG + "Entering IS_EXPOSURE_MODE_AUTO_SUPPORTED PASSED: " + data); + expect(data).assertEqual(true); + }) + .catch((err) => { + console.info(TAG + "IS_EXPOSURE_MODE_AUTO_SUPPORTED FAILED: " + err.message); + expect().assertFail(); + }); + console.info(TAG + "IS_EXPOSURE_MODE_AUTO_SUPPORTED ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : SET_EXPOSURE_MODE_AUTO + * @tc.name : set exposure mode auto camera0 api + * @tc.desc : set exposure mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('SET_EXPOSURE_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_MODE_AUTO to operate"); + await camera0InputPromise.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO) + .then(function () { + console.info(TAG + "Entering set exposure mode auto SUCCESS, current ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_AUTO); + console.info(TAG + "Entering SET_EXPOSURE_MODE_AUTO PASSED") + expect(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO).assertEqual(1); + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_MODE_AUTO FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_EXPOSURE_MODE_AUTO ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : GET_EXPOSURE_MODE_AUTO + * @tc.name : get exposure mode auto camera0 api + * @tc.desc : get exposure mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('GET_EXPOSURE_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_MODE_AUTO to operate"); + await camera0InputPromise.getExposureMode() + .then(function (data) { + console.info(TAG + "Entering get exposure mode auto SUCCESS"); + console.info(TAG + "Current exposureMode is: " + data); + expect(data).assertEqual(1); + console.info(TAG + "GET_EXPOSURE_MODE_AUTO PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_MODE_AUTO FAILED: " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_MODE_AUTO ends here"); + await sleep(1000); + done(); + }) + */ + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS + * @tc.name : Photo output capture without photosettings api + * @tc.desc : Photo output capture without photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS to operate"); + photoOutputPromise.capture(async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture without photosettings success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS PASSED"); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS ends here"); + } + await sleep(1000); + done(); + }) + await sleep(1000); + done(); + } + }) + + /** + * @tc.number : SET_EXPOSURE_BIAS + * @tc.name : set exposure bias camera0 api + * @tc.desc : set exposure bias camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_BIAS', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_BIAS to operate"); + await camera0InputPromise.setExposureBias(1) + .then(function (data) { + console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "1"); + console.info(TAG + "Entering SET_EXPOSURE_BIAS PASSED") + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_BIAS FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_EXPOSURE_BIAS ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_BIAS_VALUE + * @tc.name : get exposure value camera0 api + * @tc.desc : get exposure value camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_BIAS_VALUE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_BIAS_VALUE to operate"); + await camera0InputPromise.getExposureValue() + .then(function (data) { + console.info(TAG + "Entering getExposureValue SUCCESS"); + console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); + expect(data).assertEqual(1); + console.info(TAG + "GET_EXPOSURE_BIAS_VALUE PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_BIAS_VALUE FAILED : " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_BIAS_VALUE ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_POINT + * @tc.name : set exposure Point camera0 api + * @tc.desc : set exposure Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_POINT to operate"); + await camera0InputPromise.setExposurePoint(Point2) + .then(function (data) { + console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_EXPOSURE_POINT PASSED") + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_POINT FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_EXPOSURE_POINT ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_POINT + * @tc.name : get exposure Point camera0 api + * @tc.desc : get exposure Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_POINT to operate"); + await camera0InputPromise.getExposurePoint() + .then(function (data) { + console.info(TAG + "Entering getExposurePoint SUCCESS"); + console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_POINT PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_POINT FAILED : " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_POINT ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS Rotation-0 & Quality-0 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS1', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); + await photoOutputPromise.capture(photosettings1) + .then(function (data) { + console.info(TAG + "Entering photoOutput capture with Rotation-0 & Quality-0 success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture with photosettings1 data is not null || undefined"); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS Rotation-0 & Quality-0 PASSED"); + expect(true).assertTrue(); + } + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS Rotation-0 & Quality-0 FAILED:" + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS Rotation-0 & Quality-0 ends here"); + }); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_BIAS + * @tc.name : set exposure bias camera0 api + * @tc.desc : set exposure bias camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_BIAS', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_BIAS to operate"); + await camera0InputPromise.setExposureBias(4) + .then(function (data) { + console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "4"); + console.info(TAG + "Entering SET_EXPOSURE_BIAS PASSED") + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_BIAS FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_EXPOSURE_BIAS ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_BIAS_VALUE + * @tc.name : get exposure value camera0 api + * @tc.desc : get exposure value camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_BIAS_VALUE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_BIAS_VALUE to operate"); + await camera0InputPromise.getExposureValue() + .then(function (data) { + console.info(TAG + "Entering getExposureValue SUCCESS"); + console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); + expect(data).assertEqual(4); + console.info(TAG + "GET_EXPOSURE_BIAS_VALUE PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_BIAS_VALUE FAILED : " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_BIAS_VALUE ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_POINT + * @tc.name : set exposure Point camera0 api + * @tc.desc : set exposure Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_POINT to operate"); + await camera0InputPromise.setExposurePoint(Point3) + .then(function (data) { + console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_EXPOSURE_POINT PASSED") + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_POINT FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_EXPOSURE_POINT ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_POINT + * @tc.name : get exposure Point camera0 api + * @tc.desc : get exposure Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_POINT to operate"); + await camera0InputPromise.getExposurePoint() + .then(function (data) { + console.info(TAG + "Entering getExposurePoint SUCCESS"); + console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_POINT PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_POINT FAILED : " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_POINT ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 + * @tc.name : Photo output capture with photosettings api + * @tc.desc : Photo output capture with photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS to operate"); + await photoOutputPromise.capture(photosettings2) + .then(function (data) { + console.info(TAG + "Entering photoOutput capture with location settings success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture with photosettings2 data is not null || undefined"); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 PASSED"); + expect(true).assertTrue(); + } + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITH_PHOTOSETTINGS2 ends here"); + }); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_BIAS_-5 + * @tc.name : set exposure bias camera0 api + * @tc.desc : set exposure bias camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_BIAS', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_BIAS to operate"); + await camera0InputPromise.setExposureBias(-5) + .then(function (data) { + console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "-4"); + console.info(TAG + "Entering SET_EXPOSURE_BIAS PASSED") + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_BIAS FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_EXPOSURE_BIAS ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_BIAS_VALUE + * @tc.name : get exposure value camera0 api + * @tc.desc : get exposure value camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_BIAS_VALUE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_BIAS_VALUE to operate"); + await camera0InputPromise.getExposureValue() + .then(function (data) { + console.info(TAG + "Entering getExposureValue SUCCESS"); + console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); + expect(data).assertEqual(-4); + console.info(TAG + "GET_EXPOSURE_BIAS_VALUE PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_BIAS_VALUE FAILED : " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_BIAS_VALUE ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_BIAS_6 + * @tc.name : set exposure bias camera0 api + * @tc.desc : set exposure bias camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_BIAS', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_BIAS to operate"); + await camera0InputPromise.setExposureBias(6) + .then(function (data) { + console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + "4"); + console.info(TAG + "Entering SET_EXPOSURE_BIAS PASSED") + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_BIAS FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_EXPOSURE_BIAS ends here"); + await sleep(1000); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_BIAS_VALUE + * @tc.name : get exposure value camera0 api + * @tc.desc : get exposure value camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_BIAS_VALUE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_BIAS_VALUE to operate"); + await camera0InputPromise.getExposureValue() + .then(function (data) { + console.info(TAG + "Entering getExposureValue SUCCESS"); + console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); + expect(data).assertEqual(4); + console.info(TAG + "GET_EXPOSURE_BIAS_VALUE PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_BIAS_VALUE FAILED : " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_BIAS_VALUE ends here"); + await sleep(1000); + done(); + }) + + /*CaptureSession APIs test script*/ + /** + * @tc.number : CAPTURE_SESSION_STOP_SUCCESS_PROMISE + * @tc.name : capture session stop api + * @tc.desc : capture session stop api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_STOP_SUCCESS_PROMISE', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering capture session stop captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAPTURE_SESSION_STOP_SUCCESS_PROMISE to operate"); + await CaptureSessionPromise.stop(); + expect(true).assertTrue(); + console.info(TAG + "Entering CAPTURE_SESSION_STOP_SUCCESS_PROMISE captureSession.stop PASSED"); + console.info(TAG + "Entering CAPTURE_SESSION_STOP_SUCCESS_PROMISE captureSession.stop ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE + * @tc.name : capture session release api + * @tc.desc : capture session release api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE', 0, async function (done) { + if (CaptureSessionPromise == null || CaptureSessionPromise == undefined) { + console.info(TAG + "Entering capture session release captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE to operate"); + await CaptureSessionPromise.release(); + expect(true).assertTrue(); + console.info(TAG + "Entering CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE PASSED"); + console.info(TAG + "Entering CAPTURE_SESSION_RELEASE_SUCCESS_PROMISE ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE + * @tc.name : PreviewOutput release api + * @tc.desc : PreviewOutput release api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE', 0, async function (done) { + if (previewOutputPromise == null || previewOutputPromise == undefined) { + console.info(TAG + "Entering previewOutputPromise.release previewOutputPromise == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE to operate"); + await previewOutputPromise.release(); + expect(true).assertTrue(); + console.info(TAG + "Entering PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE PASSED"); + console.info(TAG + "Entering PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE + * @tc.name : PhotoOutput release api + * @tc.desc : PhotoOutput release api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering PhotoOutput release photoOutputPromise == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE to operate"); + await photoOutputPromise.release(); + expect(true).assertTrue(); + console.info(TAG + "Entering PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE PASSED"); + console.info(TAG + "Entering PHOTOOUTPUT_RELEASE_SUCCESS_PROMISE ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + + /** + * @tc.number : CAMERAINPUT_RELEASE_SUCCESS_PROMISE + * @tc.name : cameraInput release api + * @tc.desc : cameraInput release api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAMERAINPUT_RELEASE_SUCCESS_PROMISE', 0, async function (done) { + if (camera0InputPromise == null || camera0InputPromise == undefined) { + console.info(TAG + "Entering cameraInput release camera0InputPromise == null || undefined"); + } else { + console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS_PROMISE to operate"); + await camera0InputPromise.release(); + expect(true).assertTrue(); + console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS_PROMISEPASSED"); + console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS_PROMISE ends here"); + await sleep(1000); + done(); + } + await sleep(1000); + done(); + }) + }); +} \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..83ce6f80c8def8962629cc84b34a64c42f064caa --- /dev/null +++ b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitVideoAsync.test.ets @@ -0,0 +1,4298 @@ +/* + * 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 cameraObj from '@ohos.multimedia.camera'; +import media from '@ohos.multimedia.media' +import image from '@ohos.multimedia.image'; +import mediaLibrary from '@ohos.multimedia.mediaLibrary' +import fileio from '@ohos.fileio'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl' +import bundle from '@ohos.bundle' + +// @ts-nocheck +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; + +let TAG = "CameraModuleTest: "; +var cameraManager +var camerasArray +var camera0Input +var previewOutput +var photoOutputAsync +var videoRecorder +var surfaceId1 + +var minFrameRate_Grp0=12; +var maxFrameRate_Grp0=12; +var minFrameRate_Mix=14; +var maxFrameRate_Mix=15; +var minFrameRate_Err1=11; +var maxFrameRate_Err1=31; +var minFrameRate_Err2=14; +var maxFrameRate_Err2=28; +var minFrameRate_Err3=16; +var maxFrameRate_Err3=25; +var minFrameRate_Grp20=30; +var maxFrameRate_Grp20=30; + +var Point = { x: 1, y: 1 } +var photosettings1 = { + rotation: 0, + quality: 0, + location: { + latitude: 12.9705, + longitude: 77.7329, + altitude: 920.0000, + }, +} +var photosettings2 = { + rotation: 90, + quality: 1, + location: { + latitude: 20, + longitude: 78, + altitude: 8586, + }, +} + +var photosettings3 = { + quality: 2, + location: { + latitude: 0, + longitude: 0, + altitude: 0, + }, +} +var photosettings4 = { + rotation: 180, + location: { + latitude: -1, + longitude: -1, + altitude: -1, + }, +} + +let fdPath; +let fileAsset; +let fdNumber; +let configFile = { + audioBitrate: 48000, + audioChannels: 2, + audioCodec: 'audio/mp4a-latm', + audioSampleRate: 48000, + durationTime: 1000, + fileFormat: 'mp4', + videoBitrate: 48000, + videoCodec: 'video/mp4v-es', + videoFrameWidth: 640, + videoFrameHeight: 480, + videoFrameRate: 30 +} + +let videoConfig = { + audioSourceType: 1, + videoSourceType: 0, + profile: configFile, + url: 'file:///data/media/02.mp4', + orientationHint: 0, + location: { latitude: 30, longitude: 130 }, + maxSize: 100, + maxDuration: 500 +} +var videoId +var videoOutput +var captureSession + +export default function cameraJSUnitVideoAsync(surfaceId: any) { + + async function getImageReceiverSurfaceId() { + console.log(TAG + 'Entering create Image receiver') + var receiver = image.createImageReceiver(640, 480, 4, 8) + console.log(TAG + 'before receiver check') + if (receiver !== undefined) { + console.log(TAG + 'Receiver is ok') + surfaceId1 = await receiver.getReceivingSurfaceId() + console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) + } else { + console.log(TAG + 'Receiver is not ok') + } + } + + function sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve(1) + }, time * 1000) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + async function applyPermission() { + let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); + let atManager = abilityAccessCtrl.createAtManager(); + if (atManager != null) { + let tokenID = appInfo.accessTokenId; + console.info('[permission] case accessTokenID is ' + tokenID); + let permissionName1 = 'ohos.permission.CAMERA'; + let permissionName2 = 'ohos.permission.MICROPHONE'; + let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; + let permissionName4 = 'ohos.permission.READ_MEDIA'; + let permissionName5 = 'ohos.permission.WRITE_MEDIA'; + await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + } else { + console.info('[permission] case apply permission failed, createAtManager failed'); + } + } + + async function getFd(pathName) { + let displayName = pathName; + const mediaTest = mediaLibrary.getMediaLibrary(); + let fileKeyObj = mediaLibrary.FileKey; + let mediaType = mediaLibrary.MediaType.VIDEO; + let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); + let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); + if (dataUri != undefined) { + let args = dataUri.id.toString(); + let fetchOp = { + selections: fileKeyObj.ID + "=?", + selectionArgs: [args], + } + let fetchFileResult = await mediaTest.getFileAssets(fetchOp); + fileAsset = await fetchFileResult.getAllObject(); + fdNumber = await fileAsset[0].open('Rw'); + fdPath = "fd://" + fdNumber.toString(); + } + } + + async function closeFd() { + if (fileAsset != null) { + await fileAsset[0].close(fdNumber).then(() => { + console.info('[mediaLibrary] case close fd success'); + }).catch((err) => { + console.info('[mediaLibrary] case close fd failed'); + }); + } else { + console.info('[mediaLibrary] case fileAsset is null'); + } + } + + async function getvideosurface() { + await getFd('02.mp4'); + videoConfig.url = fdPath; + media.createVideoRecorder((err, recorder) => { + console.info(TAG + 'createVideoRecorder called') + videoRecorder = recorder + console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder)) + console.info(TAG + 'videoRecorder.prepare called.') + videoRecorder.prepare(videoConfig, (err) => { + console.info(TAG + 'videoRecorder.prepare success.') + }) + videoRecorder.getInputSurface((err, id) => { + console.info(TAG + 'getInputSurface called') + videoId = id + console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoId)) + }) + }) + } + + describe('VideoModeAsync', function () { + console.info(TAG + '----------Camera-VideoMode-Async--------------') + + beforeAll(async function () { + await applyPermission(); + console.info('beforeAll case'); + }) + + beforeEach(function () { + sleep(5); + console.info('beforeEach case'); + }) + + afterEach(async function () { + await closeFd(); + console.info('afterEach case'); + }) + + afterAll(function () { + console.info('afterAll case'); + }) + + /** + * @tc.number : GET_CAMERA_MANAGER_TC + * @tc.name : Create camera manager instance async api + * @tc.desc : Create camera manager instance async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_MANAGER_TC', 0, async function (done) { + console.info('--------------GET_CAMERA_MANAGER_TC--------------') + await sleep(1) + cameraObj.getCameraManager(null, (err, data) => { + if (!err) { + console.info(TAG + 'Entering Get Camera manager success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering Get Camera Manager data is not null || undefined') + cameraManager = data + expect(true).assertTrue() + console.info(TAG + 'Entering GET_CAMERA_MANAGER_TC PASSED') + } + } else { + expect().assertFail() + console.info(TAG + 'Entering GET_CAMERA_MANAGER_TC FAILED: ' + err.message) + } + console.info(TAG + 'Entering GET_CAMERA_MANAGER_TC ends here') + done() + }) + await sleep(1) + done() + }) + + /** + * @tc.number : CAMERA_STATUS_CALLBACK + * @tc.name : camera status callback on CameraManager async api + * @tc.desc : camera status callback on CameraManager async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAMERA_STATUS_CALLBACK', 0, async function (done) { + if (cameraManager == null || cameraManager == undefined) { + console.info(TAG + 'Entering CAMERA_STATUS_CALLBACK cameraManager == null || undefined') + } else { + console.info(TAG + 'Entering CAMERA_STATUS_CALLBACK to operate') + cameraManager.on('cameraStatus', async (err, data) => { + if (!err) { + console.info(TAG + "Camera status Callback on cameraManager is success"); + if (data != null || data != undefined) { + console.info(TAG + "Camera status Callback CameraStatusInfo_Camera: " + data.camera); + console.info(TAG + "Camera status Callback CameraStatusInfo_Status: " + data.status); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Camera status Callback FAILED: " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : GET_CAMERAS + * @tc.name : Create camera manager instance async api + * @tc.desc : Create camera manager instance async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERAS', 0, async function (done) { + console.info('--------------GET_CAMERAS--------------') + await sleep(1) + cameraManager.getCameras((err, data) => { + if (!err) { + console.info(TAG + 'Entering Get Cameras success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering Get Cameras data is not null || undefined') + camerasArray = data + if (camerasArray != null && camerasArray.length > 0) { + for (var i = 0; i < camerasArray.length; i++) { + // Get the variables from camera object + var cameraId = camerasArray[i].cameraId + console.info(TAG + 'Entering Get Cameras camera' + i + 'Id: ' + cameraId) + var cameraPosition = camerasArray[i].cameraPosition + console.info(TAG + 'Entering Get Cameras camera' + i + 'Position: ' + cameraPosition) + var cameraType = camerasArray[i].cameraType + console.info(TAG + 'Entering Get Cameras camera' + i + 'Type: ' + cameraType) + var connectionType = camerasArray[i].connectionType + console.info(TAG + 'Entering Get Cameras connection' + i + 'Type: ' + connectionType) + } + expect(true).assertTrue() + console.info(TAG + 'Entering GET_CAMERAS PASSED') + } else { + expect().assertFail() + console.info(TAG + 'Entering GET_CAMERAS FAILED cameraArray is null || undefined') + } + } + } else { + expect().assertFail() + console.info(TAG + 'Entering GET_CAMERAS FAILED: ' + err.message) + } + console.info(TAG + 'Entering GET_CAMERAS ends here') + done() + }) + await sleep(1) + done() + }) + + /*CAMERA-0 Scripts*/ + /** + * @tc.number : CREATE_CAMERA_INPUT + * @tc.name : Create camerainput from camera-0 cameraId async api + * @tc.desc : Create camerainput from camera-0 cameraId async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT', 0, async function (done) { + console.info('--------------CAMERA-0 STARTS HERE--------------') + console.info('--------------CREATE_CAMERA_INPUT--------------') + await sleep(1) + cameraManager.createCameraInput(camerasArray[0].cameraId, (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + 'Entering Create camera input data is not null || undefined') + camera0Input = data + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_CAMERA_INPUT PASSED with CameraID :' + camerasArray[0].cameraId) + } + } else { + expect().assertFail() + console.info(TAG + 'Entering CREATE_CAMERA_INPUT FAILED: ' + err.message) + } + console.info(TAG + 'Entering CREATE_CAMERA_INPUT ends here') + done() + }) + await sleep(1) + done() + }) + + /** + * @tc.number : CAMERA_INPUT_CALLBACK_ON_ERROR + * @tc.name : Photo output callback on error api + * @tc.desc : Photo output callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAMERA_INPUT_CALLBACK_ON_ERROR', 0, async function (done) { + if (camera0Input == null || camera0Input == undefined) { + console.info(TAG + "Entering Camera Input callback camera0Input == null || undefined"); + } else { + console.info(TAG + "Entering CAMERA_INPUT_CALLBACK_ON_ERROR to operate"); + camera0Input.on('error', async (err, data) => { + if (!err) { + console.info(TAG + "camera0Input error callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "CAMERA_INPUT_CALLBACK_ON_ERROR with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "CAMERA_INPUT_CALLBACK_ON_ERROR FAILED: " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : CREATE_PREVIEW_OUTPUT + * @tc.name : Create previewoutput async api + * @tc.desc : Create previewoutput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_PREVIEW_OUTPUT', 0, async function (done) { + console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT to operate') + await sleep(1) + cameraObj.createPreviewOutput(surfaceId, (err, data) => { + if (!err) { + console.info(TAG + 'Entering Create preview output success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering Create preview output data is not null || undefined') + previewOutput = data + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT PASSED') + } + } else { + console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT FAILED: ' + err.message) + expect().assertFail(); + } + console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT ends here') + done() + }) + await sleep(1) + done() + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_ERROR + * @tc.name : Preview output callback on error api + * @tc.desc : Preview output callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_ERROR', 0, async function (done) { + if (previewOutput == null || previewOutput == undefined) { + console.info(TAG + "Entering PreviewOutput callback on error previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR to operate"); + previewOutput.on('error', async (err, data) => { + if (!err) { + console.info(TAG + "PreviewOutputError callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_ERROR with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_ERROR FAILED: " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /*PhotoOutput APIs test script*/ + /** + * @tc.number : CREATE_PHOTO_OUTPUT_SUCCESS + * @tc.name : Create PhotoOutput instance api + * @tc.desc : Create PhotoOutput instance api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_PHOTO_OUTPUT_SUCCESS', 0, async function (done) { + console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS to operate"); + console.info(TAG + 'Entering getImageReceiverSurfaceId') + await getImageReceiverSurfaceId() + await sleep(1) + cameraObj.createPhotoOutput(surfaceId1, async (err, data) => { + if (!err) { + console.info(TAG + "Entering createPhotoOutput success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering createPhotoOutput data is not null || undefined"); + photoOutputAsync = data; + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS FAILED : " + err.message); + console.info(TAG + "Entering createPhotoOutput ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : PHOTO_OUTPUT_CALLBACK_ON_ERROR + * @tc.name : Photo output callback on error api + * @tc.desc : Photo output callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_OUTPUT_CALLBACK_ON_ERROR', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTO_OUTPUT_CALLBACK_ON_ERROR photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_OUTPUT_CALLBACK_ON_ERROR to operate"); + photoOutputAsync.on('error', async (err, data) => { + if (!err) { + console.info(TAG + "PhotoOutputError callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Error during PhotoOutput with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PHOTO_OUTPUT_CALLBACK_ON_ERROR FAILED: " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : CREATE_VIDEO_OUTPUT + * @tc.name : Create videooutput async api + * @tc.desc : Create videooutput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_VIDEO_OUTPUT', 0, async function (done) { + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT to operate') + await getvideosurface() + await sleep(2) + cameraObj.createVideoOutput(videoId, (err, data) => { + if (!err) { + console.info(TAG + 'Entering Create videooutput success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering Create videooutput data is not null || undefined') + videoOutput = data + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT PASSED') + } + } else { + expect().assertFail() + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT FAILED: ' + err.message) + } + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT ends here') + done() + }) + await sleep(1) + done() + }) + + /** + * @tc.number : VIDEO_OUTPUT_CALLBACK_ON_ERROR + * @tc.name : VideoOutput callback onerror async api + * @tc.desc : VideoOutput callback onerror async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_CALLBACK_ON_ERROR', 0, async function (done) { + if (videoOutput == null || videoOutput == undefined) { + console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_ERROR videoOutput == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_ERROR to operate') + await sleep(1) + videoOutput.on('error', async (err, data) => { + if (!err) { + console.info(TAG + "VideoOutput Errorcallback is success") + if (data != null || data != undefined) { + console.info(TAG + "VIDEO_OUTPUT_CALLBACK_ON_ERROR with ErrorCode: " + data.code); + expect(true).assertTrue() + } + } else { + expect().assertFail() + console.info(TAG + "VIDEO_OUTPUT_CALLBACK_ON_ERROR FAILED: " + err.message); + } + await sleep(1) + done() + }) + await sleep(1) + done(); + } + }) + + /** + * @tc.number : CREATE_CAPTURE_SESSION + * @tc.name : Create capturesession async api + * @tc.desc : Create capturesession async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAPTURE_SESSION', 0, async function (done) { + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION to operate') + await sleep(1) + cameraObj.createCaptureSession(null, async (err, data) => { + if (!err) { + console.info(TAG + 'Entering Create capturesession success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering Create capturesession data is not null || undefined') + captureSession = data + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION PASSED') + } + } else { + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION FAILED: ' + err.message) + expect().assertFail() + } + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION ends here') + await sleep(1) + done() + }) + await sleep(1) + done() + }) + + /** + * @tc.number : CAP_SES_CALLBACK_ON_ERROR + * @tc.name : CaptureSession callback on error api + * @tc.desc : CaptureSession callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAP_SES_CALLBACK_ON_ERROR', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering CAP_SES_CALLBACK_ON_ERROR captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAP_SES_CALLBACK_ON_ERROR to operate"); + captureSession.on('error', async (err, data) => { + if (!err) { + console.info(TAG + " captureSession errorcallback is success"); + if (data != null || data != undefined) { + console.info(TAG + "CAP_SES_CALLBACK_ON_ERROR with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "CAP_SES_CALLBACK_ON_ERROR FAILED: " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : BEGIN_CONFIG + * @tc.name : Begin Config async api + * @tc.desc : Begin Config async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('BEGIN_CONFIG', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + 'Entering Begin Config captureSession == null || undefined') + } else { + console.info(TAG + 'Entering BEGIN_CONFIG to operate') + await sleep(1) + captureSession.beginConfig((err, data) => { + if (!err) { + console.info(TAG + 'Entering Begin Config success') + expect(true).assertTrue() + console.info(TAG + 'Entering BEGIN_CONFIG PASSED') + } else { + console.info(TAG + 'Entering BEGIN_CONFIG FAILED: ' + err.message) + expect().assertFail(); + } + console.info(TAG + 'Entering BEGIN_CONFIG ends here') + done() + }) + await sleep(1) + done() + } + }) + + /** + * @tc.number : ADD_INPUT + * @tc.name : AddInput async api + * @tc.desc : AddInput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_INPUT', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + 'Entering AddInput captureSession == null || undefined') + } else { + console.info(TAG + 'Entering ADD_INPUT to operate') + await sleep(1) + captureSession.addInput(camera0Input, (err, data) => { + if (!err) { + console.info(TAG + 'Entering AddInput success') + expect(true).assertTrue() + console.info(TAG + 'Entering ADD_INPUT PASSED') + } else { + console.info(TAG + 'Entering ADD_INPUT FAILED: ' + err.message) + expect().assertFail(); + } + console.info(TAG + 'Entering ADD_INPUT ends here') + done() + }) + await sleep(1) + done() + } + }) + + /** + * @tc.number : ADD_OUTPUT_PREVIEW + * @tc.name : AddOutput preview async api + * @tc.desc : AddOutput preview async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PREVIEW', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + 'Entering AddOutput preview captureSession == null || undefined') + } else { + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW to operate') + await sleep(1) + captureSession.addOutput(previewOutput, (err, data) => { + if (!err) { + console.info(TAG + 'Entering AddOutput preview success') + expect(true).assertTrue() + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW PASSED') + } else { + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW FAILED: ' + err.message) + expect().assertFail(); + } + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW ends here') + done() + }) + await sleep(1) + done() + } + }) + + /** + * @tc.number : ADD_OUTPUT_PHOTO_SUCCESS + * @tc.name : Add output with photo output api + * @tc.desc : Add output with photo output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PHOTO_SUCCESS', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS to operate"); + captureSession.addOutput(photoOutputAsync, async (err, data) => { + if (!err) { + console.info(TAG + "Entering AddOutput_Photo success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS FAILED: " + err.message); + } + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS ends here"); + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : ADD_OUTPUT_VIDEO + * @tc.name : AddOutput video async api + * @tc.desc : AddOutput video async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_VIDEO', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + 'Entering AddOutput video captureSession == null || undefined') + } else { + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO to operate') + await sleep(1) + captureSession.addOutput(videoOutput, async (err, data) => { + if (!err) { + console.info(TAG + 'Entering AddOutput video success') + expect(true).assertTrue() + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO PASSED') + } else { + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO FAILED: ' + err.message) + expect().assertFail(); + } + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO ends here') + await sleep(1); + done() + }) + await sleep(1) + done() + } + }) + + /** + * @tc.number : REMOVE_INPUT_SUCCESS + * @tc.name : remove input api + * @tc.desc : remove input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('REMOVE_INPUT_SUCCESS', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS to operate"); + captureSession.removeInput(camera0Input, async (err, data) => { + if (!err) { + console.info(TAG + "Entering remove input success"); + expect(true).assertTrue(); + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering Remove Input FAILED" + err.message); + console.info(TAG + "Entering Remove Input ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + } + done(); + }) + + /** + * @tc.number : REMOVE_PREVIEW_OUTPUT_SUCCESS + * @tc.name : Remove preview Output api + * @tc.desc : Remove preview Output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('REMOVE_PREVIEW_OUTPUT_SUCCESS', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS to operate"); + captureSession.removeOutput(previewOutput, async (err, data) => { + if (!err) { + console.info(TAG + "Entering remove preview Output success"); + expect(true).assertTrue(); + console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering Remove preview Output FAILED" + err.message); + console.info(TAG + "Entering Remove Preview Output ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : REMOVE_PHOTO_OUTPUT_SUCCESS + * @tc.name : Remove photo Output api + * @tc.desc : Remove photo Output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('REMOVE_PHOTO_OUTPUT_SUCCESS', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering REMOVE_PHOTO_OUTPUT_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering REMOVE_PHOTO_OUTPUT_SUCCESS to operate"); + captureSession.removeOutput(photoOutputAsync, async (err, data) => { + if (!err) { + console.info(TAG + "Entering remove photo Output success"); + expect(true).assertTrue(); + console.info(TAG + "Entering REMOVE_PHOTO_OUTPUT_SUCCESS PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering Remove photo Output FAILED" + err.message); + console.info(TAG + "Entering Remove photo Output ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + } + done(); + }) + + /** + * @tc.number : REMOVE_VIDEO_OUTPUT_SUCCESS + * @tc.name : Remove video Output api + * @tc.desc : Remove video Output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('REMOVE_VIDEO_OUTPUT_SUCCESS', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS to operate"); + captureSession.removeOutput(videoOutput, async (err, data) => { + if (!err) { + console.info(TAG + "Entering remove video Output success"); + expect(true).assertTrue(); + console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering Remove video Output FAILED" + err.message); + console.info(TAG + "Entering Remove video Output ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : ADD_INPUT + * @tc.name : AddInput async api + * @tc.desc : AddInput async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_INPUT', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + 'Entering AddInput captureSession == null || undefined') + } else { + console.info(TAG + 'Entering ADD_INPUT to operate') + await sleep(1) + captureSession.addInput(camera0Input, (err, data) => { + if (!err) { + console.info(TAG + 'Entering AddInput success') + expect(true).assertTrue() + console.info(TAG + 'Entering ADD_INPUT PASSED') + } else { + console.info(TAG + 'Entering ADD_INPUT FAILED: ' + err.message) + expect().assertFail(); + } + console.info(TAG + 'Entering ADD_INPUT ends here') + done() + }) + await sleep(1) + done() + } + }) + + /** + * @tc.number : ADD_OUTPUT_PREVIEW + * @tc.name : AddOutput preview async api + * @tc.desc : AddOutput preview async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PREVIEW', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + 'Entering AddOutput captureSession == null || undefined') + } else { + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW to operate') + await sleep(1) + captureSession.addOutput(previewOutput, (err, data) => { + if (!err) { + console.info(TAG + 'Entering AddOutput success') + console.info(TAG + 'Entering AddOutput data is not null || undefined') + expect(true).assertTrue() + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW PASSED') + } else { + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW FAILED: ' + err.message) + expect().assertFail(); + } + console.info(TAG + 'Entering ADD_OUTPUT_PREVIEW ends here') + done() + }) + await sleep(1) + done() + } + }) + + /** + * @tc.number : ADD_OUTPUT_PHOTO + * @tc.name : Add output with photo output api + * @tc.desc : Add output with photo output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PHOTO', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering AddOutput_Photo captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_PHOTO to operate"); + captureSession.addOutput(photoOutputAsync, async (err, data) => { + if (!err) { + console.info(TAG + "Entering AddOutput_Photo success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering AddOutput_Photo data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO FAILED: " + err.message); + } + console.info(TAG + "Entering ADD_OUTPUT_PHOTO ends here"); + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : ADD_OUTPUT_VIDEO + * @tc.name : AddOutput video async api + * @tc.desc : AddOutput video async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_VIDEO', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + 'Entering AddOutput captureSession == null || undefined') + } else { + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO to operate') + await sleep(1) + captureSession.addOutput(videoOutput, (err, data) => { + if (!err) { + console.info(TAG + 'Entering AddOutput success') + console.info(TAG + 'Entering AddOutput data is not null || undefined') + expect(true).assertTrue() + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO PASSED') + } else { + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO FAILED: ' + err.message) + expect().assertFail(); + } + console.info(TAG + 'Entering ADD_OUTPUT_VIDEO ends here') + done() + }) + await sleep(1) + done() + } + }) + + //framerate + /** + * @tc.number : GET_FRAME_RATE_RANGE + * @tc.name : get frame rate range camera0 api + * @tc.desc : get frame rate range async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FRAME_RATE_RANGE', 0, async function (done) { + console.info(TAG + "Entering GET_FRAME_RATE_RANGE to operate"); + videoOutput.getFrameRateRange(async (err, data) => { + if (!err) { + console.info(TAG + "Entering get frame rate range success"); + expect(true).assertTrue(); + console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); + console.info(TAG + "GET_FRAME_RATE_RANGE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FRAME_RATE_RANGE FAILED : " + err.message); + console.info(TAG + "GET_FRAME_RATE_RANGE ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FRAME_RATE_RANGE_Grp0 + * @tc.name : set frame rate range camera0 api + * @tc.desc : set frame rate range async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FRAME_RATE_RANGE_Grp0', 0, async function (done) { + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Grp0 to operate"); + videoOutput.setFrameRateRange(minFrameRate_Grp0,maxFrameRate_Grp0, async (err, data) => { + if (!err) { + console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); + console.info(TAG + "Entering set frame rate range PASSED") + expect(true).assertTrue(); + } + else { + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Grp0 FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Grp0 ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FRAME_RATE_RANGE_Mix + * @tc.name : set frame rate range camera0 api + * @tc.desc : set frame rate range async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FRAME_RATE_RANGE_Mix', 0, async function (done) { + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Mix to operate"); + videoOutput.setFrameRateRange(minFrameRate_Mix,maxFrameRate_Mix, async (err, data) => { + if (!err) { + console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); + console.info(TAG + "Entering set frame rate range FAILED") + expect().assertFail(); + } + else { + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Mix PASSED : " + err.message); + expect(true).assertTrue(); + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Mix ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FRAME_RATE_RANGE_Err1 + * @tc.name : set frame rate range camera0 api_err + * @tc.desc : set frame rate range async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FRAME_RATE_RANGE_Err1', 0, async function (done) { + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Err1 to operate"); + videoOutput.setFrameRateRange(minFrameRate_Err1,maxFrameRate_Err1, async (err, data) => { + if (!err) { + console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); + console.info(TAG + "Entering set frame rate range FAILED") + expect().assertFail(); + } + else { + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Err1 PASSED : " + err.message); + expect(true).assertTrue(); + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Err1 ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FRAME_RATE_RANGE_Err2 + * @tc.name : set frame rate range camera0 api + * @tc.desc : set frame rate range async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FRAME_RATE_RANGE_Err2', 0, async function (done) { + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Err2 to operate"); + videoOutput.setFrameRateRange(minFrameRate_Err2,maxFrameRate_Err2, async (err, data) => { + if (!err) { + console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); + console.info(TAG + "Entering set frame rate range FAILED"); + expect().assertFail(); + } + else { + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Err2 PASSED : " + err.message); + expect(true).assertTrue(); + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Err2 ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FRAME_RATE_RANGE_Err3 + * @tc.name : set frame rate range camera0 api + * @tc.desc : set frame rate range async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FRAME_RATE_RANGE_Err3', 0, async function (done) { + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Err3 to operate"); + videoOutput.setFrameRateRange(minFrameRate_Err3,maxFrameRate_Err3, async (err, data) => { + if (!err) { + console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); + console.info(TAG + "Entering set frame rate range FAILED"); + expect().assertFail(); + } + else { + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Err3 PASSED : " + err.message); + expect(true).assertTrue(); + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Err3 ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FRAME_RATE_RANGE_Grp20 + * @tc.name : set frame rate range camera0 api + * @tc.desc : set frame rate range async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FRAME_RATE_RANGE_Grp20', 0, async function (done) { + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Grp20 to operate"); + videoOutput.setFrameRateRange(minFrameRate_Grp20,maxFrameRate_Grp20, async (err, data) => { + if (!err) { + console.info(TAG + "Entering set frame rate range, current framerateRange is: " + JSON.stringify(data)); + console.info(TAG + "Entering set frame rate range PASSED") + expect(true).assertTrue(); + } + else { + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Grp20 FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Grp20 ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : ISVIDEOSTABILIZATIONMODESUPPORTEDOFF + * @tc.name : isVideoStabilizationModeSupported Off + * @tc.desc : isVideoStabilizationModeSupported async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('ISVIDEOSTABILIZATIONMODESUPPORTEDOFF', 0, async function (done) { + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTEDOFF to operate') + captureSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.OFF, async (err, data) => { + if (!err) { + console.info(TAG + 'Entering Create isVideoStabilizationModeSupported success') + expect(data).assertEqual(true) + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTEDOFF PASSED :' + data) + } + else { + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTEDOFF FAILED: ' + err.message) + expect().assertFail() + } + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTEDOFF ends here') + await sleep(1) + done() + }) + await sleep(1) + done() + }) + */ + + /** + * @tc.number : SET_VIDEOSTABILIZATIONMODEOFF + * @tc.name : SetVideoStabilizationModeOff + * @tc.desc : SetVideoStabilizationModeOff async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('SET_VIDEOSTABILIZATIONMODEOFF', 0, async function (done) { + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODEOFF to operate') + captureSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.OFF, async (err, data) => { + if (!err) { + console.info(TAG + 'Entering Set VideoStabilization Mode Off success') + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODEOFF PASSED: ' + data) + expect(cameraObj.VideoStabilizationMode.OFF).assertEqual(0) + } + else { + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODEOFF FAILED: ' + err.message) + expect().assertFail() + } + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODEOFF ends here') + await sleep(1) + done() + }) + await sleep(1) + done() + }) + */ + + /** + * @tc.number : GET_VIDEOSTABILIZATION_MODE_OFF + * @tc.name : getVideoStabilizationModeOff + * @tc.desc : getVideoStabilizationModeOff async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_VIDEOSTABILIZATION_MODE_OFF', 0, async function (done) { + console.info(TAG + "Entering GET_VIDEOSTABILIZATION_MODE_OFF to operate"); + captureSession.getActiveVideoStabilizationMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering get Video Stabilization Mode Off success"); + console.info(TAG + "Current VideoStabilizationMode is: " + data); + expect(data).assertEqual(0); + console.info(TAG + "GET_VIDEOSTABILIZATION_MODE_OFF PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_VIDEOSTABILIZATION_MODE_OFF FAILED :" + err.message); + console.info(TAG + "GET_VIDEOSTABILIZATION_MODE_OFF ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : ISVIDEOSTABILIZATIONMODESUPPORTED_LOW + * @tc.name : is VideoStabilization Mode Low Supported + * @tc.desc : isVideoStabilizationModeSupported low async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('ISVIDEOSTABILIZATIONMODESUPPORTED_LOW', 0, async function (done) { + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTED_LOW to operate') + captureSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.LOW, async (err, data) => { + if (!err) { + console.info(TAG + 'Entering isVideoStabilizationModeSupported success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering isVideoStabilizationModeSupported data is not null || undefined') + expect(data).assertEqual(true) + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTED_LOW PASSED: ' + data) + } + } else { + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTED_LOW FAILED: ' + err.message) + expect().assertFail() + } + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTED_LOW ends here') + await sleep(1) + done() + }) + await sleep(1) + done() + }) + */ + + /** + * @tc.number : SET_VIDEOSTABILIZATIONMODELOW + * @tc.name : SetVideoStabilizationModelow + * @tc.desc : SetVideoStabilizationModelow async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('SET_VIDEOSTABILIZATIONMODELOW', 0, async function (done) { + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODELOW to operate') + captureSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.LOW, async (err, data) => { + if (!err) { + console.info(TAG + 'Entering Set VideoStabilization Mode Low success') + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODELOW PASSED: ' + data) + expect(cameraObj.VideoStabilizationMode.LOW).assertEqual(1); + } + else { + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODELOW FAILED: ' + err.message) + expect().assertFail(); + } + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODELOW ends here') + await sleep(1) + done() + }) + await sleep(1) + done() + }) + */ + + /** + * @tc.number : GET_VIDEOSTABILIZATION_MODE_LOW + * @tc.name : getVideoStabilizationModeLow + * @tc.desc : getVideoStabilizationModeLOw async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('GET_VIDEOSTABILIZATION_MODE_LOW', 0, async function (done) { + console.info(TAG + "Entering GET_VIDEOSTABILIZATION_MODE_LOW to operate"); + captureSession.getActiveVideoStabilizationMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering get Video Stabilization Mode low success"); + console.info(TAG + "Current VideoStabilizationMode is: " + data); + expect(data).assertEqual(1) + console.info(TAG + "GET_VIDEOSTABILIZATION_MODE_LOW PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_VIDEOSTABILIZATION_MODE_LOW FAILED :" + err.message); + console.info(TAG + "GET_VIDEOSTABILIZATION_MODE_LOW ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : ISVIDEOSTABILIZATIONMODESUPPORTED_MIDDLE + * @tc.name : is VideoStabilization Mode Middle Supported + * @tc.desc : isVideoStabilizationModeSupported Middle async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('ISVIDEOSTABILIZATIONMODESUPPORTED_MIDDLE', 0, async function (done) { + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTED_MIDDLE to operate') + captureSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.MIDDLE, async (err, data) => { + if (!err) { + console.info(TAG + 'Entering is VideoStabilization Mode middle Supported success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering isVideoStabilizationModeSupported data is not null || undefined') + expect(data).assertEqual(false) + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTED_MIDDLE PASSED : ' + data) + } + } else { + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTED_MIDDLE FAILED: ' + err.message) + expect().assertFail() + } + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTED_MIDDLE ends here') + await sleep(1) + done() + }) + await sleep(1) + done() + }) + */ + + /** + * @tc.number : SET_VIDEOSTABILIZATIONMODEMIDDLE + * @tc.name : SetVideoStabilizationModeMedium + * @tc.desc : SetVideoStabilizationModeMedium async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('SET_VIDEOSTABILIZATIONMODEMIDDLE', 0, async function (done) { + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODEMIDDLE to operate') + captureSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.MIDDLE, async (err, data) => { + if (!err) { + console.info(TAG + 'Entering Create Set VideoStabilization Mode middle success') + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODEMIDDLE FAILED: ' + data) + expect().assertFail(); + } + else { + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODEMIDDLE PASSED: ' + err.message) + expect(true).assertTrue(); + } + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODEMIDDLE ends here') + await sleep(1) + done() + }) + await sleep(1) + done() + }) + */ + + /** + * @tc.number : GET_VIDEOSTABILIZATION_MODE_MIDDLE + * @tc.name : getVideoStabilizationModeMedium + * @tc.desc : getVideoStabilizationModeMedium async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_VIDEOSTABILIZATION_MODE_MIDDLE', 0, async function (done) { + console.info(TAG + "Entering GET_VIDEOSTABILIZATION_MODE_MIDDLE to operate"); + captureSession.getActiveVideoStabilizationMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering get Video Stabilization Mode medium success"); + console.info(TAG + "Current VideoStabilizationMode is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_VIDEOSTABILIZATION_MODE_MIDDLE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_VIDEOSTABILIZATION_MODE_MIDDLE FAILED :" + err.message); + console.info(TAG + "GET_VIDEOSTABILIZATION_MODE_MIDDLE ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : ISVIDEOSTABILIZATIONMODESUPPORTED_HIGH + * @tc.name : is VideoStabilization Mode High Supported + * @tc.desc : isVideoStabilizationModeSupported High async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('ISVIDEOSTABILIZATIONMODESUPPORTED_HIGH', 0, async function (done) { + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTED_HIGH to operate') + captureSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.HIGH, async (err, data) => { + if (!err) { + console.info(TAG + 'Entering is VideoStabilization Mode High Supported success') + expect(data).assertEqual(false) + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTED_HIGH PASSED : ' + data) + } + else { + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTED_HIGH FAILED: ' + err.message) + expect().assertFail() + } + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTED_HIGH ends here') + await sleep(1) + done() + }) + await sleep(1) + done() + }) + */ + + /** + * @tc.number : SET_VIDEOSTABILIZATIONMODEHIGH + * @tc.name : SetVideoStabilizationModeHigh + * @tc.desc : SetVideoStabilizationModeHigh async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('SET_VIDEOSTABILIZATIONMODEHIGH', 0, async function (done) { + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODEHIGH to operate') + captureSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.HIGH, async (err, data) => { + if (!err) { + console.info(TAG + 'Entering Create Set VideoStabilization Mode High success') + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODEHIGH FAILED: ' + data) + expect().assertFail(); + } + else { + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODEHIGH PASSED: ' + err.message) + expect(true).assertTrue(); + } + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODEHIGH ends here') + await sleep(1) + done() + }) + await sleep(1) + done() + }) + */ + + /** + * @tc.number : GET_VIDEOSTABILIZATION_MODE_HIGH + * @tc.name : getVideoStabilizationModeHigh + * @tc.desc : getVideoStabilizationModeHigh async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_VIDEOSTABILIZATION_MODE_HIGH', 0, async function (done) { + console.info(TAG + "Entering GET_VIDEOSTABILIZATION_MODE_HIGH to operate"); + captureSession.getActiveVideoStabilizationMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering get Video Stabilization Mode High success"); + console.info(TAG + "Current VideoStabilizationMode is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_VIDEOSTABILIZATION_MODE_HIGH PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_VIDEOSTABILIZATION_MODE_HIGH FAILED :" + err.message); + console.info(TAG + "GET_VIDEOSTABILIZATION_MODE_HIGH ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : ISVIDEOSTABILIZATIONMODESUPPORTED_AUTO + * @tc.name : is VideoStabilization Mode Auto Supported + * @tc.desc : isVideoStabilizationModeSupported Auto async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('ISVIDEOSTABILIZATIONMODESUPPORTED_AUTO', 0, async function (done) { + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTED_AUTO to operate') + captureSession.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.AUTO, async (err, data) => { + if (!err) { + console.info(TAG + 'Entering is VideoStabilization Mode Auto Supported success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering isVideoStabilizationModeSupported data is not null || undefined') + expect(data).assertEqual(false) + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTED_AUTO PASSED : ' + data) + } + } else { + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTED_AUTO FAILED: ' + err.message) + expect().assertFail() + } + console.info(TAG + 'Entering ISVIDEOSTABILIZATIONMODESUPPORTED_AUTO ends here') + await sleep(1) + done() + }) + await sleep(1) + done() + }) + */ + + /** + * @tc.number : SET_VIDEOSTABILIZATIONMODEAUTO + * @tc.name : SetVideoStabilizationModeAuto + * @tc.desc : SetVideoStabilizationModeAuto async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('SET_VIDEOSTABILIZATIONMODEAUTO', 0, async function (done) { + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODEAUTO to operate') + captureSession.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.AUTO, async (err, data) => { + if (!err) { + console.info(TAG + 'Entering Create Set VideoStabilization Mode auto success') + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODEAUTO FAILED: ' + data) + expect().assertFail(); + } + else { + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODEAUTO PASSED: ' + err.message) + expect(true).assertTrue(); + } + console.info(TAG + 'Entering SET_VIDEOSTABILIZATIONMODEAUTO ends here') + await sleep(1) + done() + }) + await sleep(1) + done() + }) + */ + + /** + * @tc.number : GET_VIDEOSTABILIZATION_MODE_AUTO + * @tc.name : getVideoStabilizationModeAuto + * @tc.desc : getVideoStabilizationModeAuto async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_VIDEOSTABILIZATION_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering GET_VIDEOSTABILIZATION_MODE_AUTO to operate"); + captureSession.getActiveVideoStabilizationMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering get Video Stabilization Mode Auto success"); + console.info(TAG + "Current VideoStabilizationMode is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_VIDEOSTABILIZATION_MODE_AUTO PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_VIDEOSTABILIZATION_MODE_AUTO FAILED :" + err.message); + console.info(TAG + "GET_VIDEOSTABILIZATION_MODE_AUTO ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : COMMIT_CONFIG + * @tc.name : CommitConfig async api + * @tc.desc : CommitConfig async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('COMMIT_CONFIG', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + 'Entering CommitConfig captureSession == null || undefined') + } else { + console.info(TAG + 'Entering COMMIT_CONFIG to operate') + await sleep(1) + captureSession.commitConfig(async (err, data) => { + if (!err) { + console.info(TAG + 'Entering CommitConfig success') + console.info(TAG + 'Entering CommitConfig data is not null || undefined') + expect(true).assertTrue() + console.info(TAG + 'Entering COMMIT_CONFIG PASSED') + } else { + console.info(TAG + 'Entering COMMIT_CONFIG FAILED: ' + err.message) + expect().assertFail(); + } + console.info(TAG + 'Entering COMMIT_CONFIG ends here') + await sleep(1) + done() + }) + await sleep(1) + done() + } + }) + + /** + * @tc.number : FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT + * @tc.name : FocusStateChange callback api + * @tc.desc : FocusStateChange callback api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT', 0, async function (done) { + if (camera0Input == null || camera0Input == undefined) { + console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT to operate"); + camera0Input.on('focusStateChange', async (err, data) => { + if (!err) { + console.info(TAG + "FocusState callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Current FocusState is: " + data); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT FAILED: " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT + * @tc.name : ExposureStateChange callback api + * @tc.desc : ExposureStateChange callback api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT', 0, async function (done) { + if (camera0Input == null || camera0Input == undefined) { + console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT to operate"); + camera0Input.on('exposureStateChange', async (err, data) => { + if (!err) { + console.info(TAG + "ExposureStateChange callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Current ExposureStateChange is: " + data); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT FAILED: " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + //callback API + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START + * @tc.name : Preview output callback on frame start api + * @tc.desc : Preview output callback on frame start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START', 0, async function (done) { + if (previewOutput == null || previewOutput == undefined) { + console.info(TAG + "Entering Preview output callback on frame start previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START to operate"); + previewOutput.on('frameStart', async (err, data) => { + if (!err) { + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START FAILED : + err.message"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END + * @tc.name : Preview capture callback on frame end api + * @tc.desc : Preview capture callback on frame end api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END', 0, async function (done) { + if (previewOutput == null || previewOutput == undefined) { + console.info(TAG + "Entering Preview capture callback on frame end previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END to operate"); + previewOutput.on('frameEnd', async (err, data) => { + if (!err) { + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END FAILED : + err.message"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + //Capture callback + /** + * @tc.number : PHOTO_CAP_CALLBACK_ON_CAPTURE_START + * @tc.name : Photo capture callback on capture start api + * @tc.desc : Photo capture callback on capture start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_CAP_CALLBACK_ON_CAPTURE_START', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering Photo Capture Callback on CaptureStart photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_START to operate"); + photoOutputAsync.on('captureStart', async (err, data) => { + if (!err) { + console.info(TAG + "Photo Capture Callback on CaptureStart is success"); + if (data != null || data != undefined) { + console.info(TAG + "PHOTO_CAP_CALLBACK_ON_CAPTURE_START with captureId: " + data); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PHOTO_CAP_CALLBACK_ON_CAPTURE_START FAILED: " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : PHOTO_CAP_CALLBACK_ON_CAPTURE_END + * @tc.name : Photo capture callback on capture end api + * @tc.desc : Photo capture callback on capture end api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_CAP_CALLBACK_ON_CAPTURE_END', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_END photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_END to operate"); + photoOutputAsync.on('captureEnd', async (err, data) => { + if (!err) { + console.info(TAG + "captureEnd callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "captureEnd callback with captureId: " + data.captureId); + console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + 'PHOTO_CAP_CALLBACK_ON_CAPTURE_END FAILED' + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER + * @tc.name : Photo capture callback on frame shutter api + * @tc.desc : Photo capture callback on frame shutter api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER to operate"); + photoOutputAsync.on('frameShutter', async (err, data) => { + if (!err) { + console.info(TAG + "frameShutter callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "frameShutter callback with captureId: " + data.captureId); + console.info(TAG + "frameShutter callback with timestamp: " + data.timestamp); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER FAILED: " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : VIDEO_OUTPUT_CALLBACK_ON_FRAME_START + * @tc.name : VideoOutput callback onframestart async api + * @tc.desc : VideoOutput callback onframestart async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_CALLBACK_ON_FRAME_START', 0, async function (done) { + if (videoOutput == null || videoOutput == undefined) { + console.info(TAG + "Entering VideoOutput callback onframestart videoOutput == null || undefined"); + } else { + console.info(TAG + "Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_START to operate"); + videoOutput.on('frameStart', async (err, data) => { + if (!err) { + console.info(TAG + "VIDEO_OUTPUT_CALLBACK_ON_FRAME_START is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "VIDEO_OUTPUT_CALLBACK_ON_FRAME_START is FAILED : " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : VIDEO_OUTPUT_CALLBACK_ON_FRAME_END + * @tc.name : VideoOutput callback onframeend async api + * @tc.desc : VideoOutput callback onframeend async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_CALLBACK_ON_FRAME_END', 0, async function (done) { + if (videoOutput == null || videoOutput == undefined) { + console.info(TAG + 'Entering VideoOutput callback onframeend videoOutput == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_END to operate') + await sleep(1) + videoOutput.on('frameEnd', async (err, data) => { + if (!err) { + console.info(TAG + 'VIDEO_OUTPUT_CALLBACK_ON_FRAME_END is success'); + if (data != null || data != undefined) { + expect(true).assertTrue() + } + } else { + expect().assertFail(); + console.info(TAG + 'VIDEO_OUTPUT_CALLBACK_ON_FRAME_END FAILED' + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : CAPTURE_SESSION_START + * @tc.name : CaptureSession start async api + * @tc.desc : CaptureSession start async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_START', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + "Entering CaptureSession start captureSession == null || undefined") + } else { + console.info(TAG + "Entering CAPTURE_SESSION_START to operate") + await sleep(1) + captureSession.start(async (err, data) => { + if (!err) { + console.info(TAG + "Entering CaptureSession start success") + expect(true).assertTrue() + console.info(TAG + "Entering CAPTURE_SESSION_START PASSED") + } else { + console.info(TAG + 'Entering CAPTURE_SESSION_START FAILED: ' + err.message) + expect().assertFail(); + } + console.info(TAG + 'Entering CAPTURE_SESSION_START ends here') + await sleep(1) + done() + }) + await sleep(1) + done() + } + }) + + /** + * @tc.number : PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS + * @tc.name : Photo output capture without photosettings api + * @tc.desc : Photo output capture without photosettings api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS to operate"); + photoOutputAsync.capture(async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutput capture without photosettings success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering photoOutput capture without photosettings data is not null || undefined"); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS PASSED"); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS FAILED : " + err.message); + console.info(TAG + "Entering PHOTOOUTPUT_CAPTURE_WITHOUT_PHOTOSETTINGS ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + //FLASH Function API scripts + /** + * @tc.number : HAS_FLASH + * @tc.name : check if has flash-camera0Input api + * @tc.desc : check if has flash-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('HAS_FLASH', 0, async function (done) { + console.info(TAG + "hasFlash called.") + camera0Input.hasFlash(async (err, data) => { + if (!err) { + console.info(TAG + "Entering HAS_FLASH success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering HAS_FLASH data is not null || undefined"); + console.info(TAG + "Entering HAS_FLASH PASSED with HAS_FLASH is: " + data); + expect(data).assertEqual(true); + } + } else { + console.info(TAG + "Entering HAS_FLASH FAILED : " + err.message); + expect().assertFail(); + } + console.info(TAG + "Entering HAS_FLASH ends here"); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_OPEN_SUPPORTED + * @tc.name : check if flash mode open is supported-camera0Input api + * @tc.desc : check if flash mode open is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_OPEN_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED to operate"); + camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED data is not null || undefined"); + console.info(TAG + "FLASH_MODE_OPEN supported is: " + data); + expect(data).assertEqual(true); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED PASSED"); + } + } else { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_OPEN + * @tc.name : set flash mode open camera0 api + * @tc.desc : set flash mode open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_OPEN', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN to operate"); + camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); + console.info(TAG + "Entering SET_FLASH_MODE_OPEN PASSED") + expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); + } + else { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_OPEN ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_OPEN + * @tc.name : get flash mode open camera0 api + * @tc.desc : get flash mode open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FLASH_MODE_OPEN', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_OPEN to operate"); + camera0Input.getFlashMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FLASH_MODE_OPEN success"); + if (data == 1) { + console.info(TAG + "GET_FLASH_MODE_OPEN data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_OPEN PASSED"); + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_OPEN FAILED : " + err.message); + console.info(TAG + "GET_FLASH_MODE_OPEN ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED + * @tc.name : check if flash mode always open is supported-camera0Input api + * @tc.desc : check if flash mode always open is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED to operate"); + camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { + if (!err) { + console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED data is not null || undefined"); + console.info(TAG + "FLASH_MODE_ALWAYS_OPEN supported is: " + data); + expect(data).assertEqual(true); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED PASSED"); + } + } else { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_ALWAYS_OPEN + * @tc.name : set flash mode always open camera0 api + * @tc.desc : set flash mode always open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_ALWAYS_OPEN', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN to operate"); + camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN PASSED") + expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3); + } + else { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_ALWAYS_OPEN + * @tc.name : get flash mode always open camera0 api + * @tc.desc : get flash mode always open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FLASH_MODE_ALWAYS_OPEN', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN to operate"); + camera0Input.getFlashMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN success"); + if (data == 3) { + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN data is not null || undefined: "); + expect(true).assertTrue(); + console.info(TAG + "Current FlashMode is: " + data); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN PASSED"); + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN FAILED : " + err.message); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_AUTO_SUPPORTED + * @tc.name : check if flash mode auto is supported-camera0Input api + * @tc.desc : check if flash mode auto is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_AUTO_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED to operate"); + camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering FLASH_MODE_AUTO SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED data is not null || undefined"); + console.info(TAG + "FLASH_MODE_AUTO supported is: " + data); + expect(data).assertEqual(true); + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED PASSED"); + } + } else { + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED FAILED :" + err.message); + expect().assertFail(); + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_AUTO + * @tc.name : set flash mode auto camera0 api + * @tc.desc : set flash mode auto open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_AUTO to operate"); + camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FLASH_MODE_AUTO SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); + console.info(TAG + "Entering SET_FLASH_MODE_AUTO PASSED") + expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2); + } + else { + console.info(TAG + "Entering SET_FLASH_MODE_AUTO FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_AUTO ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_AUTO + * @tc.name : get flash mode auto camera0 api + * @tc.desc : get flash mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FLASH_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_AUTO to operate"); + camera0Input.getFlashMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FLASH_MODE_AUTO success"); + if (data == 2) { + console.info(TAG + "GET_FLASH_MODE_AUTO data is not null || undefined: "); + expect(true).assertTrue(); + console.info(TAG + "Current FlashMode is: " + data); + console.info(TAG + "GET_FLASH_MODE_AUTO PASSED"); + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_AUTO FAILED :" + err.message); + console.info(TAG + "GET_FLASH_MODE_AUTO ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + /** + * @tc.number : IS_FLASH_MODE_CLOSE_SUPPORTED + * @tc.name : check if flash mode close is supported-camera0Input api + * @tc.desc : check if flash mode close is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_CLOSE_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED to operate"); + camera0Input.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering FLASH_MODE_CLOSE SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED data is not null || undefined"); + console.info(TAG + "FLASH_MODE_CLOSE supported is: " + data); + expect(data).assertEqual(true); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED PASSED"); + } + } else { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED FAILED :" + err.message); + expect().assertFail(); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_CLOSE + * @tc.name : set flash mode close camera0 api + * @tc.desc : set flash mode close open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_CLOSE', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE to operate"); + camera0Input.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE PASSED") + expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0); + } + else { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_CLOSE + * @tc.name : get flash mode auto camera0 api + * @tc.desc : get flash mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FLASH_MODE_CLOSE', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_CLOSE to operate"); + camera0Input.getFlashMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FLASH_MODE_CLOSE success"); + if (data == 0) { + console.info(TAG + "GET_FLASH_MODE_CLOSE data is not null || undefined: "); + expect(true).assertTrue(); + console.info(TAG + "Current FlashMode is: " + data); + console.info(TAG + "GET_FLASH_MODE_CLOSE PASSED"); + } + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_CLOSE FAILED :" + err.message); + console.info(TAG + "GET_FLASH_MODE_CLOSE ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_ZOOM_RATIO + * @tc.name : get zoom ratio camera-0 cameraId api + * @tc.desc : get zoom ratio camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_ZOOM_RATIO', 0, async function (done) { + console.info("--------------GET_ZOOM_RATIO--------------"); + camera0Input.getZoomRatioRange(async (err, data) => { + if (!err) { + if (data != null && data != undefined) { + console.info(TAG + "Entering GET_ZOOM_RATIO data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering GET_ZOOM_RATIO Success " + data) + } + } else { + expect().assertFail(); + console.info(TAG + "Entering GET_ZOOM_RATIO FAILED: " + err.message); + } + console.info(TAG + "Entering GET_ZOOM_RATIO ends here"); + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_1_ASYNC + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_1_ASYNC', 0, async function (done) { + camera0Input.setZoomRatio(1, (err, data) => { + if (!err) { + console.info(TAG + "setZoomRatio success: 1"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err, data1) => { + if (!err) { + console.info(TAG + "getZoomRatio success : " + data1); + expect(data1).assertEqual(1); + console.info(TAG + "SET_GET_ZOOM_1_ASYNC PASSED "); + } + else { + console.info(TAG + "GET_ZOOM_1_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + } else { + console.info(TAG + "SET_ZOOM_1_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_2_ASYNC + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_2_ASYNC', 0, async function (done) { + camera0Input.setZoomRatio(2, (err, data) => { + if (!err) { + console.info(TAG + "setZoomRatio success: 2"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err, data1) => { + if (!err) { + console.info(TAG + "getZoomRatio success : " + data1); + expect(data1).assertEqual(2); + console.info(TAG + "SET_GET_ZOOM_2_ASYNC PASSED "); + } + else { + expect().assertFail(); + console.info(TAG + "GET_ZOOM_2_ASYNC FAILED" + err.message); + } + }) + } else { + expect().assertFail(); + console.info(TAG + "SET_ZOOM_2_ASYNC FAILED" + err.message); + } + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_3_ASYNC + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_3_ASYNC', 0, async function (done) { + camera0Input.setZoomRatio(3, (err, data) => { + if (!err) { + console.info(TAG + "setZoomRatio success: 3"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err, data1) => { + if (!err) { + console.info(TAG + "getZoomRatio success : " + data1); + expect(data1).assertEqual(3); + console.info(TAG + "SET_GET_ZOOM_3_ASYNC PASSED "); + } + else { + console.info(TAG + "GET_ZOOM_3_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + } else { + console.info(TAG + "SET_ZOOM_3_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_4_ASYNC + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_4_ASYNC', 0, async function (done) { + camera0Input.setZoomRatio(4, (err, data) => { + if (!err) { + console.info(TAG + "setZoomRatio success: 4"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err, data1) => { + if (!err) { + console.info(TAG + "getZoomRatio success : " + data1); + expect(data1).assertEqual(4); + console.info(TAG + "SET_GET_ZOOM_4_ASYNC PASSED "); + } + else { + console.info(TAG + "GET_ZOOM_4_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + } else { + console.info(TAG + "SET_ZOOM_4_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_5_ASYNC + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_5_ASYNC', 0, async function (done) { + camera0Input.setZoomRatio(5, (err, data) => { + if (!err) { + console.info(TAG + "setZoomRatio success: 5"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err, data1) => { + if (!err) { + console.info(TAG + "getZoomRatio success : " + data1); + expect(data1).assertEqual(5); + console.info(TAG + "SET_GET_ZOOM_5_ASYNC PASSED "); + } + else { + console.info(TAG + "GET_ZOOM_5_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + } else { + console.info(TAG + "SET_ZOOM_5_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_6_ASYNC + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_6_ASYNC', 0, async function (done) { + camera0Input.setZoomRatio(6, (err, data) => { + if (!err) { + console.info(TAG + "setZoomRatio success: 6"); + console.info(TAG + "getZoomRatio called") + camera0Input.getZoomRatio((err, data1) => { + if (!err) { + console.info(TAG + "getZoomRatio success : " + data1); + expect(data1).assertEqual(6); + console.info(TAG + "SET_GET_ZOOM_6_ASYNC PASSED "); + } + else { + console.info(TAG + "GET_ZOOM_6_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + } else { + console.info(TAG + "SET_ZOOM_6_ASYNC FAILED" + err.message); + expect().assertFail(); + } + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_LOCKED_SUPPORTED + * @tc.name : check if focus mode locked is supported-camera0Input api + * @tc.desc : check if focus mode locked is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_LOCKED_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED to operate"); + camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Is Focus Mode Locked Supported SUCCESS: " + data); + if (data != null || data != undefined) { + console.info(TAG + "Entering Is Focus Mode Locked Supported data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_LOCKED_SUPPORTED is: " + data); + expect(data).assertEqual(false); + console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED PASSED: "); + } + } else { + console.info(TAG + "IS_FOCUS_MODE_LOCKED_SUPPORTED FAILED :" + err.message); + expect().assertFail() + console.info(TAG + "IS_FOCUS_MODE_LOCKED_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_LOCKED + * @tc.name : set focus mode locked camera0 api + * @tc.desc : set focus mode locked camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_LOCKED', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED to operate"); + camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SetFocus Mode Locked SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); + console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED FAILED : ") + expect().assertFail(); + } else { + console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED PASSED : " + err.message); + expect(true).assertTrue(); + console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_LOCKED + * @tc.name : get focus mode locked camera0 api + * @tc.desc : get focus mode locked camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_MODE_LOCKED', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_LOCKED to operate"); + camera0Input.getFocusMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Focus Mode Locked SUCCESS: " + data); + console.info(TAG + "Get Focus Mode Locked data is not null || undefined: "); + console.info(TAG + "Current FocusMode is: " + data); + expect(data).assertEqual(0); + console.info(TAG + "GET_FOCUS_MODE_LOCKED PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_LOCKED FAILED : " + err.message); + console.info(TAG + "GET_FOCUS_MODE_LOCKED ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_MANUAL_SUPPORTED + * @tc.name : check if focus mode manual is supported-camera0Input api + * @tc.desc : check if focus mode manual is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_MANUAL_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED to operate"); + camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + data); + expect(data).assertEqual(true); + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED PASSED: "); + } + } else { + console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED FAILED " + err.message); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_MANUAL + * @tc.name : set focus mode manual camera0 api + * @tc.desc : set focus mode manual camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_MANUAL', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL to operate"); + camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL PASSED") + expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) + } + else { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_MANUAL + * @tc.name : get focus mode manual camera0 api + * @tc.desc : get focus mode manual camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_MODE_MANUAL', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL to operate"); + camera0Input.getFocusMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL SUCCESS"); + console.info(TAG + "GET_FOCUS_MODE_MANUAL data is not null || undefined: "); + console.info(TAG + "Current FocusMode is: " + data); + expect(data).assertEqual(0); + console.info(TAG + "GET_FOCUS_MODE_MANUAL PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_MANUAL FAILED : " + err.message); + console.info(TAG + "GET_FOCUS_MODE_MANUAL ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_POINT_focus mode manual + * @tc.name : set focus Point camera0 api + * @tc.desc : set focus Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_POINT_focus mode manual', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_POINT to operate"); + camera0Input.setFocusPoint(Point, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_FOCUS_POINT PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_FOCUS_POINT FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_POINT ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_POINT_focus mode manual + * @tc.name : get focus Point camera0 api + * @tc.desc : get focus point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_POINT_focus mode manual', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_POINT to operate"); + camera0Input.getFocusPoint(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); + console.info(TAG + "Current Focus Point is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_POINT PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_POINT FAILED : " + err.message); + console.info(TAG + "GET_FOCUS_POINT ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_CONTINUOUS_SUPPORTED + * @tc.name : check if focus mode continuous is supported-camera0Input api + * @tc.desc : check if focus mode continuous is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_CONTINUOUS_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED to operate"); + camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_CONTINOUS_SUPPORTED is: " + data); + expect(data).assertEqual(true); + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED PASSED: "); + } + } else { + console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_CONTINUOUS + * @tc.name : set focus mode continuous camera0 api + * @tc.desc : set focus mode continuous camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_CONTINUOUS', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS to operate"); + camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1); + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS PASSED"); + } + else { + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_CONTINUOUS + * @tc.name : get focus mode continuous camera0 api + * @tc.desc : get focus mode continuous camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_MODE_CONTINUOUS', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS to operate"); + camera0Input.getFocusMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS SUCCESS"); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS data is not null || undefined: "); + console.info(TAG + "Current FocusMode is: " + data); + expect(data).assertEqual(1); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS FAILED : " + err.message); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_POINT_focus mode continuous + * @tc.name : set focus Point locked camera0 api + * @tc.desc : set focus Point locked camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_POINT to operate"); + camera0Input.setFocusPoint(Point, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_FOCUS_POINT PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_FOCUS_POINT FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_POINT ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_POINT_focus mode continuous + * @tc.name : get focus Point camera0 api + * @tc.desc : get focus point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_POINT to operate"); + camera0Input.getFocusPoint(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); + console.info(TAG + "Current Focus Point is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_POINT PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_POINT FAILED : " + err.message); + console.info(TAG + "GET_FOCUS_POINT ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_AUTO_SUPPORTED + * @tc.name : check if focus mode auto is supported-camera0Input api + * @tc.desc : check if focus mode auto is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_AUTO_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED to operate"); + camera0Input.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_AUTO_SUPPORTED is: " + data); + expect(data).assertEqual(true); + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED PASSED: "); + } + } else { + console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_AUTO + * @tc.name : set focus mode auto camera0 api + * @tc.desc : set focus mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO to operate"); + camera0Input.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); + if (data != null || data != undefined) { + expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2); + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO PASSED") + } + } else { + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_AUTO + * @tc.name : get focus mode auto camera0 api + * @tc.desc : get focus mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_AUTO to operate"); + camera0Input.getFocusMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering GET_FOCUS_MODE_AUTO SUCCESS"); + console.info(TAG + "GET_FOCUS_MODE_AUTO data is not null || undefined: "); + console.info(TAG + "Current FocusMode is: " + data); + expect(data).assertEqual(2); + console.info(TAG + "GET_FOCUS_MODE_AUTO PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_AUTO FAILED : " + err.message); + console.info(TAG + "GET_FOCUS_MODE_AUTO ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_POINT_focus mode auto + * @tc.name : set focus Point camera0 api + * @tc.desc : set focus Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_POINT to operate"); + camera0Input.setFocusPoint(Point, async (err, data) => { + if (!err) { + console.info(TAG + "Entering SetFocus Point, current FocusMode is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_FOCUS_POINT PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_FOCUS_POINT FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_FOCUS_POINT ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_POINT_focus mode auto + * @tc.name : get focus Point camera0 api + * @tc.desc : get focus point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_POINT to operate"); + camera0Input.getFocusPoint(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Focus Point SUCCESS: " + JSON.stringify(data)); + console.info(TAG + "Current Focus Point is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_POINT PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_POINT FAILED : " + err.message); + console.info(TAG + "GET_FOCUS_POINT ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_EXPOSURE_MODE_LOCKED_SUPPORTED + * @tc.name : check if exposure mode locked is supported-camera0Input api + * @tc.desc : check if exposure mode locked is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('IS_EXPOSURE_MODE_LOCKED_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_EXPOSURE_MODE_LOCKED_SUPPORTED to operate"); + camera0Input.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Is Exposure Mode Locked supported SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering Is Exposure Mode Locked supported data is not null || undefined"); + console.info(TAG + "Exposure_Mode_Locked_Supported is: " + data); + expect(data).assertEqual(false); + console.info(TAG + "Entering IS_EXPOSURE_MODE_LOCKED_SUPPORTED PASSED: "); + } + } else { + console.info(TAG + "IS_EXPOSURE_MODE_LOCKED_SUPPORTED FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "IS_EXPOSURE_MODE_LOCKED_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : SET_EXPOSURE_MODE_LOCKED + * @tc.name : set exposure mode locked camera0 api + * @tc.desc : set exposure mode locked camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('SET_EXPOSURE_MODE_LOCKED', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_MODE_LOCKED to operate"); + camera0Input.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure Mode Locked, current ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED); + console.info(TAG + "Entering SET_EXPOSURE_MODE_LOCKED FAILED") + expect().assertFail(); + } else { + console.info(TAG + "Entering SET_EXPOSURE_MODE_LOCKED PASSED : " + err.message); + expect(true).assertTrue(); + console.info(TAG + "Entering SET_EXPOSURE_MODE_LOCKED ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : GET_EXPOSURE_MODE_LOCKED + * @tc.name : get exposure mode locked camera0 api + * @tc.desc : get exposure mode locked camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_MODE_LOCKED', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_MODE_LOCKED to operate"); + camera0Input.getExposureMode(async (err, data) => { + if (!err) { + console.info(TAG + "Current ExposureMode is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_MODE_LOCKED PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_MODE_LOCKED FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_MODE_LOCKED ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_POINT_exposure mode locked + * @tc.name : set exposure Point camera0 api + * @tc.desc : set exposure Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_POINT to operate"); + camera0Input.setExposurePoint(Point, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_EXPOSURE_POINT PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_EXPOSURE_POINT FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_EXPOSURE_POINT ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_POINT_exposure mode locked + * @tc.name : get exposure point camera0 api + * @tc.desc : get exposure point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_POINT to operate"); + camera0Input.getExposurePoint(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Exposure point SUCCESS"); + console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_POINT PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_POINT FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_POINT ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_BIASRANGE_exposure mode continuous auto + * @tc.name : get exposure bias range camera0 api + * @tc.desc : get exposure bias range camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_BIASRANGE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_BIASRANGE to operate"); + camera0Input.getExposureBiasRange(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Exposure bias range SUCCESS"); + console.info(TAG + "Current Exposure bias range is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_BIASRANGE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_BIASRANGE FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_BIASRANGE ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_BIAS_exposure mode locked + * @tc.name : set exposure bias camera0 api + * @tc.desc : set exposure bias camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_BIAS', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_BIAS to operate"); + camera0Input.setExposureBias(-4, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure bias is: " + "-4"); + console.info(TAG + "Entering SET_EXPOSURE_BIAS PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_EXPOSURE_BIAS FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_EXPOSURE_BIAS ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_BIASVALUE_exposure mode locked + * @tc.name : get exposure bias value camera0 api + * @tc.desc : get exposure bias value camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_BIASVALUE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_BIASVALUE to operate"); + camera0Input.getExposureValue(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Exposure bias value SUCCESS"); + console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); + expect(data).assertEqual(-4); + console.info(TAG + "GET_EXPOSURE_BIASVALUE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_BIASVALUE FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_BIASVALUE ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_EXPOSURE_MODE_AUTO_SUPPORTED + * @tc.name : check if exposure mode auto is supported-camera0Input api + * @tc.desc : check if exposure mode auto is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('IS_EXPOSURE_MODE_AUTO_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_EXPOSURE_MODE_AUTO_SUPPORTED to operate"); + camera0Input.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Is Exposure Mode Auto supported SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering Is Exposure Mode Auto supported data is not null || undefined"); + console.info(TAG + "Exposure_Mode_Auto_Supported is: " + data); + expect(data).assertEqual(true); + console.info(TAG + "Entering IS_EXPOSURE_MODE_AUTO_SUPPORTED PASSED: "); + } + } else { + console.info(TAG + "IS_EXPOSURE_MODE_AUTO_SUPPORTED FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "IS_EXPOSURE_MODE_AUTO_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : SET_EXPOSURE_MODE_AUTO + * @tc.name : set exposure mode auto camera0 api + * @tc.desc : set exposure mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('SET_EXPOSURE_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_MODE_AUTO to operate"); + camera0Input.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure Mode auto,current ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_AUTO); + if (data != null || data != undefined) { + expect(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO).assertEqual(1); + console.info(TAG + "Entering SET_EXPOSURE_MODE_AUTO PASSED") + } + } else { + console.info(TAG + "Entering SET_EXPOSURE_MODE_AUTO FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_EXPOSURE_MODE_AUTO ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : GET_EXPOSURE_MODE_AUTO + * @tc.name : get exposure mode auto camera0 api + * @tc.desc : get exposure mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('GET_EXPOSURE_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_MODE_AUTO to operate"); + camera0Input.getExposureMode(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Exposure Mode SUCCESS"); + console.info(TAG + "Get Exposure Mode data is not null || undefined: "); + console.info(TAG + "Current ExposureMode is: " + data); + expect(data).assertEqual(1); + console.info(TAG + "GET_EXPOSURE_MODE_AUTO PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_MODE_AUTO FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_MODE_AUTO ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : SET_EXPOSURE_POINT_exposure mode auto + * @tc.name : set exposure Point camera0 api + * @tc.desc : set exposure Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_POINT to operate"); + camera0Input.setExposurePoint(Point, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_EXPOSURE_POINT PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_EXPOSURE_POINT FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_EXPOSURE_POINT ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_POINT_exposure mode auto + * @tc.name : get exposure point camera0 api + * @tc.desc : get exposure point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_POINT to operate"); + camera0Input.getExposurePoint(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Exposure point SUCCESS"); + console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_POINT PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_POINT FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_POINT ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_BIAS_exposure mode auto + * @tc.name : set exposure bias camera0 api + * @tc.desc : set exposure bias camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_BIAS', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_BIAS to operate"); + camera0Input.setExposureBias(1, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure bias is: " + "1"); + console.info(TAG + "Entering SET_EXPOSURE_BIAS PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_EXPOSURE_BIAS FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_EXPOSURE_BIAS ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_BIASVALUE_exposure mode auto + * @tc.name : get exposure bias value camera0 api + * @tc.desc : get exposure bias value camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_BIASVALUE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_BIASVALUE to operate"); + camera0Input.getExposureValue(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Exposure bias value SUCCESS"); + console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); + expect(data).assertEqual(1); + console.info(TAG + "GET_EXPOSURE_BIASVALUE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_BIASVALUE FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_BIASVALUE ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_EXPOSURE_MODE_CONTINUOUS_AUTO_SUPPORTED + * @tc.name : check if exposure mode continuous auto is supported-camera0Input api + * @tc.desc : check if exposure mode continuous auto is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('IS_EXPOSURE_MODE_CONTINUOUS_AUTO_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_EXPOSURE_MODE_CONTINUOUS_AUTO_SUPPORTED to operate"); + camera0Input.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Is Exposure Mode continuous Auto supported SUCCESS "); + if (data != null || data != undefined) { + console.info(TAG + "Entering Is Exposure Mode continuous Auto supported data is not null || undefined"); + console.info(TAG + "Exposure_Mode_continuous_Auto_Supported is: " + data); + expect(data).assertEqual(false); + console.info(TAG + "Entering IS_EXPOSURE_MODE_CONTINUOUS_AUTO_SUPPORTED PASSED: "); + } + } else { + console.info(TAG + "IS_EXPOSURE_MODE_CONTINUOUS_AUTO_SUPPORTED FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "IS_EXPOSURE_MODE_CONTINUOUS_AUTO_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : SET_EXPOSURE_MODE_CONTINUOUS_AUTO + * @tc.name : set exposure mode continuous auto camera0 api + * @tc.desc : set exposure mode continuous auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('SET_EXPOSURE_MODE_CONTINUOUS_AUTO', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_MODE_CONTINUOUS_AUTO to operate"); + camera0Input.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure Mode continuous auto,current ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO); + console.info(TAG + "Entering SET_EXPOSURE_MODE_CONTINUOUS_AUTO FAILED") + expect().AssertFail(); + } else { + console.info(TAG + "Entering SET_EXPOSURE_MODE_CONTINUOUS_AUTO PASSED : " + err.message); + expect(true).assertTrue(); + console.info(TAG + "Entering SET_EXPOSURE_MODE_CONTINUOUS_AUTO ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : GET_EXPOSURE_MODE_CONTINUOUS_AUTO + * @tc.name : get exposure mode continuous auto camera0 api + * @tc.desc : get exposure mode continuous auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_MODE_CONTINUOUS_AUTO', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_MODE_CONTINUOUS_AUTO to operate"); + camera0Input.getExposureMode(async (err, data) => { + if (!err) { + console.info(TAG + "Current ExposureMode is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_MODE_CONTINUOUS_AUTO PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_MODE_CONTINUOUS_AUTO FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_MODE_CONTINUOUS_AUTO ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_POINT_exposure mode continuous auto + * @tc.name : set exposure Point camera0 api + * @tc.desc : set exposure Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_POINT to operate"); + camera0Input.setExposurePoint(Point, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure Point, current ExposureMode is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_EXPOSURE_POINT PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_EXPOSURE_POINT FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_EXPOSURE_POINT ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_POINT_exposure mode continuous auto + * @tc.name : get exposure point camera0 api + * @tc.desc : get exposure point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_POINT to operate"); + camera0Input.getExposurePoint(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Exposure point SUCCESS"); + console.info(TAG + "Current Exposure Point is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_POINT PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_POINT FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_POINT ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_BIAS_exposure mode auto + * @tc.name : set exposure bias camera0 api + * @tc.desc : set exposure bias camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_BIAS', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_BIAS to operate"); + camera0Input.setExposureBias(4, async (err, data) => { + if (!err) { + console.info(TAG + "Entering Set Exposure bias is: " + "4"); + console.info(TAG + "Entering SET_EXPOSURE_BIAS PASSED") + expect(true).assertTrue(); + } else { + console.info(TAG + "Entering SET_EXPOSURE_BIAS FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering SET_EXPOSURE_BIAS ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_BIASVALUE_exposure mode continuous auto + * @tc.name : get exposure bias value camera0 api + * @tc.desc : get exposure bias value camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_BIASVALUE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_BIASVALUE to operate"); + camera0Input.getExposureValue(async (err, data) => { + if (!err) { + console.info(TAG + "Entering Get Exposure bias value SUCCESS"); + console.info(TAG + "Current Exposure bias value is: " + JSON.stringify(data)); + expect(data).assertEqual(4); + console.info(TAG + "GET_EXPOSURE_BIASVALUE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_BIASVALUE FAILED : " + err.message); + console.info(TAG + "GET_EXPOSURE_BIASVALUE ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + }) + + /** + * @tc.number : isMirrorSupported_PHOTO_OUTPUT + * @tc.name : isMirrorSupported + * @tc.desc : isMirrorSupported + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('isMirrorSupported_PHOTO_OUTPUT', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering isMirrorSupported_PHOTO_OUTPUT to operate"); + photoOutputAsync.isMirrorSupported(async (err, data) => { + if (!err) { + console.info(TAG + "Entering isMirrorSupported_PHOTO_OUTPUT is success"); + console.info(TAG + "isMirrorSupported : " + data); + expect(true).assertTrue(); + } else { + expect().assertFail(); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : setMirror_true + * @tc.name : setMirror true + * @tc.desc : setMirror true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('setMirror_true', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering setMirror_true to operate"); + photoOutputAsync.setMirror(true, async (err, data) => { + if (!err) { + console.info(TAG + "Entering setMirror_true is success:"); + console.info(TAG + "setMirror is : " + 'True'); + expect(true).assertTrue(); + } else { + expect().assertFail(); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : VIDEO_OUTPUT_START + * @tc.name : VideoOutput start async api + * @tc.desc : VideoOutput start async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_START', 0, async function (done) { + if (videoOutput == null || videoOutput == undefined) { + console.info(TAG + "Entering VIDEO_OUTPUT_START videoOutput == null || undefined") + } else { + console.info(TAG + "Entering VIDEO_OUTPUT_START to operate") + await sleep(1) + videoOutput.start(async (err, data) => { + if (!err) { + console.info(TAG + "Entering VIDEO_OUTPUT_START success: " + JSON.stringify(data)) + if (data == undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering VIDEO_OUTPUT_START FAILED: " + err.message) + } + }) + await sleep(1) + done() + } + await sleep(1) + done() + }) + + /** + * @tc.number : VIDEO_RECORDER_START + * @tc.name : VideoRecorder start async api + * @tc.desc : VideoRecorder start async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_RECORDER_START', 0, async function (done) { + if (videoRecorder == null || videoRecorder == undefined) { + console.info(TAG + 'Entering VideoRecorder start videoRecorder == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_RECORDER_START to operate') + videoRecorder.start() + console.info(TAG + 'VIDEO_RECORDER_START called'); + sleep(3); + console.info(TAG + 'Capture with photosettings1 during video - Start & setMirror: true') + photoOutputAsync.capture(photosettings1) + console.info(TAG + 'Capture during Video - End.') + expect(true).assertTrue() + console.info(TAG + 'Entering VIDEO_RECORDER_START PASSED') + console.info(TAG + 'Entering VIDEO_RECORDER_START ends here') + await sleep(1) + done() + } + await sleep(1) + done() + }) + + /** + * @tc.number : VIDEO_OUTPUT_STOP + * @tc.name : VideoOutput stop async api + * @tc.desc : VideoOutput stop async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_STOP', 0, async function (done) { + if (videoOutput == null || videoOutput == undefined) { + console.info(TAG + 'Entering VideoOutput stop videoOutput == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_OUTPUT_STOP to operate') + videoOutput.stop(async (err, data) => { + if (!err) { + console.info(TAG + 'Entering VIDEO_OUTPUT_STOP success: ' + JSON.stringify(data)) + if (data == undefined) { + expect(true).assertTrue() + } + } else { + expect().assertFail() + console.info(TAG + 'Entering VIDEO_OUTPUT_STOP FAILED: ' + err.message) + } + console.info(TAG + 'Entering VIDEO_OUTPUT_STOP ends here') + await sleep(1) + done() + }) + await sleep(1) + done() + } + }) + + /** + * @tc.number : VIDEO_RECORDER_STOP + * @tc.name : VideoRecorder stop async api + * @tc.desc : VideoRecorder stop async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_RECORDER_STOP', 0, async function (done) { + if (videoRecorder == null || videoRecorder == undefined) { + console.info(TAG + 'Entering VideoRecorder stop videoRecorder == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_RECORDER_STOP to operate') + videoRecorder.stop() + console.info(TAG + 'VideoRecorder stop stopVideo done.') + console.info(TAG + 'Entering VIDEO_RECORDER_STOP PASSED') + expect(true).assertTrue() + } + await sleep(1) + done() + }) + + /** + * @tc.number : CAPTURE_SESSION_STOP + * @tc.name : CaptureSession stop async api + * @tc.desc : CaptureSession stop async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_STOP', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + 'Entering CaptureSession stop captureSession == null || undefined') + } else { + console.info(TAG + 'Entering CAPTURE_SESSION_STOP to operate') + await sleep(1) + captureSession.stop((err, data) => { + if (!err) { + console.info(TAG + 'Entering CaptureSession stop success') + expect(true).assertTrue() + console.info(TAG + 'Entering CAPTURE_SESSION_STOP PASSED') + } else { + console.info(TAG + 'Entering CAPTURE_SESSION_STOP FAILED: ' + err.message) + expect().assertFail(); + } + console.info(TAG + 'Entering CAPTURE_SESSION_STOP ends here') + done() + }) + await sleep(1) + done() + } + }) + + /** + * @tc.number : CAPTURE_SESSION_RELEASE + * @tc.name : CaptureSession release async api + * @tc.desc : CaptureSession release async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_RELEASE', 0, async function (done) { + if (captureSession == null || captureSession == undefined) { + console.info(TAG + 'Entering CaptureSession release captureSession == null || undefined') + } else { + console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE to operate') + await sleep(1) + captureSession.release(async (err, data) => { + if (!err) { + console.info(TAG + 'Entering CaptureSession release success') + if (data != null || data != undefined) { + console.info(TAG + 'Entering CaptureSession release data is not null || undefined') + expect(true).assertTrue() + console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE PASSED') + } + } else { + console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE FAILED: ' + err.message) + expect().assertFail(); + } + console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE ends here') + await sleep(1) + done() + }) + await sleep(1) + done() + } + }) + + /** + * @tc.number : VIDEOOUPUT_RELEASE_SUCCESS + * @tc.name : videooutput release api + * @tc.desc : videooutput release api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEOOUPUT_RELEASE_SUCCESS', 0, async function (done) { + if (videoOutput == null || videoOutput == undefined) { + console.info(TAG + "Entering videooutput.release previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering VIDEOOUPUT_RELEASE_SUCCESS to operate"); + videoOutput.release(async (err, data) => { + if (!err) { + console.info(TAG + "Entering videooutput.release success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering videooutput.release data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering VIDEOOUPUT_RELEASE_SUCCESS PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering VIDEOOUPUT_RELEASE_SUCCESS FAILED: " + err.message); + console.info(TAG + "Entering VIDEOOUPUT_RELEASE_SUCCESS ends here"); + await sleep(1); + done(); + } + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : PREVIEWOUPUT_RELEASE_SUCCESS + * @tc.name : previewOutput release api + * @tc.desc : previewOutput release api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEWOUPUT_RELEASE_SUCCESS', 0, async function (done) { + if (previewOutput == null || previewOutput == undefined) { + console.info(TAG + "Entering PREVIEWOUPUT_RELEASE_SUCCESS previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEWOUPUT_RELEASE_SUCCESS to operate"); + previewOutput.release(async (err, data) => { + if (!err) { + console.info(TAG + "Entering previewOutput.release success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering previewOutput.release data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering previewOutput.release PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering PREVIEWOUPUT_RELEASE_SUCCESS FAILED: " + err.message); + console.info(TAG + "Entering previewOutput.release ends here"); + await sleep(1); + done(); + } + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : PHOTOOUPUT_RELEASE + * @tc.name : photoOutput release api + * @tc.desc : photoOutput release api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTOOUPUT_RELEASE', 0, async function (done) { + if (photoOutputAsync == null || photoOutputAsync == undefined) { + console.info(TAG + "Entering PHOTOOUPUT_RELEASE photoOutputAsync == null || undefined"); + } else { + console.info(TAG + "Entering PHOTOOUPUT_RELEASE to operate"); + photoOutputAsync.release(async (err, data) => { + if (!err) { + console.info(TAG + "Entering photoOutputAsync.release success"); + expect(true).assertTrue(); + console.info(TAG + "Entering PHOTOOUPUT_RELEASE PASSED"); + } else { + expect().assertFail(); + console.info(TAG + "Entering PHOTOOUPUT_RELEASE FAILED: " + err.message); + console.info(TAG + "Entering photoOutputAsync.release ends here"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : CAMERAINPUT_RELEASE_SUCCESS + * @tc.name : camera Input release api + * @tc.desc : camera Input release api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAMERAINPUT_RELEASE_SUCCESS', 0, async function (done) { + if (camera0Input == null || camera0Input == undefined) { + console.info(TAG + "Entering camera0Input.release camera0Input == null || undefined"); + } else { + console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS to operate"); + camera0Input.release(async (err, data) => { + if (!err) { + console.info(TAG + "Entering camera0Input.release success"); + if (data != null || data != undefined) { + console.info(TAG + "Entering camera0Input.release data is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS PASSED"); + } + } else { + expect().assertFail(); + console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS FAILED: " + err.message); + console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS ends here"); + await sleep(1); + done(); + } + }) + await sleep(1); + done(); + } + }) + }) +} \ No newline at end of file diff --git a/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..5e82a2e527d6ba246e6911e04518bafc81abb9c5 --- /dev/null +++ b/multimedia/camera/camera_js_standard/src/main/ets/MainAbility/test/CameraJSUnitVideoPromise.test.ets @@ -0,0 +1,3807 @@ +/* + * 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 cameraObj from '@ohos.multimedia.camera' +import media from '@ohos.multimedia.media' +import image from '@ohos.multimedia.image'; +import mediaLibrary from '@ohos.multimedia.mediaLibrary' +import fileio from '@ohos.fileio'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl' +import bundle from '@ohos.bundle' + +// @ts-nocheck +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; + +let TAG = 'CameraModuleTest: ' +var cameraManagerPromise +var camerasArrayPromise +var camera0InputPromise +var previewOutputPromise +var videoRecorder +var photoOutputPromise +let fdPath; +let fileAsset; +let fdNumber; + +var minFrameRate_Grp0=12; +var maxFrameRate_Grp0=12; +var minFrameRate_Mix=14; +var maxFrameRate_Mix=15; +var minFrameRate_Err1=11; +var maxFrameRate_Err1=31; +var minFrameRate_Err2=14; +var maxFrameRate_Err2=28; +var minFrameRate_Err3=16; +var maxFrameRate_Err3=25; +var minFrameRate_Grp20=30; +var maxFrameRate_Grp20=30; + +var Point1 = { x: 1, y: 1 } +var Point2 = { x: 2, y: 2 } +var Point3 = { x: 3, y: 3 } +var photosettings1 = { + rotation: 0, + quality: 0, + location: { + latitude: 12.9705, + longitude: 77.7329, + altitude: 920.0000, + }, +} +var photosettings2 = { + rotation: 90, + quality: 1, + location: { + latitude: 20, + longitude: 78, + altitude: 8586, + }, +} + +var photosettings3 = { + quality: 2, + location: { + latitude: 0, + longitude: 0, + altitude: 0, + }, +} +var photosettings4 = { + rotation: 180, + location: { + latitude: -1, + longitude: -1, + altitude: -1, + }, +} + +var photosettings5 = { + rotation: 270, +} +let configFile = { + audioBitrate: 48000, + audioChannels: 2, + audioCodec: 'audio/mp4a-latm', + audioSampleRate: 48000, + durationTime: 1000, + fileFormat: 'mp4', + videoBitrate: 48000, + videoCodec: 'video/mp4v-es', + videoFrameWidth: 640, + videoFrameHeight: 480, + videoFrameRate: 30 +} + +let videoConfig = { + audioSourceType: 1, + videoSourceType: 0, + profile: configFile, + url: 'file:///data/media/01.mp4', + orientationHint: 0, + location: { latitude: 30, longitude: 130 }, + maxSize: 100, + maxDuration: 500 +} +var surfaceId1 +var videoId +var videoOutputPromise +var captureSessionPromise + +export default function cameraJSUnitVideoPromise(surfaceId: any) { + + async function getImageReceiverSurfaceId() { + console.log(TAG + 'Entering create Image receiver') + var receiver = image.createImageReceiver(640, 480, 4, 8) + console.log(TAG + 'before receiver check') + if (receiver !== undefined) { + console.log(TAG + 'Receiver is ok') + surfaceId1 = await receiver.getReceivingSurfaceId() + console.log(TAG + 'Received id: ' + JSON.stringify(surfaceId1)) + } else { + console.log(TAG + 'Receiver is not ok') + } + } + + function sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve(1) + }, time * 1000) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + async function applyPermission() { + let appInfo = await bundle.getApplicationInfo('com.open.harmony.multimedia.cameratest', 0, 100); + let atManager = abilityAccessCtrl.createAtManager(); + if (atManager != null) { + let tokenID = appInfo.accessTokenId; + console.info('[permission] case accessTokenID is ' + tokenID); + let permissionName1 = 'ohos.permission.CAMERA'; + let permissionName2 = 'ohos.permission.MICROPHONE'; + let permissionName3 = 'ohos.permission.MEDIA_LOCATION'; + let permissionName4 = 'ohos.permission.READ_MEDIA'; + let permissionName5 = 'ohos.permission.WRITE_MEDIA'; + await atManager.grantUserGrantedPermission(tokenID, permissionName1, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName2, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName3, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName4, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + await atManager.grantUserGrantedPermission(tokenID, permissionName5, 1).then((result) => { + console.info('[permission] case grantUserGrantedPermission success :' + result); + }).catch((err) => { + console.info('[permission] case grantUserGrantedPermission failed :' + err); + }); + } else { + console.info('[permission] case apply permission failed, createAtManager failed'); + } + } + + async function getFd(pathName) { + let displayName = pathName; + const mediaTest = mediaLibrary.getMediaLibrary(); + let fileKeyObj = mediaLibrary.FileKey; + let mediaType = mediaLibrary.MediaType.VIDEO; + let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); + let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); + if (dataUri != undefined) { + let args = dataUri.id.toString(); + let fetchOp = { + selections: fileKeyObj.ID + "=?", + selectionArgs: [args], + } + let fetchFileResult = await mediaTest.getFileAssets(fetchOp); + fileAsset = await fetchFileResult.getAllObject(); + fdNumber = await fileAsset[0].open('Rw'); + fdPath = "fd://" + fdNumber.toString(); + } + } + + async function closeFd() { + if (fileAsset != null) { + await fileAsset[0].close(fdNumber).then(() => { + console.info('[mediaLibrary] case close fd success'); + }).catch((err) => { + console.info('[mediaLibrary] case close fd failed'); + }); + } else { + console.info('[mediaLibrary] case fileAsset is null'); + } + } + + async function getvideosurface() { + await getFd('01.mp4'); + videoConfig.url = fdPath; + media.createVideoRecorder((err, recorder) => { + console.info(TAG + 'createVideoRecorder called') + videoRecorder = recorder + console.info(TAG + 'videoRecorder is :' + JSON.stringify(videoRecorder)) + console.info(TAG + 'videoRecorder.prepare called.') + videoRecorder.prepare(videoConfig, (err) => { + console.info(TAG + 'videoRecorder.prepare success.') + }) + videoRecorder.getInputSurface((err, id) => { + console.info(TAG + 'getInputSurface called') + videoId = id + console.info(TAG + 'getInputSurface surfaceId: ' + JSON.stringify(videoId)) + }) + }) + } + + describe('VideoModePromise', function () { + console.info(TAG + '----------Camera-VideoMode-Promise--------------') + + beforeAll(async function () { + await applyPermission(); + console.info('beforeAll case'); + }) + + beforeEach(function () { + sleep(5); + console.info('beforeEach case'); + }) + + afterEach(async function () { + await closeFd(); + console.info('afterEach case'); + }) + + afterAll(function () { + console.info('afterAll case'); + }) + + /** + * @tc.number : GET_CAMERA_MANAGER_PROMISE + * @tc.name : Create camera manager instance promise api + * @tc.desc : Create camera manager instance promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERA_MANAGER_PROMISE', 0, async function (done) { + console.info('--------------GET_CAMERA_MANAGER_PROMISE--------------') + cameraManagerPromise = await cameraObj.getCameraManager(null) + console.info(TAG + 'Entering Get cameraManagerPromise cameraManagerPromise: ' + cameraManagerPromise) + if (cameraManagerPromise != null && cameraManagerPromise != undefined) { + expect(true).assertTrue() + console.info(TAG + 'Entering GET_CAMERA_MANAGER_PROMISE PASSED') + } else { + expect().assertFail() + console.info(TAG + 'Entering GET_CAMERA_MANAGER_PROMISE FAILED') + } + console.info(TAG + 'Entering GET_CAMERA_MANAGER_PROMISE ends here') + await sleep(1) + done() + }) + + /** + * @tc.number : CAMERA_STATUS_CALLBACK + * @tc.name : camera status callback on CameraManager async api + * @tc.desc : camera status callback on CameraManager async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAMERA_STATUS_CALLBACK', 0, async function (done) { + if (cameraManagerPromise == null || cameraManagerPromise == undefined) { + console.info(TAG + 'Entering Camera status Callback cameraManagerPromise == null || undefined') + } else { + console.info(TAG + 'Entering CAMERA_STATUS_CALLBACK to operate') + await sleep(1) + cameraManagerPromise.on('cameraStatus', async (err, data) => { + if (!err) { + console.info(TAG + "Camera status Callback on cameraManagerPromise is success"); + if (data != null || data != undefined) { + console.info(TAG + "CAMERA_STATUS_CALLBACK CameraStatusInfo_Camera: " + data.camera); + console.info(TAG + "CAMERA_STATUS_CALLBACK CameraStatusInfo_Status: " + data.status); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "CAMERA_STATUS_CALLBACK FAILED: " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : GET_CAMERAS_PROMISE + * @tc.name : Create camera manager instance promise api + * @tc.desc : Create camera manager instance promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_CAMERAS_PROMISE', 0, async function (done) { + console.info('--------------GET_CAMERAS_PROMISE--------------') + camerasArrayPromise = await cameraManagerPromise.getCameras() + console.info(TAG + 'Entering Get Cameras Promise: ' + JSON.stringify(camerasArrayPromise)) + if (camerasArrayPromise != null && camerasArrayPromise.length > 0) { + console.info(TAG + 'Entering Get Cameras Promise success') + for (var i = 0; i < camerasArrayPromise.length; i++) { + // Get the variables from camera object + var cameraId = camerasArrayPromise[i].cameraId + console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Id: ' + cameraId) + var cameraPosition = camerasArrayPromise[i].cameraPosition + console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Position: ' + cameraPosition) + var cameraType = camerasArrayPromise[i].cameraType + console.info(TAG + 'Entering Get Cameras Promise camera' + i + 'Type: ' + cameraType) + var connectionType = camerasArrayPromise[i].connectionType + console.info(TAG + 'Entering Get Cameras Promise connection' + i + 'Type: ' + connectionType) + } + expect(true).assertTrue() + console.info(TAG + 'Entering GET_CAMERAS_PROMISE PASSED') + } else { + expect().assertFail() + console.info(TAG + 'Entering GET_CAMERAS_PROMISE FAILED') + } + console.info(TAG + 'Entering GET_CAMERAS_PROMISE ends here') + await sleep(1) + done() + }) + + /*CAMERA-0 Scripts*/ + /** + * @tc.number : CREATE_CAMERA_INPUT_PROMISE + * @tc.name : Create camerainput from camera-0 cameraId promise api + * @tc.desc : Create camerainput from camera-0 cameraId promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAMERA_INPUT_PROMISE', 0, async function (done) { + console.info('--------------CREATE_CAMERA_INPUT_PROMISE--------------') + camera0InputPromise = await cameraManagerPromise.createCameraInput(camerasArrayPromise[0].cameraId) + console.info(TAG + 'Entering Create camera input promise camera0InputPromise: ' + JSON.stringify(camera0InputPromise)) + if (camera0InputPromise != null && camera0InputPromise != undefined) { + console.info(TAG + 'Entering Create camera input promise camera0InputPromise is not null || undefined') + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_PROMISE PASSED') + } else { + expect().assertFail() + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_PROMISE FAILED') + } + console.info(TAG + 'Entering CREATE_CAMERA_INPUT_PROMISE ends here') + await sleep(1) + done() + }) + + /** + * @tc.number : CAMERA_INPUT_CALLBACK_ON_ERROR + * @tc.name : Photo output callback on error api + * @tc.desc : Photo output callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAMERA_INPUT_CALLBACK_ON_ERROR', 0, async function (done) { + if (camera0InputPromise == null || camera0InputPromise == undefined) { + console.info(TAG + "Entering Camera input error callback camera0InputPromise == null || undefined"); + } else { + console.info(TAG + "Entering CAMERA_INPUT_CALLBACK_ON_ERROR to operate"); + camera0InputPromise.on('error', async (err, data) => { + if (!err) { + console.info(TAG + "camera0InputPromise error callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "CAMERA_INPUT_CALLBACK_ON_ERROR with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "CAMERA_INPUT_CALLBACK_ON_ERROR FAILED: " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : CREATE_PREVIEW_OUTPUT_PROMISE + * @tc.name : Create previewoutput promise api + * @tc.desc : Create previewoutput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_PREVIEW_OUTPUT_PROMISE', 0, async function (done) { + console.info('--------------CREATE_PREVIEW_OUTPUT_PROMISE--------------') + previewOutputPromise = await cameraObj.createPreviewOutput(surfaceId) + console.info(TAG + 'Entering Create previewOutputPromise: ' + JSON.stringify(previewOutputPromise)) + if (previewOutputPromise != null && previewOutputPromise != undefined) { + console.info(TAG + 'Entering Create previewOutputPromise is not null || undefined') + expect(true).assertTrue(); + console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_PROMISE PASSED') + } else { + expect().assertFail(); + console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_PROMISE FAILED') + } + console.info(TAG + 'Entering CREATE_PREVIEW_OUTPUT_PROMISE ends here') + await sleep(1) + done() + }) + + /** + * @tc.number : FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT + * @tc.name : FocusStateChange callback api + * @tc.desc : FocusStateChange callback api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT', 0, async function (done) { + if (camera0InputPromise == null || camera0InputPromise == undefined) { + console.info(TAG + "Entering FocusStateChange callback previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT to operate"); + camera0InputPromise.on('focusStateChange', async (err, data) => { + if (!err) { + console.info(TAG + "FocusState callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Current FocusState is : " + data); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "FOCUSSTATECHANGE_CALLBACK_ON_CAMERAINPUT FAILED: " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT + * @tc.name : ExposureStateChange callback api + * @tc.desc : ExposureStateChange callback api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT', 0, async function (done) { + if (camera0InputPromise == null || camera0InputPromise == undefined) { + console.info(TAG + "Entering ExposureStateChange callback previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT to operate"); + camera0InputPromise.on('exposureStateChange', async (err, data) => { + if (!err) { + console.info(TAG + "ExposureStateChange callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "Current ExposureStateChange is: " + data); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "EXPOSURESTATECHANGE_CALLBACK_ON_CAMERAINPUT FAILED: " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_ERROR + * @tc.name : PreviewOutput callback onerror async api + * @tc.desc : PreviewOutput callback onerror async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_ERROR', 0, async function (done) { + if (previewOutputPromise == null || previewOutputPromise == undefined) { + console.info(TAG + 'Entering PreviewOutputError callback previewOutputPromise == null || undefined') + } else { + console.info(TAG + 'Entering PREVIEW_OUTPUT_CALLBACK_ON_ERROR to operate') + await sleep(1) + previewOutputPromise.on('error', async (err, data) => { + if (!err) { + console.info(TAG + "PreviewOutputError callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_ERROR with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_ERROR FAILED: " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : CREATE_VIDEO_OUTPUT_PROMISE + * @tc.name : Create videooutput promise api + * @tc.desc : Create videooutput promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_VIDEO_OUTPUT_PROMISE', 0, async function (done) { + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_PROMISE to operate') + await getvideosurface() + await sleep(2) + videoOutputPromise = await cameraObj.createVideoOutput(videoId) + console.info(TAG + 'Entering Create videoOutputPromise: ' + videoOutputPromise) + if (videoOutputPromise != null && videoOutputPromise != undefined) { + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_PROMISE PASSED') + } else { + expect().assertFail(); + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_PROMISE FAILED') + } + console.info(TAG + 'Entering CREATE_VIDEO_OUTPUT_PROMISE ends here'); + await sleep(1); + done(); + }) + + /** + * @tc.number : VIDEO_OUTPUT_CALLBACK_ON_ERROR + * @tc.name : VideoOutput callback onerror async api + * @tc.desc : VideoOutput callback onerror async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_CALLBACK_ON_ERROR', 0, async function (done) { + if (videoOutputPromise == null || videoOutputPromise == undefined) { + console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_ERROR videoOutputPromise == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_ERROR to operate') + await sleep(1) + videoOutputPromise.on('error', async (err, data) => { + if (!err) { + console.info(TAG + 'VideoOutput Errorcallback is success') + if (data != null || data != undefined) { + console.info(TAG + "VIDEO_OUTPUT_CALLBACK_ON_ERROR with ErrorCode: " + data.code); + expect(true).assertTrue() + } + } else { + expect().assertFail() + console.info(TAG + "VIDEO_OUTPUT_CALLBACK_ON_ERROR FAILED: " + err.message); + } + await sleep(1) + done() + }) + await sleep(1) + done(); + } + }) + + /*PhotoOutput APIs test script*/ + /** + * @tc.number : CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE + * @tc.name : Create PhotoOutput instance promise api + * @tc.desc : Create PhotoOutput instance promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE', 0, async function (done) { + console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE to operate"); + console.info(TAG + 'Entering getImageReceiverSurfaceId') + await getImageReceiverSurfaceId() + await sleep(1) + photoOutputPromise = await cameraObj.createPhotoOutput(surfaceId1); + console.info(TAG + "Entering createPhotoOutput success"); + if (photoOutputPromise != null || photoOutputPromise != undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering CREATE_PHOTO_OUTPUT_SUCCESS_PROMISE FAILED : "); + console.info(TAG + "Entering createPhotoOutput ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : PHOTO_OUTPUT_CALLBACK_ON_ERROR + * @tc.name : Photo output callback on error api + * @tc.desc : Photo output callback on error api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_OUTPUT_CALLBACK_ON_ERROR', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering Photo output callback on error photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_OUTPUT_CALLBACK_ON_ERROR to operate"); + photoOutputPromise.on('error', async (err, data) => { + if (!err) { + console.info(TAG + "PhotoOutputError callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "PHOTO_OUTPUT_CALLBACK_ON_ERROR with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PHOTO_OUTPUT_CALLBACK_ON_ERROR FAILED: " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : CREATE_CAPTURE_SESSION_PROMISE + * @tc.name : Create capturesession promise api + * @tc.desc : Create capturesession promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CREATE_CAPTURE_SESSION_PROMISE', 0, async function (done) { + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_PROMISE to operate') + captureSessionPromise = await cameraObj.createCaptureSession(null) + console.info(TAG + 'Entering Create captureSessionPromise: ' + captureSessionPromise) + if (captureSessionPromise != null && captureSessionPromise != undefined) { + expect(true).assertTrue() + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_PROMISE PASSED') + } else { + expect().assertFail() + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_PROMISE FAILED') + } + console.info(TAG + 'Entering CREATE_CAPTURE_SESSION_PROMISE ends here'); + await sleep(1); + done(); + }) + + /** + * @tc.number : CAP_SES_CALLBACK_ON_ERROR + * @tc.name : CaptureSession callback onerror async api + * @tc.desc : CaptureSession callback onerror async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAP_SES_CALLBACK_ON_ERROR', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + 'Entering captureSession errorcallback captureSessionPromise == null || undefined') + } else { + console.info(TAG + 'Entering CAP_SES_CALLBACK_ON_ERROR to operate') + await sleep(1) + captureSessionPromise.on('error', async (err, data) => { + if (!err) { + console.info(TAG + " captureSession errorcallback is success"); + if (data != null || data != undefined) { + console.info(TAG + "CAP_SES_CALLBACK_ON_ERROR with ErrorCode: " + data.code); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "CAP_SES_CALLBACK_ON_ERROR FAILED: " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /*CaptureSession APIs*/ + /** + * @tc.number : BEGIN_CONFIG_SUCCESS_PROMISE + * @tc.name : CaptureSession_Begin config promise api + * @tc.desc : CaptureSession_Begin config promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('BEGIN_CONFIG_SUCCESS_PROMISE', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + "Entering Create captureSession == null || undefined"); + } else { + console.info(TAG + "Entering BEGIN_CONFIG_SUCCESS_PROMISE to operate"); + const promise = await captureSessionPromise.beginConfig(); + console.info(TAG + "Entering beginConfig success:"); + if (promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering BEGIN_CONFIG_SUCCESS_PROMISE beginConfig PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering BEGIN_CONFIG_SUCCESS_PROMISE FAILED : "); + } + console.info(TAG + "Entering BEGIN_CONFIG_SUCCESS_PROMISE ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : ADD_INPUT_SUCCESS_PROMISE + * @tc.name : Add Input with camera0Input api + * @tc.desc : Add Input with camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_INPUT_SUCCESS_PROMISE', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + "Entering Add Input captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE to operate"); + const Promise = await captureSessionPromise.addInput(camera0InputPromise); + console.info(TAG + "Entering Add Input success"); + if (Promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE addInput PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE FAILED: "); + } + console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE ends here"); + await sleep(1); + done(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE + * @tc.name : Add output with camera0Input api + * @tc.desc : Add output with camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + "Entering Add preview output captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE to operate"); + const promise = await captureSessionPromise.addOutput(previewOutputPromise); + console.info(TAG + "Entering Add preview output : Success"); + if (promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE FAILED : "); + } + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE ends here"); + await sleep(1); + done(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : ADD_OUTPUT_VIDEO_SUCCESS + * @tc.name : Add output with video output api + * @tc.desc : Add output with video output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_VIDEO_SUCCESS', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + "Entering Add video output captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_VIDEO_SUCCESS to operate"); + const promise = await captureSessionPromise.addOutput(videoOutputPromise); + console.info(TAG + "Entering Add video output success"); + if (promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_VIDEO_SUCCESS PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_VIDEO_SUCCESS FAILED: "); + } + console.info(TAG + "Entering ADD_OUTPUT_VIDEO_SUCCESS ends here"); + await sleep(1); + done(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : ADD_OUTPUT_PHOTO + * @tc.name : Add output with photo output api + * @tc.desc : Add output with photo output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PHOTO', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + "Entering Add output with photo output captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_PHOTO to operate"); + const promise = await captureSessionPromise.addOutput(photoOutputPromise); + console.info(TAG + "Entering Add output with photo output success"); + if (promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO FAILED "); + } + console.info(TAG + "Entering ADD_OUTPUT_PHOTO ends here"); + await sleep(1); + done(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : REMOVE_INPUT_SUCCESS + * @tc.name : remove input api + * @tc.desc : remove input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('REMOVE_INPUT_SUCCESS', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS to operate"); + const Promise = await captureSessionPromise.removeInput(camera0InputPromise); + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS success " + Promise); + if (Promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS FAILED: "); + } + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS ends here"); + await sleep(1); + done(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : REMOVE_PREVIEW_OUTPUT_SUCCESS + * @tc.name : Remove preview Output api + * @tc.desc : Remove preview Output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('REMOVE_PREVIEW_OUTPUT_SUCCESS', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS to operate"); + const Promise = await captureSessionPromise.removeOutput(previewOutputPromise); + console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS success " + Promise); + if (Promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS FAILED: "); + } + console.info(TAG + "Entering REMOVE_PREVIEW_OUTPUT_SUCCESS ends here"); + await sleep(1); + done(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : REMOVE_PHOTO_OUTPUT_SUCCESS + * @tc.name : Remove photo Output api + * @tc.desc : Remove photo Output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('REMOVE_PHOTO_OUTPUT_SUCCESS', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS to operate"); + const Promise = await captureSessionPromise.removeOutput(photoOutputPromise); + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS addInput success " + Promise); + if (Promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS addInput PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS FAILED: "); + } + console.info(TAG + "Entering REMOVE_INPUT_SUCCESS ends here"); + await sleep(1); + done(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : REMOVE_VIDEO_OUTPUT_SUCCESS + * @tc.name : Remove video Output api + * @tc.desc : Remove video Output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('REMOVE_VIDEO_OUTPUT_SUCCESS', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS to operate"); + const Promise = await captureSessionPromise.removeOutput(videoOutputPromise); + console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS success " + Promise); + if (Promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS FAILED: "); + } + console.info(TAG + "Entering REMOVE_VIDEO_OUTPUT_SUCCESS ends here"); + await sleep(1); + done(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : ADD_INPUT_SUCCESS_PROMISE + * @tc.name : Add Input with camera0Input api + * @tc.desc : Add Input with camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_INPUT_SUCCESS_PROMISE', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE to operate"); + const Promise = await captureSessionPromise.addInput(camera0InputPromise); + console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE addInput success"); + if (Promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE addInput PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE FAILED: "); + } + console.info(TAG + "Entering ADD_INPUT_SUCCESS_PROMISE ends here"); + await sleep(1); + done(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE + * @tc.name : Add output with camera0Input api + * @tc.desc : Add output with camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE to operate"); + const promise = await captureSessionPromise.addOutput(previewOutputPromise); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE : Success"); + if (promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE FAILED"); + } + console.info(TAG + "Entering ADD_OUTPUT_PREVIEW_SUCCESS_PROMISE ends here"); + await sleep(1); + done(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : ADD_OUTPUT_PHOTO_SUCCESS + * @tc.name : Add output with photo output api + * @tc.desc : Add output with photo output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_PHOTO_SUCCESS', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS to operate"); + const promise = await captureSessionPromise.addOutput(photoOutputPromise); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS success"); + if (promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS FAILED "); + } + console.info(TAG + "Entering ADD_OUTPUT_PHOTO_SUCCESS ends here"); + await sleep(1); + done(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : ADD_OUTPUT_VIDEO_SUCCESS + * @tc.name : Add output with video output api + * @tc.desc : Add output with video output api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('ADD_OUTPUT_VIDEO_SUCCESS', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + "Entering ADD_OUTPUT_VIDEO_SUCCESS captureSession == null || undefined"); + } else { + console.info(TAG + "Entering ADD_OUTPUT_VIDEO_SUCCESS to operate"); + const promise = await captureSessionPromise.addOutput(videoOutputPromise); + console.info(TAG + "Entering ADD_OUTPUT_VIDEO_SUCCESS success"); + if (promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering ADD_OUTPUT_VIDEO_SUCCESS PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "Entering ADD_OUTPUT_VIDEO_SUCCESS FAILED: "); + } + console.info(TAG + "Entering ADD_OUTPUT_VIDEO_SUCCESS ends here"); + await sleep(1); + done(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FRAME_RATE_RANGE + * @tc.name : get frame rate range camera0 api + * @tc.desc : get frame rate range promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FRAME_RATE_RANGE', 0, async function (done) { + console.info(TAG + "Entering GET_FRAME_RATE_RANGE to operate"); + await videoOutputPromise.getFrameRateRange() + .then(function (data) { + console.info(TAG + "Entering get frame rate range SUCCESS "); + console.info(TAG + "Entering GET_FRAME_RATE_RANGE PASSED : " + JSON.stringify(data)) + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering GET_FRAME_RATE_RANGE FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering GET_FRAME_RATE_RANGE ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FRAME_RATE_RANGE_Grp0 + * @tc.name : set frame rate range camera0 api + * @tc.desc : set frame rate range promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FRAME_RATE_RANGE_Grp0', 0, async function (done) { + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Grp0 to operate"); + await videoOutputPromise.setFrameRateRange(minFrameRate_Grp0,maxFrameRate_Grp0) + .then(function (data) { + console.info(TAG + "Entering setFrameRateRange SUCCESS"); + console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "SET_FRAME_RATE_RANGE_Grp0 PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "SET_FRAME_RATE_RANGE_Grp0 FAILED: " + err.message); + }); + console.info(TAG + "SET_FRAME_RATE_RANGE_Grp0 ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FRAME_RATE_RANGE_MIX + * @tc.name : set frame rate range camera0 api + * @tc.desc : set frame rate range promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FRAME_RATE_RANGE_MIX', 0, async function (done) { + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_MIX to operate"); + await videoOutputPromise.setFrameRateRange(minFrameRate_Mix,maxFrameRate_Mix) + .then(function (data) { + console.info(TAG + "Entering setFrameRateRange"); + console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); + expect().assertFail(); + console.info(TAG + "SET_FRAME_RATE_RANGE_MIX FAILED"); + }) + .catch((err) => { + expect(true).assertTrue(); + console.info(TAG + "SET_FRAME_RATE_RANGE_MIX PASSED: " + err.message); + }); + console.info(TAG + "SET_FRAME_RATE_RANGE_MIX ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FRAME_RATE_RANGE_Err1 + * @tc.name : set frame rate range camera0 api + * @tc.desc : set frame rate range promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FRAME_RATE_RANGE_Err1', 0, async function (done) { + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Err1 to operate"); + await videoOutputPromise.setFrameRateRange(minFrameRate_Err1,maxFrameRate_Err1) + .then(function (data) { + console.info(TAG + "Entering setFrameRateRange"); + console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); + expect().assertFail(); + console.info(TAG + "SET_FRAME_RATE_RANGE_Err1 FAILED"); + }) + .catch((err) => { + expect(true).assertTrue(); + console.info(TAG + "SET_FRAME_RATE_RANGE_Err1 PASSED: " + err.message); + }); + console.info(TAG + "SET_FRAME_RATE_RANGE_Err1 ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FRAME_RATE_RANGE_Err2 + * @tc.name : set frame rate range camera0 api + * @tc.desc : set frame rate range promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FRAME_RATE_RANGE_Err2', 0, async function (done) { + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Err2 to operate"); + await videoOutputPromise.setFrameRateRange(minFrameRate_Err2,maxFrameRate_Err2) + .then(function (data) { + console.info(TAG + "Entering setFrameRateRange SUCCESS"); + console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); + expect().assertFail(); + console.info(TAG + "SET_FRAME_RATE_RANGE_Err2 FAILED"); + }) + .catch((err) => { + expect(true).assertTrue(); + console.info(TAG + "SET_FRAME_RATE_RANGE_Err2 PASSED: " + err.message); + }); + console.info(TAG + "SET_FRAME_RATE_RANGE_Err2 ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FRAME_RATE_RANGE_Err3 + * @tc.name : set frame rate range camera0 api + * @tc.desc : set frame rate range promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FRAME_RATE_RANGE_Err3', 0, async function (done) { + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Err3 to operate"); + await videoOutputPromise.setFrameRateRange(minFrameRate_Err3,maxFrameRate_Err3) + .then(function (data) { + console.info(TAG + "Entering setFrameRateRange SUCCESS"); + console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); + expect().assertFail(); + console.info(TAG + "SET_FRAME_RATE_RANGE_Err3 FAILED"); + }) + .catch((err) => { + expect(true).assertTrue(); + console.info(TAG + "SET_FRAME_RATE_RANGE_Err3 PASSED: " + err.message); + }); + console.info(TAG + "SET_FRAME_RATE_RANGE_Err3 ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FRAME_RATE_RANGE_Grp20 + * @tc.name : set frame rate range camera0 api + * @tc.desc : set frame rate range promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FRAME_RATE_RANGE_Grp20', 0, async function (done) { + console.info(TAG + "Entering SET_FRAME_RATE_RANGE_Grp20 to operate"); + await videoOutputPromise.setFrameRateRange(minFrameRate_Grp20,maxFrameRate_Grp20) + .then(function (data) { + console.info(TAG + "Entering setFrameRateRange SUCCESS"); + console.info(TAG + "Current FrameRateRange is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "SET_FRAME_RATE_RANGE_Grp20 PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "SET_FRAME_RATE_RANGE_Grp20 FAILED: " + err.message); + }); + console.info(TAG + "SET_FRAME_RATE_RANGE_Grp20 ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : ISVIDEOSTABILIZATIONMODESUPPORTEDOFF + * @tc.name : isVideoStabilizationModeSupportedOff + * @tc.desc : isVideoStabilizationModeSupported promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('ISVIDEOSTABILIZATIONMODESUPPORTEDOFF', 0, async function (done) { + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTEDOFF to operate"); + await captureSessionPromise.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.OFF) + .then(function (data){ + console.info(TAG + "Entering is Video Stabilization Mode OFF Supported SUCCESS "); + console.info(TAG + "isVideoStabilizationModeSupported : " + data); + expect(data).assertEqual(true); + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTEDOFF PASSED"); + }) + .catch((err) => { + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTEDOFF FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTEDOFF ends here"); + }); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : SET_VIDEOSTABILIZATIONMODEOFF + * @tc.name : SetVideoStabilizationModeOff + * @tc.desc : SetVideoStabilizationModeOff promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('SET_VIDEOSTABILIZATIONMODEOFF', 0, async function (done) { + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODEOFF to operate"); + await captureSessionPromise.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.OFF) + .then(function (){ + console.info(TAG + "Entering Set VideoStabilization Mode Off SUCCESS, current VideoStabilization Mode is: " + cameraObj.VideoStabilizationMode.OFF); + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODEOFF PASSED") + expect(cameraObj.VideoStabilizationMode.OFF).assertEqual(0) + }) + .catch((err) => { + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODEOFF FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODEOFF ends here"); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : GET_VIDEOSTABILIZATIONMODEOFF + * @tc.name : getVideoStabilizationModeOff + * @tc.desc : getVideoStabilizationModeOff promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_VIDEOSTABILIZATIONMODEOFF', 0, async function (done) { + console.info(TAG + "Entering GET_VIDEOSTABILIZATIONMODEOFF to operate"); + await captureSessionPromise.getActiveVideoStabilizationMode() + .then(function (data){ + console.info(TAG + "Entering getVideoStabilizationModeOff SUCCESS"); + console.info(TAG + "Current VideoStabilizationMode is: " + data); + expect(data).assertEqual(0); + console.info(TAG + "GET_VIDEOSTABILIZATIONMODEOFF PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_VIDEOSTABILIZATIONMODEOFF FAILED : " + err.message); + }); + console.info(TAG + "GET_VIDEOSTABILIZATIONMODEOFF ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : ISVIDEOSTABILIZATIONMODESUPPORTED_LOW + * @tc.name : isVideoStabilizationModeSupported low + * @tc.desc : isVideoStabilizationModeSupported low promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('ISVIDEOSTABILIZATIONMODESUPPORTED_LOW', 0, async function (done) { + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTED_LOW to operate"); + await captureSessionPromise.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.LOW) + .then(function (data){ + console.info(TAG + "Entering is Video Stabilization Mode LOW Supported SUCCESS "); + console.info(TAG + "isVideoStabilizationModeSupported : " + data); + expect(data).assertEqual(true); + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTED_LOW PASSED"); + }) + .catch((err) => { + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTED_LOW FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTED_LOW ends here"); + }); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : SET_VIDEOSTABILIZATIONMODELOW + * @tc.name : SetVideoStabilizationModelow + * @tc.desc : SetVideoStabilizationModelow promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('SET_VIDEOSTABILIZATIONMODELOW', 0, async function (done) { + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODELOW to operate"); + await captureSessionPromise.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.LOW) + .then(function (){ + console.info(TAG + "Entering Set VideoStabilization Mode Off SUCCESS, current VideoStabilization Mode is: " + cameraObj.VideoStabilizationMode.LOW); + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODELOW PASSED") + expect(cameraObj.VideoStabilizationMode.LOW).assertEqual(1) + }) + .catch((err) => { + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODELOW FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODELOW ends here"); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : GET_VIDEOSTABILIZATIONMODELOW + * @tc.name : getVideoStabilizationModeLow + * @tc.desc : getVideoStabilizationModeLow promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('GET_VIDEOSTABILIZATIONMODELOW', 0, async function (done) { + console.info(TAG + "Entering GET_VIDEOSTABILIZATIONMODELOW to operate"); + await captureSessionPromise.getActiveVideoStabilizationMode() + .then(function (data){ + console.info(TAG + "Entering getVideoStabilizationModeLow SUCCESS"); + console.info(TAG + "Current VideoStabilizationMode is: " + data); + expect(data).assertEqual(1); + console.info(TAG + "GET_VIDEOSTABILIZATIONMODELOW PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_VIDEOSTABILIZATIONMODELOW FAILED : " + err.message); + }); + console.info(TAG + "GET_VIDEOSTABILIZATIONMODELOW ends here"); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : ISVIDEOSTABILIZATIONMODESUPPORTED_MIDDLE + * @tc.name : isVideoStabilizationModeSupported MIDDLE + * @tc.desc : isVideoStabilizationModeSupported MIDDLE promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('ISVIDEOSTABILIZATIONMODESUPPORTED_MIDDLE', 0, async function (done) { + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTED_MIDDLE to operate"); + await captureSessionPromise.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.MIDDLE) + .then(function (data){ + console.info(TAG + "Entering is Video Stabilization Mode MIDDLE Supported SUCCESS "); + console.info(TAG + "isVideoStabilizationModeSupported : " + data); + expect(data).assertEqual(false); + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTED_MIDDLE PASSED"); + }) + .catch((err) => { + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTED_MIDDLE FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTED_MIDDLE ends here"); + }); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : SET_VIDEOSTABILIZATIONMODEMIDDLE + * @tc.name : SetVideoStabilizationModeMIDDLE + * @tc.desc : SetVideoStabilizationModeMIDDLE promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('SET_VIDEOSTABILIZATIONMODEMIDDLE', 0, async function (done) { + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODEMIDDLE to operate"); + await captureSessionPromise.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.MIDDLE) + .then(function (){ + console.info(TAG + "Entering Set VideoStabilization Mode MIDDLE SUCCESS, current VideoStabilization Mode is: " + cameraObj.VideoStabilizationMode.MIDDLE); + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODEMIDDLE FAILED") + expect().assertFail(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODEMIDDLE PASSED : " + err.message); + expect(true).assertTrue(); + }); + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODEMIDDLE ends here"); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : GET_VIDEOSTABILIZATIONMODEMIDDLE + * @tc.name : getVideoStabilizationModeMIDDLE + * @tc.desc : getVideoStabilizationModeMIDDLE promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_VIDEOSTABILIZATIONMODEMIDDLE', 0, async function (done) { + console.info(TAG + "Entering GET_VIDEOSTABILIZATIONMODEMIDDLE to operate"); + await captureSessionPromise.getActiveVideoStabilizationMode() + .then(function (data){ + console.info(TAG + "Entering getVideoStabilizationModeMIDDLE SUCCESS"); + console.info(TAG + "Current VideoStabilizationMode is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_VIDEOSTABILIZATIONMODEMIDDLE PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_VIDEOSTABILIZATIONMODEMIDDLE FAILED : " + err.message); + }); + console.info(TAG + "GET_VIDEOSTABILIZATIONMODEMIDDLE ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : ISVIDEOSTABILIZATIONMODESUPPORTED_HIGH + * @tc.name : isVideoStabilizationModeSupported High + * @tc.desc : isVideoStabilizationModeSupported High promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('ISVIDEOSTABILIZATIONMODESUPPORTED_HIGH', 0, async function (done) { + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTED_HIGH to operate"); + await captureSessionPromise.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.HIGH) + .then(function (data){ + console.info(TAG + "Entering is Video Stabilization Mode HIGH Supported SUCCESS "); + console.info(TAG + "isVideoStabilizationModeSupported : " + data); + expect(data).assertEqual(false); + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTED_HIGH PASSED"); + }) + .catch((err) => { + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTED_HIGH FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTED_HIGH ends here"); + }); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : SET_VIDEOSTABILIZATIONMODEHIGH + * @tc.name : SetVideoStabilizationModeHigh + * @tc.desc : SetVideoStabilizationModeHigh promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('SET_VIDEOSTABILIZATIONMODEHIGH', 0, async function (done) { + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODEHIGH to operate"); + await captureSessionPromise.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.HIGH) + .then(function (){ + console.info(TAG + "Entering Set VideoStabilization Mode High SUCCESS, current VideoStabilization Mode is: " + cameraObj.VideoStabilizationMode.HIGH); + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODEHIGH FAILED") + expect().assertFail(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODEHIGH PASSED : " + err.message); + expect(true).assertTrue(); + }); + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODEHIGH ends here"); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : GET_VIDEOSTABILIZATIONMODEHIGH + * @tc.name : getVideoStabilizationModeHigh + * @tc.desc : getVideoStabilizationModeHigh promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_VIDEOSTABILIZATIONMODEHIGH', 0, async function (done) { + console.info(TAG + "Entering GET_VIDEOSTABILIZATIONMODEHIGH to operate"); + await captureSessionPromise.getActiveVideoStabilizationMode() + .then(function (data){ + console.info(TAG + "Entering getVideoStabilizationModeHigh SUCCESS"); + console.info(TAG + "Current VideoStabilizationMode is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_VIDEOSTABILIZATIONMODEHIGH PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_VIDEOSTABILIZATIONMODEHIGH FAILED : " + err.message); + }); + console.info(TAG + "GET_VIDEOSTABILIZATIONMODEHIGH ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : ISVIDEOSTABILIZATIONMODESUPPORTED_AUTO + * @tc.name : isVideoStabilizationModeSupported Auto + * @tc.desc : isVideoStabilizationModeSupported Auto promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('ISVIDEOSTABILIZATIONMODESUPPORTED_AUTO', 0, async function (done) { + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTED_AUTO to operate"); + await captureSessionPromise.isVideoStabilizationModeSupported(cameraObj.VideoStabilizationMode.AUTO) + .then(function (data){ + console.info(TAG + "Entering is Video Stabilization Mode AUTO Supported SUCCESS "); + console.info(TAG + "isVideoStabilizationModeSupported : " + data); + expect(data).assertEqual(false); + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTED_AUTO PASSED"); + }) + .catch((err) => { + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTED_AUTO FAILED : " + err.message); + expect().assertFail(); + console.info(TAG + "Entering ISVIDEOSTABILIZATIONMODESUPPORTED_AUTO ends here"); + }); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : SET_VIDEOSTABILIZATIONMODEAUTO + * @tc.name : SetVideoStabilizationModeAuto + * @tc.desc : SetVideoStabilizationModeAuto promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* VideoStabilizationMode Interface will be change + it('SET_VIDEOSTABILIZATIONMODEAUTO', 0, async function (done) { + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODEAUTO to operate"); + await captureSessionPromise.setVideoStabilizationMode(cameraObj.VideoStabilizationMode.AUTO) + .then(function (){ + console.info(TAG + "Entering Set VideoStabilization Mode Auto SUCCESS, current VideoStabilization Mode is: " + cameraObj.VideoStabilizationMode.AUTO); + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODEAUTO FAILED") + expect().assertFail(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODEAUTO PASSED : " + err.message); + expect(true).assertTrue(); + }); + console.info(TAG + "Entering SET_VIDEOSTABILIZATIONMODEAUTO ends here"); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : GET_VIDEOSTABILIZATIONMODEAUTO + * @tc.name : getVideoStabilizationModeAuto + * @tc.desc : getVideoStabilizationModeAuto promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_VIDEOSTABILIZATIONMODEAUTO', 0, async function (done) { + console.info(TAG + "Entering GET_VIDEOSTABILIZATIONMODEAUTO to operate"); + await captureSessionPromise.getActiveVideoStabilizationMode() + .then(function (data){ + console.info(TAG + "Entering getVideoStabilizationModeAuto SUCCESS"); + console.info(TAG + "Current VideoStabilizationMode is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_VIDEOSTABILIZATIONMODEAUTO PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_VIDEOSTABILIZATIONMODEAUTO FAILED : " + err.message); + }); + console.info(TAG + "GET_VIDEOSTABILIZATIONMODEAUTO ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : COMMIT_CONFIG_SUCCESS + * @tc.name : commit config api + * @tc.desc : commit config api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('COMMIT_CONFIG_SUCCESS', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + "Entering Commit config captureSession == null || undefined"); + } else { + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS to operate"); + const promise = await captureSessionPromise.commitConfig(); + console.info(TAG + "Entering commitConfig success"); + if (promise == undefined) { + expect(true).assertTrue(); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS commitConfig PASSED"); + } + else { + expect().assertFail() + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS commitConfig FAILED : "); + console.info(TAG + "Entering COMMIT_CONFIG_SUCCESS commitConfig ends here"); + } + await sleep(1); + done(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START + * @tc.name : Preview output callback on frame start api + * @tc.desc : Preview output callback on frame start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START', 0, async function (done) { + if (previewOutputPromise == null || previewOutputPromise == undefined) { + console.info(TAG + "Entering Preview Output callback on frame start previewOutput == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START to operate"); + previewOutputPromise.on('frameStart', async (err, data) => { + if (!err) { + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail() + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_FRAME_START FAILED : + err.message"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END + * @tc.name : PreviewOutput callback onframeend async api + * @tc.desc : PreviewOutput callback onframeend async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END', 0, async function (done) { + if (previewOutputPromise == null || previewOutputPromise == undefined) { + console.info(TAG + 'Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END previewOutputPromise == null || undefined') + } else { + console.info(TAG + 'Entering PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END to operate') + await sleep(1) + previewOutputPromise.on('frameEnd', async (err, data) => { + if (!err) { + console.info(TAG + "PreviewStop frameEnd Callback is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PREVIEW_OUTPUT_CALLBACK_ON_FRAME_END FAILED : + err.message"); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : VIDEO_OUTPUT_CALLBACK_ON_FRAME_START + * @tc.name : VideoOutput callback onframestart async api + * @tc.desc : VideoOutput callback onframestart async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_CALLBACK_ON_FRAME_START', 0, async function (done) { + if (videoOutputPromise == null || videoOutputPromise == undefined) { + console.info(TAG + 'Entering Video frameStart Callback videoOutputPromise == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_START to operate') + await sleep(1) + videoOutputPromise.on('frameStart', async (err, data) => { + if (!err) { + console.info(TAG + "Video frameStart Callback is success"); + if (data != null || data != undefined) { + expect(true).assertTrue(); + } + } else { + expect().assertFail() + console.info(TAG + "VIDEO_OUTPUT_CALLBACK_ON_FRAME_START is FAILED : " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : VIDEO_OUTPUT_CALLBACK_ON_FRAME_END + * @tc.name : VideoOutput callback onframeend async api + * @tc.desc : VideoOutput callback onframeend async api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_CALLBACK_ON_FRAME_END', 0, async function (done) { + if (videoOutputPromise == null || videoOutputPromise == undefined) { + console.info(TAG + 'Entering Video frameEnd callback videoOutputPromise == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_OUTPUT_CALLBACK_ON_FRAME_END to operate') + await sleep(1) + videoOutputPromise.on('frameEnd', async (err, data) => { + if (!err) { + console.info(TAG + 'VIDEO_OUTPUT_CALLBACK_ON_FRAME_END is success') + if (data != null || data != undefined) { + expect(true).assertTrue() + } + } else { + expect().assertFail() + console.info(TAG + 'VIDEO_OUTPUT_CALLBACK_ON_FRAME_END FAILED' + err.message) + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + //Capture callback + /** + * @tc.number : PHOTO_CAP_CALLBACK_ON_CAPTURE_START + * @tc.name : Photo capture callback on capture start api + * @tc.desc : Photo capture callback on capture start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_CAP_CALLBACK_ON_CAPTURE_START', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering Photo capture callback on capture start photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_START to operate"); + photoOutputPromise.on('captureStart', async (err, data) => { + if (!err) { + console.info(TAG + "CaptureStart Callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "PHOTO_CAP_CALLBACK_ON_CAPTURE_START with captureId: " + data); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PHOTO_CAP_CALLBACK_ON_CAPTURE_START FAILED: " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : PHOTO_CAP_CALLBACK_ON_CAPTURE_END + * @tc.name : Photo capture callback on capture end api + * @tc.desc : Photo capture callback on capture end api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_CAP_CALLBACK_ON_CAPTURE_END', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering Photo capture callback on capture end photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_CAPTURE_END to operate"); + photoOutputPromise.on('captureEnd', async (err, data) => { + if (!err) { + console.info(TAG + "captureEnd callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "captureEnd callback with captureId: " + data.captureId); + console.info(TAG + "captureEnd callback with frameCount: " + data.frameCount); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + 'PHOTO_CAP_CALLBACK_ON_CAPTURE_END FAILED' + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER + * @tc.name : Photo capture callback on frame shutter api + * @tc.desc : Photo capture callback on frame shutter api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "Entering Photo capture callback on frame shutter photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER to operate"); + photoOutputPromise.on('frameShutter', async (err, data) => { + if (!err) { + console.info(TAG + "frameShutter callback is success"); + if (data != null || data != undefined) { + console.info(TAG + "PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER with captureId: " + data.captureId); + console.info(TAG + "PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER with timestamp: " + data.timestamp); + expect(true).assertTrue(); + } + } else { + expect().assertFail(); + console.info(TAG + "PHOTO_CAP_CALLBACK_ON_FRAME_SHUTTER FAILED: " + err.message); + } + await sleep(1); + done(); + }) + await sleep(1); + done(); + } + }) + + /** + * @tc.number : CAPTURE_SESSION_START_SUCCESS + * @tc.name : capture session start api + * @tc.desc : capture session start api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_START_SUCCESS', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + "Entering capture session start captureSession == null || undefined"); + } else { + console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS to operate"); + await captureSessionPromise.start(); + console.info(TAG + "Entering captureSession start success"); + expect(true).assertTrue(); + console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS PASSED"); + console.info(TAG + "Entering CAPTURE_SESSION_START_SUCCESS ends here"); + await sleep(1); + done(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : isMirrorSupported_PHOTO_OUTPUT + * @tc.name : isMirrorSupported + * @tc.desc : isMirrorSupported + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('isMirrorSupported_PHOTO_OUTPUT', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering isMirrorSupported_PHOTO_OUTPUT to operate"); + await photoOutputPromise.isMirrorSupported() + .then(function (data) { + console.info(TAG + "Entering isMirrorSupported_PHOTO_OUTPUT is success"); + console.info(TAG + "isMirrorSupported : " + data); + expect(true).assertTrue(); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "isMirrorSupported_PHOTO_OUTPUT FAILED : " + err.message); + }); + await sleep(1); + done(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : setMirror_true + * @tc.name : setMirror true + * @tc.desc : setMirror true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('setMirror_true', 0, async function (done) { + if (photoOutputPromise == null || photoOutputPromise == undefined) { + console.info(TAG + "photoOutput == null || undefined"); + } else { + console.info(TAG + "Entering setMirror_true to operate"); + await photoOutputPromise.setMirror(true) + .then(function (data) { + console.info(TAG + "Entering setMirror_true is success:"); + console.info(TAG + "setMirror is : " + 'True'); + expect(true).assertTrue(); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "setMirror_true FAILED : " + err.message); + }); + await sleep(1); + done(); + } + await sleep(1); + done(); + }) + + //FLASH Function API scripts + /** + * @tc.number : HAS_FLASH + * @tc.name : check if has flash-camera0Input api + * @tc.desc : check if has flash-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('HAS_FLASH', 0, async function (done) { + console.info("--------------HAS_FLASH--------------"); + console.info(TAG + 'hasFlash called.') + var hasFlashPromise = await camera0InputPromise.hasFlash(); + console.info(TAG + "Entering HAS_FLASH success"); + if (hasFlashPromise != null || hasFlashPromise != undefined) { + console.info(TAG + "Entering HAS_FLASH data is not null || undefined"); + console.info(TAG + "Entering HAS_FLASH PASSED with HAS_FLASH is: " + JSON.stringify(hasFlashPromise)); + expect(hasFlashPromise).assertEqual(true); + } + else { + console.info(TAG + "Entering HAS_FLASH FAILED : "); + expect().assertFail(); + } + console.info(TAG + "Entering HAS_FLASH ends here"); + await sleep(1) + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_OPEN_SUPPORTED + * @tc.name : check if flash mode open is supported-camera0Input api + * @tc.desc : check if flash mode open is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_OPEN_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED to operate"); + var isFMOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_OPEN); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED SUCCESS "); + if (isFMOpenSupported != null || isFMOpenSupported != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED data is not null || undefined"); + console.info(TAG + "FLASH_MODE_OPEN supported is: " + JSON.stringify(isFMOpenSupported)); + expect(isFMOpenSupported).assertEqual(true); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED PASSED"); + } + else { + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED FAILED : "); + expect().assertFail(); + console.info(TAG + "Entering IS_FLASH_MODE_OPEN_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_OPEN + * @tc.name : set flash mode open camera0 api + * @tc.desc : set flash mode open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_OPEN', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN to operate"); + var SetFMOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_OPEN); + console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMOpen)) + if (SetFMOpen == undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_OPEN); + console.info(TAG + "Entering SET_FLASH_MODE_OPEN PASSED") + expect(cameraObj.FlashMode.FLASH_MODE_OPEN).assertEqual(1); + } else { + console.info(TAG + "Entering SET_FLASH_MODE_OPEN FAILED : "); + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_OPEN ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_OPEN + * @tc.name : get flash mode open camera0 api + * @tc.desc : get flash mode open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FLASH_MODE_OPEN', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_OPEN to operate"); + var GetFMOpen = await camera0InputPromise.getFlashMode(); + console.info(TAG + "Entering GET_FLASH_MODE_OPEN success: " + JSON.stringify(GetFMOpen)); + if (GetFMOpen == 1) { + console.info(TAG + "GET_FLASH_MODE_OPEN data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " + JSON.stringify(GetFMOpen)); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_OPEN PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_OPEN FAILED : "); + console.info(TAG + "GET_FLASH_MODE_OPEN ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED + * @tc.name : check if flash mode always open is supported-camera0Input api + * @tc.desc : check if flash mode always open is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED to operate"); + var isFMAlwaysOpenSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED SUCCESS "); + if (isFMAlwaysOpenSupported != null || isFMAlwaysOpenSupported != undefined) { + console.info(TAG + "Entering FLASH_MODE_ALWAYS_OPEN data is not null || undefined"); + console.info(TAG + "FLASH_MODE_OPEN supported is: " + isFMAlwaysOpenSupported); + expect(isFMAlwaysOpenSupported).assertEqual(true); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED PASSED"); + } + else { + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED FAILED : "); + expect().assertFail(); + console.info(TAG + "Entering IS_FLASH_MODE_ALWAYS_OPEN_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_ALWAYS_OPEN + * @tc.name : set flash mode always open camera0 api + * @tc.desc : set flash mode always open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_ALWAYS_OPEN', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN to operate"); + var SetFMAlwaysOpen = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMAlwaysOpen)) + if (SetFMAlwaysOpen == undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN); + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN PASSED") + expect(cameraObj.FlashMode.FLASH_MODE_ALWAYS_OPEN).assertEqual(3) + } else { + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN FAILED : "); + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_ALWAYS_OPEN ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_ALWAYS_OPEN + * @tc.name : get flash mode always open camera0 api + * @tc.desc : get flash mode always open camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FLASH_MODE_ALWAYS_OPEN', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN to operate"); + var GetFMAlwaysOpen = await camera0InputPromise.getFlashMode(); + console.info(TAG + "Entering GET_FLASH_MODE_ALWAYS_OPEN success"); + if (GetFMAlwaysOpen == 3) { + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " + GetFMAlwaysOpen); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN FAILED : "); + console.info(TAG + "GET_FLASH_MODE_ALWAYS_OPEN ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_AUTO_SUPPORTED + * @tc.name : check if flash mode always open is supported-camera0Input api + * @tc.desc : check if flash mode always open is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_AUTO_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED to operate"); + var isFMAutoSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_AUTO); + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED SUCCESS "); + if (isFMAutoSupported != null || isFMAutoSupported != undefined) { + console.info(TAG + "Entering FLASH_MODE_AUTO data is not null || undefined"); + console.info(TAG + "FLASH_MODE_AUTO supported is: " + isFMAutoSupported); + expect(isFMAutoSupported).assertEqual(true); + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED PASSED"); + } + else { + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED FAILED : "); + expect().assertFail(); + console.info(TAG + "Entering IS_FLASH_MODE_AUTO_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_AUTO + * @tc.name : set flash mode auto camera0 api + * @tc.desc : set flash mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_AUTO to operate"); + var SetFMAlwaysAuto = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_AUTO); + console.info(TAG + "SetFMAlwaysAuto: " + JSON.stringify(SetFMAlwaysAuto)) + if (SetFMAlwaysAuto == undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_AUTO SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_AUTO); + console.info(TAG + "Entering SET_FLASH_MODE_AUTO PASSED") + expect(cameraObj.FlashMode.FLASH_MODE_AUTO).assertEqual(2) + } else { + console.info(TAG + "Entering SET_FLASH_MODE_AUTO FAILED : "); + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_AUTO ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_AUTO + * @tc.name : get flash mode auto camera0 api + * @tc.desc : get flash mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FLASH_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_AUTO to operate"); + var GetFMAuto = await camera0InputPromise.getFlashMode(); + console.info(TAG + "Entering GET_FLASH_MODE_AUTO success"); + if (GetFMAuto == 2) { + console.info(TAG + "GET_FLASH_MODE_AUTO data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " + GetFMAuto); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_AUTO PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_AUTO FAILED : "); + console.info(TAG + "GET_FLASH_MODE_AUTO ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FLASH_MODE_CLOSE_SUPPORTED + * @tc.name : check if flash mode close is supported-camera0Input api + * @tc.desc : check if flash mode close is supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FLASH_MODE_CLOSE_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED to operate"); + var isFMCloseSupported = await camera0InputPromise.isFlashModeSupported(cameraObj.FlashMode.FLASH_MODE_CLOSE); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED SUCCESS "); + if (isFMCloseSupported != null || isFMCloseSupported != undefined) { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED data is not null || undefined"); + console.info(TAG + "FLASH_MODE_CLOSE supported is: " + isFMCloseSupported); + expect(isFMCloseSupported).assertEqual(true); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED PASSED"); + } + else { + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED FAILED : "); + expect().assertFail(); + console.info(TAG + "Entering IS_FLASH_MODE_CLOSE_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FLASH_MODE_CLOSE + * @tc.name : set flash mode close camera0 api + * @tc.desc : set flash mode close camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FLASH_MODE_CLOSE', 0, async function (done) { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE to operate"); + var SetFMClose = await camera0InputPromise.setFlashMode(cameraObj.FlashMode.FLASH_MODE_CLOSE); + console.info(TAG + "setFlashModeOPEN: " + JSON.stringify(SetFMClose)) + if (SetFMClose == undefined) { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE SUCCESS, current flashmode is: " + cameraObj.FlashMode.FLASH_MODE_CLOSE); + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE PASSED") + expect(cameraObj.FlashMode.FLASH_MODE_CLOSE).assertEqual(0) + } else { + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE FAILED : "); + expect().assertFail(); + console.info(TAG + "Entering SET_FLASH_MODE_CLOSE ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FLASH_MODE_CLOSE + * @tc.name : get flash mode close camera0 api + * @tc.desc : get flash mode close camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FLASH_MODE_CLOSE', 0, async function (done) { + console.info(TAG + "Entering GET_FLASH_MODE_CLOSE to operate"); + var GetFMClose = await camera0InputPromise.getFlashMode(); + console.info(TAG + "Entering GET_FLASH_MODE_CLOSE success"); + if (GetFMClose == 0) { + console.info(TAG + "GET_FLASH_MODE_CLOSE data is not null || undefined: "); + console.info(TAG + "Current FlashMode is: " + GetFMClose); + expect(true).assertTrue(); + console.info(TAG + "GET_FLASH_MODE_CLOSE PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FLASH_MODE_CLOSE FAILED : "); + console.info(TAG + "GET_FLASH_MODE_CLOSE ends here"); + } + await sleep(1); + done(); + }) + + //ZOOM Function + /** + * @tc.number : GET_ZOOM_RATIO_PROMISE + * @tc.name : get zoom ratio camera-0 cameraId api promise api + * @tc.desc : get zoom ratio camera-0 cameraId api promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_ZOOM_RATIO_PROMISE', 0, async function (done) { + console.info("--------------GET_ZOOM_RATIO_PROMISE--------------"); + var getZoomRatioPromise = await camera0InputPromise.getZoomRatioRange(); + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE getZoomRatioPromise: " + JSON.stringify(getZoomRatioPromise)); + if (getZoomRatioPromise != null && getZoomRatioPromise != undefined) { + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE setZoomRatioPromise is not null || undefined"); + expect(true).assertTrue(); + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE success: " + JSON.stringify(getZoomRatioPromise)); + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE PASSED"); + } else { + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE FAILED"); + expect().assertFail(); + } + console.info(TAG + "Entering GET_ZOOM_RATIO_PROMISE ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_1_PROMISE + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_1_PROMISE', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(1); + console.info(TAG + "setZoomRatio success: 1"); + console.info(TAG + "getZoomRatio called") + var getpromise1 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: " + getpromise1); + if (getpromise1 != null && getpromise1 != undefined) { + expect(getpromise1).assertEqual(1); + console.info(TAG + "SET_GET_ZOOM_1_PROMISE PASSED "); + } + else { + console.info(TAG + "SET_GET_ZOOM_1_PROMISE FAILED"); + expect().assertFail(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_2_PROMISE + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_2_PROMISE', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(2); + console.info(TAG + "setZoomRatio success: 2"); + console.info(TAG + "getZoomRatio called") + var getpromise2 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: " + getpromise2); + if (getpromise2 != null && getpromise2 != undefined) { + expect(getpromise2).assertEqual(2); + console.info(TAG + "SET_GET_ZOOM_2_PROMISE PASSED "); + } + else { + console.info(TAG + "SET_GET_ZOOM_2_PROMISE FAILED"); + expect().assertFail(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_3_PROMISE + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_3_PROMISE', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(3); + console.info(TAG + "setZoomRatio success: 3"); + console.info(TAG + "getZoomRatio called") + var getpromise3 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: " + getpromise3); + if (getpromise3 != null && getpromise3 != undefined) { + expect(getpromise3).assertEqual(3); + console.info(TAG + "SET_GET_ZOOM_3_PROMISE PASSED "); + } + else { + console.info(TAG + "SET_GET_ZOOM_3_PROMISE FAILED"); + expect().assertFail(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_4_PROMISE + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_4_PROMISE', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(4); + console.info(TAG + "setZoomRatio success: 4"); + console.info(TAG + "getZoomRatio called") + var getpromise4 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: " + getpromise4); + if (getpromise4 != null && getpromise4 != undefined) { + expect(getpromise4).assertEqual(4); + console.info(TAG + "SET_GET_ZOOM_4_PROMISE PASSED "); + } + else { + console.info(TAG + "SET_GET_ZOOM_4_PROMISE FAILED"); + expect().assertFail(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_5_PROMISE + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_5_PROMISE', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(5); + console.info(TAG + "setZoomRatio success: 5"); + console.info(TAG + "getZoomRatio called") + var getpromise5 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: " + getpromise5); + if (getpromise5 != null && getpromise5 != undefined) { + expect(getpromise5).assertEqual(5); + console.info(TAG + "SET_GET_ZOOM_5_PROMISE PASSED "); + } + else { + console.info(TAG + "SET_GET_ZOOM_5_PROMISE FAILED"); + expect().assertFail(); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_GET_ZOOM_6_PROMISE + * @tc.name : Zoom camera-0 cameraId api + * @tc.desc : Zoom camera-0 cameraId api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_GET_ZOOM_6_PROMISE', 0, async function (done) { + var setpromise = await camera0InputPromise.setZoomRatio(6); + console.info(TAG + "setZoomRatio success: 6"); + console.info(TAG + "getZoomRatio called") + var getpromise6 = await camera0InputPromise.getZoomRatio(); + console.info(TAG + "getZoomRatio success: " + getpromise6); + if (getpromise6 != null && getpromise6 != undefined) { + expect(getpromise6).assertEqual(6); + console.info(TAG + "SET_GET_ZOOM_6_PROMISE PASSED "); + } + else { + console.info(TAG + "SET_GET_ZOOM_6_PROMISE FAILED"); + expect().assertFail(); + } + await sleep(1); + done(); + }) + + // FOCUS promise API's + /** + * @tc.number : IS_FOCUS_MODE_LOCKED_SUPPORTED + * @tc.name : check is focus mode locked supported-camera0Input api + * @tc.desc : check is focus mode locked supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_LOCKED_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED to operate"); + var isFMLockedSupported = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_LOCKED); + console.info(TAG + "Entering is focus mode locked supported SUCCESS "); + if (isFMLockedSupported != null || isFMLockedSupported != undefined) { + console.info(TAG + "Entering is focus mode locked supported data is not null || undefined"); + console.info(TAG + "is focus mode locked supported : " + isFMLockedSupported); + expect(isFMLockedSupported).assertEqual(false); + console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED PASSED"); + } + else { + console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED FAILED : "); + expect().assertFail(); + console.info(TAG + "Entering IS_FOCUS_MODE_LOCKED_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_LOCKED + * @tc.name : set focus mode locked camera0 api + * @tc.desc : set focus mode locked camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_LOCKED', 0, async function (done) { + console.info(TAG + "Entering set focus mode locked to operate"); + await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_LOCKED) + .then(function (data) { + console.info(TAG + "SetFMLocked: " + JSON.stringify(data)) + console.info(TAG + "Entering set focus mode locked SUCCESS, current focusmode is: " + cameraObj.FocusMode.FOCUS_MODE_LOCKED); + console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED FAILED : ") + expect().assertFail(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED PASSED : " + err.message); + expect(true).assertTrue(); + console.info(TAG + "Entering SET_FOCUS_MODE_LOCKED ends here"); + }); + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_LOCKED + * @tc.name : get focus mode locked camera0 api + * @tc.desc : get focus mode locked camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_MODE_LOCKED', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_LOCKED to operate"); + await camera0InputPromise.getFocusMode() + .then(function (data) { + console.info(TAG + "Entering get focus mode locked success: "); + if (data == 0) { + console.info(TAG + "Current focusmode is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_LOCKED PASSED"); + } + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_LOCKED FAILED : " + err.message); + console.info(TAG + "GET_FOCUS_MODE_LOCKED ends here"); + }); + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCAL_LENGTH + * @tc.name : get focal length camera0 api + * @tc.desc : get focal length camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCAL_LENGTH', 0, async function (done) { + console.info(TAG + "Entering GET_FOCAL_LENGTH to operate"); + await camera0InputPromise.getFocalLength() + .then(function (data) { + console.info(TAG + "Current focallength is: " + JSON.stringify(data)); + expect(data).assertEqual(3.4600000381469727); + console.info(TAG + "GET_FOCAL_LENGTH PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_FOCAL_LENGTH FAILED : " + err.message); + }); + console.info(TAG + "GET_FOCAL_LENGTH ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_MANUAL_SUPPORTED + * @tc.name : is focusmode manual supported + * @tc.desc : is focusmode manual supported + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_MANUAL_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED to operate"); + var isFMmanualSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_MANUAL); + if (isFMmanualSupportedpromise != null || isFMmanualSupportedpromise != undefined) { + console.info(TAG + "Entering is focusmode manual supported data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_MANUAL_SUPPORTED is: " + isFMmanualSupportedpromise); + expect(isFMmanualSupportedpromise).assertEqual(true); + console.info(TAG + "Entering IS_FOCUS_MODE_MANUAL_SUPPORTED PASSED: "); + } + else { + console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED FAILED : "); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_MANUAL_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_MANUAL + * @tc.name : set focus mode manual camera0 api + * @tc.desc : set focus mode manual camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_MANUAL', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL to operate"); + await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_MANUAL) + .then(function (data) { + console.info(TAG + "setFocusManual: " + JSON.stringify(data)) + console.info(TAG + "Entering set focus mode manual SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_MANUAL); + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL PASSED") + expect(cameraObj.FocusMode.FOCUS_MODE_MANUAL).assertEqual(0) + }) + .catch((err) => { + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_FOCUS_MODE_MANUAL ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_MANUAL + * @tc.name : get focus mode manual camera0 api + * @tc.desc : get focus mode manual camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_MODE_MANUAL', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_MANUAL to operate"); + await camera0InputPromise.getFocusMode() + .then(function (data) { + console.info(TAG + "Entering get focus mode manual SUCCESS"); + if (data == 0) { + console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_MANUAL PASSED"); + } + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_MANUAL FAILED : " + err.message); + console.info(TAG + "GET_FOCUS_MODE_MANUAL ends here"); + }); + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_POINT + * @tc.name : set focus Point camera0 api + * @tc.desc : set focus Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering set focus mode locked to operate"); + await camera0InputPromise.setFocusPoint(Point1) + .then(function (data) { + console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_FOCUS_POINT PASSED"); + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_FOCUS_POINT FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_FOCUS_POINT ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_POINT + * @tc.name : get focus Point camera0 api + * @tc.desc : get focus Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_POINT to operate"); + await camera0InputPromise.getFocusPoint() + .then(function (data) { + console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_POINT PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_POINT FAILED " + err.message); + }); + console.info(TAG + "GET_FOCUS_POINT ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_CONTINUOUS_SUPPORTED + * @tc.name : check is focus mode continuous supported-camera0Input api + * @tc.desc : check is focus mode continuous supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_CONTINUOUS_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED to operate"); + var isFMContinuousSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + if (isFMContinuousSupportedpromise != null || isFMContinuousSupportedpromise != undefined) { + console.info(TAG + "Entering is focus mode continuous supported data is not null || undefined"); + console.info(TAG + "FOCUS_MODE_CONTINUOUS_SUPPORTED is: " + isFMContinuousSupportedpromise); + expect(isFMContinuousSupportedpromise).assertEqual(true); + console.info(TAG + "Entering IS_FOCUS_MODE_CONTINUOUS_SUPPORTED PASSED: "); + } + else { + console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED FAILED : "); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_CONTINUOUS_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_CONTINUOUS + * @tc.name : set focus mode continuous camera0 api + * @tc.desc : set focus mode continuous camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_CONTINUOUS', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS to operate"); + await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) + .then(function (data) { + console.info(TAG + "setFocusCont: " + JSON.stringify(data)) + console.info(TAG + "Entering set focus mode continuous SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS PASSED") + expect(cameraObj.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO).assertEqual(1) + }) + .catch((err) => { + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_FOCUS_MODE_CONTINUOUS ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_CONTINUOUS + * @tc.name : get focus mode continuous camera0 api + * @tc.desc : get focus mode continuous camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_MODE_CONTINUOUS', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_CONTINUOUS to operate"); + await camera0InputPromise.getFocusMode() + .then(function (data) { + console.info(TAG + "Entering get focus mode continuous SUCCESS"); + if (data == 1) { + console.info(TAG + "Current FocusMode is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS PASSED"); + } + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS FAILED: " + err.message); + }); + console.info(TAG + "GET_FOCUS_MODE_CONTINUOUS ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_POINT + * @tc.name : set focus Point camera0 api + * @tc.desc : set focus Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering set focus mode locked to operate"); + await camera0InputPromise.setFocusPoint(Point2) + .then(function (data) { + console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); + console.info(TAG + "Entering SET_FOCUS_POINT PASSED"); + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_FOCUS_POINT FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_FOCUS_POINT ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_POINT + * @tc.name : get focus Point camera0 api + * @tc.desc : get focus Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_POINT to operate"); + await camera0InputPromise.getFocusPoint() + .then(function (data) { + console.info(TAG + "Current FocusPoint is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_POINT PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_POINT FAILED: " + err.message); + }); + console.info(TAG + "GET_FOCUS_POINT ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_FOCUS_MODE_AUTO_SUPPORTED + * @tc.name : check is focus mode auto supported-camera0Input api + * @tc.desc : check is focus mode auto supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('IS_FOCUS_MODE_AUTO_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED to operate"); + var isFMAutoSupportedpromise = await camera0InputPromise.isFocusModeSupported(cameraObj.FocusMode.FOCUS_MODE_AUTO); + if (isFMAutoSupportedpromise != null || isFMAutoSupportedpromise != undefined) { + console.info(TAG + "Entering is focus mode auto supported data is not null || undefined"); + console.info(TAG + "is focus mode auto supported is: " + isFMAutoSupportedpromise); + expect(isFMAutoSupportedpromise).assertEqual(true); + console.info(TAG + "Entering IS_FOCUS_MODE_AUTO_SUPPORTED PASSED: "); + } + else { + console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED FAILED : "); + expect().assertFail(); + console.info(TAG + "IS_FOCUS_MODE_AUTO_SUPPORTED ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_MODE_AUTO + * @tc.name : set focus mode auto camera0 api + * @tc.desc : set focus mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO to operate"); + var setFocusAuto = await camera0InputPromise.setFocusMode(cameraObj.FocusMode.FOCUS_MODE_AUTO) + .then(function () { + console.info(TAG + "setFocusAuto: " + JSON.stringify(setFocusAuto)) + console.info(TAG + "Entering set focus mode auto SUCCESS, current FocusMode is: " + cameraObj.FocusMode.FOCUS_MODE_AUTO); + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO PASSED") + expect(cameraObj.FocusMode.FOCUS_MODE_AUTO).assertEqual(2) + }) + .catch((err) => { + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO FAILED : "); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_FOCUS_MODE_AUTO ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_MODE_AUTO + * @tc.name : get focus mode auto camera0 api + * @tc.desc : get focus mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_MODE_AUTO to operate"); + var getfocusmodepromise = await camera0InputPromise.getFocusMode(); + console.info(TAG + "Entering get focus mode auto SUCCESS"); + if (getfocusmodepromise == 2) { + console.info(TAG + "Current FocusMode is: " + getfocusmodepromise); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_MODE_AUTO PASSED"); + } + else { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_MODE_AUTO FAILED : "); + console.info(TAG + "GET_FOCUS_MODE_AUTO ends here"); + } + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_FOCUS_POINT + * @tc.name : set focus Point camera0 api + * @tc.desc : set focus Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering set focus mode locked to operate"); + await camera0InputPromise.setFocusPoint(Point3) + .then(function (data) { + console.info(TAG + "Entering set focus Point SUCCESS, current focusPoint is:" + JSON.stringify(data)); + console.info(TAG + "Entering SET_FOCUS_POINT PASSED"); + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_FOCUS_POINT FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_FOCUS_POINT ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_FOCUS_POINT + * @tc.name : get focus Point camera0 api + * @tc.desc : get focus Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_FOCUS_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_FOCUS_POINT to operate"); + await camera0InputPromise.getFocusPoint() + .then(function (data) { + console.info(TAG + "Current focusPoint is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_FOCUS_POINT PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_FOCUS_POINT FAILED : " + err.message); + }); + console.info(TAG + "GET_FOCUS_POINT ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_EXPOSURE_MODE_LOCKED_SUPPORTED + * @tc.name : check is exposure mode locked supported-camera0Input api + * @tc.desc : check is exposure mode locked supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('IS_EXPOSURE_MODE_LOCKED_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_EXPOSURE_MODE_LOCKED_SUPPORTED to operate"); + await camera0InputPromise.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED) + .then(function (data) { + console.info(TAG + "Entering IS_EXPOSURE_MODE_LOCKED_SUPPORTED PASSED: " + data); + expect(data).assertEqual(false); + }) + .catch((err) => { + console.info(TAG + "IS_EXPOSURE_MODE_LOCKED_SUPPORTED FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "IS_EXPOSURE_MODE_LOCKED_SUPPORTED ends here"); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : SET_EXPOSURE_MODE_LOCKED + * @tc.name : set exposure mode locked camera0 api + * @tc.desc : set exposure mode locked camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('SET_EXPOSURE_MODE_LOCKED', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_MODE_Locked to operate"); + await camera0InputPromise.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED) + .then(function () { + console.info(TAG + "Entering set exposure mode auto SUCCESS, current ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_LOCKED); + console.info(TAG + "Entering SET_EXPOSURE_MODE_Locked FAILED") + expect().assertFail() + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_MODE_LOCKED PASSED : " + err.message); + expect(true).assertTrue(); + }); + console.info(TAG + "Entering SET_EXPOSURE_MODE_LOCKED ends here"); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : GET_EXPOSURE_MODE_LOCKED + * @tc.name : get exposure mode locked camera0 api + * @tc.desc : get exposure mode locked camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_MODE_LOCKED', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_MODE_LOCKED to operate"); + await camera0InputPromise.getExposureMode() + .then(function (data) { + console.info(TAG + "Entering get exposure mode locked SUCCESS"); + console.info(TAG + "Current ExposureMode is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_MODE_LOCKED PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_MODE_LOCKED FAILED : " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_MODE_LOCKED ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_POINT_exposure mode locked + * @tc.name : set exposure Point camera0 api + * @tc.desc : set exposure Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_Point to operate"); + await camera0InputPromise.setExposurePoint(Point1) + .then(function (data) { + console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_EXPOSURE_POINT PASSED") + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_POINT FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_EXPOSURE_POINT ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_POINT_exposure mode locked + * @tc.name : get exposure Point camera0 api + * @tc.desc : get exposure Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_POINT to operate"); + await camera0InputPromise.getExposurePoint() + .then(function (data) { + console.info(TAG + "Entering getExposurePoint SUCCESS"); + console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_POINT PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_POINT FAILED: " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_POINT ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_BIASRANGE_exposure mode locked + * @tc.name : get exposure bias range camera0 api + * @tc.desc : get exposure bias range camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_BIASRANGE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_BIASRANGE to operate"); + await camera0InputPromise.getExposureBiasRange() + .then(function (data) { + console.info(TAG + "Entering getExposureBiasRange SUCCESS"); + console.info(TAG + "Current ExposureBiasRange is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_BIASRANGE PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_BIASRANGE FAILED: " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_BIASRANGE ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_BIAS_exposure mode locked + * @tc.name : set exposure bias camera0 api + * @tc.desc : set exposure bias camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_BIAS', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_BIAS to operate"); + await camera0InputPromise.setExposureBias(-4) + .then(function (data) { + console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_EXPOSURE_BIAS PASSED") + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_BIAS FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_EXPOSURE_BIAS ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_VALUE_exposure mode locked + * @tc.name : get exposure value camera0 api + * @tc.desc : get exposure value camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_VALUE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_VALUE to operate"); + await camera0InputPromise.getExposureValue() + .then(function (data) { + console.info(TAG + "Entering getExposureValue SUCCESS"); + console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); + expect(data).assertEqual(-4); + console.info(TAG + "GET_EXPOSURE_VALUE PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_VALUE FAILED : " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_VALUE ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_EXPOSURE_MODE_AUTO_SUPPORTED + * @tc.name : check is exposure mode auto supported-camera0Input api + * @tc.desc : check is exposure mode auto supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('IS_EXPOSURE_MODE_AUTO_SUPPORTED', 0, async function (done) { + console.info(TAG + "Entering IS_EXPOSURE_MODE_AUTO_SUPPORTED to operate"); + await camera0InputPromise.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO) + .then(function (data) { + console.info(TAG + "Entering IS_EXPOSURE_MODE_AUTO_SUPPORTED PASSED: " + data); + expect(data).assertEqual(true); + }) + .catch((err) => { + console.info(TAG + "IS_EXPOSURE_MODE_AUTO_SUPPORTED FAILED: " + err.message); + expect().assertFail(); + }); + console.info(TAG + "IS_EXPOSURE_MODE_AUTO_SUPPORTED ends here"); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : SET_EXPOSURE_MODE_AUTO + * @tc.name : set exposure mode auto camera0 api + * @tc.desc : set exposure mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('SET_EXPOSURE_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_MODE_AUTO to operate"); + await camera0InputPromise.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO) + .then(function () { + console.info(TAG + "Entering set exposure mode auto SUCCESS, current ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_AUTO); + console.info(TAG + "Entering SET_EXPOSURE_MODE_AUTO PASSED") + expect(cameraObj.ExposureMode.EXPOSURE_MODE_AUTO).assertEqual(1); + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_MODE_AUTO FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_EXPOSURE_MODE_AUTO ends here"); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : GET_EXPOSURE_MODE_AUTO + * @tc.name : get exposure mode auto camera0 api + * @tc.desc : get exposure mode auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('GET_EXPOSURE_MODE_AUTO', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_MODE_AUTO to operate"); + await camera0InputPromise.getExposureMode() + .then(function (data) { + console.info(TAG + "Entering get exposure mode auto SUCCESS"); + console.info(TAG + "Current exposureMode is: " + data); + expect(data).assertEqual(1); + console.info(TAG + "GET_EXPOSURE_MODE_AUTO PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_MODE_AUTO FAILED: " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_MODE_AUTO ends here"); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : SET_EXPOSURE_POINT_exposure mode auto + * @tc.name : set exposure Point camera0 api + * @tc.desc : set exposure Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_POINT to operate"); + await camera0InputPromise.setExposurePoint(Point2) + .then(function (data) { + console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_EXPOSURE_POINT PASSED") + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_POINT FAILED: " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_EXPOSURE_POINT ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_POINT_exposure mode auto + * @tc.name : get exposure Point camera0 api + * @tc.desc : get exposure Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_POINT to operate"); + await camera0InputPromise.getExposurePoint() + .then(function (data) { + console.info(TAG + "Entering getExposurePoint SUCCESS"); + console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_POINT PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_POINT FAILED: " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_POINT ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_BIAS_exposure mode auto + * @tc.name : set exposure bias camera0 api + * @tc.desc : set exposure bias camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_BIAS', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_BIAS to operate"); + await camera0InputPromise.setExposureBias(1) + .then(function (data) { + console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_EXPOSURE_BIAS PASSED") + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_BIAS FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_EXPOSURE_BIAS ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_VALUE_exposure mode auto + * @tc.name : get exposure value camera0 api + * @tc.desc : get exposure value camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_VALUE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_VALUE to operate"); + await camera0InputPromise.getExposureValue() + .then(function (data) { + console.info(TAG + "Entering getExposureValue SUCCESS"); + console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); + expect(data).assertEqual(1); + console.info(TAG + "GET_EXPOSURE_VALUE PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_VALUE FAILED : " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_VALUE ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : IS_EXPOSURE_MODE_CONTINUOUS_AUTO + * @tc.name : check is exposure mode continuous auto supported-camera0Input api + * @tc.desc : check is exposure mode continuous auto supported-camera0Input api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('IS_EXPOSURE_MODE_CONTINUOUS_AUTO', 0, async function (done) { + console.info(TAG + "Entering IS_EXPOSURE_MODE_CONTINUOUS_AUTO to operate"); + await camera0InputPromise.isExposureModeSupported(cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO) + .then(function (data) { + console.info(TAG + "Entering IS_EXPOSURE_MODE_CONTINUOUS_AUTO PASSED: " + data); + expect(data).assertEqual(false); + }) + .catch((err) => { + console.info(TAG + "IS_EXPOSURE_MODE_CONTINUOUS_AUTO FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "IS_EXPOSURE_MODE_CONTINUOUS_AUTO ends here"); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : SET_EXPOSURE_MODE_CONTINUOUS_AUTO + * @tc.name : set exposure mode continuous auto camera0 api + * @tc.desc : set exposure mode continuous auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('SET_EXPOSURE_MODE_CONTINUOUS_AUTO', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_MODE_CONTINUOUS_AUTO to operate"); + await camera0InputPromise.setExposureMode(cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO) + .then(function () { + console.info(TAG + "Entering set exposure mode auto SUCCESS, current ExposureMode is: " + cameraObj.ExposureMode.EXPOSURE_MODE_CONTINUOUS_AUTO); + console.info(TAG + "Entering SET_EXPOSURE_MODE_CONTINUOUS_AUTO FAILED") + expect().assertFail(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_MODE_CONTINUOUS_AUTO PASSED : " + err.message); + expect(true).assertTrue(); + }); + console.info(TAG + "Entering SET_EXPOSURE_MODE_CONTINUOUS_AUTO ends here"); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : GET_EXPOSURE_MODE_CONTINUOUS_AUTO + * @tc.name : get exposure mode continuous auto camera0 api + * @tc.desc : get exposure mode continuous auto camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + /* EXPOSUREMODE Interface will be change + it('GET_EXPOSURE_MODE_CONTINUOUS_AUTO', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_MODE_CONTINUOUS_AUTO to operate"); + await camera0InputPromise.getExposureMode() + .then(function (data) { + console.info(TAG + "Entering get exposure mode auto SUCCESS"); + console.info(TAG + "Current exposureMode is: " + data); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_MODE_CONTINUOUS_AUTO PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_MODE_CONTINUOUS_AUTO FAILED : " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_MODE_CONTINUOUS_AUTO ends here"); + await sleep(1); + done(); + }) + */ + + /** + * @tc.number : SET_EXPOSURE_POINT + * @tc.name : set exposure Point camera0 api + * @tc.desc : set exposure Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_POINT to operate"); + await camera0InputPromise.setExposurePoint(Point3) + .then(function (data) { + console.info(TAG + "Entering set exposure Point SUCCESS, current ExposurePoint is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_EXPOSURE_POINT PASSED") + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_POINT FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_EXPOSURE_POINT ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_POINT + * @tc.name : get exposure Point camera0 api + * @tc.desc : get exposure Point camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_POINT', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_POINT to operate"); + await camera0InputPromise.getExposurePoint() + .then(function (data) { + console.info(TAG + "Entering getExposurePoint SUCCESS"); + console.info(TAG + "Current ExposurePoint is: " + JSON.stringify(data)); + expect(true).assertTrue(); + console.info(TAG + "GET_EXPOSURE_POINT PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_POINT FAILED : " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_POINT ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : SET_EXPOSURE_BIAS_exposure mode continuous auto + * @tc.name : set exposure bias camera0 api + * @tc.desc : set exposure bias camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SET_EXPOSURE_BIAS', 0, async function (done) { + console.info(TAG + "Entering SET_EXPOSURE_BIAS to operate"); + await camera0InputPromise.setExposureBias(4) + .then(function (data) { + console.info(TAG + "Entering set exposure bias SUCCESS, current Exposurebias is: " + JSON.stringify(data)); + console.info(TAG + "Entering SET_EXPOSURE_BIAS PASSED") + expect(true).assertTrue(); + }) + .catch((err) => { + console.info(TAG + "Entering SET_EXPOSURE_BIAS FAILED : " + err.message); + expect().assertFail(); + }); + console.info(TAG + "Entering SET_EXPOSURE_BIAS ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : GET_EXPOSURE_VALUE + * @tc.name : get exposure value camera0 api + * @tc.desc : get exposure value camera0 api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('GET_EXPOSURE_VALUE', 0, async function (done) { + console.info(TAG + "Entering GET_EXPOSURE_VALUE to operate"); + await camera0InputPromise.getExposureValue() + .then(function (data) { + console.info(TAG + "Entering getExposureValue SUCCESS"); + console.info(TAG + "Current ExposureValue is: " + JSON.stringify(data)); + expect(data).assertEqual(4); + console.info(TAG + "GET_EXPOSURE_VALUE PASSED"); + }) + .catch((err) => { + expect().assertFail(); + console.info(TAG + "GET_EXPOSURE_VALUE FAILED : " + err.message); + }); + console.info(TAG + "GET_EXPOSURE_VALUE ends here"); + await sleep(1); + done(); + }) + + /** + * @tc.number : VIDEO_OUTPUT_START_PROMISE + * @tc.name : VideoOutput start promise api + * @tc.desc : VideoOutput start promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_START_PROMISE', 0, async function (done) { + if (videoOutputPromise == null || videoOutputPromise == undefined) { + console.info(TAG + 'Entering Video Output start videoOutputPromise == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_OUTPUT_START_PROMISE to operate') + await videoOutputPromise.start() + expect(true).assertTrue() + console.info(TAG + 'Entering VIDEO_OUTPUT_START_PROMISE PASSED') + console.info(TAG + 'Entering VIDEO_OUTPUT_START_PROMISE ends here') + await sleep(1) + done() + } + await sleep(1) + done() + }) + + /** + * @tc.number : VIDEO_OUTPUT_STOP_PROMISE + * @tc.name : VideoOutput stop promise api + * @tc.desc : VideoOutput stop promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEO_OUTPUT_STOP_PROMISE', 0, async function (done) { + if (videoOutputPromise == null || videoOutputPromise == undefined) { + console.info(TAG + 'Entering Video Output Stop videoOutputPromise == null || undefined') + } else { + console.info(TAG + 'Entering VIDEO_OUTPUT_STOP_PROMISE to operate') + await videoOutputPromise.stop() + expect(true).assertTrue() + console.info(TAG + 'Entering VIDEO_OUTPUT_STOP_PROMISE PASSED') + console.info(TAG + 'Entering VIDEO_OUTPUT_STOP_PROMISE ends here') + await sleep(1) + done() + } + await sleep(1) + done() + }) + + /** + * @tc.number : CAPTURE_SESSION_STOP_PROMISE + * @tc.name : CaptureSession stop promise api + * @tc.desc : CaptureSession stop promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_STOP_PROMISE', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + 'Entering Capture Session Stop captureSessionPromise == null || undefined') + } else { + console.info(TAG + 'Entering CAPTURE_SESSION_STOP_PROMISE to operate') + await captureSessionPromise.stop() + expect(true).assertTrue() + console.info(TAG + 'Entering CAPTURE_SESSION_STOP_PROMISE PASSED') + console.info(TAG + 'Entering CAPTURE_SESSION_STOP_PROMISE ends here') + await sleep(1) + done() + } + await sleep(1) + done() + }) + + /** + * @tc.number : CAPTURE_SESSION_RELEASE_PROMISE + * @tc.name : CaptureSession release promise api + * @tc.desc : CaptureSession release promise api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAPTURE_SESSION_RELEASE_PROMISE', 0, async function (done) { + if (captureSessionPromise == null || captureSessionPromise == undefined) { + console.info(TAG + 'Entering Capture session release captureSessionPromise == null || undefined') + } else { + console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE_PROMISE to operate') + await captureSessionPromise.release() + expect(true).assertTrue() + console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE_PROMISE PASSED') + console.info(TAG + 'Entering CAPTURE_SESSION_RELEASE_PROMISE ends here') + await sleep(1) + done() + } + await sleep(1) + done() + }) + + /** + * @tc.number : VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE + * @tc.name : videoOutput release api + * @tc.desc : videoOutput release api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE', 0, async function (done) { + if (videoOutputPromise == null || videoOutputPromise == undefined) { + console.info(TAG + "Entering Video Output release previewOutputPromise == null || undefined"); + } else { + console.info(TAG + "Entering VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE to operate"); + await videoOutputPromise.release(); + expect(true).assertTrue(); + console.info(TAG + "Entering VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE PASSED"); + console.info(TAG + "Entering VIDEOOUTPUT_RELEASE_SUCCESS_PROMISE ends here"); + await sleep(1); + done(); + } + await sleep(1) + done() + }) + + /** + * @tc.number : PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE + * @tc.name : PreviewOutput release api + * @tc.desc : PreviewOutput release api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE', 0, async function (done) { + if (previewOutputPromise == null || previewOutputPromise == undefined) { + console.info(TAG + "Entering previewOutputPromise.release previewOutputPromise == null || undefined"); + } else { + console.info(TAG + "Entering PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE to operate"); + await previewOutputPromise.release(); + expect(true).assertTrue(); + console.info(TAG + "Entering PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE PASSED"); + console.info(TAG + "Entering PREVIEWOUTPUT_RELEASE_SUCCESS_PROMISE ends here"); + await sleep(1); + done(); + } + await sleep(1) + done() + }) + + /** + * @tc.number : CAMERAINPUT_RELEASE_SUCCESS_PROMISE + * @tc.name : cameraInput release api + * @tc.desc : cameraInput release api + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('CAMERAINPUT_RELEASE_SUCCESS_PROMISE', 0, async function (done) { + if (camera0InputPromise == null || camera0InputPromise == undefined) { + console.info(TAG + "Entering camera0InputPromise.release camera0InputPromise == null || undefined"); + } else { + console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS_PROMISE to operate"); + await camera0InputPromise.release(); + expect(true).assertTrue(); + console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS_PROMISE PASSED"); + console.info(TAG + "Entering CAMERAINPUT_RELEASE_SUCCESS_PROMISE ends here"); + await sleep(1); + done(); + } + await sleep(1) + done() + }) + }) +} \ No newline at end of file diff --git a/multimedia/camera/cameraDepthOffield/src/main/resources/base/element/string.json b/multimedia/camera/camera_js_standard/src/main/resources/base/element/string.json similarity index 100% rename from multimedia/camera/cameraDepthOffield/src/main/resources/base/element/string.json rename to multimedia/camera/camera_js_standard/src/main/resources/base/element/string.json diff --git a/multimedia/camera/camera_js_standard/src/main/resources/base/media/icon.png b/multimedia/camera/camera_js_standard/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/camera/camera_js_standard/src/main/resources/base/media/icon.png differ diff --git a/multimedia/image/image_js_standard/image/BUILD.gn b/multimedia/image/image_js_standard/image/BUILD.gn index b119740d4740f5c5d73518b6b914509c3303130c..a23a14c7f19bedcb9d23cc2e46ca36b1936bf852 100644 --- a/multimedia/image/image_js_standard/image/BUILD.gn +++ b/multimedia/image/image_js_standard/image/BUILD.gn @@ -22,7 +22,7 @@ ohos_js_hap_suite("image_js_hap") { certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsImageJsTest" subsystem_name = "multimedia" - part_name = "multimedia_image_standard" + part_name = "multimedia_image_framework" } ohos_js_assets("image_js_assets") { js2abc = true diff --git a/multimedia/image/image_js_standard/image/src/main/config.json b/multimedia/image/image_js_standard/image/src/main/config.json index bccf64ec9b2c1775dcececeea48e16f9bcd81a7b..3fe43fd2b28b20713db0f430e91f686407644e4a 100644 --- a/multimedia/image/image_js_standard/image/src/main/config.json +++ b/multimedia/image/image_js_standard/image/src/main/config.json @@ -57,6 +57,7 @@ } ], "deviceType": [ + "default", "phone", "tablet", "tv", 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 6f82489e3d5de962d7d8e5c2b07f4b03c26df8f4..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,11 +58,118 @@ 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(); + } } /** - * @tc.number : addImage_001 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0100 * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 1, alphaType: 0) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size @@ -71,13 +179,13 @@ export default function addImage() { * @tc.type : Functional * @tc.level : Level 0 */ - it('add_01_001', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 1, alphaType: 0 } - createPixMapPromise(done, 'add_01_001', 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 : add_01_002 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0200 * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 1, alphaType: 1) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size @@ -87,13 +195,13 @@ export default function addImage() { * @tc.type : Functional * @tc.level : Level 0 */ - it('add_01_002', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 1, alphaType: 1 } - createPixMapPromise(done, 'add_01_002', 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 : add_01_003 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0300 * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 0, alphaType: 2) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size @@ -103,13 +211,13 @@ export default function addImage() { * @tc.type : Functional * @tc.level : Level 0 */ - it('add_01_003', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 0, alphaType: 2 } - createPixMapPromise(done, 'add_01_003', 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 : add_01_004 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0400 * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 0, alphaType: 3) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size @@ -119,13 +227,13 @@ export default function addImage() { * @tc.type : Functional * @tc.level : Level 0 */ - it('add_01_004', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 0, alphaType: 3 } - createPixMapPromise(done, 'add_01_004', 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 : add_02_001 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0100 * @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 0, alphaType: 0) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size @@ -135,13 +243,13 @@ export default function addImage() { * @tc.type : Functional * @tc.level : Level 0 */ - it('add_02_001', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 0, alphaType: 0 } - createPixMapCb(done, 'add_02_001', 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 : add_02_002 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0200 * @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 0, alphaType: 1) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size @@ -151,13 +259,13 @@ export default function addImage() { * @tc.type : Functional * @tc.level : Level 0 */ - it('add_02_002', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 0, alphaType: 1 } - createPixMapCb(done, 'add_02_002', 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 : add_02_003 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0300 * @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 1, alphaType: 2) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size @@ -167,13 +275,13 @@ export default function addImage() { * @tc.type : Functional * @tc.level : Level 0 */ - it('add_02_003', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 1, alphaType: 2 } - createPixMapCb(done, 'add_02_003', 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 : add_02_004 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0400 * @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer,scaleMode: 1, alphaType: 3) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size @@ -183,122 +291,85 @@ export default function addImage() { * @tc.type : Functional * @tc.level : Level 0 */ - it('add_02_004', 0, async function (done) { - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }, scaleMode: 1, alphaType: 3 } - createPixMapCb(done, 'add_02_004', 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 : add_053 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0100 * @tc.name : createIncrementalSource-updateData-png-promise * @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('add_053', 0, async function (done) { - try { - let testimagebuffer = testPng; - console.info('add_053 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('add_053 0006 ' + testimagebuffer.length); - var oneStep = testimagebuffer.slice(offset, offset + bufferSize); - console.info('add_053 0007 ' + oneStep.length); - if (oneStep.length < bufferSize) { - isFinished = true; - } - ret = await incSouce.updateData(oneStep, isFinished, 0, oneStep.length); - if (!ret) { - console.info('add_053 updateData failed'); - expect(ret).assertTrue(); - break; - } - offset = offset + oneStep.length; - console.info('add_053 0011 ' + offset); - } - if (ret) { - console.info('add_053 updateData success '); - let decodingOptions = { - sampleSize: 1 - }; - incSouce.createPixelMap(decodingOptions, (err, pixelmap) => { - console.info('add_053 0014' + pixelmap); - expect(pixelmap != undefined).assertTrue(); - done(); - }) - } else { - expect(false).assertTrue(); - done(); - } - } catch (error) { - expect(false).assertTrue(); - console.info('add_053 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 : add_053-1 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_PNG_PROMISE_0200 * @tc.name : createIncrementalSource-updateData-png-promise * @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('add_053-1', 0, async function (done) { - try { - let testimagebuffer = testPng; - console.info('add_053-1 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('add_053-1 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('add_053-1 updateData failed'); - expect(ret).assertTrue(); - break; - } - offset = offset + oneStep.length; - console.info('add_053-1 0003 ' + offset); - } - if (ret) { - console.info('add_053-1 updateData success '); - let decodingOptions = { - sampleSize: 1 - }; - incSouce.createPixelMap(decodingOptions, (err, pixelmap) => { - console.info('add_053-1 0004' + pixelmap); - expect(pixelmap != undefined).assertTrue(); - done(); - }) - } else { - expect(false).assertTrue(); - done(); - } - } catch (error) { - expect(false).assertTrue(); - console.info('add_053-1 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/image/image_js_standard/image/src/main/js/test/image.test.js b/multimedia/image/image_js_standard/image/src/main/js/test/image.test.js index 0bc1564a76955a1787c51a3378b5aa4319aad74e..d4507d959d6876fe39dd7b3e191f9bf1a1a7cc04 100644 --- a/multimedia/image/image_js_standard/image/src/main/js/test/image.test.js +++ b/multimedia/image/image_js_standard/image/src/main/js/test/image.test.js @@ -65,7 +65,7 @@ export default function imageJsTest() { }) /** - * @tc.number : TC_001 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0500 * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size @@ -75,25 +75,25 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_001', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0500', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts) .then(pixelmap => { globalpixelmap = pixelmap; expect(pixelmap != undefined).assertTrue(); - console.info('TC_001 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0500 success'); done(); }) .catch(error => { - console.log('TC_001 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0500 error: ' + error); expect().assertFail(); done(); }) }) /** - * @tc.number : TC_001-1 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0500 * @tc.name : create pixelmap-callback (editable: false, pixelFormat: RGBA_8888, size: { height: 4, width: 6 },bytes = buffer) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixelFormat,size @@ -103,19 +103,19 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_001-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0500', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: false, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts, (err, pixelmap) => { globalpixelmap = pixelmap; expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-1 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0500 success'); done(); }) }) /** - * @tc.number : TC_001-2 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0600 * @tc.name : createpixelmap-promise (editable: true, pixelFormat: RGB_565, size: { height: 6, width: 8 },bytes = buffer) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixelFormat,size @@ -125,25 +125,25 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_001-2', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0600', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } image.createPixelMap(Color, opts) .then(pixelmap => { globalpixelmap = pixelmap; expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-2 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0600 success'); done(); }) .catch(error => { - console.log('TC_001-2 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0600 error: ' + error); expect().assertFail(); done(); }) }) /** - * @tc.number : TC_001-3 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0600 * @tc.name : createpixelmap-callback (editable: false, pixelFormat: RGB_565, size: { height: 6, width: 8 },bytes = buffer) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixelFormat,size @@ -153,20 +153,20 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_001-3', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0600', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: false, pixelFormat: 2, size: { height: 6, width: 8 } } image.createPixelMap(Color, opts, (err, pixelmap) => { globalpixelmap = pixelmap; expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-3 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0600 success'); done(); }) }) /** - * @tc.number : TC_001-4 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0700 * @tc.name : createpixelmap-promise(editable: true, pixelFormat: unkonwn, size: { height: 6, width: 8 }) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixelFormat,size @@ -176,25 +176,25 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_001-4', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0700', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 0, size: { height: 6, width: 8 } } image.createPixelMap(Color, opts) .then(pixelmap => { globalpixelmap = pixelmap; expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-4 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0700 success'); done(); }) .catch(error => { - console.log('TC_001-4 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0700 error: ' + error); expect().assertFail(); done(); }) }) /** - * @tc.number : TC_001-5 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0700 * @tc.name : create pixelmap-callback(editable: false, pixelFormat: unkonwn, size: { height: 6, width: 8 }) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixelFormat,size @@ -204,19 +204,19 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_001-5', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0700', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: false, pixelFormat: 0, size: { height: 6, width: 8 } } image.createPixelMap(Color, opts, (err, pixelmap) => { globalpixelmap = pixelmap; expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-5 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0700 success'); done(); }) }) /** - * @tc.number : TC_001-6 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0800 * @tc.name : create pixelmap-callback(editable: true, pixelFormat: RGBA_8888, size: { height: 6, width: 8 } bytes > buffer ) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size @@ -226,19 +226,19 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_001-6', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0800', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 3, size: { height: 6, width: 8 } } image.createPixelMap(Color, opts, (err, pixelmap) => { globalpixelmap = pixelmap; expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-6 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0800 success'); done(); }) }) /** - * @tc.number : TC_001-7 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0900 * @tc.name : create pixelmap-callback(editable: true, pixelFormat: RGB_565, size: { height: 2, width: 3 }, bytes < buffer) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size @@ -248,19 +248,19 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_001-7', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0900', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 2, size: { height: 2, width: 3 } } image.createPixelMap(Color, opts, (err, pixelmap) => { globalpixelmap = pixelmap; expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-7 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_0900 success'); done(); }) }) /** - * @tc.number : TC_001-8 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1000 * @tc.name : create pixelmap-callback(editable: true, pixelFormat: unkonwn, size: { height: -1, width: -1 }) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size @@ -270,19 +270,19 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_001-8', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1000', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 0, size: { height: -1, width: -1 } } image.createPixelMap(Color, opts, (err, pixelmap) => { globalpixelmap = pixelmap; expect(pixelmap == undefined).assertTrue(); - console.info('TC_001-8 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1000 success'); done(); }) }) /** - * @tc.number : TC_001-9 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1100 * @tc.name : create pixelmap-callback(editable: true, pixelFormat: unsupported format, size: { height: 6, width: 8 }) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size(Unsupported formats are converted to RGBA_8888) @@ -292,19 +292,19 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_001-9', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1100', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 21, size: { height: 6, width: 8 } } image.createPixelMap(Color, opts, (err, pixelmap) => { globalpixelmap = pixelmap; expect(pixelmap != undefined).assertTrue(); - console.info('TC_001-9 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1100 success'); done(); }) }) /** - * @tc.number : TC_020 + * @tc.number : SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_PROMISE_0100 * @tc.name : readPixelsToBuffer-promise * @tc.desc : read all pixels to an buffer * 1.create PixelMap,buffer @@ -314,8 +314,8 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_020', 0, async function (done) { - console.info('TC_020 in'); + it('SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_PROMISE_0100', 0, async function (done) { + console.info('SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_PROMISE_0100 in'); const color = new ArrayBuffer(96); var bufferArr = new Uint8Array(color); for (var i = 0; i < bufferArr.length; i++) { @@ -327,7 +327,7 @@ export default function imageJsTest() { .then(pixelmap => { globalpixelmap = pixelmap; if (pixelmap == undefined) { - console.info('TC_020 createPixelMap failed'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_PROMISE_0100 createPixelMap failed'); expect(false).assertTrue() done(); } @@ -339,31 +339,31 @@ export default function imageJsTest() { if (bufferArr2[i] != tcBuf020[i]) { res = false; console.info('TC_20_buffer' + bufferArr2[i]); - console.info('TC_020 failed'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_PROMISE_0100 failed'); expect(false).assertTrue(); done(); break; } } if (res) { - console.info('TC_020 success'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_PROMISE_0100 success'); expect(true).assertTrue() done(); } }).catch(error => { - console.log('TC_020 read error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_PROMISE_0100 read error: ' + error); expect().assertFail(); done(); }) }).catch(error => { - console.log('TC_020 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_PROMISE_0100 error: ' + error); expect().assertFail(); done(); }) }) /** - * @tc.number : TC_020-1 + * @tc.number : SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_CALLBACK_0100 * @tc.name : readPixelsToBuffer-callback * @tc.desc : read all pixels to an buffer * 1.create PixelMap,buffer @@ -373,8 +373,8 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_020-1', 0, async function (done) { - console.info('TC_020-1 in'); + it('SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_CALLBACK_0100', 0, async function (done) { + console.info('SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_CALLBACK_0100 in'); const color = new ArrayBuffer(96); var bufferArr = new Uint8Array(color); for (var i = 0; i < bufferArr.length; i++) { @@ -385,7 +385,7 @@ export default function imageJsTest() { image.createPixelMap(color, opts, (err, pixelmap) => { globalpixelmap = pixelmap; if (pixelmap == undefined) { - console.info('TC_020-1 createPixelMap failed'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_CALLBACK_0100 createPixelMap failed'); expect(false).assertTrue(); done(); } else { @@ -396,14 +396,14 @@ export default function imageJsTest() { for (var i = 0; i < bufferArr.length; i++) { if (bufferArr[i] != tcBuf020_1[i]) { res = false; - console.info('TC_020-1 failed'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_CALLBACK_0100 failed'); expect(false).assertTrue(); done(); break; } } if (res) { - console.info('TC_020-1 success'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_CALLBACK_0100 success'); expect(true).assertTrue() done(); } @@ -413,7 +413,7 @@ export default function imageJsTest() { }) /** - * @tc.number : TC_020-2 + * @tc.number : SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_CALLBACK_0200 * @tc.name : readPixelsToBuffer-callback(buffer:0) * @tc.desc : read all pixels to an buffer * 1.create PixelMap,buffer @@ -423,8 +423,8 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_020-2', 0, async function (done) { - console.info('TC_020-2 in'); + it('SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_CALLBACK_0200', 0, async function (done) { + console.info('SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_CALLBACK_0200 in'); const color = new ArrayBuffer(96); var bufferArr = new Uint8Array(color); for (var i = 0; i < bufferArr.length; i++) { @@ -435,7 +435,7 @@ export default function imageJsTest() { image.createPixelMap(color, opts, (err, pixelmap) => { globalpixelmap = pixelmap; if (pixelmap == undefined) { - console.info('TC_020-2 createPixelMap failed'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_CALLBACK_0200 createPixelMap failed'); expect(false).assertTrue(); done(); } else { @@ -446,14 +446,14 @@ export default function imageJsTest() { for (var i = 0; i < bufferArr.length; i++) { if (bufferArr[i] == 0) { res = false; - console.info('TC_020-2 failed'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_CALLBACK_0200 failed'); expect(false).assertTrue(); done(); break; } } if (res) { - console.info('TC_020-2 success'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_CALLBACK_0200 success'); expect(true).assertTrue() done(); } @@ -463,7 +463,7 @@ export default function imageJsTest() { }) /** - * @tc.number : TC_021 + * @tc.number : SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0100 * @tc.name : readPixels-promise * @tc.desc : 1.create PixelMap * 2.call readPixels @@ -473,7 +473,7 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_021', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0100', 0, async function (done) { const color = new ArrayBuffer(96); var bufferArr = new Uint8Array(color); for (var i = 0; i < bufferArr.length; i++) { @@ -484,7 +484,7 @@ export default function imageJsTest() { .then(pixelmap => { globalpixelmap = pixelmap; if (pixelmap == undefined) { - console.info('TC_021 createPixelMap failed'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0100 createPixelMap failed'); expect(false).assertTrue() done(); } @@ -500,28 +500,28 @@ export default function imageJsTest() { for (var i = 0; i < bufferArr2.length; i++) { if (bufferArr2[i] != tcBuf021[i]) { res = false; - console.info('TC_021 failed'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0100 failed'); expect(false).assertTrue(); done(); break; } } if (res) { - console.info('TC_021 success'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0100 success'); expect(true).assertTrue() done(); } }) }) .catch(error => { - console.log('TC_021 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0100 error: ' + error); expect().assertFail(); done(); }) }) /** - * @tc.number : TC_021-1 + * @tc.number : SUB_GRAPHIC_IMAGE_READPIXELS_CALLBACK_0100 * @tc.name : readPixels-callback * @tc.desc : 1.create PixelMap * 2.call readPixels @@ -531,7 +531,7 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_021-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_READPIXELS_CALLBACK_0100', 0, async function (done) { const color = new ArrayBuffer(96); var bufferArr = new Uint8Array(color); for (var i = 0; i < bufferArr.length; i++) { @@ -541,7 +541,7 @@ export default function imageJsTest() { image.createPixelMap(color, opts, (err, pixelmap) => { globalpixelmap = pixelmap; if (pixelmap == undefined) { - console.info('TC_020-1 createPixelMap failed'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELSTOBUFFER_CALLBACK_0100 createPixelMap failed'); expect(false).assertTrue(); done(); } else { @@ -555,17 +555,17 @@ export default function imageJsTest() { var bufferArr = new Uint8Array(area.pixels); var res = true; for (var i = 0; i < bufferArr.length; i++) { - console.info('TC_021-1 buffer ' + bufferArr[i]); + console.info('SUB_GRAPHIC_IMAGE_READPIXELS_CALLBACK_0100 buffer ' + bufferArr[i]); if (bufferArr[i] != tcBuf021_1[i]) { res = false; - console.info('TC_021-1 failed'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELS_CALLBACK_0100 failed'); expect(false).assertTrue(); done(); break; } } if (res) { - console.info('TC_021-1 success'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELS_CALLBACK_0100 success'); expect(true).assertTrue() done(); } @@ -575,7 +575,7 @@ export default function imageJsTest() { }) /** - * @tc.number : TC_021-2 + * @tc.number : SUB_GRAPHIC_IMAGE_READPIXELS_CALLBACK_0200 * @tc.name : readPixels-callback( region: { size: { height: 1, width: 2 }, x: -1, y: -1 }) * @tc.desc : 1.create PixelMap * 2.call readPixels @@ -585,7 +585,7 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_021-2', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_READPIXELS_CALLBACK_0200', 0, async function (done) { const color = new ArrayBuffer(96); var bufferArr = new Uint8Array(color); for (var i = 0; i < bufferArr.length; i++) { @@ -596,7 +596,7 @@ export default function imageJsTest() { globalpixelmap = pixelmap; if (pixelmap == undefined) { expect(false).assertTrue(); - console.info('TC_021-2 create pixelmap fail'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELS_CALLBACK_0200 create pixelmap fail'); done(); } else { const area = { @@ -606,12 +606,12 @@ export default function imageJsTest() { region: { size: { height: 1, width: 2 }, x: -1, y: -1 } } pixelmap.readPixels(area).then(() => { - console.info('TC_021-2 failed'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELS_CALLBACK_0200 failed'); expect(false).assertTrue(); done(); }).catch(() => { expect(true).assertTrue(); - console.info('TC_021-2 success'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELS_CALLBACK_0200 success'); done(); }) } @@ -619,7 +619,7 @@ export default function imageJsTest() { }) /** - * @tc.number : TC_021-3 + * @tc.number : SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0200 * @tc.name : readPixels-promise(buffer:0) * @tc.desc : 1.create PixelMap * 2.call readPixels @@ -629,7 +629,7 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_021-3', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0200', 0, async function (done) { const color = new ArrayBuffer(96); var bufferArr = new Uint8Array(color); for (var i = 0; i < bufferArr.length; i++) { @@ -640,7 +640,7 @@ export default function imageJsTest() { globalpixelmap = pixelmap; if (pixelmap == undefined) { expect(false).assertTrue(); - console.info('TC_021-3 create pixelmap failed'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0200 create pixelmap failed'); done(); } else { const area = { @@ -650,12 +650,12 @@ export default function imageJsTest() { region: { size: { height: 1, width: 2 }, x: 0, y: 0 } } pixelmap.readPixels(area).then(() => { - console.info('TC_021-3 failed'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0200 failed'); expect(false).assertTrue(); done(); }).catch(() => { expect(true).assertTrue(); - console.info('TC_021-3 success'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0200 success'); done(); }) } @@ -663,7 +663,7 @@ export default function imageJsTest() { }) /** - * @tc.number : TC_021-4 + * @tc.number : SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0300 * @tc.name : readPixels-promise(offset > buffer) * @tc.desc : 1.create PixelMap * 2.call readPixels @@ -673,7 +673,7 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_021-4', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0300', 0, async function (done) { const color = new ArrayBuffer(96); var bufferArr = new Uint8Array(color); for (var i = 0; i < bufferArr.length; i++) { @@ -684,7 +684,7 @@ export default function imageJsTest() { globalpixelmap = pixelmap; if (pixelmap == undefined) { expect(false).assertTrue(); - console.info('TC_021-4 createPixelMap success'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0300 createPixelMap success'); done(); } const area = { @@ -694,19 +694,19 @@ export default function imageJsTest() { region: { size: { height: 1, width: 2 }, x: 0, y: 0 } } pixelmap.readPixels(area).then(() => { - console.info('TC_021-4 failed'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0300 failed'); expect(false).assertTrue(); done(); }).catch(() => { expect(true).assertTrue(); - console.info('TC_021-4 success'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0300 success'); done(); }) }) }) /** - * @tc.number : TC_021-5 + * @tc.number : SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0400 * @tc.name : readPixels-promise(region: { size: { height: -1, width:-1}, x: 0, y: 0 }) * @tc.desc : 1.create PixelMap * 2.call readPixels @@ -716,7 +716,7 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_021-5', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0400', 0, async function (done) { const color = new ArrayBuffer(96); var bufferArr = new Uint8Array(color); for (var i = 0; i < bufferArr.length; i++) { @@ -727,7 +727,7 @@ export default function imageJsTest() { globalpixelmap = pixelmap; if (pixelmap == undefined) { expect(false).assertTrue(); - console.info('TC_021-5 createPixelMap success'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0400 createPixelMap success'); done(); } const area = { @@ -737,19 +737,19 @@ export default function imageJsTest() { region: { size: { height: -1, width: -1 }, x: 0, y: 0 } } pixelmap.readPixels(area).then(() => { - console.info('TC_021-5 failed'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0400 failed'); expect(false).assertTrue(); done(); }).catch(() => { expect(true).assertTrue(); - console.info('TC_021-5 success'); + console.info('SUB_GRAPHIC_IMAGE_READPIXELS_PROMISE_0400 success'); done(); }) }) }) /** - * @tc.number : TC_022 + * @tc.number : SUB_GRAPHIC_IMAGE_WRITEPIXELS_PROMISE_0100 * @tc.name : writePixels-promise * @tc.desc : 1.create PixelMap * 2.call writePixels @@ -759,14 +759,14 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_022', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_WRITEPIXELS_PROMISE_0100', 0, async function (done) { const color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(color, opts) .then(pixelmap => { globalpixelmap = pixelmap; if (pixelmap == undefined) { - console.info('TC_022 createPixelMap failed'); + console.info('SUB_GRAPHIC_IMAGE_WRITEPIXELS_PROMISE_0100 createPixelMap failed'); expect(false).assertTrue() done(); } @@ -796,14 +796,14 @@ export default function imageJsTest() { for (var i = 0; i < readArr.length; i++) { if (readArr[i] != tcBuf022[i]) { res = false; - console.info('TC_022 failed'); + console.info('SUB_GRAPHIC_IMAGE_WRITEPIXELS_PROMISE_0100 failed'); expect(false).assertTrue(); done(); break; } } if (res) { - console.info('TC_022 success'); + console.info('SUB_GRAPHIC_IMAGE_WRITEPIXELS_PROMISE_0100 success'); expect(true).assertTrue() done(); } @@ -811,14 +811,14 @@ export default function imageJsTest() { }) }) .catch(error => { - console.log('TC_022 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_WRITEPIXELS_PROMISE_0100 error: ' + error); expect().assertFail(); done(); }) }) /** - * @tc.number : TC_022-1 + * @tc.number : SUB_GRAPHIC_IMAGE_WRITEPIXELS_CALLBACK_0100 * @tc.name : writePixels-callback * @tc.desc : 1.create PixelMap * 2.call writePixels @@ -828,14 +828,14 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_022-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_WRITEPIXELS_CALLBACK_0100', 0, async function (done) { try { const color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(color, opts, (err, pixelmap) => { globalpixelmap = pixelmap; if (pixelmap == undefined) { - console.info('TC_022-1 createPixelMap failed'); + console.info('SUB_GRAPHIC_IMAGE_WRITEPIXELS_CALLBACK_0100 createPixelMap failed'); expect(false).assertTrue() done(); } @@ -862,14 +862,14 @@ export default function imageJsTest() { for (var i = 0; i < readArr.length; i++) { if (readArr[i] != tcBuf022[i]) { res = false; - console.info('TC_022-1 failed'); + console.info('SUB_GRAPHIC_IMAGE_WRITEPIXELS_CALLBACK_0100 failed'); expect(false).assertTrue(); done(); break; } } if (res) { - console.info('TC_022-1 success'); + console.info('SUB_GRAPHIC_IMAGE_WRITEPIXELS_CALLBACK_0100 success'); expect(true).assertTrue() done(); } @@ -877,14 +877,14 @@ export default function imageJsTest() { }) }) } catch (error) { - console.info('TC_022-1 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_WRITEPIXELS_CALLBACK_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_023 + * @tc.number : SUB_GRAPHIC_IMAGE_WRITEBUFFERTOPIXELS_PROMISE_0100 * @tc.name : writeBufferToPixels-promise * @tc.desc : 1.create PixelMap,buffer * 2.call writeBufferToPixels @@ -894,14 +894,14 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_023', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_WRITEBUFFERTOPIXELS_PROMISE_0100', 0, async function (done) { const color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(color, opts) .then(pixelmap => { globalpixelmap = pixelmap; if (pixelmap == undefined) { - console.info('TC_023 createPixelMap failed'); + console.info('SUB_GRAPHIC_IMAGE_WRITEBUFFERTOPIXELS_PROMISE_0100 createPixelMap failed'); expect(false).assertTrue() done(); } @@ -919,14 +919,14 @@ export default function imageJsTest() { for (var i = 0; i < bufferArr.length; i++) { if (bufferArr[i] == 0) { res = false; - console.info('TC_023 failed'); + console.info('SUB_GRAPHIC_IMAGE_WRITEBUFFERTOPIXELS_PROMISE_0100 failed'); expect(false).assertTrue() done(); break; } } if (res) { - console.info('TC_023 success'); + console.info('SUB_GRAPHIC_IMAGE_WRITEBUFFERTOPIXELS_PROMISE_0100 success'); expect(true).assertTrue(); done(); } @@ -934,14 +934,14 @@ export default function imageJsTest() { }) }) .catch(error => { - console.log('TC_023 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_WRITEBUFFERTOPIXELS_PROMISE_0100 error: ' + error); expect().assertFail(); done(); }) }) /** - * @tc.number : TC_023-1 + * @tc.number : SUB_GRAPHIC_IMAGE_WRITEBUFFERTOPIXELS_CALLBACK_0100 * @tc.name : writeBufferToPixels-callback * @tc.desc : 1.create PixelMap,buffer * 2.call writeBufferToPixels @@ -951,7 +951,7 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_023-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_WRITEBUFFERTOPIXELS_CALLBACK_0100', 0, async function (done) { const color = new ArrayBuffer(96); var bufferArr = new Uint8Array(color); for (var i = 0; i < bufferArr.length; i++) { @@ -962,7 +962,7 @@ export default function imageJsTest() { globalpixelmap = pixelmap; if (pixelmap == undefined) { expect(false).assertTrue() - console.info('TC_023-1 failed'); + console.info('SUB_GRAPHIC_IMAGE_WRITEBUFFERTOPIXELS_CALLBACK_0100 failed'); done(); } const writeColor = new ArrayBuffer(96); @@ -975,7 +975,7 @@ export default function imageJsTest() { if (res) { if (bufferArr[i] == 0) { res = false; - console.info('TC_023-1 Success'); + console.info('SUB_GRAPHIC_IMAGE_WRITEBUFFERTOPIXELS_CALLBACK_0100 Success'); expect(true).assertTrue() done(); break; @@ -983,7 +983,7 @@ export default function imageJsTest() { } } if (res) { - console.info('TC_023-1 no change after writeBuffer'); + console.info('SUB_GRAPHIC_IMAGE_WRITEBUFFERTOPIXELS_CALLBACK_0100 no change after writeBuffer'); expect(false).assertTrue(); done(); } @@ -993,7 +993,7 @@ export default function imageJsTest() { }) /** - * @tc.number : TC_024 + * @tc.number : SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PIXELMAP_PROMISE_0100 * @tc.name : getImageInfo-pixelmap-promise * @tc.desc : 1.create PixelMap,ImageInfo * 2.call getImageInfo @@ -1003,45 +1003,45 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_024', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PIXELMAP_PROMISE_0100', 0, async function (done) { const color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } image.createPixelMap(color, opts) .then(pixelmap => { globalpixelmap = pixelmap; if (pixelmap == undefined) { - console.info('TC_024 createPixelMap failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PIXELMAP_PROMISE_0100 createPixelMap failed'); expect(false).assertTrue() done(); } pixelmap.getImageInfo().then(imageInfo => { if (imageInfo == undefined) { - console.info('TC_024 imageInfo is empty'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PIXELMAP_PROMISE_0100 imageInfo is empty'); expect(false).assertTrue() done(); } if (imageInfo.size.height == 4 && imageInfo.size.width == 6) { - console.info('TC_024 success '); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PIXELMAP_PROMISE_0100 success '); expect(true).assertTrue() done(); } done(); }).catch(error => { - console.log('TC_024 getimageinfo error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PIXELMAP_PROMISE_0100 getimageinfo error: ' + error); expect().assertFail(); done(); }) done(); }) .catch(error => { - console.log('TC_024 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PIXELMAP_PROMISE_0100 error: ' + error); expect().assertFail(); done(); }) }) /** - * @tc.number : TC_024-1 + * @tc.number : SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PIXELMAP_CALLBACK_0100 * @tc.name : getImageInfo-pixelmap-callback * @tc.desc : 1.create PixelMap,ImageInfo * 2.call getImageInfo @@ -1051,24 +1051,24 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_024-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PIXELMAP_CALLBACK_0100', 0, async function (done) { const color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(color, opts, (err, pixelmap) => { if (pixelmap == undefined) { globalpixelmap = pixelmap; expect(false).assertTrue() - console.info('TC_024-1 create pixelmap fail'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PIXELMAP_CALLBACK_0100 create pixelmap fail'); done(); } pixelmap.getImageInfo((err, imageInfo) => { if (imageInfo == undefined) { - console.info('TC_024-1 imageInfo is empty'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PIXELMAP_CALLBACK_0100 imageInfo is empty'); expect(false).assertTrue() done(); } if (imageInfo.size.height == 4 && imageInfo.size.width == 6) { - console.info('TC_024-1 imageInfo success'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PIXELMAP_CALLBACK_0100 imageInfo success'); expect(true).assertTrue() done(); } @@ -1078,7 +1078,7 @@ export default function imageJsTest() { }) /** - * @tc.number : TC_025-1 + * @tc.number : SUB_GRAPHIC_IMAGE_GETBYTESNUMBERPERROW_0100 * @tc.name : getBytesNumberPerRow * @tc.desc : 1.create PixelMap * 2.set PixelMap @@ -1089,7 +1089,7 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_025-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETBYTESNUMBERPERROW_0100', 0, async function (done) { const color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } const expectNum = 4 * opts.size.width; @@ -1101,7 +1101,7 @@ export default function imageJsTest() { done(); } else { const num = pixelmap.getBytesNumberPerRow(); - console.info('TC_025-1 num is ' + num); + console.info('SUB_GRAPHIC_IMAGE_GETBYTESNUMBERPERROW_0100 num is ' + num); expect(num == expectNum).assertTrue(); if (num == expectNum) { console.info('TC_25-1 success'); @@ -1114,7 +1114,7 @@ export default function imageJsTest() { }) /** - * @tc.number : TC_026-1 + * @tc.number : SUB_GRAPHIC_IMAGE_GETBYTESNUMBERPERROW_0200 * @tc.name : getPixelBytesNumber * @tc.desc : 1.create PixelMap * 2.set Pixel @@ -1125,7 +1125,7 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_026-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETBYTESNUMBERPERROW_0200', 0, async function (done) { const color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } const expectNum = 4 * opts.size.width * opts.size.height; @@ -1133,16 +1133,16 @@ export default function imageJsTest() { globalpixelmap = pixelmap; if (pixelmap == undefined) { expect(false).assertTrue() - console.info('TC_026-1 create pixelmap fail'); + console.info('SUB_GRAPHIC_IMAGE_GETBYTESNUMBERPERROW_0200 create pixelmap fail'); done(); } else { const num = pixelmap.getPixelBytesNumber(); - console.info('TC_026-1 num is ' + num); + console.info('SUB_GRAPHIC_IMAGE_GETBYTESNUMBERPERROW_0200 num is ' + num); expect(num == expectNum).assertTrue(); if (num == expectNum) { - console.info('TC_026-1 success'); + console.info('SUB_GRAPHIC_IMAGE_GETBYTESNUMBERPERROW_0200 success'); } else { - console.info('TC_026-1 fail'); + console.info('SUB_GRAPHIC_IMAGE_GETBYTESNUMBERPERROW_0200 fail'); } done(); } @@ -1150,7 +1150,7 @@ export default function imageJsTest() { }) /** - * @tc.number : TC_027 + * @tc.number : SUB_GRAPHIC_IMAGE_RELEASE_PIXELMAP_PROMISE_0100 * @tc.name : release-pixelmap-promise * @tc.desc : 1.create PixelMap * 2.set Pixel @@ -1160,34 +1160,34 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_027', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RELEASE_PIXELMAP_PROMISE_0100', 0, async function (done) { const color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(color, opts).then(pixelmap => { globalpixelmap = pixelmap; if (pixelmap == undefined) { - console.info('TC_027 createPixelMap failed'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_PIXELMAP_PROMISE_0100 createPixelMap failed'); expect(false).assertTrue() done(); } pixelmap.release().then(() => { - console.info('TC_027 success'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_PIXELMAP_PROMISE_0100 success'); expect(true).assertTrue(); done(); }).catch(error => { - console.log('TC_027 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_RELEASE_PIXELMAP_PROMISE_0100 error: ' + error); expect().assertFail(); done(); }) }).catch(error => { - console.log('TC_027 createPixelMap failed error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_RELEASE_PIXELMAP_PROMISE_0100 createPixelMap failed error: ' + error); expect().assertFail(); done(); }) }) /** - * @tc.number : TC_027-1 + * @tc.number : SUB_GRAPHIC_IMAGE_RELEASE_PIXELMAP_CALLBACK_0100 * @tc.name : release-pixelmap-callback * @tc.desc : 1.create PixelMap * 2.set Pixel @@ -1197,19 +1197,19 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_027-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RELEASE_PIXELMAP_CALLBACK_0100', 0, async function (done) { const color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(color, opts, (err, pixelmap) => { globalpixelmap = pixelmap; if (pixelmap == undefined) { - console.info('TC_027-1 createPixelMap failed'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_PIXELMAP_CALLBACK_0100 createPixelMap failed'); expect(false).assertTrue() done(); } pixelmap.release(() => { expect(true).assertTrue(); - console.log('TC_027-1 success'); + console.log('SUB_GRAPHIC_IMAGE_RELEASE_PIXELMAP_CALLBACK_0100 success'); done(); }) }) @@ -1218,7 +1218,7 @@ export default function imageJsTest() { /** - * @tc.number : TC_041 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0100 * @tc.name : createImageSource(uri)-jpg * @tc.desc : 1.set uri * 2.call createImageSource(uri) @@ -1227,23 +1227,23 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_041', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); expect(imageSourceApi != undefined).assertTrue(); - console.info('TC_041 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0100 success'); fileio.closeSync(fdNumber); done(); } catch (error) { - console.info('TC_041 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_041-1 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0200 * @tc.name : createImageSource(uri)-bmp * @tc.desc : 1.seturi * 2.call createImageSource(uri) @@ -1252,22 +1252,22 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_041-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0200', 0, async function (done) { try { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); expect(imageSourceApi != undefined).assertTrue(); - console.info('TC_041-1 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_UR_0200 success'); done(); } catch (error) { - console.info('TC_041-1 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0200 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_041-2 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0300 * @tc.name : createImageSource(uri)-gif * @tc.desc : 1.seturi * 2.call createImageSource(uri) @@ -1276,15 +1276,15 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_041-2', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0300', 0, async function (done) { try { await getFd('test.gif'); const imageSourceApi = image.createImageSource(fdNumber); expect(imageSourceApi != undefined).assertTrue(); - console.info('TC_041-2 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0300 success'); done(); } catch (error) { - console.info('TC_041-2 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0300 error: ' + error); expect(false).assertTrue(); done(); } @@ -1292,7 +1292,7 @@ export default function imageJsTest() { }) /** - * @tc.number : TC_041-3 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0400 * @tc.name : createImageSource(uri)-png * @tc.desc : 1.seturi * 2.call createImageSource(uri) @@ -1301,15 +1301,15 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_041-3', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0400', 0, async function (done) { try { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); expect(imageSourceApi != undefined).assertTrue(); - console.info('TC_041-3 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0400 success'); done(); } catch (error) { - console.info('TC_041-3 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_0400 error: ' + error); expect(false).assertTrue(); done(); } @@ -1317,7 +1317,7 @@ export default function imageJsTest() { }) /** - * @tc.number : TC_041-4 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_ERROR_SUFFIXFILE_0100 * @tc.name : createImageSource(uri)-wrong suffix file * @tc.desc : 1.call createImageSource(uri) * 2.Incoming wrong suffix file @@ -1326,15 +1326,15 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_041-4', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_ERROR_SUFFIXFILE_0100', 0, async function (done) { const imageSourceApi = image.createImageSource('file:///data/local/tmp/test.123'); expect(imageSourceApi == undefined).assertTrue(); - console.info('TC_041-4 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_ERROR_SUFFIXFILE_0100 success'); done(); }) /** - * @tc.number : TC_041-5 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_ERROR_URI_0100 * @tc.name : createImageSource(uri)-wrong uri * @tc.desc : 1.call createImageSource(uri) * 2.set wrong uri @@ -1343,21 +1343,21 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_041-5', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_ERROR_URI_0100', 0, async function (done) { try { const imageSourceApi = image.createImageSource('file:///multimedia/test.jpg'); expect(imageSourceApi == undefined).assertTrue(); - console.info('TC_041-5 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_ERROR_URI_0100 success'); done(); } catch (error) { - console.info('TC_041-5 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_URI_ERROR_URI_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_042 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_0100 * @tc.name : createImageSource(fd) * @tc.desc : 1.call createImageSource * 2.set fd @@ -1366,19 +1366,19 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_042', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_042 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_0100 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo((err, imageInfo) => { if (err) { expect(false).assertTrue(); - console.info('TC_042 err: ' + err); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_0100 err: ' + err); done(); return } @@ -1387,7 +1387,7 @@ export default function imageJsTest() { fileio.closeSync(fdNumber); done(); } else { - console.info('TC_042 failed'); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_0100 failed'); expect(false).assertTrue(); done(); } @@ -1395,14 +1395,14 @@ export default function imageJsTest() { }) } } catch (error) { - console.info('TC_042 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_FD_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_042-1 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_0200 * @tc.name : createImageSource(fd) fd<0 * @tc.desc : 1.call createImageSource * 2.set wrong fd @@ -1411,15 +1411,15 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_042-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_0200', 0, async function (done) { const imageSourceApi = image.createImageSource(-2); expect(imageSourceApi == undefined).assertTrue(); - console.info('TC_042-1 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_0200 success'); done(); }) /** - * @tc.number : TC_043 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_0300 * @tc.name : createImageSource(data) * @tc.desc : 1.setdata * 2.createImageSource @@ -1428,16 +1428,16 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_043', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_0300', 0, async function (done) { const data = testJpg.buffer; const imageSourceApi = image.createImageSource(data); if (imageSourceApi == undefined) { - console.info('TC_043 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_0300 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo((err, imageInfo) => { - console.info('TC_043 imageInfo'); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_0300 imageInfo'); expect(imageInfo != undefined).assertTrue(); done(); }) @@ -1445,7 +1445,7 @@ export default function imageJsTest() { }) /** - * @tc.number : TC_043-1 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_0400 * @tc.name : createImageSource(data) buffer:0 * @tc.desc : 1.setdata * 2.createImageSource @@ -1454,16 +1454,16 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_043-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_0400', 0, async function (done) { const data = new ArrayBuffer(0); const imageSourceApi = image.createImageSource(data); expect(imageSourceApi == undefined).assertTrue(); - console.info('TC_043-1 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEIMAGESOURCE_0400 success'); done(); }) /** - * @tc.number : TC_044 + * @tc.number : SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_JPG_0100 * @tc.name : release-imagesource-promise-jpg * @tc.desc : 1.create ImageSource * 2.call release() @@ -1472,34 +1472,34 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_044', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_JPG_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_044 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_JPG_0100 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.release().then(() => { - console.info('TC_044 success'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_JPG_0100 success'); expect(true).assertTrue(); done(); }).catch(error => { - console.info('TC_044 error'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_JPG_0100 error'); expect(false).assertTrue(); done(); }) } } catch (error) { - console.info('TC_044 err:' + error); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_JPG_0100 err:' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_044-1 + * @tc.number : SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_JPG_0100 * @tc.name : release-imagesource-callback-jpg * @tc.desc : 1.create ImageSource * 2.call release() @@ -1508,30 +1508,30 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_044-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_JPG_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_044-1 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_JPG_0100 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.release(() => { - console.info('TC_044-1 Success'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_JPG_0100 Success'); expect(true).assertTrue(); done(); }) } } catch (error) { - console.info('TC_044-1 err:' + error); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_JPG_0100 err:' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_045 + * @tc.number : SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0100 * @tc.name : getImageInfo(callback: AsyncCallback)-jpg * @tc.desc : 1.create imageSource * 2.imageSourcecall getImageInfo(ImageInfo) @@ -1541,37 +1541,37 @@ export default function imageJsTest() { * @tc.level : Level 1 */ - it('TC_045', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_045 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0100 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo((err, imageInfo) => { if (err) { expect(false).assertTrue(); - console.info('TC_045 err:' + err); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0100 err:' + err); done(); return } if (imageInfo != undefined) { - console.info('TC_045 imageInfo.size.height:' + imageInfo.size.height); - console.info('TC_045 imageInfo.size.width:' + imageInfo.size.width); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0100 imageInfo.size.height:' + imageInfo.size.height); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0100 imageInfo.size.width:' + imageInfo.size.width); expect(true).assertTrue(); fileio.closeSync(fdNumber); done(); } else { - console.info('TC_045 failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0100 failed'); expect(false).assertTrue(); done(); } }) } } catch (error) { - console.info('TC_045 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0100 error: ' + error); expect(false).assertTrue(); done(); } @@ -1579,7 +1579,7 @@ export default function imageJsTest() { /** - * @tc.number : TC_045-1 + * @tc.number : SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0200 * @tc.name : getImageInfo(callback: AsyncCallback)-bmp * @tc.desc : 1.create imageSource * 2.imageSourcecall getImageInfo(ImageInfo) @@ -1588,31 +1588,31 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_045-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0200', 0, async function (done) { try { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_045-1 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0200 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo((err, imageInfo) => { expect(imageInfo != undefined).assertTrue(); - console.info('TC_045-1 imageInfo.size.height:' + imageInfo.size.height); - console.info('TC_045-1 imageInfo.size.width:' + imageInfo.size.width); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0200 imageInfo.size.height:' + imageInfo.size.height); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0200 imageInfo.size.width:' + imageInfo.size.width); done(); }) } } catch (error) { - console.info('TC_045-1 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0200 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_045-2 + * @tc.number : SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0300 * @tc.name : getImageInfo(callback: AsyncCallback)-png * @tc.desc : 1.create imageSource * 2.imageSourcecall getImageInfo(ImageInfo) @@ -1621,31 +1621,31 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_045-2', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0300', 0, async function (done) { try { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_045-2 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0300 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo((err, imageInfo) => { expect(imageInfo != undefined).assertTrue(); - console.info('TC_045-2 imageInfo.size.height:' + imageInfo.size.height); - console.info('TC_045-2 imageInfo.size.width:' + imageInfo.size.width); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0300 imageInfo.size.height:' + imageInfo.size.height); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0300 imageInfo.size.width:' + imageInfo.size.width); done(); }) } } catch (error) { - console.info('TC_045-2 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0300 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_045-3 + * @tc.number : SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0400 * @tc.name : getImageInfo(callback: AsyncCallback)-gif * @tc.desc : 1.create ImageInfo * 2.call getImageInfo(index, ImageInfo) @@ -1654,44 +1654,44 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_045-3', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0400', 0, async function (done) { try { await getFd('test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_045-3 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0400 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo((err, imageInfo) => { if (err) { expect(false).assertTrue(); - console.info('TC_045-3 error' + err); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0400 error' + err); done(); return } if (imageInfo != undefined && imageInfo != null) { expect(true).assertTrue(); - console.info('TC_045-3 imageInfo.size.height:' + imageInfo.size.height); - console.info('TC_045-3 imageInfo.size.width:' + imageInfo.size.width); - console.info('TC_045-3 success') + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0400 imageInfo.size.height:' + imageInfo.size.height); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0400 imageInfo.size.width:' + imageInfo.size.width); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0400 success') done(); } else { expect(false).assertTrue(); - console.info('TC_045-3 failed') + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0400 failed') done(); } }) } } catch (error) { - console.info('TC_045-3 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0400 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_046 + * @tc.number : SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0500 * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-jpg * @tc.desc : 1.create ImageInfo * 2.call getImageInfo(index, ImageInfo) @@ -1700,31 +1700,31 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_046', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0500', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_046 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0500 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(0, (err, imageInfo) => { expect(imageInfo != undefined).assertTrue(); - console.info('TC_046 imageInfo.size.height:' + imageInfo.size.height); - console.info('TC_046 imageInfo.size.width:' + imageInfo.size.width); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0500 imageInfo.size.height:' + imageInfo.size.height); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0500 imageInfo.size.width:' + imageInfo.size.width); done(); }) } } catch (error) { - console.info('TC_046 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0500 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_046-1 + * @tc.number : SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0600 * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-bmp * @tc.desc : 1.create ImageInfo * 2.call getImageInfo(index, ImageInfo) @@ -1733,31 +1733,31 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_046-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0600', 0, async function (done) { try { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_046-1 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0600 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(0, (err, imageInfo) => { expect(imageInfo != undefined).assertTrue(); - console.info('TC_046-1 imageInfo.size.height:' + imageInfo.size.height); - console.info('TC_046-1 imageInfo.size.width:' + imageInfo.size.width); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0600 imageInfo.size.height:' + imageInfo.size.height); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0600 imageInfo.size.width:' + imageInfo.size.width); done(); }) } } catch (error) { - console.info('TC_046-1 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0600 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number: TC_046-2 + * @tc.number: SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0700 * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-png * @tc.desc : 1.create ImageInfo * 2.call getImageInfo(index, ImageInfo) @@ -1766,24 +1766,24 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_046-2', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0700', 0, async function (done) { try { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_046-2 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0700 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(0, (err, imageInfo) => { expect(imageInfo != undefined).assertTrue(); - console.info('TC_046-2 imageInfo.size.height:' + imageInfo.size.height); - console.info('TC_046-2 imageInfo.size.width:' + imageInfo.size.width); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0700 imageInfo.size.height:' + imageInfo.size.height); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0700 imageInfo.size.width:' + imageInfo.size.width); done(); }) } } catch { - console.info('TC_046-2 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0700 error: ' + error); expect(false).assertTrue(); done(); } @@ -1791,7 +1791,7 @@ export default function imageJsTest() { }) /** - * @tc.number: TC_046-3 + * @tc.number: SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0800 * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-gif * @tc.desc : 1.create ImageInfo * 2.call getImageInfo(index, ImageInfo) @@ -1800,44 +1800,44 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_046-3', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0800', 0, async function (done) { try { await getFd('test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_046-3 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0800 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(0, (err, imageInfo) => { if (err) { expect(false).assertTrue(); - console.info('TC_046-3 error' + err); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0800 error' + err); done(); return } if (imageInfo != undefined && imageInfo != null) { expect(true).assertTrue(); - console.info('TC_046-3 imageInfo.size.height:' + imageInfo.size.height); - console.info('TC_046-3 imageInfo.size.width:' + imageInfo.size.width); - console.info('TC_046-3 success') + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0800 imageInfo.size.height:' + imageInfo.size.height); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0800 imageInfo.size.width:' + imageInfo.size.width); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0800 success') done(); } else { expect(false).assertTrue(); - console.info('TC_046-3 failed') + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0800 failed') done(); } }) } } catch (error) { - console.info('TC_046-3 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_CALLBACK_0800 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number: TC_046-4 + * @tc.number: SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_CALLBACK_GIF_0100 * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-gif(frame:1)-index:1 * @tc.desc : 1.create ImageInfo * 2.call getImageInfo(index, ImageInfo) @@ -1846,12 +1846,12 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_046-4', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_CALLBACK_GIF_0100', 0, async function (done) { try { await getFd('test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_046-4 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_CALLBACK_GIF_0100 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1866,14 +1866,14 @@ export default function imageJsTest() { }) } } catch (error) { - console.info('TC_046-4 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_CALLBACK_GIF_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number: TC_046-5 + * @tc.number: SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_CALLBACK_GIF_0200 * @tc.name : getImageInfo(index: number, callback: AsyncCallback)-gif-index:-1 * @tc.desc : 1.create ImageInfo * 2.call getImageInfo(index, ImageInfo) @@ -1882,12 +1882,12 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_046-5', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_CALLBACK_GIF_0200', 0, async function (done) { try { await getFd('test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_046-5 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_CALLBACK_GIF_0200 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1897,14 +1897,14 @@ export default function imageJsTest() { }) } } catch (error) { - console.info('TC_046-5 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_CALLBACK_GIF_0200 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_047 + * @tc.number : SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0100 * @tc.name : getImageInfo(index?: number): Promise-jpg * @tc.desc : 1.create imagesource * 2.call getImageInfo(index) @@ -1913,37 +1913,37 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_047', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_047 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0100 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(0) .then(imageInfo => { expect(imageInfo != undefined).assertTrue(); - console.info('TC_047 imageInfo'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0100 imageInfo'); console.info('imageInfo.size.height:' + imageInfo.size.height); console.info('imageInfo.size.width:' + imageInfo.size.width); done(); }).catch(error => { - console.log('TC_047 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0100 error: ' + error); expect().assertFail(); done(); }) } } catch (error) { - console.info('TC_047 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_047-1 + * @tc.number : SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0200 * @tc.name : getImageInfo(index?: number): Promise-bmp * @tc.desc : 1.create imagesource * 2.call getImageInfo(index) @@ -1952,37 +1952,37 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_047-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0200', 0, async function (done) { try { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_047-1 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0200 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(0) .then(imageInfo => { expect(imageInfo != undefined).assertTrue(); - console.info('TC_047-1 imageInfo'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0200 imageInfo'); console.info('imageInfo.size.height:' + imageInfo.size.height); console.info('imageInfo.size.width:' + imageInfo.size.width); done(); }).catch(error => { - console.log('TC_047-1 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0200 error: ' + error); expect().assertFail(); done(); }) } } catch (error) { - console.info('TC_047-1 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0200 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_047-2 + * @tc.number : SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0300 * @tc.name : getImageInfo(index?: number): Promise-png * @tc.desc : 1.create imagesource * 2.call getImageInfo(index) @@ -1991,37 +1991,37 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_047-2', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0300', 0, async function (done) { try { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_047-2 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0300 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(0) .then(imageInfo => { expect(imageInfo != undefined).assertTrue(); - console.info('TC_047-2 imageInfo'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0300 imageInfo'); console.info('imageInfo.size.height:' + imageInfo.size.height); console.info('imageInfo.size.width:' + imageInfo.size.width); done(); }).catch(error => { - console.log('TC_047-2 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0300 error: ' + error); expect().assertFail(); done(); }) } } catch (error) { - console.info('TC_047-2 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0300 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_047-3 + * @tc.number : SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0400 * @tc.name : getImageInfo(index?: number): Promise-gif * @tc.desc : 1.create imagesource * 2.call getImageInfo(index) @@ -2030,12 +2030,12 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_047-3', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0400', 0, async function (done) { try { await getFd('test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_047-3 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0400 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2043,29 +2043,29 @@ export default function imageJsTest() { .then(imageInfo => { if (imageInfo != undefined && imageInfo != null) { expect(true).assertTrue(); - console.info('TC_047-3 imageInfo.size.height:' + imageInfo.size.height); - console.info('TC_047-3 imageInfo.size.width:' + imageInfo.size.width); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0400 imageInfo.size.height:' + imageInfo.size.height); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0400 imageInfo.size.width:' + imageInfo.size.width); done(); } else { expect(false).assertTrue(); - console.info('TC_047-3 failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0400 failed'); done(); } }).catch(error => { - console.log('TC_047-3 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0400 error: ' + error); expect().assertFail(); done(); }) } } catch (error) { - console.info('TC_047-3 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_PROMISE_0400 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number: TC_047-4 + * @tc.number: SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_PROMISE_GIF_0100 * @tc.name : getImageInfo(index?: number): Promise-gif(frame:1)-index:1 * @tc.desc : 1.create imagesource * 2.call getImageInfo(index=1) @@ -2074,35 +2074,35 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_047-4', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_PROMISE_GIF_0100', 0, async function (done) { try { await getFd('test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_047-4 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_PROMISE_GIF_0100 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(1) .then(() => { - console.log('TC_047-4 failed'); + console.log('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_PROMISE_GIF_0100 failed'); expect().assertFail(); done(); }).catch(error => { - console.log('TC_047-4 success'); + console.log('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_PROMISE_GIF_0100 success'); expect(true).assertTrue(); done(); }) } } catch (error) { - console.info('TC_047-4 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_PROMISE_GIF_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_047-5 + * @tc.number : SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_PROMISE_GIF_0200 * @tc.name : getImageInfo(index?: number): Promise-gif-index:-1 * @tc.desc : 1.create imagesource * 2.call getImageInfo(index=-1) @@ -2111,35 +2111,35 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_047-5', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_PROMISE_GIF_0200', 0, async function (done) { try { await getFd('test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_047-5 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_PROMISE_GIF_0200 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageInfo(-1) .then(() => { - console.log('TC_047-5 failed'); + console.log('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_PROMISE_GIF_0200 failed'); expect().assertFail(); done(); }).catch(error => { - console.log('TC_047-5 success'); + console.log('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_PROMISE_GIF_0200 success'); expect(true).assertTrue(); done(); }) } } catch (error) { - console.info('TC_047-5 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_GETIMAGEINFO_INDEX_PROMISE_GIF_0200 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_050-14 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_JPG_0100 * @tc.name : createPixelMap-promise-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -2149,35 +2149,35 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-14', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_JPG_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_050-14 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_JPG_0100 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.createPixelMap().then(pixelmap => { globalpixelmap = pixelmap; - console.info('TC_050-14 success '); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_JPG_0100 success '); expect(pixelmap != undefined).assertTrue(); done(); }).catch(error => { - console.log('TC_050-14 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_JPG_0100 error: ' + error); expect().assertFail(); done(); }) } } catch (error) { - console.info('TC_050-14 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_JPG_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_050-15 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_JPG_0100 * @tc.name : createPixelMap-callback-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -2187,31 +2187,31 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-15', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_JPG_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_050-15 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_JPG_0100 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.createPixelMap((err, pixelmap) => { globalpixelmap = pixelmap; - console.info('TC_050-15 success '); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_JPG_0100 success '); expect(pixelmap != undefined).assertTrue(); done(); }) } } catch (error) { - console.info('TC_050-15 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_JPG_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_053 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0100 * @tc.name : createIncrementalSource-updateData-png * @tc.desc : 1.create imagesource * 2.update data @@ -2220,38 +2220,38 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_053', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0100', 0, async function (done) { try { let testimagebuffer = testPng; - console.info('TC_053 0003 ' + testimagebuffer.length); + console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0100 0003 ' + testimagebuffer.length); let bufferSize = testimagebuffer.length; let offset = 0; const incSouce = image.createIncrementalSource(new ArrayBuffer(1)); let ret; let isFinished = false; while (offset < testimagebuffer.length) { - console.info('TC_053 0006 ' + testimagebuffer.length); + console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0100 0006 ' + testimagebuffer.length); var oneStep = testimagebuffer.slice(offset, offset + bufferSize); - console.info('TC_053 0007 ' + oneStep.length); + console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0100 0007 ' + oneStep.length); if (oneStep.length < bufferSize) { isFinished = true; } ret = await incSouce.updateData(oneStep, isFinished, 0, oneStep.length); if (!ret) { - console.info('TC_053 updateData failed'); + console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0100 updateData failed'); expect(ret).assertTrue(); break; } offset = offset + oneStep.length; - console.info('TC_053 0011 ' + offset); + console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0100 0011 ' + offset); } if (ret) { - console.info('TC_053 updateData success '); + console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0100 updateData success '); let decodingOptions = { sampleSize: 1 }; incSouce.createPixelMap(decodingOptions, (err, pixelmap) => { - console.info('TC_053 0014' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0100 0014' + pixelmap); expect(pixelmap != undefined).assertTrue(); done(); }) @@ -2259,12 +2259,12 @@ export default function imageJsTest() { done(); } } catch (error) { - console.info('TC_053 updateData failed ' + error); + console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0100 updateData failed ' + error); } }) /** - * @tc.number : TC_053-1 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0200 * @tc.name : createIncrementalSource-updateData-jpg * @tc.desc : 1.create imagesource * 2.update data @@ -2273,33 +2273,33 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_053-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0200', 0, async function (done) { try { let testimagebuffer = testJpg; - console.info('TC_053-1 0003 ' + testimagebuffer.length); + console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0200 0003 ' + testimagebuffer.length); let bufferSize = testimagebuffer.length; let offset = 0; const incSouce = image.createIncrementalSource(new ArrayBuffer(1)); let isFinished = false; let ret; while (offset < testimagebuffer.length) { - console.info('TC_053-1 0006 ' + testimagebuffer.length); + console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0200 0006 ' + testimagebuffer.length); var oneStep = testimagebuffer.slice(offset, offset + bufferSize); - console.info('TC_053-1 0007 ' + oneStep.length); + console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0200 0007 ' + oneStep.length); if (oneStep.length < bufferSize) { isFinished = true; } ret = await incSouce.updateData(oneStep, isFinished, 0, oneStep.length); if (!ret) { - console.info('TC_053-1 updateData failed'); + console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0200 updateData failed'); expect(ret).assertTrue(); break; } offset = offset + oneStep.length; - console.info('TC_053-1 0011 ' + offset); + console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0200 0011 ' + offset); } if (ret) { - console.info('TC_053-1 updateData success '); + console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0200 updateData success '); let decodingOptions = { sampleSize: 1 }; @@ -2311,12 +2311,12 @@ export default function imageJsTest() { done(); } } catch (error) { - console.info('TC_053-1 updateData failed ' + error); + console.info('SUB_GRAPHIC_IMAGE_CREATEINCREMENTALSOURCE_UPDATEDATA_0200 updateData failed ' + error); } }) /** - * @tc.number : TC_064 + * @tc.number : SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_0100 * @tc.name : release ImageSource - promise - png * @tc.desc : 1.create ImageSource * 2.call release() @@ -2325,34 +2325,34 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_064', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_0100', 0, async function (done) { try { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_064 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_0100 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.release().then(() => { - console.info('TC_064 success'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_0100 success'); expect(true).assertTrue(); done(); }).catch(error => { - console.log('TC_064 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_0100 error: ' + error); expect().assertFail(); done(); }) } } catch (error) { - console.info('TC_064 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_064-1 + * @tc.number : SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_0100 * @tc.name : release ImageSource - callback - png * @tc.desc : 1.create ImageSource * 2.call release() @@ -2361,37 +2361,37 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_064-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_0100', 0, async function (done) { try { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_064-1 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_0100 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.release(async (err) => { if (err) { - console.info('TC_064-1 err:' + err); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_0100 err:' + err); expect(false).assertTrue(); done(); return } - console.info('TC_064-1 Success'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_0100 Success'); expect(true).assertTrue(); expect(true).assertTrue(); done(); }) } } catch (error) { - console.info('TC_064-1 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_065 + * @tc.number : SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_0200 * @tc.name : release ImageSource - promise - bmp * @tc.desc : 1.create ImageSource * 2.call release() @@ -2400,34 +2400,34 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_065', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_0200', 0, async function (done) { try { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_065 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_0200 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.release().then(() => { - console.info('TC_065 success'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_0200 success'); expect(true).assertTrue(); done(); }).catch(error => { - console.log('TC_065 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_0200 error: ' + error); expect().assertFail(); done(); }) } } catch (error) { - console.info('TC_065 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_0200 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_065-1 + * @tc.number : SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_0200 * @tc.name : release ImageSource - callback - bmp * @tc.desc : 1.create ImageSource * 2.create SourceStream @@ -2436,30 +2436,30 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_065-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_0200', 0, async function (done) { try { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_065-1 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_0200 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.release(async () => { - console.info('TC_065-1 Success'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_0200 Success'); expect(true).assertTrue(); done(); }) } } catch (error) { - console.info('TC_065-1 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_0200 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_066 + * @tc.number : SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_0300 * @tc.name : release ImageSource - promise - gif * @tc.desc : 1.create ImageSource * 2.call release() @@ -2468,34 +2468,34 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_066', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_0300', 0, async function (done) { try { await getFd('test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_066 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_0300 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.release().then(() => { - console.info('TC_066 success'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_0300 success'); expect(true).assertTrue(); done(); }).catch(error => { - console.log('TC_066 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_0300 error: ' + error); expect().assertFail(); done(); }) } } catch (error) { - console.info('TC_066 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_PROMISE_0300 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_066-1 + * @tc.number : SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_0300 * @tc.name : release ImageSource - callback - gif * @tc.desc : 1.create ImageSource * 2.call release() @@ -2504,30 +2504,30 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_066-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_0300', 0, async function (done) { try { await getFd('test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_066-1 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_0300 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.release(() => { - console.info('TC_066-1 Success'); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_0300 Success'); expect(true).assertTrue(); done(); }) } } catch (error) { - console.info('TC_066-1 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_RELEASE_IMAGESOURCE_CALLBACK_0300 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_067-14 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0800 * @tc.name : createPixelMap-promise-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -2537,36 +2537,36 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-14', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0800', 0, async function (done) { try { await getFd('moving_test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_067-14 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0800 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.createPixelMap().then(pixelmap => { globalpixelmap = pixelmap; - console.info('TC_067-14 success '); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0800 success '); expect(pixelmap !== undefined).assertTrue(); done(); }).catch(error => { - console.log('TC_067-14 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0800 error: ' + error); expect().assertFail(); done(); }) } } catch (error) { - console.info('TC_067-14 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0800 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_067-15 - * @tc.name : createPixelMap-pcallback-gif + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1200 + * @tc.name : createPixelMap-callback-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap @@ -2575,31 +2575,31 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-15', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1200', 0, async function (done) { try { await getFd('moving_test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_067-15 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1200 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.createPixelMap((err, pixelmap) => { globalpixelmap = pixelmap; - console.info('TC_067-15 success '); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1200 success '); expect(pixelmap !== undefined).assertTrue(); done(); }) } } catch (error) { - console.info('TC_067-15 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1200 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_068-14 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0900 * @tc.name : createPixelMap-promise-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -2609,35 +2609,35 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-14', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0900', 0, async function (done) { try { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_068-14 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0900 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.createPixelMap().then(pixelmap => { globalpixelmap = pixelmap; - console.info('TC_068-14 success '); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0900 success '); expect(pixelmap != undefined).assertTrue(); done(); }).catch(error => { - console.log('TC_068-14 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0900 error: ' + error); expect().assertFail(); done(); }) } } catch (error) { - console.info('TC_068-14 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_0900 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_068-15 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1300 * @tc.name : createPixelMap-callback-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -2647,31 +2647,31 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-15', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1300', 0, async function (done) { try { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_068-15 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1300 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.createPixelMap((err, pixelmap) => { globalpixelmap = pixelmap; - console.info('TC_068-15 success '); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1300 success '); expect(pixelmap != undefined).assertTrue(); done(); }) } } catch (error) { - console.info('TC_068-15 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1300 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_163-14 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_1000 * @tc.name : createPixelMap-promise-png * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -2681,35 +2681,35 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-14', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_1000', 0, async function (done) { try { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_163-14 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_1000 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.createPixelMap().then(pixelmap => { globalpixelmap = pixelmap; - console.info('TC_163-14 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_1000 success'); expect(pixelmap != undefined).assertTrue(); done(); }).catch(error => { - console.log('TC_163-14 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_1000 error: ' + error); expect().assertFail(); done(); }) } } catch (error) { - console.info('TC_163-14 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_1000 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_163-15 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1400 * @tc.name : createPixelMap-callback-png * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -2719,31 +2719,31 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-15', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1400', 0, async function (done) { try { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_163-15 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1400 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.createPixelMap((err, pixelmap) => { globalpixelmap = pixelmap; - console.info('TC_163-15 success'); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1400 success'); expect(pixelmap != undefined).assertTrue(); done(); }) } } catch (error) { - console.info('TC_163-15 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_1400 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_164 + * @tc.number : SUB_GRAPHIC_IMAGE_IMAGESOURCE_SUPPORTEDFORMATS_0100 * @tc.name : imagesource supportedFormats * @tc.desc : 1.create imagesource * 2.call supportedFormats @@ -2751,29 +2751,29 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_164', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_IMAGESOURCE_SUPPORTEDFORMATS_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_164 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_IMAGESOURCE_SUPPORTEDFORMATS_0100 create image source failed'); expect(false).assertTrue(); done(); } else { expect(imageSourceApi.supportedFormats != undefined).assertTrue(); console.info(imageSourceApi.supportedFormats); - console.info('TC_164 success '); + console.info('SUB_GRAPHIC_IMAGE_IMAGESOURCE_SUPPORTEDFORMATS_0100 success '); done(); } } catch (error) { - console.info('TC_164 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_IMAGESOURCE_SUPPORTEDFORMATS_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_166 + * @tc.number : SUB_GRAPHIC_IMAGE_IMAGEPACKER_SUPPORTEDFORMATS_0100 * @tc.name : imagepacker supportedFormats * @tc.desc : 1.create imagepacker * 2.call supportedFormats @@ -2781,22 +2781,22 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_166', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_IMAGEPACKER_SUPPORTEDFORMATS_0100', 0, async function (done) { const imagePackerApi = image.createImagePacker(); if (imagePackerApi == undefined) { - console.info('TC_166 create image packer failed'); + console.info('SUB_GRAPHIC_IMAGE_IMAGEPACKER_SUPPORTEDFORMATS_0100 create image packer failed'); expect(false).assertTrue(); done(); } else { expect(imagePackerApi.supportedFormats != undefined).assertTrue(); console.info(imagePackerApi.supportedFormats); - console.info('TC_166 success '); + console.info('SUB_GRAPHIC_IMAGE_IMAGEPACKER_SUPPORTEDFORMATS_0100 success '); done(); } }) /** - * @tc.number : TC_168 + * @tc.number : SUB_GRAPHIC_IMAGE_ISEDITABLE_0100 * @tc.name : isEditable * @tc.desc : 1.create pixelmap * 2.call isEditable @@ -2805,24 +2805,24 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_168', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_ISEDITABLE_0100', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts, (error, pixelmap) => { if (pixelmap == undefined) { - console.info('TC_168 create pixelmap failed'); + console.info('SUB_GRAPHIC_IMAGE_ISEDITABLE_0100 create pixelmap failed'); expect(false).assertTrue(); done(); } else { expect(pixelmap.isEditable == true).assertTrue(); - console.info('TC_168 success '); + console.info('SUB_GRAPHIC_IMAGE_ISEDITABLE_0100 success '); done(); } }) }) /** - * @tc.number : editable_001 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_EDITABLE_0100 * @tc.name : create pixelmap-callback (editable: true, pixelFormat: ARGB_8888, * size: { height: 4, width: 6 },bytes = buffer) * @tc.desc : 1.create InitializationOptions object @@ -2833,22 +2833,22 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('editable_001', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_EDITABLE_0100', 0, async function (done) { const Color = new ArrayBuffer(96); let edit = true; let opts = { editable: true, pixelFormat: 1, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts, (err, pixelmap) => { expect(pixelmap != undefined).assertTrue(); - console.info('editable_001 editable: ' + pixelmap.isEditable); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_EDITABLE_0100 editable: ' + pixelmap.isEditable); expect(pixelmap.isEditable == opts.editable).assertTrue(); - console.info('editable_001 edit: ' + edit); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_EDITABLE_0100 edit: ' + edit); expect(pixelmap.isEditable == edit).assertTrue(); done(); }) }) /** - * @tc.number : editable_002 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_EDITABLE_0200 * @tc.name : create pixelmap-callback (editable: false, pixelFormat: ARGB_8888, * size: { height: 4, width: 6 },bytes = buffer) * @tc.desc : 1.create InitializationOptions object @@ -2859,22 +2859,22 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('editable_002', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_EDITABLE_0200', 0, async function (done) { const Color = new ArrayBuffer(96); let edit = false; let opts = { editable: false, pixelFormat: 1, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts, (err, pixelmap) => { expect(pixelmap != undefined).assertTrue(); - console.info('editable_002 editable: ' + pixelmap.isEditable); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_EDITABLE_0200 editable: ' + pixelmap.isEditable); expect(pixelmap.isEditable == opts.editable).assertTrue(); - console.info('editable_002 edit: ' + edit); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_CALLBACK_EDITABLE_0200 edit: ' + edit); expect(pixelmap.isEditable == edit).assertTrue(); done(); }) }) /** - * @tc.number : editable_003 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_EDITABLE_0100 * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGB_565, * size: { height: 4, width: 6 }, bytes = buffer) * @tc.desc : 1.create InitializationOptions object @@ -2885,27 +2885,27 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('editable_003', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_EDITABLE_0100', 0, async function (done) { const Color = new ArrayBuffer(96); let edit = true; let opts = { editable: true, pixelFormat: 2, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts) .then(pixelmap => { - console.info('editable_003 editable: ' + pixelmap.isEditable); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_EDITABLE_0100 editable: ' + pixelmap.isEditable); expect(pixelmap != undefined).assertTrue(); expect(pixelmap.isEditable == opts.editable).assertTrue(); expect(pixelmap.isEditable == edit).assertTrue(); done(); }) .catch(error => { - console.log('editable_003 err' + error); + console.log('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_EDITABLE_0100 err' + error); expect(false).assertTrue(); done(); }) }) /** - * @tc.number : editable_004 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_EDITABLE_0200 * @tc.name : create pixelmap-promise (editable: false, pixelFormat: RGB_565, * size: { height: 4, width: 6 }, bytes = buffer) * @tc.desc : 1.create InitializationOptions object @@ -2916,20 +2916,20 @@ export default function imageJsTest() { * @tc.type : Functional * @tc.level : Level 0 */ - it('editable_004', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_EDITABLE_0200', 0, async function (done) { const Color = new ArrayBuffer(96); let edit = false; let opts = { editable: false, pixelFormat: 2, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts) .then(pixelmap => { - console.info('editable_004 editable: ' + pixelmap.isEditable); + console.info('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_EDITABLE_0200 editable: ' + pixelmap.isEditable); expect(pixelmap != undefined).assertTrue(); expect(pixelmap.isEditable == opts.editable).assertTrue(); expect(pixelmap.isEditable == edit).assertTrue(); done(); }) .catch(error => { - console.log('editable_004 err' + error); + console.log('SUB_GRAPHIC_IMAGE_CREATEPIXELMAP_PROMISE_EDITABLE_0200 err' + error); expect(false).assertTrue(); done(); }) diff --git a/multimedia/image/image_js_standard/imageColorspace/BUILD.gn b/multimedia/image/image_js_standard/imageColorspace/BUILD.gn index 355176f28f498bbe8f743bd961876d94ab86f56f..8b245f23c2e5adca69feb539c08a1181b1328e3e 100644 --- a/multimedia/image/image_js_standard/imageColorspace/BUILD.gn +++ b/multimedia/image/image_js_standard/imageColorspace/BUILD.gn @@ -22,7 +22,7 @@ ohos_js_hap_suite("image_colorspace_js_hap") { certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsImageColorspaceJsTest" subsystem_name = "multimedia" - part_name = "multimedia_image_standard" + part_name = "multimedia_image_framework" } ohos_js_assets("image_colorspace_js_assets") { js2abc = true diff --git a/multimedia/image/image_js_standard/imageColorspace/src/main/config.json b/multimedia/image/image_js_standard/imageColorspace/src/main/config.json index e59a00392033f8711044d166595c45289f1278e9..dbbf027561b838739f02cf649d372347c60956e7 100644 --- a/multimedia/image/image_js_standard/imageColorspace/src/main/config.json +++ b/multimedia/image/image_js_standard/imageColorspace/src/main/config.json @@ -57,6 +57,7 @@ } ], "deviceType": [ + "default", "phone", "tablet", "tv", diff --git a/multimedia/image/image_js_standard/imageColorspace/src/main/js/test/colorspace.test.js b/multimedia/image/image_js_standard/imageColorspace/src/main/js/test/colorspace.test.js index 55c50cac16ae83cb699dba1b250bd2e92cb38d5b..d9b6f06122e731fcdbce1cb4f28e016189cb0e3a 100644 --- a/multimedia/image/image_js_standard/imageColorspace/src/main/js/test/colorspace.test.js +++ b/multimedia/image/image_js_standard/imageColorspace/src/main/js/test/colorspace.test.js @@ -112,7 +112,7 @@ describe('imageColorSpace', function () { } /** - * @tc.number : decodeP3_001 + * @tc.number : SUB_GRAPHIC_IMAGE_COLORSPACE_DECODE_0100 * @tc.name : Decode * @tc.desc : 1.create imagesource * 2.create pixelmap @@ -120,8 +120,8 @@ describe('imageColorSpace', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('decodeP3_001', 0, async function (done) { - let logger = loger('decodeP3_001') + it('SUB_GRAPHIC_IMAGE_COLORSPACE_DECODE_0100', 0, async function (done) { + let logger = loger('SUB_GRAPHIC_IMAGE_COLORSPACE_DECODE_0100') try { let imageSource = genPicSource(); logger.log("ImageSource " + (imageSource != undefined)); @@ -141,7 +141,7 @@ describe('imageColorSpace', function () { }) /** - * @tc.number : decodeP3_002 + * @tc.number : SUB_GRAPHIC_IMAGE_COLORSPACE_DECODE_CALLBACK_0100 * @tc.name : Decode -callback * @tc.desc : 1.create imagesource * 2.create pixelmap @@ -149,8 +149,8 @@ describe('imageColorSpace', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('decodeP3_002', 0, async function (done) { - let logger = loger('decodeP3_002') + it('SUB_GRAPHIC_IMAGE_COLORSPACE_DECODE_CALLBACK_0100', 0, async function (done) { + let logger = loger('SUB_GRAPHIC_IMAGE_COLORSPACE_DECODE_CALLBACK_0100') try { let imageSource = genPicSource(); logger.log("ImageSource " + (imageSource != undefined)); @@ -170,7 +170,7 @@ describe('imageColorSpace', function () { }) /** - * @tc.number : encodeP3_001 + * @tc.number : SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_CALLBACK_0100 * @tc.name : Encode -callback * @tc.desc : 1.create imagesource * 2.createImagePacker @@ -179,9 +179,9 @@ describe('imageColorSpace', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('encodeP3_001', 0, async function (done) { - let logger = loger('encodeP3_001') - let testNum = 'encodeP3_001' + it('SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_CALLBACK_0100', 0, async function (done) { + let logger = loger('SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_CALLBACK_0100') + let testNum = 'SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_CALLBACK_0100' try { let imageSource = genPicSource(); logger.log("ImageSource " + (imageSource != undefined)); @@ -217,7 +217,7 @@ describe('imageColorSpace', function () { }) /** - * @tc.number : encodeP3_002 + * @tc.number : SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_PROMISE_0100 * @tc.name : Encode -promise * @tc.desc : 1.create imagesource * 2.createImagePacker @@ -226,9 +226,9 @@ describe('imageColorSpace', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('encodeP3_002', 0, async function (done) { - let logger = loger('encodeP3_002') - let testNum = 'encodeP3_002' + it('SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_PROMISE_0100', 0, async function (done) { + let logger = loger('SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_PROMISE_0100') + let testNum = 'SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_PROMISE_0100' try { let imageSource = genPicSource(); logger.log("ImageSource " + (imageSource != undefined)); @@ -254,7 +254,7 @@ describe('imageColorSpace', function () { done(); }).catch(error => { - console.log('encodeP3_002 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_PROMISE_0100 error: ' + error); expect(false).assertTrue(); done(); }) @@ -268,7 +268,7 @@ describe('imageColorSpace', function () { }) /** - * @tc.number : encodeP3_003 + * @tc.number : SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_CALLBACK_0200 * @tc.name : Encode -callback- * @tc.desc : 1.create imagesource * 2.createImagePacker @@ -277,13 +277,13 @@ describe('imageColorSpace', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('encodeP3_003', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_CALLBACK_0200', 0, async function (done) { let packOpts = { format:["image/gif"], quality:90 } - packingCbFail(done, 'encodeP3_003', packOpts) + packingCbFail(done, 'SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_CALLBACK_0200', packOpts) }) /** - * @tc.number : encodeP3_004 + * @tc.number : SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_CALLBACK_ERROR_FORMAT_0100 * @tc.name : Encode -callback-wrong format * @tc.desc : 1.create imagesource * 2.createImagePacker @@ -292,13 +292,13 @@ describe('imageColorSpace', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('encodeP3_004', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_CALLBACK_ERROR_FORMAT_0100', 0, async function (done) { let packOpts = { format:["image/jpeg"], quality:200 } - packingCbFail(done, 'encodeP3_004', packOpts) + packingCbFail(done, 'SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_CALLBACK_ERROR_FORMAT_0100', packOpts) }) /** - * @tc.number : encodeP3_005 + * @tc.number : SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_CALLBACK_NO_QUALITY_0100 * @tc.name : Encode -callback-no quality * @tc.desc : 1.create imagesource * 2.createImagePacker @@ -307,13 +307,13 @@ describe('imageColorSpace', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('encodeP3_005', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_CALLBACK_NO_QUALITY_0100', 0, async function (done) { let packOpts = { format:["image/jpeg"] } - packingCbFail(done, 'encodeP3_005', packOpts) + packingCbFail(done, 'SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_CALLBACK_NO_QUALITY_0100', packOpts) }) /** - * @tc.number : encodeP3_006 + * @tc.number : SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_CALLBACK_NO_FORMAT_0100 * @tc.name : Encode -callback-no format * @tc.desc : 1.create imagesource * 2.createImagePacker @@ -322,13 +322,13 @@ describe('imageColorSpace', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('encodeP3_006', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_CALLBACK_NO_FORMAT_0100', 0, async function (done) { let packOpts = { quality:50 } - packingCbFail(done, 'encodeP3_006', packOpts) + packingCbFail(done, 'SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_CALLBACK_NO_FORMAT_0100', packOpts) }) /** - * @tc.number : encodeP3_007 + * @tc.number : SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_PROMISE_0200 * @tc.name : Encode -promise * @tc.desc : 1.create imagesource * 2.createImagePacker @@ -337,13 +337,13 @@ describe('imageColorSpace', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('encodeP3_007', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_PROMISE_0200', 0, async function (done) { let packOpts = { format:["image/gif"], quality:90 } - packingPromiseFail(done, 'encodeP3_007', packOpts) + packingPromiseFail(done, 'SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_PROMISE_0200', packOpts) }) /** - * @tc.number : encodeP3_008 + * @tc.number : SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_PROMISE_0300 * @tc.name : Encode -promise * @tc.desc : 1.create imagesource * 2.createImagePacker @@ -352,13 +352,13 @@ describe('imageColorSpace', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('encodeP3_008', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_PROMISE_0300', 0, async function (done) { let packOpts = { format:["image/jpeg"], quality:101 } - packingPromiseFail(done, 'encodeP3_008', packOpts) + packingPromiseFail(done, 'SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_PROMISE_0300', packOpts) }) /** - * @tc.number : encodeP3_009 + * @tc.number : SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_PROMISE_NO_QUALITY_0100 * @tc.name : Encode -promise -no quality * @tc.desc : 1.create imagesource * 2.createImagePacker @@ -367,13 +367,13 @@ describe('imageColorSpace', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('encodeP3_009', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_PROMISE_NO_QUALITY_0100', 0, async function (done) { let packOpts = { format:["image/jpeg"] } - packingPromiseFail(done, 'encodeP3_009', packOpts) + packingPromiseFail(done, 'SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_PROMISE_NO_QUALITY_0100', packOpts) }) /** - * @tc.number : encodeP3_010 + * @tc.number : SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_PROMISE_NO_FORMAT_0100 * @tc.name : Encode -promise -no format * @tc.desc : 1.create imagesource * 2.createImagePacker @@ -382,9 +382,9 @@ describe('imageColorSpace', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('encodeP3_010', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_PROMISE_NO_FORMAT_0100', 0, async function (done) { let packOpts = { quality:100 } - packingPromiseFail(done, 'encodeP3_010', packOpts) + packingPromiseFail(done, 'SUB_GRAPHIC_IMAGE_COLORSPACE_ENCODE_PROMISE_NO_FORMAT_0100', packOpts) }) }) diff --git a/multimedia/image/image_js_standard/imageCreator/BUILD.gn b/multimedia/image/image_js_standard/imageCreator/BUILD.gn index 74187b5f776c5b637f3ef6cb2d9de2a9dc5ce463..9b3437550dc438f2e21676cceec20c4456a7ac58 100644 --- a/multimedia/image/image_js_standard/imageCreator/BUILD.gn +++ b/multimedia/image/image_js_standard/imageCreator/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/multimedia/image/image_js_standard/imageCreator/src/main/config.json b/multimedia/image/image_js_standard/imageCreator/src/main/config.json index 4b39ae597190042901701e8b8c49113dbb7b9ad6..60e4fcbc7ecc80b71406f973e8de8c9480d9ec9b 100644 --- a/multimedia/image/image_js_standard/imageCreator/src/main/config.json +++ b/multimedia/image/image_js_standard/imageCreator/src/main/config.json @@ -44,6 +44,7 @@ } ], "deviceType": [ + "default", "phone", "tablet", "tv", diff --git a/multimedia/image/image_js_standard/imageCreator/src/main/js/test/creator.test.js b/multimedia/image/image_js_standard/imageCreator/src/main/js/test/creator.test.js index e88430fafba9bcc0b650cf406fdd62f1b77248c3..35ea2c9b32ee2e3a4b951a03d6c4f237279b734d 100644 --- a/multimedia/image/image_js_standard/imageCreator/src/main/js/test/creator.test.js +++ b/multimedia/image/image_js_standard/imageCreator/src/main/js/test/creator.test.js @@ -171,7 +171,7 @@ describe('ImageCreator', function () { } /** - * @tc.number : Creator_001 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0100 * @tc.name : createImageCreator * @tc.desc : 1.set width,height,format,capacity * 2.create ImageCreator @@ -180,11 +180,11 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_001', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0100', 0, async function (done) { var creator = image.createImageCreator(WIDTH, HEIGHT, FORMAT, CAPACITY); if (creator == undefined) { expect(false).assertTrue(); - console.info('creator_001 undefined') + console.info('SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0100 undefined') done(); } else { expect(creator.size.width == WIDTH).assertTrue(); @@ -196,7 +196,7 @@ describe('ImageCreator', function () { }) /** - * @tc.number : Creator_001-1 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0200 * @tc.name : createImageCreator * @tc.desc : 1.set width,height,format,capacity * 2.create ImageCreator @@ -205,12 +205,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_001-1', 0, async function (done) { - createCreator(done, 'Creator_001-1', WIDTH, HEIGHT, FORMAT, 'hd!'); + it('SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0200', 0, async function (done) { + createCreator(done, 'SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0200', WIDTH, HEIGHT, FORMAT, 'hd!'); }) /** - * @tc.number : Creator_001-2 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0300 * @tc.name : createImageCreator * @tc.desc : 1.set width,height,format,capacity * 2.create ImageCreator @@ -219,12 +219,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_001-2', 0, async function (done) { - createCreator(done, 'Creator_001-2', WIDTH, HEIGHT, null, CAPACITY); + it('SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0300', 0, async function (done) { + createCreator(done, 'SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0300', WIDTH, HEIGHT, null, CAPACITY); }) /** - * @tc.number : Creator_001-3 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0400 * @tc.name : createImageCreator * @tc.desc : 1.set width,height,format,capacity * 2.create ImageCreator @@ -233,12 +233,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_001-3', 0, async function (done) { - createCreator(done, 'Creator_001-3', WIDTH, null, FORMAT, CAPACITY); + it('SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0400', 0, async function (done) { + createCreator(done, 'SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0400', WIDTH, null, FORMAT, CAPACITY); }) /** - * @tc.number : Creator_001-4 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0500 * @tc.name : createImageCreator * @tc.desc : 1.set width,height,format,capacity * 2.create ImageCreator @@ -247,12 +247,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_001-4', 0, async function (done) { - createCreator(done, 'Creator_001-4', null, HEIGHT, FORMAT, CAPACITY); + it('SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0500', 0, async function (done) { + createCreator(done, 'SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0500', null, HEIGHT, FORMAT, CAPACITY); }) /** - * @tc.number : Creator_001-5 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0600 * @tc.name : createImageCreator * @tc.desc : 1.set width,height,format,capacity * 2.create ImageCreator @@ -261,12 +261,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_001-5', 0, async function (done) { - createCreator(done, 'Creator_001-5', WIDTH, HEIGHT, FORMAT, null); + it('SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0600', 0, async function (done) { + createCreator(done, 'SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0600', WIDTH, HEIGHT, FORMAT, null); }) /** - * @tc.number : Creator_001-6 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0700 * @tc.name : createImageCreator * @tc.desc : 1.set width,height,format,capacity * 2.create ImageCreator @@ -275,12 +275,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_001-6', 0, async function (done) { - createCreator(done, 'Creator_001-6', false, HEIGHT, FORMAT, CAPACITY); + it('SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0700', 0, async function (done) { + createCreator(done, 'SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0700', false, HEIGHT, FORMAT, CAPACITY); }) /** - * @tc.number : Creator_001-7 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0800 * @tc.name : createImageCreator * @tc.desc : 1.set width,height,format,capacity * 2.create ImageCreator @@ -289,12 +289,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_001-7', 0, async function (done) { - createCreator(done, 'Creator_001-7', { a: 10 }, HEIGHT, FORMAT, CAPACITY); + it('SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0800', 0, async function (done) { + createCreator(done, 'SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0800', { a: 10 }, HEIGHT, FORMAT, CAPACITY); }) /** - * @tc.number : Creator_001-8 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0900 * @tc.name : createImageCreator * @tc.desc : 1.set width,height,format,capacity * 2.create ImageCreator @@ -303,12 +303,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_001-8', 0, async function (done) { - createCreator(done, 'Creator_001-8', WIDTH, false, FORMAT, CAPACITY); + it('SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0900', 0, async function (done) { + createCreator(done, 'SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_0900', WIDTH, false, FORMAT, CAPACITY); }) /** - * @tc.number : Creator_001-9 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_1000 * @tc.name : createImageCreator * @tc.desc : 1.set width,height,format,capacity * 2.create ImageCreator @@ -317,13 +317,13 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_001-9', 0, async function (done) { - createCreator(done, 'Creator_001-9', WIDTH, HEIGHT, 'form.', CAPACITY); + it('SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_1000', 0, async function (done) { + createCreator(done, 'SUB_GRAPHIC_IMAGE_CREATOR_CREATEIMAGECREATOR_1000', WIDTH, HEIGHT, 'form.', CAPACITY); }) /** - * @tc.number : Creator_002 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_RELEASE_PROMISE_0100 * @tc.name : release-promise * @tc.desc : 1.create ImageCreator * 2.call release @@ -332,11 +332,11 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_002', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATOR_RELEASE_PROMISE_0100', 0, async function (done) { var creator = image.createImageCreator(WIDTH, HEIGHT, FORMAT, CAPACITY); if (creator != undefined) { creator.release().then(() => { - console.info('Creator_002 release '); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_RELEASE_PROMISE_0100 release '); expect(true).assertTrue(); done(); }).catch(error => { @@ -345,13 +345,13 @@ describe('ImageCreator', function () { }) } else { expect(false).assertTrue(); - console.info('Creator_002 finished'); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_RELEASE_PROMISE_0100 finished'); done() } }) /** - * @tc.number : Creator_003 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_RELEASE_CALLBACK_0100 * @tc.name : release-callback * @tc.desc : 1.create ImageCreator * 2.call release @@ -360,29 +360,29 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_003', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATOR_RELEASE_CALLBACK_0100', 0, async function (done) { var creator = image.createImageCreator(WIDTH, HEIGHT, FORMAT, CAPACITY); if (creator != undefined) { creator.release((err) => { if (err) { - console.info('Creator_003 release call back' + err); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_RELEASE_CALLBACK_0100 release call back' + err); expect(false).assertTrue(); done(); return; } - console.info('Creator_003 release call back'); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_RELEASE_CALLBACK_0100 release call back'); expect(true).assertTrue(); done(); }); } else { expect(false).assertTrue(); - console.info('Creator_003 finished'); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_RELEASE_CALLBACK_0100 finished'); done() } }) /** - * @tc.number : Creator_004 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_DEQUEUEIMAGE_PROMISE_0100 * @tc.name : dequeueImage-promise * @tc.desc : 1.create ImageCreator * 2.call dequeueImage @@ -391,27 +391,27 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_004', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATOR_DEQUEUEIMAGE_PROMISE_0100', 0, async function (done) { var creator = image.createImageCreator(WIDTH, HEIGHT, FORMAT, CAPACITY); if (creator != undefined) { creator.dequeueImage().then(img => { - console.info('Creator_004 dequeueImage Success'); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_DEQUEUEIMAGE_PROMISE_0100 dequeueImage Success'); expect(img != undefined).assertTrue(); done(); }).catch(error => { - console.log('Creator_004 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_CREATOR_DEQUEUEIMAGE_PROMISE_0100 error: ' + error); expect(false).assertTrue(); done(); }) } else { expect(false).assertTrue(); - console.info('Creator_004 finished'); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_DEQUEUEIMAGE_PROMISE_0100 finished'); done(); } }) /** - * @tc.number : Creator_005 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_DEQUEUEIMAGE_CALLBACK_0100 * @tc.name : dequeueImage-callback * @tc.desc : 1.create ImageCreator * 2.call dequeueImage @@ -420,29 +420,29 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_005', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATOR_DEQUEUEIMAGE_CALLBACK_0100', 0, async function (done) { var creator = image.createImageCreator(WIDTH, HEIGHT, FORMAT, CAPACITY); if (creator != undefined) { creator.dequeueImage((err, img) => { if (err) { - console.info('Creator_005 err:' + err); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_DEQUEUEIMAGE_CALLBACK_0100 err:' + err); expect(false).assertTrue(); done(); return; } - console.info('Creator_005 dequeueImage call back Success'); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_DEQUEUEIMAGE_CALLBACK_0100 dequeueImage call back Success'); expect(img != undefined).assertTrue(); done(); }); } else { expect(false).assertTrue(); - console.info('Creator_005 finished'); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_DEQUEUEIMAGE_CALLBACK_0100 finished'); done() } }) /** - * @tc.number : Creator_006 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_PROMISE_0200 * @tc.name : queueImage-promise * @tc.desc : 1.create ImageCreator * 2.call dequeueImage @@ -452,7 +452,7 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_006', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_PROMISE_0200', 0, async function (done) { var creator = image.createImageCreator(WIDTH, HEIGHT, FORMAT, CAPACITY); if (creator != undefined) { creator.dequeueImage().then(img => { @@ -480,12 +480,12 @@ describe('ImageCreator', function () { console.info("this is img " + img); creator.queueImage(img).then(() => { - console.info('Creator_006 queueImage Success'); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_PROMISE_0200 queueImage Success'); var dummy = creator.test; expect(true).assertTrue(); done(); }).catch(error => { - console.info('Creator_006 queueImage error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_PROMISE_0200 queueImage error: ' + error); expect(false).assertTrue(); done(); }) @@ -493,13 +493,13 @@ describe('ImageCreator', function () { }) } else { expect(false).assertTrue(); - console.info('Creator_006 createImageCreator failed'); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_PROMISE_0200 createImageCreator failed'); done() } }) /** - * @tc.number : Creator_006-1 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_PROMISE_0300 * @tc.name : queueImage-promise-1 * @tc.desc : 1.create ImageCreator * 2.call queueImage @@ -507,12 +507,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_006-1', 0, async function (done) { - queueImageError(done, 'Creator_006-1', 1); + it('SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_PROMISE_0300', 0, async function (done) { + queueImageError(done, 'SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_PROMISE_0300', 1); }) /** - * @tc.number : Creator_006-2 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_PROMISE_0400 * @tc.name : queueImage-promise-null * @tc.desc : 1.create ImageCreator * 2.call queueImage @@ -520,12 +520,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_006-2', 0, async function (done) { - queueImageError(done, 'Creator_006-2', null); + it('SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_PROMISE_0400', 0, async function (done) { + queueImageError(done, 'SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_PROMISE_0400', null); }) /** - * @tc.number : Creator_006-3 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_PROMISE_0500 * @tc.name : queueImage-promise-'a' * @tc.desc : 1.create ImageCreator * 2.call queueImage @@ -533,12 +533,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_006-3', 0, async function (done) { - queueImageError(done, 'Creator_006-3', 'a'); + it('SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_PROMISE_0500', 0, async function (done) { + queueImageError(done, 'SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_PROMISE_0500', 'a'); }) /** - * @tc.number : Creator_006-4 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_PROMISE_0600 * @tc.name : on-{a : 1} * @tc.desc : 1.create ImageCreator * 2.call queueImage @@ -546,12 +546,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_006-4', 0, async function (done) { - queueImageError(done, 'Creator_006-4', { a: 1 }); + it('SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_PROMISE_0600', 0, async function (done) { + queueImageError(done, 'SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_PROMISE_0600', { a: 1 }); }) /** - * @tc.number : Creator_007 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0200 * @tc.name : queueImage-callback * @tc.desc : 1.create ImageCreator * 2.call dequeueImage @@ -561,12 +561,12 @@ describe('ImageCreator', function () { * @tc.level : Level 0 */ - it('Creator_007', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0200', 0, async function (done) { var creator = image.createImageCreator(WIDTH, HEIGHT, FORMAT, CAPACITY); if (creator != undefined) { creator.dequeueImage((err, img) => { if (err || img == undefined) { - console.log('Creator_007 dequeueImage error:' + err); + console.log('SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0200 dequeueImage error:' + err); expect(false).assertTrue(); done(); return; @@ -575,7 +575,7 @@ describe('ImageCreator', function () { img.getComponent(JPEG, (err, component) => { if (err) { expect(false).assertTrue(); - console.log('Creator_007 getComponent error:' + err); + console.log('SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0200 getComponent error:' + err); done(); return; } @@ -592,11 +592,11 @@ describe('ImageCreator', function () { console.info("this is img " + img); creator.queueImage(img, (err) => { if (err) { - console.info('Creator_007 queueImage err: ' + err); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0200 queueImage err: ' + err); expect(false).assertTrue(); done(); } - console.info('Creator_007 queueImage Success'); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0200 queueImage Success'); var dummy = creator.test; expect(true).assertTrue(); done(); @@ -605,13 +605,13 @@ describe('ImageCreator', function () { }) } else { expect(false).assertTrue(); - console.info('Creator_007 createImageCreator failed'); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0200 createImageCreator failed'); done(); } }) /** - * @tc.number : Creator_007-1 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0300 * @tc.name : queueImage-callback * @tc.desc : 1.create ImageCreator * 2.call dequeueImage @@ -621,12 +621,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_007-1', 0, async function (done) { - queueImageCbError(done, 'Creator_007-1', 1); + it('SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0300', 0, async function (done) { + queueImageCbError(done, 'SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0300', 1); }) /** - * @tc.number : Creator_007-2 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0400 * @tc.name : queueImage-callback * @tc.desc : 1.create ImageCreator * 2.call dequeueImage @@ -636,12 +636,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_007-2', 0, async function (done) { - queueImageCbError(done, 'Creator_007-2', null); + it('SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0400', 0, async function (done) { + queueImageCbError(done, 'SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0400', null); }) /** - * @tc.number : Creator_007-3 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0500 * @tc.name : queueImage-callback * @tc.desc : 1.create ImageCreator * 2.call dequeueImage @@ -651,12 +651,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_007-3', 0, async function (done) { - queueImageCbError(done, 'Creator_007-3', 'a'); + it('SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0500', 0, async function (done) { + queueImageCbError(done, 'SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0500', 'a'); }) /** - * @tc.number : Creator_007-4 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0600 * @tc.name : queueImage-callback * @tc.desc : 1.create ImageCreator * 2.call dequeueImage @@ -666,12 +666,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_007-4', 0, async function (done) { - queueImageCbError(done, 'Creator_007-4', { a: 1 }); + it('SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0600', 0, async function (done) { + queueImageCbError(done, 'SUB_GRAPHIC_IMAGE_CREATOR_QUEUEIMAGE_CALLBACK_0600', { a: 1 }); }) /** - * @tc.number : Creator_008 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_ON_0100 * @tc.name : on * @tc.desc : 1.create ImageCreator * 2.call on @@ -680,7 +680,7 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_008', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_CREATOR_ON_0100', 0, async function (done) { var creator = image.createImageCreator(WIDTH, HEIGHT, FORMAT, CAPACITY) expect(creator != undefined).assertTrue(); if (creator == undefined) { @@ -689,25 +689,25 @@ describe('ImageCreator', function () { } creator.on('imageRelease', (err) => { if (err) { - console.info('Creator_008 on release faild' + err); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_ON_0100 on release faild' + err); expect(false).assertTrue(); done(); return; } - console.info('Creator_008 on call back IN'); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_ON_0100 on call back IN'); expect(true).assertTrue(); done(); }) creator.dequeueImage((err, img) => { if (err || img == undefined) { - console.info('Creator_008 dequeueImage fail: ' + err); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_ON_0100 dequeueImage fail: ' + err); expect(false).assertTrue(); done(); return; } img.getComponent(JPEG, (err, component) => { if (err || component == undefined) { - console.info('Creator_008 getComponent err:' + err); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_ON_0100 getComponent err:' + err); expect(false).assertTrue(); done(); return; @@ -723,12 +723,12 @@ describe('ImageCreator', function () { } creator.queueImage(img, (err) => { if (err) { - console.info('Creator_008 queueImage failerr: ' + err); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_ON_0100 queueImage failerr: ' + err); expect(false).assertTrue(); done(); return; } - console.info('Creator_008 queueImage Success'); + console.info('SUB_GRAPHIC_IMAGE_CREATOR_ON_0100 queueImage Success'); expect(true).assertTrue(); var dummy = creator.test; }) @@ -737,7 +737,7 @@ describe('ImageCreator', function () { }) /** - * @tc.number : Creator_008-1 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_ON_0200 * @tc.name : on-1 * @tc.desc : 1.create ImageCreator * 2.call on @@ -745,12 +745,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_008-1', 0, async function (done) { - onErr(done, 'Creator_008-1', 1); + it('SUB_GRAPHIC_IMAGE_CREATOR_ON_0200', 0, async function (done) { + onErr(done, 'SUB_GRAPHIC_IMAGE_CREATOR_ON_0200', 1); }) /** - * @tc.number : Creator_008-2 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_ON_0300 * @tc.name : on-null * @tc.desc : 1.create ImageCreator * 2.call on @@ -758,12 +758,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_008-2', 0, async function (done) { - onErr(done, 'Creator_008-2', null); + it('SUB_GRAPHIC_IMAGE_CREATOR_ON_0300', 0, async function (done) { + onErr(done, 'SUB_GRAPHIC_IMAGE_CREATOR_ON_0300', null); }) /** - * @tc.number : Creator_008-3 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_ON_0400 * @tc.name : on-{a : 1} * @tc.desc : 1.create ImageCreator * 2.call on @@ -771,12 +771,12 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_008-3', 0, async function (done) { - onErr(done, 'Creator_008-3', { a: 1 }); + it('SUB_GRAPHIC_IMAGE_CREATOR_ON_0400', 0, async function (done) { + onErr(done, 'SUB_GRAPHIC_IMAGE_CREATOR_ON_0400', { a: 1 }); }) /** - * @tc.number : Creator_008-4 + * @tc.number : SUB_GRAPHIC_IMAGE_CREATOR_ON_0500 * @tc.name : on-'a' * @tc.desc : 1.create ImageCreator * 2.call on @@ -784,7 +784,7 @@ describe('ImageCreator', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Creator_008-4', 0, async function (done) { - onErr(done, 'Creator_008-4', 'a'); + it('SUB_GRAPHIC_IMAGE_CREATOR_ON_0500', 0, async function (done) { + onErr(done, 'SUB_GRAPHIC_IMAGE_CREATOR_ON_0500', 'a'); }) }) \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/BUILD.gn b/multimedia/image/image_js_standard/imageDecodeOptions/BUILD.gn index f35627476bb69548064e9451bb13242e71b44aee..a024be149d5eb61f2c696dac7208c0bddc8a9c57 100644 --- a/multimedia/image/image_js_standard/imageDecodeOptions/BUILD.gn +++ b/multimedia/image/image_js_standard/imageDecodeOptions/BUILD.gn @@ -22,7 +22,7 @@ ohos_js_hap_suite("image_DecodeOptions_js_hap") { certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsImageDecodeOptionsJsTest" subsystem_name = "multimedia" - part_name = "multimedia_image_standard" + part_name = "multimedia_image_framework" } ohos_js_assets("image_DecodeOptions_js_assets") { js2abc = true diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/config.json b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/config.json index afbf1d0bf5eb2f4aeca86b5b239f5818d6909ad0..04a0775f2dd8ff0140ace2a48af687e33cf85642 100644 --- a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/config.json +++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/config.json @@ -57,6 +57,7 @@ } ], "deviceType": [ + "default", "phone", "tablet", "tv", diff --git a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/test/image.test.js b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/test/image.test.js index 87ee5822de168a724df395427a9c1db36401f03c..b1f0a13e7d3962e52ea686eac3e3e863dc565e6b 100644 --- a/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/test/image.test.js +++ b/multimedia/image/image_js_standard/imageDecodeOptions/src/main/js/test/image.test.js @@ -66,7 +66,7 @@ export default function imageDecodeOptions() { /** - * @tc.number : TC_050 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_JPG_0100 * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_8888-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -76,12 +76,12 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_JPG_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_050 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_JPG_0100 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -96,26 +96,26 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_050 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_JPG_0100 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_050 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_JPG_0100 success '); expect(pixelmap != undefined).assertTrue(); done(); } }) } } catch (error) { - console.info('TC_050 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_JPG_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_050-1 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_JPG_0200 * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGB_565-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -125,12 +125,12 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_JPG_0200', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_050-1 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_JPG_0200 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -145,26 +145,26 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_050-1 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_JPG_0200 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_050-1 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_JPG_0200 success '); expect(pixelmap != undefined).assertTrue(); done(); } }) } } catch (error) { - console.info('TC_050-1 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_JPG_0200 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_050-2 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_JPG_0300 * @tc.name : createPixelMap(decodingOptions)-pixelformat:unknown-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -174,12 +174,12 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-2', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_JPG_0300', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_050-2 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_JPG_0300 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -194,26 +194,26 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_050-2 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_JPG_0300 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_050-2 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_JPG_0300 success '); expect(pixelmap != undefined).assertTrue(); done(); } }) } } catch (error) { - console.info('TC_050-2 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_JPG_0300 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_050-3 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0100 * @tc.name : createPixelMap(decodingOptions: index 1})-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -223,12 +223,12 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-3', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_050-3 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0100 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -243,26 +243,26 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_050-3 success '); - console.info('TC_050-3 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0100 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0100 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_050-3 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0100 fail ' + pixelmap); expect(false).assertTrue(); done(); } }) } } catch (error) { - console.info('TC_050-3 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_050-4 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0200 * @tc.name : createPixelMap(decodingOptions:index -1})-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -272,12 +272,12 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-4', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0200', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_050-4 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0200 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -292,26 +292,26 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_050-4 success '); - console.info('TC_050-4 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0200 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0200 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_050-4 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0200 fail ' + pixelmap); expect(false).assertTrue(); done(); } }) } } catch (error) { - console.info('TC_050-4 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0200 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_050-5 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0100 * @tc.name : createPixelMap(decodingOptions:sampleSize -1})-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -321,12 +321,12 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-5', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_050-5 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0100 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -341,26 +341,26 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_050-5 success '); - console.info('TC_050-5 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0100 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0100 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_050-5 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0100 fail ' + pixelmap); expect(false).assertTrue(); done(); } }) } } catch (error) { - console.info('TC_050-5 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_050-6 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0100 * @tc.name : createPixelMap(decodingOptions:rotate -10})-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -370,12 +370,12 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-6', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_050-6 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0100 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -390,26 +390,26 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_050-6 success '); - console.info('TC_050-6 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0100 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0100 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_050-6 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0100 fail ' + pixelmap); expect(false).assertTrue(); done(); } }) } } catch (error) { - console.info('TC_050-6 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_050-7 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0100 * @tc.name : createPixelMap(decodingOptions:unsupported pixelformat)-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -419,12 +419,12 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-7', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_050-7 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0100 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -439,26 +439,26 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_050-7 success '); - console.info('TC_050-7 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0100 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0100 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_050-7 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0100 fail ' + pixelmap); expect(false).assertTrue(); done(); } }) } } catch (error) { - console.info('TC_050-7 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_050-8 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0100 * @tc.name : createPixelMap(decodingOptions:editable false})-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -468,12 +468,12 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-8', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_050-8 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0100 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -488,26 +488,26 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_050-8 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0100 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_050-8 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0100 success '); expect(pixelmap != undefined).assertTrue(); done(); } }) } } catch (error) { - console.info('TC_050-8 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_050-9 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0100 * @tc.name : createPixelMap(decodingOptions:desiredSize>imagesize)-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -517,12 +517,12 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-9', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_050-9 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0100 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -537,26 +537,26 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_050-9 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0100 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_050-9 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0100 success '); expect(pixelmap != undefined).assertTrue(); done(); } }) } } catch (error) { - console.info('TC_050-9 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_050-10 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0200 * @tc.name : createPixelMap(decodingOptions:desiredRegion>imagesize)-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -566,12 +566,12 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-10', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0200', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_050-10 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0200 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -586,7 +586,7 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_050-10 createPixelMap err ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0200 createPixelMap err ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { @@ -594,25 +594,25 @@ export default function imageDecodeOptions() { pixelmap.getImageInfo().then((imageInfo) => { expect(imageInfo.size.height == 2).assertTrue(); expect(imageInfo.size.width == 1).assertTrue(); - console.info('TC_050-10 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0200 success '); console.info("imageInfo height :" + imageInfo.size.height ); console.info("imageInfo width : " + imageInfo.size.width); done(); }).catch((err) => { - console.info('TC_050-10 getimageInfo err ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0200 getimageInfo err ' + JSON.stringify(err)); }) } }) } } catch (error) { - console.info('TC_050-10 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0200 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_050-11 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0100 * @tc.name : createPixelMapdecodingOptions:x -1 y -1)-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -622,12 +622,12 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-11', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_050-11 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0100 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -642,26 +642,26 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_050-11 success '); - console.info('TC_050-11 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0100 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0100 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_050-11 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0100 fail ' + pixelmap); expect(false).assertTrue(); done(); } }) } } catch (error) { - console.info('TC_050-11 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_050-12 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0200 * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -671,12 +671,12 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-12', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0200', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_050-12 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0200 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -691,26 +691,26 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_050-12 success '); - console.info('TC_050-12 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0200 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0200 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_050-12 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0200 fail ' + pixelmap); expect(false).assertTrue(); done(); } }) } } catch (error) { - console.info('TC_050-12 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0200 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_050-13 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0200 * @tc.name : createPixelMap(decodingOptions:rotate>360)-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -720,12 +720,12 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-13', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0200', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_050-13 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0200 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -740,26 +740,26 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_050-13 success '); - console.info('TC_050-13 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0200 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0200 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_050-13 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0200 fail ' + pixelmap); expect(false).assertTrue(); done(); } }) } } catch (error) { - console.info('TC_050-13 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0200 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_050-14 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PROMISE_0100 * @tc.name : createPixelMap-promise-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -769,35 +769,35 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-14', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PROMISE_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_050-14 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PROMISE_0100 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.createPixelMap().then(pixelmap => { globalpixelmap = pixelmap; - console.info('TC_050-14 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PROMISE_0100 success '); expect(pixelmap != undefined).assertTrue(); done(); }).catch(error => { - console.log('TC_050-14 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PROMISE_0100 error: ' + error); expect().assertFail(); done(); }) } } catch (error) { - console.info('TC_050-14 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PROMISE_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_050-15 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_CALLBACK_0100 * @tc.name : createPixelMap-callback-jpg * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -807,31 +807,31 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-15', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_CALLBACK_0100', 0, async function (done) { try { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_050-15 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_CALLBACK_0100 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.createPixelMap((err, pixelmap) => { globalpixelmap = pixelmap; - console.info('TC_050-15 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_CALLBACK_0100 success '); expect(pixelmap != undefined).assertTrue(); done(); }) } } catch (error) { - console.info('TC_050-15 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_CALLBACK_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_067 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0100 * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_8888-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -841,11 +841,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0100', 0, async function (done) { await getFd('moving_test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_067 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0100 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -860,12 +860,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_067 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0100 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_067 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0100 success '); expect(pixelmap != undefined).assertTrue(); done(); } @@ -874,7 +874,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_067-1 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0200 * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_565-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -884,11 +884,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0200', 0, async function (done) { await getFd('moving_test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_067-1 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0200 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -903,12 +903,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_067-1 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0200 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_067-1 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0200 success '); expect(pixelmap != undefined).assertTrue(); done(); } @@ -917,7 +917,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_067-2 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0300 * @tc.name : createPixelMap(decodingOptions)-pixelformat:unkonwn-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -927,11 +927,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-2', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0300', 0, async function (done) { await getFd('moving_test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_067-2 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0300 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -946,12 +946,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_067-2 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0300 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_067-2 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0300 success '); expect(pixelmap != undefined).assertTrue(); done(); } @@ -960,7 +960,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_067-3 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0300 * @tc.name : createPixelMap(decodingOptions:index 1})-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -970,11 +970,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-3', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0300', 0, async function (done) { await getFd('moving_test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_067-3 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0300 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -989,12 +989,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_067-3 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0300 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_067-3 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0300 success '); expect(pixelmap != undefined).assertTrue(); done(); } @@ -1003,7 +1003,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_067-4 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0400 * @tc.name : createPixelMap(decodingOptions:index -1})-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1013,11 +1013,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-4', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0400', 0, async function (done) { await getFd('moving_test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_067-4 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0400 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1032,12 +1032,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_067-4 success '); - console.info('TC_067-4 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0400 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0400 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_067-4 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0400 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -1046,7 +1046,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_067-5 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0200 * @tc.name : createPixelMap(decodingOptions:sampleSize -1})-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1056,11 +1056,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-5', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0200', 0, async function (done) { await getFd('moving_test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_067-5 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0200 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1075,12 +1075,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_067-5 success '); - console.info('TC_067-5 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0200 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0200 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_067-5 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0200 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -1089,7 +1089,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_067-6 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0300 * @tc.name : createPixelMap(decodingOptions:rotate -10})-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1099,11 +1099,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-6', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0300', 0, async function (done) { await getFd('moving_test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_067-6 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0300 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1118,12 +1118,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_067-6 success '); - console.info('TC_067-6 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0300 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0300 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_067-6 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0300 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -1132,7 +1132,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_067-7 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0200 * @tc.name : createPixelMap(decodingOptions:unsupported pixelformat)-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1142,11 +1142,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-7', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0200', 0, async function (done) { await getFd('moving_test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_067-7 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0200 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1161,12 +1161,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_067-7 success '); - console.info('TC_067-7 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0200 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0200 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_067-7 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0200 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -1175,7 +1175,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_067-8 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0200 * @tc.name : createPixelMap(decodingOptions:editable false})-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1185,11 +1185,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-8', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0200', 0, async function (done) { await getFd('moving_test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_067-8 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0200 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1204,12 +1204,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_067-8 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0200 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_067-8 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0200 success '); expect(pixelmap != undefined).assertTrue(); done(); } @@ -1218,7 +1218,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_067-9 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0300 * @tc.name : createPixelMap(decodingOptions:desiredSize>imagesize)-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1228,11 +1228,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-9', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0300', 0, async function (done) { await getFd('moving_test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_067-9 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0300 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1247,12 +1247,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_067-9 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0300 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_067-9 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0300 success '); expect(pixelmap != undefined).assertTrue(); done(); } @@ -1261,7 +1261,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_067-10 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0400 * @tc.name : createPixelMap(decodingOptions:desiredRegion>imagesize)-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1271,11 +1271,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-10', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0400', 0, async function (done) { await getFd('moving_test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info(' TC_067-10 create image source failed'); + console.info(' SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0400 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1290,7 +1290,7 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_067-10 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0400 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { @@ -1298,12 +1298,12 @@ export default function imageDecodeOptions() { pixelmap.getImageInfo().then((imageInfo) => { expect(imageInfo.size.height == 2).assertTrue(); expect(imageInfo.size.width == 1).assertTrue(); - console.info('TC_067-10 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0400 success '); console.info("imageInfo height :" + imageInfo.size.height); console.info("imageInfo width : " + imageInfo.size.width); done(); }).catch((err) => { - console.info('TC_067-10 getimageInfo err ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0400 getimageInfo err ' + JSON.stringify(err)); }) } }) @@ -1311,7 +1311,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_067-11 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0300 * @tc.name : createPixelMapdecodingOptions:x -1 y -1)-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1321,11 +1321,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-11', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0300', 0, async function (done) { await getFd('moving_test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_067-11 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0300 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1340,12 +1340,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_067-11 success '); - console.info('TC_067-11createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0300 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0300createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_067-11 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0300 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -1354,7 +1354,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_067-12 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0400 * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1364,11 +1364,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-12', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0400', 0, async function (done) { await getFd('moving_test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_067-12 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0400 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1383,12 +1383,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_067-12 success '); - console.info('TC_067-12 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0400 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0400 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_067-12 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0400 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -1397,7 +1397,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_067-13 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0400 * @tc.name : createPixelMap(decodingOptions:rotate>360)-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1407,11 +1407,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-13', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0400', 0, async function (done) { await getFd('moving_test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_067-13 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0400 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1426,12 +1426,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_067-13 success '); - console.info('TC_067-13 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0400 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0400 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_067-13 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0400 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -1440,7 +1440,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_067-14 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PROMISE_0200 * @tc.name : createPixelMap-promise-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1450,21 +1450,21 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-14', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PROMISE_0200', 0, async function (done) { await getFd('moving_test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_067-14 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PROMISE_0200 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.createPixelMap().then(pixelmap => { globalpixelmap = pixelmap; - console.info('TC_067-14 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PROMISE_0200 success '); expect(pixelmap !== undefined).assertTrue(); done(); }).catch(error => { - console.log('TC_067-14 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PROMISE_0200 error: ' + error); expect().assertFail(); done(); }) @@ -1472,8 +1472,8 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_067-15 - * @tc.name : createPixelMap-pcallback-gif + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_CALLBACK_0200 + * @tc.name : createPixelMap-callback-gif * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap @@ -1482,17 +1482,17 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-15', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_CALLBACK_0200', 0, async function (done) { await getFd('moving_test.gif'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_067-15 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_CALLBACK_0200 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.createPixelMap((err, pixelmap) => { - console.info('TC_067-15 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_CALLBACK_0200 success '); expect(pixelmap !== undefined).assertTrue(); done(); }) @@ -1500,7 +1500,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_068 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0400 * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_8888-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1510,11 +1510,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0400', 0, async function (done) { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_068 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0400 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1529,12 +1529,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_068 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0400 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_068 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0400 success '); expect(pixelmap != undefined).assertTrue(); done(); } @@ -1543,7 +1543,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_068-1 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0500 * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGB_565-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1553,11 +1553,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0500', 0, async function (done) { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_068-1 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0500 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1572,12 +1572,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_068-1 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0500 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_068-1 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0500 success '); expect(pixelmap != undefined).assertTrue(); done(); } @@ -1586,7 +1586,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_068-2 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0600 * @tc.name : createPixelMap(decodingOptions)-pixelformat:unkonwn-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1596,11 +1596,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-2', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0600', 0, async function (done) { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_068-2 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0600 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1615,12 +1615,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_068-2 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0600 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_068-2 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0600 success '); expect(pixelmap != undefined).assertTrue(); done(); } @@ -1629,7 +1629,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_068-3 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0500 * @tc.name : createPixelMap(decodingOptions: index 1})-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1639,11 +1639,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-3', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0500', 0, async function (done) { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_068-3 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0500 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1658,12 +1658,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_068-3 success '); - console.info('TC_068-3 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0500 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0500 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_068-3 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0500 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -1672,7 +1672,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_068-4 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0600 * @tc.name : createPixelMap(decodingOptions:index -1})-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1682,11 +1682,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-4', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0600', 0, async function (done) { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_068-4 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0600 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1701,12 +1701,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_068-4 success '); - console.info('TC_068-4 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0600 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0600 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_068-4 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0600 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -1715,7 +1715,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_068-5 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0300 * @tc.name : createPixelMap(decodingOptions:sampleSize -1})-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1725,11 +1725,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-5', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0300', 0, async function (done) { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_068-5 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0300 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1744,12 +1744,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_068-5 success '); - console.info('TC_068-5 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0300 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0300 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_068-5 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0300 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -1758,7 +1758,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_068-6 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0500 * @tc.name : createPixelMap(decodingOptions:rotate -10})-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1768,11 +1768,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-6', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0500', 0, async function (done) { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_068-6 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0500 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1787,12 +1787,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_068-6 success '); - console.info('TC_068-6 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0500 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0500 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_068-6 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0500 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -1801,7 +1801,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_068-7 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0300 * @tc.name : createPixelMap(decodingOptions:unsupported pixelformat)-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1811,11 +1811,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-7', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0300', 0, async function (done) { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_068-7 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0300 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1830,12 +1830,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_068-7 success '); - console.info('TC_068-7 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0300 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0300 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_068-7 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0300 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -1844,7 +1844,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_068-8 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0300 * @tc.name : createPixelMap(decodingOptions:editable false})-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1854,11 +1854,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-8', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0300', 0, async function (done) { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_068-8 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0300 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1873,12 +1873,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_068-8 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0300 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_068-8 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0300 success '); expect(pixelmap != undefined).assertTrue(); done(); } @@ -1887,7 +1887,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_068-9 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0500 * @tc.name : createPixelMap(decodingOptions:desiredSize>imagesize)-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1897,11 +1897,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-9', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0500', 0, async function (done) { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_068-9 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0500 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1916,12 +1916,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_068-9 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0500 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_068-9 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0500 success '); expect(pixelmap != undefined).assertTrue(); done(); } @@ -1930,7 +1930,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_068-10 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0600 * @tc.name : createPixelMap(decodingOptions:desiredRegion>imagesize)-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1940,11 +1940,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-10', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0600', 0, async function (done) { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info(' TC_068-10 create image source failed'); + console.info(' SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0600 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -1960,7 +1960,7 @@ export default function imageDecodeOptions() { imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_068-10 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0600 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { @@ -1968,12 +1968,12 @@ export default function imageDecodeOptions() { pixelmap.getImageInfo().then((imageInfo) => { expect(imageInfo.size.height == 2).assertTrue(); expect(imageInfo.size.width == 1).assertTrue(); - console.info('TC_068-10 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0600 success '); console.info("imageInfo height :" + imageInfo.size.height); console.info("imageInfo width : " + imageInfo.size.width); done(); }).catch((err) => { - console.info('TC_068-10 getimageInfo err ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0600 getimageInfo err ' + JSON.stringify(err)); }) } }) @@ -1981,7 +1981,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_068-11 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0500 * @tc.name : createPixelMapdecodingOptions:x -1 y -1)-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -1991,11 +1991,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-11', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0500', 0, async function (done) { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_068-11 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0500 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2010,12 +2010,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_068-11 success '); - console.info('TC_068-11 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0500 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0500 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_068-11 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0500 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -2024,7 +2024,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_068-12 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0600 * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -2034,11 +2034,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-12', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0600', 0, async function (done) { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_068-12 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0600 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2053,12 +2053,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_068-12 success '); - console.info('TC_068-12 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0600 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0600 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_068-12 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0600 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -2067,8 +2067,8 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_068-13 - * @tc.name : createPixelMap(decodingOptions:rotate>360)-jpg + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0600 + * @tc.name : createPixelMap(decodingOptions:rotate>360)-bmp * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions * 3.create PixelMap @@ -2077,11 +2077,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-13', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0600', 0, async function (done) { await getFd('test.bmp'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_068-13 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0600 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2096,12 +2096,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_068-13 success '); - console.info('TC_068-13 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0600 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0600 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_068-13 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0600 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -2110,7 +2110,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_163 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0700 * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_8888-png * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -2120,11 +2120,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0700', 0, async function (done) { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_163 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0700 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2139,12 +2139,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_163 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0700 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_163 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0700 success '); expect(pixelmap != undefined).assertTrue(); done(); } @@ -2153,7 +2153,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_163-1 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0800 * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGB_565-png * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -2163,11 +2163,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0800', 0, async function (done) { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_163-1 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0800 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2182,12 +2182,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_163-1 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0800 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_163-1 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0800 success '); expect(pixelmap != undefined).assertTrue(); done(); } @@ -2196,7 +2196,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_163-2 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0900 * @tc.name : createPixelMap(decodingOptions)-pixelformat:unkonwn-png * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -2206,11 +2206,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-2', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0900', 0, async function (done) { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_163-2 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0900 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2225,12 +2225,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_163-2 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0900 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_163-2 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_PIXELFORMAT_0900 success '); expect(pixelmap != undefined).assertTrue(); done(); } @@ -2239,7 +2239,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_163-3 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0700 * @tc.name : createPixelMap(decodingOptions: index 1})-png * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -2249,11 +2249,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-3', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0700', 0, async function (done) { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_163-3 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0700 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2268,12 +2268,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_163-3 success '); - console.info('TC_163-3 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0700 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0700 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_163-3 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0700 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -2282,7 +2282,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_163-4 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0800 * @tc.name : createPixelMap(decodingOptions:index -1})-png * @tc.desc : 1.create imagesource * 2.set decodingOptions @@ -2293,11 +2293,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-4', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0800', 0, async function (done) { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_163-4 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0800 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2312,12 +2312,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_163-4 success '); - console.info('TC_163-4 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0800 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0800 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_163-4 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_INDEX_0800 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -2326,7 +2326,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_163-5 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0400 * @tc.name : createPixelMap(decodingOptions:sampleSize -1})-png * @tc.desc : 1.create imagesource * 2.set decodingOptions @@ -2337,11 +2337,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-5', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0400', 0, async function (done) { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_163-5 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0400 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2356,12 +2356,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_163-5 success '); - console.info('TC_163-5 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0400 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0400 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_163-5 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_SAMPLESIZE_0400 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -2370,7 +2370,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_163-6 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0700 * @tc.name : createPixelMap(decodingOptions:rotate -10})-png * @tc.desc : 1.create imagesource * 2.set decodingOptions @@ -2381,11 +2381,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-6', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0700', 0, async function (done) { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_163-6 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0700 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2400,12 +2400,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_163-6 success '); - console.info('TC_163-6 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0700 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0700 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_163-6 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0700 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -2414,7 +2414,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_163-7 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0400 * @tc.name : createPixelMap(decodingOptions:unsupported pixelformat)-png * @tc.desc : 1.create imagesource * 2.set decodingOptions @@ -2425,11 +2425,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-7', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0400', 0, async function (done) { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_163-7 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0400 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2444,12 +2444,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_163-7 success '); - console.info('TC_163-7 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0400 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0400 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_163-7 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_PIXELFORMAT_0400 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -2458,7 +2458,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_163-8 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0400 * @tc.name : createPixelMap(decodingOptions:editable false})-png * @tc.desc : 1.create imagesource * 2.set decodingOptions @@ -2469,11 +2469,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-8', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0400', 0, async function (done) { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_163-8 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0400 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2488,12 +2488,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_163-8 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0400 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_163-8 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_EDITABLE_FALSE_0400 success '); expect(pixelmap != undefined).assertTrue(); done(); } @@ -2502,7 +2502,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_163-9 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0700 * @tc.name : createPixelMap(decodingOptions:desiredSize>imagesize)-png * @tc.desc : 1.create imagesource * 2.set decodingOptions @@ -2513,11 +2513,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-9', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0700', 0, async function (done) { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_163-9 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0700 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2532,12 +2532,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_163-9 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0700 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; - console.info('TC_163-9 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0700 success '); expect(pixelmap != undefined).assertTrue(); done(); } @@ -2546,7 +2546,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_163-10 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0800 * @tc.name : createPixelMap(decodingOptions:desiredRegion>imagesize)-png * @tc.desc : 1.create imagesource * 2.set decodingOptions @@ -2557,11 +2557,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-10', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0800', 0, async function (done) { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info(' TC_163-10 create image source failed'); + console.info(' SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0800 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2576,7 +2576,7 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_163-10 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0800 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { @@ -2584,12 +2584,12 @@ export default function imageDecodeOptions() { pixelmap.getImageInfo().then((imageInfo) => { expect(imageInfo.size.height == 2).assertTrue(); expect(imageInfo.size.width == 1).assertTrue(); - console.info('TC_163-10 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0800 success '); console.info("imageInfo height :" + imageInfo.size.height); console.info("imageInfo width : " + imageInfo.size.width); done(); }).catch((err) => { - console.info('TC_163-10 getimageInfo err ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_DESIRED_0800 getimageInfo err ' + JSON.stringify(err)); }) } }) @@ -2597,7 +2597,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_163-11 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0700 * @tc.name : createPixelMapdecodingOptions:x -1 y -1)-png * @tc.desc : 1.create imagesource * 2.set decodingOptions @@ -2608,11 +2608,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-11', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0700', 0, async function (done) { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_163-11 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0700 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2627,12 +2627,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_163-11 success '); - console.info('TC_163-11 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0700 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0700 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_163-11 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0700 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -2641,7 +2641,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_163-12 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0800 * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-png * @tc.desc : 1.create imagesource * 2.set decodingOptions @@ -2652,11 +2652,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-12', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0800', 0, async function (done) { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_163-12 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0800 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2671,12 +2671,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_163-12 success '); - console.info('TC_163-12 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0800 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0800 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_163-12 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_XY_0800 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -2685,7 +2685,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_163-13 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0800 * @tc.name : createPixelMap(decodingOptions:rotate>360)-png * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -2695,11 +2695,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-13', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0800', 0, async function (done) { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_163-13 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0800 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2714,12 +2714,12 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_163-13 success '); - console.info('TC_163-13 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0800 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0800 createPixelMap error ' + JSON.stringify(err)); expect(true).assertTrue(); done(); } else { - console.info('TC_163-13 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0800 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -2728,7 +2728,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_167 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_IMAGE_FORMAT_0100 * @tc.name : createPixelMap-unsupported image format * @tc.desc : 1.create imagesource * 2.set index and DecodeOptions @@ -2738,7 +2738,7 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_167', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_IMAGE_FORMAT_0100', 0, async function (done) { await getFd('test.tiff'); const imageSourceApi = image.createImageSource(fdNumber); let decodingOptions = { @@ -2753,12 +2753,12 @@ export default function imageDecodeOptions() { imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { globalpixelmap = pixelmap; if (err) { - console.info('TC_167 success '); - console.info('TC_167 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_IMAGE_FORMAT_0100 success '); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_IMAGE_FORMAT_0100 createPixelMap error ' + JSON.stringify(err)); expect(pixelmap == undefined).assertTrue(); done(); } else { - console.info('TC_167 fail ' + pixelmap); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_UNSUPPORTED_IMAGE_FORMAT_0100 fail ' + pixelmap); expect(false).assertTrue(); done(); } @@ -2767,7 +2767,7 @@ export default function imageDecodeOptions() { }) /** - * @tc.number : TC_169 + * @tc.number : SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0900 * @tc.name : Decode the image to generate a bitmap * @tc.desc : 1.create imagesource * 2.create pixelmap @@ -2777,11 +2777,11 @@ export default function imageDecodeOptions() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_169', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0900', 0, async function (done) { await getFd('test.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_169 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0900 create image source failed'); expect(false).assertTrue(); done(); } else { @@ -2796,24 +2796,24 @@ export default function imageDecodeOptions() { }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { if (err) { - console.info('TC_169 createPixelMap error ' + JSON.stringify(err)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0900 createPixelMap error ' + JSON.stringify(err)); expect(false).assertTrue(); done(); } else { globalpixelmap = pixelmap; pixelmap.getImageInfo((error, imageInfo) => { if (error) { - console.info('TC_169 getimageInfo err ' + JSON.stringify(error)); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0900 getimageInfo err ' + JSON.stringify(error)); expect(false).assertTrue(); done(); } else { if (imageInfo != undefined) { - console.info('TC_169 success'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0900 success'); expect(imageInfo.size.height == 2).assertTrue(); expect(imageInfo.size.width == 1).assertTrue(); done(); } else { - console.info('TC_169 imageInfo is empty'); + console.info('SUB_GRAPHIC_IMAGE_DECODEOPTIONS_CREATEPIXELMAP_ROTATE_0900 imageInfo is empty'); expect(false).assertTrue() done(); } diff --git a/multimedia/image/image_js_standard/imageExif/BUILD.gn b/multimedia/image/image_js_standard/imageExif/BUILD.gn index 11df801ceefc76a4b53563ea602e29a78d9f20ba..e4920f6cd0399b7aba9a8e5ae8cd9f400ceef89e 100644 --- a/multimedia/image/image_js_standard/imageExif/BUILD.gn +++ b/multimedia/image/image_js_standard/imageExif/BUILD.gn @@ -22,7 +22,7 @@ ohos_js_hap_suite("image_exif_js_hap") { certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsImageExifJsTest" subsystem_name = "multimedia" - part_name = "multimedia_image_standard" + part_name = "multimedia_image_framework" } ohos_js_assets("image_exif_js_assets") { source_dir = "./src/main/js/default" diff --git a/multimedia/image/image_js_standard/imageExif/src/main/config.json b/multimedia/image/image_js_standard/imageExif/src/main/config.json index c06776984f532b4dbf17643b69db9e08a2bb20d4..ac7daed551c405febf2ed32d38b599a0209cb596 100644 --- a/multimedia/image/image_js_standard/imageExif/src/main/config.json +++ b/multimedia/image/image_js_standard/imageExif/src/main/config.json @@ -44,6 +44,7 @@ } ], "deviceType": [ + "default", "phone", "tablet", "tv", diff --git a/multimedia/image/image_js_standard/imageExif/src/main/js/test/image.test.js b/multimedia/image/image_js_standard/imageExif/src/main/js/test/image.test.js index c70840ec94d344c73f338c3cc42f5d7312edbaa9..bd25eae35eb5b625e666847233ffbfe1501547e0 100644 --- a/multimedia/image/image_js_standard/imageExif/src/main/js/test/image.test.js +++ b/multimedia/image/image_js_standard/imageExif/src/main/js/test/image.test.js @@ -62,7 +62,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_171 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0100 * @tc.name : getImageProperty(BitsPerSample)-promise * @tc.desc : 1.create imagesource * 2.set property @@ -72,22 +72,22 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_171', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0100', 0, async function (done) { await getFd('test_exif1.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_171 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0100 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("BitsPerSample") .then(data => { - console.info('TC_171 BitsPerSample ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0100 BitsPerSample ' + data); expect(data != undefined && data != '').assertTrue(); done(); }) .catch(error => { - console.log('TC_171 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0100 error: ' + error); expect(false).assertFail(); done(); }) @@ -95,7 +95,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_171-1 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0200 * @tc.name : getImageProperty(Orientation)-promise * @tc.desc : 1.create imagesource * 2.set property @@ -105,22 +105,22 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_171-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0200', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_171-1 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0200 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("Orientation") .then(data => { - console.info('TC_171-1 Orientation ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0200 Orientation ' + data); expect(data != undefined && data != '').assertTrue(); done(); }) .catch(error => { - console.log('TC_171-1 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0200 error: ' + error); expect(false).assertFail(); done(); }) @@ -128,7 +128,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_171-2 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0300 * @tc.name : getImageProperty(ImageLength)-promise * @tc.desc : 1.create imagesource * 2.set property @@ -138,22 +138,22 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_171-2', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0300', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_171-2 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0300 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("ImageLength") .then(data => { - console.info('TC_171-2 ImageLength ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0300 ImageLength ' + data); expect(data != undefined && data != '').assertTrue(); done(); }) .catch(error => { - console.log('TC_171-2 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0300 error: ' + error); expect(false).assertFail(); done(); }) @@ -161,7 +161,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_171-3 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0400 * @tc.name : getImageProperty(ImageWidth)-promise * @tc.desc : 1.create imagesource * 2.set property @@ -171,22 +171,22 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_171-3', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0400', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_171-3 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0400 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("ImageWidth") .then(data => { - console.info('TC_171-3 ImageWidth ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0400 ImageWidth ' + data); expect(data != undefined && data != '').assertTrue(); done(); }) .catch(error => { - console.log('TC_171-3 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0400 error: ' + error); expect(false).assertFail(); done(); }) @@ -194,7 +194,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_171-4 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0500 * @tc.name : getImageProperty(GPSLatitude)-promise * @tc.desc : 1.create imagesource * 2.set property @@ -204,22 +204,22 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_171-4', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0500', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_171-4 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0500 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLatitude") .then(data => { - console.info('TC_171-4 GPSLatitude ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0500 GPSLatitude ' + data); expect(data != undefined && data != '').assertTrue(); done(); }) .catch(error => { - console.log('TC_171-4 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0500 error: ' + error); expect(false).assertFail(); done(); }) @@ -227,7 +227,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_171-5 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0600 * @tc.name : getImageProperty(GPSLongitude)-promise * @tc.desc : 1.create imagesource * 2.set property @@ -237,22 +237,22 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_171-5', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0600', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_171-5 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0600 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLongitude") .then(data => { - console.info('TC_171-5 GPSLongitude ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0600 GPSLongitude ' + data); expect(data != undefined && data != '').assertTrue(); done(); }) .catch(error => { - console.log('TC_171-5 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0600 error: ' + error); expect(false).assertFail(); done(); }) @@ -260,7 +260,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_171-6 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0700 * @tc.name : getImageProperty(GPSLatitudeRef)-promise * @tc.desc : 1.create imagesource * 2.set property @@ -270,22 +270,22 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_171-6', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0700', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_171-6 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0700 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLatitudeRef") .then(data => { - console.info('TC_171-6 GPSLatitudeRef ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0700 GPSLatitudeRef ' + data); expect(data != undefined && data != '').assertTrue(); done(); }) .catch(error => { - console.log('TC_171-6 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0700 error: ' + error); expect(false).assertFail(); done(); }) @@ -293,7 +293,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_171-7 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0800 * @tc.name : getImageProperty(GPSLongitudeRef)-promise * @tc.desc : 1.create imagesource * 2.set property @@ -303,22 +303,22 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_171-7', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0800', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_171-7 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0800 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLongitudeRef") .then(data => { - console.info('TC_171-7 GPSLongitudeRef ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0800 GPSLongitudeRef ' + data); expect(data != undefined && data != '').assertTrue(); done(); }) .catch(error => { - console.log('TC_171-7 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0800 error: ' + error); expect(false).assertFail(); done(); }) @@ -326,32 +326,32 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_171-8 - * @tc.name : getImageProperty(DateTimeOriginal) + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0900 + * @tc.name : getImageProperty(DateTimeOriginal)-promise * @tc.desc : 1.create imagesource * 2.set property - * 3.call getImageProperty(ImageLength) + * 3.call getImageProperty(DateTimeOriginal) * 4.The return value is not empty * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_171-8', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0900', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_171-8 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0900 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("DateTimeOriginal") .then(data => { - console.info('TC_171-8 DateTimeOriginal ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0900 DateTimeOriginal ' + data); expect(data != undefined && data != '').assertTrue(); done(); }) .catch(error => { - console.log('TC_171-8 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROMISE_0900 error: ' + error); expect(false).assertFail(); done(); }) @@ -359,7 +359,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_172 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0100 * @tc.name : getImageProperty(BitsPerSample)-callback * @tc.desc : 1.create imagesource * 2.call getImageProperty(BitsPerSample) @@ -368,21 +368,21 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_172', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0100', 0, async function (done) { await getFd('test_exif1.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_172 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0100 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("BitsPerSample", (error, data) => { if (error) { - console.info('TC_172 getImageProperty BitsPerSample error'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0100 getImageProperty BitsPerSample error'); expect(false).assertTrue(); done(); } else { - console.info('TC_172 BitsPerSample ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0100 BitsPerSample ' + data); expect(data != undefined && data != '').assertTrue(); done(); } @@ -391,7 +391,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_172-1 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0200 * @tc.name : getImageProperty(Orientation)-callback * @tc.desc : 1.create imagesource * 2.call getImageProperty(Orientation) @@ -400,21 +400,21 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_172-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0200', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_172-1 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0200 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("Orientation", (error, data) => { if (error) { - console.info('TC_172-1 getImageProperty Orientation error'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0200 getImageProperty Orientation error'); expect(false).assertTrue(); done(); } else { - console.info('TC_172-1 Orientation ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0200 Orientation ' + data); expect(data != undefined && data != '').assertTrue(); done(); } @@ -423,7 +423,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_172-2 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0300 * @tc.name : getImageProperty(ImageLength)-callback * @tc.desc : 1.create imagesource * 2.call getImageProperty(ImageLength) @@ -432,21 +432,21 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_172-2', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0300', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_172-2 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0300 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("ImageLength", (error, data) => { if (error) { - console.info('TC_172-2 getImageProperty ImageLength error'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0300 getImageProperty ImageLength error'); expect(false).assertTrue(); done(); } else { - console.info('TC_172-2 ImageLength ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0300 ImageLength ' + data); expect(data != undefined && data != '').assertTrue(); done(); } @@ -455,7 +455,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_172-3 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0400 * @tc.name : getImageProperty(ImageWidth)-callback * @tc.desc : 1.create imagesource * 2.call getImageProperty(ImageWidth) @@ -464,21 +464,21 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_172-3', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0400', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_172-3 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0400 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("ImageWidth", (error, data) => { if (error) { - console.info('TC_172-3 getImageProperty ImageWidth error'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0400 getImageProperty ImageWidth error'); expect(false).assertTrue(); done(); } else { - console.info('TC_172-3 ImageWidth ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0400 ImageWidth ' + data); expect(data != undefined && data != '').assertTrue(); done(); } @@ -487,7 +487,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_172-4 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0500 * @tc.name : getImageProperty(GPSLatitude)-callback * @tc.desc : 1.create imagesource * 2.call getImageProperty(GPSLatitude) @@ -496,21 +496,21 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_172-4', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0500', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_172-4 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0500 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLatitude", (error, data) => { if (error) { - console.info('TC_172-4 getImageProperty GPSLatitude error'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0500 getImageProperty GPSLatitude error'); expect(false).assertTrue(); done(); } else { - console.info('TC_172-4 GPSLatitude ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0500 GPSLatitude ' + data); expect(data != undefined && data != '').assertTrue(); done(); } @@ -519,7 +519,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_172-5 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0600 * @tc.name : getImageProperty(GPSLongitude)-callback * @tc.desc : 1.create imagesource * 2.call getImageProperty(GPSLongitude) @@ -528,21 +528,21 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_172-5', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0600', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_172-5 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0600 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLongitude", (error, data) => { if (error) { - console.info('TC_172-5 getImageProperty GPSLongitude error'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0600 getImageProperty GPSLongitude error'); expect(false).assertTrue(); done(); } else { - console.info('TC_172-5 GPSLongitude ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0600 GPSLongitude ' + data); expect(data != undefined && data != '').assertTrue(); done(); } @@ -551,7 +551,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_172-6 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0700 * @tc.name : getImageProperty(GPSLatitudeRef)-callback * @tc.desc : 1.create imagesource * 2.call getImageProperty(GPSLatitudeRef) @@ -560,21 +560,21 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_172-6', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0700', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_172-6 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0700 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLatitudeRef", (error, data) => { if (error) { - console.info('TC_172-6 getImageProperty GPSLatitudeRef error'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0700 getImageProperty GPSLatitudeRef error'); expect(false).assertTrue(); done(); } else { - console.info('TC_172-6 GPSLatitudeRef ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0700 GPSLatitudeRef ' + data); expect(data != undefined && data != '').assertTrue(); done(); } @@ -583,7 +583,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_172-7 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0800 * @tc.name : getImageProperty(GPSLongitudeRef)-callback * @tc.desc : 1.create imagesource * 2.call getImageProperty(GPSLongitudeRef) @@ -592,21 +592,21 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_172-7', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0800', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_172-7 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0800 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLongitudeRef", (error, data) => { if (error) { - console.info('TC_172-7 getImageProperty GPSLongitudeRef error'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0800 getImageProperty GPSLongitudeRef error'); expect(false).assertTrue(); done(); } else { - console.info('TC_172-7 GPSLongitudeRef ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0800 GPSLongitudeRef ' + data); expect(data != undefined && data != '').assertTrue(); done(); } @@ -615,7 +615,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_172-8 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0900 * @tc.name : getImageProperty(DateTimeOriginal)-callback * @tc.desc : 1.create imagesource * 2.call getImageProperty(DateTimeOriginal) @@ -624,21 +624,21 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_172-8', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0900', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_172-8 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0900 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("DateTimeOriginal", (error, data) => { if (error) { - console.info('TC_172-8 getImageProperty DateTimeOriginal error'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0900 getImageProperty DateTimeOriginal error'); expect(false).assertTrue(); done(); } else { - console.info('TC_172-8 DateTimeOriginal ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_CALLBACK_0900 DateTimeOriginal ' + data); expect(data != undefined && data != '').assertTrue(); done(); } @@ -647,7 +647,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_173 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0100 * @tc.name : getImageProperty(BitsPerSample,property)-callback * @tc.desc : 1.create imagesource * 2.set property @@ -657,22 +657,22 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_173', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0100', 0, async function (done) { await getFd('test_exif1.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_173 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0100 create image source failed'); expect(false).assertTrue(); done(); } else { let property = { index: 0, defaultValue: '9999' } imageSourceApi.getImageProperty("BitsPerSample", property, (error, data) => { if (error) { - console.info('TC_173 getImageProperty BitsPerSample error'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0100 getImageProperty BitsPerSample error'); expect(false).assertTrue(); done(); } else { - console.info('TC_173 BitsPerSample ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0100 BitsPerSample ' + data); expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); } @@ -681,7 +681,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_173-1 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0200 * @tc.name : getImageProperty(Orientation,property)-callback * @tc.desc : 1.create imagesource * 2.set property @@ -691,22 +691,22 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_173-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0200', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_173-1 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0200 create image source failed'); expect(false).assertTrue(); done(); } else { let property = { index: 0, defaultValue: '9999' } imageSourceApi.getImageProperty("Orientation", property, (error, data) => { if (error) { - console.info('TC_173-1 getImageProperty Orientation error'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0200 getImageProperty Orientation error'); expect(false).assertTrue(); done(); } else { - console.info('TC_173-1 Orientation ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0200 Orientation ' + data); expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); } @@ -715,7 +715,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_173-2 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0300 * @tc.name : getImageProperty(ImageLength,property)-callback * @tc.desc : 1.create imagesource * 2.set property @@ -725,22 +725,22 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_173-2', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0300', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_173-2 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0300 create image source failed'); expect(false).assertTrue(); done(); } else { let property = { index: 0, defaultValue: '9999' } imageSourceApi.getImageProperty("ImageLength", property, (error, data) => { if (error) { - console.info('TC_173-2 getImageProperty ImageLength error'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0300 getImageProperty ImageLength error'); expect(false).assertTrue(); done(); } else { - console.info('TC_173-2 ImageLength ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0300 ImageLength ' + data); expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); } @@ -749,7 +749,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_173-3 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0400 * @tc.name : getImageProperty(ImageWidth,property)-callback * @tc.desc : 1.create imagesource * 2.set property @@ -759,22 +759,22 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_173-3', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0400', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_173-3 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0400 create image source failed'); expect(false).assertTrue(); done(); } else { let property = { index: 0, defaultValue: '9999' } imageSourceApi.getImageProperty("ImageWidth", property, (error, data) => { if (error) { - console.info('TC_173-3 getImageProperty ImageWidth error'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0400 getImageProperty ImageWidth error'); expect(false).assertTrue(); done(); } else { - console.info('TC_173-3 ImageWidth ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0400 ImageWidth ' + data); expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); } @@ -783,7 +783,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_173-4 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0500 * @tc.name : getImageProperty(GPSLatitude,property)-callback * @tc.desc : 1.create imagesource * 2.set property @@ -793,22 +793,22 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_173-4', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0500', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_173-4 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0500 create image source failed'); expect(false).assertTrue(); done(); } else { let property = { index: 0, defaultValue: '9999' } imageSourceApi.getImageProperty("GPSLatitude", property, (error, data) => { if (error) { - console.info('TC_173-4 getImageProperty GPSLatitude error'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0500 getImageProperty GPSLatitude error'); expect(false).assertTrue(); done(); } else { - console.info('TC_173-4 GPSLatitude ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0500 GPSLatitude ' + data); expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); } @@ -817,7 +817,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_173-5 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0600 * @tc.name : getImageProperty(GPSLongitude,property)-callback * @tc.desc : 1.create imagesource * 2.set property @@ -827,22 +827,22 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_173-5', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0600', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_173-5 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0600 create image source failed'); expect(false).assertTrue(); done(); } else { let property = { index: 0, defaultValue: '9999' } imageSourceApi.getImageProperty("GPSLongitude", property, (error, data) => { if (error) { - console.info('TC_173-5 getImageProperty GPSLongitude error'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0600 getImageProperty GPSLongitude error'); expect(false).assertTrue(); done(); } else { - console.info('TC_173-5 GPSLongitude ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0600 GPSLongitude ' + data); expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); } @@ -851,7 +851,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_173-6 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0700 * @tc.name : getImageProperty(GPSLatitudeRef,property)-callback * @tc.desc : 1.create imagesource * 2.set property @@ -861,22 +861,22 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_173-6', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0700', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_173-6 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0700 create image source failed'); expect(false).assertTrue(); done(); } else { let property = { index: 0, defaultValue: '9999' } imageSourceApi.getImageProperty("GPSLatitudeRef", property, (error, data) => { if (error) { - console.info('TC_173-6 getImageProperty GPSLatitudeRef error'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0700 getImageProperty GPSLatitudeRef error'); expect(false).assertTrue(); done(); } else { - console.info('TC_173-6 GPSLatitudeRef ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0700 GPSLatitudeRef ' + data); expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); } @@ -885,7 +885,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_173-7 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0800 * @tc.name : getImageProperty(GPSLongitudeRef,property)-callback * @tc.desc : 1.create imagesource * 2.set property @@ -895,22 +895,22 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_173-7', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0800', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_173-7 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0800 create image source failed'); expect(false).assertTrue(); done(); } else { let property = { index: 0, defaultValue: '9999' } imageSourceApi.getImageProperty("GPSLongitudeRef", property, (error, data) => { if (error) { - console.info('TC_173-7 getImageProperty GPSLongitudeRef error'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0800 getImageProperty GPSLongitudeRef error'); expect(false).assertTrue(); done(); } else { - console.info('TC_173-7 GPSLongitudeRef ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0800 GPSLongitudeRef ' + data); expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); } @@ -919,7 +919,7 @@ describe('imageExif', function () { }) /** - * @tc.number : TC_173-8 + * @tc.number : SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0900 * @tc.name : getImageProperty(DateTimeOriginal,property)-callback * @tc.desc : 1.create imagesource * 2.set property @@ -929,22 +929,22 @@ describe('imageExif', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_173-8', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0900', 0, async function (done) { await getFd('test_exif.jpg'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_173-8 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0900 create image source failed'); expect(false).assertTrue(); done(); } else { let property = { index: 0, defaultValue: '9999' } imageSourceApi.getImageProperty("DateTimeOriginal", property, (error, data) => { if (error) { - console.info('TC_173-8 getImageProperty DateTimeOriginal error'); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0900 getImageProperty DateTimeOriginal error'); expect(false).assertTrue(); done(); } else { - console.info('TC_173-8 DateTimeOriginal ' + data); + console.info('SUB_GRAPHIC_IMAGE_EXIF_GETIMAGEPROPERTY_PROPERTY_CALLBACK_0900 DateTimeOriginal ' + data); expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); } diff --git a/multimedia/image/image_js_standard/imageModifyProperty/BUILD.gn b/multimedia/image/image_js_standard/imageModifyProperty/BUILD.gn index 00a3e5dd6254ade05b95730063543bb32be0dc7d..686a48a5a7d43ab802d915f1cdf4679107d090c9 100644 --- a/multimedia/image/image_js_standard/imageModifyProperty/BUILD.gn +++ b/multimedia/image/image_js_standard/imageModifyProperty/BUILD.gn @@ -22,7 +22,7 @@ ohos_js_hap_suite("image_modifyProperty_js_hap") { certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsImageModifyPropertyJsTest" subsystem_name = "multimedia" - part_name = "multimedia_image_standard" + part_name = "multimedia_image_framework" } ohos_js_assets("image_modifyProperty_js_assets") { js2abc = true diff --git a/multimedia/image/image_js_standard/imageModifyProperty/Test.json b/multimedia/image/image_js_standard/imageModifyProperty/Test.json index 5ddabbd64480a87a002f173689256ea4e99a4940..c4c6d812dbcf579fdc9d00f9da56ac28ecffd3c4 100644 --- a/multimedia/image/image_js_standard/imageModifyProperty/Test.json +++ b/multimedia/image/image_js_standard/imageModifyProperty/Test.json @@ -19,7 +19,7 @@ "type": "ShellKit", "run-command": [ "mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.image.ModifyProperty/haps/entry/files/", - "chmod -R 666 /data/app/el2/100/base/ohos.acts.multimedia.image.ModifyProperty/haps/entry/files/*" + "chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image.ModifyProperty/haps/entry/files/*" ], "teardown-command":[ @@ -40,7 +40,7 @@ "chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image.ModifyProperty/haps/entry/files/test_exif.jpg" ], "teardown-command": [ - "rm -rf /data/app/el2/100/base/ohos.acts.multimedia.image.ModifyProperty/*" + "rm -rf /data/app/el2/100/base/ohos.acts.multimedia.image.ModifyProperty/haps/entry/files/*" ] } ] diff --git a/multimedia/image/image_js_standard/imageModifyProperty/src/main/config.json b/multimedia/image/image_js_standard/imageModifyProperty/src/main/config.json index cffa4cf8fd77406f12659d2c60cee22c7312bcb3..e285b070c6dddb9e686d4321c834849bacc6aaa4 100644 --- a/multimedia/image/image_js_standard/imageModifyProperty/src/main/config.json +++ b/multimedia/image/image_js_standard/imageModifyProperty/src/main/config.json @@ -57,6 +57,7 @@ } ], "deviceType": [ + "default", "phone", "tablet", "tv", diff --git a/multimedia/image/image_js_standard/imageModifyProperty/src/main/js/test/modify.test.js b/multimedia/image/image_js_standard/imageModifyProperty/src/main/js/test/modify.test.js index 2b889462133ef1ecc9908265f1c14a1d80d5d649..4eaafc4de6d8fc0d1509867dcd035eeeaef32e77 100644 --- a/multimedia/image/image_js_standard/imageModifyProperty/src/main/js/test/modify.test.js +++ b/multimedia/image/image_js_standard/imageModifyProperty/src/main/js/test/modify.test.js @@ -13,1161 +13,1457 @@ * limitations under the License. */ -import image from '@ohos.multimedia.image' -import fileio from '@ohos.fileio' -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -import {modifyBuf} from './modifyBuffer' -import featureAbility from '@ohos.ability.featureAbility' +import image from "@ohos.multimedia.image"; +import fileio from "@ohos.fileio"; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import { modifyBuf } from "./modifyBuffer"; +import featureAbility from "@ohos.ability.featureAbility"; export default function imageModifyProperty() { -describe('imageModifyProperty', function () { - let filePath; - let fdNumber; - async function getFd(fileName) { - let context = await featureAbility.getContext(); - await context.getFilesDir().then((data) => { - filePath = data + '/' + fileName; - console.info('image case filePath is ' + filePath); - }) - await fileio.open(filePath, 0o2 | 0o100, 0o777).then((data) => { - fdNumber = data; - console.info("image case open fd success " + fdNumber); - }, (err) => { - console.info("image cese open fd fail" + err) - }).catch((err) => { - console.info("image case open fd err " + err); - }) - } - beforeAll(async function () { - console.info('beforeAll case'); - }) - - beforeEach(function () { - console.info('beforeEach case'); - }) - - afterEach(async function () { - await fileio.close(fdNumber).then(function(){ - console.info("close file succeed"); - }).catch(function(err){ - console.info("close file failed with error:"+ err); - }); - console.info('afterEach case'); - }) - - afterAll(function () { - console.info('afterAll case'); - }) - - - async function modifyPromise(done, testNum, type, key, value, checkProps){ - let imageSourceApi; - if (type == 'buffer') { - const data = modifyBuf.buffer; - imageSourceApi = image.createImageSource(data); - } else { - await getFd('test_exif.jpg'); - imageSourceApi = image.createImageSource(fdNumber); + describe("imageModifyProperty", function () { + let filePath; + async function getFd(fileName) { + let context = await featureAbility.getContext(); + await context.getFilesDir().then((data) => { + filePath = data + "/" + fileName; + console.info("image case filePath is " + filePath); + }); } - if (imageSourceApi == undefined) { - console.info(`${testNum} create image source failed`); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.modifyImageProperty(key, value).then(() => { - imageSourceApi.getImageProperty(key).then(data => { - console.info(`${testNum} ${key} ` + data); - checkProps(data); - done(); - }).catch((err) => { - console.info(`${testNum} getImageProperty failed, err:${err}`); - expect(false).assertTrue(); - done(); - }) - }).catch((err) => { - console.info(`${testNum} modifyImageProperty failed, err:${err}`); + beforeAll(async function () { + console.info("beforeAll case"); + }); + + beforeEach(function () { + console.info("beforeEach case"); + }); + + afterEach(async function () { + console.info("afterEach case"); + }); + + afterAll(function () { + console.info("afterAll case"); + }); + + async function modifyPromise(done, testNum, type, key, value, checkProps) { + let imageSourceApi; + if (type == "buffer") { + const data = modifyBuf.buffer; + imageSourceApi = image.createImageSource(data); + } else { + await getFd("test_exif.jpg"); + imageSourceApi = image.createImageSource(filePath); + } + if (imageSourceApi == undefined) { + console.info(`${testNum} create image source failed`); expect(false).assertTrue(); done(); - }) - } - } - - async function modifyCb(done, testNum, type, key, value, checkProps){ - let imageSourceApi; - if (type == 'buffer') { - const data = modifyBuf.buffer; - imageSourceApi = image.createImageSource(data); - } else { - await getFd('test_exif.jpg'); - imageSourceApi = image.createImageSource(fdNumber); - } - if (imageSourceApi == undefined) { - console.info(`${testNum} create image source failed`); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.modifyImageProperty(key, value, (error) => { - if(error){ - expect(false).assertTrue(); - console.info(`${testNum} modify err: ` + error); - }else{ - imageSourceApi.getImageProperty(key, (error, data) => { - if(error){ - expect(false).assertTrue(); - console.info(`${testNum} get err: ` + error); - }else{ - console.info(`${testNum} ${key}: ` + data); - checkProps(data); - done(); - } - - }) - } - }) - } - } - - async function modifyCb1(done, testNum, type, key, value, checkProps){ - let imageSourceApi; - if (type == 'buffer') { - const data = modifyBuf.buffer; - imageSourceApi = image.createImageSource(data); - } else { - await getFd('test_exif.jpg'); - imageSourceApi = image.createImageSource(fdNumber); - } - if (imageSourceApi == undefined) { - console.info(`${testNum} create image source failed`); - expect(false).assertTrue(); - done(); - } else { - let property = { index: 0, defaultValue: '1' } - imageSourceApi.modifyImageProperty(key, value, property, (error) => { - if(error){ - expect(false).assertTrue(); - console.info(`${testNum} modify err: ` + error); - }else{ - imageSourceApi.getImageProperty(key, (error, data) => { - if(error){ - expect(false).assertTrue(); - console.info(`${testNum} get err: ` + error); - }else{ - console.info(`${testNum} ${key}: ` + data); - checkProps(data); - done(); - } - + } else { + imageSourceApi + .modifyImageProperty(key, value) + .then(() => { + imageSourceApi + .getImageProperty(key) + .then((data) => { + console.info(`${testNum} ${key} ` + data); + checkProps(data); + done(); + }) + .catch((err) => { + console.info(`${testNum} getImageProperty failed, err:${err}`); + expect(false).assertTrue(); + done(); + }); }) - } - }) - } - } - - async function modifyErrCb(done, testNum, type, key, value) { - let imageSourceApi; - if (type == 'buffer') { - const data = modifyBuf.buffer; - imageSourceApi = image.createImageSource(data); - } else { - await getFd('test_exif.jpg'); - imageSourceApi = image.createImageSource(fdNumber); + .catch((err) => { + console.info(`${testNum} modifyImageProperty failed, err:${err}`); + expect(false).assertTrue(); + done(); + }); + } } - if (imageSourceApi == undefined) { - console.info(`${testNum} create image source failed`); - expect(false).assertTrue(); - done(); - } else { + + async function modifyCb(done, testNum, type, key, value, checkProps) { + let imageSourceApi; + if (type == "buffer") { + const data = modifyBuf.buffer; + imageSourceApi = image.createImageSource(data); + } else { + await getFd("test_exif.jpg"); + imageSourceApi = image.createImageSource(filePath); + } + if (imageSourceApi == undefined) { + console.info(`${testNum} create image source failed`); + expect(false).assertTrue(); + done(); + } else { imageSourceApi.modifyImageProperty(key, value, (error) => { - expect(error.code != 0).assertTrue(); - console.info(`${testNum} errormsg: ` + error) - done(); - }) - - } - } - - async function modifyErrCb1(done, testNum, type, key, value) { - let imageSourceApi; - if (type == 'buffer') { - const data = modifyBuf.buffer; - imageSourceApi = image.createImageSource(data); - }else { - await getFd('test_exif.jpg'); - imageSourceApi = image.createImageSource(fdNumber); + if (error) { + expect(false).assertTrue(); + console.info(`${testNum} modify err: ` + error); + } else { + imageSourceApi.getImageProperty(key, (error, data) => { + if (error) { + expect(false).assertTrue(); + console.info(`${testNum} get err: ` + error); + } else { + console.info(`${testNum} ${key}: ` + data); + checkProps(data); + done(); + } + }); + } + }); + } } - if (imageSourceApi == undefined) { - console.info(`${testNum} create image source failed`); - expect(false).assertTrue(); - done(); - } else { - let property = { index: 0, defaultValue: '1' } + + async function modifyCb1(done, testNum, type, key, value, checkProps) { + let imageSourceApi; + if (type == "buffer") { + const data = modifyBuf.buffer; + imageSourceApi = image.createImageSource(data); + } else { + await getFd("test_exif.jpg"); + imageSourceApi = image.createImageSource(filePath); + } + if (imageSourceApi == undefined) { + console.info(`${testNum} create image source failed`); + expect(false).assertTrue(); + done(); + } else { + let property = { index: 0, defaultValue: "1" }; imageSourceApi.modifyImageProperty(key, value, property, (error) => { + if (error) { + expect(false).assertTrue(); + console.info(`${testNum} modify err: ` + error); + } else { + imageSourceApi.getImageProperty(key, (error, data) => { + if (error) { + expect(false).assertTrue(); + console.info(`${testNum} get err: ` + error); + } else { + console.info(`${testNum} ${key}: ` + data); + checkProps(data); + done(); + } + }); + } + }); + } + } + + async function modifyErrCb(done, testNum, type, key, value) { + let imageSourceApi; + if (type == "buffer") { + const data = modifyBuf.buffer; + imageSourceApi = image.createImageSource(data); + } else { + await getFd("test_exif.jpg"); + imageSourceApi = image.createImageSource(filePath); + } + if (imageSourceApi == undefined) { + console.info(`${testNum} create image source failed`); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.modifyImageProperty(key, value, (error) => { expect(error.code != 0).assertTrue(); - console.info(`${testNum} errormsg: ` + error) + console.info(`${testNum} errormsg: ` + error); done(); - }) + }); + } } - } - async function modifyImageErrPromise(done, testNum, type, key, value) { - let imageSourceApi; - try { - if (type == 'buffer') { + async function modifyErrCb1(done, testNum, type, key, value) { + let imageSourceApi; + if (type == "buffer") { const data = modifyBuf.buffer; imageSourceApi = image.createImageSource(data); } else { - await getFd('test_exif.jpg'); - imageSourceApi = image.createImageSource(fdNumber); + await getFd("test_exif.jpg"); + imageSourceApi = image.createImageSource(filePath); + } + if (imageSourceApi == undefined) { + console.info(`${testNum} create image source failed`); + expect(false).assertTrue(); + done(); + } else { + let property = { index: 0, defaultValue: "1" }; + imageSourceApi.modifyImageProperty(key, value, property, (error) => { + expect(error.code != 0).assertTrue(); + console.info(`${testNum} errormsg: ` + error); + done(); + }); } - } catch (error) { - expect(false).assertTrue(); - done(); } - if (imageSourceApi == undefined) { - console.info(`${testNum} create image source failed`); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.modifyImageProperty(key, value) - .then(() => { + async function modifyImageErrPromise(done, testNum, type, key, value) { + let imageSourceApi; + try { + if (type == "buffer") { + const data = modifyBuf.buffer; + imageSourceApi = image.createImageSource(data); + } else { + await getFd("test_exif.jpg"); + imageSourceApi = image.createImageSource(filePath); + } + } catch (error) { expect(false).assertTrue(); done(); - }).catch((error) => { - expect(error.code != 0).assertTrue(); - console.info(`${testNum} message: ` + error); + } + + if (imageSourceApi == undefined) { + console.info(`${testNum} create image source failed`); + expect(false).assertTrue(); done(); - }) - } - } - - /** - * @tc.number : modify_01_001 - * @tc.name : modifyImageProperty(Orientation)-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_001', 0, async function (done) { - function checkProps(result){ - expect(result == 'Top-right').assertTrue(); - } - modifyPromise(done, 'modify_01_001', 'buffer', "Orientation", "2", checkProps); - }) - - /** - * @tc.number : modify_01_002 - * @tc.name : modifyImageProperty(GPSLatitude)-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_002', 0, async function (done) { - function checkProps(result){ - expect(result.search("38") != -1).assertTrue(); - } - modifyPromise(done, 'modify_01_002', 'buffer', "GPSLatitude", "114,3", checkProps); - }) - - /** - * @tc.number : modify_01_003 - * @tc.name : modifyImageProperty(GPSLongitude)-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_003', 0, async function (done) { - function checkProps(result){ - expect(result.search("9") != -1).assertTrue(); - } - modifyPromise(done, 'modify_01_003', 'buffer', "GPSLongitude", "18,2", checkProps); - }) - - /** - * @tc.number : modify_01_004 - * @tc.name : modifyImageProperty(GPSLatitudeRef)-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_004', 0, async function (done) { - function checkProps(result){ - expect(result == 'N').assertTrue(); - } - modifyPromise(done, 'modify_01_004', 'buffer', "GPSLatitudeRef", "N", checkProps); - }) - - /** - * @tc.number : modify_01_005 - * @tc.name : modifyImageProperty(GPSLongitudeRef)-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_005', 0, async function (done) { - function checkProps(result){ - expect(result == 'W').assertTrue(); - } - modifyPromise(done, 'modify_01_005', 'buffer', "GPSLongitudeRef", "W", checkProps); - }) - - /** - * @tc.number : modify_01_006 - * @tc.name : modifyImageProperty(Orientation)-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_006', 0, async function (done) { - function checkProps(result){ - expect(result == 'Top-right').assertTrue(); - } - modifyPromise(done, 'modify_01_006', 'fd', "Orientation", "2", checkProps) - }) - - /** - * @tc.number : modify_01_007 - * @tc.name : modifyImageProperty(GPSLatitude)-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_007', 0, async function (done) { - function checkProps(result){ - expect(result.search("38") != -1).assertTrue(); - } - modifyPromise(done, 'modify_01_007', 'fd', "GPSLatitude", "114,3", checkProps); - }) - - /** - * @tc.number : modify_01_008 - * @tc.name : modifyImageProperty(GPSLongitude)-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_008', 0, async function (done) { - function checkProps(result){ - expect(result.search("9") != -1).assertTrue(); - } - modifyPromise(done, 'modify_01_008', 'fd', "GPSLongitude", "18,2", checkProps); - }) - - /** - * @tc.number : modify_01_009 - * @tc.name : modifyImageProperty(GPSLatitudeRef)-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_009', 0, async function (done) { - function checkProps(result){ - expect(result == 'N').assertTrue(); - } - modifyPromise(done, 'modify_01_009', 'fd', "GPSLatitudeRef", "N", checkProps); - }) - - /** - * @tc.number : modify_01_010 - * @tc.name : modifyImageProperty(GPSLongitudeRef)-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_010', 0, async function (done) { - function checkProps(result){ - expect(result == 'W').assertTrue(); - } - modifyPromise(done, 'modify_01_010', 'fd', "GPSLongitudeRef", "W", checkProps); - }) - - /** - * @tc.number : modify_02_001 - * @tc.name : modifyImageProperty(Orientation)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_001', 0, async function (done) { - function checkProps(result){ - expect(result == 'Top-right').assertTrue(); - } - modifyCb(done, 'modify_02_001', 'buffer', "Orientation", "2", checkProps); - }) - - /** - * @tc.number : modify_02_002 - * @tc.name : modifyImageProperty(GPSLatitude)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_002', 0, async function (done) { - function checkProps(result){ - expect(result.search("38") != -1).assertTrue(); - } - modifyCb(done, 'modify_02_002', 'buffer', "GPSLatitude", "114,3", checkProps); - }) - - /** - * @tc.number : modify_02_003 - * @tc.name : modifyImageProperty(GPSLongitude)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_003', 0, async function (done) { - function checkProps(result){ - expect(result.search("9") != -1).assertTrue(); - } - modifyCb(done, 'modify_02_003', 'buffer', "GPSLongitude", "18,2", checkProps); - }) - - /** - * @tc.number : modify_02_004 - * @tc.name : modifyImageProperty(GPSLatitudeRef)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_004', 0, async function (done) { - function checkProps(result){ - expect(result == "N").assertTrue(); - } - modifyCb(done, 'modify_02_004', 'buffer', "GPSLatitudeRef", "N", checkProps); - }) - - /** - * @tc.number :modify_02_005 - * @tc.name : modifyImageProperty(GPSLongitudeRef)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_005', 0, async function (done) { - function checkProps(result){ - expect(result == "W").assertTrue(); - } - modifyCb(done, 'modify_02_005', 'buffer', "GPSLongitudeRef", "W", checkProps); - }) - - /** - * @tc.number : modify_02_006 - * @tc.name : modifyImageProperty(Orientation)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_006', 0, async function (done) { - function checkProps(result){ - expect(result == 'Top-right').assertTrue(); - } - modifyCb(done, 'modify_02_006', 'fd', "Orientation", "2", checkProps); - }) - - /** - * @tc.number : modify_02_007 - * @tc.name : modifyImageProperty(GPSLatitude)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_007', 0, async function (done) { - function checkProps(result){ - expect(result.search("38") != -1).assertTrue(); - } - modifyCb(done, 'modify_02_007', 'fd', "GPSLatitude", "114,3", checkProps); - }) - - /** - * @tc.number : modify_02_008 - * @tc.name : modifyImageProperty(GPSLongitude)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_008', 0, async function (done) { - function checkProps(result){ - expect(result.search("9") != -1).assertTrue(); - } - modifyCb(done, 'modify_02_008', 'fd', "GPSLongitude", "18,2", checkProps); - }) - - /** - * @tc.number : modify_02_009 - * @tc.name : modifyImageProperty(GPSLatitudeRef)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_009', 0, async function (done) { - function checkProps(result){ - expect(result == "N").assertTrue(); - } - modifyCb(done, 'modify_02_009', 'fd', "GPSLatitudeRef", "N", checkProps); - }) - - /** - * @tc.number : modify_02_010 - * @tc.name : modifyImageProperty(GPSLongitudeRef)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_010', 0, async function (done) { - function checkProps(result){ - expect(result == "W").assertTrue(); - } - modifyCb(done, 'modify_02_010', 'fd', "GPSLongitudeRef", "W", checkProps); - }) - - /** - * @tc.number : modify_03_001 - * @tc.name : modifyImageProperty(Orientation,property)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value,options) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_001', 0, async function (done) { - function checkProps(result){ - expect(result == 'Top-right').assertTrue(); - } - modifyCb1(done, 'modify_03_001', 'buffer', "Orientation", "2", checkProps); - }) - - /** - * @tc.number : modify_03_002 - * @tc.name : modifyImageProperty(GPSLatitude,property)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value,options) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_002', 0, async function (done) { - function checkProps(result){ - expect(result.search("38") != -1).assertTrue(); - } - modifyCb1(done, 'modify_03_002', 'buffer', "GPSLatitude", "114,3", checkProps); - }) - - /** - * @tc.number : modify_03_003 - * @tc.name : modifyImageProperty(GPSLongitude,property)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value,options) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_003', 0, async function (done) { - function checkProps(result){ - expect(result.search("9") != -1).assertTrue(); - } - modifyCb1(done, 'modify_03_003', 'buffer', "GPSLongitude", "18,2", checkProps); - }) - - /** - * @tc.number : modify_03_004 - * @tc.name : modifyImageProperty(GPSLatitudeRef,property)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value,options) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_004', 0, async function (done) { - function checkProps(result){ - expect(result == "N").assertTrue(); - } - modifyCb1(done, 'modify_03_004', 'buffer', "GPSLatitudeRef", "N", checkProps); - }) - - /** - * @tc.number : modify_03_005 - * @tc.name : modifyImageProperty(GPSLongitudeRef,property)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value,options) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_005', 0, async function (done) { - function checkProps(result){ - expect(result == "W").assertTrue(); - } - modifyCb1(done, 'modify_03_005', 'buffer', "GPSLongitudeRef", "W", checkProps); - }) - - /** - * @tc.number : modify_03_006 - * @tc.name : modifyImageProperty(Orientation,property)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value,options) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_006', 0, async function (done) { - function checkProps(result){ - expect(result == 'Top-right').assertTrue(); - } - modifyCb1(done, 'modify_03_006', 'fd', "Orientation", "2", checkProps); - }) - - /** - * @tc.number : modify_03_007 - * @tc.name : modifyImageProperty(GPSLatitude,property)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value,options) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_007', 0, async function (done) { - function checkProps(result){ - expect(result.search("38") != -1).assertTrue(); - } - modifyCb1(done, 'modify_03_007', 'fd', "GPSLatitude", "114,3", checkProps); - }) - - /** - * @tc.number : modify_03_008 - * @tc.name : modifyImageProperty(GPSLongitude,property)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value,options) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_008', 0, async function (done) { - function checkProps(result){ - expect(result.search("9") != -1).assertTrue(); - } - modifyCb1(done, 'modify_03_008', 'fd', "GPSLongitude", "18,2", checkProps); - }) - - /** - * @tc.number : modify_03_009 - * @tc.name : modifyImageProperty(GPSLatitudeRef,property)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value,options) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_009', 0, async function (done) { - function checkProps(result){ - expect(result == "N").assertTrue(); - } - modifyCb1(done, 'modify_03_009', 'fd', "GPSLatitudeRef", "N", checkProps); - }) - - /** - * @tc.number : modify_03_010 - * @tc.name : modifyImageProperty(GPSLongitudeRef,property)-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value,options) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_010', 0, async function (done) { - function checkProps(result){ - expect(result == "W").assertTrue(); + } else { + imageSourceApi + .modifyImageProperty(key, value) + .then(() => { + expect(false).assertTrue(); + done(); + }) + .catch((error) => { + expect(error.code != 0).assertTrue(); + console.info(`${testNum} message: ` + error); + done(); + }); + } } - modifyCb1(done, 'modify_03_010', 'fd', "GPSLongitudeRef", "W", checkProps); - }) - - /** - * @tc.number : modify_01_011 - * @tc.name : modifyImageProperty(Orientation)-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_011', 0, async function (done) { - modifyImageErrPromise(done, 'modify_01_011', 'fd', "Orientation", "abcdef") - }) - - /** - * @tc.number : modify_01_012 - * @tc.name : modifyImageProperty(GPSLatitude)-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_012', 0, async function (done) { - modifyImageErrPromise(done, 'modify_01_012', 'fd', "GPSLatitude", "abc,3") - }) - - /** - * @tc.number : modify_01_013 - * @tc.name : modifyImageProperty(GPSLongitude)-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_013', 0, async function (done) { - modifyImageErrPromise(done, 'modify_01_013', 'fd', "GPSLongitude", "abc,2") - }) - - /** - * @tc.number : modify_01_014 - * @tc.name : modifyImageProperty(GPSLatitudeRef)-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_014', 0, async function (done) { - modifyImageErrPromise(done, 'modify_01_014', 'fd', "GPSLatitudeRef", "456") - }) - - /** - * @tc.number : modify_01_015 - * @tc.name : modifyImageProperty(GPSLongitudeRef)-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_015', 0, async function (done) { - modifyImageErrPromise(done, 'modify_01_015', 'fd', "GPSLongitudeRef", "1234") - }) - - /** - * @tc.number : modify_01_016 - * @tc.name : modifyImageProperty()-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_016', 0, async function (done) { - modifyImageErrPromise(done, "modify_01_016", "buffer", "Orientation", "abcdef") - }) - - /** - * @tc.number : modify_01_017 - * @tc.name : modifyImageProperty()-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_017', 0, async function (done) { - modifyImageErrPromise(done, "modify_01_017", "buffer", "GPSLatitude", "abc,3") - }) - - /** - * @tc.number : modify_01_018 - * @tc.name : modifyImageProperty()-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_018', 0, async function (done) { - modifyImageErrPromise(done, "modify_01_018", "buffer", "GPSLongitude", "abc,2") - }) - - /** - * @tc.number : modify_01_019 - * @tc.name : modifyImageProperty()-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_019', 0, async function (done) { - modifyImageErrPromise(done, "modify_01_019", "buffer", "GPSLatitudeRef", "456") - }) - - /** - * @tc.number : modify_01_020 - * @tc.name : modifyImageProperty()-promise - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_01_020', 0, async function (done) { - modifyImageErrPromise(done, "modify_01_020", "buffer", "GPSLongitudeRef", "1234") - }) - - /** - * @tc.number : modify_02_011 - * @tc.name : modifyImageProperty-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_011', 0, async function (done) { - modifyErrCb(done, "modify_02_011", "fd", "Orientation", "abcdef") - }) - - /** - * @tc.number : modify_02_012 - * @tc.name : modifyImageProperty-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_012', 0, async function (done) { - modifyErrCb(done, "modify_02_012", "fd", "GPSLatitude", "abc,3") - }) - - /** - * @tc.number : modify_02_013 - * @tc.name : modifyImageProperty-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_013', 0, async function (done) { - modifyErrCb(done, "modify_02_013", "fd", "GPSLongitude", "abc,2") - }) - - /** - * @tc.number : modify_02_014 - * @tc.name : modifyImageProperty-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_014', 0, async function (done) { - modifyErrCb(done, "modify_02_014", "fd", "GPSLongitudeRef", "1234") - }) - - /** - * @tc.number : modify_02_015 - * @tc.name : modifyImageProperty-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_015', 0, async function (done) { - modifyErrCb(done, "modify_02_015", "fd", "GPSLatitudeRef", "456") - }) - - /** - * @tc.number : modify_02_016 - * @tc.name : modifyImageProperty-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_016', 0, async function (done) { - modifyErrCb(done, "modify_02_016", "buffer", "Orientation", "abcdef") - }) - - /** - * @tc.number : modify_02_017 - * @tc.name : modifyImageProperty-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_017', 0, async function (done) { - modifyErrCb(done, "modify_02_017", "buffer", "GPSLatitude", "abc,3") - }) - - /** - * @tc.number : modify_02_018 - * @tc.name : modifyImageProperty-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_018', 0, async function (done) { - modifyErrCb(done, "modify_02_018", "buffer", "GPSLongitude", "abc,2") - }) - - /** - * @tc.number : modify_02_019 - * @tc.name : modifyImageProperty-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_019', 0, async function (done) { - modifyErrCb(done, "modify_02_019", "buffer", "GPSLongitudeRef", "1234") - }) - - /** - * @tc.number : modify_02_020 - * @tc.name : modifyImageProperty-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_02_020', 0, async function (done) { - modifyErrCb(done, "modify_02_020", "buffer", "GPSLatitudeRef", "456") - }) - - /** - * @tc.number : modify_03_011 - * @tc.name : modifyImageProperty()-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_011', 0, async function (done) { - modifyErrCb1(done, "modify_03_011", "fd", "Orientation", "abcdef") - }) - - /** - * @tc.number : modify_03_012 - * @tc.name : modifyImageProperty()-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_012', 0, async function (done) { - modifyErrCb1(done, "modify_03_012", "fd", "GPSLatitude", "abc,3") - }) - - /** - * @tc.number : modify_03_013 - * @tc.name : modifyImageProperty()-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_013', 0, async function (done) { - modifyErrCb1(done, "modify_03_013", "fd", "GPSLongitude", "abc,2") - }) - - /** - * @tc.number : modify_03_014 - * @tc.name : modifyImageProperty()-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_014', 0, async function (done) { - modifyErrCb1(done, "modify_03_014", "fd", "GPSLatitudeRef", "1234") - }) - - /** - * @tc.number : modify_03_015 - * @tc.name : modifyImageProperty()-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_015', 0, async function (done) { - modifyErrCb1(done, "modify_03_015", "fd", "GPSLongitudeRef", "567") - }) - - /** - * @tc.number : modify_03_016 - * @tc.name : modifyImageProperty-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_016', 0, async function (done) { - modifyErrCb1(done, "modify_03_016", "buffer", "Orientation", "abcef") - }) - - /** - * @tc.number : modify_03_017 - * @tc.name : modifyImageProperty-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_017', 0, async function (done) { - modifyErrCb1(done, "modify_03_017", "buffer", "GPSLatitude", "abc,3") - }) - - /** - * @tc.number : modify_03_018 - * @tc.name : modifyImageProperty-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_018', 0, async function (done) { - modifyErrCb1(done, "modify_03_018", "buffer", "GPSLongitude", "abc,2") - }) - - /** - * @tc.number : modify_03_019 - * @tc.name : modifyImageProperty-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_019', 0, async function (done) { - modifyErrCb1(done, "modify_03_019", "buffer", "GPSLatitudeRef", "456") - }) - - /** - * @tc.number : modify_03_020 - * @tc.name : modifyImageProperty-callback - * @tc.desc : 1.create imagesource - * 2.call modifyImageProperty(key,value) - * 3.return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('modify_03_020', 0, async function (done) { - modifyErrCb1(done, "modify_03_020", "buffer", "GPSLongitudeRef", "1234") - }) -})} + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0100 + * @tc.name : modifyImageProperty(Orientation)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0100", 0, async function (done) { + function checkProps(result) { + expect(result == "Top-right").assertTrue(); + } + modifyPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0100", + "buffer", + "Orientation", + "2", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0200 + * @tc.name : modifyImageProperty(GPSLatitude)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0200", 0, async function (done) { + function checkProps(result) { + expect(result.search("38") != -1).assertTrue(); + } + modifyPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0200", + "buffer", + "GPSLatitude", + "114,3", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0300 + * @tc.name : modifyImageProperty(GPSLongitude)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0300", 0, async function (done) { + function checkProps(result) { + expect(result.search("9") != -1).assertTrue(); + } + modifyPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0300", + "buffer", + "GPSLongitude", + "18,2", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0400 + * @tc.name : modifyImageProperty(GPSLatitudeRef)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0400", 0, async function (done) { + function checkProps(result) { + expect(result == "N").assertTrue(); + } + modifyPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0400", + "buffer", + "GPSLatitudeRef", + "N", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0500 + * @tc.name : modifyImageProperty(GPSLongitudeRef)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0500", 0, async function (done) { + function checkProps(result) { + expect(result == "W").assertTrue(); + } + modifyPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0500", + "buffer", + "GPSLongitudeRef", + "W", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0600 + * @tc.name : modifyImageProperty(Orientation)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0600", 0, async function (done) { + function checkProps(result) { + expect(result == "Top-right").assertTrue(); + } + modifyPromise(done, "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0600", "fd", "Orientation", "2", checkProps); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0700 + * @tc.name : modifyImageProperty(GPSLatitude)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0700", 0, async function (done) { + function checkProps(result) { + expect(result.search("38") != -1).assertTrue(); + } + modifyPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0700", + "fd", + "GPSLatitude", + "114,3", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0800 + * @tc.name : modifyImageProperty(GPSLongitude)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0800", 0, async function (done) { + function checkProps(result) { + expect(result.search("9") != -1).assertTrue(); + } + modifyPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0800", + "fd", + "GPSLongitude", + "18,2", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0900 + * @tc.name : modifyImageProperty(GPSLatitudeRef)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0900", 0, async function (done) { + function checkProps(result) { + expect(result == "N").assertTrue(); + } + modifyPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_0900", + "fd", + "GPSLatitudeRef", + "N", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_1000 + * @tc.name : modifyImageProperty(GPSLongitudeRef)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_1000", 0, async function (done) { + function checkProps(result) { + expect(result == "W").assertTrue(); + } + modifyPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_1000", + "fd", + "GPSLongitudeRef", + "W", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0100 + * @tc.name : modifyImageProperty(Orientation)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0100", 0, async function (done) { + function checkProps(result) { + expect(result == "Top-right").assertTrue(); + } + modifyCb(done, "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0100", "buffer", "Orientation", "2", checkProps); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0200 + * @tc.name : modifyImageProperty(GPSLatitude)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0200", 0, async function (done) { + function checkProps(result) { + expect(result.search("38") != -1).assertTrue(); + } + modifyCb( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0200", + "buffer", + "GPSLatitude", + "114,3", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0300 + * @tc.name : modifyImageProperty(GPSLongitude)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0300", 0, async function (done) { + function checkProps(result) { + expect(result.search("9") != -1).assertTrue(); + } + modifyCb( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0300", + "buffer", + "GPSLongitude", + "18,2", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0400 + * @tc.name : modifyImageProperty(GPSLatitudeRef)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0400", 0, async function (done) { + function checkProps(result) { + expect(result == "N").assertTrue(); + } + modifyCb( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0400", + "buffer", + "GPSLatitudeRef", + "N", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0500 + * @tc.name : modifyImageProperty(GPSLongitudeRef)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0500", 0, async function (done) { + function checkProps(result) { + expect(result == "W").assertTrue(); + } + modifyCb( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0500", + "buffer", + "GPSLongitudeRef", + "W", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0600 + * @tc.name : modifyImageProperty(Orientation)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0600", 0, async function (done) { + function checkProps(result) { + expect(result == "Top-right").assertTrue(); + } + modifyCb(done, "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0600", "fd", "Orientation", "2", checkProps); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0700 + * @tc.name : modifyImageProperty(GPSLatitude)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0700", 0, async function (done) { + function checkProps(result) { + expect(result.search("38") != -1).assertTrue(); + } + modifyCb(done, "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0700", "fd", "GPSLatitude", "114,3", checkProps); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0800 + * @tc.name : modifyImageProperty(GPSLongitude)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0800", 0, async function (done) { + function checkProps(result) { + expect(result.search("9") != -1).assertTrue(); + } + modifyCb(done, "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0800", "fd", "GPSLongitude", "18,2", checkProps); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0900 + * @tc.name : modifyImageProperty(GPSLatitudeRef)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0900", 0, async function (done) { + function checkProps(result) { + expect(result == "N").assertTrue(); + } + modifyCb(done, "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_0900", "fd", "GPSLatitudeRef", "N", checkProps); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_1000 + * @tc.name : modifyImageProperty(GPSLongitudeRef)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_1000", 0, async function (done) { + function checkProps(result) { + expect(result == "W").assertTrue(); + } + modifyCb(done, "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_1000", "fd", "GPSLongitudeRef", "W", checkProps); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0100 + * @tc.name : modifyImageProperty(Orientation,property)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value,options) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0100", 0, async function (done) { + function checkProps(result) { + expect(result == "Top-right").assertTrue(); + } + modifyCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0100", + "buffer", + "Orientation", + "2", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0200 + * @tc.name : modifyImageProperty(GPSLatitude,property)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value,options) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0200", 0, async function (done) { + function checkProps(result) { + expect(result.search("38") != -1).assertTrue(); + } + modifyCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0200", + "buffer", + "GPSLatitude", + "114,3", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0300 + * @tc.name : modifyImageProperty(GPSLongitude,property)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value,options) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0300", 0, async function (done) { + function checkProps(result) { + expect(result.search("9") != -1).assertTrue(); + } + modifyCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0300", + "buffer", + "GPSLongitude", + "18,2", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0400 + * @tc.name : modifyImageProperty(GPSLatitudeRef,property)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value,options) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0400", 0, async function (done) { + function checkProps(result) { + expect(result == "N").assertTrue(); + } + modifyCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0400", + "buffer", + "GPSLatitudeRef", + "N", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0500 + * @tc.name : modifyImageProperty(GPSLongitudeRef,property)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value,options) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0500", 0, async function (done) { + function checkProps(result) { + expect(result == "W").assertTrue(); + } + modifyCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0500", + "buffer", + "GPSLongitudeRef", + "W", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0600 + * @tc.name : modifyImageProperty(Orientation,property)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value,options) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0600", 0, async function (done) { + function checkProps(result) { + expect(result == "Top-right").assertTrue(); + } + modifyCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0600", + "fd", + "Orientation", + "2", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0700 + * @tc.name : modifyImageProperty(GPSLatitude,property)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value,options) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0700", 0, async function (done) { + function checkProps(result) { + expect(result.search("38") != -1).assertTrue(); + } + modifyCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0700", + "fd", + "GPSLatitude", + "114,3", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0800 + * @tc.name : modifyImageProperty(GPSLongitude,property)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value,options) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0800", 0, async function (done) { + function checkProps(result) { + expect(result.search("9") != -1).assertTrue(); + } + modifyCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0800", + "fd", + "GPSLongitude", + "18,2", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0900 + * @tc.name : modifyImageProperty(GPSLatitudeRef,property)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value,options) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0900", 0, async function (done) { + function checkProps(result) { + expect(result == "N").assertTrue(); + } + modifyCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_0900", + "fd", + "GPSLatitudeRef", + "N", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_1000 + * @tc.name : modifyImageProperty(GPSLongitudeRef,property)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value,options) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_1000", 0, async function (done) { + function checkProps(result) { + expect(result == "W").assertTrue(); + } + modifyCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_1000", + "fd", + "GPSLongitudeRef", + "W", + checkProps + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0100 + * @tc.name : modifyImageProperty(Orientation)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0100", 0, async function (done) { + modifyImageErrPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0100", + "fd", + "Orientation", + "abcdef" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0200 + * @tc.name : modifyImageProperty(GPSLatitude)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0200", 0, async function (done) { + modifyImageErrPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0200", + "fd", + "GPSLatitude", + "abc,3" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0300 + * @tc.name : modifyImageProperty(GPSLongitude)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0300", 0, async function (done) { + modifyImageErrPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0200", + "fd", + "GPSLongitude", + "abc,2" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0400 + * @tc.name : modifyImageProperty(GPSLatitudeRef)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0400", 0, async function (done) { + modifyImageErrPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0400", + "fd", + "GPSLatitudeRef", + "456" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0500 + * @tc.name : modifyImageProperty(GPSLongitudeRef)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0500", 0, async function (done) { + modifyImageErrPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0500", + "fd", + "GPSLongitudeRef", + "1234" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0600 + * @tc.name : modifyImageProperty(Orientation)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0600", 0, async function (done) { + modifyImageErrPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0600", + "buffer", + "Orientation", + "abcdef" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0700 + * @tc.name : modifyImageProperty(GPSLatitude)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0700", 0, async function (done) { + modifyImageErrPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0700", + "buffer", + "GPSLatitude", + "abc,3" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0800 + * @tc.name : modifyImageProperty(GPSLongitude)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0800", 0, async function (done) { + modifyImageErrPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0800", + "buffer", + "GPSLongitude", + "abc,2" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0900 + * @tc.name : modifyImageProperty(GPSLatitudeRef)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0900", 0, async function (done) { + modifyImageErrPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_0900", + "buffer", + "GPSLatitudeRef", + "456" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_1000 + * @tc.name : modifyImageProperty(GPSLongitudeRef)-promise + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_1000", 0, async function (done) { + modifyImageErrPromise( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROMISE_ERROR_1000", + "buffer", + "GPSLongitudeRef", + "1234" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0100 + * @tc.name : modifyImageProperty(Orientation)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0100", 0, async function (done) { + modifyErrCb(done, "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0100", "fd", "Orientation", "abcdef"); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0200 + * @tc.name : modifyImageProperty(GPSLatitude)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0200", 0, async function (done) { + modifyErrCb(done, "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0200", "fd", "GPSLatitude", "abc,3"); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0300 + * @tc.name : modifyImageProperty(GPSLongitude)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0300", 0, async function (done) { + modifyErrCb(done, "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0300", "fd", "GPSLongitude", "abc,2"); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0400 + * @tc.name : modifyImageProperty(GPSLongitudeRef)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0400", 0, async function (done) { + modifyErrCb(done, "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0400", "fd", "GPSLongitudeRef", "1234"); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0500 + * @tc.name : modifyImageProperty(GPSLatitudeRef)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0500", 0, async function (done) { + modifyErrCb(done, "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0500", "fd", "GPSLatitudeRef", "456"); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0600 + * @tc.name : modifyImageProperty(Orientation)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0600", 0, async function (done) { + modifyErrCb( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0600", + "buffer", + "Orientation", + "abcdef" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0700 + * @tc.name : modifyImageProperty(GPSLatitude)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0700", 0, async function (done) { + modifyErrCb(done, "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0700", "buffer", "GPSLatitude", "abc,3"); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0800 + * @tc.name : modifyImageProperty(GPSLongitude)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0800", 0, async function (done) { + modifyErrCb( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0800", + "buffer", + "GPSLongitude", + "abc,2" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0900 + * @tc.name : modifyImageProperty(GPSLongitudeRef)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0900", 0, async function (done) { + modifyErrCb( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_0900", + "buffer", + "GPSLongitudeRef", + "1234" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_1000 + * @tc.name : modifyImageProperty(GPSLatitudeRef)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_1000", 0, async function (done) { + modifyErrCb( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_CALLBACK_ERROR_1000", + "buffer", + "GPSLatitudeRef", + "456" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0100 + * @tc.name : modifyImageProperty(Orientation)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0100", 0, async function (done) { + modifyErrCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0100", + "fd", + "Orientation", + "abcdef" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0200 + * @tc.name : modifyImageProperty(GPSLatitude)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0200", 0, async function (done) { + modifyErrCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0200", + "fd", + "GPSLatitude", + "abc,3" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0300 + * @tc.name : modifyImageProperty(GPSLongitude)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0300", 0, async function (done) { + modifyErrCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0300", + "fd", + "GPSLongitude", + "abc,2" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0400 + * @tc.name : modifyImageProperty(GPSLatitudeRef)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0400", 0, async function (done) { + modifyErrCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0400", + "fd", + "GPSLatitudeRef", + "1234" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0500 + * @tc.name : modifyImageProperty(GPSLongitudeRef)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0500", 0, async function (done) { + modifyErrCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0500", + "fd", + "GPSLongitudeRef", + "567" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0600 + * @tc.name : modifyImageProperty(Orientation)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0600", 0, async function (done) { + modifyErrCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0600", + "buffer", + "Orientation", + "abcef" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0700 + * @tc.name : modifyImageProperty(GPSLatitude)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0700", 0, async function (done) { + modifyErrCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0700", + "buffer", + "GPSLatitude", + "abc,3" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0800 + * @tc.name : modifyImageProperty(GPSLongitude)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0800", 0, async function (done) { + modifyErrCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0800", + "buffer", + "GPSLongitude", + "abc,2" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0900 + * @tc.name : modifyImageProperty(GPSLatitudeRef)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0900", 0, async function (done) { + modifyErrCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_0900", + "buffer", + "GPSLatitudeRef", + "456" + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_1000 + * @tc.name : modifyImageProperty(GPSLongitudeRef)-callback + * @tc.desc : 1.create imagesource + * 2.call modifyImageProperty(key,value) + * 3.return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_1000", 0, async function (done) { + modifyErrCb1( + done, + "SUB_GRAPHIC_IMAGE_MODIFYPROPERTY_PROPERTY_CALLBACK_ERROR_1000", + "buffer", + "GPSLongitudeRef", + "1234" + ); + }); + }); +} diff --git a/multimedia/image/image_js_standard/imagePacking/BUILD.gn b/multimedia/image/image_js_standard/imagePacking/BUILD.gn index adf51961b4cf74302c4fe3b8ef513dc9d63b1f53..2a11628dae27556e03dac60fc7da719ae717eee9 100644 --- a/multimedia/image/image_js_standard/imagePacking/BUILD.gn +++ b/multimedia/image/image_js_standard/imagePacking/BUILD.gn @@ -22,7 +22,7 @@ ohos_js_hap_suite("image_packing_js_hap") { certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsImagePackingJsTest" subsystem_name = "multimedia" - part_name = "multimedia_image_standard" + part_name = "multimedia_image_framework" } ohos_js_assets("image_packing_js_assets") { js2abc = true diff --git a/multimedia/image/image_js_standard/imagePacking/src/main/config.json b/multimedia/image/image_js_standard/imagePacking/src/main/config.json index ba8abff04a415d92538e234f69ad0ad1a6142eac..ae2af959c5c509e9be3858a54571045ba19a50eb 100644 --- a/multimedia/image/image_js_standard/imagePacking/src/main/config.json +++ b/multimedia/image/image_js_standard/imagePacking/src/main/config.json @@ -57,6 +57,7 @@ } ], "deviceType": [ + "default", "phone", "tablet", "tv", diff --git a/multimedia/image/image_js_standard/imagePacking/src/main/js/test/packing.test.js b/multimedia/image/image_js_standard/imagePacking/src/main/js/test/packing.test.js index 40774e44c3e4fe89973514ed8bf8d00998402b73..f2562bd2c48fd41d8d72b4a10eab4dc49c427459 100644 --- a/multimedia/image/image_js_standard/imagePacking/src/main/js/test/packing.test.js +++ b/multimedia/image/image_js_standard/imagePacking/src/main/js/test/packing.test.js @@ -217,7 +217,7 @@ export default function imagePacking() { } /** - * @tc.number : SUB_IMAGE_packing_P_001 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0100 * @tc.name : SUB_IMAGE_packing_P_001 * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -226,13 +226,13 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packing_P_001', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0100', 0, async function (done) { let packOpts = { format: "image/jpeg", quality: 99 } - packingPromise(done, 'SUB_IMAGE_packing_P_001', 2, packOpts) + packingPromise(done, 'SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0100', 2, packOpts) }) /** - * @tc.number : SUB_IMAGE_packing_P_002 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0200 * @tc.name : SUB_IMAGE_packing_P_002 - Promise - RGB565 quality 123 * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -241,13 +241,13 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packing_P_002', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0200', 0, async function (done) { let packOpts = { format: "image/jpeg", quality: 123 } - packingPromiseFail(done, 'SUB_IMAGE_packing_P_002', 2, packOpts) + packingPromiseFail(done, 'SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0200', 2, packOpts) }) /** - * @tc.number : SUB_IMAGE_packing_P_003 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0300 * @tc.name : SUB_IMAGE_packing_P_003 - Promise - RGB565 quality null * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -256,13 +256,13 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packing_P_003', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0300', 0, async function (done) { let packOpts = { format: "image/jpeg" } - packingPromiseFail(done, 'SUB_IMAGE_packing_P_003', 2, packOpts) + packingPromiseFail(done, 'SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0300', 2, packOpts) }) /** - * @tc.number : SUB_IMAGE_packing_P_004 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0400 * @tc.name : SUB_IMAGE_packing_P_004 - Promise - RGB565 format null * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -271,13 +271,13 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packing_P_004', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0400', 0, async function (done) { let packOpts = { quality: 99 } - packingPromiseFail(done, 'SUB_IMAGE_packing_P_004', 2, packOpts) + packingPromiseFail(done, 'SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0400', 2, packOpts) }) /** - * @tc.number : SUB_IMAGE_packing_P_005 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0500 * @tc.name : SUB_IMAGE_packing_P_005 - Promise - RGB565 wrong format * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -286,13 +286,13 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packing_P_005', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0500', 0, async function (done) { let packOpts = { format: "image/png", quality: 99 } - packingPromiseFail(done, 'SUB_IMAGE_packing_P_005', 2, packOpts) + packingPromiseFail(done, 'SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0500', 2, packOpts) }) /** - * @tc.number : SUB_IMAGE_packing_P_006 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0600 * @tc.name : SUB_IMAGE_packing_P_006 * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -301,13 +301,13 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packing_P_006', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0600', 0, async function (done) { let packOpts = { format: "image/jpeg", quality: 50 } - packingPromise(done, 'SUB_IMAGE_packing_P_006', 5, packOpts) + packingPromise(done, 'SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0600', 5, packOpts) }) /** - * @tc.number : SUB_IMAGE_packing_P_007 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0700 * @tc.name : SUB_IMAGE_packing_P_007 - Promise - RGB888 quality 123 * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -316,13 +316,13 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packing_P_007', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0700', 0, async function (done) { let packOpts = { format: "image/jpeg", quality: 123 } - packingPromiseFail(done, 'SUB_IMAGE_packing_P_007', 5, packOpts) + packingPromiseFail(done, 'SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0700', 5, packOpts) }) /** - * @tc.number : SUB_IMAGE_packing_P_008 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0800 * @tc.name : SUB_IMAGE_packing_P_008 - Promise - RGB888 quality null * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -331,13 +331,13 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packing_P_008', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0800', 0, async function (done) { let packOpts = { format: "image/jpeg" } - packingPromiseFail(done, 'SUB_IMAGE_packing_P_008', 5, packOpts) + packingPromiseFail(done, 'SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0800', 5, packOpts) }) /** - * @tc.number : SUB_IMAGE_packing_P_009 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0900 * @tc.name : SUB_IMAGE_packing_P_009 - Promise - RGB888 format null * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -346,13 +346,13 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packing_P_009', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0900', 0, async function (done) { let packOpts = { quality: 99 } - packingPromiseFail(done, 'SUB_IMAGE_packing_P_009', 5, packOpts) + packingPromiseFail(done, 'SUB_GRAPHIC_IMAGE_PACKING_PROMISE_0900', 5, packOpts) }) /** - * @tc.number : SUB_IMAGE_packing_P_010 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_PROMISE_1000 * @tc.name : SUB_IMAGE_packing_P_010 - Promise - RGB888 wrong format * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -361,13 +361,13 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packing_P_010', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_PROMISE_1000', 0, async function (done) { let packOpts = { format: "image/png", quality: 99 } - packingPromiseFail(done, 'SUB_IMAGE_packing_P_010', 5, packOpts) + packingPromiseFail(done, 'SUB_GRAPHIC_IMAGE_PACKING_PROMISE_1000', 5, packOpts) }) /** - * @tc.number : SUB_IMAGE_packingCb_001 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0100 * @tc.name : SUB_IMAGE_packingCb_001 * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -376,13 +376,13 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packingCb_001', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0100', 0, async function (done) { let packOpts = { format: "image/jpeg", quality: 99 } - packingCb(done, 'SUB_IMAGE_packingCb_001', 2, packOpts) + packingCb(done, 'SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0100', 2, packOpts) }) /** - * @tc.number : SUB_IMAGE_packingCb_002 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0200 * @tc.name : SUB_IMAGE_packingCb_002 - callback - RGB565 quality 123 * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -391,14 +391,14 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packingCb_002', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0200', 0, async function (done) { let packOpts = { format: "image/jpeg", quality: 123 } - packingCbFail(done, 'SUB_IMAGE_packingCb_002', 2, packOpts) + packingCbFail(done, 'SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0200', 2, packOpts) }) /** - * @tc.number : SUB_IMAGE_packingCb_003 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0300 * @tc.name : SUB_IMAGE_packingCb_003 - callback - RGB565 quality null * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -407,13 +407,13 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packingCb_003', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0300', 0, async function (done) { let packOpts = { format: "image/jpeg" } - packingCbFail(done, 'SUB_IMAGE_packingCb_003', 2, packOpts) + packingCbFail(done, 'SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0300', 2, packOpts) }) /** - * @tc.number : SUB_IMAGE_packingCb_004 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0400 * @tc.name : SUB_IMAGE_packingCb_004 - callback - RGB565 format null * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -422,13 +422,13 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packingCb_004', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0400', 0, async function (done) { let packOpts = { quality: 99 } - packingCbFail(done, 'SUB_IMAGE_packingCb_004', 2, packOpts) + packingCbFail(done, 'SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0400', 2, packOpts) }) /** - * @tc.number : SUB_IMAGE_packingCb_005 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0500 * @tc.name : SUB_IMAGE_packingCb_005 - callback - RGB565 wrong format * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -437,13 +437,13 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packingCb_005', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0500', 0, async function (done) { let packOpts = { format: "image/png", quality: 99 } - packingCbFail(done, 'SUB_IMAGE_packingCb_005', 2, packOpts) + packingCbFail(done, 'SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0500', 2, packOpts) }) /** - * @tc.number : SUB_IMAGE_packingCb_006 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0600 * @tc.name : SUB_IMAGE_packingCb_006 * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -452,13 +452,13 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packingCb_006', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0600', 0, async function (done) { let packOpts = { format: "image/jpeg", quality: 50 } - packingCb(done, 'SUB_IMAGE_packingCb_006', 5, packOpts) + packingCb(done, 'SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0600', 5, packOpts) }) /** - * @tc.number : SUB_IMAGE_packingCb_007 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0700 * @tc.name : SUB_IMAGE_packingCb_007 - callback - RGB888 quality 123 * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -467,14 +467,14 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packingCb_007', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0700', 0, async function (done) { let packOpts = { format: "image/jpeg", quality: 123 } - packingCbFail(done, 'SUB_IMAGE_packingCb_007', 5, packOpts) + packingCbFail(done, 'SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0700', 5, packOpts) }) /** - * @tc.number : SUB_IMAGE_packingCb_008 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0800 * @tc.name : SUB_IMAGE_packingCb_008 - callback - RGB888 quality null * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -483,13 +483,13 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packingCb_008', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0800', 0, async function (done) { let packOpts = { format: "image/jpeg" } - packingCbFail(done, 'SUB_IMAGE_packingCb_008', 5, packOpts) + packingCbFail(done, 'SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0800', 5, packOpts) }) /** - * @tc.number : SUB_IMAGE_packingCb_009 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0900 * @tc.name : SUB_IMAGE_packingCb_009 - callback - RGB888 format null * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -498,13 +498,13 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packingCb_009', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0900', 0, async function (done) { let packOpts = { quality: 99 } - packingCbFail(done, 'SUB_IMAGE_packingCb_009', 5, packOpts) + packingCbFail(done, 'SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_0900', 5, packOpts) }) /** - * @tc.number : SUB_IMAGE_packingCb_010 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_1000 * @tc.name : SUB_IMAGE_packingCb_010 - callback - RGB888 wrong format * @tc.desc : 1.create PixelMap * 2.create ImagePacker @@ -513,13 +513,13 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_packingCb_010', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_1000', 0, async function (done) { let packOpts = { format: "image/png", quality: 99 } - packingCbFail(done, 'SUB_IMAGE_packingCb_010', 5, packOpts) + packingCbFail(done, 'SUB_GRAPHIC_IMAGE_PACKING_CALLBACK_1000', 5, packOpts) }) /** - * @tc.number : TC_062 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0100 * @tc.name : packing ImageSource - promise * @tc.desc : 1.create ImageSource * 2.call packing @@ -529,36 +529,36 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_062', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0100', 0, async function (done) { try { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_062 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0100 create image source failed'); expect(false).assertTrue(); done(); } else { const imagePackerApi = image.createImagePacker(); if (imagePackerApi == undefined) { - console.info('TC_062 create image packer failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0100 create image packer failed'); expect(false).assertTrue(); done(); } else { let packOpts = { format: "image/jpeg", quality: 99 } imagePackerApi.packing(imageSourceApi, packOpts) .then(data => { - console.info('TC_062 success'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0100 success'); expect(data != undefined).assertTrue(); done(); }).catch(error => { - console.log('TC_062 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0100 error: ' + error); expect(false).assertFail(); done(); }) } } } catch (error) { - console.info('TC_062 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0100 error: ' + error); expect(false).assertTrue(); done(); } @@ -566,7 +566,7 @@ export default function imagePacking() { }) /** - * @tc.number : TC_062-1 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0100 * @tc.name : packing ImageSource - callback * @tc.desc : 1.create ImageSource * 2.call packing @@ -576,38 +576,38 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_062-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0100', 0, async function (done) { try { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_062-1 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0100 create image source failed'); expect(false).assertTrue(); done(); } else { const imagePackerApi = image.createImagePacker(); if (imagePackerApi == undefined) { - console.info('TC_062-1 create image packer failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0100 create image packer failed'); expect(false).assertTrue(); done(); } else { let packOpts = { format: "image/jpeg", quality: 1 } imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { - console.info('TC_062-1 success' + JSON.stringify(data)); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0100 success' + JSON.stringify(data)); expect(data != undefined).assertTrue(); done(); }) } } } catch (error) { - console.info('TC_062-1 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_062-2 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0200 * @tc.name : packing ImageSource - callback - wrong format * @tc.desc : 1.create ImageSource * 2.call packing @@ -617,24 +617,24 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_062-2', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0200', 0, async function (done) { try { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_062-2 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0200 create image source failed'); expect(false).assertTrue(); done(); } else { const imagePackerApi = image.createImagePacker(); if (imagePackerApi == undefined) { - console.info('TC_062-2 create image packer failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0200 create image packer failed'); expect(false).assertTrue(); done(); } else { let packOpts = { format: "image/gif", quality: 98 } imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { - console.info('TC_062-2 success'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0200 success'); expect(data == undefined).assertTrue(); console.info(data); done(); @@ -642,14 +642,14 @@ export default function imagePacking() { } } } catch (error) { - console.info('TC_062-2 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0200 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_062-3 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0300 * @tc.name : packing ImageSource - callback - wrong quality * @tc.desc : 1.create ImageSource * 2.call packing @@ -659,24 +659,24 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_062-3', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0300', 0, async function (done) { try { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_062-3 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0300 create image source failed'); expect(false).assertTrue(); done(); } else { const imagePackerApi = image.createImagePacker(); if (imagePackerApi == undefined) { - console.info('TC_062-3 create image packer failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0300 create image packer failed'); expect(false).assertTrue(); done(); } else { let packOpts = { format: "image/jpeg", quality: 101 } imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { - console.info('TC_062-3 success'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0300 success'); expect(data == undefined).assertTrue(); console.info(data); done(); @@ -684,14 +684,14 @@ export default function imagePacking() { } } } catch (error) { - console.info('TC_062-3 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0300 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_062-4 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_CREATEIMAGEPACKER_0100 * @tc.name : createImagePacker * @tc.desc : 1.create ImageSource * 2.call packing @@ -701,35 +701,35 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_062-4', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_CREATEIMAGEPACKER_0100', 0, async function (done) { try { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_062-4 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_CREATEIMAGEPACKER_0100 create image source failed'); expect(false).assertTrue(); done(); } else { const imagePackerApi = image.createImagePacker(); if (imagePackerApi == undefined) { - console.info('TC_062-4 create image packer failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_CREATEIMAGEPACKER_0100 create image packer failed'); expect(false).assertTrue(); done(); } else { - console.info('TC_062-4 create image packer success'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_CREATEIMAGEPACKER_0100 create image packer success'); expect(true).assertTrue(); done(); } } } catch (error) { - console.info('TC_062-4 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_PACKING_CREATEIMAGEPACKER_0100 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_062-5 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0200 * @tc.name : packing ImageSource - promise - no quality * @tc.desc : 1.create ImageSource * 2.call packing @@ -740,44 +740,44 @@ export default function imagePacking() { * @tc.level : Level 1 */ - it('TC_062-5', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0200', 0, async function (done) { try { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_062-5 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0200 create image source failed'); expect(false).assertTrue(); done(); } else { const imagePackerApi = image.createImagePacker(); if (imagePackerApi == undefined) { - console.info('TC_062-5 create image packer failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0200 create image packer failed'); expect(false).assertTrue(); done(); } else { let packOpts = { format: "image/jpeg" } imagePackerApi.packing(imageSourceApi, packOpts) .then(data => { - console.info('TC_062-5 failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0200 failed'); expect(data == undefined).assertTrue(); done(); }).catch(error => { - console.log('TC_062-5 error: ' + error); - console.log('TC_062-5 success'); + console.log('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0200 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0200 success'); expect(true).assertTrue(); done(); }) } } } catch (error) { - console.info('TC_062-5 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0200 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_062-6 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0300 * @tc.name : packing ImageSource - promise - no format * @tc.desc : 1.create ImageSource * 2.call packing @@ -787,44 +787,44 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_062-6', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0300', 0, async function (done) { try { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_062-6 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0300 create image source failed'); expect(false).assertTrue(); done(); } else { const imagePackerApi = image.createImagePacker(); if (imagePackerApi == undefined) { - console.info('TC_062-6 create image packer failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0300 create image packer failed'); expect(false).assertTrue(); done(); } else { let packOpts = { quality: 50 } imagePackerApi.packing(imageSourceApi, packOpts) .then(data => { - console.info('TC_062-6 failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0300 failed'); expect(data == undefined).assertTrue(); done(); }).catch(error => { - console.log('TC_062-6 error: ' + error); - console.log('TC_062-6 success'); + console.log('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0300 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0300 success'); expect(true).assertTrue(); done(); }) } } } catch (error) { - console.info('TC_062-6 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_PROMISE_0300 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_062-7 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0400 * @tc.name : packing ImageSource - callback - quality 100 * @tc.desc : 1.create ImageSource * 2.call packing @@ -835,18 +835,18 @@ export default function imagePacking() { * @tc.level : Level 1 */ - it('TC_062-7', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0400', 0, async function (done) { try { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_062-7 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0400 create image source failed'); expect(false).assertTrue(); done(); } else { const imagePackerApi = image.createImagePacker(); if (imagePackerApi == undefined) { - console.info('TC_062-7 create image packer failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0400 create image packer failed'); expect(false).assertTrue(); done(); } else { @@ -854,31 +854,31 @@ export default function imagePacking() { imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { if (err) { expect(false).assertTrue(); - console.info('TC_062-7 error: ' + err); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0400 error: ' + err); done(); return } if (data != undefined) { - console.info('TC_062-7 success'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0400 success'); expect(true).assertTrue(); done(); } else { except(false).assertTrue(); - console.info('TC_062-7 failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0400 failed'); done(); } }) } } } catch (error) { - console.info('TC_062-7 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0400 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_062-8 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0500 * @tc.name : packing ImageSource - callback - quality 0 * @tc.desc : 1.create ImageSource * 2.call packing @@ -888,38 +888,38 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_062-8', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0500', 0, async function (done) { try { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_062-8 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0500 create image source failed'); expect(false).assertTrue(); done(); } else { const imagePackerApi = image.createImagePacker(); if (imagePackerApi == undefined) { - console.info('TC_062-8 create image packer failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0500 create image packer failed'); expect(false).assertTrue(); done(); } else { let packOpts = { format: "image/jpeg", quality: 0 } imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { - console.info('TC_062-8 success'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0500 success'); expect(data != undefined).assertTrue(); done(); }) } } } catch (error) { - console.info('TC_062-8 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0500 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_062-9 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0600 * @tc.name : packing ImageSource - callback - quality -1 * @tc.desc : 1.create ImageSource * 2.call packing @@ -929,38 +929,38 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_062-9', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0600', 0, async function (done) { try { await getFd('test.png'); const imageSourceApi = image.createImageSource(fdNumber); if (imageSourceApi == undefined) { - console.info('TC_062-9 create image source failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0600 create image source failed'); expect(false).assertTrue(); done(); } else { const imagePackerApi = image.createImagePacker(); if (imagePackerApi == undefined) { - console.info('TC_062-9 create image packer failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0600 create image packer failed'); expect(false).assertTrue(); done(); } else { let packOpts = { format: "image/jpeg", quality: -1 } imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { - console.info('TC_062-9 success'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0600 success'); expect(data == undefined).assertTrue(); done(); }) } } } catch (error) { - console.info('TC_062-9 error: ' + error); + console.info('SUB_GRAPHIC_IMAGE_PACKING_IMAGESOURCE_CALLBACK_0600 error: ' + error); expect(false).assertTrue(); done(); } }) /** - * @tc.number : TC_063 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_RELEASE_IMAGEPACKER_PROMISE_0100 * @tc.name : release ImagePacker - promise * @tc.desc : 1.create ImagePacker * 2.call release @@ -969,19 +969,19 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_063', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_RELEASE_IMAGEPACKER_PROMISE_0100', 0, async function (done) { const imagePackerApi = image.createImagePacker(); if (imagePackerApi == undefined) { - console.info('TC_063 create image packer failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_RELEASE_IMAGEPACKER_PROMISE_0100 create image packer failed'); expect(false).assertTrue(); done(); } else { imagePackerApi.release().then(() => { - console.info('TC_063 success'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_RELEASE_IMAGEPACKER_PROMISE_0100 success'); expect(true).assertTrue(); done(); }).catch(() => { - console.log('TC_063 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_PACKING_RELEASE_IMAGEPACKER_PROMISE_0100 error: ' + error); expect(false).assertTrue(); done(); }) @@ -989,7 +989,7 @@ export default function imagePacking() { }) /** - * @tc.number : TC_063-1 + * @tc.number : SUB_GRAPHIC_IMAGE_PACKING_RELEASE_IMAGEPACKER_CALLBACK_0100 * @tc.name : release ImagePacker - callback * @tc.desc : 1.create ImagePacker * 2.call release @@ -998,15 +998,15 @@ export default function imagePacking() { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_063-1', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PACKING_RELEASE_IMAGEPACKER_CALLBACK_0100', 0, async function (done) { const imagePackerApi = image.createImagePacker(); if (imagePackerApi == undefined) { - console.info('TC_063-1 create image packer failed'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_RELEASE_IMAGEPACKER_CALLBACK_0100 create image packer failed'); expect(false).assertTrue(); done(); } else { imagePackerApi.release(() => { - console.info('TC_063-1 success'); + console.info('SUB_GRAPHIC_IMAGE_PACKING_RELEASE_IMAGEPACKER_CALLBACK_0100 success'); expect(true).assertTrue(); done(); }) diff --git a/multimedia/image/image_js_standard/imagePixelMapFramework/BUILD.gn b/multimedia/image/image_js_standard/imagePixelMapFramework/BUILD.gn index 2ad4ab24f367b340e88bfc9ea769ef0abc236867..34e34927aa196b47d2e1ddb63a6ee53e8f5a6bdc 100644 --- a/multimedia/image/image_js_standard/imagePixelMapFramework/BUILD.gn +++ b/multimedia/image/image_js_standard/imagePixelMapFramework/BUILD.gn @@ -22,7 +22,7 @@ ohos_js_hap_suite("image_pixelmapframework_js_hap") { certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsImagePixelMapFrameworkJsTest" subsystem_name = "multimedia" - part_name = "multimedia_image_standard" + part_name = "multimedia_image_framework" } ohos_js_assets("image_pixelmapframework_js_assets") { js2abc = true diff --git a/multimedia/image/image_js_standard/imagePixelMapFramework/src/main/config.json b/multimedia/image/image_js_standard/imagePixelMapFramework/src/main/config.json index d2432a2001444462b29d61799ac5bee1bd406a22..d833b8a7b534f6912a74554382e3ebec7324e0bc 100644 --- a/multimedia/image/image_js_standard/imagePixelMapFramework/src/main/config.json +++ b/multimedia/image/image_js_standard/imagePixelMapFramework/src/main/config.json @@ -57,6 +57,7 @@ } ], "deviceType": [ + "default", "phone", "tablet", "tv", diff --git a/multimedia/image/image_js_standard/imagePixelMapFramework/src/main/js/test/framework.test.js b/multimedia/image/image_js_standard/imagePixelMapFramework/src/main/js/test/framework.test.js index 4386657df6884e4624dfb5698a30ce7b70c4c27b..90d6da6111d4789abad51c6fcb355f3cc9c0f223 100755 --- a/multimedia/image/image_js_standard/imagePixelMapFramework/src/main/js/test/framework.test.js +++ b/multimedia/image/image_js_standard/imagePixelMapFramework/src/main/js/test/framework.test.js @@ -386,7 +386,7 @@ describe('imagePixelMapFramework', function () { } /** - * @tc.number : frmwk_001 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_BASE64_0100 * @tc.name : BASE64 Image * @tc.desc : 1.create imagesource with base64Image * : 2.create pixelmap @@ -394,8 +394,8 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_001', 0, async function (done) { - let logger = loger('frmwk_001') + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_BASE64_0100', 0, async function (done) { + let logger = loger('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_BASE64_0100') try { const imageSource = image.createImageSource(base64Image) logger.log("ImageSource " + (imageSource != undefined)); @@ -413,7 +413,7 @@ describe('imagePixelMapFramework', function () { }) /** - * @tc.number : frmwk_002 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_PROMISE_0100 * @tc.name : Pixelmap Scale-promise * @tc.desc : 1.create pixelmap * : 2.call scale @@ -423,7 +423,7 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_002', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_PROMISE_0100', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { if (newInfo.size.width != orgInfo.size.width * 2) { logger.log(`org width ${orgInfo.size.width}, new width ${newInfo.size.width} `); @@ -431,11 +431,11 @@ describe('imagePixelMapFramework', function () { done() } } - await pixelMapModifySizeTest(done, 'frmwk_002', 'promise', 'scale', sizeCheck, scale2x1, 2.0, 1.0) + await pixelMapModifySizeTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_PROMISE_0100', 'promise', 'scale', sizeCheck, scale2x1, 2.0, 1.0) }) /** - * @tc.number : frmwk_003 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_PROMISE_0200 * @tc.name : Pixelmap Scale-promise * @tc.desc : 1.create pixelmap * : 2.call scale @@ -445,7 +445,7 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_003', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_PROMISE_0200', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { if (newInfo.size.height != orgInfo.size.height * 4) { logger.log(`org height ${orgInfo.size.height}, new height ${newInfo.size.height} `); @@ -453,11 +453,11 @@ describe('imagePixelMapFramework', function () { done() } } - await pixelMapModifySizeTest(done, 'frmwk_003', 'promise', 'scale', sizeCheck, scale1x4, 1.0, 4.0) + await pixelMapModifySizeTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_PROMISE_0200', 'promise', 'scale', sizeCheck, scale1x4, 1.0, 4.0) }) /** - * @tc.number : frmwk_004 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_CALLBACK_0100 * @tc.name : Pixelmap Scale-callback * @tc.desc : 1.create pixelmap * : 2.call scale @@ -467,7 +467,7 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_004', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_CALLBACK_0100', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { if (newInfo.size.height != orgInfo.size.height * 4) { logger.log(`org height ${orgInfo.size.height}, new height ${newInfo.size.height} `); @@ -475,11 +475,11 @@ describe('imagePixelMapFramework', function () { done() } } - await pixelMapModifySizeTest(done, 'frmwk_004', 'callback', 'scale', sizeCheck, scale1x4, 1.0, 4.0) + await pixelMapModifySizeTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_CALLBACK_0100', 'callback', 'scale', sizeCheck, scale1x4, 1.0, 4.0) }) /** - * @tc.number : frmwk_005 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_PROMISE_0100 * @tc.name : Pixelmap Translate -promise * @tc.desc : 1.create pixelmap * : 2.call translate @@ -489,7 +489,7 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_005', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_PROMISE_0100', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { if (newInfo.size.width != orgInfo.size.width + 3) { logger.log(`org width ${orgInfo.size.width}, new width ${newInfo.size.width} `); @@ -497,11 +497,11 @@ describe('imagePixelMapFramework', function () { done(); } } - await pixelMapModifySizeTest(done, 'frmwk_005', 'promise', 'translate', sizeCheck, translate3x1, 3.0, 1.0) + await pixelMapModifySizeTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_PROMISE_0100', 'promise', 'translate', sizeCheck, translate3x1, 3.0, 1.0) }) /** - * @tc.number : frmwk_006 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_PROMISE_0200 * @tc.name : Pixelmap Translate-promise * @tc.desc : 1.create pixelmap * : 2.call translate @@ -511,7 +511,7 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_006', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_PROMISE_0200', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { if (newInfo.size.height != orgInfo.size.height + 3) { logger.log(`org height ${orgInfo.size.height}, new height ${newInfo.size.height} `); @@ -519,11 +519,11 @@ describe('imagePixelMapFramework', function () { done(); } } - await pixelMapModifySizeTest(done, 'frmwk_006', 'promise', 'translate', sizeCheck, translate1x3, 1.0, 3.0) + await pixelMapModifySizeTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_PROMISE_0200', 'promise', 'translate', sizeCheck, translate1x3, 1.0, 3.0) }) /** - * @tc.number : frmwk_01_007 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_CALLBACK_0100 * @tc.name : Pixelmap Translate-callback * @tc.desc : 1.create pixelmap * : 2.call translate @@ -533,7 +533,7 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_007', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_CALLBACK_0100', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { if (newInfo.size.height != orgInfo.size.height + 3) { logger.log(`org height ${orgInfo.size.height}, new height ${newInfo.size.height} `); @@ -541,11 +541,11 @@ describe('imagePixelMapFramework', function () { done(); } } - await pixelMapModifySizeTest(done, 'frmwk_007', 'callback', 'translate', sizeCheck, translate1x3, 1.0, 3.0) + await pixelMapModifySizeTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_CALLBACK_0100', 'callback', 'translate', sizeCheck, translate1x3, 1.0, 3.0) }) /** - * @tc.number : frmwk_008 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_PROMISE_0100 * @tc.name : Pixelmap Rotate-promise * @tc.desc : 1.create pixelmap * : 2.call rotate @@ -555,7 +555,7 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_008', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_PROMISE_0100', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { if (newInfo.size.width != orgInfo.size.height) { logger.log(`org height ${orgInfo.size.height}, new width ${newInfo.size.width} `); @@ -563,11 +563,11 @@ describe('imagePixelMapFramework', function () { done(); } } - await pixelMapModifySizeTest(done, 'frmwk_008', 'promise', 'rotate', sizeCheck, rotate90, 90.0) + await pixelMapModifySizeTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_PROMISE_0100', 'promise', 'rotate', sizeCheck, rotate90, 90.0) }) /** - * @tc.number : frmwk_009 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_CALLBACK_0100 * @tc.name : Pixelmap Rotate-callback * @tc.desc : 1.create pixelmap * : 2.call rotate @@ -577,7 +577,7 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_009', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_CALLBACK_0100', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { if (newInfo.size.width != orgInfo.size.height) { logger.log(`org height ${orgInfo.size.height}, new width ${newInfo.size.width} `); @@ -585,11 +585,11 @@ describe('imagePixelMapFramework', function () { done(); } } - await pixelMapModifySizeTest(done, 'frmwk_009', 'callback', 'rotate', sizeCheck, rotate90, 90.0) + await pixelMapModifySizeTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_CALLBACK_0100', 'callback', 'rotate', sizeCheck, rotate90, 90.0) }) /** - * @tc.number : frmwk_010 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_PROMISE_0100 * @tc.name : Pixelmap Flip-promise * @tc.desc : 1.create pixelmap * : 2.call flip @@ -599,7 +599,7 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_010', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_PROMISE_0100', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { if (newInfo.size.width != orgInfo.size.width) { logger.log(`org width ${orgInfo.size.width}, new width ${newInfo.size.width} `); @@ -607,11 +607,11 @@ describe('imagePixelMapFramework', function () { done(); } } - await pixelMapModifySizeTest(done, 'frmwk_010', 'promise', 'flip', sizeCheck, flipH, false, true) + await pixelMapModifySizeTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_PROMISE_0100', 'promise', 'flip', sizeCheck, flipH, false, true) }) /** - * @tc.number : frmwk_011 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_CALLBACK_0100 * @tc.name : Pixelmap Flip-callback * @tc.desc : 1.create pixelmap * : 2.call flip @@ -621,7 +621,7 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_011', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_CALLBACK_0100', 0, async function (done) { function sizeCheck(done, logger, orgInfo, newInfo) { if (newInfo.size.width != orgInfo.size.width) { logger.log(`org width ${orgInfo.size.width}, new width ${newInfo.size.width} `); @@ -629,11 +629,11 @@ describe('imagePixelMapFramework', function () { done(); } } - await pixelMapModifySizeTest(done, 'frmwk_011', 'callback', 'flip', sizeCheck, flipH, false, true) + await pixelMapModifySizeTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_CALLBACK_0100', 'callback', 'flip', sizeCheck, flipH, false, true) }) /** - * @tc.number : frmwk_012 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_ISSUPPORTALPHA_SETSUPPORTALPHA_0100 * @tc.name : isSupportAlpha SetSupportAlpha * @tc.desc : 1.create imagesource * : 2.create pixelmap @@ -643,8 +643,8 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_012', 0, async function (done) { - let logger = loger('frmwk_012') + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_ISSUPPORTALPHA_SETSUPPORTALPHA_0100', 0, async function (done) { + let logger = loger('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_ISSUPPORTALPHA_SETSUPPORTALPHA_0100') try { let imageSource = genPicSource(); logger.log("ImageSource " + (imageSource != undefined)); @@ -676,7 +676,7 @@ describe('imagePixelMapFramework', function () { } }) /** - * @tc.number : frmwk_013 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CREATEALPHAPIXELMAP_PROMISE_0100 * @tc.name : createAlphaPixelmap-promise * @tc.desc : 1.create imagesource * : 2.create pixelmap @@ -686,13 +686,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_013', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CREATEALPHAPIXELMAP_PROMISE_0100', 0, async function (done) { var imageData = testPng.buffer; - await createAlphaPixelmapTest(done, 'frmwk_013', 'promise', imageData); + await createAlphaPixelmapTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CREATEALPHAPIXELMAP_PROMISE_0100', 'promise', imageData); }) /** - * @tc.number : frmwk_014 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CREATEALPHAPIXELMAP_CALLBACK_0100 * @tc.name : createAlphaPixelmap-callback * @tc.desc : 1.create imagesource * : 2.create pixelmap @@ -702,13 +702,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_014', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CREATEALPHAPIXELMAP_CALLBACK_0100', 0, async function (done) { var imageData = testPng.buffer; - await createAlphaPixelmapTest(done, 'frmwk_014', 'callback', imageData); + await createAlphaPixelmapTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CREATEALPHAPIXELMAP_CALLBACK_0100', 'callback', imageData); }) /** - * @tc.number : frmwk_015 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CREATEALPHAPIXELMAP_0100 * @tc.name : createAlphaPixelmap-Jpg * @tc.desc : 1.create imagesource * : 2.create pixelmap @@ -718,13 +718,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_015', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CREATEALPHAPIXELMAP_0100', 0, async function (done) { var imageData = testJpg.buffer; - await createAlphaPixelmapTest(done, 'frmwk_015', 'promise', imageData); + await createAlphaPixelmapTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CREATEALPHAPIXELMAP_0100', 'promise', imageData); }) /** - * @tc.number : frmwk_016 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CREATEALPHAPIXELMAP_0200 * @tc.name : createAlphaPixelmap * @tc.desc : 1.create imagesource * : 2.create pixelmap @@ -734,13 +734,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_016', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CREATEALPHAPIXELMAP_0200', 0, async function (done) { var imageData = testBmp.buffer; - await createAlphaPixelmapTest(done, 'frmwk_016', 'promise', imageData); + await createAlphaPixelmapTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CREATEALPHAPIXELMAP_0200', 'promise', imageData); }) /** - * @tc.number : frmwk_017 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CREATEALPHAPIXELMAP_0300 * @tc.name : createAlphaPixelmap * @tc.desc : 1.create imagesource * : 2.create pixelmap @@ -750,13 +750,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_017', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CREATEALPHAPIXELMAP_0300', 0, async function (done) { var imageData = testGif.buffer; - await createAlphaPixelmapTest(done, 'frmwk_017', 'promise', imageData); + await createAlphaPixelmapTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CREATEALPHAPIXELMAP_0300', 'promise', imageData); }) /** - * @tc.number : frmwk_018 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETALPHA_PROMISE_0100 * @tc.name : setAlpha-promise * @tc.desc : 1.create pixelmap * : 2.setAlpha @@ -766,8 +766,8 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_018', 0, async function (done) { - let logger = loger('frmwk_018') + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETALPHA_PROMISE_0100', 0, async function (done) { + let logger = loger('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETALPHA_PROMISE_0100') try { var pixelMap = await genPixelMap() logger.log("pixelMap " + (pixelMap != undefined)); @@ -800,7 +800,7 @@ describe('imagePixelMapFramework', function () { }) /** - * @tc.number : frmwk_019 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETALPHA_CALLBACK_0100 * @tc.name : setAlpha -callback * @tc.desc : 1.create pixelmap * : 2.setAlpha @@ -810,8 +810,8 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_019', 0, async function (done) { - let logger = loger('frmwk_019') + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETALPHA_CALLBACK_0100', 0, async function (done) { + let logger = loger('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETALPHA_CALLBACK_0100') try { var pixelMap = await genPixelMap() logger.log("pixelMap " + (pixelMap != undefined)); @@ -845,7 +845,7 @@ describe('imagePixelMapFramework', function () { }) /** - * @tc.number : frmwk_020 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SOURCEOPTIONS_GETDENSITY_FITDENSITY_0100 * @tc.name : SourceOptions getDensity fitDensity * @tc.desc : 1.create ImageSource * : 2.create PixelMap @@ -854,13 +854,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_020', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SOURCEOPTIONS_GETDENSITY_FITDENSITY_0100', 0, async function (done) { var imageData = testPng.buffer; - await getDensityTest(done, 'frmwk_020', imageData) + await getDensityTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SOURCEOPTIONS_GETDENSITY_FITDENSITY_0100', imageData) }) /** - * @tc.number : frmwk_021 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_FITDENSITY_0100 * @tc.name : fitDensity * @tc.desc : 1.create ImageSource * : 2.create PixelMap with fitDensity @@ -869,14 +869,14 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_021', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_FITDENSITY_0100', 0, async function (done) { var imageData = testPng.buffer; let decodingOptions = { fitDensity: 240 }; - await getDensityTest(done, 'frmwk_021', imageData, decodingOptions) + await getDensityTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_FITDENSITY_0100', imageData, decodingOptions) }) /** - * @tc.number : frmwk_022 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_FITDENSITY_0200 * @tc.name : setDensity * @tc.desc : 1.create ImageSource * : 2.create PixelMap @@ -886,13 +886,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_022', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_FITDENSITY_0200', 0, async function (done) { var imageData = testPng.buffer; - await setDensityTest(done, 'frmwk_022', imageData) + await setDensityTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_FITDENSITY_0200', imageData) }) /** - * @tc.number : frmwk_023 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SOURCEOPTIONS_GETDENSITY_FITDENSITY_0200 * @tc.name : SourceOptions getDensity fitDensity * @tc.desc : 1.create ImageSource * : 2.create PixelMap @@ -901,13 +901,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_023', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SOURCEOPTIONS_GETDENSITY_FITDENSITY_0200', 0, async function (done) { var imageData = testJpg.buffer; - await getDensityTest(done, 'frmwk_023', imageData) + await getDensityTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SOURCEOPTIONS_GETDENSITY_FITDENSITY_0200', imageData) }) /** - * @tc.number : frmwk_024 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SOURCEOPTIONS_GETDENSITY_FITDENSITY_0300 * @tc.name : SourceOptions getDensity fitDensity * @tc.desc : 1.create ImageSource * : 2.create PixelMap @@ -916,13 +916,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_024', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SOURCEOPTIONS_GETDENSITY_FITDENSITY_0300', 0, async function (done) { var imageData = testBmp.buffer; - await getDensityTest(done, 'frmwk_024', imageData) + await getDensityTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SOURCEOPTIONS_GETDENSITY_FITDENSITY_0300', imageData) }) /** - * @tc.number : frmwk_025 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SOURCEOPTIONS_GETDENSITY_FITDENSITY_0400 * @tc.name : SourceOptions getDensity fitDensity * @tc.desc : 1.create ImageSource * : 2.create PixelMap @@ -931,13 +931,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_025', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SOURCEOPTIONS_GETDENSITY_FITDENSITY_0400', 0, async function (done) { var imageData = testGif.buffer; - await getDensityTest(done, 'frmwk_025', imageData) + await getDensityTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SOURCEOPTIONS_GETDENSITY_FITDENSITY_0400', imageData) }) /** - * @tc.number : frmwk_026 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_FITDENSITY_0300 * @tc.name : fitDensity-JPG * @tc.desc : 1.create ImageSource * : 2.create PixelMap with fitDensity @@ -946,14 +946,14 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_026', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_FITDENSITY_0300', 0, async function (done) { var imageData = testJpg.buffer; let decodingOptions = { fitDensity: 240 }; - await getDensityTest(done, 'frmwk_026', imageData, decodingOptions) + await getDensityTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_FITDENSITY_0300', imageData, decodingOptions) }) /** - * @tc.number : frmwk_027 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_FITDENSITY_0400 * @tc.name : fitDensity-bmp * @tc.desc : 1.create ImageSource * : 2.create PixelMap with fitDensity @@ -962,14 +962,14 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_027', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_FITDENSITY_0400', 0, async function (done) { var imageData = testBmp.buffer; let decodingOptions = { fitDensity: 240 }; - await getDensityTest(done, 'frmwk_027', imageData, decodingOptions) + await getDensityTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_FITDENSITY_0400', imageData, decodingOptions) }) /** - * @tc.number : frmwk_028 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_FITDENSITY_0500 * @tc.name : fitDensity-gif * @tc.desc : 1.create ImageSource * : 2.create PixelMap with fitDensity @@ -978,14 +978,14 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_028', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_FITDENSITY_0500', 0, async function (done) { var imageData = testGif.buffer; let decodingOptions = { fitDensity: 240 }; - await getDensityTest(done, 'frmwk_028', imageData, decodingOptions) + await getDensityTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_FITDENSITY_0500', imageData, decodingOptions) }) /** - * @tc.number : frmwk_029 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_0100 * @tc.name : setDensity-Jpg * @tc.desc : 1.create ImageSource * : 2.create PixelMap @@ -995,13 +995,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_029', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_0100', 0, async function (done) { var imageData = testJpg.buffer; - await setDensityTest(done, 'frmwk_029', imageData) + await setDensityTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_0100', imageData) }) /** - * @tc.number : frmwk_030 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_0200 * @tc.name : setDensity-bmp * @tc.desc : 1.create ImageSource * : 2.create PixelMap @@ -1011,13 +1011,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_030', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_0200', 0, async function (done) { var imageData = testBmp.buffer; - await setDensityTest(done, 'frmwk_030', imageData) + await setDensityTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_0200', imageData) }) /** - * @tc.number : frmwk_031 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_0300 * @tc.name : setDensity-gif * @tc.desc : 1.create ImageSource * : 2.create PixelMap @@ -1027,13 +1027,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_031', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_0300', 0, async function (done) { var imageData = testGif.buffer; - await setDensityTest(done, 'frmwk_031', imageData) + await setDensityTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_0300', imageData) }) /** - * @tc.number : frmwk_032 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_PROMISE_0100 * @tc.name : crop-promise * @tc.desc : 1.create PixelMap * : 2.crop @@ -1044,7 +1044,7 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_032', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_PROMISE_0100', 0, async function (done) { var region = { size: { height: 3, width: 3 }, x: 1, y: 1 }; function sizeCheck(done, logger, orgInfo, newInfo) { orgInfo = region; @@ -1054,11 +1054,11 @@ describe('imagePixelMapFramework', function () { done(); } } - await pixelMapModifySizeTest(done, 'frmwk_032', 'promise', 'crop', sizeCheck, crop3x3, region) + await pixelMapModifySizeTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_PROMISE_0100', 'promise', 'crop', sizeCheck, crop3x3, region) }) /** - * @tc.number : frmwk_033 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_CALLBACK_0100 * @tc.name : crop -callback * @tc.desc : 1.create PixelMap * : 2.crop @@ -1069,7 +1069,7 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('frmwk_033', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_CALLBACK_0100', 0, async function (done) { var region = { size: { height: 3, width: 3 }, x: 1, y: 1 }; function sizeCheck(done, logger, orgInfo, newInfo) { orgInfo = region; @@ -1079,11 +1079,11 @@ describe('imagePixelMapFramework', function () { done(); } } - await pixelMapModifySizeTest(done, 'frmwk_033', 'callback', 'crop', sizeCheck, crop3x3, region) + await pixelMapModifySizeTest(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_CALLBACK_0100', 'callback', 'crop', sizeCheck, crop3x3, region) }) /** - * @tc.number : scaleErr_001 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_PROMISE_0100 * @tc.name : Pixelmap Scale-promise-wrong x * @tc.desc : 1.create pixelmap * : 2.call scale @@ -1091,12 +1091,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('scaleErr_001', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'scaleErr_001', 'promise', 'scale', { a: 10 }, 1.0) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_PROMISE_0100', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_PROMISE_0100', 'promise', 'scale', { a: 10 }, 1.0) }) /** - * @tc.number : scaleErr_002 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_PROMISE_0200 * @tc.name : Pixelmap Scale-promise-wrong x * @tc.desc : 1.create pixelmap * : 2.call scale @@ -1104,12 +1104,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('scaleErr_002', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'scaleErr_002', 'promise', 'scale', 'a', 1.0) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_PROMISE_0200', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_PROMISE_0200', 'promise', 'scale', 'a', 1.0) }) /** - * @tc.number : scaleErr_003 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_PROMISE_0300 * @tc.name : Pixelmap Scale-promise-wrong y * @tc.desc : 1.create pixelmap * : 2.call scale @@ -1117,13 +1117,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('scaleErr_003', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'scaleErr_003', 'promise', 'scale', 1.0, null) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_PROMISE_0300', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_PROMISE_0300', 'promise', 'scale', 1.0, null) }) /** - * @tc.number : scaleErr_004 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_PROMISE_0400 * @tc.name : Pixelmap Scale-promise-wrong y * @tc.desc : 1.create pixelmap * : 2.call scale @@ -1131,13 +1131,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('scaleErr_004', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'scaleErr_004', 'promise', 'scale', 1.0, true) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_PROMISE_0400', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_PROMISE_0400', 'promise', 'scale', 1.0, true) }) /** - * @tc.number : scaleErr_005 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_CALLBACK_0100 * @tc.name : Pixelmap Scale-callback-wrong x * @tc.desc : 1.create pixelmap * : 2.call scale @@ -1145,12 +1145,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('scaleErr_005', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'scaleErr_005', 'callback', 'scale', { a: 10 }, 1.0) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_CALLBACK_0100', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_CALLBACK_0100', 'callback', 'scale', { a: 10 }, 1.0) }) /** - * @tc.number : scaleErr_006 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_CALLBACK_0200 * @tc.name : Pixelmap Scale-callback-wrong x * @tc.desc : 1.create pixelmap * : 2.call scale @@ -1158,12 +1158,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('scaleErr_006', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'scaleErr_006', 'callback', 'scale', 'a', 1.0) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_CALLBACK_0200', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_CALLBACK_0200', 'callback', 'scale', 'a', 1.0) }) /** - * @tc.number : scaleErr_007 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_CALLBACK_0300 * @tc.name : Pixelmap Scale-callback-wrong y * @tc.desc : 1.create pixelmap * : 2.call scale @@ -1171,12 +1171,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('scaleErr_007', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'scaleErr_007', 'callback', 'scale', 1.0, null) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_CALLBACK_0300', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_CALLBACK_0300', 'callback', 'scale', 1.0, null) }) /** - * @tc.number : scaleErr_008 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_CALLBACK_0400 * @tc.name : Pixelmap Scale-callback-wrong y * @tc.desc : 1.create pixelmap * : 2.call scale @@ -1184,12 +1184,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('scaleErr_008', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'scaleErr_008', 'callback', 'scale', 1.0, true) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_CALLBACK_0400', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_SCALE_ERROR_CALLBACK_0400', 'callback', 'scale', 1.0, true) }) /** - * @tc.number : translateErr_001 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_PROMISE_0100 * @tc.name : Pixelmap Translate -promise-wrong x * @tc.desc : 1.create pixelmap * : 2.call translate @@ -1197,12 +1197,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('translateErr_001', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'translateErr_001', 'promise', 'translate', { a: 10 }, 1.0) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_PROMISE_0100', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_PROMISE_0100', 'promise', 'translate', { a: 10 }, 1.0) }) /** - * @tc.number : translateErr_002 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_PROMISE_0200 * @tc.name : Pixelmap Translate -promise-wrong x * @tc.desc : 1.create pixelmap * : 2.call translate @@ -1210,12 +1210,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('translateErr_002', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'translateErr_002', 'promise', 'translate', 'a', 1.0) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_PROMISE_0200', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_PROMISE_0200', 'promise', 'translate', 'a', 1.0) }) /** - * @tc.number : translateErr_003 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_PROMISE_0300 * @tc.name : Pixelmap Translate -promise-wrong y * @tc.desc : 1.create pixelmap * : 2.call translate @@ -1223,12 +1223,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('translateErr_003', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'translateErr_003', 'promise', 'translate', 1.0, null) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_PROMISE_0300', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_PROMISE_0300', 'promise', 'translate', 1.0, null) }) /** - * @tc.number : translateErr_004 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_PROMISE_0400 * @tc.name : Pixelmap Translate -promise-wrong y * @tc.desc : 1.create pixelmap * : 2.call translate @@ -1236,12 +1236,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('translateErr_004', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'translateErr_004', 'promise', 'translate', 1.0, false) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_PROMISE_0400', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_PROMISE_0400', 'promise', 'translate', 1.0, false) }) /** - * @tc.number : translateErr_005 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_CALLBACK_0100 * @tc.name : Pixelmap Translate -callback-wrong x * @tc.desc : 1.create pixelmap * : 2.call translate @@ -1249,12 +1249,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('translateErr_005', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'translateErr_005', 'callback', 'translate', { a: 10 }, 1.0) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_CALLBACK_0100', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_CALLBACK_0100', 'callback', 'translate', { a: 10 }, 1.0) }) /** - * @tc.number : translateErr_006 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_CALLBACK_0200 * @tc.name : Pixelmap Translate -callback-wrong x * @tc.desc : 1.create pixelmap * : 2.call translate @@ -1262,12 +1262,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('translateErr_006', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'translateErr_006', 'callback', 'translate', 'a', 1.0) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_CALLBACK_0200', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_CALLBACK_0200', 'callback', 'translate', 'a', 1.0) }) /** - * @tc.number : translateErr_007 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_CALLBACK_0300 * @tc.name : Pixelmap Translate -callback-wrong y * @tc.desc : 1.create pixelmap * : 2.call translate @@ -1275,12 +1275,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('translateErr_007', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'translateErr_007', 'callback', 'translate', 1.0, null) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_CALLBACK_0300', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_CALLBACK_0300', 'callback', 'translate', 1.0, null) }) /** - * @tc.number : translateErr_008 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_CALLBACK_0400 * @tc.name : Pixelmap Translate -callback-wrong y * @tc.desc : 1.create pixelmap * : 2.call translate @@ -1288,12 +1288,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('translateErr_008', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'translateErr_008', 'callback', 'translate', 1.0, false) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_CALLBACK_0400', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_TRANSLATE_ERROR_CALLBACK_0400', 'callback', 'translate', 1.0, false) }) /** - * @tc.number : rotateErr_001 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_PROMISE_0100 * @tc.name : Pixelmap Rotate-promise-wrong angle * @tc.desc : 1.create pixelmap * : 2.call rotate @@ -1301,12 +1301,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('rotateErr_001', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'rotateErr_001', 'promise', 'rotate', 'a') + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_PROMISE_0100', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_PROMISE_0100', 'promise', 'rotate', 'a') }) /** - * @tc.number : rotateErr_002 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_PROMISE_0200 * @tc.name : Pixelmap Rotate-promise-wrong angle * @tc.desc : 1.create pixelmap * : 2.call rotate @@ -1314,12 +1314,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('rotateErr_002', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'rotateErr_002', 'promise', 'rotate', { a: 10 }) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_PROMISE_0200', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_PROMISE_0200', 'promise', 'rotate', { a: 10 }) }) /** - * @tc.number : rotateErr_003 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_PROMISE_0300 * @tc.name : Pixelmap Rotate-promise-wrong angle * @tc.desc : 1.create pixelmap * : 2.call rotate @@ -1327,12 +1327,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('rotateErr_003', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'rotateErr_003', 'promise', 'rotate', null) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_PROMISE_0300', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_PROMISE_0300', 'promise', 'rotate', null) }) /** - * @tc.number : rotateErr_004 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_PROMISE_0400 * @tc.name : Pixelmap Rotate-promise-wrong angle * @tc.desc : 1.create pixelmap * : 2.call rotate @@ -1340,12 +1340,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('rotateErr_004', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'rotateErr_004', 'promise', 'rotate', false) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_PROMISE_0400', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_PROMISE_0400', 'promise', 'rotate', false) }) /** - * @tc.number : rotateErr_005 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_CALLBACK_0100 * @tc.name : Pixelmap Rotate-callback-wrong angle * @tc.desc : 1.create pixelmap * : 2.call rotate @@ -1353,12 +1353,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('rotateErr_005', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'rotateErr_005', 'callback', 'rotate', 'a') + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_CALLBACK_0100', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_CALLBACK_0100', 'callback', 'rotate', 'a') }) /** - * @tc.number : rotateErr_006 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_CALLBACK_0200 * @tc.name : Pixelmap Rotate-callback-wrong angle * @tc.desc : 1.create pixelmap * : 2.call rotate @@ -1366,12 +1366,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('rotateErr_006', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'rotateErr_006', 'callback', 'rotate', { a: 10 }) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_CALLBACK_0200', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_CALLBACK_0200', 'callback', 'rotate', { a: 10 }) }) /** - * @tc.number : rotateErr_007 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_CALLBACK_0300 * @tc.name : Pixelmap Rotate-callback-wrong angle * @tc.desc : 1.create pixelmap * : 2.call rotate @@ -1379,12 +1379,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('rotateErr_007', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'rotateErr_007', 'callback', 'rotate', null) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_CALLBACK_0300', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_CALLBACK_0300', 'callback', 'rotate', null) }) /** - * @tc.number : rotateErr_008 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_CALLBACK_0400 * @tc.name : Pixelmap Rotate-callback-wrong angle * @tc.desc : 1.create pixelmap * : 2.call rotate @@ -1392,12 +1392,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('rotateErr_008', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'rotateErr_008', 'callback', 'rotate', false) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_CALLBACK_0400', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_ROTATE_ERROR_ANGLE_CALLBACK_0400', 'callback', 'rotate', false) }) /** - * @tc.number : flipErr_001 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_PROMISE_0100 * @tc.name : Pixelmap Flip-promise-wrong x * @tc.desc : 1.create pixelmap * : 2.call flip @@ -1405,12 +1405,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('flipErr_001', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'flipErr_001', 'promise', 'flip', 'false', true) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_PROMISE_0100', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_PROMISE_0100', 'promise', 'flip', 'false', true) }) /** - * @tc.number : flipErr_002 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_PROMISE_0200 * @tc.name : Pixelmap Flip-promise-wrong x * @tc.desc : 1.create pixelmap * : 2.call flip @@ -1418,12 +1418,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('flipErr_002', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'flipErr_002', 'promise', 'flip', 1, true) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_PROMISE_0200', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_PROMISE_0200', 'promise', 'flip', 1, true) }) /** - * @tc.number : flipErr_003 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_PROMISE_0300 * @tc.name : Pixelmap Flip-promise-wrong y * @tc.desc : 1.create pixelmap * : 2.call flip @@ -1431,12 +1431,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('flipErr_003', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'flipErr_003', 'promise', 'flip', true, { a: 10 }) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_PROMISE_0300', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_PROMISE_0300', 'promise', 'flip', true, { a: 10 }) }) /** - * @tc.number : flipErr_004 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_PROMISE_0400 * @tc.name : Pixelmap Flip-promise-wrong y * @tc.desc : 1.create pixelmap * : 2.call flip @@ -1444,12 +1444,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('flipErr_004', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'flipErr_004', 'promise', 'flip', true, null) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_PROMISE_0400', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_PROMISE_0400', 'promise', 'flip', true, null) }) /** - * @tc.number : flipErr_005 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_CALLBACK_0100 * @tc.name : Pixelmap Flip-callback-wrong x * @tc.desc : 1.create pixelmap * : 2.call flip @@ -1457,12 +1457,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('flipErr_005', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'flipErr_005', 'callback', 'flip', 'false', true) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_CALLBACK_0100', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_CALLBACK_0100', 'callback', 'flip', 'false', true) }) /** - * @tc.number : flipErr_006 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_CALLBACK_0200 * @tc.name : Pixelmap Flip-callback-wrong x * @tc.desc : 1.create pixelmap * : 2.call flip @@ -1470,12 +1470,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('flipErr_006', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'flipErr_006', 'callback', 'flip', 1, true) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_CALLBACK_0200', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_CALLBACK_0200', 'callback', 'flip', 1, true) }) /** - * @tc.number : flipErr_007 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_CALLBACK_0300 * @tc.name : Pixelmap Flip-callback-wrong y * @tc.desc : 1.create pixelmap * : 2.call flip @@ -1483,12 +1483,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('flipErr_007', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'flipErr_007', 'callback', 'flip', true, { a: 10 }) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_CALLBACK_0300', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_CALLBACK_0300', 'callback', 'flip', true, { a: 10 }) }) /** - * @tc.number : flipErr_008 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_CALLBACK_0400 * @tc.name : Pixelmap Flip-callback-wrong y * @tc.desc : 1.create pixelmap * : 2.call flip @@ -1496,12 +1496,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('flipErr_008', 0, async function (done) { - await pixelMapModifySizeTestErr(done, 'flipErr_008', 'callback', 'flip', true, null) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_CALLBACK_0400', 0, async function (done) { + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_PIXELMAP_FLIP_ERROR_CALLBACK_0400', 'callback', 'flip', true, null) }) /** - * @tc.number : setAlphaAbleErr_001 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETSUPPORTALPHA_ERROR_ALPHA_0100 * @tc.name : SetSupportAlpha-wrong alpha * @tc.desc : 1.create imagesource * : 2.create pixelmap @@ -1510,12 +1510,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('setAlphaAbleErr_001', 0, async function (done) { - setAlphaAbleErr(done, 'setAlphaAbleErr_001', 'a') + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETSUPPORTALPHA_ERROR_ALPHA_0100', 0, async function (done) { + setAlphaAbleErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETSUPPORTALPHA_ERROR_ALPHA_0100', 'a') }) /** - * @tc.number : setAlphaAbleErr_002 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETSUPPORTALPHA_ERROR_ALPHA_0200 * @tc.name : SetSupportAlpha-wrong alpha * @tc.desc : 1.create imagesource * : 2.create pixelmap @@ -1524,12 +1524,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('setAlphaAbleErr_002', 0, async function (done) { - setAlphaAbleErr(done, 'setAlphaAbleErr_002', { a: 1 }) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETSUPPORTALPHA_ERROR_ALPHA_0200', 0, async function (done) { + setAlphaAbleErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETSUPPORTALPHA_ERROR_ALPHA_0200', { a: 1 }) }) /** - * @tc.number : setAlphaAbleErr_003 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETSUPPORTALPHA_ERROR_ALPHA_0300 * @tc.name : SetSupportAlpha-wrong alpha * @tc.desc : 1.create imagesource * : 2.create pixelmap @@ -1538,12 +1538,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('setAlphaAbleErr_003', 0, async function (done) { - setAlphaAbleErr(done, 'setAlphaAbleErr_003', null) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETSUPPORTALPHA_ERROR_ALPHA_0300', 0, async function (done) { + setAlphaAbleErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETSUPPORTALPHA_ERROR_ALPHA_0300', null) }) /** - * @tc.number : setAlphaAbleErr_004 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETSUPPORTALPHA_ERROR_ALPHA_0400 * @tc.name : SetSupportAlpha-wrong alpha * @tc.desc : 1.create imagesource * : 2.create pixelmap @@ -1552,12 +1552,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('setAlphaAbleErr_004', 0, async function (done) { - setAlphaAbleErr(done, 'setAlphaAbleErr_004', 1) + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETSUPPORTALPHA_ERROR_ALPHA_0400', 0, async function (done) { + setAlphaAbleErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETSUPPORTALPHA_ERROR_ALPHA_0400', 1) }) /** - * @tc.number : cropErr_001 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_PROMISE_SIZE_0100 * @tc.name : crop-promise- size: { height: 3, width: 3 }, x: -1, y: 1 * @tc.desc : 1.create PixelMap * : 2.crop @@ -1568,13 +1568,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('cropErr_001', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_PROMISE_SIZE_0100', 0, async function (done) { var region = { size: { height: 3, width: 3 }, x: -1, y: 1 }; - await pixelMapModifySizeTestErr(done, 'cropErr_001', 'promise', 'crop', region) + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_PROMISE_SIZE_0100', 'promise', 'crop', region) }) /** - * @tc.number : cropErr_002 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_PROMISE_SIZE_0200 * @tc.name : crop-promise-size: { height: 3, width: 3 }, x: 1, y: -1 * @tc.desc : 1.create PixelMap * : 2.crop @@ -1585,13 +1585,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('cropErr_002', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_PROMISE_SIZE_0200', 0, async function (done) { var region = { size: { height: 3, width: 3 }, x: 1, y: -1 }; - await pixelMapModifySizeTestErr(done, 'cropErr_002', 'promise', 'crop', region) + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_PROMISE_SIZE_0200', 'promise', 'crop', region) }) /** - * @tc.number : cropErr_003 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_PROMISE_SIZE_0300 * @tc.name : crop-promise-size: { height: 3, width: -3 }, x: 1, y: 1 * @tc.desc : 1.create PixelMap * : 2.crop @@ -1602,13 +1602,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('cropErr_003', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_PROMISE_SIZE_0300', 0, async function (done) { var region = { size: { height: 3, width: -3 }, x: 1, y: 1 }; - await pixelMapModifySizeTestErr(done, 'cropErr_003', 'promise', 'crop', region) + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_PROMISE_SIZE_0300', 'promise', 'crop', region) }) /** - * @tc.number : cropErr_004 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_PROMISE_SIZE_0400 * @tc.name : crop-promise-size: { height: -3, width: 3 }, x: 1, y: 1 * @tc.desc : 1.create PixelMap * : 2.crop @@ -1619,13 +1619,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('cropErr_004', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_PROMISE_SIZE_0400', 0, async function (done) { var region = { size: { height: -3, width: 3 }, x: 1, y: 1 }; - await pixelMapModifySizeTestErr(done, 'cropErr_004', 'promise', 'crop', region) + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_PROMISE_SIZE_0400', 'promise', 'crop', region) }) /** - * @tc.number : cropErr_005 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_CALLBACK_SIZE_0100 * @tc.name : crop-callback-size: { height: 3, width: 3 }, x: -1, y: 1 * @tc.desc : 1.create PixelMap * : 2.crop @@ -1636,13 +1636,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('cropErr_005', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_CALLBACK_SIZE_0100', 0, async function (done) { var region = { size: { height: 3, width: 3 }, x: -1, y: 1 }; - await pixelMapModifySizeTestErr(done, 'cropErr_005', 'callback', 'crop', region) + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_CALLBACK_SIZE_0100', 'callback', 'crop', region) }) /** - * @tc.number : cropErr_006 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_CALLBACK_SIZE_0200 * @tc.name : crop-callback-size: { height: 3, width: 3 }, x: 1, y: -1 * @tc.desc : 1.create PixelMap * : 2.crop @@ -1653,13 +1653,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('cropErr_006', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_CALLBACK_SIZE_0200', 0, async function (done) { var region = { size: { height: 3, width: 3 }, x: 1, y: -1 }; - await pixelMapModifySizeTestErr(done, 'cropErr_006', 'callback', 'crop', region) + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_CALLBACK_SIZE_0200', 'callback', 'crop', region) }) /** - * @tc.number : cropErr_007 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_CALLBACK_SIZE_0300 * @tc.name : crop-callback-size: { height: 3, width: -3 }, x: 1, y: 1 * @tc.desc : 1.create PixelMap * : 2.crop @@ -1670,13 +1670,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('cropErr_007', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_CALLBACK_SIZE_0300', 0, async function (done) { var region = { size: { height: 3, width: -3 }, x: 1, y: 1 }; - await pixelMapModifySizeTestErr(done, 'cropErr_007', 'callback', 'crop', region) + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_CALLBACK_SIZE_0300', 'callback', 'crop', region) }) /** - * @tc.number : cropErr_008 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_CALLBACK_SIZE_0400 * @tc.name : crop-callback-size: { height: -3, width: 3 }, x: 1, y: 1 * @tc.desc : 1.create PixelMap * : 2.crop @@ -1687,13 +1687,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('cropErr_008', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_CALLBACK_SIZE_0400', 0, async function (done) { var region = { size: { height: -3, width: 3 }, x: 1, y: 1 }; - await pixelMapModifySizeTestErr(done, 'cropErr_008', 'callback', 'crop', region) + await pixelMapModifySizeTestErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_CROP_CALLBACK_SIZE_0400', 'callback', 'crop', region) }) /** - * @tc.number : setDensityErr_001 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_GIF_ERROR_DENSITY_0100 * @tc.name : setDensity-gif-wrong density * @tc.desc : 1.create ImageSource * : 2.create PixelMap @@ -1702,13 +1702,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('setDensityErr_001', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_GIF_ERROR_DENSITY_0100', 0, async function (done) { var imageData = testGif.buffer; - setDensityErr(done, 'setDensityErr_001', imageData, null) + setDensityErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_GIF_ERROR_DENSITY_0100', imageData, null) }) /** - * @tc.number : setDensityErr_002 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_GIF_ERROR_DENSITY_0200 * @tc.name : setDensity-gif-wrong density * @tc.desc : 1.create ImageSource * : 2.create PixelMap @@ -1717,13 +1717,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('setDensityErr_002', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_GIF_ERROR_DENSITY_0200', 0, async function (done) { var imageData = testGif.buffer; - setDensityErr(done, 'setDensityErr_002', imageData, 'a') + setDensityErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_GIF_ERROR_DENSITY_0200', imageData, 'a') }) /** - * @tc.number : setDensityErr_003 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_GIF_ERROR_DENSITY_0300 * @tc.name : setDensity-gif-wrong density * @tc.desc : 1.create ImageSource * : 2.create PixelMap @@ -1732,13 +1732,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('setDensityErr_003', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_GIF_ERROR_DENSITY_0300', 0, async function (done) { var imageData = testGif.buffer; - setDensityErr(done, 'setDensityErr_003', imageData, true) + setDensityErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_GIF_ERROR_DENSITY_0300', imageData, true) }) /** - * @tc.number : setDensityErr_004 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_GIF_ERROR_DENSITY_0400 * @tc.name : setDensity-gif-wrong density * @tc.desc : 1.create ImageSource * : 2.create PixelMap @@ -1747,13 +1747,13 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('setDensityErr_004', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_GIF_ERROR_DENSITY_0400', 0, async function (done) { var imageData = testGif.buffer; - setDensityErr(done, 'setDensityErr_004', imageData, { a: 1 }) + setDensityErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_SETDENSITY_GIF_ERROR_DENSITY_0400', imageData, { a: 1 }) }) /** - * @tc.number : opacityErr_001 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_PROMISE_ERROR_ALPHA_0100 * @tc.name : opacity-promise-wrong alpha * @tc.desc : 1.create pixelmap * : 2.opacity @@ -1761,12 +1761,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('opacityErr_001', 0, async function (done) { - opacityErr(done, 'opacityErr_001', { a: 1 }, 'Promise') + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_PROMISE_ERROR_ALPHA_0100', 0, async function (done) { + opacityErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_PROMISE_ERROR_ALPHA_0100', { a: 1 }, 'Promise') }) /** - * @tc.number : opacityErr_002 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_PROMISE_ERROR_ALPHA_0200 * @tc.name : opacity-promise-wrong alpha * @tc.desc : 1.create pixelmap * : 2.opacity @@ -1774,12 +1774,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('opacityErr_002', 0, async function (done) { - opacityErr(done, 'opacityErr_002', 'a', 'Promise') + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_PROMISE_ERROR_ALPHA_0200', 0, async function (done) { + opacityErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_PROMISE_ERROR_ALPHA_0200', 'a', 'Promise') }) /** - * @tc.number : opacityErr_003 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_PROMISE_ERROR_ALPHA_0300 * @tc.name : opacity-promise-wrong alpha * @tc.desc : 1.create pixelmap * : 2.opacity @@ -1787,12 +1787,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('opacityErr_003', 0, async function (done) { - opacityErr(done, 'opacityErr_003', null, 'Promise') + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_PROMISE_ERROR_ALPHA_0300', 0, async function (done) { + opacityErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_PROMISE_ERROR_ALPHA_0300', null, 'Promise') }) /** - * @tc.number : opacityErr_004 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_PROMISE_ERROR_ALPHA_0400 * @tc.name : opacity-promise-wrong alpha * @tc.desc : 1.create pixelmap * : 2.opacity @@ -1800,12 +1800,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('opacityErr_004', 0, async function (done) { - opacityErr(done, 'opacityErr_004', 2, 'Promise') + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_PROMISE_ERROR_ALPHA_0400', 0, async function (done) { + opacityErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_PROMISE_ERROR_ALPHA_0400', 2, 'Promise') }) /** - * @tc.number : opacityErr_005 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_CALLBACK_ERROR_ALPHA_0100 * @tc.name : opacity-callback-wrong alpha * @tc.desc : 1.create pixelmap * : 2.opacity @@ -1813,12 +1813,12 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('opacityErr_005', 0, async function (done) { - opacityErr(done, 'opacityErr_005', { a: 1 }, 'callback') + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_CALLBACK_ERROR_ALPHA_0100', 0, async function (done) { + opacityErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_CALLBACK_ERROR_ALPHA_0100', { a: 1 }, 'callback') }) /** - * @tc.number : opacityErr_006 + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_CALLBACK_ERROR_ALPHA_0200 * @tc.name : opacity-callback-wrong alpha * @tc.desc : 1.create pixelmap * : 2.opacity @@ -1826,33 +1826,33 @@ describe('imagePixelMapFramework', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('opacityErr_006', 0, async function (done) { - opacityErr(done, 'opacityErr_006', 'a', 'callback') + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_CALLBACK_ERROR_ALPHA_0200', 0, async function (done) { + opacityErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_CALLBACK_ERROR_ALPHA_0200', 'a', 'callback') }) /** - * @tc.number : opacityErr_007 - * @tc.name : opacityErr-callback-wrong alpha + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_CALLBACK_ERROR_ALPHA_0300 + * @tc.name : opacity-callback-wrong alpha * @tc.desc : 1.create pixelmap * : 2.opacityErr * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 0 */ - it('opacityErr_007', 0, async function (done) { - opacityErr(done, 'opacityErr_007', null, 'callback') + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_CALLBACK_ERROR_ALPHA_0300', 0, async function (done) { + opacityErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_CALLBACK_ERROR_ALPHA_0300', null, 'callback') }) /** - * @tc.number : opacityErr_008 - * @tc.name : opacityErr-callback-wrong alpha + * @tc.number : SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_CALLBACK_ERROR_ALPHA_0400 + * @tc.name : opacity-callback-wrong alpha * @tc.desc : 1.create pixelmap * : 2.opacity * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 0 */ - it('opacityErr_008', 0, async function (done) { - opacityErr(done, 'opacityErr_008', 2, 'callback') + it('SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_CALLBACK_ERROR_ALPHA_0400', 0, async function (done) { + opacityErr(done, 'SUB_GRAPHIC_IMAGE_PIXELMAPFRAMEWORK_OPACITY_CALLBACK_ERROR_ALPHA_0400', 2, 'callback') }) })} diff --git a/multimedia/image/image_js_standard/imageRGBA/BUILD.gn b/multimedia/image/image_js_standard/imageRGBA/BUILD.gn index 2a0a35be6d8cea5d36e2f70bb4993ef4223856d9..f42020e443ec021aee2a74c38cfc2304a7ff0a9d 100644 --- a/multimedia/image/image_js_standard/imageRGBA/BUILD.gn +++ b/multimedia/image/image_js_standard/imageRGBA/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/multimedia/image/image_js_standard/imageRGBA/src/main/config.json b/multimedia/image/image_js_standard/imageRGBA/src/main/config.json index 29aafe990cec42fb8f8ef0f0fd7d831eb27385c3..7c490f312beff754cf30a44b8807d4b18bdd9c6b 100644 --- a/multimedia/image/image_js_standard/imageRGBA/src/main/config.json +++ b/multimedia/image/image_js_standard/imageRGBA/src/main/config.json @@ -44,6 +44,7 @@ } ], "deviceType": [ + "default", "phone", "tablet", "tv", diff --git a/multimedia/image/image_js_standard/imageRGBA/src/main/js/test/RGBA.test.js b/multimedia/image/image_js_standard/imageRGBA/src/main/js/test/RGBA.test.js index 708a60f85c944d72a3c6b37ae10aa545979db618..b3faac10b2051493dfcafa9608524e50c65d9b8b 100644 --- a/multimedia/image/image_js_standard/imageRGBA/src/main/js/test/RGBA.test.js +++ b/multimedia/image/image_js_standard/imageRGBA/src/main/js/test/RGBA.test.js @@ -35,7 +35,7 @@ describe('Image', function () { }) /** - * @tc.number : RGBA_001 + * @tc.number : SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0100 * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_F16, * size: { height: 4, width: 6 }, bytes = buffer) * @tc.desc : 1.create InitializationOptions object @@ -46,7 +46,7 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('RGBA_001', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0100', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 7, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts) @@ -56,14 +56,14 @@ describe('Image', function () { done(); }) .catch(error => { - console.log('RGBA_001 err' + error); + console.log('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0100 err' + error); expect(false).assertTrue(); done(); }) }) /** - * @tc.number : RGBA_002 + * @tc.number : SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0100 * @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGBA_F16, * size: { height: 4, width: 6 },bytes = buffer) * @tc.desc : 1.create InitializationOptions object @@ -74,12 +74,12 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('RGBA_002', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0100', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 7, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts, (err, pixelmap) => { if (err != undefined) { - console.info('RGBA_002 err: ' + err); + console.info('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0100 err: ' + err); expect(false).assertTrue(); done(); return; @@ -91,7 +91,7 @@ describe('Image', function () { }) /** - * @tc.number : RGBA_003 + * @tc.number : SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0200 * @tc.name : create pixelmap-promise (editable: false, pixelFormat: RGBA_F16, * size: { height: 4, width: 6 }, bytes = buffer) * @tc.desc : 1.create InitializationOptions object @@ -102,7 +102,7 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('RGBA_003', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0200', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: false, pixelFormat: 7, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts) @@ -112,14 +112,14 @@ describe('Image', function () { done(); }) .catch(error => { - console.log('RGBA_003 err' + error); + console.log('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0200 err' + error); expect(false).assertTrue(); done(); }) }) /** - * @tc.number : RGBA_004 + * @tc.number : SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0200 * @tc.name : create pixelmap-callback (editable: false, pixelFormat: RGBA_F16, * size: { height: 4, width: 6 },bytes = buffer) * @tc.desc : 1.create InitializationOptions object @@ -130,12 +130,12 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('RGBA_004', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0200', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: false, pixelFormat: 7, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts, (err, pixelmap) => { if (err != undefined) { - console.info('RGBA_002 err: ' + err); + console.info('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0200 err: ' + err); expect(false).assertTrue(); done(); return; @@ -148,7 +148,7 @@ describe('Image', function () { }) /** - * @tc.number : RGBA_005 + * @tc.number : SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0300 * @tc.name : create pixelmap-promise (editable: true, pixelFormat: ALPHA_8, * size: { height: 4, width: 6 }, bytes = buffer) * @tc.desc : 1.create InitializationOptions object @@ -159,7 +159,7 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('RGBA_005', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0300', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 6, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts) @@ -169,14 +169,14 @@ describe('Image', function () { done(); }) .catch(error => { - console.log('RGBA_005 err' + error); + console.log('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0300 err' + error); expect(false).assertTrue(); done(); }) }) /** - * @tc.number : RGBA_006 + * @tc.number : SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0400 * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGB_565, * size: { height: 4, width: 6 }, bytes = buffer) * @tc.desc : 1.create InitializationOptions object @@ -187,7 +187,7 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('RGBA_006', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0400', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 2, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts) @@ -197,14 +197,14 @@ describe('Image', function () { done(); }) .catch(error => { - console.log('RGBA_006 err' + error); + console.log('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0400 err' + error); expect(false).assertTrue(); done(); }) }) /** - * @tc.number : RGBA_007 + * @tc.number : SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0500 * @tc.name : create pixelmap-promise (editable: true, pixelFormat: ARGB_8888, * size: { height: 4, width: 6 }, bytes = buffer) * @tc.desc : 1.create InitializationOptions object @@ -215,7 +215,7 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('RGBA_007', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0500', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 1, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts) @@ -225,14 +225,14 @@ describe('Image', function () { done(); }) .catch(error => { - console.log('RGBA_007 err' + error); + console.log('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0500 err' + error); expect(false).assertTrue(); done(); }) }) /** - * @tc.number : RGBA_008 + * @tc.number : SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0300 * @tc.name : create pixelmap-callback (editable: true, pixelFormat: ALPHA_8, * size: { height: 4, width: 6 },bytes = buffer) * @tc.desc : 1.create InitializationOptions object @@ -243,12 +243,12 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('RGBA_008', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0300', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 6, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts, (err, pixelmap) => { if (err != undefined) { - console.info('RGBA_008 err: ' + err); + console.info('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0300 err: ' + err); expect(false).assertTrue(); done(); return; @@ -261,7 +261,7 @@ describe('Image', function () { }) /** - * @tc.number : RGBA_009 + * @tc.number : SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0400 * @tc.name : create pixelmap-callback (editable: true, pixelFormat: RGB_565, * size: { height: 4, width: 6 },bytes = buffer) * @tc.desc : 1.create InitializationOptions object @@ -272,12 +272,12 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('RGBA_009', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0400', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 2, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts, (err, pixelmap) => { if (err != undefined) { - console.info('RGBA_009 err: ' + err); + console.info('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0400 err: ' + err); expect(false).assertTrue(); done(); return; @@ -290,7 +290,7 @@ describe('Image', function () { }) /** - * @tc.number : RGBA_010 + * @tc.number : SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0500 * @tc.name : create pixelmap-callback (editable: true, pixelFormat: ARGB_8888, * size: { height: 4, width: 6 },bytes = buffer) * @tc.desc : 1.create InitializationOptions object @@ -301,12 +301,12 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('RGBA_010', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0500', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 1, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts, (err, pixelmap) => { if (err != undefined) { - console.info('RGBA_010 err: ' + err); + console.info('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0500 err: ' + err); expect(false).assertTrue(); done(); return; @@ -318,7 +318,7 @@ describe('Image', function () { }) /** - * @tc.number : RGBA_011 + * @tc.number : SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0600 * @tc.name : create pixelmap-callback(editable: true, pixelFormat: unkonwn, size: { height: -1, width: 8 }) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size @@ -328,14 +328,14 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('RGBA_011', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0600', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 0, size: { height: -1, width: 8 } } image.createPixelMap(Color, opts, (err, pixelmap) => { if (err) { - console.info('RGBA_011 err: ' + err); + console.info('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0600 err: ' + err); expect(pixelmap == undefined).assertTrue(); - console.info('RGBA_011 pass'); + console.info('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0600 pass'); done(); } else { expect(false).assertTrue(); @@ -345,7 +345,7 @@ describe('Image', function () { }) /** - * @tc.number : RGBA_012 + * @tc.number : SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0700 * @tc.name : create pixelmap-callback(editable: true, pixelFormat: ARGB_8888, size: { height: 6, width: -1 }) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size @@ -355,14 +355,14 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('RGBA_012', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0700', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 1, size: { height: 6, width: -1 } } image.createPixelMap(Color, opts, (err, pixelmap) => { if (err) { - console.info('RGBA_012 err: ' + err); + console.info('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0700 err: ' + err); expect(pixelmap == undefined).assertTrue(); - console.info('RGBA_012 pass'); + console.info('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0700 pass'); done(); } else { expect(false).assertTrue(); @@ -372,7 +372,7 @@ describe('Image', function () { }) /** - * @tc.number : RGBA_013 + * @tc.number : SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0600 * @tc.name : create pixelmap-promise(editable: true, pixelFormat: unkonwn, size: { height: -1, width: 8 }) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size @@ -382,22 +382,22 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('RGBA_013', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0600', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 0, size: { height: -1, width: 8 } } image.createPixelMap(Color, opts).then(pixelmap => { expect(false).assertTrue(); - console.info('RGBA_013 failed'); + console.info('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0600 failed'); done(); }).catch(error => { - console.log('RGBA_013 err: ' + error); + console.log('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0600 err: ' + error); expect(true).assertTrue(); done(); }) }) /** - * @tc.number : RGBA_014 + * @tc.number : SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0700 * @tc.name : create pixelmap-promise(editable: true, pixelFormat: unkonwn, size: { height: 6, width: -1 }) * @tc.desc : 1.create InitializationOptions object * 2.set editable,pixeFormat,size @@ -407,22 +407,22 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('RGBA_014', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0700', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 0, size: { height: 6, width: -1 } } image.createPixelMap(Color, opts).then(pixelmap => { expect(false).assertTrue(); - console.info('RGBA_014 failed'); + console.info('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0700 failed'); done(); }).catch(error => { - console.log('RGBA_014 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0700 error: ' + error); expect(true).assertTrue(); done(); }) }) /** - * @tc.number : RGBA_015 + * @tc.number : SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0800 * @tc.name : create pixelmap-promise (editable: true, pixelFormat: BGRA8888, * size: { height: 4, width: 6 }, bytes = buffer) * @tc.desc : 1.create InitializationOptions object @@ -433,25 +433,25 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('RGBA_015', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0800', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 4, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts) .then(pixelmap => { - console.log('RGBA_015 pixelFormat: 4'); + console.log('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0800 pixelFormat: 4'); expect(pixelmap != undefined).assertTrue(); expect(pixelmap.isEditable == opts.editable).assertTrue(); done(); }) .catch(error => { - console.log('RGBA_015 err: ' + error); + console.log('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_PROMISE_0800 err: ' + error); expect(false).assertTrue(); done(); }) }) /** - * @tc.number : RGBA_016 + * @tc.number : SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0800 * @tc.name : create pixelmap-callback (editable: true, pixelFormat: BGRA8888, * size: { height: 4, width: 6 },bytes = buffer) * @tc.desc : 1.create InitializationOptions object @@ -462,17 +462,17 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('RGBA_016', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0800', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 4, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts, (err, pixelmap) => { if (err != undefined) { - console.log('RGBA_016 err: ' + err); + console.log('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0800 err: ' + err); expect(false).assertTrue(); done(); return; } - console.log('RGBA_016 pixelFormat: image.PixelMapFormat.BGRA_8888'); + console.log('SUB_GRAPHIC_IMAGE_RGBA_CREATE_PIXELMAP_CALLBACK_0800 pixelFormat: image.PixelMapFormat.BGRA_8888'); expect(pixelmap != undefined).assertTrue(); expect(pixelmap.isEditable == opts.editable).assertTrue(); done(); diff --git a/multimedia/image/image_js_standard/imageRaw/BUILD.gn b/multimedia/image/image_js_standard/imageRaw/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..87b1b2160fde91b849a1119cb58f52ba34e9da1a --- /dev/null +++ b/multimedia/image/image_js_standard/imageRaw/BUILD.gn @@ -0,0 +1,35 @@ +# 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("image_raw_js_hap") { + hap_profile = "./src/main/config.json" + deps = [ + ":image_raw_js_assets", + ":image_raw_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsImageRawJsTest" + subsystem_name = "multimedia" + part_name = "multimedia_image_framework" +} +ohos_js_assets("image_raw_js_assets") { + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" +} +ohos_resources("image_raw_resources") { + sources = [ "./src/main/resources" ] + hap_profile = "./src/main/config.json" +} diff --git a/multimedia/image/image_js_standard/imageRaw/Test.json b/multimedia/image/image_js_standard/imageRaw/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..52ac7754a3c9d59cdfed8ac65607cdc59ed9d80d --- /dev/null +++ b/multimedia/image/image_js_standard/imageRaw/Test.json @@ -0,0 +1,55 @@ +{ + "description": "Configuration for Image Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "300000", + "shell-timeout": "120000", + "bundle-name": "ohos.acts.multimedia.image.Raw", + "package-name": "ohos.acts.multimedia.image.Raw" + }, + "kits": [ + { + "test-file-name": [ + "ActsImageRawJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.image.Raw/haps/entry/files/", + "chmod -R 666 /data/app/el2/100/base/ohos.acts.multimedia.image.Raw/haps/entry/files/*" + ], + "teardown-command":[ + + ] + }, + { + "type": "PushKit", + "pre-push": [], + "push": [ + + "./resource/image/test.nrw ->/data/app/el2/100/base/ohos.acts.multimedia.image.Raw/haps/entry/files", + "./resource/image/test.cr2 ->/data/app/el2/100/base/ohos.acts.multimedia.image.Raw/haps/entry/files", + "./resource/image/test_dng.dng ->/data/app/el2/100/base/ohos.acts.multimedia.image.Raw/haps/entry/files", + "./resource/image/test.cr3 ->/data/app/el2/100/base/ohos.acts.multimedia.image.Raw/haps/entry/files", + "./resource/image/test.arw ->/data/app/el2/100/base/ohos.acts.multimedia.image.Raw/haps/entry/files", + "./resource/image/test.pef ->/data/app/el2/100/base/ohos.acts.multimedia.image.Raw/haps/entry/files", + "./resource/image/test.raf ->/data/app/el2/100/base/ohos.acts.multimedia.image.Raw/haps/entry/files", + "./resource/image/test.rw2 ->/data/app/el2/100/base/ohos.acts.multimedia.image.Raw/haps/entry/files" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "hilog -Q pidoff", + "hilog -b D", + "chmod 777 /data/app/el2/100/base/ohos.acts.multimedia.image.Raw/haps/entry/files/*" + ], + "teardown-command": [ + "rm -rf /data/app/el2/100/base/ohos.acts.multimedia.image.Raw/*" + ] + } + ] +} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageRaw/signature/openharmony_sx.p7b b/multimedia/image/image_js_standard/imageRaw/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..d9fe0c1edd5ef09a357ed0bf05ed915a72278cca Binary files /dev/null and b/multimedia/image/image_js_standard/imageRaw/signature/openharmony_sx.p7b differ diff --git a/multimedia/image/image_js_standard/imageRaw/src/main/config.json b/multimedia/image/image_js_standard/imageRaw/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..99bae99c04ac6f686d3858c8d56cf68c24a6a487 --- /dev/null +++ b/multimedia/image/image_js_standard/imageRaw/src/main/config.json @@ -0,0 +1,133 @@ +{ + "app": { + "apiVersion": { + "compatible": 6, + "releaseType": "Beta1", + "target": 7 + }, + "vendor": "acts", + "bundleName": "ohos.acts.multimedia.image.Raw", + "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": [ + "default", + "phone", + "tablet", + "tv", + "wearable" + ], + "mainAbility": ".MainAbility", + "distro": { + "moduleType": "entry", + "installationFree": false, + "deliveryWithInstall": true, + "moduleName": "entry" + }, + "reqPermissions": [ + { + "name": "ohos.permission.GET_BUNDLE_INFO", + "reason": "use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason": "use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "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" + } + ], + "package": "ohos.acts.multimedia.image.Raw", + "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": "" + } +} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageRaw/src/main/js/MainAbility/app.js b/multimedia/image/image_js_standard/imageRaw/src/main/js/MainAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..8b3c3b3cb7930c465567b386bf230cb38a0d128e --- /dev/null +++ b/multimedia/image/image_js_standard/imageRaw/src/main/js/MainAbility/app.js @@ -0,0 +1,23 @@ +/* + * 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'); + } +}; \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageRaw/src/main/js/MainAbility/i18n/en-US.json b/multimedia/image/image_js_standard/imageRaw/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..0331845d4580b25c5af980f2ff65203583053b66 --- /dev/null +++ b/multimedia/image/image_js_standard/imageRaw/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/multimedia/image/image_js_standard/imageRaw/src/main/js/MainAbility/i18n/zh-CN.json b/multimedia/image/image_js_standard/imageRaw/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..9106b0897838e8e7600cd824146a7c2f8ee6c574 --- /dev/null +++ b/multimedia/image/image_js_standard/imageRaw/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageRaw/src/main/js/MainAbility/pages/index/index.css b/multimedia/image/image_js_standard/imageRaw/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..53b12aeee6149cbc85a51a69bdadb6a06c635dd3 --- /dev/null +++ b/multimedia/image/image_js_standard/imageRaw/src/main/js/MainAbility/pages/index/index.css @@ -0,0 +1,46 @@ +.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; + } +} \ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageRaw/src/main/js/MainAbility/pages/index/index.hml b/multimedia/image/image_js_standard/imageRaw/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..e7b706af9e044f0ef934e80c6c23ddabf25e2f7d --- /dev/null +++ b/multimedia/image/image_js_standard/imageRaw/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
\ No newline at end of file diff --git a/multimedia/image/image_js_standard/imageRaw/src/main/js/MainAbility/pages/index/index.js b/multimedia/image/image_js_standard/imageRaw/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..6e13f07516799a59adf5300cb7a609436db8122a --- /dev/null +++ b/multimedia/image/image_js_standard/imageRaw/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,29 @@ +/* + * 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 { + 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/multimedia/image/image_js_standard/imageRaw/src/main/js/TestAbility/app.js similarity index 100% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/app.js rename to multimedia/image/image_js_standard/imageRaw/src/main/js/TestAbility/app.js diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/i18n/en-US.json b/multimedia/image/image_js_standard/imageRaw/src/main/js/TestAbility/i18n/en-US.json similarity index 100% rename from distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/i18n/en-US.json rename to multimedia/image/image_js_standard/imageRaw/src/main/js/TestAbility/i18n/en-US.json diff --git a/distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/i18n/zh-CN.json b/multimedia/image/image_js_standard/imageRaw/src/main/js/TestAbility/i18n/zh-CN.json similarity index 100% rename from distributedschedule/dmsfwk/continuationmanagertest/src/main/js/TestAbility/i18n/zh-CN.json rename to multimedia/image/image_js_standard/imageRaw/src/main/js/TestAbility/i18n/zh-CN.json diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/pages/index/index.css b/multimedia/image/image_js_standard/imageRaw/src/main/js/TestAbility/pages/index/index.css similarity index 100% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/pages/index/index.css rename to multimedia/image/image_js_standard/imageRaw/src/main/js/TestAbility/pages/index/index.css diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/pages/index/index.hml b/multimedia/image/image_js_standard/imageRaw/src/main/js/TestAbility/pages/index/index.hml similarity index 100% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/pages/index/index.hml rename to multimedia/image/image_js_standard/imageRaw/src/main/js/TestAbility/pages/index/index.hml diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/pages/index/index.js b/multimedia/image/image_js_standard/imageRaw/src/main/js/TestAbility/pages/index/index.js similarity index 100% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/pages/index/index.js rename to multimedia/image/image_js_standard/imageRaw/src/main/js/TestAbility/pages/index/index.js diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/multimedia/image/image_js_standard/imageRaw/src/main/js/TestRunner/OpenHarmonyTestRunner.js similarity index 100% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/TestRunner/OpenHarmonyTestRunner.js rename to multimedia/image/image_js_standard/imageRaw/src/main/js/TestRunner/OpenHarmonyTestRunner.js diff --git a/multimedia/image/image_js_standard/imageRaw/src/main/js/test/List.test.js b/multimedia/image/image_js_standard/imageRaw/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..ed4fa8881a65078355bbbd7f42ea67953d810ada --- /dev/null +++ b/multimedia/image/image_js_standard/imageRaw/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 imageRaw from "./raw.test.js"; +export default function testsuite() { + imageRaw(); +} diff --git a/multimedia/image/image_js_standard/imageRaw/src/main/js/test/raw.test.js b/multimedia/image/image_js_standard/imageRaw/src/main/js/test/raw.test.js new file mode 100644 index 0000000000000000000000000000000000000000..80ae7cbcf39f0ff099951614a8e3ad67cd7f4aee --- /dev/null +++ b/multimedia/image/image_js_standard/imageRaw/src/main/js/test/raw.test.js @@ -0,0 +1,914 @@ +/* + * 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 image from "@ohos.multimedia.image"; +import fileio from "@ohos.fileio"; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import featureAbility from "@ohos.ability.featureAbility"; +export default function imageRaw() { + describe("imageRaw", function () { + const RGBA_8888 = image.PixelMapFormat.RGBA_8888; + let filePath; + let fdNumber; + async function getFd(fileName) { + let context = await featureAbility.getContext(); + await context.getFilesDir().then((data) => { + filePath = data + "/" + fileName; + console.info("image case filePath is " + filePath); + }); + await fileio + .open(filePath, 0o2, 0o777) + .then( + (data) => { + fdNumber = data; + console.info("image case open fd success " + fdNumber); + }, + (err) => { + console.info("image cese open fd fail" + err); + } + ) + .catch((err) => { + console.info("image case open fd err " + err); + }); + } + + beforeAll(async function () { + console.info("beforeAll case"); + }); + + beforeEach(function () { + console.info("beforeEach case"); + }); + + afterEach(async function () { + console.info("afterEach case"); + }); + + afterAll(async function () { + console.info("afterAll case"); + }); + + async function packingPromise(done, testNum, pixelmap, packOpts) { + console.info(`${testNum} packingPromise enter`); + try { + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info(`${testNum} packingPromise create image packer failed`); + expect(false).assertTrue(); + done(); + } else { + let packOptsFormat = `format:` + packOpts.format; + let packOptsQuality = `quality:` + packOpts.quality; + console.info( + `${testNum} packingPromise packOpts={` + packOptsFormat + `, ` + packOptsQuality + `}` + ); + imagePackerApi + .packing(pixelmap, packOpts) + .then((data) => { + console.info(`${testNum} packing finished`); + if (data != undefined) { + console.info(`${testNum} packing success`); + var dataArr = new Uint8Array(data); + console.info(`${testNum} packing show begin(length:` + dataArr.length + `)`); + var line = 0; + for (var i = 0; i < dataArr.length; i++) { + var str = `dataArr[` + i + `]=`; + for (var j = 0; j < 20 && i < dataArr.length; j++, i++) { + str = str + "," + dataArr[i]; + } + console.info(`${testNum} packing ` + str); + i--; + line++; + } + console.info(`${testNum} packing show end(line:` + line + `)`); + expect(true).assertTrue(); + done(); + } else { + console.info(`${testNum} packing failed`); + expect(false).assertTrue(); + done(); + } + }) + .catch((error) => { + console.log(`${testNum} packing error: ` + error); + expect(false).assertTrue(); + done(); + }); + } + } catch (error) { + console.info(`${testNum} packingPromise error: ` + error); + expect(false).assertTrue(); + done(); + } + console.info(`${testNum} packingPromise leave`); + } + + async function createPixelMapPromise(done, testNum, picName, decodeOpts, packFunc, packOpts) { + let imageSourceApi; + try { + await getFd(picName); + imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info(`${testNum} createPixelMapPromise create imagesource failed`); + expect(false).assertTrue(); + done(); + } else { + console.info(`${testNum} createPixelMapPromise create imagesource success`); + imageSourceApi + .createPixelMap(decodeOpts) + .then((pixelmap) => { + if (pixelmap != undefined) { + console.info(`${testNum} createPixelMap create pixelmap success`); + packFunc(done, testNum, pixelmap, packOpts); + } else { + console.info(`${testNum} createPixelMap create pixelmap failed`); + expect(false).assertTrue(); + done(); + } + }) + .catch((error) => { + console.log(`${testNum} createPixelMap err: ` + error); + expect(false).assertTrue(); + done(); + }); + } + } catch (error) { + console.info(`${testNum} error: ` + error); + expect(false).assertTrue(); + done(); + } + console.info(`${testNum} createPixelMapPromise leave`); + } + + async function createPixelMapCallBack(done, testNum, picName, decodeOpts, packFunc, packOpts) { + let imageSourceApi; + try { + await getFd(picName); + imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info(`${testNum} createPixelMapPromise create imagesource failed`); + expect(false).assertTrue(); + done(); + } else { + console.info(`${testNum} createPixelMapPromise create imagesource success`); + imageSourceApi.createPixelMap(decodeOpts, (err, pixelmap) => { + if (pixelmap != undefined) { + console.info(`${testNum} createPixelMap create pixelmap success`); + packFunc(done, testNum, pixelmap, packOpts); + } else { + console.info(`${testNum} createPixelMap create pixelmap failed err: ${err}`); + expect(false).assertTrue(); + done(); + } + }); + } + } catch (error) { + console.info(`${testNum} error: ` + error); + expect(false).assertTrue(); + done(); + } + console.info(`${testNum} createPixelMapPromise leave`); + } + + async function createPixelMapCallBackErr(done, testNum, picName, decodeOpts) { + let imageSourceApi; + try { + await getFd(picName); + imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info(`${testNum} createPixelMapPromise create imagesource failed`); + expect(false).assertTrue(); + done(); + } else { + console.info(`${testNum} createPixelMapPromise create imagesource success`); + imageSourceApi.createPixelMap(decodeOpts, (err, pixelmap) => { + if (pixelmap == undefined) { + expect(true).assertTrue(); + console.info(`${testNum} success: ` + err); + done(); + } else { + expect(false).assertTrue(); + done(); + } + }); + } + } catch (error) { + console.info(`${testNum} error: ` + error); + expect(false).assertTrue(); + done(); + } + console.info(`${testNum} createPixelMap leave`); + } + async function createPixelMapPromiseErr(done, testNum, picName, decodeOpts) { + let imageSourceApi; + try { + await getFd(picName); + imageSourceApi = image.createImageSource(fdNumber); + if (imageSourceApi == undefined) { + console.info(`${testNum} createPixelMapPromise create imagesource failed`); + expect(false).assertTrue(); + done(); + } else { + console.info(`${testNum} createPixelMapPromise create imagesource success`); + imageSourceApi + .createPixelMap(decodeOpts) + .then((pixelmap) => { + console.log(`${testNum} failed`); + expect(false).assertTrue(); + done(); + }) + .catch((error) => { + console.log(`${testNum} createPixelMap err: ` + error); + expect(true).assertTrue(); + done(); + }); + } + } catch (error) { + console.info(`${testNum} error: ` + error); + expect(false).assertTrue(); + done(); + } + console.info(`${testNum} createPixelMap leave`); + } + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_0100 + * @tc.name : createPixelMap - promise-arw + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * 4.packing + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it("SUB_GRAPHIC_IMAGE_RAW_0100", 0, async function (done) { + let decodeOpts = { + sampleSize: 1, + editable: true, + desiredSize: { width: 192, height: 108 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + index: 0, + }; + let packOpts = { format: ["image/webp"], quality: 100 }; + createPixelMapPromise(done, "SUB_GRAPHIC_IMAGE_RAW_0100", "test.arw", decodeOpts, packingPromise, packOpts); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_0200 + * @tc.name : createPixelMap - promise-cr2 + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * 4.packing + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_RAW_0200", 0, async function (done) { + let decodeOpts = { + sampleSize: 1, + editable: true, + desiredSize: { width: 160, height: 120 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + index: 0, + }; + let packOpts = { format: ["image/webp"], quality: 100 }; + createPixelMapPromise(done, "SUB_GRAPHIC_IMAGE_RAW_0200", "test.cr2", decodeOpts, packingPromise, packOpts); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_0300 + * @tc.name : createPixelMap - promise-dng + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * 4.packing + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 2 + */ + it("SUB_GRAPHIC_IMAGE_RAW_0300", 0, async function (done) { + let decodeOpts = { + sampleSize: 1, + editable: true, + desiredSize: { width: 160, height: 120 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + index: 0, + }; + let packOpts = { format: ["image/webp"], quality: 100 }; + createPixelMapPromise( + done, + "SUB_GRAPHIC_IMAGE_RAW_0300", + "test_dng.dng", + decodeOpts, + packingPromise, + packOpts + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_0400 + * @tc.name : createPixelMap - promise-nrw + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * 4.packing + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 2 + */ + it("SUB_GRAPHIC_IMAGE_RAW_0400", 0, async function (done) { + let decodeOpts = { + sampleSize: 1, + editable: true, + desiredSize: { width: 160, height: 120 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + index: 0, + }; + let packOpts = { format: ["image/webp"], quality: 100 }; + createPixelMapPromise(done, "SUB_GRAPHIC_IMAGE_RAW_0400", "test.nrw", decodeOpts, packingPromise, packOpts); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_0500 + * @tc.name : createPixelMap - promise-pef + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * 4.packing + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 2 + */ + it("SUB_GRAPHIC_IMAGE_RAW_0500", 0, async function (done) { + let decodeOpts = { + sampleSize: 1, + editable: true, + desiredSize: { width: 160, height: 120 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + index: 0, + }; + let packOpts = { format: ["image/webp"], quality: 100 }; + createPixelMapPromise(done, "SUB_GRAPHIC_IMAGE_RAW_0500", "test.pef", decodeOpts, packingPromise, packOpts); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_0600 + * @tc.name : createPixelMap - promise-raf + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * 4.packing + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 2 + */ + it("SUB_GRAPHIC_IMAGE_RAW_0600", 0, async function (done) { + let decodeOpts = { + sampleSize: 1, + editable: true, + desiredSize: { width: 160, height: 120 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + index: 0, + }; + let packOpts = { format: ["image/webp"], quality: 100 }; + createPixelMapPromise(done, "SUB_GRAPHIC_IMAGE_RAW_0600", "test.raf", decodeOpts, packingPromise, packOpts); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_0700 + * @tc.name : createPixelMap - promise-rw2 + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * 4.packing + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 2 + */ + it("SUB_GRAPHIC_IMAGE_RAW_0700", 0, async function (done) { + let decodeOpts = { + sampleSize: 1, + editable: true, + desiredSize: { width: 160, height: 120 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + index: 0, + }; + let packOpts = { format: ["image/webp"], quality: 100 }; + createPixelMapPromise(done, "SUB_GRAPHIC_IMAGE_RAW_0700", "test.rw2", decodeOpts, packingPromise, packOpts); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_0800 + * @tc.name : createPixelMap - callback-arw + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * 4.packing + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ + it("SUB_GRAPHIC_IMAGE_RAW_0800", 0, async function (done) { + let decodeOpts = { + sampleSize: 1, + editable: true, + desiredSize: { width: 192, height: 108 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + index: 0, + }; + let packOpts = { format: ["image/webp"], quality: 100 }; + createPixelMapCallBack( + done, + "SUB_GRAPHIC_IMAGE_RAW_0800", + "test.arw", + decodeOpts, + packingPromise, + packOpts + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_0900 + * @tc.name : createPixelMap - callback-cr2 + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * 4.packing + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_RAW_0900", 0, async function (done) { + let decodeOpts = { + sampleSize: 1, + editable: true, + desiredSize: { width: 160, height: 120 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + index: 0, + }; + let packOpts = { format: ["image/webp"], quality: 100 }; + createPixelMapCallBack( + done, + "SUB_GRAPHIC_IMAGE_RAW_0900", + "test.cr2", + decodeOpts, + packingPromise, + packOpts + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_1000 + * @tc.name : createPixelMap - callback-dng + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * 4.packing + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 2 + */ + it("SUB_GRAPHIC_IMAGE_RAW_1000", 0, async function (done) { + let decodeOpts = { + sampleSize: 1, + editable: true, + desiredSize: { width: 160, height: 120 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + index: 0, + }; + let packOpts = { format: ["image/webp"], quality: 100 }; + createPixelMapCallBack( + done, + "SUB_GRAPHIC_IMAGE_RAW_1000", + "test_dng.dng", + decodeOpts, + packingPromise, + packOpts + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_1100 + * @tc.name : createPixelMap - callback-nrw + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * 4.packing + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 2 + */ + it("SUB_GRAPHIC_IMAGE_RAW_1100", 0, async function (done) { + let decodeOpts = { + sampleSize: 1, + editable: true, + desiredSize: { width: 160, height: 120 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + index: 0, + }; + let packOpts = { format: ["image/webp"], quality: 100 }; + createPixelMapCallBack( + done, + "SUB_GRAPHIC_IMAGE_RAW_1100", + "test.nrw", + decodeOpts, + packingPromise, + packOpts + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_1200 + * @tc.name : createPixelMap - callback-pef + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * 4.packing + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 2 + */ + it("SUB_GRAPHIC_IMAGE_RAW_1200", 0, async function (done) { + let decodeOpts = { + sampleSize: 1, + editable: true, + desiredSize: { width: 160, height: 120 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + index: 0, + }; + let packOpts = { format: ["image/webp"], quality: 100 }; + createPixelMapCallBack( + done, + "SUB_GRAPHIC_IMAGE_RAW_1200", + "test.pef", + decodeOpts, + packingPromise, + packOpts + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_1300 + * @tc.name : createPixelMap - callback-raf + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * 4.packing + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 2 + */ + it("SUB_GRAPHIC_IMAGE_RAW_1300", 0, async function (done) { + let decodeOpts = { + sampleSize: 1, + editable: true, + desiredSize: { width: 160, height: 120 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + index: 0, + }; + let packOpts = { format: ["image/webp"], quality: 100 }; + createPixelMapCallBack( + done, + "SUB_GRAPHIC_IMAGE_RAW_1300", + "test.raf", + decodeOpts, + packingPromise, + packOpts + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_1400 + * @tc.name : createPixelMap - callback-rw2 + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * 4.packing + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 2 + */ + it("SUB_GRAPHIC_IMAGE_RAW_1400", 0, async function (done) { + let decodeOpts = { + sampleSize: 1, + editable: true, + desiredSize: { width: 160, height: 120 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + index: 0, + }; + let packOpts = { format: ["image/webp"], quality: 100 }; + createPixelMapCallBack( + done, + "SUB_GRAPHIC_IMAGE_RAW_1400", + "test.rw2", + decodeOpts, + packingPromise, + packOpts + ); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_1500 + * @tc.name : createPixelMap - callback-arw + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 3 + */ + it("SUB_GRAPHIC_IMAGE_RAW_1500", 0, async function (done) { + let decodingOption = { + sampleSize: -1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index: 0, + }; + await createPixelMapCallBackErr(done, "SUB_GRAPHIC_IMAGE_RAW_1500", "test.arw", decodingOption); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_1600 + * @tc.name : createPixelMap - callback-arw + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 3 + */ + it("SUB_GRAPHIC_IMAGE_RAW_1600", 0, async function (done) { + let decodingOption = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index: -1, + }; + await createPixelMapCallBackErr(done, "SUB_GRAPHIC_IMAGE_RAW_1600", "test.arw", decodingOption); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_1700 + * @tc.name : createPixelMap - callback-arw + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 3 + */ + it("SUB_GRAPHIC_IMAGE_RAW_1700", 0, async function (done) { + let decodingOption = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 500, + desiredPixelFormat: RGBA_8888, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index: 0, + }; + await createPixelMapCallBackErr(done, "SUB_GRAPHIC_IMAGE_RAW_1700", "test.arw", decodingOption); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_1800 + * @tc.name : createPixelMap - callback-arw + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 3 + */ + it("SUB_GRAPHIC_IMAGE_RAW_1800", 0, async function (done) { + let decodingOption = { + sampleSize: 1, + editable: false, + desiredSize: { width: 1, height: 2 }, + rotate: 0, + desiredPixelFormat: 33, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index: 0, + }; + await createPixelMapCallBackErr(done, "SUB_GRAPHIC_IMAGE_RAW_1800", "test.arw", decodingOption); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_1900 + * @tc.name : createPixelMap - callback-arw + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 3 + */ + it("SUB_GRAPHIC_IMAGE_RAW_1900", 0, async function (done) { + let decodingOption = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + desiredRegion: { size: { height: 1, width: 2 }, x: 10000, y: 0 }, + index: 0, + }; + await createPixelMapCallBackErr(done, "SUB_GRAPHIC_IMAGE_RAW_1900", "test.arw", decodingOption); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_2000 + * @tc.name : createPixelMap - callback-arw + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 3 + */ + it("SUB_GRAPHIC_IMAGE_RAW_2000", 0, async function (done) { + let decodingOption = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 10000 }, + index: 0, + }; + await createPixelMapCallBackErr(done, "SUB_GRAPHIC_IMAGE_RAW_2000", "test.arw", decodingOption); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_2100 + * @tc.name : createPixelMap - promise-arw + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 3 + */ + it("SUB_GRAPHIC_IMAGE_RAW_2100", 0, async function (done) { + let decodingOption = { + sampleSize: -1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index: 0, + }; + await createPixelMapPromiseErr(done, "SUB_GRAPHIC_IMAGE_RAW_2100", "test.arw", decodingOption); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_2200 + * @tc.name : createPixelMap - promise-arw + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 3 + */ + it("SUB_GRAPHIC_IMAGE_RAW_2200", 0, async function (done) { + let decodingOption = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index: -1, + }; + await createPixelMapPromiseErr(done, "SUB_GRAPHIC_IMAGE_RAW_2200", "test.arw", decodingOption); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_2300 + * @tc.name : createPixelMap - promise-arw + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 3 + */ + it("SUB_GRAPHIC_IMAGE_RAW_2300", 0, async function (done) { + let decodingOption = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 500, + desiredPixelFormat: RGBA_8888, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index: 0, + }; + await createPixelMapPromiseErr(done, "SUB_GRAPHIC_IMAGE_RAW_2300", "test.arw", decodingOption); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_2400 + * @tc.name : createPixelMap - promise-arw + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 3 + */ + it("SUB_GRAPHIC_IMAGE_RAW_2400", 0, async function (done) { + let decodingOption = { + sampleSize: 1, + editable: false, + desiredSize: { width: 1, height: 2 }, + rotate: 0, + desiredPixelFormat: 33, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index: 0, + }; + await createPixelMapPromiseErr(done, "SUB_GRAPHIC_IMAGE_RAW_2400", "test.arw", decodingOption); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_2500 + * @tc.name : createPixelMap - promise-arw + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 3 + */ + it("SUB_GRAPHIC_IMAGE_RAW_2500", 0, async function (done) { + let decodingOption = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + desiredRegion: { size: { height: 1, width: 2 }, x: 10000, y: 0 }, + index: 0, + }; + await createPixelMapPromiseErr(done, "SUB_GRAPHIC_IMAGE_RAW_2500", "test.arw", decodingOption); + }); + + /** + * @tc.number : SUB_GRAPHIC_IMAGE_RAW_2600 + * @tc.name : createPixelMap - promise-arw + * @tc.desc : 1.create imagesource + * 2.set DecodeOptions + * 3.create PixelMap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 3 + */ + it("SUB_GRAPHIC_IMAGE_RAW_2600", 0, async function (done) { + let decodingOption = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 10000 }, + index: 0, + }; + await createPixelMapPromiseErr(done, "SUB_GRAPHIC_IMAGE_RAW_2600", "test.arw", decodingOption); + }); + }); +} diff --git a/multimedia/image/image_js_standard/imageRaw/src/main/resources/base/element/string.json b/multimedia/image/image_js_standard/imageRaw/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..1d7bac3ea9bb0e76919191be613c4c14d712914e --- /dev/null +++ b/multimedia/image/image_js_standard/imageRaw/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "ImageJSTestMain" + }, + { + "name": "mainability_description", + "value": "ImageJSTestMain 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 diff --git a/multimedia/image/image_js_standard/imageRaw/src/main/resources/base/media/icon.png b/multimedia/image/image_js_standard/imageRaw/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/image/image_js_standard/imageRaw/src/main/resources/base/media/icon.png differ diff --git a/multimedia/image/image_js_standard/imageReceiver/BUILD.gn b/multimedia/image/image_js_standard/imageReceiver/BUILD.gn index 8c779c2616b1d7bf90899f4dc6b8ef6b4ac6a00f..f44047d531263f940675007c4877ae03eb4b7e51 100644 --- a/multimedia/image/image_js_standard/imageReceiver/BUILD.gn +++ b/multimedia/image/image_js_standard/imageReceiver/BUILD.gn @@ -22,7 +22,7 @@ ohos_js_hap_suite("image_receiver_js_hap") { certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsImageReceiverJsTest" subsystem_name = "multimedia" - part_name = "multimedia_image_standard" + part_name = "multimedia_image_framework" } ohos_js_assets("image_receiver_js_assets") { js2abc = true diff --git a/multimedia/image/image_js_standard/imageReceiver/src/main/config.json b/multimedia/image/image_js_standard/imageReceiver/src/main/config.json index e903d15b2b7c934ddf820ec211fdc7166987fc64..88dd614879bd7242c86383436c06cd7d7f65831c 100644 --- a/multimedia/image/image_js_standard/imageReceiver/src/main/config.json +++ b/multimedia/image/image_js_standard/imageReceiver/src/main/config.json @@ -57,6 +57,7 @@ } ], "deviceType": [ + "default", "phone", "tablet", "tv", diff --git a/multimedia/image/image_js_standard/imageReceiver/src/main/js/test/receiver.test.js b/multimedia/image/image_js_standard/imageReceiver/src/main/js/test/receiver.test.js index cfef2593967f4040e156808e90c1128cced16526..52afa6105f51aefb1e7ba294b2aaac0ca0b6ffbe 100644 --- a/multimedia/image/image_js_standard/imageReceiver/src/main/js/test/receiver.test.js +++ b/multimedia/image/image_js_standard/imageReceiver/src/main/js/test/receiver.test.js @@ -1,5 +1,5 @@ /* - * 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 @@ -28,8 +28,6 @@ describe('ImageReceiver', function () { const CAPACITY = 8; const YCBCR_422_SP = 1000; const FORMATJPEG = 2000; - let globalreceiver; - let globalimg; beforeAll(async function () { console.info('beforeAll case'); @@ -40,22 +38,6 @@ describe('ImageReceiver', function () { }) afterEach(async function () { - if (globalreceiver != undefined) { - console.info('globalreceiver release start'); - try { - await globalreceiver.release(); - } catch (error) { - console.info('globalreceiver release fail'); - } - } - if (globalimg != undefined) { - try { - console.info('globalimg release start'); - await globalimg.release(); - } catch (error) { - console.info('globalimg release fail'); - } - } console.info('afterEach case'); }) @@ -74,57 +56,53 @@ describe('ImageReceiver', function () { done(); } catch (error) { expect(error.code == 1).assertTrue(); - console.info(`${testNum} err message: ` + error); + console.info(`${testNum} err message` + error); done(); } } async function getComponentProErr(done, testNum, param) { var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY); - globalreceiver = receiver; let once = false; if (receiver == undefined) { expect(false).assertTrue(); done(); } else { receiver.on('imageArrival', () => { - if (once) { - return; - } - once = true; - receiver.readLatestImage(async (err, img) => { - globalimg = img; - if (img == undefined) { + if (once) { + return; + } + once = true; + receiver.readLatestImage(async (err, img) => { + if (img == undefined) { + expect(false).assertTrue(); + done(); + } else { + expect(img.size.width == WIDTH).assertTrue(); + expect(img.size.height == HEIGHT).assertTrue(); + expect(img.format == 12).assertTrue(); + expect(img.clipRect.size.width == WIDTH).assertTrue(); + expect(img.clipRect.size.height == HEIGHT).assertTrue(); + expect(img.clipRect.x == 0).assertTrue(); + expect(img.clipRect.y == 0).assertTrue(); + try { + await img.getComponent(param); expect(false).assertTrue(); + } catch (error) { + expect(error.code == 1).assertTrue(); + console.log(`${testNum} error msg: ` + error); done(); - } else { - expect(img.size.width == WIDTH).assertTrue(); - expect(img.size.height == HEIGHT).assertTrue(); - expect(img.format == 12).assertTrue(); - expect(img.clipRect.size.width == WIDTH).assertTrue(); - expect(img.clipRect.size.height == HEIGHT).assertTrue(); - expect(img.clipRect.x == 0).assertTrue(); - expect(img.clipRect.y == 0).assertTrue(); - try { - await img.getComponent(param); - expect(false).assertTrue(); - done(); - } catch (error) { - expect(error.code == 1).assertTrue(); - console.log(`${testNum} error msg: ` + error); - done(); - } } - }) - expect(true).assertTrue(); + } }) - var dummy = receiver.test; + expect(true).assertTrue(); + }) + var dummy = receiver.test; } } async function getComponentCbErr(done, testNum, param) { var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY); - globalreceiver = receiver; let once = false; if (receiver == undefined) { expect(false).assertTrue(); @@ -136,7 +114,6 @@ describe('ImageReceiver', function () { } once = true; receiver.readLatestImage(async (err, img) => { - globalimg = img; if (img == undefined) { expect(false).assertTrue(); done(); @@ -151,7 +128,6 @@ describe('ImageReceiver', function () { try { img.getComponent(param, (err, component) => { expect(false).assertTrue(); - done(); }) } catch (error) { expect(error.code == 1).assertTrue(); @@ -166,9 +142,8 @@ describe('ImageReceiver', function () { } } - async function getComponentPromise(done, testNum, param, checkFormat, checkStride) { - var receiver = image.createImageReceiver(WIDTH, HEIGHT, YCBCR_422_SP, CAPACITY); - globalreceiver = receiver; + async function getComponentP(done, testNum, param) { + var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY); let once = false; if (receiver == undefined) { expect(false).assertTrue(); @@ -181,19 +156,18 @@ describe('ImageReceiver', function () { } once = true; receiver.readLatestImage((err, img) => { - globalimg = img; if (err) { expect(false).assertTrue(); done(); } else { expect(img.size.width == WIDTH).assertTrue(); expect(img.size.height == HEIGHT).assertTrue(); - checkFormat(img.format); + expect(img.format == 12).assertTrue(); expect(img.clipRect.size.width == WIDTH).assertTrue(); expect(img.clipRect.size.height == HEIGHT).assertTrue(); expect(img.clipRect.x == 0).assertTrue(); expect(img.clipRect.y == 0).assertTrue(); - console.info(`${testNum} ${param} img.format: ${img.format}`); + img.getComponent(param).then(component => { if (component == undefined) { expect(false).assertTrue(); @@ -201,7 +175,8 @@ describe('ImageReceiver', function () { } else { expect(component.componentType == param).assertTrue(); expect(component.byteBuffer != undefined).assertTrue(); - checkStride(component.rowStride, component.pixelStride); + expect(component.rowStride == 0).assertTrue(); + expect(component.pixelStride == 0).assertTrue(); done(); } }).catch(error => { @@ -213,16 +188,11 @@ describe('ImageReceiver', function () { }) expect(true).assertTrue(); }) - if (param == JPEG) { - var dummy = receiver.test - } else { - var dummy = receiver.testYUV; - } + var dummy = receiver.test; } - async function getComponentCb(done, testNum, param, checkFormat, checkStride) { - var receiver = image.createImageReceiver(WIDTH, HEIGHT, YCBCR_422_SP, CAPACITY); - globalreceiver = receiver; + async function getComponentCb(done, testNum, param) { + var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY); let once = false; if (receiver == undefined) { expect(false).assertTrue(); @@ -236,29 +206,28 @@ describe('ImageReceiver', function () { } once = true; receiver.readLatestImage((err, img) => { - globalimg = img; if (err) { expect(false).assertTrue(); done(); } else { expect(img.size.width == WIDTH).assertTrue(); expect(img.size.height == HEIGHT).assertTrue(); - checkFormat(img.format); + expect(img.format == 12).assertTrue(); expect(img.clipRect.size.width == WIDTH).assertTrue(); expect(img.clipRect.size.height == HEIGHT).assertTrue(); expect(img.clipRect.x == 0).assertTrue(); expect(img.clipRect.y == 0).assertTrue(); - console.info(`${testNum} ${param} img.format: ${img.format}`); + img.getComponent(param, (err, component) => { if (err) { expect(false).assertTrue(); - console.log(`${testNum} geterror: ` + err); - done(); + console.log(`${testNum} geterror: ` + err) } else { expect(component != undefined).assertTrue(); expect(component.componentType == param).assertTrue(); expect(component.byteBuffer != undefined).assertTrue(); - checkStride(component.rowStride, component.pixelStride); + expect(component.rowStride == 0).assertTrue(); + expect(component.pixelStride == 0).assertTrue(); done(); } }) @@ -266,18 +235,11 @@ describe('ImageReceiver', function () { }) expect(true).assertTrue(); }) - if (param == JPEG) { - console.info(`${testNum} ${param} `) - var dummy = receiver.test - } else { - console.info(`${testNum} ${param} `) - var dummy = receiver.testYUV; - } + var dummy = receiver.test; } async function onErr(done, testNum, param) { - var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY); - globalreceiver = receiver; + var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY) expect(receiver != undefined).assertTrue(); if (receiver == undefined) { expect(false).assertTrue(); @@ -302,7 +264,7 @@ describe('ImageReceiver', function () { } /** - * @tc.number : Receiver_001 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_0100 * @tc.name : createImageReceiver * @tc.desc : 1.set width,height,format,capacity * 2.create ImageReceiver @@ -311,9 +273,8 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_001', 0, async function (done) { - var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY); - globalreceiver = receiver; + it('SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_0100', 0, async function (done) { + var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY) if (receiver == undefined) { expect(false).assertTrue(); console.info('receiver_001 undefined') @@ -328,7 +289,7 @@ describe('ImageReceiver', function () { }) /** - * @tc.number : Receiver_001-1 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_0200 * @tc.name : createImageReceiver * @tc.desc : 1.set width,height,format,capacity * 2.create ImageReceiver @@ -337,12 +298,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_001-1', 0, async function (done) { - createRecriver(done, 'Receiver_001-1', WIDTH, HEIGHT, FORMAT, 'hd!') + it('SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_0200', 0, async function (done) { + createRecriver(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_0200', WIDTH, HEIGHT, FORMAT, 'hd!') }) /** - * @tc.number : Receiver_001-2 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0100 * @tc.name : createImageReceiver-wrong format * @tc.desc : 1.set width,height,format,capacity * 2.create ImageReceiver @@ -351,12 +312,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_001-2', 0, async function (done) { - createRecriver(done, 'Receiver_001-2', WIDTH, HEIGHT, null, CAPACITY) + it('SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0100', 0, async function (done) { + createRecriver(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0100', WIDTH, HEIGHT, null, CAPACITY) }) /** - * @tc.number : Receiver_001-3 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0200 * @tc.name : createImageReceiver-wrong height * @tc.desc : 1.set width,height,format,capacity * 2.create ImageReceiver @@ -365,12 +326,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_001-3', 0, async function (done) { - createRecriver(done, 'Receiver_001-3', WIDTH, null, FORMAT, CAPACITY) + it('SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0200', 0, async function (done) { + createRecriver(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0200', WIDTH, null, FORMAT, CAPACITY) }) /** - * @tc.number : Receiver_001-4 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0300 * @tc.name : createImageReceiver-wrong width * @tc.desc : 1.set width,height,format,capacity * 2.create ImageReceiver @@ -379,12 +340,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_001-4', 0, async function (done) { - createRecriver(done, 'Receiver_001-4', null, HEIGHT, FORMAT, CAPACITY) + it('SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0300', 0, async function (done) { + createRecriver(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0300', null, HEIGHT, FORMAT, CAPACITY) }) /** - * @tc.number : Receiver_001-5 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0400 * @tc.name : createImageReceiver-wrong capacity * @tc.desc : 1.set width,height,format,capacity * 2.create ImageReceiver @@ -393,12 +354,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_001-5', 0, async function (done) { - createRecriver(done, 'Receiver_001-5', WIDTH, HEIGHT, FORMAT, null) + it('SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0400', 0, async function (done) { + createRecriver(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0400', WIDTH, HEIGHT, FORMAT, null) }) /** - * @tc.number : Receiver_001-6 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0500 * @tc.name : createImageReceiver-wrong width * @tc.desc : 1.set width,height,format,capacity * 2.create ImageReceiver @@ -407,12 +368,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_001-6', 0, async function (done) { - createRecriver(done, 'Receiver_001-6', false, HEIGHT, FORMAT, CAPACITY) + it('SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0500', 0, async function (done) { + createRecriver(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0500', false, HEIGHT, FORMAT, CAPACITY) }) /** - * @tc.number : Receiver_001-7 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0600 * @tc.name : createImageReceiver- wrong width * @tc.desc : 1.set width,height,format,capacity * 2.create ImageReceiver @@ -421,12 +382,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_001-7', 0, async function (done) { - createRecriver(done, 'Receiver_001-7', { a: 10 }, HEIGHT, FORMAT, CAPACITY) + it('SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0600', 0, async function (done) { + createRecriver(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0600', { a: 10 }, HEIGHT, FORMAT, CAPACITY) }) /** - * @tc.number : Receiver_001-8 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_0300 * @tc.name : createImageReceiver * @tc.desc : 1.set width,height,format,capacity * 2.create ImageReceiver @@ -435,12 +396,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_001-8', 0, async function (done) { - createRecriver(done, 'Receiver_001-8', WIDTH, false, FORMAT, CAPACITY) + it('SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_0300', 0, async function (done) { + createRecriver(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_0300', WIDTH, false, FORMAT, CAPACITY) }) /** - * @tc.number : Receiver_001-9 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0700 * @tc.name : createImageReceiver- wrong format * @tc.desc : 1.set width,height,format,capacity * 2.create ImageReceiver @@ -449,12 +410,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_001-9', 0, async function (done) { - createRecriver(done, 'Receiver_001-9', WIDTH, HEIGHT, 'form.', CAPACITY) + it('SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0700', 0, async function (done) { + createRecriver(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_ERROR_0700', WIDTH, HEIGHT, 'form.', CAPACITY) }) /** - * @tc.number : Receiver_001-10 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_0400 * @tc.name : createImageReceiver * @tc.desc : 1.set width,height,format,capacity * 2.create ImageReceiver @@ -463,12 +424,11 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_001-10', 0, async function (done) { - var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMATJPEG, CAPACITY); - globalreceiver = receiver; + it('SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_0400', 0, async function (done) { + var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMATJPEG, CAPACITY) if (receiver == undefined) { expect(false).assertTrue(); - console.info('Receiver_001-10 undefined') + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_0400 undefined') done(); } else { expect(receiver.size.width == WIDTH).assertTrue(); @@ -480,7 +440,7 @@ describe('ImageReceiver', function () { }) /** - * @tc.number : Receiver_001-11 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_0500 * @tc.name : createImageReceiver * @tc.desc : 1.set width,height,format,capacity * 2.create ImageReceiver @@ -489,12 +449,11 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_001-11', 0, async function (done) { - var receiver = image.createImageReceiver(WIDTH, HEIGHT, YCBCR_422_SP, CAPACITY); - globalreceiver = receiver; + it('SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_0500', 0, async function (done) { + var receiver = image.createImageReceiver(WIDTH, HEIGHT, YCBCR_422_SP, CAPACITY) if (receiver == undefined) { expect(false).assertTrue(); - console.info('Receiver_001-11 undefined') + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_CREATEIMAGERECEIVER_0500 undefined') done(); } else { expect(receiver.size.width == WIDTH).assertTrue(); @@ -506,7 +465,7 @@ describe('ImageReceiver', function () { }) /** - * @tc.number : Receiver_002 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_GETRECEIVINGSURFACEID_PROMISE_0100 * @tc.name : getReceivingSurfaceId-promise * @tc.desc : 1.create ImageReceiver * 2.call getReceivingSurfaceId @@ -515,16 +474,15 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_002', 0, async function (done) { - var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY); - globalreceiver = receiver; + it('SUB_GRAPHIC_IMAGE_RECEIVER_GETRECEIVINGSURFACEID_PROMISE_0100', 0, async function (done) { + var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY) if (receiver != undefined) { receiver.getReceivingSurfaceId().then(id => { - console.info('Receiver_002 getReceivingSurfaceId [' + id + "]"); + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_GETRECEIVINGSURFACEID_PROMISE_0100 getReceivingSurfaceId [' + id + "]"); expect(isString(id)).assertTrue(); done(); }).catch(error => { - console.log('Receiver_002 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_RECEIVER_GETRECEIVINGSURFACEID_PROMISE_0100 error: ' + error); expect(false).assertTrue(); done(); }) @@ -535,7 +493,7 @@ describe('ImageReceiver', function () { }) /** - * @tc.number : Receiver_003 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_GETRECEIVINGSURFACEID_CALLBACK_0100 * @tc.name : getReceivingSurfaceId-callback * @tc.desc : 1.create ImageReceiver * 2.call getReceivingSurfaceId @@ -544,24 +502,23 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_003', 0, async function (done) { - var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY); - globalreceiver = receiver; + it('SUB_GRAPHIC_IMAGE_RECEIVER_GETRECEIVINGSURFACEID_CALLBACK_0100', 0, async function (done) { + var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY) if (receiver != undefined) { receiver.getReceivingSurfaceId((err, id) => { - console.info('Receiver_003 getReceivingSurfaceId call back [' + id + "]"); + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_GETRECEIVINGSURFACEID_CALLBACK_0100 getReceivingSurfaceId call back [' + id + "]"); expect(isString(id)).assertTrue(); done(); }); } else { expect(false).assertTrue(); - console.info('Receiver_003 finished'); + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_GETRECEIVINGSURFACEID_CALLBACK_0100 finished'); done() } }) /** - * @tc.number : Receiver_004 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_RELEASE_PROMISE_0100 * @tc.name : release-promise * @tc.desc : 1.create ImageReceiver * 2.call release @@ -569,12 +526,11 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_004', 0, async function (done) { - var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY); - globalreceiver = receiver; + it('SUB_GRAPHIC_IMAGE_RECEIVER_RELEASE_PROMISE_0100', 0, async function (done) { + var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY) if (receiver != undefined) { receiver.release().then(() => { - console.info('Receiver_004 release '); + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_RELEASE_PROMISE_0100 release '); expect(true).assertTrue(); done(); }).catch(error => { @@ -583,13 +539,13 @@ describe('ImageReceiver', function () { }) } else { expect(false).assertTrue(); - console.info('Receiver_004 finished'); + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_RELEASE_PROMISE_0100 finished'); done() } }) /** - * @tc.number : Receiver_005 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_RELEASE_CALLBACK_0100 * @tc.name : release-callback * @tc.desc : 1.create ImageReceiver * 2.call release @@ -597,30 +553,29 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_005', 0, async function (done) { - var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY); - globalreceiver = receiver; + it('SUB_GRAPHIC_IMAGE_RECEIVER_RELEASE_CALLBACK_0100', 0, async function (done) { + var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY) if (receiver != undefined) { receiver.release((err) => { if (err) { expect(false).assertTrue(); - console.info('Receiver_005 release fail'); - done(); + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_RELEASE_CALLBACK_0100 release fail'); + done() } else { - console.info('Receiver_005 release call back'); + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_RELEASE_CALLBACK_0100 release call back'); expect(true).assertTrue(); done(); } }); } else { expect(false).assertTrue(); - console.info('Receiver_005 finished'); - done(); + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_RELEASE_CALLBACK_0100 finished'); + done() } }) /** - * @tc.number : Receiver_006 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_READLATESTIMAGE_PROMISE_0100 * @tc.name : readLatestImage-promise * @tc.desc : 1.create ImageReceiver * 2.call readLatestImage @@ -629,30 +584,28 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_006', 0, async function (done) { - var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY); - globalreceiver = receiver; + it('SUB_GRAPHIC_IMAGE_RECEIVER_READLATESTIMAGE_PROMISE_0100', 0, async function (done) { + var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY) var dummy = receiver.test; if (receiver != undefined) { receiver.readLatestImage().then(img => { - globalimg = img; - console.info('Receiver_006 readLatestImage Success'); + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_READLATESTIMAGE_PROMISE_0100 readLatestImage Success'); expect(img != undefined).assertTrue(); done(); }).catch(error => { - console.log('Receiver_006 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_RECEIVER_READLATESTIMAGE_PROMISE_0100 error: ' + error); expect(false).assertTrue(); done(); }) } else { expect(false).assertTrue(); - console.info('Receiver_006 finished'); - done(); + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_READLATESTIMAGE_PROMISE_0100 finished'); + done() } }) /** - * @tc.number : Receiver_007 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_READLATESTIMAGE_CALLBACK_0100 * @tc.name : readLatestImage-callback * @tc.desc : 1.create ImageReceiver * 2.call readLatestImage @@ -661,26 +614,24 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_007', 0, async function (done) { - var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY); - globalreceiver = receiver; + it('SUB_GRAPHIC_IMAGE_RECEIVER_READLATESTIMAGE_CALLBACK_0100', 0, async function (done) { + var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY) var dummy = receiver.test; if (receiver != undefined) { receiver.readLatestImage((err, img) => { - globalimg = img; - console.info('Receiver_007 readLatestImage call back Success'); + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_READLATESTIMAGE_CALLBACK_0100 readLatestImage call back Success'); expect(img != undefined).assertTrue(); done(); }); } else { expect(false).assertTrue(); - console.info('Receiver_007 finished'); + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_READLATESTIMAGE_CALLBACK_0100 finished'); done(); } }) /** - * @tc.number : Receiver_008 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_READNEXTIMAGE_PROMISE_0100 * @tc.name : readNextImage-promise * @tc.desc : 1.create ImageReceiver * 2.call readNextImage @@ -689,31 +640,29 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_008', 0, async function (done) { - var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY); - globalreceiver = receiver; + it('SUB_GRAPHIC_IMAGE_RECEIVER_READNEXTIMAGE_PROMISE_0100', 0, async function (done) { + var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY) var dummy = receiver.test; expect(receiver != undefined).assertTrue(); if (receiver != undefined) { receiver.readNextImage().then(img => { - globalimg = img; - console.info('Receiver_008 readNextImage Success'); + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_READNEXTIMAGE_PROMISE_0100 readNextImage Success'); expect(img != undefined).assertTrue(); done() }).catch(error => { - console.log('Receiver_008 error: ' + error); + console.log('SUB_GRAPHIC_IMAGE_RECEIVER_READNEXTIMAGE_PROMISE_0100 error: ' + error); expect(false).assertTrue(); done(); }) } else { expect(false).assertTrue(); - console.info('Receiver_008 finished'); + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_READNEXTIMAGE_PROMISE_0100 finished'); done(); } }) /** - * @tc.number : Receiver_009 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_READNEXTIMAGE_CALLBACK_0100 * @tc.name : readNextImage-callback * @tc.desc : 1.create ImageReceiver * 2.call readNextImage @@ -722,18 +671,15 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_009', 0, async function (done) { - var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY); - globalreceiver = receiver; + it('SUB_GRAPHIC_IMAGE_RECEIVER_READNEXTIMAGE_CALLBACK_0100', 0, async function (done) { + var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY) var dummy = receiver.test; if (receiver != undefined) { receiver.readNextImage((err, img) => { - globalimg = img; if (err) { expect(false).assertTrue(); - done(); } else { - console.info('Receiver_009 readNextImage call back Success'); + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_READNEXTIMAGE_CALLBACK_0100 readNextImage call back Success'); expect(img != undefined).assertTrue(); done(); } @@ -741,13 +687,13 @@ describe('ImageReceiver', function () { }) } else { expect(false).assertTrue(); - console.info('Receiver_009 finished'); + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_READNEXTIMAGE_CALLBACK_0100 finished'); done(); } }) /** - * @tc.number : Receiver_010 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_PROMISE_JPEG_0100 * @tc.name : getComponent-jpeg * @tc.desc : 1.create ImageReceiver * 2.call on @@ -757,19 +703,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_010', 0, async function (done) { - function checkFormat(format) { - expect(format == 12).assertTrue(); - } - function checkStride(rowStride, pixelStride) { - expect(rowStride == 8192).assertTrue(); - expect(pixelStride == 1).assertTrue(); - } - getComponentPromise(done, 'Receiver_010', JPEG, checkFormat, checkStride) + it('SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_PROMISE_JPEG_0100', 0, async function (done) { + getComponentP(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_PROMISE_JPEG_0100', JPEG) }) /** - * @tc.number : Receiver_010_1 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_PROMISE_YUV_U_0100 * @tc.name : getComponent-YUV_U * @tc.desc : 1.create ImageReceiver * 2.call on @@ -779,19 +718,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_010_1', 0, async function (done) { - function checkFormat(format) { - expect(format == 22).assertTrue(); - } - function checkStride(rowStride, pixelStride) { - expect(rowStride == 4096).assertTrue(); - expect(pixelStride == 2).assertTrue(); - } - getComponentPromise(done, 'Receiver_010_1', YUV_U, checkFormat, checkStride) + it('SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_PROMISE_YUV_U_0100', 0, async function (done) { + getComponentP(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_PROMISE_YUV_U_0100', YUV_U) }) /** - * @tc.number : Receiver_010_2 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_PROMISE_YUV_V_0100 * @tc.name : getComponent-YUV_V * @tc.desc : 1.create ImageReceiver * 2.call on @@ -801,19 +733,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_010_2', 0, async function (done) { - function checkFormat(format) { - expect(format == 22).assertTrue(); - } - function checkStride(rowStride, pixelStride) { - expect(rowStride == 4096).assertTrue(); - expect(pixelStride == 2).assertTrue(); - } - getComponentPromise(done, 'Receiver_010_2', YUV_V, checkFormat, checkStride) + it('SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_PROMISE_YUV_V_0100', 0, async function (done) { + getComponentP(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_PROMISE_YUV_V_0100', YUV_V) }) /** - * @tc.number : Receiver_010_3 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_PROMISE_YUV_Y_0100 * @tc.name : getComponent-YUV_Y * @tc.desc : 1.create ImageReceiver * 2.call on @@ -823,19 +748,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_010_3', 0, async function (done) { - function checkFormat(format) { - expect(format == 22).assertTrue(); - } - function checkStride(rowStride, pixelStride) { - expect(rowStride == 8192).assertTrue(); - expect(pixelStride == 1).assertTrue(); - } - getComponentPromise(done, 'Receiver_010_3', YUV_Y, checkFormat, checkStride) + it('SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_PROMISE_YUV_Y_0100', 0, async function (done) { + getComponentP(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_PROMISE_YUV_Y_0100', YUV_Y) }) /** - * @tc.number : Receiver_010_4 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_CALLBACK_JPEG_0100 * @tc.name : getComponent-jpeg * @tc.desc : 1.create ImageReceiver * 2.call on @@ -845,19 +763,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_010_4', 0, async function (done) { - function checkFormat(format) { - expect(format == 12).assertTrue(); - } - function checkStride(rowStride, pixelStride) { - expect(rowStride == 8192).assertTrue(); - expect(pixelStride == 1).assertTrue(); - } - getComponentCb(done, 'Receiver_010_4', JPEG, checkFormat, checkStride) + it('SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_CALLBACK_JPEG_0100', 0, async function (done) { + getComponentCb(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_CALLBACK_JPEG_0100', JPEG) }) - + /** - * @tc.number : Receiver_010_5 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_CALLBACK_YUV_Y_0100 * @tc.name : getComponent-YUV_Y * @tc.desc : 1.create ImageReceiver * 2.call on @@ -867,19 +778,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_010_5', 0, async function (done) { - function checkFormat(format) { - expect(format == 22).assertTrue(); - } - function checkStride(rowStride, pixelStride) { - expect(rowStride == 8192).assertTrue(); - expect(pixelStride == 1).assertTrue(); - } - getComponentCb(done, 'Receiver_010_5', YUV_Y, checkFormat, checkStride) + it('SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_CALLBACK_YUV_Y_0100', 0, async function (done) { + getComponentCb(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_CALLBACK_YUV_Y_0100', YUV_Y) }) - + /** - * @tc.number : Receiver_010_6 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_CALLBACK_YUV_V_0100 * @tc.name : getComponent-YUV_V * @tc.desc : 1.create ImageReceiver * 2.call on @@ -889,19 +793,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_010_6', 0, async function (done) { - function checkFormat(format) { - expect(format == 22).assertTrue(); - } - function checkStride(rowStride, pixelStride) { - expect(rowStride == 4096).assertTrue(); - expect(pixelStride == 2).assertTrue(); - } - getComponentCb(done, 'Receiver_010_6', YUV_V, checkFormat, checkStride) + it('SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_CALLBACK_YUV_V_0100', 0, async function (done) { + getComponentCb(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_CALLBACK_YUV_V_0100', YUV_V) }) /** - * @tc.number : Receiver_010_7 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_CALLBACK_YUV_U_0100 * @tc.name : getComponent-YUV_U * @tc.desc : 1.create ImageReceiver * 2.call on @@ -911,19 +808,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_010_7', 0, async function (done) { - function checkFormat(format) { - expect(format == 22).assertTrue(); - } - function checkStride(rowStride, pixelStride) { - expect(rowStride == 4096).assertTrue(); - expect(pixelStride == 2).assertTrue(); - } - getComponentCb(done, 'Receiver_010_7', YUV_U, checkFormat, checkStride) + it('SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_CALLBACK_YUV_U_0100', 0, async function (done) { + getComponentCb(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_CALLBACK_YUV_U_0100', YUV_U) }) /** - * @tc.number : Receiver_011 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_RECEIVERON_0100 * @tc.name : on * @tc.desc : 1.create ImageReceiver * 2.call on @@ -931,9 +821,8 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_011', 0, async function (done) { - var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY); - globalreceiver = receiver; + it('SUB_GRAPHIC_IMAGE_RECEIVER_RECEIVERON_0100', 0, async function (done) { + var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY) if (receiver == undefined) { expect(false).assertTrue(); done(); @@ -941,24 +830,24 @@ describe('ImageReceiver', function () { let pass = false; receiver.on('imageArrival', (err) => { if (err) { - console.info('Receiver_011 on err' + err); + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_RECEIVERON_0100 on err' + err); expect(false).assertTrue(); done(); } else { pass = true; - console.info('Receiver_011 on call back IN'); + console.info('SUB_GRAPHIC_IMAGE_RECEIVER_RECEIVERON_0100 on call back IN'); } }) var dummy = receiver.test - await sleep(2000); + await sleep(2000) expect(pass).assertTrue(); done(); } }) /** - * @tc.number : Receiver_012 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_RELEASE_PROMISE_0200 * @tc.name : release-promise * @tc.desc : 1.create ImageReceiver * 2.call on @@ -969,9 +858,8 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_012', 0, async function (done) { - var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY); - globalreceiver = receiver; + it('SUB_GRAPHIC_IMAGE_RECEIVER_RELEASE_PROMISE_0200', 0, async function (done) { + var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY) if (receiver == undefined) { expect(false).assertTrue(); done(); @@ -999,22 +887,22 @@ describe('ImageReceiver', function () { img.release().then(() => { expect(true).assertTrue(); - done(); + done() }).catch(error => { - console.log('Receiver_012 err' + error); + console.log('SUB_GRAPHIC_IMAGE_RECEIVER_RELEASE_PROMISE_0200 err' + error) expect(false).assertTrue(); done(); }) } }).catch(error => { - console.log('Receiver_012 readLatestImage err' + error) + console.log('SUB_GRAPHIC_IMAGE_RECEIVER_RELEASE_PROMISE_0200 readLatestImage err' + error) expect(false).assertTrue(); done(); }) }) /** - * @tc.number : Receiver_013 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_RELEASE_CALLBACK_0200 * @tc.name : release-callback * @tc.desc : 1.create ImageReceiver * 2.call on @@ -1025,9 +913,8 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_013', 0, async function (done) { - var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY); - globalreceiver = receiver; + it('SUB_GRAPHIC_IMAGE_RECEIVER_RELEASE_CALLBACK_0200', 0, async function (done) { + var receiver = image.createImageReceiver(WIDTH, HEIGHT, FORMAT, CAPACITY) if (receiver == undefined) { expect(false).assertTrue(); done(); @@ -1043,7 +930,7 @@ describe('ImageReceiver', function () { receiver.readLatestImage((err, img) => { if (img == undefined) { expect(false).assertTrue(); - done(); + done() return; } @@ -1068,7 +955,7 @@ describe('ImageReceiver', function () { }) /** - * @tc.number : Receiver_014 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0100 * @tc.name : getComponent-wrong format * @tc.desc : 1.create ImageReceiver * 2.call on @@ -1078,12 +965,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_014', 0, async function (done) { - getComponentCbErr(done, 'Receiver_014', null) + it('SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0100', 0, async function (done) { + getComponentCbErr(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0100', null) }) /** - * @tc.number : Receiver_015 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0200 * @tc.name : getComponent-wrong format * @tc.desc : 1.create ImageReceiver * 2.call on @@ -1093,12 +980,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_015', 0, async function (done) { - getComponentCbErr(done, 'Receiver_015', 'ab') + it('SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0200', 0, async function (done) { + getComponentCbErr(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0200', 'ab') }) /** - * @tc.number : Receiver_016 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0300 * @tc.name : getComponent-wrong format * @tc.desc : 1.create ImageReceiver * 2.call on @@ -1108,12 +995,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_016', 0, async function (done) { - getComponentCbErr(done, 'Receiver_016', 0.1) + it('SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0300', 0, async function (done) { + getComponentCbErr(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0300', 0.1) }) /** - * @tc.number : Receiver_017 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0400 * @tc.name : getComponent-wrong format * @tc.desc : 1.create ImageReceiver * 2.call on @@ -1123,12 +1010,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_017', 0, async function (done) { - getComponentCbErr(done, 'Receiver_017', { a: 1 }) + it('SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0400', 0, async function (done) { + getComponentCbErr(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0400', { a: 1 }) }) /** - * @tc.number : Receiver_018 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0500 * @tc.name : getComponent-wrong format * @tc.desc : 1.create ImageReceiver * 2.call on @@ -1138,12 +1025,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_018', 0, async function (done) { - getComponentProErr(done, 'Receiver_018', null) + it('SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0500', 0, async function (done) { + getComponentProErr(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0500', null) }) /** - * @tc.number : Receiver_019 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0600 * @tc.name : getComponent-wrong format * @tc.desc : 1.create ImageReceiver * 2.call on @@ -1153,12 +1040,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_019', 0, async function (done) { - getComponentProErr(done, 'Receiver_019', 'ab') + it('SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0600', 0, async function (done) { + getComponentProErr(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0600', 'ab') }) /** - * @tc.number : Receiver_020 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0700 * @tc.name : getComponent-wrong format * @tc.desc : 1.create ImageReceiver * 2.call on @@ -1168,12 +1055,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_020', 0, async function (done) { - getComponentProErr(done, 'Receiver_020', 0.1) + it('SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0700', 0, async function (done) { + getComponentProErr(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0700', 0.1) }) /** - * @tc.number : Receiver_021 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0800 * @tc.name : getComponent-wrong format * @tc.desc : 1.create ImageReceiver * 2.call on @@ -1183,12 +1070,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_021', 0, async function (done) { - getComponentProErr(done, 'Receiver_021', { a: 1 }) + it('SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0800', 0, async function (done) { + getComponentProErr(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_GETCOMPONENT_ERROR_0800', { a: 1 }) }) /** - * @tc.number : Receiver_022 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_IMAGERECEIVER_ON_ERROR_0100 * @tc.name : on-1 * @tc.desc : 1.create ImageReceiver * 2.call on @@ -1196,12 +1083,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_022', 0, async function (done) { - onErr(done, 'Receiver_022', 1) + it('SUB_GRAPHIC_IMAGE_RECEIVER_IMAGERECEIVER_ON_ERROR_0100', 0, async function (done) { + onErr(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_IMAGERECEIVER_ON_ERROR_0100', 1) }) /** - * @tc.number : Receiver_023 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_IMAGERECEIVER_ON_ERROR_0200 * @tc.name : on-null * @tc.desc : 1.create ImageReceiver * 2.call on @@ -1209,12 +1096,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_023', 0, async function (done) { - onErr(done, 'Receiver_023', null) + it('SUB_GRAPHIC_IMAGE_RECEIVER_IMAGERECEIVER_ON_ERROR_0200', 0, async function (done) { + onErr(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_IMAGERECEIVER_ON_ERROR_0200', null) }) /** - * @tc.number : Receiver_024 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_IMAGERECEIVER_ON_ERROR_0300 * @tc.name : on-{a : 1} * @tc.desc : 1.create ImageReceiver * 2.call on @@ -1222,12 +1109,12 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_024', 0, async function (done) { - onErr(done, 'Receiver_024', { a: 1 }) + it('SUB_GRAPHIC_IMAGE_RECEIVER_IMAGERECEIVER_ON_ERROR_0300', 0, async function (done) { + onErr(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_IMAGERECEIVER_ON_ERROR_0300', { a: 1 }) }) /** - * @tc.number : Receiver_025 + * @tc.number : SUB_GRAPHIC_IMAGE_RECEIVER_IMAGERECEIVER_ON_ERROR_0400 * @tc.name : on-'a' * @tc.desc : 1.create ImageReceiver * 2.call on @@ -1235,8 +1122,8 @@ describe('ImageReceiver', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('Receiver_025', 0, async function (done) { - onErr(done, 'Receiver_025', 'a') + it('SUB_GRAPHIC_IMAGE_RECEIVER_IMAGERECEIVER_ON_ERROR_0400', 0, async function (done) { + onErr(done, 'SUB_GRAPHIC_IMAGE_RECEIVER_IMAGERECEIVER_ON_ERROR_0400', 'a') }) }) } diff --git a/multimedia/image/image_js_standard/imageWebp/BUILD.gn b/multimedia/image/image_js_standard/imageWebp/BUILD.gn index dd607b126af37ec2df8711509b8fce9be5736190..6354bf98f338042924662c32ddad87913a5e9857 100644 --- a/multimedia/image/image_js_standard/imageWebp/BUILD.gn +++ b/multimedia/image/image_js_standard/imageWebp/BUILD.gn @@ -22,7 +22,7 @@ ohos_js_hap_suite("image_webp_js_hap") { certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsImageWebpJsTest" subsystem_name = "multimedia" - part_name = "multimedia_image_standard" + part_name = "multimedia_image_framework" } ohos_js_assets("image_webp_js_assets") { js2abc = true diff --git a/multimedia/image/image_js_standard/imageWebp/src/main/config.json b/multimedia/image/image_js_standard/imageWebp/src/main/config.json index 98306907cf82f442132f4209ced69b3cac872b61..5531412f12c4f4260df6b8acad719596222411d8 100644 --- a/multimedia/image/image_js_standard/imageWebp/src/main/config.json +++ b/multimedia/image/image_js_standard/imageWebp/src/main/config.json @@ -57,6 +57,7 @@ } ], "deviceType": [ + "default", "phone", "tablet", "tv", diff --git a/multimedia/image/image_js_standard/imageWebp/src/main/js/test/webp.test.js b/multimedia/image/image_js_standard/imageWebp/src/main/js/test/webp.test.js index 85714b481986d5bb9affcaf2aa4a0bd86f3e18c8..06f4989823e30eec9fb2e61d87cca6e653b3deda 100644 --- a/multimedia/image/image_js_standard/imageWebp/src/main/js/test/webp.test.js +++ b/multimedia/image/image_js_standard/imageWebp/src/main/js/test/webp.test.js @@ -13,197 +13,197 @@ * limitations under the License. */ -import image from '@ohos.multimedia.image' -import fileio from '@ohos.fileio' -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -import featureAbility from '@ohos.ability.featureAbility' +import image from "@ohos.multimedia.image"; +import fileio from "@ohos.fileio"; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; +import featureAbility from "@ohos.ability.featureAbility"; export default function imageWebp() { -describe('imageWebp', function () { - let filePath; - let fdNumber; - async function getFd(fileName) { - let context = await featureAbility.getContext(); - await context.getFilesDir().then((data) => { - filePath = data + '/' + fileName; - console.info('image case filePath is ' + filePath); - }) - await fileio.open(filePath).then((data) => { - fdNumber = data; - console.info("image case open fd success " + fdNumber); - }, (err) => { - console.info("image cese open fd fail" + err) - }).catch((err) => { - console.info("image case open fd err " + err); - }) - } - beforeAll(async function () { - console.info('beforeAll case'); - }) + describe("imageWebp", function () { + let filePath; + async function getFd(fileName) { + let context = await featureAbility.getContext(); + await context.getFilesDir().then((data) => { + filePath = data + "/" + fileName; + console.info("image case filePath is " + filePath); + }); + } - beforeEach(function () { - console.info('beforeEach case'); - }) + beforeAll(async function () { + console.info("beforeAll case"); + }); - afterEach(async function () { - await fileio.close(fdNumber).then(function(){ - console.info("close file succeed"); - }).catch(function(err){ - console.info("close file failed with error:"+ err); + beforeEach(function () { + console.info("beforeEach case"); }); - console.info('afterEach case'); - }) - afterAll(async function () { - console.info('afterAll case'); - }) + afterEach(async function () { + console.info("afterEach case"); + }); + afterAll(async function () { + console.info("afterAll case"); + }); - async function createPixMapCbErr(done, testNum, arg) { - await getFd('test_large.webp'); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info(`${testNum} create image source failed`); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.createPixelMap(arg, (err, pixelmap) => { - if (pixelmap == undefined) { - expect(true).assertTrue(); - console.info(`${testNum} success `); - done(); - } else { - expect(false).assertTrue(); - done(); - } - }) + async function createPixMapCbErr(done, testNum, arg) { + await getFd("test_large.webp"); + let imageSourceApi = image.createImageSource(filePath); + if (imageSourceApi == undefined) { + console.info(`${testNum} create image source failed`); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.createPixelMap(arg, (err, pixelmap) => { + if (pixelmap == undefined) { + expect(true).assertTrue(); + console.info(`${testNum} success `); + done(); + } else { + expect(false).assertTrue(); + done(); + } + }); + } } - } - - async function createPixMapCb(done, testNum, arg) { - await getFd('test_large.webp'); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info(`${testNum} create image source failed`); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.createPixelMap(arg, (err, pixelmap) => { - if (err) { - console.info(`${testNum} - fail `); - expect(false).assertTrue(); - done(); - } else { - pixelmap.getImageInfo().then((imageInfo) => { - expect(imageInfo.size.height == 2).assertTrue(); - expect(imageInfo.size.width == 1).assertTrue(); - console.info(`${testNum} - success `); - console.info("imageInfo height :" + imageInfo.size.height + "width : " + imageInfo.size.width); + async function createPixMapCb(done, testNum, arg) { + await getFd("test_large.webp"); + let imageSourceApi = image.createImageSource(filePath); + if (imageSourceApi == undefined) { + console.info(`${testNum} create image source failed`); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.createPixelMap(arg, (err, pixelmap) => { + if (err) { + console.info(`${testNum} - fail ${err}`); + expect(false).assertTrue(); done(); - }).catch((err) => { - console.info(`${testNum} getimageInfo err ` + JSON.stringify(err)); - }) - } - }) + } else { + pixelmap + .getImageInfo() + .then((imageInfo) => { + expect(imageInfo.size.height == 2).assertTrue(); + expect(imageInfo.size.width == 1).assertTrue(); + console.info(`${testNum} - success `); + console.info( + "imageInfo height :" + imageInfo.size.height + "width : " + imageInfo.size.width + ); + done(); + }) + .catch((err) => { + console.info(`${testNum} getimageInfo err ` + JSON.stringify(err)); + }); + } + }); + } } - } - async function createPixMapPromiseErr(done, testNum, arg) { - await getFd('test_large.webp'); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info(`${testNum} create image source failed`); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.createPixelMap(arg).then(pixelmap => { - console.log(`${testNum} failed`); - expect().assertFail(); - done(); - }).catch(error => { - console.log(`${testNum} success `); - expect(true).assertTrue(); + async function createPixMapPromiseErr(done, testNum, arg) { + await getFd("test_large.webp"); + let imageSourceApi = image.createImageSource(filePath); + if (imageSourceApi == undefined) { + console.info(`${testNum} create image source failed`); + expect(false).assertTrue(); done(); - }) + } else { + imageSourceApi + .createPixelMap(arg) + .then((pixelmap) => { + console.log(`${testNum} failed`); + expect().assertFail(); + done(); + }) + .catch((error) => { + console.log(`${testNum} success `); + expect(true).assertTrue(); + done(); + }); + } } - } - async function createPixMapPromise(done, testNum, arg) { - await getFd('test_large.webp'); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info(`${testNum} create image source failed`); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.createPixelMap(arg).then(pixelmap => { - pixelmap.getImageInfo().then((imageInfo) => { - expect(imageInfo.size.height == 2).assertTrue(); - expect(imageInfo.size.width == 1).assertTrue(); - console.info(`${testNum} - success `); - console.info("imageInfo height :" + imageInfo.size.height + "width : " + imageInfo.size.width); - done(); - }).catch((err) => { - console.info(`${testNum} getimageInfo err ` + JSON.stringify(err)); - }) - }).catch(error => { - console.log(`${testNum} fail `); - expect(flase).assertTrue(); + async function createPixMapPromise(done, testNum, arg) { + await getFd("test_large.webp"); + let imageSourceApi = image.createImageSource(filePath); + if (imageSourceApi == undefined) { + console.info(`${testNum} create image source failed`); + expect(false).assertTrue(); done(); - }) - } - } - async function packingPromise(done, testNum, arg) { - console.info(`${testNum} enter`); - var height = 4 - var width = 6 - var pixelSize = 4 - var widthSize = width * pixelSize - var bufferSize = height * widthSize - const color = new ArrayBuffer(bufferSize); - var colorArr = new Uint8Array(color); - for (var h = 0; h < height / 2; h++) { - for (var w = 0; w < width / 2; w++) { - var pos = widthSize * h + pixelSize * w - colorArr[pos + 0] = 255; // r - colorArr[pos + 1] = 0; - colorArr[pos + 2] = 0; - colorArr[pos + 3] = 255; + } else { + imageSourceApi + .createPixelMap(arg) + .then((pixelmap) => { + pixelmap + .getImageInfo() + .then((imageInfo) => { + expect(imageInfo.size.height == 2).assertTrue(); + expect(imageInfo.size.width == 1).assertTrue(); + console.info(`${testNum} - success `); + console.info( + "imageInfo height :" + imageInfo.size.height + "width : " + imageInfo.size.width + ); + done(); + }) + .catch((err) => { + console.info(`${testNum} getimageInfo err ` + JSON.stringify(err)); + }); + }) + .catch((error) => { + console.log(`${testNum} fail `); + expect(flase).assertTrue(); + done(); + }); } } - for (var h = 0; h < height / 2; h++) { - for (var w = width / 2; w < width; w++) { - var pos = widthSize * h + pixelSize * w - colorArr[pos + 0] = 0; - colorArr[pos + 1] = 255; // g - colorArr[pos + 2] = 0; - colorArr[pos + 3] = 255; + async function packingPromise(done, testNum, arg) { + console.info(`${testNum} enter`); + var height = 4; + var width = 6; + var pixelSize = 4; + var widthSize = width * pixelSize; + var bufferSize = height * widthSize; + const color = new ArrayBuffer(bufferSize); + var colorArr = new Uint8Array(color); + for (var h = 0; h < height / 2; h++) { + for (var w = 0; w < width / 2; w++) { + var pos = widthSize * h + pixelSize * w; + colorArr[pos + 0] = 255; // r + colorArr[pos + 1] = 0; + colorArr[pos + 2] = 0; + colorArr[pos + 3] = 255; + } } - } - for (var h = height / 2; h < height; h++) { - for (var w = 0; w < width / 2; w++) { - var pos = widthSize * h + pixelSize * w - colorArr[pos + 0] = 0; - colorArr[pos + 1] = 0; - colorArr[pos + 2] = 255; // b - colorArr[pos + 3] = 255; + for (var h = 0; h < height / 2; h++) { + for (var w = width / 2; w < width; w++) { + var pos = widthSize * h + pixelSize * w; + colorArr[pos + 0] = 0; + colorArr[pos + 1] = 255; // g + colorArr[pos + 2] = 0; + colorArr[pos + 3] = 255; + } } - } - for (var h = height / 2; h < height; h++) { - for (var w = width / 2; w < width; w++) { - var pos = widthSize * h + pixelSize * w - colorArr[pos + 0] = 0; - colorArr[pos + 1] = 0; - colorArr[pos + 2] = 0; - colorArr[pos + 3] = 255; + for (var h = height / 2; h < height; h++) { + for (var w = 0; w < width / 2; w++) { + var pos = widthSize * h + pixelSize * w; + colorArr[pos + 0] = 0; + colorArr[pos + 1] = 0; + colorArr[pos + 2] = 255; // b + colorArr[pos + 3] = 255; + } + } + for (var h = height / 2; h < height; h++) { + for (var w = width / 2; w < width; w++) { + var pos = widthSize * h + pixelSize * w; + colorArr[pos + 0] = 0; + colorArr[pos + 1] = 0; + colorArr[pos + 2] = 0; + colorArr[pos + 3] = 255; + } } - } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts) - .then(pixelmap => { + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }; + image.createPixelMap(color, opts).then((pixelmap) => { if (pixelmap == undefined) { - console.info('${testNum} create pixelmap failed'); - expect(false).assertTrue() + console.info("${testNum} create pixelmap failed"); + expect(false).assertTrue(); done(); } else { const imagePackerApi = image.createImagePacker(); @@ -212,8 +212,9 @@ describe('imageWebp', function () { expect(false).assertTrue(); done(); } else { - imagePackerApi.packing(pixelmap, arg) - .then(data => { + imagePackerApi + .packing(pixelmap, arg) + .then((data) => { console.info(`${testNum} success`); expect(data != undefined).assertTrue(); var dataArr = new Uint8Array(data); @@ -222,149 +223,151 @@ describe('imageWebp', function () { console.info(`dataArr[` + i + `]=` + dataArr[i]); } done(); - }).catch(error => { + }) + .catch((error) => { console.log(`${testNum} error: ` + error); expect(false).assertFail(); done(); - }) + }); } } - }) - console.info(`${testNum} leave`); - } + }); + console.info(`${testNum} leave`); + } - async function packingCb(done, testNum, arg) { - console.info(`${testNum} enter`); - var height = 4 - var width = 6 - var pixelSize = 4 - var widthSize = width * pixelSize - var bufferSize = height * widthSize - const color = new ArrayBuffer(bufferSize); - var colorArr = new Uint8Array(color); - for (var h = 0; h < height / 2; h++) { - for (var w = 0; w < width / 2; w++) { - var pos = widthSize * h + pixelSize * w - colorArr[pos + 0] = 255; // r - colorArr[pos + 1] = 0; - colorArr[pos + 2] = 0; - colorArr[pos + 3] = 255; + async function packingCb(done, testNum, arg) { + console.info(`${testNum} enter`); + var height = 4; + var width = 6; + var pixelSize = 4; + var widthSize = width * pixelSize; + var bufferSize = height * widthSize; + const color = new ArrayBuffer(bufferSize); + var colorArr = new Uint8Array(color); + for (var h = 0; h < height / 2; h++) { + for (var w = 0; w < width / 2; w++) { + var pos = widthSize * h + pixelSize * w; + colorArr[pos + 0] = 255; // r + colorArr[pos + 1] = 0; + colorArr[pos + 2] = 0; + colorArr[pos + 3] = 255; + } } - } - for (var h = 0; h < height / 2; h++) { - for (var w = width / 2; w < width; w++) { - var pos = widthSize * h + pixelSize * w - colorArr[pos + 0] = 0; - colorArr[pos + 1] = 255; // g - colorArr[pos + 2] = 0; - colorArr[pos + 3] = 255; + for (var h = 0; h < height / 2; h++) { + for (var w = width / 2; w < width; w++) { + var pos = widthSize * h + pixelSize * w; + colorArr[pos + 0] = 0; + colorArr[pos + 1] = 255; // g + colorArr[pos + 2] = 0; + colorArr[pos + 3] = 255; + } } - } - for (var h = height / 2; h < height; h++) { - for (var w = 0; w < width / 2; w++) { - var pos = widthSize * h + pixelSize * w - colorArr[pos + 0] = 0; - colorArr[pos + 1] = 0; - colorArr[pos + 2] = 255; // b - colorArr[pos + 3] = 255; + for (var h = height / 2; h < height; h++) { + for (var w = 0; w < width / 2; w++) { + var pos = widthSize * h + pixelSize * w; + colorArr[pos + 0] = 0; + colorArr[pos + 1] = 0; + colorArr[pos + 2] = 255; // b + colorArr[pos + 3] = 255; + } } - } - for (var h = height / 2; h < height; h++) { - for (var w = width / 2; w < width; w++) { - var pos = widthSize * h + pixelSize * w - colorArr[pos + 0] = 0; - colorArr[pos + 1] = 0; - colorArr[pos + 2] = 0; - colorArr[pos + 3] = 255; + for (var h = height / 2; h < height; h++) { + for (var w = width / 2; w < width; w++) { + var pos = widthSize * h + pixelSize * w; + colorArr[pos + 0] = 0; + colorArr[pos + 1] = 0; + colorArr[pos + 2] = 0; + colorArr[pos + 3] = 255; + } } - } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts) - .then(pixelmap => { - if (pixelmap == undefined) { - console.info('${testNum} create pixelmap failed'); - expect(false).assertTrue() - done(); - } else { - const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == undefined) { - console.info(`${testNum} create image packer failed`); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }; + image + .createPixelMap(color, opts) + .then((pixelmap) => { + if (pixelmap == undefined) { + console.info("${testNum} create pixelmap failed"); expect(false).assertTrue(); done(); } else { - imagePackerApi.packing(pixelmap, arg, (err, data) => { - console.info(`${testNum} success`); - expect(data != undefined).assertTrue(); - var dataArr = new Uint8Array(data); - console.info(`${testNum} dataArr.length=` + dataArr.length); - for (var i = 0; i < dataArr.length; i++) { - console.info(`dataArr[` + i + `]=` + dataArr[i]); - } + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info(`${testNum} create image packer failed`); + expect(false).assertTrue(); done(); - }) + } else { + imagePackerApi.packing(pixelmap, arg, (err, data) => { + console.info(`${testNum} success`); + expect(data != undefined).assertTrue(); + var dataArr = new Uint8Array(data); + console.info(`${testNum} dataArr.length=` + dataArr.length); + for (var i = 0; i < dataArr.length; i++) { + console.info(`dataArr[` + i + `]=` + dataArr[i]); + } + done(); + }); + } } - } - }).catch(error => { - console.log(`${testNum} error: ` + error); - expect(false).assertFail(); - done(); - }) - console.info(`${testNum} leave`); - } + }) + .catch((error) => { + console.log(`${testNum} error: ` + error); + expect(false).assertFail(); + done(); + }); + console.info(`${testNum} leave`); + } - async function packingPromiseErr(done, testNum, arg) { - console.info(`${testNum} enter`); - var height = 4 - var width = 6 - var pixelSize = 4 - var widthSize = width * pixelSize - var bufferSize = height * widthSize - const color = new ArrayBuffer(bufferSize); - var colorArr = new Uint8Array(color); - for (var h = 0; h < height / 2; h++) { - for (var w = 0; w < width / 2; w++) { - var pos = widthSize * h + pixelSize * w - colorArr[pos + 0] = 255; // r - colorArr[pos + 1] = 0; - colorArr[pos + 2] = 0; - colorArr[pos + 3] = 255; + async function packingPromiseErr(done, testNum, arg) { + console.info(`${testNum} enter`); + var height = 4; + var width = 6; + var pixelSize = 4; + var widthSize = width * pixelSize; + var bufferSize = height * widthSize; + const color = new ArrayBuffer(bufferSize); + var colorArr = new Uint8Array(color); + for (var h = 0; h < height / 2; h++) { + for (var w = 0; w < width / 2; w++) { + var pos = widthSize * h + pixelSize * w; + colorArr[pos + 0] = 255; // r + colorArr[pos + 1] = 0; + colorArr[pos + 2] = 0; + colorArr[pos + 3] = 255; + } } - } - for (var h = 0; h < height / 2; h++) { - for (var w = width / 2; w < width; w++) { - var pos = widthSize * h + pixelSize * w - colorArr[pos + 0] = 0; - colorArr[pos + 1] = 255; // g - colorArr[pos + 2] = 0; - colorArr[pos + 3] = 255; + for (var h = 0; h < height / 2; h++) { + for (var w = width / 2; w < width; w++) { + var pos = widthSize * h + pixelSize * w; + colorArr[pos + 0] = 0; + colorArr[pos + 1] = 255; // g + colorArr[pos + 2] = 0; + colorArr[pos + 3] = 255; + } } - } - for (var h = height / 2; h < height; h++) { - for (var w = 0; w < width / 2; w++) { - var pos = widthSize * h + pixelSize * w - colorArr[pos + 0] = 0; - colorArr[pos + 1] = 0; - colorArr[pos + 2] = 255; // b - colorArr[pos + 3] = 255; + for (var h = height / 2; h < height; h++) { + for (var w = 0; w < width / 2; w++) { + var pos = widthSize * h + pixelSize * w; + colorArr[pos + 0] = 0; + colorArr[pos + 1] = 0; + colorArr[pos + 2] = 255; // b + colorArr[pos + 3] = 255; + } } - } - for (var h = height / 2; h < height; h++) { - for (var w = width / 2; w < width; w++) { - var pos = widthSize * h + pixelSize * w - colorArr[pos + 0] = 0; - colorArr[pos + 1] = 0; - colorArr[pos + 2] = 0; - colorArr[pos + 3] = 255; + for (var h = height / 2; h < height; h++) { + for (var w = width / 2; w < width; w++) { + var pos = widthSize * h + pixelSize * w; + colorArr[pos + 0] = 0; + colorArr[pos + 1] = 0; + colorArr[pos + 2] = 0; + colorArr[pos + 3] = 255; + } } - } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts) - .then(pixelmap => { + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }; + image.createPixelMap(color, opts).then((pixelmap) => { if (pixelmap == undefined) { - console.info('${testNum} create pixelmap failed'); - expect(false).assertTrue() + console.info("${testNum} create pixelmap failed"); + expect(false).assertTrue(); done(); } else { const imagePackerApi = image.createImagePacker(); @@ -373,759 +376,761 @@ describe('imageWebp', function () { expect(false).assertTrue(); done(); } else { - imagePackerApi.packing(pixelmap, arg) - .then(data => { + imagePackerApi + .packing(pixelmap, arg) + .then((data) => { expect(data == undefined).assertTrue(); done(); - }).catch(error => { + }) + .catch((error) => { console.log(`${testNum} error: ` + error); expect(true).assertTrue(); done(); - }) + }); } } - }) - console.info(`${testNum} leave`); - } + }); + console.info(`${testNum} leave`); + } - async function packingCbErr(done, testNum, arg) { - console.info(`${testNum} enter`); - var height = 4 - var width = 6 - var pixelSize = 4 - var widthSize = width * pixelSize - var bufferSize = height * widthSize - const color = new ArrayBuffer(bufferSize); - var colorArr = new Uint8Array(color); - for (var h = 0; h < height / 2; h++) { - for (var w = 0; w < width / 2; w++) { - var pos = widthSize * h + pixelSize * w - colorArr[pos + 0] = 255; // r - colorArr[pos + 1] = 0; - colorArr[pos + 2] = 0; - colorArr[pos + 3] = 255; + async function packingCbErr(done, testNum, arg) { + console.info(`${testNum} enter`); + var height = 4; + var width = 6; + var pixelSize = 4; + var widthSize = width * pixelSize; + var bufferSize = height * widthSize; + const color = new ArrayBuffer(bufferSize); + var colorArr = new Uint8Array(color); + for (var h = 0; h < height / 2; h++) { + for (var w = 0; w < width / 2; w++) { + var pos = widthSize * h + pixelSize * w; + colorArr[pos + 0] = 255; // r + colorArr[pos + 1] = 0; + colorArr[pos + 2] = 0; + colorArr[pos + 3] = 255; + } } - } - for (var h = 0; h < height / 2; h++) { - for (var w = width / 2; w < width; w++) { - var pos = widthSize * h + pixelSize * w - colorArr[pos + 0] = 0; - colorArr[pos + 1] = 255; // g - colorArr[pos + 2] = 0; - colorArr[pos + 3] = 255; + for (var h = 0; h < height / 2; h++) { + for (var w = width / 2; w < width; w++) { + var pos = widthSize * h + pixelSize * w; + colorArr[pos + 0] = 0; + colorArr[pos + 1] = 255; // g + colorArr[pos + 2] = 0; + colorArr[pos + 3] = 255; + } } - } - for (var h = height / 2; h < height; h++) { - for (var w = 0; w < width / 2; w++) { - var pos = widthSize * h + pixelSize * w - colorArr[pos + 0] = 0; - colorArr[pos + 1] = 0; - colorArr[pos + 2] = 255; // b - colorArr[pos + 3] = 255; + for (var h = height / 2; h < height; h++) { + for (var w = 0; w < width / 2; w++) { + var pos = widthSize * h + pixelSize * w; + colorArr[pos + 0] = 0; + colorArr[pos + 1] = 0; + colorArr[pos + 2] = 255; // b + colorArr[pos + 3] = 255; + } } - } - for (var h = height / 2; h < height; h++) { - for (var w = width / 2; w < width; w++) { - var pos = widthSize * h + pixelSize * w - colorArr[pos + 0] = 0; - colorArr[pos + 1] = 0; - colorArr[pos + 2] = 0; - colorArr[pos + 3] = 255; + for (var h = height / 2; h < height; h++) { + for (var w = width / 2; w < width; w++) { + var pos = widthSize * h + pixelSize * w; + colorArr[pos + 0] = 0; + colorArr[pos + 1] = 0; + colorArr[pos + 2] = 0; + colorArr[pos + 3] = 255; + } } - } - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts) - .then(pixelmap => { - if (pixelmap == undefined) { - console.info('${testNum} create pixelmap failed'); - expect(false).assertTrue() - done(); - } else { - const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == undefined) { - console.info(`${testNum} create image packer failed`); + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }; + image + .createPixelMap(color, opts) + .then((pixelmap) => { + if (pixelmap == undefined) { + console.info("${testNum} create pixelmap failed"); expect(false).assertTrue(); done(); } else { - imagePackerApi.packing(pixelmap, arg, (err, data) => { - console.info(`${testNum} success`); - expect(data == undefined).assertTrue(); + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info(`${testNum} create image packer failed`); + expect(false).assertTrue(); done(); - }) - } - } - }).catch(error => { - console.log(`${testNum} error: ` + error); - expect(true).assertTrue(); - done(); - }) - console.info(`${testNum} leave`); - } - - /** - * @tc.number : wbp_001 - * @tc.name : createPixelMap - promise-webp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.return pixelmap - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_001', 0, async function (done) { - try { - await getFd('test_large.webp'); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('wbp_001 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize: 1, - editable: true, - desiredSize: { width: 1, height: 2 }, - rotate: 10, - desiredPixelFormat: 2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index: 0 - }; - - imageSourceApi.createPixelMap(decodingOptions).then(pixelmap => { - if (pixelmap != undefined) { - expect(true).assertTrue(); - console.info('wbp_001 success '); - done(); - } else { - expect(false).assertTrue(); - done(); + } else { + imagePackerApi.packing(pixelmap, arg, (err, data) => { + console.info(`${testNum} success`); + expect(data == undefined).assertTrue(); + done(); + }); + } } }) - } - } catch (error) { - console.info('wbp_001 error: ' + error); - expect(false).assertTrue(); - done(); + .catch((error) => { + console.log(`${testNum} error: ` + error); + expect(true).assertTrue(); + done(); + }); + console.info(`${testNum} leave`); } - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100 + * @tc.name : createPixelMap - promise-webp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.return pixelmap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100", 0, async function (done) { + try { + await getFd("test_large.webp"); + let imageSourceApi = image.createImageSource(filePath); + if (imageSourceApi == undefined) { + console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100 create image source failed"); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index: 0, + }; - /** - * @tc.number : wbp_002 - * @tc.name : createPixelMap - callback-webp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.return pixelmap - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_002', 0, async function (done) { - try { - await getFd('test_large.webp'); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('wbp_002 create image source failed'); + imageSourceApi.createPixelMap(decodingOptions).then((pixelmap) => { + if (pixelmap != undefined) { + expect(true).assertTrue(); + console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100 success "); + done(); + } else { + expect(false).assertTrue(); + done(); + } + }); + } + } catch (error) { + console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0100 error: " + error); expect(false).assertTrue(); done(); - } else { - let decodingOptions = { - sampleSize: 1, - editable: true, - desiredSize: { width: 1, height: 2 }, - rotate: 10, - desiredPixelFormat: 2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index: 0 - }; - - imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { - if (pixelmap != undefined) { - expect(true).assertTrue(); - console.info('wbp_002 success '); - done(); - } else { - expect(false).assertTrue(); - done(); - } - }) } - } catch (error) { - console.info('wbp_002 error: ' + error); - expect(false).assertTrue(); - done(); - } + }); - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100 + * @tc.name : createPixelMap - callback-webp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.return pixelmap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100", 0, async function (done) { + try { + await getFd("test_large.webp"); + let imageSourceApi = image.createImageSource(filePath); + if (imageSourceApi == undefined) { + console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100 create image source failed"); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index: 0, + }; - /** - * @tc.number : wbp_003 - * @tc.name : createPixelMap-promise-webp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.return pixelmap - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_003', 0, async function (done) { - try { - await getFd('test_large.webp'); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('wbp_003 create image source failed'); + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + if (pixelmap != undefined) { + expect(true).assertTrue(); + console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100 success "); + done(); + } else { + expect(false).assertTrue(); + done(); + } + }); + } + } catch (error) { + console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0100 error: " + error); expect(false).assertTrue(); done(); - } else { - imageSourceApi.createPixelMap().then(pixelmap => { - expect(pixelmap != undefined).assertTrue(); - console.info('wbp_003 success '); - done(); - }).catch(error => { - console.log('wbp_003 error: ' + error); - expect().assertFail(); - done(); - }) } - } catch (error) { - console.info('wbp_003 err ' + error); - } - - }) + }); - /** - * @tc.number : wbp_004 - * @tc.name : createPixelMap-callback-webp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.return pixelmap - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_004', 0, async function (done) { - try { - await getFd('test_large.webp'); - const imageSourceApi = image.createImageSource(fdNumber); - if (imageSourceApi == undefined) { - console.info('wbp_004 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.createPixelMap((err, pixelmap) => { - expect(pixelmap != undefined).assertTrue(); - console.info('wbp_004 success '); + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 + * @tc.name : createPixelMap-promise-webp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.return pixelmap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200", 0, async function (done) { + try { + await getFd("test_large.webp"); + let imageSourceApi = image.createImageSource(filePath); + if (imageSourceApi == undefined) { + console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 create image source failed"); + expect(false).assertTrue(); done(); - }) + } else { + imageSourceApi + .createPixelMap() + .then((pixelmap) => { + expect(pixelmap != undefined).assertTrue(); + console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 success "); + done(); + }) + .catch((error) => { + console.log("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 error: " + error); + expect().assertFail(); + done(); + }); + } + } catch (error) { + console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_PROMISE_0200 err " + error); } - } catch (error) { - console.info('wbp_004 err ' + error); - } - - }) - - /** - * @tc.number : wbp_005 - * @tc.name : createPixelMap-callback -{sampleSize: -1} -webp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.return pixelmap undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_005', 0, async function (done) { - let decodingOptions = { - sampleSize: -1, - editable: true, - desiredSize: { width: 1, height: 2 }, - rotate: 10, - desiredPixelFormat: 2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index: 0 - }; - createPixMapCbErr(done, 'wbp_005', decodingOptions) - }) + }); - /** - * @tc.number : wbp_006 - * @tc.name : createPixelMap-callback -{index: -1} -webp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.return pixelmap undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_006', 0, async function (done) { - let decodingOptions = { - sampleSize: 1, - editable: true, - desiredSize: { width: 1, height: 2 }, - rotate: 10, - desiredPixelFormat: 0, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index: -1 - }; - createPixMapCbErr(done, 'wbp_006', decodingOptions) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200 + * @tc.name : createPixelMap-callback-webp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.return pixelmap + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200", 0, async function (done) { + try { + await getFd("test_large.webp"); + let imageSourceApi = image.createImageSource(filePath); + if (imageSourceApi == undefined) { + console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200 create image source failed"); + expect(false).assertTrue(); + done(); + } else { + imageSourceApi.createPixelMap((err, pixelmap) => { + expect(pixelmap != undefined).assertTrue(); + console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200 success "); + done(); + }); + } + } catch (error) { + console.info("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0200 err " + error); + } + }); - /** - * @tc.number : wbp_007 - * @tc.name : createPixelMap-callback -{rotate: 500} -webp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.return pixelmap undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_007', 0, async function (done) { - let decodingOptions = { - sampleSize: 1, - editable: true, - desiredSize: { width: 1, height: 2 }, - rotate: 500, - desiredPixelFormat: 3, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index: 0 - }; - createPixMapCbErr(done, 'wbp_007', decodingOptions) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0300 + * @tc.name : createPixelMap-callback -{sampleSize: -1} -webp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.return pixelmap undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0300", 0, async function (done) { + let decodingOptions = { + sampleSize: -1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index: 0, + }; + createPixMapCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0300", decodingOptions); + }); - /** - * @tc.number : wbp_007-1 - * @tc.name : createPixelMap-callback -{rotate: -10} -webp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.return pixelmap undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_007-1', 0, async function (done) { - let decodingOptions = { - sampleSize: 1, - editable: true, - desiredSize: { width: 1, height: 2 }, - rotate: -10, - desiredPixelFormat: 3, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index: 0 - }; - createPixMapCbErr(done, 'wbp_007-1', decodingOptions) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0400 + * @tc.name : createPixelMap-callback -{index: -1} -webp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.return pixelmap undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0400", 0, async function (done) { + let decodingOptions = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 0, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index: -1, + }; + createPixMapCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0400", decodingOptions); + }); - /** - * @tc.number : wbp_007-2 - * @tc.name : createPixelMap-callback editable: false -webp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.return pixelmap undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_007-2', 0, async function (done) { - let decodingOptions = { - sampleSize: 1, - editable: false, - desiredSize: { width: 1, height: 2 }, - rotate: 10, - desiredPixelFormat: 33, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index: 0 - }; - createPixMapCbErr(done, 'wbp_007-2', decodingOptions) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0500 + * @tc.name : createPixelMap-callback -{rotate: 500} -webp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.return pixelmap undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0500", 0, async function (done) { + let decodingOptions = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 500, + desiredPixelFormat: 3, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index: 0, + }; + createPixMapCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0500", decodingOptions); + }); - /** - * @tc.number : wbp_008 - * @tc.name : createPixelMap-callback -{ size: { height: 1, width: 2 }, x: -1, y: -1 }-webp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.return pixelmap undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_008', 0, async function (done) { - let decodingOptions = { - sampleSize: 1, - editable: true, - desiredSize: { width: 1, height: 2 }, - rotate: 10, - desiredPixelFormat: 2, - desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, - index: 0 - }; - createPixMapCbErr(done, 'wbp_008', decodingOptions) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0600 + * @tc.name : createPixelMap-callback -{rotate: -10} -webp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.return pixelmap undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0600", 0, async function (done) { + let decodingOptions = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: -10, + desiredPixelFormat: 3, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index: 0, + }; + createPixMapCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0600", decodingOptions); + }); - /** - * @tc.number : wbp_009 - * @tc.name : createPixelMap-callback -size: { height: 10000, width: 10000 } -webp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.return pixelmap undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_009', 0, async function (done) { - let decodingOptions = { - sampleSize: 1, - editable: true, - desiredSize: { width: 1, height: 2 }, - rotate: 10, - desiredPixelFormat: 3, - desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, - index: 0 - }; - createPixMapCb(done, 'wbp_009', decodingOptions) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0700 + * @tc.name : createPixelMap-callback editable: false -webp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.return pixelmap undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0700", 0, async function (done) { + let decodingOptions = { + sampleSize: 1, + editable: false, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 33, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index: 0, + }; + createPixMapCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0700", decodingOptions); + }); - /** - * @tc.number : wbp_010 - * @tc.name : createPixelMap-callback - sampleSize: -1 -webp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.return pixelmap undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_010', 0, async function (done) { - let decodingOptions = { - sampleSize: -1, - editable: true, - desiredSize: { width: 1, height: 2 }, - rotate: 10, - desiredPixelFormat: 2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index: 0 - }; - createPixMapPromiseErr(done, 'wbp_010', decodingOptions) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0800 + * @tc.name : createPixelMap-callback -{ size: { height: 1, width: 2 }, x: -1, y: -1 }-webp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.return pixelmap undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0800", 0, async function (done) { + let decodingOptions = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, + desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, + index: 0, + }; + createPixMapCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0800", decodingOptions); + }); - /** - * @tc.number : wbp_011 - * @tc.name : createPixelMap-callback - index: -1 -webp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.return pixelmap undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_011', 0, async function (done) { - let decodingOptions = { - sampleSize: 1, - editable: true, - desiredSize: { width: 1, height: 2 }, - rotate: 10, - desiredPixelFormat: 2, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index: -1 - }; - createPixMapPromiseErr(done, 'wbp_011', decodingOptions) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0900 + * @tc.name : createPixelMap-callback -size: { height: 10000, width: 10000 } -webp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.return pixelmap undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0900", 0, async function (done) { + let decodingOptions = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 3, + desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, + index: 0, + }; + createPixMapCb(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_0900", decodingOptions); + }); - /** - * @tc.number : wbp_012 - * @tc.name : createPixelMap-callback - desiredPixelFormat: 1 -webp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.return pixelmap undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_012', 0, async function (done) { - let decodingOptions = { - sampleSize: 2, - editable: true, - desiredSize: { width: 1, height: 2 }, - rotate: 500, - desiredPixelFormat: 1, - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index: 0 - }; - createPixMapPromiseErr(done, 'wbp_012', decodingOptions) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1000 + * @tc.name : createPixelMap-callback - sampleSize: -1 -webp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.return pixelmap undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1000", 0, async function (done) { + let decodingOptions = { + sampleSize: -1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index: 0, + }; + createPixMapPromiseErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1000", decodingOptions); + }); + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1100 + * @tc.name : createPixelMap-callback - index: -1 -webp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.return pixelmap undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1100", 0, async function (done) { + let decodingOptions = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index: -1, + }; + createPixMapPromiseErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1100", decodingOptions); + }); - /** - * @tc.number : wbp_013 - * @tc.name : createPixelMap-callback - { size: { height: 1, width: 2 }, x: -1, y: -1 } -webp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.return pixelmap undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_013', 0, async function (done) { - let decodingOptions = { - sampleSize: 1, - editable: true, - desiredSize: { width: 1, height: 2 }, - rotate: 10, - desiredPixelFormat: 3, - desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, - index: 0 - }; - createPixMapPromiseErr(done, 'wbp_013', decodingOptions) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1200 + * @tc.name : createPixelMap-callback - desiredPixelFormat: 1 -webp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.return pixelmap undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1200", 0, async function (done) { + let decodingOptions = { + sampleSize: 2, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 500, + desiredPixelFormat: 1, + desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, + index: 0, + }; + createPixMapPromiseErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1200", decodingOptions); + }); - /** - * @tc.number : wbp_014 - * @tc.name : createPixelMap-callback - size: { height: 10000, width:10000 } -webp - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.return pixelmap undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_014', 0, async function (done) { - let decodingOptions = { - sampleSize: 1, - editable: true, - desiredSize: { width: 1, height: 2 }, - rotate: 10, - desiredPixelFormat: 2, - desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, - index: 0 - }; - createPixMapPromise(done, 'wbp_014', decodingOptions) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1300 + * @tc.name : createPixelMap-callback - { size: { height: 1, width: 2 }, x: -1, y: -1 } -webp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.return pixelmap undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1300", 0, async function (done) { + let decodingOptions = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 3, + desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, + index: 0, + }; + createPixMapPromiseErr(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1300", decodingOptions); + }); - /** - * @tc.number : wbp_015 - * @tc.name : packing - callback-webp - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_015', 0, async function (done) { - let packOpts = { format: ["image/webp"], quality: 90 } - packingCb(done, 'wbp_015', packOpts) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1400 + * @tc.name : createPixelMap-callback - size: { height: 10000, width:10000 } -webp + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.return pixelmap undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1400", 0, async function (done) { + let decodingOptions = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, + desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, + index: 0, + }; + createPixMapPromise(done, "SUB_GRAPHIC_IMAGE_WEBP_CREATEPIXELMAP_CALLBACK_1400", decodingOptions); + }); - /** - * @tc.number : wbp_016 - * @tc.name : packing - promise-webp - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_016', 0, async function (done) { - let packOpts = { format: ["image/webp"], quality: 100 } - packingPromise(done, 'wbp_016', packOpts) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0100 + * @tc.name : packing - callback-webp + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0100", 0, async function (done) { + let packOpts = { format: ["image/webp"], quality: 90 }; + packingCb(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0100", packOpts); + }); - /** - * @tc.number : wbp_017 - * @tc.name : packing - promise-webp-wrong quality - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_017', 0, async function (done) { - let packOpts = { format: ["image/webp"], quality: 123 } - packingPromiseErr(done, 'wbp_017', packOpts) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0100 + * @tc.name : packing - promise-webp + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0100", 0, async function (done) { + let packOpts = { format: ["image/webp"], quality: 100 }; + packingPromise(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0100", packOpts); + }); - /** - * @tc.number : wbp_018 - * @tc.name : packing - promise-webp - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_018', 0, async function (done) { - let packOpts = { format: ["image/gif"], quality: 90 } - packingPromiseErr(done, 'wbp_018', packOpts) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0100 + * @tc.name : packing - promise-webp-wrong quality + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0100", 0, async function (done) { + let packOpts = { format: ["image/webp"], quality: 123 }; + packingPromiseErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0100", packOpts); + }); - /** - * @tc.number : wbp_019 - * @tc.name : packing - promise-webp-no format - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_019', 0, async function (done) { - let packOpts = { quality: 90 } - packingPromiseErr(done, 'wbp_019', packOpts) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0200 + * @tc.name : packing - promise-webp + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0200", 0, async function (done) { + let packOpts = { format: ["image/gif"], quality: 90 }; + packingPromiseErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0200", packOpts); + }); - /** - * @tc.number : wbp_020 - * @tc.name : packing - promise-webp-no format - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_020', 0, async function (done) { - let packOpts = { format: ["image/jpeg"] } - packingPromiseErr(done, 'wbp_020', packOpts) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0300 + * @tc.name : packing - promise-webp-no format + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0300", 0, async function (done) { + let packOpts = { quality: 90 }; + packingPromiseErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0300", packOpts); + }); - /** - * @tc.number : wbp_021 - * @tc.name : packing - callback-webp-wrong format - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_021', 0, async function (done) { - let packOpts = { format: ["image/gif"], quality: 100 } - packingCbErr(done, 'wbp_021', packOpts) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0400 + * @tc.name : packing - promise-webp-no format + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0400", 0, async function (done) { + let packOpts = { format: ["image/jpeg"] }; + packingPromiseErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0400", packOpts); + }); - /** - * @tc.number : wbp_022 - * @tc.name : packing - callback-webp-wrong quality - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_022', 0, async function (done) { - let packOpts = { format: ["image/jpeg"], quality: 112 } - packingCbErr(done, 'wbp_022', packOpts) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0100 + * @tc.name : packing - callback-webp-wrong format + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0100", 0, async function (done) { + let packOpts = { format: ["image/gif"], quality: 100 }; + packingCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0100", packOpts); + }); - /** - * @tc.number : wbp_023 - * @tc.name : packing - callback-webp-no quality - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_023', 0, async function (done) { - let packOpts = { format: ["image/jpeg"] } - packingCbErr(done, 'wbp_023', packOpts) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0200 + * @tc.name : packing - callback-webp-wrong quality + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0200", 0, async function (done) { + let packOpts = { format: ["image/jpeg"], quality: 112 }; + packingCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0200", packOpts); + }); - /** - * @tc.number : wbp_024 - * @tc.name : packing - callback-webp-no format - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_024', 0, async function (done) { - let packOpts = { quality: 90 } - packingCbErr(done, 'wbp_024', packOpts) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0300 + * @tc.name : packing - callback-webp-no quality + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0300", 0, async function (done) { + let packOpts = { format: ["image/jpeg"] }; + packingCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0300", packOpts); + }); - /** - * @tc.number : wbp_025 - * @tc.name : packing - callback-webp-quality -1 - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_025', 0, async function (done) { - let packOpts = { format: ["image/jpeg"], quality: -1 } - packingCbErr(done, 'wbp_025', packOpts) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0400 + * @tc.name : packing - callback-webp-no format + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0400", 0, async function (done) { + let packOpts = { quality: 90 }; + packingCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0400", packOpts); + }); - /** - * @tc.number : wbp_026 - * @tc.name : packing - promise-webp-quality -1 - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_026', 0, async function (done) { - let packOpts = { format: ["image/jpeg"], quality: -1 } - packingPromiseErr(done, 'wbp_026', packOpts) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0500 + * @tc.name : packing - callback-webp-quality -1 + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0500", 0, async function (done) { + let packOpts = { format: ["image/jpeg"], quality: -1 }; + packingCbErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_ERROR_0500", packOpts); + }); + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0500 + * @tc.name : packing - promise-webp-quality -1 + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0500", 0, async function (done) { + let packOpts = { format: ["image/jpeg"], quality: -1 }; + packingPromiseErr(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_ERROR_0500", packOpts); + }); - /** - * @tc.number : wbp_027 - * @tc.name : packing - callback-webp-quality 0 - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_027', 0, async function (done) { - let packOpts = { format: ["image/jpeg"], quality: 0 } - packingPromise(done, 'wbp_027', packOpts) - }) + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0200 + * @tc.name : packing - callback-webp-quality 0 + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0200", 0, async function (done) { + let packOpts = { format: ["image/jpeg"], quality: 0 }; + packingCb(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_CALLBACK_0200", packOpts); + }); - /** - * @tc.number : wbp_028 - * @tc.name : packing - promise-webp-quality 0 - * @tc.desc : 1.create ImageSource - * 2.call packing - * 3.return array - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('wbp_028', 0, async function (done) { - let packOpts = { format: ["image/jpeg"], quality: 0 } - packingPromise(done, 'wbp_028', packOpts) - }) -})} + /** + * @tc.number : SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0200 + * @tc.name : packing - promise-webp-quality 0 + * @tc.desc : 1.create ImageSource + * 2.call packing + * 3.return array + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it("SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0200", 0, async function (done) { + let packOpts = { format: ["image/jpeg"], quality: 0 }; + packingPromise(done, "SUB_GRAPHIC_IMAGE_WEBP_PACKING_PROMISE_0200", packOpts); + }); + }); +} diff --git a/multimedia/image/image_js_standard/imageYUV/BUILD.gn b/multimedia/image/image_js_standard/imageYUV/BUILD.gn index a1df27b81469655f7c8462a0bd65ac4926448774..4824bfac133c74fea212d5715477294cf78a6ad6 100644 --- a/multimedia/image/image_js_standard/imageYUV/BUILD.gn +++ b/multimedia/image/image_js_standard/imageYUV/BUILD.gn @@ -22,7 +22,7 @@ ohos_js_hap_suite("image_yuv_js_hap") { certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsImageyuvJsTest" subsystem_name = "multimedia" - part_name = "multimedia_image_standard" + part_name = "multimedia_image_framework" } ohos_js_assets("image_yuv_js_assets") { js2abc = true diff --git a/multimedia/image/image_js_standard/imageYUV/src/main/config.json b/multimedia/image/image_js_standard/imageYUV/src/main/config.json index 507d0a9b352c113bfee3409c97737e68575a7597..63e4e634a05ae43311e407591c3e169449273aa0 100644 --- a/multimedia/image/image_js_standard/imageYUV/src/main/config.json +++ b/multimedia/image/image_js_standard/imageYUV/src/main/config.json @@ -57,6 +57,7 @@ } ], "deviceType": [ + "default", "phone", "tablet", "tv", diff --git a/multimedia/image/image_js_standard/imageYUV/src/main/js/test/yuv.test.js b/multimedia/image/image_js_standard/imageYUV/src/main/js/test/yuv.test.js index d8366bcb0716c44041350f9bbd7d843ff1d27bf5..1e27e9077f3250a0fc24d0a241fb7515e7bb91fa 100644 --- a/multimedia/image/image_js_standard/imageYUV/src/main/js/test/yuv.test.js +++ b/multimedia/image/image_js_standard/imageYUV/src/main/js/test/yuv.test.js @@ -308,128 +308,128 @@ describe('imageYuv', function () { } /** - * @tc.number : SUB_IMAGE_yuv_pixelmap_P_001 - * @tc.name : SUB_IMAGE_yuv_pixelmap_P_001 + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0100 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0100 * @tc.desc : 1.create ImageSource * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_pixelmap_P_001', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0100', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 8, sourceSize: { height: 4, width: 6 } }; - yuvToJpegByPixelMapPromise(done, 'SUB_IMAGE_yuv_pixelmap_P_001', sourceOptions, yuvData) + yuvToJpegByPixelMapPromise(done, 'SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0100', sourceOptions, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_pixelmap_P_002 - * @tc.name : SUB_IMAGE_yuv_pixelmap_P_002 + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0200 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0200 * @tc.desc : 1.create ImageSource * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_pixelmap_P_002', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0200', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 9, sourceSize: { height: 4, width: 6 } }; - yuvToJpegByPixelMapPromise(done, 'SUB_IMAGE_yuv_pixelmap_P_002', sourceOptions, yuvData) + yuvToJpegByPixelMapPromise(done, 'SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0200', sourceOptions, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_pixelmap_P_003 - * @tc.name : SUB_IMAGE_yuv_pixelmap_P_003 - Promise - wrong buffer + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0300 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0300 - Promise - wrong buffer * @tc.desc : 1.create ImageSource * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_pixelmap_P_003', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0300', 0, async function (done) { let yuvData = new ArrayBuffer(5); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 8, sourceSize: { height: 4, width: 6 } }; - yuvToJpegByPixelMapPromise(done, 'SUB_IMAGE_yuv_pixelmap_P_003', sourceOptions, yuvData) + yuvToJpegByPixelMapPromise(done, 'SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0300', sourceOptions, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_pixelmap_P_004 - * @tc.name : SUB_IMAGE_yuv_pixelmap_P_004 - Promise - wrong width + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0400 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0400 - Promise - wrong width * @tc.desc : 1.create ImageSource * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_pixelmap_P_004', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0400', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 8, sourceSize: { height: 4, width: 5 } }; - yuvToJpegByPixelMapPromise_Fail(done, 'SUB_IMAGE_yuv_pixelmap_P_004', sourceOptions, yuvData) + yuvToJpegByPixelMapPromise_Fail(done, 'SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0400', sourceOptions, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_pixelmap_P_005 - * @tc.name : SUB_IMAGE_yuv_pixelmap_P_005 - Promise - wrong buffer + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0500 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0500 - Promise - wrong buffer * @tc.desc : 1.create ImageSource * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_pixelmap_P_005', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0500', 0, async function (done) { let yuvData = new ArrayBuffer(5); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 9, sourceSize: { height: 4, width: 6 } }; - yuvToJpegByPixelMapPromise(done, 'SUB_IMAGE_yuv_pixelmap_P_005', sourceOptions, yuvData) + yuvToJpegByPixelMapPromise(done, 'SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0500', sourceOptions, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_pixelmap_P_006 - * @tc.name : SUB_IMAGE_yuv_pixelmap_P_006 - Promise - wrong width + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0600 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0600 - Promise - wrong width * @tc.desc : 1.create ImageSource * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_pixelmap_P_006', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0600', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 9, sourceSize: { height: 4, width: 5 } }; - yuvToJpegByPixelMapPromise_Fail(done, 'SUB_IMAGE_yuv_pixelmap_P_006', sourceOptions, yuvData) + yuvToJpegByPixelMapPromise_Fail(done, 'SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0600', sourceOptions, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_pixelmap_P_007 - * @tc.name : SUB_IMAGE_yuv_pixelmap_P_007 - Promise - wrong format + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0700 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0700 - Promise - wrong format * @tc.desc : 1.create ImageSource * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_pixelmap_P_007', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0700', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 10, sourceSize: { height: 4, width: 6 } }; - yuvToJpegByPixelMapPromise_Fail(done, 'SUB_IMAGE_yuv_pixelmap_P_007', sourceOptions, yuvData) + yuvToJpegByPixelMapPromise_Fail(done, 'SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0700', sourceOptions, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_pixelmap_P_008 - * @tc.name : SUB_IMAGE_yuv_pixelmap_P_008 - Promise - format null + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0800 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0800 - Promise - format null * @tc.desc : 1.create ImageSource * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_pixelmap_P_008', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0800', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourceSize: { height: 4, width: 6 } }; - yuvToJpegByPixelMapPromise_Fail(done, 'SUB_IMAGE_yuv_pixelmap_P_008', sourceOptions, yuvData) + yuvToJpegByPixelMapPromise_Fail(done, 'SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_PROMISE_0800', sourceOptions, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_imagesource_P_001 - * @tc.name : SUB_IMAGE_yuv_imagesource_P_001 + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0100 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0100 * @tc.desc : 1.create ImageSource * 2.create pixelmap * 3.create ImagePacker @@ -438,16 +438,16 @@ describe('imageYuv', function () { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_imagesource_P_001', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0100', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 8, sourceSize: { height: 4, width: 6 } }; let packOpts = { format: "image/jpeg", quality: 99 } - yuvToJpegByImageSourcePromise(done, 'SUB_IMAGE_yuv_imagesource_P_001', sourceOptions, packOpts, yuvData) + yuvToJpegByImageSourcePromise(done, 'SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0100', sourceOptions, packOpts, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_imagesource_P_002 - * @tc.name : SUB_IMAGE_yuv_imagesource_P_002 + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0200 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0200 * @tc.desc : 1.create ImageSource * 2.create pixelmap * 3.create ImagePacker @@ -456,16 +456,16 @@ describe('imageYuv', function () { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_imagesource_P_002', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0200', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 9, sourceSize: { height: 4, width: 6 } }; let packOpts = { format: "image/jpeg", quality: 99 } - yuvToJpegByImageSourcePromise(done, 'SUB_IMAGE_yuv_imagesource_P_002', sourceOptions, packOpts, yuvData) + yuvToJpegByImageSourcePromise(done, 'SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0200', sourceOptions, packOpts, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_imagesource_P_003 - * @tc.name : SUB_IMAGE_yuv_imagesource_P_003 - Promise - wrong buffer + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0300 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0300 - Promise - wrong buffer * @tc.desc : 1.create ImageSource * 2.create pixelmap * 3.create ImagePacker @@ -474,16 +474,16 @@ describe('imageYuv', function () { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_imagesource_P_003', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0300', 0, async function (done) { let yuvData = new ArrayBuffer(5); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 8, sourceSize: { height: 4, width: 6 } }; let packOpts = { format: "image/jpeg", quality: 99 } - yuvToJpegByImageSourcePromise(done, 'SUB_IMAGE_yuv_imagesource_P_003', sourceOptions, packOpts, yuvData) + yuvToJpegByImageSourcePromise(done, 'SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0300', sourceOptions, packOpts, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_imagesource_P_004 - * @tc.name : SUB_IMAGE_yuv_imagesource_P_004 - Promise - wrong width + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0400 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0400 - Promise - wrong width * @tc.desc : 1.create ImageSource * 2.create pixelmap * 3.create ImagePacker @@ -492,16 +492,16 @@ describe('imageYuv', function () { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_imagesource_P_004', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0400', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 8, sourceSize: { height: 4, width: 5 } }; let packOpts = { format: "image/jpeg", quality: 99 } - yuvToJpegByImageSourcePromise_Fail(done, 'SUB_IMAGE_yuv_imagesource_P_004', sourceOptions, packOpts, yuvData) + yuvToJpegByImageSourcePromise_Fail(done, 'SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0400', sourceOptions, packOpts, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_imagesource_P_005 - * @tc.name : SUB_IMAGE_yuv_imagesource_P_005 - Promise - wrong buffer + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0500 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0500 - Promise - wrong buffer * @tc.desc : 1.create ImageSource * 2.create pixelmap * 3.create ImagePacker @@ -510,16 +510,16 @@ describe('imageYuv', function () { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_imagesource_P_005', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0500', 0, async function (done) { let yuvData = new ArrayBuffer(5); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 9, sourceSize: { height: 4, width: 6 } }; let packOpts = { format: "image/jpeg", quality: 99 } - yuvToJpegByImageSourcePromise(done, 'SUB_IMAGE_yuv_imagesource_P_005', sourceOptions, packOpts, yuvData) + yuvToJpegByImageSourcePromise(done, 'SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0500', sourceOptions, packOpts, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_imagesource_P_006 - * @tc.name : SUB_IMAGE_yuv_imagesource_P_006 - Promise - wrong width + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0600 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0600 - Promise - wrong width * @tc.desc : 1.create ImageSource * 2.create pixelmap * 3.create ImagePacker @@ -528,16 +528,16 @@ describe('imageYuv', function () { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_imagesource_P_006', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0600', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 9, sourceSize: { height: 4, width: 5 } }; let packOpts = { format: "image/jpeg", quality: 99 } - yuvToJpegByImageSourcePromise_Fail(done, 'SUB_IMAGE_yuv_imagesource_P_006', sourceOptions, packOpts, yuvData) + yuvToJpegByImageSourcePromise_Fail(done, 'SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0600', sourceOptions, packOpts, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_imagesource_P_007 - * @tc.name : SUB_IMAGE_yuv_imagesource_P_007 - Promise - wrong format + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0700 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0700 - Promise - wrong format * @tc.desc : 1.create ImageSource * 2.create pixelmap * 3.create ImagePacker @@ -546,16 +546,16 @@ describe('imageYuv', function () { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_imagesource_P_007', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0700', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 10, sourceSize: { height: 4, width: 6 } }; let packOpts = { format: "image/jpeg", quality: 99 } - yuvToJpegByImageSourcePromise_Fail(done, 'SUB_IMAGE_yuv_imagesource_P_007', sourceOptions, packOpts, yuvData) + yuvToJpegByImageSourcePromise_Fail(done, 'SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0700', sourceOptions, packOpts, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_imagesource_P_008 - * @tc.name : SUB_IMAGE_yuv_imagesource_P_008 - Promise - format null + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0800 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0800 - Promise - format null * @tc.desc : 1.create ImageSource * 2.create pixelmap * 3.create ImagePacker @@ -564,15 +564,15 @@ describe('imageYuv', function () { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_imagesource_P_008', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0800', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourceSize: { height: 4, width: 6 } }; let packOpts = { format: "image/jpeg", quality: 99 } - yuvToJpegByImageSourcePromise_Fail(done, 'SUB_IMAGE_yuv_imagesource_P_008', sourceOptions, packOpts, yuvData) + yuvToJpegByImageSourcePromise_Fail(done, 'SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_PROMISE_0800', sourceOptions, packOpts, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_pixelmap_CB_001 + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0100 * @tc.name : SUB_IMAGE_yuv_pixelmap_CB_001 * @tc.desc : 1.create ImageSource * 2.create pixelmap @@ -580,14 +580,14 @@ describe('imageYuv', function () { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_pixelmap_CB_001', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0100', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 8, sourceSize: { height: 4, width: 6 } }; - yuvToJpegByPixelMapCallback(done, 'SUB_IMAGE_yuv_pixelmap_CB_001', sourceOptions, yuvData) + yuvToJpegByPixelMapCallback(done, 'SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0100', sourceOptions, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_pixelmap_CB_002 + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0200 * @tc.name : SUB_IMAGE_yuv_pixelmap_CB_002 * @tc.desc : 1.create ImageSource * 2.create pixelmap @@ -595,105 +595,105 @@ describe('imageYuv', function () { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_pixelmap_CB_002', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0200', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 9, sourceSize: { height: 4, width: 6 } }; - yuvToJpegByPixelMapCallback(done, 'SUB_IMAGE_yuv_pixelmap_CB_002', sourceOptions, yuvData) + yuvToJpegByPixelMapCallback(done, 'SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0200', sourceOptions, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_pixelmap_CB_003 - * @tc.name : SUB_IMAGE_yuv_pixelmap_CB_003 - Promise - wrong buffer + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0300 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0300 - Promise - wrong buffer * @tc.desc : 1.create ImageSource * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_pixelmap_CB_003', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0300', 0, async function (done) { let yuvData = new ArrayBuffer(5); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 8, sourceSize: { height: 4, width: 6 } }; - yuvToJpegByPixelMapCallback(done, 'SUB_IMAGE_yuv_pixelmap_CB_003', sourceOptions, yuvData) + yuvToJpegByPixelMapCallback(done, 'SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0300', sourceOptions, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_pixelmap_CB_004 - * @tc.name : SUB_IMAGE_yuv_pixelmap_CB_004 - Promise - wrong width + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0400 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0400 - Promise - wrong width * @tc.desc : 1.create ImageSource * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_pixelmap_CB_004', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0400', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 8, sourceSize: { height: 4, width: 5 } }; - yuvToJpegByPixelMapCallback_Fail(done, 'SUB_IMAGE_yuv_pixelmap_CB_004', sourceOptions, yuvData) + yuvToJpegByPixelMapCallback_Fail(done, 'SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0400', sourceOptions, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_pixelmap_CB_005 - * @tc.name : SUB_IMAGE_yuv_pixelmap_CB_005 - Promise - wrong buffer + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0500 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0500 - Promise - wrong buffer * @tc.desc : 1.create ImageSource * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_pixelmap_CB_005', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0500', 0, async function (done) { let yuvData = new ArrayBuffer(5); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 9, sourceSize: { height: 4, width: 6 } }; - yuvToJpegByPixelMapCallback(done, 'SUB_IMAGE_yuv_pixelmap_CB_005', sourceOptions, yuvData) + yuvToJpegByPixelMapCallback(done, 'SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0500', sourceOptions, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_pixelmap_CB_006 - * @tc.name : SUB_IMAGE_yuv_pixelmap_CB_006 - Promise - wrong width + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0600 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0600 - Promise - wrong width * @tc.desc : 1.create ImageSource * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_pixelmap_CB_006', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0600', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 9, sourceSize: { height: 4, width: 5 } }; - yuvToJpegByPixelMapCallback_Fail(done, 'SUB_IMAGE_yuv_pixelmap_CB_006', sourceOptions, yuvData) + yuvToJpegByPixelMapCallback_Fail(done, 'SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0600', sourceOptions, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_pixelmap_CB_007 - * @tc.name : SUB_IMAGE_yuv_pixelmap_CB_007 - Promise - wrong format + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0700 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0700 - Promise - wrong format * @tc.desc : 1.create ImageSource * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_pixelmap_CB_007', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0700', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 10, sourceSize: { height: 4, width: 6 } }; - yuvToJpegByPixelMapCallback_Fail(done, 'SUB_IMAGE_yuv_pixelmap_CB_007', sourceOptions, yuvData) + yuvToJpegByPixelMapCallback_Fail(done, 'SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0700', sourceOptions, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_pixelmap_CB_008 - * @tc.name : SUB_IMAGE_yuv_pixelmap_CB_008 - Promise - format null + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0800 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0800 - Promise - format null * @tc.desc : 1.create ImageSource * 2.create pixelmap * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_pixelmap_CB_008', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0800', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourceSize: { height: 4, width: 6 } }; - yuvToJpegByPixelMapCallback_Fail(done, 'SUB_IMAGE_yuv_pixelmap_CB_008', sourceOptions, yuvData) + yuvToJpegByPixelMapCallback_Fail(done, 'SUB_GRAPHIC_IMAGE_YUV_PIXELMAP_CB_0800', sourceOptions, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_imagesource_CB_001 - * @tc.name : SUB_IMAGE_yuv_imagesource_CB_001 + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0100 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0100 * @tc.desc : 1.create ImageSource * 2.create pixelmap * 3.create ImagePacker @@ -702,15 +702,15 @@ describe('imageYuv', function () { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_imagesource_CB_001', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0100', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 8, sourceSize: { height: 4, width: 6 } }; let packOpts = { format: "image/jpeg", quality: 99 } - yuvToJpegByImageSourceCallback(done, 'SUB_IMAGE_yuv_imagesource_CB_001', sourceOptions, packOpts, yuvData) + yuvToJpegByImageSourceCallback(done, 'SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0100', sourceOptions, packOpts, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_imagesource_CB_002 + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0200 * @tc.name : SUB_IMAGE_yuv_imagesource_CB_002 * @tc.desc : 1.create ImageSource * 2.create pixelmap @@ -720,16 +720,16 @@ describe('imageYuv', function () { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_imagesource_CB_002', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0200', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 9, sourceSize: { height: 4, width: 6 } }; let packOpts = { format: "image/jpeg", quality: 99 } - yuvToJpegByImageSourceCallback(done, 'SUB_IMAGE_yuv_imagesource_CB_002', sourceOptions, packOpts, yuvData) + yuvToJpegByImageSourceCallback(done, 'SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0200', sourceOptions, packOpts, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_imagesource_CB_003 - * @tc.name : SUB_IMAGE_yuv_imagesource_CB_003 - Promise - wrong buffer + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0300 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0300 - Promise - wrong buffer * @tc.desc : 1.create ImageSource * 2.create pixelmap * 3.create ImagePacker @@ -738,16 +738,16 @@ describe('imageYuv', function () { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_imagesource_CB_003', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0300', 0, async function (done) { let yuvData = new ArrayBuffer(5); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 8, sourceSize: { height: 4, width: 6 } }; let packOpts = { format: "image/jpeg", quality: 99 } - yuvToJpegByImageSourceCallback(done, 'SUB_IMAGE_yuv_imagesource_CB_003', sourceOptions, packOpts, yuvData) + yuvToJpegByImageSourceCallback(done, 'SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0300', sourceOptions, packOpts, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_imagesource_CB_004 - * @tc.name : SUB_IMAGE_yuv_imagesource_CB_004 - Promise - wrong width + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0400 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0400 - Promise - wrong width * @tc.desc : 1.create ImageSource * 2.create pixelmap * 3.create ImagePacker @@ -756,16 +756,16 @@ describe('imageYuv', function () { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_imagesource_CB_004', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0400', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 8, sourceSize: { height: 4, width: 5 } }; let packOpts = { format: "image/jpeg", quality: 99 } - yuvToJpegByImageSourceCallback_Fail(done, 'SUB_IMAGE_yuv_imagesource_CB_004', sourceOptions, packOpts, yuvData) + yuvToJpegByImageSourceCallback_Fail(done, 'SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0400', sourceOptions, packOpts, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_imagesource_CB_005 - * @tc.name : SUB_IMAGE_yuv_imagesource_CB_005 - Promise - wrong buffer + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0500 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0500 - Promise - wrong buffer * @tc.desc : 1.create ImageSource * 2.create pixelmap * 3.create ImagePacker @@ -774,16 +774,16 @@ describe('imageYuv', function () { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_imagesource_CB_005', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0500', 0, async function (done) { let yuvData = new ArrayBuffer(5); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 9, sourceSize: { height: 4, width: 6 } }; let packOpts = { format: "image/jpeg", quality: 99 } - yuvToJpegByImageSourceCallback(done, 'SUB_IMAGE_yuv_imagesource_CB_005', sourceOptions, packOpts, yuvData) + yuvToJpegByImageSourceCallback(done, 'SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0500', sourceOptions, packOpts, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_imagesource_CB_006 - * @tc.name : SUB_IMAGE_yuv_imagesource_CB_006 - Promise - wrong width + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0600 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0600 - Promise - wrong width * @tc.desc : 1.create ImageSource * 2.create pixelmap * 3.create ImagePacker @@ -792,16 +792,16 @@ describe('imageYuv', function () { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_imagesource_CB_006', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0600', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 9, sourceSize: { height: 4, width: 5 } }; let packOpts = { format: "image/jpeg", quality: 99 } - yuvToJpegByImageSourceCallback_Fail(done, 'SUB_IMAGE_yuv_imagesource_CB_006', sourceOptions, packOpts, yuvData) + yuvToJpegByImageSourceCallback_Fail(done, 'SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0600', sourceOptions, packOpts, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_imagesource_CB_007 - * @tc.name : SUB_IMAGE_yuv_imagesource_CB_007 - Promise - wrong format + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0700 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0700 - Promise - wrong format * @tc.desc : 1.create ImageSource * 2.create pixelmap * 3.create ImagePacker @@ -810,16 +810,16 @@ describe('imageYuv', function () { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_imagesource_CB_007', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0700', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourcePixelFormat: 10, sourceSize: { height: 4, width: 6 } }; let packOpts = { format: "image/jpeg", quality: 99 } - yuvToJpegByImageSourceCallback_Fail(done, 'SUB_IMAGE_yuv_imagesource_CB_007', sourceOptions, packOpts, yuvData) + yuvToJpegByImageSourceCallback_Fail(done, 'SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0700', sourceOptions, packOpts, yuvData) }) /** - * @tc.number : SUB_IMAGE_yuv_imagesource_CB_008 - * @tc.name : SUB_IMAGE_yuv_imagesource_CB_008 - Promise - format null + * @tc.number : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0800 + * @tc.name : SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0800 - Promise - format null * @tc.desc : 1.create ImageSource * 2.create pixelmap * 3.create ImagePacker @@ -828,10 +828,10 @@ describe('imageYuv', function () { * @tc.type : Functional * @tc.level : level 0 */ - it('SUB_IMAGE_yuv_imagesource_CB_008', 0, async function (done) { + it('SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0800', 0, async function (done) { let yuvData = createBuffer(4, 6); let sourceOptions = { sourceDensity: 120, sourceSize: { height: 4, width: 6 } }; let packOpts = { format: "image/jpeg", quality: 99 } - yuvToJpegByImageSourceCallback_Fail(done, 'SUB_IMAGE_yuv_imagesource_CB_008', sourceOptions, packOpts, yuvData) + yuvToJpegByImageSourceCallback_Fail(done, 'SUB_GRAPHIC_IMAGE_YUV_IMAGESOURCE_CB_0800', sourceOptions, packOpts, yuvData) }) })} diff --git a/multimedia/image/image_js_standard/image_ndk_test/BUILD.gn b/multimedia/image/image_js_standard/image_ndk_test/BUILD.gn index 304f6ae4025505609f9f913572bd251f6b0f4e8e..de545729f127a714074b153beedc9610b7dd8bb2 100644 --- a/multimedia/image/image_js_standard/image_ndk_test/BUILD.gn +++ b/multimedia/image/image_js_standard/image_ndk_test/BUILD.gn @@ -25,7 +25,7 @@ ohos_js_hap_suite("image_pixelmap_ndk_hap") { hap_name = "ActsPixelMapNapiEtsTest" shared_libraries = [ "./entry/src/main/cpp:imagePixelmap" ] subsystem_name = "multimedia" - part_name = "multimedia_image_standard" + part_name = "multimedia_image_framework" } ohos_js_assets("pixelmap_ets_assets") { diff --git a/multimedia/image/image_js_standard/image_ndk_test/entry/src/main/config.json b/multimedia/image/image_js_standard/image_ndk_test/entry/src/main/config.json index e7cfb44a6d2fe00a977e2d1b1c673905897a5650..a5a941b05f2366e7facd375be197a8719d312a5c 100644 --- a/multimedia/image/image_js_standard/image_ndk_test/entry/src/main/config.json +++ b/multimedia/image/image_js_standard/image_ndk_test/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": "ohos.image.napitest.MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/multimedia/image/image_js_standard/image_ndk_test/entry/src/main/cpp/BUILD.gn b/multimedia/image/image_js_standard/image_ndk_test/entry/src/main/cpp/BUILD.gn index aebf555170d31efbddbca6ec0c71ba8a295f04e7..aff4d0ff8cb08a0393be924e0764967a0665529a 100644 --- a/multimedia/image/image_js_standard/image_ndk_test/entry/src/main/cpp/BUILD.gn +++ b/multimedia/image/image_js_standard/image_ndk_test/entry/src/main/cpp/BUILD.gn @@ -31,7 +31,7 @@ config("public_config") { ohos_shared_library("imagePixelmap") { sources = [ "./napi/imagePixelmap.cpp" ] - if (!(product_name == "m40")) { + if (use_musl) { if (target_cpu == "arm") { libs = [ "${clang_base_path}/../libcxx-ndk/lib/arm-linux-ohos/c++/libc++_shared.so" ] } else if (target_cpu == "arm64") { @@ -45,7 +45,7 @@ ohos_shared_library("imagePixelmap") { deps = [ "//foundation/arkui/napi:ace_napi", - "//foundation/multimedia/image_standard/frameworks/kits/js/common/pixelmap_ndk:pixelmap_ndk", + "//foundation/multimedia/image_framework/frameworks/kits/js/common/pixelmap_ndk:pixelmap_ndk", ] output_extension = "so" diff --git a/multimedia/media/media_cpp_standard/BUILD.gn b/multimedia/media/media_cpp_standard/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..464df229a1a2db8d1099b2ccba48391657783723 --- /dev/null +++ b/multimedia/media/media_cpp_standard/BUILD.gn @@ -0,0 +1,75 @@ +# 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("//test/xts/tools/build/suite.gni") + +module_output_path = "acts/ActsAvcodecNdkTest" + +ohos_moduletest_suite("ActsAvcodecNdkTest") { + module_out_path = module_output_path + sources = [ + "audioDecEncNdk/src/ADecEncNdkSample.cpp", + "audioDecEncNdk/src/ActsAudioDecEncNdkTest.cpp", + "videoDecEncNdk/src/ActsVideoDecEncNdkTest.cpp", + "videoDecEncNdk/src/VDecEncNdkSample.cpp", + ] + include_dirs = [ + "include", + "audioDecEncNdk/include", + "videoDecEncNdk/include", + "//foundation/multimedia/audio_framework/interfaces/inner_api/native/audiocommon/include", + "//foundation/multimedia/player_framework/interfaces/inner_api/native", + "//foundation/multimedia/player_framework/interfaces/kits/c", + "//foundation/multimedia/player_framework/frameworks/native/capi/common", + "//commonlibrary/c_utils/base/include", + "//graphic/graphic_2d/interfaces/kits/surface", + "//graphic/graphic_2d/interfaces/inner_api/surface", + "//foundation/graphic/graphic_2d/frameworks/surface/include", + ] + + cflags = [ + "-Werror", + "-fno-rtti", + "-fno-exceptions", + "-Wall", + "-fno-common", + "-fstack-protector-strong", + "-Wshadow", + "-FPIC", + "-FS", + "-O2", + "-D_FORTIFY_SOURCE=2", + "-fvisibility=hidden", + "-Wformat=2", + "-Wdate-time", + "", + ] + + deps = [ + "//foundation/graphic/graphic_2d:libsurface", + "//foundation/graphic/graphic_2d/frameworks/surface:surface", + "//foundation/multimedia/player_framework/interfaces/kits/c:native_media_adec", + "//foundation/multimedia/player_framework/interfaces/kits/c:native_media_aenc", + "//foundation/multimedia/player_framework/interfaces/kits/c:native_media_codecbase", + "//foundation/multimedia/player_framework/interfaces/kits/c:native_media_core", + "//foundation/multimedia/player_framework/interfaces/kits/c:native_media_vdec", + "//foundation/multimedia/player_framework/interfaces/kits/c:native_media_venc", + ] + external_deps = [ + "c_utils:utils", + "hiviewdfx_hilog_native:libhilog", + ] + + part_name = "multimedia_player_framework" + subsystem_name = "multimedia" +} diff --git a/multimedia/media/media_cpp_standard/Test.json b/multimedia/media/media_cpp_standard/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..f8a1ecfb98ea2e46c3eed0d5166f6adc26f22e62 --- /dev/null +++ b/multimedia/media/media_cpp_standard/Test.json @@ -0,0 +1,35 @@ +{ + "description": "Config for avcodec ndk test cases", + "driver": { + "module-name": "ActsAvcodecNdkTest", + "native-test-timeout": "300000", + "native-test-device-path": "/data/local/tmp", + "runtime-hint": "1s", + "type": "CppTest" + }, + "kits": [ + { + "type": "PushKit", + "pre-push" : [ + "mount -o rw,remount /", + "rm /data/media/*", + "mkdir -p /data/media/", + "mkdir -p /data/local/tmp/" + ], + "push": [ + "ActsAvcodecNdkTest->/data/local/tmp/ActsAvcodecNdkTest", + "./resource/audio/audioDecode/AAC_48000_32_1.aac ->/data/media/", + "./resource/media/es/out_320_240_10s.h264 ->/data/media/" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "hilog -Q pidoff", + "chmod 777 -R /data/local/tmp", + "chmod 777 -R /data/media", + "chmod 777 /data/media/*" + ] + } + ] +} \ No newline at end of file diff --git a/multimedia/media/media_cpp_standard/audioDecEncNdk/include/ADecEncNdkSample.h b/multimedia/media/media_cpp_standard/audioDecEncNdk/include/ADecEncNdkSample.h new file mode 100644 index 0000000000000000000000000000000000000000..ea8bc106c1b3657d19d0530f6e9471ac18d3218f --- /dev/null +++ b/multimedia/media/media_cpp_standard/audioDecEncNdk/include/ADecEncNdkSample.h @@ -0,0 +1,139 @@ +/* + * 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 AUDIODECENC_NDK_SAMPLE_H +#define AUDIODECENC_NDK_SAMPLE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "securec.h" +#include "native_avcodec_base.h" +#include "native_avcodec_audiodecoder.h" +#include "native_avcodec_audioencoder.h" +#include "nocopyable.h" +#include "ndktest_log.h" + +namespace OHOS { +namespace Media { +class ADecEncSignal { +public: + std::mutex inMutexDec_; + std::condition_variable inCondDec_; + std::queue inQueueDec_; + std::queue outQueueDec_; + std::queue sizeQueueDec_; + std::queue flagQueueDec_; + std::queue inBufferQueueDec_; + std::queue outBufferQueueDec_; + + std::mutex inMutexEnc_; + std::mutex outMutexEnc_; + std::condition_variable inCondEnc_; + std::condition_variable outCondEnc_; + std::queue inQueueEnc_; + std::queue outQueueEnc_; + std::queue sizeQueueEnc_; + std::queue flagQueueEnc_; + std::queue inBufferQueueEnc_; + std::queue outBufferQueueEnc_; + int32_t errorNum_ = 0; + std::atomic isFlushing_ = false; +}; + +class ADecEncNdkSample : public NoCopyable { +public: + ADecEncNdkSample() = default; + ~ADecEncNdkSample(); + + struct OH_AVCodec* CreateAudioDecoder(std::string mimetype); + int32_t ConfigureDec(struct OH_AVFormat *format); + int32_t PrepareDec(); + int32_t StartDec(); + int32_t StopDec(); + int32_t FlushDec(); + int32_t ResetDec(); + int32_t ReleaseDec(); + + struct OH_AVCodec* CreateAudioEncoder(std::string mimetype); + int32_t ConfigureEnc(struct OH_AVFormat *format); + int32_t PrepareEnc(); + int32_t StartEnc(); + int32_t StopEnc(); + int32_t FlushEnc(); + int32_t ResetEnc(); + int32_t ReleaseEnc(); + int32_t CalcuError(); + + void SetReadPath(const char* inp_path, uint32_t es[], uint32_t length); + void SetEosState(bool needSetEos); + void SetSavePath(const char* outp_path); + void ReRead(); + void ResetDecParam(); + void ResetEncParam(); + int32_t GetFrameCount(); + bool GetEncEosState(); + bool GetDecEosState(); + void PopInqueueDec(); + void PopOutqueueDec(); + void PopInqueueEnc(); + void PopOutqueueEnc(); + int32_t PushInbufferDec(uint32_t index, uint32_t bufferSize); + int32_t PushInbufferEnc(); + + ADecEncSignal* acodecSignal_ = nullptr; + uint32_t decInCnt_ = 0; + uint32_t decOutCnt_ = 0; + uint32_t encInCnt_ = 0; + uint32_t encOutCnt_ = 0; + bool isDecInputEOS = false; + bool isEncInputEOS = false; + bool isDecOutputEOS = false; + bool isEncOutputEOS = false; + bool setEos = true; + +private: + struct OH_AVCodec* adec_; + void InputFuncDec(); + std::atomic isDecRunning_ = false; + std::unique_ptr testFile_; + std::unique_ptr inputLoopDec_; + std::unique_ptr outputLoopDec_; + struct OH_AVCodecAsyncCallback cbDec_; + int64_t timeStampDec_ = 0; + struct OH_AVCodec* aenc_; + void InputFuncEnc(); + void OutputFuncEnc(); + int32_t WriteToFile(); + std::atomic isEncRunning_ = false; + std::unique_ptr inputLoopEnc_; + std::unique_ptr outputLoopEnc_; + struct OH_AVCodecAsyncCallback cbEnc_; + int64_t timeStampEnc_ = 0; + std::string outDir_ = "/data/media/out.aac"; + const char* INP_FILE; + const char* OUT_FILE; + uint32_t* ES; + uint32_t ES_LENGTH = 0; +}; +} +} +#endif // AUDIODECENC_NDK_SAMPLE_H diff --git a/multimedia/media/media_cpp_standard/audioDecEncNdk/src/ADecEncNdkSample.cpp b/multimedia/media/media_cpp_standard/audioDecEncNdk/src/ADecEncNdkSample.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9b542b4ac87b604ba8befc7d7c309c37d054b472 --- /dev/null +++ b/multimedia/media/media_cpp_standard/audioDecEncNdk/src/ADecEncNdkSample.cpp @@ -0,0 +1,753 @@ +/* + * 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 "ADecEncNdkSample.h" +#include "native_avmemory.h" +#include "native_averrors.h" +using namespace OHOS; +using namespace OHOS::Media; +using namespace std; + +namespace { + constexpr uint32_t SAMPLE_DURATION_US = 23000; + constexpr uint32_t STOPNUM = 10000; + + void AdecAsyncError(OH_AVCodec *codec, int32_t errorCode, void *userData) + { + ADecEncSignal* acodecSignal_ = static_cast(userData); + cout << "DEC Error errorCode=" << errorCode << endl; + acodecSignal_->errorNum_ += 1; + } + + void AdecAsyncStreamChanged(OH_AVCodec *codec, OH_AVFormat *format, void *userData) + { + cout << "DEC Format Changed" << endl; + } + + void AdecAsyncNeedInputData(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, void *userData) + { + ADecEncSignal* acodecSignal_ = static_cast(userData); + unique_lock lock(acodecSignal_->inMutexDec_); + if (acodecSignal_->isFlushing_.load()) { + return; + } + acodecSignal_->inQueueDec_.push(index); + acodecSignal_->inBufferQueueDec_.push(data); + acodecSignal_->inCondDec_.notify_all(); + } + + void AdecAsyncNewOutputData(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, + OH_AVCodecBufferAttr *attr, void *userData) + { + ADecEncSignal* acodecSignal_ = static_cast(userData); + unique_lock lock(acodecSignal_->inMutexEnc_); + if (acodecSignal_->isFlushing_.load()) { + cout << "DEC OutputAvailable: isFlushing_.load() is true, return" << endl; + return; + } + acodecSignal_->outQueueDec_.push(index); + acodecSignal_->sizeQueueDec_.push(attr->size); + acodecSignal_->flagQueueDec_.push(attr->flags); + acodecSignal_->outBufferQueueDec_.push(data); + acodecSignal_->inCondEnc_.notify_all(); + } + + void AencAsyncError(OH_AVCodec *codec, int32_t errorCode, void *userData) + { + ADecEncSignal* acodecSignal_ = static_cast(userData); + cout << "ENC Error errorCode=" << errorCode << endl; + acodecSignal_->errorNum_ += 1; + } + + void AencAsyncStreamChanged(OH_AVCodec *codec, OH_AVFormat *format, void *userData) + { + cout << "ENC Format Changed" << endl; + } + + void AencAsyncNeedInputData(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, void *userData) + { + ADecEncSignal* acodecSignal_ = static_cast(userData); + unique_lock lock(acodecSignal_->inMutexEnc_); + if (acodecSignal_->isFlushing_.load()) { + return; + } + acodecSignal_->inQueueEnc_.push(index); + acodecSignal_->inBufferQueueEnc_.push(data); + acodecSignal_->inCondEnc_.notify_all(); + } + + void AencAsyncNewOutputData(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, + OH_AVCodecBufferAttr *attr, void *userData) + { + ADecEncSignal* acodecSignal_ = static_cast(userData); + unique_lock lock(acodecSignal_->outMutexEnc_); + if (acodecSignal_->isFlushing_.load()) { + return; + } + acodecSignal_->outQueueEnc_.push(index); + acodecSignal_->sizeQueueEnc_.push(attr->size); + acodecSignal_->flagQueueEnc_.push(attr->flags); + acodecSignal_->outBufferQueueEnc_.push(data); + acodecSignal_->outCondEnc_.notify_all(); + } + + void clearIntqueue (std::queue& q) + { + std::queue empty; + swap(empty, q); + } + + void clearBufferqueue (std::queue& q) + { + std::queue empty; + swap(empty, q); + } +} + +ADecEncNdkSample::~ADecEncNdkSample() +{ + OH_AudioDecoder_Destroy(adec_); + OH_AudioEncoder_Destroy(aenc_); + delete acodecSignal_; + acodecSignal_ = nullptr; +} + +struct OH_AVCodec* ADecEncNdkSample::CreateAudioDecoder(std::string mimetype) +{ + adec_ = OH_AudioDecoder_CreateByMime(mimetype.c_str()); + NDK_CHECK_AND_RETURN_RET_LOG(adec_ != nullptr, nullptr, "Fatal: OH_AudioDecoder_CreateByMime"); + + acodecSignal_ = new ADecEncSignal(); + NDK_CHECK_AND_RETURN_RET_LOG(acodecSignal_ != nullptr, nullptr, "Fatal: No Memory"); + + cbDec_.onError = AdecAsyncError; + cbDec_.onStreamChanged = AdecAsyncStreamChanged; + cbDec_.onNeedInputData = AdecAsyncNeedInputData; + cbDec_.onNeedOutputData = AdecAsyncNewOutputData; + int32_t ret = OH_AudioDecoder_SetCallback(adec_, cbDec_, static_cast(acodecSignal_)); + NDK_CHECK_AND_RETURN_RET_LOG(ret == AV_ERR_OK, NULL, "Fatal: OH_AudioDecoder_SetCallback"); + return adec_; +} + +int32_t ADecEncNdkSample::ConfigureDec(struct OH_AVFormat *format) +{ + return OH_AudioDecoder_Configure(adec_, format); +} + +int32_t ADecEncNdkSample::PrepareDec() +{ + return OH_AudioDecoder_Prepare(adec_); +} + +int32_t ADecEncNdkSample::StartDec() +{ + cout << "Enter start dec" << endl; + isDecRunning_.store(true); + if (testFile_ == nullptr) { + testFile_ = std::make_unique(); + NDK_CHECK_AND_RETURN_RET_LOG(testFile_ != nullptr, AV_ERR_UNKNOWN, "Fatal: No memory"); + testFile_->open(INP_FILE, std::ios::in | std::ios::binary); + } + if (inputLoopDec_ == nullptr) { + inputLoopDec_ = make_unique(&ADecEncNdkSample::InputFuncDec, this); + NDK_CHECK_AND_RETURN_RET_LOG(inputLoopDec_ != nullptr, AV_ERR_UNKNOWN, "Fatal: No memory"); + } + cout << "Exit start dec" << endl; + return OH_AudioDecoder_Start(adec_); +} + +void ADecEncNdkSample::ResetDecParam() +{ + isDecInputEOS = false; + isDecOutputEOS = false; + decInCnt_ = 0; + decOutCnt_ = 0; + acodecSignal_->isFlushing_.store(true); + unique_lock lock(acodecSignal_->inMutexDec_); + clearIntqueue(acodecSignal_->inQueueDec_); + clearBufferqueue(acodecSignal_->inBufferQueueDec_); + acodecSignal_->inCondDec_.notify_all(); + lock.unlock(); + unique_lock lock2(acodecSignal_->inMutexEnc_); + clearIntqueue(acodecSignal_->outQueueDec_); + clearIntqueue(acodecSignal_->sizeQueueDec_); + clearIntqueue(acodecSignal_->flagQueueDec_); + clearBufferqueue(acodecSignal_->outBufferQueueDec_); + acodecSignal_->inCondEnc_.notify_all(); + lock2.unlock(); + acodecSignal_->isFlushing_.store(false); + isDecRunning_.store(true); +} + +void ADecEncNdkSample::ResetEncParam() +{ + isEncInputEOS = false; + isEncOutputEOS = false; + encInCnt_ = 0; + encOutCnt_ = 0; + acodecSignal_->isFlushing_.store(true); + unique_lock lock(acodecSignal_->inMutexEnc_); + clearIntqueue(acodecSignal_->inQueueEnc_); + clearBufferqueue(acodecSignal_->inBufferQueueEnc_); + acodecSignal_->inCondEnc_.notify_all(); + lock.unlock(); + unique_lock lock2(acodecSignal_->outMutexEnc_); + clearIntqueue(acodecSignal_->outQueueEnc_); + clearIntqueue(acodecSignal_->sizeQueueEnc_); + clearIntqueue(acodecSignal_->flagQueueEnc_); + clearBufferqueue(acodecSignal_->outBufferQueueEnc_); + acodecSignal_->outCondEnc_.notify_all(); + lock2.unlock(); + acodecSignal_->isFlushing_.store(false); + isEncRunning_.store(true); +} + +int32_t ADecEncNdkSample::StopDec() +{ + cout << "ENTER DEC STOP" << endl; + unique_lock lock(acodecSignal_->inMutexDec_); + unique_lock lock2(acodecSignal_->inMutexEnc_); + acodecSignal_->isFlushing_.store(true); + lock.unlock(); + lock2.unlock(); + int32_t ret = OH_AudioDecoder_Stop(adec_); + unique_lock lockIn(acodecSignal_->inMutexDec_); + clearIntqueue(acodecSignal_->inQueueDec_); + clearBufferqueue(acodecSignal_->inBufferQueueDec_); + acodecSignal_->inCondDec_.notify_all(); + unique_lock lockOut(acodecSignal_->inMutexEnc_); + clearIntqueue(acodecSignal_->outQueueDec_); + clearIntqueue(acodecSignal_->sizeQueueDec_); + clearIntqueue(acodecSignal_->flagQueueDec_); + clearBufferqueue(acodecSignal_->outBufferQueueDec_); + acodecSignal_->inCondEnc_.notify_all(); + acodecSignal_->isFlushing_.store(false); + lockIn.unlock(); + lockOut.unlock(); + cout << "EXIT DEC STOP" << endl; + return ret; +} + +int32_t ADecEncNdkSample::FlushDec() +{ + cout << "ENTER DEC FLUSH" << endl; + unique_lock lock(acodecSignal_->inMutexDec_); + unique_lock lock2(acodecSignal_->inMutexEnc_); + acodecSignal_->isFlushing_.store(true); + lock.unlock(); + lock2.unlock(); + int32_t ret = OH_AudioDecoder_Flush(adec_); + unique_lock lockIn(acodecSignal_->inMutexDec_); + clearIntqueue(acodecSignal_->inQueueDec_); + clearBufferqueue(acodecSignal_->inBufferQueueDec_); + acodecSignal_->inCondDec_.notify_all(); + unique_lock lockOut(acodecSignal_->inMutexEnc_); + clearIntqueue(acodecSignal_->outQueueDec_); + clearIntqueue(acodecSignal_->sizeQueueDec_); + clearIntqueue(acodecSignal_->flagQueueDec_); + clearBufferqueue(acodecSignal_->outBufferQueueDec_); + acodecSignal_->inCondEnc_.notify_all(); + acodecSignal_->isFlushing_.store(false); + lockIn.unlock(); + lockOut.unlock(); + cout << "EXIT DEC FLUSH" << endl; + return ret; +} + +int32_t ADecEncNdkSample::ResetDec() +{ + cout << "enter Reset DEC" << endl; + unique_lock lock(acodecSignal_->inMutexDec_); + unique_lock lock2(acodecSignal_->inMutexEnc_); + acodecSignal_->isFlushing_.store(true); + lock.unlock(); + lock2.unlock(); + int32_t ret = OH_AudioDecoder_Reset(adec_); + unique_lock lockIn(acodecSignal_->inMutexDec_); + clearIntqueue(acodecSignal_->inQueueDec_); + clearBufferqueue(acodecSignal_->inBufferQueueDec_); + acodecSignal_->inCondDec_.notify_all(); + unique_lock lockOut(acodecSignal_->inMutexEnc_); + clearIntqueue(acodecSignal_->outQueueDec_); + clearIntqueue(acodecSignal_->sizeQueueDec_); + clearIntqueue(acodecSignal_->flagQueueDec_); + clearBufferqueue(acodecSignal_->outBufferQueueDec_); + acodecSignal_->inCondEnc_.notify_all(); + acodecSignal_->isFlushing_.store(false); + lockIn.unlock(); + lockOut.unlock(); + cout << "exit Reset DEC" << endl; + return ret; +} + +int32_t ADecEncNdkSample::ReleaseDec() +{ + cout << "enter Release DEC" << endl; + isDecRunning_.store(false); + isEncRunning_.store(false); + cout << "isDecRunning_ set false" << endl; + if (inputLoopDec_ != nullptr && inputLoopDec_->joinable()) { + unique_lock lock(acodecSignal_->inMutexDec_); + acodecSignal_->inQueueDec_.push(STOPNUM); + acodecSignal_->inCondDec_.notify_all(); + lock.unlock(); + inputLoopDec_->join(); + inputLoopDec_.reset(); + } + OH_AudioDecoder_Destroy(adec_); + cout << "exit Release DEC" << endl; + return AV_ERR_OK; +} + +void ADecEncNdkSample::PopInqueueDec() +{ + if (acodecSignal_ == nullptr) { + return; + } + acodecSignal_->inQueueDec_.pop(); + acodecSignal_->inBufferQueueDec_.pop(); +} + +int32_t ADecEncNdkSample::PushInbufferDec(uint32_t index, uint32_t bufferSize) +{ + struct OH_AVCodecBufferAttr attr; + attr.offset = 0; + attr.flags = AVCODEC_BUFFER_FLAGS_NONE; + if (decInCnt_ == ES_LENGTH) { + cout << "DEC input: set EOS" << endl; + attr.flags = AVCODEC_BUFFER_FLAGS_EOS; + attr.pts = 0; + attr.size = 0; + isDecInputEOS = true; + } else { + attr.pts = timeStampDec_; + attr.size = bufferSize; + } + return OH_AudioDecoder_PushInputData(adec_, index, attr); +} + +void ADecEncNdkSample::InputFuncDec() +{ + while (true) { + if (!isDecRunning_.load()) { + break; + } + unique_lock lock(acodecSignal_->inMutexDec_); + acodecSignal_->inCondDec_.wait(lock, [this]() {return acodecSignal_->inQueueDec_.size() > 0; }); + if (!isDecRunning_.load()) { + break; + } + uint32_t index = acodecSignal_->inQueueDec_.front(); + OH_AVMemory *buffer = reinterpret_cast(acodecSignal_->inBufferQueueDec_.front()); + if (acodecSignal_->isFlushing_.load() || isDecInputEOS || buffer == nullptr) { + PopInqueueDec(); + continue; + } + NDK_CHECK_AND_RETURN_LOG(testFile_ != nullptr && testFile_->is_open(), "Fatal: open file fail"); + uint32_t bufferSize = 0; + if (decInCnt_ < ES_LENGTH) { + bufferSize = ES[decInCnt_]; + char *fileBuffer = (char *)malloc(sizeof(char) * bufferSize + 1); + NDK_CHECK_AND_RETURN_LOG(fileBuffer != nullptr, "Fatal: malloc fail"); + (void)testFile_->read(fileBuffer, bufferSize); + if (testFile_->eof()) { + free(fileBuffer); + break; + } + if (memcpy_s(OH_AVMemory_GetAddr(buffer), OH_AVMemory_GetSize(buffer), + fileBuffer, bufferSize) != EOK) { + free(fileBuffer); + PopInqueueDec(); + break; + } + free(fileBuffer); + } + if (PushInbufferDec(index, bufferSize) != AV_ERR_OK) { + cout << "Fatal: OH_AudioDecoder_PushInputData fail" << endl; + acodecSignal_->errorNum_ += 1; + } else { + decInCnt_++; + } + timeStampDec_ += SAMPLE_DURATION_US; + PopInqueueDec(); + } +} + +struct OH_AVCodec* ADecEncNdkSample::CreateAudioEncoder(std::string mimetype) +{ + aenc_ = OH_AudioEncoder_CreateByMime(mimetype.c_str()); + NDK_CHECK_AND_RETURN_RET_LOG(aenc_ != nullptr, nullptr, "Fatal: OH_AudioEncoder_CreateByMime"); + cbEnc_.onError = AencAsyncError; + cbEnc_.onStreamChanged = AencAsyncStreamChanged; + cbEnc_.onNeedInputData = AencAsyncNeedInputData; + cbEnc_.onNeedOutputData = AencAsyncNewOutputData; + int32_t ret = OH_AudioEncoder_SetCallback(aenc_, cbEnc_, static_cast(acodecSignal_)); + NDK_CHECK_AND_RETURN_RET_LOG(ret == AV_ERR_OK, NULL, "Fatal: OH_AudioEncoder_SetCallback"); + return aenc_; +} + +int32_t ADecEncNdkSample::ConfigureEnc(struct OH_AVFormat *format) +{ + return OH_AudioEncoder_Configure(aenc_, format); +} + + +int32_t ADecEncNdkSample::PrepareEnc() +{ + return OH_AudioEncoder_Prepare(aenc_); +} + +int32_t ADecEncNdkSample::StartEnc() +{ + isEncRunning_.store(true); + if (inputLoopEnc_ == nullptr) { + inputLoopEnc_ = make_unique(&ADecEncNdkSample::InputFuncEnc, this); + NDK_CHECK_AND_RETURN_RET_LOG(inputLoopEnc_ != nullptr, AV_ERR_UNKNOWN, "Fatal: No memory"); + } + if (outputLoopEnc_ == nullptr) { + outputLoopEnc_ = make_unique(&ADecEncNdkSample::OutputFuncEnc, this); + NDK_CHECK_AND_RETURN_RET_LOG(outputLoopEnc_ != nullptr, AV_ERR_UNKNOWN, "Fatal: No memory"); + } + return OH_AudioEncoder_Start(aenc_); +} + +int32_t ADecEncNdkSample::StopEnc() +{ + cout << "ENTER ENC STOP" << endl; + unique_lock lock(acodecSignal_->outMutexEnc_); + unique_lock lock2(acodecSignal_->inMutexEnc_); + acodecSignal_->isFlushing_.store(true); + lock.unlock(); + lock2.unlock(); + int32_t ret = OH_AudioEncoder_Stop(aenc_); + unique_lock lockIn(acodecSignal_->outMutexEnc_); + clearIntqueue(acodecSignal_->outQueueEnc_); + clearIntqueue(acodecSignal_->sizeQueueEnc_); + clearIntqueue(acodecSignal_->flagQueueEnc_); + clearBufferqueue(acodecSignal_->outBufferQueueEnc_); + acodecSignal_->outCondEnc_.notify_all(); + unique_lock lockOut(acodecSignal_->inMutexEnc_); + clearIntqueue(acodecSignal_->inQueueEnc_); + clearBufferqueue(acodecSignal_->inBufferQueueEnc_); + acodecSignal_->inCondEnc_.notify_all(); + acodecSignal_->isFlushing_.store(false); + lockIn.unlock(); + lockOut.unlock(); + cout << "EXIT ENC STOP" << endl; + return ret; +} + +int32_t ADecEncNdkSample::FlushEnc() +{ + cout << "ENTER ENC FLUSH" << endl; + unique_lock lock(acodecSignal_->outMutexEnc_); + unique_lock lock2(acodecSignal_->inMutexEnc_); + acodecSignal_->isFlushing_.store(true); + lock.unlock(); + lock2.unlock(); + int32_t ret = OH_AudioEncoder_Flush(aenc_); + unique_lock lockIn(acodecSignal_->outMutexEnc_); + clearIntqueue(acodecSignal_->outQueueEnc_); + clearIntqueue(acodecSignal_->sizeQueueEnc_); + clearIntqueue(acodecSignal_->flagQueueEnc_); + clearBufferqueue(acodecSignal_->outBufferQueueEnc_); + acodecSignal_->outCondEnc_.notify_all(); + unique_lock lockOut(acodecSignal_->inMutexEnc_); + clearIntqueue(acodecSignal_->inQueueEnc_); + clearBufferqueue(acodecSignal_->inBufferQueueEnc_); + acodecSignal_->inCondEnc_.notify_all(); + acodecSignal_->isFlushing_.store(false); + lockIn.unlock(); + lockOut.unlock(); + cout << "EXIT ENC FLUSH" << endl; + return ret; +} + +int32_t ADecEncNdkSample::ResetEnc() +{ + cout << "enter Reset ENC" << endl; + unique_lock lock(acodecSignal_->outMutexEnc_); + unique_lock lock2(acodecSignal_->inMutexEnc_); + acodecSignal_->isFlushing_.store(true); + lock.unlock(); + lock2.unlock(); + int32_t ret = OH_AudioEncoder_Reset(aenc_); + unique_lock lockIn(acodecSignal_->outMutexEnc_); + clearIntqueue(acodecSignal_->outQueueEnc_); + clearIntqueue(acodecSignal_->sizeQueueEnc_); + clearIntqueue(acodecSignal_->flagQueueEnc_); + clearBufferqueue(acodecSignal_->outBufferQueueEnc_); + acodecSignal_->outCondEnc_.notify_all(); + unique_lock lockOut(acodecSignal_->inMutexEnc_); + clearIntqueue(acodecSignal_->inQueueEnc_); + clearBufferqueue(acodecSignal_->inBufferQueueEnc_); + acodecSignal_->inCondEnc_.notify_all(); + acodecSignal_->isFlushing_.store(false); + lockIn.unlock(); + lockOut.unlock(); + cout << "exit Reset ENC" << endl; + return ret; +} + +int32_t ADecEncNdkSample::ReleaseEnc() +{ + cout << "enter Release ENC" << endl; + isEncRunning_.store(false); + cout << "set isEncRunning_ false success" << endl; + if (inputLoopEnc_ != nullptr && inputLoopEnc_->joinable()) { + cout << "enter inputLoopEnc_ set function " << endl; + unique_lock lock(acodecSignal_->inMutexEnc_); + acodecSignal_->outQueueDec_.push(STOPNUM); + acodecSignal_->inQueueEnc_.push(STOPNUM); + acodecSignal_->inCondEnc_.notify_all(); + lock.unlock(); + inputLoopEnc_->join(); + inputLoopEnc_.reset(); + } + cout << "set inputLoopEnc_ release success" << endl; + if (outputLoopEnc_ != nullptr && outputLoopEnc_->joinable()) { + unique_lock lock(acodecSignal_->outMutexEnc_); + acodecSignal_->outQueueEnc_.push(STOPNUM); + acodecSignal_->outCondEnc_.notify_all(); + lock.unlock(); + outputLoopEnc_->join(); + outputLoopEnc_.reset(); + } + OH_AudioEncoder_Destroy(aenc_); + cout << "exit RELEASE ENC" << endl; + return AV_ERR_OK; +} + +void ADecEncNdkSample::PopOutqueueDec() +{ + if (acodecSignal_ == nullptr) { + return; + } + acodecSignal_->outQueueDec_.pop(); + acodecSignal_->sizeQueueDec_.pop(); + acodecSignal_->flagQueueDec_.pop(); + acodecSignal_->outBufferQueueDec_.pop(); +} + +void ADecEncNdkSample::PopInqueueEnc() +{ + if (acodecSignal_ == nullptr) { + return; + } + acodecSignal_->inQueueEnc_.pop(); + acodecSignal_->inBufferQueueEnc_.pop(); +} + +int32_t ADecEncNdkSample::PushInbufferEnc() +{ + uint32_t indexEnc = acodecSignal_->inQueueEnc_.front(); + OH_AVMemory *bufferEnc = reinterpret_cast(acodecSignal_->inBufferQueueEnc_.front()); + if (bufferEnc == nullptr) { + cout << "Fatal: GetEncInputBuffer fail" << endl; + return AV_ERR_NO_MEMORY; + } + uint32_t indexDec = acodecSignal_->outQueueDec_.front(); + OH_AVMemory *bufferDec = acodecSignal_->outBufferQueueDec_.front(); + uint32_t sizeDecOut = acodecSignal_->sizeQueueDec_.front(); + uint32_t flagDecOut = acodecSignal_->flagQueueDec_.front(); + + struct OH_AVCodecBufferAttr attr; + attr.offset = 0; + attr.size = sizeDecOut; + attr.pts = timeStampEnc_; + attr.flags = 0; + if (flagDecOut == 1) { + cout << "DEC output EOS " << endl; + isDecOutputEOS = true; + cout << "set isDecOutputEOS = true " << endl; + if (setEos) { + isEncInputEOS = true; + attr.flags = 1; + } + } else { + if (memcpy_s(OH_AVMemory_GetAddr(bufferEnc), OH_AVMemory_GetSize(bufferEnc), + OH_AVMemory_GetAddr(bufferDec), sizeDecOut) != EOK) { + cout << "ENC input Fatal: memcpy fail" << endl; + PopOutqueueDec(); + PopInqueueEnc(); + return AV_ERR_OPERATE_NOT_PERMIT; + } + if (OH_AudioDecoder_FreeOutputData(adec_, indexDec) != AV_ERR_OK) { + cout << "Fatal: DEC ReleaseDecOutputBuffer fail" << endl; + acodecSignal_->errorNum_ += 1; + } else { + decOutCnt_ += 1; + } + } + return OH_AudioEncoder_PushInputData(aenc_, indexEnc, attr); +} + +void ADecEncNdkSample::InputFuncEnc() +{ + while (true) { + cout << "DEC enter InputFuncEnc()" << endl; + if (!isEncRunning_.load()) { + break; + } + unique_lock lock(acodecSignal_->inMutexEnc_); + acodecSignal_->inCondEnc_.wait(lock, [this]() { + return (acodecSignal_->inQueueEnc_.size() > 0 && acodecSignal_->outQueueDec_.size() > 0); + }); + + if (!isEncRunning_.load()) { + break; + } + if (acodecSignal_->isFlushing_.load() || isDecOutputEOS) { + PopOutqueueDec(); + PopInqueueEnc(); + continue; + } + if (PushInbufferEnc() != AV_ERR_OK) { + cout << "Fatal error, exit" << endl; + acodecSignal_->errorNum_ += 1; + } else { + encInCnt_++; + } + timeStampEnc_ += SAMPLE_DURATION_US; + PopOutqueueDec(); + PopInqueueEnc(); + } +} + +void ADecEncNdkSample::PopOutqueueEnc() +{ + if (acodecSignal_ == nullptr) { + return; + } + acodecSignal_->outQueueEnc_.pop(); + acodecSignal_->sizeQueueEnc_.pop(); + acodecSignal_->flagQueueEnc_.pop(); + acodecSignal_->outBufferQueueEnc_.pop(); +} + +int32_t ADecEncNdkSample::WriteToFile() +{ + auto buffer = acodecSignal_->outBufferQueueEnc_.front(); + if (buffer == nullptr) { + cout << "getOutPut Buffer fail" << endl; + return AV_ERR_INVALID_VAL; + } + uint32_t size = acodecSignal_->sizeQueueEnc_.front(); + FILE *outFile = fopen(OUT_FILE, "a"); + if (outFile == nullptr) { + cout << "dump data fail" << endl; + return AV_ERR_INVALID_VAL; + } else { + fwrite(OH_AVMemory_GetAddr(buffer), 1, size, outFile); + } + return fclose(outFile); +} + +void ADecEncNdkSample::OutputFuncEnc() +{ + while (true) { + if (!isEncRunning_.load()) { + break; + } + unique_lock lock(acodecSignal_->outMutexEnc_); + acodecSignal_->outCondEnc_.wait(lock, [this]() { return acodecSignal_->outQueueEnc_.size() > 0; }); + if (!isEncRunning_.load()) { + break; + } + if (acodecSignal_->isFlushing_.load() || isEncOutputEOS) { + PopOutqueueEnc(); + continue; + } + uint32_t index = acodecSignal_->outQueueEnc_.front(); + uint32_t encOutflag = acodecSignal_->flagQueueEnc_.front(); + if (encOutflag == 1) { + cout << "ENC get output EOS" << endl; + isEncOutputEOS = true; + } else { + if (WriteToFile() != 0) { + PopOutqueueEnc(); + continue; + } + if (OH_AudioEncoder_FreeOutputData(aenc_, index) != AV_ERR_OK) { + cout << "Fatal: ReleaseOutputBuffer fail" << endl; + acodecSignal_->errorNum_ += 1; + } else { + encOutCnt_ += 1; + cout << "ENC output cnt: " << encOutCnt_ << endl; + } + } + PopOutqueueEnc(); + } +} + +void ADecEncNdkSample::SetReadPath(const char * inp_path, uint32_t es[], uint32_t length) +{ + INP_FILE = inp_path; + ES = es; + ES_LENGTH = length; +} + +void ADecEncNdkSample::ReRead() +{ + if (testFile_ != nullptr) { + testFile_->close(); + cout << "ReRead close before file success " << endl; + } + cout << "ReRead INP_FILE is " << INP_FILE << endl; + testFile_->open(INP_FILE, std::ios::in | std::ios::binary); + if (testFile_ != nullptr) { + cout << "testFile open success" << endl; + } + decInCnt_ = 0; +} + +void ADecEncNdkSample::SetEosState(bool needSetEos) +{ + setEos = needSetEos; +} + +void ADecEncNdkSample::SetSavePath(const char * outp_path) +{ + OUT_FILE = outp_path; +} + +int32_t ADecEncNdkSample::CalcuError() +{ + cout << "errorNum_ is :" << acodecSignal_->errorNum_ << endl; + cout << "decInCnt_ is :" << decInCnt_ << endl; + cout << "decOutCnt_ is :" << decOutCnt_ << endl; + cout << "encInCnt_ is :" << encInCnt_ << endl; + cout << "encOutCnt_ is :" << encOutCnt_ << endl; + cout << "acodecSignal_->inQueueDec_.size() is :" << acodecSignal_->inQueueDec_.size() << endl; + cout << "acodecSignal_->outQueueDec_.size() is :" << acodecSignal_->outQueueDec_.size() << endl; + cout << "acodecSignal_->inQueueEnc_.size() is :" << acodecSignal_->inQueueEnc_.size() << endl; + cout << "acodecSignal_->outQueueEnc_.size() is :" << acodecSignal_->outQueueEnc_.size() << endl; + return acodecSignal_->errorNum_ ; +} + +int32_t ADecEncNdkSample::GetFrameCount() +{ + return encOutCnt_; +} + +bool ADecEncNdkSample::GetEncEosState() +{ + return isEncOutputEOS; +} + +bool ADecEncNdkSample::GetDecEosState() +{ + return isDecOutputEOS; +} \ 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 new file mode 100644 index 0000000000000000000000000000000000000000..5ff9818d6e4f3985e7610bad6da392decbb914fb --- /dev/null +++ b/multimedia/media/media_cpp_standard/audioDecEncNdk/src/ActsAudioDecEncNdkTest.cpp @@ -0,0 +1,429 @@ +/* + * 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 "gtest/gtest.h" +#include "audio_info.h" +#include "native_avcodec_audiodecoder.h" +#include "native_avcodec_audioencoder.h" +#include "native_avcodec_base.h" +#include "native_avformat.h" +#include "ADecEncNdkSample.h" + +using namespace std; +using namespace testing::ext; +using namespace OHOS; +using namespace OHOS::Media; + +namespace { +class ActsAudioDecEncNdkTest : public testing::Test { +public: + static void SetUpTestCase(); + static void TearDownTestCase(); + void SetUp() override; + void TearDown() override; +}; + +void ActsAudioDecEncNdkTest::SetUpTestCase() {} +void ActsAudioDecEncNdkTest::TearDownTestCase() {} +void ActsAudioDecEncNdkTest::SetUp() {} +void ActsAudioDecEncNdkTest::TearDown() {} + +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}; +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 < 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; +} +} + +/** + * @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, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0100, TestSize.Level1) +{ + ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample(); + + map AudioParam = { + {OH_MD_KEY_AUD_CHANNEL_COUNT, DEFAULT_CHANNELS}, + {OH_MD_KEY_AUD_SAMPLE_RATE, DEFAULT_SAMPLE_RATE}, + {OH_MD_KEY_AUDIO_SAMPLE_FORMAT, AudioStandard::SAMPLE_S16LE}, + }; + OH_AVFormat *AudioFormat = OH_AVFormat_Create(); + ASSERT_NE(nullptr, AudioFormat); + ASSERT_EQ(true, SetFormat(AudioFormat, AudioParam)); + + struct OH_AVCodec* audDec = aDecEncSample->CreateAudioDecoder(MIME_TYPE_AAC); + ASSERT_NE(nullptr, audDec); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ConfigureDec(AudioFormat)); + OH_AVFormat *OutDescDec = OH_AudioDecoder_GetOutputDescription(audDec); + ASSERT_NE(nullptr, OutDescDec); + ASSERT_EQ(true, CheckDecDesc(AudioParam, OutDescDec)); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->PrepareDec()); + + struct OH_AVCodec* audEnc = aDecEncSample->CreateAudioEncoder(MIME_TYPE_AAC); + ASSERT_NE(nullptr, audEnc); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ConfigureEnc(AudioFormat)); + OH_AVFormat *OutDescEnc = OH_AudioEncoder_GetOutputDescription(audEnc); + ASSERT_NE(nullptr, OutDescEnc); + ASSERT_EQ(true, CheckDecDesc(AudioParam, OutDescEnc)); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->PrepareEnc()); + + aDecEncSample->SetReadPath(READPATH, ES_AAC_48000_32_1, ES_AAC_48000_32_1_Length); + aDecEncSample->SetSavePath("/data/media/AAC_48000_32_1_out1.aac"); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartDec()); + + while (!aDecEncSample->GetEncEosState()) {}; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StopDec()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StopEnc()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ReleaseDec()); + audDec = nullptr; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ReleaseEnc()); + audEnc = nullptr; + OH_AVFormat_Destroy(AudioFormat); + AudioFormat = nullptr; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->CalcuError()); +} + +/** + * @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, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0200, TestSize.Level1) +{ + ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample(); + + struct OH_AVCodec* audDec = aDecEncSample->CreateAudioDecoder(MIME_TYPE_AAC); + ASSERT_NE(nullptr, audDec); + OH_AVFormat *AudioFormat = OH_AVFormat_Create(); + ASSERT_NE(nullptr, AudioFormat); + OH_AVFormat_SetIntValue(AudioFormat, OH_MD_KEY_AUD_CHANNEL_COUNT, DEFAULT_CHANNELS); + OH_AVFormat_SetIntValue(AudioFormat, OH_MD_KEY_AUD_SAMPLE_RATE, DEFAULT_SAMPLE_RATE); + OH_AVFormat_SetIntValue(AudioFormat, OH_MD_KEY_AUDIO_SAMPLE_FORMAT, AudioStandard::SAMPLE_S16LE); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ConfigureDec(AudioFormat)); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->PrepareDec()); + + struct OH_AVCodec* audEnc = aDecEncSample->CreateAudioEncoder(MIME_TYPE_AAC); + ASSERT_NE(nullptr, audEnc); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ConfigureEnc(AudioFormat)); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->PrepareEnc()); + aDecEncSample->SetReadPath(READPATH, ES_AAC_48000_32_1, ES_AAC_48000_32_1_Length); + aDecEncSample->SetSavePath("/data/media/AAC_48000_32_1_out2.aac"); + + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartDec()); + while (!aDecEncSample->GetEncEosState()) {}; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ResetEnc()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ResetDec()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ReleaseDec()); + audDec = nullptr; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ReleaseEnc()); + audEnc = nullptr; + OH_AVFormat_Destroy(AudioFormat); + AudioFormat = nullptr; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->CalcuError()); +} + +/** + * @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, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0300, TestSize.Level1) +{ + ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample(); + + struct OH_AVCodec* audDec = aDecEncSample->CreateAudioDecoder(MIME_TYPE_AAC); + ASSERT_NE(nullptr, audDec); + OH_AVFormat *AudioFormat = OH_AVFormat_Create(); + ASSERT_NE(nullptr, AudioFormat); + OH_AVFormat_SetIntValue(AudioFormat, OH_MD_KEY_AUD_CHANNEL_COUNT, DEFAULT_CHANNELS); + OH_AVFormat_SetIntValue(AudioFormat, OH_MD_KEY_AUD_SAMPLE_RATE, DEFAULT_SAMPLE_RATE); + OH_AVFormat_SetIntValue(AudioFormat, OH_MD_KEY_AUDIO_SAMPLE_FORMAT, AudioStandard::SAMPLE_S16LE); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ConfigureDec(AudioFormat)); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->PrepareDec()); + + struct OH_AVCodec* audEnc = aDecEncSample->CreateAudioEncoder(MIME_TYPE_AAC); + ASSERT_NE(nullptr, audEnc); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ConfigureEnc(AudioFormat)); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->PrepareEnc()); + aDecEncSample->SetReadPath(READPATH, ES_AAC_48000_32_1, ES_AAC_48000_32_1_Length); + aDecEncSample->SetSavePath("/data/media/AAC_48000_32_1_out3.aac"); + + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartDec()); + while (!aDecEncSample->GetEncEosState()) {}; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ReleaseDec()); + audDec = nullptr; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ReleaseEnc()); + audEnc = nullptr; + OH_AVFormat_Destroy(AudioFormat); + AudioFormat = nullptr; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->CalcuError()); +} + +/** + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0400 + * @tc.name : flush at running + * @tc.desc : Basic function test + */ +HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0400, TestSize.Level1) +{ + ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample(); + + struct OH_AVCodec* audDec = aDecEncSample->CreateAudioDecoder(MIME_TYPE_AAC); + ASSERT_NE(nullptr, audDec); + OH_AVFormat *AudioFormat = OH_AVFormat_Create(); + ASSERT_NE(nullptr, AudioFormat); + OH_AVFormat_SetIntValue(AudioFormat, OH_MD_KEY_AUD_CHANNEL_COUNT, DEFAULT_CHANNELS); + OH_AVFormat_SetIntValue(AudioFormat, OH_MD_KEY_AUD_SAMPLE_RATE, DEFAULT_SAMPLE_RATE); + OH_AVFormat_SetIntValue(AudioFormat, OH_MD_KEY_AUDIO_SAMPLE_FORMAT, AudioStandard::SAMPLE_S16LE); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ConfigureDec(AudioFormat)); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->PrepareDec()); + + struct OH_AVCodec* audEnc = aDecEncSample->CreateAudioEncoder(MIME_TYPE_AAC); + ASSERT_NE(nullptr, audEnc); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ConfigureEnc(AudioFormat)); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->PrepareEnc()); + aDecEncSample->SetReadPath(READPATH, ES_AAC_48000_32_1, ES_AAC_48000_32_1_Length); + aDecEncSample->SetSavePath("/data/media/AAC_48000_32_1_out4.aac"); + aDecEncSample->SetEosState(false); + + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartDec()); + while (aDecEncSample->GetFrameCount() < 50) {}; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->FlushDec()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->FlushEnc()); + aDecEncSample->ReRead(); + aDecEncSample->ResetDecParam(); + aDecEncSample->ResetEncParam(); + aDecEncSample->SetSavePath("/data/media/AAC_48000_32_1_out4_2.aac"); + aDecEncSample->SetEosState(true); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartDec()); + + while (!aDecEncSample->GetEncEosState()) {}; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ReleaseDec()); + audDec = nullptr; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ReleaseEnc()); + audEnc = nullptr; + OH_AVFormat_Destroy(AudioFormat); + AudioFormat = nullptr; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->CalcuError()); +} + +/** + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0500 + * @tc.name : flush decoder at eos + * @tc.desc : Basic function test + */ +HWTEST_F(ActsAudioDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0500, TestSize.Level1) +{ + ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample(); + + struct OH_AVCodec* audDec = aDecEncSample->CreateAudioDecoder(MIME_TYPE_AAC); + ASSERT_NE(nullptr, audDec); + OH_AVFormat *AudioFormat = OH_AVFormat_Create(); + ASSERT_NE(nullptr, AudioFormat); + OH_AVFormat_SetIntValue(AudioFormat, OH_MD_KEY_AUD_CHANNEL_COUNT, DEFAULT_CHANNELS); + OH_AVFormat_SetIntValue(AudioFormat, OH_MD_KEY_AUD_SAMPLE_RATE, DEFAULT_SAMPLE_RATE); + OH_AVFormat_SetIntValue(AudioFormat, OH_MD_KEY_AUDIO_SAMPLE_FORMAT, AudioStandard::SAMPLE_S16LE); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ConfigureDec(AudioFormat)); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->PrepareDec()); + + struct OH_AVCodec* audEnc = aDecEncSample->CreateAudioEncoder(MIME_TYPE_AAC); + ASSERT_NE(nullptr, audEnc); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ConfigureEnc(AudioFormat)); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->PrepareEnc()); + aDecEncSample->SetReadPath(READPATH, ES_AAC_48000_32_1, ES_AAC_48000_32_1_Length); + aDecEncSample->SetEosState(false); + aDecEncSample->SetSavePath("/data/media/AAC_48000_32_1_out5.aac"); + + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartDec()); + while (!aDecEncSample->GetDecEosState()) {}; + cout << "aDecEncSample->GetDecEosState() is " << aDecEncSample->GetDecEosState() << endl; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->CalcuError()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->FlushDec()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->FlushEnc()); + aDecEncSample->ReRead(); + aDecEncSample->ResetDecParam(); + aDecEncSample->ResetEncParam(); + aDecEncSample->SetSavePath("/data/media/AAC_48000_32_1_out5_2.aac"); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartDec()); + aDecEncSample->SetEosState(true); + sleep(2); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->CalcuError()); + + while (!aDecEncSample->GetEncEosState()) {}; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ReleaseDec()); + audDec = nullptr; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ReleaseEnc()); + audEnc = nullptr; + OH_AVFormat_Destroy(AudioFormat); + AudioFormat = nullptr; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->CalcuError()); +} + + +/** + * @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, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0600, TestSize.Level1) +{ + ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample(); + + struct OH_AVCodec* audDec = aDecEncSample->CreateAudioDecoder(MIME_TYPE_AAC); + ASSERT_NE(nullptr, audDec); + OH_AVFormat *AudioFormat = OH_AVFormat_Create(); + ASSERT_NE(nullptr, AudioFormat); + OH_AVFormat_SetIntValue(AudioFormat, OH_MD_KEY_AUD_CHANNEL_COUNT, DEFAULT_CHANNELS); + OH_AVFormat_SetIntValue(AudioFormat, OH_MD_KEY_AUD_SAMPLE_RATE, DEFAULT_SAMPLE_RATE); + OH_AVFormat_SetIntValue(AudioFormat, OH_MD_KEY_AUDIO_SAMPLE_FORMAT, AudioStandard::SAMPLE_S16LE); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ConfigureDec(AudioFormat)); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->PrepareDec()); + + struct OH_AVCodec* audEnc = aDecEncSample->CreateAudioEncoder(MIME_TYPE_AAC); + ASSERT_NE(nullptr, audEnc); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ConfigureEnc(AudioFormat)); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->PrepareEnc()); + aDecEncSample->SetReadPath(READPATH, ES_AAC_48000_32_1, ES_AAC_48000_32_1_Length); + aDecEncSample->SetSavePath("/data/media/AAC_48000_32_1_out6.aac"); + aDecEncSample->SetEosState(false); + + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartDec()); + while (aDecEncSample->GetFrameCount() < 50) {}; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StopDec()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StopEnc()); + aDecEncSample->ReRead(); + aDecEncSample->ResetDecParam(); + aDecEncSample->ResetEncParam(); + aDecEncSample->SetSavePath("/data/media/AAC_48000_32_1_out6_2.aac"); + aDecEncSample->SetEosState(true); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartDec()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->CalcuError()); + + while (!aDecEncSample->GetEncEosState()) {}; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ReleaseDec()); + audDec = nullptr; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ReleaseEnc()); + audEnc = nullptr; + OH_AVFormat_Destroy(AudioFormat); + AudioFormat = nullptr; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->CalcuError()); +} + + +/** + * @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, SUB_MULTIMEDIA_MEDIA_AUDIO_DEC_ENC_FUNCTION_0700, TestSize.Level1) +{ + ADecEncNdkSample *aDecEncSample = new ADecEncNdkSample(); + + struct OH_AVCodec* audDec = aDecEncSample->CreateAudioDecoder(MIME_TYPE_AAC); + ASSERT_NE(nullptr, audDec); + OH_AVFormat *AudioFormat = OH_AVFormat_Create(); + ASSERT_NE(nullptr, AudioFormat); + OH_AVFormat_SetIntValue(AudioFormat, OH_MD_KEY_AUD_CHANNEL_COUNT, DEFAULT_CHANNELS); + OH_AVFormat_SetIntValue(AudioFormat, OH_MD_KEY_AUD_SAMPLE_RATE, DEFAULT_SAMPLE_RATE); + OH_AVFormat_SetIntValue(AudioFormat, OH_MD_KEY_AUDIO_SAMPLE_FORMAT, AudioStandard::SAMPLE_S16LE); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ConfigureDec(AudioFormat)); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->PrepareDec()); + + struct OH_AVCodec* audEnc = aDecEncSample->CreateAudioEncoder(MIME_TYPE_AAC); + ASSERT_NE(nullptr, audEnc); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ConfigureEnc(AudioFormat)); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->PrepareEnc()); + aDecEncSample->SetReadPath(READPATH, ES_AAC_48000_32_1, ES_AAC_48000_32_1_Length); + aDecEncSample->SetEosState(false); + aDecEncSample->SetSavePath("/data/media/AAC_48000_32_1_out7.aac"); + + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartDec()); + while (!aDecEncSample->GetDecEosState()) {}; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StopDec()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->FlushEnc()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->CalcuError()); + + aDecEncSample->ReRead(); + aDecEncSample->ResetDecParam(); + aDecEncSample->ResetEncParam(); + aDecEncSample->SetSavePath("/data/media/AAC_48000_32_1_out7_2.aac"); + aDecEncSample->SetEosState(true); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, aDecEncSample->StartDec()); + + while (!aDecEncSample->GetEncEosState()) {}; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ReleaseDec()); + audDec = nullptr; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->ReleaseEnc()); + audEnc = nullptr; + OH_AVFormat_Destroy(AudioFormat); + AudioFormat = nullptr; + ASSERT_EQ(AV_ERR_OK, aDecEncSample->CalcuError()); +} \ No newline at end of file diff --git a/multimedia/media/media_cpp_standard/include/ndktest_log.h b/multimedia/media/media_cpp_standard/include/ndktest_log.h new file mode 100644 index 0000000000000000000000000000000000000000..a2ae49b37cbdf918036ba386a01d5c548425d9fa --- /dev/null +++ b/multimedia/media/media_cpp_standard/include/ndktest_log.h @@ -0,0 +1,56 @@ +/* + * 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 NDKTEST_LOG_H +#define NDKTEST_LOG_H + +#include + +#define RET_FAIL (-1) +#define RET_OK 0 + +#define NDK_CHECK_AND_RETURN_RET_LOG(cond, ret, fmt, ...) \ + do { \ + if (!(cond)) { \ + (void)printf("%s\n", fmt, ##__VA_ARGS__); \ + return ret; \ + } \ + } while (0) + +#define NDK_CHECK_AND_RETURN_LOG(cond, fmt, ...) \ + do { \ + if (!(cond)) { \ + (void)printf("%s\n", fmt, ##__VA_ARGS__); \ + return; \ + } \ + } while (0) + +#define NDK_CHECK_AND_BREAK_LOG(cond, fmt, ...) \ + if (!(cond)) { \ + (void)printf("%s\n", fmt, ##__VA_ARGS__); \ + break; \ + } + +#define NDK_CHECK_AND_CONTINUE_LOG(cond, fmt, ...) \ + if (!(cond)) { \ + (void)printf("%s\n", fmt, ##__VA_ARGS__); \ + continue; \ + } + +#define NDK_CHECK_AND_LOG(cond, fmt, ...) \ + if (!(cond)) { \ + (void)printf("%s\n", fmt, ##__VA_ARGS__); \ + } +#endif // NDKTEST_LOG_H \ No newline at end of file diff --git a/multimedia/media/media_cpp_standard/videoDecEncNdk/include/VDecEncNdkSample.h b/multimedia/media/media_cpp_standard/videoDecEncNdk/include/VDecEncNdkSample.h new file mode 100644 index 0000000000000000000000000000000000000000..83accef2f5d46d4929ed1813b1d09e78c6eed3b1 --- /dev/null +++ b/multimedia/media/media_cpp_standard/videoDecEncNdk/include/VDecEncNdkSample.h @@ -0,0 +1,139 @@ +/* + * 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 VIDEODECENC_NDK_SAMPLE_H +#define VIDEODECENC_NDK_SAMPLE_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "securec.h" +#include "nocopyable.h" +#include "ndktest_log.h" +#include "native_avmagic.h" +#include "surface.h" +#include "native_avcodec_videodecoder.h" +#include "native_avcodec_videoencoder.h" + +namespace OHOS { +namespace Media { +class VDecEncSignal { +public: + std::mutex inMutexDec_; + std::mutex outMutexDec_; + std::condition_variable inCondDec_; + std::condition_variable outCondDec_; + std::queue inQueueDec_; + std::queue outQueueDec_; + std::queue flagQueueDec_; + std::queue inBufferQueueDec_; + std::queue outBufferQueueDec_; + + std::mutex outMutexEnc_; + std::condition_variable outCondEnc_; + std::queue inQueueEnc_; + std::queue outQueueEnc_; + std::queue sizeQueueEnc_; + std::queue flagQueueEnc_; + std::queue inBufferQueueEnc_; + std::queue outBufferQueueEnc_; + int32_t errorNum_ = 0; + std::atomic isVdecFlushing_ = false; + std::atomic isVencFlushing_ = false; +}; + +class VDecEncNdkSample : public NoCopyable { +public: + VDecEncNdkSample() = default; + ~VDecEncNdkSample(); + + void SetEosState(bool needSetEos); + struct OH_AVCodec* CreateVideoDecoderByMime(std::string mimetype); + struct OH_AVCodec* CreateVideoDecoderByName(std::string name); + int32_t ConfigureDec(struct OH_AVFormat *format); + int32_t SetOutputSurface(); + int32_t PrepareDec(); + int32_t StartDec(); + int32_t StopDec(); + int32_t FlushDec(); + int32_t ResetDec(); + int32_t ReleaseDec(); + + struct OH_AVCodec* CreateVideoEncoderByMime(std::string mimetype); + struct OH_AVCodec* CreateVideoEncoderByName(std::string name); + int32_t ConfigureEnc(struct OH_AVFormat *format); + int32_t GetSurface(); + int32_t PrepareEnc(); + int32_t StartEnc(); + int32_t StopEnc(); + int32_t FlushEnc(); + int32_t ResetEnc(); + int32_t ReleaseEnc(); + + int32_t CalcuError(); + void SetReadPath(std::string filepath); + void SetSavePath(std::string filepath); + void ReRead(); + void ResetDecParam(); + void ResetEncParam(); + int32_t GetFrameCount(); + bool GetEncEosState(); + bool GetDecEosState(); + void PopInqueueDec(); + void PopOutqueueDec(); + void PopOutqueueEnc(); + void SendEncEos(); + int32_t PushInbufferDec(uint32_t index, uint32_t bufferSize); + VDecEncSignal* vcodecSignal_ = nullptr; + bool isDecInputEOS = false; + bool isEncInputEOS = false; + bool isDecOutputEOS = false; + bool isEncOutputEOS = false; + bool setEos = true; + +private: + OHNativeWindow *nativeWindow_; + struct OH_AVCodec* vdec_; + void InputFuncDec(); + void OutputFuncDec(); + int32_t WriteToFile(); + std::atomic isDecRunning_ = false; + std::unique_ptr testFile_; + std::unique_ptr inputLoopDec_; + std::unique_ptr outputLoopDec_; + struct OH_AVCodecAsyncCallback cbDec_; + int64_t timeStampDec_ = 0; + uint32_t decInCnt_ = 0; + uint32_t decOutCnt_ = 0; + + struct OH_AVCodec* venc_; + void OutputFuncEnc(); + std::atomic isEncRunning_ = false; + std::unique_ptr outputLoopEnc_; + struct OH_AVCodecAsyncCallback cbEnc_; + bool isFirstDecFrame_ = true; + uint32_t encOutCnt_ = 0; + std::string inFile_ = "/data/media/out_320_240_10s.h264"; + std::string outFile_ = "/data/media/video_out.es"; +}; +} +} +#endif // VIDEODECENC_NDK_SAMPLE_H diff --git a/multimedia/media/media_cpp_standard/videoDecEncNdk/src/ActsVideoDecEncNdkTest.cpp b/multimedia/media/media_cpp_standard/videoDecEncNdk/src/ActsVideoDecEncNdkTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..4c3d29349dbabd2c6392ff39c6d344fba360a427 --- /dev/null +++ b/multimedia/media/media_cpp_standard/videoDecEncNdk/src/ActsVideoDecEncNdkTest.cpp @@ -0,0 +1,426 @@ +/* + * 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 "gtest/gtest.h" +#include "native_avcodec_videodecoder.h" +#include "native_avcodec_videoencoder.h" +#include "native_avcodec_base.h" +#include "native_avformat.h" +#include "VDecEncNdkSample.h" + +using namespace std; +using namespace testing::ext; +using namespace OHOS; +using namespace OHOS::Media; + +namespace { +class ActsVideoDecEncNdkTest : public testing::Test { +public: + static void SetUpTestCase(); + static void TearDownTestCase(); + void SetUp() override; + void TearDown() override; +}; + +void ActsVideoDecEncNdkTest::SetUpTestCase() {} +void ActsVideoDecEncNdkTest::TearDownTestCase() {} +void ActsVideoDecEncNdkTest::SetUp() {} +void ActsVideoDecEncNdkTest::TearDown() {} +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 < 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; +} + +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 : SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0100 + * @tc.name : stop at end of stream + * @tc.desc : Basic function test + */ +HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0100, TestSize.Level1) +{ + VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample(); + + struct OH_AVCodec* videoDec = vDecEncSample->CreateVideoDecoderByMime(MIME_TYPE_AVC); + ASSERT_NE(nullptr, videoDec); + struct OH_AVCodec* videoEnc = vDecEncSample->CreateVideoEncoderByMime(MIME_TYPE_MPEG4); + ASSERT_NE(nullptr, videoEnc); + vDecEncSample->SetReadPath(READPATH); + vDecEncSample->SetSavePath("/data/media/video_001.es"); + + OH_AVFormat *VideoFormat = OH_AVFormat_Create(); + ASSERT_NE(nullptr, VideoFormat); + map VideoParam = { + {OH_MD_KEY_WIDTH, DEFAULT_WIDTH}, + {OH_MD_KEY_HEIGHT, DEFAULT_HEIGHT}, + {OH_MD_KEY_PIXEL_FORMAT, DEFAULT_PIXELFORMAT}, + {OH_MD_KEY_FRAME_RATE, DEFAULT_FRAMERATE}, + }; + ASSERT_EQ(true, SetFormat(VideoFormat, VideoParam)); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureDec(VideoFormat)); + OH_AVFormat *OutDescDec = OH_VideoDecoder_GetOutputDescription(videoDec); + ASSERT_NE(nullptr, OutDescDec); + ASSERT_EQ(true, CheckDecDesc(VideoParam, OutDescDec)); + + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureEnc(VideoFormat)); + OH_AVFormat *OutDescEnc = OH_VideoEncoder_GetOutputDescription(videoEnc); + ASSERT_NE(nullptr, OutDescEnc); + ASSERT_EQ(true, CheckDecDesc(VideoParam, OutDescEnc)); + + ASSERT_EQ(AV_ERR_OK, vDecEncSample->GetSurface()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->SetOutputSurface()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareDec()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartDec()); + + while (!vDecEncSample->GetEncEosState()) {}; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StopDec()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StopEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ReleaseEnc()); + videoEnc = nullptr; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ReleaseDec()); + videoDec = nullptr; + OH_AVFormat_Destroy(VideoFormat); + VideoFormat = nullptr; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->CalcuError()); +} + +/** + * @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, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0200, TestSize.Level1) +{ + VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample(); + + struct OH_AVCodec* videoDec = vDecEncSample->CreateVideoDecoderByMime(MIME_TYPE_AVC); + ASSERT_NE(nullptr, videoDec); + struct OH_AVCodec* videoEnc = vDecEncSample->CreateVideoEncoderByMime(MIME_TYPE_AVC); + ASSERT_NE(nullptr, videoEnc); + vDecEncSample->SetReadPath(READPATH); + vDecEncSample->SetSavePath("/data/media/video_002.es"); + + OH_AVFormat *VideoFormat = createFormat(); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureDec(VideoFormat)); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureEnc(VideoFormat)); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->GetSurface()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->SetOutputSurface()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareDec()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartDec()); + + while (!vDecEncSample->GetEncEosState()) {}; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ResetDec()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ResetEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ReleaseEnc()); + videoEnc = nullptr; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ReleaseDec()); + videoDec = nullptr; + OH_AVFormat_Destroy(VideoFormat); + VideoFormat = nullptr; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->CalcuError()); +} + + + /** + * @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, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0300, TestSize.Level1) +{ + VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample(); + + struct OH_AVCodec* videoDec = vDecEncSample->CreateVideoDecoderByMime(MIME_TYPE_AVC); + ASSERT_NE(nullptr, videoDec); + struct OH_AVCodec* videoEnc = vDecEncSample->CreateVideoEncoderByMime(MIME_TYPE_AVC); + ASSERT_NE(nullptr, videoEnc); + vDecEncSample->SetReadPath(READPATH); + vDecEncSample->SetSavePath("/data/media/video_003.es"); + + OH_AVFormat *VideoFormat = createFormat(); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureDec(VideoFormat)); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureEnc(VideoFormat)); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->GetSurface()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->SetOutputSurface()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareDec()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartDec()); + + while (!vDecEncSample->GetEncEosState()) {}; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ReleaseEnc()); + videoEnc = nullptr; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ReleaseDec()); + videoDec = nullptr; + OH_AVFormat_Destroy(VideoFormat); + VideoFormat = nullptr; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->CalcuError()); +} + +/** +* @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0400 +* @tc.name : flush at running +* @tc.desc : Basic function test +*/ +HWTEST_F(ActsVideoDecEncNdkTest, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0400, TestSize.Level1) +{ + VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample(); + + struct OH_AVCodec* videoDec = vDecEncSample->CreateVideoDecoderByMime(MIME_TYPE_AVC); + ASSERT_NE(nullptr, videoDec); + struct OH_AVCodec* videoEnc = vDecEncSample->CreateVideoEncoderByMime(MIME_TYPE_AVC); + ASSERT_NE(nullptr, videoEnc); + vDecEncSample->SetReadPath(READPATH); + vDecEncSample->SetEosState(false); + vDecEncSample->SetSavePath("/data/media/video_004.es"); + + OH_AVFormat *VideoFormat = createFormat(); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureDec(VideoFormat)); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureEnc(VideoFormat)); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->GetSurface()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->SetOutputSurface()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareDec()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartDec()); + + while (vDecEncSample->GetFrameCount() < 100) {}; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->FlushDec()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->FlushEnc()); + vDecEncSample->ReRead(); + vDecEncSample->ResetDecParam(); + vDecEncSample->ResetEncParam(); + vDecEncSample->SetEosState(true); + vDecEncSample->SetSavePath("/data/media/video_004_2.es"); + + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartDec()); + + while (!vDecEncSample->GetEncEosState()) {}; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ReleaseEnc()); + videoEnc = nullptr; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ReleaseDec()); + videoDec = nullptr; + OH_AVFormat_Destroy(VideoFormat); + VideoFormat = nullptr; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->CalcuError()); +} + + +/** + * @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, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0500, TestSize.Level1) +{ + VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample(); + + struct OH_AVCodec* videoDec = vDecEncSample->CreateVideoDecoderByMime(MIME_TYPE_AVC); + ASSERT_NE(nullptr, videoDec); + struct OH_AVCodec* videoEnc = vDecEncSample->CreateVideoEncoderByMime(MIME_TYPE_AVC); + ASSERT_NE(nullptr, videoEnc); + vDecEncSample->SetReadPath(READPATH); + vDecEncSample->SetEosState(false); + vDecEncSample->SetSavePath("/data/media/video_005.es"); + + OH_AVFormat *VideoFormat = createFormat(); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureDec(VideoFormat)); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureEnc(VideoFormat)); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->GetSurface()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->SetOutputSurface()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareDec()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartDec()); + + while (!vDecEncSample->GetDecEosState()) {}; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->CalcuError()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->FlushDec()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->FlushEnc()); + vDecEncSample->ReRead(); + vDecEncSample->ResetDecParam(); + vDecEncSample->ResetEncParam(); + vDecEncSample->SetSavePath("/data/media/video_005_2.es"); + vDecEncSample->SetEosState(true); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->CalcuError()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartDec()); + + while (!vDecEncSample->GetEncEosState()) {}; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ReleaseEnc()); + videoEnc = nullptr; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ReleaseDec()); + videoDec = nullptr; + OH_AVFormat_Destroy(VideoFormat); + VideoFormat = nullptr; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->CalcuError()); +} + + +/** + * @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, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0600, TestSize.Level1) +{ + VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample(); + + struct OH_AVCodec* videoDec = vDecEncSample->CreateVideoDecoderByMime(MIME_TYPE_AVC); + ASSERT_NE(nullptr, videoDec); + struct OH_AVCodec* videoEnc = vDecEncSample->CreateVideoEncoderByMime(MIME_TYPE_AVC); + ASSERT_NE(nullptr, videoEnc); + vDecEncSample->SetReadPath(READPATH); + vDecEncSample->SetEosState(false); + vDecEncSample->SetSavePath("/data/media/video_006.es"); + + OH_AVFormat *VideoFormat = createFormat(); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureDec(VideoFormat)); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureEnc(VideoFormat)); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->GetSurface()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->SetOutputSurface()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareDec()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartDec()); + + while (vDecEncSample->GetFrameCount() < 100) {}; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StopDec()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StopEnc()); + vDecEncSample->ReRead(); + vDecEncSample->ResetDecParam(); + vDecEncSample->ResetEncParam(); + vDecEncSample->SetEosState(true); + vDecEncSample->SetSavePath("/data/media/video_006_2.es"); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartDec()); + + while (!vDecEncSample->GetEncEosState()) {}; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StopDec()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StopEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ReleaseEnc()); + videoEnc = nullptr; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ReleaseDec()); + videoDec = nullptr; + OH_AVFormat_Destroy(VideoFormat); + VideoFormat = nullptr; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->CalcuError()); +} + + +/** + * @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, SUB_MULTIMEDIA_MEDIA_VIDEO_DEC_ENC_FUNCTION_0700, TestSize.Level1) +{ + VDecEncNdkSample *vDecEncSample = new VDecEncNdkSample(); + + struct OH_AVCodec* videoDec = vDecEncSample->CreateVideoDecoderByMime(MIME_TYPE_AVC); + ASSERT_NE(nullptr, videoDec); + struct OH_AVCodec* videoEnc = vDecEncSample->CreateVideoEncoderByMime(MIME_TYPE_AVC); + ASSERT_NE(nullptr, videoEnc); + vDecEncSample->SetReadPath(READPATH); + vDecEncSample->SetEosState(false); + vDecEncSample->SetSavePath("/data/media/video_007.es"); + + OH_AVFormat *VideoFormat = createFormat(); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureDec(VideoFormat)); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ConfigureEnc(VideoFormat)); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->GetSurface()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->SetOutputSurface()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->PrepareDec()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartDec()); + + while (!vDecEncSample->GetDecEosState()) {}; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StopDec()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->FlushEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->CalcuError()); + vDecEncSample->ReRead(); + vDecEncSample->ResetDecParam(); + vDecEncSample->ResetEncParam(); + vDecEncSample->SetSavePath("/data/media/video_007_2.es"); + vDecEncSample->SetEosState(true); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StartDec()); + + while (!vDecEncSample->GetEncEosState()) {}; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StopDec()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->StopEnc()); + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ReleaseEnc()); + videoEnc = nullptr; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->ReleaseDec()); + videoDec = nullptr; + OH_AVFormat_Destroy(VideoFormat); + VideoFormat = nullptr; + ASSERT_EQ(AV_ERR_OK, vDecEncSample->CalcuError()); +} \ No newline at end of file diff --git a/multimedia/media/media_cpp_standard/videoDecEncNdk/src/VDecEncNdkSample.cpp b/multimedia/media/media_cpp_standard/videoDecEncNdk/src/VDecEncNdkSample.cpp new file mode 100644 index 0000000000000000000000000000000000000000..432a636faf9700e38a92b6853130bc86a28f019a --- /dev/null +++ b/multimedia/media/media_cpp_standard/videoDecEncNdk/src/VDecEncNdkSample.cpp @@ -0,0 +1,755 @@ +/* + * 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 "gtest/gtest.h" +#include "audio_info.h" +#include "av_common.h" +#include "avcodec_video_encoder.h" +#include "avcodec_video_decoder.h" +#include "native_avmemory.h" +#include "VDecEncNdkSample.h" + +using namespace OHOS; +using namespace OHOS::Media; +using namespace std; + +namespace { + constexpr uint32_t SAMPLE_DURATION_US = 23000; + constexpr uint32_t ES[] = { + 2106, 11465, 321, 72, 472, 68, 76, 79, 509, 90, 677, 88, 956, 99, 347, 77, 452, 681, 81, 1263, 94, 106, 97, + 998, 97, 797, 93, 1343, 150, 116, 117, 926, 1198, 128, 110, 78, 1582, 158, 135, 112, 1588, 165, 132, + 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}; + constexpr uint32_t ES_LENGTH = sizeof(ES) / sizeof(uint32_t); + constexpr int32_t STOPNUM = 10000; + + void VdecAsyncError(OH_AVCodec *codec, int32_t errorCode, void *userData) + { + cout << "DEC Error errorCode=" << errorCode << endl; + VDecEncSignal* vcodecSignal_ = static_cast(userData); + vcodecSignal_->errorNum_ += 1; + } + + void VdecAsyncStreamChanged(OH_AVCodec *codec, OH_AVFormat *format, void *userData) + { + cout << "DEC Format Changed" << endl; + } + void VdecAsyncNeedInputData(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, void *userData) + { + VDecEncSignal* vcodecSignal_ = static_cast(userData); + unique_lock lock(vcodecSignal_->inMutexDec_); + if (vcodecSignal_->isVdecFlushing_.load()) { + cout << "VdecAsyncNeedInputData isVdecFlushing_ is true, return" << endl; + return; + } + vcodecSignal_->inQueueDec_.push(index); + vcodecSignal_->inBufferQueueDec_.push(data); + vcodecSignal_->inCondDec_.notify_all(); + } + + void VdecAsyncNewOutputData(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, + OH_AVCodecBufferAttr *attr, void *userData) + { + VDecEncSignal* vcodecSignal_ = static_cast(userData); + unique_lock lock(vcodecSignal_->outMutexDec_); + if (vcodecSignal_->isVdecFlushing_.load()) { + cout << "VdecAsyncNeedInputData isVdecFlushing_ is true, return" << endl; + return; + } + vcodecSignal_->outQueueDec_.push(index); + vcodecSignal_->flagQueueDec_.push(attr->flags); + vcodecSignal_->outCondDec_.notify_all(); + } + + + void VencAsyncError(OH_AVCodec *codec, int32_t errorCode, void *userData) + { + cout << "ENC Error errorCode=" << errorCode << endl; + VDecEncSignal* vcodecSignal_ = static_cast(userData); + vcodecSignal_->errorNum_ += 1; + } + + void VencAsyncStreamChanged(OH_AVCodec *codec, OH_AVFormat *format, void *userData) + { + cout << "ENC Format Changed" << endl; + } + + void VencAsyncNewOutputData(OH_AVCodec *codec, uint32_t index, OH_AVMemory *data, + OH_AVCodecBufferAttr *attr, void *userData) + { + VDecEncSignal* vcodecSignal_ = static_cast(userData); + unique_lock lock(vcodecSignal_->outMutexEnc_); + if (vcodecSignal_->isVencFlushing_.load()) { + cout << "VdecAsyncNeedInputData isVencFlushing_ is true, return" << endl; + return; + } + vcodecSignal_->outQueueEnc_.push(index); + vcodecSignal_->sizeQueueEnc_.push(attr->size); + vcodecSignal_->flagQueueEnc_.push(attr->flags); + vcodecSignal_->outBufferQueueEnc_.push(data); + vcodecSignal_->outCondEnc_.notify_all(); + } + + void clearIntqueue (std::queue& q) + { + std::queue empty; + swap(empty, q); + } + + void clearBufferqueue (std::queue& q) + { + std::queue empty; + swap(empty, q); + } +} + +VDecEncNdkSample::~VDecEncNdkSample() +{ + OH_VideoDecoder_Destroy(vdec_); + OH_VideoEncoder_Destroy(venc_); + + delete vcodecSignal_; + vcodecSignal_ = nullptr; +} + +void VDecEncNdkSample::SetReadPath(std::string filepath) +{ + inFile_ = filepath; + if (testFile_ == nullptr) { + testFile_ = std::make_unique(); + } + testFile_->open(inFile_, std::ios::in | std::ios::binary); +} + +void VDecEncNdkSample::SetSavePath(std::string filepath) +{ + outFile_ = filepath; +} + +void VDecEncNdkSample::SetEosState(bool needSetEos) +{ + setEos = needSetEos; +} + +void VDecEncNdkSample::ReRead() +{ + if (testFile_ != nullptr) { + testFile_->close(); + cout << "ReRead close before file success " << endl; + } + cout << "ReRead inFile is " << inFile_ << endl; + testFile_->open(inFile_, std::ios::in | std::ios::binary); + if (testFile_ != nullptr) { + cout << "testFile open success" << endl; + } + decInCnt_ = 0; + isFirstDecFrame_ = true; + timeStampDec_ = 0; +} + +void VDecEncNdkSample::ResetDecParam() +{ + decInCnt_ = 0; + decOutCnt_ = 0; + isDecInputEOS = false; + isDecOutputEOS = false; + unique_lock lockIn(vcodecSignal_->inMutexDec_); + clearIntqueue(vcodecSignal_->inQueueDec_); + clearBufferqueue(vcodecSignal_->inBufferQueueDec_); + vcodecSignal_->inCondDec_.notify_all(); + unique_lock lockOut(vcodecSignal_->outMutexDec_); + clearIntqueue(vcodecSignal_->outQueueDec_); + clearIntqueue(vcodecSignal_->flagQueueDec_); + clearBufferqueue(vcodecSignal_->outBufferQueueDec_); + vcodecSignal_->outCondDec_.notify_all(); + isDecRunning_.store(true); + cout << "isDecRunning_.load() is " << isDecRunning_.load() << endl; +} +void VDecEncNdkSample::ResetEncParam() +{ + encOutCnt_ = 0; + isEncInputEOS = false; + isEncOutputEOS = false; + unique_lock lockOut(vcodecSignal_->outMutexEnc_); + clearIntqueue(vcodecSignal_->outQueueEnc_); + clearIntqueue(vcodecSignal_->sizeQueueEnc_); + clearIntqueue(vcodecSignal_->flagQueueEnc_); + clearBufferqueue(vcodecSignal_->outBufferQueueEnc_); + vcodecSignal_->outCondEnc_.notify_all(); + isEncRunning_.store(true); + cout << "isEncRunning_.load() is " << isEncRunning_.load() << endl; +} + +struct OH_AVCodec* VDecEncNdkSample::CreateVideoDecoderByMime(std::string mimetype) +{ + vdec_ = OH_VideoDecoder_CreateByMime(mimetype.c_str()); + NDK_CHECK_AND_RETURN_RET_LOG(vdec_ != nullptr, nullptr, "Fatal: OH_VideoDecoder_CreateByMime"); + if (vcodecSignal_ == nullptr) { + vcodecSignal_ = new VDecEncSignal(); + NDK_CHECK_AND_RETURN_RET_LOG(vcodecSignal_ != nullptr, nullptr, "Fatal: No Memory"); + } + cbDec_.onError = VdecAsyncError; + cbDec_.onStreamChanged = VdecAsyncStreamChanged; + cbDec_.onNeedInputData = VdecAsyncNeedInputData; + cbDec_.onNeedOutputData = VdecAsyncNewOutputData; + int32_t ret = OH_VideoDecoder_SetCallback(vdec_, cbDec_, static_cast(vcodecSignal_)); + NDK_CHECK_AND_RETURN_RET_LOG(ret == AV_ERR_OK, NULL, "Fatal: OH_VideoDecoder_SetCallback"); + return vdec_; +} + +struct OH_AVCodec* VDecEncNdkSample::CreateVideoDecoderByName(std::string name) +{ + vdec_ = OH_VideoDecoder_CreateByName(name.c_str()); + NDK_CHECK_AND_RETURN_RET_LOG(vdec_ != nullptr, nullptr, "Fatal: OH_VideoDecoder_CreateByName"); + if (vcodecSignal_ == nullptr) { + vcodecSignal_ = new VDecEncSignal(); + NDK_CHECK_AND_RETURN_RET_LOG(vcodecSignal_ != nullptr, nullptr, "Fatal: No Memory"); + } + cbDec_.onError = VdecAsyncError; + cbDec_.onStreamChanged = VdecAsyncStreamChanged; + cbDec_.onNeedInputData = VdecAsyncNeedInputData; + cbDec_.onNeedOutputData = VdecAsyncNewOutputData; + int32_t ret = OH_VideoDecoder_SetCallback(vdec_, cbDec_, static_cast(vcodecSignal_)); + NDK_CHECK_AND_RETURN_RET_LOG(ret == AV_ERR_OK, NULL, "Fatal: OH_VideoDecoder_SetCallback"); + return vdec_; +} + +int32_t VDecEncNdkSample::ConfigureDec(struct OH_AVFormat *format) +{ + return OH_VideoDecoder_Configure(vdec_, format); +} + +int32_t VDecEncNdkSample::PrepareDec() +{ + return OH_VideoDecoder_Prepare(vdec_); +} + +int32_t VDecEncNdkSample::StartDec() +{ + cout << "Enter dec start" << endl; + isDecRunning_.store(true); + + if (inputLoopDec_ == nullptr) { + inputLoopDec_ = make_unique(&VDecEncNdkSample::InputFuncDec, this); + NDK_CHECK_AND_RETURN_RET_LOG(inputLoopDec_ != nullptr, AV_ERR_UNKNOWN, "Fatal: No memory"); + } + if (outputLoopDec_ == nullptr) { + outputLoopDec_ = make_unique(&VDecEncNdkSample::OutputFuncDec, this); + NDK_CHECK_AND_RETURN_RET_LOG(outputLoopDec_ != nullptr, AV_ERR_UNKNOWN, "Fatal: No memory"); + } + cout << "Exit dec start" << endl; + return OH_VideoDecoder_Start(vdec_); +} + +int32_t VDecEncNdkSample::StopDec() +{ + cout << "ENTER DEC stop" << endl; + unique_lock lock(vcodecSignal_->inMutexDec_); + unique_lock lock2(vcodecSignal_->outMutexDec_); + vcodecSignal_->isVdecFlushing_.store(true); + lock.unlock(); + lock2.unlock(); + int32_t ret = OH_VideoDecoder_Stop(vdec_); + unique_lock lockIn(vcodecSignal_->inMutexDec_); + clearIntqueue(vcodecSignal_->inQueueDec_); + clearBufferqueue(vcodecSignal_->inBufferQueueDec_); + vcodecSignal_->inCondDec_.notify_all(); + lockIn.unlock(); + unique_lock lockOut(vcodecSignal_->outMutexDec_); + clearIntqueue(vcodecSignal_->outQueueDec_); + clearIntqueue(vcodecSignal_->flagQueueDec_); + clearBufferqueue(vcodecSignal_->outBufferQueueDec_); + vcodecSignal_->outCondDec_.notify_all(); + lockOut.unlock(); + vcodecSignal_->isVdecFlushing_.store(false); + cout << "EXIT DEC stop" << endl; + return ret; +} + +int32_t VDecEncNdkSample::FlushDec() +{ + cout << "ENTER DEC FLUSH" << endl; + unique_lock lock(vcodecSignal_->inMutexDec_); + unique_lock lock2(vcodecSignal_->outMutexDec_); + vcodecSignal_->isVdecFlushing_.store(true); + lock.unlock(); + lock2.unlock(); + int32_t ret = OH_VideoDecoder_Flush(vdec_); + unique_lock lockIn(vcodecSignal_->inMutexDec_); + clearIntqueue(vcodecSignal_->inQueueDec_); + clearBufferqueue(vcodecSignal_->inBufferQueueDec_); + vcodecSignal_->inCondDec_.notify_all(); + lockIn.unlock(); + unique_lock lockOut(vcodecSignal_->outMutexDec_); + clearIntqueue(vcodecSignal_->outQueueDec_); + clearIntqueue(vcodecSignal_->flagQueueDec_); + clearBufferqueue(vcodecSignal_->outBufferQueueDec_); + vcodecSignal_->outCondDec_.notify_all(); + lockOut.unlock(); + vcodecSignal_->isVdecFlushing_.store(false); + cout << "EXIT DEC FLUSH" << endl; + return ret; +} + +int32_t VDecEncNdkSample::ResetDec() +{ + cout << "Enter DEC reset" << endl; + unique_lock lock(vcodecSignal_->inMutexDec_); + unique_lock lock2(vcodecSignal_->outMutexDec_); + vcodecSignal_->isVdecFlushing_.store(true); + lock.unlock(); + lock2.unlock(); + int32_t ret = OH_VideoDecoder_Reset(vdec_); + unique_lock lockIn(vcodecSignal_->inMutexDec_); + clearIntqueue(vcodecSignal_->inQueueDec_); + clearBufferqueue(vcodecSignal_->inBufferQueueDec_); + vcodecSignal_->inCondDec_.notify_all(); + lockIn.unlock(); + unique_lock lockOut(vcodecSignal_->outMutexDec_); + clearIntqueue(vcodecSignal_->outQueueDec_); + clearIntqueue(vcodecSignal_->flagQueueDec_); + clearBufferqueue(vcodecSignal_->outBufferQueueDec_); + vcodecSignal_->outCondDec_.notify_all(); + lockOut.unlock(); + vcodecSignal_->isVdecFlushing_.store(false); + cout << "Exit DEC reset" << endl; + return ret; +} + +int32_t VDecEncNdkSample::ReleaseDec() +{ + cout << "Enter DEC release" << endl; + isDecRunning_.store(false); + if (inputLoopDec_ != nullptr && inputLoopDec_->joinable()) { + unique_lock lock(vcodecSignal_->inMutexDec_); + vcodecSignal_->inQueueDec_.push(STOPNUM); + vcodecSignal_->inCondDec_.notify_all(); + lock.unlock(); + inputLoopDec_->join(); + inputLoopDec_.reset(); + } + if (outputLoopDec_ != nullptr && outputLoopDec_->joinable()) { + unique_lock lock(vcodecSignal_->outMutexDec_); + vcodecSignal_->outQueueDec_.push(STOPNUM); + vcodecSignal_->outCondDec_.notify_all(); + lock.unlock(); + outputLoopDec_->join(); + outputLoopDec_.reset(); + } + OH_VideoDecoder_Destroy(vdec_); + cout << "Exit DEC release" << endl; + return AV_ERR_OK; +} + +void VDecEncNdkSample::PopInqueueDec() +{ + if (vcodecSignal_ == nullptr) { + return; + } + vcodecSignal_->inQueueDec_.pop(); + vcodecSignal_->inBufferQueueDec_.pop(); +} + +int32_t VDecEncNdkSample::PushInbufferDec(uint32_t index, uint32_t bufferSize) +{ + if (vdec_ == nullptr) { + return AV_ERR_INVALID_VAL; + } + struct OH_AVCodecBufferAttr attr; + attr.offset = 0; + if (decInCnt_ == ES_LENGTH) { + attr.flags = AVCODEC_BUFFER_FLAGS_EOS; + attr.pts = 0; + attr.size = 0; + cout << "EOS Frame, frameCount = " << decInCnt_ << endl; + isDecInputEOS = true; + } else { + attr.pts = timeStampDec_; + attr.size = bufferSize; + if (isFirstDecFrame_) { + attr.flags = AVCODEC_BUFFER_FLAGS_CODEC_DATA; + isFirstDecFrame_ = false; + } else { + attr.flags = AVCODEC_BUFFER_FLAGS_NONE; + } + } + return OH_VideoDecoder_PushInputData(vdec_, index, attr); +} + +void VDecEncNdkSample::InputFuncDec() +{ + while (true) { + cout << "ENTER DEC IN" << endl; + if (!isDecRunning_.load()) { + break; + } + unique_lock lock(vcodecSignal_->inMutexDec_); + vcodecSignal_->inCondDec_.wait(lock, [this]() { return vcodecSignal_->inQueueDec_.size() > 0; }); + if (!isDecRunning_.load()) { + break; + } + + uint32_t index = vcodecSignal_->inQueueDec_.front(); + OH_AVMemory *buffer = reinterpret_cast(vcodecSignal_->inBufferQueueDec_.front()); + if (vcodecSignal_->isVdecFlushing_.load() || isDecInputEOS || buffer == nullptr) { + PopInqueueDec(); + continue; + } + NDK_CHECK_AND_RETURN_LOG(testFile_ != nullptr && testFile_->is_open(), "Fatal: open file fail"); + uint32_t bufferSize = 0; + if (decInCnt_ < ES_LENGTH) { + bufferSize = ES[decInCnt_]; + char *fileBuffer = (char *)malloc(sizeof(char) * bufferSize + 1); + NDK_CHECK_AND_RETURN_LOG(fileBuffer != nullptr, "Fatal: malloc fail"); + (void)testFile_->read(fileBuffer, bufferSize); + if (testFile_->eof()) { + free(fileBuffer); + cout << "Finish" << endl; + break; + } + if (memcpy_s(OH_AVMemory_GetAddr(buffer), OH_AVMemory_GetSize(buffer), fileBuffer, bufferSize) != EOK + || buffer == nullptr) { + free(fileBuffer); + PopInqueueDec(); + continue; + } + free(fileBuffer); + } + if (PushInbufferDec(index, bufferSize) != AV_ERR_OK) { + cout << "Fatal: OH_VideoDecoder_PushInputData fail, exit" << endl; + vcodecSignal_->errorNum_ += 1; + } else { + decInCnt_++; + } + timeStampDec_ += SAMPLE_DURATION_US; + PopInqueueDec(); + } +} + +void VDecEncNdkSample::PopOutqueueDec() +{ + if (vcodecSignal_ == nullptr) { + return; + } + vcodecSignal_->outQueueDec_.pop(); + vcodecSignal_->flagQueueDec_.pop(); +} + +void VDecEncNdkSample::SendEncEos() +{ + if (vcodecSignal_ == nullptr || venc_== nullptr) { + return; + } + if (setEos) { + int32_t ret = OH_VideoEncoder_NotifyEndOfStream(venc_); + if (ret == 0) { + cout << "ENC IN: input EOS " << endl; + isEncInputEOS = true; + } else { + cout << "ENC IN: input EOS fail" << endl; + vcodecSignal_->errorNum_ += 1; + } + } +} + +void VDecEncNdkSample::OutputFuncDec() +{ + while (true) { + if (!isDecRunning_.load()) { + break; + } + unique_lock lock(vcodecSignal_->outMutexDec_); + vcodecSignal_->outCondDec_.wait(lock, [this]() { return vcodecSignal_->outQueueDec_.size() > 0; }); + if (!isDecRunning_.load()) { + break; + } + if (vcodecSignal_->isVdecFlushing_.load() || vcodecSignal_->isVencFlushing_.load() || isEncInputEOS) { + PopOutqueueDec(); + continue; + } + + uint32_t index = vcodecSignal_->outQueueDec_.front(); + uint32_t outflag = vcodecSignal_->flagQueueDec_.front(); + if (outflag == 0) { + uint32_t ret = OH_VideoDecoder_RenderOutputData(vdec_, index); + if (ret == 0) { + decOutCnt_ += 1; + cout << "DEC OUT.: render output success, decOutCnt_ is " << decOutCnt_ << endl; + } else { + cout << "DEC OUT. Fatal: ReleaseOutputBuffer fail" << endl; + vcodecSignal_->errorNum_ += 1; + break; + } + } else { + cout << "DEC OUT.: output EOS" << endl; + isDecOutputEOS = true; + SendEncEos(); + } + PopOutqueueDec(); + } +} + +struct OH_AVCodec* VDecEncNdkSample::CreateVideoEncoderByMime(std::string mimetype) +{ + venc_ = OH_VideoEncoder_CreateByMime(mimetype.c_str()); + NDK_CHECK_AND_RETURN_RET_LOG(venc_ != nullptr, nullptr, "Fatal: OH_VideoEncoder_CreateByMime"); + + if (vcodecSignal_ == nullptr) { + vcodecSignal_ = new VDecEncSignal(); + NDK_CHECK_AND_RETURN_RET_LOG(vcodecSignal_ != nullptr, nullptr, "Fatal: No Memory"); + } + cbEnc_.onError = VencAsyncError; + cbEnc_.onStreamChanged = VencAsyncStreamChanged; + cbEnc_.onNeedOutputData = VencAsyncNewOutputData; + int32_t ret = OH_VideoEncoder_SetCallback(venc_, cbEnc_, static_cast(vcodecSignal_)); + NDK_CHECK_AND_RETURN_RET_LOG(ret == AV_ERR_OK, NULL, "Fatal: OH_VideoEncoder_SetCallback"); + return venc_; +} + +struct OH_AVCodec* VDecEncNdkSample::CreateVideoEncoderByName(std::string name) +{ + venc_ = OH_VideoEncoder_CreateByName(name.c_str()); + NDK_CHECK_AND_RETURN_RET_LOG(venc_ != nullptr, nullptr, "Fatal: OH_VideoEncoder_CreateByName"); + + if (vcodecSignal_ == nullptr) { + vcodecSignal_ = new VDecEncSignal(); + NDK_CHECK_AND_RETURN_RET_LOG(vcodecSignal_ != nullptr, nullptr, "Fatal: No Memory"); + } + cbEnc_.onError = VencAsyncError; + cbEnc_.onStreamChanged = VencAsyncStreamChanged; + cbEnc_.onNeedOutputData = VencAsyncNewOutputData; + int32_t ret = OH_VideoEncoder_SetCallback(venc_, cbEnc_, static_cast(vcodecSignal_)); + NDK_CHECK_AND_RETURN_RET_LOG(ret == AV_ERR_OK, NULL, "Fatal: OH_VideoEncoder_SetCallback"); + return venc_; +} + +int32_t VDecEncNdkSample::ConfigureEnc(struct OH_AVFormat *format) +{ + return OH_VideoEncoder_Configure(venc_, format); +} + +struct VEncObject : public OH_AVCodec { + explicit VEncObject(const std::shared_ptr &encoder) + : OH_AVCodec(AVMagic::MEDIA_MAGIC_VIDEO_ENCODER), videoEncoder_(encoder) {} + ~VEncObject() = default; + + const std::shared_ptr videoEncoder_; +}; + +int32_t VDecEncNdkSample::GetSurface() +{ + return OH_VideoEncoder_GetSurface(venc_, &nativeWindow_); +} + +struct VDecObject : public OH_AVCodec { + explicit VDecObject(const std::shared_ptr &decoder) + : OH_AVCodec(AVMagic::MEDIA_MAGIC_VIDEO_DECODER), videoDecoder_(decoder) {} + ~VDecObject() = default; + + const std::shared_ptr videoDecoder_; +}; + +int32_t VDecEncNdkSample::SetOutputSurface() +{ + return OH_VideoDecoder_SetSurface(vdec_, nativeWindow_); +} + +int32_t VDecEncNdkSample::PrepareEnc() +{ + return OH_VideoEncoder_Prepare(venc_); +} + +int32_t VDecEncNdkSample::StartEnc() +{ + cout << "Enter enc start" << endl; + isEncRunning_.store(true); + if (outputLoopEnc_ == nullptr) { + outputLoopEnc_ = make_unique(&VDecEncNdkSample::OutputFuncEnc, this); + NDK_CHECK_AND_RETURN_RET_LOG(outputLoopEnc_ != nullptr, AV_ERR_UNKNOWN, "Fatal: No memory"); + } + cout << "Exit enc start" << endl; + return OH_VideoEncoder_Start(venc_); +} + +int32_t VDecEncNdkSample::StopEnc() +{ + cout << "Enter enc stop" << endl; + unique_lock lock(vcodecSignal_->outMutexEnc_); + vcodecSignal_->isVencFlushing_.store(true); + lock.unlock(); + int32_t ret = OH_VideoEncoder_Stop(venc_); + unique_lock lockOut(vcodecSignal_->outMutexEnc_); + clearIntqueue(vcodecSignal_->outQueueEnc_); + clearIntqueue(vcodecSignal_->sizeQueueEnc_); + clearIntqueue(vcodecSignal_->flagQueueEnc_); + clearBufferqueue(vcodecSignal_->outBufferQueueEnc_); + vcodecSignal_->outCondEnc_.notify_all(); + lockOut.unlock(); + vcodecSignal_->isVencFlushing_.store(false); + cout << "Exit enc stop" << endl; + return ret; +} + +int32_t VDecEncNdkSample::FlushEnc() +{ + cout << "Enter enc flush" << endl; + unique_lock lock(vcodecSignal_->outMutexEnc_); + vcodecSignal_->isVencFlushing_.store(true); + lock.unlock(); + int32_t ret = OH_VideoEncoder_Flush(venc_); + unique_lock lockOut(vcodecSignal_->outMutexEnc_); + clearIntqueue(vcodecSignal_->outQueueEnc_); + clearIntqueue(vcodecSignal_->sizeQueueEnc_); + clearIntqueue(vcodecSignal_->flagQueueEnc_); + clearBufferqueue(vcodecSignal_->outBufferQueueEnc_); + vcodecSignal_->outCondEnc_.notify_all(); + lockOut.unlock(); + vcodecSignal_->isVencFlushing_.store(false); + cout << "Exit enc flush" << endl; + return ret; +} + +int32_t VDecEncNdkSample::ResetEnc() +{ + cout << "Enter enc reset" << endl; + unique_lock lock(vcodecSignal_->outMutexEnc_); + vcodecSignal_->isVencFlushing_.store(true); + lock.unlock(); + int32_t ret = OH_VideoEncoder_Reset(venc_); + unique_lock lockOut(vcodecSignal_->outMutexEnc_); + clearIntqueue(vcodecSignal_->outQueueEnc_); + clearIntqueue(vcodecSignal_->sizeQueueEnc_); + clearIntqueue(vcodecSignal_->flagQueueEnc_); + clearBufferqueue(vcodecSignal_->outBufferQueueEnc_); + vcodecSignal_->outCondEnc_.notify_all(); + lockOut.unlock(); + vcodecSignal_->isVencFlushing_.store(false); + cout << "exit enc reset" << endl; + return ret; +} + +int32_t VDecEncNdkSample::ReleaseEnc() +{ + cout << "Enter enc release" << endl; + isEncRunning_.store(false); + if (outputLoopEnc_ != nullptr && outputLoopEnc_->joinable()) { + unique_lock lock(vcodecSignal_->outMutexEnc_); + vcodecSignal_->outQueueEnc_.push(STOPNUM); + vcodecSignal_->outCondEnc_.notify_all(); + lock.unlock(); + outputLoopEnc_->join(); + outputLoopEnc_.reset(); + } + cout << "exit enc release" << endl; + OH_VideoEncoder_Destroy(venc_); + cout << "exit enc destroy" << endl; + return AV_ERR_OK; +} + +void VDecEncNdkSample::PopOutqueueEnc() +{ + if (vcodecSignal_ == nullptr) { + return; + } + vcodecSignal_->outQueueEnc_.pop(); + vcodecSignal_->sizeQueueEnc_.pop(); + vcodecSignal_->flagQueueEnc_.pop(); + vcodecSignal_->outBufferQueueEnc_.pop(); +} + +int32_t VDecEncNdkSample::WriteToFile() +{ + auto buffer = vcodecSignal_->outBufferQueueEnc_.front(); + uint32_t size = vcodecSignal_->sizeQueueEnc_.front(); + if (buffer == nullptr) { + cout << "getOutPut Buffer fail" << endl; + return AV_ERR_INVALID_VAL; + } + FILE *outFile = fopen(outFile_.c_str(), "a"); + if (outFile == nullptr) { + cout << "dump data fail" << endl; + return AV_ERR_INVALID_VAL; + } else { + fwrite(OH_AVMemory_GetAddr(buffer), 1, size, outFile); + } + return fclose(outFile); +} + +void VDecEncNdkSample::OutputFuncEnc() +{ + while (true) { + if (!isEncRunning_.load()) { + break; + } + unique_lock lock(vcodecSignal_->outMutexEnc_); + vcodecSignal_->outCondEnc_.wait(lock, [this]() { return vcodecSignal_->outQueueEnc_.size() > 0; }); + if (!isEncRunning_.load()) { + break; + } + if (vcodecSignal_->isVencFlushing_.load() || isEncOutputEOS) { + PopOutqueueEnc(); + continue; + } + + uint32_t index = vcodecSignal_->outQueueEnc_.front(); + uint32_t encOutflag = vcodecSignal_->flagQueueEnc_.front(); + if (encOutflag == 1) { + cout << "ENC get output EOS" << endl; + isEncOutputEOS = true; + } else { + if (WriteToFile() != 0) { + PopOutqueueEnc(); + continue; + } + uint32_t ret = OH_VideoEncoder_FreeOutputData(venc_, index); + if (ret != 0) { + cout << "Fatal: ReleaseOutputBuffer fail" << endl; + vcodecSignal_->errorNum_ += 1; + } else { + encOutCnt_ += 1; + cout << "ENC OUT.: output success, encOutCnt_ is " << encOutCnt_ << endl; + } + } + PopOutqueueEnc(); + } +} + +int32_t VDecEncNdkSample::CalcuError() +{ + cout << "errorNum_ is :" << vcodecSignal_->errorNum_ << endl; + cout << "decInCnt_ is :" << decInCnt_ << endl; + cout << "decOutCnt_ is :" << decOutCnt_ << endl; + cout << "encOutCnt_ is :" << encOutCnt_ << endl; + cout << "DEC inQueueDec_.size() is " << vcodecSignal_->inQueueDec_.size() << endl; + cout << "DEC outQueueDec_.size() is " << vcodecSignal_->outQueueDec_.size() << endl; + cout << "DEC outBufferQueueDec_.size() is " << vcodecSignal_->outBufferQueueDec_.size() << endl; + cout << "DEC outQueueEnc_.size() is " << vcodecSignal_->outQueueEnc_.size() << endl; + return vcodecSignal_->errorNum_ ; +} + +int32_t VDecEncNdkSample::GetFrameCount() +{ + return encOutCnt_; +} +bool VDecEncNdkSample::GetEncEosState() +{ + return isEncOutputEOS; +} +bool VDecEncNdkSample::GetDecEosState() +{ + return isDecOutputEOS; +} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/AudioPlayerTestBase.js b/multimedia/media/media_js_standard/AudioPlayerTestBase.js index a67be4e0185ffcf489d0fc9956f4fcd5ac879bd9..bef966e419d8ceda9ad020ccc02f7d2089b851dc 100644 --- a/multimedia/media/media_js_standard/AudioPlayerTestBase.js +++ b/multimedia/media/media_js_standard/AudioPlayerTestBase.js @@ -41,7 +41,7 @@ export function playAudioSource(src, duration, playTime, checkSeekTime, done) { console.info('case set source success'); expect(audioPlayer.state).assertEqual('idle'); expect(audioPlayer.currentTime).assertEqual(0); - expect(audioPlayer.duration).assertClose(duration, 500); + expect(Math.abs(audioPlayer.duration - duration)).assertLess(500); // step 0: dataLoad -> play audioPlayer.play(); }); @@ -53,10 +53,23 @@ export function playAudioSource(src, duration, playTime, checkSeekTime, done) { // step 1: play -> seek duration/3 mediaTestBase.msleep(playTime); audioPlayer.seek(audioPlayer.duration / 3); + // step 2: seek duration/3 -> pause + mediaTestBase.msleep(playTime); + audioPlayer.pause(); } else if (playCount == 2) { // step 5: play -> seek duration when loop is true audioPlayer.loop = true; audioPlayer.seek(audioPlayer.duration); + // step 6: seek duration -> setVolume + seek duration when loop is false + mediaTestBase.msleep(playTime); + console.info('case state 2 is :' + audioPlayer.state); + expect(audioPlayer.state).assertEqual('playing'); + audioPlayer.loop = false; + audioPlayer.setVolume(0.5); + audioPlayer.seek(audioPlayer.duration); + seekEOS = true; + // step 7: wait for finish + mediaTestBase.msleep(playTime); } else if (playCount == 3) { // step 9: play -> stop audioPlayer.stop(); @@ -72,6 +85,8 @@ export function playAudioSource(src, duration, playTime, checkSeekTime, done) { if (pauseCount == 1) { // step 3: pause -> seek 0 audioPlayer.seek(0); + // step 4: seek 0 -> play + audioPlayer.play(); } else { // step 13: pause -> stop audioPlayer.stop(); @@ -112,40 +127,7 @@ export function playAudioSource(src, duration, playTime, checkSeekTime, done) { done(); return; } - console.info('case seek success, and seek time is ' + seekDoneTime); - if (seekCount == 1) { - // step 2: seek duration/3 -> pause - expect(audioPlayer.state).assertEqual('playing'); - if (checkSeekTime) { - expect(audioPlayer.duration / 3).assertClose(seekDoneTime, 1); - } - mediaTestBase.msleep(playTime); - audioPlayer.pause(); - } else if (seekCount == 2){ - // step 4: seek 0 -> play - if (checkSeekTime) { - expect(0).assertEqual(seekDoneTime); - } - expect(audioPlayer.state).assertEqual('paused'); - audioPlayer.play(); - } else if (seekCount == 3){ - // step 6: seek duration -> setVolume + seek duration when loop is false - if (checkSeekTime) { - expect(audioPlayer.duration).assertEqual(seekDoneTime); - } - mediaTestBase.msleep(playTime); - expect(audioPlayer.state).assertEqual('playing'); - audioPlayer.loop = false; - audioPlayer.setVolume(0.5); - audioPlayer.seek(audioPlayer.duration); - seekEOS = true; - } else if (seekEOS && seekDoneTime != 0){ - // step 7: wait for finish - if (checkSeekTime) { - expect(audioPlayer.duration).assertEqual(seekDoneTime); - } - mediaTestBase.msleep(playTime); - } + console.info('case timeUpdate success, and timeUpdate is ' + seekDoneTime); }); audioPlayer.on('volumeChange', () => { console.info('case set volume success '); diff --git a/multimedia/media/media_js_standard/VideoPlayerTestBase.js b/multimedia/media/media_js_standard/VideoPlayerTestBase.js index 1a06ae480327c5d81e620a6f617d1fcb1221e602..199311645310e07593e84edde5e84fde619f649a 100644 --- a/multimedia/media/media_js_standard/VideoPlayerTestBase.js +++ b/multimedia/media/media_js_standard/VideoPlayerTestBase.js @@ -49,7 +49,7 @@ export async function playVideoSource(url, width, height, duration, playTime, do await videoPlayer.prepare().then(() => { console.info('case prepare called'); - expect(videoPlayer.duration).assertClose(duration, 500); + expect(Math.abs(videoPlayer.duration - duration)).assertLess(500); if (width != null & height != null) { expect(videoPlayer.width).assertEqual(width); expect(videoPlayer.height).assertEqual(height); @@ -75,7 +75,7 @@ export async function playVideoSource(url, width, height, duration, playTime, do mediaTestBase.msleep(playTime); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); let endTime = videoPlayer.currentTime; - expect(endTime - startTime).assertClose(playTime, 1000); + expect(Math.abs(endTime - startTime - playTime)).assertLess(1000); await videoPlayer.seek(videoPlayer.duration / 3).then((seekDoneTime) => { console.info('case seek called and seekDoneTime is ' + seekDoneTime); @@ -203,7 +203,7 @@ export async function testVideoSeek(url, duration, playTime, done) { videoPlayer.seek(videoPlayer.duration / 3).then((seekDoneTime) => { console.info('case seek called and seekDoneTime is ' + seekDoneTime); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); - expect(videoPlayer.duration).assertClose(duration, 500); + expect(Math.abs(videoPlayer.duration - duration)).assertLess(500); await videoPlayer.pause().then(() => { console.info('case pause called'); expect(videoPlayer.state).assertEqual('paused'); @@ -224,7 +224,7 @@ export async function testVideoSeek(url, duration, playTime, done) { console.info('case setSpeed called and speedMode is ' + speedMode); expect(speedMode).assertEqual(media.PlaybackSpeed.SPEED_FORWARD_2_00_X); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); - expect(videoPlayer.duration).assertClose(duration, 500); + expect(Math.abs(videoPlayer.duration - duration)).assertLess(500); await videoPlayer.setVolume(0.5).then(() => { console.info('case setVolume called'); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); diff --git a/multimedia/media/media_js_standard/VideoRecorderTestBase.js b/multimedia/media/media_js_standard/VideoRecorderTestBase.js index 777a7e41ae3e6ed5fcc8df367392fff1f389c3ac..67ee6ffd84c8c04a337a0b199abc45f377cffd98 100644 --- a/multimedia/media/media_js_standard/VideoRecorderTestBase.js +++ b/multimedia/media/media_js_standard/VideoRecorderTestBase.js @@ -22,7 +22,8 @@ const VIDEO_TRACK = 'video_track'; const AUDIO_TRACK = 'audio_track'; const AUDIO_VIDEO_TYPE = 'audio_video'; const ONLYVIDEO_TYPE = 'only_video'; -const DELTA_TIME = 1000; +const DELTA_TIME = 1500; +const BITRATE_DELTA_TIME = 20000; const PLAY_TIME = 1000; @@ -50,13 +51,25 @@ export function getTrackArray(videoType, recorderConfigFile) { if (videoType == AUDIO_VIDEO_TYPE) { let audioTrack = new Array(recorderConfigFile.audioBitrate, recorderConfigFile.audioChannels, 'audio/mpeg', recorderConfigFile.audioSampleRate); - let videoTrack = new Array('video/mpeg', recorderConfigFile.videoFrameHeight, - recorderConfigFile.videoFrameWidth); + let videoTrack = null; + if (recorderConfigFile.videoCodec == 'video/avc') { + videoTrack = new Array('video/x-h264', recorderConfigFile.videoFrameHeight, + recorderConfigFile.videoFrameWidth); + } else { + videoTrack = new Array('video/mpeg', recorderConfigFile.videoFrameHeight, + recorderConfigFile.videoFrameWidth); + } let trackArray = new Array(videoTrack, audioTrack); return trackArray; } else if (videoType == ONLYVIDEO_TYPE) { - let videoTrack = new Array('video/mpeg', - recorderConfigFile.videoFrameHeight, recorderConfigFile.videoFrameWidth); + let videoTrack = null; + if (recorderConfigFile.videoCodec == 'video/avc') { + videoTrack = new Array('video/x-h264', recorderConfigFile.videoFrameHeight, + recorderConfigFile.videoFrameWidth); + } else { + videoTrack = new Array('video/mpeg', recorderConfigFile.videoFrameHeight, + recorderConfigFile.videoFrameWidth); + } let trackArray = new Array(videoTrack); return trackArray; } else { @@ -78,7 +91,7 @@ export function checkDescription(obj, trackTpye, descriptionValue) { expect(obj['width']).assertEqual(descriptionValue[index++]); } else { console.info('case audio bitrate is '+ obj['bitrate']); - expect(obj['bitrate']).assertClose(descriptionValue[index++], 2 * DELTA_TIME); + expect(Math.abs(obj['bitrate'] - descriptionValue[index++])).assertLess(BITRATE_DELTA_TIME); console.info('case audio channel_count is '+ obj['channel_count']); expect(obj['channel_count']).assertEqual(descriptionValue[index++]); console.info('case audio codec_mime is '+ obj['codec_mime']); @@ -115,7 +128,7 @@ export async function checkVideos(playFdPath, duration, trackArray, playerSurfac } await videoPlayer.prepare().then(() => { expect(videoPlayer.state).assertEqual('prepared'); - expect(videoPlayer.duration).assertClose(duration, DELTA_TIME); + expect(Math.abs(videoPlayer.duration - duration)).assertLess(DELTA_TIME); console.info('case prepare called!!'); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); @@ -136,7 +149,7 @@ export async function checkVideos(playFdPath, duration, trackArray, playerSurfac expect(videoPlayer.state).assertEqual('playing'); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); let endTime = videoPlayer.currentTime; - expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME); + expect(Math.abs(endTime - startTime - PLAY_TIME)).assertLess(DELTA_TIME); await videoPlayer.stop().then(() => { console.info('case stop called!!'); diff --git a/multimedia/media/media_js_standard/audioCodecFormat/src/main/config.json b/multimedia/media/media_js_standard/audioCodecFormat/src/main/config.json index b2aec582d8a220073ac0d90404a3758bcdad941c..751e465b8a6e893a1169853ef6518dbbf3d55912 100644 --- a/multimedia/media/media_js_standard/audioCodecFormat/src/main/config.json +++ b/multimedia/media/media_js_standard/audioCodecFormat/src/main/config.json @@ -44,6 +44,7 @@ } ], "deviceType": [ + "default", "default", "tablet", "tv", diff --git a/multimedia/media/media_js_standard/audioDecoder/src/main/config.json b/multimedia/media/media_js_standard/audioDecoder/src/main/config.json index 1b3b41930b02ec67954983e701da1a708d2a1361..8cc8834a54914997f444435118f3928b98f017cd 100644 --- a/multimedia/media/media_js_standard/audioDecoder/src/main/config.json +++ b/multimedia/media/media_js_standard/audioDecoder/src/main/config.json @@ -44,6 +44,7 @@ } ], "deviceType": [ + "default", "default", "tablet", "tv", diff --git a/multimedia/media/media_js_standard/audioEncoder/src/main/config.json b/multimedia/media/media_js_standard/audioEncoder/src/main/config.json index 80ce37311c3ecefe494acea709a028b4205b341d..89ce75b7d8ce7e64fa1e8961d2c097343842f154 100644 --- a/multimedia/media/media_js_standard/audioEncoder/src/main/config.json +++ b/multimedia/media/media_js_standard/audioEncoder/src/main/config.json @@ -44,6 +44,7 @@ } ], "deviceType": [ + "default", "default", "tablet", "tv", diff --git a/multimedia/media/media_js_standard/audioPlayer/Test.json b/multimedia/media/media_js_standard/audioPlayer/Test.json index 392125a3583e0f1d3808b6d597be6d5de1272bf2..bf19fbf7825e6f1d15e7efacfa54f688d5936c2e 100644 --- a/multimedia/media/media_js_standard/audioPlayer/Test.json +++ b/multimedia/media/media_js_standard/audioPlayer/Test.json @@ -19,9 +19,12 @@ { "type": "ShellKit", "run-command": [ - "mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files" + "mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files", + "power-shell setmode 602" ], - "teardown-command": [] + "teardown-command": [ + "power-shell setmode 600" + ] }, { "type": "PushKit", diff --git a/multimedia/media/media_js_standard/audioPlayer/src/main/config.json b/multimedia/media/media_js_standard/audioPlayer/src/main/config.json index d9d3fd57c8a67693575a0d4ccb86503093891f41..d25cb8cfe5735bc489e234438e8cb2b4eb598769 100644 --- a/multimedia/media/media_js_standard/audioPlayer/src/main/config.json +++ b/multimedia/media/media_js_standard/audioPlayer/src/main/config.json @@ -57,6 +57,7 @@ } ], "deviceType": [ + "default", "default", "tablet", "tv", 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 3e42214faf3f65630dec741d536fa1fbb9225a91..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 @@ -117,6 +117,9 @@ describe('PlayerLocalTestAudioAPI', function () { case SEEK_STATE: console.info(`case seek to time is ${mySteps[SECOND_INDEX]}`); audioPlayer.seek(mySteps[SECOND_INDEX]); + mySteps.shift(); + mySteps.shift(); + nextStep(mySteps, done); break; case VOLUME_STATE: console.info(`case to setVolume`); @@ -195,36 +198,25 @@ describe('PlayerLocalTestAudioAPI', function () { console.info(`case seek filed,errcode is ${seekDoneTime}`); return; } - if (mySteps[0] != SEEK_STATE) { - return; - } - mySteps.shift(); - mySteps.shift(); - console.info(`case seekDoneTime is ${seekDoneTime}`); - console.info(`case seek called`); - expect(audioPlayer.currentTime + DELTA_TIME).assertClose(seekDoneTime + DELTA_TIME, DELTA_TIME); - console.info(`case loop is ${audioPlayer.loop}`); - if ((audioPlayer.loop == true) && (seekDoneTime == DURATION_TIME)) { - console.info('case loop is true'); - mediaTestBase.msleep(PLAY_STATE); - } - if ((seekDoneTime < audioPlayer.duration) || (audioPlayer.state == 'paused')) { - nextStep(mySteps,done); - } + console.info(`case timeUpdate, seekDoneTime is ${seekDoneTime}`); }); audioPlayer.on('volumeChange', () => { - console.info(`case setvolume called`); - mySteps.shift(); - mySteps.shift(); - if (audioPlayer.state == 'playing') { - mediaTestBase.msleep(PLAY_TIME); + if (mySteps[0] != VOLUME_STATE) { + console.info(`case setvolume called by system`); + } else { + console.info(`case setvolume called`); + mySteps.shift(); + mySteps.shift(); + if (audioPlayer.state == 'playing') { + mediaTestBase.msleep(PLAY_TIME); + } + nextStep(mySteps,done); } - nextStep(mySteps,done); }); audioPlayer.on('finish', () => { mySteps.shift(); expect(audioPlayer.state).assertEqual('stopped'); - expect(audioPlayer.currentTime).assertClose(audioPlayer.duration, DELTA_TIME); + expect(Math.abs(audioPlayer.currentTime - audioPlayer.duration)).assertLess(DELTA_TIME); console.info(`case finish called`); nextStep(mySteps,done); }); @@ -249,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); @@ -266,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); @@ -283,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); @@ -300,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(); @@ -316,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); @@ -333,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(); @@ -349,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(); @@ -365,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(); @@ -381,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(); @@ -397,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(); @@ -413,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(); @@ -429,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(); @@ -445,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(); @@ -461,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(); @@ -477,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(); @@ -493,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(); @@ -509,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(); @@ -525,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(); @@ -541,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(); @@ -557,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(); @@ -573,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(); @@ -589,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(); @@ -605,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(); @@ -621,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(); @@ -637,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(); @@ -653,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(); @@ -669,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(); @@ -685,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(); @@ -701,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(''); @@ -720,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/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js b/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js index e9e50d775d1f4fb3572e1e9a6bd2d6a5af158acf..1098511da51a782ae03c911691466bee0f7a4604 100644 --- a/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js +++ b/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFUNC.test.js @@ -130,6 +130,9 @@ describe('PlayerLocalTestAudioFUNC', function () { case SEEK_STATE: console.info('case seek to time is ' + mySteps[SECOND_INDEX]); audioPlayer.seek(mySteps[SECOND_INDEX]); + mySteps.shift(); + mySteps.shift(); + nextStep(mySteps, done); break; case VOLUME_STATE: console.info(`case to setVolume`); @@ -235,38 +238,25 @@ describe('PlayerLocalTestAudioFUNC', function () { nextStep(mySteps, done); }); audioPlayer.on('timeUpdate', (seekDoneTime) => { - if (typeof (seekDoneTime) == 'undefined') { - expect().assertFail(); - console.info('case seek failed'); - return; - } - if (mySteps[0] != SEEK_STATE) { - return; - } - mySteps.shift(); - mySteps.shift(); - console.info('case seekDoneTime is' + seekDoneTime); - expect(audioPlayer.currentTime + DELTA_TIME).assertClose(seekDoneTime + DELTA_TIME, DELTA_TIME); - console.info('case loop is' + audioPlayer.loop); - if ((audioPlayer.loop == true) && (seekDoneTime == DURATION_TIME)) { - console.info('case loop is true'); - mediaTestBase.msleep(PLAY_STATE); - } - nextStep(mySteps, done); + console.info('case timeUpdate seekDoneTime is' + seekDoneTime); }); audioPlayer.on('volumeChange', () => { - console.info(`case setvolume called`); - mySteps.shift(); - mySteps.shift(); - if (audioPlayer.state == 'playing') { - mediaTestBase.msleep(PLAY_TIME); + if (mySteps[0] != VOLUME_STATE) { + console.info(`case setvolume called by system`); + } else { + console.info(`case setvolume called`); + mySteps.shift(); + mySteps.shift(); + if (audioPlayer.state == 'playing') { + mediaTestBase.msleep(PLAY_TIME); + } + nextStep(mySteps, done); } - nextStep(mySteps, done); }); audioPlayer.on('finish', () => { mySteps.shift(); expect(audioPlayer.state).assertEqual('stopped'); - expect(audioPlayer.currentTime).assertClose(audioPlayer.duration, DELTA_TIME); + expect(Math.abs(audioPlayer.currentTime - audioPlayer.duration)).assertLess(DELTA_TIME); console.info(`case finish called`); nextStep(mySteps, done); }); @@ -287,14 +277,14 @@ describe('PlayerLocalTestAudioFUNC', function () { } /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FUNCTION_SETSOURCE + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FUNCTION_SETSOURCE_0100 * @tc.name : 001.test setSorce '' * @tc.desc : Audio playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FUNCTION_SETSOURCE', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FUNCTION_SETSOURCE_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); bufferFlag = true; let mySteps = new Array(SRC_STATE, ERROR_STATE, RELEASE_STATE, END_STATE); @@ -304,14 +294,14 @@ describe('PlayerLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FUNCTION_SETVOLUME + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FUNCTION_SETVOLUME_0100 * @tc.name : 001.test SetVolume 0/0.5/1 * @tc.desc : Audio playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FUNCTION_SETVOLUME', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FUNCTION_SETVOLUME_0100', 0, async function (done) { let mySteps = new Array(SRC_STATE, PLAY_STATE, VOLUME_STATE, 0, VOLUME_STATE, 0.5, VOLUME_STATE, MAX_VOLUME, RESET_STATE, RELEASE_STATE, END_STATE); initAudioPlayer(); @@ -320,14 +310,14 @@ describe('PlayerLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_SEEK + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FUNCTION_SEEK_0100 * @tc.name : 001.test seek mode 0 / 0.5 * duration/ duration * @tc.desc : Audio playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_SEEK', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FUNCTION_SEEK_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, PLAY_STATE, SEEK_STATE, 0, SEEK_STATE, DURATION_TIME / 2, SEEK_STATE, DURATION_TIME, FINISH_STATE, RELEASE_STATE, END_STATE); @@ -337,14 +327,14 @@ describe('PlayerLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_GETTRECKDESCRIPTION + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FUNCTION_GETTRECKDESCRIPTION_0100 * @tc.name : 001.test getTrackDescription * @tc.desc : Audio playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_GETTRECKDESCRIPTION', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FUNCTION_GETTRECKDESCRIPTION_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let mySteps = new Array(SRC_STATE, GETDESCRIPTION_PROMISE, GETDESCRIPTION_CALLBACK, RELEASE_STATE, END_STATE); initAudioPlayer(); @@ -353,14 +343,14 @@ describe('PlayerLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FUNCTION_LOOP + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FUNCTION_LOOP_0100 * @tc.name : 001.test loop * @tc.desc : Audio playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FUNCTION_LOOP', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FUNCTION_LOOP_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let playCount = 0; let seekCount = 0; @@ -397,37 +387,24 @@ describe('PlayerLocalTestAudioFUNC', function () { console.info('case seek failed'); return; } - console.info(`case seekDoneTime is ${seekDoneTime}`); - if (seekDoneTime == DURATION_TIME) { - if (seekCount == 3) { - console.info('case loop is false, seek time is ' + seekDoneTime); - testAudioPlayer.loop = false; - testAudioPlayer.seek(DURATION_TIME); - seekCount++; - } else if (seekCount < 3) { - seekCount++; - console.info('case seek time is ' + seekDoneTime); - console.info('case seek testAudioPlayer.loop is ' + testAudioPlayer.loop); - expect(testAudioPlayer.loop).assertEqual(true); - expect(testAudioPlayer.state).assertEqual('playing'); - mediaTestBase.msleep(PLAY_TIME); - testAudioPlayer.seek(DURATION_TIME); - } else { - console.info('case last seek time is ' + seekDoneTime); - } - } else if (seekDoneTime == 0) { - console.info('case seek time is ' + seekDoneTime); + console.info('case timeUpdate, seekDoneTime is ' + seekDoneTime); + console.info('case timeUpdate, testAudioPlayer.state is ' + testAudioPlayer.state); + + if (seekDoneTime == DURATION_TIME && seekCount == 0) { + console.info('case loop step 1'); + seekCount++; + //mediaTestBase.msleep(PLAY_TIME); expect(testAudioPlayer.state).assertEqual('playing'); - if (seekCount == 4) { - expect(testAudioPlayer.loop).assertEqual(false); - } else { - expect(testAudioPlayer.loop).assertEqual(true); - } + testAudioPlayer.seek(DURATION_TIME - 1000); + } else if ((seekDoneTime == (DURATION_TIME - 1000)) && seekCount == 1) { + console.info('case loop step 2'); + seekCount++; + testAudioPlayer.loop = false; } }); testAudioPlayer.on('finish', () => { console.info('case finish success seekCount is ' + seekCount); - expect(seekCount).assertEqual(4); + expect(seekCount).assertEqual(2); testAudioPlayer.reset(); }); testAudioPlayer.on('reset', () => { @@ -442,46 +419,47 @@ describe('PlayerLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FUNCTION_BASE_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FUNCTION_BASE_0100 * @tc.name : 001.test audio player (src) * @tc.desc : Audio playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FUNCTION_BASE_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FUNCTION_BASE_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); playAudioSource(fdPath, DURATION_TIME, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FUNCTION_BASE_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FUNCTION_BASE_0200 * @tc.name : 002.test audio player (fdsrc) * @tc.desc : Audio playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FUNCTION_BASE_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FUNCTION_BASE_0200', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); playAudioSource(fileDescriptor, DURATION_TIME, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FUNCTION_MULTIPLE + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FUNCTION_MULTIPLE_0100 * @tc.name : 001.test two audio player * @tc.desc : Audio playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FUNCTION_MULTIPLE', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FUNCTION_MULTIPLE_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); function waitForDone() { console.info('case wait for next player'); } playAudioSource(fdPath, DURATION_TIME, PLAY_TIME, true, waitForDone); - mediaTestBase.msleep(1000); + await mediaTestBase.msleepAsync(1000).then( + () => {}, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); playAudioSource(fdPath, DURATION_TIME, PLAY_TIME, true, done); }) }) diff --git a/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js b/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js index 9cc739cda3316064fa51508ef1e6a9a356cf098f..23809b4ab4881534d0ec99d322e31023b57fc096 100644 --- a/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js +++ b/multimedia/media/media_js_standard/audioPlayer/src/main/js/test/PlayerLocalTestAudioFormat.test.js @@ -13,15 +13,13 @@ * limitations under the License. */ -import media from '@ohos.multimedia.media' import * as mediaTestBase from '../../../../../MediaTestBase.js'; +import {playAudioSource} from '../../../../../AudioPlayerTestBase.js'; import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' export default function PlayerLocalTestAudioFormat() { describe('PlayerLocalTestAudioFormat', function () { - const MAX_VOLUME = 1; const PLAY_TIME = 3000; - const SEEK_TIME = 10000; // 10s let isToSeek = false; let isToDuration = false; let fdNumber = 0; @@ -44,85 +42,8 @@ describe('PlayerLocalTestAudioFormat', function () { console.info('afterAll case'); }) - async function playSource(audioFile, done) { - let audioPlayer = media.createAudioPlayer(); - await mediaTestBase.getFdRead(audioFile, done).then((testNumber) => { - fdNumber = testNumber; - }) - audioPlayer.on('dataLoad', () => { - console.info('case set source success'); - expect(audioPlayer.state).assertEqual('idle'); - expect(audioPlayer.currentTime).assertEqual(0); - audioPlayer.play(); - }); - audioPlayer.on('play', () => { - console.info('case start to play'); - expect(audioPlayer.state).assertEqual('playing'); - mediaTestBase.msleep(PLAY_TIME); - if (!isToSeek) { - audioPlayer.pause(); - } else { - audioPlayer.seek(SEEK_TIME); - } - }); - audioPlayer.on('pause', () => { - console.info('case now is paused'); - expect(audioPlayer.state).assertEqual('paused'); - audioPlayer.setVolume(MAX_VOLUME); - }); - audioPlayer.on('stop', () => { - console.info('case stop success'); - expect(audioPlayer.state).assertEqual('stopped'); - audioPlayer.reset(); - }); - audioPlayer.on('reset', () => { - console.info('case reset success'); - expect(audioPlayer.state).assertEqual('idle'); - audioPlayer.release(); - audioPlayer = null; - done(); - }); - audioPlayer.on('timeUpdate', (seekDoneTime) => { - if (seekDoneTime == null) { - console.info(`case seek filed,errcode is ${seekDoneTime}`); - audioPlayer.release(); - expect().assertFail(); - done(); - return; - } - console.info('case seek success, and seek time is ' + seekDoneTime); - if (!isToDuration) { - expect(SEEK_TIME).assertEqual(seekDoneTime); - isToDuration = true; - mediaTestBase.msleep(PLAY_TIME); - audioPlayer.seek(audioPlayer.duration); - } else { - expect(audioPlayer.duration).assertEqual(seekDoneTime); - } - }); - audioPlayer.on('volumeChange', () => { - console.info('case set volume value to ' + MAX_VOLUME); - audioPlayer.play(); - isToSeek = true; - }); - audioPlayer.on('finish', () => { - console.info('case play end'); - expect(audioPlayer.state).assertEqual('stopped'); - audioPlayer.stop(); - }); - audioPlayer.on('error', (err) => { - console.info(`case error called,errName is ${err.name}`); - console.info(`case error called,errCode is ${err.code}`); - console.info(`case error called,errMessage is ${err.message}`); - audioPlayer.release(); - expect().assertFail(); - done(); - }); - audioPlayer.src = 'fd://' + fdNumber; - } - /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP3_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP3_0100 * @tc.name : 001.Playing mp3 streams * @tc.desc : Format : MP3 Codec : MP3 @@ -133,12 +54,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP3_0100', 0, async function (done) { - playSource('01.mp3', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP3_0100', 0, async function (done) { + await mediaTestBase.getFdRead('01.mp3', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219600, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP3_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP3_0200 * @tc.name : 002.Playing mp3 streams * @tc.desc : Format : MP3 Codec : MP3 @@ -149,12 +74,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP3_0200', 0, async function (done) { - playSource('02.mp3', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP3_0200', 0, async function (done) { + await mediaTestBase.getFdRead('02.mp3', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber; + playAudioSource(path, 219600, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP3_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP3_0300 * @tc.name : 003.Playing mp3 streams * @tc.desc : Format : MP3 Codec : MP3 @@ -165,12 +94,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP3_0300', 0, async function (done) { - playSource('03.mp3', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP3_0300', 0, async function (done) { + await mediaTestBase.getFdRead('03.mp3', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber; + playAudioSource(path, 219600, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP3_0400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP3_0400 * @tc.name : 004.Playing mp3 streams * @tc.desc : Format : MP3 Codec : MP3 @@ -181,12 +114,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP3_0400', 0, async function (done) { - playSource('04.mp3', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP3_0400', 0, async function (done) { + await mediaTestBase.getFdRead('04.mp3', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219600, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0100 * @tc.name : 001.Playing mp4 streams * @tc.desc : Format : MP4 Codec : AAC LC @@ -197,13 +134,17 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_0100', 0, async function (done) { - playSource('47.mp4', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0100', 0, async function (done) { + await mediaTestBase.getFdRead('47.mp4', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219575, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0300 * @tc.name : 003.Playing mp4 streams * @tc.desc : Format : MP4 Codec : AAC LC @@ -214,12 +155,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_0300', 0, async function (done) { - playSource('49.mp4', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0300', 0, async function (done) { + await mediaTestBase.getFdRead('49.mp4', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219575, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_0400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0400 * @tc.name : 004.Playing mp4 streams * @tc.desc : Format : MP4 Codec : AAC LC @@ -230,12 +175,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_0400', 0, async function (done) { - playSource('50.mp4', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0400', 0, async function (done) { + await mediaTestBase.getFdRead('50.mp4', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219575, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_0500 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0500 * @tc.name : 005.Playing mp4 streams * @tc.desc : Format : MP4 Codec : AAC LC @@ -246,12 +195,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_0500', 0, async function (done) { - playSource('51.mp4', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0500', 0, async function (done) { + await mediaTestBase.getFdRead('51.mp4', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219565, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_0600 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0600 * @tc.name : 006.Playing mp4 streams * @tc.desc : Format : MP4 Codec : AAC LC @@ -262,12 +215,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_0600', 0, async function (done) { - playSource('54.mp4', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0600', 0, async function (done) { + await mediaTestBase.getFdRead('54.mp4', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219577, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_0700 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0700 * @tc.name : 007.Playing mp4 streams * @tc.desc : Format : MP4 Codec : MP3 @@ -278,12 +235,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_0700', 0, async function (done) { - playSource('64.mp4', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0700', 0, async function (done) { + await mediaTestBase.getFdRead('64.mp4', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219577, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_0800 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0800 * @tc.name : 008.Playing mp4 streams * @tc.desc : Format : MP4 Codec : MP3 @@ -294,12 +255,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_0800', 0, async function (done) { - playSource('65.mp4', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0800', 0, async function (done) { + await mediaTestBase.getFdRead('65.mp4', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219577, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_0900 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0900 * @tc.name : 009.Playing mp4 streams * @tc.desc : Format : MP4 Codec : MP3 @@ -310,12 +275,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_0900', 0, async function (done) { - playSource('66.mp4', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_0900', 0, async function (done) { + await mediaTestBase.getFdRead('66.mp4', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219577, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_1000 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1000 * @tc.name : 010.Playing mp4 streams * @tc.desc : Format : MP4 Codec : MP3 @@ -326,12 +295,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_1000', 0, async function (done) { - playSource('67.mp4', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1000', 0, async function (done) { + await mediaTestBase.getFdRead('67.mp4', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219577, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_1100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1100 * @tc.name : 011.Playing mp4 streams * @tc.desc : Format : MP4 Codec : Vorbis @@ -342,12 +315,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_1100', 0, async function (done) { - playSource('92.mp4', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1100', 0, async function (done) { + await mediaTestBase.getFdRead('92.mp4', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219555, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_1200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1200 * @tc.name : 012.Playing mp4 streams * @tc.desc : Format : MP4 Codec : Vorbis @@ -358,12 +335,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_1200', 0, async function (done) { - playSource('93.mp4', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1200', 0, async function (done) { + await mediaTestBase.getFdRead('93.mp4', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219555, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_1300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1300 * @tc.name : 013.Playing mp4 streams * @tc.desc : Format : MP4 Codec : Vorbis @@ -374,12 +355,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_1300', 0, async function (done) { - playSource('94.mp4', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1300', 0, async function (done) { + await mediaTestBase.getFdRead('94.mp4', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219555, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_1400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1400 * @tc.name : 014.Playing mp4 streams * @tc.desc : Format : MP4 Codec : Vorbis @@ -390,12 +375,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_1400', 0, async function (done) { - playSource('96.mp4', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1400', 0, async function (done) { + await mediaTestBase.getFdRead('96.mp4', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219554, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_1500 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1500 * @tc.name : 015.Playing mp4 streams * @tc.desc : Format : MP4 Codec : Vorbis @@ -406,12 +395,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_1500', 0, async function (done) { - playSource('97.mp4', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1500', 0, async function (done) { + await mediaTestBase.getFdRead('97.mp4', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219554, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_1600 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1600 * @tc.name : 016.Playing mp4 streams * @tc.desc : Format : MP4 Codec : Vorbis @@ -422,12 +415,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_MP4_1600', 0, async function (done) { - playSource('98.mp4', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_MP4_1600', 0, async function (done) { + await mediaTestBase.getFdRead('98.mp4', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219554, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_M4A_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_M4A_0100 * @tc.name : 001.Playing m4a streams * @tc.desc : Format : M4A Codec : AAC LC @@ -438,13 +435,17 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_M4A_0100', 0, async function (done) { - playSource('55.m4a', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_M4A_0100', 0, async function (done) { + await mediaTestBase.getFdRead('55.m4a', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219575, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_M4A_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_M4A_0300 * @tc.name : 003.Playing m4a streams * @tc.desc : Format : M4A Codec : AAC LC @@ -455,12 +456,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_M4A_0300', 0, async function (done) { - playSource('57.m4a', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_M4A_0300', 0, async function (done) { + await mediaTestBase.getFdRead('57.m4a', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219575, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_M4A_0400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_M4A_0400 * @tc.name : 004.Playing m4a streams * @tc.desc : Format : M4A Codec : AAC LC @@ -471,12 +476,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_M4A_0400', 0, async function (done) { - playSource('58.m4a', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_M4A_0400', 0, async function (done) { + await mediaTestBase.getFdRead('58.m4a', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219575, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_M4A_0500 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_M4A_0500 * @tc.name : 005.Playing m4a streams * @tc.desc : Format : M4A Codec : AAC LC @@ -487,12 +496,16 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_M4A_0500', 0, async function (done) { - playSource('59.m4a', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_M4A_0500', 0, async function (done) { + await mediaTestBase.getFdRead('59.m4a', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219565, PLAY_TIME, true, done); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_M4A_0700 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_M4A_0700 * @tc.name : 007.Playing m4a streams * @tc.desc : Format : M4A Codec : AAC LC @@ -503,8 +516,12 @@ describe('PlayerLocalTestAudioFormat', function () { * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_LOCAL_FORMAT_M4A_0700', 0, async function (done) { - playSource('62.m4a', done); + it('SUB_MULTIMEDIA_MEDIA_AUDIOPLAYER_FORMAT_M4A_0700', 0, async function (done) { + await mediaTestBase.getFdRead('62.m4a', done).then((testNumber) => { + fdNumber = testNumber; + }) + let path = 'fd://' + fdNumber + playAudioSource(path, 219565, PLAY_TIME, true, done); }) }) } diff --git a/multimedia/media/media_js_standard/audioRecorder/Test.json b/multimedia/media/media_js_standard/audioRecorder/Test.json index 67543d85b136cd4094b26e4d1dbaa2bec9dec71a..21b2f993a6aebb7c14acfa1fcf692b8c0865f8fd 100644 --- a/multimedia/media/media_js_standard/audioRecorder/Test.json +++ b/multimedia/media/media_js_standard/audioRecorder/Test.json @@ -10,9 +10,11 @@ { "type": "ShellKit", "run-command": [ - "rm -rf /storage/media/100/local/files/Videos/audio_*" + "rm -rf /storage/media/100/local/files/Audios/audio_*", + "power-shell setmode 602" ], "teardown-command":[ + "power-shell setmode 600" ] }, { diff --git a/multimedia/media/media_js_standard/audioRecorder/src/main/config.json b/multimedia/media/media_js_standard/audioRecorder/src/main/config.json index 938e76200054f1cfc03e7c0f3f8dd56eba6a4e30..3dc3a205614ad972f6fde0f804eaf5098ab95106 100644 --- a/multimedia/media/media_js_standard/audioRecorder/src/main/config.json +++ b/multimedia/media/media_js_standard/audioRecorder/src/main/config.json @@ -44,6 +44,7 @@ } ], "deviceType": [ + "default", "default", "tablet", "tv", 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 1b554a13de677c468e054fe535990f21dcd484d7..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 2cd8c6304a401d3c421363d714cbebc4552d602e..8389851c9783d84467245586ffdd1cd1f31f5ebc 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; @@ -527,14 +527,14 @@ describe('RecorderLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_0100 * @tc.name : 001.start * @tc.desc : Audio recordr control test * @tc.size : MediumTest * @tc.type : Function * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_0100', 0, async function (done) { fdObject = await mediaTestBase.getAudioFd('audio_16.m4a'); fdPath = "fd://" + fdObject.fdNumber.toString(); audioConfig.uri = fdPath; @@ -548,14 +548,14 @@ describe('RecorderLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_0200 * @tc.name : 002.pause * @tc.desc : Audio recordr control test * @tc.size : MediumTest * @tc.type : Function * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_0200', 0, async function (done) { fdObject = await mediaTestBase.getAudioFd('audio_17.m4a'); fdPath = "fd://" + fdObject.fdNumber.toString(); audioConfig.uri = fdPath; @@ -569,14 +569,14 @@ describe('RecorderLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_0300 * @tc.name : 003.pause->resume * @tc.desc : Audio recordr control test * @tc.size : MediumTest * @tc.type : Function * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_0300', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_0300', 0, async function (done) { fdObject = await mediaTestBase.getAudioFd('audio_18.m4a'); fdPath = "fd://" + fdObject.fdNumber.toString(); audioConfig.uri = fdPath; @@ -590,14 +590,14 @@ describe('RecorderLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_0400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_0400 * @tc.name : 005.reset * @tc.desc : Audio recordr control test * @tc.size : MediumTest * @tc.type : Function * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_0400', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_0400', 0, async function (done) { fdObject = await mediaTestBase.getAudioFd('audio_19.m4a'); fdPath = "fd://" + fdObject.fdNumber.toString(); audioConfig.uri = fdPath; @@ -611,14 +611,14 @@ describe('RecorderLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_0500 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_0500 * @tc.name : 006.pause->resume->pause * @tc.desc : Audio recordr control test * @tc.size : MediumTest * @tc.type : Function * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_0500', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_0500', 0, async function (done) { fdObject = await mediaTestBase.getAudioFd('audio_20.m4a'); fdPath = "fd://" + fdObject.fdNumber.toString(); audioConfig.uri = fdPath; @@ -626,20 +626,20 @@ describe('RecorderLocalTestAudioFUNC', function () { let trackArray = videoRecorderBase.getTrackArray(ONLYAUDIO_TYPE, audioConfig); initAudioRecorder(); let mySteps = new Array(PRE_STATE, START_STATE, PAUSE_STATE, RESUME_STATE, PAUSE_STATE, - STOP_STATE, RELEASE_STATE, CHECK_STATE, trackArray, RECORDER_TIME, END_STATE); + STOP_STATE, RELEASE_STATE, CHECK_STATE, trackArray, RECORDER_TIME * 2, END_STATE); setCallback(mySteps, done); audioRecorder.prepare(audioConfig); }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_0600 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_0600 * @tc.name : 007.pause->stop->reset * @tc.desc : Audio recordr control test * @tc.size : MediumTest * @tc.type : Function * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_0600', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_0600', 0, async function (done) { fdObject = await mediaTestBase.getAudioFd('audio_21.m4a'); fdPath = "fd://" + fdObject.fdNumber.toString(); audioConfig.uri = fdPath; @@ -653,14 +653,14 @@ describe('RecorderLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_0700 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_0700 * @tc.name : 008.pause->resume->stop->reset * @tc.desc : Audio recordr control test * @tc.size : MediumTest * @tc.type : Function * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_0700', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_0700', 0, async function (done) { fdObject = await mediaTestBase.getAudioFd('audio_22.m4a'); fdPath = "fd://" + fdObject.fdNumber.toString(); audioConfig.uri = fdPath; @@ -674,14 +674,14 @@ describe('RecorderLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_0800 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_0800 * @tc.name : 009.stop->reset->pause->resume->stop->reset * @tc.desc : Audio recordr control test * @tc.size : MediumTest * @tc.type : Function * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_0800', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_0800', 0, async function (done) { fdObject = await mediaTestBase.getAudioFd('audio_23.m4a'); fdPath = "fd://" + fdObject.fdNumber.toString(); audioConfig.uri = fdPath; @@ -696,14 +696,14 @@ describe('RecorderLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_0900 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_0900 * @tc.name : 010.stop->reset->pause->stop->reset * @tc.desc : Audio recordr control test * @tc.size : MediumTest * @tc.type : Function * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_0900', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_0900', 0, async function (done) { fdObject = await mediaTestBase.getAudioFd('audio_24.m4a'); fdPath = "fd://" + fdObject.fdNumber.toString(); audioConfig.uri = fdPath; @@ -718,14 +718,14 @@ describe('RecorderLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_1000 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_1000 * @tc.name : 011.start->reset->start->stop * @tc.desc : Audio recordr control test * @tc.size : MediumTest * @tc.type : Function * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_1000', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_1000', 0, async function (done) { fdObject = await mediaTestBase.getFd('audio_25.mp4'); fdPath = "fd://" + fdObject.fdNumber.toString(); audioConfig.uri = fdPath; @@ -739,14 +739,14 @@ describe('RecorderLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_1100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_1100 * @tc.name : 012.start->pause->start(error) * @tc.desc : Audio recordr control test * @tc.size : MediumTest * @tc.type : Function * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_1100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_1100', 0, async function (done) { fdObject = await mediaTestBase.getFd('audio_26.mp4'); fdPath = "fd://" + fdObject.fdNumber.toString(); audioConfig.uri = fdPath; @@ -760,14 +760,14 @@ describe('RecorderLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_1200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_1200 * @tc.name : 013.start->stop->pause(error) * @tc.desc : Audio recordr control test * @tc.size : MediumTest * @tc.type : Function * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_1200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_1200', 0, async function (done) { fdObject = await mediaTestBase.getFd('audio_27.mp4'); fdPath = "fd://" + fdObject.fdNumber.toString(); audioConfig.uri = fdPath; @@ -781,7 +781,7 @@ describe('RecorderLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_1300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_1300 * @tc.name : 014. API8 audioEncoderMime: audio/mp4a-latm, * fileFormat:mp4 * @tc.desc : Audio recordr control test @@ -789,7 +789,7 @@ describe('RecorderLocalTestAudioFUNC', function () { * @tc.type : Function * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_1300', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_1300', 0, async function (done) { fdObject = await mediaTestBase.getFd('audio_28.mp4'); fdPath = "fd://" + fdObject.fdNumber.toString(); let newAudioConfig = { @@ -811,7 +811,7 @@ describe('RecorderLocalTestAudioFUNC', function () { }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_1400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_1400 * @tc.name : 014. API8 audioEncoderMime: audio/mp4a-latm, * fileFormat:m4a * @tc.desc : Audio recordr control test @@ -819,7 +819,7 @@ describe('RecorderLocalTestAudioFUNC', function () { * @tc.type : Function * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_RECORDER_AUDIO_FUNCTION_1400', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_AUDIO_RECORDER_FUNCTION_1400', 0, async function (done) { fdObject = await mediaTestBase.getAudioFd('audio_29.m4a'); fdPath = "fd://" + fdObject.fdNumber.toString(); let newAudioConfig = { diff --git a/multimedia/media/media_js_standard/hlsPlayer/src/main/config.json b/multimedia/media/media_js_standard/hlsPlayer/src/main/config.json index 1770d4222e19d4a2377574f88d58ade16d25a965..a3098d40d1a284fd4604849398698eeff3da7476 100644 --- a/multimedia/media/media_js_standard/hlsPlayer/src/main/config.json +++ b/multimedia/media/media_js_standard/hlsPlayer/src/main/config.json @@ -44,6 +44,7 @@ } ], "deviceType": [ + "default", "default", "tablet", "tv", diff --git a/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/VideoPlayerHLSSeekTest.test.js b/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/VideoPlayerHLSSeekTest.test.js index dc97230a663ae2c0468f7122c983358ce722b2a7..c6c04312e73aa2ba47a4f581bcddbea956dc8b5f 100644 --- a/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/VideoPlayerHLSSeekTest.test.js +++ b/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/VideoPlayerHLSSeekTest.test.js @@ -47,7 +47,7 @@ describe('VideoPlayerHLSTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HLS_SEEK + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_SEEK_0100 * @tc.name : 001.test hls * @tc.desc : HLS Video playback control test * @tc.size : MediumTest @@ -81,7 +81,7 @@ describe('VideoPlayerHLSTest', function () { * @tc.level : Level1 */ it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_SEEK_AudioOnly_0100', 0, async function (done) { - await testVideoSeek(HTTP_PATH + '05.hls/audio_only/index.m3u8', 10033, PLAY_TIME, done); + await testVideoSeek(HTTP_PATH + '05.hls/audio_only/index.m3u8', 219600, PLAY_TIME, done); done(); }) diff --git a/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/VideoPlayerHLSTest.test.js b/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/VideoPlayerHLSTest.test.js index 285f025b582bfdeddc1b65ba947c6624e89ddd0b..83161274dd8dcb1e867019a0844a55658e0aa80c 100644 --- a/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/VideoPlayerHLSTest.test.js +++ b/multimedia/media/media_js_standard/hlsPlayer/src/main/js/test/VideoPlayerHLSTest.test.js @@ -47,7 +47,7 @@ describe('VideoPlayerHLSTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HLS + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_0100 * @tc.name : 001.test hls * @tc.desc : HLS Video playback control test * @tc.size : MediumTest @@ -81,7 +81,7 @@ describe('VideoPlayerHLSTest', function () { * @tc.level : Level1 */ it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HLS_AudioOnly_0100', 0, async function (done) { - await playVideoSource(HTTP_PATH + '05.hls/audio_only/index.m3u8', 0, 0, 10033, PLAY_TIME, done); + await playVideoSource(HTTP_PATH + '05.hls/audio_only/index.m3u8', 0, 0, 219600, PLAY_TIME, done); done(); }) diff --git a/multimedia/media/media_js_standard/httpPlayer/src/main/config.json b/multimedia/media/media_js_standard/httpPlayer/src/main/config.json index 029ecc293038b47b77b890388b0b7a2b3cc4dec1..9ca0c9eb28707a1dc6db2e621f7fcf1102c3b53b 100644 --- a/multimedia/media/media_js_standard/httpPlayer/src/main/config.json +++ b/multimedia/media/media_js_standard/httpPlayer/src/main/config.json @@ -44,6 +44,7 @@ } ], "deviceType": [ + "default", "phone", "tablet", "tv", diff --git a/multimedia/media/media_js_standard/httpPlayer/src/main/js/test/HttpPlayerCompatibilityTest.test.js b/multimedia/media/media_js_standard/httpPlayer/src/main/js/test/HttpPlayerCompatibilityTest.test.js index f223df92d3f154ae3df09a14f57adfc12dfcbbc0..fdde5667bd9a115c9c861ef59df3da12b71232ed 100644 --- a/multimedia/media/media_js_standard/httpPlayer/src/main/js/test/HttpPlayerCompatibilityTest.test.js +++ b/multimedia/media/media_js_standard/httpPlayer/src/main/js/test/HttpPlayerCompatibilityTest.test.js @@ -52,7 +52,7 @@ describe('HttpPlayerCompatibilityTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_MP4_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_MP4_0100 * @tc.name : 001.H264_AAC * @tc.desc : Http playback control test * @tc.size : MediumTest @@ -66,7 +66,7 @@ describe('HttpPlayerCompatibilityTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_MP4_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_MP4_0200 * @tc.name : 002.H264_MP3 * @tc.desc : Http playback control test * @tc.size : MediumTest @@ -80,7 +80,7 @@ describe('HttpPlayerCompatibilityTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_TS_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_TS_0100 * @tc.name : 001.H264_AAC * @tc.desc : Http playback control test * @tc.size : MediumTest @@ -94,7 +94,7 @@ describe('HttpPlayerCompatibilityTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_TS_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_TS_0200 * @tc.name : 002.H264_MP3 * @tc.desc : Http playback control test * @tc.size : MediumTest @@ -108,7 +108,7 @@ describe('HttpPlayerCompatibilityTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_MKV_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_MKV_0100 * @tc.name : 001.H264_AAC * @tc.desc : Http playback control test * @tc.size : MediumTest @@ -122,7 +122,7 @@ describe('HttpPlayerCompatibilityTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_MKV_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_MKV_0200 * @tc.name : 002.H264_MP3 * @tc.desc : Http playback control test * @tc.size : MediumTest @@ -136,7 +136,7 @@ describe('HttpPlayerCompatibilityTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_MKV_0500 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_MKV_0500 * @tc.name : 005.MPEG2_AAC * @tc.desc : Http playback control test * @tc.size : MediumTest @@ -150,7 +150,7 @@ describe('HttpPlayerCompatibilityTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_MKV_0600 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_MKV_0600 * @tc.name : 006.MPEG2_MP3 * @tc.desc : Http playback control test * @tc.size : MediumTest @@ -164,7 +164,7 @@ describe('HttpPlayerCompatibilityTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_MKV_0800 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_MKV_0800 * @tc.name : 008.MPEG4_MP3 * @tc.desc : Http playback control test * @tc.size : MediumTest @@ -178,7 +178,7 @@ describe('HttpPlayerCompatibilityTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_WEBM_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_HTTP_FORMAT_WEBM_0100 * @tc.name : 001.VP8_VORBIS * @tc.desc : Http playback control test * @tc.size : MediumTest @@ -192,7 +192,7 @@ describe('HttpPlayerCompatibilityTest', function () { }) /* * - * @tc.number : SUB_MEDIA_AUDIO_PLAYER_HTTP_FORMAT_MP3_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_HTTP_FORMAT_MP3_0100 * @tc.name : 001.MP3 * @tc.desc : Http playback control test * @tc.size : MediumTest @@ -205,7 +205,7 @@ describe('HttpPlayerCompatibilityTest', function () { }) /* * - * @tc.number : SUB_MEDIA_AUDIO_PLAYER_HTTP_FORMAT_AAC_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_HTTP_FORMAT_AAC_0100 * @tc.name : 001.AAC * @tc.desc : Http playback control test * @tc.size : MediumTest @@ -218,7 +218,7 @@ describe('HttpPlayerCompatibilityTest', function () { }) /* * - * @tc.number : SUB_MEDIA_AUDIO_PLAYER_HTTP_FORMAT_WAV_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_HTTP_FORMAT_WAV_0100 * @tc.name : 001.MP3 * @tc.desc : Http playback control test * @tc.size : MediumTest @@ -231,7 +231,7 @@ describe('HttpPlayerCompatibilityTest', function () { }) /* * - * @tc.number : SUB_MEDIA_AUDIO_PLAYER_HTTP_FORMAT_FLAC_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_HTTP_FORMAT_FLAC_0100 * @tc.name : 001.FLAC * @tc.desc : Http playback control test * @tc.size : MediumTest @@ -244,7 +244,7 @@ describe('HttpPlayerCompatibilityTest', function () { }) /* * - * @tc.number : SUB_MEDIA_AUDIO_PLAYER_HTTP_FORMAT_M4A_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_HTTP_FORMAT_M4A_0100 * @tc.name : 001.M4A * @tc.desc : Http playback control test * @tc.size : MediumTest @@ -257,7 +257,7 @@ describe('HttpPlayerCompatibilityTest', function () { }) /* * - * @tc.number : SUB_MEDIA_AUDIO_PLAYER_HTTP_FORMAT_OGG_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_AUDIO_PLAYER_HTTP_FORMAT_OGG_0100 * @tc.name : 001.OGG * @tc.desc : Http playback control test * @tc.size : MediumTest diff --git a/multimedia/media/media_js_standard/recorderFormat/src/main/config.json b/multimedia/media/media_js_standard/recorderFormat/src/main/config.json index dae5bb381e561f2d019aaebb9f0d09d2c9a46fc5..283888e7ebf790b2a0e502452bad083e37c84a29 100644 --- a/multimedia/media/media_js_standard/recorderFormat/src/main/config.json +++ b/multimedia/media/media_js_standard/recorderFormat/src/main/config.json @@ -57,6 +57,7 @@ } ], "deviceType": [ + "default", "default", "tablet", "tv", diff --git a/multimedia/media/media_js_standard/recorderProfile/BUILD.gn b/multimedia/media/media_js_standard/recorderProfile/BUILD.gn deleted file mode 100644 index e72aae52ecb2723b776d7cdbf385f6af4e64d012..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/recorderProfile/BUILD.gn +++ /dev/null @@ -1,36 +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("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("recorder_profile_js_hap") { - hap_profile = "./src/main/config.json" - js2abc = true - deps = [ - ":profile_js_assets", - ":profile_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsRecorderProfileJsTest" - subsystem_name = "multimedia" - part_name = "multimedia_player_framework" -} -ohos_js_assets("profile_js_assets") { - js2abc = true - hap_profile = "./src/main/config.json" - source_dir = "./src/main/js" -} -ohos_resources("profile_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} 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/signature/openharmony_sx.p7b b/multimedia/media/media_js_standard/recorderProfile/signature/openharmony_sx.p7b deleted file mode 100644 index 02772ce36b607a459e0e124b0240997e7e0c5523..0000000000000000000000000000000000000000 Binary files a/multimedia/media/media_js_standard/recorderProfile/signature/openharmony_sx.p7b and /dev/null differ diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/config.json b/multimedia/media/media_js_standard/recorderProfile/src/main/config.json deleted file mode 100644 index 0c8c8f09de6dcc3650e39ca3103226e44143bb14..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/config.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "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": "" - } -} \ No newline at end of file diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/i18n/en-US.json b/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "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/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ 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/MainAbility/pages/index/index.js b/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 9f776a29eacf91263bacf9ddf404b13e8607bd60..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,29 +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. - */ - - -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/test/List.test.js b/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/List.test.js deleted file mode 100644 index a49b1267843b4940264a0cd71217be4b0d948681..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/List.test.js +++ /dev/null @@ -1,25 +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 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() -} 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 8b46680c65a1ac5aa378fff66ae86ba918b8fc9c..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/js/test/ProfileAbnormalTestCallback.test.js +++ /dev/null @@ -1,345 +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 callbackAbnormalAudioRecoderConfigSupported(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(false); - console.info('isAudioRecoderConfigSupported: 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_PROFILE_RELIABILITY_CALLBACK_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_PROFILE_RELIABILITY_CALLBACK_0100', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalAll, done); - }) - - /* * - * @tc.number : SUB_PROFILE_RELIABILITY_CALLBACK_0200 - * @tc.name : test isAudioRecoderConfigSupported false - * @tc.desc : FormatType is wrong - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_PROFILE_RELIABILITY_CALLBACK_0200', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalFormatType, done); - }) - - /* * - * @tc.number : SUB_PROFILE_RELIABILITY_CALLBACK_0300 - * @tc.name : test isAudioRecoderConfigSupported fasle - * @tc.desc : CodecMimeType is wrong - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_PROFILE_RELIABILITY_CALLBACK_0300', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalCodecMimeType, done); - }) - - /* * - * @tc.number : SUB_PROFILE_RELIABILITY_CALLBACK_0400 - * @tc.name : test isAudioRecoderConfigSupported false - * @tc.desc : bitrate is wrong - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_PROFILE_RELIABILITY_CALLBACK_0400', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalBitrate, done); - }) - - /* * - * @tc.number : SUB_PROFILE_RELIABILITY_CALLBACK_0500 - * @tc.name : test isAudioRecoderConfigSupported false - * @tc.desc : sampleRate is wrong - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_PROFILE_RELIABILITY_CALLBACK_0500', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalSampleRate, done); - }) - - /* * - * @tc.number : SUB_PROFILE_RELIABILITY_CALLBACK_0600 - * @tc.name : test isAudioRecoderConfigSupported false - * @tc.desc : channel is wrong - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level2 - */ - it('SUB_PROFILE_RELIABILITY_CALLBACK_0600', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalSampleChannel, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_CALLBACK_0700', 0, async function (done) { - console.info('test hasVideoRecorderProfile'); - callbackAbnormalHasVideoProfile(1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_CALLBACK_0800', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - callbackAbnormalHasVideoProfile(-1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_CALLBACK_0900', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - callbackAbnormalHasVideoProfile(0, -1, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_CALLBACK_1000', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - callbackAbnormalHasVideoProfile(65535, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_CALLBACK_1100', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - callbackAbnormalHasVideoProfile(65536, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_CALLBACK_1200', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - callbackAbnormalHasVideoProfile(0, 65535, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_CALLBACK_1300', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - callbackAbnormalHasVideoProfile(0, 65536, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_CALLBACK_1400', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - callbackAbnormalGetVideoProfile(-1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_CALLBACK_1500', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - callbackAbnormalGetVideoProfile(0, -1, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_CALLBACK_1600', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - callbackAbnormalGetVideoProfile(65535, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_CALLBACK_1700', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - callbackAbnormalGetVideoProfile(65536, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_CALLBACK_1800', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - callbackAbnormalGetVideoProfile(0, 65535, done); - }) - - /* * - * @tc.number : SUB_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_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 b5dd178a1f5eb1c9f9accb5dea11d539b65154eb..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_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_PROFILE_RELIABILITY_PROMISE_0100', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalAll, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_PROMISE_0200', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalFormatType, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_PROMISE_0300', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalCodecMimeType, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_PROMISE_0400', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalBitrate, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_PROMISE_0500', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalSampleRate, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_PROMISE_0600', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseAbnormalAudioRecoderConfigSupported(base.audioRecorderAbnormalSampleChannel, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_PROMISE_0700', 0, async function (done) { - console.info('test hasVideoRecorderProfile'); - promiseAbnormalHasVideoProfile(1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_PROMISE_0800', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - promiseAbnormalHasVideoProfile(-1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_PROMISE_0900', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - promiseAbnormalHasVideoProfile(0, -1, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_PROMISE_1000', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - promiseAbnormalHasVideoProfile(65535, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_PROMISE_1100', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - promiseAbnormalHasVideoProfile(65536, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_PROMISE_1200', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - promiseAbnormalHasVideoProfile(0, 65535, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_PROMISE_1300', 0, async function (done) { - console.info("test hasVideoRecorderProfile"); - promiseAbnormalHasVideoProfile(0, 65536, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_PROMISE_1400', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - promiseAbnormalGetVideoProfile(-1, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_PROMISE_1500', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - promiseAbnormalGetVideoProfile(0, -1, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_PROMISE_1600', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - promiseAbnormalGetVideoProfile(65535, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_PROMISE_1700', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - promiseAbnormalGetVideoProfile(65536, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_RELIABILITY_PROMISE_1800', 0, async function (done) { - console.info("test getVideoRecorderProfile"); - promiseAbnormalGetVideoProfile(0, 65535, done); - }) - - /* * - * @tc.number : SUB_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_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 9f12a13ee8c9dabc8921a083323a6cd7ac759fb4..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_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_PROFILE_FUNCTION_CALLBACK_0100', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - getAudioRecorderCapsTest(done); - console.info("test getAudioRecorderCaps success "); - }) - - /* * - * @tc.number : SUB_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_PROFILE_FUNCTION_CALLBACK_0200', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - getVideoRecorderCapsTest(done); - }) - - /* * - * @tc.number : SUB_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_PROFILE_FUNCTION_CALLBACK_1200 - * @tc.name : test isAudioRecoderConfigSupported - * @tc.desc : isAudioRecoderConfigSupported true - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_PROFILE_FUNCTION_CALLBACK_1200', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackAudioRecoderConfigSupported(base.audioRecorderPara1, done); - }) - - /* * - * @tc.number : SUB_PROFILE_FUNCTION_CALLBACK_1300 - * @tc.name : test isAudioRecoderConfigSupported - * @tc.desc : isAudioRecoderConfigSupported true - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_PROFILE_FUNCTION_CALLBACK_1300', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - callbackAudioRecoderConfigSupported(base.audioRecorderPara2, done); - }) - - /* * - * @tc.number : SUB_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_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 1aec66fd7d67fff7fea6801c7f7eace5a032567d..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_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_PROFILE_FUNCTION_PROMISE_0100', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - getAudioRecorderCapsTest(done); - console.info("test getAudioRecorderCaps success "); - }) - - /* * - * @tc.number : SUB_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_PROFILE_FUNCTION_PROMISE_0200', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - getVideoRecorderCapsTest(done); - }) - - /* * - * @tc.number : SUB_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_PROFILE_FUNCTION_PROMISE_1200 - * @tc.name : test isAudioRecoderConfigSupported - * @tc.desc : isAudioRecoderConfigSupported true - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_PROFILE_FUNCTION_PROMISE_1200', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseAudioRecoderConfigSupported(base.audioRecorderPara1, done); - }) - - /* * - * @tc.number : SUB_PROFILE_FUNCTION_PROMISE_1300 - * @tc.name : test isAudioRecoderConfigSupported - * @tc.desc : isAudioRecoderConfigSupported true - * @tc.size : MediumTest - * @tc.type : Function test - * @tc.level : Level1 - */ - it('SUB_PROFILE_FUNCTION_PROMISE_1300', 0, async function (done) { - console.info("test getAudioRecorderCaps"); - promiseAudioRecoderConfigSupported(base.audioRecorderPara2, done); - }) - - /* * - * @tc.number : SUB_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_PROFILE_FUNCTION_PROMISE_1400', 0, async function (done) { - console.info('test hasVideoRecorderProfile'); - promiseHasVideoProfile(0, media.VideoRecorderQualityLevel.RECORDER_QUALITY_LOW, done); - }) - -}) -} diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/element/string.json b/multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/element/string.json deleted file mode 100644 index 8afb12da3b72e7b085a608d62d98beb65fe83030..0000000000000000000000000000000000000000 --- a/multimedia/media/media_js_standard/recorderProfile/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "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 diff --git a/multimedia/media/media_js_standard/videoCodecFormat/src/main/config.json b/multimedia/media/media_js_standard/videoCodecFormat/src/main/config.json index 45772d032c1364e5eb7f7b6441b1e55689af8067..ff7acc2a60d98b514b4693de405ebb61cea4f702 100644 --- a/multimedia/media/media_js_standard/videoCodecFormat/src/main/config.json +++ b/multimedia/media/media_js_standard/videoCodecFormat/src/main/config.json @@ -44,6 +44,7 @@ } ], "deviceType": [ + "default", "default", "tablet", "tv", diff --git a/multimedia/media/media_js_standard/videoDecoder/src/main/config.json b/multimedia/media/media_js_standard/videoDecoder/src/main/config.json index ad90158a074d13fe83d76868dc8c728548503a32..bd20539f5af03bd1460b0f67a67dac5da0b9174c 100644 --- a/multimedia/media/media_js_standard/videoDecoder/src/main/config.json +++ b/multimedia/media/media_js_standard/videoDecoder/src/main/config.json @@ -44,6 +44,7 @@ } ], "deviceType": [ + "default", "default", "tablet", "tv", diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/config.json b/multimedia/media/media_js_standard/videoEncoder/src/main/config.json index 073fb7fd22d8ae60b798696dee2e2d8633cbbdaf..f0db2a1501a0b67ab03feeb448b682ae95fd6d5b 100644 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/config.json +++ b/multimedia/media/media_js_standard/videoEncoder/src/main/config.json @@ -44,6 +44,7 @@ } ], "deviceType": [ + "default", "default", "tablet", "tv", diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderHardwareFuncCallbackTest.test.js b/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderHardwareFuncCallbackTest.test.js index 913ef36c1eacd1ba00f00445141ae3c6477e79e5..709959b5a7ec6bbc00b34f3bc8043c98669a29c3 100644 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderHardwareFuncCallbackTest.test.js +++ b/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderHardwareFuncCallbackTest.test.js @@ -500,14 +500,14 @@ describe('videoHardwareEncoderFuncCallback', function () { /* * - * @tc.number : SUB_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_00_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_0100 * @tc.name : 000.test video software encoder capbility * @tc.desc : basic encode function * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_00_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_0100', 0, async function (done) { console.info("test video encoder capbility"); let supportedEncForm = []; let supportedDecForm = []; @@ -577,14 +577,14 @@ describe('videoHardwareEncoderFuncCallback', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_01_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_0200 * @tc.name : 001.test release after last frame * @tc.desc : basic encode function * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level1 */ - it('SUB_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_01_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_0200', 0, async function (done) { checkFormat(done); console.info("case test release after last frame"); ES_FRAME_SIZE = H264_FRAME_SIZE_60FPS_320; @@ -597,14 +597,14 @@ describe('videoHardwareEncoderFuncCallback', function () { /* * - * @tc.number : SUB_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_01_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_0300 * @tc.name : 002.test stop at running state and restart * @tc.desc : basic encode function * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level1 */ - it('SUB_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_01_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_0300', 0, async function (done) { checkFormat(done); console.info("test stop at runnning state and restart"); ES_FRAME_SIZE = H264_FRAME_SIZE_60FPS_320; @@ -636,14 +636,14 @@ describe('videoHardwareEncoderFuncCallback', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_01_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_0400 * @tc.name : 003.test stop at EOS and restart * @tc.desc : basic encode function * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level1 */ - it('SUB_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_01_0300', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_0400', 0, async function (done) { checkFormat(done); console.info('case test stop at EOS and restart'); ES_FRAME_SIZE = H264_FRAME_SIZE_60FPS_320; @@ -675,14 +675,14 @@ describe('videoHardwareEncoderFuncCallback', function () { /* * - * @tc.number : SUB_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_01_0400 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_0500 * @tc.name : 004.test flush at running state * @tc.desc : basic encode function * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level1 */ - it('SUB_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_01_0400', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_0500', 0, async function (done) { checkFormat(done); console.info('case test flush at running state'); ES_FRAME_SIZE = H264_FRAME_SIZE_60FPS_320; @@ -706,14 +706,14 @@ describe('videoHardwareEncoderFuncCallback', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_01_0500 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_0600 * @tc.name : 005.test flush at eos state * @tc.desc : basic encode function * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_01_0500', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_0600', 0, async function (done) { checkFormat(done); console.info("case test flush at eos state"); ES_FRAME_SIZE = H264_FRAME_SIZE_60FPS_320; @@ -738,14 +738,14 @@ describe('videoHardwareEncoderFuncCallback', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_01_0600 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_0700 * @tc.name : 006.test reconfigure * @tc.desc : basic encode function * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_01_0600', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_0700', 0, async function (done) { checkFormat(done); console.info("case test reconfigure"); ES_FRAME_SIZE = H264_FRAME_SIZE_60FPS_320; @@ -768,14 +768,14 @@ describe('videoHardwareEncoderFuncCallback', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_01_0700 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_0800 * @tc.name : 007.test recreate videoencoder * @tc.desc : basic encode function * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_01_0700', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_HARDWARE_ENCODER_FUNCTION_CALLBACK_0800', 0, async function (done) { checkFormat(done); console.info('case test recreate videoencoder'); ES_FRAME_SIZE = H264_FRAME_SIZE_60FPS_320; diff --git a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareReliabilityCallbackTest.test.js b/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareReliabilityCallbackTest.test.js index f991455277d3b039e1234a2cfe9ed2b34bda69be..b9bb1df4e5423503ec333c45d6ca19a793e8e5c8 100644 --- a/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareReliabilityCallbackTest.test.js +++ b/multimedia/media/media_js_standard/videoEncoder/src/main/js/test/VideoEncoderSoftwareReliabilityCallbackTest.test.js @@ -1287,14 +1287,14 @@ describe('VideoEncoderSoftwareReliCallbackTest', function () { }) /* * - * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE+RESET_CALLBACK_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_RESET_CALLBACK_0100 * @tc.name : 001. configure -> reset for 50 times * @tc.desc : Reliability Test * @tc.size : MediumTest * @tc.type : Reliability * @tc.level : Level2 */ - it('SUB_MULTIMEDIA_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE+RESET_CALLBACK_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_SOFTWARE_ENCODER_API_CONFIGURE_RESET_CALLBACK_0100', 0, async function (done) { let name = 'avenc_mpeg4'; let events = require('events'); let eventEmitter = new events.EventEmitter(); diff --git a/multimedia/media/media_js_standard/videoPlayer/Test.json b/multimedia/media/media_js_standard/videoPlayer/Test.json index a8de664040379cb52286a4614600e948b2950a1b..98bf9daf67c3e45a6d16eb114880b58e2e403c99 100644 --- a/multimedia/media/media_js_standard/videoPlayer/Test.json +++ b/multimedia/media/media_js_standard/videoPlayer/Test.json @@ -17,11 +17,14 @@ "cleanup-apps": true }, { - "type": "ShellKit", - "run-command": [ - "mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.video.videoplayer/haps/entry/files" + "type": "ShellKit", + "run-command": [ + "mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.video.videoplayer/haps/entry/files", + "power-shell setmode 602" ], - "teardown-command": [] + "teardown-command":[ + "power-shell setmode 600" + ] }, { "type": "PushKit", diff --git a/multimedia/media/media_js_standard/videoPlayer/src/main/config.json b/multimedia/media/media_js_standard/videoPlayer/src/main/config.json index 6399c0fa78dc3a85fd3230a22c4a35a6ca935535..5a10bfe5e27ffbe57b41db50034aa2b6ca3bb81f 100644 --- a/multimedia/media/media_js_standard/videoPlayer/src/main/config.json +++ b/multimedia/media/media_js_standard/videoPlayer/src/main/config.json @@ -57,6 +57,7 @@ } ], "deviceType": [ + "default", "default", "tablet", "tv", diff --git a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js index ce220612792e3fd10f6348f4307a4ad4edfd10f3..b5d9a45991ab980257b04abe6e606e4e80356144 100644 --- a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js +++ b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerAPICallbackTest.test.js @@ -305,24 +305,24 @@ describe('VideoPlayerAPICallbackTest', function () { }); }); - function checkSeekTime(seekMode, seekTime, seekDoneTime) { + function checkSeekTime(videoPlayer, seekMode, seekTime, seekDoneTime) { switch (seekMode) { case media.SeekMode.SEEK_NEXT_SYNC: if (seekTime == 0) { - expect(seekDoneTime + DELTA_TIME).assertClose(DELTA_TIME, DELTA_TIME); + expect(seekDoneTime).assertLess(DELTA_TIME); } else if (seekTime == DURATION_TIME) { - expect(seekDoneTime).assertClose(DURATION_TIME, DELTA_TIME); + expect(Math.abs(videoPlayer.currentTime - DURATION_TIME)).assertLess(DELTA_TIME); } else { - expect(seekDoneTime).assertClose(NEXT_FRAME_TIME, DELTA_TIME); + expect(Math.abs(videoPlayer.currentTime - NEXT_FRAME_TIME)).assertLess(DELTA_TIME); } break; case media.SeekMode.SEEK_PREV_SYNC: if (seekTime == 0) { - expect(seekDoneTime + DELTA_TIME).assertClose(DELTA_TIME, DELTA_TIME); + expect(seekDoneTime).assertLess(DELTA_TIME); } else if (seekTime == DURATION_TIME) { - expect(seekDoneTime).assertClose(NEXT_FRAME_TIME, DELTA_TIME); + expect(Math.abs(videoPlayer.currentTime - NEXT_FRAME_TIME)).assertLess(DELTA_TIME); } else { - expect(seekDoneTime).assertClose(PREV_FRAME_TIME, DELTA_TIME); + expect(Math.abs(videoPlayer.currentTime - PREV_FRAME_TIME)).assertLess(DELTA_TIME); } break; default: @@ -336,7 +336,7 @@ describe('VideoPlayerAPICallbackTest', function () { steps.shift(); videoPlayer.seek(seekTime, media.SeekMode.SEEK_NEXT_SYNC, (err, seekDoneTime) => { if (err == null) { - checkSeekTime(media.SeekMode.SEEK_NEXT_SYNC, seekTime, seekDoneTime); + checkSeekTime(videoPlayer, media.SeekMode.SEEK_NEXT_SYNC, seekTime, seekDoneTime); console.info('case seek success and seekDoneTime is '+ seekDoneTime); toNextStep(videoPlayer, steps, done); } else if ((err != null) && (steps[0] == ERROR_EVENT)) { diff --git a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js index aa9b9f57e667907acf2955c34dfe62858bd1c4a3..a36db93ed711aee8bc5e2a993ec0f81f6e1c83f7 100644 --- a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js +++ b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncCallbackTest.test.js @@ -264,7 +264,7 @@ describe('VideoPlayerFuncCallbackTest', function () { console.info('case play success!!'); mediaTestBase.msleep(PLAY_TIME); let endTime = videoPlayer.currentTime; - expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME); + expect(Math.abs(endTime - startTime - PLAY_TIME)).assertLess(DELTA_TIME); toNextStep(videoPlayer, steps, done); } else if ((err != null) && (steps[0] == ERROR_EVENT)) { steps.shift(); @@ -338,24 +338,24 @@ describe('VideoPlayerFuncCallbackTest', function () { }); }); - function checkSeekTime(seekMode, seekTime, seekDoneTime) { + function checkSeekTime(videoPlayer, seekMode, seekTime, seekDoneTime) { switch (seekMode) { case media.SeekMode.SEEK_NEXT_SYNC: if (seekTime == 0) { - expect(seekDoneTime + DELTA_SEEK_TIME).assertClose(DELTA_SEEK_TIME, DELTA_SEEK_TIME); + expect(seekDoneTime).assertLess(DELTA_SEEK_TIME); } else if (seekTime == DURATION_TIME) { - expect(seekDoneTime).assertClose(DURATION_TIME, DELTA_SEEK_TIME); + expect(Math.abs(videoPlayer.currentTime - DURATION_TIME)).assertLess(DELTA_SEEK_TIME); } else { - expect(seekDoneTime).assertClose(NEXT_FRAME_TIME, DELTA_SEEK_TIME); + expect(Math.abs(videoPlayer.currentTime - NEXT_FRAME_TIME)).assertLess(DELTA_SEEK_TIME); } break; case media.SeekMode.SEEK_PREV_SYNC: if (seekTime == 0) { - expect(seekDoneTime + DELTA_SEEK_TIME).assertClose(DELTA_SEEK_TIME, DELTA_SEEK_TIME); + expect(seekDoneTime).assertLess(DELTA_SEEK_TIME); } else if (seekTime == DURATION_TIME) { - expect(seekDoneTime).assertClose(NEXT_FRAME_TIME, DELTA_SEEK_TIME); + expect(Math.abs(videoPlayer.currentTime - NEXT_FRAME_TIME)).assertLess(DELTA_SEEK_TIME); } else { - expect(seekDoneTime).assertClose(PREV_FRAME_TIME, DELTA_SEEK_TIME); + expect(Math.abs(videoPlayer.currentTime - PREV_FRAME_TIME)).assertLess(DELTA_SEEK_TIME); } break; default: @@ -372,7 +372,7 @@ describe('VideoPlayerFuncCallbackTest', function () { if (seekTime > DURATION_TIME) { seekTime = DURATION_TIME; } - checkSeekTime(media.SeekMode.SEEK_PREV_SYNC, seekTime, seekDoneTime); + checkSeekTime(videoPlayer, media.SeekMode.SEEK_PREV_SYNC, seekTime, seekDoneTime); console.info('case seek success and seekDoneTime is '+ seekDoneTime); toNextStep(videoPlayer, steps, done); } else if ((err != null) && (steps[0] == ERROR_EVENT)) { @@ -395,7 +395,7 @@ describe('VideoPlayerFuncCallbackTest', function () { if (seekTime > DURATION_TIME) { seekTime = DURATION_TIME; } - checkSeekTime(seekMode, seekTime, seekDoneTime); + checkSeekTime(videoPlayer, seekMode, seekTime, seekDoneTime); console.info('case seek success and seekDoneTime is '+ seekDoneTime); toNextStep(videoPlayer, steps, done); } else if ((err != null) && (steps[0] == ERROR_EVENT)) { @@ -429,19 +429,19 @@ describe('VideoPlayerFuncCallbackTest', function () { if (videoPlayer.state == 'playing') { switch (speedValue) { case media.PlaybackSpeed.SPEED_FORWARD_0_75_X: - expect(endTime - startTime).assertClose(0.75 * 1000, DELTA_TIME); + expect(Math.abs(endTime - startTime - (0.75 * 1000))).assertLess(DELTA_TIME * 0.75); break; case media.PlaybackSpeed.SPEED_FORWARD_1_00_X: - expect(endTime - startTime).assertClose(1000, DELTA_TIME); + expect(Math.abs(endTime - startTime - (1000))).assertLess(DELTA_TIME); break; case media.PlaybackSpeed.SPEED_FORWARD_1_25_X: - expect(endTime - startTime).assertClose(1.25 * 1000, DELTA_TIME); + expect(Math.abs(endTime - startTime - (1.25 * 1000))).assertLess(DELTA_TIME * 1.25); break; case media.PlaybackSpeed.SPEED_FORWARD_1_75_X: - expect(endTime - startTime).assertClose(1.75 * 1000, DELTA_TIME); + expect(Math.abs(endTime - startTime - (1.75 * 1000))).assertLess(DELTA_TIME * 1.75); break; case media.PlaybackSpeed.SPEED_FORWARD_2_00_X: - expect(endTime - startTime).assertClose(2 * 1000, DELTA_TIME); + expect(Math.abs(endTime - startTime - (2 * 1000))).assertLess(DELTA_TIME * 2); break; } } else { @@ -471,14 +471,14 @@ describe('VideoPlayerFuncCallbackTest', function () { }); /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SETSOURCE + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SETSOURCE_0100 * @tc.name : 001.test setSorce '' (callback) * @tc.desc : Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_SETSOURCE_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SETSOURCE_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let videoPlayer = null; let mySteps = new Array(CREATE_EVENT, SETSOURCE_EVENT, '', ERROR_EVENT, RELEASE_EVENT, END_EVENT); @@ -523,14 +523,14 @@ describe('VideoPlayerFuncCallbackTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SEEKMODE + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SEEKMODE_0100 * @tc.name : 001.test seek mode SEEK_PREV_SYNC/SEEK_NEXT_SYNC (callback) * @tc.desc : Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SEEKMODE', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_SEEKMODE_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let videoPlayer = null; let mySteps = new Array(CREATE_EVENT, SETFDSOURCE_EVENT, fileDescriptor, SETSURFACE_EVENT, @@ -646,14 +646,14 @@ describe('VideoPlayerFuncCallbackTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_GETTRECKDESCRIPTION + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_GETTRECKDESCRIPTION_0100 * @tc.name : 001.test getTrackDescription (callback) * @tc.desc : Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_GETTRECKDESCRIPTION', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_GETTRECKDESCRIPTION_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let videoPlayer = null; let mySteps = new Array(CREATE_EVENT, SETFDSOURCE_EVENT, fileDescriptor, SETSURFACE_EVENT, @@ -680,14 +680,14 @@ describe('VideoPlayerFuncCallbackTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_BASE + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_BASE_0100 * @tc.name : 001.test video playe (callback) * @tc.desc : Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_BASE', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_CALLBACK_BASE_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let videoPlayer = null; let fdPath = fdHead + fileDescriptor.fd; diff --git a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js index b15636a3a716b00e9f71697e110a8d5b0ccf3c5c..7f19fdb1173e180e14fb565046bd5d5f76bc554a 100644 --- a/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js +++ b/multimedia/media/media_js_standard/videoPlayer/src/main/js/test/VideoPlayerFuncPromiseTest.test.js @@ -27,7 +27,7 @@ describe('VideoPlayerFuncPromiseTest', function () { const WIDTH_VALUE = 720; const HEIGHT_VALUE = 480; const DURATION_TIME = 10034; - const DELTA_TIME = 1000; + const DELTA_TIME = 1500; const NEXT_FRAME_TIME = 8333; const PREV_FRAME_TIME = 4166; const DELTA_SEEK_TIME = 100; @@ -88,19 +88,24 @@ describe('VideoPlayerFuncPromiseTest', function () { if (videoPlayer.state == 'playing') { switch (speedValue) { case media.PlaybackSpeed.SPEED_FORWARD_0_75_X: - expect(newTime - startTime).assertClose(0.75 * 1000, DELTA_TIME); + console.error('checkSpeedTime time is :' + (newTime - startTime)); + expect(Math.abs(newTime - startTime - (0.75 * 1000))).assertLess(DELTA_TIME * 0.75); break; case media.PlaybackSpeed.SPEED_FORWARD_1_00_X: - expect(newTime - startTime).assertClose(1000, DELTA_TIME); + console.error('checkSpeedTime time is :' + (newTime - startTime)); + expect(Math.abs(newTime - startTime - (1000))).assertLess(DELTA_TIME); break; case media.PlaybackSpeed.SPEED_FORWARD_1_25_X: - expect(newTime - startTime).assertClose(1.25 * 1000, DELTA_TIME); + console.error('checkSpeedTime time is :' + (newTime - startTime)); + expect(Math.abs(newTime - startTime - (1.25 * 1000))).assertLess(DELTA_TIME * 1.25); break; case media.PlaybackSpeed.SPEED_FORWARD_1_75_X: - expect(newTime - startTime).assertClose(1.75 * 1000, DELTA_TIME); + console.error('checkSpeedTime time is :' + (newTime - startTime)); + expect(Math.abs(newTime - startTime - (1.75 * 1000))).assertLess(DELTA_TIME * 1.75); break; case media.PlaybackSpeed.SPEED_FORWARD_2_00_X: - expect(newTime - startTime).assertClose(2 * 1000, DELTA_TIME); + console.error('checkSpeedTime time is :' + (newTime - startTime)); + expect(Math.abs(newTime - startTime - (2 * 1000))).assertLess(DELTA_TIME * 2); break; } } else { @@ -182,8 +187,8 @@ describe('VideoPlayerFuncPromiseTest', function () { expect(videoPlayer.state).assertEqual('playing'); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); let endTime = videoPlayer.currentTime; - expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME); - + expect(Math.abs(endTime - startTime - PLAY_TIME)).assertLess(DELTA_TIME); + for (let i = 0; i < 3; i++) { await videoPlayer.setVolume(i * 0.5).then(() => { expect(videoPlayer.state).assertEqual('playing'); @@ -239,7 +244,7 @@ describe('VideoPlayerFuncPromiseTest', function () { expect(videoPlayer.state).assertEqual('playing'); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); let endTime = videoPlayer.currentTime; - expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME); + expect(Math.abs(endTime - startTime - PLAY_TIME)).assertLess(DELTA_TIME); startTime = videoPlayer.currentTime; await videoPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_0_75_X).then((speedMode) => { @@ -293,14 +298,14 @@ describe('VideoPlayerFuncPromiseTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_SeekMode + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_SeekMode * @tc.name : 001.seek mode SEEK_PREV_SYNC/SEEK_NEXT_SYNC (promise) * @tc.desc : Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_SeekMode', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_SeekMode', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let videoPlayer = null; await media.createVideoPlayer().then((video) => { @@ -334,41 +339,47 @@ describe('VideoPlayerFuncPromiseTest', function () { expect(videoPlayer.state).assertEqual('playing'); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); let endTime = videoPlayer.currentTime; - expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME); + expect(Math.abs(endTime - startTime - PLAY_TIME)).assertLess(DELTA_TIME); await videoPlayer.seek(SEEK_TIME, media.SeekMode.SEEK_NEXT_SYNC).then((seekDoneTime) => { expect(videoPlayer.state).assertEqual('playing'); - expect(seekDoneTime).assertClose(NEXT_FRAME_TIME, DELTA_SEEK_TIME); + expect(seekDoneTime).assertEqual(SEEK_TIME); + expect(Math.abs(videoPlayer.currentTime - NEXT_FRAME_TIME)).assertLess(DELTA_SEEK_TIME); console.info('case seek called and seekDoneTime is' + seekDoneTime); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); await videoPlayer.seek(SEEK_TIME, media.SeekMode.SEEK_PREV_SYNC).then((seekDoneTime) => { expect(videoPlayer.state).assertEqual('playing'); - expect(seekDoneTime).assertClose(PREV_FRAME_TIME, DELTA_SEEK_TIME); + expect(seekDoneTime).assertEqual(SEEK_TIME); + expect(Math.abs(videoPlayer.currentTime - PREV_FRAME_TIME)).assertLess(DELTA_SEEK_TIME); console.info('case seek called and seekDoneTime is' + seekDoneTime); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); await videoPlayer.seek(PREV_FRAME_TIME - 100, media.SeekMode.SEEK_PREV_SYNC).then((seekDoneTime) => { expect(videoPlayer.state).assertEqual('playing'); - expect(seekDoneTime + DELTA_SEEK_TIME).assertClose(DELTA_SEEK_TIME, DELTA_SEEK_TIME); + expect(seekDoneTime).assertEqual(PREV_FRAME_TIME - 100); + expect(Math.abs(videoPlayer.currentTime)).assertLess(DELTA_SEEK_TIME); console.info('case seek called and seekDoneTime is' + seekDoneTime); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); await videoPlayer.seek(PREV_FRAME_TIME + 100, media.SeekMode.SEEK_PREV_SYNC).then((seekDoneTime) => { expect(videoPlayer.state).assertEqual('playing'); - expect(seekDoneTime).assertClose(PREV_FRAME_TIME, DELTA_SEEK_TIME); + expect(seekDoneTime).assertEqual(PREV_FRAME_TIME + 100); + expect(Math.abs(videoPlayer.currentTime - PREV_FRAME_TIME)).assertLess(DELTA_SEEK_TIME); console.info('case seek called and seekDoneTime is' + seekDoneTime); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); await videoPlayer.seek(NEXT_FRAME_TIME - 100, media.SeekMode.SEEK_NEXT_SYNC).then((seekDoneTime) => { expect(videoPlayer.state).assertEqual('playing'); - expect(seekDoneTime).assertClose(NEXT_FRAME_TIME, DELTA_SEEK_TIME); + expect(seekDoneTime).assertEqual(NEXT_FRAME_TIME - 100); + expect(Math.abs(videoPlayer.currentTime - NEXT_FRAME_TIME)).assertLess(DELTA_SEEK_TIME); console.info('case seek called and seekDoneTime is' + seekDoneTime); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); await videoPlayer.seek(NEXT_FRAME_TIME + 100, media.SeekMode.SEEK_NEXT_SYNC).then((seekDoneTime) => { expect(videoPlayer.state).assertEqual('playing'); - expect(seekDoneTime).assertClose(NEXT_FRAME_TIME + 100, DELTA_SEEK_TIME); + expect(seekDoneTime).assertEqual(NEXT_FRAME_TIME + 100); + expect(Math.abs(videoPlayer.currentTime - NEXT_FRAME_TIME - 100)).assertLess(DELTA_SEEK_TIME); console.info('case seek called and seekDoneTime is' + seekDoneTime); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); @@ -454,14 +465,14 @@ describe('VideoPlayerFuncPromiseTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_GetTreckDescription + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_GetTreckDescription * @tc.name : 001.getTrackDescription (promise) * @tc.desc : Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level1 */ - it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_GetTreckDescription', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_GetTreckDescription', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let videoPlayer = null; let arrayDescription = null; @@ -581,12 +592,12 @@ describe('VideoPlayerFuncPromiseTest', function () { expect(videoPlayer.state).assertEqual('playing'); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); let endTime = videoPlayer.currentTime; - expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME); + expect(Math.abs(endTime - startTime - PLAY_TIME)).assertLess(DELTA_TIME); for (let i = 0; i < 4; i++) { await videoPlayer.seek(DURATION_TIME, media.SeekMode.SEEK_NEXT_SYNC).then((seekDoneTime) => { expect(videoPlayer.state).assertEqual('playing'); - expect(seekDoneTime).assertClose(DURATION_TIME, DELTA_SEEK_TIME); + expect(Math.abs(seekDoneTime - DURATION_TIME)).assertLess(DELTA_SEEK_TIME); console.info('case seek called and seekDoneTime is' + seekDoneTime); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); mediaTestBase.msleep(3000); @@ -646,7 +657,7 @@ describe('VideoPlayerFuncPromiseTest', function () { expect(videoPlayer.state).assertEqual('playing'); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); let endTime = videoPlayer.currentTime; - expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME); + expect(Math.abs(endTime - startTime - PLAY_TIME)).assertLess(DELTA_TIME); await videoPlayer.pause().then(() => { expect(videoPlayer.state).assertEqual('paused'); @@ -685,7 +696,7 @@ describe('VideoPlayerFuncPromiseTest', function () { expect(videoPlayer.state).assertEqual('playing'); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); endTime = videoPlayer.currentTime; - expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME); + expect(Math.abs(endTime - startTime - PLAY_TIME)).assertLess(DELTA_TIME); await videoPlayer.seek(videoPlayer.duration / 2).then((seekDoneTime) => { expect(videoPlayer.state).assertEqual('playing'); @@ -765,7 +776,8 @@ describe('VideoPlayerFuncPromiseTest', function () { expect(videoPlayer.state).assertEqual('playing'); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); let endTime = videoPlayer.currentTime; - expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME); + expect(Math.abs(endTime - startTime - PLAY_TIME)).assertLess(DELTA_TIME); + console.info('case set videoScaleType : 0'); videoPlayer.videoScaleType = media.VideoScaleType.VIDEO_SCALE_TYPE_FIT; await videoPlayer.pause().then(() => { @@ -810,7 +822,7 @@ describe('VideoPlayerFuncPromiseTest', function () { expect(videoPlayer.state).assertEqual('playing'); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); endTime = videoPlayer.currentTime; - expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME); + expect(Math.abs(endTime - startTime - PLAY_TIME)).assertLess(DELTA_TIME); console.info('case set videoScaleType : 0'); videoPlayer.videoScaleType = media.VideoScaleType.VIDEO_SCALE_TYPE_FIT; await videoPlayer.seek(videoPlayer.duration / 2).then((seekDoneTime) => { @@ -905,7 +917,7 @@ describe('VideoPlayerFuncPromiseTest', function () { expect(videoPlayer.state).assertEqual('playing'); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); let endTime = videoPlayer.currentTime; - expect(endTime - startTime).assertClose(PLAY_TIME, DELTA_TIME); + expect(Math.abs(endTime - startTime - PLAY_TIME)).assertLess(DELTA_TIME); for (let i = 0; i < 20; i++) { if (count == 0) { @@ -963,14 +975,14 @@ describe('VideoPlayerFuncPromiseTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_PARAMETER_0100 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_PARAMETER_0100 * @tc.name : 001.parameter value after create/reset/release (promise) * @tc.desc : Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_PARAMETER_0100', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_PARAMETER_0100', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let videoPlayer = null; await media.createVideoPlayer().then((video) => { @@ -1028,14 +1040,14 @@ describe('VideoPlayerFuncPromiseTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_PARAMETER_0200 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_PARAMETER_0200 * @tc.name : 002.speed and loop value after finish (promise) * @tc.desc : Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_PARAMETER_0200', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_PARAMETER_0200', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let videoPlayer = null; await media.createVideoPlayer().then((video) => { @@ -1120,7 +1132,7 @@ describe('VideoPlayerFuncPromiseTest', function () { await videoPlayer.seek(SEEK_TIME, media.SeekMode.SEEK_PREV_SYNC).then((seekDoneTime) => { expect(videoPlayer.state).assertEqual('playing'); - expect(seekDoneTime).assertClose(PREV_FRAME_TIME, DELTA_SEEK_TIME); + expect(Math.abs(videoPlayer.currentTime - PREV_FRAME_TIME)).assertLess(DELTA_SEEK_TIME); console.info('case seek called and seekDoneTime is' + seekDoneTime); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); startTime = videoPlayer.currentTime; @@ -1134,14 +1146,14 @@ describe('VideoPlayerFuncPromiseTest', function () { }) /* * - * @tc.number : SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_PARAMETER_0300 + * @tc.number : SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_PARAMETER_0300 * @tc.name : 003.speed and loop value after reset (promise) * @tc.desc : Video playback control test * @tc.size : MediumTest * @tc.type : Function test * @tc.level : Level0 */ - it('SUB_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_PARAMETER_0300', 0, async function (done) { + it('SUB_MULTIMEDIA_MEDIA_VIDEO_PLAYER_FUNCTION_PROMISE_PARAMETER_0300', 0, async function (done) { mediaTestBase.isFileOpen(fileDescriptor, done); let videoPlayer = null; await media.createVideoPlayer().then((video) => { @@ -1221,7 +1233,7 @@ describe('VideoPlayerFuncPromiseTest', function () { expect(videoPlayer.state).assertEqual('playing'); }, mediaTestBase.failureCallback).catch(mediaTestBase.catchCallback); endTime = videoPlayer.currentTime; - checkTime(PLAY_TIME * 2, (endTime - startTime), DELTA_TIME); + checkTime(PLAY_TIME * 2, (endTime - startTime), DELTA_TIME * 2); }) }) } \ No newline at end of file diff --git a/multimedia/media/media_js_standard/videoRecorder/Test.json b/multimedia/media/media_js_standard/videoRecorder/Test.json index f3674de5fa81984f32dfc296ad842e4e9d78bd5a..0de93974f04899fbb1d8fee04aad7032019b4b04 100644 --- a/multimedia/media/media_js_standard/videoRecorder/Test.json +++ b/multimedia/media/media_js_standard/videoRecorder/Test.json @@ -10,9 +10,11 @@ { "type": "ShellKit", "run-command": [ - "rm -rf /storage/media/100/local/files/Videos/*" + "rm -rf /storage/media/100/local/files/Videos/*", + "power-shell setmode 602" ], "teardown-command":[ + "power-shell setmode 600" ] }, { diff --git a/multimedia/media/media_js_standard/videoRecorder/src/main/config.json b/multimedia/media/media_js_standard/videoRecorder/src/main/config.json index bb6d00e0c5e6bc3224c62aa3118a8ced097fddc6..7f26560739218222f5d2660809b5871b9ab25b71 100644 --- a/multimedia/media/media_js_standard/videoRecorder/src/main/config.json +++ b/multimedia/media/media_js_standard/videoRecorder/src/main/config.json @@ -44,6 +44,7 @@ } ], "deviceType": [ + "default", "default", "tablet", "tv", diff --git a/multimedia/medialibrary/common.js b/multimedia/medialibrary/common.js index 5789806948bf14c8d9a7437517078d88801b9be5..a90838a9595d5b4f0c52d92536c14f6736f0b515 100755 --- a/multimedia/medialibrary/common.js +++ b/multimedia/medialibrary/common.js @@ -17,16 +17,16 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; import bundle from '@ohos.bundle'; const presetsCount = { - ActsMediaLibraryAlbum: { albumsCount: 7, assetsCount: 19 }, - ActsMediaLibraryFavorite: { albumsCount: 6, assetsCount: 32 }, + ActsMediaLibraryAlbumTest: { albumsCount: 7, assetsCount: 19 }, + ActsMediaLibraryFavoriteTest: { albumsCount: 6, assetsCount: 32 }, ActsMediaLibraryAlbumFileResultCb: { albumsCount: 5, assetsCount: 118 }, - ActsMediaLibraryFile: { albumsCount: 6, assetsCount: 21 }, - ActsMediaLibraryFileAsset: { albumsCount: 27, assetsCount: 72 }, + ActsMediaLibraryFileTest: { albumsCount: 6, assetsCount: 21 }, + ActsMediaLibraryFileAssetTest: { albumsCount: 27, assetsCount: 72 }, ActsMediaLibraryFileAssetUri: { albumsCount: 3, assetsCount: 6 }, - ActsMediaLibraryFileKey: { albumsCount: 2, assetsCount: 2 }, - ActsMediaLibraryFileResult: { albumsCount: 4, assetsCount: 13 }, + ActsMediaLibraryFileKeyTest: { albumsCount: 2, assetsCount: 2 }, + ActsMediaLibraryFileResultTest: { albumsCount: 4, assetsCount: 13 }, ActsMediaLibraryGetThumbnail: { albumsCount: 3, assetsCount: 3 }, - ActsMediaLibraryBase: { albumsCount: 11, assetsCount: 11 }, + ActsMediaLibraryBaseTest: { albumsCount: 11, assetsCount: 11 }, } const IMAGE_TYPE = mediaLibrary.MediaType.IMAGE; @@ -36,11 +36,18 @@ const FILE_TYPE = mediaLibrary.MediaType.FILE; const FILEKEY = mediaLibrary.FileKey; const { RELATIVE_PATH, ALBUM_NAME, MEDIA_TYPE } = FILEKEY -const sleep = async function sleep(times = 10) { - await new Promise(res => setTimeout(res, times)); -} -const allFetchOp = function (others = {}) { +const sleep = async function sleep(times) { + if (!times) { + times = 10; + } + await new Promise((res) => setTimeout(res, times)); +}; + +const allFetchOp = function (others) { + if (!others) { + others = {}; + } return { selections: '', selectionArgs: [], @@ -48,7 +55,10 @@ const allFetchOp = function (others = {}) { }; } -const fetchOps = function (testNum, path, type, others = {}) { +const fetchOps = function (testNum, path, type, others) { + if (!others) { + others = {}; + } let ops = { selections: FILEKEY.RELATIVE_PATH + '= ? AND ' + FILEKEY.MEDIA_TYPE + '=?', selectionArgs: [path, type.toString()], @@ -75,8 +85,19 @@ const idFetchOps = function (testNum, albumId) { return ops } -const albumFetchOps = function (testNum, path, albumName, type, - others = { order: FILEKEY.DATE_ADDED + " DESC", }) { +const fileIdFetchOps = function (testNum, id) { + let ops = { + selections: FILEKEY.ID + "= ?", + selectionArgs: [id + ""], + }; + console.info(`${testNum}: fetchOps${JSON.stringify(ops)}`); + return ops; +}; + +const albumFetchOps = function (testNum, path, albumName, type, others) { + if (!others) { + others = { order: FILEKEY.DATE_ADDED + " DESC", }; + } let ops = { selections: RELATIVE_PATH + '= ? AND ' + ALBUM_NAME + '= ? AND ' + MEDIA_TYPE + '= ?', selectionArgs: [path, albumName, type.toString()], @@ -87,8 +108,10 @@ const albumFetchOps = function (testNum, path, albumName, type, } // albums of two resource types -const albumTwoTypesFetchOps = function (testNum, paths, albumName, types, - others = { order: FILEKEY.DATE_ADDED + " DESC", }) { +const albumTwoTypesFetchOps = function (testNum, paths, albumName, types, others) { + if (!others) { + others = { order: FILEKEY.DATE_ADDED + " DESC" }; + } try { let ops = { selections: '(' + RELATIVE_PATH + '= ? or ' + @@ -107,7 +130,10 @@ const albumTwoTypesFetchOps = function (testNum, paths, albumName, types, } // albums of three resource types -const albumThreeTypesFetchOps = function (testNum, paths, albumName, types, others = { order: FILEKEY.DATE_ADDED, }) { +const albumThreeTypesFetchOps = function (testNum, paths, albumName, types, others) { + if (!others) { + others = { order: FILEKEY.DATE_ADDED + " DESC" }; + } try { let ops = { selections: '(' + RELATIVE_PATH + '= ? or ' + @@ -172,9 +198,12 @@ const checkAlbumsCount = function (done, testNum, albumList, expectCount) { return albumsCount == expectCount; } -const getPermission = async function (name = 'ohos.acts.multimedia.mediaLibrary') { +const getPermission = async function (name) { + if (!name) { + name = "ohos.acts.multimedia.mediaLibrary"; + } console.info('getPermission start', name) - let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.mediaLibrary', 0, 100); + let appInfo = await bundle.getApplicationInfo(name, 0, 100); let tokenID = appInfo.accessTokenId; let atManager = abilityAccessCtrl.createAtManager(); let result1 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.MEDIA_LOCATION", 1); @@ -214,4 +243,5 @@ export { checkAlbumsCount, MODIFY_ERROR_CODE_01, isNum, -} + fileIdFetchOps, +}; diff --git a/multimedia/medialibrary/mediaLibrary_album/BUILD.gn b/multimedia/medialibrary/mediaLibrary_album/BUILD.gn index f36f1ff846c7b8e6dcfd1e973e0539345eb1af5e..e82fb7aaf2957c605df92bc18dc006737b215d1c 100755 --- a/multimedia/medialibrary/mediaLibrary_album/BUILD.gn +++ b/multimedia/medialibrary/mediaLibrary_album/BUILD.gn @@ -21,7 +21,7 @@ ohos_js_hap_suite("mediaLibrary_album_hap") { ] ets2abc = true certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsMediaLibraryAlbum" + hap_name = "ActsMediaLibraryAlbumTest" } ohos_app_scope("medialibrary_app_profile") { diff --git a/multimedia/medialibrary/mediaLibrary_album/Test.json b/multimedia/medialibrary/mediaLibrary_album/Test.json index 35371947bfc8c196a8301bf86b3ee5315a3727f3..6ec369173bc75f01b40b3da205be14e6a49ea4a1 100755 --- a/multimedia/medialibrary/mediaLibrary_album/Test.json +++ b/multimedia/medialibrary/mediaLibrary_album/Test.json @@ -15,7 +15,7 @@ "rm -rf /storage/media/100/local/files/*", "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", "mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios}", - "mkdir -p /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata" + "mkdir -p /storage/media/100/local/temp" ] }, { @@ -23,9 +23,9 @@ "pre-push": [ ], "push": [ - "./resource/medialibrary/01.jpg ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.mp3 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.mp4 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata" + "./resource/medialibrary/01.jpg ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp" ] }, { @@ -35,11 +35,11 @@ "mkdir -pv /storage/media/100/local/files/Videos/Static", "mkdir -pv /storage/media/100/local/files/Audios/Static", - "for d in Static; do for i in $$(seq 5); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", - "for d in Static; do for i in $$(seq 5); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", - "for d in Static; do for i in $$(seq 5); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", + "for d in Static; do for i in $$(seq 5); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", + "for d in Static; do for i in $$(seq 5); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", + "for d in Static; do for i in $$(seq 5); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", - "for d in DynamicPro1 DynamicPro2 DynamicCb1 DynamicCb2; do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/$$d ;done;", + "for d in DynamicPro1 DynamicPro2 DynamicCb1 DynamicCb2; do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d ;done;", "chmod -R 777 /storage/media/100/local/files/*", "chmod -R 777 /data/service/el2/100/hmdfs/account/files/*", @@ -47,16 +47,13 @@ "hilog -p off", "hilog -b I", "hilog -b D -D 0xD002B70", - "scanner_demo", + "scanner", "sleep 10" - ], - "teardown-command":[ - ] }, { "test-file-name": [ - "ActsMediaLibraryAlbum.hap" + "ActsMediaLibraryAlbumTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumGetFileAssetsCallback.test.ets b/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumGetFileAssetsCallback.test.ets index df2afa16301113fa1ac26603f27509a9229f40de..a1ed61c33f7d62751ea95f95b162d27a7787e810 100755 --- a/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumGetFileAssetsCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumGetFileAssetsCallback.test.ets @@ -36,7 +36,7 @@ export default function albumGetFileAssetsCallbackTest(abilityContext) { beforeAll(async function () { console.info('beforeAll case'); await getPermission(); - await checkPresetsAssets(media, 'ActsMediaLibraryAlbum'); + await checkPresetsAssets(media, 'ActsMediaLibraryAlbumTest'); }); beforeEach(function () { console.info('beforeEach case'); @@ -62,8 +62,9 @@ export default function albumGetFileAssetsCallbackTest(abilityContext) { const albumCountPass = await checkAlbumsCount(done, testNum, albumList, expectAlbumCount); if (!albumCountPass) return; // one asset type - if (expectAlbumCount == 1) { - const album = albumList[0]; + + let count = 0; + for (const album of albumList) { album.getFileAssets(allFetchOp({ order: `date_added DESC LIMIT 0,${expectAssetsCount}` }), (error, fetchFileResult) => { if (fetchFileResult == undefined || error) { console.info(`${testNum} fetchFileResult undefined or error, error: ${error}`) @@ -71,33 +72,16 @@ export default function albumGetFileAssetsCallbackTest(abilityContext) { done(); return; } - console.info(`${testNum}, getCount: ${fetchFileResult.getCount()}`) - console.info(`${testNum}, expectAssetsCount: ${expectAssetsCount}`) + count++; + console.info(`${testNum}, expectAssetsCount: ${expectAssetsCount} + getCount: ${fetchFileResult.getCount()}`) expect(fetchFileResult.getCount()).assertEqual(expectAssetsCount); - done(); }); - } else { - // more asset type - let count = 0; - for (const album of albumList) { - album.getFileAssets(allFetchOp({ order: `date_added DESC LIMIT 0,${expectAssetsCount}` }), (error, fetchFileResult) => { - if (fetchFileResult == undefined || error) { - console.info(`${testNum} fetchFileResult undefined or error, error: ${error}`) - expect(false).assertTrue(); - done(); - return; - } - count++; - console.info(`${testNum}, getCount: ${fetchFileResult.getCount()}`) - console.info(`${testNum}, expectAssetsCount: ${expectAssetsCount}`) - expect(fetchFileResult.getCount()).assertEqual(expectAssetsCount); - }); - await sleep(500) - } await sleep(500) - expect(count).assertEqual(expectAlbumCount); - done(); } + await sleep(500) + expect(count).assertEqual(expectAlbumCount); + done(); } catch (error) { console.info(`${testNum}, error: ${error}`) expect(false).assertTrue(); diff --git a/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumGetFileAssetsPromise.test.ets b/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumGetFileAssetsPromise.test.ets index df062a23c4fbb93f126aca05e2dec4fd4f0adcb0..fe638761abcb8ebc2aed9152d7d0c8b3a94f90b6 100755 --- a/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumGetFileAssetsPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumGetFileAssetsPromise.test.ets @@ -33,7 +33,7 @@ export default function albumGetFileAssetsPromiseTest(abilityContext) { const media = mediaLibrary.getMediaLibrary(abilityContext); beforeAll(async function () { console.info('beforeAll case'); - await checkPresetsAssets(media, 'ActsMediaLibraryAlbum'); + await checkPresetsAssets(media, 'ActsMediaLibraryAlbumTest'); }); beforeEach(function () { console.info('beforeEach case'); @@ -62,9 +62,8 @@ export default function albumGetFileAssetsPromiseTest(abilityContext) { // one asset type let op: mediaLibrary.MediaFetchOptions = allFetchOp({ order: `date_added DESC LIMIT 0,${expectAssetsCount}` }) - if (expectAlbumCount == 1) { - const album = albumList[0]; - + let count = 0; + for (const album of albumList) { let fetchFileResult = await album.getFileAssets(op); if (fetchFileResult == undefined) { console.info(`${testNum} fetchFileResult undefined`) @@ -72,29 +71,13 @@ export default function albumGetFileAssetsPromiseTest(abilityContext) { done(); return; } - console.info(`${testNum}, getCount: ${fetchFileResult.getCount()}`) - console.info(`${testNum}, expectAssetsCount: ${expectAssetsCount}`) + count++; + console.info(`${testNum}, expectAssetsCount: ${expectAssetsCount} + getCount: ${fetchFileResult.getCount()}`) expect(fetchFileResult.getCount()).assertEqual(expectAssetsCount); - done(); - } else { - // more asset type - let count = 0; - for (const album of albumList) { - let fetchFileResult = await album.getFileAssets(op); - if (fetchFileResult == undefined) { - console.info(`${testNum} fetchFileResult undefined`) - expect(false).assertTrue(); - done(); - return; - } - count++; - console.info(`${testNum}, getCount: ${fetchFileResult.getCount()}`) - console.info(`${testNum}, expectAssetsCount: ${expectAssetsCount}`) - expect(fetchFileResult.getCount()).assertEqual(expectAssetsCount); - } - expect(count).assertEqual(expectAlbumCount); - done(); } + expect(count).assertEqual(expectAlbumCount); + done(); } catch (error) { console.info(`${testNum}, error: ${error}`) expect(false).assertTrue(); diff --git a/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumTestCallBack.test.ets b/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumTestCallBack.test.ets index 2ffc177d478be507a5836ae7a6a95c9c31390ffa..6de2d33f913d86d4c67ae2d3f6b7e1003e0fe240 100755 --- a/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumTestCallBack.test.ets +++ b/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumTestCallBack.test.ets @@ -37,7 +37,7 @@ export default function albumTestCallbackTest(abilityContext) { const media = mediaLibrary.getMediaLibrary(abilityContext); beforeAll(async function () { console.info('beforeAll case'); - await checkPresetsAssets(media, 'ActsMediaLibraryAlbum'); + await checkPresetsAssets(media, 'ActsMediaLibraryAlbumTest'); }); beforeEach(function () { console.info('beforeEach case'); @@ -51,13 +51,13 @@ export default function albumTestCallbackTest(abilityContext) { }); function printAlbumMessage(testNum, album) { - console.info(`${testNum} album.albumId: ${album.albumId}`); - console.info(`${testNum} album.albumName: ${album.albumName}`); - console.info(`${testNum} album.albumUri: ${album.albumUri}`); - console.info(`${testNum} album.dateModified: ${album.dateModified}`); - console.info(`${testNum} album.count: ${album.count}`); - console.info(`${testNum} album.relativePath: ${album.relativePath}`); - console.info(`${testNum} album.coverUri: ${album.coverUri}`); + console.info(`${testNum} album.albumId: ${album.albumId} + album.albumName: ${album.albumName} + album.albumUri: ${album.albumUri} + album.dateModified: ${album.dateModified} + album.count: ${album.count} + album.relativePath: ${album.relativePath} + album.coverUri: ${album.coverUri}`); } const props = { @@ -148,8 +148,7 @@ export default function albumTestCallbackTest(abilityContext) { const album = albumList[0]; album.albumName = newName; album.commitModify(async (error) => { - console.info(`${testNum}, error.message: ${error.message}`) - console.info(`${testNum}, error.code: ${error.code}`) + console.info(`${testNum}, error.message: ${error.message} error.code: ${error.code}`) expect(error.code != undefined).assertTrue(); done(); }); diff --git a/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumTestPromise.test.ets b/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumTestPromise.test.ets index 2a2a9fa0bbe2c52db4babe2e4ab3fca36be311c6..1895d9d9f01788e3caa982317f08484edce7494a 100755 --- a/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumTestPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_album/entry/src/main/ets/test/albumTestPromise.test.ets @@ -36,7 +36,7 @@ export default function albumTestPromiseTest(abilityContext) { const media = mediaLibrary.getMediaLibrary(abilityContext); beforeAll(async function () { console.info('beforeAll case'); - await checkPresetsAssets(media, 'ActsMediaLibraryAlbum'); + await checkPresetsAssets(media, 'ActsMediaLibraryAlbumTest'); }); beforeEach(function () { console.info('beforeEach case'); @@ -50,13 +50,13 @@ export default function albumTestPromiseTest(abilityContext) { }); function printAlbumMessage(testNum, album) { - console.info(`${testNum} album.albumId: ${album.albumId}`); - console.info(`${testNum} album.albumName: ${album.albumName}`); - console.info(`${testNum} album.albumUri: ${album.albumUri}`); - console.info(`${testNum} album.dateModified: ${album.dateModified}`); - console.info(`${testNum} album.count: ${album.count}`); - console.info(`${testNum} album.relativePath: ${album.relativePath}`); - console.info(`${testNum} album.coverUri: ${album.coverUri}`); + console.info(`${testNum} album.albumId: ${album.albumId} + album.albumName: ${album.albumName} + album.albumUri: ${album.albumUri} + album.dateModified: ${album.dateModified} + album.count: ${album.count} + album.relativePath: ${album.relativePath} + album.coverUri: ${album.coverUri}`); } const props = { @@ -115,7 +115,6 @@ export default function albumTestPromiseTest(abilityContext) { const abnormalAlbumCount = async function (done, testNum, fetchOp) { try { - const albumList = await media.getAlbums(fetchOp); console.info(`${testNum}, albumList.length: ${albumList.length}`) expect(albumList.length).assertEqual(0); @@ -127,6 +126,19 @@ export default function albumTestPromiseTest(abilityContext) { } } + const queryConditionAbnormal = async function (done, testNum, fetchOp) { + try { + console.info(`${testNum}, fetchOp: ${JSON.stringify(fetchOp)}`) + const albumList = await media.getAlbums(fetchOp); + expect(false).assertTrue(); + done(); + } catch (error) { + console.info(`${testNum},query condition abnormal error: ${error}`) + expect(true).assertTrue(); + done(); + } + } + const abnormalAlbumCommitModify = async function (done, testNum, fetchOp, newName, expectAlbumCount) { try { const albumList = await media.getAlbums(fetchOp); @@ -139,8 +151,7 @@ export default function albumTestPromiseTest(abilityContext) { expect(false).assertTrue(); done(); } catch (error) { - console.info(`${testNum}, error.message: ${error.message}`) - console.info(`${testNum}, error.code: ${error.code}`) + console.info(`${testNum}, error.message: ${error.message} error.code: ${error.code}`) expect(error.code!=undefined).assertTrue(); done(); } @@ -301,7 +312,7 @@ export default function albumTestPromiseTest(abilityContext) { }; let testNum = 'SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_002_07' - await abnormalAlbumCount(done, testNum, fileHasArgsfetchOp) + await queryConditionAbnormal(done, testNum, fileHasArgsfetchOp) }); /** @@ -318,7 +329,7 @@ export default function albumTestPromiseTest(abilityContext) { selectionArgs: ['666'], }; let testNum = 'SUB_MEDIA_MEDIALIBRARY_GETALBUMASSETS_PROMISE_002_08' - await abnormalAlbumCount(done, testNum, fileHasArgsfetchOp) + await queryConditionAbnormal(done, testNum, fileHasArgsfetchOp) }); // ------------------------------ 002 test end ------------------------- diff --git a/multimedia/medialibrary/mediaLibrary_album/entry/src/main/module.json b/multimedia/medialibrary/mediaLibrary_album/entry/src/main/module.json index 8e0400fc761d17bbb4800f146c44da034a4bb89e..f1957f30e322ce1c4b3bc18f9313261fec7433ba 100755 --- a/multimedia/medialibrary/mediaLibrary_album/entry/src/main/module.json +++ b/multimedia/medialibrary/mediaLibrary_album/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:mainability_description", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/multimedia/medialibrary/mediaLibrary_base/BUILD.gn b/multimedia/medialibrary/mediaLibrary_base/BUILD.gn index 4bf9e8f54f25ebb1f5e80b09fcfd08918fad5dfd..92707371dd4d5bda83b1fa76b09d30bee5e3c50b 100755 --- a/multimedia/medialibrary/mediaLibrary_base/BUILD.gn +++ b/multimedia/medialibrary/mediaLibrary_base/BUILD.gn @@ -21,7 +21,7 @@ ohos_js_hap_suite("mediaLibrary_base_hap") { ] ets2abc = true certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsMediaLibraryBase" + hap_name = "ActsMediaLibraryBaseTest" } ohos_app_scope("medialibrary_app_profile") { diff --git a/multimedia/medialibrary/mediaLibrary_base/Test.json b/multimedia/medialibrary/mediaLibrary_base/Test.json index efecafbe624a41f17e975ca4507d1bcb0c9df285..3ddec50cac06325cc7f2af30b9f044a94a250761 100755 --- a/multimedia/medialibrary/mediaLibrary_base/Test.json +++ b/multimedia/medialibrary/mediaLibrary_base/Test.json @@ -9,24 +9,22 @@ "kits": [ { "type": "ShellKit", - "pre-push": [ - ], + "pre-push": [], "run-command": [ "rm -rf /storage/media/100/local/files/*", "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", "mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios,Documents}", - "mkdir -p /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata" + "mkdir -p /storage/media/100/local/temp" ] }, { "type": "PushKit", - "pre-push": [ - ], + "pre-push": [], "push": [ - "./resource/medialibrary/01.jpg ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.mp3 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.mp4 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.dat ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata" + "./resource/medialibrary/01.jpg ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.dat ->/storage/media/100/local/temp" ] }, { @@ -36,26 +34,23 @@ "mkdir -pv /storage/media/100/local/files/Videos//{Static,On,Off}", "mkdir -pv /storage/media/100/local/files/Audios/{Static,On,Off}", "mkdir -pv /storage/media/100/local/files/Documents/{Static,On,Off}", - - "for d in Static On Off OnAlbum OffAlbum; do for i in $$(seq 1); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", - "for d in Static On Off; do for i in $$(seq 1); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", - "for d in Static On Off; do for i in $$(seq 1); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", - "for d in Static On Off; do for i in $$(seq 1); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;", - + "for d in Static On Off OnAlbum OffAlbum; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", + "for d in Static On Off; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", + "for d in Static On Off; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", + "for d in Static On Off; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;", "chmod -R 777 /storage/media/100/local/files/*", "chmod -R 777 /data/service/el2/100/hmdfs/account/files/*", "hilog -Q pidoff", "hilog -p off", "hilog -b I", - "hilog -b D -D 0xD002B70", - "setenforce 0", - "scanner_demo", + "hilog -b D -D 0xD002B70", + "scanner", "sleep 10" ] }, { "test-file-name": [ - "ActsMediaLibraryBase.hap" + "ActsMediaLibraryBaseTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestCallback.test.ets b/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestCallback.test.ets index 8618e57ea2da25ad13dc3a612bf57368981dcaea..420c0d4a5f38dbd56c1b89ec1dc9bb72e9416703 100755 --- a/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestCallback.test.ets @@ -36,7 +36,7 @@ export default function mediaLibraryTestCallback(abilityContext) { beforeAll(async function () { console.info('beforeAll case'); await getPermission(); - await checkPresetsAssets(media, 'ActsMediaLibraryBase'); + await checkPresetsAssets(media, 'ActsMediaLibraryBaseTest'); }); beforeEach(function () { console.info('beforeEach case'); @@ -276,14 +276,14 @@ export default function mediaLibraryTestCallback(abilityContext) { await asset.close(fd); try { media.createAsset(type, name, path, async (err, creatAsset) => { - if (err || creatAsset == undefined) { + if (err != undefined) { expect(true).assertTrue(); done(); return; - } else { - expect(false).assertTrue(); - done(); } + expect(false).assertTrue(); + done(); + }); } catch (error) { console.info(`${testNum}:: error :${error}`); @@ -298,15 +298,15 @@ export default function mediaLibraryTestCallback(abilityContext) { } /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_001 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_001 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_001', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_001'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_001', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_001'; let currentFetchOps = fetchOps(testNum, 'Pictures/Static/', IMAGE_TYPE); let type = 'image'; let count = 1; @@ -314,15 +314,15 @@ export default function mediaLibraryTestCallback(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_002 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_002 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_002', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_002'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_002', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_002'; let currentFetchOps = fetchOps(testNum, 'Videos/Static/', VIDEO_TYPE); let type = 'video'; let count = 1; @@ -330,15 +330,15 @@ export default function mediaLibraryTestCallback(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_003 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_003 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_003', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_003'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_003', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_003'; let currentFetchOps = fetchOps(testNum, 'Audios/Static/', AUDIO_TYPE); let type = 'audio'; let count = 1; @@ -346,15 +346,15 @@ export default function mediaLibraryTestCallback(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_004 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_004 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_004', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_004'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_004', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_004'; let currentFetchOps = fetchOps(testNum, 'Documents/Static/', FILE_TYPE); let type = 'file'; let count = 1; @@ -362,15 +362,15 @@ export default function mediaLibraryTestCallback(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_005 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_005 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_005', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_005'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_005', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_005'; let currentFetchOps = imageAndVideofetchOp; let type = 'video'; let count = 2; @@ -379,15 +379,15 @@ export default function mediaLibraryTestCallback(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_006 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_006 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_006', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_006'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_006', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_006'; let currentFetchOps = imageAndVideoAndfilefetchOp; let type = 'file'; let count = 3; @@ -396,15 +396,15 @@ export default function mediaLibraryTestCallback(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_007 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_007 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_007', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_006'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_007', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_006'; let currentFetchOps = imageAndVideoAndfileAndAudiofetchOp; let type = 'audio'; let count = 4; @@ -413,157 +413,157 @@ export default function mediaLibraryTestCallback(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_008 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_008 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_008', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_008', 0, async function (done) { let currentFetchOps = { selections: FILEKEY.MEDIA_TYPE + '= ?', selectionArgs: [], }; - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_008'; + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_008'; await getFileAssetsZero(done, testNum, currentFetchOps) }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_009 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_009 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_009', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_009', 0, async function (done) { let currentFetchOps = { selections: FILEKEY.MEDIA_TYPE + 'abc= ?', selectionArgs: [AUDIO_TYPE.toString()], }; - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_009'; + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_009'; await getFileAssetsAbnormal(done, testNum, currentFetchOps) }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_010 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_010 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_010', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_010', 0, async function (done) { let currentFetchOps = { selections: FILEKEY.MEDIA_TYPE + '= ?', selectionArgs: [111], }; - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_010'; + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_010'; await getFileAssetsZero(done, testNum, currentFetchOps) }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_011 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_011 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_011', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_011', 0, async function (done) { let currentFetchOps = { selections: 'abc' + '= ?', selectionArgs: [AUDIO_TYPE.toString()], }; - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETFILEASSETS_011'; + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETFILEASSETS_011'; await getFileAssetsAbnormal(done, testNum, currentFetchOps) }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_001 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_001 * @tc.name : getPublicDirectory * @tc.desc : getPublicDirectory DIR_CAMERA * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_001', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_001'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_001', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_001'; let dir = mediaLibrary.DirectoryType.DIR_CAMERA; let val = 'Camera/'; await checkGetPublicDirectory(done, testNum, dir, val) }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_002 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_002 * @tc.name : getPublicDirectory * @tc.desc : getPublicDirectory DIR_VIDEO * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_002', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_002'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_002', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_002'; let dir = mediaLibrary.DirectoryType.DIR_VIDEO; let val = 'Videos/'; await checkGetPublicDirectory(done, testNum, dir, val) }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_003 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_003 * @tc.name : getPublicDirectory * @tc.desc : getPublicDirectory DIR_IMAGE * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_003', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_003'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_003', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_003'; let dir = mediaLibrary.DirectoryType.DIR_IMAGE; let val = 'Pictures/'; await checkGetPublicDirectory(done, testNum, dir, val) }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_004 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_004 * @tc.name : getPublicDirectory - * @tc.desc : getPublicDirectory DIR_IMAGE + * @tc.desc : getPublicDirectory DIR_AUDIO * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_004', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_004'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_004', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_004'; let dir = mediaLibrary.DirectoryType.DIR_AUDIO; let val = 'Audios/'; await checkGetPublicDirectory(done, testNum, dir, val) }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_005 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_005 * @tc.name : getPublicDirectory * @tc.desc : getPublicDirectory DIR_IMAGE * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_005', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_004'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_005', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_005'; let dir = mediaLibrary.DirectoryType.DIR_DOCUMENTS; let val = 'Documents/'; await checkGetPublicDirectory(done, testNum, dir, val) }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_006 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_006 * @tc.name : getPublicDirectory * @tc.desc : getPublicDirectory 110 * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_006', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_006', 0, async function (done) { try { await media.getPublicDirectory(110); console.info('MediaLibraryTest : getPublicDirectory 006 failed'); @@ -577,15 +577,30 @@ export default function mediaLibraryTestCallback(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_001 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_007 + * @tc.name : getPublicDirectory + * @tc.desc : getPublicDirectory DIR_DOWNLOAD + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_007', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_GETPUBLICDIRECTORY_007'; + let dir = mediaLibrary.DirectoryType.DIR_DOWNLOAD; + let val = 'Download/'; + await checkGetPublicDirectory(done, testNum, dir, val) + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_001 * @tc.name : createAsset * @tc.desc : Create File Asset image (does not exist) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_001', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_001'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_001', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_001'; let currentFetchOps = fetchOps(testNum, 'Pictures/Static/', IMAGE_TYPE); let type = IMAGE_TYPE; let name = new Date().getTime() + '.jpg'; @@ -594,15 +609,15 @@ export default function mediaLibraryTestCallback(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_002 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_002 * @tc.name : createAsset * @tc.desc : Create File Asset image (existed) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_002', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_002'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_002', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_002'; let currentFetchOps = fetchOps(testNum, 'Pictures/Static/', IMAGE_TYPE); let type = IMAGE_TYPE; let name = new Date().getTime() + '.jpg'; @@ -612,15 +627,15 @@ export default function mediaLibraryTestCallback(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_003 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_003 * @tc.name : createAsset * @tc.desc : Create File Asset video (does not exist) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_003', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_003'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_003', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_003'; let currentFetchOps = fetchOps(testNum, 'Videos/Static/', VIDEO_TYPE); let type = VIDEO_TYPE; let name = new Date().getTime() + '.mp4'; @@ -629,15 +644,15 @@ export default function mediaLibraryTestCallback(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_004 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_004 * @tc.name : createAsset * @tc.desc : Create File Asset video (existed) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_004', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_004'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_004', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_004'; let currentFetchOps = fetchOps(testNum, 'Videos/Static/', VIDEO_TYPE); let type = VIDEO_TYPE; let name = new Date().getTime() + '.mp4'; @@ -646,15 +661,15 @@ export default function mediaLibraryTestCallback(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_005 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_005 * @tc.name : createAsset * @tc.desc : Create File Asset audio (does not exist) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_005', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_005'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_005', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_005'; let currentFetchOps = fetchOps(testNum, 'Audios/Static/', AUDIO_TYPE); let type = AUDIO_TYPE; let name = new Date().getTime() + '.mp3'; @@ -663,15 +678,15 @@ export default function mediaLibraryTestCallback(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_006 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_006 * @tc.name : createAsset * @tc.desc : Create File Asset audio (existed) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_006', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_006'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_006', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_006'; let currentFetchOps = fetchOps(testNum, 'Audios/Static/', AUDIO_TYPE); let type = AUDIO_TYPE; let name = new Date().getTime() + '.mp3'; @@ -680,15 +695,15 @@ export default function mediaLibraryTestCallback(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_007 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_007 * @tc.name : createAsset * @tc.desc : Create File Asset file (does not exist) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_007', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_007'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_007', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_007'; let currentFetchOps = fetchOps(testNum, 'Documents/Static/', FILE_TYPE); let type = FILE_TYPE; let name = new Date().getTime() + '.dat'; @@ -697,15 +712,15 @@ export default function mediaLibraryTestCallback(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_008 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_008 * @tc.name : createAsset * @tc.desc : Create File Asset file (existed) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_008', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_008'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_008', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_008'; let currentFetchOps = fetchOps(testNum, 'Documents/Static/', FILE_TYPE); let type = FILE_TYPE; let name = new Date().getTime() + '.dat'; @@ -714,15 +729,15 @@ export default function mediaLibraryTestCallback(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_001 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_001 * @tc.name : createAsset * @tc.desc : Create File Asset image (does not exist) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_009', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_CALLBACK_CREATEASSET_001'; + it('SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_009', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_CALLBACK_CREATEASSET_001'; let currentFetchOps = fetchOps(testNum, 'Pictures/Static/', IMAGE_TYPE); let type = IMAGE_TYPE; let name = new Date().getTime() + '.jpg'; diff --git a/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestPromise.test.ets b/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestPromise.test.ets index 29b5a20424870f5dc33274ea6357893bfc9573e4..722ba4bf1319120225dae7afcd432617502d5fde 100755 --- a/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestPromise.test.ets @@ -36,7 +36,7 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { beforeAll(async function () { console.info('beforeAll case'); await getPermission(); - await checkPresetsAssets(media, 'ActsMediaLibraryBase'); + await checkPresetsAssets(media, 'ActsMediaLibraryBaseTest'); }); beforeEach(function () { console.info('beforeEach case'); @@ -258,14 +258,14 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { } } /** - * @tc.number : SUB_MEDIA_MIDIALIBRARY_PROMISE_GETMEDIALIBRAY_001 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETMEDIALIBRAY_001 * @tc.name : getMediaLibrary * @tc.desc : Obtains a MediaLibrary instance * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MIDIALIBRARY_PROMISE_GETMEDIALIBRAY_001', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETMEDIALIBRAY_001', 0, async function (done) { try { expect(media != undefined).assertTrue(); done(); @@ -277,15 +277,15 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_001 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_001 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_001', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_001'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_001', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_001'; let currentFetchOps = fetchOps(testNum, 'Pictures/Static/', IMAGE_TYPE); let type = 'image'; let count = 1; @@ -293,15 +293,15 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_002 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_002 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_002', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_002'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_002', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_002'; let currentFetchOps = fetchOps(testNum, 'Videos/Static/', VIDEO_TYPE); let type = 'video'; let count = 1; @@ -309,15 +309,15 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_003 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_003 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_003', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_003'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_003', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_003'; let currentFetchOps = fetchOps(testNum, 'Audios/Static/', AUDIO_TYPE); let type = 'audio'; let count = 1; @@ -325,15 +325,15 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_004 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_004 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_004', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_004'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_004', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_004'; let currentFetchOps = fetchOps(testNum, 'Documents/Static/', FILE_TYPE); let type = 'file'; let count = 1; @@ -341,15 +341,15 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_005 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_005 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_005', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_005'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_005', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_005'; let currentFetchOps = imageAndVideofetchOp; let type = 'video'; let count = 2; @@ -358,15 +358,15 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_006 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_006 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_006', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_006'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_006', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_006'; let currentFetchOps = imageAndVideoAndfilefetchOp; let type = 'file'; let count = 3; @@ -375,15 +375,15 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_007 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_007 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_007', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_006'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_007', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_006'; let currentFetchOps = imageAndVideoAndfileAndAudiofetchOp; let type = 'audio'; let count = 4; @@ -392,157 +392,157 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_008 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_008 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_008', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_008', 0, async function (done) { let currentFetchOps = { selections: FILEKEY.MEDIA_TYPE + '= ?', selectionArgs: [], }; - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_008'; + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_008'; await getFileAssetsZero(done, testNum, currentFetchOps) }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_009 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_009 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_009', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_009', 0, async function (done) { let currentFetchOps = { selections: FILEKEY.MEDIA_TYPE + 'abc= ?', selectionArgs: [AUDIO_TYPE.toString()], }; - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_009'; + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_009'; await getFileAssetsAbnormal(done, testNum, currentFetchOps) }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_010 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_010 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_010', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_010', 0, async function (done) { let currentFetchOps = { selections: FILEKEY.MEDIA_TYPE + '= ?', selectionArgs: [111], }; - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_010'; + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_010'; await getFileAssetsZero(done, testNum, currentFetchOps) }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_011 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_011 * @tc.name : getFileAssets * @tc.desc : query all assets * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_011', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_011', 0, async function (done) { let currentFetchOps = { selections: 'abc' + '= ?', selectionArgs: [AUDIO_TYPE.toString()], }; - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_GETFILEASSETS_011'; + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_GETFILEASSETS_011'; await getFileAssetsAbnormal(done, testNum, currentFetchOps) }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_001 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_001 * @tc.name : getPublicDirectory * @tc.desc : getPublicDirectory DIR_CAMERA * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_001', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_001'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_001', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_001'; let dir = mediaLibrary.DirectoryType.DIR_CAMERA; let val = 'Camera/'; await checkGetPublicDirectory(done, testNum, dir, val) }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_002 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_002 * @tc.name : getPublicDirectory * @tc.desc : getPublicDirectory DIR_VIDEO * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_002', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_002'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_002', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_002'; let dir = mediaLibrary.DirectoryType.DIR_VIDEO; let val = 'Videos/'; await checkGetPublicDirectory(done, testNum, dir, val) }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_003 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_003 * @tc.name : getPublicDirectory * @tc.desc : getPublicDirectory DIR_IMAGE * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_003', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_003'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_003', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_003'; let dir = mediaLibrary.DirectoryType.DIR_IMAGE; let val = 'Pictures/'; await checkGetPublicDirectory(done, testNum, dir, val) }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_004 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_004 * @tc.name : getPublicDirectory - * @tc.desc : getPublicDirectory DIR_IMAGE + * @tc.desc : getPublicDirectory DIR_AUDIO * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_004', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_004'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_004', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_004'; let dir = mediaLibrary.DirectoryType.DIR_AUDIO; let val = 'Audios/'; await checkGetPublicDirectory(done, testNum, dir, val) }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_005 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_005 * @tc.name : getPublicDirectory - * @tc.desc : getPublicDirectory DIR_IMAGE + * @tc.desc : getPublicDirectory DIR_DOCUMENTS * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_005', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_004'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_005', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_005'; let dir = mediaLibrary.DirectoryType.DIR_DOCUMENTS; let val = 'Documents/'; await checkGetPublicDirectory(done, testNum, dir, val) }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_006 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_006 * @tc.name : getPublicDirectory * @tc.desc : getPublicDirectory 110 * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_006', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_006', 0, async function (done) { try { await media.getPublicDirectory(110); console.info('MediaLibraryTest : getPublicDirectory 006 failed'); @@ -556,15 +556,31 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_001 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_007 + * @tc.name : getPublicDirectory + * @tc.desc : getPublicDirectory DIR_DOWNLOAD + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_007', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_GETPUBLICDIRECTORY_007'; + let dir = mediaLibrary.DirectoryType.DIR_DOWNLOAD; + let val = 'Download/'; + await checkGetPublicDirectory(done, testNum, dir, val) + }); + + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_001 * @tc.name : createAsset * @tc.desc : Create File Asset image (does not exist) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_001', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_001'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_001', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_001'; let currentFetchOps = fetchOps(testNum, 'Pictures/Static/', IMAGE_TYPE); let type = IMAGE_TYPE; let name = new Date().getTime() + '.jpg'; @@ -573,15 +589,15 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_002 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_002 * @tc.name : createAsset * @tc.desc : Create File Asset image (existed) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_002', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_002'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_002', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_002'; let currentFetchOps = fetchOps(testNum, 'Pictures/Static/', IMAGE_TYPE); let type = IMAGE_TYPE; let name = new Date().getTime() + '.jpg'; @@ -591,15 +607,15 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_003 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_003 * @tc.name : createAsset * @tc.desc : Create File Asset video (does not exist) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_003', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_003'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_003', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_003'; let currentFetchOps = fetchOps(testNum, 'Videos/Static/', VIDEO_TYPE); let type = VIDEO_TYPE; let name = new Date().getTime() + '.mp4'; @@ -608,15 +624,15 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_004 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_004 * @tc.name : createAsset * @tc.desc : Create File Asset video (existed) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_004', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_004'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_004', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_004'; let currentFetchOps = fetchOps(testNum, 'Videos/Static/', VIDEO_TYPE); let type = VIDEO_TYPE; let name = new Date().getTime() + '.mp4'; @@ -625,15 +641,15 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_005 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_005 * @tc.name : createAsset * @tc.desc : Create File Asset audio (does not exist) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_005', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_005'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_005', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_005'; let currentFetchOps = fetchOps(testNum, 'Audios/Static/', AUDIO_TYPE); let type = AUDIO_TYPE; let name = new Date().getTime() + '.mp3'; @@ -642,15 +658,15 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_006 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_006 * @tc.name : createAsset * @tc.desc : Create File Asset audio (existed) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_006', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_006'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_006', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_006'; let currentFetchOps = fetchOps(testNum, 'Audios/Static/', AUDIO_TYPE); let type = AUDIO_TYPE; let name = new Date().getTime() + '.mp3'; @@ -659,15 +675,15 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_007 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_007 * @tc.name : createAsset * @tc.desc : Create File Asset file (does not exist) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_007', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_007'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_007', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_007'; let currentFetchOps = fetchOps(testNum, 'Documents/Static/', FILE_TYPE); let type = FILE_TYPE; let name = new Date().getTime() + '.dat'; @@ -676,15 +692,15 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_008 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_008 * @tc.name : createAsset * @tc.desc : Create File Asset file (existed) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_008', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_008'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_008', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_008'; let currentFetchOps = fetchOps(testNum, 'Documents/Static/', FILE_TYPE); let type = FILE_TYPE; let name = new Date().getTime() + '.dat'; @@ -693,15 +709,15 @@ export default function mediaLibraryTestPromiseTest(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_001 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_001 * @tc.name : createAsset * @tc.desc : Create File Asset image (does not exist) * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_009', 0, async function (done) { - let testNum = 'SUB__MEDIA_MIDIALIBRARY_PROMISE_CREATEASSET_001'; + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_009', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_CREATEASSET_001'; let currentFetchOps = fetchOps(testNum, 'Pictures/Static/', IMAGE_TYPE); let type = IMAGE_TYPE; let name = new Date().getTime() + '.jpg'; diff --git a/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestPromiseOnOff.test.ets b/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestPromiseOnOff.test.ets index a8c872f0f58566aa56d8c34c1fdf75fa75d20ddc..e74f4c6cd8698b2156cbba18f06226aec5a6643c 100755 --- a/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestPromiseOnOff.test.ets +++ b/multimedia/medialibrary/mediaLibrary_base/entry/src/main/ets/test/mediaLibraryTestPromiseOnOff.test.ets @@ -35,7 +35,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext) { beforeAll(async function () { console.info('beforeAll case'); await getPermission(); - await checkPresetsAssets(media, 'ActsMediaLibraryBase'); + await checkPresetsAssets(media, 'ActsMediaLibraryBaseTest'); }); beforeEach(function () { console.info('beforeEach case'); @@ -50,8 +50,8 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext) { const onTest = async (done, testNum, type, fetchOps) => { try { - let conut = 0; - media.on(type, () => { conut++; }); + let count = 0; + media.on(type, () => { count++; }); const fetchFileResult = await media.getFileAssets(fetchOps); let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchFileResult, 1); if (!checkAssetCountPass) return; @@ -59,7 +59,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext) { asset.title = asset.title + 'changename'; await asset.commitModify(); await sleep(1000) - expect(conut > 0).assertTrue(); + expect(count > 0).assertTrue(); done(); } catch (error) { console.info(`${testNum}:: error :${error}`); @@ -69,21 +69,19 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext) { } const offTest = async (done, testNum, type, fetchOps) => { try { - let conut = 0; + let count = 0; media.on(type, () => { - conut++; + count++; }); - await sleep(200) const fetchFileResult = await media.getFileAssets(fetchOps); let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchFileResult, 1); if (!checkAssetCountPass) return; const asset = await fetchFileResult.getFirstObject(); asset.title = asset.title + 'changename'; media.off(type); - await sleep(200) await asset.commitModify(); await sleep(1000) - expect(conut).assertEqual(0); + expect(count).assertEqual(0); done(); } catch (error) { console.info(`${testNum}:: error :${error}`); @@ -92,79 +90,79 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext) { } } /** - * @tc.number : SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_001 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_001 * @tc.name : ON * @tc.desc : ON Image ASSET * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_001', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_001', 0, async function (done) { let type = 'imageChange' - let testNum = 'SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_001'; + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_001'; let currentFetchOps = fetchOps(testNum, 'Pictures/On/', IMAGE_TYPE); await onTest(done, testNum, type, currentFetchOps) }); /** - * @tc.number : SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_002 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_002 * @tc.name : ON * @tc.desc : ON Video ASSET * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_002', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_002', 0, async function (done) { let type = 'videoChange' - let testNum = 'SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_002'; + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_002'; let currentFetchOps = fetchOps(testNum, 'Videos/On/', VIDEO_TYPE); await onTest(done, testNum, type, currentFetchOps) }); /** - * @tc.number : SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_003 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_003 * @tc.name : ON * @tc.desc : ON Audio ASSET * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_003', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_003', 0, async function (done) { let type = 'audioChange' - let testNum = 'SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_003'; + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_003'; let currentFetchOps = fetchOps(testNum, 'Audios/On/', AUDIO_TYPE); await onTest(done, testNum, type, currentFetchOps) }); /** - * @tc.number : SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_004 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_004 * @tc.name : ON * @tc.desc : ON File ASSET * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_004', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_004', 0, async function (done) { let type = 'fileChange' - let testNum = 'SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_004'; + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_004'; let currentFetchOps = fetchOps(testNum, 'Documents/On/', FILE_TYPE); await onTest(done, testNum, type, currentFetchOps) }); /** - * @tc.number : SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_005 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_005 * @tc.name : ON * @tc.desc : ON ALBUM * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_005', 0, async function (done) { - let testNum = 'SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_005' + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_005', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_005' try { - let conut = 0; + let count = 0; media.on('albumChange', () => { - conut++; + count++; }); let currentFetchOps = albumFetchOps(testNum, 'Pictures/', 'OnAlbum', IMAGE_TYPE); const albumList = await media.getAlbums(currentFetchOps); @@ -175,7 +173,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext) { album.albumName = album.albumName + 'changename'; await album.commitModify(); await sleep(1000) - expect(conut > 0).assertTrue(); + expect(count > 0).assertTrue(); album.albumName = oldName; await album.commitModify(); done(); @@ -187,22 +185,22 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext) { }); /** - * @tc.number : SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_006 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_006 * @tc.name : ON * @tc.desc : ON DEVICE ASSET * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_006', 0, async function (done) { - let testNum = 'SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_006' + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_006', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_006' try { - let conut = 0; + let count = 0; expect(true).assertTrue(); done(); media.on('deviceChange', () => { console.info('MediaLibraryTest : on 006 callback'); - conut++; + count++; }); let currentFetchOps = fetchOps(testNum, 'Documents/On/', FILE_TYPE); const fetchFileResult = await media.getFileAssets(currentFetchOps); @@ -214,7 +212,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext) { res(true) }, 1000) }) - expect(conut == 0).assertTrue(); + expect(count == 0).assertTrue(); done(); } catch (error) { console.info(`MediaLibraryTest : on 006 failed, error: ${error}`); @@ -225,22 +223,22 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext) { }); /** - * @tc.number : SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_006 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_006 * @tc.name : ON * @tc.desc : ON REMOTE_FILE ASSET * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_007', 0, async function (done) { - let testNum = 'SUB_MEDIA_MIDIALIBRARY_PROMISE_ON_007' + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_007', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_ON_007' try { - let conut = 0; + let count = 0; expect(true).assertTrue(); done(); media.on('remoteFileChange', () => { console.info('MediaLibraryTest : on 007 callback'); - conut++; + count++; }); let currentFetchOps = fetchOps(testNum, 'Documents/On/', FILE_TYPE); @@ -253,7 +251,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext) { res(true) }, 1000) }) - expect(conut == 0).assertTrue(); + expect(count == 0).assertTrue(); done(); } catch (error) { console.info(`MediaLibraryTest : on 006 failed, error: ${error}`); @@ -264,79 +262,79 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext) { }); /** - * @tc.number : SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_001 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_001 * @tc.name : off * @tc.desc : off Image ASSET * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_001', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_001', 0, async function (done) { let type = 'imageChange' - let testNum = 'SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_001'; + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_001'; let currentFetchOps = fetchOps(testNum, 'Pictures/Off/', IMAGE_TYPE); await offTest(done, testNum, type, currentFetchOps) }); /** - * @tc.number : SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_002 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_002 * @tc.name : off * @tc.desc : off video ASSET * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_002', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_002', 0, async function (done) { let type = 'videoChange' - let testNum = 'SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_002'; + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_002'; let currentFetchOps = fetchOps(testNum, 'Videos/Off/', VIDEO_TYPE); await offTest(done, testNum, type, currentFetchOps) }); /** - * @tc.number : SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_003 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_003 * @tc.name : off * @tc.desc : off audio ASSET * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_003', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_003', 0, async function (done) { let type = 'audioChange' - let testNum = 'SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_003'; + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_003'; let currentFetchOps = fetchOps(testNum, 'Audios/Off/', AUDIO_TYPE); await offTest(done, testNum, type, currentFetchOps) }); /** - * @tc.number : SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_004 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_004 * @tc.name : off * @tc.desc : off file ASSET * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_004', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_004', 0, async function (done) { let type = 'fileChange' - let testNum = 'SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_004'; + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_004'; let currentFetchOps = fetchOps(testNum, 'Documents/Off/', FILE_TYPE); await offTest(done, testNum, type, currentFetchOps) }); /** - * @tc.number : SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_005 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_005 * @tc.name : off * @tc.desc : off album * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_005', 0, async function (done) { - let testNum = 'SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_005' + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_005', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_005' try { - let conut = 0; + let count = 0; media.on('albumChange', () => { - conut++; + count++; }); await sleep(300) media.off('albumChange'); @@ -352,7 +350,7 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext) { await sleep(300) album.albumName = oldName; await album.commitModify(); - expect(conut).assertEqual(0); + expect(count).assertEqual(0); done(); } catch (error) { console.info(`${testNum}:: error :${error}`); @@ -361,15 +359,15 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext) { } }); /** - * @tc.number : SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_006 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_006 * @tc.name : off * @tc.desc : off device ASSET * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_006', 0, async function (done) { - let testNum = 'SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_006' + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_006', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_006' try { media.on('deviceChange', () => { console.info('MediaLibraryTest : off 006 failed'); @@ -410,15 +408,15 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext) { }); /** - * @tc.number : SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_007 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_007 * @tc.name : off * @tc.desc : off remoteFile ASSET * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_007', 0, async function (done) { - let testNum = 'SUB_MEDIA_MIDIALIBRARY_PROMISE_OFF_007' + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_007', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_PROMISE_OFF_007' try { media.on('remoteFileChange', () => { console.info('MediaLibraryTest : off 007 failed'); @@ -460,14 +458,14 @@ export default function mediaLibraryTestPromiseOnOffTest(abilityContext) { }); /** - * @tc.number : SUB__MEDIA_MIDIALIBRARY_PROMISE_RELEASE_001 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_PROMISE_RELEASE_001 * @tc.name : release * @tc.desc : Release MediaLibrary instance * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB__MEDIA_MIDIALIBRARY_PROMISE_RELEASE_001', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_PROMISE_RELEASE_001', 0, async function (done) { try { await media.release(); console.info('MediaLibraryTest : release 001 passed'); diff --git a/multimedia/medialibrary/mediaLibrary_base/entry/src/main/module.json b/multimedia/medialibrary/mediaLibrary_base/entry/src/main/module.json index 82fb1970953e8e320b149a3885c079feaf97b750..f3eedb3d449aa6a71d157dfea758a37ae1ec41f2 100755 --- a/multimedia/medialibrary/mediaLibrary_base/entry/src/main/module.json +++ b/multimedia/medialibrary/mediaLibrary_base/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:mainability_description", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/multimedia/medialibrary/mediaLibrary_favorite/BUILD.gn b/multimedia/medialibrary/mediaLibrary_favorite/BUILD.gn index 2944426bdd63a6481360e5afa8a0884980da59ff..18389d25439db13db9103b0dcc637b9203d04920 100755 --- a/multimedia/medialibrary/mediaLibrary_favorite/BUILD.gn +++ b/multimedia/medialibrary/mediaLibrary_favorite/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") @@ -21,7 +21,7 @@ ohos_js_hap_suite("mediaLibrary_favorite_hap") { ] ets2abc = true certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsMediaLibraryFavorite" + hap_name = "ActsMediaLibraryFavoriteTest" } ohos_app_scope("medialibrary_app_profile") { diff --git a/multimedia/medialibrary/mediaLibrary_favorite/Test.json b/multimedia/medialibrary/mediaLibrary_favorite/Test.json index f749a8bd5c1d34cd1bcaf8f076c66df9802cdc2c..b3f230e0516e6112adda532272e40407bd0c0cfc 100755 --- a/multimedia/medialibrary/mediaLibrary_favorite/Test.json +++ b/multimedia/medialibrary/mediaLibrary_favorite/Test.json @@ -9,24 +9,22 @@ "kits": [ { "type": "ShellKit", - "pre-push": [ - ], + "pre-push": [], "run-command": [ "rm -rf /storage/media/100/local/files/*", "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", "mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios,Documents}", - "mkdir -p /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata" + "mkdir -p /storage/media/100/local/temp" ] }, { "type": "PushKit", - "pre-push": [ - ], + "pre-push": [], "push": [ - "./resource/medialibrary/01.jpg ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.mp3 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.mp4 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.dat ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata" + "./resource/medialibrary/01.jpg ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.dat ->/storage/media/100/local/temp" ] }, { @@ -36,25 +34,23 @@ "mkdir -pv /storage/media/100/local/files/Videos/{StaticPro,StaticCb}", "mkdir -pv /storage/media/100/local/files/Audios/{StaticPro,StaticCb}", "mkdir -pv /storage/media/100/local/files/Documents/{StaticPro,StaticCb}", - - "for d in {StaticPro,StaticCb}; do for i in $$(seq 4); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", - "for d in {StaticPro,StaticCb}; do for i in $$(seq 4); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", - "for d in {StaticPro,StaticCb}; do for i in $$(seq 4); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", - "for d in {StaticPro,StaticCb}; do for i in $$(seq 4); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;", - + "for d in {StaticPro,StaticCb}; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", + "for d in {StaticPro,StaticCb}; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", + "for d in {StaticPro,StaticCb}; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", + "for d in {StaticPro,StaticCb}; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;", "chmod -R 777 /storage/media/100/local/files/*", "chmod -R 777 /data/service/el2/100/hmdfs/account/files/*", "hilog -Q pidoff", "hilog -p off", "hilog -b I", - "hilog -b D -D 0xD002B70", - "scanner_demo", + "hilog -b D -D 0xD002B70", + "scanner", "sleep 10" ] }, { "test-file-name": [ - "ActsMediaLibraryFavorite.hap" + "ActsMediaLibraryFavoriteTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/ets/test/favoriteTestCallback.test.ets b/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/ets/test/favoriteTestCallback.test.ets index 31c2056bc88540249cad280f163fcb803680bf61..5b46d7d49f98ec2d0ef941125e40d1bb551bc857 100755 --- a/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/ets/test/favoriteTestCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/ets/test/favoriteTestCallback.test.ets @@ -33,7 +33,7 @@ export default function favoriteTestCallbackTest(abilityContext) { beforeAll(async function () { console.info('beforeAll case'); await getPermission(); - await checkPresetsAssets(media, 'ActsMediaLibraryFavorite'); + await checkPresetsAssets(media, 'ActsMediaLibraryFavoriteTest'); }); beforeEach(function () { console.info('beforeEach case'); diff --git a/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/ets/test/favoriteTestPromise.test.ets b/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/ets/test/favoriteTestPromise.test.ets index 984e4ef222f1d215a826a3dc313870af440b17c7..ce3d8fe9a05de461ec366eae6b9f4743617933bd 100755 --- a/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/ets/test/favoriteTestPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/ets/test/favoriteTestPromise.test.ets @@ -31,7 +31,7 @@ export default function favoriteTestPromiseTest(abilityContext) { var media = mediaLibrary.getMediaLibrary(abilityContext); beforeAll(async function () { console.info('beforeAll case'); - await checkPresetsAssets(media, 'ActsMediaLibraryFavorite'); + await checkPresetsAssets(media, 'ActsMediaLibraryFavoriteTest'); }); beforeEach(function () { console.info('beforeEach case'); diff --git a/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/module.json b/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/module.json index 8e0400fc761d17bbb4800f146c44da034a4bb89e..f1957f30e322ce1c4b3bc18f9313261fec7433ba 100755 --- a/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/module.json +++ b/multimedia/medialibrary/mediaLibrary_favorite/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:mainability_description", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/multimedia/medialibrary/mediaLibrary_file/BUILD.gn b/multimedia/medialibrary/mediaLibrary_file/BUILD.gn index 673c4d86cc4dc2f3106184703c6975f4ece7f45f..da81808d429b23fe1b31ffbb3c48475b145b3db8 100755 --- a/multimedia/medialibrary/mediaLibrary_file/BUILD.gn +++ b/multimedia/medialibrary/mediaLibrary_file/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") @@ -21,7 +21,7 @@ ohos_js_hap_suite("mediaLibrary_file_hap") { ] ets2abc = true certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsMediaLibraryFile" + hap_name = "ActsMediaLibraryFileTest" } ohos_app_scope("medialibrary_app_profile") { diff --git a/multimedia/medialibrary/mediaLibrary_file/Test.json b/multimedia/medialibrary/mediaLibrary_file/Test.json index 02d4ca45d073ea005a65e1c6f2565763c018c720..4754ce1ced6c8d34bb6fcbb8538d111bde239e15 100755 --- a/multimedia/medialibrary/mediaLibrary_file/Test.json +++ b/multimedia/medialibrary/mediaLibrary_file/Test.json @@ -9,24 +9,22 @@ "kits": [ { "type": "ShellKit", - "pre-push": [ - ], + "pre-push": [], "run-command": [ "rm -rf /storage/media/100/local/files/*", "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", "mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios,Documents}", - "mkdir -p /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata" + "mkdir -p /storage/media/100/local/temp" ] }, { "type": "PushKit", - "pre-push": [ - ], + "pre-push": [], "push": [ - "./resource/medialibrary/01.jpg ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.mp3 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.mp4 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.dat ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata" + "./resource/medialibrary/01.jpg ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.dat ->/storage/media/100/local/temp" ] }, { @@ -36,31 +34,27 @@ "mkdir -pv /storage/media/100/local/files/Videos/{Static,Dynamic}", "mkdir -pv /storage/media/100/local/files/Audios/{Static,Dynamic}", "mkdir -pv /storage/media/100/local/files/Documents/{Static,Dynamic}", - - "for d in Static; do for i in $$(seq 6); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", - "for d in Static; do for i in $$(seq 6); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", - "for d in Static; do for i in $$(seq 6); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", - "for d in Static; do for i in $$(seq 6); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;", - - "cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/Dynamic/01.jpg", - "cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp4 /storage/media/100/local/files/Videos/Dynamic/01.mp4", - "cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp3 /storage/media/100/local/files/Audios/Dynamic/01.mp3", - "cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.dat /storage/media/100/local/files/Documents/Dynamic/01.dat", - + "for d in Static; do for i in $$(seq 6); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", + "for d in Static; do for i in $$(seq 6); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", + "for d in Static; do for i in $$(seq 6); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", + "for d in Static; do for i in $$(seq 6); do cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;", + "cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/Dynamic/01.jpg", + "cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/Dynamic/01.mp4", + "cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/Dynamic/01.mp3", + "cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/Dynamic/01.dat", "chmod -R 777 /storage/media/100/local/files/*", "chmod -R 777 /data/service/el2/100/hmdfs/account/files/*", "hilog -Q pidoff", "hilog -p off", "hilog -b I", - "setenforce 0", - "hilog -b D -D 0xD002B70", - "scanner_demo", + "hilog -b D -D 0xD002B70", + "scanner", "sleep 10" ] }, { "test-file-name": [ - "ActsMediaLibraryFile.hap" + "ActsMediaLibraryFileTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestCallback.test.ets b/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestCallback.test.ets index 170fcbeaab466619a75823c4bf9550ec7e7ec4e6..ef2805faadd3a5a6587bef157b9ec5d7da56537f 100755 --- a/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestCallback.test.ets @@ -39,7 +39,7 @@ export default function fileTestCallbackTest(abilityContext) { beforeAll(async function () { console.info('beforeAll case'); await getPermission(); - await checkPresetsAssets(media, 'ActsMediaLibraryFile') + await checkPresetsAssets(media, 'ActsMediaLibraryFileTest') }); beforeEach(function () { console.info('beforeEach case'); @@ -84,6 +84,7 @@ export default function fileTestCallbackTest(abilityContext) { await copyFile(fd, creatAssetFd2); await creatAsset2.close(creatAssetFd2); await asset.close(fd); + console.info(`${testNum} displayName1: ${displayName1}, displayName2 :${displayName2} `); expect(creatAsset1.id != creatAsset2.id).assertTrue(); done(); }); @@ -146,7 +147,7 @@ export default function fileTestCallbackTest(abilityContext) { fetchFileResult = await media.getFileAssets(idOP); let newAsset = await fetchFileResult.getFirstObject(); expect(isNum(newAsset.dateModified)).assertTrue(); - expect(newAsset.dateModified != asset.dateModified).assertTrue() + expect(newAsset.dateModified).assertEqual(asset.dateModified); done(); }); } catch (error) { diff --git a/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestPromise.test.ets b/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestPromise.test.ets index da2f8aa250acae6e464d1d1900d156efb227b58e..14db2dd614cdfc0fe2912029b69c100c1e3efa16 100755 --- a/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_file/entry/src/main/ets/test/fileTestPromise.test.ets @@ -37,7 +37,7 @@ export default function fileTestPromiseTest(abilityContext) { const media = mediaLibrary.getMediaLibrary(abilityContext); beforeAll(async function () { console.info('beforeAll case'); - await checkPresetsAssets(media, 'ActsMediaLibraryFile') + await checkPresetsAssets(media, 'ActsMediaLibraryFileTest') }); beforeEach(function () { console.info('beforeEach case'); @@ -78,6 +78,7 @@ export default function fileTestPromiseTest(abilityContext) { await creatAsset2.close(creatAssetFd2); await asset.close(fd); expect(creatAsset1.id != creatAsset2.id).assertTrue(); + console.info(`${testNum} displayName1: ${displayName1}, displayName2 :${displayName2} `); done(); } catch (error) { console.info(`${testNum} failed error: ${error}`) @@ -130,7 +131,7 @@ export default function fileTestPromiseTest(abilityContext) { fetchFileResult = await media.getFileAssets(idOP); let newAsset = await fetchFileResult.getFirstObject(); expect(isNum(newAsset.dateModified)).assertTrue(); - expect(newAsset.dateModified != asset.dateModified).assertTrue() + expect(newAsset.dateModified).assertEqual(asset.dateModified); done(); } catch (error) { console.info(`${testNum} failed error: ${error}`) diff --git a/multimedia/medialibrary/mediaLibrary_file/entry/src/main/module.json b/multimedia/medialibrary/mediaLibrary_file/entry/src/main/module.json index 8e0400fc761d17bbb4800f146c44da034a4bb89e..f1957f30e322ce1c4b3bc18f9313261fec7433ba 100755 --- a/multimedia/medialibrary/mediaLibrary_file/entry/src/main/module.json +++ b/multimedia/medialibrary/mediaLibrary_file/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:mainability_description", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/multimedia/medialibrary/mediaLibrary_fileAsset/BUILD.gn b/multimedia/medialibrary/mediaLibrary_fileAsset/BUILD.gn index f6dc879da57ce5a546bfc34968e07614c353f0a7..908b75b8ff69fed7315564e23460044d8842d0b5 100755 --- a/multimedia/medialibrary/mediaLibrary_fileAsset/BUILD.gn +++ b/multimedia/medialibrary/mediaLibrary_fileAsset/BUILD.gn @@ -21,7 +21,7 @@ ohos_js_hap_suite("mediaLibrary_fileAsset_hap") { ] ets2abc = true certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsMediaLibraryFileAsset" + hap_name = "ActsMediaLibraryFileAssetTest" } ohos_app_scope("medialibrary_app_profile") { diff --git a/multimedia/medialibrary/mediaLibrary_fileAsset/Test.json b/multimedia/medialibrary/mediaLibrary_fileAsset/Test.json index 01f0a48a5462ff5ae780ee07a1eacf22a8718e64..57312dfa1ce30c3be94f1579034965b6cb22f196 100755 --- a/multimedia/medialibrary/mediaLibrary_fileAsset/Test.json +++ b/multimedia/medialibrary/mediaLibrary_fileAsset/Test.json @@ -9,24 +9,22 @@ "kits": [ { "type": "ShellKit", - "pre-push": [ - ], + "pre-push": [], "run-command": [ "rm -rf /storage/media/100/local/files/*", "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", "mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios,Documents}", - "mkdir -p /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata" + "mkdir -p /storage/media/100/local/temp" ] }, { "type": "PushKit", - "pre-push": [ - ], + "pre-push": [], "push": [ - "./resource/medialibrary/01.jpg ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.mp3 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.mp4 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.dat ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata" + "./resource/medialibrary/01.jpg ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.dat ->/storage/media/100/local/temp" ] }, { @@ -36,30 +34,27 @@ "mkdir -pv /storage/media/100/local/files/Videos/{ModifyCb,ModifyPro,RW,R,W,RW_cb,R_cb,W_cb,openClose}", "mkdir -pv /storage/media/100/local/files/Audios/{ModifyCb,ModifyPro,RW,R,W,RW_cb,R_cb,W_cb,openClose}", "mkdir -pv /storage/media/100/local/files/Documents/{ModifyCb,ModifyPro,RW,R,W,RW_cb,R_cb,W_cb,openClose}", - - "for d in RW_cb R_cb W_cb RW R W openClose; do for i in $$(seq 2); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", - "for d in RW_cb R_cb W_cb RW R W openClose; do for i in $$(seq 2); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", - "for d in RW_cb R_cb W_cb RW R W openClose; do for i in $$(seq 2); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", - "for d in RW_cb R_cb W_cb RW R W openClose; do for i in $$(seq 2); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;", - - "for d in ModifyCb ModifyPro; do for i in $$(seq 7); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", - "for d in ModifyCb ModifyPro; do for i in $$(seq 5); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", - "for d in ModifyCb ModifyPro; do for i in $$(seq 5); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", - "for d in ModifyCb ModifyPro; do for i in $$(seq 5); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;", - + "for d in RW_cb R_cb W_cb RW R W openClose; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", + "for d in RW_cb R_cb W_cb RW R W openClose; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", + "for d in RW_cb R_cb W_cb RW R W openClose; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", + "for d in RW_cb R_cb W_cb RW R W openClose; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;", + "for d in ModifyCb ModifyPro; do for i in $$(seq 7); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", + "for d in ModifyCb ModifyPro; do for i in $$(seq 5); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", + "for d in ModifyCb ModifyPro; do for i in $$(seq 5); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", + "for d in ModifyCb ModifyPro; do for i in $$(seq 5); do cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;", "chmod -R 777 /storage/media/100/local/files/*", "chmod -R 777 /data/service/el2/100/hmdfs/account/files/*", "hilog -Q pidoff", "hilog -p off", "hilog -b I", - "hilog -b D -D 0xD002B70", - "scanner_demo", + "hilog -b D -D 0xD002B70", + "scanner", "sleep 10" ] }, { "test-file-name": [ - "ActsMediaLibraryFileAsset.hap" + "ActsMediaLibraryFileAssetTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetCallback2.test.ets b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetCallback2.test.ets index 25b97f497a6de8b509d63f24b57000ab6647f9b8..da973774054627a73b142ec56bf9ee4291a72be0 100755 --- a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetCallback2.test.ets +++ b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetCallback2.test.ets @@ -33,7 +33,7 @@ export default function fileAssetCallback2Test(abilityContext) { beforeAll(async function () { console.info('beforeAll case'); await getPermission(); - await checkPresetsAssets(media, 'ActsMediaLibraryFileAsset') + await checkPresetsAssets(media, 'ActsMediaLibraryFileAssetTest') }); beforeEach(function () { console.info('beforeEach case'); @@ -66,8 +66,8 @@ export default function fileAssetCallback2Test(abilityContext) { selections: FILEKEY.ID + '= ?', selectionArgs: [id + ''], }; - const fetchFileResult2 = await media.getFileAssets(currentfetchOp); - const currentAsset = await fetchFileResult2.getFirstObject(); + const fetchFileResultById = await media.getFileAssets(currentfetchOp); + const currentAsset = await fetchFileResultById.getFirstObject(); expect(currentAsset[prop]).assertEqual(val); asset[prop] = oldVal; @@ -85,15 +85,15 @@ export default function fileAssetCallback2Test(abilityContext) { /** - * @tc.number : SUB_MEDIA_FILEASSET_commitModify_callback_001 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_001 * @tc.name : commitModify * @tc.desc : Modify displayName * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_FILEASSET_commitModify_callback_001', 0, async function (done) { - let testNum = 'SUB_MEDIA_FILEASSET_commitModify_callback_001' + it('SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_001', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_001' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyCb/', '01', IMAGE_TYPE); let prop = 'displayName' let val = new Date().getTime() + '.jpg' @@ -101,15 +101,15 @@ export default function fileAssetCallback2Test(abilityContext) { }); /** - * @tc.number : SUB_MEDIA_FILEASSET_commitModify_callback_002 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_002 * @tc.name : commitModify * @tc.desc : Modify title * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_FILEASSET_commitModify_callback_002', 0, async function (done) { - let testNum = 'SUB_MEDIA_FILEASSET_commitModify_callback_002' + it('SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_002', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_002' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyCb/', '02', IMAGE_TYPE); let prop = 'title' let val = new Date().getTime() + 'newTitle' @@ -117,15 +117,15 @@ export default function fileAssetCallback2Test(abilityContext) { }); /** - * @tc.number : SUB_MEDIA_FILEASSET_commitModify_callback_003 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_003 * @tc.name : commitModify * @tc.desc : Modify relativePath * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_FILEASSET_commitModify_callback_003', 0, async function (done) { - let testNum = 'SUB_MEDIA_FILEASSET_commitModify_callback_003' + it('SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_003', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_003' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyCb/', '03', IMAGE_TYPE); let prop = 'relativePath' let val = 'Pictures/Temp/' @@ -133,16 +133,16 @@ export default function fileAssetCallback2Test(abilityContext) { }); /** - * @tc.number : SUB_MEDIA_FILEASSET_commitModify_callback_004 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_004 * @tc.name : commitModify * @tc.desc : Modify orientation * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_FILEASSET_commitModify_callback_004', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_004', 0, async function (done) { - let testNum = 'SUB_MEDIA_FILEASSET_commitModify_callback_004' + let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_CALLBACK_004' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyCb/', '04', IMAGE_TYPE); let prop = 'orientation' let val = 1 @@ -150,22 +150,29 @@ export default function fileAssetCallback2Test(abilityContext) { }); /** - * @tc.number : SUB_MEDIA_FILEASSET_isDirectory_callback_001 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_ISDIRECTORY_CALLBACK_001 * @tc.name : isDirectory * @tc.desc : isDirectory asset * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_FILEASSET_isDirectory_callback_001', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_FILEASSET_ISDIRECTORY_CALLBACK_001', 0, async function (done) { try { - let testNum = 'SUB_MEDIA_FILEASSET_isDirectory_callback_001' + let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_ISDIRECTORY_CALLBACK_001' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyCb/', '05', IMAGE_TYPE); const fetchFileResult = await media.getFileAssets(fetchOp); const asset = await fetchFileResult.getFirstObject(); - const isDir = await asset.isDirectory(); - expect(!isDir).assertTrue(); - done(); + asset.isDirectory((err, isDir) =>{ + if (err) { + console.info(`${testNum} err : ${err}`); + expect.assertFail(); + done(); + return; + } + expect(isDir).assertEqual(false); + done(); + }); } catch (error) { console.info('FileAsset isDirectory 001 failed, message = ' + error); expect(false).assertTrue(); diff --git a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetPromise2.test.ets b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetPromise2.test.ets index 047a4b4392e66852ecce301a30f43a1b4c28a76a..2be8986ff0375aca82777eb1c497a83b44d23958 100755 --- a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetPromise2.test.ets +++ b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetPromise2.test.ets @@ -31,7 +31,7 @@ export default function fileAssetPromise2Test(abilityContext) { const media = mediaLibrary.getMediaLibrary(abilityContext); beforeAll(async function () { console.info('beforeAll case'); - await checkPresetsAssets(media, 'ActsMediaLibraryFileAsset') + await checkPresetsAssets(media, 'ActsMediaLibraryFileAssetTest') }); beforeEach(function () { console.info('beforeEach case'); @@ -58,8 +58,8 @@ export default function fileAssetPromise2Test(abilityContext) { selections: FILEKEY.ID + '= ?', selectionArgs: [id + ''], }; - const fetchFileResult2 = await media.getFileAssets(currentfetchOp); - const currentAsset = await fetchFileResult2.getFirstObject(); + const fetchFileResultById = await media.getFileAssets(currentfetchOp); + const currentAsset = await fetchFileResultById.getFirstObject(); expect(currentAsset[prop]).assertEqual(val); asset[prop] = oldVal; @@ -96,15 +96,15 @@ export default function fileAssetPromise2Test(abilityContext) { } } /** - * @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_001 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_001 * @tc.name : commitModify * @tc.desc : Modify displayName * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_FILEASSET_commitModify_promise_001', 0, async function (done) { - let testNum = 'SUB_MEDIA_FILEASSET_commitModify_promise_001' + it('SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_001', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_001' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyPro/', '01', IMAGE_TYPE); let prop = 'displayName' let val = new Date().getTime() + '.jpg' @@ -112,15 +112,15 @@ export default function fileAssetPromise2Test(abilityContext) { }); /** - * @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_002 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_002 * @tc.name : commitModify * @tc.desc : Modify title * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_FILEASSET_commitModify_promise_002', 0, async function (done) { - let testNum = 'SUB_MEDIA_FILEASSET_commitModify_promise_002' + it('SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_002', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_002' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyPro/', '02', IMAGE_TYPE); let prop = 'title' let val = new Date().getTime() + 'newTitle' @@ -128,15 +128,15 @@ export default function fileAssetPromise2Test(abilityContext) { }); /** - * @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_003 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_003 * @tc.name : commitModify * @tc.desc : Modify relativePath * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_FILEASSET_commitModify_promise_003', 0, async function (done) { - let testNum = 'SUB_MEDIA_FILEASSET_commitModify_promise_003' + it('SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_003', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_003' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyPro/', '03', IMAGE_TYPE); let prop = 'relativePath' let val = 'Pictures/Temp/' @@ -144,15 +144,15 @@ export default function fileAssetPromise2Test(abilityContext) { }); /** - * @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_004 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_004 * @tc.name : commitModify * @tc.desc : Modify orientation * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_FILEASSET_commitModify_promise_004', 0, async function (done) { - let testNum = 'SUB_MEDIA_FILEASSET_commitModify_promise_004' + it('SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_004', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_004' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyPro/', '04', IMAGE_TYPE); let prop = 'orientation' let val = 1 @@ -160,15 +160,15 @@ export default function fileAssetPromise2Test(abilityContext) { }); /** - * @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_005 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_005 * @tc.name : commitModify * @tc.desc : Modify uri * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_FILEASSET_commitModify_promise_005', 0, async function (done) { - let testNum = 'SUB_MEDIA_FILEASSET_commitModify_promise_005' + it('SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_005', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_005' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyPro/', '06', IMAGE_TYPE); let prop = 'uri' let val = 'newUri' @@ -176,15 +176,15 @@ export default function fileAssetPromise2Test(abilityContext) { }); /** - * @tc.number : SUB_MEDIA_FILEASSET_commitModify_promise_006 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_006 * @tc.name : commitModify * @tc.desc : Modify mediaType * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_FILEASSET_commitModify_promise_006', 0, async function (done) { - let testNum = 'SUB_MEDIA_FILEASSET_commitModify_promise_006' + it('SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_006', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_COMMITMODIFY_PROMISE_006' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyPro/', '07', IMAGE_TYPE); let prop = 'mediaType' let val = 'newMediaType' @@ -192,21 +192,21 @@ export default function fileAssetPromise2Test(abilityContext) { }); /** - * @tc.number : SUB_MEDIA_FILEASSET_isDirectory_promise_001 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_FILEASSET_ISDIRECTORY_PROMISE_001 * @tc.name : isDirectory * @tc.desc : isDirectory asset * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_FILEASSET_isDirectory_promise_001', 0, async function (done) { + it('SUB_MEDIA_MEDIALIBRARY_FILEASSET_ISDIRECTORY_PROMISE_001', 0, async function (done) { try { - let testNum = 'SUB_MEDIA_FILEASSET_isDirectory_promise_001' + let testNum = 'SUB_MEDIA_MEDIALIBRARY_FILEASSET_ISDIRECTORY_PROMISE_001' let fetchOp = nameFetchOps(testNum, 'Pictures/ModifyPro/', '05', IMAGE_TYPE); const fetchFileResult = await media.getFileAssets(fetchOp); const asset = await fetchFileResult.getFirstObject(); const isDir = await asset.isDirectory(); - expect(!isDir).assertTrue(); + expect(isDir).assertEqual(false); done(); } catch (error) { console.info('FileAsset isDirectory 001 failed, message = ' + error); diff --git a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestCallback.test.ets b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestCallback.test.ets index d97349b29f1c7a0ab4cbf67394a167460713a6c2..21f0275e12d7249008c307d97cfa75d86d8f4b88 100755 --- a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestCallback.test.ets @@ -26,13 +26,14 @@ import { checkAssetsCount, fetchOps, isNum, + fileIdFetchOps, } from '../../../../../../common'; export default function fileAssetTestCallbackTest(abilityContext) { describe('fileAssetTestCallbackTest', function () { const media = mediaLibrary.getMediaLibrary(abilityContext); beforeAll(async function () { console.info('beforeAll case'); - await checkPresetsAssets(media, 'ActsMediaLibraryFileAsset') + await checkPresetsAssets(media, 'ActsMediaLibraryFileAssetTest') }); beforeEach(function () { console.info('beforeEach case'); @@ -76,6 +77,12 @@ export default function fileAssetTestCallbackTest(abilityContext) { console.info(`fd1:${fd1},fd:${fd}`) await asset.close(fd); await asset1.close(fd1); + await sleep(50); + let newFetchFileResult = await media.getFileAssets(fileIdFetchOps(testNum, asset.id)); + let checkAssetCountPass = await checkAssetsCount(done, testNum, newFetchFileResult, 1); + if (!checkAssetCountPass) return; + let newAsset = await newFetchFileResult.getFirstObject(); + expect(newAsset.dateModified != asset.dateModified).assertTrue(); done(); }); diff --git a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestPromise.test.ets b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestPromise.test.ets index 3b25e698f9d3c25e1a09b81479151bf5910b717c..6871c1612eda267918e6525507bf6acaba639067 100755 --- a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestPromise.test.ets @@ -26,13 +26,14 @@ import { checkAssetsCount, fetchOps, isNum, + fileIdFetchOps, } from '../../../../../../common'; export default function fileAssetTestPromiseTest(abilityContext) { describe('fileAssetTestPromiseTest', function () { const media = mediaLibrary.getMediaLibrary(abilityContext); beforeAll(async function () { console.info('beforeAll case'); - await checkPresetsAssets(media, 'ActsMediaLibraryFileAsset') + await checkPresetsAssets(media, 'ActsMediaLibraryFileAssetTest') }); beforeEach(function () { console.info('beforeEach case'); @@ -70,6 +71,12 @@ export default function fileAssetTestPromiseTest(abilityContext) { console.info(`fd1:${fd1},fd:${fd}`) await asset.close(fd); await asset1.close(fd1); + await sleep(50); + let newFetchFileResult = await media.getFileAssets(fileIdFetchOps(testNum, asset.id)); + checkAssetCountPass = await checkAssetsCount(done, testNum, newFetchFileResult, 1); + if (!checkAssetCountPass) return; + let newAsset = await newFetchFileResult.getFirstObject(); + expect(newAsset.dateModified != asset.dateModified).assertTrue(); done(); } catch (error) { console.info(`${testNum} :: error: ${error}`); diff --git a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/module.json b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/module.json index 82fb1970953e8e320b149a3885c079feaf97b750..f3eedb3d449aa6a71d157dfea758a37ae1ec41f2 100755 --- a/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/module.json +++ b/multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:mainability_description", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/multimedia/medialibrary/mediaLibrary_fileKey/BUILD.gn b/multimedia/medialibrary/mediaLibrary_fileKey/BUILD.gn index 56278642724fb5bde61d615addec6b49ad996ec2..c4d65b026b13b3edba2ee44737b83f9abe9cf984 100755 --- a/multimedia/medialibrary/mediaLibrary_fileKey/BUILD.gn +++ b/multimedia/medialibrary/mediaLibrary_fileKey/BUILD.gn @@ -21,7 +21,7 @@ ohos_js_hap_suite("mediaLibrary_fileKey_hap") { ] ets2abc = true certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsMediaLibraryFileKey" + hap_name = "ActsMediaLibraryFileKeyTest" } ohos_app_scope("medialibrary_app_profile") { diff --git a/multimedia/medialibrary/mediaLibrary_fileKey/Test.json b/multimedia/medialibrary/mediaLibrary_fileKey/Test.json index fc3091c075f340d260fa6284196b6ef4a389f283..4c2ad25f09c24d1bbdb5af4d3bf51dba8faaf1da 100755 --- a/multimedia/medialibrary/mediaLibrary_fileKey/Test.json +++ b/multimedia/medialibrary/mediaLibrary_fileKey/Test.json @@ -9,24 +9,22 @@ "kits": [ { "type": "ShellKit", - "pre-push": [ - ], + "pre-push": [], "run-command": [ "rm -rf /storage/media/100/local/files/*", "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", "mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios,Documents}", - "mkdir -p /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata" + "mkdir -p /storage/media/100/local/temp" ] }, { "type": "PushKit", - "pre-push": [ - ], + "pre-push": [], "push": [ - "./resource/medialibrary/01.jpg ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.mp3 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.mp4 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.dat ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata" + "./resource/medialibrary/01.jpg ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.dat ->/storage/media/100/local/temp" ] }, { @@ -34,23 +32,21 @@ "run-command": [ "mkdir -pv /storage/media/100/local/files/Pictures/ImageInfo", "mkdir -pv /storage/media/100/local/files/Audios/Static", - - "cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/ImageInfo/01.jpg", - "cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp3 /storage/media/100/local/files/Audios/Static/01.mp3", - + "cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/ImageInfo/01.jpg", + "cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/Static/01.mp3", "chmod -R 777 /storage/media/100/local/files/*", "chmod -R 777 /data/service/el2/100/hmdfs/account/files/*", "hilog -Q pidoff", "hilog -p off", "hilog -b I", - "hilog -b D -D 0xD002B70", - "scanner_demo", + "hilog -b D -D 0xD002B70", + "scanner", "sleep 10" ] }, { "test-file-name": [ - "ActsMediaLibraryFileKey.hap" + "ActsMediaLibraryFileKeyTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/ets/test/filekeyTestCallback.test.ets b/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/ets/test/filekeyTestCallback.test.ets index 67651e0b38c0e15a8458ddafc988b984dfa8c456..1749cbea6b95f721b5cd4aa13cf8047632d8141f 100755 --- a/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/ets/test/filekeyTestCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/ets/test/filekeyTestCallback.test.ets @@ -25,7 +25,8 @@ import { checkAssetsCount, fetchOps, getPermission, -} from '../../../../../../common'; + checkAlbumsCount, +} from "../../../../../../common"; export default function filekeyTestCallbackTest(abilityContext) { describe('filekeyTestCallbackTest', function () { @@ -34,7 +35,7 @@ export default function filekeyTestCallbackTest(abilityContext) { beforeAll(async function () { console.info('beforeAll case'); await getPermission(); - await checkPresetsAssets(media, 'ActsMediaLibraryFileKey') + await checkPresetsAssets(media, 'ActsMediaLibraryFileKeyTest') }); beforeEach(function () { console.info('beforeEach case'); @@ -315,6 +316,8 @@ export default function filekeyTestCallbackTest(abilityContext) { console.info(`${testNum} currentFetchOp : ${JSON.stringify(currentFetchOp)}`) const albumList = await media.getAlbums(currentFetchOp); const album = albumList[0]; + const albumCountPass = await checkAlbumsCount(done, testNum, albumList, 1); + if (!albumCountPass) return; expect(album.albumName).assertEqual(albumName); done(); } catch (error) { diff --git a/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/ets/test/filekeyTestPromise.test.ets b/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/ets/test/filekeyTestPromise.test.ets index 2cdf95156e87b59e3a6e0eef77418ae5988fa157..e64a2e5cf1b5cb2495622e5b5235fbaaeea1bc97 100755 --- a/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/ets/test/filekeyTestPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/ets/test/filekeyTestPromise.test.ets @@ -21,7 +21,7 @@ import { sleep, IMAGE_TYPE, AUDIO_TYPE, - + checkAlbumsCount, FILEKEY, checkPresetsAssets, checkAssetsCount, @@ -35,7 +35,7 @@ export default function filekeyTestPromiseTest(abilityContext) { beforeAll(async function () { console.info('beforeAll case'); - await checkPresetsAssets(media, 'ActsMediaLibraryFileKey') + await checkPresetsAssets(media, 'ActsMediaLibraryFileKeyTest') }); beforeEach(function () { console.info('beforeEach case'); @@ -308,6 +308,8 @@ export default function filekeyTestPromiseTest(abilityContext) { } console.info(`${testNum} currentFetchOp : ${JSON.stringify(currentFetchOp)}`) const albumList = await media.getAlbums(currentFetchOp); + const albumCountPass = await checkAlbumsCount(done, testNum, albumList, 1); + if (!albumCountPass) return; const album = albumList[0]; expect(album.albumName).assertEqual(albumName); done(); diff --git a/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/module.json b/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/module.json index 82fb1970953e8e320b149a3885c079feaf97b750..f3eedb3d449aa6a71d157dfea758a37ae1ec41f2 100755 --- a/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/module.json +++ b/multimedia/medialibrary/mediaLibrary_fileKey/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:mainability_description", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/multimedia/medialibrary/mediaLibrary_fileResult/BUILD.gn b/multimedia/medialibrary/mediaLibrary_fileResult/BUILD.gn index d423dfe5299f07d9d12a1989eee8888f8c745ddb..e8f00055273373a3da246a574855e43602befca8 100755 --- a/multimedia/medialibrary/mediaLibrary_fileResult/BUILD.gn +++ b/multimedia/medialibrary/mediaLibrary_fileResult/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") @@ -21,7 +21,7 @@ ohos_js_hap_suite("mediaLibrary_fileResult_hap") { ] ets2abc = true certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsMediaLibraryFileResult" + hap_name = "ActsMediaLibraryFileResultTest" } ohos_app_scope("medialibrary_app_profile") { diff --git a/multimedia/medialibrary/mediaLibrary_fileResult/Test.json b/multimedia/medialibrary/mediaLibrary_fileResult/Test.json index d9a6902ee925e494b0def5cc2810d4d362fc5b4f..500dae51b67ed310f7da2db38fb22add8c039cf1 100755 --- a/multimedia/medialibrary/mediaLibrary_fileResult/Test.json +++ b/multimedia/medialibrary/mediaLibrary_fileResult/Test.json @@ -9,53 +9,48 @@ "kits": [ { "type": "ShellKit", - "pre-push": [ - ], + "pre-push": [], "run-command": [ "rm -rf /storage/media/100/local/files/*", "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", "mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios,Documents}", - "mkdir -p /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata" + "mkdir -p /storage/media/100/local/temp" ] }, { "type": "PushKit", - "pre-push": [ - ], + "pre-push": [], "push": [ - "./resource/medialibrary/01.jpg ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.mp3 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.mp4 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.dat ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata" + "./resource/medialibrary/01.jpg ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.dat ->/storage/media/100/local/temp" ] }, { "type": "ShellKit", "run-command": [ - "mkdir -pv /storage/media/100/local/files/Pictures/{Static,ImageInfo}", + "mkdir -pv /storage/media/100/local/files/Pictures/Static", "mkdir -pv /storage/media/100/local/files/Videos/Static", "mkdir -pv /storage/media/100/local/files/Audios/Static", "mkdir -pv /storage/media/100/local/files/Documents/Static", - - "for d in Static; do for i in $$(seq 4); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", - "for d in Static; do for i in $$(seq 4); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", - "for d in Static; do for i in $$(seq 4); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", - "for d in Static; do for i in $$(seq 100); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;", - "cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/ImageInfo/01.jpg", - + "for d in Static; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", + "for d in Static; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", + "for d in Static; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", + "for d in Static; do for i in $$(seq 100); do cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;", "chmod -R 777 /storage/media/100/local/files/*", "chmod -R 777 /data/service/el2/100/hmdfs/account/files/*", "hilog -Q pidoff", "hilog -p off", "hilog -b I", - "hilog -b D -D 0xD002B70", - "scanner_demo", + "hilog -b D -D 0xD002B70", + "scanner", "sleep 10" ] }, { "test-file-name": [ - "ActsMediaLibraryFileResult.hap" + "ActsMediaLibraryFileResultTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/multimedia/medialibrary/mediaLibrary_fileResult/entry/src/main/ets/test/fetchFileResultCallback.test.ets b/multimedia/medialibrary/mediaLibrary_fileResult/entry/src/main/ets/test/fetchFileResultCallback.test.ets index 5c8a96454f6d5f3930c23e37f17380d0f80953c1..57f6244a6f41ada6551f85e70d8225b73c1ed8f2 100755 --- a/multimedia/medialibrary/mediaLibrary_fileResult/entry/src/main/ets/test/fetchFileResultCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_fileResult/entry/src/main/ets/test/fetchFileResultCallback.test.ets @@ -33,7 +33,7 @@ export default function fetchFileResultCallbackTest(abilityContext) { beforeAll(async function () { console.info('beforeAll case'); await getPermission(); - await checkPresetsAssets(media, 'ActsMediaLibraryFileResult'); + await checkPresetsAssets(media, 'ActsMediaLibraryFileResultTest'); }); beforeEach(function () { console.info('beforeEach case'); diff --git a/multimedia/medialibrary/mediaLibrary_fileResult/entry/src/main/ets/test/fetchFileResultPromise.test.ets b/multimedia/medialibrary/mediaLibrary_fileResult/entry/src/main/ets/test/fetchFileResultPromise.test.ets index 9939450769f2fe291838e91aab9bbfa8db62de8b..ab3280ba593275445c78cfd6ad660431f77a3271 100755 --- a/multimedia/medialibrary/mediaLibrary_fileResult/entry/src/main/ets/test/fetchFileResultPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_fileResult/entry/src/main/ets/test/fetchFileResultPromise.test.ets @@ -34,7 +34,7 @@ export default function fetchFileResultPromiseTest(abilityContext) { const media = mediaLibrary.getMediaLibrary(abilityContext); beforeAll(async function () { console.info('beforeAll case'); - await checkPresetsAssets(media, 'ActsMediaLibraryFileResult'); + await checkPresetsAssets(media, 'ActsMediaLibraryFileResultTest'); }); beforeEach(function () { console.info('beforeEach case'); diff --git a/multimedia/medialibrary/mediaLibrary_fileResult/entry/src/main/module.json b/multimedia/medialibrary/mediaLibrary_fileResult/entry/src/main/module.json index 8e0400fc761d17bbb4800f146c44da034a4bb89e..f1957f30e322ce1c4b3bc18f9313261fec7433ba 100755 --- a/multimedia/medialibrary/mediaLibrary_fileResult/entry/src/main/module.json +++ b/multimedia/medialibrary/mediaLibrary_fileResult/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:mainability_description", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/multimedia/medialibrary/mediaLibrary_getThumbnail/Test.json b/multimedia/medialibrary/mediaLibrary_getThumbnail/Test.json index 969fe647f173112b10865281fe68d9f13352e4e0..79c4179c8ecc8869ffacfcd3f46b652c49ffc66f 100755 --- a/multimedia/medialibrary/mediaLibrary_getThumbnail/Test.json +++ b/multimedia/medialibrary/mediaLibrary_getThumbnail/Test.json @@ -15,7 +15,7 @@ "rm -rf /storage/media/100/local/files/*", "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.MediaLibraryDataA/*", "mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios}", - "mkdir -p /data/accounts/account_0/appdata/com.ohos.medialibrary.MediaLibraryDataA" + "mkdir -p /storage/media/100/local/temp" ] }, { @@ -23,9 +23,9 @@ "pre-push": [ ], "push": [ - "./resource/medialibrary/01.jpg ->/data/accounts/account_0/appdata/com.ohos.medialibrary.MediaLibraryDataA", - "./resource/medialibrary/01.mp3 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.MediaLibraryDataA", - "./resource/medialibrary/01.mp4 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.MediaLibraryDataA" + "./resource/medialibrary/01.jpg ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp" ] }, { @@ -35,9 +35,9 @@ "mkdir -pv /storage/media/100/local/files/Videos/Thumbnail", "mkdir -pv /storage/media/100/local/files/Audios/Thumbnail", - "cp /data/accounts/account_0/appdata/com.ohos.medialibrary.MediaLibraryDataA/01.jpg /storage/media/100/local/files/Pictures/Thumbnail", - "cp /data/accounts/account_0/appdata/com.ohos.medialibrary.MediaLibraryDataA/01.mp3 /storage/media/100/local/files/Audios/Thumbnail", - "cp /data/accounts/account_0/appdata/com.ohos.medialibrary.MediaLibraryDataA/01.mp4 /storage/media/100/local/files/Videos/Thumbnail", + "cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/Thumbnail", + "cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/Thumbnail", + "cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/Thumbnail", "chmod -R 777 /storage/media/100/local/files/*", "chmod -R 777 /data/service/el2/100/hmdfs/account/files/*", @@ -45,11 +45,8 @@ "hilog -p off", "hilog -b I", "hilog -b D -D 0xD002B70", - "scanner_demo", + "scanner", "sleep 10" - ], - "teardown-command":[ - "rm -rf /storage/media/100/local/files/*" ] }, { diff --git a/multimedia/medialibrary/mediaLibrary_getThumbnail/entry/src/main/module.json b/multimedia/medialibrary/mediaLibrary_getThumbnail/entry/src/main/module.json index 82fb1970953e8e320b149a3885c079feaf97b750..f3eedb3d449aa6a71d157dfea758a37ae1ec41f2 100755 --- a/multimedia/medialibrary/mediaLibrary_getThumbnail/entry/src/main/module.json +++ b/multimedia/medialibrary/mediaLibrary_getThumbnail/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:mainability_description", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/AppScope/app.json b/multimedia/medialibrary/mediaLibrary_js_standard/AppScope/app.json deleted file mode 100755 index 841282ae47b98590bdbc8aea744fbbcd178e9195..0000000000000000000000000000000000000000 --- a/multimedia/medialibrary/mediaLibrary_js_standard/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app":{ - "bundleName":"ohos.acts.multimedia.mediaLibrary", - "vendor":"huawei", - "versionCode":1000000, - "versionName":"1.0.0", - "debug":false, - "icon":"$media:icon", - "label":"$string:entry_MainAbility", - "description":"$string:mainability_description", - "distributedNotificationEnabled":true, - "keepAlive":true, - "singleUser":true, - "minAPIVersion":8, - "targetAPIVersion":8, - "car":{ - "apiCompatibleVersion":8, - "singleUser":false - } - } -} diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/BUILD.gn b/multimedia/medialibrary/mediaLibrary_js_standard/BUILD.gn deleted file mode 100755 index f2951e28ac2a4fd6061569b7ad04f9a7762ae72a..0000000000000000000000000000000000000000 --- a/multimedia/medialibrary/mediaLibrary_js_standard/BUILD.gn +++ /dev/null @@ -1,40 +0,0 @@ -# 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("mediaLibrary_js_hap") { - hap_profile = "entry/src/main/module.json" - deps = [ - ":mediaLibrary_js_assets", - ":mediaLibrary_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsMediaLibraryJsTest" -} - -ohos_app_scope("medialibrary_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("mediaLibrary_js_assets") { - source_dir = "entry/src/main/ets" -} - -ohos_resources("mediaLibrary_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":medialibrary_app_profile" ] - hap_profile = "entry/src/main/module.json" -} diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/Test.json b/multimedia/medialibrary/mediaLibrary_js_standard/Test.json deleted file mode 100755 index 868729d527d50c7ce4712ed14372457ae3530ab8..0000000000000000000000000000000000000000 --- a/multimedia/medialibrary/mediaLibrary_js_standard/Test.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "description": "Configuration for mediaLibrary Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "600000", - "package": "ohos.acts.multimedia.mediaLibrary", - "shell-timeout": "600000" - }, - "kits": [ - { - "type": "ShellKit", - "pre-push": [ - ], - "run-command": [ - "rm -rf /storage/media/100/local/files/*", - "rm -rf /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/*", - "mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios,Documents}", - "mkdir -p /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata" - ] - }, - { - "type": "PushKit", - "pre-push": [ - ], - "push": [ - "./resource/medialibrary/01.jpg ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.mp3 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.mp4 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.dat ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata" - ] - }, - { - "type": "ShellKit", - "run-command": [ - "mkdir -pv /storage/media/100/local/files/Pictures/{Static,Static01,Album/Static,Dynamic,Dynamic01,Dynamic022,DeleteCb01,AblumInfo,DeletePro01,Dynamic03,Temp}", - "mkdir -pv /storage/media/100/local/files/Videos/{Static,Static01,Album/Static,Dynamic,Dynamic01,Dynamic02,DeleteCb01,AblumInfo,DeletePro01,Dynamic03}", - "mkdir -pv /storage/media/100/local/files/Audios/{Static,Static01,Album/Static,Dynamic,Dynamic01,Dynamic02,DeleteCb01,AblumInfo,DeletePro01,Dynamic03}", - "mkdir -pv /storage/media/100/local/files/Documents/{Static,Static01,Album/Static,Dynamic,Dynamic01,Dynamic02,DeleteCb01,AblumInfo,DeletePro01}", - "for d in Static Album/Static Dynamic Dynamic01 Dynamic022 AblumInfo; do for i in $$(seq 3); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", - "for d in Static Album/Static Dynamic Dynamic01 Dynamic02 AblumInfo; do for i in $$(seq 3); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", - "for d in Static Album/Static Dynamic Dynamic01 Dynamic02 AblumInfo; do for i in $$(seq 3); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", - "for d in Static Album/Static Dynamic Dynamic01 Dynamic02 AblumInfo; do for i in $$(seq 3); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;", - - "for d in DeleteCb01 DeletePro01 Static01; do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/$$d ;done;", - "for d in DeleteCb01 DeletePro01 Static01; do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp3 /storage/media/100/local/files/Audios/$$d ;done;", - "for d in DeleteCb01 DeletePro01 Static01; do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp4 /storage/media/100/local/files/Videos/$$d ;done;", - "for d in DeleteCb01 DeletePro01 Static01; do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.dat /storage/media/100/local/files/Documents/$$d ;done;", - - "chmod -R 777 /storage/media/100/local/files/*", - "chmod -R 777 /data/service/el2/100/hmdfs/account/files/*", - "hilog -Q pidoff", - "hilog -b D -D 0xD002B70", - "aa start -a com.ohos.photos.MainAbility -b com.ohos.photos", - "sleep 10", - "cem publish -e usual.event.SCREEN_OFF", - "sleep 10" - ] - }, - { - "test-file-name": [ - "ActsMediaLibraryJsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/pages/index/index.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/pages/index/index.ets deleted file mode 100755 index 578783ebc22394b888f6d961ce7ef6be4bd7a51f..0000000000000000000000000000000000000000 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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'; - -import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" -import testsuite from "../../test/List.test.ets" - - -@Entry -@Component -struct Index { - - aboutToAppear(){ - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - globalThis.abilityWant.parameters.timeout = 70000; - configService.setConfig(globalThis.abilityWant.parameters) - console.info('testsuite()---->') - testsuite(globalThis.abilityContext) - core.execute() - console.info('core.execute()---->') - } - - build() { - Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/List.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/List.test.ets deleted file mode 100755 index eba0e5a516c9183276b04ac764a0500de4a09df0..0000000000000000000000000000000000000000 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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 getPermissionTest from './getPermission.test.ets' - -export default function testsuite(abilityContext) { - getPermissionTest() -} diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/favtrashTestCallBack.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/favtrashTestCallBack.test.ets deleted file mode 100755 index 217f4f744857daa1247d9b43db8aa0f5e36a5759..0000000000000000000000000000000000000000 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/favtrashTestCallBack.test.ets +++ /dev/null @@ -1,426 +0,0 @@ -/* - * 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 mediaLibrary from '@ohos.multimedia.mediaLibrary'; -import featureAbility from '@ohos.ability.featureAbility'; - -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; -import { - sleep, -} from '../../../../../../common'; -describe('file.callback.test.js', function () { - var context = featureAbility.getContext(); - console.info('MediaLibraryTest : getMediaLibrary IN'); - var media = mediaLibrary.getMediaLibrary(context); - console.info('MediaLibraryTest : getMediaLibrary OUT'); - beforeAll(function () { - console.info('File Callback MediaLibraryTest: beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed.'); - }); - beforeEach(function () { - console.info('File Callback MediaLibraryTest: beforeEach: Prerequisites at the test case level, which are executed before each test case is executed.'); - }); - afterEach(async function () { await sleep(200)}); - afterAll(function () { - console.info('File Callback MediaLibraryTest: afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed'); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_007_01 - * @tc.name : favorite - * @tc.desc : favorite by true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_007_01', 0, async function (done) { - const asset = await media.createAsset(mediaType, 'image01.jpg', path); - asset.favorite(true, (err) => { - if (err == undefined) { - console.info('MediaLibraryTest : ASSET_CALLBACK favorite 007_01 success'); - expect(true).assertTrue(); - done(); - } else { - console.info('MediaLibraryTest : ASSET_CALLBACK favorite 007_01 fail, message = ' + err); - expect(false).assertTrue(); - done(); - } - }); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_007_02 - * @tc.name : favorite - * @tc.desc : favorite by false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_007_02', 0, async function (done) { - const asset = await media.createAsset(mediaType, 'image02.jpg', path); - asset.favorite(false, (err) => { - if (err == undefined) { - console.info('MediaLibraryTest : ASSET_CALLBACK favorite 007_02 success'); - expect(true).assertTrue(); - done(); - } else { - console.info('MediaLibraryTest : ASSET_CALLBACK favorite 007_02 fail, message = ' + err); - expect(false).assertTrue(); - done(); - } - }); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_007_03 - * @tc.name : favorite - * @tc.desc : favorite by 666 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_007_03', 0, async function (done) { - const asset = await media.createAsset(mediaType, 'image03.jpg', path); - asset.favorite(666, (err) => { - if (err == undefined) { - console.info('MediaLibraryTest : ASSET_CALLBACK favorite 007_03 success'); - expect(false).assertTrue(); - done(); - } else { - console.info('MediaLibraryTest : ASSET_CALLBACK favorite 007_03 fail, message = ' + err); - expect(true).assertTrue(); - done(); - } - }); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_007_04 - * @tc.name : favorite - * @tc.desc : favorite by '666' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_007_04', 0, async function (done) { - const asset = await media.createAsset(mediaType, 'image04.jpg', path); - asset.favorite('666', (err) => { - if (err == undefined) { - console.info('MediaLibraryTest : ASSET_CALLBACK favorite 007_04 success'); - expect(false).assertTrue(); - done(); - } else { - console.info('MediaLibraryTest : ASSET_CALLBACK favorite 007_04 fail, message = ' + err); - expect(true).assertTrue(); - done(); - } - }); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_007_05 - * @tc.name : favorite - * @tc.desc : favorite by 0.666 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_007_05', 0, async function (done) { - const asset = await media.createAsset(mediaType, 'image05.jpg', path); - asset.favorite(0.666, (err) => { - if (err == undefined) { - console.info('MediaLibraryTest : ASSET_CALLBACK favorite 007_05 success'); - expect(false).assertTrue(); - done(); - } else { - console.info('MediaLibraryTest : ASSET_CALLBACK favorite 007_05 fail, message = ' + err); - expect(true).assertTrue(); - done(); - } - }); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_007_06 - * @tc.name : favorite - * @tc.desc : favorite by null - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_CALLBACK_007_06', 0, async function (done) { - const asset = await media.createAsset(mediaType, 'image06.jpg', path); - asset.favorite(null, (err) => { - if (err == undefined) { - console.info('MediaLibraryTest : ASSET_CALLBACK favorite 007_06 success'); - expect(false).assertTrue(); - done(); - } else { - console.info('MediaLibraryTest : ASSET_CALLBACK favorite 007_06 fail, message = ' + err); - expect(true).assertTrue(); - done(); - } - }); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ISFAV_ASSET_CALLBACK_008_01 - * @tc.name : isFavorite - * @tc.desc : Is Favourite true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_ISFAV_ASSET_CALLBACK_008_01', 0, async function (done) { - const asset = await media.createAsset(mediaType, 'image07.jpg', path); - await asset.favorite(true); - asset.isFavorite((err, isFavorite) => { - if (err == undefined && isFavorite == true) { - console.info('MediaLibraryTest : ASSET_CALLBACK isFavorite 008_01 isFavorite = ' + isFavorite); - expect(true).assertTrue(); - done(); - } else { - console.info('MediaLibraryTest : ASSET_CALLBACK isFavorite 008_01 fail, message = ' + err); - expect(false).assertTrue(); - done(); - } - }); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ISFAV_ASSET_CALLBACK_008_02 - * @tc.name : isFavorite - * @tc.desc : Is Favourite true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_ISFAV_ASSET_CALLBACK_008_02', 0, async function (done) { - const asset = await media.createAsset(mediaType, 'image0702.jpg', path); - await asset.favorite(false); - asset.isFavorite((err, isFavorite) => { - if (err == undefined && isFavorite == false) { - console.info('MediaLibraryTest : ASSET_CALLBACK isFavorite 008_02 isFavorite = ' + isFavorite); - expect(true).assertTrue(); - done(); - } else { - console.info('MediaLibraryTest : ASSET_CALLBACK isFavorite 008_02 fail, message = ' + err); - expect(false).assertTrue(); - done(); - } - }); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_CALLBACK_009_01 - * @tc.name : trash - * @tc.desc : Trash by true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_CALLBACK_009_01', 0, async function (done) { - const asset = await media.createAsset(mediaType, 'image08.jpg', path); - asset.trash(true, (err) => { - if (err == undefined) { - console.info('MediaLibraryTest : ASSET_CALLBACK trash 009_01'); - expect(true).assertTrue(); - done(); - } else { - console.info('MediaLibraryTest : ASSET_CALLBACK trash 009_01 fail ,message = ', err); - expect(false).assertTrue(); - done(); - } - }); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_CALLBACK_009_02 - * @tc.name : trash - * @tc.desc : Trash by false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_CALLBACK_009_02', 0, async function (done) { - const asset = await media.createAsset(mediaType, 'image09.jpg', path); - asset.trash(false, (err) => { - if (err == undefined) { - console.info('MediaLibraryTest : ASSET_CALLBACK trash 009_02'); - expect(true).assertTrue(); - done(); - } else { - console.info('MediaLibraryTest : ASSET_CALLBACK trash 009_02 fail ,message = ', err); - expect(false).assertTrue(); - done(); - } - }); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_CALLBACK_009_03 - * @tc.name : trash - * @tc.desc : Trash by 666 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_CALLBACK_009_03', 0, async function (done) { - const asset = await media.createAsset(mediaType, 'image10.jpg', path); - asset.trash(666, (err) => { - if (err == undefined) { - console.info('MediaLibraryTest : ASSET_CALLBACK trash 009_03'); - expect(false).assertTrue(); - done(); - } else { - console.info('MediaLibraryTest : ASSET_CALLBACK trash 009_03 fail ,message = ', err); - expect(true).assertTrue(); - done(); - } - }); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_CALLBACK_009_04 - * @tc.name : trash - * @tc.desc : Trash by '666' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_CALLBACK_009_04', 0, async function (done) { - const asset = await media.createAsset(mediaType, 'image11.jpg', path); - asset.trash('666', (err) => { - if (err == undefined) { - console.info('MediaLibraryTest : ASSET_CALLBACK trash 009_04'); - expect(false).assertTrue(); - done(); - } else { - console.info('MediaLibraryTest : ASSET_CALLBACK trash 009_04 fail ,message = ', err); - expect(true).assertTrue(); - done(); - } - }); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_CALLBACK_009_05 - * @tc.name : trash - * @tc.desc : Trash by 0.666 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_CALLBACK_009_05', 0, async function (done) { - const asset = await media.createAsset(mediaType, 'image12.jpg', path); - asset.trash(0.666, (err) => { - if (err == undefined) { - console.info('MediaLibraryTest : ASSET_CALLBACK trash 009_05'); - expect(false).assertTrue(); - done(); - } else { - console.info('MediaLibraryTest : ASSET_CALLBACK trash 009_05 fail ,message = ', err); - expect(true).assertTrue(); - done(); - } - }); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_CALLBACK_009_06 - * @tc.name : trash - * @tc.desc : Trash by null - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_CALLBACK_009_06', 0, async function (done) { - const asset = await media.createAsset(mediaType, 'image13.jpg', path); - asset.trash(null, (err) => { - if (err == undefined) { - console.info('MediaLibraryTest : ASSET_CALLBACK trash 009_06'); - expect(false).assertTrue(); - done(); - } else { - console.info('MediaLibraryTest : ASSET_CALLBACK trash 009_06 fail ,message = ', err); - expect(true).assertTrue(); - done(); - } - }); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ISTRASH_ASSET_CALLBACK_0010_01 - * @tc.name : isTrash - * @tc.desc : isTrash true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_ISTRASH_ASSET_CALLBACK_0010_01', 0, async function (done) { - const asset = await media.createAsset(mediaType, 'image14.jpg', path); - await asset.trash(true); - asset.isTrash((err, isTrash) => { - if (err == undefined && isTrash == true) { - console.info('MediaLibraryTest : ASSET_CALLBACK trash 0010_01'); - expect(true).assertTrue(); - done(); - } else { - console.info('MediaLibraryTest : ASSET_CALLBACK trash 0010_01 fail ,message = ', err); - expect(false).assertTrue(); - done(); - } - }); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ISTRASH_ASSET_CALLBACK_0010_02 - * @tc.name : isTrash - * @tc.desc : isTrash false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_ISTRASH_ASSET_CALLBACK_0010_02', 0, async function (done) { - const asset = await media.createAsset(mediaType, 'image15.jpg', path); - await asset.trash(false); - asset.isTrash((err, isTrash) => { - if (err == undefined && isTrash == false) { - console.info('MediaLibraryTest : ASSET_CALLBACK trash 0010_02'); - expect(true).assertTrue(); - done(); - } else { - console.info('MediaLibraryTest : ASSET_CALLBACK trash 0010_02 fail ,message = ', err); - expect(false).assertTrue(); - done(); - } - }); - }); -}); diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/favtrashTestPromise.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/favtrashTestPromise.test.ets deleted file mode 100755 index e228bf7a803b261675d8e9577428bd6ea61d7b40..0000000000000000000000000000000000000000 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/favtrashTestPromise.test.ets +++ /dev/null @@ -1,422 +0,0 @@ -/* - * 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 mediaLibrary from '@ohos.multimedia.mediaLibrary'; -import featureAbility from '@ohos.ability.featureAbility'; - -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; -import { - sleep, -} from '../../../../../../common'; -describe('file.promise.test.js', function () { - var context = featureAbility.getContext(); - console.info('MediaLibraryTest : getMediaLibrary IN'); - var media = mediaLibrary.getMediaLibrary(context); - console.info('MediaLibraryTest : getMediaLibrary OUT'); - beforeAll(function () { - console.info('File Promise MediaLibraryTest: beforeAll : Prerequisites at the test suite level, which are executed before the test suite is executed.'); - }); - beforeEach(function () { - console.info('File Promise MediaLibraryTest: beforeEach: Prerequisites at the test case level, which are executed before each test case is executed.'); - }); - afterEach(async function () { await sleep(200)}); - afterAll(function () { - console.info('File Promise MediaLibraryTest: afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed'); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_007_01 - * @tc.name : favorite - * @tc.desc : favorite by true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_007_01', 0, async function (done) { - try { - const asset = await media.createAsset(mediaType, 'image01.jpg', path); - await asset.favorite(true); - console.info('MediaLibraryTest : ASSET_PROMISE favorite 007_01 success'); - expect(true).assertTrue(); - } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE close 007_01 fail, message = ' + error); - expect(false).assertTrue(); - } - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_007_02 - * @tc.name : favorite - * @tc.desc : favorite by false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_007_02', 0, async function (done) { - try { - const asset = await media.createAsset(mediaType, 'image02.jpg', path); - await asset.favorite(false); - console.info('MediaLibraryTest : ASSET_PROMISE favorite 007_02 success'); - expect(true).assertTrue(); - } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE close 007_02 fail, message = ' + error); - expect(false).assertTrue(); - } - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_007_03 - * @tc.name : favorite - * @tc.desc : favorite by 666 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_007_03', 0, async function (done) { - try { - const asset = await media.createAsset(mediaType, 'image03.jpg', path); - await asset.favorite(666); - console.info('MediaLibraryTest : ASSET_PROMISE favorite 007_03 success'); - expect(false).assertTrue(); - } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE close 007_03 fail, message = ' + error); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_007_04 - * @tc.name : favorite - * @tc.desc : favorite by '666' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_007_04', 0, async function (done) { - try { - const asset = await media.createAsset(mediaType, 'image04.jpg', path); - await asset.favorite('666'); - console.info('MediaLibraryTest : ASSET_PROMISE favorite 007_04 success'); - expect(false).assertTrue(); - } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE close 007_04 fail, message = ' + error); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_007_05 - * @tc.name : favorite - * @tc.desc : favorite by 0.666 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_007_05', 0, async function (done) { - try { - const asset = await media.createAsset(mediaType, 'image05.jpg', path); - await asset.favorite(0.666); - console.info('MediaLibraryTest : ASSET_PROMISE favorite 007_05 success'); - expect(false).assertTrue(); - } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE close 007_05 fail, message = ' + error); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_007_06 - * @tc.name : favorite - * @tc.desc : favorite by null - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_FAV_ASSET_PROMISE_007_06', 0, async function (done) { - try { - const asset = await media.createAsset(mediaType, 'image06.jpg', path); - await asset.favorite(); - console.info('MediaLibraryTest : ASSET_PROMISE favorite 007_06 success'); - expect(false).assertTrue(); - } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE close 007_06 fail, message = ' + error); - expect(true).assertTrue(); - } - done(); - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ISFAV_ASSET_PROMISE_008_01 - * @tc.name : isFavorite - * @tc.desc : Is Favourite - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_ISFAV_ASSET_PROMISE_008_01', 0, async function (done) { - try { - const asset = await media.createAsset(mediaType, 'image07.jpg', path); - await asset.favorite(true); - let isFavorite = await asset.isFavorite(); - if (isFavorite == true) { - console.info('MediaLibraryTest : ASSET_PROMISE isFavorite = ' + isFavorite); - expect(true).assertTrue(); - } else { - console.info('MediaLibraryTest : ASSET_PROMISE isFavorite = ' + isFavorite); - expect(true).assertTrue(); - } - done(); - } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE isFavorite fail, message = ' + error); - expect(false).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ISFAV_ASSET_PROMISE_008_02 - * @tc.name : isFavorite - * @tc.desc : Is Favourite - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_ISFAV_ASSET_PROMISE_008_02', 0, async function (done) { - try { - const asset = await media.createAsset(mediaType, 'image0702.jpg', path); - await asset.favorite(false); - let isFavorite = await asset.isFavorite(); - if (isFavorite == false) { - console.info('MediaLibraryTest : ASSET_PROMISE isFavorite = ' + isFavorite); - expect(true).assertTrue(); - } else { - console.info('MediaLibraryTest : ASSET_PROMISE isFavorite = ' + isFavorite); - expect(true).assertTrue(); - } - done(); - } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE isFavorite fail, message = ' + error); - expect(false).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_PROMISE_009_01 - * @tc.name : trash - * @tc.desc : Trash by true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_PROMISE_009_01', 0, async function (done) { - try { - const asset = await media.createAsset(mediaType, 'image08.jpg', path); - await asset.trash(true); - console.info('MediaLibraryTest : ASSET_PROMISE trash 009_01'); - expect(true).assertTrue(); - done(); - } catch (trashError) { - console.info('MediaLibraryTest : ASSET_PROMISE trash 009_01 fail ,message = ', trashError); - expect(false).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_PROMISE_009_02 - * @tc.name : trash - * @tc.desc : Trash by false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_PROMISE_009_02', 0, async function (done) { - try { - const asset = await media.createAsset(mediaType, 'image09.jpg', path); - await asset.trash(false); - console.info('MediaLibraryTest : ASSET_PROMISE trash 009_02'); - expect(true).assertTrue(); - done(); - } catch (trashError) { - console.info('MediaLibraryTest : ASSET_PROMISE trash 009_02 fail ,message = ', trashError); - expect(false).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_PROMISE_009_03 - * @tc.name : trash - * @tc.desc : Trash by 666 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_PROMISE_009_03', 0, async function (done) { - try { - const asset = await media.createAsset(mediaType, 'image10.jpg', path); - await asset.trash(666); - console.info('MediaLibraryTest : ASSET_PROMISE trash 009_03'); - expect(false).assertTrue(); - done(); - } catch (trashError) { - console.info('MediaLibraryTest : ASSET_PROMISE trash 009_03 fail ,message = ' + trashError); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_PROMISE_009_04 - * @tc.name : trash - * @tc.desc : Trash by '666' - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_PROMISE_009_04', 0, async function (done) { - try { - const asset = await media.createAsset(mediaType, 'image11.jpg', path); - await asset.trash('666'); - console.info('MediaLibraryTest : ASSET_PROMISE trash 009_04'); - expect(false).assertTrue(); - done(); - } catch (trashError) { - console.info('MediaLibraryTest : ASSET_PROMISE trash 009_04 fail ,message = ' + trashError); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_PROMISE_009_05 - * @tc.name : trash - * @tc.desc : Trash by 0.666 - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_PROMISE_009_05', 0, async function (done) { - try { - const asset = await media.createAsset(mediaType, 'image12.jpg', path); - await asset.trash(0.666); - console.info('MediaLibraryTest : ASSET_PROMISE trash 009_05'); - expect(false).assertTrue(); - done(); - } catch (trashError) { - console.info('MediaLibraryTest : ASSET_PROMISE trash 009_05 fail ,message = ' + trashError); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_PROMISE_009_06 - * @tc.name : trash - * @tc.desc : Trash by null - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_TRA_ASSET_PROMISE_009_06', 0, async function (done) { - try { - const asset = await media.createAsset(mediaType, 'image13.jpg', path); - await asset.trash(); - console.info('MediaLibraryTest : ASSET_PROMISE trash 009_06'); - expect(false).assertTrue(); - done(); - } catch (trashError) { - console.info('MediaLibraryTest : ASSET_PROMISE trash 009_06 fail ,message = ' + trashError); - expect(true).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ISTRASH_ASSET_PROMISE_0010_01 - * @tc.name : isTrash - * @tc.desc : isTrash true - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_ISTRASH_ASSET_PROMISE_0010_01', 0, async function (done) { - try { - const asset = await media.createAsset(mediaType, 'image14.jpg', path); - await asset.trash(true); - let isTrash = await asset.isTrash(); - console.info('MediaLibraryTest : ASSET_PROMISE Trash 0010_01 = ' + isTrash); - if (isTrash) { - expect(true).assertTrue(); - } else { - expect(false).assertTrue(); - } - done(); - } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE isTrash 0010_01 fail, message = ' + error); - expect(false).assertTrue(); - done(); - } - }); - - /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ISTRASH_ASSET_PROMISE_0010_02 - * @tc.name : isTrash - * @tc.desc : isTrash false - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - - it('SUB_MEDIA_MEDIALIBRARY_ISTRASH_ASSET_PROMISE_0010_02', 0, async function (done) { - try { - const asset = await media.createAsset(mediaType, 'image15.jpg', path); - await asset.trash(false); - let isTrash = await asset.isTrash(); - console.info('MediaLibraryTest : ASSET_PROMISE Trash 0010_02 = ' + isTrash); - if (!isTrash) { - expect(true).assertTrue(); - } else { - expect(false).assertTrue(); - } - done(); - } catch (error) { - console.info('MediaLibraryTest : ASSET_PROMISE isTrash 0010_02 fail, message = ' + error); - expect(false).assertTrue(); - done(); - } - }); -}); diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/getPermission.test.ets b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/getPermission.test.ets deleted file mode 100755 index 39b1976021e6869b995a6cf0ca0b890451821841..0000000000000000000000000000000000000000 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/test/getPermission.test.ets +++ /dev/null @@ -1,47 +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 { describe, beforeAll,afterAll, it, expect } from 'deccjsunit/index'; -import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; -import bundle from '@ohos.bundle'; - -export default function getPermissionTest() { - describe("get_permission", function () { - - /** - * @tc.number SUB_DF_GRANT_USER_GRANTED_PERMISSION_0000 - * @tc.name grant_user_granted_permission_async_000 - * @tc.desc Test grantUserGrantedPermission() interfaces, grant permission. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 0 - * @tc.require - */ - it("grant_user_granted_permission_async_000", 0, async function (done) { - let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.mediaLibrary', 0, 100); - let tokenID = appInfo.accessTokenId; - let atManager = abilityAccessCtrl.createAtManager(); - let result1 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.MEDIA_LOCATION", 1); - let result2 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.READ_MEDIA", 1); - let result3 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.WRITE_MEDIA", 1); - let isGranted1 = await atManager.verifyAccessToken(tokenID, "ohos.permission.MEDIA_LOCATION"); - let isGranted2 = await atManager.verifyAccessToken(tokenID, "ohos.permission.READ_MEDIA"); - let isGranted3 = await atManager.verifyAccessToken(tokenID, "ohos.permission.WRITE_MEDIA"); - expect(result1 == 0 && result2 == 0 && result3 == 0).assertTrue(); - expect(isGranted1 == 0 && isGranted2 == 0 && isGranted3 == 0).assertTrue(); - done(); - }); - }); -} \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/module.json b/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/module.json deleted file mode 100755 index 8e0400fc761d17bbb4800f146c44da034a4bb89e..0000000000000000000000000000000000000000 --- a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/module.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:mainability_description", - "mainElement": "MainAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "ohos.acts.multimedia.mediaLibrary.MainAbility", - "srcEntrance": "./ets/MainAbility/MainAbility.ts", - "description": "$string:mainability_description", - "icon": "$media:icon", - "label": "$string:entry_MainAbility", - "visible": true, - "orientation": "portrait", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities":[ - "entity.system.home" - ] - } - ] - } - ], - "requestPermissions": [ - { - "name": "ohos.permission.GET_BUNDLE_INFO", - "reason": "use ohos.permission.GET_BUNDLE_INFO" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "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" - } - ] - } -} diff --git a/multimedia/medialibrary/mediaLibrary_mediafetchoptions/BUILD.gn b/multimedia/medialibrary/mediaLibrary_mediafetchoptions/BUILD.gn index 6664cc18d9ad2a53694069ebe594451fb58180be..45fae924f4e70d51e06d6017155c2b0e4f22a217 100644 --- a/multimedia/medialibrary/mediaLibrary_mediafetchoptions/BUILD.gn +++ b/multimedia/medialibrary/mediaLibrary_mediafetchoptions/BUILD.gn @@ -21,7 +21,7 @@ ohos_js_hap_suite("mediaLibrary_mediafetchoptions_hap") { ] ets2abc = true certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsMediaLibraryMediafetchoptions" + hap_name = "ActsMediaLibraryMediafetchoptionsTest" } ohos_app_scope("medialibrary_app_profile") { diff --git a/multimedia/medialibrary/mediaLibrary_mediafetchoptions/Test.json b/multimedia/medialibrary/mediaLibrary_mediafetchoptions/Test.json index b139ac132dd70065fa52448ac4bbdb91a9bcbc7f..ca5d990be8ac41dde9429af98c56862ff7c5e396 100644 --- a/multimedia/medialibrary/mediaLibrary_mediafetchoptions/Test.json +++ b/multimedia/medialibrary/mediaLibrary_mediafetchoptions/Test.json @@ -9,24 +9,22 @@ "kits": [ { "type": "ShellKit", - "pre-push": [ - ], + "pre-push": [], "run-command": [ "rm -rf /storage/media/100/local/files/*", "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", "mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios,Documents}", - "mkdir -p /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata" + "mkdir -p /storage/media/100/local/temp" ] }, { "type": "PushKit", - "pre-push": [ - ], + "pre-push": [], "push": [ - "./resource/medialibrary/01.jpg ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.mp3 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.mp4 ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata", - "./resource/medialibrary/01.dat ->/data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata" + "./resource/medialibrary/01.jpg ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.dat ->/storage/media/100/local/temp" ] }, { @@ -36,25 +34,23 @@ "mkdir -pv /storage/media/100/local/files/Videos/Static", "mkdir -pv /storage/media/100/local/files/Audios/Static", "mkdir -pv /storage/media/100/local/files/Documents/Static", - - "for d in Static; do for i in $$(seq 2); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", - "for d in Static; do for i in $$(seq 2); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", - "for d in Static; do for i in $$(seq 2); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", - "for d in Static; do for i in $$(seq 2); do cp /data/accounts/account_0/appdata/com.ohos.medialibrary.medialibrarydata/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;", - + "for d in Static; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", + "for d in Static; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", + "for d in Static; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", + "for d in Static; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;", "chmod -R 777 /storage/media/100/local/files/*", "chmod -R 777 /data/service/el2/100/hmdfs/account/files/*", "hilog -Q pidoff", "hilog -p off", "hilog -b I", - "hilog -b D -D 0xD002B70", - "scanner_demo", + "hilog -b D -D 0xD002B70", + "scanner", "sleep 10" ] }, { "test-file-name": [ - "ActsMediaLibraryMediafetchoptions.hap" + "ActsMediaLibraryMediafetchoptionsTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/multimedia/medialibrary/mediaLibrary_mediafetchoptions/entry/src/main/ets/test/mediafetchoptionsCallback.test.ets b/multimedia/medialibrary/mediaLibrary_mediafetchoptions/entry/src/main/ets/test/mediafetchoptionsCallback.test.ets index 5515856551af2fb395b7d3fba5c7575ecea36b1f..bb226a7657142e6df1f8865b5108c2061d98fabd 100644 --- a/multimedia/medialibrary/mediaLibrary_mediafetchoptions/entry/src/main/ets/test/mediafetchoptionsCallback.test.ets +++ b/multimedia/medialibrary/mediaLibrary_mediafetchoptions/entry/src/main/ets/test/mediafetchoptionsCallback.test.ets @@ -30,8 +30,8 @@ import { getPermission, } from '../../../../../../common'; -export default function filekeyTestCallbackTest(abilityContext) { - describe('filekeyTestCallbackTest', function () { +export default function mediafetchoptionsCallback(abilityContext) { + describe('mediafetchoptionsCallback', function () { const media = mediaLibrary.getMediaLibrary(abilityContext); beforeAll(async function () { console.info('beforeAll case'); @@ -87,60 +87,60 @@ export default function filekeyTestCallbackTest(abilityContext) { } } /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ASSET_URI_Callback_001 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_ASSET_URI_CALLBACK_001 * @tc.name : uri * @tc.desc : serach image asset by uri * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MEDIALIBRARY_ASSET_URI_Callback_001', 0, async function (done) { - let testNum = 'SUB_MEDIA_MEDIALIBRARY_ASSET_URI_Callback_001'; + it('SUB_MEDIA_MEDIALIBRARY_ASSET_URI_CALLBACK_001', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_ASSET_URI_CALLBACK_001'; let currentFetchOp = fetchOps(testNum, 'Pictures/Static/', IMAGE_TYPE); let type = 'image'; await serachUri(done, testNum, currentFetchOp, type); }); /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ASSET_URI_Callback_002 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_ASSET_URI_CALLBACK_002 * @tc.name : uri * @tc.desc : serach audio asset by uri * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MEDIALIBRARY_ASSET_URI_Callback_002', 0, async function (done) { - let testNum = 'SUB_MEDIA_MEDIALIBRARY_ASSET_URI_Callback_002'; + it('SUB_MEDIA_MEDIALIBRARY_ASSET_URI_CALLBACK_002', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_ASSET_URI_CALLBACK_002'; let currentFetchOp = fetchOps(testNum, 'Audios/Static/', AUDIO_TYPE); let type = 'audio'; await serachUri(done, testNum, currentFetchOp, type); }); /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ASSET_URI_Callback_003 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_ASSET_URI_CALLBACK_003 * @tc.name : uri * @tc.desc : serach video asset by uri * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MEDIALIBRARY_ASSET_URI_Callback_003', 0, async function (done) { - let testNum = 'SUB_MEDIA_MEDIALIBRARY_ASSET_URI_Callback_003'; + it('SUB_MEDIA_MEDIALIBRARY_ASSET_URI_CALLBACK_003', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_ASSET_URI_CALLBACK_003'; let currentFetchOp = fetchOps(testNum, 'Videos/Static/', VIDEO_TYPE); let type = 'video'; await serachUri(done, testNum, currentFetchOp, type); }); /** - * @tc.number : SUB_MEDIA_MEDIALIBRARY_ASSET_URI_Callback_004 + * @tc.number : SUB_MEDIA_MEDIALIBRARY_ASSET_URI_CALLBACK_004 * @tc.name : uri * @tc.desc : serach file asset by uri * @tc.size : MEDIUM * @tc.type : Function * @tc.level : Level 0 */ - it('SUB_MEDIA_MEDIALIBRARY_ASSET_URI_Callback_004', 0, async function (done) { - let testNum = 'SUB_MEDIA_MEDIALIBRARY_ASSET_URI_Callback_004'; + it('SUB_MEDIA_MEDIALIBRARY_ASSET_URI_CALLBACK_004', 0, async function (done) { + let testNum = 'SUB_MEDIA_MEDIALIBRARY_ASSET_URI_CALLBACK_004'; let currentFetchOp = fetchOps(testNum, 'Documents/Static/', FILE_TYPE); let type = 'file'; await serachUri(done, testNum, currentFetchOp, type); diff --git a/multimedia/medialibrary/mediaLibrary_mediafetchoptions/entry/src/main/ets/test/mediafetchoptionsPromise.test.ets b/multimedia/medialibrary/mediaLibrary_mediafetchoptions/entry/src/main/ets/test/mediafetchoptionsPromise.test.ets index f276a31f9795af1f774fe3bb37d3374e77e17dd9..1742657dc8500fbd7831951e1d673a7e0e205199 100644 --- a/multimedia/medialibrary/mediaLibrary_mediafetchoptions/entry/src/main/ets/test/mediafetchoptionsPromise.test.ets +++ b/multimedia/medialibrary/mediaLibrary_mediafetchoptions/entry/src/main/ets/test/mediafetchoptionsPromise.test.ets @@ -30,8 +30,8 @@ import { getPermission, } from '../../../../../../common'; -export default function filekeyTestPromiseTest(abilityContext) { - describe('filekeyTestPromiseTest', function () { +export default function mediafetchoptionsPromise(abilityContext) { + describe('mediafetchoptionsPromise', function () { const media = mediaLibrary.getMediaLibrary(abilityContext); beforeAll(async function () { console.info('beforeAll case'); diff --git a/multimedia/medialibrary/mediaLibrary_mediafetchoptions/entry/src/main/module.json b/multimedia/medialibrary/mediaLibrary_mediafetchoptions/entry/src/main/module.json index 82fb1970953e8e320b149a3885c079feaf97b750..f3eedb3d449aa6a71d157dfea758a37ae1ec41f2 100644 --- a/multimedia/medialibrary/mediaLibrary_mediafetchoptions/entry/src/main/module.json +++ b/multimedia/medialibrary/mediaLibrary_mediafetchoptions/entry/src/main/module.json @@ -6,6 +6,7 @@ "description": "$string:mainability_description", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/multimedia/medialibrary/mediaLibrary_trash/AppScope/app.json b/multimedia/medialibrary/mediaLibrary_trash/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..5139eaad5d5fd2e2de13b4970785d6fa8ae1a4ba --- /dev/null +++ b/multimedia/medialibrary/mediaLibrary_trash/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app":{ + "bundleName":"ohos.acts.multimedia.mediaLibrary", + "vendor":"huawei", + "versionCode":1000000, + "versionName":"1.0.0", + "debug":false, + "icon":"$media:icon", + "label":"$string:entry_MainAbility", + "description":"$string:mainability_description", + "distributedNotificationEnabled":true, + "keepAlive":true, + "singleUser":true, + "minAPIVersion":8, + "targetAPIVersion":8, + "car":{ + "apiCompatibleVersion":8, + "singleUser":false + } + } +} diff --git a/multimedia/medialibrary/mediaLibrary_trash/AppScope/resources/base/element/string.json b/multimedia/medialibrary/mediaLibrary_trash/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c1dee63527ae5e3c37f3736f6b68189e8df6f201 --- /dev/null +++ b/multimedia/medialibrary/mediaLibrary_trash/AppScope/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "MediaLibraryJSTestMain" + }, + { + "name": "mainability_description", + "value": "MediaLibraryJSTestMain Ability" + } + ] +} \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_trash/AppScope/resources/base/media/app_icon.png b/multimedia/medialibrary/mediaLibrary_trash/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/medialibrary/mediaLibrary_trash/AppScope/resources/base/media/app_icon.png differ diff --git a/multimedia/medialibrary/mediaLibrary_trash/BUILD.gn b/multimedia/medialibrary/mediaLibrary_trash/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..42b7cdb55ae78ef97565b020cee8ab4492d9814e --- /dev/null +++ b/multimedia/medialibrary/mediaLibrary_trash/BUILD.gn @@ -0,0 +1,40 @@ +# 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("mediaLibrary_trash_js_hap") { + hap_profile = "entry/src/main/module.json" + deps = [ + ":mediaLibrary_js_assets", + ":mediaLibrary_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsMediaLibraryTrashJsTest" +} + +ohos_app_scope("medialibrary_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("mediaLibrary_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("mediaLibrary_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":medialibrary_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/multimedia/medialibrary/mediaLibrary_trash/Test.json b/multimedia/medialibrary/mediaLibrary_trash/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..f9fb1236da44863fe9298c9d3e4fe8369a2035b8 --- /dev/null +++ b/multimedia/medialibrary/mediaLibrary_trash/Test.json @@ -0,0 +1,63 @@ +{ + "description": "Configuration for mediaLibrary Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "ohos.acts.multimedia.mediaLibrary", + "shell-timeout": "600000" + }, + "kits": [ + { + "type": "ShellKit", + "pre-push": [ + ], + "run-command": [ + "rm -rf /storage/media/100/local/files/*", + "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.MediaLibraryDataA/*", + "mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios,Documents}", + "mkdir -p /storage/media/100/local/temp" + ] + }, + { + "type": "PushKit", + "pre-push": [ + ], + "push": [ + "./resource/medialibrary/01.jpg ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.dat ->/storage/media/100/local/temp" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "mkdir -pv /storage/media/100/local/files/Pictures/{trash,trashCb}", + "mkdir -pv /storage/media/100/local/files/Videos/{trash,trashCb}", + "mkdir -pv /storage/media/100/local/files/Audios/{trash,trashCb}", + "mkdir -pv /storage/media/100/local/files/Documents/{trash,trashCb}", + + "for d in trash trashCb; do for i in $$(seq 3); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", + "for d in trash trashCb; do for i in $$(seq 3); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", + "for d in trash trashCb; do for i in $$(seq 3); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", + "for d in trash trashCb; do for i in $$(seq 3); do cp /storage/media/100/local/temp/01.dat /storage/media/100/local/files/Documents/$$d/0$$i.dat; done;done;", + + "chmod -R 777 /storage/media/100/local/files/*", + "chmod -R 777 /data/service/el2/100/hmdfs/account/files/*", + "hilog -Q pidoff", + "hilog -p off", + "hilog -b I", + "hilog -b D -D 0xD002B70", + "scanner", + "sleep 10" + ] + }, + { + "test-file-name": [ + "ActsMediaLibraryTrashJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/Application/AbilityStage.ts b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..51cb02ba3f5c7011c1cd433d07deebd47a195704 --- /dev/null +++ b/multimedia/medialibrary/mediaLibrary_trash/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/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/MainAbility/MainAbility.ts b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..2f9d6d1f23f95d9fc891fbc550cd5a589cfb6c89 --- /dev/null +++ b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,36 @@ +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") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", 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") + } +}; \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/pages/index/index.ets b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b15b989b903b686d0e3766c5662235d1695b0193 --- /dev/null +++ b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,68 @@ +/* + * 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'; + +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" +import testsuite from "../../test/List.test.ets" + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters) + console.info('testsuite()---->') + testsuite(globalThis.abilityContext) + core.execute() + console.info('core.execute()---->') + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/pages/second/second.ets b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/pages/second/second.ets new file mode 100644 index 0000000000000000000000000000000000000000..1c1c727ff11ecc97909f482c35268db87ae23bb4 --- /dev/null +++ b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/pages/second/second.ets @@ -0,0 +1,43 @@ +/* + * 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 router from '@system.router'; + +@Entry +@Component +struct Second { + private content: string = "Second Page" + + build() { + Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('back to index') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + router.back() + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/test/List.test.ets b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..273d2768b008ab334ab2019892815840ee94cbf4 --- /dev/null +++ b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* + * 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 trashPromise from './trashPromise.test.ets' +import trashCallback from './trashCallback.test.ets' +export default function testsuite(abilityContext) { + trashCallback(abilityContext) + trashPromise(abilityContext) +} \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/test/trashCallback.test.ets b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/test/trashCallback.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1dc947ff1926bf55648dfa7d9258c72d5dcfef3c --- /dev/null +++ b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/test/trashCallback.test.ets @@ -0,0 +1,414 @@ +/* + * 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 mediaLibrary from "@ohos.multimedia.mediaLibrary"; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index"; +import { + sleep, + IMAGE_TYPE, + AUDIO_TYPE, + VIDEO_TYPE, + FILE_TYPE, + fetchOps, + getPermission, + albumFetchOps, + fileIdFetchOps, +} from "../../../../../../common"; + +export default function trashCallback(abilityContext) { + describe("trashCallback", function () { + beforeAll(async function () { + await getPermission(); + console.info("beforeAll case"); + }); + beforeEach(function () { + console.info("beforeEach case"); + }); + afterEach(async function () { + console.info("afterEach case"); + await sleep; + }); + afterAll(async function () { + console.info("afterAll case"); + }); + + const media = mediaLibrary.getMediaLibrary(abilityContext); + + async function setTrash(done, testNum, databasefFetchOps, ablumFetchOps, noAlbum) { + try { + // database info + let databaseFetchFileResult = await media.getFileAssets(databasefFetchOps); + let count = databaseFetchFileResult.getCount(); + //album info + if (!noAlbum) { + let albumList = await media.getAlbums(ablumFetchOps); + let album = albumList[0]; + let albumFetchFileResult = await album.getFileAssets(); + let albumFilesCount = albumFetchFileResult.getCount(); + expect(albumFilesCount).assertEqual(count); + } + // file info + let asset = await databaseFetchFileResult.getFirstObject(); + let id = asset.id; + let istrash = await asset.isTrash(); + expect(istrash).assertFalse(); + // trash operation + asset.trash(true, async (err) => { + if (err) { + console.info(`${testNum} err: ${err}`); + expect(false).assertTrue(); + done(); + return; + } + asset.isTrash(async (err, trashState) => { + if (err) { + console.info(`${testNum} err: ${err}`); + expect(false).assertTrue(); + done(); + return; + } + expect(trashState).assertTrue(); + try { + // after trash database info + databaseFetchFileResult = await media.getFileAssets(databasefFetchOps); + let databaseCount = databaseFetchFileResult.getCount(); + + expect(databaseCount).assertEqual(count - 1); + //album info + if (!noAlbum) { + let albumList = await media.getAlbums(ablumFetchOps); + let album = albumList[0]; + let albumFetchFileResult = await album.getFileAssets(); + let albumFilesCount = albumFetchFileResult.getCount(); + expect(albumFilesCount).assertEqual(count - 1); + } + let assetOpts = fileIdFetchOps(id); + let trashAssetResult = await media.getFileAssets(assetOpts); + let afterTrashAssetConut = trashAssetResult.getCount(); + expect(afterTrashAssetConut).assertEqual(0); + await asset.trash(false); + done(); + } catch (error) { + console.info(`${testNum} error: ${error}`); + expect(false).assertTrue(); + done(); + } + }); + }); + } catch (error) { + console.info(`${testNum} error: ${error}`); + expect(false).assertTrue(); + done(); + } + } + + async function recovery(done, testNum, databasefFetchOps, ablumFetchOps, noAlbum) { + try { + let databaseFetchFileResult = await media.getFileAssets(databasefFetchOps); + let count = databaseFetchFileResult.getCount(); + let asset = await databaseFetchFileResult.getFirstObject(); + let id = asset.id; + await asset.trash(true); + + let istrash = await asset.isTrash(); + if (!istrash) { + console.info(`${testNum} istrash failed: ${istrash}`); + expect(istrash).assertFalse(); + return; + } + asset.trash(false, async (err) => { + if (err) { + console.info(`${testNum} err: ${err}`); + expect(false).assertTrue(); + done(); + return; + } + asset.isTrash(async (err, trashState) => { + if (err) { + console.info(`${testNum} err: ${err}`); + expect(false).assertTrue(); + done(); + return; + } + expect(trashState).assertFalse(); + try { + databaseFetchFileResult = await media.getFileAssets(databasefFetchOps); + let databaseCount = databaseFetchFileResult.getCount(); + expect(databaseCount).assertEqual(count); + //album info + if (!noAlbum) { + let albumList = await media.getAlbums(ablumFetchOps); + let album = albumList[0]; + let albumFetchFileResult = await album.getFileAssets(); + let albumFilesCount = albumFetchFileResult.getCount(); + expect(albumFilesCount).assertEqual(count); + } + // asset after trash Conut + let assetOpts = fileIdFetchOps(testNum, id); + let recoveryAssetResult = await media.getFileAssets(assetOpts); + let afterRecoveryAssetConut = recoveryAssetResult.getCount(); + expect(afterRecoveryAssetConut).assertEqual(1); + let recoveryAsset = await recoveryAssetResult.getFirstObject(); + let recoveryAssetState = await recoveryAsset.isTrash(); + expect(recoveryAssetState).assertFalse(); + done(); + } catch (error) { + console.info(`${testNum} error: ${error}`); + expect(false).assertTrue(); + done(); + } + }); + }); + } catch (error) { + console.info(`${testNum} error: ${error}`); + expect(false).assertTrue(); + done(); + } + } + async function trashError(done, testNum, databasefFetchOps, value) { + try { + let databaseFetchFileResult = await media.getFileAssets(databasefFetchOps); + let asset = await databaseFetchFileResult.getFirstObject(); + let count = databaseFetchFileResult.getCount(); + console.info(`${testNum}count:${count}`); + try { + asset.trash(value, async (err) => { + if (err) { + console.info(`${testNum} err: ${err}`); + expect(false).assertTrue(); + done(); + return; + } + expect(false).assertTrue(); + done(); + }); + } catch (error) { + console.info(`${testNum} error: ${error}`); + let databaseFetchFileResult = await media.getFileAssets(databasefFetchOps); + let count2 = databaseFetchFileResult.getCount(); + expect(count).assertEqual(count2); + done(); + } + } catch (error) { + console.info(`${testNum} error: ${error}`); + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_CALLBACK_01_001 + * @tc.name : trash + * @tc.desc : image asset Trash by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_CALLBACK_01_001", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_CALLBACK_01_001"; + let rOps = fetchOps(testNum, "Pictures/trashCb/", IMAGE_TYPE); + let aOps = albumFetchOps(testNum, "Pictures/", "trashCb", IMAGE_TYPE); + let noAlbum = false; + await setTrash(done, testNum, rOps, aOps, noAlbum); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_CALLBACK_01_002 + * @tc.name : trash + * @tc.desc : video asset Trash by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_CALLBACK_01_002", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_CALLBACK_01_002"; + let rOps = fetchOps(testNum, "Videos/trashCb/", VIDEO_TYPE); + let aOps = albumFetchOps(testNum, "Videos/", "trashCb", VIDEO_TYPE); + let noAlbum = false; + await setTrash(done, testNum, rOps, aOps, noAlbum); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_CALLBACK_01_003 + * @tc.name : trash + * @tc.desc : audio asset Trash by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_CALLBACK_01_003", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_CALLBACK_01_003"; + let rOps = fetchOps(testNum, "Audios/trashCb/", AUDIO_TYPE); + let aOps = albumFetchOps(testNum, "Audios/", "trashCb", AUDIO_TYPE); + let noAlbum = false; + await setTrash(done, testNum, rOps, aOps, noAlbum); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_CALLBACK_01_004 + * @tc.name : trash + * @tc.desc : file asset Trash by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_CALLBACK_01_004", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_CALLBACK_01_004"; + let rOps = fetchOps(testNum, "Documents/trashCb/", FILE_TYPE); + let aOps = albumFetchOps(testNum, "Documents/", "trashCb", FILE_TYPE); + let noAlbum = true; + await setTrash(done, testNum, rOps, aOps, noAlbum); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_CALLBACK_02_001 + * @tc.name : trash + * @tc.desc : image asset Trash by 1 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_CALLBACK_02_001", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_CALLBACK_02_001"; + let rOps = fetchOps(testNum, "Pictures/trashCb/", IMAGE_TYPE); + let value = 1; + await trashError(done, testNum, rOps, value); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_CALLBACK_02_002 + * @tc.name : trash + * @tc.desc : image asset Trash by 'abc' + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_CALLBACK_02_002", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_CALLBACK_02_002"; + let rOps = fetchOps(testNum, "Pictures/trashCb/", IMAGE_TYPE); + let value = "abc"; + await trashError(done, testNum, rOps, value); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_CALLBACK_02_003 + * @tc.name : trash + * @tc.desc : image asset Trash by {a:10} + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_CALLBACK_02_003", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_CALLBACK_02_003"; + let rOps = fetchOps(testNum, "Pictures/trashCb/", IMAGE_TYPE); + let value = { a: 10 }; + await trashError(done, testNum, rOps, value); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_CALLBACK_02_004 + * @tc.name : trash + * @tc.desc : image asset Trash by undefined + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_CALLBACK_02_004", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_CALLBACK_02_004"; + let rOps = fetchOps(testNum, "Pictures/trashCb/", IMAGE_TYPE); + let value = undefined; + await trashError(done, testNum, rOps, value); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_CALLBACK_02_005 + * @tc.name : trash + * @tc.desc : image asset Trash by null + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_CALLBACK_02_005", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_CALLBACK_02_005"; + let rOps = fetchOps(testNum, "Pictures/trashCb/", IMAGE_TYPE); + let value = null; + await trashError(done, testNum, rOps, value); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_CALLBACK_03_001 + * @tc.name : trash + * @tc.desc : image asset Trash by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_CALLBACK_03_001", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_CALLBACK_03_001"; + let rOps = fetchOps(testNum, "Pictures/trash/", IMAGE_TYPE); + let aOps = albumFetchOps(testNum, "Pictures/", "trash", IMAGE_TYPE); + let noAlbum = false; + await recovery(done, testNum, rOps, aOps, noAlbum); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_CALLBACK_03_002 + * @tc.name : trash + * @tc.desc : video asset Trash by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_CALLBACK_03_002", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_CALLBACK_03_002"; + let rOps = fetchOps(testNum, "Videos/trash/", VIDEO_TYPE); + let aOps = albumFetchOps(testNum, "Videos/", "trash", VIDEO_TYPE); + let noAlbum = false; + await recovery(done, testNum, rOps, aOps, noAlbum); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_CALLBACK_03_003 + * @tc.name : trash + * @tc.desc : audio asset Trash by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_CALLBACK_03_003", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_CALLBACK_03_003"; + let rOps = fetchOps(testNum, "Audios/trash/", AUDIO_TYPE); + let aOps = albumFetchOps(testNum, "Audios/", "trash", AUDIO_TYPE); + let noAlbum = false; + await recovery(done, testNum, rOps, aOps, noAlbum); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_CALLBACK_03_004 + * @tc.name : trash + * @tc.desc : file asset Trash by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_CALLBACK_03_004", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_CALLBACK_03_004"; + let rOps = fetchOps(testNum, "Documents/trash/", FILE_TYPE); + let aOps = albumFetchOps(testNum, "Documents/", "trash", FILE_TYPE); + let noAlbum = true; + await recovery(done, testNum, rOps, aOps, noAlbum); + }); + }); +} diff --git a/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/test/trashPromise.test.ets b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/test/trashPromise.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..65efe07957d8b55b0fdd36977ff80376b5c14c03 --- /dev/null +++ b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/ets/test/trashPromise.test.ets @@ -0,0 +1,365 @@ +/* + * 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 mediaLibrary from "@ohos.multimedia.mediaLibrary"; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index"; +import { + sleep, + IMAGE_TYPE, + AUDIO_TYPE, + VIDEO_TYPE, + FILE_TYPE, + fetchOps, + fileIdFetchOps, + albumFetchOps, +} from "../../../../../../common"; + +export default function trashPromise(abilityContext) { + describe("trashPromise", function () { + beforeAll(async function () { + console.info("beforeAll case"); + }); + beforeEach(function () { + console.info("beforeEach case"); + }); + afterEach(async function () { + console.info("afterEach case"); + await sleep(); + }); + afterAll(async function () { + console.info("afterAll case"); + }); + + const media = mediaLibrary.getMediaLibrary(abilityContext); + async function setTrash(done, testNum, databasefFetchOps, ablumFetchOps, noAlbum = false) { + try { + // database info + let databaseFetchFileResult = await media.getFileAssets(databasefFetchOps); + let count = databaseFetchFileResult.getCount(); + + //album info + if (!noAlbum) { + var albumList = await media.getAlbums(ablumFetchOps); + var album = albumList[0]; + var albumFetchFileResult = await album.getFileAssets(); + var albumFilesCount = albumFetchFileResult.getCount(); + expect(albumFilesCount).assertEqual(count); + } + + // file info + let asset = await databaseFetchFileResult.getFirstObject(); + let id = asset.id; + let istrash = await asset.isTrash(); + expect(istrash).assertFalse(); + // trash operation + await asset.trash(true); + istrash = await asset.isTrash(); + console.info(`${testNum} istrash: ${istrash}`); + databaseFetchFileResult = await media.getFileAssets(databasefFetchOps); + let databaseCount = databaseFetchFileResult.getCount(); + expect(databaseCount).assertEqual(count - 1); + //album info + if (!noAlbum) { + var albumList = await media.getAlbums(ablumFetchOps); + var album = albumList[0]; + var albumFetchFileResult = await album.getFileAssets(); + var albumFilesCount = albumFetchFileResult.getCount(); + expect(databaseCount).assertEqual(count - 1); + } + + // asset after trash Conut + let assetOpts = fileIdFetchOps(id); + let trashAssetResult = await media.getFileAssets(assetOpts); + let afterTrashAssetConut = trashAssetResult.getCount(); + expect(afterTrashAssetConut).assertEqual(0); + await asset.trash(false); + done(); + } catch (error) { + console.info(`${testNum} error: ${error}`); + expect(false).assertTrue(); + done(); + } + } + + async function trashError(done, testNum, databasefFetchOps, value) { + try { + let databaseFetchFileResult = await media.getFileAssets(databasefFetchOps); + let asset = await databaseFetchFileResult.getFirstObject(); + let count = databaseFetchFileResult.getCount(); + try { + await asset.trash(value); + expect(false).assertTrue(); + done(); + } catch (error) { + console.info(`${testNum} error: ${error}`); + let databaseFetchFileResult = await media.getFileAssets(databasefFetchOps); + let count2 = databaseFetchFileResult.getCount(); + expect(count).assertEqual(count2); + done(); + } + } catch (error) { + console.info(`${testNum} error: ${error}`); + expect(false).assertTrue(); + done(); + } + } + + async function recovery(done, testNum, databasefFetchOps, ablumFetchOps, noAlbum) { + try { + let databaseFetchFileResult = await media.getFileAssets(databasefFetchOps); + let count = databaseFetchFileResult.getCount(); + let asset = await databaseFetchFileResult.getFirstObject(); + let id = asset.id; + await asset.trash(true); + + let istrash = await asset.isTrash(); + if (!istrash) { + console.info(`${testNum} istrash failed: ${istrash}`); + expect(istrash).assertFalse(); + return; + } + await asset.trash(false); + + databaseFetchFileResult = await media.getFileAssets(databasefFetchOps); + let databaseCount = databaseFetchFileResult.getCount(); + expect(databaseCount).assertEqual(count); + //album info + if (!noAlbum) { + let albumList = await media.getAlbums(ablumFetchOps); + let album = albumList[0]; + let albumFetchFileResult = await album.getFileAssets(); + let albumFilesCount = albumFetchFileResult.getCount(); + expect(albumFilesCount).assertEqual(count); + } + + // asset after trash Conut + let assetOpts = fileIdFetchOps(testNum, id); + let recoveryAssetResult = await media.getFileAssets(assetOpts); + let afterRecoveryAssetConut = recoveryAssetResult.getCount(); + expect(afterRecoveryAssetConut).assertEqual(1); + let recoveryAsset = await recoveryAssetResult.getFirstObject(); + let recoveryAssetState = await recoveryAsset.isTrash(); + expect(recoveryAssetState).assertFalse(); + + done(); + } catch (error) { + console.info(`${testNum} error: ${error}`); + expect(false).assertTrue(); + done(); + } + } + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_PROMISE_01_001 + * @tc.name : trash + * @tc.desc : image asset Trash by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_PROMISE_01_001", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_PROMISE_01_001"; + let rOps = fetchOps(testNum, "Pictures/trash/", IMAGE_TYPE); + let aOps = albumFetchOps(testNum, "Pictures/", "trash", IMAGE_TYPE); + let noAlbum = false; + await setTrash(done, testNum, rOps, aOps, noAlbum); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_PROMISE_01_002 + * @tc.name : trash + * @tc.desc : video asset Trash by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_PROMISE_01_002", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_PROMISE_01_002"; + let rOps = fetchOps(testNum, "Videos/trash/", VIDEO_TYPE); + let aOps = albumFetchOps(testNum, "Videos/", "trash", VIDEO_TYPE); + let noAlbum = false; + await setTrash(done, testNum, rOps, aOps, noAlbum); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_PROMISE_01_003 + * @tc.name : trash + * @tc.desc : audio asset Trash by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_PROMISE_01_003", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_PROMISE_01_003"; + let rOps = fetchOps(testNum, "Audios/trash/", AUDIO_TYPE); + let aOps = albumFetchOps(testNum, "Audios/", "trash", AUDIO_TYPE); + let noAlbum = false; + await setTrash(done, testNum, rOps, aOps, noAlbum); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_PROMISE_01_004 + * @tc.name : trash + * @tc.desc : file asset Trash by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_PROMISE_01_004", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_PROMISE_01_004"; + let rOps = fetchOps(testNum, "Documents/trash/", FILE_TYPE); + let aOps = albumFetchOps(testNum, "Documents/", "trash", FILE_TYPE); + let noAlbum = true; + await setTrash(done, testNum, rOps, aOps, noAlbum); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_PROMISE_02_001 + * @tc.name : trash + * @tc.desc : image asset Trash by 1 + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_PROMISE_02_001", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_PROMISE_02_001"; + let rOps = fetchOps(testNum, "Pictures/trash/", IMAGE_TYPE); + let value = 1; + await trashError(done, testNum, rOps, value); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_PROMISE_02_002 + * @tc.name : trash + * @tc.desc : image asset Trash by 'abc' + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_PROMISE_02_002", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_PROMISE_02_002"; + let rOps = fetchOps(testNum, "Pictures/trash/", IMAGE_TYPE); + let value = "abc"; + await trashError(done, testNum, rOps, value); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_PROMISE_02_003 + * @tc.name : trash + * @tc.desc : image asset Trash by {a:10} + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_PROMISE_02_003", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_PROMISE_02_003"; + let rOps = fetchOps(testNum, "Pictures/trash/", IMAGE_TYPE); + let value = { a: 10 }; + await trashError(done, testNum, rOps, value); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_PROMISE_02_004 + * @tc.name : trash + * @tc.desc : image asset Trash by undefined + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_PROMISE_02_004", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_PROMISE_02_004"; + let rOps = fetchOps(testNum, "Pictures/trash/", IMAGE_TYPE); + let value = undefined; + await trashError(done, testNum, rOps, value); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_PROMISE_02_005 + * @tc.name : trash + * @tc.desc : image asset Trash by null + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 3 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_PROMISE_02_005", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_ERROR_PROMISE_02_005"; + let rOps = fetchOps(testNum, "Pictures/trash/", IMAGE_TYPE); + let value = null; + await trashError(done, testNum, rOps, value); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_PROMISE_03_001 + * @tc.name : trash + * @tc.desc : image asset Trash by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_PROMISE_03_001", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_PROMISE_03_001"; + let rOps = fetchOps(testNum, "Pictures/trash/", IMAGE_TYPE); + let aOps = albumFetchOps(testNum, "Pictures/", "trash", IMAGE_TYPE); + let noAlbum = false; + await recovery(done, testNum, rOps, aOps, noAlbum); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_PROMISE_03_002 + * @tc.name : trash + * @tc.desc : video asset Trash by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_PROMISE_03_002", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_PROMISE_03_002"; + let rOps = fetchOps(testNum, "Videos/trash/", VIDEO_TYPE); + let aOps = albumFetchOps(testNum, "Videos/", "trash", VIDEO_TYPE); + let noAlbum = false; + await recovery(done, testNum, rOps, aOps, noAlbum); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_PROMISE_03_003 + * @tc.name : trash + * @tc.desc : audio asset Trash by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_PROMISE_03_003", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_PROMISE_03_003"; + let rOps = fetchOps(testNum, "Audios/trash/", AUDIO_TYPE); + let aOps = albumFetchOps(testNum, "Audios/", "trash", AUDIO_TYPE); + let noAlbum = false; + await recovery(done, testNum, rOps, aOps, noAlbum); + }); + + /** + * @tc.number : SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_PROMISE_03_004 + * @tc.name : trash + * @tc.desc : file asset Trash by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it("SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_PROMISE_03_004", 0, async function (done) { + let testNum = "SUB_MEDIA_MEDIALIBRARY_TRASH_RECOVERY_PROMISE_03_004"; + let rOps = fetchOps(testNum, "Documents/trash/", FILE_TYPE); + let aOps = albumFetchOps(testNum, "Documents/", "trash", FILE_TYPE); + let noAlbum = true; + await recovery(done, testNum, rOps, aOps, noAlbum); + }); + }); +} diff --git a/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/module.json b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..f3eedb3d449aa6a71d157dfea758a37ae1ec41f2 --- /dev/null +++ b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/module.json @@ -0,0 +1,68 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:mainability_description", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "ohos.acts.multimedia.mediaLibrary.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:mainability_description", + "icon": "$media:icon", + "label": "$string:entry_MainAbility", + "visible": true, + "orientation": "portrait", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities":[ + "entity.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.GET_BUNDLE_INFO", + "reason": "use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "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" + } + ] + } +} diff --git a/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/resources/base/element/string.json b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d75a3fee650de2abaabfd60f40d90d9c6a4b0b0b --- /dev/null +++ b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "MediaLibraryJSTestMain" + }, + { + "name": "mainability_description", + "value": "MediaLibraryJSTestMain Ability" + } + ] + } \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/resources/base/media/icon.png b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/resources/base/media/icon.png differ diff --git a/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/resources/base/profile/main_pages.json b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/multimedia/medialibrary/mediaLibrary_trash/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_trash/signature/openharmony_sx.p7b b/multimedia/medialibrary/mediaLibrary_trash/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/multimedia/medialibrary/mediaLibrary_trash/signature/openharmony_sx.p7b differ diff --git a/multimedia/userfilemgr/common.js b/multimedia/userfilemgr/common.js new file mode 100755 index 0000000000000000000000000000000000000000..ce65c8b7e91543c739230e463bdba33a48289851 --- /dev/null +++ b/multimedia/userfilemgr/common.js @@ -0,0 +1,183 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; +import bundle from '@ohos.bundle'; +import dataSharePredicates from '@ohos.data.dataSharePredicates'; +import mediaLibrary from '@ohos.multimedia.mediaLibrary'; + +const presetsCount = { + ActsUserFileMgrAlbumJsTest: { albumsCount: 3, assetsCount: 3 }, + ActsUserFileMgrBaseJsTest: { albumsCount: 9, assetsCount: 18 }, + ActsUserFileMgrFileAssetJsTest: { albumsCount: 45, assetsCount: 87 }, +} + +const IMAGE_TYPE = userFileManager.FileType.IMAGE; +const VIDEO_TYPE = userFileManager.FileType.VIDEO; +const AUDIO_TYPE = userFileManager.FileType.AUDIO; + +const AUDIOKEY = userFileManager.AudioKey; +const IMAGEVIDEOKEY = userFileManager.ImageVideoKey; +const ALBUMKEY = userFileManager.AlbumKey; +const FILEKEY = mediaLibrary.FileKey; +const sleep = async function sleep(times) { + if (times == undefined) { + times = 10 + } + await new Promise(res => setTimeout(res, times)); +} + +const allFetchOp = function () { + let predicates = new dataSharePredicates.DataSharePredicates(); + return { + fetchColumns: [], + predicates: predicates + }; +} + +const audioFetchOps = function (testNum, path) { + let predicates = new dataSharePredicates.DataSharePredicates(); + predicates.equalTo(FILEKEY.RELATIVE_PATH, path); + let ops = { + fetchColumns: [], + predicates: predicates + }; + console.info(`${testNum} queryOps: ${FILEKEY.RELATIVE_PATH} = ${path}`); + return ops +} + +const imageVideoFetchOps = function (testNum, path) { + let predicates = new dataSharePredicates.DataSharePredicates(); + predicates.equalTo(FILEKEY.RELATIVE_PATH, path); + let ops = { + fetchColumns: [], + predicates: predicates + }; + console.info(`${testNum} queryOps: ${FILEKEY.RELATIVE_PATH} = ${path}`); + return ops +} + +const audioNameFetchOps = function (testNum, path, displayName) { + let predicates = new dataSharePredicates.DataSharePredicates(); + predicates.equalTo(FILEKEY.RELATIVE_PATH, path) + .equalTo(AUDIOKEY.DISPLAY_NAME, displayName); + let ops = { + fetchColumns: [], + predicates: predicates + }; + console.info(`${testNum} queryOps: ${FILEKEY.RELATIVE_PATH} = ${path} AND display_name = ${displayName}`); + return ops +} + +const imageVideoNameFetchOps = function (testNum, path, displayName) { + let predicates = new dataSharePredicates.DataSharePredicates(); + predicates.equalTo(FILEKEY.RELATIVE_PATH, path) + .equalTo(IMAGEVIDEOKEY.DISPLAY_NAME, displayName); + let ops = { + fetchColumns: [], + predicates: predicates + }; + console.info(`${testNum} queryOps: ${FILEKEY.RELATIVE_PATH} = ${path} AND display_name = ${displayName}`); + return ops +} + +const albumFetchOps = function (testNum, path, albumName) { + let predicates = new dataSharePredicates.DataSharePredicates(); + predicates.equalTo(FILEKEY.RELATIVE_PATH, path) + .equalTo("bucket_display_name", albumName); + let ops = { + predicates: predicates + }; + console.info(`${testNum} queryOps: ${FILEKEY.RELATIVE_PATH} = ${path} AND bucket_display_name = ${albumName}`); + return ops +} + +const checkPresetsAssets = async function (userfilemgr, hapName) { + console.info('checkPresetsAssets start') + let fetchAlbumResult = await userfilemgr.getPhotoAlbums(allFetchOp()); + let albumsCount = fetchAlbumResult.getCount(); + let fetchPhotoResult = await userfilemgr.getPhotoAssets(allFetchOp()); + let fetchAudioResult = await userfilemgr.getAudioAssets(allFetchOp()); + let assetsCount = fetchPhotoResult.getCount() + fetchAudioResult.getCount(); + console.info(`${hapName}:: assetsCount: ${assetsCount} albumsCount: ${albumsCount}, + presetsassetsCount: ${presetsCount[hapName].assetsCount} + presetsalbumsCount: ${presetsCount[hapName].albumsCount}`); + console.info('checkPresetsAssets end') +} + +const checkAssetsCount = async function (done, testNum, fetchAssetResult, expectCount) { + if (!fetchAssetResult) { + console.info(`${testNum}:: fetchAssetResult is undefined`); + expect(false).assertTrue(); + done(); + return false + } + let count = await fetchAssetResult.getCount(); + if (count != expectCount) { + console.info(`${testNum}:: count:expectCount - ${count} : ${expectCount}`); + expect(count).assertEqual(expectCount); + done(); + } + return count == expectCount; +} + +const getPermission = async function (name = 'ohos.acts.multimedia.userfilemgr') { + console.info('getPermission start', name) + let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.userfilemgr', 0, 100); + let tokenID = appInfo.accessTokenId; + let atManager = abilityAccessCtrl.createAtManager(); + let result1 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.MEDIA_LOCATION", 1); + let resultReadImageVideo = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.READ_IMAGEVIDEO", 1); + let resultReadAudio = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.READ_AUDIO", 1); + let resultReadDocument = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.READ_DOCUMENT", 1); + let resultWriteImageVideo = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.WRITE_IMAGEVIDEO", 1); + let resultWriteAudio = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.WRITE_AUDIO", 1); + let resultWriteDocument = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.WRITE_DOCUMENT", 1); + let isGranted1 = await atManager.verifyAccessToken(tokenID, "ohos.permission.MEDIA_LOCATION"); + let isGrantedReadImageVideo = await atManager.verifyAccessToken(tokenID, "ohos.permission.READ_IMAGEVIDEO"); + let isGrantedReadAudio = await atManager.verifyAccessToken(tokenID, "ohos.permission.READ_AUDIO"); + let isGrantedReadDocument = await atManager.verifyAccessToken(tokenID, "ohos.permission.READ_DOCUMENT"); + let isGrantedWriteImageVideo = await atManager.verifyAccessToken(tokenID, "ohos.permission.WRITE_IMAGEVIDEO"); + let isGrantedWriteAudio = await atManager.verifyAccessToken(tokenID, "ohos.permission.WRITE_AUDIO"); + let isGrantedWriteDocument = await atManager.verifyAccessToken(tokenID, "ohos.permission.WRITE_DOCUMENT"); + if (result1 != 0 || isGranted1 !=0 || !(resultReadImageVideo == 0 && resultReadAudio == 0 && resultReadDocument == 0) || + !(resultWriteImageVideo == 0 && resultWriteAudio == 0 && resultWriteDocument == 0) || + !(isGrantedReadImageVideo == 0 && isGrantedReadAudio == 0 && isGrantedReadDocument == 0) || + !(isGrantedWriteImageVideo == 0 && isGrantedWriteAudio == 0 && isGrantedWriteDocument == 0)) { + console.info('getPermission failed') + } + console.info('getPermission end') +} + +const isNum = function (value) { + return typeof value === 'number' && !isNaN(value); +} +export { + getPermission, + IMAGE_TYPE, + VIDEO_TYPE, + AUDIO_TYPE, + sleep, + allFetchOp, + audioFetchOps, + imageVideoFetchOps, + audioNameFetchOps, + imageVideoNameFetchOps, + albumFetchOps, + checkPresetsAssets, + checkAssetsCount, + isNum, +}; \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_album/AppScope/app.json b/multimedia/userfilemgr/userfilemgr_album/AppScope/app.json new file mode 100755 index 0000000000000000000000000000000000000000..103cf8e6368fd2a71f15ca4506e1ce4e48a58669 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_album/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app":{ + "bundleName":"ohos.acts.multimedia.userfilemgr", + "vendor":"huawei", + "versionCode":1000000, + "versionName":"1.0.0", + "debug":false, + "icon":"$media:icon", + "label":"$string:entry_MainAbility", + "description":"$string:mainability_description", + "distributedNotificationEnabled":true, + "keepAlive":true, + "singleUser":true, + "minAPIVersion":8, + "targetAPIVersion":8, + "car":{ + "apiCompatibleVersion":8, + "singleUser":false + } + } +} diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/AppScope/resources/base/element/string.json b/multimedia/userfilemgr/userfilemgr_album/AppScope/resources/base/element/string.json similarity index 100% rename from multimedia/medialibrary/mediaLibrary_js_standard/AppScope/resources/base/element/string.json rename to multimedia/userfilemgr/userfilemgr_album/AppScope/resources/base/element/string.json diff --git a/multimedia/userfilemgr/userfilemgr_album/AppScope/resources/base/media/app_icon.png b/multimedia/userfilemgr/userfilemgr_album/AppScope/resources/base/media/app_icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/userfilemgr/userfilemgr_album/AppScope/resources/base/media/app_icon.png differ diff --git a/multimedia/userfilemgr/userfilemgr_album/BUILD.gn b/multimedia/userfilemgr/userfilemgr_album/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..c2d6356fa83ce43f2612672796b5b1c50fb86b88 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_album/BUILD.gn @@ -0,0 +1,40 @@ +# 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("userfilemgr_album_js_hap") { + hap_profile = "entry/src/main/module.json" + deps = [ + ":mediaLibrary_js_assets", + ":mediaLibrary_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsUserFileMgrAlbumJsTest" +} + +ohos_app_scope("medialibrary_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("mediaLibrary_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("mediaLibrary_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":medialibrary_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/multimedia/userfilemgr/userfilemgr_album/Test.json b/multimedia/userfilemgr/userfilemgr_album/Test.json new file mode 100755 index 0000000000000000000000000000000000000000..ad7cf9685ec62d099cedaa5bbcff91ce83b1ec0a --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_album/Test.json @@ -0,0 +1,54 @@ +{ + "description": "Configuration for userfilemgr Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "ohos.acts.multimedia.userfilemgr", + "shell-timeout": "600000" + }, + "kits": [ + { + "type": "ShellKit", + "pre-push": [ + ], + "run-command": [ + "rm -rf /storage/media/100/local/files/*", + "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", + "mkdir -pv /storage/media/100/local/files/Pictures", + "mkdir -p /storage/media/100/local/temp" + ] + }, + { + "type": "PushKit", + "pre-push": [ + ], + "push": [ + "./resource/medialibrary/01.jpg ->/storage/media/100/local/temp" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "mkdir -pv /storage/media/100/local/files/Pictures/{Static,DynamicCb,DynamicPro}", + + "for d in Static DynamicCb DynamicPro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", + + "chmod -R 777 /storage/media/100/local/files/*", + "chmod -R 777 /data/service/el2/100/hmdfs/account/files/*", + "hilog -Q pidoff", + "hilog -p off", + "hilog -b I", + "hilog -b D -D 0xD002B70", + "scanner", + "sleep 10" + ] + }, + { + "test-file-name": [ + "ActsUserFileMgrAlbumJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/Application/AbilityStage.ts b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/Application/AbilityStage.ts similarity index 100% rename from multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/Application/AbilityStage.ts rename to multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/Application/AbilityStage.ts diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/MainAbility/MainAbility.ts b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/MainAbility/MainAbility.ts similarity index 100% rename from multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/MainAbility/MainAbility.ts rename to multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/MainAbility/MainAbility.ts diff --git a/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/pages/index/index.ets b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/pages/index/index.ets new file mode 100755 index 0000000000000000000000000000000000000000..ac301f98781abd45f4d9d98fd7ffecfde9053ed9 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/pages/index/index.ets @@ -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 file from '@system.file'; + +import { Core, ExpectExtend, InstrumentLog, ReportExtend } from "deccjsunit/index" +import testsuite from "../../test/List.test.ets" + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters) + console.info('testsuite()---->') + testsuite(globalThis.abilityContext) + core.execute() + console.info('core.execute()---->') + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/pages/second/second.ets b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/pages/second/second.ets similarity index 100% rename from multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/ets/pages/second/second.ets rename to multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/pages/second/second.ets diff --git a/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/List.test.ets b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/List.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..3eb3b9f14c2b370bf89120b391eb435ea36ccca1 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,25 @@ +/* + * 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 albumCommitModifyCallback from './albumCommitModifyCallback.test.ets' +import albumCommitModifyPromise from './albumCommitModifyPromise.test.ets' +import albumGetFileAssetsCallback from './albumGetFileAssetsCallback.test.ets' +import albumGetFileAssetsPromise from './albumGetFileAssetsPromise.test.ets' +export default function testsuite(abilityContext) { + albumCommitModifyCallback(abilityContext) + albumCommitModifyPromise(abilityContext) + albumGetFileAssetsCallback(abilityContext) + albumGetFileAssetsPromise(abilityContext) +} diff --git a/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumCommitModifyCallback.test.ets b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumCommitModifyCallback.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..c0b46c0341e77f74b522df369835195a4cfdab54 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumCommitModifyCallback.test.ets @@ -0,0 +1,83 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; + +import { + sleep, + albumFetchOps, + checkPresetsAssets, + checkAssetsCount, + getPermission, +} from '../../../../../../common'; + + +export default function albumCommitModifyCallback(abilityContext) { + describe('albumCommitModifyCallback', function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + await getPermission(); + await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest'); + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + const albumCommitModify = async function (done, testNum, fetchOp, expectAlbumCount = 1) { + try { + const fetchAlbumResult = await userfilemgr.getPhotoAlbums(fetchOp); + const albumCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumCount); + if (!albumCountPass) return; + const album = await fetchAlbumResult.getFirstObject(); + const newName = 'newAlbumNameCallback'; + fetchAlbumResult.close(); + album.albumName = newName; + album.commitModify(async () => { + expect(true).assertTrue(); + done(); + }); + } catch (error) { + console.info(`${testNum}, failed error: ${error}`) + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_ALBUM_COMMITMODIFY_CALLBACK_01 + * @tc.name : commitModify + * @tc.desc : image album modify albumname + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_ALBUM_COMMITMODIFY_CALLBACK_01', 0, async function (done) { + const testNum = 'SUB_USERFILE_MGR_ALBUM_COMMITMODIFY_CALLBACK_01'; + let currentFetchOp = albumFetchOps(testNum, 'Pictures/', 'DynamicCb'); + await albumCommitModify(done, testNum, currentFetchOp); + }); + }); +} + + diff --git a/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumCommitModifyPromise.test.ets b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumCommitModifyPromise.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..f98dfb691cebb13d5bec277185cfc4008a1b76ce --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumCommitModifyPromise.test.ets @@ -0,0 +1,82 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; + +import { + sleep, + albumFetchOps, + checkPresetsAssets, + checkAssetsCount, + getPermission, +} from '../../../../../../common'; + + +export default function albumCommitModifyPromise(abilityContext) { + describe('albumCommitModifyPromise', function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + await getPermission(); + await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest'); + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + const albumCommitModify = async function (done, testNum, fetchOp, expectAlbumCount = 1) { + try { + const fetchAlbumResult = await userfilemgr.getPhotoAlbums(fetchOp); + const albumCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumCount); + if (!albumCountPass) return; + const album = await fetchAlbumResult.getFirstObject(); + const newName = 'newAlbumNamePromise'; + fetchAlbumResult.close(); + album.albumName = newName; + await album.commitModify(); + expect(true).assertTrue(); + done(); + } catch (error) { + console.info(`${testNum}, failed error: ${error}`) + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_ALBUM_COMMITMODIFY_PROMISE_01 + * @tc.name : commitModify + * @tc.desc : album modify albumname + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_ALBUM_COMMITMODIFY_PROMISE_01', 0, async function (done) { + const testNum = 'SUB_USERFILE_MGR_ALBUM_COMMITMODIFY_PROMISE_01'; + let currentFetchOp = albumFetchOps(testNum, 'Pictures/', 'DynamicPro'); + await albumCommitModify(done, testNum, currentFetchOp); + }); + }); +} + + diff --git a/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumGetFileAssetsCallback.test.ets b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumGetFileAssetsCallback.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..27ddb27c2795d7f05ae6a60de05d05a3022a842d --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumGetFileAssetsCallback.test.ets @@ -0,0 +1,86 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; +import dataSharePredicates from '@ohos.data.dataSharePredicates'; + +import { + sleep, + allFetchOp, + albumFetchOps, + checkPresetsAssets, + checkAssetsCount, +} from '../../../../../../common'; + +export default function albumGetFileAssetsCallback(abilityContext) { + describe('albumGetFileAssetsCallback', function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest'); + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + const getPhotoAssetsTest = async function (done, testNum, fetchOp, expectAlbumCount = 1, expectAssetsCount = 1) { + try { + const fetchAlbumResult = await userfilemgr.getPhotoAlbums(fetchOp); + const albumCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumCount); + if (!albumCountPass) return; + const album = await fetchAlbumResult.getFirstObject(); + fetchAlbumResult.close(); + album.getPhotoAssets(allFetchOp(), (error, fetchAssetResult) => { + if (error != undefined) { + console.info(`${testNum} getPhotoAssets error: ${error}`); + expect(false).assertTrue(); + done(); + return; + } + console.info(`${testNum}, getCount: ${fetchAssetResult.getCount()} + expectAssetsCount: ${expectAssetsCount}`); + expect(fetchAssetResult.getCount()).assertEqual(expectAssetsCount); + fetchAssetResult.close(); + done(); + }); + } catch (error) { + console.info(`${testNum}, error: ${error}`); + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_CALLBACK_01 + * @tc.name : getPhotoAssets + * @tc.desc : Album getPhotoAssets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_CALLBACK_01', 0, async function (done) { + const testNum = 'SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_CALLBACK_01'; + let currentFetchOp = albumFetchOps(testNum, 'Pictures/', 'Static'); + await getPhotoAssetsTest(done, testNum, currentFetchOp); + }); + }); +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumGetFileAssetsPromise.test.ets b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumGetFileAssetsPromise.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..d99380957c265cde4a0ab88733359ca605382e05 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/ets/test/albumGetFileAssetsPromise.test.ets @@ -0,0 +1,87 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; +import dataSharePredicates from '@ohos.data.dataSharePredicates'; + +import { + sleep, + allFetchOp, + albumFetchOps, + checkPresetsAssets, + checkAssetsCount, +} from '../../../../../../common'; + +export default function albumGetFileAssetsPromise(abilityContext) { + describe('albumGetFileAssetsPromise', function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest'); + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + const getPhotoAssetsTest = async function (done, testNum, fetchOp, expectAlbumCount = 1, expectAssetsCount = 1) { + try { + const fetchAlbumResult = await userfilemgr.getPhotoAlbums(fetchOp); + const albumCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumCount); + if (!albumCountPass) return; + const album = await fetchAlbumResult.getFirstObject(); + fetchAlbumResult.close(); + let op: userFileManager.FetchOptions = allFetchOp(); + let fetchAssetResult = await album.getPhotoAssets(op); + if (fetchAssetResult == undefined) { + expect(false).assertTrue(); + done(); + return; + } + console.info(`${testNum}, getCount: ${fetchAssetResult.getCount()} + expectAssetsCount: ${expectAssetsCount}`) + expect(fetchAssetResult.getCount()).assertEqual(expectAssetsCount); + fetchAssetResult.close(); + done(); + } catch (error) { + console.info(`${testNum}, error: ${error}`); + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_PROMISE_01 + * @tc.name : getPhotoAssets + * @tc.desc : Album getPhotoAssets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_PROMISE_01', 0, async function (done) { + const testNum = 'SUB_USERFILE_MGR_ALBUM_GETPHOTOASSETS_PROMISE_01'; + let currentFetchOp = albumFetchOps(testNum, 'Pictures/', 'Static'); + await getPhotoAssetsTest(done, testNum, currentFetchOp); + }); + }); +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_album/entry/src/main/module.json b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/module.json new file mode 100755 index 0000000000000000000000000000000000000000..c41f57d383c045e0f439a17b158ddb5c9c098966 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/module.json @@ -0,0 +1,84 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:mainability_description", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "ohos.acts.multimedia.userfilemgr.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:mainability_description", + "icon": "$media:icon", + "label": "$string:entry_MainAbility", + "visible": true, + "orientation": "portrait", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities":[ + "entity.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.GET_BUNDLE_INFO", + "reason": "use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "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_IMAGEVIDEO", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.READ_AUDIO", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.READ_DOCUMENT", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.WRITE_IMAGEVIDEO", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.WRITE_AUDIO", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.WRITE_DOCUMENT", + "reason":"use ohos.permission.WRITE_MEDIA" + } + ] + } +} diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/resources/base/element/string.json b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/resources/base/element/string.json similarity index 100% rename from multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/resources/base/element/string.json rename to multimedia/userfilemgr/userfilemgr_album/entry/src/main/resources/base/element/string.json diff --git a/multimedia/userfilemgr/userfilemgr_album/entry/src/main/resources/base/media/icon.png b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/resources/base/media/icon.png differ diff --git a/multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/resources/base/profile/main_pages.json b/multimedia/userfilemgr/userfilemgr_album/entry/src/main/resources/base/profile/main_pages.json similarity index 100% rename from multimedia/medialibrary/mediaLibrary_js_standard/entry/src/main/resources/base/profile/main_pages.json rename to multimedia/userfilemgr/userfilemgr_album/entry/src/main/resources/base/profile/main_pages.json diff --git a/multimedia/userfilemgr/userfilemgr_album/signature/openharmony_sx.p7b b/multimedia/userfilemgr/userfilemgr_album/signature/openharmony_sx.p7b new file mode 100755 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/multimedia/userfilemgr/userfilemgr_album/signature/openharmony_sx.p7b differ diff --git a/multimedia/userfilemgr/userfilemgr_base/AppScope/app.json b/multimedia/userfilemgr/userfilemgr_base/AppScope/app.json new file mode 100755 index 0000000000000000000000000000000000000000..25f1a749f8b57b96979879112a1f5bd21548a92c --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_base/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app":{ + "bundleName":"ohos.acts.multimedia.userfilemgr", + "vendor":"huawei", + "versionCode":1000000, + "versionName":"1.0.0", + "debug":false, + "icon":"$media:icon", + "label":"$string:entry_MainAbility", + "description":"$string:mainability_description", + "distributedNotificationEnabled":true, + "keepAlive":true, + "singleUser":true, + "minAPIVersion":8, + "targetAPIVersion":8, + "car":{ + "apiCompatibleVersion":8, + "singleUser":false + } + } +} diff --git a/multimedia/userfilemgr/userfilemgr_base/AppScope/resources/base/element/string.json b/multimedia/userfilemgr/userfilemgr_base/AppScope/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..c1dee63527ae5e3c37f3736f6b68189e8df6f201 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_base/AppScope/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "MediaLibraryJSTestMain" + }, + { + "name": "mainability_description", + "value": "MediaLibraryJSTestMain Ability" + } + ] +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_base/AppScope/resources/base/media/app_icon.png b/multimedia/userfilemgr/userfilemgr_base/AppScope/resources/base/media/app_icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/userfilemgr/userfilemgr_base/AppScope/resources/base/media/app_icon.png differ diff --git a/multimedia/userfilemgr/userfilemgr_base/BUILD.gn b/multimedia/userfilemgr/userfilemgr_base/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..0bdbd5796205af9f91f30776113530ec1d393a2d --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_base/BUILD.gn @@ -0,0 +1,40 @@ +# 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("userfilemgr_base_js_hap") { + hap_profile = "entry/src/main/module.json" + deps = [ + ":mediaLibrary_js_assets", + ":mediaLibrary_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsUserFileMgrBaseJsTest" +} + +ohos_app_scope("medialibrary_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("mediaLibrary_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("mediaLibrary_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":medialibrary_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/multimedia/userfilemgr/userfilemgr_base/Test.json b/multimedia/userfilemgr/userfilemgr_base/Test.json new file mode 100755 index 0000000000000000000000000000000000000000..60853ef5aee89d036e0f70e2a21c6e95b660f182 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_base/Test.json @@ -0,0 +1,63 @@ +{ + "description": "Configuration for userfilemgr Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "ohos.acts.multimedia.userfilemgr", + "shell-timeout": "600000" + }, + "kits": [ + { + "type": "ShellKit", + "pre-push": [ + ], + "run-command": [ + "rm -rf /storage/media/100/local/files/*", + "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", + "mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios}", + "mkdir -p /storage/media/100/local/temp" + ] + }, + { + "type": "PushKit", + "pre-push": [ + ], + "push": [ + "./resource/medialibrary/01.jpg ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "mkdir -pv /storage/media/100/local/files/Pictures/{Static,On,Off,myAlbum}", + "mkdir -pv /storage/media/100/local/files/Videos/{Static,On,Off,myAlbum}", + "mkdir -pv /storage/media/100/local/files/Audios/{Static,On,Off,myAlbum}", + + "for d in Static; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", + "for d in Static; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", + "for d in Static; do for i in $$(seq 4); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", + "for d in On Off myAlbum; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", + "for d in On Off myAlbum; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", + "for d in On Off myAlbum; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", + + "chmod -R 777 /storage/media/100/local/files/*", + "chmod -R 777 /data/service/el2/100/hmdfs/account/files/*", + "hilog -Q pidoff", + "hilog -p off", + "hilog -b I", + "hilog -b D -D 0xD002B70", + "scanner", + "sleep 10" + ] + }, + { + "test-file-name": [ + "ActsUserFileMgrBaseJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/Application/AbilityStage.ts b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/Application/AbilityStage.ts new file mode 100755 index 0000000000000000000000000000000000000000..51cb02ba3f5c7011c1cd433d07deebd47a195704 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_base/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/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/MainAbility/MainAbility.ts b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100755 index 0000000000000000000000000000000000000000..2f9d6d1f23f95d9fc891fbc550cd5a589cfb6c89 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,36 @@ +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") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", 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") + } +}; \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/pages/index/index.ets b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/pages/index/index.ets new file mode 100755 index 0000000000000000000000000000000000000000..624cad290665fcd29dcd579d9582a300479e8ad7 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,68 @@ +/* + * 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'; + +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" +import testsuite from "../../test/List.test.ets" + +@Entry +@Component +struct Index { + + aboutToAppear(){ + + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters) + console.info('testsuite()---->') + testsuite(globalThis.abilityContext) + core.execute() + console.info('core.execute()---->') + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/pages/second/second.ets b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/pages/second/second.ets new file mode 100755 index 0000000000000000000000000000000000000000..1c1c727ff11ecc97909f482c35268db87ae23bb4 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/pages/second/second.ets @@ -0,0 +1,43 @@ +/* + * 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 router from '@system.router'; + +@Entry +@Component +struct Second { + private content: string = "Second Page" + + build() { + Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('back to index') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + router.back() + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/List.test.ets b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/List.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..145ef047ad5bb37524a08417345dc07c0afda607 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,29 @@ +/* + * 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 getAlbumsCallbackTest from './getAlbumsCallback.test.ets' +import getAlbumsPromiseTest from './getAlbumsPromise.test.ets' +import getFileAssetsCallbackTest from './getFileAssetsCallback.test.ets' +import getFileAssetsPromiseTest from './getFileAssetsPromise.test.ets' +import getUserFileMgrTest from './getUserFileMgr.test.ets' +import onOffReleasePromiseTest from './onOffReleasePromise.test.ets' +export default function testsuite(abilityContext) { + getAlbumsCallbackTest(abilityContext) + getAlbumsPromiseTest(abilityContext) + getFileAssetsCallbackTest(abilityContext) + getFileAssetsPromiseTest(abilityContext) + getUserFileMgrTest(abilityContext) + onOffReleasePromiseTest(abilityContext) +} diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getAlbumsCallback.test.ets b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getAlbumsCallback.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..11fdef4fa1f566df2cfc9617676608356bb33ca3 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getAlbumsCallback.test.ets @@ -0,0 +1,127 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; + +import { + sleep, + albumFetchOps, + checkPresetsAssets, + checkAssetsCount, + getPermission, + isNum, +} from '../../../../../../common'; + + +export default function getAlbumsCallbackTest(abilityContext) { + describe('getAlbumsCallbackTest', function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + await getPermission(); + await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest'); + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + function printAlbumMessage(testNum, album) { + console.info(`${testNum} + album.albumName: ${album.albumName} + album.albumUri: ${album.albumUri} + album.dateModified: ${album.dateModified} + album.count: ${album.count} + album.relativePath: ${album.relativePath} + album.coverUri: ${album.coverUri}`); + } + + const props = { + albumName: 'myAlbum', + albumUri: 'datashare:///userfilemgr/album/', + count: 1 + } + const checkProps = async function (done, testNum, album, relativePaths) { + printAlbumMessage(testNum, album); + if (album.coverUri == undefined) { + console.info(`${testNum}, album.coverUri is undefined`); + expect(false).assertTrue(); + done(); + return; + } + expect(album.albumName).assertEqual(props.albumName); + expect(album.count).assertEqual(props.count); + expect(isNum(album.dateModified)).assertTrue(); + if (Array.isArray(relativePaths)) { + let i = relativePaths.indexOf(album.relativePath); + if (i > -1) { + relativePaths.splice(i, 1) + } else { + expect(false).assertTrue(); + done(); + } + } else { + expect(album.relativePath).assertEqual(relativePaths); + } + } + const checkAlbumInfo = async function (done, testNum, fetchOp, relativePaths) { + try { + userfilemgr.getPhotoAlbums(fetchOp, async (err, fetchAlbumResult) => { + if(err) { + console.info(`${testNum} getPhotoAlbums err: ${err}`) + expect(false).assertTrue(); + done(); + return; + } + let expectAlbumCount = 1; + const albumCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumCount); + if (!albumCountPass) return; + const album = await fetchAlbumResult.getFirstObject(); + checkProps(done, testNum, album, relativePaths); + fetchAlbumResult.close(); + done(); + }); + } catch (error) { + console.info(`${testNum}, failed: ${error}`); + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOALBUMS_CALLBACK_01 + * @tc.name : getPhotoAlbums + * @tc.desc : getPhotoAlbums by relativePath && albumName, print all album info + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOALBUMS_CALLBACK_01', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOALBUMS_CALLBACK_01'; + let currentFetchOp = albumFetchOps(testNum, 'Pictures/', 'myAlbum'); + let relativePaths = 'Pictures/'; + await checkAlbumInfo(done, testNum, currentFetchOp, relativePaths); + }); + }); +} + + diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getAlbumsPromise.test.ets b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getAlbumsPromise.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..12091934b49a18185035e43018e65b920fc4f093 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getAlbumsPromise.test.ets @@ -0,0 +1,114 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; + +import { + sleep, + albumFetchOps, + checkPresetsAssets, + checkAssetsCount, +} from '../../../../../../common'; + +export default function getAlbumsPromiseTest(abilityContext) { + describe('getAlbumsPromiseTest', function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest'); + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + function printAlbumMessage(testNum, album) { + console.info(`${testNum} + album.albumName: ${album.albumName} + album.albumUri: ${album.albumUri} + album.dateModified: ${album.dateModified} + album.count: ${album.count} + album.relativePath: ${album.relativePath} + album.coverUri: ${album.coverUri}`); + } + + const props = { + albumName: 'myAlbum', + albumUri: 'datashare:///userfilemgr/album/', + count: 1 + } + const checkProps = async function (done, testNum, album, relativePaths) { + printAlbumMessage(testNum, album); + if (album.coverUri == undefined) { + console.info(`${testNum}, album.coverUri is undefined`); + expect(false).assertTrue(); + done(); + return; + } + expect(album.albumName).assertEqual(props.albumName); + expect(album.count).assertEqual(props.count); + if (Array.isArray(relativePaths)) { + let i = relativePaths.indexOf(album.relativePath); + if (i > -1) { + relativePaths.splice(i, 1) + } else { + expect(false).assertTrue(); + done(); + } + } else { + expect(album.relativePath).assertEqual(relativePaths); + } + } + const checkAlbumInfo = async function (done, testNum, fetchOp, relativePaths, expectAlbumCount = 1) { + try { + const fetchAlbumResult = await userfilemgr.getPhotoAlbums(fetchOp); + const albumCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumCount); + if (!albumCountPass) return; + const album = await fetchAlbumResult.getFirstObject(); + checkProps(done, testNum, album, relativePaths); + fetchAlbumResult.close(); + done(); + } catch (error) { + console.info(`${testNum}, failed: ${error}`); + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOALBUMS_PROMISE_01 + * @tc.name : getPhotoAlbums + * @tc.desc : getPhotoAlbums by relativePath && albumName, print all album info + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOALBUMS_PROMISE_01', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOALBUMS_PROMISE_01'; + let currentFetchOp = albumFetchOps(testNum, 'Pictures/', 'myAlbum'); + let relativePaths = 'Pictures/'; + await checkAlbumInfo(done, testNum, currentFetchOp, relativePaths); + }); + }); +} + + diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsCallback.test.ets b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsCallback.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1c74a296ec7cb368dcea8cf1e23358d3e68305ad --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsCallback.test.ets @@ -0,0 +1,453 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; +import { + sleep, + IMAGE_TYPE, + VIDEO_TYPE, + AUDIO_TYPE, + audioFetchOps, + imageVideoFetchOps, + checkPresetsAssets, + checkAssetsCount, +} from '../../../../../../common'; + + +export default function getFileAssetsCallbackTest(abilityContext) { + describe('getFileAssetsCallbackTest', function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrBaseJsTest'); + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep(500) + }); + afterAll(function () { + console.info('afterAll case'); + }); + + const props = { + image: { + displayName: '01.jpg', + fileType: IMAGE_TYPE.toString(), + }, + video: { + displayName: '01.mp4', + fileType: VIDEO_TYPE.toString(), + }, + audio: { + displayName: '01.mp3', + fileType: AUDIO_TYPE.toString(), + }, + } + + async function getFirstObjectTest(done, testNum, fetchOp, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let expectCount = 4; + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); + if (!checkAssetCountPass) return; + fetchAssetResult.getFirstObject(async (err, asset) => { + if (err) { + console.info(`${testNum} err : ${err}`) + expect.assertFail(); + fetchAssetResult.close(); + done(); + return; + } + expect(asset != undefined).assertTrue(); + fetchAssetResult.close(); + }); + done(); + } catch (error) { + console.info(`${testNum}:: error :${error}`); + expect(false).assertTrue(); + done(); + } + } + + async function getLastObjectTest(done, testNum, fetchOp, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let expectCount = 4; + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); + if (!checkAssetCountPass) return; + fetchAssetResult.getLastObject(async (err, asset) => { + if (err) { + console.info(`${testNum} err : ${err}`) + expect.assertFail(); + fetchAssetResult.close(); + done(); + return; + } + expect(asset != undefined).assertTrue(); + fetchAssetResult.close(); + }); + done(); + } catch (error) { + console.info(`${testNum}:: error :${error}`); + expect(false).assertTrue(); + done(); + } + } + + async function getPositionObjectTest(done, testNum, fetchOp, pos, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let expectCount = 4; + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); + if (!checkAssetCountPass) return; + fetchAssetResult.getPositionObject(pos, async (err, asset) => { + if (err) { + console.info(`${testNum} err : ${err}`) + expect.assertFail(); + fetchAssetResult.close(); + done(); + return; + } + expect(asset != undefined).assertTrue(); + fetchAssetResult.close(); + }); + done(); + } catch (error) { + console.info(`${testNum}:: error :${error}`); + expect(false).assertTrue(); + done(); + } + } + + async function isAfterLastTest(done, testNum, fetchOp, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let expectCount = 4; + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); + if (!checkAssetCountPass) return; + let asset = await fetchAssetResult.getFirstObject(); + for (var i = 1; i < expectCount; i++) { + asset = await fetchAssetResult.getNextObject(); + if (i == expectCount - 1) { + let result = fetchAssetResult.isAfterLast(); + expect(result).assertTrue(); + fetchAssetResult.close(); + done(); + } + } + done(); + } catch (error) { + console.info(`${testNum} error ${error}`); + expect(false).assertTrue(); + done(); + } + } + + async function checkFileAssetAttr(done, testNum, fetchOp, type, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let expectCount = 4; + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); + if (!checkAssetCountPass) return; + fetchAssetResult.getFirstObject(async (err, asset) => { + if (err) { + console.info(`${testNum} err : ${err}`) + expect.assertFail(); + fetchAssetResult.close(); + done(); + return; + } + expect(asset.displayName).assertEqual(props[type].displayName); + expect(asset.uri != undefined).assertTrue(); + fetchAssetResult.close(); + done(); + }); + } catch (error) { + console.info(`${testNum}:: error :${error}`); + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_01_001 + * @tc.name : getFirstObject + * @tc.desc : getFirstObject query image assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_01_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_01_001'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Pictures/Static/'); + let isAudio = false; + await getFirstObjectTest(done, testNum, currentFetchOps, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETAUDIOASSETS_CALLBACK_01_002 + * @tc.name : getFirstObject + * @tc.desc : getFirstObject query audio assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETAUDIOASSETS_CALLBACK_01_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETAUDIOASSETS_CALLBACK_01_002'; + let currentFetchOps = audioFetchOps(testNum, 'Audios/Static/'); + let isAudio = true; + await getFirstObjectTest(done, testNum, currentFetchOps, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_01_003 + * @tc.name : getFirstObject + * @tc.desc : getFirstObject query video assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_01_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_01_003'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Videos/Static/'); + let isAudio = false; + await getFirstObjectTest(done, testNum, currentFetchOps, isAudio); + }); + + //------------------------------------------------------------------------------ + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_02_001 + * @tc.name : getLastObject + * @tc.desc : getLastObject query image assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_02_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_02_001'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Pictures/Static/'); + let isAudio = false; + await getLastObjectTest(done, testNum, currentFetchOps, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETAUDIOASSETS_CALLBACK_02_002 + * @tc.name : getLastObject + * @tc.desc : getLastObject query audio assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETAUDIOASSETS_CALLBACK_02_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETAUDIOASSETS_CALLBACK_02_002'; + let currentFetchOps = audioFetchOps(testNum, 'Audios/Static/'); + let isAudio = true; + await getLastObjectTest(done, testNum, currentFetchOps, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_02_003 + * @tc.name : getLastObject + * @tc.desc : getLastObject query video assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_02_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_02_003'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Videos/Static/'); + let isAudio = false; + await getLastObjectTest(done, testNum, currentFetchOps, isAudio); + }); + + //------------------------------------------------------------------------------ + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_03_001 + * @tc.name : getPositionObject + * @tc.desc : getPositionObject query image assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_03_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_03_001'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Pictures/Static/'); + let pos = 0; + let isAudio = false; + await getPositionObjectTest(done, testNum, currentFetchOps, pos, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETAUDIOASSETS_CALLBACK_03_002 + * @tc.name : getPositionObject + * @tc.desc : getPositionObject query audio assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETAUDIOASSETS_CALLBACK_03_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETAUDIOASSETS_CALLBACK_03_002'; + let currentFetchOps = audioFetchOps(testNum, 'Audios/Static/'); + let pos = 0; + let isAudio = true; + await getPositionObjectTest(done, testNum, currentFetchOps, pos, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_03_003 + * @tc.name : getPositionObject + * @tc.desc : getPositionObject query video assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_03_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_03_003'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Videos/Static/'); + let pos = 0; + let isAudio = false; + await getPositionObjectTest(done, testNum, currentFetchOps, pos, isAudio); + }); + + //------------------------------------------------------------------------------ + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_04_001 + * @tc.name : isAfterLast + * @tc.desc : isAfterLast query image assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_04_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_04_001'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Pictures/Static/'); + let isAudio = false; + await isAfterLastTest(done, testNum, currentFetchOps, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETAUDIOASSETS_CALLBACK_04_002 + * @tc.name : isAfterLast + * @tc.desc : isAfterLast query audio assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETAUDIOASSETS_CALLBACK_04_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETAUDIOASSETS_CALLBACK_04_002'; + let currentFetchOps = audioFetchOps(testNum, 'Audios/Static/'); + let isAudio = true; + await isAfterLastTest(done, testNum, currentFetchOps, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_04_003 + * @tc.name : isAfterLast + * @tc.desc : isAfterLast query video assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_04_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_04_003'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Videos/Static/'); + let isAudio = false; + await isAfterLastTest(done, testNum, currentFetchOps, isAudio); + }); + + //------------------------------------------------------------------------------ + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_05_001 + * @tc.name : getPhotoAssets + * @tc.desc : query image assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_05_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_05_001'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Pictures/Static/'); + let type = 'image'; + let isAudio = false; + await checkFileAssetAttr(done, testNum, currentFetchOps, type, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETAUDIOASSETS_CALLBACK_05_002 + * @tc.name : getAudioAssets + * @tc.desc : query audio assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETAUDIOASSETS_CALLBACK_05_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETAUDIOASSETS_CALLBACK_05_002'; + let currentFetchOps = audioFetchOps(testNum, 'Audios/Static/'); + let type = 'audio'; + let isAudio = true; + await checkFileAssetAttr(done, testNum, currentFetchOps, type, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_05_003 + * @tc.name : getPhotoAssets + * @tc.desc : query video assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_05_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_CALLBACK_05_003'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Videos/Static/'); + let type = 'video'; + let isAudio = false; + await checkFileAssetAttr(done, testNum, currentFetchOps, type, isAudio); + }); + }); +} + diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsPromise.test.ets b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsPromise.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b1529966147cfe42a9bcc89992a5f570c42c0c7d --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getFileAssetsPromise.test.ets @@ -0,0 +1,428 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; +import { + sleep, + IMAGE_TYPE, + VIDEO_TYPE, + AUDIO_TYPE, + checkPresetsAssets, + checkAssetsCount, + allFetchOp, + audioFetchOps, + imageVideoFetchOps, +} from '../../../../../../common'; + + +export default function getFileAssetsPromiseTest(abilityContext) { + describe('getFileAssetsPromiseTest', function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrBaseJsTest'); + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep(500) + }); + afterAll(function () { + console.info('afterAll case'); + }); + + const props = { + image: { + displayName: '01.jpg', + fileType: IMAGE_TYPE.toString(), + }, + video: { + displayName: '01.mp4', + fileType: VIDEO_TYPE.toString(), + }, + audio: { + displayName: '01.mp3', + fileType: AUDIO_TYPE.toString(), + }, + } + + async function getFirstObjectTest(done, testNum, fetchOp, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let expectCount = 4; + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); + if (!checkAssetCountPass) return; + let asset = await fetchAssetResult.getFirstObject(); + expect(asset != undefined).assertTrue(); + fetchAssetResult.close(); + done(); + } catch (error) { + console.info(`${testNum}:: error :${error}`); + expect(false).assertTrue(); + done(); + } + } + + async function getLastObjectTest(done, testNum, fetchOp, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let expectCount = 4; + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); + if (!checkAssetCountPass) return; + let asset = await fetchAssetResult.getLastObject(); + expect(asset != undefined).assertTrue(); + fetchAssetResult.close(); + done(); + } catch (error) { + console.info(`${testNum}:: error :${error}`); + expect(false).assertTrue(); + done(); + } + } + + async function getPositionObjectTest(done, testNum, fetchOp, pos, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let expectCount = 4; + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); + if (!checkAssetCountPass) return; + let asset = await fetchAssetResult.getPositionObject(pos); + expect(asset != undefined).assertTrue(); + fetchAssetResult.close(); + done(); + } catch (error) { + console.info(`${testNum}:: error :${error}`); + expect(false).assertTrue(); + done(); + } + } + + async function isAfterLastTest(done, testNum, fetchOp, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let expectCount = 4; + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); + if (!checkAssetCountPass) return; + let asset = await fetchAssetResult.getFirstObject(); + for (var i = 1; i < expectCount; i++) { + asset = await fetchAssetResult.getNextObject(); + if (i == expectCount - 1) { + let result = fetchAssetResult.isAfterLast(); + expect(result).assertTrue(); + fetchAssetResult.close(); + done(); + } + } + } catch (error) { + console.info(`${testNum} error ${error}`); + expect(false).assertTrue(); + done(); + } + } + + async function checkFileAssetAttr(done, testNum, fetchOp, type, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let expectCount = 4; + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); + if (!checkAssetCountPass) return; + fetchAssetResult.getFirstObject(async (err, asset) => { + if (err) { + console.info(`${testNum} err : ${err}`) + expect.assertFail(); + fetchAssetResult.close(); + done(); + return; + } + expect(asset.displayName).assertEqual(props[type].displayName); + fetchAssetResult.close(); + done(); + }); + } catch (error) { + console.info(`${testNum}:: error :${error}`); + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_01_001 + * @tc.name : getFirstObject + * @tc.desc : getFirstObject query image assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_01_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_01_001'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Pictures/Static/'); + let isAudio = false; + await getFirstObjectTest(done, testNum, currentFetchOps, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETAUDIOASSETS_PROMISE_01_002 + * @tc.name : getFirstObject + * @tc.desc : getFirstObject query audio assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETAUDIOASSETS_PROMISE_01_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETAUDIOASSETS_PROMISE_01_002'; + let currentFetchOps = audioFetchOps(testNum, 'Audios/Static/'); + let isAudio = true; + await getFirstObjectTest(done, testNum, currentFetchOps, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_01_003 + * @tc.name : getFirstObject + * @tc.desc : getFirstObject query video assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_01_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_01_003'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Videos/Static/'); + let isAudio = false; + await getFirstObjectTest(done, testNum, currentFetchOps, isAudio); + }); + + //------------------------------------------------------------------------------ + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_02_001 + * @tc.name : getLastObject + * @tc.desc : getLastObject query image assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_02_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_02_001'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Pictures/Static/'); + let isAudio = false; + await getLastObjectTest(done, testNum, currentFetchOps, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETAUDIOASSETS_PROMISE_02_002 + * @tc.name : getLastObject + * @tc.desc : getLastObject query audio assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETAUDIOASSETS_PROMISE_02_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETAUDIOASSETS_PROMISE_02_002'; + let currentFetchOps = audioFetchOps(testNum, 'Audios/Static/'); + let isAudio = true; + await getLastObjectTest(done, testNum, currentFetchOps, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_02_003 + * @tc.name : getLastObject + * @tc.desc : getLastObject query video assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_02_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_02_003'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Videos/Static/'); + let isAudio = false; + await getLastObjectTest(done, testNum, currentFetchOps, isAudio); + }); + + //------------------------------------------------------------------------------ + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_03_001 + * @tc.name : getPositionObject + * @tc.desc : getPositionObject query image assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_03_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_03_001'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Pictures/Static/'); + let pos = 0; + let isAudio = false; + await getPositionObjectTest(done, testNum, currentFetchOps, pos, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETAUDIOASSETS_PROMISE_03_002 + * @tc.name : getPositionObject + * @tc.desc : getPositionObject query audio assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETAUDIOASSETS_PROMISE_03_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETAUDIOASSETS_PROMISE_03_002'; + let currentFetchOps = audioFetchOps(testNum, 'Audios/Static/'); + let pos = 0; + let isAudio = true; + await getPositionObjectTest(done, testNum, currentFetchOps, pos, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_03_003 + * @tc.name : getPositionObject + * @tc.desc : getPositionObject query video assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_03_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_03_003'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Videos/Static/'); + let pos = 0; + let isAudio = false; + await getPositionObjectTest(done, testNum, currentFetchOps, pos, isAudio); + }); + + //--------------------------------------------------------------------------------- + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_04_001 + * @tc.name : isAfterLast + * @tc.desc : isAfterLast query image assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_04_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_04_001'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Pictures/Static/'); + let isAudio = false; + await isAfterLastTest(done, testNum, currentFetchOps, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETAUDIOASSETS_PROMISE_04_002 + * @tc.name : isAfterLast + * @tc.desc : isAfterLast query audio assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETAUDIOASSETS_PROMISE_04_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETAUDIOASSETS_PROMISE_04_002'; + let currentFetchOps = audioFetchOps(testNum, 'Audios/Static/'); + let isAudio = true; + await isAfterLastTest(done, testNum, currentFetchOps, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_04_003 + * @tc.name : isAfterLast + * @tc.desc : isAfterLast query video assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_04_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_04_003'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Videos/Static/'); + let isAudio = false; + await isAfterLastTest(done, testNum, currentFetchOps, isAudio); + }); + + //------------------------------------------------------------------------------ + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_05_001 + * @tc.name : getPhotoAssets + * @tc.desc : query image assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_05_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_05_001'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Pictures/Static/'); + let type = 'image'; + let isAudio = false; + await checkFileAssetAttr(done, testNum, currentFetchOps, type, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETAUDIOASSETS_PROMISE_05_002 + * @tc.name : getAudioAssets + * @tc.desc : query audio assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETAUDIOASSETS_PROMISE_05_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETAUDIOASSETS_PROMISE_05_002'; + let currentFetchOps = audioFetchOps(testNum, 'Audios/Static/'); + let type = 'audio'; + let isAudio = true; + await checkFileAssetAttr(done, testNum, currentFetchOps, type, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_05_003 + * @tc.name : getPhotoAssets + * @tc.desc : query video assets + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_05_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETS_PROMISE_05_003'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Videos/Static/'); + let type = 'video'; + let isAudio = false; + await checkFileAssetAttr(done, testNum, currentFetchOps, type, isAudio); + }); + }); +} + diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getUserFileMgr.test.ets b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getUserFileMgr.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c1bdde255f71cd8360d038e74268b7465d16d5b4 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/getUserFileMgr.test.ets @@ -0,0 +1,58 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; +import { sleep } from '../../../../../../common'; + +export default function getUserFileMgrTest(abilityContext) { + describe('getUserFileMgrTest', function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETUSERFILEMGR_00 + * @tc.name : getUserFileMgr + * @tc.desc : Obtains a userFileMgr instance + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETUSERFILEMGR_00', 0, async function (done) { + try { + expect(userfilemgr != undefined).assertTrue(); + done(); + } catch (error) { + console.info(`SUB_USERFILE_MGR_GETUSERFILEMGR_00 failed, error: ${error}`); + expect(false).assertTrue(); + done(); + } + }); + }); +} + + diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/onOffReleasePromise.test.ets b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/onOffReleasePromise.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb25c7cf873da944a149f32c192a798d8c8676d1 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/ets/test/onOffReleasePromise.test.ets @@ -0,0 +1,225 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; + +import { + sleep, + audioFetchOps, + imageVideoFetchOps, + checkPresetsAssets, + checkAssetsCount, +} from '../../../../../../common'; + + +export default function onOffReleasePromiseTest(abilityContext) { + describe('onOffReleasePromiseTest', function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrAlbumJsTest'); + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + const onTest = async (done, testNum, fetchOp, type, newName, isAudio) => { + try { + let count = 0; + userfilemgr.on(type, () => { count++; }); + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); + if (!checkAssetCountPass) return; + const asset = await fetchAssetResult.getFirstObject(); + fetchAssetResult.close(); + asset.displayName = newName; + await asset.commitModify(); + await sleep(1000) + expect(count > 0).assertTrue(); + done(); + } catch (error) { + console.info(`${testNum}:: error :${error}`); + expect(false).assertTrue(); + done(); + } + } + const offTest = async (done, testNum, fetchOp, type, newName, isAudio) => { + try { + let count = 0; + userfilemgr.on(type, () => { + count++; + }); + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); + if (!checkAssetCountPass) return; + const asset = await fetchAssetResult.getFirstObject(); + fetchAssetResult.close(); + asset.displayName = newName; + userfilemgr.off(type); + await asset.commitModify(); + await sleep(1000) + expect(count).assertEqual(0); + done(); + } catch (error) { + console.info(`${testNum}:: error :${error}`); + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_ON_PROMISE_01 + * @tc.name : ON + * @tc.desc : ON image ASSET + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_ON_PROMISE_01', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_ON_PROMISE_01'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Pictures/On/'); + let type = 'imageChange'; + let newName = 'imageChange.jpg'; + let isAudio = false; + await onTest(done, testNum, currentFetchOps, type, newName, isAudio) + }); + + /** + * @tc.number : SUB_USERFILE_MGR_ON_PROMISE_02 + * @tc.name : ON + * @tc.desc : ON audio ASSET + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_ON_PROMISE_02', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_ON_PROMISE_02'; + let currentFetchOps = audioFetchOps(testNum, 'Audios/On/'); + let type = 'audioChange'; + let newName = 'audioChange.mp3'; + let isAudio = true; + await onTest(done, testNum, currentFetchOps, type, newName, isAudio) + }); + + /** + * @tc.number : SUB_USERFILE_MGR_ON_PROMISE_03 + * @tc.name : ON + * @tc.desc : ON video ASSET + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_ON_PROMISE_03', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_ON_PROMISE_03'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Videos/On/'); + let type = 'videoChange'; + let newName = 'videoChange.mp4'; + let isAudio = false; + await onTest(done, testNum, currentFetchOps, type, newName, isAudio) + }); + + /** + * @tc.number : SUB_USERFILE_MGR_OFF_PROMISE_01 + * @tc.name : off + * @tc.desc : off image ASSET + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_OFF_PROMISE_01', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_OFF_PROMISE_01'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Pictures/Off/'); + let type = 'imageChange'; + let newName = 'imageChange.jpg'; + let isAudio = false; + await offTest(done, testNum,currentFetchOps, type, newName, isAudio) + }); + + /** + * @tc.number : SUB_USERFILE_MGR_OFF_PROMISE_02 + * @tc.name : off + * @tc.desc : off audio ASSET + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_OFF_PROMISE_02', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_OFF_PROMISE_02'; + let currentFetchOps = audioFetchOps(testNum, 'Audios/Off/'); + let type = 'audioChange'; + let newName = 'audioChange.mp3'; + let isAudio = true; + await offTest(done, testNum,currentFetchOps, type, newName, isAudio) + }); + + /** + * @tc.number : SUB_USERFILE_MGR_OFF_PROMISE_03 + * @tc.name : off + * @tc.desc : off video ASSET + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_OFF_PROMISE_03', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_OFF_PROMISE_03'; + let currentFetchOps = imageVideoFetchOps(testNum, 'Videos/Off/'); + let type = 'videoChange'; + let newName = 'videoChange.mp4'; + let isAudio = false; + await offTest(done, testNum,currentFetchOps, type, newName, isAudio) + }); + + /** + * @tc.number : SUB_USERFILE_MGR_PROMISE_PROMISE_01 + * @tc.name : release + * @tc.desc : Release MediaLibrary instance + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_PROMISE_PROMISE_01', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_PROMISE_PROMISE_01'; + try { + await userfilemgr.release(); + expect(true).assertTrue(); + done(); + } catch (error) { + console.info(`${testNum}:: error :${error}`); + expect(false).assertTrue(); + done(); + } + }); + }); +} + + diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/module.json b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/module.json new file mode 100755 index 0000000000000000000000000000000000000000..2315c8ab56cb06a6d553933c8487e57e176f0e68 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/module.json @@ -0,0 +1,84 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:mainability_description", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "ohos.acts.multimedia.userfilemgr.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:mainability_description", + "icon": "$media:icon", + "label": "$string:entry_MainAbility", + "visible": true, + "orientation": "portrait", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities":[ + "entity.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.GET_BUNDLE_INFO", + "reason": "use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "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_IMAGEVIDEO", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.READ_AUDIO", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.READ_DOCUMENT", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.WRITE_IMAGEVIDEO", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.WRITE_AUDIO", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.WRITE_DOCUMENT", + "reason":"use ohos.permission.WRITE_MEDIA" + } + ] + } +} diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/resources/base/element/string.json b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..d75a3fee650de2abaabfd60f40d90d9c6a4b0b0b --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "MediaLibraryJSTestMain" + }, + { + "name": "mainability_description", + "value": "MediaLibraryJSTestMain Ability" + } + ] + } \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/resources/base/media/icon.png b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/resources/base/media/icon.png differ diff --git a/multimedia/userfilemgr/userfilemgr_base/entry/src/main/resources/base/profile/main_pages.json b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/resources/base/profile/main_pages.json new file mode 100755 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_base/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_base/signature/openharmony_sx.p7b b/multimedia/userfilemgr/userfilemgr_base/signature/openharmony_sx.p7b new file mode 100755 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/multimedia/userfilemgr/userfilemgr_base/signature/openharmony_sx.p7b differ diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/AppScope/app.json b/multimedia/userfilemgr/userfilemgr_fileAsset/AppScope/app.json new file mode 100755 index 0000000000000000000000000000000000000000..25f1a749f8b57b96979879112a1f5bd21548a92c --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app":{ + "bundleName":"ohos.acts.multimedia.userfilemgr", + "vendor":"huawei", + "versionCode":1000000, + "versionName":"1.0.0", + "debug":false, + "icon":"$media:icon", + "label":"$string:entry_MainAbility", + "description":"$string:mainability_description", + "distributedNotificationEnabled":true, + "keepAlive":true, + "singleUser":true, + "minAPIVersion":8, + "targetAPIVersion":8, + "car":{ + "apiCompatibleVersion":8, + "singleUser":false + } + } +} diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/AppScope/resources/base/element/string.json b/multimedia/userfilemgr/userfilemgr_fileAsset/AppScope/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..c1dee63527ae5e3c37f3736f6b68189e8df6f201 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/AppScope/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "MediaLibraryJSTestMain" + }, + { + "name": "mainability_description", + "value": "MediaLibraryJSTestMain Ability" + } + ] +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/AppScope/resources/base/media/app_icon.png b/multimedia/userfilemgr/userfilemgr_fileAsset/AppScope/resources/base/media/app_icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/userfilemgr/userfilemgr_fileAsset/AppScope/resources/base/media/app_icon.png differ diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/BUILD.gn b/multimedia/userfilemgr/userfilemgr_fileAsset/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..d2ed44f87ab2b29287d7a70f99dbbd5a369a80c9 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/BUILD.gn @@ -0,0 +1,40 @@ +# 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("userfilemgr_fileAsset_js_hap") { + hap_profile = "entry/src/main/module.json" + deps = [ + ":mediaLibrary_js_assets", + ":mediaLibrary_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsUserFileMgrFileAssetJsTest" +} + +ohos_app_scope("medialibrary_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("mediaLibrary_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("mediaLibrary_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":medialibrary_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/Test.json b/multimedia/userfilemgr/userfilemgr_fileAsset/Test.json new file mode 100755 index 0000000000000000000000000000000000000000..05f5814596b728a8ff5e14b1c1e7bd20018cbffa --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/Test.json @@ -0,0 +1,68 @@ +{ + "description": "Configuration for userfilemgr Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "ohos.acts.multimedia.userfilemgr", + "shell-timeout": "600000" + }, + "kits": [ + { + "type": "ShellKit", + "pre-push": [ + ], + "run-command": [ + "rm -rf /storage/media/100/local/files/*", + "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", + "mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios}", + "mkdir -p /storage/media/100/local/temp" + ] + }, + { + "type": "PushKit", + "pre-push": [ + ], + "push": [ + "./resource/medialibrary/01.jpg ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp3 ->/storage/media/100/local/temp", + "./resource/medialibrary/01.mp4 ->/storage/media/100/local/temp" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "mkdir -pv /storage/media/100/local/files/Pictures/{ModifyCb,ModifyPro,FavCb,FavPro,Thumbnail,Static,R_Cb,W_Cb,RW_Cb,R_Pro,W_Pro,RW_Pro,openClose,trashCb,trashPro}", + "mkdir -pv /storage/media/100/local/files/Videos/{ModifyCb,ModifyPro,FavCb,FavPro,Thumbnail,Static,R_Cb,W_Cb,RW_Cb,R_Pro,W_Pro,RW_Pro,openClose,trashCb,trashPro}", + "mkdir -pv /storage/media/100/local/files/Audios/{ModifyCb,ModifyPro,FavCb,FavPro,Thumbnail,Static,R_Cb,W_Cb,RW_Cb,R_Pro,W_Pro,RW_Pro,openClose,trashCb,trashPro}", + + "for d in FavCb FavPro trashCb trashPro; do for i in $$(seq 3); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", + "for d in FavCb FavPro trashCb trashPro; do for i in $$(seq 3); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", + "for d in FavCb FavPro trashCb trashPro; do for i in $$(seq 3); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", + + "for d in Thumbnail openClose W_Cb RW_Cb W_Pro RW_Pro; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", + "for d in Thumbnail openClose W_Cb RW_Cb W_Pro RW_Pro; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", + "for d in Thumbnail openClose W_Cb RW_Cb W_Pro RW_Pro; do for i in $$(seq 2); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", + + "for d in ModifyCb ModifyPro Static R_Cb R_Pro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.jpg /storage/media/100/local/files/Pictures/$$d/0$$i.jpg; done;done;", + "for d in ModifyCb ModifyPro Static R_Cb R_Pro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp3 /storage/media/100/local/files/Audios/$$d/0$$i.mp3; done;done;", + "for d in ModifyCb ModifyPro Static R_Cb R_Pro; do for i in $$(seq 1); do cp /storage/media/100/local/temp/01.mp4 /storage/media/100/local/files/Videos/$$d/0$$i.mp4; done;done;", + + "chmod -R 777 /storage/media/100/local/files/*", + "chmod -R 777 /data/service/el2/100/hmdfs/account/files/*", + "hilog -Q pidoff", + "hilog -p off", + "hilog -b I", + "hilog -b D -D 0xD002B70", + "scanner", + "sleep 10" + ] + }, + { + "test-file-name": [ + "ActsUserFileMgrFileAssetJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/Application/AbilityStage.ts b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/Application/AbilityStage.ts new file mode 100755 index 0000000000000000000000000000000000000000..51cb02ba3f5c7011c1cd433d07deebd47a195704 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/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/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/MainAbility/MainAbility.ts b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100755 index 0000000000000000000000000000000000000000..2f9d6d1f23f95d9fc891fbc550cd5a589cfb6c89 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,36 @@ +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") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", 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") + } +}; \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/pages/index/index.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/pages/index/index.ets new file mode 100755 index 0000000000000000000000000000000000000000..624cad290665fcd29dcd579d9582a300479e8ad7 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,68 @@ +/* + * 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'; + +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" +import testsuite from "../../test/List.test.ets" + +@Entry +@Component +struct Index { + + aboutToAppear(){ + + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters) + console.info('testsuite()---->') + testsuite(globalThis.abilityContext) + core.execute() + console.info('core.execute()---->') + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/pages/second/second.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/pages/second/second.ets new file mode 100755 index 0000000000000000000000000000000000000000..1c1c727ff11ecc97909f482c35268db87ae23bb4 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/pages/second/second.ets @@ -0,0 +1,43 @@ +/* + * 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 router from '@system.router'; + +@Entry +@Component +struct Second { + private content: string = "Second Page" + + build() { + Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('back to index') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + router.back() + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/List.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/List.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..34b9e3c77e4a4d8a4b02d46db30eef6374f74451 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,39 @@ +/* + * 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 fileAssetCommitModifyCallbackTest from './fileAssetCommitModifyCallback.test.ets' +import fileAssetCommitModifyPromiseTest from './fileAssetCommitModifyPromise.test.ets' +import fileAssetFavoriteCallbackTest from './fileAssetFavoriteCallback.test.ets' +import fileAssetFavoritePromiseTest from './fileAssetFavoritePromise.test.ets' +import fileAssetFileKeyTest from './fileAssetFileKey.test.ets' +import fileAssetGetThumbnailCallbackTest from './fileAssetGetThumbnailCallback.test.ets' +import fileAssetGetThumbnailPromiseTest from './fileAssetGetThumbnailPromise.test.ets' +import fileAssetOpenCallbackTest from './fileAssetOpenCallback.test.ets' +import fileAssetOpenPromiseTest from './fileAssetOpenPromise.test.ets' +import fileAssetTrashCallbackTest from './fileAssetTrashCallback.test.ets' +import fileAssetTrashPromiseTest from './fileAssetTrashPromise.test.ets' +export default function testsuite(abilityContext) { + fileAssetCommitModifyCallbackTest(abilityContext) + fileAssetCommitModifyPromiseTest(abilityContext) + fileAssetFavoriteCallbackTest(abilityContext) + fileAssetFavoritePromiseTest(abilityContext) + fileAssetFileKeyTest(abilityContext) + fileAssetGetThumbnailCallbackTest(abilityContext) + fileAssetGetThumbnailPromiseTest(abilityContext) + fileAssetOpenCallbackTest(abilityContext) + fileAssetOpenPromiseTest(abilityContext) + fileAssetTrashCallbackTest(abilityContext) + fileAssetTrashPromiseTest(abilityContext) +} diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyCallback.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyCallback.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..e45c84ca5632d4383a15b7d872b3ecd63530e6ea --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyCallback.test.ets @@ -0,0 +1,134 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; + +import { + sleep, + IMAGE_TYPE, + VIDEO_TYPE, + AUDIO_TYPE, + audioNameFetchOps, + imageVideoNameFetchOps, + checkPresetsAssets, + checkAssetsCount, + getPermission, +} from '../../../../../../common'; + +export default function fileAssetCommitModifyCallbackTest(abilityContext) { + describe('fileAssetCommitModifyCallbackTest', function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + await getPermission(); + await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest') + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + const checkCommitModify = async function (done, testNum, fetchOp, prop, val, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); + if (!checkAssetCountPass) return; + const asset = await fetchAssetResult.getFirstObject(); + const oldVal = asset.get(prop); + asset.set(prop, val); + await asset.commitModify(async (err) => { + if (err) { + console.info(`${testNum} err : ${err}`) + expect.assertFail(); + done(); + return; + } + asset.set(prop, oldVal.toString()); + await asset.commitModify(); + fetchAssetResult.close(); + done(); + }); + } catch (error) { + console.info(`${testNum} error : ${error}`) + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_COMMITMODIFY_CALLBACK_01 + * @tc.name : commitModify + * @tc.desc : image asset modify displayName + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_COMMITMODIFY_CALLBACK_01', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_COMMITMODIFY_CALLBACK_01'; + let fetchOp = imageVideoNameFetchOps(testNum, 'Pictures/ModifyCb/', '01.jpg'); + let prop = 'display_name'; + let val = IMAGE_TYPE.toString() + '.jpg'; + let isAudio = false; + await checkCommitModify(done, testNum, fetchOp, prop, val, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_COMMITMODIFY_CALLBACK_02 + * @tc.name : commitModify + * @tc.desc : audio asset modify displayName + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_COMMITMODIFY_CALLBACK_02', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_COMMITMODIFY_CALLBACK_02'; + let fetchOp = audioNameFetchOps(testNum, 'Audios/ModifyCb/', '01.mp3'); + let prop = 'display_name'; + let val = AUDIO_TYPE.toString() + '.mp3'; + let isAudio = true; + await checkCommitModify(done, testNum, fetchOp, prop, val, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_COMMITMODIFY_CALLBACK_03 + * @tc.name : commitModify + * @tc.desc : video asset modify displayName + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_COMMITMODIFY_CALLBACK_03', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_COMMITMODIFY_CALLBACK_03'; + let fetchOp = imageVideoNameFetchOps(testNum, 'Videos/ModifyCb/', '01.mp4'); + let prop = 'display_name'; + let val = VIDEO_TYPE.toString() + '.mp4'; + let isAudio = false; + await checkCommitModify(done, testNum, fetchOp, prop, val, isAudio); + }); + }); +} + diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyPromise.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyPromise.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..c81786cdbae8af4c7f068f6ad98763f9c9db5ce7 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetCommitModifyPromise.test.ets @@ -0,0 +1,125 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; + +import { + sleep, + IMAGE_TYPE, + VIDEO_TYPE, + AUDIO_TYPE, + checkPresetsAssets, + checkAssetsCount, + audioNameFetchOps, + imageVideoNameFetchOps, +} from '../../../../../../common'; + +export default function fileAssetCommitModifyPromiseTest(abilityContext) { + describe('fileAssetCommitModifyPromiseTest', function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest') + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + const checkCommitModify = async function (done, testNum, fetchOp, prop, val, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); + if (!checkAssetCountPass) return; + const asset = await fetchAssetResult.getFirstObject(); + const oldVal = asset.get(prop) + asset.set(prop, val); + await asset.commitModify(); + asset.set(prop, oldVal.toString()); + await asset.commitModify(); + fetchAssetResult.close(); + done(); + } catch (error) { + console.info(`${testNum} error : ${error}`); + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_COMMITMODIFY_PROMISE_01 + * @tc.name : commitModify + * @tc.desc : image asset modify displayName + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_COMMITMODIFY_PROMISE_01', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_COMMITMODIFY_PROMISE_01'; + let fetchOp = imageVideoNameFetchOps(testNum, 'Pictures/ModifyPro/', '01.jpg'); + let prop = 'display_name'; + let val = IMAGE_TYPE.toString() + '.jpg'; + let isAudio = false; + await checkCommitModify(done, testNum, fetchOp, prop, val, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_COMMITMODIFY_PROMISE_02 + * @tc.name : commitModify + * @tc.desc : audio asset modify displayName + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_COMMITMODIFY_PROMISE_02', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_COMMITMODIFY_PROMISE_02'; + let fetchOp = audioNameFetchOps(testNum, 'Audios/ModifyPro/', '01.mp3'); + let prop = 'display_name'; + let val = AUDIO_TYPE.toString() + '.mp3'; + let isAudio = true; + await checkCommitModify(done, testNum, fetchOp, prop, val, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_COMMITMODIFY_PROMISE_03 + * @tc.name : commitModify + * @tc.desc : video asset modify displayName + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_COMMITMODIFY_PROMISE_03', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_COMMITMODIFY_PROMISE_03'; + let fetchOp = imageVideoNameFetchOps(testNum, 'Videos/ModifyPro/', '01.mp4'); + let prop = 'display_name'; + let val = VIDEO_TYPE.toString() + '.mp4'; + let isAudio = false; + await checkCommitModify(done, testNum, fetchOp, prop, val, isAudio); + }); + }); +} + diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFavoriteCallback.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFavoriteCallback.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..884d57b589cd5d12c5e83609a7505103d6e0be57 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFavoriteCallback.test.ets @@ -0,0 +1,272 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; +import { + sleep, + checkPresetsAssets, + audioNameFetchOps, + imageVideoNameFetchOps, + checkAssetsCount, + getPermission, +} from '../../../../../../common'; + +export default function fileAssetFavoriteCallbackTest(abilityContext) { + describe('fileAssetFavoriteCallbackTest', function () { + var userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + await getPermission(); + await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFavorite'); + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + const favoriteDefaultState = async function (done, testNum, fetchOp, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); + if (!checkAssetCountPass) return; + let asset = await fetchAssetResult.getFirstObject(); + asset.isFavorite(async (err, isFavorite) => { + if (err) { + expect(false).assertTrue(); + await fetchAssetResult.close(); + done(); + return; + } + expect(isFavorite).assertEqual(false); + fetchAssetResult.close(); + done() + }); + } catch (error) { + console.info(`${testNum} failed error: ${error}`); + expect(false).assertTrue(); + done(); + } + } + const favoriteByTrue = async function (done, testNum, fetchOp, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); + if (!checkAssetCountPass) return; + const asset = await fetchAssetResult.getFirstObject(); + let isFavorite = await asset.isFavorite(); + console.info(`${testNum} isFavorite: ${isFavorite}`); + asset.favorite(true, async (err) => { + if(err) { + console.info(`${testNum} failed err: ${err}`); + expect(false).assertTrue(); + done(); + return; + } + let isFavorite = await asset.isFavorite(); + expect(isFavorite).assertEqual(true); + fetchAssetResult.close(); + done(); + }); + + } catch (error) { + console.info(`${testNum} failed error: ${error}`); + expect(false).assertTrue(); + done(); + } + } + const favoriteByFalse = async function (done, testNum, fetchOp, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); + if (!checkAssetCountPass) return; + const asset = await fetchAssetResult.getFirstObject(); + await asset.favorite(true); + asset.favorite(false, async (err) => { + if(err) { + console.info(`${testNum} failed err: ${err}`); + expect(false).assertTrue(); + done(); + return; + } + let isFavorite = await asset.isFavorite(); + expect(isFavorite).assertEqual(false); + fetchAssetResult.close(); + done(); + }); + } catch (error) { + console.info(`${testNum} failed error: ${error}`); + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_01_001 + * @tc.name : isFavorite + * @tc.desc : isFavorite(image) result false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_01_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_01_001'; + let currentFetchOp = imageVideoNameFetchOps(testNum, 'Pictures/FavCb/', '01.jpg'); + let isAudio = false; + await favoriteDefaultState(done, testNum, currentFetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_01_002 + * @tc.name : favorite + * @tc.desc : favorite(image) by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_01_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_01_002'; + let currentFetchOp = imageVideoNameFetchOps(testNum, 'Pictures/FavCb/', '02.jpg'); + let isAudio = false; + await favoriteByTrue(done, testNum, currentFetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_01_003 + * @tc.name : favorite + * @tc.desc : favorite(image) by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_01_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_01_003'; + let currentFetchOp = imageVideoNameFetchOps(testNum, 'Pictures/FavCb/', '03.jpg'); + let isAudio = false; + await favoriteByFalse(done, testNum, currentFetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_02_001 + * @tc.name : isFavorite + * @tc.desc : isFavorite(audio) result false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_02_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_02_001'; + let currentFetchOp = audioNameFetchOps(testNum, 'Audios/FavCb/', '01.mp3'); + let isAudio = true; + await favoriteDefaultState(done, testNum, currentFetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_02_002 + * @tc.name : favorite + * @tc.desc : favorite(audio) by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_02_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_02_002'; + let currentFetchOp = audioNameFetchOps(testNum, 'Audios/FavCb/', '02.mp3'); + let isAudio = true; + await favoriteByTrue(done, testNum, currentFetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_02_003 + * @tc.name : favorite + * @tc.desc : favorite(audio) by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_02_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_02_003'; + let currentFetchOp = audioNameFetchOps(testNum, 'Audios/FavCb/', '03.mp3'); + let isAudio = true; + await favoriteByFalse(done, testNum, currentFetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_03_001 + * @tc.name : isFavorite + * @tc.desc : isFavorite(video) result false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_03_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_03_001'; + let currentFetchOp = imageVideoNameFetchOps(testNum, 'Videos/FavCb/', '01.mp4'); + let isAudio = false; + await favoriteDefaultState(done, testNum, currentFetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_03_002 + * @tc.name : favorite + * @tc.desc : favorite(video) by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_03_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_03_002'; + let currentFetchOp = imageVideoNameFetchOps(testNum, 'Videos/FavCb/', '02.mp4'); + let isAudio = false; + await favoriteByTrue(done, testNum, currentFetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_03_003 + * @tc.name : favorite + * @tc.desc : favorite(video) by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_03_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_FAVORITE_CALLBACK_03_003'; + let currentFetchOp = imageVideoNameFetchOps(testNum, 'Videos/FavCb/', '03.mp4'); + let isAudio = false; + await favoriteByFalse(done, testNum, currentFetchOp, isAudio); + }); + }); +} diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFavoritePromise.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFavoritePromise.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..1d8e188b96cdbaf0aff22da040d61ab275b560bd --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFavoritePromise.test.ets @@ -0,0 +1,246 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; +import { + sleep, + checkPresetsAssets, + audioNameFetchOps, + imageVideoNameFetchOps, + checkAssetsCount, +} from '../../../../../../common'; + +export default function fileAssetFavoritePromiseTest(abilityContext) { + describe('fileAssetFavoritePromiseTest', function () { + var userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFavorite'); + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + const favoriteDefaultState = async function (done, testNum, fetchOp, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); + if (!checkAssetCountPass) return; + let asset = await fetchAssetResult.getFirstObject(); + let isFavorite = await asset.isFavorite(); + expect(isFavorite).assertEqual(false); + fetchAssetResult.close(); + done() + } catch (error) { + console.info(`${testNum} failed error: ${error}`); + expect(false).assertTrue(); + done(); + } + } + const favoriteByTrue = async function (done, testNum, fetchOp, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); + if (!checkAssetCountPass) return; + const asset = await fetchAssetResult.getFirstObject(); + await asset.favorite(true); + let isFavorite = await asset.isFavorite(); + expect(isFavorite).assertEqual(true); + fetchAssetResult.close(); + done(); + } catch (error) { + console.info(`${testNum} failed error: ${error}`); + expect(false).assertTrue(); + done(); + } + } + const favoriteByFalse = async function (done, testNum, fetchOp, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); + if (!checkAssetCountPass) return; + const asset = await fetchAssetResult.getFirstObject(); + await asset.favorite(true); + await asset.favorite(false); + let isFavorite = await asset.isFavorite(); + expect(isFavorite).assertEqual(false); + fetchAssetResult.close(); + done(); + } catch (error) { + console.info(`${testNum} failed error: ${error}`); + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_01_001 + * @tc.name : isFavorite + * @tc.desc : isFavorite(image) result false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_01_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_01_001'; + let currentFetchOp = imageVideoNameFetchOps(testNum, 'Pictures/FavPro/', '01.jpg'); + let isAudio = false; + await favoriteDefaultState(done, testNum, currentFetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_01_002 + * @tc.name : favorite + * @tc.desc : favorite(image) by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_01_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_01_002'; + let currentFetchOp = imageVideoNameFetchOps(testNum, 'Pictures/FavPro/', '02.jpg'); + let isAudio = false; + await favoriteByTrue(done, testNum, currentFetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_01_003 + * @tc.name : favorite + * @tc.desc : favorite(image) by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_01_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_01_003'; + let currentFetchOp = imageVideoNameFetchOps(testNum, 'Pictures/FavPro/', '03.jpg'); + let isAudio = false; + await favoriteByFalse(done, testNum, currentFetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_02_001 + * @tc.name : isFavorite + * @tc.desc : isFavorite(audio) result false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_02_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_02_001'; + let currentFetchOp = audioNameFetchOps(testNum, 'Audios/FavPro/', '01.mp3'); + let isAudio = true; + await favoriteDefaultState(done, testNum, currentFetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_02_002 + * @tc.name : favorite + * @tc.desc : favorite(audio) by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_02_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_02_002'; + let currentFetchOp = audioNameFetchOps(testNum, 'Audios/FavPro/', '02.mp3'); + let isAudio = true; + await favoriteByTrue(done, testNum, currentFetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_03_003 + * @tc.name : favorite + * @tc.desc : favorite(audio) by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_03_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_03_003'; + let currentFetchOp = audioNameFetchOps(testNum, 'Audios/FavPro/', '03.mp3'); + let isAudio = true; + await favoriteByFalse(done, testNum, currentFetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_03_001 + * @tc.name : isFavorite + * @tc.desc : isFavorite(video) result false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_03_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_03_001'; + let currentFetchOp = imageVideoNameFetchOps(testNum, 'Videos/FavPro/', '01.mp4'); + let isAudio = false; + await favoriteDefaultState(done, testNum, currentFetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_03_002 + * @tc.name : favorite + * @tc.desc : favorite(video) by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_03_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_03_002'; + let currentFetchOp = imageVideoNameFetchOps(testNum, 'Videos/FavPro/', '02.mp4'); + let isAudio = false; + await favoriteByTrue(done, testNum, currentFetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_03_003 + * @tc.name : favorite + * @tc.desc : favorite(video) by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_03_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_FAVORITE_PROMISE_03_003'; + let currentFetchOp = imageVideoNameFetchOps(testNum, 'Videos/FavPro/', '03.mp4'); + let isAudio = false; + await favoriteByFalse(done, testNum, currentFetchOp, isAudio); + }); + }); +} diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFileKey.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFileKey.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f732460429237133d088b423a834539a3316b081 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetFileKey.test.ets @@ -0,0 +1,452 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; +import dataSharePredicates from '@ohos.data.dataSharePredicates'; + +import { + sleep, + audioFetchOps, + imageVideoFetchOps, + albumFetchOps, + checkPresetsAssets, + checkAssetsCount, +} from '../../../../../../common'; + +export default function fileAssetFileKeyTest(abilityContext) { + describe('fileAssetFileKeyTest', function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest') + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + const AUDIOKEY = userFileManager.AudioKey; + const ImageVideoKey = userFileManager.ImageVideoKey; + const AlbumKey = userFileManager.AlbumKey; + + const getAlbumsByKey = async function (done, testNum, type, fileKey) { + try { + let expectAlbumNum = 1; + let fetchOps = albumFetchOps(testNum, 'Pictures/', 'Static'); + let fetchAlbumResult = await userfilemgr.getPhotoAlbums(fetchOps); + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAlbumResult, expectAlbumNum); + if (!checkAssetCountPass) return; + const album = await fetchAlbumResult.getFirstObject(); + console.info(`${testNum} fileKey : ${fileKey}`) + console.info(`${testNum} type : ${album[type]}`) + fetchAlbumResult.close(); + let predicates = new dataSharePredicates.DataSharePredicates(); + predicates.equalTo(fileKey, album[type]); + let ops = { + predicates: predicates + }; + + userfilemgr.getPhotoAlbums(ops, async (err, newAlbumResult) => { + if (err) { + console.info(`${testNum}, err: ${err}`) + expect(false).assertTrue(); + done(); + return; + } + const fetchCount = newAlbumResult.getCount(); + const currentAlbum = await newAlbumResult.getFirstObject(); + //expect(currentAlbum.get(type)).assertEqual(album.get(type)); + expect(currentAlbum[type]).assertEqual(album[type]); + expect(fetchCount > 0).assertTrue(); + console.info(`${testNum} newAlbum : ${currentAlbum[type]} count: ${fetchCount}`) + newAlbumResult.close(); + done(); + }); + } catch (error) { + console.info(`${testNum} error : ${error}`) + expect(false).assertTrue(); + done(); + } + } + + const getPhotoAssetsByKey = async function (done, testNum, fileKey) { + try { + let expectAssetNum = 1; + let fetchOps = imageVideoFetchOps(testNum, 'Pictures/Static/'); + let fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOps); + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectAssetNum); + if (!checkAssetCountPass) return; + const asset = await fetchAssetResult.getFirstObject(); + console.info(`${testNum} fileKey : ${fileKey}`) + console.info(`${testNum} type : ${asset.get(fileKey)}`) + let predicates = new dataSharePredicates.DataSharePredicates(); + predicates.equalTo(fileKey, asset.get(fileKey)); + let ops = { + fetchColumns: [], + predicates: predicates + }; + + userfilemgr.getPhotoAssets(ops, async (err, newAssetResult) => { + if (err) { + console.info(`${testNum}, err: ${err}`) + expect(false).assertTrue(); + done(); + return; + } + const fetchCount = newAssetResult.getCount(); + const currentAsset = await newAssetResult.getFirstObject(); + expect(currentAsset.get(fileKey)).assertEqual(asset.get(fileKey)); + expect(fetchCount > 0).assertTrue(); + done(); + }); + } catch (error) { + console.info(`${testNum} error : ${error}`) + expect(false).assertTrue(); + done(); + } + } + + const getAudioAssetsByKey = async function (done, testNum, fileKey) { + try { + let expectAssetNum = 1; + let fetchOps = audioFetchOps(testNum, 'Audios/Static/'); + let fetchAssetResult = await userfilemgr.getAudioAssets(fetchOps); + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectAssetNum); + if (!checkAssetCountPass) return; + const asset = await fetchAssetResult.getFirstObject(); + console.info(`${testNum} fileKey : ${fileKey}`) + console.info(`${testNum} type : ${asset.get(fileKey)}`) + let predicates = new dataSharePredicates.DataSharePredicates(); + predicates.equalTo(fileKey, asset.get(fileKey)); + let ops = { + fetchColumns: [], + predicates: predicates + }; + + userfilemgr.getAudioAssets(ops, async (err, newAssetResult) => { + if (err) { + console.info(`${testNum}, err: ${err}`) + expect(false).assertTrue(); + done(); + return; + } + const fetchCount = newAssetResult.getCount(); + const currentAsset = await newAssetResult.getFirstObject(); + expect(currentAsset.get(fileKey)).assertEqual(asset.get(fileKey)); + expect(fetchCount > 0).assertTrue(); + done(); + }); + } catch (error) { + console.info(`${testNum} error : ${error}`) + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOALBUMSBYKEY_03 + * @tc.name : AlbumKey + * @tc.desc : AlbumKey.DATE_ADDED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOALBUMSBYKEY_03', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOALBUMSBYKEY_03'; + let type = 'dateAdded'; + let fileKey = AlbumKey.DATE_ADDED; + await getAlbumsByKey(done, testNum, type, fileKey); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOALBUMSBYKEY_04 + * @tc.name : AlbumKey + * @tc.desc : AlbumKey.DATE_MODIFIED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOALBUMSBYKEY_04', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOALBUMSBYKEY_04'; + let type = 'dateModified'; + let fileKey = AlbumKey.DATE_MODIFIED; + await getAlbumsByKey(done, testNum, type, fileKey); + }); + + //------------------------------------------------------------------------------ + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_02 + * @tc.name : ImageVideoKey + * @tc.desc : ImageVideoKey.FILE_TYPE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_02', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_02'; + let fileKey = ImageVideoKey.FILE_TYPE; + await getPhotoAssetsByKey(done, testNum, fileKey); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_03 + * @tc.name : ImageVideoKey + * @tc.desc : ImageVideoKey.DISPLAY_NAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_03', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_03'; + let fileKey = ImageVideoKey.DISPLAY_NAME; + await getPhotoAssetsByKey(done, testNum, fileKey); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_04 + * @tc.name : ImageVideoKey + * @tc.desc : ImageVideoKey.DATE_ADDED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_04', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_04'; + let fileKey = ImageVideoKey.DATE_ADDED; + await getPhotoAssetsByKey(done, testNum, fileKey); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_05 + * @tc.name : ImageVideoKey + * @tc.desc : ImageVideoKey.DATE_MODIFIED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_05', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_05'; + let fileKey = ImageVideoKey.DATE_MODIFIED; + await getPhotoAssetsByKey(done, testNum, fileKey); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_06 + * @tc.name : ImageVideoKey + * @tc.desc : ImageVideoKey.TITLE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_06', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_06'; + let fileKey = ImageVideoKey.TITLE; + await getPhotoAssetsByKey(done, testNum, fileKey); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_07 + * @tc.name : ImageVideoKey + * @tc.desc : ImageVideoKey.DURATION + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_07', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_07'; + let fileKey = ImageVideoKey.DURATION; + await getPhotoAssetsByKey(done, testNum, fileKey); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_08 + * @tc.name : ImageVideoKey + * @tc.desc : ImageVideoKey.WIDTH + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_08', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_08'; + let fileKey = ImageVideoKey.WIDTH; + await getPhotoAssetsByKey(done, testNum, fileKey); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_09 + * @tc.name : ImageVideoKey + * @tc.desc : ImageVideoKey.HEIGHT + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_09', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_09'; + let fileKey = ImageVideoKey.HEIGHT; + await getPhotoAssetsByKey(done, testNum, fileKey); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_010 + * @tc.name : ImageVideoKey + * @tc.desc : ImageVideoKey.DATE_TAKEN + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_010', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_010'; + let fileKey = ImageVideoKey.DATE_TAKEN; + await getPhotoAssetsByKey(done, testNum, fileKey); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_011 + * @tc.name : ImageVideoKey + * @tc.desc : ImageVideoKey.ORIENTATION + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_011', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_011'; + let fileKey = ImageVideoKey.ORIENTATION; + await getPhotoAssetsByKey(done, testNum, fileKey); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_012 + * @tc.name : ImageVideoKey + * @tc.desc : ImageVideoKey.FAVORITE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_012', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETPHOTOASSETSBYKEY_012'; + let fileKey = ImageVideoKey.FAVORITE; + await getPhotoAssetsByKey(done, testNum, fileKey); + }); + + //---------------------------------------------------------------------------- + + /** + * @tc.number : SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_02 + * @tc.name : AUDIOKEY + * @tc.desc : AUDIOKEY.DISPLAY_NAME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_02', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_02'; + let fileKey = AUDIOKEY.DISPLAY_NAME; + await getAudioAssetsByKey(done, testNum, fileKey); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_03 + * @tc.name : AUDIOKEY + * @tc.desc : AUDIOKEY.DATE_ADDED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_03', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_03'; + let fileKey = AUDIOKEY.DATE_ADDED; + await getAudioAssetsByKey(done, testNum, fileKey); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_04 + * @tc.name : AUDIOKEY + * @tc.desc : AUDIOKEY.DATE_MODIFIED + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_04', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_04'; + let fileKey = AUDIOKEY.DATE_MODIFIED; + await getAudioAssetsByKey(done, testNum, fileKey); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_05 + * @tc.name : AUDIOKEY + * @tc.desc : AUDIOKEY.TITLE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_05', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_05'; + let fileKey = AUDIOKEY.TITLE; + await getAudioAssetsByKey(done, testNum, fileKey); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_06 + * @tc.name : AUDIOKEY + * @tc.desc : AUDIOKEY.ARTIST + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_06', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_06'; + let fileKey = AUDIOKEY.ARTIST; + await getAudioAssetsByKey(done, testNum, fileKey); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_08 + * @tc.name : AUDIOKEY + * @tc.desc : AUDIOKEY.DURATION + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_08', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_08'; + let fileKey = AUDIOKEY.DURATION; + await getAudioAssetsByKey(done, testNum, fileKey); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_09 + * @tc.name : AUDIOKEY + * @tc.desc : AUDIOKEY.FAVORITE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_09', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_GETAUDIOASSETSBYKEY_09'; + let fileKey = AUDIOKEY.FAVORITE; + await getAudioAssetsByKey(done, testNum, fileKey); + }); + }); +} + diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetGetThumbnailCallback.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetGetThumbnailCallback.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e08751965cd06c3ec1c9b8ab878cd3aa5b44563 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetGetThumbnailCallback.test.ets @@ -0,0 +1,206 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; +import image from '@ohos.multimedia.image'; + +import { + sleep, + checkPresetsAssets, + checkAssetsCount, + audioNameFetchOps, + imageVideoNameFetchOps, +} from '../../../../../../common'; +export default function fileAssetGetThumbnailCallbackTest(abilityContext) { + describe('fileAssetGetThumbnailCallbackTest', function () { + image.createPixelMap(new ArrayBuffer(4096), { size: { height: 1, width: 2 } }).then((pixelmap) => { }); + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrGetThumbnailTest'); + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + async function testGetThumbnail(done, testNum, fetchOp, size, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); + if (!checkAssetCountPass) return; + let asset = await fetchAssetResult.getFirstObject(); + fetchAssetResult.close(); + if (size == 'default') { + size = { width: 256, height: 256 }; + asset.getThumbnail(async (err, pixelmap) => { + if (err != undefined) { + console.info(`${testNum}:: err1 :${err}`); + expect(false).assertTrue(); + done(); + return; + } + await pixelmap.getImageInfo((err, info) => { + if (err != undefined) { + console.info(`${testNum}:: err2 :${err}`); + expect(false).assertTrue(); + done(); + return; + } + console.info(`${testNum}:: width :${info.size.width} height :${info.size.height}`); + expect(info.size.width).assertEqual(size.width); + expect(info.size.height).assertEqual(size.height); + done(); + }); + }) + } else { + asset.getThumbnail(size, async (err, pixelmap) => { + if (err != undefined) { + console.info(`${testNum}:: err1 :${err}`); + expect(false).assertTrue(); + done(); + return; + } + await pixelmap.getImageInfo((err, info) => { + if (err != undefined) { + console.info(`${testNum}:: err2 :${err}`); + expect(false).assertTrue(); + done(); + return; + } + console.info(`${testNum}:: width :${info.size.width} height :${info.size.height}`); + expect(info.size.width).assertEqual(size.width); + expect(info.size.height).assertEqual(size.height); + done(); + }); + }) + } + } catch (error) { + console.info(`${testNum}:: error :${error}`); + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_CALLBACK_01_001 + * @tc.name : getThumbnail + * @tc.desc : getThumbnail(image) by no arg + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_CALLBACK_01_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_CALLBACK_01_001'; + let dOp = imageVideoNameFetchOps(testNum, 'Pictures/Thumbnail/', '01.jpg'); + let size = 'default'; + let isAudio = false; + await testGetThumbnail(done, testNum, dOp, size, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_CALLBACK_01_002 + * @tc.name : getThumbnail + * @tc.desc : getThumbnail(image) by { width: 128, height: 128 } + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_CALLBACK_01_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_CALLBACK_01_002'; + let dOp = imageVideoNameFetchOps(testNum, 'Pictures/Thumbnail/', '02.jpg'); + let size = { width: 128, height: 128 }; + let isAudio = false; + await testGetThumbnail(done, testNum, dOp, size, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_CALLBACK_02_001 + * @tc.name : getThumbnail + * @tc.desc : getThumbnail(audio) by no arg + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_CALLBACK_02_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_CALLBACK_02_001'; + let dOp = audioNameFetchOps(testNum, 'Audios/Thumbnail/', '01.mp3'); + let size = 'default'; + let isAudio = true; + await testGetThumbnail(done, testNum, dOp, size, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_CALLBACK_02_002 + * @tc.name : getThumbnail + * @tc.desc : getThumbnail(audio) by { width: 128, height: 128 } + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_CALLBACK_02_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_CALLBACK_02_002'; + let dOp = audioNameFetchOps(testNum, 'Audios/Thumbnail/', '02.mp3'); + let size = { width: 128, height: 128 }; + let isAudio = true; + await testGetThumbnail(done, testNum, dOp, size, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_CALLBACK_03_001 + * @tc.name : getThumbnail + * @tc.desc : getThumbnail(video) by no arg + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_CALLBACK_03_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_CALLBACK_03_001'; + let dOp = imageVideoNameFetchOps(testNum, 'Videos/Thumbnail/', '01.mp4'); + let size = 'default'; + let isAudio = false; + await testGetThumbnail(done, testNum, dOp, size, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_CALLBACK_03_002 + * @tc.name : getThumbnail + * @tc.desc : getThumbnail(video) by { width: 128, height: 128 } + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_CALLBACK_03_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_CALLBACK_03_002'; + let dOp = imageVideoNameFetchOps(testNum, 'Videos/Thumbnail/', '02.mp4'); + let size = { width: 128, height: 128 }; + let isAudio = false; + await testGetThumbnail(done, testNum, dOp, size, isAudio); + }); + }); +} + diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetGetThumbnailPromise.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetGetThumbnailPromise.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2c2d3282540a73537682e79779af604b6300a140 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetGetThumbnailPromise.test.ets @@ -0,0 +1,175 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; +import image from '@ohos.multimedia.image'; +import { + sleep, + checkPresetsAssets, + checkAssetsCount, + audioNameFetchOps, + imageVideoNameFetchOps, +} from '../../../../../../common'; + +export default function fileAssetGetThumbnailPromiseTest(abilityContext) { + describe('fileAssetGetThumbnailPromiseTest', function () { + image.createPixelMap(new ArrayBuffer(4096), { size: { height: 1, width: 2 } }).then((pixelmap) => { }); + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrGetThumbnailTest'); + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + async function testGetThumbnail(done, testNum, fetchOp, size, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); + if (!checkAssetCountPass) return; + let asset = await fetchAssetResult.getFirstObject(); + fetchAssetResult.close(); + console.info(`${testNum}:displayName ${asset.displayName}`) + let pixelmap; + if (size == 'default') { + size = { width: 256, height: 256 }; + pixelmap = await asset.getThumbnail() + } else { + pixelmap = await asset.getThumbnail(size) + } + let info = await pixelmap.getImageInfo(); + console.info(`${testNum}:: width :${info.size.width} height :${info.size.height}`); + expect(info.size.width).assertEqual(size.width); + expect(info.size.height).assertEqual(size.height); + done(); + } catch (error) { + console.info(`${testNum}:: error :${error}`); + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_PROMISE_01_001 + * @tc.name : getThumbnail + * @tc.desc : getThumbnail(image) by no arg + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_PROMISE_01_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_PROMISE_01_001'; + let dOp = imageVideoNameFetchOps(testNum, 'Pictures/Thumbnail/', '01.jpg'); + let size = 'default'; + let isAudio = false; + await testGetThumbnail(done, testNum, dOp, size, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_PROMISE_01_002 + * @tc.name : getThumbnail + * @tc.desc : getThumbnail(image) by { width: 128, height: 128 } + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_PROMISE_01_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_PROMISE_01_002'; + let dOp = imageVideoNameFetchOps(testNum, 'Pictures/Thumbnail/', '02.jpg'); + let size = { width: 128, height: 128 }; + let isAudio = false; + await testGetThumbnail(done, testNum, dOp, size, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_PROMISE_02_001 + * @tc.name : getThumbnail + * @tc.desc : getThumbnail(audio) by no arg + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_PROMISE_02_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_PROMISE_02_001'; + let dOp = audioNameFetchOps(testNum, 'Audios/Thumbnail/', '01.mp3'); + let size = 'default'; + let isAudio = true; + await testGetThumbnail(done, testNum, dOp, size, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_PROMISE_02_002 + * @tc.name : getThumbnail + * @tc.desc : getThumbnail(audio) by { width: 128, height: 128 } + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_PROMISE_02_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_PROMISE_02_002'; + let dOp = audioNameFetchOps(testNum, 'Audios/Thumbnail/', '02.mp3'); + let size = { width: 128, height: 128 }; + let isAudio = true; + await testGetThumbnail(done, testNum, dOp, size, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_PROMISE_03_001 + * @tc.name : getThumbnail + * @tc.desc : getThumbnail(video) by no arg + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_PROMISE_03_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_PROMISE_03_001'; + let dOp = imageVideoNameFetchOps(testNum, 'Videos/Thumbnail/', '01.mp4'); + let size = 'default'; + let isAudio = false; + await testGetThumbnail(done, testNum, dOp, size, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_PROMISE_03_002 + * @tc.name : getThumbnail + * @tc.desc : getThumbnail(video) by { width: 128, height: 128 } + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_PROMISE_03_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_GETTHUMBNAIL_PROMISE_03_002'; + let dOp = imageVideoNameFetchOps(testNum, 'Videos/Thumbnail/', '02.mp4'); + let size = { width: 128, height: 128 }; + let isAudio = false; + await testGetThumbnail(done, testNum, dOp, size, isAudio); + }); + }); +} + diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenCallback.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenCallback.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..923205f079731ebd03b170dfae48152e454a23fd --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenCallback.test.ets @@ -0,0 +1,450 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import fileio from '@ohos.fileio'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; +import { + sleep, + audioFetchOps, + imageVideoFetchOps, + audioNameFetchOps, + imageVideoNameFetchOps, + isNum, + checkPresetsAssets, + checkAssetsCount, +} from '../../../../../../common'; +export default function fileAssetOpenCallbackTest(abilityContext) { + describe('fileAssetOpenCallbackTest', function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest') + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + const rOpenTest = async function (done, testNum, fetchOp, assetProps, expectCount, isAudio) { + let asset; + let fd; + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); + if (!checkAssetCountPass) return; + asset = await fetchAssetResult.getFirstObject(); + fetchAssetResult.close(); + asset.open('r', async (err, fd) => { + if (err) { + console.info(`${testNum} :: err: ${err}`); + expect.assertFail(); + done(); + return; + } + expect(isNum(fd)).assertTrue(); + let buf = new ArrayBuffer(4096); + let res = await fileio.read(fd, buf); + console.log(' bytesRead: ' + res.bytesRead) + expect(res.bytesRead).assertEqual(assetProps.bytesRead); + try { + await fileio.write(fd, buf); + expect.assertFail(); + } catch (error) { + expect(true).assertTrue(); + await asset.close(fd); + } + done(); + }); + } catch (error) { + console.info(`${testNum} :: error: ${error}`); + expect.assertFail(); + await asset.close(fd); + done(); + } + } + + const wOpenTest = async function (done, testNum, fetchOp, assetProps, expectCount, isAudio) { + let asset, asset1; + let fd, fd1; + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); + if (!checkAssetCountPass) return; + asset = await fetchAssetResult.getFirstObject(); + asset1 = await fetchAssetResult.getNextObject(); + fetchAssetResult.close(); + asset.open('w', async (err, fd) => { + if (err) { + console.info(`${testNum} :: err: ${err}`); + expect.assertFail(); + done(); + return; + } + expect(isNum(fd)).assertTrue(); + fd1 = await asset1.open('r'); + let buf = new ArrayBuffer(4096); + await fileio.read(fd1, buf); + let write = await fileio.write(fd, buf); + console.info(`${testNum} :: write: ${write}`); + expect(write).assertEqual(assetProps.write); + let buf1 = new ArrayBuffer(4096); + try { + await fileio.read(fd, buf1); + expect.assertFail(); + } catch (error) { + expect(true).assertTrue(); + } + done(); + }); + } catch (error) { + console.info(`${testNum} :: error: ${error}`); + expect(false).assertTrue(); + await asset.close(fd); + await asset1.close(fd1); + done(); + } + } + + const rwOpenTest = async function (done, testNum, fetchOp, assetProps, expectCount, isAudio) { + let asset, asset1; + let fd, fd1; + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); + if (!checkAssetCountPass) return; + asset = await fetchAssetResult.getFirstObject(); + asset.open('rw', async (err, fd) => { + if (err) { + console.info(`${testNum} :: err: ${err}`); + expect.assertFail(); + done(); + return; + } + expect(isNum(fd)).assertTrue(); + let buf = new ArrayBuffer(4096); + let res = await fileio.read(fd, buf); + expect(res.bytesRead).assertEqual(assetProps.bytesRead); + asset1 = await fetchAssetResult.getNextObject(); + fd1 = await asset1.open('r'); + expect(isNum(fd1)).assertTrue(); + let buf1 = new ArrayBuffer(4096); + await fileio.read(fd1, buf1); + let write = await fileio.write(fd, buf1); + expect(write).assertEqual(assetProps.write); + console.info(`res.bytesRead:${res.bytesRead},write:${write}`) + console.info(`fd1:${fd1},fd:${fd}`) + await asset.close(fd); + await asset1.close(fd1); + fetchAssetResult.close(); + done(); + }); + } catch (error) { + console.info(`${testNum} :: error: ${error}`); + await asset.close(fd); + await asset1.close(fd1); + expect.assertFail(); + done(); + } + } + + const closeTest = async function (done, testNum, fetchOp, isAudio) { + let asset; + let fd; + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); + if (!checkAssetCountPass) return; + const asset = await fetchAssetResult.getFirstObject(); + fd = await asset.open('r'); + expect(isNum(fd)).assertTrue(); + asset.close(fd, async (err) => { + if (err) { + console.info(`${testNum} :: err: ${err}`); + expect.assertFail(); + done(); + return; + } + let count = 0 + let buf = new ArrayBuffer(4096); + try { + await fileio.read(fd, buf); + } catch (error) { + count++ + } + try { + await fileio.write(fd, buf); + } catch (error) { + count++ + } + await sleep(1000) + expect(count).assertEqual(2); + done(); + }); + } catch (error) { + console.info(`${testNum} error:${error}`) + await asset.close(fd); + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_01_001 + * @tc.name : open('r') + * @tc.desc : open -r the type of image + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_01_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_01_001'; + let fetchOp = imageVideoFetchOps(testNum, 'Pictures/R_Cb/'); + let assetProps = { + bytesRead: 4096, + }; + let expectCount = 1; + let isAudio = false; + await rOpenTest(done, testNum, fetchOp, assetProps, expectCount, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_01_002 + * @tc.name : open('w') + * @tc.desc : open -w the type of image + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_01_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_01_002'; + let fetchOp = imageVideoFetchOps(testNum, 'Pictures/W_Cb/'); + let assetProps = { + write: 4096, + }; + let expectCount = 2; + let isAudio = false; + await wOpenTest(done, testNum, fetchOp, assetProps, expectCount, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_01_003 + * @tc.name : open('rw') + * @tc.desc : open -rw the type of image + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_01_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_01_003'; + let fetchOp = imageVideoFetchOps(testNum, 'Pictures/RW_Cb/'); + let assetProps = { + bytesRead: 4096, + write: 4096, + }; + let expectCount = 2; + let isAudio = false; + await rwOpenTest(done, testNum, fetchOp, assetProps, expectCount, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_02_001 + * @tc.name : open('r') + * @tc.desc : open -r the type of audio + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_02_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_02_001'; + let fetchOp = audioFetchOps(testNum, 'Audios/R_Cb/'); + let assetProps = { + bytesRead: 4096, + }; + let expectCount = 1; + let isAudio = true; + await rOpenTest(done, testNum, fetchOp, assetProps, expectCount, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_02_002 + * @tc.name : open('w') + * @tc.desc : open -w the type of audio + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_02_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_02_002'; + let fetchOp = audioFetchOps(testNum, 'Audios/W_Cb/'); + let assetProps = { + write: 4096, + }; + let expectCount = 2; + let isAudio = true; + await wOpenTest(done, testNum, fetchOp, assetProps, expectCount, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_02_003 + * @tc.name : open('rw') + * @tc.desc : open -rw the type of audio + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_02_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_02_003'; + let fetchOp = audioFetchOps(testNum, 'Audios/RW_Cb/'); + let assetProps = { + bytesRead: 4096, + write: 4096, + }; + let expectCount = 2; + let isAudio = true; + await rwOpenTest(done, testNum, fetchOp, assetProps, expectCount, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_03_001 + * @tc.name : open('r') + * @tc.desc : open -r the type of video + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_03_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_03_001'; + let fetchOp = imageVideoFetchOps(testNum, 'Videos/R_Cb/'); + let assetProps = { + bytesRead: 4096, + }; + let expectCount = 1; + let isAudio = false; + await rOpenTest(done, testNum, fetchOp, assetProps, expectCount, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_03_002 + * @tc.name : open('w') + * @tc.desc : open -w the type of video + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_03_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_03_002'; + let fetchOp = imageVideoFetchOps(testNum, 'Videos/W_Cb/'); + let assetProps = { + write: 4096, + }; + let expectCount = 2; + let isAudio = false; + await wOpenTest(done, testNum, fetchOp, assetProps, expectCount, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_03_003 + * @tc.name : open('rw') + * @tc.desc : open -rw the type of video + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_03_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_OPEN_CALLBACK_03_003'; + let fetchOp = imageVideoFetchOps(testNum, 'Videos/RW_Cb/'); + let assetProps = { + bytesRead: 4096, + write: 4096, + }; + let expectCount = 2; + let isAudio = false; + await rwOpenTest(done, testNum, fetchOp, assetProps, expectCount, isAudio); + }); + + //------------------------------------------------------------------------------------ + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_CLOSE_CALLBACK_01 + * @tc.name : close + * @tc.desc : asset close the type of image + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_CLOSE_CALLBACK_01', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_CLOSE_CALLBACK_01'; + let fetchOp = imageVideoNameFetchOps(testNum, 'Pictures/openClose/', '01.jpg'); + let isAudio = false; + await closeTest(done, testNum, fetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_CLOSE_CALLBACK_02 + * @tc.name : close + * @tc.desc : asset close the type of audio + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_CLOSE_CALLBACK_02', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_CLOSE_CALLBACK_02'; + let fetchOp = audioNameFetchOps(testNum, 'Audios/openClose/', '01.mp3'); + let isAudio = true; + await closeTest(done, testNum, fetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_CLOSE_CALLBACK_03 + * @tc.name : close + * @tc.desc : asset close the type of video + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_CLOSE_CALLBACK_03', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_CLOSE_CALLBACK_03'; + let fetchOp = imageVideoNameFetchOps(testNum, 'Videos/openClose/', '01.mp4'); + let isAudio = false; + await closeTest(done, testNum, fetchOp, isAudio); + }); + }); +} diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenPromise.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenPromise.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..50caea55ef5603477172f6b2a9cd204fcdda000c --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetOpenPromise.test.ets @@ -0,0 +1,429 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import fileio from '@ohos.fileio'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; +import { + sleep, + IMAGE_TYPE, + VIDEO_TYPE, + AUDIO_TYPE, + audioFetchOps, + imageVideoFetchOps, + audioNameFetchOps, + imageVideoNameFetchOps, + checkPresetsAssets, + checkAssetsCount, + isNum, +} from '../../../../../../common'; +export default function fileAssetOpenPromiseTest(abilityContext) { + describe('fileAssetOpenPromiseTest', function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + await checkPresetsAssets(userfilemgr, 'ActsUserFileMgrFileAssetJsTest') + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + const rOpenTest = async function (done, testNum, fetchOp, assetProps, expectCount, isAudio) { + let asset; + let fd; + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); + if (!checkAssetCountPass) return; + asset = await fetchAssetResult.getFirstObject(); + fetchAssetResult.close(); + fd = await asset.open('r'); + expect(isNum(fd)).assertTrue(); + let buf = new ArrayBuffer(4096); + let res = await fileio.read(fd, buf); + console.log(' bytesRead: ' + res.bytesRead) + expect(res.bytesRead).assertEqual(assetProps.bytesRead); + try { + await fileio.write(fd, buf); + expect.assertFail(); + } catch (error) { + expect(true).assertTrue(); + await asset.close(fd); + done(); + } + } catch (error) { + console.info(`${testNum} :: error: ${error}`); + expect.assertFail(); + await asset.close(fd); + done(); + } + } + + const wOpenTest = async function (done, testNum, fetchOp, assetProps, expectCount, isAudio) { + let asset, asset1; + let fd, fd1; + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); + if (!checkAssetCountPass) return; + asset = await fetchAssetResult.getFirstObject(); + asset1 = await fetchAssetResult.getNextObject(); + fetchAssetResult.close(); + + fd = await asset.open('w'); + expect(isNum(fd)).assertTrue(); + fd1 = await asset1.open('r'); + let buf = new ArrayBuffer(4096); + await fileio.read(fd1, buf); + let write = await fileio.write(fd, buf); + console.info(`${testNum} :: write: ${write}`); + expect(write).assertEqual(assetProps.write); + let buf1 = new ArrayBuffer(4096); + try { + await fileio.read(fd, buf1); + expect.assertFail(); + + } catch (error) { + expect(true).assertTrue(); + + } + done(); + } catch (error) { + console.info(`${testNum} :: error: ${error}`); + expect(false).assertTrue(); + await asset.close(fd); + await asset1.close(fd1); + done(); + } + } + + const rwOpenTest = async function (done, testNum, fetchOp, assetProps, expectCount, isAudio) { + let asset, asset1; + let fd, fd1; + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, expectCount); + if (!checkAssetCountPass) return; + asset = await fetchAssetResult.getFirstObject(); + fd = await asset.open('rw'); + expect(isNum(fd)).assertTrue(); + let buf = new ArrayBuffer(4096); + let res = await fileio.read(fd, buf); + expect(res.bytesRead).assertEqual(assetProps.bytesRead); + asset1 = await fetchAssetResult.getNextObject(); + fd1 = await asset1.open('r'); + expect(isNum(fd1)).assertTrue(); + let buf1 = new ArrayBuffer(4096); + await fileio.read(fd1, buf1); + let write = await fileio.write(fd, buf1); + expect(write).assertEqual(assetProps.write); + console.info(`res.bytesRead:${res.bytesRead},write:${write}`) + console.info(`fd1:${fd1},fd:${fd}`) + await asset.close(fd); + await asset1.close(fd1); + fetchAssetResult.close(); + done(); + } catch (error) { + console.info(`${testNum} :: error: ${error}`); + await asset.close(fd); + await asset1.close(fd1); + expect.assertFail(); + done(); + } + } + + const closeTest = async function (done, testNum, fetchOp, isAudio) { + let asset; + let fd; + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); + if (!checkAssetCountPass) return; + const asset = await fetchAssetResult.getFirstObject(); + fd = await asset.open('r'); + expect(isNum(fd)).assertTrue(); + await asset.close(fd); + let count = 0 + let buf = new ArrayBuffer(4096); + try { + await fileio.read(fd, buf); + } catch (error) { + count++ + } + try { + await fileio.write(fd, buf); + } catch (error) { + count++ + } + await sleep(1000) + expect(count).assertEqual(2); + done(); + } catch (error) { + console.info(`${testNum} error:${error}`) + await asset.close(fd); + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_01_001 + * @tc.name : open('r') + * @tc.desc : open -r the type of image + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_01_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_01_001'; + let fetchOp = imageVideoFetchOps(testNum, 'Pictures/R_Pro/'); + let assetProps = { + bytesRead: 4096, + }; + let expectCount = 1; + let isAudio = false; + await rOpenTest(done, testNum, fetchOp, assetProps, expectCount, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_01_002 + * @tc.name : open('w') + * @tc.desc : open -w the type of image + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_01_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_01_002'; + let fetchOp = imageVideoFetchOps(testNum, 'Pictures/W_Pro/'); + let assetProps = { + write: 4096, + }; + let expectCount = 2; + let isAudio = false; + await wOpenTest(done, testNum, fetchOp, assetProps, expectCount, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_01_003 + * @tc.name : open('rw') + * @tc.desc : open -rw the type of image + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_01_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_01_003'; + let fetchOp = imageVideoFetchOps(testNum, 'Pictures/RW_Pro/'); + let assetProps = { + bytesRead: 4096, + write: 4096, + }; + let expectCount = 2; + let isAudio = false; + await rwOpenTest(done, testNum, fetchOp, assetProps, expectCount, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_02_001 + * @tc.name : open('r') + * @tc.desc : open -r the type of audio + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_02_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_02_001'; + let fetchOp = audioFetchOps(testNum, 'Audios/R_Pro/'); + let assetProps = { + bytesRead: 4096, + }; + let expectCount = 1; + let isAudio = true; + await rOpenTest(done, testNum, fetchOp, assetProps, expectCount, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_02_002 + * @tc.name : open('w') + * @tc.desc : open -w the type of audio + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_02_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_02_002'; + let fetchOp = audioFetchOps(testNum, 'Audios/W_Pro/'); + let assetProps = { + write: 4096, + }; + let expectCount = 2; + let isAudio = true; + await wOpenTest(done, testNum, fetchOp, assetProps, expectCount, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_02_003 + * @tc.name : open('rw') + * @tc.desc : open -rw the type of audio + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_02_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_02_003'; + let fetchOp = audioFetchOps(testNum, 'Audios/RW_Pro/'); + let assetProps = { + bytesRead: 4096, + write: 4096, + }; + let expectCount = 2; + let isAudio = true; + await rwOpenTest(done, testNum, fetchOp, assetProps, expectCount, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_03_001 + * @tc.name : open('r') + * @tc.desc : open -r the type of video + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_03_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_03_001'; + let fetchOp = imageVideoFetchOps(testNum, 'Videos/R_Pro/'); + let assetProps = { + bytesRead: 4096, + }; + let expectCount = 1; + let isAudio = false; + await rOpenTest(done, testNum, fetchOp, assetProps, expectCount, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_03_002 + * @tc.name : open('w') + * @tc.desc : open -w the type of video + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_03_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_03_002'; + let fetchOp = imageVideoFetchOps(testNum, 'Videos/W_Pro/'); + let assetProps = { + write: 4096, + }; + let expectCount = 2; + let isAudio = false; + await wOpenTest(done, testNum, fetchOp, assetProps, expectCount, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_03_003 + * @tc.name : open('rw') + * @tc.desc : open -rw the type of video + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_03_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_OPEN_PROMISE_03_003'; + let fetchOp = imageVideoFetchOps(testNum, 'Videos/RW_Pro/'); + let assetProps = { + bytesRead: 4096, + write: 4096, + }; + let expectCount = 2; + let isAudio = false; + await rwOpenTest(done, testNum, fetchOp, assetProps, expectCount, isAudio); + }); + + //-------------------------------------------------------------------------------- + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_CLOSE_PROMISE_01 + * @tc.name : close + * @tc.desc : asset close the type of image + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_CLOSE_PROMISE_01', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_CLOSE_PROMISE_01'; + let fetchOp = imageVideoNameFetchOps(testNum, 'Pictures/openClose/', '02.jpg'); + let isAudio = false; + await closeTest(done, testNum, fetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_CLOSE_PROMISE_02 + * @tc.name : close + * @tc.desc : asset close the type of audio + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_CLOSE_PROMISE_02', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_CLOSE_PROMISE_03'; + let fetchOp = audioNameFetchOps(testNum, 'Audios/openClose/', '02.mp3'); + let isAudio = true; + await closeTest(done, testNum, fetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_CLOSE_PROMISE_03 + * @tc.name : close + * @tc.desc : asset close the type of video + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_CLOSE_PROMISE_03', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_CLOSE_PROMISE_03'; + let fetchOp = imageVideoNameFetchOps(testNum, 'Videos/openClose/', '02.mp4'); + let isAudio = false; + await closeTest(done, testNum, fetchOp, isAudio); + }); + }); +} diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashCallback.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashCallback.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f998da1d1204f72f59aa1dae57957700c794fdc6 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashCallback.test.ets @@ -0,0 +1,361 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index"; +import { + sleep, + allFetchOp, + audioNameFetchOps, + imageVideoNameFetchOps, + albumFetchOps, + checkAssetsCount, +} from "../../../../../../common"; + +export default function fileAssetTrashCallbackTest(abilityContext) { + describe("fileAssetTrashCallbackTest", function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info("beforeAll case"); + }); + beforeEach(function () { + console.info("beforeEach case"); + }); + afterEach(async function () { + console.info("afterEach case"); + await sleep; + }); + afterAll(async function () { + console.info("afterAll case"); + }); + + const isTrashTest = async function (done, testNum, fetchOp, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); + if (!checkAssetCountPass) return; + let asset = await fetchAssetResult.getFirstObject(); + asset.isTrash(async (err, isTrash) => { + if (err) { + expect(false).assertTrue(); + await fetchAssetResult.close(); + done(); + return; + } + expect(isTrash).assertEqual(false); + fetchAssetResult.close(); + done() + }); + } catch (error) { + console.info(`${testNum} failed error: ${error}`) + expect(false).assertTrue(); + done(); + } + } + + async function setTrash(done, testNum, databasefFetchOps, ablumFetchOps, noAlbum, isAudio) { + let expectAssetNum = 3 + try { + // database info + let databaseFetchFileResult; + if (isAudio) { + databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps); + } else { + databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); + } + let count = databaseFetchFileResult.getCount(); + //album info + if (!noAlbum) { + let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps); + let album = await fetchAlbumResult.getFirstObject(); + let op: userFileManager.FetchOptions = allFetchOp(); + let albumFetchFileResult = await album.getPhotoAssets(op); + let albumFilesCount = albumFetchFileResult.getCount(); + expect(albumFilesCount).assertEqual(expectAssetNum); + fetchAlbumResult.close(); + } + // file info + let asset = await databaseFetchFileResult.getFirstObject(); + let istrash = await asset.isTrash(); + console.info(`${testNum} istrash: ${istrash}`); + // trash operation + asset.trash(true, async (err) => { + if (err) { + console.info(`${testNum} err: ${err}`); + expect(false).assertTrue(); + done(); + return; + } + asset.isTrash(async (err, trashState) => { + if (err) { + console.info(`${testNum} err: ${err}`); + expect(false).assertTrue(); + done(); + return; + } + expect(trashState).assertTrue(); + try { + // after trash database info + let databaseFetchFileResult; + if (isAudio) { + databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps); + } else { + databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); + } + let databaseCount = databaseFetchFileResult.getCount(); + databaseFetchFileResult.close(); + + expect(databaseCount).assertEqual(count - 1); + //album info + if (!noAlbum) { + let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps); + let album = await fetchAlbumResult.getFirstObject(); + let op: userFileManager.FetchOptions = allFetchOp(); + let albumFetchFileResult = await album.getPhotoAssets(op); + let albumFilesCount = albumFetchFileResult.getCount(); + expect(albumFilesCount).assertEqual(expectAssetNum - 1); + fetchAlbumResult.close(); + } + await asset.trash(false); + done(); + } catch (error) { + console.info(`${testNum} error: ${error}`); + expect(false).assertTrue(); + done(); + } + }); + }); + } catch (error) { + console.info(`${testNum} error: ${error}`); + expect(false).assertTrue(); + done(); + } + } + + async function recovery(done, testNum, databasefFetchOps, ablumFetchOps, noAlbum, isAudio) { + let expectAssetNum = 3; + try { + let databaseFetchFileResult; + if (isAudio) { + databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps); + } else { + databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); + } + let count = databaseFetchFileResult.getCount(); + let asset = await databaseFetchFileResult.getFirstObject(); + await asset.trash(true); + asset.trash(false, async (err) => { + if (err) { + console.info(`${testNum} err: ${err}`); + expect(false).assertTrue(); + done(); + return; + } + asset.isTrash(async (err, trashState) => { + if (err) { + console.info(`${testNum} err: ${err}`); + expect(false).assertTrue(); + done(); + return; + } + expect(trashState).assertFalse(); + try { + let databaseFetchFileResult; + if (isAudio) { + databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps); + } else { + databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); + } + let databaseCount = databaseFetchFileResult.getCount(); + databaseFetchFileResult.close(); + expect(databaseCount).assertEqual(count); + //album info + if (!noAlbum) { + let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps); + let album = await fetchAlbumResult.getFirstObject(); + let op: userFileManager.FetchOptions = allFetchOp(); + let albumFetchFileResult = await album.getPhotoAssets(op); + let albumFilesCount = albumFetchFileResult.getCount(); + expect(albumFilesCount).assertEqual(expectAssetNum); + fetchAlbumResult.close(); + } + done(); + } catch (error) { + console.info(`${testNum} error: ${error}`); + expect(false).assertTrue(); + done(); + } + }); + }); + } catch (error) { + console.info(`${testNum} error: ${error}`); + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_01_001 + * @tc.name : isTrash + * @tc.desc : isTrash(image) result false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_01_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_01_001' + let currentFetchOp = imageVideoNameFetchOps(testNum, 'Pictures/trashCb/', '01.jpg'); + let isAudio = false; + await isTrashTest(done, testNum, currentFetchOp, isAudio) + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_01_002 + * @tc.name : trash + * @tc.desc : trash(image) by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_01_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_01_002' + let rOps = imageVideoNameFetchOps(testNum, "Pictures/trashCb/", '02.jpg'); + let aOps = albumFetchOps(testNum, "Pictures/", "trashCb"); + let noAlbum = false; + let isAudio = false; + await setTrash(done, testNum, rOps, aOps, noAlbum, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_01_003 + * @tc.name : trash + * @tc.desc : trash(image) by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_01_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_01_003' + let rOps = imageVideoNameFetchOps(testNum, "Pictures/trashCb/", '03.jpg'); + let aOps = albumFetchOps(testNum, "Pictures/", "trashCb"); + let noAlbum = false; + let isAudio = false; + await recovery(done, testNum, rOps, aOps, noAlbum, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_02_001 + * @tc.name : isTrash + * @tc.desc : isTrash(audio) result false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_02_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_02_001' + let currentFetchOp = audioNameFetchOps(testNum, 'Audios/trashCb/', '01.mp3'); + let isAudio = true; + await isTrashTest(done, testNum, currentFetchOp, isAudio) + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_02_002 + * @tc.name : trash + * @tc.desc : trash(audio) by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_02_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_02_002' + let rOps = audioNameFetchOps(testNum, "Audios/trashCb/", '02.mp3'); + let aOps = albumFetchOps(testNum, "Audios/", "trashCb"); + let noAlbum = true; + let isAudio = true; + await setTrash(done, testNum, rOps, aOps, noAlbum, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_02_003 + * @tc.name : trash + * @tc.desc : trash(audio) by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_02_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_02_003' + let rOps = audioNameFetchOps(testNum, "Audios/trashCb/", '03.mp3'); + let aOps = albumFetchOps(testNum, "Audios/", "trashCb"); + let noAlbum = true; + let isAudio = true; + await recovery(done, testNum, rOps, aOps, noAlbum, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_03_001 + * @tc.name : isTrash + * @tc.desc : isTrash(video) result false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_03_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_03_001' + let currentFetchOp = imageVideoNameFetchOps(testNum, 'Videos/trashCb/', '01.mp4'); + let isAudio = false; + await isTrashTest(done, testNum, currentFetchOp, isAudio) + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_03_002 + * @tc.name : trash + * @tc.desc : trash(video) by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_03_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_03_002' + let rOps = imageVideoNameFetchOps(testNum, "Videos/trashCb/", '02.mp4'); + let aOps = albumFetchOps(testNum, "Videos/", "trashCb"); + let noAlbum = true; + let isAudio = false; + await setTrash(done, testNum, rOps, aOps, noAlbum, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_03_003 + * @tc.name : trash + * @tc.desc : trash(video) by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_03_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_TRASH_CALLBACK_03_003' + let rOps = imageVideoNameFetchOps(testNum, "Videos/trashCb/", '03.mp4'); + let aOps = albumFetchOps(testNum, "Videos/", "trashCb"); + let noAlbum = true; + let isAudio = false; + await recovery(done, testNum, rOps, aOps, noAlbum, isAudio); + }); + }); +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashPromise.test.ets b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashPromise.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..9dff1abafcab15b99ec6aaa03b8db4f94de08e12 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/ets/test/fileAssetTrashPromise.test.ets @@ -0,0 +1,307 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "deccjsunit/index"; +import { + sleep, + allFetchOp, + audioNameFetchOps, + imageVideoNameFetchOps, + albumFetchOps, + checkAssetsCount, +} from "../../../../../../common"; + +export default function fileAssetTrashPromiseTest(abilityContext) { + describe("fileAssetTrashPromiseTest", function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info("beforeAll case"); + }); + beforeEach(function () { + console.info("beforeEach case"); + }); + afterEach(async function () { + console.info("afterEach case"); + await sleep; + }); + afterAll(async function () { + console.info("afterAll case"); + }); + + const isTrashTest = async function (done, testNum, fetchOp, isAudio) { + try { + let fetchAssetResult; + if (isAudio) { + fetchAssetResult = await userfilemgr.getAudioAssets(fetchOp); + } else { + fetchAssetResult = await userfilemgr.getPhotoAssets(fetchOp); + } + let checkAssetCountPass = await checkAssetsCount(done, testNum, fetchAssetResult, 1); + if (!checkAssetCountPass) return; + let asset = await fetchAssetResult.getFirstObject(); + let isTrash = await asset.isTrash(); + expect(isTrash).assertEqual(false); + fetchAssetResult.close(); + done(); + } catch (error) { + console.info(`${testNum} failed error: ${error}`) + expect(false).assertTrue(); + done(); + } + } + + async function setTrash(done, testNum, databasefFetchOps, ablumFetchOps, noAlbum, isAudio) { + let expectAssetNum = 3 + try { + // database info + let databaseFetchFileResult; + if (isAudio) { + databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps); + } else { + databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); + } + let count = databaseFetchFileResult.getCount(); + //album info + if (!noAlbum) { + let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps); + let album = await fetchAlbumResult.getFirstObject(); + let op: userFileManager.FetchOptions = allFetchOp(); + let albumFetchFileResult = await album.getPhotoAssets(op); + let albumFilesCount = albumFetchFileResult.getCount(); + expect(albumFilesCount).assertEqual(expectAssetNum); + fetchAlbumResult.close(); + } + // file info + let asset = await databaseFetchFileResult.getFirstObject(); + // trash operation + await asset.trash(true); + let istrash = await asset.isTrash(); + console.info(`${testNum} istrash: ${istrash}`); + databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); + if (isAudio) { + databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps); + } else { + databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); + } + let databaseCount = databaseFetchFileResult.getCount(); + databaseFetchFileResult.close() + expect(databaseCount).assertEqual(count - 1); + //album info + if (!noAlbum) { + var fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps); + var album = await fetchAlbumResult.getFirstObject(); + let op: userFileManager.FetchOptions = allFetchOp(); + var albumFetchFileResult = await album.getPhotoAssets(op); + var albumFilesCount = albumFetchFileResult.getCount(); + expect(albumFilesCount).assertEqual(expectAssetNum - 1); + fetchAlbumResult.close(); + } + await asset.trash(false); + done(); + } catch (error) { + console.info(`${testNum} error: ${error}`); + expect(false).assertTrue(); + done(); + } + } + + async function recovery(done, testNum, databasefFetchOps, ablumFetchOps, noAlbum, isAudio) { + let expectAssetNum = 3; + try { + let databaseFetchFileResult; + if (isAudio) { + databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps); + } else { + databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); + } + let count = databaseFetchFileResult.getCount(); + let asset = await databaseFetchFileResult.getFirstObject(); + await asset.trash(true); + await asset.trash(false); + if (isAudio) { + databaseFetchFileResult = await userfilemgr.getAudioAssets(databasefFetchOps); + } else { + databaseFetchFileResult = await userfilemgr.getPhotoAssets(databasefFetchOps); + } + let databaseCount = databaseFetchFileResult.getCount(); + databaseFetchFileResult.close(); + expect(databaseCount).assertEqual(count); + //album info + if (!noAlbum) { + let fetchAlbumResult = await userfilemgr.getPhotoAlbums(ablumFetchOps); + let album = await fetchAlbumResult.getFirstObject(); + let op: userFileManager.FetchOptions = allFetchOp(); + let albumFetchFileResult = await album.getPhotoAssets(op); + let albumFilesCount = albumFetchFileResult.getCount(); + expect(albumFilesCount).assertEqual(expectAssetNum); + fetchAlbumResult.close(); + } + done(); + } catch (error) { + console.info(`${testNum} error: ${error}`); + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_01_001 + * @tc.name : isTrash + * @tc.desc : isTrash(image) result false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_01_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_01_001'; + let currentFetchOp = imageVideoNameFetchOps(testNum, 'Pictures/trashPro/', '01.jpg'); + let isAudio = false; + await isTrashTest(done, testNum, currentFetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_01_002 + * @tc.name : trash + * @tc.desc : trash(image) by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_01_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_01_002'; + let rOps = imageVideoNameFetchOps(testNum, "Pictures/trashPro/", '02.jpg'); + let aOps = albumFetchOps(testNum, "Pictures/", "trashPro"); + let noAlbum = false; + let isAudio = false; + await setTrash(done, testNum, rOps, aOps, noAlbum, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_01_003 + * @tc.name : trash + * @tc.desc : trash(image) by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_01_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_01_003' + let rOps = imageVideoNameFetchOps(testNum, "Pictures/trashPro/", '03.jpg'); + let aOps = albumFetchOps(testNum, "Pictures/", "trashPro"); + let noAlbum = false; + let isAudio = false; + await recovery(done, testNum, rOps, aOps, noAlbum, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_02_001 + * @tc.name : isTrash + * @tc.desc : isTrash(audio) result false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_02_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_02_001' + let currentFetchOp = audioNameFetchOps(testNum, 'Audios/trashPro/', '01.mp3'); + let isAudio = true; + await isTrashTest(done, testNum, currentFetchOp, isAudio) + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_02_002 + * @tc.name : trash + * @tc.desc : trash(audio) by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_02_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_02_002' + let rOps = audioNameFetchOps(testNum, "Audios/trashPro/", '02.mp3'); + let aOps = albumFetchOps(testNum, "Audios/", "trashPro"); + let noAlbum = true; + let isAudio = true; + await setTrash(done, testNum, rOps, aOps, noAlbum, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_02_003 + * @tc.name : trash + * @tc.desc : trash(audio) by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_02_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_02_003' + let rOps = audioNameFetchOps(testNum, "Audios/trashPro/", '03.mp3'); + let aOps = albumFetchOps(testNum, "Audios/", "trashPro"); + let noAlbum = true; + let isAudio = true; + await recovery(done, testNum, rOps, aOps, noAlbum, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_03_001 + * @tc.name : isTrash + * @tc.desc : isTrash(video) result false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_03_001', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_03_001' + let currentFetchOp = imageVideoNameFetchOps(testNum, 'Videos/trashPro/', '01.mp4'); + let isAudio = false; + await isTrashTest(done, testNum, currentFetchOp, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_03_002 + * @tc.name : trash + * @tc.desc : trash(video) by true + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_03_002', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_03_002' + let rOps = imageVideoNameFetchOps(testNum, "Videos/trashPro/", '02.mp4'); + let aOps = albumFetchOps(testNum, "Videos/", "trashPro"); + let noAlbum = false; + let isAudio = false; + await setTrash(done, testNum, rOps, aOps, noAlbum, isAudio); + }); + + /** + * @tc.number : SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_03_003 + * @tc.name : trash + * @tc.desc : trash(video) by false + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_03_003', 0, async function (done) { + let testNum = 'SUB_USERFILE_MGR_FILEASSET_TRASH_PROMISE_03_003' + let rOps = imageVideoNameFetchOps(testNum, "Videos/trashPro/", '03.mp4'); + let aOps = albumFetchOps(testNum, "Videos/", "trashPro"); + let noAlbum = false; + let isAudio = false; + await recovery(done, testNum, rOps, aOps, noAlbum, isAudio); + }); + }); +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/module.json b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/module.json new file mode 100755 index 0000000000000000000000000000000000000000..2315c8ab56cb06a6d553933c8487e57e176f0e68 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/module.json @@ -0,0 +1,84 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:mainability_description", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "ohos.acts.multimedia.userfilemgr.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:mainability_description", + "icon": "$media:icon", + "label": "$string:entry_MainAbility", + "visible": true, + "orientation": "portrait", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities":[ + "entity.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.GET_BUNDLE_INFO", + "reason": "use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "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_IMAGEVIDEO", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.READ_AUDIO", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.READ_DOCUMENT", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.WRITE_IMAGEVIDEO", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.WRITE_AUDIO", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.WRITE_DOCUMENT", + "reason":"use ohos.permission.WRITE_MEDIA" + } + ] + } +} diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/resources/base/element/string.json b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..d75a3fee650de2abaabfd60f40d90d9c6a4b0b0b --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "MediaLibraryJSTestMain" + }, + { + "name": "mainability_description", + "value": "MediaLibraryJSTestMain Ability" + } + ] + } \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/resources/base/media/icon.png b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/resources/base/media/icon.png differ diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/resources/base/profile/main_pages.json b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/resources/base/profile/main_pages.json new file mode 100755 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_fileAsset/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_fileAsset/signature/openharmony_sx.p7b b/multimedia/userfilemgr/userfilemgr_fileAsset/signature/openharmony_sx.p7b new file mode 100755 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/multimedia/userfilemgr/userfilemgr_fileAsset/signature/openharmony_sx.p7b differ diff --git a/multimedia/userfilemgr/userfilemgr_noPermission/AppScope/app.json b/multimedia/userfilemgr/userfilemgr_noPermission/AppScope/app.json new file mode 100755 index 0000000000000000000000000000000000000000..103cf8e6368fd2a71f15ca4506e1ce4e48a58669 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_noPermission/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app":{ + "bundleName":"ohos.acts.multimedia.userfilemgr", + "vendor":"huawei", + "versionCode":1000000, + "versionName":"1.0.0", + "debug":false, + "icon":"$media:icon", + "label":"$string:entry_MainAbility", + "description":"$string:mainability_description", + "distributedNotificationEnabled":true, + "keepAlive":true, + "singleUser":true, + "minAPIVersion":8, + "targetAPIVersion":8, + "car":{ + "apiCompatibleVersion":8, + "singleUser":false + } + } +} diff --git a/multimedia/userfilemgr/userfilemgr_noPermission/AppScope/resources/base/element/string.json b/multimedia/userfilemgr/userfilemgr_noPermission/AppScope/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..9b9d5b5e10c7ce74908c32b43d24568367b46d97 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_noPermission/AppScope/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "MediaLibraryJSTestMain" + }, + { + "name": "mainability_description", + "value": "MediaLibraryJSTestMain Ability" + } + ] +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_noPermission/AppScope/resources/base/media/app_icon.png b/multimedia/userfilemgr/userfilemgr_noPermission/AppScope/resources/base/media/app_icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/userfilemgr/userfilemgr_noPermission/AppScope/resources/base/media/app_icon.png differ diff --git a/multimedia/userfilemgr/userfilemgr_noPermission/BUILD.gn b/multimedia/userfilemgr/userfilemgr_noPermission/BUILD.gn new file mode 100755 index 0000000000000000000000000000000000000000..064eb330ef0284b78f356acb6e0f410ccaa19353 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_noPermission/BUILD.gn @@ -0,0 +1,40 @@ +# 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("userfilemgr_noPermission_js_hap") { + hap_profile = "entry/src/main/module.json" + deps = [ + ":mediaLibrary_js_assets", + ":mediaLibrary_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsUserFileMgrNoPermissionJsTest" +} + +ohos_app_scope("medialibrary_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("mediaLibrary_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("mediaLibrary_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":medialibrary_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/multimedia/userfilemgr/userfilemgr_noPermission/Test.json b/multimedia/userfilemgr/userfilemgr_noPermission/Test.json new file mode 100755 index 0000000000000000000000000000000000000000..21253d62089a7a20393a24b646213c3b24c76e64 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_noPermission/Test.json @@ -0,0 +1,47 @@ +{ + "description": "Configuration for userfilemgr Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "300000", + "package": "ohos.acts.multimedia.userfilemgr", + "shell-timeout": "600000" + }, + "kits": [ + { + "type": "ShellKit", + "pre-push": [ + ], + "run-command": [ + "rm -rf /storage/media/100/local/files/*", + "rm -rf /data/app/el2/100/database/com.ohos.medialibrary.medialibrarydata/*", + "mkdir -pv /storage/media/100/local/files/{Pictures,Videos,Audios}" + ] + }, + { + "type": "PushKit", + "pre-push": [ + ], + "push": [ + + ] + }, + { + "type": "ShellKit", + "run-command": [ + "hilog -Q pidoff", + "hilog -p off", + "hilog -b I", + "hilog -b D -D 0xD002B70", + "scanner", + "sleep 10" + ] + }, + { + "test-file-name": [ + "ActsUserFileMgrNoPermissionJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/Application/AbilityStage.ts b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/Application/AbilityStage.ts new file mode 100755 index 0000000000000000000000000000000000000000..14f230e140160dc5f94ecc462304621178f4cf64 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_noPermission/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/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/MainAbility/MainAbility.ts b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100755 index 0000000000000000000000000000000000000000..72b03d747b3e2e8bdf18ea37c54c789bebb767bb --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,36 @@ +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") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", 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") + } +}; \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/pages/index/index.ets b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/pages/index/index.ets new file mode 100755 index 0000000000000000000000000000000000000000..ac301f98781abd45f4d9d98fd7ffecfde9053ed9 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/pages/index/index.ets @@ -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 file from '@system.file'; + +import { Core, ExpectExtend, InstrumentLog, ReportExtend } from "deccjsunit/index" +import testsuite from "../../test/List.test.ets" + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters) + console.info('testsuite()---->') + testsuite(globalThis.abilityContext) + core.execute() + console.info('core.execute()---->') + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/pages/second/second.ets b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/pages/second/second.ets new file mode 100755 index 0000000000000000000000000000000000000000..1f2a06b64cdadcc83027bb6797e24536a2c85757 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/pages/second/second.ets @@ -0,0 +1,43 @@ +/* + * 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 router from '@system.router'; + +@Entry +@Component +struct Second { + private content: string = "Second Page" + + build() { + Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('back to index') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + router.back() + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/test/List.test.ets b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/test/List.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..8742e87b83310b1cb4ee61555e7ea131f20bde6b --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/test/List.test.ets @@ -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. + */ + +import userFileMgrNoPermissionCallback from './userFileMgrNoPermissionCallback.test.ets' +import userFileMgrNoPermissionPromise from './userFileMgrNoPermissionPromise.test.ets' +export default function testsuite(abilityContext) { + userFileMgrNoPermissionCallback(abilityContext) + userFileMgrNoPermissionPromise(abilityContext) +} diff --git a/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/test/userFileMgrNoPermissionCallback.test.ets b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/test/userFileMgrNoPermissionCallback.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..7d8a9769bd94fa8371d3ccfcab4e1461502af9e5 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/test/userFileMgrNoPermissionCallback.test.ets @@ -0,0 +1,110 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; + +import { + sleep, + allFetchOp, +} from '../../../../../../common'; + + +export default function userFileMgrNoPermissionCallback(abilityContext) { + describe('userFileMgrNoPermissionCallback', function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + const getPhotoAssetsTest = async function (done, testNum) { + try { + await userfilemgr.getPhotoAssets(allFetchOp(), async (err, fetchAssetResult) => { + if (err != undefined) { + console.info(`${testNum}, err: ${err}`); + expect(true).assertTrue(); + done(); + return; + } + expect(false).assertTrue(); + done(); + }) + } catch (error) { + console.info(`${testNum}, failed error: ${error}`) + expect(false).assertTrue(); + done(); + } + } + + const getPhotoAlbumsTest = async function (done, testNum) { + try { + await userfilemgr.getPhotoAlbums(allFetchOp(), async (err, fetchAlbumResult) => { + if (err != undefined) { + console.info(`${testNum}, err: ${err}`); + expect(true).assertTrue(); + done(); + return; + } + expect(false).assertTrue(); + done(); + }) + } catch (error) { + console.info(`${testNum}, failed error: ${error}`) + expect(false).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_01 + * @tc.name : getPhotoAssets + * @tc.desc : getPhotoAssets(image) with no permission + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_01', 0, async function (done) { + const testNum = 'SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_CALLBACK_01'; + await getPhotoAssetsTest(done, testNum); + }); + + //-------------------------------------------------------------------------------------- + + /** + * @tc.number : SUB_USERFILE_MGR_GETPHOTOALBUMS_NOPERMISSION_CALLBACK_01 + * @tc.name : getPhotoAlbums + * @tc.desc : getPhotoAlbums with no permission + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETPHOTOALBUMS_NOPERMISSION_CALLBACK_01', 0, async function (done) { + const testNum = 'SUB_USERFILE_MGR_GETPHOTOALBUMS_NOPERMISSION_CALLBACK_01'; + await getPhotoAlbumsTest(done, testNum); + }); + }); +} + + diff --git a/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/test/userFileMgrNoPermissionPromise.test.ets b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/test/userFileMgrNoPermissionPromise.test.ets new file mode 100755 index 0000000000000000000000000000000000000000..84be86ad4559aefa38384e6e4aa5c377c7717cf7 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/ets/test/userFileMgrNoPermissionPromise.test.ets @@ -0,0 +1,96 @@ +/* + * 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 userFileManager from '@ohos.filemanagement.userFileManager'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; + +import { + sleep, + allFetchOp, +} from '../../../../../../common'; + + +export default function userFileMgrNoPermissionPromise(abilityContext) { + describe('userFileMgrNoPermissionPromise', function () { + const userfilemgr = userFileManager.getUserFileMgr(abilityContext); + beforeAll(async function () { + console.info('beforeAll case'); + }); + beforeEach(function () { + console.info('beforeEach case'); + }); + afterEach(async function () { + console.info('afterEach case'); + await sleep() + }); + afterAll(function () { + console.info('afterAll case'); + }); + + const getPhotoAssetsTest = async function (done, testNum) { + try { + await userfilemgr.getPhotoAssets(allFetchOp()); + expect(false).assertTrue(); + done(); + } catch (error) { + console.info(`${testNum}, failed error: ${error}`) + expect(true).assertTrue(); + done(); + } + } + + const getPhotoAlbumsTest = async function (done, testNum) { + try { + await userfilemgr.getPhotoAlbums(allFetchOp()); + expect(false).assertTrue(); + done(); + } catch (error) { + console.info(`${testNum}, failed error: ${error}`) + expect(true).assertTrue(); + done(); + } + } + + /** + * @tc.number : SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_01 + * @tc.name : getPhotoAssets + * @tc.desc : getPhotoAssets(image) with no permission + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_01', 0, async function (done) { + const testNum = 'SUB_USERFILE_MGR_GETFILEASSETS_NOPERMISSION_PROMISE_01'; + await getPhotoAssetsTest(done, testNum); + }); + + //-------------------------------------------------------------------------------------- + + /** + * @tc.number : SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_01 + * @tc.name : getPhotoAlbums + * @tc.desc : getPhotoAlbums with no permission + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_01', 0, async function (done) { + const testNum = 'SUB_USERFILE_MGR_GETALBUMS_NOPERMISSION_PROMISE_01'; + await getPhotoAlbumsTest(done, testNum); + }); + }); +} + + diff --git a/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/module.json b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/module.json new file mode 100755 index 0000000000000000000000000000000000000000..c41f57d383c045e0f439a17b158ddb5c9c098966 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/module.json @@ -0,0 +1,84 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:mainability_description", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "ohos.acts.multimedia.userfilemgr.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:mainability_description", + "icon": "$media:icon", + "label": "$string:entry_MainAbility", + "visible": true, + "orientation": "portrait", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities":[ + "entity.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + { + "name": "ohos.permission.GET_BUNDLE_INFO", + "reason": "use ohos.permission.GET_BUNDLE_INFO" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", + "reason":"use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" + }, + { + "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_IMAGEVIDEO", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.READ_AUDIO", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.READ_DOCUMENT", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.WRITE_IMAGEVIDEO", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.WRITE_AUDIO", + "reason":"use ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.WRITE_DOCUMENT", + "reason":"use ohos.permission.WRITE_MEDIA" + } + ] + } +} diff --git a/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/resources/base/element/string.json b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..32237ee203edf64926964fb238fa44e396ddf577 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "MediaLibraryJSTestMain" + }, + { + "name": "mainability_description", + "value": "MediaLibraryJSTestMain Ability" + } + ] + } \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/resources/base/media/icon.png b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/resources/base/media/icon.png new file mode 100755 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/resources/base/media/icon.png differ diff --git a/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/resources/base/profile/main_pages.json b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/resources/base/profile/main_pages.json new file mode 100755 index 0000000000000000000000000000000000000000..96b478210df9884592229ae2db6f6bb7f86c14f4 --- /dev/null +++ b/multimedia/userfilemgr/userfilemgr_noPermission/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/multimedia/userfilemgr/userfilemgr_noPermission/signature/openharmony_sx.p7b b/multimedia/userfilemgr/userfilemgr_noPermission/signature/openharmony_sx.p7b new file mode 100755 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/multimedia/userfilemgr/userfilemgr_noPermission/signature/openharmony_sx.p7b differ diff --git a/multimodalinput/input_js_standard/BUILD.gn b/multimodalinput/input_js_standard/BUILD.gn old mode 100755 new mode 100644 index 85079c4235d8d24a43d23153acc9c1fc9fbfc33e..e2439f6270b74adee1b54bc7f70a2e5e4107eea0 --- a/multimodalinput/input_js_standard/BUILD.gn +++ b/multimodalinput/input_js_standard/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") @@ -25,7 +25,9 @@ ohos_js_hap_suite("multimodalinput_js_test") { part_name = "input" } ohos_js_assets("multimodalinput_js_assets") { - source_dir = "./src/main/js/default" + js2abc = true + hap_profile = "./src/main/config.json" + source_dir = "./src/main/js" } ohos_resources("multimodalinput_js_resources") { sources = [ "./src/main/resources" ] diff --git a/multimodalinput/input_js_standard/Test.json b/multimodalinput/input_js_standard/Test.json index 17746afe6aa2d8f8daaed65d269f19dde18bccf1..f9345da095959ce622d98dcdaa6c4471991ac928 100644 --- a/multimodalinput/input_js_standard/Test.json +++ b/multimodalinput/input_js_standard/Test.json @@ -1,10 +1,12 @@ { "description": "Configuration for multimodalinput js api Tests", "driver": { - "type": "JSUnitTest", - "test-timeout": "160000", - "package": "ohos.acts.multimodalinput.input", - "shell-timeout": "60000" + "type": "OHJSUnitTest", + "bundle-name": "ohos.acts.multimodalinput.input", + "package-name": "ohos.acts.multimodalinput.input", + "test-timeout": "300000", + "shell-timeout": "300000", + "testcase-timeout": 60000 }, "kits": [ { diff --git a/multimodalinput/input_js_standard/src/main/config.json b/multimodalinput/input_js_standard/src/main/config.json index 4c01ce014352faab7c986fd5db0ac03c3928ce11..81fc1a860a6a68581d053dbc6ddb73e503ac79c3 100644 --- a/multimodalinput/input_js_standard/src/main/config.json +++ b/multimodalinput/input_js_standard/src/main/config.json @@ -14,8 +14,11 @@ "deviceConfig": {}, "module": { "package": "ohos.acts.multimodalinput.input", - "name": ".MyApplication", + "name": ".entry", + "mainAbility":".MainAbility", + "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { @@ -25,23 +28,40 @@ }, "abilities": [ { - "visible": true, - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "ohos.acts.multimodalinput.input.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "launchType": "standard" + "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": [ @@ -54,7 +74,21 @@ "designWidth": 720, "autoDesignWidth": false } + }, + { + "pages": [ + "pages/index/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } } - ] + ], + "testRunner": { + "name": "OpenHarmonyTestRunner", + "srcPath": "TestRunner" + } } } diff --git a/multimodalinput/input_js_standard/src/main/js/MainAbility/app.js b/multimodalinput/input_js_standard/src/main/js/MainAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..1f429acbb22073515107201fccb9dc1f5f8e9cc1 --- /dev/null +++ b/multimodalinput/input_js_standard/src/main/js/MainAbility/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/ListMultimodalinput.test' + +export default { + onCreate() { + console.info('Application onCreate1111') + let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + let abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/multimodalinput/input_js_standard/src/main/js/MainAbility/i18n/en-US.json b/multimodalinput/input_js_standard/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/multimodalinput/input_js_standard/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/multimodalinput/input_js_standard/src/main/js/MainAbility/i18n/zh-CN.json b/multimodalinput/input_js_standard/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/multimodalinput/input_js_standard/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/multimodalinput/input_js_standard/src/main/js/default/pages/index/index.css b/multimodalinput/input_js_standard/src/main/js/MainAbility/pages/index/index.css similarity index 100% rename from multimodalinput/input_js_standard/src/main/js/default/pages/index/index.css rename to multimodalinput/input_js_standard/src/main/js/MainAbility/pages/index/index.css diff --git a/multimodalinput/input_js_standard/src/main/js/default/pages/index/index.hml b/multimodalinput/input_js_standard/src/main/js/MainAbility/pages/index/index.hml similarity index 100% rename from multimodalinput/input_js_standard/src/main/js/default/pages/index/index.hml rename to multimodalinput/input_js_standard/src/main/js/MainAbility/pages/index/index.hml diff --git a/multimodalinput/input_js_standard/src/main/js/MainAbility/pages/index/index.js b/multimodalinput/input_js_standard/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c7af4060be0acc5053da4d5780e460a0d285c777 --- /dev/null +++ b/multimodalinput/input_js_standard/src/main/js/MainAbility/pages/index/index.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. + */ + + + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + }, + onReady() { + console.info('onReady'); + }, +} diff --git a/multimodalinput/input_js_standard/src/main/js/TestAbility/app.js b/multimodalinput/input_js_standard/src/main/js/TestAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..875191631733a62e2bdff76d6b5a2e2f1b130937 --- /dev/null +++ b/multimodalinput/input_js_standard/src/main/js/TestAbility/app.js @@ -0,0 +1,23 @@ +/* + * 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'); + } +}; diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/i18n/en-US.json b/multimodalinput/input_js_standard/src/main/js/TestAbility/i18n/en-US.json similarity index 100% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/i18n/en-US.json rename to multimodalinput/input_js_standard/src/main/js/TestAbility/i18n/en-US.json diff --git a/multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/i18n/zh-CN.json b/multimodalinput/input_js_standard/src/main/js/TestAbility/i18n/zh-CN.json similarity index 100% rename from multimedia/media/media_js_standard/recorderProfile/src/main/js/TestAbility/i18n/zh-CN.json rename to multimodalinput/input_js_standard/src/main/js/TestAbility/i18n/zh-CN.json diff --git a/notification/ans_standard/actsansnotificationcancel/src/main/js/TestAbility/pages/index/index.css b/multimodalinput/input_js_standard/src/main/js/TestAbility/pages/index/index.css similarity index 100% rename from notification/ans_standard/actsansnotificationcancel/src/main/js/TestAbility/pages/index/index.css rename to multimodalinput/input_js_standard/src/main/js/TestAbility/pages/index/index.css diff --git a/notification/ans_standard/actsansnotificationcancel/src/main/js/TestAbility/pages/index/index.hml b/multimodalinput/input_js_standard/src/main/js/TestAbility/pages/index/index.hml similarity index 100% rename from notification/ans_standard/actsansnotificationcancel/src/main/js/TestAbility/pages/index/index.hml rename to multimodalinput/input_js_standard/src/main/js/TestAbility/pages/index/index.hml diff --git a/notification/ans_standard/actsansnotificationcancel/src/main/js/TestAbility/pages/index/index.js b/multimodalinput/input_js_standard/src/main/js/TestAbility/pages/index/index.js similarity index 100% rename from notification/ans_standard/actsansnotificationcancel/src/main/js/TestAbility/pages/index/index.js rename to multimodalinput/input_js_standard/src/main/js/TestAbility/pages/index/index.js diff --git a/multimodalinput/input_js_standard/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/multimodalinput/input_js_standard/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 0000000000000000000000000000000000000000..05ba5782592890d16fe15add4421c6187bae9511 --- /dev/null +++ b/multimodalinput/input_js_standard/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'] + '.MainAbility' + + 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/multimodalinput/input_js_standard/src/main/js/default/app.js b/multimodalinput/input_js_standard/src/main/js/default/app.js deleted file mode 100644 index 830070d196d86b127cea947d168bfd116f446205..0000000000000000000000000000000000000000 --- a/multimodalinput/input_js_standard/src/main/js/default/app.js +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/multimodalinput/input_js_standard/src/main/js/default/pages/index/index.js b/multimodalinput/input_js_standard/src/main/js/default/pages/index/index.js deleted file mode 100644 index 916858c2940898b9a500263943f32c3765980604..0000000000000000000000000000000000000000 --- a/multimodalinput/input_js_standard/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,46 +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 { Core, ExpectExtend } from 'deccjsunit/index' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onActive() { - console.info('onShow finish') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - this.timeout = 5000 - configService.setConfig(this) - - require('../../test/ListMultimodalinput.test') - core.execute() - }, - onReady() { - }, -} diff --git a/multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js b/multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js deleted file mode 100755 index d923ec6a83bd6671b2ebe715415c5519ccb53a59..0000000000000000000000000000000000000000 --- a/multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js +++ /dev/null @@ -1,366 +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 inputDevice from '@ohos.multimodalInput.inputDevice'; -import { - describe, - beforeAll, - beforeEach, - afterEach, - afterAll, - it, - expect -} from 'deccjsunit/index' - -describe('MultimodalInput_test', function () { - - // 参数正确,返回一个数组 - it('inputDevice::getDeviceIds_test-01', 0, function () { - console.info(`inputDevice::getDeviceIds_test-01 enter`); - inputDevice.getDeviceIds((data, err) => { - if (err) { - expect(false).assertTrue(); - } else { - expect(data).assertInstanceOf('Array'); - } - console.info(`inputDevice::getDeviceIds_test-01 exit`); - }) - }) - - // 参数正确,判断一种或多种设备 - it("inputDevice::getDeviceIds_test-02", 0, function () { - console.info(`inputDevice::getDeviceIds_test-02 enter`); - inputDevice.getDeviceIds((data, err) => { - if (err) { - expect(false).assertTrue(); - } else { - expect(data.length > 0).assertTure(); - } - console.info(`inputDevice::getDeviceIds_test-02 exit`); - }) - }) - - // 参数类型错误 - it("inputDevice::getDeviceIds_test-03", 0, function () { - console.info(`inputDevice::getDeviceIds_test-03 enter`); - try { - inputDevice.getDeviceIds(-1); - } catch (error) { - expect(error.message).assertEqual("GetDeviceIds: \"The first parameter type is wrong\""); - } - console.info(`inputDevice::getDeviceIds_test-03 exit`); - }) - - // 参数数量错误 - it("inputDevice::getDeviceIds_test-04", 0, function () { - console.info(`inputDevice::getDeviceIds_test-04 enter`); - try { - inputDevice.getDeviceIds(-1, (data) => { - console.info(data); - }); - } catch (error) { - expect(error.message).assertEqual("GetDeviceIds: \"too many parameters\""); - } - console.info(`inputDevice::getDeviceIds_test-04 exit`); - }) - - // 无效的设备id - it("inputDevice::getDevice_test-01", 0, function () { - console.info(`inputDevice::getDevice_test-01 enter`); - inputDevice.getDevice(-1, (data, err) => { - if (err) { - expect(false).assertTrue(); - console.info(`inputDevice::getDevice_test-01 ${JSON.stringify(err)}`); - } else { - expect(JSON.stringify(data) !== "{}").assertTrue(); - } - console.info(`inputDevice::getDevice_test-01 exit`); - }) - }) - - // 参数正常,返回值正常 - it("inputDevice::getDevice_test-02", 0, function () { - console.info(`inputDevice::getDevice_test-02 enter`); - inputDevice.getDeviceIds((data, err) => { - if (err) { - expect(false).assertTrue(); - } else { - let arr = []; - for (let i = 0; i < data.length; i++) { - inputDevice.getDevice(data[i], (res, err) => { - console.info(`getDevice:data ${JSON.stringify(data)}`); - arr = Object.keys(res); - expect(res.id).assertInstanceOf('Number'); - expect(res.name).assertInstanceOf('String'); - expect(res.sources).assertInstanceOf('Array'); - expect(res.axisRanges).assertInstanceOf('Array'); - expect(res.bus).assertInstanceOf('Number'); - expect(res.product).assertInstanceOf('Number'); - expect(res.vendor).assertInstanceOf('Number'); - expect(res.version).assertInstanceOf('Number'); - expect(res.phys).assertInstanceOf('String'); - expect(res.uniq).assertInstanceOf('String'); - expect(res).assertInstanceOf('Object'); - for(let j = 0;j < res.axisRanges.length; j++ ){ - expect(res.axisRanges[j].source == 'keyboard' || res.axisRanges[j].source == 'mouse' - || res.axisRanges[j].source == 'touchpad' || res.axisRanges[j].source == 'touchscreen' - || res.axisRanges[j].source == 'joystick' || res.axisRanges[j].source == 'trackball').assertTrue(); - expect(res.axisRanges[j].axis == 'touchMajor' || res.axisRanges[j].axis == 'touchMinor' - || res.axisRanges[j].axis == 'orientation' || res.axisRanges[j].axis == 'x' - || res.axisRanges[j].axis == 'y' || res.axisRanges[j].axis == 'pressure' - || res.axisRanges[j].axis == 'toolMinor' || res.axisRanges[j].axis == 'touchMajor' - || res.axisRanges[j].axis == 'NULL').assertTrue(); - expect(res.axisRanges[j].max).assertInstanceOf('Number'); - expect(res.axisRanges[j]).assertInstanceOf('AxisRange'); - expect(res.axisRanges[j].min).assertInstanceOf('Number'); - expect(res.axisRanges[j].fuzz).assertInstanceOf('Number'); - expect(res.axisRanges[j].flat).assertInstanceOf('Number'); - expect(res.axisRanges[j].resolution).assertInstanceOf('Number'); - } - }) - } - } - console.info(`inputDevice::getDevice_test-02 exit`); - }); - }) - - // 参数正常,返回值正常 - it("inputDevice::supportKeys_test-01", 0, function () { - console.info(`inputDevice::supportKeys_test-01 enter`); - inputDevice.getDeviceIds((data, err) => { - if (err) { - expect(false).assertTrue(); - } else { - for (let i = 0; i < data.length; ++i) { - inputDevice.supportKeys(data[i], [17, 22, 2055], (res, err) => { - expect(res).assertInstanceOf('Array'); - }); - } - } - console.info(`inputDevice::supportKeys_test-01 exit`); - }); - }) - - // 第二个参数异常 - it("inputDevice::supportKeys_test-02", 0, function () { - console.info(`inputDevice::supportKeys_test-02 enter`); - try { - inputDevice.supportKeys(0, 2022, (res) => { - console.info(res); - }); - } catch (error) { - expect(error.message).assertEqual("SupportKeys: \"The second parameter type is wrong\""); - } - console.info(`inputDevice::supportKeys_test-02 exit`); - }) - - // 参数正常 - it("inputDevice::getKeyboardType_test-01", 0, function () { - console.info(`inputDevice::getKeyboardType_test-01 enter`); - inputDevice.getDeviceIds((data, err) => { - if (err) { - expect(false).assertTrue(); - } else { - for (let i = 0; i < data.length; ++i) { - inputDevice.getKeyboardType(data[i], (res, err) => { - expect(res).assertInstanceOf('Number'); - }); - } - } - console.info(`inputDevice::getKeyboardType_test-01 exit`); - }); - }) - - //参数异常 - it("inputDevice::getKeyboardType_test-02", 0, function () { - console.info(`inputDevice::getKeyboardType_test-02 enter`); - try { - inputDevice.getKeyboardType(-1); - } catch (error) { - expect(error.message).assertEqual("getKeyboardType: \"The second parameter type is wrong\""); - } - console.info(`inputDevice::getKeyboardType_test-02 exit`); - }); - - // 参数正常 - it("inputDevice::getKeyboardType_test-03", 0, function () { - console.info(`inputDevice::getKeyboardType_test-03 enter`); - inputDevice.getDeviceIds((data, err) => { - if (err) { - expect(false).assertTrue(); - } else { - for (let i = 0; i < data.length; ++i) { - inputDevice.getKeyboardType(data[i]).then((res) => { - expect(res).assertInstanceOf('Number'); - }); - } - } - console.info(`inputDevice::getKeyboardType_test-03 exit`); - }); - }) - - /** - * @tc.number MultimodalInputDevice_js_0010 - * @tc.name MultimodalInputDevice_KeyboardType_NONE_test - * @tc.desc inputDevice.KeyboardType.NONE test - */ - it('MultimodalInputDevice_KeyboardType_NONE_test', 0, function () { - console.info('MultimodalInputDevice_KeyboardType_NONE_test = ' + inputDevice.KeyboardType.NONE); - expect(inputDevice.KeyboardType.NONE == 0).assertTrue(); - }) - - /** - * @tc.number MultimodalInputDevice_js_0020 - * @tc.name MultimodalInputDevice_KeyboardType_UNKNOWN_test - * @tc.desc inputDevice.KeyboardType.UNKNOWN test - */ - it('MultimodalInputDevice_KeyboardType_UNKNOWN_test', 0, function () { - console.info('MultimodalInputDevice_KeyboardType_UNKNOWN_test = ' + inputDevice.KeyboardType.UNKNOWN); - expect(inputDevice.KeyboardType.UNKNOWN == 1).assertTrue(); - }) - - /** - * @tc.number MultimodalInputDevice_js_0030 - * @tc.name MultimodalInputDevice_KeyboardType_ALPHABETIC_KEYBOARD_test - * @tc.desc inputDevice.KeyboardType.ALPHABETIC_KEYBOARD test - */ - it('MultimodalInputDevice_KeyboardType_ALPHABETIC_KEYBOARD_test', 0, function () { - console.info('MultimodalInputDevice_KeyboardType_ALPHABETIC_KEYBOARD_test = ' - + inputDevice.KeyboardType.ALPHABETIC_KEYBOARD); - expect(inputDevice.KeyboardType.ALPHABETIC_KEYBOARD == 2).assertTrue(); - }) - - /** - * @tc.number MultimodalInputDevice_js_0040 - * @tc.name MultimodalInputDevice_KeyboardType_ALPHABETIC_DIGITAL_KEYBOARD_test - * @tc.desc inputDevice.KeyboardType.DIGITAL_KEYBOARD test - */ - it('MultimodalInputDevice_KeyboardType_ALPHABETIC_DIGITAL_KEYBOARD_test', 0, function () { - console.info('MultimodalInputDevice_KeyboardType_ALPHABETIC_DIGITAL_KEYBOARD_test = ' - + inputDevice.KeyboardType.DIGITAL_KEYBOARD); - expect(inputDevice.KeyboardType.DIGITAL_KEYBOARD == 3).assertTrue(); - }) - - /** - * @tc.number MultimodalInputDevice_js_0050 - * @tc.name MultimodalInputDevice_KeyboardType_ALPHABETIC_HANDWRITING_PEN_test - * @tc.desc inputDevice.KeyboardType.HANDWRITING_PEN test - */ - it('MultimodalInputDevice_KeyboardType_ALPHABETIC_HANDWRITING_PEN_test', 0, function () { - console.info('MultimodalInputDevice_KeyboardType_ALPHABETIC_HANDWRITING_PEN_test = ' - + inputDevice.KeyboardType.HANDWRITING_PEN); - expect(inputDevice.KeyboardType.HANDWRITING_PEN == 4).assertTrue(); - }) - - /** - * @tc.number MultimodalInputDevice_js_0060 - * @tc.name MultimodalInputDevice_KeyboardType_ALPHABETIC_REMOTE_CONTROL_test - * @tc.desc inputDevice.KeyboardType.REMOTE_CONTROL test - */ - it('MultimodalInputDevice_KeyboardType_ALPHABETIC_REMOTE_CONTROL_test', 0, function () { - console.info('MultimodalInputDevice_KeyboardType_ALPHABETIC_REMOTE_CONTROL_test = ' - + inputDevice.KeyboardType.REMOTE_CONTROL); - expect(inputDevice.KeyboardType.REMOTE_CONTROL == 5).assertTrue(); - }) - - /** - * @tc.number MultimodalInputDevice_js_0070 - * @tc.name MultimodalInputDevice_getDeviceIds_Promise_test - * @tc.desc inputdevice interface getDeviceIds & supportKeys test - */ - it("MultimodalInputDevice_getDeviceIds_Promise_test", 0, async function (done) { - console.info(`MultimodalInputDevice_getDeviceIds_Promise_test enter`); - inputDevice.getDeviceIds().then((data, err) => { - if (err) { - console.info(`MultimodalInputDevice_getDeviceIds_Promise_test err`); - expect(false).assertTrue(); - done(); - } else { - console.info(`MultimodalInputDevice_getDeviceIds_Promise_test data`); - for (let i = 0; i < data.length; ++i) { - inputDevice.supportKeys(data[i], [17, 22, 2055]).then((res, err) => { - expect(res).assertInstanceOf('Array'); - }); - } - done(); - } - console.info(`MultimodalInputDevice_getDeviceIds_Promise_test exit`); - }); - }) - - /** - * @tc.number MultimodalInputDevice_js_0080 - * @tc.name MultimodalInputDevice_getDevice_Promise_test - * @tc.desc inputdevice interface getDevice test - */ - it("MultimodalInputDevice_getDevice_Promise_test", 0, async function (done) { - console.info(`MultimodalInputDevice_getDevice_Promise_test enter`); - inputDevice.getDevice(-1).then((data, err) => { - if (err) { - console.info(`MultimodalInputDevice_getDevice_Promise_test err`); - expect(false).assertTrue(); - console.info(`MultimodalInputDevice_getDevice_Promise_test ${JSON.stringify(err)}`); - done(); - } else { - console.info(`MultimodalInputDevice_getDevice_Promise_test data`); - expect(JSON.stringify(data) !== "{}").assertTrue(); - done(); - } - console.info(`MultimodalInputDevice_getDevice_Promise_test exit`); - }); - }) - - /** - * @tc.number MultimodalInputDevice_js_0090 - * @tc.name MultimodalInputDevice_on_test - * @tc.desc inputdevice interface getDevice test - */ - it("MultimodalInputDevice_on_test", 0, function () { - console.info(`MultimodalInputDevice_on_test enter`); - let isPhysicalKeyboardExist = true; - inputDevice.on("change", (data) => { - console.info("type: " + data.type + ", deviceId: " + data.deviceId); - inputDevice.getKeyboardType(data.deviceId, (err, ret) => { - console.info("The keyboard type of the device is: " + ret); - if (ret == inputDevice.KeyboardType.ALPHABETIC_KEYBOARD && data.type == 'add') { - // 监听物理键盘已连接。 - isPhysicalKeyboardExist = true; - } else if (ret == inputDevice.KeyboardType.ALPHABETIC_KEYBOARD && data.type == 'remove') { - // 监听物理键盘已断开。 - isPhysicalKeyboardExist = false; - } - }); - }); - console.info(`MultimodalInputDevice_on_test exit`); - }) - - /** - * @tc.number MultimodalInputDevice_js_0100 - * @tc.name MultimodalInputDevice_off_test - * @tc.desc inputdevice interface getDevice test - */ - it("MultimodalInputDevice_off_test", 0, function () { - console.info(`MultimodalInputDevice_off_test enter`); - function listener(data) { - console.info("type: " + data.type + ", deviceId: " + data.deviceId); - expect(data.type== 'add' || data.type== 'remove').assertTrue(); - expect(data).assertInstanceOf('DeviceListener'); - } - // 单独取消listener的监听。 - inputDevice.off("change", listener); - console.info(`MultimodalInputDevice_off_test exit`); - }) - -}) diff --git a/multimodalinput/input_js_standard/src/main/js/default/test/ListMultimodalinput.test.js b/multimodalinput/input_js_standard/src/main/js/default/test/ListMultimodalinput.test.js deleted file mode 100755 index f6a3ea7b0562c18d321e3ff9417a8724d0e1f1eb..0000000000000000000000000000000000000000 --- a/multimodalinput/input_js_standard/src/main/js/default/test/ListMultimodalinput.test.js +++ /dev/null @@ -1,19 +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. - */ - - -require('./InputDevice.test.js') -require('./MultimodalInputKey_Code.test.js') -require('./Pointer.test.js') diff --git a/multimodalinput/input_js_standard/src/main/js/default/test/MultimodalInputEventType.test.js b/multimodalinput/input_js_standard/src/main/js/default/test/MultimodalInputEventType.test.js deleted file mode 100755 index c7855fb7066b05ce3ae3a7584654ea4fbbc7af20..0000000000000000000000000000000000000000 --- a/multimodalinput/input_js_standard/src/main/js/default/test/MultimodalInputEventType.test.js +++ /dev/null @@ -1,252 +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 inputkeyCode from '@ohos.multimodalInput.keyCode' -import keyEvent from '@ohos.multimodalInput.keyEvent' -import mouseEvent from '@ohos.multimodalInput.mouseEvent' -import touchEvent from '@ohos.multimodalInput.touchEvent' -import { Key, KeyEvent } from '@ohos.multimodalInput.keyEvent' -import { AxisValue, MouseEvent } from '@ohos.multimodalInput.mouseEvent' -import { Touch, TouchEvent } from '@ohos.multimodalInput.touchEvent' - -import { - describe, - beforeAll, - beforeEach, - afterEach, - afterAll, - it, - expect -} from 'deccjsunit/index' - -describe('MultimodalInput_test', function () { - - it('MultimodalInput_test::KeyEventTypeTest_0010', 0, function () { - console.info(`MultimodalInput_test::KeyEventTypeTest_0010 enter`); - - expect(keyEvent.Action.CANCEL == 0).assertTrue(); - expect(keyEvent.Action.DOWN == 1).assertTrue(); - expect(keyEvent.Action.UP == 2).assertTrue(); - - console.info(`MultimodalInput_test::KeyEventTypeTest_0010 exit`); - }) - - it('MultimodalInput_test::KeyEventTypeTest_0020', 0, function () { - console.info(`MultimodalInput_test::KeyEventTypeTest_0020 enter`); - - let testKey: Key = { code: inputkeyCode.KeyCode.KEYCODE_FN, pressedTime: 10, deviceId: 1 }; - - expect(testKey.code == inputkeyCode.KeyCode.KEYCODE_FN).assertTrue(); - expect(testKey.pressedTime == 10).assertTrue(); - expect(testKey.deviceId == 1).assertTrue(); - - console.info(`MultimodalInput_test::KeyEventTypeTest_0020 exit`); - }) - - it('MultimodalInput_test::KeyEventTypeTest_0030', 0, function () { - console.info(`MultimodalInput_test::KeyEventTypeTest_0030 enter`); - - let testKey: Key = { code: inputkeyCode.KeyCode.KEYCODE_FN, pressedTime: 10, deviceId: 1 }; - let testKeyEvent: KeyEvent = { - action: keyEvent.Action.DOWN, key: testKey, unicodeChar: 1, keys: [testKey], - ctrlKey: true, altKey: true, shiftKey: true, logoKey: true, fnKey: true, capsLock: true, numLock: true, - scrollLock: true - }; - - expect(testKeyEvent.action == keyEvent.Action.DOWN).assertTrue(); - expect(testKeyEvent.key.code == testKey.code).assertTrue(); - expect(testKeyEvent.unicodeChar == 1).assertTrue(); - expect(testKeyEvent.keys[0].code == testKey.code).assertTrue(); - expect(testKeyEvent.ctrlKey).assertTrue(); - expect(testKeyEvent.altKey).assertTrue(); - expect(testKeyEvent.shiftKey).assertTrue(); - expect(testKeyEvent.logoKey).assertTrue(); - expect(testKeyEvent.fnKey).assertTrue(); - expect(testKeyEvent.capsLock).assertTrue(); - expect(testKeyEvent.numLock).assertTrue(); - expect(testKeyEvent.scrollLock).assertTrue(); - - console.info(`MultimodalInput_test::KeyEventTypeTest_0030 exit`); - }) - - it('MultimodalInput_test::MouseEventTypeTest_0010', 0, function () { - console.info(`MultimodalInput_test::MouseEventTypeTest_0010 enter`); - - expect(mouseEvent.Action.CANCEL == 0).assertTrue(); - expect(mouseEvent.Action.MOVE == 1).assertTrue(); - expect(mouseEvent.Action.BUTTON_DOWN == 2).assertTrue(); - expect(mouseEvent.Action.BUTTON_UP == 3).assertTrue(); - expect(mouseEvent.Action.AXIS_BEGIN == 4).assertTrue(); - expect(mouseEvent.Action.AXIS_UPDATE == 5).assertTrue(); - expect(mouseEvent.Action.AXIS_END == 6).assertTrue(); - - console.info(`MultimodalInput_test::MouseEventTypeTest_0010 exit`); - }) - - it('MultimodalInput_test::MouseEventTypeTest_0020', 0, function () { - console.info(`MultimodalInput_test::MouseEventTypeTest_0020 enter`); - - expect(mouseEvent.Button.LEFT == 0).assertTrue(); - expect(mouseEvent.Button.MIDDLE == 1).assertTrue(); - expect(mouseEvent.Button.RIGHT == 2).assertTrue(); - expect(mouseEvent.Button.SIDE == 3).assertTrue(); - expect(mouseEvent.Button.EXTRA == 4).assertTrue(); - expect(mouseEvent.Button.FORWARD == 5).assertTrue(); - expect(mouseEvent.Button.BACK == 6).assertTrue(); - expect(mouseEvent.Button.TASK == 6).assertTrue(); - - console.info(`MultimodalInput_test::MouseEventTypeTest_0020 exit`); - }) - - it('MultimodalInput_test::MouseEventTypeTest_0030', 0, function () { - console.info(`MultimodalInput_test::MouseEventTypeTest_0030 enter`); - - expect(mouseEvent.Axis.SCROLL_VERTICAL == 0).assertTrue(); - expect(mouseEvent.Axis.SCROLL_HORIZONTAL == 1).assertTrue(); - expect(mouseEvent.Axis.PINCH == 2).assertTrue(); - - console.info(`MultimodalInput_test::MouseEventTypeTest_0030 exit`); - }) - - it('MultimodalInput_test::MouseEventTypeTest_0040', 0, function () { - console.info(`MultimodalInput_test::MouseEventTypeTest_0040 enter`); - - let testAxisValue: AxisValue = { axis: mouseEvent.Axis.SCROLL_VERTICAL, value: 1 }; - expect(testAxisValue.axis == mouseEvent.Axis.SCROLL_VERTICAL).assertTrue(); - expect(testAxisValue.value == 1).assertTrue(); - - console.info(`MultimodalInput_test::MouseEventTypeTest_0040 exit`); - }) - - it('MultimodalInput_test::MouseEventTypeTest_0050', 0, function () { - console.info(`MultimodalInput_test::MouseEventTypeTest_0050 enter`); - - let testAxisValue: AxisValue = { axis: mouseEvent.Axis.SCROLL_VERTICAL, value: 1 }; - let testMouseEvent: MouseEvent = { - action: mouseEvent.Action.CANCEL, screenX: 1, screenY: 1, windowX: 1, - windowY: 1, rawDeltaX: 1, rawDeltaY: 1, button: mouseEvent.Button.LEFT, - pressedButtons: [mouseEvent.Button.LEFT], axes: [testAxisValue], - pressedKeys: [inputkeyCode.KeyCode.KEYCODE_FN], ctrlKey: true, altKey: true, shiftKey: true, - logoKey: true, fnKey: true, capsLock: true, numLock: true, scrollLock: true - }; - expect(testMouseEvent.action == mouseEvent.Action.CANCEL).assertTrue(); - expect(testMouseEvent.screenX == 1).assertTrue(); - expect(testMouseEvent.screenY == 1).assertTrue(); - expect(testMouseEvent.windowX == 1).assertTrue(); - expect(testMouseEvent.windowY == 1).assertTrue(); - expect(testMouseEvent.rawDeltaX == 1).assertTrue(); - expect(testMouseEvent.rawDeltaY == 1).assertTrue(); - expect(testMouseEvent.button == mouseEvent.Button.LEFT).assertTrue(); - expect(testMouseEvent.pressedButtons[0] == mouseEvent.Button.LEFT).assertTrue(); - expect(testMouseEvent.axes[0].axis == mouseEvent.Axis.SCROLL_VERTICAL).assertTrue(); - expect(testMouseEvent.pressedKeys[0] == inputkeyCode.KeyCode.KEYCODE_FN).assertTrue(); - expect(testMouseEvent.ctrlKey).assertTrue(); - expect(testMouseEvent.altKey).assertTrue(); - expect(testMouseEvent.shiftKey).assertTrue(); - expect(testMouseEvent.logoKey).assertTrue(); - expect(testMouseEvent.fnKey).assertTrue(); - expect(testMouseEvent.capsLock).assertTrue(); - expect(testMouseEvent.numLock).assertTrue(); - expect(testMouseEvent.scrollLock).assertTrue(); - - console.info(`MultimodalInput_test::MouseEventTypeTest_0050 exit`); - }) - - it('MultimodalInput_test::TouchEventTypeTest_0010', 0, function () { - console.info(`MultimodalInput_test::TouchEventTypeTest_0010 enter`); - - expect(touchEvent.Action.CANCEL == 0).assertTrue(); - expect(touchEvent.Action.DOWN == 1).assertTrue(); - expect(touchEvent.Action.MOVE == 2).assertTrue(); - expect(touchEvent.Action.UP == 3).assertTrue(); - - console.info(`MultimodalInput_test::TouchEventTypeTest_0010 exit`); - }) - - it('MultimodalInput_test::TouchEventTypeTest_0020', 0, function () { - console.info(`MultimodalInput_test::TouchEventTypeTest_0020 enter`); - - expect(touchEvent.ToolType.FINGER == 0).assertTrue(); - expect(touchEvent.ToolType.PEN == 1).assertTrue(); - expect(touchEvent.ToolType.RUBBER == 2).assertTrue(); - expect(touchEvent.ToolType.BRUSH == 3).assertTrue(); - expect(touchEvent.ToolType.PENCIL == 4).assertTrue(); - expect(touchEvent.ToolType.AIRBRUSH == 5).assertTrue(); - expect(touchEvent.ToolType.MOUSE == 6).assertTrue(); - expect(touchEvent.ToolType.LENS == 7).assertTrue(); - - console.info(`MultimodalInput_test::TouchEventTypeTest_0020 exit`); - }) - - it('MultimodalInput_test::TouchEventTypeTest_0030', 0, function () { - console.info(`MultimodalInput_test::TouchEventTypeTest_0030 enter`); - - expect(touchEvent.SourceType.TOUCH_SCREEN == 0).assertTrue(); - expect(touchEvent.SourceType.PEN == 1).assertTrue(); - expect(touchEvent.SourceType.TOUCH_PAD == 2).assertTrue(); - - console.info(`MultimodalInput_test::TouchEventTypeTest_0030 exit`); - }) - - it('MultimodalInput_test::TouchEventTypeTest_0040', 0, function () { - console.info(`MultimodalInput_test::TouchEventTypeTest_0040 enter`); - - let testTouch: Touch = { - id: 1, pressedTime: 1, screenX: 1, screenY: 1, windowX: 1, windowY: 1, pressure: 1, - width: 1, height: 1, tiltX: 1, tiltY: 1, toolX: 1, toolY: 1, toolWidth: 1, toolHeight: 1, rawX: 1, - rawY: 1, toolType: touchEvent.ToolType.FINGER - }; - expect(testTouch.id == 1).assertTrue(); - expect(touchEvent.pressedTime == 1).assertTrue(); - expect(touchEvent.screenX == 1).assertTrue(); - expect(touchEvent.screenY == 1).assertTrue(); - expect(touchEvent.windowX == 1).assertTrue(); - expect(touchEvent.windowY == 1).assertTrue(); - expect(touchEvent.pressure == 1).assertTrue(); - expect(touchEvent.width == 1).assertTrue(); - expect(touchEvent.height == 1).assertTrue(); - expect(touchEvent.tiltX == 1).assertTrue(); - expect(touchEvent.tiltY == 1).assertTrue(); - expect(touchEvent.toolX == 1).assertTrue(); - expect(touchEvent.toolY == 1).assertTrue(); - expect(touchEvent.toolWidth == 1).assertTrue(); - expect(touchEvent.toolHeight == 1).assertTrue(); - expect(touchEvent.rawX == 1).assertTrue(); - expect(touchEvent.rawY == 1).assertTrue(); - expect(touchEvent.toolType == touchEvent.ToolType.FINGER).assertTrue(); - - console.info(`MultimodalInput_test::TouchEventTypeTest_0040 exit`); - }) - - it('MultimodalInput_test::TouchEventTypeTest_0050', 0, function () { - console.info(`MultimodalInput_test::TouchEventTypeTest_0050 enter`); - - let testTouch: Touch = { - id: 1, pressedTime: 1, screenX: 1, screenY: 1, windowX: 1, windowY: 1, pressure: 1, - width: 1, height: 1, tiltX: 1, tiltY: 1, toolX: 1, toolY: 1, toolWidth: 1, toolHeight: 1, rawX: 1, - rawY: 1, toolType: touchEvent.ToolType.FINGER - }; - let testTouchEvent: TouchEvent = { - action: touchEvent.Action.CANCEL, touch: testTouch, touches: [testTouch], - sourceType: touchEvent.SourceType.TOUCH_SCREEN - }; - expect(testTouchEvent.action == touchEvent.Action.CANCEL).assertTrue(); - expect(testTouchEvent.touch.id == 1).assertTrue(); - expect(testTouchEvent.touches[0].id == 1).assertTrue(); - expect(testTouchEvent.sourceType == touchEvent.SourceType.TOUCH_SCREEN).assertTrue(); - - console.info(`MultimodalInput_test::TouchEventTypeTest_0050 exit`); - }) -}) diff --git a/multimodalinput/input_js_standard/src/main/js/default/test/MultimodalInputKey_Code.test.js b/multimodalinput/input_js_standard/src/main/js/default/test/MultimodalInputKey_Code.test.js deleted file mode 100755 index 05e9a7013fe5a7ff9eece811f67b16ed9214675a..0000000000000000000000000000000000000000 --- a/multimodalinput/input_js_standard/src/main/js/default/test/MultimodalInputKey_Code.test.js +++ /dev/null @@ -1,2671 +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 inputkeyCode from '@ohos.multimodalInput.keyCode'; -import { - describe, - beforeAll, - beforeEach, - afterEach, - afterAll, - it, - expect -} from 'deccjsunit/index' - -describe('Multimodalinput_KeyCode_test', function () { - - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_FN == 0).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0020', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0020 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_UNKNOWN == -1).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0020 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0030', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0030 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_HOME == 1).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0030 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0040', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0040 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BACK == 2).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0040 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0050', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0050 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_PLAY_PAUSE == 10).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0050 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0060', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0060 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_STOP == 11).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0060 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0070', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0070 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_NEXT == 12).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0070 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0080', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0080 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_PREVIOUS == 13).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0080 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0090', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0090 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_REWIND == 14).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0090 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0100', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0100 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_FAST_FORWARD == 15).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0100 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0110', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0110 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_VOLUME_UP == 16).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0110 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0120', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0120 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_VOLUME_DOWN == 17).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0120 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0130', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0130 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_POWER == 18).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0130 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0140', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0140 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_CAMERA == 19).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0140 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0150', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0150 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_VOLUME_MUTE == 22).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0150 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0160', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0160 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MUTE == 23).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0160 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0170', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0170 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BRIGHTNESS_UP == 40).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0170 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0180', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0180 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BRIGHTNESS_DOWN == 41).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0180 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0190', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0190 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_0 == 2000).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0190 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0200', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0200 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_1 == 2001).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0200 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0210', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0210 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_2 == 2002).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0210 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0220', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0220 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_3 == 2003).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0220 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0230', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0230 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_4 == 2004).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0230 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0240', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0240 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_5 == 2005).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0240 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0250', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_6 == 2006).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0260', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_7 == 2007).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0270', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_8 == 2008).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0280', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_9 == 2009).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0290', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_STAR == 2010).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0300', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_POUND == 2011).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0310', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_DPAD_UP == 2012).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0320', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_DPAD_DOWN == 2013).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0330', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_DPAD_LEFT == 2014).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0340', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_DPAD_RIGHT == 2015).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0350', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_DPAD_CENTER == 2016).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0360', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_A == 2017).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0370', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_B == 2018).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0380', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_C == 2019).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0390', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_D == 2020).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0400', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_E == 2021).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0410', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F == 2022).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0420', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_G == 2023).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0430', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_H == 2024).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0440', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_I == 2025).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0450', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_J == 2026).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0460', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_K == 2027).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0470', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_L == 2028).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0480', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_M == 2029).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0490', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_N == 2030).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0500', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_O == 2031).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0510', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_P == 2032).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0520', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_Q == 2033).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0530', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_R == 2034).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0540', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_S == 2035).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0550', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_T == 2036).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0560', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_U == 2037).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0570', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_V == 2038).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0580', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_W == 2039).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0590', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_X == 2040).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0600', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_Y == 2041).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0610', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_Z == 2042).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0620', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_COMMA == 2043).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0630', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PERIOD == 2044).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0640', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_ALT_LEFT == 2045).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0650', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_ALT_RIGHT == 2046).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0660', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SHIFT_LEFT == 2047).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0670', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SHIFT_RIGHT == 2048).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0680', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_TAB == 2049).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0690', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SPACE == 2050).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0700', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SYM == 2051).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0710', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_EXPLORER == 2052).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0720', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_ENVELOPE == 2053).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0730', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_ENTER == 2054).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0740', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_DEL == 2055).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0750', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_GRAVE == 2056).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0760', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MINUS == 2057).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0770', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_EQUALS == 2058).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0780', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_LEFT_BRACKET == 2059).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0790', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_RIGHT_BRACKET == 2060).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0800', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BACKSLASH == 2061).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0810', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SEMICOLON == 2062).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0820', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_APOSTROPHE == 2063).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0830', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SLASH == 2064).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0840', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_AT == 2065).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0850', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PLUS == 2066).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0860', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MENU == 2067).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0870', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PAGE_UP == 2068).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0880', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PAGE_DOWN == 2069).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0890', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_ESCAPE == 2070).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0900', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_FORWARD_DEL == 2071).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0910', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_CTRL_LEFT == 2072).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0920', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_CTRL_RIGHT == 2073).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0930', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_CAPS_LOCK == 2074).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0940', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SCROLL_LOCK == 2075).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0950', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_META_LEFT == 2076).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0960', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_META_RIGHT == 2077).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0970', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_FUNCTION == 2078).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0980', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SYSRQ == 2079).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0990', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BREAK == 2080).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0100', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_100 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MOVE_HOME == 2081).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_100 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_101', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_101 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MOVE_END == 2082).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_101 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_102', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_102 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_INSERT == 2083).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_102 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_103', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_103 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_FORWARD == 2084).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_103 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_104', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_104 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_PLAY == 2085).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_104 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_105', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_105 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_PAUSE == 2086).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_105 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_106', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_106 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_CLOSE == 2087).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_106 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_107', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_107 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_EJECT == 2088).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_107 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_108', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_108 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_RECORD == 2089).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_108 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_109', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_109 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F1 == 2090).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_109 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_110', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_110 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F2 == 2091).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_110 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_111', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_111 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F3 == 2092).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_111 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_112', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_112 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F4 == 2093).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_112 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_113', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_113 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F5 == 2094).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_113 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_114', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_114 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F6 == 2095).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_114 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_115', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_115 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F7 == 2096).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_115 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_116', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_116 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F8 == 2097).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_116 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_117', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_117 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F9 == 2098).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_117 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_118', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_118 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F10 == 2099).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_118 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_119', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_119 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F11 == 2100).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_119 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_120', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_120 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F12 == 2101).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_120 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_121', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_121 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUM_LOCK == 2102).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_121 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_122', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_122 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_0 == 2103).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_122 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_123', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_123 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_1 == 2104).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_123 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_124', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_124 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_2 == 2105).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_124 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_125', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_125 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_3 == 2106).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_125 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_126', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_126 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_4 == 2107).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_126 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_127', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_127 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_5 == 2108).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_127 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_128', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_128 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_6 == 2109).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_128 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_129', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_129 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_7 == 2110).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_129 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_130', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_130 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_8 == 2111).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_130 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_131', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_131 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_9 == 2112).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_131 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_132', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_132 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_DIVIDE == 2113).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_132 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_133', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_133 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_MULTIPLY == 2114).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_133 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_134', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_134 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_SUBTRACT == 2115).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_134 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_135', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_135 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_ADD == 2116).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_135 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_136', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_136 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_DOT == 2117).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_136 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_137', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_137 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_COMMA == 2118).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_137 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_138', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_138 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_ENTER == 2119).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_138 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_139', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_139 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_EQUALS == 2120).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_139 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_140', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_140 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_LEFT_PAREN == 2121).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_140 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_141', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_141 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_RIGHT_PAREN == 2122).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_141 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_142', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_142 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_VIRTUAL_MULTITASK == 2210).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_142 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_143', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_143 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SLEEP == 2600).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_143 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_144', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_144 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_ZENKAKU_HANKAKU == 2601).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_144 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_145', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_145 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_102ND == 2602).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_145 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_146', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_146 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_RO == 2603).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_146 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_147', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_147 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_KATAKANA == 2604).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_147 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_148', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_148 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_HIRAGANA == 2605).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_148 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_149', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_149 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_HENKAN == 2606).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_149 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_150', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_150 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_KATAKANA_HIRAGANA == 2607).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_150 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_151', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_151 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MUHENKAN == 2608).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_151 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_152', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_152 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_LINEFEED == 2609).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_152 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_153', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_153 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MACRO == 2610).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_153 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_154', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_154 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_PLUSMINUS == 2611).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_154 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_155', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_155 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SCALE == 2612).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_155 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_156', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_156 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_HANGUEL == 2613).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_156 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_157', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_157 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_HANJA == 2614).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_157 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_158', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_158 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_YEN == 2615).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_158 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_159', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_159 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_STOP == 2616).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_159 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_160', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_160 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_AGAIN == 2617).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_160 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_161', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_161 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PROPS == 2618).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_161 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_162', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_162 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_UNDO == 2619).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_162 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_163', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_163 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_COPY == 2620).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_163 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_164', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_164 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_OPEN == 2621).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_164 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_165', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_165 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PASTE == 2622).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_165 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_166', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_166 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_FIND == 2623).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_166 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_167', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_167 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_CUT == 2624).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_167 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_168', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_168 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_HELP == 2625).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_168 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_169', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_169 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_CALC == 2626).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_169 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_170', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_170 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_FILE == 2627).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_170 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_171', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_171 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BOOKMARKS == 2628).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_171 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_172', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_172 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NEXT == 2629).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_172 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_173', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_173 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PLAYPAUSE == 2630).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_173 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_174', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_174 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PREVIOUS == 2631).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_174 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_175', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_175 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_STOPCD == 2632).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_175 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_178', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_178 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_CONFIG == 2634).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_178 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_179', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_179 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_REFRESH == 2635).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_179 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_180', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_180 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_EXIT == 2636).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_180 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_181', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_181 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_EDIT == 2637).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_181 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_182', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_182 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SCROLLUP == 2638).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_182 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_183', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_183 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SCROLLDOWN == 2639).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_183 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_184', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_184 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NEW == 2640).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_184 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_186', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_186 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_REDO == 2641).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_186 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_188', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_188 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_CLOSE == 2642).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_188 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_189', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_189 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PLAY == 2643).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_189 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_190', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_190 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BASSBOOST == 2644).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_190 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_192', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_192 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PRINT == 2645).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_192 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_193', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_193 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_CHAT == 2646).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_193 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_194', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_194 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_FINANCE == 2647).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_194 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_195', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_195 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_CANCEL == 2648).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_195 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_197', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_197 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_KBDILLUM_TOGGLE == 2649).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_197 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_198', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_198 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_KBDILLUM_DOWN == 2650).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_198 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_199', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_199 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_KBDILLUM_UP == 2651).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_199 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_200', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_200 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SEND == 2652).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_200 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_201', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_201 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_REPLY == 2653).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_201 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_203', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_203 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_FORWARDMAIL == 2654).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_203 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_205', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_205 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SAVE == 2655).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_205 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_206', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_206 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_DOCUMENTS == 2656).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_206 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_207', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_207 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_VIDEO_NEXT == 2657).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_207 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_208', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_208 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_VIDEO_PREV == 2658).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_208 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_209', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_209 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BRIGHTNESS_CYCLE == 2659).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_209 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_210', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_210 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BRIGHTNESS_ZERO == 2660).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_210 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_211', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_211 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_DISPLAY_OFF == 2661).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_211 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_212', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_212 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BTN_MISC == 2662).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_212 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_213', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_213 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_GOTO == 2663).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_213 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_214', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_214 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_INFO == 2664).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_214 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_215', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_215 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PROGRAM == 2665).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_215 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_216', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_216 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PVR == 2666).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_216 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_217', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_217 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SUBTITLE == 2667).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_217 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_218', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_218 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_FULL_SCREEN == 2668).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_218 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_219', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_219 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_KEYBOARD == 2669).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_219 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_221', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_221 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_ASPECT_RATIO == 2670).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_221 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_222', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_222 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PC == 2671).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_222 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_223', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_223 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_TV == 2672).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_223 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_224', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_224 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_TV2 == 2673).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_224 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_226', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_226 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_VCR == 2674).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_226 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_227', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_227 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_VCR2 == 2675).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_227 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_228', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_228 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SAT == 2676).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_228 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_230', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_230 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_CD == 2677).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_230 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_231', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_231 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_TAPE == 2678).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_231 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_232', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_232 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_TUNER == 2679).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_232 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_233', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_233 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PLAYER == 2680).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_233 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_234', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_234 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_DVD == 2681).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_234 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_235', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_235 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_AUDIO == 2682).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_235 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_236', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_236 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_VIDEO == 2683).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_236 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_237', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_237 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MEMO == 2684).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_237 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_238', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_238 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_CALENDAR == 2685).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_238 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_239', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_239 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_RED == 2686).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_239 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_240', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_240 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_GREEN == 2687).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_240 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_241', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_241 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_YELLOW == 2688).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_241 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_242', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_242 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BLUE == 2689).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_242 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_243', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_243 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_CHANNELUP == 2690).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_243 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_245', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_245 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_CHANNELDOWN == 2691).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_245 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_246', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_246 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_LAST == 2692).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_246 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_247', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_247 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_RESTART == 2693).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_247 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_248', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_248 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SLOW == 2694).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_248 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_249', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_249 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SHUFFLE == 2695).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_249 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_250', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_250 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_VIDEOPHONE == 2696).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_250 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_251', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_251 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_GAMES == 2697).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_251 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_252', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_252 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_ZOOMIN == 2698).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_252 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_253', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_253 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_ZOOMOUT == 2699).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_253 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_255', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_255 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_ZOOMRESET == 2700).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_255 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_256', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_256 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_WORDPROCESSOR == 2701).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_256 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_257', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_257 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_EDITOR == 2702).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_257 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_258', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_258 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SPREADSHEET == 2703).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_258 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_259', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_259 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_GRAPHICSEDITOR == 2704).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_259 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_260', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_260 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PRESENTATION == 2705).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_260 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_261', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_261 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_DATABASE == 2706).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_261 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_262', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_262 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_NEWS == 2707).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_262 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_263', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_263 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_VOICEMAIL == 2708).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_263 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_264', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_264 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_ADDRESSBOOK == 2709).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_264 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_265', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_265 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MESSENGER == 2710).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_265 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_266', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_266 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BRIGHTNESS_TOGGLE == 2711).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_266 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_267', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_267 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SPELLCHECK == 2712).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_267 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_268', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_268 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_COFFEE == 2713).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_268 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_269', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_269 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_REPEAT == 2714).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_269 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_270', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_270 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_IMAGES == 2715).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_270 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_271', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_271 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BUTTONCONFIG == 2716).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_271 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_272', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_272 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_TASKMANAGER == 2717).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_272 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_273', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_273 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_JOURNAL == 2718).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_273 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_274', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_274 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_CONTROLPANEL == 2719).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_274 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_275', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_275 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_APPSELECT == 2720).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_275 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_276', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_276 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SCREENSAVER == 2721).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_276 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_277', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_277 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_ASSISTANT == 2722).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_277 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_278', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_278 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_KBD_LAYOUT_NEXT == 2723).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_278 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_279', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_279 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BRIGHTNESS_MIN == 2724).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_279 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_280', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_280 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BRIGHTNESS_MAX == 2725).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_280 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_282', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_282 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_KBDINPUTASSIST_PREV == 2726).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_282 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_283', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_283 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_KBDINPUTASSIST_NEXT == 2727).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_283 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_284', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_284 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_KBDINPUTASSIST_PREVGROUP == 2728).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_284 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_285', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_285 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_KBDINPUTASSIST_NEXTGROUP == 2729).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_285 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_286', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_286 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_KBDINPUTASSIST_ACCEPT == 2730).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_286 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_287', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_287 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_KBDINPUTASSIST_CANCEL == 2731).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_287 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_288', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_288 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_FRONT == 2800).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_288 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_289', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_289 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SETUP == 2801).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_289 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_290', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_290 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_WAKEUP == 2802).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_290 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_293', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_293 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SENDFILE == 2803).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_293 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_294', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_294 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_DELETEFILE == 2804).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_294 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_295', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_295 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_XFER == 2805).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_295 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_296', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_296 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PROG1 == 2806).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_296 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_298', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_298 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PROG2 == 2807).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_298 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_299', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_299 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MSDOS == 2808).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_299 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_300', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_300 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SCREENLOCK == 2809).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_300 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_301', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_301 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_DIRECTION_ROTATE_DISPLAY == 2810).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_301 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_302', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_302 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_CYCLEWINDOWS == 2811).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_302 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_303', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_303 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_COMPUTER == 2812).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_303 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_304', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_304 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_EJECTCLOSECD == 2813).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_304 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_305', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_305 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_ISO == 2814).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_305 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_306', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_306 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_MOVE == 2815).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_306 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_307', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_307 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F13 == 2816).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_307 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_308', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_308 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F14 == 2817).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_308 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_309', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_309 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F15 == 2818).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_309 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_310', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_310 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F16 == 2819).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_310 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_311', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_311 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F17 == 2820).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_311 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_312', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_312 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F18 == 2821).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_312 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_313', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_313 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F19 == 2822).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_313 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_315', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_315 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F20 == 2823).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_315 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_316', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_316 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F21 == 2824).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_316 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_317', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_317 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F22 == 2825).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_317 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_318', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_318 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F23 == 2826).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_318 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_319', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_319 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_F24 == 2827).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_319 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_320', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_320 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PROG3 == 2828).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_320 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_321', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_321 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_PROG4 == 2829).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_321 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_322', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_322 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_DASHBOARD == 2830).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_322 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_323', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_323 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SUSPEND == 2831).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_323 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_324', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_324 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_HP == 2832).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_324 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_325', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_325 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SOUND == 2833).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_325 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_326', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_326 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_QUESTION == 2834).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_326 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_327', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_327 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_CONNECT == 2836).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_327 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_328', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_328 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SPORT == 2837).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_328 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_329', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_329 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SHOP == 2838).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_329 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_330', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_330 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_ALTERASE == 2839).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_330 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_331', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_331 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_SWITCHVIDEOMODE == 2841).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_331 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_332', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_332 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BATTERY == 2842).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_332 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_333', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_333 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BLUETOOTH == 2843).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_333 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_334', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_334 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_WLAN == 2844).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_334 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_335', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_335 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_UWB == 2845).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_335 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_336', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_336 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_WWAN_WIMAX == 2846).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_336 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_337', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_337 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_RFKILL == 2847).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_337 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_338', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_338 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_CHANNEL == 3001).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_338 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_339', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_339 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BTN_0 == 3100).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_339 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_340', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_340 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BTN_1 == 3101).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_340 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_341', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_341 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BTN_2 == 3102).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_341 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_342', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_342 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BTN_3 == 3103).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_342 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_343', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_343 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BTN_4 == 3104).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_343 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_344', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_344 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BTN_5 == 3105).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_344 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_345', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_345 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BTN_6 == 3106).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_345 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_346', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_346 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BTN_7 == 3107).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_346 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_347', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_347 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BTN_8 == 3108).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_347 exit`); - }) - - it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_348', 0, function () { - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_348 enter`); - - expect(inputkeyCode.KeyCode.KEYCODE_BTN_9 == 3109).assertTrue(); - - console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_348 exit`); - }) -}) - - diff --git a/multimodalinput/input_js_standard/src/main/js/default/test/Pointer.test.js b/multimodalinput/input_js_standard/src/main/js/default/test/Pointer.test.js deleted file mode 100755 index 2b607c843cf4c0251afdfdf0ce1153bbf27fdd99..0000000000000000000000000000000000000000 --- a/multimodalinput/input_js_standard/src/main/js/default/test/Pointer.test.js +++ /dev/null @@ -1,75 +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 pointer from '@ohos.multimodalInput.pointer' -import { - describe, - beforeAll, - beforeEach, - afterEach, - afterAll, - it, - expect -} from 'deccjsunit/index' - -describe('MultimodalInput_Pointer_test', function () { - - it('MultimodalInput_Pointer_test::PointerVisibleTest_001', 0, function () { - console.info(`MultimodalInput_Pointer_test::SetPointerVisibleTest_001 enter`); - var callback = function (err, data) { - if (err) { - this.log(`MultimodalInput_Pointer_test::SetPointerVisibleTest_001 failed, err=${JSON.stringify(err)}`); - expect(false).assertTrue(); - } else { - this.log(`MultimodalInput_Pointer_test::SetPointerVisibleTest_001 success`); - expect(true).assertTure(); - } - }; - pointer.setPointerVisible(false, callback); - - pointer.isPointerVisible().then(data => { - this.log(`MultimodalInput_Pointer_test::PointerVisibleTest_001 success, data=${JSON.stringify(data)}`); - expect(data == false).assertTrue(); - }, data => { - this.log(`MultimodalInput_Pointer_test::PointerVisibleTest_001 failed, err=${JSON.stringify(data)}`); - expect(false).assertTrue(); - }); - console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_001 exit`); - }) - - it('MultimodalInput_Pointer_test::PointerVisibleTest_002', 0, function () { - console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_002 enter`); - pointer.setPointerVisible(true).then(data => { - this.log(`MultimodalInput_Pointer_test::PointerVisibleTest_002 success, data=${JSON.stringify(data)}`); - expect(true).assertTrue(); - }, data => { - this.log(`MultimodalInput_Pointer_test::PointerVisibleTest_002 failed, err=${JSON.stringify(data)}`); - expect(false).assertTure(); - }); - - var callback = function (err, data) { - if (err) { - this.log(`MultimodalInput_Pointer_test::PointerVisibleTest_002 failed, err=${JSON.stringify(err)}`); - expect(false).assertTrue(); - } else { - this.log(`MultimodalInput_Pointer_test::PointerVisibleTest_002 success, data=${JSON.stringify(data)}`); - expect(data == true).assertTrue(); - } - }; - pointer.isPointerVisible(callback); - console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_002 exit`); - }) - -}) diff --git a/multimodalinput/input_js_standard/src/main/js/test/InputDevice.test.js b/multimodalinput/input_js_standard/src/main/js/test/InputDevice.test.js new file mode 100644 index 0000000000000000000000000000000000000000..39077355907725e9f45e0d1762d72bbf2995115d --- /dev/null +++ b/multimodalinput/input_js_standard/src/main/js/test/InputDevice.test.js @@ -0,0 +1,359 @@ +/* + * 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 inputDevice from '@ohos.multimodalInput.inputDevice'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium' +export default function MultimodalInput_Device_test() { +describe('MultimodalInput_Device_test', function () { + + // 参数正确,返回一个数组 + it('inputDevice::getDeviceIds_test-01', 0, function () { + console.info(`inputDevice::getDeviceIds_test-01 enter`); + inputDevice.getDeviceIds((data, err) => { + if (err) { + expect(false).assertTrue(); + } else { + expect(data).assertInstanceOf('Array'); + } + console.info(`inputDevice::getDeviceIds_test-01 exit`); + }) + }) + + // 参数正确,判断一种或多种设备 + it("inputDevice::getDeviceIds_test-02", 0, function () { + console.info(`inputDevice::getDeviceIds_test-02 enter`); + inputDevice.getDeviceIds((data, err) => { + if (err) { + expect(false).assertTrue(); + } else { + expect(data.length > 0).assertTrue(); + } + console.info(`inputDevice::getDeviceIds_test-02 exit`); + }) + }) + + // 参数类型错误 + it("inputDevice::getDeviceIds_test-03", 0, function () { + console.info(`inputDevice::getDeviceIds_test-03 enter`); + try { + inputDevice.getDeviceIds(-1); + } catch (error) { + expect(error.message).assertEqual("GetDeviceIds: \"The first parameter type is wrong\""); + } + console.info(`inputDevice::getDeviceIds_test-03 exit`); + }) + + // 参数数量错误 + it("inputDevice::getDeviceIds_test-04", 0, function () { + console.info(`inputDevice::getDeviceIds_test-04 enter`); + try { + inputDevice.getDeviceIds(-1, (data) => { + console.info(data); + }); + } catch (error) { + expect(error.message).assertEqual("GetDeviceIds: \"too many parameters\""); + } + console.info(`inputDevice::getDeviceIds_test-04 exit`); + }) + + // 无效的设备id + it("inputDevice::getDevice_test-01", 0, function () { + console.info(`inputDevice::getDevice_test-01 enter`); + inputDevice.getDevice(-1, (data, err) => { + if (err) { + expect(false).assertTrue(); + console.info(`inputDevice::getDevice_test-01 ${JSON.stringify(err)}`); + } else { + expect(JSON.stringify(data) !== "{}").assertTrue(); + } + console.info(`inputDevice::getDevice_test-01 exit`); + }) + }) + + // 参数正常,返回值正常 + it("inputDevice::getDevice_test-02", 0, function () { + console.info(`inputDevice::getDevice_test-02 enter`); + inputDevice.getDeviceIds((data, err) => { + if (err) { + expect(false).assertTrue(); + } else { + let arr = []; + for (let i = 0; i < data.length; i++) { + inputDevice.getDevice(data[i], (res, err) => { + console.info(`getDevice:data ${JSON.stringify(data)}`); + arr = Object.keys(res); + expect(res.id).assertInstanceOf('Number'); + expect(res.name).assertInstanceOf('String'); + expect(res.sources).assertInstanceOf('Array'); + expect(res.axisRanges).assertInstanceOf('Array'); + expect(res.bus).assertInstanceOf('Number'); + expect(res.product).assertInstanceOf('Number'); + expect(res.vendor).assertInstanceOf('Number'); + expect(res.version).assertInstanceOf('Number'); + expect(res.phys).assertInstanceOf('String'); + expect(res.uniq).assertInstanceOf('String'); + expect(res).assertInstanceOf('Object'); + for(let j = 0;j < res.axisRanges.length; j++ ){ + expect(res.axisRanges[j].source == 'keyboard' || res.axisRanges[j].source == 'mouse' + || res.axisRanges[j].source == 'touchpad' || res.axisRanges[j].source == 'touchscreen' + || res.axisRanges[j].source == 'joystick' || res.axisRanges[j].source == 'trackball').assertTrue(); + expect(res.axisRanges[j].axis == 'touchMajor' || res.axisRanges[j].axis == 'touchMinor' + || res.axisRanges[j].axis == 'orientation' || res.axisRanges[j].axis == 'x' + || res.axisRanges[j].axis == 'y' || res.axisRanges[j].axis == 'pressure' + || res.axisRanges[j].axis == 'toolMinor' || res.axisRanges[j].axis == 'touchMajor' + || res.axisRanges[j].axis == 'NULL').assertTrue(); + expect(res.axisRanges[j].max).assertInstanceOf('Number'); + expect(res.axisRanges[j]).assertInstanceOf('AxisRange'); + expect(res.axisRanges[j].min).assertInstanceOf('Number'); + expect(res.axisRanges[j].fuzz).assertInstanceOf('Number'); + expect(res.axisRanges[j].flat).assertInstanceOf('Number'); + expect(res.axisRanges[j].resolution).assertInstanceOf('Number'); + } + }) + } + } + console.info(`inputDevice::getDevice_test-02 exit`); + }); + }) + + // 参数正常,返回值正常 + it("inputDevice::supportKeys_test-01", 0, function () { + console.info(`inputDevice::supportKeys_test-01 enter`); + inputDevice.getDeviceIds((data, err) => { + if (err) { + expect(false).assertTrue(); + } else { + for (let i = 0; i < data.length; ++i) { + inputDevice.supportKeys(data[i], [17, 22, 2055], (res, err) => { + expect(res).assertInstanceOf('Array'); + }); + } + } + console.info(`inputDevice::supportKeys_test-01 exit`); + }); + }) + + // 第二个参数异常 + it("inputDevice::supportKeys_test-02", 0, function () { + console.info(`inputDevice::supportKeys_test-02 enter`); + try { + inputDevice.supportKeys(0, 2022, (res) => { + console.info(res); + }); + } catch (error) { + expect(error.message).assertEqual("SupportKeys: \"The second parameter type is wrong\""); + } + console.info(`inputDevice::supportKeys_test-02 exit`); + }) + + // 参数正常 + it("inputDevice::getKeyboardType_test-01", 0, function () { + console.info(`inputDevice::getKeyboardType_test-01 enter`); + inputDevice.getDeviceIds((data, err) => { + if (err) { + expect(false).assertTrue(); + } else { + for (let i = 0; i < data.length; ++i) { + inputDevice.getKeyboardType(data[i], (res, err) => { + expect(res).assertInstanceOf('Number'); + }); + } + } + console.info(`inputDevice::getKeyboardType_test-01 exit`); + }); + }) + + //参数异常 + it("inputDevice::getKeyboardType_test-02", 0, function () { + console.info(`inputDevice::getKeyboardType_test-02 enter`); + try { + inputDevice.getKeyboardType(-1); + } catch (error) { + expect(error.message).assertEqual("getKeyboardType: \"The second parameter type is wrong\""); + } + console.info(`inputDevice::getKeyboardType_test-02 exit`); + }); + + // 参数正常 + it("inputDevice::getKeyboardType_test-03", 0, function () { + console.info(`inputDevice::getKeyboardType_test-03 enter`); + inputDevice.getDeviceIds((data, err) => { + if (err) { + expect(false).assertTrue(); + } else { + for (let i = 0; i < data.length; ++i) { + inputDevice.getKeyboardType(data[i]).then((res) => { + expect(res).assertInstanceOf('Number'); + }); + } + } + console.info(`inputDevice::getKeyboardType_test-03 exit`); + }); + }) + + /** + * @tc.number MultimodalInputDevice_js_0010 + * @tc.name MultimodalInputDevice_KeyboardType_NONE_test + * @tc.desc inputDevice.KeyboardType.NONE test + */ + it('MultimodalInputDevice_KeyboardType_NONE_test', 0, function () { + console.info('MultimodalInputDevice_KeyboardType_NONE_test = ' + inputDevice.KeyboardType.NONE); + expect(inputDevice.KeyboardType.NONE == 0).assertTrue(); + }) + + /** + * @tc.number MultimodalInputDevice_js_0020 + * @tc.name MultimodalInputDevice_KeyboardType_UNKNOWN_test + * @tc.desc inputDevice.KeyboardType.UNKNOWN test + */ + it('MultimodalInputDevice_KeyboardType_UNKNOWN_test', 0, function () { + console.info('MultimodalInputDevice_KeyboardType_UNKNOWN_test = ' + inputDevice.KeyboardType.UNKNOWN); + expect(inputDevice.KeyboardType.UNKNOWN == 1).assertTrue(); + }) + + /** + * @tc.number MultimodalInputDevice_js_0030 + * @tc.name MultimodalInputDevice_KeyboardType_ALPHABETIC_KEYBOARD_test + * @tc.desc inputDevice.KeyboardType.ALPHABETIC_KEYBOARD test + */ + it('MultimodalInputDevice_KeyboardType_ALPHABETIC_KEYBOARD_test', 0, function () { + console.info('MultimodalInputDevice_KeyboardType_ALPHABETIC_KEYBOARD_test = ' + + inputDevice.KeyboardType.ALPHABETIC_KEYBOARD); + expect(inputDevice.KeyboardType.ALPHABETIC_KEYBOARD == 2).assertTrue(); + }) + + /** + * @tc.number MultimodalInputDevice_js_0040 + * @tc.name MultimodalInputDevice_KeyboardType_ALPHABETIC_DIGITAL_KEYBOARD_test + * @tc.desc inputDevice.KeyboardType.DIGITAL_KEYBOARD test + */ + it('MultimodalInputDevice_KeyboardType_ALPHABETIC_DIGITAL_KEYBOARD_test', 0, function () { + console.info('MultimodalInputDevice_KeyboardType_ALPHABETIC_DIGITAL_KEYBOARD_test = ' + + inputDevice.KeyboardType.DIGITAL_KEYBOARD); + expect(inputDevice.KeyboardType.DIGITAL_KEYBOARD == 3).assertTrue(); + }) + + /** + * @tc.number MultimodalInputDevice_js_0050 + * @tc.name MultimodalInputDevice_KeyboardType_ALPHABETIC_HANDWRITING_PEN_test + * @tc.desc inputDevice.KeyboardType.HANDWRITING_PEN test + */ + it('MultimodalInputDevice_KeyboardType_ALPHABETIC_HANDWRITING_PEN_test', 0, function () { + console.info('MultimodalInputDevice_KeyboardType_ALPHABETIC_HANDWRITING_PEN_test = ' + + inputDevice.KeyboardType.HANDWRITING_PEN); + expect(inputDevice.KeyboardType.HANDWRITING_PEN == 4).assertTrue(); + }) + + /** + * @tc.number MultimodalInputDevice_js_0060 + * @tc.name MultimodalInputDevice_KeyboardType_ALPHABETIC_REMOTE_CONTROL_test + * @tc.desc inputDevice.KeyboardType.REMOTE_CONTROL test + */ + it('MultimodalInputDevice_KeyboardType_ALPHABETIC_REMOTE_CONTROL_test', 0, function () { + console.info('MultimodalInputDevice_KeyboardType_ALPHABETIC_REMOTE_CONTROL_test = ' + + inputDevice.KeyboardType.REMOTE_CONTROL); + expect(inputDevice.KeyboardType.REMOTE_CONTROL == 5).assertTrue(); + }) + + /** + * @tc.number MultimodalInputDevice_js_0070 + * @tc.name MultimodalInputDevice_getDeviceIds_Promise_test + * @tc.desc inputdevice interface getDeviceIds & supportKeys test + */ + it("MultimodalInputDevice_getDeviceIds_Promise_test", 0, async function (done) { + console.info(`MultimodalInputDevice_getDeviceIds_Promise_test enter`); + inputDevice.getDeviceIds().then((data, err) => { + if (err) { + console.info(`MultimodalInputDevice_getDeviceIds_Promise_test err`); + expect(false).assertTrue(); + done(); + } else { + console.info(`MultimodalInputDevice_getDeviceIds_Promise_test data`); + for (let i = 0; i < data.length; ++i) { + inputDevice.supportKeys(data[i], [17, 22, 2055]).then((res, err) => { + expect(res).assertInstanceOf('Array'); + }); + } + done(); + } + console.info(`MultimodalInputDevice_getDeviceIds_Promise_test exit`); + }); + }) + + /** + * @tc.number MultimodalInputDevice_js_0080 + * @tc.name MultimodalInputDevice_getDevice_Promise_test + * @tc.desc inputdevice interface getDevice test + */ + it("MultimodalInputDevice_getDevice_Promise_test", 0, async function (done) { + console.info(`MultimodalInputDevice_getDevice_Promise_test enter`); + inputDevice.getDevice(-1).then((data, err) => { + if (err) { + console.info(`MultimodalInputDevice_getDevice_Promise_test err`); + expect(false).assertTrue(); + console.info(`MultimodalInputDevice_getDevice_Promise_test ${JSON.stringify(err)}`); + done(); + } else { + console.info(`MultimodalInputDevice_getDevice_Promise_test data`); + expect(JSON.stringify(data) !== "{}").assertTrue(); + done(); + } + console.info(`MultimodalInputDevice_getDevice_Promise_test exit`); + }); + }) + + /** + * @tc.number MultimodalInputDevice_js_0090 + * @tc.name MultimodalInputDevice_on_test + * @tc.desc inputdevice interface getDevice test + */ + it("MultimodalInputDevice_on_test", 0, function () { + console.info(`MultimodalInputDevice_on_test enter`); + let isPhysicalKeyboardExist = true; + inputDevice.on("change", (data) => { + console.info("type: " + data.type + ", deviceId: " + data.deviceId); + inputDevice.getKeyboardType(data.deviceId, (err, ret) => { + console.info("The keyboard type of the device is: " + ret); + if (ret == inputDevice.KeyboardType.ALPHABETIC_KEYBOARD && data.type == 'add') { + // 监听物理键盘已连接。 + isPhysicalKeyboardExist = true; + } else if (ret == inputDevice.KeyboardType.ALPHABETIC_KEYBOARD && data.type == 'remove') { + // 监听物理键盘已断开。 + isPhysicalKeyboardExist = false; + } + }); + }); + console.info(`MultimodalInputDevice_on_test exit`); + }) + + /** + * @tc.number MultimodalInputDevice_js_0100 + * @tc.name MultimodalInputDevice_off_test + * @tc.desc inputdevice interface getDevice test + */ + it("MultimodalInputDevice_off_test", 0, function () { + console.info(`MultimodalInputDevice_off_test enter`); + function listener(data) { + console.info("type: " + data.type + ", deviceId: " + data.deviceId); + expect(data.type== 'add' || data.type== 'remove').assertTrue(); + expect(data).assertInstanceOf('DeviceListener'); + } + // 单独取消listener的监听。 + inputDevice.off("change", listener); + console.info(`MultimodalInputDevice_off_test exit`); + }) + +}) +} diff --git a/multimodalinput/input_js_standard/src/main/js/test/ListMultimodalinput.test.js b/multimodalinput/input_js_standard/src/main/js/test/ListMultimodalinput.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b69ddbcd640accf2637edc3fbc713c8ae5d7dc0c --- /dev/null +++ b/multimodalinput/input_js_standard/src/main/js/test/ListMultimodalinput.test.js @@ -0,0 +1,25 @@ +/* + * 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 MultimodalInput_Device_test from './InputDevice.test.js' +import MultimodalInput_KeyCode_test from './MultimodalInputKey_Code.test.js' +import MultimodalInput_Pointer_test from './Pointer.test.js' +export default function testsuite() { +MultimodalInput_Device_test() +MultimodalInput_KeyCode_test() +MultimodalInput_Pointer_test() +} \ No newline at end of file diff --git a/multimodalinput/input_js_standard/src/main/js/test/MultimodalInputKey_Code.test.js b/multimodalinput/input_js_standard/src/main/js/test/MultimodalInputKey_Code.test.js new file mode 100644 index 0000000000000000000000000000000000000000..54878b1ea1763d4b0dcfac883e7dcd6ca333b748 --- /dev/null +++ b/multimodalinput/input_js_standard/src/main/js/test/MultimodalInputKey_Code.test.js @@ -0,0 +1,2663 @@ +/* + * 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 inputkeyCode from '@ohos.multimodalInput.keyCode'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium' + export default function MultimodalInput_KeyCode_test() { + describe('MultimodalInput_KeyCode_test', function () { + + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_FN == 0).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0020', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0020 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_UNKNOWN == -1).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0020 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0030', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0030 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_HOME == 1).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0030 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0040', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0040 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BACK == 2).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0040 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0050', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0050 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_PLAY_PAUSE == 10).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0050 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0060', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0060 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_STOP == 11).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0060 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0070', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0070 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_NEXT == 12).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0070 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0080', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0080 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_PREVIOUS == 13).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0080 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0090', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0090 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_REWIND == 14).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0090 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0100', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0100 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_FAST_FORWARD == 15).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0100 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0110', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0110 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_VOLUME_UP == 16).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0110 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0120', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0120 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_VOLUME_DOWN == 17).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0120 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0130', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0130 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_POWER == 18).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0130 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0140', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0140 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_CAMERA == 19).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0140 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0150', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0150 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_VOLUME_MUTE == 22).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0150 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0160', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0160 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MUTE == 23).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0160 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0170', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0170 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BRIGHTNESS_UP == 40).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0170 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0180', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0180 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BRIGHTNESS_DOWN == 41).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0180 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0190', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0190 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_0 == 2000).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0190 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0200', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0200 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_1 == 2001).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0200 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0210', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0210 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_2 == 2002).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0210 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0220', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0220 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_3 == 2003).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0220 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0230', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0230 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_4 == 2004).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0230 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0240', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0240 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_5 == 2005).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0240 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0250', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_6 == 2006).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0260', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_7 == 2007).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0270', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_8 == 2008).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0280', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_9 == 2009).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0290', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_STAR == 2010).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0300', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_POUND == 2011).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0310', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_DPAD_UP == 2012).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0320', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_DPAD_DOWN == 2013).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0330', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_DPAD_LEFT == 2014).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0340', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_DPAD_RIGHT == 2015).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0350', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_DPAD_CENTER == 2016).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0360', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_A == 2017).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0370', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_B == 2018).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0380', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_C == 2019).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0390', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_D == 2020).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0400', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_E == 2021).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0410', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F == 2022).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0420', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_G == 2023).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0430', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_H == 2024).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0440', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_I == 2025).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0450', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_J == 2026).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0460', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_K == 2027).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0470', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_L == 2028).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0480', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_M == 2029).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0490', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_N == 2030).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0500', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_O == 2031).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0510', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_P == 2032).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0520', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_Q == 2033).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0530', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_R == 2034).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0540', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_S == 2035).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0550', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_T == 2036).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0560', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_U == 2037).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0570', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_V == 2038).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0580', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_W == 2039).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0590', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_X == 2040).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0600', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_Y == 2041).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0610', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_Z == 2042).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0620', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_COMMA == 2043).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0630', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PERIOD == 2044).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0640', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_ALT_LEFT == 2045).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0650', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_ALT_RIGHT == 2046).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0660', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SHIFT_LEFT == 2047).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0670', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SHIFT_RIGHT == 2048).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0680', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_TAB == 2049).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0690', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SPACE == 2050).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0700', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SYM == 2051).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0710', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_EXPLORER == 2052).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0720', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_ENVELOPE == 2053).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0730', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_ENTER == 2054).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0740', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_DEL == 2055).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0750', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_GRAVE == 2056).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0760', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MINUS == 2057).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0770', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_EQUALS == 2058).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0780', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_LEFT_BRACKET == 2059).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0790', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_RIGHT_BRACKET == 2060).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0800', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BACKSLASH == 2061).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0810', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SEMICOLON == 2062).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0820', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_APOSTROPHE == 2063).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0830', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SLASH == 2064).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0840', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_AT == 2065).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0850', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PLUS == 2066).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0860', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MENU == 2067).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0870', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PAGE_UP == 2068).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0880', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PAGE_DOWN == 2069).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0890', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_ESCAPE == 2070).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0900', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_FORWARD_DEL == 2071).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0910', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_CTRL_LEFT == 2072).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0920', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_CTRL_RIGHT == 2073).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0930', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_CAPS_LOCK == 2074).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0940', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SCROLL_LOCK == 2075).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0950', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_META_LEFT == 2076).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0960', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_META_RIGHT == 2077).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0970', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_FUNCTION == 2078).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0980', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SYSRQ == 2079).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0990', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BREAK == 2080).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_0010 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_1000', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_1000 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MOVE_HOME == 2081).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_1000 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_101', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_101 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MOVE_END == 2082).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_101 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_102', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_102 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_INSERT == 2083).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_102 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_103', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_103 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_FORWARD == 2084).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_103 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_104', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_104 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_PLAY == 2085).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_104 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_105', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_105 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_PAUSE == 2086).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_105 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_106', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_106 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_CLOSE == 2087).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_106 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_107', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_107 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_EJECT == 2088).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_107 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_108', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_108 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_RECORD == 2089).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_108 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_109', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_109 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F1 == 2090).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_109 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_110', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_110 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F2 == 2091).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_110 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_111', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_111 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F3 == 2092).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_111 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_112', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_112 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F4 == 2093).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_112 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_113', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_113 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F5 == 2094).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_113 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_114', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_114 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F6 == 2095).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_114 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_115', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_115 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F7 == 2096).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_115 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_116', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_116 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F8 == 2097).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_116 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_117', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_117 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F9 == 2098).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_117 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_118', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_118 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F10 == 2099).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_118 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_119', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_119 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F11 == 2100).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_119 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_120', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_120 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F12 == 2101).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_120 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_121', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_121 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUM_LOCK == 2102).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_121 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_122', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_122 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_0 == 2103).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_122 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_123', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_123 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_1 == 2104).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_123 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_124', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_124 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_2 == 2105).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_124 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_125', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_125 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_3 == 2106).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_125 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_126', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_126 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_4 == 2107).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_126 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_127', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_127 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_5 == 2108).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_127 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_128', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_128 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_6 == 2109).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_128 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_129', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_129 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_7 == 2110).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_129 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_130', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_130 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_8 == 2111).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_130 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_131', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_131 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_9 == 2112).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_131 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_132', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_132 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_DIVIDE == 2113).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_132 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_133', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_133 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_MULTIPLY == 2114).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_133 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_134', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_134 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_SUBTRACT == 2115).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_134 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_135', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_135 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_ADD == 2116).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_135 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_136', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_136 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_DOT == 2117).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_136 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_137', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_137 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_COMMA == 2118).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_137 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_138', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_138 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_ENTER == 2119).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_138 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_139', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_139 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_EQUALS == 2120).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_139 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_140', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_140 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_LEFT_PAREN == 2121).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_140 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_141', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_141 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_RIGHT_PAREN == 2122).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_141 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_142', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_142 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_VIRTUAL_MULTITASK == 2210).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_142 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_143', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_143 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SLEEP == 2600).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_143 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_144', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_144 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_ZENKAKU_HANKAKU == 2601).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_144 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_145', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_145 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_102ND == 2602).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_145 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_146', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_146 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_RO == 2603).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_146 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_147', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_147 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_KATAKANA == 2604).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_147 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_148', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_148 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_HIRAGANA == 2605).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_148 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_149', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_149 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_HENKAN == 2606).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_149 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_150', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_150 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_KATAKANA_HIRAGANA == 2607).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_150 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_151', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_151 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MUHENKAN == 2608).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_151 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_152', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_152 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_LINEFEED == 2609).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_152 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_153', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_153 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MACRO == 2610).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_153 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_154', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_154 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NUMPAD_PLUSMINUS == 2611).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_154 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_155', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_155 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SCALE == 2612).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_155 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_156', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_156 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_HANGUEL == 2613).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_156 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_157', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_157 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_HANJA == 2614).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_157 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_158', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_158 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_YEN == 2615).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_158 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_159', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_159 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_STOP == 2616).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_159 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_160', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_160 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_AGAIN == 2617).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_160 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_161', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_161 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PROPS == 2618).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_161 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_162', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_162 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_UNDO == 2619).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_162 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_163', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_163 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_COPY == 2620).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_163 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_164', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_164 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_OPEN == 2621).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_164 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_165', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_165 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PASTE == 2622).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_165 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_166', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_166 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_FIND == 2623).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_166 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_167', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_167 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_CUT == 2624).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_167 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_168', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_168 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_HELP == 2625).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_168 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_169', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_169 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_CALC == 2626).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_169 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_170', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_170 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_FILE == 2627).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_170 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_171', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_171 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BOOKMARKS == 2628).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_171 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_172', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_172 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NEXT == 2629).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_172 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_173', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_173 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PLAYPAUSE == 2630).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_173 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_174', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_174 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PREVIOUS == 2631).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_174 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_175', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_175 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_STOPCD == 2632).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_175 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_178', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_178 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_CONFIG == 2634).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_178 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_179', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_179 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_REFRESH == 2635).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_179 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_180', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_180 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_EXIT == 2636).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_180 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_181', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_181 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_EDIT == 2637).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_181 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_182', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_182 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SCROLLUP == 2638).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_182 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_183', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_183 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SCROLLDOWN == 2639).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_183 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_184', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_184 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NEW == 2640).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_184 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_186', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_186 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_REDO == 2641).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_186 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_188', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_188 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_CLOSE == 2642).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_188 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_189', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_189 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PLAY == 2643).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_189 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_190', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_190 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BASSBOOST == 2644).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_190 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_192', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_192 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PRINT == 2645).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_192 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_193', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_193 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_CHAT == 2646).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_193 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_194', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_194 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_FINANCE == 2647).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_194 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_195', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_195 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_CANCEL == 2648).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_195 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_197', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_197 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_KBDILLUM_TOGGLE == 2649).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_197 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_198', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_198 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_KBDILLUM_DOWN == 2650).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_198 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_199', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_199 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_KBDILLUM_UP == 2651).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_199 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_200', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_200 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SEND == 2652).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_200 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_201', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_201 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_REPLY == 2653).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_201 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_203', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_203 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_FORWARDMAIL == 2654).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_203 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_205', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_205 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SAVE == 2655).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_205 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_206', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_206 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_DOCUMENTS == 2656).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_206 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_207', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_207 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_VIDEO_NEXT == 2657).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_207 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_208', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_208 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_VIDEO_PREV == 2658).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_208 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_209', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_209 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BRIGHTNESS_CYCLE == 2659).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_209 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_210', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_210 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BRIGHTNESS_ZERO == 2660).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_210 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_211', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_211 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_DISPLAY_OFF == 2661).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_211 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_212', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_212 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BTN_MISC == 2662).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_212 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_213', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_213 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_GOTO == 2663).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_213 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_214', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_214 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_INFO == 2664).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_214 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_215', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_215 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PROGRAM == 2665).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_215 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_216', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_216 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PVR == 2666).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_216 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_217', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_217 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SUBTITLE == 2667).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_217 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_218', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_218 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_FULL_SCREEN == 2668).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_218 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_219', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_219 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_KEYBOARD == 2669).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_219 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_221', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_221 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_ASPECT_RATIO == 2670).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_221 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_222', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_222 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PC == 2671).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_222 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_223', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_223 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_TV == 2672).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_223 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_224', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_224 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_TV2 == 2673).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_224 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_226', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_226 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_VCR == 2674).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_226 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_227', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_227 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_VCR2 == 2675).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_227 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_228', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_228 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SAT == 2676).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_228 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_230', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_230 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_CD == 2677).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_230 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_231', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_231 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_TAPE == 2678).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_231 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_232', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_232 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_TUNER == 2679).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_232 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_233', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_233 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PLAYER == 2680).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_233 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_234', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_234 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_DVD == 2681).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_234 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_235', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_235 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_AUDIO == 2682).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_235 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_236', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_236 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_VIDEO == 2683).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_236 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_237', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_237 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MEMO == 2684).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_237 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_238', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_238 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_CALENDAR == 2685).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_238 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_239', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_239 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_RED == 2686).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_239 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_240', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_240 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_GREEN == 2687).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_240 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_241', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_241 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_YELLOW == 2688).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_241 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_242', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_242 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BLUE == 2689).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_242 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_243', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_243 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_CHANNELUP == 2690).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_243 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_245', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_245 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_CHANNELDOWN == 2691).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_245 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_246', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_246 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_LAST == 2692).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_246 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_247', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_247 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_RESTART == 2693).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_247 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_248', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_248 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SLOW == 2694).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_248 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_249', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_249 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SHUFFLE == 2695).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_249 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_250', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_250 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_VIDEOPHONE == 2696).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_250 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_251', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_251 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_GAMES == 2697).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_251 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_252', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_252 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_ZOOMIN == 2698).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_252 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_253', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_253 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_ZOOMOUT == 2699).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_253 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_255', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_255 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_ZOOMRESET == 2700).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_255 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_256', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_256 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_WORDPROCESSOR == 2701).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_256 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_257', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_257 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_EDITOR == 2702).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_257 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_258', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_258 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SPREADSHEET == 2703).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_258 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_259', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_259 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_GRAPHICSEDITOR == 2704).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_259 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_260', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_260 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PRESENTATION == 2705).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_260 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_261', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_261 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_DATABASE == 2706).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_261 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_262', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_262 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_NEWS == 2707).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_262 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_263', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_263 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_VOICEMAIL == 2708).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_263 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_264', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_264 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_ADDRESSBOOK == 2709).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_264 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_265', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_265 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MESSENGER == 2710).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_265 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_266', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_266 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BRIGHTNESS_TOGGLE == 2711).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_266 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_267', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_267 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SPELLCHECK == 2712).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_267 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_268', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_268 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_COFFEE == 2713).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_268 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_269', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_269 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MEDIA_REPEAT == 2714).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_269 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_270', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_270 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_IMAGES == 2715).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_270 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_271', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_271 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BUTTONCONFIG == 2716).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_271 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_272', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_272 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_TASKMANAGER == 2717).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_272 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_273', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_273 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_JOURNAL == 2718).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_273 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_274', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_274 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_CONTROLPANEL == 2719).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_274 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_275', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_275 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_APPSELECT == 2720).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_275 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_276', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_276 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SCREENSAVER == 2721).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_276 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_277', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_277 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_ASSISTANT == 2722).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_277 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_278', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_278 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_KBD_LAYOUT_NEXT == 2723).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_278 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_279', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_279 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BRIGHTNESS_MIN == 2724).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_279 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_280', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_280 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BRIGHTNESS_MAX == 2725).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_280 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_282', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_282 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_KBDINPUTASSIST_PREV == 2726).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_282 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_283', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_283 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_KBDINPUTASSIST_NEXT == 2727).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_283 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_284', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_284 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_KBDINPUTASSIST_PREVGROUP == 2728).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_284 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_285', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_285 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_KBDINPUTASSIST_NEXTGROUP == 2729).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_285 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_286', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_286 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_KBDINPUTASSIST_ACCEPT == 2730).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_286 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_287', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_287 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_KBDINPUTASSIST_CANCEL == 2731).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_287 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_288', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_288 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_FRONT == 2800).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_288 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_289', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_289 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SETUP == 2801).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_289 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_290', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_290 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_WAKEUP == 2802).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_290 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_293', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_293 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SENDFILE == 2803).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_293 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_294', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_294 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_DELETEFILE == 2804).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_294 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_295', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_295 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_XFER == 2805).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_295 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_296', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_296 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PROG1 == 2806).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_296 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_298', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_298 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PROG2 == 2807).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_298 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_299', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_299 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MSDOS == 2808).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_299 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_300', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_300 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SCREENLOCK == 2809).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_300 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_301', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_301 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_DIRECTION_ROTATE_DISPLAY == 2810).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_301 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_302', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_302 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_CYCLEWINDOWS == 2811).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_302 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_303', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_303 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_COMPUTER == 2812).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_303 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_304', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_304 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_EJECTCLOSECD == 2813).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_304 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_305', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_305 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_ISO == 2814).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_305 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_306', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_306 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_MOVE == 2815).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_306 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_307', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_307 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F13 == 2816).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_307 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_308', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_308 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F14 == 2817).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_308 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_309', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_309 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F15 == 2818).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_309 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_310', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_310 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F16 == 2819).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_310 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_311', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_311 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F17 == 2820).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_311 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_312', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_312 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F18 == 2821).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_312 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_313', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_313 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F19 == 2822).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_313 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_315', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_315 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F20 == 2823).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_315 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_316', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_316 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F21 == 2824).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_316 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_317', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_317 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F22 == 2825).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_317 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_318', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_318 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F23 == 2826).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_318 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_319', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_319 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_F24 == 2827).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_319 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_320', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_320 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PROG3 == 2828).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_320 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_321', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_321 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_PROG4 == 2829).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_321 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_322', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_322 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_DASHBOARD == 2830).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_322 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_323', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_323 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SUSPEND == 2831).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_323 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_324', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_324 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_HP == 2832).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_324 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_325', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_325 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SOUND == 2833).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_325 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_326', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_326 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_QUESTION == 2834).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_326 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_327', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_327 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_CONNECT == 2836).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_327 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_328', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_328 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SPORT == 2837).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_328 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_329', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_329 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SHOP == 2838).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_329 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_330', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_330 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_ALTERASE == 2839).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_330 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_331', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_331 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_SWITCHVIDEOMODE == 2841).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_331 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_332', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_332 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BATTERY == 2842).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_332 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_333', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_333 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BLUETOOTH == 2843).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_333 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_334', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_334 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_WLAN == 2844).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_334 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_335', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_335 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_UWB == 2845).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_335 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_336', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_336 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_WWAN_WIMAX == 2846).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_336 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_337', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_337 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_RFKILL == 2847).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_337 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_338', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_338 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_CHANNEL == 3001).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_338 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_339', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_339 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BTN_0 == 3100).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_339 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_340', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_340 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BTN_1 == 3101).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_340 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_341', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_341 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BTN_2 == 3102).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_341 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_342', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_342 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BTN_3 == 3103).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_342 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_343', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_343 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BTN_4 == 3104).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_343 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_344', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_344 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BTN_5 == 3105).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_344 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_345', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_345 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BTN_6 == 3106).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_345 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_346', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_346 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BTN_7 == 3107).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_346 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_347', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_347 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BTN_8 == 3108).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_347 exit`); + }) + + it('Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_348', 0, function () { + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_348 enter`); + + expect(inputkeyCode.KeyCode.KEYCODE_BTN_9 == 3109).assertTrue(); + + console.info(`Multimodalinput_KeyCode_test::SUB_MMI_KeyCodeTest_348 exit`); + }) +}) + } + diff --git a/multimodalinput/input_js_standard/src/main/js/test/Pointer.test.js b/multimodalinput/input_js_standard/src/main/js/test/Pointer.test.js new file mode 100644 index 0000000000000000000000000000000000000000..d1e78d418dc6528216740ad1e5ec7988f22e426d --- /dev/null +++ b/multimodalinput/input_js_standard/src/main/js/test/Pointer.test.js @@ -0,0 +1,291 @@ +/* + * 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 pointer from '@ohos.multimodalInput.pointer' +import window from '@ohos.window' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium' + export default function MultimodalInput_Pointer_test() { + describe('MultimodalInput_Pointer_test', function () { + + it('MultimodalInput_Pointer_test::PointerVisibleTest_001', 0, function () { + console.info(`MultimodalInput_Pointer_test::SetPointerVisibleTest_001 enter`); + var callback = function (err, data) { + if (err) { + console.info(`MultimodalInput_Pointer_test::SetPointerVisibleTest_001 failed, err=${JSON.stringify(err)}`); + expect(false).assertTrue(); + } else { + console.info(`MultimodalInput_Pointer_test::SetPointerVisibleTest_001 success`); + expect(true).assertTrue(); + } + }; + pointer.setPointerVisible(false, callback); + + pointer.isPointerVisible().then(data => { + console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_001 success, data=${JSON.stringify(data)}`); + expect(data == false).assertTrue(); + }, err => { + console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_001 failed, err=${JSON.stringify(err)}`); + expect(false).assertTrue(); + }); + console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_001 exit`); + }) + + it('MultimodalInput_Pointer_test::PointerVisibleTest_002', 0, function () { + console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_002 enter`); + pointer.setPointerVisible(true).then(data => { + console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_002 success, data=${JSON.stringify(data)}`); + expect(true).assertTrue(); + }, err => { + console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_002 failed, err=${JSON.stringify(err)}`); + expect(false).assertTrue(); + }); + + var callback = function (err, data) { + if (err) { + console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_002 failed, err=${JSON.stringify(err)}`); + expect(false).assertTrue(); + } else { + console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_002 success, data=${JSON.stringify(data)}`); + expect(data == true).assertTrue(); + } + }; + pointer.isPointerVisible(callback); + console.info(`MultimodalInput_Pointer_test::PointerVisibleTest_002 exit`); + }) + + it('MultimodalInput_Pointer_test::SetPointerStyle_001', 0, function () { + console.info(`SetPointerStyle_001 enter`); + window.getTopWindow((err, data) => { + if (err) { + console.info(`SetPointerStyle_001 failed, err=${JSON.stringify(err)}`); + expect(false).assertTrue(); + } + var windowClass = data; + windowClass.getProperties((err, data) => { + if (err) { + console.info(`SetPointerStyle_001 failed, err=${JSON.stringify(err)}`); + expect(false).assertTrue(); + } + var windowId = data.id; + pointer.setPointerStyle(windowId, 4).then(() => { + expect(true).assertTrue(); + console.info(`SetPointerStyle_001 success`); + }).catch((err) => { + expect(false).assertTrue(); + console.info("promise::catch", err); + }); + }) + }) + }) + + it('MultimodalInput_Pointer_test::SetPointerStyle_002', 0, function () { + console.info(`SetPointerStyle_002 enter`); + window.getTopWindow((err, data) => { + var windowClass = data; + if (err) { + console.info(`SetPointerStyle_002 failed, err=${JSON.stringify(err)}`); + expect(false).assertTrue(); + } + windowClass.getProperties((err, data) => { + if (err) { + console.info(`SetPointerStyle_002 failed, err=${JSON.stringify(err)}`); + expect(false).assertTrue(); + } + var windowId = data.id; + pointer.setPointerStyle(windowId, 4, (err) => { + if (err) { + console.info(`SetPointerStyle_002 failed, err=${JSON.stringify(err)}`); + expect(false).assertTrue(); + } else { + console.info(`SetPointerStyle_002 success`); + expect(true).assertTrue(); + } + }); + }) + }) + }) + + it('MultimodalInput_Pointer_test::GetPointerStyle_001', 0, function () { + console.info(`GetPointerStyle_001 enter`); + window.getTopWindow((err, data) => { + if (err) { + console.info(`GetPointerStyle_001 failed, err=${JSON.stringify(err)}`); + expect(false).assertTrue(); + } + var windowClass = data; + windowClass.getProperties((err, data) => { + if (err) { + console.info(`GetPointerStyle_001 failed, err=${JSON.stringify(err)}`); + expect(false).assertTrue(); + } + var windowId = data.id; + pointer.getPointerStyle(windowId).then((data) => { + console.info(`GetPointerStyle_001 success, data=${JSON.stringify(data)}`); + expect(data).assertTrue('Number'); + }).catch((err) => { + console.info("promise::catch", err); + expect(false).assertTrue(); + }); + }) + }) + }) + + it('MultimodalInput_Pointer_test::GetPointerStyle_002', 0, function () { + console.info(`GetPointerStyle_002 enter`); + window.getTopWindow((err, data) => { + if (err) { + console.info(`GetPointerStyle_002 failed, err=${JSON.stringify(err)}`); + expect(false).assertTrue(); + } + var windowClass = data; + windowClass.getProperties((err, data) => { + if (err) { + console.info(`GetPointerStyle_002 failed, err=${JSON.stringify(err)}`); + expect(false).assertTrue(); + } + var windowId = data.id; + pointer.getPointerStyle(windowId, (err, data) => { + if (err) { + console.info(`GetPointerStyle_002 failed, err=${JSON.stringify(err)}`); + expect(false).assertTrue(); + } else { + console.info(`GetPointerStyle_002 success, data=${JSON.stringify(data)}`); + expect(data).assertTrue('Number'); + } + }); + }) + }) + }) + + it('MultimodalInput_Pointer_test::Pointer_PointerStyle_test', 0, function () { + console.info('MultimodalInput_Pointer_test::Pointer_PointerStyle_test = ' + pointer.PointerStyle.DEFAULT); + expect(pointer.PointerStyle.DEFAULT == 0).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_EAST_test = ' + pointer.PointerStyle.EAST); + expect(pointer.PointerStyle.EAST == 1).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_WEST_test = ' + pointer.PointerStyle.WEST); + expect(pointer.PointerStyle.WEST == 2).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_SOUTH_test = ' + pointer.PointerStyle.SOUTH); + expect(pointer.PointerStyle.SOUTH == 3).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_NORTH_test = ' + pointer.PointerStyle.NORTH); + expect(pointer.PointerStyle.NORTH == 4).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_WEST_EAST_test = ' + pointer.PointerStyle.WEST_EAST); + expect(pointer.PointerStyle.WEST_EAST == 5).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_NORTH_SOUTH_test = ' + pointer.PointerStyle.NORTH_SOUTH); + expect(pointer.PointerStyle.NORTH_SOUTH == 6).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_NORTH_EAST_test = ' + pointer.PointerStyle.NORTH_EAST); + expect(pointer.PointerStyle.NORTH_EAST == 7).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_NORTH_WEST_test = ' + pointer.PointerStyle.NORTH_WEST); + expect(pointer.PointerStyle.NORTH_WEST == 8).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_SOUTH_EAST_test = ' + pointer.PointerStyle.SOUTH_EAST); + expect(pointer.PointerStyle.SOUTH_EAST == 9).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_SOUTH_WEST_test = ' + pointer.PointerStyle.SOUTH_WEST); + expect(pointer.PointerStyle.SOUTH_WEST == 10).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_NORTH_EAST_SOUTH_WEST_test = ' + pointer.PointerStyle.NORTH_EAST_SOUTH_WEST); + expect(pointer.PointerStyle.NORTH_EAST_SOUTH_WEST == 11).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_NORTH_WEST_SOUTH_EAST_test = ' + pointer.PointerStyle.NORTH_WEST_SOUTH_EAST); + expect(pointer.PointerStyle.NORTH_WEST_SOUTH_EAST == 12).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_CROSS_test = ' + pointer.PointerStyle.CROSS); + expect(pointer.PointerStyle.CROSS == 13).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_CURSOR_COPY_test = ' + pointer.PointerStyle.CURSOR_COPY); + expect(pointer.PointerStyle.CURSOR_COPY == 14).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_CURSOR_FORBID_test = ' + pointer.PointerStyle.CURSOR_FORBID); + expect(pointer.PointerStyle.CURSOR_FORBID == 15).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_COLOR_SUCKER_test = ' + pointer.PointerStyle.COLOR_SUCKER); + expect(pointer.PointerStyle.COLOR_SUCKER == 16).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_HAND_GRABBING_test = ' + pointer.PointerStyle.HAND_GRABBING); + expect(pointer.PointerStyle.HAND_GRABBING == 17).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_HAND_OPEN_test = ' + pointer.PointerStyle.HAND_OPEN); + expect(pointer.PointerStyle.HAND_OPEN == 18).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_HAND_POINTING_test = ' + pointer.PointerStyle.HAND_POINTING); + expect(pointer.PointerStyle.HAND_POINTING == 19).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_HELP_test = ' + pointer.PointerStyle.HELP); + expect(pointer.PointerStyle.HELP == 20).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_MOVE_test = ' + pointer.PointerStyle.MOVE); + expect(pointer.PointerStyle.MOVE == 21).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_RESIZE_UP_DOWN_test = ' + pointer.PointerStyle.RESIZE_UP_DOWN); + expect(pointer.PointerStyle.RESIZE_UP_DOWN == 22).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_RESIZE_LEFT_RIGHT_test = ' + pointer.PointerStyle.RESIZE_LEFT_RIGHT); + expect(pointer.PointerStyle.RESIZE_LEFT_RIGHT == 23).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_SCREENSHOT_CHOOSE_test = ' + pointer.PointerStyle.SCREENSHOT_CHOOSE); + expect(pointer.PointerStyle.SCREENSHOT_CHOOSE == 24).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_SCREENSHOT_CURSOR_test = ' + pointer.PointerStyle.SCREENSHOT_CURSOR); + expect(pointer.PointerStyle.SCREENSHOT_CURSOR == 25).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_TEXT_CURSOR_test = ' + pointer.PointerStyle.TEXT_CURSOR); + expect(pointer.PointerStyle.TEXT_CURSOR == 26).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_ZOOM_IN_test = ' + pointer.PointerStyle.ZOOM_IN); + expect(pointer.PointerStyle.ZOOM_IN == 27).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_ZOOM_OUT_test = ' + pointer.PointerStyle.ZOOM_OUT); + expect(pointer.PointerStyle.ZOOM_OUT == 28).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_MIDDLE_BTN_EAST_test = ' + pointer.PointerStyle.MIDDLE_BTN_EAST); + expect(pointer.PointerStyle.MIDDLE_BTN_EAST == 29).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_MIDDLE_BTN_WEST_test = ' + pointer.PointerStyle.MIDDLE_BTN_WEST); + expect(pointer.PointerStyle.MIDDLE_BTN_WEST == 30).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_MIDDLE_BTN_SOUTH_test = ' + pointer.PointerStyle.MIDDLE_BTN_SOUTH); + expect(pointer.PointerStyle.MIDDLE_BTN_SOUTH == 31).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_MIDDLE_BTN_NORTH_test = ' + pointer.PointerStyle.MIDDLE_BTN_NORTH); + expect(pointer.PointerStyle.MIDDLE_BTN_NORTH == 32).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_MIDDLE_BTN_NORTH_SOUTH_test = ' + pointer.PointerStyle.MIDDLE_BTN_NORTH_SOUTH); + expect(pointer.PointerStyle.MIDDLE_BTN_NORTH_SOUTH == 33).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_MIDDLE_BTN_NORTH_EAST_test = ' + pointer.PointerStyle.MIDDLE_BTN_NORTH_EAST); + expect(pointer.PointerStyle.MIDDLE_BTN_NORTH_EAST == 34).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_MIDDLE_BTN_NORTH_WEST_test = ' + pointer.PointerStyle.MIDDLE_BTN_NORTH_WEST); + expect(pointer.PointerStyle.MIDDLE_BTN_NORTH_WEST == 35).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_MIDDLE_BTN_SOUTH_EAST_test = ' + pointer.PointerStyle.MIDDLE_BTN_SOUTH_EAST); + expect(pointer.PointerStyle.MIDDLE_BTN_SOUTH_EAST == 36).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_MIDDLE_BTN_SOUTH_WEST_test = ' + pointer.PointerStyle.MIDDLE_BTN_SOUTH_WEST); + expect(pointer.PointerStyle.MIDDLE_BTN_SOUTH_WEST == 37).assertTrue(); + + console.info('MultimodalInput_Pointer_test::Pointer_MIDDLE_BTN_NORTH_SOUTH_WEST_EAST_test = ' + pointer.PointerStyle.MIDDLE_BTN_NORTH_SOUTH_WEST_EAST); + expect(pointer.PointerStyle.MIDDLE_BTN_NORTH_SOUTH_WEST_EAST == 38).assertTrue(); + }) +}) +} \ No newline at end of file diff --git a/multimodalinput/input_js_standard/src/main/resources/base/element/string.json b/multimodalinput/input_js_standard/src/main/resources/base/element/string.json index 39aa12e8038392d83a5b16ebf8b58b5ae63349ba..2990a560b29c11d128604169e4c78c4d72eebada 100644 --- a/multimodalinput/input_js_standard/src/main/resources/base/element/string.json +++ b/multimodalinput/input_js_standard/src/main/resources/base/element/string.json @@ -7,6 +7,22 @@ { "name": "mainability_description", "value": "JS_Phone_Empty Feature 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 diff --git a/multimodalinput/multimodalinput_ets_standard/BUILD.gn b/multimodalinput/multimodalinput_ets_standard/BUILD.gn old mode 100755 new mode 100644 index 1e8ee88e9bcdbc52170b6909487bcea6d6dcc89e..17ea4baf40e1eb8cac4a6cba7af7fbc9188bec2b --- a/multimodalinput/multimodalinput_ets_standard/BUILD.gn +++ b/multimodalinput/multimodalinput_ets_standard/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/multimodalinput/multimodalinput_ets_standard/Test.json b/multimodalinput/multimodalinput_ets_standard/Test.json old mode 100755 new mode 100644 diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/config.json b/multimodalinput/multimodalinput_ets_standard/entry/src/main/config.json old mode 100755 new mode 100644 index d2c26caa769322b30c573d3101937c24d098768d..72dc4538b0a3ae94009b267da3e32c377fee41bb --- a/multimodalinput/multimodalinput_ets_standard/entry/src/main/config.json +++ b/multimodalinput/multimodalinput_ets_standard/entry/src/main/config.json @@ -18,6 +18,7 @@ "name": ".MyApplication", "mainAbility": "ohos.acts.multimodalinput.input.MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/MainAbility/app.ets b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/MainAbility/app.ets old mode 100755 new mode 100644 index b917b80ff7cabb5078dd7a9d9bf546c510bd86d7..1a86d49eeb234e7c0bd8901c84f49b6ad919b564 --- a/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/MainAbility/app.ets +++ b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/MainAbility/app.ets @@ -14,7 +14,7 @@ * limitations under the License. */ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' +import { Hypium } from '@ohos/hypium' import testsuite from '../test/List.test' export default { diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/MainAbility/pages/index.ets b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/MainAbility/pages/index.ets old mode 100755 new mode 100644 diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestAbility/app.ets b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestAbility/app.ets old mode 100755 new mode 100644 diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestAbility/pages/index.ets b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestAbility/pages/index.ets old mode 100755 new mode 100644 diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts old mode 100755 new mode 100644 diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/List.test.ets b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/List.test.ets old mode 100755 new mode 100644 diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/MultimodalInputEventType.test.ets b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/MultimodalInputEventType.test.ets old mode 100755 new mode 100644 index f1556f6a766d31ed3f4f87d5415ceb9666703577..33426d9a8b98835e59465d8d57ef57e24b7da2a7 --- a/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/MultimodalInputEventType.test.ets +++ b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/MultimodalInputEventType.test.ets @@ -21,16 +21,7 @@ import inputEvent from '@ohos.multimodalInput.inputEvent' import { Key, KeyEvent } from '@ohos.multimodalInput.keyEvent' import { AxisValue, MouseEvent } from '@ohos.multimodalInput.mouseEvent' import { Touch, TouchEvent } from '@ohos.multimodalInput.touchEvent' - -import { - describe, - beforeAll, - beforeEach, - afterEach, - afterAll, - it, - expect -} from 'hypium/index' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium' export default function MultimodalInputEventTypeTest() { describe('MultimodalInput_test', function () { diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/Utils.ets b/multimodalinput/multimodalinput_ets_standard/entry/src/main/ets/test/Utils.ets old mode 100755 new mode 100644 diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/color.json b/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/color.json old mode 100755 new mode 100644 diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/float.json b/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/float.json old mode 100755 new mode 100644 diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/string.json b/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/media/icon.png b/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 diff --git a/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/rawfile/test.png b/multimodalinput/multimodalinput_ets_standard/entry/src/main/resources/rawfile/test.png old mode 100755 new mode 100644 diff --git a/multimodalinput/multimodalinput_ets_standard/signature/openharmony_sx.p7b b/multimodalinput/multimodalinput_ets_standard/signature/openharmony_sx.p7b old mode 100755 new mode 100644 diff --git a/notification/ans_standard/BUILD.gn b/notification/ans_standard/BUILD.gn index dc8fd2217e29f89ffaa26d767eaaf11f61edd1e9..09b4264b4d579835d3a72de5ef2f64545724d2c6 100644 --- a/notification/ans_standard/BUILD.gn +++ b/notification/ans_standard/BUILD.gn @@ -16,12 +16,11 @@ group("ans_standard") { testonly = true if (is_standard_system) { deps = [ - #"actsansnotificationcancel:ActsAnsNotificationCancelTest", - #"actsansnotificationremove:ActsAnsNotificationRemoveTest", + "actsNotificationDistributedTest:ActsNotificationDistributedTest", + "actsNotificationPublishTest:ActsNotificationPublishTest", "actsNotificationSlotTest:ActsNotificationSlotTest", - "actsansslottest:ActsAnsSlotTest", + "actsNotificationWantAgentTest:ActsNotificationWantAgentTest", "actsnotificationshow:ActsNotificationShowTest", - "publish_test:publish_test", ] } } 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/notification/ans_standard/actsNotificationDistributedTest/signature/openharmony_sx.p7b b/notification/ans_standard/actsNotificationDistributedTest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..c21526ed6d8aa59d47b67380df6fec1a7d8af9dd Binary files /dev/null and b/notification/ans_standard/actsNotificationDistributedTest/signature/openharmony_sx.p7b differ diff --git a/notification/ans_standard/actsNotificationDistributedTest/src/main/config.json b/notification/ans_standard/actsNotificationDistributedTest/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..e996fb1673ea1438cddd19e617a243e7aa7d41fd --- /dev/null +++ b/notification/ans_standard/actsNotificationDistributedTest/src/main/config.json @@ -0,0 +1,100 @@ +{ + "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": [ + "default", + "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/ans_standard/actsNotificationPublishTest/BUILD.gn b/notification/ans_standard/actsNotificationPublishTest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..8b97e27a6b9830467bbf942ac7ad77f81980206b --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/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("ActsNotificationPublishTest") { + hap_profile = "./src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsNotificationPublishTest" + 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/actsNotificationPublishTest/Test.json b/notification/ans_standard/actsNotificationPublishTest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..fb297dca949c926f94cf6e74ed4fb640c8f2e601 --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/Test.json @@ -0,0 +1,26 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "180000", + "shell-timeout": "180000", + "bundle-name": "com.example.actsnotificationpublish", + "package-name": "com.example.actsnotificationpublish" + }, + "kits": [ + { + "test-file-name": [ + "ActsNotificationPublishTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type":"ShellKit", + "run-command":[ + "anm setting -e com.example.actsnotificationpublish:0:true" + ], + "cleanup-apps":true + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/actsNotificationPublishTest/signature/openharmony_sx.p7b b/notification/ans_standard/actsNotificationPublishTest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..c21526ed6d8aa59d47b67380df6fec1a7d8af9dd Binary files /dev/null and b/notification/ans_standard/actsNotificationPublishTest/signature/openharmony_sx.p7b differ diff --git a/notification/ans_standard/actsNotificationPublishTest/src/main/config.json b/notification/ans_standard/actsNotificationPublishTest/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..8120c60b675c183114cde32cf12e2cae78b93a54 --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/src/main/config.json @@ -0,0 +1,100 @@ +{ + "app": { + "bundleName": "com.example.actsnotificationpublish", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsnotificationpublish", + "name": ".entry", + "deviceType": [ + "default", + "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/actsNotificationPublishTest/src/main/js/MainAbility/app.js b/notification/ans_standard/actsNotificationPublishTest/src/main/js/MainAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..b58cf3c570b660c6f6f8cdcb1b317d67687deb29 --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/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/actsNotificationPublishTest/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/actsNotificationPublishTest/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/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/actsNotificationPublishTest/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/actsNotificationPublishTest/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/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/actsNotificationPublishTest/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/actsNotificationPublishTest/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b6c4207e3d98d227f135ee57bfa49b98cfb93faf --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/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/actsNotificationPublishTest/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/actsNotificationPublishTest/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..153d713d137f27cf989ffbaee2e886f92898056e --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/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/actsNotificationPublishTest/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/actsNotificationPublishTest/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..312c30c0c27535e4ee98fce4ca802506159ba2d1 --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/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/actsNotificationPublishTest/src/main/js/TestAbility/app.js b/notification/ans_standard/actsNotificationPublishTest/src/main/js/TestAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..d5ee271df29e516d1c8929054283e5f2bf5c981c --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/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/actsNotificationPublishTest/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/actsNotificationPublishTest/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/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/actsNotificationPublishTest/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/actsNotificationPublishTest/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/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/actsNotificationPublishTest/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/actsNotificationPublishTest/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b21c92c6290ea747bd891e2ab673721afc5521ed --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/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/actsNotificationPublishTest/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/actsNotificationPublishTest/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/notification/ans_standard/actsNotificationPublishTest/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/actsNotificationPublishTest/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d94b75c085fa1c16a0b2721609b18c57a7295476 --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/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/actsNotificationPublishTest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/actsNotificationPublishTest/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 0000000000000000000000000000000000000000..b9e78ce7cf73f1ade6ba52a408a44e33f5430f0d --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/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/actsNotificationPublishTest/src/main/js/test/ActsNotificationPublishTest.js b/notification/ans_standard/actsNotificationPublishTest/src/main/js/test/ActsNotificationPublishTest.js new file mode 100644 index 0000000000000000000000000000000000000000..44a8787ea0382e39cdc0f13d0ff3ab23ab3fb1c7 --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/src/main/js/test/ActsNotificationPublishTest.js @@ -0,0 +1,338 @@ +/* +* 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 ActsNotificationPublishTest() { + describe('SUB_NOTIFICATION_ANS_Publish_TEST', function () { + let TAG = 'SUB_NOTIFICATION_ANS_Publish_TEST ===>' + console.info(TAG + 'SUB_NOTIFICATION_ANS_Publish_TEST START') + + /* + * @tc.number : SUB_NOTIFICATION_ANS_CANCEL_TEST_0100 + * @tc.name : function cancel(id: number, label: string, callback: AsyncCallback): void + * @tc.desc : Cancels a notification with the specified label and ID + */ + it('SUB_NOTIFICATION_ANS_CANCEL_TEST_0100', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_CANCEL_TEST_0100 START`) + let id = 1 + let label = "label" + await notification.cancel(id, label, (err) => { + if (err.code) { + console.info(`${TAG} cancel AsyncCallback err: ${err.code}`) + expect(true).assertTrue() + done() + } else { + console.info(`${TAG} cancel AsyncCallback success`) + expect(false).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_CANCEL_TEST_0100 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_CANCEL_TEST_0200 + * @tc.name : function cancel(id: number, label: string, callback: AsyncCallback): void + * @tc.desc : Cancels a notification with the specified label and ID + */ + it('SUB_NOTIFICATION_ANS_CANCEL_TEST_0200', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_CANCEL_TEST_0100 START`) + let id = 1 + let label = "label" + await notification.cancel(id, label).then(() => { + console.info(`${TAG} cancel Promise success`) + expect(false).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} cancel Promise err: ${err.code}`) + expect(true).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_CANCEL_TEST_0100 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_CANCEL_TEST_0300 + * @tc.name : function cancel(id: number, callback: AsyncCallback): void + * @tc.desc : Cancels a notification with the specified ID + */ + it('SUB_NOTIFICATION_ANS_CANCEL_TEST_0300', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_CANCEL_TEST_0300 START`) + let id = 1 + await notification.cancel(id, (err) => { + if (err.code) { + console.info(`${TAG} cancel id err: ${err.code}`) + expect(true).assertTrue() + done() + } else { + console.info(`${TAG} cancel id success`) + expect(false).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_CANCEL_TEST_0300 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_CANCELAll_TEST_0100 + * @tc.name : function cancelAll(callback: AsyncCallback): void + * @tc.desc : Cancels all notifications of the current application + */ + it('SUB_NOTIFICATION_ANS_CANCELAll_TEST_0100', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_CANCELAll_TEST_0100 START`) + await notification.cancelAll((err) => { + if (err.code) { + console.info(`${TAG} cancelAll AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} cancelAll AsyncCallback success`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_CANCELAll_TEST_0100 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_CANCELAll_TEST_0200 + * @tc.name : function cancelAll(): Promise + * @tc.desc : Cancels all notifications of the current application + */ + it('SUB_NOTIFICATION_ANS_CANCELAll_TEST_0200', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_CANCELAll_TEST_0200 START`) + await notification.cancelAll().then(() => { + console.info(`${TAG} cancelAll Promise success`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} cancelAll Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_CANCELAll_TEST_0200 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_CANCEL_GROUP_TEST_0100 + * @tc.name : function cancelGroup(groupName: string, callback: AsyncCallback): void + * @tc.desc : Cancel the notification of a specified group for this application + */ + it('SUB_NOTIFICATION_ANS_CANCEL_GROUP_TEST_0100', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_CANCEL_GROUP_TEST_0100 START`) + let groupName = "groupName" + await notification.cancelGroup(groupName, (err) => { + if (err.code) { + console.info(`${TAG} cancelGroup AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} cancelGroup AsyncCallback success`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_CANCEL_GROUP_TEST_0100 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_CANCEL_GROUP_TEST_0200 + * @tc.name : function cancelGroup(groupName: string): Promise + * @tc.desc : Cancel the notification of a specified group for this application + */ + it('SUB_NOTIFICATION_ANS_CANCEL_GROUP_TEST_0200', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_CANCEL_GROUP_TEST_0200 START`) + let groupName = "groupName" + await notification.cancelGroup(groupName).then(() => { + console.info(`${TAG} cancelGroup Promise success`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} cancelGroup Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_CANCEL_GROUP_TEST_0200 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_REQUEST_ENABLE_TEST_0100 + * @tc.name : function requestEnableNotification(callback: AsyncCallback): void + * @tc.desc : OperationType.UNKNOWN_TYPE & WantAgentFlags.ONE_TIME_FLAG + */ + it('SUB_NOTIFICATION_ANS_REQUEST_ENABLE_TEST_0100', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_REQUEST_ENABLE_TEST_0100 START`) + await notification.requestEnableNotification((err) => { + if (err.code) { + console.info(`${TAG} requestEnableNotification AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} requestEnableNotification AsyncCallback success`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_REQUEST_ENABLE_TEST_0100 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_REQUEST_ENABLE_TEST_0200 + * @tc.name : function requestEnableNotification(): Promise + * @tc.desc : OperationType.UNKNOWN_TYPE & WantAgentFlags.ONE_TIME_FLAG + */ + it('SUB_NOTIFICATION_ANS_REQUEST_ENABLE_TEST_0200', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_REQUEST_ENABLE_TEST_0200 START`) + await notification.requestEnableNotification().then(() => { + console.info(`${TAG} requestEnableNotification Promise success`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} requestEnableNotification Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_REQUEST_ENABLE_TEST_0200 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_COUNT_TEST_0100 + * @tc.name : function getActiveNotificationCount(callback: AsyncCallback): void + * @tc.desc : Obtains the number of all active notifications + */ + it('SUB_NOTIFICATION_ANS_COUNT_TEST_0100', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_ACTIVE_COUNT_TEST_0100 START`) + await notification.getActiveNotificationCount((err, data) => { + if (err.code) { + console.info(`${TAG} getActiveNotificationCount AsyncCallback err :${JSON.stringify(data)}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} getActiveNotificationCount AsyncCallback success`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_COUNT_TEST_0100 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_COUNT_TEST_0200 + * @tc.name : function getActiveNotificationCount(): Promise + * @tc.desc : Obtains the number of all active notifications + */ + it('SUB_NOTIFICATION_ANS_COUNT_TEST_0200', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_ACTIVE_COUNT_TEST_0200 START`) + await notification.getActiveNotificationCount().then((data) => { + console.info(`${TAG} getActiveNotificationCount Promise success :${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} getActiveNotificationCount Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_COUNT_TEST_0200 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_COUNT_TEST_0300 + * @tc.name : function getActiveNotifications(callback: AsyncCallback>): void + * @tc.desc : Obtains an array of active notifications + */ + it('SUB_NOTIFICATION_ANS_COUNT_TEST_0300', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_ACTIVE_COUNT_TEST_0300 START`) + await notification.getActiveNotifications((err, data) => { + if (err.code) { + console.info(`${TAG} getActiveNotifications AsyncCallback err :${JSON.stringify(data)}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} getActiveNotifications AsyncCallback success`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_COUNT_TEST_0300 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_COUNT_TEST_0400 + * @tc.name : function getActiveNotifications(): Promise> + * @tc.desc : Obtains an array of active notifications + */ + it('SUB_NOTIFICATION_ANS_COUNT_TEST_0400', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_COUNT_TEST_0400 START`) + await notification.getActiveNotifications().then((data) => { + console.info(`${TAG} getActiveNotifications Promise success :${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} getActiveNotifications Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_COUNT_TEST_0400 END`) + }) + + + /* + * @tc.number : SUB_NOTIFICATION_ANS_SUPPORT_TEST_0100 + * @tc.name : function isSupportTemplate(templateName: string, callback: AsyncCallback): void + * @tc.desc : Obtains whether the template is supported by the system + */ + it('SUB_NOTIFICATION_ANS_SUPPORT_TEST_0100', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_SUPPORT_TEST_0100 START`) + let templateName = 'test_templateName' + await notification.isSupportTemplate(templateName, (err, data) => { + if (err.code) { + console.info(`${TAG} isSupportTemplate AsyncCallback err :${JSON.stringify(data)}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} isSupportTemplate AsyncCallback success`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_SUPPORT_TEST_0100 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_SUPPORT_TEST_0200 + * @tc.name : function isSupportTemplate(templateName: string): Promise + * @tc.desc : Obtains whether the template is supported by the system + */ + it('SUB_NOTIFICATION_ANS_SUPPORT_TEST_0200', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_SUPPORT_TEST_0200 START`) + let templateName = 'test_templateName' + await notification.isSupportTemplate(templateName).then((data) => { + console.info(`${TAG} isSupportTemplate Promise success :${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} isSupportTemplate Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_SUPPORT_TEST_0200 END`) + }) + + console.info(TAG + 'SUB_NOTIFICATION_ANS_Publish_TEST END') + }) + +} diff --git a/notification/ans_standard/actsNotificationPublishTest/src/main/js/test/List.test.js b/notification/ans_standard/actsNotificationPublishTest/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..7d3b2d9e197867e1ed4d7348b0230173ae1c05e4 --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/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 ActsNotificationPublishTest from './ActsNotificationPublishTest.js' +export default function testsuite() { + ActsNotificationPublishTest() +} diff --git a/notification/ans_standard/actsNotificationPublishTest/src/main/resources/base/element/string.json b/notification/ans_standard/actsNotificationPublishTest/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..054c46cf82e60c39de9ec845737cdda67a89676d --- /dev/null +++ b/notification/ans_standard/actsNotificationPublishTest/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/actsNotificationPublishTest/src/main/resources/base/media/icon.png b/notification/ans_standard/actsNotificationPublishTest/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/notification/ans_standard/actsNotificationPublishTest/src/main/resources/base/media/icon.png differ diff --git a/notification/ans_standard/actsNotificationSlotTest/src/main/config.json b/notification/ans_standard/actsNotificationSlotTest/src/main/config.json index e81bbade5239c8689b9c6d372c30e3752f0d4d87..6d5dac9b5f3a266c38646439a3a0a793c6a202fa 100644 --- a/notification/ans_standard/actsNotificationSlotTest/src/main/config.json +++ b/notification/ans_standard/actsNotificationSlotTest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsnotificationslot", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/notification/ans_standard/actsNotificationWantAgentTest/BUILD.gn b/notification/ans_standard/actsNotificationWantAgentTest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..898fe68757eaffe7aa89e6cd380c26060bd06b23 --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/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("ActsNotificationWantAgentTest") { + hap_profile = "./src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsNotificationWantAgentTest" + 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/actsNotificationWantAgentTest/Test.json b/notification/ans_standard/actsNotificationWantAgentTest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..2bd57395f91902693c227dfbb53d59addf4c9a0e --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/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.actsnotificationwantagent", + "package-name": "com.example.actsnotificationwantagent" + }, + "kits": [ + { + "test-file-name": [ + "ActsNotificationWantAgentTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} \ No newline at end of file diff --git a/notification/ans_standard/actsNotificationWantAgentTest/signature/openharmony_sx.p7b b/notification/ans_standard/actsNotificationWantAgentTest/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/notification/ans_standard/actsNotificationWantAgentTest/signature/openharmony_sx.p7b differ diff --git a/notification/ans_standard/actsNotificationWantAgentTest/src/main/config.json b/notification/ans_standard/actsNotificationWantAgentTest/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..7cbe6c640074f017ce64753ad466b4b3cce53d04 --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/src/main/config.json @@ -0,0 +1,95 @@ +{ + "app": { + "bundleName": "com.example.actsnotificationwantagent", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsnotificationwantagent", + "name": ".entry", + "deviceType": [ + "default", + "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/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/MainAbility/app.js b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/MainAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..b58cf3c570b660c6f6f8cdcb1b317d67687deb29 --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/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/actsNotificationWantAgentTest/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/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/actsNotificationWantAgentTest/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/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/actsNotificationWantAgentTest/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b6c4207e3d98d227f135ee57bfa49b98cfb93faf --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/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/actsNotificationWantAgentTest/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..153d713d137f27cf989ffbaee2e886f92898056e --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/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/actsNotificationWantAgentTest/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..312c30c0c27535e4ee98fce4ca802506159ba2d1 --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/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/actsNotificationWantAgentTest/src/main/js/TestAbility/app.js b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/TestAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..d5ee271df29e516d1c8929054283e5f2bf5c981c --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/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/actsNotificationWantAgentTest/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/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/actsNotificationWantAgentTest/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/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/actsNotificationWantAgentTest/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b21c92c6290ea747bd891e2ab673721afc5521ed --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/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/actsNotificationWantAgentTest/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d94b75c085fa1c16a0b2721609b18c57a7295476 --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/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/actsNotificationWantAgentTest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 0000000000000000000000000000000000000000..b9e78ce7cf73f1ade6ba52a408a44e33f5430f0d --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/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/actsNotificationWantAgentTest/src/main/js/test/ActsNotificationWantAgentTest.js b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/test/ActsNotificationWantAgentTest.js new file mode 100644 index 0000000000000000000000000000000000000000..f34e106c1fa2f42f233ab8c16db493ff95428ca4 --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/test/ActsNotificationWantAgentTest.js @@ -0,0 +1,923 @@ +/* + * 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 wantAgent from '@ohos.wantAgent' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' + +export default function ActsNotificationWantAgentTest() { + describe('SUB_NOTIFICATION_ANS_WANT_AGENT_TEST', function () { + let TAG = 'SUB_NOTIFICATION_ANS_WANT_AGENT_TEST ===>' + console.info(TAG + 'SUB_NOTIFICATION_ANS_WANT_AGENT_TEST START') + + let WantAgent = {} + let wantAgentData1 = {} + let wantAgentData2 = {} + + let WantAgentInfo = { + wants: [ + { + deviceId: "deviceId", + bundleName: "com.example.actsnotificationwantagent", + abilityName: "com.example.actsnotificationwantagent.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + myKey0: 2222, + myKey1: [1, 2, 3], + myKey2: "[1, 2, 3]", + myKey3: "notification", + myKey4: [false, true, false], + myKey5: ["ANS", "WANT", "AGENT"], + myKey6: true + } + } + ], + operationType: wantAgent.OperationType, + requestCode: 0, + wantAgentFlags: [wantAgent.WantAgentFlags], + extraInfo: { + key: 'WantAgentInfo_test' + } + } + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0100 + * @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void + * @tc.desc : OperationType.UNKNOWN_TYPE & WantAgentFlags.ONE_TIME_FLAG + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0100', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0100 START`) + WantAgentInfo.operationType = wantAgent.OperationType.UNKNOWN_TYPE + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.ONE_TIME_FLAG + wantAgent.getWantAgent(WantAgentInfo, (err, data) => { + if (err.code) { + console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + WantAgent = data + console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0100 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0200 + * @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void + * @tc.desc : OperationType.START_ABILITY & WantAgentFlags.NO_BUILD_FLAG + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0200', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0200 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.NO_BUILD_FLAG + wantAgent.getWantAgent(WantAgentInfo, (err, data) => { + if (err.code) { + console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + WantAgent = data + console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0200 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0300 + * @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void + * @tc.desc : OperationType.START_ABILITIES & WantAgentFlags.CANCEL_PRESENT_FLAG + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0300', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0300 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITIES + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.CANCEL_PRESENT_FLAG + wantAgent.getWantAgent(WantAgentInfo, (err, data) => { + if (err.code) { + console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + WantAgent = data + console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0300 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0400 + * @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void + * @tc.desc : OperationType.START_SERVICE & WantAgentFlags.UPDATE_PRESENT_FLAG + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0400', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0400 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_SERVICE + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + wantAgent.getWantAgent(WantAgentInfo, (err, data) => { + if (err.code) { + console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + WantAgent = data + console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0400 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0500 + * @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void + * @tc.desc : OperationType.SEND_COMMON_EVENT & WantAgentFlags.CONSTANT_FLAG + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0500', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0500 START`) + WantAgentInfo.operationType = wantAgent.OperationType.SEND_COMMON_EVENT + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.CONSTANT_FLAG + wantAgent.getWantAgent(WantAgentInfo, (err, data) => { + if (err.code) { + console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + WantAgent = data + console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0500 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0600 + * @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void + * @tc.desc : OperationType.UNKNOWN_TYPE & WantAgentFlags.REPLACE_ELEMENT + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0600', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0600 START`) + WantAgentInfo.operationType = wantAgent.OperationType.UNKNOWN_TYPE + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_ELEMENT + wantAgent.getWantAgent(WantAgentInfo, (err, data) => { + if (err.code) { + console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + WantAgent = data + console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0600 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0700 + * @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void + * @tc.desc : OperationType.START_ABILITY & WantAgentFlags.REPLACE_ACTION + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0700', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0700 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_ACTION + wantAgent.getWantAgent(WantAgentInfo, (err, data) => { + if (err.code) { + console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + WantAgent = data + console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0700 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0800 + * @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void + * @tc.desc : OperationType.START_ABILITIES & WantAgentFlags.REPLACE_URI + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0800', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0800 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITIES + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_URI + wantAgent.getWantAgent(WantAgentInfo, (err, data) => { + if (err.code) { + console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + WantAgent = data + console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0800 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0900 + * @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void + * @tc.desc : OperationType.START_SERVICE & WantAgentFlags.REPLACE_ENTITIES + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0900', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0900 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_SERVICE + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_ENTITIES + wantAgent.getWantAgent(WantAgentInfo, (err, data) => { + if (err.code) { + console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + WantAgent = data + console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_0900 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1000 + * @tc.name : function getWantAgent(info: WantAgentInfo, callback: AsyncCallback): void + * @tc.desc : OperationType.SEND_COMMON_EVENT & WantAgentFlags.REPLACE_BUNDLE + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1000', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1000 START`) + WantAgentInfo.operationType = wantAgent.OperationType.SEND_COMMON_EVENT + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_BUNDLE + wantAgent.getWantAgent(WantAgentInfo, (err, data) => { + if (err.code) { + console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + WantAgent = data + console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1000 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1100 + * @tc.name : function getWantAgent(info: WantAgentInfo): Promise + * @tc.desc : OperationType.UNKNOWN_TYPE & WantAgentFlags.ONE_TIME_FLAG + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1100', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1100 START`) + WantAgentInfo.operationType = wantAgent.OperationType.UNKNOWN_TYPE + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.ONE_TIME_FLAG + wantAgent.getWantAgent(WantAgentInfo).then((data) => { + WantAgent = data + console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} getWantAgent Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1100 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1200 + * @tc.name : function getWantAgent(info: WantAgentInfo): Promise + * @tc.desc : OperationType.START_ABILITY & WantAgentFlags.NO_BUILD_FLAG + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1200', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1200 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.NO_BUILD_FLAG + wantAgent.getWantAgent(WantAgentInfo).then((data) => { + WantAgent = data + console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} getWantAgent Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1200 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1300 + * @tc.name : function getWantAgent(info: WantAgentInfo): Promise + * @tc.desc : OperationType.START_ABILITIES & WantAgentFlags.CANCEL_PRESENT_FLAG + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1300', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1300 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITIES + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.CANCEL_PRESENT_FLAG + wantAgent.getWantAgent(WantAgentInfo).then((data) => { + WantAgent = data + console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} getWantAgent Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1300 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1400 + * @tc.name : function getWantAgent(info: WantAgentInfo): Promise + * @tc.desc : OperationType.START_SERVICE & WantAgentFlags.UPDATE_PRESENT_FLAG + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1400', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1400 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_SERVICE + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + wantAgent.getWantAgent(WantAgentInfo).then((data) => { + WantAgent = data + console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} getWantAgent Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1400 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1500 + * @tc.name : function getWantAgent(info: WantAgentInfo): Promise + * @tc.desc : OperationType.SEND_COMMON_EVENT & WantAgentFlags.CONSTANT_FLAG + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1500', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1500 START`) + WantAgentInfo.operationType = wantAgent.OperationType.SEND_COMMON_EVENT + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.CONSTANT_FLAG + wantAgent.getWantAgent(WantAgentInfo).then((data) => { + WantAgent = data + console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} getWantAgent Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1500 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1600 + * @tc.name : function getWantAgent(info: WantAgentInfo): Promise + * @tc.desc : OperationType.UNKNOWN_TYPE & WantAgentFlags.REPLACE_ELEMENT + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1600', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1600 START`) + WantAgentInfo.operationType = wantAgent.OperationType.UNKNOWN_TYPE + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_ELEMENT + wantAgent.getWantAgent(WantAgentInfo).then((data) => { + WantAgent = data + console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} getWantAgent Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1600 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1700 + * @tc.name : function getWantAgent(info: WantAgentInfo): Promise + * @tc.desc : OperationType.START_ABILITY & WantAgentFlags.REPLACE_ACTION + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1700', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1700 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_ACTION + wantAgent.getWantAgent(WantAgentInfo).then((data) => { + WantAgent = data + console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} getWantAgent Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1700 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1800 + * @tc.name : function getWantAgent(info: WantAgentInfo): Promise + * @tc.desc : OperationType.START_ABILITIES & WantAgentFlags.REPLACE_URI + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1800', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1800 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITIES + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_URI + wantAgent.getWantAgent(WantAgentInfo).then((data) => { + WantAgent = data + console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} getWantAgent Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1800 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1900 + * @tc.name : function getWantAgent(info: WantAgentInfo): Promise + * @tc.desc : OperationType.START_SERVICE & WantAgentFlags.REPLACE_ENTITIES + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1900', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1900 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_SERVICE + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_ENTITIES + wantAgent.getWantAgent(WantAgentInfo).then((data) => { + WantAgent = data + console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} getWantAgent Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_1900 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2000 + * @tc.name : function getWantAgent(info: WantAgentInfo): Promise + * @tc.desc : OperationType.SEND_COMMON_EVENT & WantAgentFlags.REPLACE_BUNDLE + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2000', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2000 START`) + WantAgentInfo.operationType = wantAgent.OperationType.SEND_COMMON_EVENT + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.REPLACE_BUNDLE + wantAgent.getWantAgent(WantAgentInfo).then((data) => { + WantAgent = data + console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} getWantAgent Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2000 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2100 + * @tc.name : function cancel(agent: WantAgent, callback: AsyncCallback): void + * @tc.desc : Cancels a WantAgent + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2100', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2100 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + wantAgent.getWantAgent(WantAgentInfo, (err, data) => { + if (err.code) { + console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + WantAgent = data + console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + } + }) + wantAgent.cancel(WantAgent, (err) => { + if (err.code) { + console.info(`${TAG} cancel AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} cancel AsyncCallback success`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2100 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2200 + * @tc.name : function cancel(agent: WantAgent): Promise + * @tc.desc : Cancels a WantAgent + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2200', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2200 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + wantAgent.getWantAgent(WantAgentInfo).then((data) => { + WantAgent = data + console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} getWantAgent Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + wantAgent.cancel(WantAgent).then(() => { + console.info(`${TAG} cancel Promise success`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} cancel Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2200 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2300 + * @tc.name : function getBundleName(agent: WantAgent, callback: AsyncCallback): void + * @tc.desc : Obtains the bundle name of a WantAgent. + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2300', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2300 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + wantAgent.getWantAgent(WantAgentInfo, (err, data) => { + if (err.code) { + console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + WantAgent = data + console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + } + }) + wantAgent.getBundleName(WantAgent, (err, data) => { + if (err.code) { + console.info(`${TAG} getBundleName AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} getBundleName AsyncCallback success: ${JSON.stringify(data)}`) + expect(data).assertEqual('com.example.actsnotificationwantagent') + done() + } + }) + + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2300 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2400 + * @tc.name : function getBundleName(agent: WantAgent): Promise + * @tc.desc : Obtains the bundle name of a WantAgent + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2400', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2400 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + wantAgent.getWantAgent(WantAgentInfo).then((data) => { + WantAgent = data + console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} getWantAgent Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + wantAgent.getBundleName(WantAgent) + .then((data) => { + console.info(`${TAG} getBundleName Promise success: ${JSON.stringify(data)}`) + expect(data).assertEqual('com.example.actsnotificationwantagent') + done() + }) + .catch((err) => { + console.info(`${TAG} getBundleName Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2400 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2500 + * @tc.name : function getUid(agent: WantAgent, callback: AsyncCallback): void + * @tc.desc : Obtains the UID of a WantAgent + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2500', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2500 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + wantAgent.getWantAgent(WantAgentInfo, (err, data) => { + if (err.code) { + console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + WantAgent = data + console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + } + }) + await wantAgent.getUid(WantAgent, (err, data) => { + if (err.code) { + console.info(`${TAG} getUid AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} getUid AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2500 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2600 + * @tc.name : function getUid(agent: WantAgent): Promise + * @tc.desc : Obtains the UID of a WantAgent + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2600', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2600 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + wantAgent.getWantAgent(WantAgentInfo).then((data) => { + WantAgent = data + console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} getWantAgent Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + await wantAgent.getUid(WantAgent).then((data) => { + console.info(`${TAG} getUid Promise success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} getUid Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2600 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2700 + * @tc.name : function equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback): void + * @tc.desc : Checks whether two WantAgent objects are equal + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2700', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2700 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + wantAgent.getWantAgent(WantAgentInfo, (err, data) => { + if (err.code) { + console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + wantAgentData1 = data + wantAgentData2 = data + console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + wantAgent.equal(wantAgentData1, wantAgentData2, (err, data) => { + if (err.code) { + console.info(`${TAG} equal AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} equal AsyncCallback success: ${JSON.stringify(data)}`) + expect(data).assertTrue() + done() + } + }) + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2700 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2800 + * @tc.name : function equal(agent: WantAgent, otherAgent: WantAgent): Promise + * @tc.desc : Checks whether two WantAgent objects are equal + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2800', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2800 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + wantAgent.getWantAgent(WantAgentInfo, (err, data) => { + if (err.code) { + console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + wantAgentData1 = data + wantAgentData2 = data + console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + wantAgent.equal(wantAgentData1, wantAgentData2).then((data) => { + console.info(`${TAG} equal Promise success: ${JSON.stringify(data)}`) + expect(data).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} equal Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2800 END`) + }) + + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2900 + * @tc.name : function getOperationType(agent: WantAgent, callback: AsyncCallback): void + * @tc.desc : Obtains the {@link OperationType} of a {@link WantAgent} + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2900', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2900 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + wantAgent.getWantAgent(WantAgentInfo, (err, data) => { + if (err.code) { + console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + WantAgent = data + console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + } + }) + await wantAgent.getOperationType(WantAgent, (err, data) => { + if (err.code) { + console.info(`${TAG} getOperationType AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} getOperationType AsyncCallback success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_2900 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_3000 + * @tc.name : function getOperationType(agent: WantAgent): Promise + * @tc.desc : Obtains the {@link OperationType} of a {@link WantAgent} + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_3000', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_3000 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + wantAgent.getWantAgent(WantAgentInfo).then((data) => { + WantAgent = data + console.info(`${TAG} getWantAgent Promise success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }).catch((err) => { + console.info(`${TAG} getWantAgent Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + await wantAgent.getOperationType(WantAgent) + .then((data) => { + console.info(`${TAG} getOperationType Promise success: ${JSON.stringify(data)}`) + expect(true).assertTrue() + done() + }) + .catch((err) => { + console.info(`${TAG} getOperationType Promise err: ${err.code}`) + expect(false).assertTrue() + done() + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_3000 END`) + }) + + /* + * @tc.number : SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_3100 + * @tc.name : function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback): void + * @tc.desc : Triggers a WantAgent + */ + it('SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_3100', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_3100 START`) + WantAgentInfo.operationType = wantAgent.OperationType.START_ABILITY + WantAgentInfo.wantAgentFlags = wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG + wantAgent.getWantAgent(WantAgentInfo, (err, data) => { + if (err.code) { + console.info(`${TAG} getWantAgent AsyncCallback err: ${err.code}`) + expect(false).assertTrue() + done() + } else { + WantAgent = data + console.info(`${TAG} getWantAgent AsyncCallback success: ${JSON.stringify(data)}`) + + let triggerInfo = { + code: 0, + want: { + deviceId: "deviceId", + bundleName: "com.example.actsnotificationwantagent", + abilityName: "com.example.actsnotificationwantagent.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + parameters: + { + myKey0: 2222, + myKey1: [1, 2, 3], + myKey2: "[1, 2, 3]", + myKey3: "notification", + myKey4: [false, true, false], + myKey5: ["ANS", "WANT", "AGENT"], + myKey6: true, + } + }, + permission: '', + extraInfo: { + test: 'this is a test value' + } + } + wantAgent.trigger(WantAgent, triggerInfo, (err, data) => { + if (err.code) { + console.info(`${TAG} trigger AsyncCallback err: ${JSON.stringify(err)}`) + expect(false).assertTrue() + done() + } else { + console.info(`${TAG} trigger AsyncCallback success: ${JSON.stringify(data)}`) + expect(typeof(data.wantAgent)).assertEqual('object') + expect(data.finalCode).assertEqual(0) + expect(data.finalData).assertEqual('') + expect(typeof(data.extraInfo)).assertEqual('object') + expect(data.want.deviceId).assertEqual('deviceId') + expect(data.want.bundleName).assertEqual('com.example.actsnotificationwantagent') + expect(data.want.abilityName).assertEqual('com.example.actsnotificationwantagent.MainAbility') + done() + } + + }) + } + }) + console.info(`${TAG} SUB_NOTIFICATION_ANS_GET_WANT_AGENT_TEST_3100 END`) + }) + console.info(TAG + 'SUB_NOTIFICATION_ANS_WANT_AGENT_TEST END') + }) +} diff --git a/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/test/List.test.js b/notification/ans_standard/actsNotificationWantAgentTest/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..64c28d712bbbe75776a7b59df20b392b14724022 --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/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 ActsNotificationWantAgentTest from './ActsNotificationWantAgentTest.js' +export default function testsuite() { + ActsNotificationWantAgentTest() +} diff --git a/notification/ans_standard/actsNotificationWantAgentTest/src/main/resources/base/element/string.json b/notification/ans_standard/actsNotificationWantAgentTest/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..054c46cf82e60c39de9ec845737cdda67a89676d --- /dev/null +++ b/notification/ans_standard/actsNotificationWantAgentTest/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/actsNotificationWantAgentTest/src/main/resources/base/media/icon.png b/notification/ans_standard/actsNotificationWantAgentTest/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/notification/ans_standard/actsNotificationWantAgentTest/src/main/resources/base/media/icon.png differ diff --git a/notification/ans_standard/actsansnotificationcancel/BUILD.gn b/notification/ans_standard/actsansnotificationcancel/BUILD.gn deleted file mode 100644 index e3f194b5fd2c052b1a1548acf7cf954c582a9655..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationcancel/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsNotificationCancelTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsNotificationCancelTest" - 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/actsansnotificationcancel/Test.json b/notification/ans_standard/actsansnotificationcancel/Test.json deleted file mode 100644 index 44c55948aa67cf7c8743f673c3cf54d3a94c21c8..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationcancel/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "shell-timeout": "180000", - "bundle-name": "com.example.actsansnotificationcancel", - "package-name": "com.example.actsansnotificationcancel" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsNotificationCancelTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/actsansnotificationcancel/src/main/config.json b/notification/ans_standard/actsansnotificationcancel/src/main/config.json deleted file mode 100644 index d10b9283b82a0e5a93e69aa029cbcf7db94465ec..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationcancel/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansnotificationcancel", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansnotificationcancel", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/actsansnotificationcancel/src/main/js/MainAbility/app.js b/notification/ans_standard/actsansnotificationcancel/src/main/js/MainAbility/app.js deleted file mode 100644 index 4f1747a95c4acbb66db5351e826c31584356e11c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationcancel/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* -* 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/actsansnotificationcancel/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/actsansnotificationcancel/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationcancel/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansnotificationcancel/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/actsansnotificationcancel/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationcancel/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansnotificationcancel/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/actsansnotificationcancel/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationcancel/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/actsansnotificationcancel/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/actsansnotificationcancel/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index db0b4b27222b9b0154df7df937c231d5fe52ab42..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationcancel/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - ActsAnsNotificationCancel - -
diff --git a/notification/ans_standard/actsansnotificationcancel/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/actsansnotificationcancel/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationcancel/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/actsansnotificationcancel/src/main/js/TestAbility/app.js b/notification/ans_standard/actsansnotificationcancel/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationcancel/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/actsansnotificationcancel/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/actsansnotificationcancel/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationcancel/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansnotificationcancel/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/actsansnotificationcancel/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationcancel/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansnotificationcancel/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/actsansnotificationcancel/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationcancel/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/actsansnotificationcancel/src/main/js/test/ActsAnsNotificationCancel.test.js b/notification/ans_standard/actsansnotificationcancel/src/main/js/test/ActsAnsNotificationCancel.test.js deleted file mode 100644 index 5b5d91957743124e917fbfa1907bc7733515a51f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationcancel/src/main/js/test/ActsAnsNotificationCancel.test.js +++ /dev/null @@ -1,2110 +0,0 @@ -/* -* 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 notify from '@ohos.notification' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -let timeout = 500; -export default function ActsAnsNotificationCancel() { -describe('ActsAnsNotificationCancel', function () { - console.info('===========ActsAnsNotificationCancel start====================>'); - let timesOfOnConsume - function onConsumeCancelAll(data) { - console.info('================ANS_Cancel_0100 onConsume start=======================>'); - console.info('================ANS_Cancel_0100 onConsume data:=================>' + JSON.stringify(data)); - timesOfOnConsume = timesOfOnConsume + 1 - if (timesOfOnConsume == 2){ - notify.cancelAll(cancelAllCallBack); - console.info('================ANS_Cancel_0100 onConsume cancelAll=======================>'); - } - console.info('================ANS_Cancel_0100 onConsume end=======================>'); - } - let timesOfOnCancel - function onCancelCancelAll(data) { - console.info('================ANS_Cancel_0100 onCancel start===============>'); - console.info('================ANS_Cancel_0100 onCancel data:===============>' + JSON.stringify(data)); - timesOfOnCancel = timesOfOnCancel + 1 - if (timesOfOnCancel == 1){ - expect(data.request.id).assertEqual(1); - } else if (timesOfOnCancel == 2){ - expect(data.request.id).assertEqual(2); - } - console.info('================ANS_Cancel_0100 onCancel end=======================>'); - } - function cancelAllCallBack(err, data){ - console.info('========ANS_Cancel_0100 cancelAllCallBack start==============>'); - console.info('========ANS_Cancel_0100 cancelAllCallBack data===============>' + JSON.stringify(data)); - console.info('========ANS_Cancel_0100 cancelAllCallBack err================>' + JSON.stringify(err)); - console.info('========ANS_Cancel_0100 cancelAllCallBack end================>'); - } - - /* - * @tc.number: ANS_Cancel_0100 - * @tc.name: cancelAll(callback: AsyncCallback): void; - * @tc.desc: Verify that the application successfully cancels all its published notifications by calling the - cancelAll(callback: AsyncCallback) interface - */ - it('ANS_Cancel_0100', 0, async function (done) { - console.info('==================ANS_Cancel_0100 start==================>'); - timesOfOnConsume = 0 - timesOfOnCancel = 0 - let subscriber ={ - onConsume:onConsumeCancelAll, - onCancel:onCancelCancelAll, - } - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 1, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '0100_1', - badgeIconStyle: 1, - showDeliveryTime: true, - } - let notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 2, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '0100_2', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.subscribe(subscriber); - console.info('===========ANS_Cancel_0100 subscribe promise=======>'); - await notify.publish(notificationRequest); - console.info('===========ANS_Cancel_0100 publish1 promise=======>'); - await notify.publish(notificationRequest1); - console.info('===========ANS_Cancel_0100 publish2 promise=======>'); - setTimeout((async function(){ - console.info('======ANS_Cancel_0100 setTimeout==================>'); - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_0100 setTimeout unsubscribe==================>'); - done(); - }),timeout); - }) - - - function onConsumeCancelAllPromise(data) { - timesOfOnConsume = timesOfOnConsume + 1 - console.info('================ANS_Cancel_0200 onConsume start===========>'); - console.info('================ANS_Cancel_0200 onConsume data:============>' + JSON.stringify(data)); - if (timesOfOnConsume == 2){ - notify.cancelAll(); - console.info('==========ANS_Cancel_0200 onConsume cancelAll promise==========>'); - } - console.info('================ANS_Cancel_0200 onConsume end===============>'); - } - - function onCancelCancelAllPromise(data) { - timesOfOnCancel = timesOfOnCancel + 1 - console.info('=========ANS_Cancel_0200 onCancel start==========>'); - console.info('=========ANS_Cancel_0200 onCancel data:==========>' + JSON.stringify(data)); - if (timesOfOnCancel == 1){ - expect(data.request.id).assertEqual(1); - } else if (timesOfOnCancel == 2){ - expect(data.request.id).assertEqual(2); - } - console.info('==========ANS_Cancel_0200 onCancel end=======================>'); - } - - /* - * @tc.number: ANS_Cancel_0200 - * @tc.name: cancelAll(): Promise; - * @tc.desc: Verify that the application successfully cancels all its published notifications by - calling the cancelAll(): Promise interface - */ - it('ANS_Cancel_0200', 0, async function (done) { - console.info('===============ANS_Cancel_0200 start==========================>'); - timesOfOnConsume = 0 - timesOfOnCancel = 0 - let subscriber ={ - onConsume:onConsumeCancelAllPromise, - onCancel:onCancelCancelAllPromise, - } - await notify.subscribe(subscriber); - console.info('==================ANS_Cancel_0200 subscribe promise==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 1, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '0200', - badgeIconStyle: 1, - showDeliveryTime: true, - } - let notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 2, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '0200', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('==========ANS_Cancel_0200 publish1 promise==================>'); - await notify.publish(notificationRequest1); - console.info('==========ANS_Cancel_0200 publish2 promise==================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_0200 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - function onConsumeCancelAllNoNotify(data) { - console.info('================ANS_Cancel_0300 onConsume start========>'); - console.info('================ANS_Cancel_0300 onConsume data:========>' + JSON.stringify(data)); - expect().assertFail(); - console.info('================ANS_Cancel_0300 onConsume end=======================>'); - } - function onCancelCancelAllNoNotify(data) { - console.info('=================ANS_Cancel_0300 onCancel start=============>'); - expect().assertFail(); - console.info('================ANS_Cancel_0300 onCancel data:==============>' + JSON.stringify(data)); - console.info('================ANS_Cancel_0300 onCancel end================>'); - } - function cancelAllCallBackNoNotify(err, data){ - console.info('==========ANS_Cancel_0300 cancelAllCallBack start=============>'); - console.info('==========ANS_Cancel_0300 cancelAllCallBack data:=============>' + JSON.stringify(data)); - console.info('==========ANS_Cancel_0300 cancelAllCallBack err:=============>' + JSON.stringify(err)); - console.info('==========ANS_Cancel_0300 cancelAllCallBack end===============>'); - } - - /* - * @tc.number: ANS_Cancel_0300 - * @tc.name: cancelAll(callback: AsyncCallback): void - * @tc.desc: Verify that when there is no notification in the notification list, - call the cancelAll(callback: AsyncCallback): void interface, - and the application cancels all its published notifications. - At this time, no notification information is cancelled, - and there is no OnCancel notification(Callback mode) - */ - it('ANS_Cancel_0300', 0, async function (done) { - console.info('===============ANS_Cancel_0300 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelAllNoNotify, - onCancel:onCancelCancelAllNoNotify, - } - await notify.subscribe(subscriber); - console.info('===============ANS_Cancel_0300 subscribe promise===============>'); - await notify.cancelAll(cancelAllCallBackNoNotify); - console.info('===============ANS_Cancel_0300 cancelAll promise===============>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_0300 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - function onConsumeCancelAllNoNotifyPromise(data) { - console.info('================ANS_Cancel_0400 onConsume===============>'); - console.info('================ANS_Cancel_0400 onConsume data:===========>' + JSON.stringify(data)); - expect().assertFail(); - console.info('================ANS_Cancel_0400 onConsume end===========>'); - } - function onCancelCancelAllNoNotifyPromise(data) { - console.info('===============ANS_Cancel_0400 onCancel ==================>'); - console.info('===============ANS_Cancel_0400 onCancel data==============>' + JSON.stringify(data)); - expect().assertFail(); - console.info('===============ANS_Cancel_0400 onCancel end===============>'); - } - - /* - * @tc.number: ANS_Cancel_0400 - * @tc.name: cancelAll(): Promise; - * @tc.desc: Verify that when there is no notification in the notification list, - call the cancelAll(callback: AsyncCallback): void interface, - and the application cancels all its published notifications. - At this time, no notification information is cancelled, - and there is no OnCancel notification( Callback mode) - */ - it('ANS_Cancel_0400', 0, async function (done) { - console.info('===============ANS_Cancel_0400 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelAllNoNotifyPromise, - onCancel:onCancelCancelAllNoNotifyPromise, - } - await notify.subscribe(subscriber); - console.info('================ANS_Cancel_0400 subscribe promise=============>'); - await notify.cancelAll(); - console.info('================ANS_Cancel_0400 cancelAll promise=============>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_0400 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - - }) - - function onConsumeCancelAll2Times(data) { - console.info('==========ANS_Cancel_0500 onConsume start==============>'); - console.info('==========ANS_Cancel_0500 onConsume data:==============>' + JSON.stringify(data)); - notify.cancelAll(cancelAllCallBack2Times1); - console.info('==========ANS_Cancel_0500 onConsume cancelAll=================>'); - console.info('==========ANS_Cancel_0500 onConsume end=======================>'); - } - - function onCancelCancelAll2Times(data) { - console.info('=========ANS_Cancel_0500 onCancel start===============>'); - console.info('=========ANS_Cancel_0500 onCancel data:===============>' + JSON.stringify(data)); - timesOfOnCancel = timesOfOnCancel + 1 - if (timesOfOnCancel == 1){ - expect(data.request.id).assertEqual(5); - } else if (timesOfOnCancel){ - expect(data.request.id).assertEqual(0); - } - console.info('==========ANS_Cancel_0500 onCancel end===============>'); - } - function cancelAllCallBack2Times1(err){ - console.info('==========ANS_Cancel_0500 cancelAllCallBack1 start==========>'); - console.info('==========ANS_Cancel_0500 cancelAllCallBack1 err:===========>' + JSON.stringify(err)); - notify.cancelAll(cancelAllCallBack2Times2); - console.info('==========ANS_Cancel_0500 cancelAllCallBack1 cancelAll======>'); - console.info('==========ANS_Cancel_0500 cancelAllCallBack1 end===========>'); - } - function cancelAllCallBack2Times2(err){ - console.info('==========ANS_Cancel_0500 cancelAllCallBack2 start=============>'); - console.info('==========ANS_Cancel_0500 cancelAllCallBack2 err:==============>' + JSON.stringify(err)); - console.info('==========ANS_Cancel_0500 cancelAllCallBack2 end===============>'); - } - - /* - * @tc.number: ANS_Cancel_0500 - * @tc.name: cancelAll(callback: AsyncCallback): void - * @tc.desc: Verify that all notifications are cancelled successfully - by calling the cancelAll(callback: AsyncCallback): void interface, - and then cancel the notification again - */ - it('ANS_Cancel_0500', 0, async function (done) { - console.info('============ANS_Cancel_0500 start==================>'); - timesOfOnCancel = 0 - let subscriber ={ - onConsume:onConsumeCancelAll2Times, - onCancel:onCancelCancelAll2Times, - } - await notify.subscribe(subscriber); - console.info('============ANS_Cancel_0500 subscribe promise======>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 5, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '0500', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('==============ANS_Cancel_0500 publish promise end==============>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_0500 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - function onConsumeCancelAll2TimesPromise(data) { - console.info('==========ANS_Cancel_0600 onConsume start============>'); - console.info('==========ANS_Cancel_0600 onConsume data=============>' + JSON.stringify(data)); - notify.cancelAll(); - console.info('==========ANS_Cancel_0600 onConsume cancelAll 2times1 end======>'); - notify.cancelAll(); - console.info('==========ANS_Cancel_0600 onConsume cancelAll 2times2 end======>'); - console.info('==========ANS_Cancel_0600 onConsume end========>'); - } - function onCancelCancelAll2TimesPromise(data) { - timesOfOnCancel = timesOfOnCancel + 1 - console.info('==========ANS_Cancel_0600 onCancel===================>'); - console.info('==========ANS_Cancel_0600 onCancel data:============>' + JSON.stringify(data)); - if (timesOfOnCancel == 1){ - expect(data.request.id).assertEqual(6); - } else if (timesOfOnCancel == 2){ - expect().assertFail(); - } - console.info('==========ANS_Cancel_0600 onCancel end=============>'); - } - - /* - * @tc.number: ANS_Cancel_0600 - * @tc.name: cancelAll(): Promise; - * @tc.desc: Verify that all notifications are cancelled successfully by calling the - cancelAll(): Promise interface, and then cancel the notification again - */ - it('ANS_Cancel_0600', 0, async function (done) { - console.info('===============ANS_Cancel_0600 start==========================>'); - timesOfOnCancel = 0 - let subscriber ={ - onConsume:onConsumeCancelAll2TimesPromise, - onCancel:onCancelCancelAll2TimesPromise, - } - await notify.subscribe(subscriber); - console.info('==================ANS_Cancel_0600 subscribe promise==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 6, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '0600', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('==================ANS_Cancel_0600 publish promise==================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_0600 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - function onConsumeCancelAllIsUnremovable(data) { - console.info('========ANS_Cancel_0700 onConsume start===========>'); - console.info('========ANS_Cancel_0700 onConsume data: ===========>' + JSON.stringify(data)); - notify.cancelAll(cancelAllCallBackIsUnremovable); - console.info('========ANS_Cancel_0700 onConsume cancelAll===========>'); - console.info('========ANS_Cancel_0700 onConsume end============>'); - } - function onCancelCancelAllIsUnremovable(data) { - console.info('================ANS_Cancel_0700 onCancel start=======================>'); - console.info('================ANS_Cancel_0700 onCancel data:====================>' + JSON.stringify(data)); - expect(data.request.id).assertEqual(7); - console.info('================ANS_Cancel_0700 onCancel end=======================>'); - } - function cancelAllCallBackIsUnremovable(err, data){ - console.info('===========ANS_Cancel_0700 cancelAllCallBack start==========>'); - console.info('===========ANS_Cancel_0700 cancelAllCallBack err:===========>' + JSON.stringify(err)); - console.info('===========ANS_Cancel_0700 cancelAllCallBack data:==========>' + JSON.stringify(data)); - console.info('===========ANS_Cancel_0700 cancelAllCallBack end=======================>'); - } - - /* - * @tc.number: ANS_Cancel_0700 - * @tc.name: cancelAll(callback: AsyncCallback): void; - * @tc.desc: Verify that by calling the cancelAll(callback: AsyncCallback): void; - interface, the application successfully cancels all the notifications - that isUnremovable is true that it has published - */ - it('ANS_Cancel_0700', 0, async function (done) { - console.info('===============ANS_Cancel_0700 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelAllIsUnremovable, - onCancel:onCancelCancelAllIsUnremovable, - } - await notify.subscribe(subscriber); - console.info('========ANS_Cancel_0700 subscribe promise==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 7, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '0700', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('===========ANS_Cancel_0700 publish promise==================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_0700 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - function onConsumeCancelAllIsUnremovablPromise(data) { - console.info('================ANS_Cancel_0800 onConsume start=============>'); - console.info('================ANS_Cancel_0800 onConsume data:=============>' + JSON.stringify(data)); - notify.cancelAll(); - console.info('================ANS_Cancel_0800 cancelAll==========>'); - console.info('================ANS_Cancel_0800 onConsume end===============>'); - } - function onCancelCancelAllIsUnremovablePromise(data) { - console.info('================ANS_Cancel_0800 onCancel start================>'); - console.info('================ANS_Cancel_0800 onCancel data :===============>' + JSON.stringify(data)); - expect(data.request.id).assertEqual(8); - console.info('================ANS_Cancel_0800 onCancel end================>'); - } - - /* - * @tc.number: ANS_Cancel_0800 - * @tc.name: cancelAll(): Promise; - * @tc.desc: Verify that by calling the cancelAll(): Promise interface, - the application successfully cancels all the notifications - that isUnremovable is true that it has published - */ - it('ANS_Cancel_0800', 0, async function (done) { - console.info('===============ANS_Cancel_0800 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelAllIsUnremovablPromise, - onCancel:onCancelCancelAllIsUnremovablePromise, - } - await notify.subscribe(subscriber); - console.info('==================ANS_Cancel_0800 subscribe promsie==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 8, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '0800', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('=========ANS_Cancel_0800 publish promise==================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_0800 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - function onConsumeCancel(data) { - console.info('=========ANS_Cancel_0900 onConsume start================>'); - console.info('=========ANS_Cancel_0900 onConsume data:================>' + JSON.stringify(data)); - notify.cancel(data.request.id,cancelCallBackCancel); - console.info('=========ANS_Cancel_0900 onConsume cancel=============>'); - console.info('=========ANS_Cancel_0900 onConsume end================>'); - } - function onCancelCancel(data) { - console.info('=========ANS_Cancel_0900 onCancel start================>'); - console.info('=========ANS_Cancel_0900 onCancel data:================>' + JSON.stringify(data)); - expect(data.request.id).assertEqual(9); - console.info('=========ANS_Cancel_0900 onCancel end================>'); - } - function cancelCallBackCancel(err){ - console.info('===========ANS_Cancel_0900 cancelCallBack start================>'); - console.info('===========ANS_Cancel_0900 cancelCallBack err:=================>' + JSON.stringify(err)); - console.info('===========ANS_Cancel_0900 cancelCallBack end==================>'); - } - - /* - * @tc.number: ANS_Cancel_0900 - * @tc.name: cancel(id: number, callback: AsyncCallback): void; - * @tc.desc: Verify that the specific ID notification is cancelled successfully by calling - the cancel(id: number, callback: AsyncCallback): void; interface - */ - it('ANS_Cancel_0900', 0, async function (done) { - console.info('===============ANS_Cancel_0900 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancel, - onCancel:onCancelCancel, - } - await notify.subscribe(subscriber); - console.info('==================ANS_Cancel_0900 subscribe promise==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 9, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('==================ANS_Cancel_0900 publish promise==================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_0900 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - function onConsumeCancelWrongId(data) { - console.info('========ANS_Cancel_1000 onConsume start==============>'); - console.info('========ANS_Cancel_1000 onConsume data:==============>' + JSON.stringify(data)); - console.info('========ANS_Cancel_1000 onConsume label:=============>' + data.request.label); - console.info('========ANS_Cancel_1000 onConsume id:================>' + data.request.id); - notify.cancel(9999,cancelCallBackCancelWrongId); - console.info('========ANS_Cancel_1000 onConsume cancel==========>'); - console.info('========ANS_Cancel_1000 onConsume end============>'); - } - function onCancelCancelWrongId(data) { - console.info('================ANS_Cancel_1000 onCancel start=============>'); - console.info('================ANS_Cancel_1000 onCancel data:=============>' + JSON.stringify(data)); - expect().assertFail(); - console.info('================ANS_Cancel_1000 onCancel end===============>'); - } - function cancelCallBackCancelWrongId(err){ - console.info('==============ANS_Cancel_1000 cancelCallBack start===============>'); - console.info('==============ANS_Cancel_1000 cancelCallBack err:================>' + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info('==============ANS_Cancel_1000 cancelCallBack end=================>'); - } - - /* - * @tc.number: ANS_Cancel_1000 - * @tc.name: cancel(id: number, callback: AsyncCallback): void; - * @tc.desc: Verify that when the cancel(id: number, callback: AsyncCallback): void - interface is called, when the id is wrong, no notification information is cancelled at this time - */ - it('ANS_Cancel_1000', 0, async function (done) { - console.info('===============ANS_Cancel_1000 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelWrongId, - onCancel:onCancelCancelWrongId, - } - await notify.subscribe(subscriber); - console.info('================ANS_Cancel_1000 subscribe promise==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 10, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '1000', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('===========ANS_Cancel_1000 publish promise==================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_1000 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - function onConsumeCancelIsUnremovable(data) { - console.info('============ANS_Cancel_1100 onConsume start===============>'); - console.info('============ANS_Cancel_1100 onConsume data:===============>' + JSON.stringify(data)); - console.info('============ANS_Cancel_1100 onConsume label:==============>' + data.request.label); - console.info('============ANS_Cancel_1100 onConsume id: =======================>' + data.request.id); - notify.cancel(data.request.id,cancelCallBackCancelIsUnremovable); - console.info('============ANS_Cancel_1100 onConsume cancel=======================>'); - console.info('============ANS_Cancel_1100 onConsume end=======================>'); - } - function onCancelCancelIsUnremovable(data) { - console.info('============ANS_Cancel_1100 onCancel start================>'); - console.info('============ANS_Cancel_1100 onCancel data:================>' + JSON.stringify(data)); - console.info('============ANS_Cancel_1100 onCancel id:================>' + data.request.id); - expect(data.request.id).assertEqual(11); - console.info('============ANS_Cancel_1100 onCancel end=======================>'); - } - function cancelCallBackCancelIsUnremovable(err){ - console.info('============ANS_Cancel_1100 cancelCallBack start=================>'); - console.info('============ANS_Cancel_1100 cancelCallBack err:==================>' + JSON.stringify(err)); - console.info('============ANS_Cancel_1100 cancelCallBack end===================>'); - } - - /* - * @tc.number: ANS_Cancel_1100 - * @tc.name: cancel(id: number, callback: AsyncCallback): void; - * @tc.desc: Verify the success of canceling the notification with the notification attribute isUnremovable - being true by calling the cancel(id: number, callback: AsyncCallback): void interface - */ - it('ANS_Cancel_1100', 0, async function (done) { - console.info('===============ANS_Cancel_1100 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelIsUnremovable, - onCancel:onCancelCancelIsUnremovable, - } - await notify.subscribe(subscriber); - console.info('===============ANS_Cancel_1100 subscribe promise=============>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 11, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('============ANS_Cancel_1100 publish promise===========>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_1100 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - let id1200 - function onConsumeCancel2Times(data) { - console.info('=========ANS_Cancel_1200 onConsume start=====================>'); - console.info('=========ANS_Cancel_1200 onConsume data:=====================>' + JSON.stringify(data)); - console.info('=========ANS_Cancel_1200 onConsume label:====================>' + data.request.label); - console.info('=========ANS_Cancel_1200 onConsume id:=======================>' + data.request.id); - id1200 = data.request.id - notify.cancel(id1200, cancelCallBackCancel2Times1); - console.info('=========ANS_Cancel_1200 onConsume cancel====================>'); - console.info('=========ANS_Cancel_1200 onConsume end=======================>'); - } - function onCancelCancel2Times(data) { - timesOfOnCancel = timesOfOnCancel + 1 - console.info('=========ANS_Cancel_1200 onCancel start======================>'); - console.info('=========ANS_Cancel_1200 onCancel data:===========>' + JSON.stringify(data)); - console.info('=========ANS_Cancel_1200 onCancel timesOfOnCancel========>'+timesOfOnCancel); - if (timesOfOnCancel == 1){ - expect(data.request.id).assertEqual(12); - console.info('=========ANS_Cancel_1200 onCancel id:======================>' + data.request.id); - notify.cancel(id1200, cancelCallBackCancel2Times2); - console.info('=========ANS_Cancel_1200 onCancel cancelCallBack_cancel 2Times2===========>'); - }else if(timesOfOnCancel == 2) { - expect().assertFail(); - } - console.info('=========ANS_Cancel_1200 onCancel end=======================>'); - } - function cancelCallBackCancel2Times1(err){ - console.info('===========ANS_Cancel_1200 cancelCallBack1 start================>'); - console.info('===========ANS_Cancel_1200 cancelCallBack1 err:=================>' + JSON.stringify(err)); - console.info('===========ANS_Cancel_1200 cancelCallBack1 end=======================>'); - } - - function cancelCallBackCancel2Times2(err){ - console.info('===========ANS_Cancel_1200 cancelCallBack2 start===========>'); - console.info('===========ANS_Cancel_1200 cancelCallBack2 err:============>' + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info('===========ANS_Cancel_1200 cancelCallBack2 end============>'); - } - - /* - * @tc.number: ANS_Cancel_1200 - * @tc.name: cancel(id: number, callback: AsyncCallback): void; - * @tc.desc: Verify that the cancel(id: number, callback: AsyncCallback): void - interface is called twice in a row to cancel the notification - */ - it('ANS_Cancel_1200', 0, async function (done) { - console.info('=============ANS_Cancel_1200 start==========================>'); - timesOfOnCancel = 0 - let subscriber ={ - onConsume:onConsumeCancel2Times, - onCancel:onCancelCancel2Times, - } - await notify.subscribe(subscriber); - console.info('=============ANS_Cancel_1200 subscribe promise==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 12, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('========ANS_Cancel_1200 publish promise=================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_1200 setTimeout unsubscribe end==================>'); - done(); - }),1500); - }) - - function onConsumeCancelLabel(data) { - console.info('============ANS_Cancel_1300 onConsume start=============>'); - console.info('============ANS_Cancel_1300 onConsume data:=============>' + JSON.stringify(data)); - console.info('============ANS_Cancel_1300 onConsume label: ===========>' + data.request.label); - console.info('============ANS_Cancel_1300 onConsume id: ==============>' + data.request.id); - notify.cancel(data.request.id, data.request.label, cancelCallBackCancelLabel); - console.info('============ANS_Cancel_1300 onConsume cance=============>'); - console.info('============ANS_Cancel_1300 onConsume end===============>'); - } - function onCancelCancelLabel(data) { - console.info('=========ANS_Cancel_1300 onCancel start============>'); - console.info('=========ANS_Cancel_1300 onCancel data:============>' + JSON.stringify(data)); - expect(data.request.id).assertEqual(13); - console.info('=========ANS_Cancel_1300 onCancel id:============>' + data.request.id); - expect(data.request.label).assertEqual('1300'); - console.info('=========ANS_Cancel_1300 onCancel label:============>' + data.request.label); - console.info('=========ANS_Cancel_1300 onCancel end==============>'); - } - function cancelCallBackCancelLabel(err){ - console.info('=========ANS_Cancel_1300 cancelCallBack start====================>'); - console.info('=========ANS_Cancel_1300 cancelCallBack err:=====================>' + JSON.stringify(err)); - console.info('=========ANS_Cancel_1300 cancelCallBack end=====================>'); - } - - /* - * @tc.number: ANS_Cancel_1300 - * @tc.name: cancel(id: number, label: string, callback: AsyncCallback): void; - * @tc.desc: Verify that the cancel notification is successful by calling the - cancel(id: number, label: string, callback: AsyncCallback): void; interface - */ - let subscriber - it('ANS_Cancel_1300', 0, async function (done) { - console.info('===============ANS_Cancel_1300 start==========================>'); - subscriber ={ - onConsume:onConsumeCancelLabel, - onCancel:onCancelCancelLabel, - } - await notify.subscribe(subscriber); - console.info('================ANS_Cancel_1300 subscribe promise==============>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 13, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '1300', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('===========ANS_Cancel_1300 publish promise==================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_1300 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - function onConsumeCancelLabelPromise(data) { - console.info('==========ANS_Cancel_1400 onConsume start=================>'); - console.info('==========ANS_Cancel_1400 onConsume data:=================>' + JSON.stringify(data)); - console.info('==========ANS_Cancel_1400 onConsume label:================>' + data.request.label); - console.info('==========ANS_Cancel_1400 onConsume id:===================>' + data.request.id); - notify.cancel(data.request.id, data.request.label); - console.info('==========ANS_Cancel_1400 onConsume cancel==========>'); - console.info('==========ANS_Cancel_1400 onConsume end=============>'); - } - function onCancelCancelLabelPromise(data) { - console.info('==========ANS_Cancel_1400 onCancel start============>'); - console.info('==========ANS_Cancel_1400 onCancel data:============>' + JSON.stringify(data)); - expect(data.request.id).assertEqual(14); - console.info('==========ANS_Cancel_1400 onCancel id:================>' + data.request.id); - expect(data.request.label).assertEqual('1400'); - console.info('==========ANS_Cancel_1400 onCancel label:================>' + data.request.label); - console.info('==========ANS_Cancel_1400 onCancel end==============>'); - } - - /* - * @tc.number: ANS_Cancel_1400 - * @tc.name: cancel(id: number, label?: string): Promise - * @tc.desc: Verify that the cancel notification is successful by calling the - cancel(id: number, label?: string): Promise interface - */ - it('ANS_Cancel_1400', 0, async function (done) { - console.info('===============ANS_Cancel_1400 start==========================>'); - subscriber ={ - onConsume:onConsumeCancelLabelPromise, - onCancel:onCancelCancelLabelPromise, - } - await notify.subscribe(subscriber); - console.info('==========ANS_Cancel_1400 subscribe promise==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 14, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '1400', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('===============ANS_Cancel_1400 publish promise==============>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_1400 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - function onConsumeCancelLabelIsUnremoveable(data) { - console.info('========ANS_Cancel_1500 onConsume start=====================>'); - console.info('========ANS_Cancel_1500 onConsume data:=====================>' + JSON.stringify(data)); - console.info('========ANS_Cancel_1500 onConsume label:====================>' + data.request.label); - console.info('========ANS_Cancel_1500 onConsume id:=======================>' + data.request.id); - notify.cancel(data.request.id, data.request.label, cancelCallBackCancelLabelIsUnremoveable); - console.info('========ANS_Cancel_1500 onConsume cancel====================>'); - console.info('========ANS_Cancel_1500 onConsume end=======================>'); - } - function onCancelCancelLabelIsUnremoveable(data) { - console.info('========ANS_Cancel_1500 onCancel start=======================>'); - console.info('========ANS_Cancel_1500 onCancel data : =======================>' + JSON.stringify(data)); - expect(data.request.id).assertEqual(15); - console.info('========ANS_Cancel_1500 onCancel id : =======================>' + data.request.id); - expect(data.request.label).assertEqual('1500'); - console.info('========ANS_Cancel_1500 onCancel label : =======================>' + data.request.label); - console.info('========ANS_Cancel_1500 onCancel end=======================>'); - } - function cancelCallBackCancelLabelIsUnremoveable(err){ - console.info('========ANS_Cancel_1500 cancelCallBack start=========>'); - console.info('========ANS_Cancel_1500 cancelCallBack err:==========>' + JSON.stringify(err)); - console.info('========ANS_Cancel_1500 cancelCallBack end===========>'); - } - - /* - * @tc.number: ANS_Cancel_1500 - * @tc.name: cancel(id: number, label: string, callback: AsyncCallback): void - * @tc.desc: Verify that the notification whose notification property isUnremovable is true is canceled - successfully by calling the cancel(id: number, label: string, callback: AsyncCallback): void interface - */ - it('ANS_Cancel_1500', 0, async function (done) { - console.info('===============ANS_Cancel_1500 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelLabelIsUnremoveable, - onCancel:onCancelCancelLabelIsUnremoveable, - } - await notify.subscribe(subscriber); - console.info('=======ANS_Cancel_1500 subscribe promise==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 15, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '1500', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('===========ANS_Cancel_1500 publish promise=============>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_1500 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - function onConsumeCancelLabelIsUnremoveablePromise(data) { - console.info('============ANS_Cancel_1600 onConsume start==================>'); - console.info('============ANS_Cancel_1600 onConsume data:==================>' + JSON.stringify(data)); - console.info('============ANS_Cancel_1600 onConsume label:=================>' + data.request.label); - console.info('============ANS_Cancel_1600 onConsume id:====================>' + data.request.id); - notify.cancel(data.request.id, data.request.label) - console.info('============ANS_Cancel_1600 onConsume cancel end==========>'); - console.info('============ANS_Cancel_1600 onConsume end====================>'); - } - function onCancelCancelLabelIsUnremoveablePromise(data) { - console.info('============ANS_Cancel_1600 onCancel start=================>'); - console.info('============ANS_Cancel_1600 onCancel data:=================>' + JSON.stringify(data)); - expect(data.request.id).assertEqual(16); - console.info('============ANS_Cancel_1600 onCancel id : =======================>' + data.request.id); - expect(data.request.label).assertEqual('1600'); - console.info('============ANS_Cancel_1600 onCancel label : =======================>' + data.request.label); - console.info('============ANS_Cancel_1600 onCancel end===================>'); - } - - /* - * @tc.number: ANS_Cancel_1600 - * @tc.name: cancel(id: number, label?: string): Promise - * @tc.desc: Verify that the notification whose notification property isUnremovable is true - is canceled successfully by calling the cancel(id: number, label?: string): Promise interface - */ - it('ANS_Cancel_1600', 0, async function (done) { - console.info('===============ANS_Cancel_1600 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelLabelIsUnremoveablePromise, - onCancel:onCancelCancelLabelIsUnremoveablePromise, - } - await notify.subscribe(subscriber); - console.info('==============ANS_Cancel_1600 subscribe promise==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 16, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '1600', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('==============ANS_Cancel_1600 publish promise==================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_1600 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - function onConsumeCancelWrongLabel(data) { - console.info('================ANS_Cancel_1700 onConsume start===============>'); - console.info('================ANS_Cancel_1700 onConsume data:===============>' + JSON.stringify(data)); - console.info('================ANS_Cancel_1700 onConsume label:==============>' + data.request.label); - console.info('================ANS_Cancel_1700 onConsume id:=================>' + data.request.id); - notify.cancel(data.request.id, '9999', cancelCallBackCancelWrongLabel); - console.info('================ANS_Cancel_1700 onConsume cancel=======================>'); - console.info('================ANS_Cancel_1700 onConsume end=======================>'); - } - function onCancelCancelWrongLabel(data) { - console.info('================ANS_Cancel_1700 onCancel start===============>'); - console.info('================ANS_Cancel_1700 onCancel data:===============>' + JSON.stringify(data)); - expect().assertFail(0); - console.info('================ANS_Cancel_1700 onCancel end=================>'); - } - function cancelCallBackCancelWrongLabel(err){ - console.info('================ANS_Cancel_1700 cancelCallBack start=================>'); - console.info('================ANS_Cancel_1700 cancelCallBack err:==================>' + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info('================ANS_Cancel_1700 cancelCallBack end===================>'); - } - - /* - * @tc.number: ANS_Cancel_1700 - * @tc.name: cancel(id: number, label: string, callback: AsyncCallback): void; - * @tc.desc: Verify that the cancel(id: number, label: string, callback: AsyncCallback): void - interface is called, the label is wrong and the ID is correct. - */ - it('ANS_Cancel_1700', 0, async function (done) { - console.info('===============ANS_Cancel_1700 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelWrongLabel, - onCancel:onCancelCancelWrongLabel, - } - await notify.subscribe(subscriber); - console.info('==============ANS_Cancel_1700 subscribe promise==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 17, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '1700', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('==============ANS_Cancel_1700 publish promise==================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_1700 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - function onConsumeCancelWrongLabelPromise(data) { - console.info('=========ANS_Cancel_1800 onConsume start================>'); - console.info('=========ANS_Cancel_1800 onConsume data:================>' + JSON.stringify(data)); - console.info('=========ANS_Cancel_1800 onConsume label:===============>' + data.request.label); - console.info('=========ANS_Cancel_1800 onConsume id:==================>' + data.request.id); - notify.cancel(data.request.id, '9999').then(()=>{ - console.info('=========ANS_Cancel_1800 onConsume cancel then======>'); - }).catch((err)=>{ - console.info('=========ANS_Cancel_1800 onConsume cancel catch err======>'+JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - }); - console.info('=========ANS_Cancel_1800 onConsume end=======================>'); - } - function onCancelCancelWrongLabelPromise(data) { - console.info('=========ANS_Cancel_1800 onCancel start=======================>'); - console.info('=========ANS_Cancel_1800 onCancel data : =======================>' + JSON.stringify(data)); - expect().assertFail(0); - console.info('=========ANS_Cancel_1800 onCancel end=======================>'); - } - - /* - * @tc.number: ANS_Cancel_1800 - * @tc.name: cancel(id: number, label?: string): Promise - * @tc.desc: Verify that the cancel(id: number, label?: string): Promise interface is called, - the label is wrong and the ID is correct. - */ - it('ANS_Cancel_1800', 0, async function (done) { - console.info('===============ANS_Cancel_1800 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelWrongLabelPromise, - onCancel:onCancelCancelWrongLabelPromise, - } - await notify.subscribe(subscriber); - console.info('==============ANS_Cancel_1800 subscribe promise==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 18, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '1800', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('==============ANS_Cancel_1800 publish promise==================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_1800 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - function onConsumeCancelLabelNullCharacter(data) { - console.info('===========ANS_Cancel_1900 onConsume start==================>'); - console.info('===========ANS_Cancel_1900 onConsume data:==================>' + JSON.stringify(data)); - console.info('===========ANS_Cancel_1900 onConsume label:=================>' + data.request.label); - console.info('===========ANS_Cancel_1900 onConsume id:====================>' + data.request.id); - notify.cancel(data.request.id, '', cancelCallBackCancelNullCharacter); - console.info('===========ANS_Cancel_1900 onConsume cancel=======================>'); - console.info('===========ANS_Cancel_1900 onConsume end=======================>'); - } - function onCancelCancelLabelNullCharacter(data) { - console.info('===========ANS_Cancel_1900 onCancel start================>'); - console.info('===========ANS_Cancel_1900 onCancel data:================>' + JSON.stringify(data)); - expect().assertFail(0); - console.info('===========ANS_Cancel_1900 onCancel end=======================>'); - } - function cancelCallBackCancelNullCharacter(err){ - console.info('===========ANS_Cancel_1900 cancelCallBack start=================>'); - console.info('===========ANS_Cancel_1900 cancelCallBack err:==================>' + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info('===========ANS_Cancel_1900 cancelCallBack end===================>'); - } - - /* - * @tc.number: ANS_Cancel_1900 - * @tc.name: cancel(id: number, label: string, callback: AsyncCallback): void; - * @tc.desc: Verify that the cancel(id: number, label: string, callback: AsyncCallback): void - interface is called, and the label uses empty characters - */ - it('ANS_Cancel_1900', 0, async function (done) { - console.info('===============ANS_Cancel_1900 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelLabelNullCharacter, - onCancel:onCancelCancelLabelNullCharacter, - } - await notify.subscribe(subscriber); - console.info('=============ANS_Cancel_1900 subscribe promise==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 19, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '1900', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('==========ANS_Cancel_1900 publish promise==============>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_1900 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - function onConsumeCancelNullCharacter(data) { - console.info('==========ANS_Cancel_2000 onConsume start=================>'); - console.info('==========ANS_Cancel_2000 onConsume data:=================>' + JSON.stringify(data)); - console.info('==========ANS_Cancel_2000 onConsume label:================>' + data.request.label); - console.info('==========ANS_Cancel_2000 onConsume id:===================>' + data.request.id); - notify.cancel(data.request.id, '').then(()=>{ - console.info('=========ANS_Cancel_2000 onConsume cancel then======>'); - }).catch((err)=>{ - console.info('=========ANS_Cancel_2000 onConsume cancel catch err======>'+JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - }); - console.info('==========ANS_Cancel_2000 onConsume cancel end==========>'); - console.info('==========ANS_Cancel_2000 onConsume end=================>'); - } - function onCancelCancelNullCharacter(data) { - console.info('==========ANS_Cancel_2000 onCancel start====================>'); - console.info('==========ANS_Cancel_2000 onCancel data:======================>' + JSON.stringify(data)); - expect().assertFail(0); - console.info('==========ANS_Cancel_2000 onCancel end=======================>'); - } - - /* - * @tc.number: ANS_Cancel_2000 - * @tc.name: cancel(id: number, label?: string): Promise; - * @tc.desc: Verify that the cancel(id: number, label?: string): Promise interface is called, - and the label uses empty characters - */ - it('ANS_Cancel_2000', 0, async function (done) { - console.info('===============ANS_Cancel_2000 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelNullCharacter, - onCancel:onCancelCancelNullCharacter, - } - await notify.subscribe(subscriber); - console.info('=========ANS_Cancel_2000 subscribe promise==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 20, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '2000', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('============ANS_Cancel_2000 publish promise===============>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_2000 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - let id2100 - let label2100 - function onConsumeCancelLabel2Times(data) { - console.info('=========ANS_Cancel_2100 onConsume start==================>'); - console.info('=========ANS_Cancel_2100 onConsume data:==================>' + JSON.stringify(data)); - console.info('=========ANS_Cancel_2100 onConsume label:=================>' + data.request.label); - console.info('=========ANS_Cancel_2100 onConsume id:====================>' + data.request.id); - id2100 = data.request.id - label2100 = data.request.label - notify.cancel(id2100, label2100, cancelCallBackCancelLabel2Times1); - console.info('=========ANS_Cancel_2100 onConsume cancel=======================>'); - console.info('=========ANS_Cancel_2100 onConsume end=======================>'); - } - function onCancelCancelLabel2Times(data) { - timesOfOnCancel = timesOfOnCancel + 1 - console.info('=========ANS_Cancel_2100 onCancel start==========>'); - console.info('=========ANS_Cancel_2100 onCancel data===========>' + JSON.stringify(data)); - if (timesOfOnCancel == 1){ - expect(data.request.id).assertEqual(21); - expect(data.request.label).assertEqual('2100'); - }else if(timesOfOnCancel == 2){ - expect().assertFail(); - } - console.info('=========ANS_Cancel_2100 onCancel end==========>'); - } - function cancelCallBackCancelLabel2Times1(err){ - console.info('=========ANS_Cancel_2100 cancelCallBack 2Times1 start============>'); - console.info('=========ANS_Cancel_2100 cancelCallBack 2Times1 err==============>' + JSON.stringify(err)); - expect(err.code).assertEqual(0); - notify.cancel(id2100, label2100, cancelCallBackCancelLabel2Times2); - console.info('=========ANS_Cancel_2100 cancelCallBack 2Times1 cancel =======================>'); - console.info('=========ANS_Cancel_2100 cancelCallBack 2Times1 end=======================>'); - } - function cancelCallBackCancelLabel2Times2(err){ - console.info('=========ANS_Cancel_2100 cancelCallBack 2Times2 start================>'); - console.info('=========ANS_Cancel_2100 cancelCallBack 2Times2 err:=================>' + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info('=========ANS_Cancel_2100 cancelCallBack 2Times2 end==================>'); - } - - /* - * @tc.number: ANS_Cancel_2100 - * @tc.name: cancel(id: number, label: string, callback: AsyncCallback): void - * @tc.desc: Verify that the cancel(id: number, label: string, callback: AsyncCallback): void - interface is called twice in a row - */ - it('ANS_Cancel_2100', 0, async function (done) { - console.info('===============ANS_Cancel_2100 start==========================>'); - timesOfOnCancel = 0 - let subscriber ={ - onConsume:onConsumeCancelLabel2Times, - onCancel:onCancelCancelLabel2Times, - } - await notify.subscribe(subscriber); - console.info('=============ANS_Cancel_2100 subscribe promise==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 21, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '2100', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('=============ANS_Cancel_2100 publish promise================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_2100 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - let id2200 - let label2200 - function onConsumeCancelLabelPromise2Times(data) { - console.info('===========ANS_Cancel_2200 onConsume start=======================>'); - console.info('===========ANS_Cancel_2200 onConsume data:=========>' + JSON.stringify(data)); - console.info('===========ANS_Cancel_2200 onConsume label:========>' + data.request.label); - console.info('===========ANS_Cancel_2200 onConsume id:===========>' + data.request.id); - id2200 = data.request.id - label2200 = data.request.label - notify.cancel(id2200, label2200); - console.info('===========ANS_Cancel_2200 onConsume cancel1==========>'); - notify.cancel(id2200, label2200).then(()=>{ - console.info('=========ANS_Cancel_2200 onConsume cancel2 then======>'); - }).catch((err)=>{ - console.info('=========ANS_Cancel_2200 onConsume cancel2 catch err======>'+JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - }); - console.info('===========ANS_Cancel_2200 onConsume cancel2==========>'); - console.info('===========ANS_Cancel_2200 onConsume end==============>'); - } - function onCancelCancelLabelPromise2Times(data) { - console.info('===========ANS_Cancel_2200 onCancel start===================>'); - console.info('===========ANS_Cancel_2200 onCancel data:===================>' + JSON.stringify(data)); - timesOfOnCancel = timesOfOnCancel + 1 - if (timesOfOnCancel == 1){ - expect(data.request.id).assertEqual(22); - expect(data.request.label).assertEqual('2200'); - }else if (timesOfOnCancel == 2){ - expect().assertFail(); - } - console.info('===========ANS_Cancel_2200 onCancel end=======================>'); - } - - /* - * @tc.number: ANS_Cancel_2200 - * @tc.name: cancel(id: number, label?: string): Promise - * @tc.desc: Verify that the cancel(id: number, label?: string): Promise - interface is called twice in a row - */ - it('ANS_Cancel_2200', 0, async function (done) { - console.info('===============ANS_Cancel_2200 start==========================>'); - timesOfOnCancel = 0 - let subscriber ={ - onConsume:onConsumeCancelLabelPromise2Times, - onCancel:onCancelCancelLabelPromise2Times, - } - await notify.subscribe(subscriber); - console.info('================ANS_Cancel_2200 subscribe_2200_promise=============>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 22, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '2200', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('================ANS_Cancel_2200 publish promise==================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_2200 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - function onConsumeCancelRightLabelWrongId(data) { - console.info('============ANS_Cancel_2300 onConsume start=======================>'); - console.info('============ANS_Cancel_2300 onConsume data: =======================>' + JSON.stringify(data)); - console.info('============ANS_Cancel_2300 onConsume label: =======================>' + data.request.label); - console.info('============ANS_Cancel_2300 onConsume id: =======================>' + data.request.id); - notify.cancel(11111, data.request.label, cancelCallBackCancelRightLabelWrongId); - console.info('============ANS_Cancel_2300 onConsume cancel=======================>'); - console.info('============ANS_Cancel_2300 onConsume end=======================>'); - } - function onCancelCancelRightLabelWrongId(data) { - console.info('============ANS_Cancel_2300 onCancel start=======================>'); - console.info('============ANS_Cancel_2300 onCancel data:=======================>' + JSON.stringify(data)); - expect().assertFail(); - console.info('============ANS_Cancel_2300 onCancel end=======================>'); - } - function cancelCallBackCancelRightLabelWrongId(err){ - console.info('============ANS_Cancel_2300 cancelCallBack start=======================>'); - console.info('============ANS_Cancel_2300 cancelCallBack err:===============>' + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info('============ANS_Cancel_2300 cancelCallBack end===================>'); - } - - /* - * @tc.number: ANS_Cancel_2300 - * @tc.name: cancel(id: number, label: string, callback: AsyncCallback): void - * @tc.desc: Verify that the cancel(id: number, label: string, callback: AsyncCallback): - void interface is called, the label is correct and the ID is wrong. - */ - it('ANS_Cancel_2300', 0, async function (done) { - console.info('===============ANS_Cancel_2300 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelRightLabelWrongId, - onCancel:onCancelCancelRightLabelWrongId, - } - await notify.subscribe(subscriber); - console.info('================ANS_Cancel_2300 promise==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 23, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '2300', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('============ANS_Cancel_2300 publish promise==================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_2300 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - function onConsumeCancelRightLabelWrongIdPromise(data) { - console.info('============ANS_Cancel_2400 onConsume start==============>'); - console.info('============ANS_Cancel_2400 onConsume data:==============>' + JSON.stringify(data)); - console.info('============ANS_Cancel_2400 onConsume label:=============>' + data.request.label); - console.info('============ANS_Cancel_2400 onConsume id:================>' + data.request.id); - notify.cancel(11111, data.request.label).then(()=>{ - console.info('=========ANS_Cancel_2400 onConsume cancel then======>'); - }).catch((err)=>{ - console.info('=========ANS_Cancel_2400 onConsume cancel catch err======>'+JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - }); - console.info('============ANS_Cancel_2400 onConsume cancel==========>'); - console.info('============ANS_Cancel_2400 onConsume end=============>'); - } - function onCancelCancelRightLabelWrongIdPromise(data) { - console.info('============ANS_Cancel_2400 onCancel start:==============>'); - console.info('============ANS_Cancel_2400 onCancel data:===============>' + JSON.stringify(data)); - expect().assertFail(); - console.info('============ANS_Cancel_2400 onCancel end=======================>'); - } - - /* - * @tc.number: ANS_Cancel_2400 - * @tc.name: cancel(id: number, label?: string): Promise - * @tc.desc: Verify that the cancel(id: number, label: string, callback: AsyncCallback): void - interface is called, the label is correct and the ID is correct wrong. - */ - it('ANS_Cancel_2400', 0, async function (done) { - console.info('===============ANS_Cancel_2400 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelRightLabelWrongIdPromise, - onCancel:onCancelCancelRightLabelWrongIdPromise, - } - await notify.subscribe(subscriber); - console.info('============ANS_Cancel_2400 subscribe promise========>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 24, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '2400', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('============ANS_Cancel_2400 publish promise==================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_2400 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - function onConsumeCancelWrongLabelWrongId(data) { - console.info('==========ANS_Cancel_2500 onConsume start=======================>'); - console.info('==========ANS_Cancel_2500 onConsume data:=======================>' + JSON.stringify(data)); - console.info('==========ANS_Cancel_2500 onConsume label:======================>' + data.request.label); - console.info('==========ANS_Cancel_2500 onConsume id==========================>' + data.request.id); - notify.cancel(6666, '6666', cancelCallBackCancelWrongLabelWrongId); - console.info('==========ANS_Cancel_2500 onConsume cancel====================>'); - console.info('==========ANS_Cancel_2500 onConsume end=======================>'); - } - function onCancelCancelWrongLabelWrongId(data) { - console.info('==========ANS_Cancel_2500 onCancel start====================>'); - console.info('==========ANS_Cancel_2500 onCancel data:====================>' + JSON.stringify(data)); - expect().assertFail(); - console.info('==========ANS_Cancel_2500 onCancel end======================>'); - } - function cancelCallBackCancelWrongLabelWrongId(err){ - console.info('==========ANS_Cancel_2500 cancelCallBack start=======================>'); - console.info('==========ANS_Cancel_2500 cancelCallBack err:================>' + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info('==========ANS_Cancel_2500 cancelCallBack end=======================>'); - } - - /* - * @tc.number: ANS_Cancel_2500 - * @tc.name: cancel(id: number, label: string, callback: AsyncCallback): void - * @tc.desc: Verify that the cancel(id: number, label: string, callback: AsyncCallback): void -  interface is called, the label is correct and the ID is correct wrong. - */ - it('ANS_Cancel_2500', 0, async function (done) { - console.info('===============ANS_Cancel_2500 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelWrongLabelWrongId, - onCancel:onCancelCancelWrongLabelWrongId, - } - await notify.subscribe(subscriber); - console.info('================ANS_Cancel_2500 subscribe promise==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 25, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '2500', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('==========ANS_Cancel_2500 publish promise==================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_2500 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - function onConsumeCancelWrongLabelWrongIdPromise(data) { - console.info('========ANS_Cancel_2600 onConsume start:=============>'); - console.info('========ANS_Cancel_2600 onConsume data:==============>' + JSON.stringify(data)); - console.info('========ANS_Cancel_2600 onConsume label:=============>' + data.request.label); - console.info('========ANS_Cancel_2600 onConsume id:================>' + data.request.id); - notify.cancel(6666, '6666').then(()=>{ - console.info('=========ANS_Cancel_2600 onConsume cancel then======>'); - }).catch((err)=>{ - console.info('=========ANS_Cancel_2600 onConsume cancel catch err======>'+JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - }); - console.info('========ANS_Cancel_2600 onConsume end================>'); - console.info('========ANS_Cancel_2600 onConsume end================>'); - } - function onCancelCancelWrongLabelWrongIdPromise(data) { - console.info('========ANS_Cancel_2600 onCancel start=======================>'); - console.info('========ANS_Cancel_2600 onCancel data:=======================>' + JSON.stringify(data)); - expect().assertFail(); - console.info('========ANS_Cancel_2600 onCancel end=======================>'); - } - - /* - * @tc.number: ANS_Cancel_2600 - * @tc.name: cancel(id: number, label?: string): Promise - * @tc.desc: Verify that the cancel(id: number, label?: string): Promise interface is called, -  the label is wrong and the ID is wrong. - */ - it('ANS_Cancel_2600', 0, async function (done) { - console.info('===============ANS_Cancel_2600 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelWrongLabelWrongIdPromise, - onCancel:onCancelCancelWrongLabelWrongIdPromise, - } - await notify.subscribe(subscriber); - console.info('===============ANS_Cancel_2600 subscribe promise==================>'); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - id: 26, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: 'statusBarText', - isFloatingIcon : true, - label: '2600', - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info('===============ANS_Cancel_2600 publish promise==================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_2600 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - /* - * @tc.number: ANS_Cancel_2700 - * @tc.name: cancel(id: number, label?: string): Promise - * @tc.desc: add NotificationTemplate extraInfo template badgeNumber - */ - it('ANS_Cancel_2700', 0, async function (done) { - console.info('===============ANS_Cancel_2700 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelWrongLabelWrongIdPromise, - onCancel:onCancelCancelWrongLabelWrongIdPromise, - } - await notify.subscribe(subscriber); - console.info('===============ANS_Cancel_2700 subscribe promise==================>'); - let NotificationTemplate = { - name:'/system/etc/notification_template/assets/js/downloadTemplate.js', - data:{key3:"789",key4:"111"} - } - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - extraInfo:{ - key1: "1231", - key2:"456" - }, - template:NotificationTemplate, - badgeNumber:1, - } - await notify.publish(notificationRequest); - console.info('===============ANS_Cancel_2700 publish promise==================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_2700 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) - - /* - * @tc.number: ANS_Cancel_2800 - * @tc.name: cancel(id: number, label?: string): Promise - * @tc.desc: add creatorPid - */ - it('ANS_Cancel_2800', 0, async function (done) { - console.info('===============ANS_Cancel_2800 start==========================>'); - let subscriber ={ - onConsume:onConsumeCancelWrongLabelWrongIdPromise, - onCancel:onCancelCancelWrongLabelWrongIdPromise, - } - await notify.subscribe(subscriber); - console.info('===============ANS_Cancel_2800 subscribe promise==================>'); - - let NotificationTemplate = { - name:'/system/etc/notification_template/assets/js/downloadTemplate.js', - data:{key3:"789",key4:"111"} - } - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: 'test_title', - text: 'test_text', - additionalText: 'test_additionalText' - }, - }, - extraInfo:{ - key1: "1231", - key2:"456" - }, - template:NotificationTemplate, - creatorPid:1, - } - await notify.publish(notificationRequest); - console.info('===============ANS_Cancel_2800 publish promise==================>'); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info('======ANS_Cancel_2800 setTimeout unsubscribe end==================>'); - done(); - }),timeout); - }) -}) } diff --git a/notification/ans_standard/actsansnotificationcancel/src/main/js/test/List.test.js b/notification/ans_standard/actsansnotificationcancel/src/main/js/test/List.test.js deleted file mode 100644 index 2987240b11b561edef38f8cc535ca6145017e2ff..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationcancel/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* -* 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 ActsAnsNotificationCancel from './ActsAnsNotificationCancel.test.js' -export default function testsuite() { -ActsAnsNotificationCancel() -} diff --git a/notification/ans_standard/actsansnotificationcancel/src/main/resources/base/element/string.json b/notification/ans_standard/actsansnotificationcancel/src/main/resources/base/element/string.json deleted file mode 100644 index 35e963197206eb6c56d82195c63adae9f0417de3..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationcancel/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "cancel" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/actsansnotificationremove/BUILD.gn b/notification/ans_standard/actsansnotificationremove/BUILD.gn deleted file mode 100644 index f70bba05968cf0b5e0394bc4dcfec70a178cf8ed..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsNotificationRemoveTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsNotificationRemoveTest" - 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/actsansnotificationremove/Test.json b/notification/ans_standard/actsansnotificationremove/Test.json deleted file mode 100644 index 3787ea1ba1eae6b10d664856badedf5ce377b2eb..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "shell-timeout": "180000", - "bundle-name": "com.example.actsansnotificationremove", - "package-name": "com.example.actsansnotificationremove" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsNotificationRemoveTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/actsansnotificationremove/signature/openharmony_sx.p7b b/notification/ans_standard/actsansnotificationremove/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/actsansnotificationremove/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/actsansnotificationremove/src/main/config.json b/notification/ans_standard/actsansnotificationremove/src/main/config.json deleted file mode 100644 index 672a9e8e04f94ef7d10762b1cd3b7902c7082554..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansnotificationremove", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansnotificationremove", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/actsansnotificationremove/src/main/js/MainAbility/app.js b/notification/ans_standard/actsansnotificationremove/src/main/js/MainAbility/app.js deleted file mode 100644 index 4f1747a95c4acbb66db5351e826c31584356e11c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* -* 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/actsansnotificationremove/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/actsansnotificationremove/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansnotificationremove/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/actsansnotificationremove/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansnotificationremove/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/actsansnotificationremove/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 406641d81b4fb36d0b97c49b722528391c7a56a0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/actsansnotificationremove/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/actsansnotificationremove/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 4fcd0a37b3c7e4bf08855b01194225f00ea6d03b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - ActsAnsNotificationRemove - -
diff --git a/notification/ans_standard/actsansnotificationremove/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/actsansnotificationremove/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/actsansnotificationremove/src/main/js/TestAbility/app.js b/notification/ans_standard/actsansnotificationremove/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/actsansnotificationremove/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/actsansnotificationremove/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansnotificationremove/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/actsansnotificationremove/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansnotificationremove/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/actsansnotificationremove/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/actsansnotificationremove/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/actsansnotificationremove/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/actsansnotificationremove/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/actsansnotificationremove/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/actsansnotificationremove/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/actsansnotificationremove/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/actsansnotificationremove/src/main/js/test/ActsAnsNotificationRemove.test.js b/notification/ans_standard/actsansnotificationremove/src/main/js/test/ActsAnsNotificationRemove.test.js deleted file mode 100644 index 681862ea252ae58111db9ae0f620e8ada69bfe3a..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/src/main/js/test/ActsAnsNotificationRemove.test.js +++ /dev/null @@ -1,3079 +0,0 @@ -/* -* 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 notify from '@ohos.notification' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -let timeout = 300; -export default function ActsAnsNotificationRemove() { -describe('ActsAnsNotificationRemove', function () { - console.info("===========ActsAnsNotificationRemove start====================>"); - let subscriber; - function publishCallback(err) { - console.info("==========================publishCallback=======================>"); - } - let hashCode; - function onConsumeRemove(data) { - console.info("=============ANS_Remove_0100 onConsume start=======================>"); - console.info("=============ANS_Remove_0100 onConsume data:==================>" + JSON.stringify(data)); - console.info("=============ANS_Remove_0100 onConsume hascode:===============>" + data.request.hashCode); - hashCode = data.request.hashCode - notify.remove(hashCode,removeCallBack); - console.info("=============ANS_Remove_0100 onConsume remove=======================>"); - console.info("=============ANS_Remove_0100 onConsume end=======================>"); - } - - function onCancelRemove(data) { - console.info("==========ANS_Remove_0100 onCancel start==================>"); - console.info("==========ANS_Remove_0100 onCancel data : ================>" + JSON.stringify(data)); - console.info("==========ANS_Remove_0100 onCancel hashCode===============>" + hashCode); - console.info("==========ANS_Remove_0100 onCancel data.request.hashCode==>" + data.request.hashCode); - expect(hashCode).assertEqual(data.request.hashCode); - console.info("==========ANS_Remove_0100 onCancel end=======================>"); - } - - function removeCallBack(err, data) { - console.info("==========ANS_Remove_0100 removeCallBack err=========>" + JSON.stringify(err)); - console.info("==========ANS_Remove_0100 removeCallBack data : =======================>" + JSON.stringify(data)); - } - function subscriberCallBack(err, data) { - console.info("================subscriberCallBack err : =======================>" + JSON.stringify(err)); - console.info("================subscriberCallBack data : =======================>" + JSON.stringify(data)); - } - function publishCallback(err, data) { - console.info("================publishCallback err : =======================>" + JSON.stringify(err)); - console.info("================publishCallback data : =======================>" + JSON.stringify(data)); - } - - /* - * @tc.number: ANS_Remove_0100 - * @tc.name: remove(hashCode: string, callback: AsyncCallback): void; - * @tc.desc: Verify that the call interface remove(hashCode: string, callback: AsyncCallback): void - deletes the notification information through hashcode - */ - it('ANS_Remove_0100', 0, async function (done) { - console.info("===============ANS_Remove_0100==========================>"); - hashCode = 0 - let subscriber ={ - onConsume:onConsumeRemove, - onCancel:onCancelRemove, - } - await notify.subscribe(subscriber); - console.info("==================ANS_Remove_0100 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 1, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0100", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("=============ANS_Remove_0100 publish promise===========>"); - setTimeout((async function(){ - console.info("======ANS_Remove_0100 setTimeout==================>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_0100 setTimeout unsubscribe==================>"); - await notify.cancelAll(); - done(); - }),timeout); - - }) - - function onConsumeRemovePromise(data) { - console.info("================ANS_Remove_0200 onConsume start===============>"); - console.info("================ANS_Remove_0200 onConsume data================>" + JSON.stringify(data)); - hashCode = data.request.hashCode - console.info("================ANS_Remove_0200 onConsume hascode:========>" + data.request.hashCode); - notify.remove(hashCode); - console.info("================ANS_Remove_0200 onConsume remove============>"); - console.info("================ANS_Remove_0200 onConsume end===============>"); - } - - function onCancelRemovePromise(data) { - console.info("===========ANS_Remove_0200 onCancel start================>"); - console.info("===========ANS_Remove_0200 onCancel data:=================>" + JSON.stringify(data)); - console.info("===========ANS_Remove_0200 onCancel hashCode====================>" + hashCode); - console.info("===========ANS_Remove_0200 onCancel data.request.hashCode=======>" + data.request.hashCode); - expect(hashCode).assertEqual(data.request.hashCode); - console.info("===========ANS_Remove_0200 onCancel end===================>"); - } - - /* - * @tc.number: ANS_Remove_0200 - * @tc.name: remove(hashCode: string): Promise; - * @tc.desc: Verify that the call interface remove(hashCode: string): Promise - deletes the notification information through hashcode - */ - it('ANS_Remove_0200', 0, async function (done) { - console.info("===============ANS_Remove_0200==========================>"); - hashCode = 0 - let subscriber ={ - onConsume:onConsumeRemovePromise, - onCancel:onCancelRemovePromise, - } - await notify.subscribe(subscriber); - console.info("===============ANS_Remove_0200 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 2, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0200", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("======ANS_Remove_0200 publish==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_0200 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_0200 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeRemoveErrHashCode(data) { - console.info("================ANS_Remove_0300 onConsume start=======================>"); - console.info("================ANS_Remove_0300 onConsume data:=============>" + JSON.stringify(data)); - notify.remove("errorHashCode",removeErrHashCodeCallBack); - console.info("================ANS_Remove_0300 onConsume remove=======================>"); - console.info("================ANS_Remove_0300 onConsume end=======================>"); - } - function onCancelRemoveErrHashCode() { - console.info("================ANS_Remove_0300 onCancel start=======================>"); - expect().assertFail(); - console.info("================ANS_Remove_0300 onCancel end=======================>"); - } - function removeErrHashCodeCallBack(err) { - console.info("==========ANS_Remove_0300 removeCallBack start==============>"); - console.info("==========ANS_Remove_0300 removeCallBack err====================>" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info("==========ANS_Remove_0300 removeCallBack end=======================>"); - } - - /* - * @tc.number: ANS_Remove_0300 - * @tc.name: remove(hashCode: string, callback: AsyncCallback): void - * @tc.desc: Verify that the error hashcode is used to call the interface - remove(hashCode: string, callback: AsyncCallback) to delete the notification information - */ - it('ANS_Remove_0300', 0, async function (done) { - console.info("===============ANS_Remove_0300==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveErrHashCode, - onCancel:onCancelRemoveErrHashCode, - } - await notify.subscribe(subscriber); - console.info("==================ANS_Remove_0300 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 3, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0300", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("==================ANS_Remove_0300 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_0300 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_0300 setTimeout unsubscribe============>"); - await notify.cancelAll() - done(); - }),timeout); - }) - - function onConsumeRemoveErrHashCodePromise(data) { - console.info("===========ANS_Remove_0400 onConsume start:===========>"); - console.info("===========ANS_Remove_0400 onConsume data:===========>" + JSON.stringify(data)); - notify.remove("errorHashCode").then((data)=>{ - console.info("===========ANS_Remove_0400 onConsume remove data:===========>" + JSON.stringify(data)); - }).catch((err)=>{ - console.info("===========ANS_Remove_0400 onConsume remove err:============>" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info("===========ANS_Remove_0400 onConsume end:===================>"); - }); - } - - function onCancelRemoveErrHashCodePromise() { - console.info("===========ANS_Remove_0400 onCancel start:===========>"); - expect().assertFail(); - console.info("===========ANS_Remove_0400 onCancel end:===========>"); - } - - /* - * @tc.number: ANS_Remove_0400 - * @tc.name: remove(hashCode: string): Promise - * @tc.desc: Verify that the error hashcode is used to call the interface - remove(hashCode: string): Promise to delete the notification information - */ - it('ANS_Remove_0400', 0, async function (done) { - console.info("===============ANS_Remove_0400==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveErrHashCodePromise, - onCancel:onCancelRemoveErrHashCodePromise, - } - await notify.subscribe(subscriber); - console.info("===============ANS_Remove_0400 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 4, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0400", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("==================ANS_Remove_0400 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_0400 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_0400 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeRemoveUseEmptyCharacter(data) { - console.info("================ANS_Remove_0500 onConsume start==============>"); - console.info("================ANS_Remove_0500 onConsume data:==============>" + JSON.stringify(data)); - notify.remove('',removeCallBackUseEmptyCharacter); - console.info("================ANS_Remove_0500 onConsume remove=============>"); - console.info("================ANS_Remove_0500 onConsume end================>"); - } - - function onCancelRemoveUseEmptyCharacter(data) { - console.info("=============ANS_Remove_0500 onCancel start===============>"); - console.info("=============ANS_Remove_0500 onCancel data:===============>" + JSON.stringify(data)); - expect().assertFail(); - console.info("=============ANS_Remove_0500 onCancel end=================>"); - } - - function removeCallBackUseEmptyCharacter(err) { - console.info("=============ANS_Remove_0500 removeCallBack start===============>"); - console.info("=============ANS_Remove_0500 removeCallBack err=================>" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info("=============ANS_Remove_0500 removeCallBack end=================>"); - } - - /* - * @tc.number: ANS_Remove_0500 - * @tc.name: remove(hashCode: string, callback: AsyncCallback): void; - * @tc.desc: Verify that the Empty Character hashcode is used to call the interface - remove(hashCode: string, callback: AsyncCallback): void - to delete the notification information - */ - it('ANS_Remove_0500', 0, async function (done) { - console.info("===============ANS_Remove_0500==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveUseEmptyCharacter, - onCancel:onCancelRemoveUseEmptyCharacter, - } - await notify.subscribe(subscriber); - console.info("==================ANS_Remove_0500 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 5, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0500", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("==================ANS_Remove_0500 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_0500 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_0500 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function OnConsumeRemoveUseEmptyCharacterPromise(data) { - console.info("===============ANS_Remove_0600 onConsume start==================>"); - console.info("===============ANS_Remove_0600 onConsume data:==================>" + JSON.stringify(data)); - notify.remove('').then((data)=>{ - console.info("===========ANS_Remove_0600 onConsume remove data:============>" + JSON.stringify(data)); - }).catch((err)=>{ - console.info("===========ANS_Remove_0600 onConsume remove err:=============>" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info("===========ANS_Remove_0600 onConsume end=====================>"); - }); - - } - - function OnCancelRemoveUseEmptyCharacterPromise(data) { - console.info("==============ANS_Remove_0600 onCancel start=============>"); - console.info("==============ANS_Remove_0600 onCancel data:=============>" + JSON.stringify(data)); - expect().assertFail(); - console.info("==============ANS_Remove_0600 onCancel end===============>"); - } - - /* - * @tc.number: ANS_Remove_0600 - * @tc.name: remove(hashCode: string): Promise; - * @tc.desc: Verify that the Empty Character hashcode is used to call the interface - remove(hashCode: string): Promise to delete the notification information - */ - it('ANS_Remove_0600', 0, async function (done) { - console.info("===============ANS_Remove_0600 start==========================>"); - let subscriber ={ - onConsume:OnConsumeRemoveUseEmptyCharacterPromise, - onCancel:OnCancelRemoveUseEmptyCharacterPromise, - } - await notify.subscribe(subscriber); - console.info("==================ANS_Remove_0600 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 6, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0600", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("==================ANS_Remove_0600 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_0600 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_0600 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeRemoveNotExistHashCode(data) { - console.info("==============ANS_Remove_0700 onConsume start===================>"); - console.info("==============ANS_Remove_0700 onConsume data:===================>" + JSON.stringify(data)); - notify.remove("9999_9999_9",removeNotExistHashCodeCallBack); - console.info("==============ANS_Remove_0700 onConsume remove===================>"); - console.info("==============ANS_Remove_0700 onConsume end===================>"); - } - - function onCancelRemoveNotExistHashCode(data) { - console.info("==============ANS_Remove_0700 onCancel start=======================>"); - console.info("==============ANS_Remove_0700 onCancel data:============>" + JSON.stringify(data)); - expect().assertFail(); - console.info("==============ANS_Remove_0700 onCancel end=======================>"); - } - - function removeNotExistHashCodeCallBack(err) { - console.info("==========ANS_Remove_0700 removeCallBack start==========>"); - console.info("==========ANS_Remove_0700 removeCallBack err=================>" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info("==========ANS_Remove_0700 removeCallBack end=======================>"); - } - - /* - * @tc.number: ANS_Remove_0700 - * @tc.name: remove(hashCode: string, callback: AsyncCallback): void; - * @tc.desc: Verify that the not exist hashCode is used to call the interface - * remove(hashCode: string, callback: AsyncCallback): void - * to delete the notification information - */ - it('ANS_Remove_0700', 0, async function (done) { - console.info("===============ANS_Remove_0700==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveNotExistHashCode, - onCancel:onCancelRemoveNotExistHashCode, - } - await notify.subscribe(subscriber); - console.info("================ANS_Remove_0700 subscribe promise=======>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 7, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0700", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("============ANS_Remove_0700 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_0700 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_0700 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeRemoveNotExistHashCodePromise(data) { - console.info("================ANS_Remove_0800 onConsume start===============>"); - console.info("================ANS_Remove_0800 onConsume data:===============>" + JSON.stringify(data)); - notify.remove("9999_9999_9").then((data)=>{ - console.info("===========ANS_Remove_0800 onConsume remove data:=========>" + JSON.stringify(data)); - }).catch((err)=>{ - console.info("===========ANS_Remove_0800 onConsume remove err:==========>" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info("===========ANS_Remove_0800 onConsume end==================>"); - }); - - } - - function onCancelRemoveNotExistHashCodePromise(data) { - console.info("============ANS_Remove_0800 onCancel start===============>"); - console.info("============ANS_Remove_0800 onCancel data:===============>" + JSON.stringify(data)); - expect().assertFail(); - console.info("============ANS_Remove_0800 onCancel end=================>"); - } - - /* - * @tc.number: ANS_Remove_0800 - * @tc.name: remove(hashCode: string): Promise; - * @tc.desc: Verify that the not exist hashCode is used to call the interface remove(hashCode: string, - * callback: AsyncCallback): void to delete the notification information - */ - it('ANS_Remove_0800', 0, async function (done) { - console.info("===============ANS_Remove_0800==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveNotExistHashCodePromise, - onCancel:onCancelRemoveNotExistHashCodePromise, - } - await notify.subscribe(subscriber); - console.info("================ANS_Remove_0800 subscribe promise=======>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 8, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0800", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("==========ANS_Remove_0800 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_0800 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_0800 setTimeout unsubscribe============>"); - await notify.cancelAll() - done(); - }),timeout); - }) - - function onConsumeRemoveNonComplianceHashCode(data) { - console.info("================ANS_Remove_0900 onConsume start===================>"); - console.info("================ANS_Remove_0900 onConsume data: ==================>" + JSON.stringify(data)); - notify.remove("哈希码",removeNonComplianceHashCallBack); - console.info("================ANS_Remove_0900 onConsume remove==================>"); - console.info("================ANS_Remove_0900 onConsume end=====================>"); - } - - function onCancelRemoveNonComplianceHashCode(data) { - console.info("================ANS_Remove_0900 onCancel start====================>"); - console.info("================ANS_Remove_0900 onCancel data:====================>" + JSON.stringify(data)); - expect().assertFail(); - console.info("================ANS_Remove_0900 onCancel end======================>"); - } - - function removeNonComplianceHashCallBack(err, data) { - console.info("================ANS_Remove_0900 removeCallBack start=======================>"); - console.info("================ANS_Remove_0900 removeCallBack err=================>" + JSON.stringify(err)); - console.info("================ANS_Remove_0900 removeCallBack data=================>" + JSON.stringify(data)); - console.info("================ANS_Remove_0900 removeCallBack end=======================>"); - expect(err.code != 0).assertEqual(true); - } - - /* - * @tc.number: ANS_Remove_0900 - * @tc.name: remove(hashCode: string, callback: AsyncCallback): void; - * @tc.desc: Verify that the non compliance hashCode is used to call the interface remove(hashCode: string, - * callback: AsyncCallback): void to delete the notification information - */ - it('ANS_Remove_0900', 0, async function (done) { - console.info("===============ANS_Remove_0900==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveNonComplianceHashCode, - onCancel:onCancelRemoveNonComplianceHashCode, - } - await notify.subscribe(subscriber); - console.info("============ANS_Remove_0900 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 9, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0900", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("==================ANS_Remove_0900 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_0900 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_0900 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeRemoveNonComplianceHashCodePromise(data) { - console.info("================ANS_Remove_1000 onConsume start===========>"); - console.info("================ANS_Remove_1000 onConsume data:===========>" + JSON.stringify(data)); - notify.remove("哈希码").then((data)=>{ - console.info("===========ANS_Remove_1000 onConsume remove data:===========>" + JSON.stringify(data)); - }).catch((err)=>{ - console.info("===========ANS_Remove_1000 onConsume remove err:===========>" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info("===========ANS_Remove_1000 onConsume end===================>"); - }); - } - - function onCancelRemoveNonComplianceHashCodePromise(data) { - console.info("================ANS_Remove_1000 onCancel start==================>"); - console.info("================ANS_Remove_1000 onCancel data:==================>" + JSON.stringify(data)); - expect().assertFail(); - console.info("================ANS_Remove_1000 onCancel end====================>"); - } - - /* - * @tc.number: ANS_Remove_1000 - * @tc.name: remove(hashCode: string, callback: AsyncCallback): void; - * @tc.desc: Verify that the non compliance hashCode is used to call the interface - remove(hashCode: string, callback: AsyncCallback): void to delete the notification information - */ - it('ANS_Remove_1000', 0, async function (done) { - console.info("===============ANS_Remove_1000==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveNonComplianceHashCodePromise, - onCancel:onCancelRemoveNonComplianceHashCodePromise, - } - await notify.subscribe(subscriber); - console.info("================ANS_Remove_1000 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 10, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1000", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("================ANS_Remove_1000 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_1000 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_1000 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function removeCallBack2TimesOf2(err) { - console.info("=====ANS_Remove_1100 removeCallBack2TimesOf2 start==========>"); - console.info("=====ANS_Remove_1100 removeCallBack2TimesOf2 err============>" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info("=====ANS_Remove_1100 removeCallBack2TimesOf2 end==========>"); - } - function removeCallBack2TimesOf1(err) { - console.info("=====ANS_Remove_1100 removeCallBack2TimesOf1 start============>"); - console.info("=====ANS_Remove_1100 removeCallBack2TimesOf1 err========>" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - notify.remove(hashCode1100,removeCallBack2TimesOf2); - console.info("=====ANS_Remove_1100 removeCallBack2TimesOf1 end============>"); - } - let hashCode1100; - function onConsumeCallbackRemove2Times(data) { - console.info("=====ANS_Remove_1100 onConsume start=================>"); - console.info("=====ANS_Remove_1100 onConsume data: ================>" + JSON.stringify(data)); - hashCode1100 = data.request.hashCode; - notify.remove(data.request.hashCode,removeCallBack2TimesOf1); - console.info("=====ANS_Remove_1100 onConsume remove================>"); - console.info("=====ANS_Remove_1100 onConsume end===================>"); - } - let timesOfOnCancelCallbackRemove2Times - function onCancelCallbackRemove2Times(data) { - timesOfOnCancelCallbackRemove2Times = timesOfOnCancelCallbackRemove2Times + 1 - console.info("=====ANS_Remove_1100 onCancel start=======================>"); - console.info("=====ANS_Remove_1100 onCancel data:=======================>" + JSON.stringify(data)); - if (timesOfOnCancelCallbackRemove2Times == 1){ - expect(data.request.id).assertEqual(11); - } else if (timesOfOnCancelCallbackRemove2Times == 2){ - expect().assertFail(); - } - console.info("=====ANS_Remove_1100 onCancel end=======================>"); - } - - /* - * @tc.number: ANS_Remove_1100 - * @tc.name: remove(hashCode: string, callback: AsyncCallback): void; - * @tc.desc: Verify that the interface remove(hashCode: string, callback: AsyncCallback): void; - is called twice in a row to delete the notification information - */ - it('ANS_Remove_1100', 0, async function (done) { - console.info("===============ANS_Remove_1100==========================>"); - hashCode1100 = 0; - timesOfOnCancelCallbackRemove2Times = 0 - let subscriber ={ - onConsume:onConsumeCallbackRemove2Times, - onCancel:onCancelCallbackRemove2Times, - } - await notify.subscribe(subscriber); - console.info("===============ANS_Remove_1100 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 11, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1100", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("==========ANS_Remove_1100 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_1100 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_1100 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeCallbackRemove2TimesPromise(data) { - console.info("=======ANS_Remove_1200 onConsume start=============>"); - console.info("=======ANS_Remove_1200 onConsume data:=============>" + JSON.stringify(data)); - notify.remove(data.request.hashCode).then(()=>{ - console.info("=======ANS_Remove_1200 onConsume remove_2times1:=======>"); - }).catch((err)=>{ - console.info("=======ANS_Remove_1200 onConsume remove_2times1 err:========>" + JSON.stringify(err)); - expect(err.code == 0).assertEqual(true); - }); - notify.remove(data.request.hashCode).then((data)=>{ - console.info("=======ANS_Remove_1200 onConsume remove_2times2 data:=======>" + JSON.stringify(data)); - }).catch((err)=>{ - console.info("=======ANS_Remove_1200 onConsume remove_2times2 err:========>" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info("================ANS_Remove_1200 onConsume end=================>"); - }); - } - let timesOfOnCancelCallbackRemove2TimesPromise - function onCancelCallbackRemove2TimesPromise(data) { - timesOfOnCancelCallbackRemove2TimesPromise = timesOfOnCancelCallbackRemove2TimesPromise + 1 - console.info("================ANS_Remove_1200 onCancel start=========>"); - console.info("================ANS_Remove_1200 onCancel data:=========>" + JSON.stringify(data)); - if (timesOfOnCancelCallbackRemove2TimesPromise == 1){ - expect(data.request.id).assertEqual(12); - console.info("============ANS_Remove_1200 onCancel id:===========>" + JSON.stringify(data.request.id)); - } else if (timesOfOnCancelCallbackRemove2TimesPromise == 2){ - expect().assertFail(); - } - console.info("================ANS_Remove_1200 onCancel end==============>"); - } - - /* - * @tc.number: ANS_Remove_1200 - * @tc.name: remove(hashCode: string): Promise; - * @tc.desc: Verify that the interface remove(hashCode: string): Promise is called twice in a row to - * delete the notification information - */ - it('ANS_Remove_1200', 0, async function (done) { - console.info("===============ANS_Remove_1200 start========================>"); - timesOfOnCancelCallbackRemove2TimesPromise = 0 - let subscriber ={ - onConsume:onConsumeCallbackRemove2TimesPromise, - onCancel:onCancelCallbackRemove2TimesPromise, - } - await notify.subscribe(subscriber); - console.info("===============ANS_Remove_1200 subscribe promise=============>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 12, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1200", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("============ANS_Remove_1200 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_1200 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_1200 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeRemoveIsUnremovable(data) { - console.info("==========ANS_Remove_1300 onConsume start=================>"); - console.info("==========ANS_Remove_1300 onConsume data:=================>" + JSON.stringify(data)); - notify.remove(data.request.hashCode,removeIsUnremovableCallBack); - console.info("==========ANS_Remove_1300 onConsume remove==============>"); - console.info("==========ANS_Remove_1300 onConsume end=================>"); - } - - function onCancelRemoveIsUnremovable(data) { - console.info("==========ANS_Remove_1300 onCancel start================>"); - console.info("==========ANS_Remove_1300 onCancel data:================>" + JSON.stringify(data)); - console.info("==========ANS_Remove_1300 onCancel end================>"); - } - - function removeIsUnremovableCallBack(err) { - console.info("==========ANS_Remove_1300 removeCallBack start===================>"); - console.info("==========ANS_Remove_1300 removeCallBack err=====================>" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.info("==========ANS_Remove_1300 removeCallBack end=====================>"); - } - - /* - * @tc.number: ANS_Remove_1300 - * @tc.name: remove(hashCode: string, callback: AsyncCallback): void; - * @tc.desc: Verify that the calling interface remove(hashCode: string, callback: AsyncCallback): void; - * deletes the notification information that the property isunremovable is true - */ - it('ANS_Remove_1300', 0, async function (done) { - console.info("===============ANS_Remove_1300==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveIsUnremovable, - onCancel:onCancelRemoveIsUnremovable, - } - await notify.subscribe(subscriber); - console.info("================ANS_Remove_1300 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 13, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1300", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("================ANS_Remove_1300 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_1300 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_1300 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function OnConsumeRemoveIsUnremovablePromise(data) { - console.info("==============ANS_Remove_1400 onConsume start==============>"); - console.info("==============ANS_Remove_1400 onConsume data:==============>" + JSON.stringify(data)); - notify.remove(data.request.hashCode).then((data)=>{ - console.info("=======ANS_Remove_1400 onConsume remove data:=======>" + JSON.stringify(data)); - }).catch((err)=>{ - console.info("=======ANS_Remove_1400 onConsume remove err:========>" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.info("=======ANS_Remove_1400 onConsume end================>"); - }); - } - - function OnCancelRemoveIsUnremovablePromise(data) { - console.info("==============ANS_Remove_1400 onCancel start==============>"); - console.info("==============ANS_Remove_1400 onCancel data:==============>" + JSON.stringify(data)); - console.info("==============ANS_Remove_1400 onCancel end================>"); - } - - /* - * @tc.number: ANS_Remove_1400 - * @tc.name: remove(hashCode: string): Promise; - * @tc.desc: Verify that the calling interface remove(hashCode: string): Promise; - deletes the notification information that the property isunremovable is true - */ - it('ANS_Remove_1400', 0, async function (done) { - console.info("===============ANS_Remove_1400 start==========================>"); - let subscriber ={ - onConsume:OnConsumeRemoveIsUnremovablePromise, - onCancel:OnCancelRemoveIsUnremovablePromise, - } - await notify.subscribe(subscriber); - console.info("===============ANS_Remove_1400 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 14, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1400", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("==============ANS_Remove_1400 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_1400 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_1400 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - let timesOfOnConsumeRemoveAllByBundleOption - function onConsumeRemoveAllByBundleOption(data) { - timesOfOnConsumeRemoveAllByBundleOption = timesOfOnConsumeRemoveAllByBundleOption + 1 - console.info("==========ANS_Remove_1500 onConsume start=======>"); - console.info("==========ANS_Remove_1500 onConsume data:=======>" + JSON.stringify(data)); - let bundleOption = { - bundle:data.request.creatorBundleName, - uid:data.request.creatorUid, - } - if (timesOfOnConsumeRemoveAllByBundleOption == 2){ - notify.removeAll(bundleOption,removeAllByBundleOptionCallBack); - console.info("=======ANS_Remove_1500 onConsume remove=============>"); - } - console.info("===========ANS_Remove_1500 onConsume end===========>"); - } - let timesOfOnCancelRemoveAllByBundleOption - function onCancelRemoveAllByBundleOption(data) { - timesOfOnCancelRemoveAllByBundleOption = timesOfOnCancelRemoveAllByBundleOption + 1 - console.info("===========ANS_Remove_1500 onCancel start====================>"); - console.info("===========ANS_Remove_1500 onCancel data:====================>" + JSON.stringify(data)); - if (timesOfOnCancelRemoveAllByBundleOption == 1){ - expect(data.request.label).assertEqual("1500_1"); - }else if (timesOfOnCancelRemoveAllByBundleOption == 2){ - expect(data.request.label).assertEqual("1500_2"); - } - console.info("===========ANS_Remove_1500 onCancel end=======================>"); - } - function removeAllByBundleOptionCallBack(data) { - console.info("===========ANS_Remove_1500 removeAllCallBack start=================>"); - console.info("===========ANS_Remove_1500 removeAllCallBack data==================>" + JSON.stringify(data)); - console.info("===========ANS_Remove_1500 removeAllCallBack end===================>"); - } - - /* - * @tc.number: ANS_Remove_1500 - * @tc.name: removeAll(bundle: BundleOption, callback: AsyncCallback):void; - * @tc.desc: Verify that the calling interface removeAll(bundle: BundleOption, callback: AsyncCallback):void; - * deletes all notification information through BundleOption - */ - it('ANS_Remove_1500', 0, async function (done) { - console.info("===============ANS_Remove_1500 start==========================>"); - timesOfOnCancelRemoveAllByBundleOption = 0 - timesOfOnConsumeRemoveAllByBundleOption = 0 - let subscriber ={ - onConsume:onConsumeRemoveAllByBundleOption, - onCancel:onCancelRemoveAllByBundleOption, - } - await notify.subscribe(subscriber); - console.info("===============ANS_Remove_1500 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 15, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1500_1", - badgeIconStyle: 1, - showDeliveryTime: true, - } - let notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 15, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1500_2", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("=============ANS_Remove_1500 publish1 promise==================>"); - await notify.publish(notificationRequest1); - console.info("=============ANS_Remove_1500 publish2 promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_1500 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_1500 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - let timesOfOnConsumeRemoveAllByBundleOptionNullUid - function onConsumeRemoveAllByBundleOptionNullUid(data) { - console.info("===============ANS_Remove_1600 onConsume start================>"); - console.info("===============ANS_Remove_1600 onConsume data:========>" + JSON.stringify(data)); - let bundleOption = { - bundle:data.request.creatorBundleName, - uid:0, - } - timesOfOnConsumeRemoveAllByBundleOptionNullUid = timesOfOnConsumeRemoveAllByBundleOptionNullUid + 1 - if (timesOfOnConsumeRemoveAllByBundleOptionNullUid == 2){ - notify.removeAll(bundleOption,removeAllByBundleOptionCallBackNullUid); - console.info("===============ANS_Remove_1600 onConsume remove==================>"); - } - console.info("===============ANS_Remove_1600 onConsume end================>"); - } - function onCancelRemoveAllByBundleOptionNullUid(data) { - console.info("===============ANS_Remove_1600 onCancel start===================>"); - console.info("===============ANS_Remove_1600 onCancel data:===================>" + JSON.stringify(data)); - expect().assertFail(); - console.info("===============ANS_Remove_1600 onCancel end====================>"); - } - function removeAllByBundleOptionCallBackNullUid(err) { - console.info("=========ANS_Remove_1600 removeAllCallBack start=============>"); - console.info("=========ANS_Remove_1600 removeAllCallBack err===============>" + JSON.stringify(err)); - console.info("=========ANS_Remove_1600 removeAllCallBack end===============>"); - } - - /* - * @tc.number: ANS_Remove_1600 - * @tc.name: removeAll(bundle: BundleOption, callback: AsyncCallback):void; - * @tc.desc: Verify that the calling interface removeAll(bundle: BundleOption, callback: AsyncCallback):void; - * deletes all notification information through BundleOption Correct bundle, 0 uid. - */ - it('ANS_Remove_1600', 0, async function (done) { - console.info("===============ANS_Remove_1600==========================>"); - timesOfOnConsumeRemoveAllByBundleOptionNullUid = 0 - let subscriber ={ - onConsume:onConsumeRemoveAllByBundleOptionNullUid, - onCancel:onCancelRemoveAllByBundleOptionNullUid, - } - await notify.subscribe(subscriber); - console.info("==================ANS_Remove_1600 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 16, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1600_1", - badgeIconStyle: 1, - showDeliveryTime: true, - } - let notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 16, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1600_2", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("==================ANS_Remove_1600 publish1 promise==================>"); - await notify.publish(notificationRequest1); - console.info("==================ANS_Remove_1600 publish2 promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_1600 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_1600 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeRemoveAllByBundleOptionWrongUid(data) { - console.info("========ANS_Remove_1700 onConsume start==============>"); - console.info("========ANS_Remove_1700 onConsume data:==============>" + JSON.stringify(data)); - let bundleOption = { - bundle:data.request.creatorBundleName, - uid:123456789 - } - notify.removeAll(bundleOption,removeAllByBundleOptionCallBackWrongUid); - console.info("========ANS_Remove_1700 onConsume remove============>"); - console.info("========ANS_Remove_1700 onConsume end===============>"); - } - function onCancelRemoveAllByBundleOptionWrongUid(data) { - console.info("==========ANS_Remove_1700 onCancel start====================>"); - console.info("==========ANS_Remove_1700 onCancel data:====================>" + JSON.stringify(data)); - expect().assertFail(); - console.info("==========ANS_Remove_1700 onCancel end======================>"); - } - function removeAllByBundleOptionCallBackWrongUid(err) { - console.info("==========ANS_Remove_1700 removeAllCallBack start=============>"); - console.info("==========ANS_Remove_1700 removeAllCallBack err===============>" + JSON.stringify(err)); - console.info("==========ANS_Remove_1700 removeAllCallBack end=======================>"); - } - - /* - * @tc.number: ANS_Remove_1700 - * @tc.name: removeAll(bundle: BundleOption, callback: AsyncCallback):void; - * @tc.desc: Verify that the calling interface removeAll(bundle: BundleOption, callback: AsyncCallback):void; - * deletes all notification information through BundleOption Correct bundle, wrong uid. - */ - it('ANS_Remove_1700', 0, async function (done) { - console.info("===============ANS_Remove_1700==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveAllByBundleOptionWrongUid, - onCancel:onCancelRemoveAllByBundleOptionWrongUid, - } - await notify.subscribe(subscriber); - console.info("=============ANS_Remove_1700 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 17, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1700", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("===============ANS_Remove_1700 publish promise===============>"); - setTimeout((async function(){ - console.info("======ANS_Remove_1700 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_1700 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - - }) - - function onConsumeRemoveAllByBundleOptionWrongBundleCorrectUid(data) { - console.info("==============ANS_Remove_1800 onConsume start=============>"); - console.info("==============ANS_Remove_1800 onConsume data:=============>" + JSON.stringify(data)); - let bundleOption = { - bundle:"wrongBundleName", - uid:data.request.creatorUid, - } - notify.removeAll(bundleOption,removeAllByBundleOptionCallBackWrongBundleCorrectUid); - console.info("==============ANS_Remove_1800 onConsume remove=============>"); - console.info("==============ANS_Remove_1800 onConsume end================>"); - } - function onCancelremoveAllByBundleOptionwrongBundleCorrectUid(data) { - console.info("==============ANS_Remove_1800 onCancel start===============>"); - console.info("==============ANS_Remove_1800 onCancel data:===============>" + JSON.stringify(data)); - expect().assertFail(); - console.info("==============ANS_Remove_1800 onCancel end===============>"); - } - function removeAllByBundleOptionCallBackWrongBundleCorrectUid(err, data) { - console.info("=========ANS_Remove_1800 removeAllCallBack start==========>"); - console.info("=========ANS_Remove_1800 removeAllCallBack err============>" + JSON.stringify(err)); - console.info("=========ANS_Remove_1800 removeAllCallBack end==========>"); - } - - /* - * @tc.number: ANS_Remove_1800 - * @tc.name: removeAll(bundle: BundleOption, callback: AsyncCallback):void; - * @tc.desc: Verify that the calling interface removeAll(bundle: BundleOption, callback: AsyncCallback):void; - * deletes all notification information through BundleOption wrong bundle, correct uid. - */ - it('ANS_Remove_1800', 0, async function (done) { - console.info("===============ANS_Remove_1800 start==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveAllByBundleOptionWrongBundleCorrectUid, - onCancel:onCancelremoveAllByBundleOptionwrongBundleCorrectUid, - } - await notify.subscribe(subscriber); - console.info("================ANS_Remove_1800 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 18, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1800", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("============ANS_Remove_1800 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_1800 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_1800 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeRemoveAllByBundleOptionNullCharacterBundleCorrectUid(data) { - console.info("===========ANS_Remove_1900 onConsume start===============>"); - console.info("===========ANS_Remove_1900 onConsume data:===============>" + JSON.stringify(data)); - let bundleOption = { - bundle:"", - uid:data.request.creatorUid, - } - notify.removeAll(bundleOption,removeAllByBundleOptionCallBackNullCharacterBundleCorrectUid); - console.info("===========ANS_Remove_1900 onConsume removeAll===========>"); - console.info("===========ANS_Remove_1900 onConsume end=================>"); - } - function onCancelRemoveAllByBundleOptionNullCharacterBundleCorrectUid(data) { - console.info("===========ANS_Remove_1900 onCancel start===========>"); - console.info("===========ANS_Remove_1900 onCancel data:==========>" + JSON.stringify(data)); - expect().assertFail(); - console.info("===========ANS_Remove_1900 onCancel end===========>"); - } - function removeAllByBundleOptionCallBackNullCharacterBundleCorrectUid(err) { - console.info("========ANS_Remove_1900 removeAllCallback start===========>"); - console.info("========ANS_Remove_1900 removeAllCallback err=============>" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info("========ANS_Remove_1900 removeAllCallback end=============>"); - } - - /* - * @tc.number: ANS_Remove_1900 - * @tc.name: removeAll(bundle: BundleOption, callback: AsyncCallback):void; - * @tc.desc: Verify that the calling interface removeAll(bundle: BundleOption, callback: AsyncCallback):void; - * deletes all notification information through BundleOption null character bundle, correct uid. - */ - it('ANS_Remove_1900', 0, async function (done) { - console.info("===============ANS_Remove_1900 start==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveAllByBundleOptionNullCharacterBundleCorrectUid, - onCancel:onCancelRemoveAllByBundleOptionNullCharacterBundleCorrectUid, - } - await notify.subscribe(subscriber); - console.info("===============ANS_Remove_1900 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 19, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1900", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("===============ANS_Remove_1900 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_1900 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_1900 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeRemoveAllByBundleOptionWrongBundleWrongUid(data) { - console.info("============ANS_Remove_2000 onConsume start================>"); - console.info("============ANS_Remove_2000 onConsume data:================>" + JSON.stringify(data)); - let bundleOption = { - bundle:"wrongBundleName", - uid:123456789, - } - notify.removeAll(bundleOption,removeAllByBundleOptionCallBackWrongBundleWrongUid); - console.info("============ANS_Remove_2000 onConsume remove================>"); - console.info("============ANS_Remove_2000 onConsume end===================>"); - } - function onCancelRemoveAllByBundleOptionWrongBundleWrongUid(data) { - console.info("============ANS_Remove_2000 onCancel start=================>"); - console.info("============ANS_Remove_2000 onCancel data:=================>" + JSON.stringify(data)); - expect().assertFail(); - console.info("============ANS_Remove_2000 onCancel end==============>"); - } - function removeAllByBundleOptionCallBackWrongBundleWrongUid(err) { - console.info("============ANS_Remove_2000 removeAllCallBack start============>"); - console.info("============ANS_Remove_2000 removeAllCallBack err==============>" + JSON.stringify(err)); - console.info("============ANS_Remove_2000 removeAllCallBack end=============>"); - } - - /* - * @tc.number: ANS_Remove_2000 - * @tc.name: removeAll(bundle: BundleOption, callback: AsyncCallback):void; - * @tc.desc: Verify that the calling interface removeAll(bundle: BundleOption, callback: AsyncCallback):void; - * deletes all notification information through BundleOption wrong bundle, wrong uid. - */ - it('ANS_Remove_2000', 0, async function (done) { - console.info("===============ANS_Remove_2000 start==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveAllByBundleOptionWrongBundleWrongUid, - onCancel:onCancelRemoveAllByBundleOptionWrongBundleWrongUid, - } - await notify.subscribe(subscriber); - console.info("==============ANS_Remove_2000 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 20, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "2000", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("==============ANS_Remove_2000 publish promise==============>"); - setTimeout((async function(){ - console.info("======ANS_Remove_2000 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_2000 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeRemoveAllByBundleOptionNullCharacterBundleWrongUid(data) { - console.info("=========ANS_Remove_2100 onConsume start===================>"); - console.info("=========ANS_Remove_2100 onConsume data:======>" + JSON.stringify(data)); - let bundleOption = { - bundle:"", - uid:123456789, - } - notify.removeAll(bundleOption,removeAllByBundleOptionCallBackNullCharacterBundleWrongUid); - console.info("=========ANS_Remove_2100 onConsume remove===================>"); - console.info("=========ANS_Remove_2100 onConsume end===================>"); - } - function onCancelRemoveAllByBundleOptionNullCharacterBundleWrongUid(data) { - console.info("=========ANS_Remove_2100 onCancel start==========>"); - console.info("=========ANS_Remove_2100 onCancel data:==========>" + JSON.stringify(data)); - expect().assertFail(); - console.info("=========ANS_Remove_2100 onCancel end============>"); - } - function removeAllByBundleOptionCallBackNullCharacterBundleWrongUid(err) { - console.info("=========ANS_Remove_2100 removeAllCallBack start===============>"); - console.info("=========ANS_Remove_2100 err=========>" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info("=========ANS_Remove_2100 removeAllCallBack end===============>"); - } - - /* - * @tc.number: ANS_Remove_2100 - * @tc.name: removeAll(bundle: BundleOption, callback: AsyncCallback):void; - * @tc.desc: Verify that the calling interface removeAll(bundle: BundleOption, callback: AsyncCallback):void; - * deletes all notification information through BundleOption null character bundle, wrong uid. - */ - it('ANS_Remove_2100', 0, async function (done) { - console.info("===============ANS_Remove_2100 start==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveAllByBundleOptionNullCharacterBundleWrongUid, - onCancel:onCancelRemoveAllByBundleOptionNullCharacterBundleWrongUid, - } - await notify.subscribe(subscriber); - console.info("============ANS_Remove_2100 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 21, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "2100", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("=========ANS_Remove_2100 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_2100 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_2100 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeRemoveAllByBundleOptionIsUnremovable(data) { - console.info("==========ANS_Remove_2200 onConsume start==================>"); - console.info("==========ANS_Remove_2200 onConsume data:=================>" + JSON.stringify(data)); - let bundleOption = { - bundle:data.request.creatorBundleName, - uid:data.request.creatorUid, - } - notify.removeAll(bundleOption,removeAllByBundleOptionCallBackIsUnremovable); - console.info("==========ANS_Remove_2200 onConsume removeAll==================>"); - console.info("==========ANS_Remove_2200 onConsume end==================>"); - } - function onCancelRemoveAllByBundleOptionIsUnremovable(data) { - console.info("==========ANS_Remove_2200 onCancel start=================>"); - console.info("==========ANS_Remove_2200 onCancel data:=================>" + JSON.stringify(data)); - expect().assertFail(); - console.info("==========ANS_Remove_2200 onCancel end===================>"); - } - function removeAllByBundleOptionCallBackIsUnremovable(err) { - console.info("==========ANS_Remove_2200 removeAllCallBack start==========>"); - console.info("==========ANS_Remove_2200 removeAllCallBack err============>" + JSON.stringify(err)); - console.info("==========ANS_Remove_2200 removeAllCallBack end============>"); - } - - /* - * @tc.number: ANS_Remove_2200 - * @tc.name: removeAll(bundle: BundleOption, callback: AsyncCallback):void; - * @tc.desc: Verify that the removeAll(bundle: BundleOption, callback: AsyncCallback):void - interface is called to delete the notification information whose attribute isUnremovable is true - */ - it('ANS_Remove_2200', 0, async function (done) { - console.info("===============ANS_Remove_2200 start==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveAllByBundleOptionIsUnremovable, - onCancel:onCancelRemoveAllByBundleOptionIsUnremovable, - } - await notify.subscribe(subscriber); - console.info("==============ANS_Remove_2200 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 22, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "2200", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("=============ANS_Remove_2200 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_2200 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_2200 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function removeAllCallBack(err,data) { - console.info("================ANS_Remove_2300 removeAllCallBack start:========>"); - console.info("================ANS_Remove_2300 removeAllCallBack err:==========>" + JSON.stringify(err)); - console.info("================ANS_Remove_2300 removeAllCallBack data:=========>" + JSON.stringify(data)); - console.info("================ANS_Remove_2300 removeAllCallBack end:==========>") - } - let timesOfOnConsumeRemoveAll - function onConsumeRemoveAll(data) { - timesOfOnConsumeRemoveAll = timesOfOnConsumeRemoveAll + 1 - console.info("================ANS_Remove_2300 onConsume start==================>"); - console.info("================ANS_Remove_2300 onConsume data: =================>" + JSON.stringify(data)); - if (timesOfOnConsumeRemoveAll == 2) - { - notify.removeAll(removeAllCallBack); - console.info("============ANS_Remove_2300 onConsume removeAll==========>"); - } - console.info("================ANS_Remove_2300 onConsume end====================>"); - } - let timesOfOnCancelRemoveAll - function onCancelRemoveAll(data) { - timesOfOnCancelRemoveAll = timesOfOnCancelRemoveAll + 1 - console.info("==================ANS_Remove_2300 onCancel start===========>"); - console.info("==================ANS_Remove_2300 onCancel data============>" + JSON.stringify(data)); - if (timesOfOnCancelRemoveAll == 1) - { - expect(data.request.label).assertEqual("2300_1"); - } - if (timesOfOnCancelRemoveAll == 2) - { - expect(data.request.label).assertEqual("2300_2"); - } - console.info("==================ANS_Remove_2300 onCancel end=============>"); - } - - /* - * @tc.number: ANS_Remove_2300 - * @tc.name: removeAll(callback: AsyncCallback): void; - * @tc.desc: Verify that the removeAll(callback: AsyncCallback): void interface is called to delete the - * notification information - */ - it('ANS_Remove_2300', 0, async function (done) { - console.info("===============ANS_Remove_2300 start==========================>"); - timesOfOnConsumeRemoveAll = 0; - timesOfOnCancelRemoveAll = 0; - let subscriber ={ - onConsume:onConsumeRemoveAll, - onCancel:onCancelRemoveAll, - } - await notify.subscribe(subscriber); - console.info("=============ANS_Remove_2300 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 23, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "2300_1", - badgeIconStyle: 1, - showDeliveryTime: true, - } - let notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 23, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "2300_2", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("===========ANS_Remove_2300 publish1 promise================>"); - await notify.publish(notificationRequest1); - console.info("============ANS_Remove_2300 publish2 promise===============>"); - setTimeout((async function(){ - console.info("======ANS_Remove_2300 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_2300 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeRemoveAllPromise(data) { - timesOfOnConsumeRemoveAll = timesOfOnConsumeRemoveAll + 1 - console.info("===========ANS_Remove_2400 onConsume start==============>"); - console.info("===========ANS_Remove_2400 onConsume data:==============>" + JSON.stringify(data)); - if (timesOfOnConsumeRemoveAll == 2) - { - notify.removeAll(); - console.info("===========ANS_Remove_2400 onConsume removeAll==========>"); - } - console.info("===========ANS_Remove_2400 onConsume end==============>"); - } - - function onCancelRemoveAllPromise(data) { - timesOfOnCancelRemoveAll = timesOfOnCancelRemoveAll + 1 - console.info("===========ANS_Remove_2400 onCancel start=======================>"); - console.info("===========ANS_Remove_2400 onCancel data : =============>" + JSON.stringify(data)); - if (timesOfOnCancelRemoveAll == 1) - { - expect(data.request.label).assertEqual("2400_1"); - } - if (timesOfOnCancelRemoveAll == 2) - { - expect(data.request.label).assertEqual("2400_2"); - } - console.info("===========ANS_Remove_2400 onCancel end=======================>"); - } - - /* - * @tc.number: ANS_Remove_2400 - * @tc.name: removeAll(bundle?: BundleOption): Promise - * @tc.desc: Verify that the removeAll(bundle?: BundleOption): Promise interface is called to delete the - * notification information - */ - it('ANS_Remove_2400', 0, async function (done) { - console.info("===============ANS_Remove_2400 start==========================>"); - timesOfOnConsumeRemoveAll = 0 - timesOfOnCancelRemoveAll = 0 - let subscriber ={ - onConsume:onConsumeRemoveAllPromise, - onCancel:onCancelRemoveAllPromise, - } - await notify.subscribe(subscriber); - console.info("==============ANS_Remove_2400 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 24, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "2400_1", - badgeIconStyle: 1, - showDeliveryTime: true, - } - let notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 24, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "2400_2", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("===ANS_Remove_2400 publish1 promise============>"); - await notify.publish(notificationRequest1); - console.info("===ANS_Remove_2400 publish2 promise============>"); - setTimeout((async function(){ - console.info("======ANS_Remove_2400 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_2400 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function removeAllCallBackIsUnremovable(err,data) { - console.info("=========ANS_Remove_2500 removeAllCallBack start=========>"); - console.info("=========ANS_Remove_2500 removeAllCallBack err:==========>" + JSON.stringify(err)); - console.info("=========ANS_Remove_2500 removeAllCallBack data:=========>" + JSON.stringify(data)); - console.info("=========ANS_Remove_2500 removeAllCallBack end===========>"); - } - function onConsumeRemoveAllIsUnremovable(data) { - console.info("=========ANS_Remove_2500 onConsume start===========>"); - console.info("=========ANS_Remove_2500 onConsumedata:============>" + JSON.stringify(data)); - notify.removeAll(removeAllCallBackIsUnremovable); - console.info("=========ANS_Remove_2500 onConsume removeAll=======>"); - console.info("=========ANS_Remove_2500 onConsume end=============>"); - } - function onCancelCallbackRemoveAllIsUnremovable(data) { - expect().assertFail(); - console.info("=========ANS_Remove_2500 onCancel start==============>"); - console.info("=========ANS_Remove_2500 onCancel data:==============>" + JSON.stringify(data)); - console.info("=========ANS_Remove_2500 onCancel end================>"); - } - - /* - * @tc.number: ANS_Remove_2500 - * @tc.name: removeAll(callback: AsyncCallback): void; - * @tc.desc: Verify that the removeAll(callback: AsyncCallback): void interface is called to delete the - * notification information whose attribute isUnremovable is true - */ - it('ANS_Remove_2500', 0, async function (done) { - console.info("===============ANS_Remove_2500 start==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveAllIsUnremovable, - onCancel:onCancelCallbackRemoveAllIsUnremovable, - } - await notify.subscribe(subscriber); - console.info("======ANS_Remove_2500 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 25, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "2500", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("============ANS_Remove_2500 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_2500 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_2500 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function OnConsumeRemoveAllIsUnremovablePromise(data) { - console.info("===========ANS_Remove_2600 onConsume start===========>"); - console.info("===========ANS_Remove_2600 onConsume data============>" + JSON.stringify(data)); - notify.removeAll() - console.info("===========ANS_Remove_2600 onConsume removeAll=======>"); - console.info("===========ANS_Remove_2600 onConsume end=============>"); - } - function OnCancelCallbackRemoveAllIsUnremovablePromise(data) { - console.info("===========ANS_Remove_2600 onCancel start================>"); - console.info("===========ANS_Remove_2600 onCancel data : ==============>" + JSON.stringify(data)); - console.info("===========ANS_Remove_2600 onCancel end==================>"); - } - - /* - * @tc.number: ANS_Remove_2600 - * @tc.name: removeAll(bundle?: BundleOption): Promise; - * @tc.desc: Verify that the removeAll(bundle?: BundleOption): Promise interface is called to delete the - * notification information whose attribute isUnremovable is true - */ - it('ANS_Remove_2600', 0, async function (done) { - console.info("===============ANS_Remove_2600 start==========================>"); - let subscriber ={ - onConsume:OnConsumeRemoveAllIsUnremovablePromise, - onCancel:OnCancelCallbackRemoveAllIsUnremovablePromise, - } - await notify.subscribe(subscriber); - console.info("============ANS_Remove_2600 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 26, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "2600", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("==========ANS_Remove_2600 publish promise==============>"); - setTimeout((async function(){ - console.info("======ANS_Remove_2600 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_2600 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function removeAllCallBack2TimesOf2(err) { - console.info("=======ANS_Remove_2700 removeAllCallBack2TimesOf2 start===========>"); - console.info("=======ANS_Remove_2700 removeAllCallBack2TimesOf2 err=============>" + JSON.stringify(err)); - console.info("=======ANS_Remove_2700 removeAllCallBack2TimesOf2 end=============>"); - } - function removeAllCallBack2TimesOf1(err) { - console.info("=======ANS_Remove_2700 removeAllCallBack2TimesOf1 start==========>"); - console.info("=======ANS_Remove_2700 removeAllCallBack2TimesOf1 err============>" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - notify.removeAll(removeAllCallBack2TimesOf2); - console.info("=======ANS_Remove_2700 removeAllCallBack2TimesOf1 removeAll=====>"); - console.info("=======ANS_Remove_2700 removeAllCallBack2TimesOf1 end==========>"); - } - function onConsumeRemoveAll2Times(data) { - console.info("=======ANS_Remove_2700 onConsume start=========>"); - console.info("=======ANS_Remove_2700 onConsume data:=========>" + JSON.stringify(data)); - notify.removeAll(removeAllCallBack2TimesOf1); - console.info("=======ANS_Remove_2700 onConsume remove========>"); - console.info("=======ANS_Remove_2700 onConsume end===========>"); - } - let timesOfOnCancelCallbackRemoveAll2Times - function onCancelRemoveAll2Times(data) { - timesOfOnCancelCallbackRemoveAll2Times = timesOfOnCancelCallbackRemoveAll2Times + 1 - console.info("=======ANS_Remove_2700 onCancel start============>"); - console.info("=======ANS_Remove_2700 onCancel data:============>" + JSON.stringify(data)); - if (timesOfOnCancelCallbackRemoveAll2Times == 1){ - expect(data.request.id).assertEqual(27); - console.info("=======ANS_Remove_2700 onCancel id============>"); - } else if (timesOfOnCancelCallbackRemoveAll2Times == 2){ - expect().assertFail(); - } - console.info("=======ANS_Remove_2700 onCancel end============>"); - } - - /* - * @tc.number: ANS_Remove_2700 - * @tc.name: remove(hashCode: string, callback: AsyncCallback): void; - * @tc.desc: Verify that the interface remove(hashCode: string, callback: AsyncCallback): void; is called - * twice in a row to delete the notification information - */ - it('ANS_Remove_2700', 0, async function (done) { - console.info("===============ANS_Remove_2700 start==========================>"); - timesOfOnCancelCallbackRemoveAll2Times = 0 - let subscriber ={ - onConsume:onConsumeRemoveAll2Times, - onCancel:onCancelRemoveAll2Times, - } - await notify.subscribe(subscriber); - console.info("============ANS_Remove_2700 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 27, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "2700", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("=========ANS_Remove_2700 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_2700 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_2700 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeCallbackRemoveAll2TimesPromise(data) { - console.info("=============ANS_Remove_2800 onConsume start=============>"); - console.info("=============ANS_Remove_2800 onConsume data: =======================>" + JSON.stringify(data)); - notify.removeAll(); - console.info("=============ANS_Remove_2800 onConsume removeAll1=======================>"); - notify.removeAll(); - console.info("=============ANS_Remove_2800 onConsume removeAll2=======================>"); - console.info("=============ANS_Remove_2800 onConsume end=============>"); - } - let timesOfOnCancelCallbackRemoveAll2TimesPromise - function onCancelCallbackRemoveAll2TimesPromise(data) { - timesOfOnCancelCallbackRemoveAll2TimesPromise = timesOfOnCancelCallbackRemoveAll2TimesPromise + 1 - console.info("===================ANS_Remove_2800 onCancel start=======================>"); - console.info("===================ANS_Remove_2800 onCancel data : ========>" + JSON.stringify(data)); - if (timesOfOnCancelCallbackRemoveAll2TimesPromise == 1){ - expect(data.request.id).assertEqual(28); - } else if (timesOfOnCancelCallbackRemoveAll2TimesPromise == 2){ - expect().assertFail(); - } - console.info("===================ANS_Remove_2800 onCancel end=======================>"); - } - - /* - * @tc.number: ANS_Remove_2800 - * @tc.name: removeAll(bundle?: BundleOption): Promise; - * @tc.desc: Verify that the interface removeAll(bundle?: BundleOption): Promise; is called twice in a row - * to delete the notification information - */ - it('ANS_Remove_2800', 0, async function (done) { - console.info("===============ANS_Remove_2800 start==========================>"); - timesOfOnCancelCallbackRemoveAll2TimesPromise = 0 - let subscriber ={ - onConsume:onConsumeCallbackRemoveAll2TimesPromise, - onCancel:onCancelCallbackRemoveAll2TimesPromise, - } - await notify.subscribe(subscriber); - console.info("================ANS_Remove_2800 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 28, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "2800", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("================ANS_Remove_2800 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_2800 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_2800 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeRemoveByNotificationKey(data) { - console.info("=======ANS_Remove_2900 onConsume start=======================>"); - console.info("=======ANS_Remove_2900 onConsume data: =======================>" + JSON.stringify(data)); - console.info("=======ANS_Remove_2900 onConsume creatorBundleName:====>" + data.request.creatorBundleName); - console.info("=======ANS_Remove_2900 onConsume creatorUid:==============>" + data.request.creatorUid); - console.info("=======ANS_Remove_2900 onConsume id: =======================>" + data.request.id); - console.info("=======ANS_Remove_2900 onConsume label: =======================>" + data.request.label); - let bundleOption = { - bundle:data.request.creatorBundleName, - uid:data.request.creatorUid, - } - let notificationKey = { - id:data.request.id, - label:data.request.label - } - notify.remove(bundleOption,notificationKey,removeByNotificationKeyCB); - console.info("=============ANS_Remove_2900 onConsume remove=======================>"); - console.info("=============ANS_Remove_2900 onConsume end=======================>"); - } - function onCancelRemoveByNotificationKey(data) { - console.info("=============ANS_Remove_2900 onCancel start================>"); - console.info("=============ANS_Remove_2900 onCancel data:==========>" + JSON.stringify(data)); - expect(data.request.label).assertEqual("2900"); - console.info("=============ANS_Remove_2900 onCancel label:==========>" + JSON.stringify(data.request.label)); - expect(data.request.id).assertEqual(29); - console.info("=============ANS_Remove_2900 onCancel id:==========>" + JSON.stringify(data.request.id)); - console.info("=============ANS_Remove_2900 onCancel end================>"); - } - function removeByNotificationKeyCB(err, data) { - console.info("==========ANS_Remove_2900 removeCalback start============>"); - console.info("==========ANS_Remove_2900 removeCalback err==============>" + JSON.stringify(err)); - console.info("==========ANS_Remove_2900 removeCalback data=============>" + JSON.stringify(data)); - console.info("==========ANS_Remove_2900 removeCalback end============>"); - } - - /* - * @tc.number: ANS_Remove_2900 - * @tc.name: remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCallback): void; - * @tc.desc: Verify that the calling interface remove(bundle: BundleOption, notificationKey: NotificationKey, - * callback: AsyncCallback): void; deletes notification information through BundleOption and - * NotificationKey - */ - it('ANS_Remove_2900', 0, async function (done) { - console.info("===============ANS_Remove_2900 start==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveByNotificationKey, - onCancel:onCancelRemoveByNotificationKey, - } - await notify.subscribe(subscriber); - console.info("================ANS_Remove_2900 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 29, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "2900", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("==============ANS_Remove_2900 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_2900 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_2900 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeRemoveByNotificationKeyPromise(data) { - console.info("==========ANS_Remove_3000 onConsume start==============>"); - console.info("==========ANS_Remove_3000 data: =======================>" + JSON.stringify(data)); - let bundleOption = { - bundle:data.request.creatorBundleName, - uid:data.request.creatorUid, - } - let notificationKey = { - id:30, - label:"3000" - } - notify.remove(bundleOption,notificationKey) - console.info("==========ANS_Remove_3000 onConsume remove==============>"); - console.info("==========ANS_Remove_3000 onConsume end=================>"); - } - function onCancelRemoveByNotificationKeyPromise(data) { - console.info("========ANS_Remove_3000 onCancel start========>"); - console.info("========ANS_Remove_3000 onCancel data:========>" + JSON.stringify(data)); - expect(data.request.label).assertEqual("3000"); - expect(data.request.id).assertEqual(30); - console.info("========ANS_Remove_3000 onCancel end==========>"); - } - - /* - * @tc.number: ANS_Remove_3000 - * @tc.name: remove(bundle: BundleOption, notificationKey: NotificationKey): Promise; - * @tc.desc: Verify that the calling interface - remove(bundle: BundleOption, notificationKey: NotificationKey): Promise - deletes notification information through BundleOption and NotificationKey - */ - it('ANS_Remove_3000', 0, async function (done) { - console.info("===============ANS_Remove_3000 start==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveByNotificationKeyPromise, - onCancel:onCancelRemoveByNotificationKeyPromise, - } - await notify.subscribe(subscriber); - console.info("===============ANS_Remove_3000 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 30, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "3000", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("=============ANS_Remove_3000 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_3000 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_3000 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeRemoveByNotificationKeyWrongKey(data) { - console.info("==========ANS_Remove_3100 onConsume start=============>"); - console.info("==========ANS_Remove_3100 onConsume data:=============>" + JSON.stringify(data)); - let bundleOption = { - bundle:data.request.creatorBundleName, - uid:data.request.creatorUid, - } - let notificationKey = { - id:0, - label:"wrongLabel" - } - notify.remove(bundleOption,notificationKey,removeByNotificationKeyCBWrongKey); - console.info("==========ANS_Remove_3100 onConsume remove==========>"); - console.info("==========ANS_Remove_3100 onConsume end=============>"); - } - function onCancelRemoveByNotificationKeyWrongKey(data) { - console.info("==========ANS_Remove_3100 onCancel start===========>"); - console.info("==========ANS_Remove_3100 onCancel data:===========>" + JSON.stringify(data)); - expect().assertFail(); - console.info("==========ANS_Remove_3100 onCancel end===========>"); -} - function removeByNotificationKeyCBWrongKey(err, data) { - console.info("==========ANS_Remove_3100 removeCallback start===========>"); - console.info("==========ANS_Remove_3100 removeCallback err=============>" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info("==========ANS_Remove_3100 removeCallback data============>" + JSON.stringify(data)); - console.info("==========ANS_Remove_3100 removeCallback end===========>"); - } - - /* - * @tc.number: ANS_Remove_3100 - * @tc.name: remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCallback): void; - * @tc.desc: Verify that the calling interface remove(bundle: BundleOption, notificationKey: NotificationKey, - * callback: AsyncCallback): void; deletes notification information through BundleOption and - * NotificationKey correct bundleOption,wrong notificationKey. - */ - it('ANS_Remove_3100', 0, async function (done) { - console.info("===============ANS_Remove_3100 start==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveByNotificationKeyWrongKey, - onCancel:onCancelRemoveByNotificationKeyWrongKey, - } - await notify.subscribe(subscriber); - console.info("==============ANS_Remove_3100 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 31, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "3100", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("=============ANS_Remove_3100 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_3100 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_3100 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeRemoveByNotificationKeyWrongKeyPromise(data) { - console.info("===========ANS_Remove_3200 onConsume start===============>"); - console.info("===========ANS_Remove_3200 onConsume data:===============>" + JSON.stringify(data)); - let bundleOption = { - bundle:data.request.creatorBundleName, - uid:data.request.creatorUid, - } - let notificationKey = { - id:0, - label:"wrongLabel" - } - notify.remove(bundleOption, notificationKey).then((data)=>{ - console.info("=======ANS_Remove_3200 onConsume remove data:=======>" + JSON.stringify(data)); - }).catch((err)=>{ - console.info("=======ANS_Remove_3200 onConsume remove err:========>" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - }); - console.info("===========ANS_Remove_3200 onConsume remove============>"); - console.info("===========ANS_Remove_3200 onConsume end===============>"); - } - function onCancelRemoveByNotificationKeyWrongKeyPromise(data) { - console.info("===========ANS_Remove_3200 onCancel start=================>"); - console.info("===========ANS_Remove_3200 onCanceldata:==================>" + JSON.stringify(data)); - expect().assertFail(); - console.info("===========ANS_Remove_3200 onCancel end=================>"); - } - - /* - * @tc.number: ANS_Remove_3200 - * @tc.name: remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCallback): void; - * @tc.desc: Verify that the calling interface remove(bundle: BundleOption, notificationKey: NotificationKey): - * Promise deletes notification information through BundleOption and NotificationKey correct - * bundleOption,wrong notificationKey. - */ - it('ANS_Remove_3200', 0, async function (done) { - console.info("===============ANS_Remove_3200 start=================>"); - let subscriber ={ - onConsume:onConsumeRemoveByNotificationKeyWrongKeyPromise, - onCancel:onCancelRemoveByNotificationKeyWrongKeyPromise, - } - await notify.subscribe(subscriber); - console.info("===============ANS_Remove_3200 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 32, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "3200", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("===========ANS_Remove_3200 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_3200 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_3200 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function OnConsumeRemoveByNotificationKeyWrongBundle(data) { - console.info("==============ANS_Remove_3300 onConsume start===============>"); - console.info("==============ANS_Remove_3300 onConsume data:===============>" + JSON.stringify(data)); - let bundleOption = { - bundle:"wrongBundleName", - uid:0, - } - let notificationKey = { - id:33, - label:"3300" - } - notify.remove(bundleOption,notificationKey,removeByNotificationKeyCBWrongBundle); - console.info("==============ANS_Remove_3300 onConsume remove===============>"); - console.info("==============ANS_Remove_3300 onConsume end==================>"); - } - function OnCancelRemoveByNotificationKeyWrongBundle(data) { - console.info("==============ANS_Remove_3300 onCancel start=============>"); - console.info("==============ANS_Remove_3300 onCancel data:===========>" + JSON.stringify(data)); - expect().assertFail(); - console.info("==============ANS_Remove_3300 onCancel end=============>"); - } - function removeByNotificationKeyCBWrongBundle(err, data) { - console.info("===========ANS_Remove_3300 removeCallback start==========>"); - console.info("===========ANS_Remove_3300 removeCallback err============>" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info("===========ANS_Remove_3300 removeCallback data===========>" + JSON.stringify(data)); - console.info("===========ANS_Remove_3300 removeCallback end============>"); - } - - /* - * @tc.number: ANS_Remove_3300 - * @tc.name: remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCallback): void; - * @tc.desc: Verify that the calling interface remove(bundle: BundleOption, notificationKey: NotificationKey, - * callback: AsyncCallback): void; deletes notification information through BundleOption and - * NotificationKey wrong bundleOption,correct notificationKey. - */ - it('ANS_Remove_3300', 0, async function (done) { - console.info("===============ANS_Remove_3300 start==========================>"); - let subscriber ={ - onConsume:OnConsumeRemoveByNotificationKeyWrongBundle, - onCancel:OnCancelRemoveByNotificationKeyWrongBundle, - } - await notify.subscribe(subscriber); - console.info("================ANS_Remove_3300 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 33, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "3300", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("================ANS_Remove_3300 publish promise=================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_3300 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_3300 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeRemoveByNotificationKeyWrongBundlePromise(data) { - console.info("===========ANS_Remove_3400 onConsume start============>"); - console.info("===========ANS_Remove_3400 onConsume data:============>" + JSON.stringify(data)); - let bundleOption = { - bundle:"wrongBundleName", - uid:0, - } - let notificationKey = { - id:34, - label:"3400" - } - notify.remove(bundleOption, notificationKey).then((data)=>{ - console.info("=======ANS_Remove_3400 onConsume remove data:=======>" + JSON.stringify(data)); - }).catch((err)=>{ - console.info("=======ANS_Remove_3400 onConsume remove err:========>" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - }); - console.info("===========ANS_Remove_3400 onConsume remove=========>"); - console.info("===========ANS_Remove_3400 onConsume end============>"); - } - function onCancelRemoveByNotificationKeyWrongBundlePromise(data) { - console.info("===========ANS_Remove_3400 onCancel start=============>"); - console.info("===========ANS_Remove_3400 onCancel data: ============>" + JSON.stringify(data)); - expect().assertFail(); - console.info("===========ANS_Remove_3400 onCancel end===============>"); - } - - /* - * @tc.number: ANS_Remove_3400 - * @tc.name: remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCallback): void; - * @tc.desc: Verify that the calling interface remove(bundle: BundleOption, notificationKey: NotificationKey): - * Promise deletes notification information through BundleOption and NotificationKey correct - * bundleOption,wrong notificationKey. - */ - it('ANS_Remove_3400', 0, async function (done) { - console.info("===============ANS_Remove_3400 start==========================>"); - let subscriber ={ - onConsume:onConsumeRemoveByNotificationKeyWrongBundlePromise, - onCancel:onCancelRemoveByNotificationKeyWrongBundlePromise, - } - await notify.subscribe(subscriber); - console.info("============ANS_Remove_3400 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 34, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "3400", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("============ANS_Remove_3400 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_3400 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_3400 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function removeByNotificationKey2Times2CB(err,data) { - console.info("==========ANS_Remove_3500 removeCallback2Times2 start============>"); - console.info("==========ANS_Remove_3500 removeCallback2Times2 err==============>" + JSON.stringify(err)); - console.info("==========ANS_Remove_3500 removeCallback2Times2 data============>" + JSON.stringify(data)); - expect(err.code != 0).assertEqual(true); - console.info("==========ANS_Remove_3500 removeCallback2Times2 end================>"); - } - function removeByNotificationKey2Times1CB(err,data) { - console.info("==========ANS_Remove_3500 removeCallback2Times1 start===========>"); - console.info("==========ANS_Remove_3500 removeCallback2Times1 err=============>" + JSON.stringify(err)); - console.info("==========ANS_Remove_3500 removeCallback2Times1 data============>" + JSON.stringify(data)); - expect(err.code).assertEqual(0); - console.info("==========ANS_Remove_3500 removeCallback2Times1 end==============>"); - } - function onConsumeRemoveByNotificationKey2Times(data) { - console.info("=========ANS_Remove_3500 onConsume start=======================>"); - console.info("=========ANS_Remove_3500 onConsume data:=========>" + JSON.stringify(data)); - let bundleOption = { - bundle:data.request.creatorBundleName, - uid:data.request.creatorUid, - } - let notificationKey = { - id:35, - label:"3500" - } - notify.remove(bundleOption,notificationKey,removeByNotificationKey2Times1CB); - notify.remove(bundleOption,notificationKey,removeByNotificationKey2Times2CB); - console.info("=========ANS_Remove_3500 onConsume remove==============>"); - console.info("=========ANS_Remove_3500 onConsume end=================>"); - } - let timesOfOnCancelRemoveByNotificationKey2Times - function onCancelRemoveByNotificationKey2Times(data) { - timesOfOnCancelRemoveByNotificationKey2Times = timesOfOnCancelRemoveByNotificationKey2Times + 1 - console.info("=========ANS_Remove_3500 onCancel start===============>"); - console.info("=========ANS_Remove_3500 onCancel data : ========>" + JSON.stringify(data)); - if (timesOfOnCancelRemoveByNotificationKey2Times == 1){ - expect(data.request.id).assertEqual(35); - expect(data.request.label).assertEqual("3500"); - } else if (timesOfOnCancelRemoveByNotificationKey2Times == 2){ - expect().assertFail(); - } - console.info("=========ANS_Remove_3500 onCancel end=======================>"); - } - - /* - * @tc.number: ANS_Remove_3500 - * @tc.name: remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCallback): void; - * @tc.desc: Verify that the interface remove(bundle: BundleOption, notificationKey: NotificationKey, callback: - * AsyncCallback): void; void; is called twice in a row to delete the notification information - */ - it('ANS_Remove_3500', 0, async function (done) { - console.info("===============ANS_Remove_3500 start==========================>"); - timesOfOnCancelRemoveByNotificationKey2Times = 0 - let subscriber ={ - onConsume:onConsumeRemoveByNotificationKey2Times, - onCancel:onCancelRemoveByNotificationKey2Times, - } - await notify.subscribe(subscriber); - console.info("===========ANS_Remove_3500 subscribe promise==================>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 35, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "3500", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("============ANS_Remove_3500 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_3500 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_3500 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) - - function onConsumeRemoveByNotificationKey2TimesPromise(data) { - console.info("=========ANS_Remove_3600 onConsume start===========>"); - console.info("=========ANS_Remove_3600 onConsume data: =======================>" + JSON.stringify(data)); - let bundleOption = { - bundle:data.request.creatorBundleName, - uid:data.request.creatorUid, - } - let notificationKey = { - id:36, - label:"3600" - } - notify.remove(bundleOption, notificationKey) - console.info("=========ANS_Remove_3600 onConsume remove1===========>"); - notify.remove(bundleOption, notificationKey).then((data)=>{ - console.info("=======ANS_Remove_3600 onConsume remove2 data:=======>" + JSON.stringify(data)); - }).catch((err)=>{ - console.info("=======ANS_Remove_3600 onConsume remove2 err:========>" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info("=========ANS_Remove_3600 onConsume end===========>"); - }); - } - let timesOnCancelcbRemoveByKey2TimesPromise - function onCancelRemoveByNotificationKey2TimesPromise(data) { - timesOnCancelcbRemoveByKey2TimesPromise = timesOnCancelcbRemoveByKey2TimesPromise + 1 - console.info("=========ANS_Remove_3600 onCancel start=============>"); - console.info("=========ANS_Remove_3600 onCancel data:=============>" + JSON.stringify(data)); - if (timesOnCancelcbRemoveByKey2TimesPromise == 1){ - expect(data.request.id).assertEqual(36); - expect(data.request.label).assertEqual("3600"); - } else if (timesOnCancelcbRemoveByKey2TimesPromise == 2){ - expect().assertFail(); - } - console.info("=========ANS_Remove_3600 onCancel end=============>"); - } - - /* - * @tc.number: ANS_Remove_3600 - * @tc.name: remove(bundle: BundleOption, notificationKey: NotificationKey): Promise; - * @tc.desc: Verify that the interface remove(bundle: BundleOption, notificationKey: NotificationKey): - * Promise is called twice in a row to delete the notification information - */ - it('ANS_Remove_3600', 0, async function (done) { - console.info("===============ANS_Remove_3600 start==========================>"); - timesOnCancelcbRemoveByKey2TimesPromise = 0 - timesOnCancelcbRemoveByKey2TimesPromise = 0 - let subscriber ={ - onConsume:onConsumeRemoveByNotificationKey2TimesPromise, - onCancel:onCancelRemoveByNotificationKey2TimesPromise, - } - await notify.subscribe(subscriber); - console.info("========ANS_Remove_3600 subscribe promise=============>"); - let notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 36, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "3600", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("============ANS_Remove_3600 publish promise==================>"); - setTimeout((async function(){ - console.info("======ANS_Remove_3600 setTimeout============>"); - await notify.unsubscribe(subscriber); - console.info("======ANS_Remove_3600 setTimeout unsubscribe============>"); - await notify.cancelAll(); - done(); - }),timeout); - }) -}) } diff --git a/notification/ans_standard/actsansnotificationremove/src/main/js/test/List.test.js b/notification/ans_standard/actsansnotificationremove/src/main/js/test/List.test.js deleted file mode 100644 index ac1477d357d82a2d1561b66debd52bde24316ee9..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* -* 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 ActsAnsNotificationRemove from './ActsAnsNotificationRemove.test.js' -export default function testsuite() { -ActsAnsNotificationRemove() -} diff --git a/notification/ans_standard/actsansnotificationremove/src/main/resources/base/element/string.json b/notification/ans_standard/actsansnotificationremove/src/main/resources/base/element/string.json deleted file mode 100644 index d2bf15e3967e3f9ee2cc637fbbbb1f80ed6b3f51..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansnotificationremove/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "MyApplication" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/actsansslottest/BUILD.gn b/notification/ans_standard/actsansslottest/BUILD.gn deleted file mode 100644 index a30e1a942d6509e6972bec7a76a9304ea3382f27..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/BUILD.gn +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//test/xts/tools/build/suite.gni") - -group("ActsAnsSlotTest") { - testonly = true - if (is_standard_system) { - deps = [ - "actsansgetslotWithoutadd:ActsAnsGetSlotWithoutAddTest", - "actsansgetslottestcallback:ActsAnsGetSlotTestCallbackTest", - "actsansgetslottestpromise:ActsAnsGetSlotTestPromiseTest", - "actsansremoveslottest:ActsAnsRemoveSlotTest", - "actsansremoveslotwithoutadd:ActsAnsRemoveSlotWithoutAddTest", - - #"actsansslotbybundle:ActsAnsSlotByBundleTest", - #"actsansaddslotsystem:ActsAnsAddSlotSystemTest", - #"actsansslotsystemcallback:ActsAnsSlotSystemCallbackTest", - #"actsansslotsystempromise:ActsAnsSlotSystemPromiseTest", - #"actsansslottaddremoveall:ActsAnsSlotAddRemoveAllTest", - ] - } -} diff --git a/notification/ans_standard/actsansslottest/actsansaddslotsystem/BUILD.gn b/notification/ans_standard/actsansslottest/actsansaddslotsystem/BUILD.gn deleted file mode 100644 index a06dca840a62a3f38fd7e224ae7ca270f57b0bf0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsAddSlotSystemTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsAddSlotSystemTest" - 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/actsansslottest/actsansaddslotsystem/Test.json b/notification/ans_standard/actsansslottest/actsansaddslotsystem/Test.json deleted file mode 100644 index b8fa7368c7a5e4ff49909277fe545b40d7e36fef..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "com.example.actsansaddslotsystem", - "package-name": "com.example.actsansaddslotsystem" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsAddSlotSystemTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansaddslotsystem/signature/openharmony_sx.p7b b/notification/ans_standard/actsansslottest/actsansaddslotsystem/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/actsansslottest/actsansaddslotsystem/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/config.json b/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/config.json deleted file mode 100644 index ea585470ff6d36a8a94abc6766caddaadbc9bbfb..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansaddslotsystem", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansaddslotsystem", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/MainAbility/app.js b/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/actsansslottest/actsansaddslotsystem/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index cc183ba6f171c0a02e11f8a2eecdf4247d8c8bc2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - {{title}} - -
diff --git a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index f0ebbb56e9c9e2005c19b0e217bbc45c02128396..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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: "测试addSlot(slot: NotificationSlot)接口" - }, - onInit() { - this.title = "测试addSlot(slot: NotificationSlot)接口"; - }, - onShow() { - console.info('onShow finish') - }, - onReady() { - }, -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestAbility/app.js b/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/actsansslottest/actsansaddslotsystem/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/actsansslottest/actsansaddslotsystem/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/actsansslottest/actsansaddslotsystem/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index 5d0258ca1a74182ee4e59c8158385613263d2964..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,483 +0,0 @@ -/* - * 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' - -const TIMEOUT = 2000; -export default function ActsAnsAddSlotSystem() { -describe('ActsAnsAddSlotSystem', function () { - - /* - * @tc.number : ActsAnsAddSlotSystem_0100 - * @tc.name : addSlot notification - * @tc.desc : Get the added SOCIAL_COMMUNICATION type slot - */ - it('ActsAnsAddSlotSystem_0100', 0, async function (done) { - console.debug("====>ActsAnsAddSlotSystem_0100 start====>"); - function getSlotCallback(err, data) { - console.debug("====>ActsAnsAddSlotSystem_0100 enter====>"); - console.debug("====>getSlot 0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlot 0100 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION); - expect(data.level).assertEqual(notification.SlotLevel.LEVEL_NONE); - expect(data.desc).assertEqual("slot_SOCIAL_COMMUNICATION_desc"); - expect(data.badgeFlag).assertEqual(false); - expect(data.bypassDnd).assertEqual(true); - expect(data.vibrationEnabled).assertEqual(true); - expect(data.sound).assertEqual("slot_SOCIAL_COMMUNICATION_sound"); - expect(data.lightEnabled).assertEqual(true); - expect(data.lightColor).assertEqual(1); - notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{ - console.debug("====>removeSlot ActsAnsAddSlotSystem_0100 err====>" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - done(); - }) - } - console.debug("====>addSlot SOCIAL_COMMUNICATION====>"); - notification.addSlot( - { - type: notification.SlotType.SOCIAL_COMMUNICATION, - level: notification.SlotLevel.LEVEL_NONE, - desc: "slot_SOCIAL_COMMUNICATION_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_SOCIAL_COMMUNICATION_sound", - lightEnabled: true, - lightColor: 1 - }, - (err)=>{ - console.debug("====>addSlot SOCIAL_COMMUNICATION callback====>"); - expect(err.code).assertEqual(0); - console.debug("====>getSlot SlotType.SOCIAL_COMMUNICATION====>"); - notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION, getSlotCallback); - }) - setTimeout(function(){ - console.debug("====>time out ActsAnsAddSlotSystem_0100====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsAddSlotSystem_0200 - * @tc.name : addSlot notification - * @tc.desc : Get the added SERVICE_INFORMATION type slot - */ - it('ActsAnsAddSlotSystem_0200', 0, async function (done) { - console.debug("====>ActsAnsAddSlotSystem_0200 start====>"); - function getSlotCallback(err, data) { - console.debug("====>ActsAnsAddSlotSystem_0200 enter====>"); - console.debug("====>getSlot 0200 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlot 0200 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.SERVICE_INFORMATION); - expect(data.level).assertEqual(notification.SlotLevel.LEVEL_MIN); - expect(data.desc).assertEqual("slot_SERVICE_INFORMATION_desc"); - expect(data.badgeFlag).assertEqual(false); - expect(data.bypassDnd).assertEqual(true); - expect(data.vibrationEnabled).assertEqual(true); - expect(data.sound).assertEqual("slot_SERVICE_INFORMATION_sound"); - expect(data.lightEnabled).assertEqual(true); - expect(data.lightColor).assertEqual(2); - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>removeSlot ActsAnsAddSlotSystem_0200 err====>" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - done(); - }) - } - console.debug("====>addSlot SERVICE_INFORMATION====>"); - notification.addSlot( - { - type: notification.SlotType.SERVICE_INFORMATION, - level: notification.SlotLevel.LEVEL_MIN, - desc: "slot_SERVICE_INFORMATION_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_SERVICE_INFORMATION_sound", - lightEnabled: true, - lightColor: 2 - }, - (err)=>{ - console.debug("====>addSlot SERVICE_INFORMATION callback====>"); - expect(err.code).assertEqual(0); - console.debug("====>getSlot SlotType.SERVICE_INFORMATION====>"); - notification.getSlot(notification.SlotType.SERVICE_INFORMATION, getSlotCallback); - }) - setTimeout(function(){ - console.debug("====>time out ActsAnsAddSlotSystem_0200====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsAddSlotSystem_0300 - * @tc.name : addSlot notification - * @tc.desc : Get the added CONTENT_INFORMATION type slot - */ - it('ActsAnsAddSlotSystem_0300', 0, async function (done) { - console.debug("====>ActsAnsAddSlotSystem_0300 start====>"); - function getSlotCallback(err, data) { - console.debug("====>ActsAnsAddSlotSystem_0300 enter====>"); - console.debug("====>getSlot 0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlot 0300 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.CONTENT_INFORMATION); - expect(data.level).assertEqual(notification.SlotLevel.LEVEL_LOW); - expect(data.desc).assertEqual("slot_CONTENT_INFORMATION_desc"); - expect(data.badgeFlag).assertEqual(false); - expect(data.bypassDnd).assertEqual(true); - expect(data.vibrationEnabled).assertEqual(true); - expect(data.sound).assertEqual("slot_CONTENT_INFORMATION_sound"); - expect(data.lightEnabled).assertEqual(true); - expect(data.lightColor).assertEqual(3); - notification.removeSlot(notification.SlotType.CONTENT_INFORMATION, (err)=>{ - console.debug("====>removeSlot ActsAnsAddSlotSystem_0300 err====>" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - done(); - }) - } - console.debug("====>addSlot CONTENT_INFORMATION====>"); - notification.addSlot( - { - type: notification.SlotType.CONTENT_INFORMATION, - level: notification.SlotLevel.LEVEL_LOW, - desc: "slot_CONTENT_INFORMATION_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_CONTENT_INFORMATION_sound", - lightEnabled: true, - lightColor: 3 - }, - (err)=>{ - console.debug("====>addSlot CONTENT_INFORMATION callback====>"); - expect(err.code).assertEqual(0); - console.debug("====>getSlot SlotType.CONTENT_INFORMATION====>"); - notification.getSlot(notification.SlotType.CONTENT_INFORMATION, getSlotCallback); - }) - setTimeout(function(){ - console.debug("====>time out ActsAnsAddSlotSystem_0300====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsAddSlotSystem_0400 - * @tc.name : addSlot notification - * @tc.desc : Get the added OTHER_TYPES type slot - */ - it('ActsAnsAddSlotSystem_0400', 0, async function (done) { - console.debug("====>ActsAnsAddSlotSystem_0400 start====>"); - function getSlotCallback(err, data) { - console.debug("====>ActsAnsAddSlotSystem_0400 enter====>"); - console.debug("====>getSlot 0400 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlot 0400 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.OTHER_TYPES); - expect(data.level).assertEqual(notification.SlotLevel.LEVEL_DEFAULT); - expect(data.desc).assertEqual("slot_OTHER_TYPES_desc"); - expect(data.badgeFlag).assertEqual(false); - expect(data.bypassDnd).assertEqual(true); - expect(data.vibrationEnabled).assertEqual(true); - expect(data.sound).assertEqual("slot_OTHER_TYPES_sound"); - expect(data.lightEnabled).assertEqual(true); - expect(data.lightColor).assertEqual(4); - notification.removeSlot(notification.SlotType.OTHER_TYPES, (err)=>{ - console.debug("====>removeSlot ActsAnsAddSlotSystem_0400 err====>" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - done(); - }) - } - console.debug("====>addSlot OTHER_TYPES====>"); - notification.addSlot( - { - type: notification.SlotType.OTHER_TYPES, - level: notification.SlotLevel.LEVEL_DEFAULT, - desc: "slot_OTHER_TYPES_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_OTHER_TYPES_sound", - lightEnabled: true, - lightColor: 4 - }, - (err)=>{ - console.debug("====>addSlot OTHER_TYPES callback====>"); - expect(err.code).assertEqual(0); - notification.getSlot(notification.SlotType.OTHER_TYPES, getSlotCallback); - }) - console.debug("====>getSlot SlotType.OTHER_TYPES====>"); - - setTimeout(function(){ - console.debug("====>time out ActsAnsAddSlotSystem_0400====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsAddSlotSystem_0500 - * @tc.name : addSlot notification - * @tc.desc : Get the added UNKNOWN_TYPE type slot - */ - it('ActsAnsAddSlotSystem_0500', 0, async function (done) { - console.debug("====>ActsAnsAddSlotSystem_0500 start====>"); - function getSlotCallback(err, data) { - console.debug("====>ActsAnsAddSlotSystem_0500 enter====>"); - console.debug("====>getSlot 0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlot 0500 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.OTHER_TYPES); - expect(data.level).assertEqual(notification.SlotLevel.LEVEL_DEFAULT); - expect(data.desc).assertEqual("slot_OTHER_TYPES_desc"); - expect(data.badgeFlag).assertEqual(false); - expect(data.bypassDnd).assertEqual(true); - expect(data.vibrationEnabled).assertEqual(true); - expect(data.sound).assertEqual("slot_OTHER_TYPES_sound"); - expect(data.lightEnabled).assertEqual(true); - expect(data.lightColor).assertEqual(4); - notification.removeSlot(notification.SlotType.OTHER_TYPES, (err)=>{ - console.debug("====>removeSlot ActsAnsAddSlotSystem_0500 err====>" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - done(); - }) - } - console.debug("====>addSlot UNKNOWN_TYPE====>"); - await notification.addSlot( - { - type: notification.SlotType.UNKNOWN_TYPE, - level: notification.SlotLevel.LEVEL_DEFAULT, - desc: "slot_OTHER_TYPES_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_OTHER_TYPES_sound", - lightEnabled: true, - lightColor: 4 - }, - (err)=>{ - console.debug("====>addSlot UNKNOWN_TYPE callback====>"); - expect(err.code).assertEqual(0); - console.debug("====>getSlot SlotType.UNKNOWN_TYPE====>"); - notification.getSlot(notification.SlotType.UNKNOWN_TYPE, getSlotCallback); - }) - setTimeout(function(){ - console.debug("====>time out ActsAnsAddSlotSystem_0500====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsAddSlotSystem_0600 - * @tc.name : addSlot notification promise - * @tc.desc : Get the added SOCIAL_COMMUNICATION type slot - */ - it('ActsAnsAddSlotSystem_0600', 0, async function (done) { - console.debug("====>ActsAnsAddSlotSystem_0600 start====>"); - console.debug("====>addSlot SOCIAL_COMMUNICATION====>"); - await notification.addSlot( - { - type: notification.SlotType.SOCIAL_COMMUNICATION, - level: notification.SlotLevel.LEVEL_NONE, - desc: "slot_SOCIAL_COMMUNICATION_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_SOCIAL_COMMUNICATION_sound", - lightEnabled: true, - lightColor: 1 - }); - console.debug("====>getSlot SlotType.SOCIAL_COMMUNICATION====>"); - var data = await notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION); - console.debug("====>getSlot 0600 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION); - expect(data.level).assertEqual(notification.SlotLevel.LEVEL_NONE); - expect(data.desc).assertEqual("slot_SOCIAL_COMMUNICATION_desc"); - expect(data.badgeFlag).assertEqual(false); - expect(data.bypassDnd).assertEqual(true); - expect(data.vibrationEnabled).assertEqual(true); - expect(data.sound).assertEqual("slot_SOCIAL_COMMUNICATION_sound"); - expect(data.lightEnabled).assertEqual(true); - expect(data.lightColor).assertEqual(1); - console.debug("====>removeSlot ActsAnsAddSlotSystem_0600 start====>"); - await notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION); - console.debug("====>ActsAnsAddSlotSystem_0600 end====>"); - done(); - setTimeout(function(){ - console.debug("====>time out ActsAnsAddSlotSystem_0600====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsAddSlotSystem_0700 - * @tc.name : addSlot notification promise - * @tc.desc : Get the added SERVICE_INFORMATION type slot - */ - it('ActsAnsAddSlotSystem_0700', 0, async function (done) { - console.debug("====>ActsAnsAddSlotSystem_0700 start====>"); - console.debug("====>addSlot SERVICE_INFORMATION====>"); - await notification.addSlot( - { - type: notification.SlotType.SERVICE_INFORMATION, - level: notification.SlotLevel.LEVEL_MIN, - desc: "slot_SERVICE_INFORMATION_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_SERVICE_INFORMATION_sound", - lightEnabled: true, - lightColor: 2 - }); - console.debug("====>getSlot SlotType.SERVICE_INFORMATION====>"); - var data = await notification.getSlot(notification.SlotType.SERVICE_INFORMATION); - console.debug("====>getSlot 0700 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.SERVICE_INFORMATION); - expect(data.level).assertEqual(notification.SlotLevel.LEVEL_MIN); - expect(data.desc).assertEqual("slot_SERVICE_INFORMATION_desc"); - expect(data.badgeFlag).assertEqual(false); - expect(data.bypassDnd).assertEqual(true); - expect(data.vibrationEnabled).assertEqual(true); - expect(data.sound).assertEqual("slot_SERVICE_INFORMATION_sound"); - expect(data.lightEnabled).assertEqual(true); - expect(data.lightColor).assertEqual(2); - console.debug("====>removeSlot ActsAnsAddSlotSystem_0700 start====>"); - await notification.removeSlot(notification.SlotType.SERVICE_INFORMATION); - console.debug("====>ActsAnsAddSlotSystem_0700 end====>"); - done(); - setTimeout(function(){ - console.debug("====>time out ActsAnsAddSlotSystem_0700====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsAddSlotSystem_0800 - * @tc.name : addSlot notification promise - * @tc.desc : Get the added CONTENT_INFORMATION type slot - */ - it('ActsAnsAddSlotSystem_0800', 0, async function (done) { - console.debug("====>ActsAnsAddSlotSystem_0800 start====>"); - console.debug("====>addSlot CONTENT_INFORMATION====>"); - await notification.addSlot( - { - type: notification.SlotType.CONTENT_INFORMATION, - level: notification.SlotLevel.LEVEL_LOW, - desc: "slot_CONTENT_INFORMATION_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_CONTENT_INFORMATION_sound", - lightEnabled: true, - lightColor: 3 - }); - console.debug("====>getSlot SlotType.CONTENT_INFORMATION====>"); - var data = await notification.getSlot(notification.SlotType.CONTENT_INFORMATION); - console.debug("====>getSlot 0800 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.CONTENT_INFORMATION); - expect(data.level).assertEqual(notification.SlotLevel.LEVEL_LOW); - expect(data.desc).assertEqual("slot_CONTENT_INFORMATION_desc"); - expect(data.badgeFlag).assertEqual(false); - expect(data.bypassDnd).assertEqual(true); - expect(data.vibrationEnabled).assertEqual(true); - expect(data.sound).assertEqual("slot_CONTENT_INFORMATION_sound"); - expect(data.lightEnabled).assertEqual(true); - expect(data.lightColor).assertEqual(3); - console.debug("====>removeSlot ActsAnsAddSlotSystem_0800 start====>"); - await notification.removeSlot(notification.SlotType.CONTENT_INFORMATION); - console.debug("====>ActsAnsAddSlotSystem_0800 end====>"); - done(); - setTimeout(function(){ - console.debug("====>time out ActsAnsAddSlotSystem_0800====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsAddSlotSystem_0900 - * @tc.name : addSlot notification promise - * @tc.desc : Get the added OTHER_TYPES type slot - */ - it('ActsAnsAddSlotSystem_0900', 0, async function (done) { - console.debug("====>ActsAnsAddSlotSystem_0900 start====>"); - console.debug("====>addSlot OTHER_TYPES====>"); - await notification.addSlot( - { - type: notification.SlotType.OTHER_TYPES, - level: notification.SlotLevel.LEVEL_DEFAULT, - desc: "slot_OTHER_TYPES_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_OTHER_TYPES_sound", - lightEnabled: true, - lightColor: 4 - }) - console.debug("====>getSlot SlotType.OTHER_TYPES====>"); - var data = await notification.getSlot(notification.SlotType.OTHER_TYPES); - console.debug("====>getSlot 0900 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.OTHER_TYPES); - expect(data.level).assertEqual(notification.SlotLevel.LEVEL_DEFAULT); - expect(data.desc).assertEqual("slot_OTHER_TYPES_desc"); - expect(data.badgeFlag).assertEqual(false); - expect(data.bypassDnd).assertEqual(true); - expect(data.vibrationEnabled).assertEqual(true); - expect(data.sound).assertEqual("slot_OTHER_TYPES_sound"); - expect(data.lightEnabled).assertEqual(true); - expect(data.lightColor).assertEqual(4); - console.debug("====>removeSlot ActsAnsAddSlotSystem_0900 start====>"); - await notification.removeSlot(notification.SlotType.OTHER_TYPES); - console.debug("====>ActsAnsAddSlotSystem_0900 end====>"); - done(); - setTimeout(function(){ - console.debug("====>time out ActsAnsAddSlotSystem_0900====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsAddSlotSystem_1000 - * @tc.name : addSlot notification promise - * @tc.desc : Get the added UNKNOWN_TYPE type slot - */ - it('ActsAnsAddSlotSystem_1000', 0, async function (done) { - console.debug("====>ActsAnsAddSlotSystem_1000 start====>"); - console.debug("====>addSlot UNKNOWN_TYPE====>"); - await notification.addSlot( - { - type: notification.SlotType.UNKNOWN_TYPE, - level: notification.SlotLevel.LEVEL_DEFAULT, - desc: "slot_OTHER_TYPES_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_OTHER_TYPES_sound", - lightEnabled: true, - lightColor: 4 - }); - console.debug("====>getSlot SlotType.UNKNOWN_TYPE====>"); - var data = await notification.getSlot(notification.SlotType.UNKNOWN_TYPE); - console.debug("====>getSlot enter====>"); - console.debug("====>getSlot data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.OTHER_TYPES); - expect(data.level).assertEqual(notification.SlotLevel.LEVEL_DEFAULT); - expect(data.desc).assertEqual("slot_OTHER_TYPES_desc"); - expect(data.badgeFlag).assertEqual(false); - expect(data.bypassDnd).assertEqual(true); - expect(data.vibrationEnabled).assertEqual(true); - expect(data.sound).assertEqual("slot_OTHER_TYPES_sound"); - expect(data.lightEnabled).assertEqual(true); - expect(data.lightColor).assertEqual(4); - console.debug("====>removeSlot ActsAnsAddSlotSystem_1000 start====>"); - await notification.removeSlot(notification.SlotType.OTHER_TYPES); - console.debug("====>ActsAnsAddSlotSystem_1000 end====>"); - done(); - setTimeout(function(){ - console.debug("====>time out ActsAnsAddSlotSystem_1000====>"); - }, TIMEOUT); - }) -}) } diff --git a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/test/List.test.js b/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/test/List.test.js deleted file mode 100644 index dc2da888b55e094987a37fd8fecf5909adbc0041..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsAddSlotSystem from './ExampleJsunit.test.js' -export default function testsuite() { -ActsAnsAddSlotSystem() -} diff --git a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/resources/base/element/string.json b/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/resources/base/element/string.json deleted file mode 100644 index 2dcfb5308faba77d2fb41377affca465e5ae746b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansaddslotsystem/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ActsAnsSlotSystemCallback" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/BUILD.gn b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/BUILD.gn deleted file mode 100644 index c75be1431bc9169d344e36f74dd6bbc1d75f9e3f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsGetSlotWithoutAddTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsGetSlotWithoutAddTest" - 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/actsansslottest/actsansgetslotWithoutadd/Test.json b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/Test.json deleted file mode 100644 index 4bd5e35be15bc0260521d127be6ac4261cceb950..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "com.example.actsansgetslotwithoutadd", - "package-name": "com.example.actsansgetslotwithoutadd" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsGetSlotWithoutAddTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/signature/openharmony_sx.p7b b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/config.json b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/config.json deleted file mode 100644 index 2c4127306e13cdda6b029dd49c86856868b14c98..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansgetslotwithoutadd", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansgetslotwithoutadd", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/MainAbility/app.js b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/actsansslottest/actsansgetslotWithoutadd/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 95b3afa04dd4bba8c34ad3086534adb6c28cfa3c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - {{title}} - -
diff --git a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index cc130bfa4ce4e63743bfec03df97c79f1429cbae..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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: "测试GetSlot接口" - }, - onInit() { - this.title = "测试GetSlot接口"; - }, - onShow() { - console.info('onShow finish') - }, - onReady() { - }, -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestAbility/app.js b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/actsansslottest/actsansgetslotWithoutadd/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index 93e108c6661199416c02c88aee71374071dce108..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,241 +0,0 @@ -/* - * 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' - -const TIMEOUT = 2000; -export default function ActsAnsGetSlotWithoutAdd() { -describe('ActsAnsGetSlotWithoutAdd', function () { - - /* - * @tc.number : ActsAnsGetSlotWithoutAdd_0100 - * @tc.name : getSlot by type callback - * @tc.desc : Get the SOCIAL_COMMUNICATION type slot without adding - */ - it('ActsAnsGetSlotWithoutAdd_0100', 0, async function (done) { - console.debug("====>ActsAnsGetSlotWithoutAdd_0100 start====>"); - function getSlotCallback(err, data) { - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0100 enter====>"); - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0100 err:" + JSON.stringify(err)); - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0100 data:" + JSON.stringify(data)); - expect(err.code != 0).assertEqual(true); - done(); - } - console.debug("====>getSlot callback SlotType.SOCIAL_COMMUNICATION====>"); - await notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION, getSlotCallback); - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotWithoutAdd_0100====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsGetSlotWithoutAdd_0200 - * @tc.name : getSlot by type callback - * @tc.desc : Get the SERVICE_INFORMATION type slot without adding - */ - it('ActsAnsGetSlotWithoutAdd_0200', 0, async function (done) { - console.debug("====>ActsAnsGetSlotWithoutAdd_0200 start====>"); - function getSlotCallback(err, data) { - console.debug("====>ActsAnsGetSlotWithoutAdd_0200 enter====>"); - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0200 err:" + JSON.stringify(err)); - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0200 data:" + JSON.stringify(data)); - expect(err.code != 0).assertEqual(true); - done(); - } - console.debug("====>getSlot callback SlotType.SERVICE_INFORMATION====>"); - await notification.getSlot(notification.SlotType.SERVICE_INFORMATION, getSlotCallback); - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotWithoutAdd_0200====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsGetSlotWithoutAdd_0300 - * @tc.name : getSlot by type callback - * @tc.desc : Get the CONTENT_INFORMATION type slot without adding - */ - it('ActsAnsGetSlotWithoutAdd_0300', 0, async function (done) { - console.debug("====>ActsAnsGetSlotWithoutAdd_0300 start====>"); - function getSlotCallback(err, data) { - console.debug("====>ActsAnsGetSlotWithoutAdd_0300 enter====>"); - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0300 err:" + JSON.stringify(err)); - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0300 data:" + JSON.stringify(data)); - expect(err.code != 0).assertEqual(true); - done(); - } - console.debug("====>getSlot callback SlotType.CONTENT_INFORMATION====>"); - await notification.getSlot(notification.SlotType.CONTENT_INFORMATION, getSlotCallback); - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotWithoutAdd_0300====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsGetSlotWithoutAdd_0400 - * @tc.name : getSlot by type callback - * @tc.desc : Get the OTHER_TYPES type slot without adding - */ - it('ActsAnsGetSlotWithoutAdd_0400', 0, async function (done) { - console.debug("====>ActsAnsGetSlotWithoutAdd_0400 start====>"); - function getSlotCallback(err, data) { - console.debug("====>ActsAnsGetSlotWithoutAdd_0400 enter====>"); - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0400 err:" + JSON.stringify(err)); - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0400 data:" + JSON.stringify(data)); - expect(err.code != 0).assertEqual(true); - done(); - } - console.debug("====>getSlot callback SlotType.OTHER_TYPES====>"); - await notification.getSlot(notification.SlotType.OTHER_TYPES, getSlotCallback); - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotWithoutAdd_0400====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsGetSlotWithoutAdd_0500 - * @tc.name : getSlot by type callback - * @tc.desc : Get the UNKNOWN_TYPE type slot without adding - */ - it('ActsAnsGetSlotWithoutAdd_0500', 0, async function (done) { - console.debug("====>ActsAnsGetSlotWithoutAdd_0500 start====>"); - function getSlotCallback(err, data) { - console.debug("====>ActsAnsGetSlotWithoutAdd_0500 enter====>"); - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0500 err:" + JSON.stringify(err)); - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0500 data:" + JSON.stringify(data)); - expect(err.code != 0).assertEqual(true); - done(); - } - console.debug("====>getSlot callback SlotType.UNKNOWN_TYPE====>"); - await notification.getSlot(notification.SlotType.UNKNOWN_TYPE, getSlotCallback); - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotWithoutAdd_0500====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsGetSlotWithoutAdd_0600 - * @tc.name : getSlot by type promise - * @tc.desc : Get the SOCIAL_COMMUNICATION type slot without adding - */ - it('ActsAnsGetSlotWithoutAdd_0600', 0, async function (done) { - console.debug("====>ActsAnsGetSlotWithoutAdd_0600 start====>"); - console.debug("====>getSlot SlotType.SOCIAL_COMMUNICATION====>"); - notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION).then((data)=>{ - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0600 enter====>"); - expect().assertFail(); - done(); - }).catch((err)=>{ - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0600 err:" + JSON.stringify(err)); - console.debug("====>ActsAnsGetSlotWithoutAdd_0600 end====>"); - expect(err.code != 0).assertEqual(true); - done(); - }) - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotWithoutAdd_0600====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsGetSlotWithoutAdd_0700 - * @tc.name : getSlot by type promise - * @tc.desc : Get the SERVICE_INFORMATION type slot without adding - */ - it('ActsAnsGetSlotWithoutAdd_0700', 0, async function (done) { - console.debug("====>ActsAnsGetSlotWithoutAdd_0700 start====>"); - console.debug("====>getSlot SlotType.SERVICE_INFORMATION====>"); - notification.getSlot(notification.SlotType.SERVICE_INFORMATION).then((data)=>{ - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0700 enter====>"); - expect().assertFail(); - done(); - }).catch((err)=>{ - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0700 err:" + JSON.stringify(err)); - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0700 end====>"); - expect(err.code != 0).assertEqual(true); - done(); - }) - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotWithoutAdd_0700====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsGetSlotWithoutAdd_0800 - * @tc.name : getSlot by type promise - * @tc.desc : Get the UNKNOWN_TYPE type slot without adding - */ - it('ActsAnsGetSlotWithoutAdd_0800', 0, async function (done) { - console.debug("====>ActsAnsGetSlotWithoutAdd_0800 start====>"); - console.debug("====>getSlot SlotType.UNKNOWN_TYPE====>"); - notification.getSlot(notification.SlotType.UNKNOWN_TYPE).then((data)=>{ - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0800 enter====>"); - expect().assertFail(); - done(); - }).catch((err)=>{ - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0800 err:" + JSON.stringify(err)); - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0800 end====>"); - expect(err.code != 0).assertEqual(true); - done(); - }) - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotWithoutAdd_0800====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsGetSlotWithoutAdd_0900 - * @tc.name : getSlot by type promise - * @tc.desc : Get the OTHER_TYPES type slot without adding - */ - it('ActsAnsGetSlotWithoutAdd_0900', 0, async function (done) { - console.debug("====>ActsAnsGetSlotWithoutAdd_0900 start====>"); - console.debug("====>getSlot SlotType.OTHER_TYPES====>"); - notification.getSlot(notification.SlotType.OTHER_TYPES).then((data)=>{ - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0900 enter====>"); - expect().assertFail(); - done(); - }).catch((err)=>{ - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0900 err:" + JSON.stringify(err)); - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_0900 end====>"); - expect(err.code != 0).assertEqual(true); - done(); - }) - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotWithoutAdd_0900====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsGetSlotWithoutAdd_1000 - * @tc.name : getSlot by type promise - * @tc.desc : Get the CONTENT_INFORMATION type slot without adding - */ - it('ActsAnsGetSlotWithoutAdd_1000', 0, async function (done) { - console.debug("====>ActsAnsGetSlotWithoutAdd_1000 start====>"); - console.debug("====>getSlot SlotType.CONTENT_INFORMATION====>"); - notification.getSlot(notification.SlotType.CONTENT_INFORMATION).then((data)=>{ - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_1000 enter====>"); - expect().assertFail(); - done(); - }).catch((err)=>{ - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_1000 err:" + JSON.stringify(err)); - console.debug("====>getSlot ActsAnsGetSlotWithoutAdd_1000 end====>"); - expect(err.code != 0).assertEqual(true); - done(); - }) - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotWithoutAdd_1000====>"); - }, TIMEOUT); - }) -}) } diff --git a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/test/List.test.js b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/test/List.test.js deleted file mode 100644 index a616371fd65724cadf202bf6db048038750ace57..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsGetSlotWithoutAdd from './ExampleJsunit.test.js' -export default function testsuite() { -ActsAnsGetSlotWithoutAdd() -} diff --git a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/resources/base/element/string.json b/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/resources/base/element/string.json deleted file mode 100644 index 63151edc575cbac002b4a8febea73d6541548cc6..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslotWithoutadd/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ActsAnsSlotSystemPromise" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/BUILD.gn b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/BUILD.gn deleted file mode 100644 index da23c5d6b94f0ef8028239ea93ae14008a9deecb..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsGetSlotTestCallbackTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsGetSlotTestCallbackTest" - 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/actsansslottest/actsansgetslottestcallback/Test.json b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/Test.json deleted file mode 100644 index 61354aea5e3f2e30858b03f776e2f2c0a41c7162..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "com.example.actsansgetslottestcallback", - "package-name": "com.example.actsansgetslottestcallback" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsGetSlotTestCallbackTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/signature/openharmony_sx.p7b b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/config.json b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/config.json deleted file mode 100644 index ef18767a004cb2e9941f79d8fd41cb92f43a98ab..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansgetslottestcallback", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansgetslottestcallback", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/MainAbility/app.js b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/actsansslottest/actsansgetslottestcallback/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index cc183ba6f171c0a02e11f8a2eecdf4247d8c8bc2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - {{title}} - -
diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index fe0d3124a704e40ff8f338eac0fdf99c22ee6879..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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: "测试GetSlot接口:callback形式" - }, - onInit() { - this.title = "测试GetSlot接口:callback形式"; - }, - onShow() { - console.info('onShow finish') - }, - onReady() { - }, -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestAbility/app.js b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/actsansslottest/actsansgetslottestcallback/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/actsansslottest/actsansgetslottestcallback/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/actsansslottest/actsansgetslottestcallback/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index 3e9a3e6630fd4413022600e67bbb3b2b2071b50b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,231 +0,0 @@ -/* - * 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' - -const TIMEOUT = 2000; -const SOUNDURL = "file://system/etc/Light.ogg"; -export default function ActsAnsGetSlotTestCallback() { -describe('ActsAnsGetSlotTestCallback', function () { - - /* - * @tc.number : ActsAnsGetSlotTestCallback_0100 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : Get the SOCIAL_COMMUNICATION type slot after adding - */ - it('ActsAnsGetSlotTestCallback_0100', 0, async function (done) { - console.debug("====>ActsAnsGetSlotTestCallback_0100 start====>"); - console.debug("====>addSlot SlotType.SOCIAL_COMMUNICATION start====>"); - notification.addSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{ - console.debug("====>addSlot 0100 enter====>"); - console.debug("====>addSlot 0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlot SlotType.SOCIAL_COMMUNICATION start====>"); - notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err, data)=>{ - console.debug("====>getSlot 0100 enter====>"); - console.debug("====>getSlot 0100 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlot ActsAnsGetSlotTestCallback_0100 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION); - expect(data.level).assertEqual(4); - expect(data.desc).assertEqual(""); - expect(data.badgeFlag).assertEqual(true); - expect(data.bypassDnd).assertEqual(false); - expect(data.lockscreenVisibility).assertEqual(2); - expect(data.vibrationEnabled).assertEqual(true); - expect(data.sound).assertEqual(SOUNDURL); - expect(data.lightEnabled).assertEqual(false); - expect(data.lightColor).assertEqual(0); - console.debug("====>getSlot ActsAnsGetSlotTestCallback_0100 finish====>"); - notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{ - console.debug("====>removeSlot SOCIAL_COMMUNICATION enter====>"); - expect(err.code).assertEqual(0); - done(); - }) - }); - }); - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotTestCallback_0100====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsGetSlotTestCallback_0200 - * @tc.name : Verify getSlot SERVICE_INFORMATION - * @tc.desc : Get the SERVICE_INFORMATION type slot after adding - */ - it('ActsAnsGetSlotTestCallback_0200', 0, async function (done) { - console.debug("====>ActsAnsGetSlotTestCallback_0200 start====>"); - function getSlotCallbackSecond(err, data) { - console.debug("====>getSlot ActsAnsGetSlotTestCallback_0200 enter====>"); - console.debug("====>getSlot ActsAnsGetSlotTestCallback_0200 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlot ActsAnsGetSlotTestCallback_0200 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.SERVICE_INFORMATION); - expect(data.level).assertEqual(3); - expect(data.desc).assertEqual(""); - expect(data.badgeFlag).assertEqual(true); - expect(data.bypassDnd).assertEqual(false); - expect(data.lockscreenVisibility).assertEqual(2); - expect(data.vibrationEnabled).assertEqual(true); - expect(data.sound).assertEqual(SOUNDURL); - expect(data.lightEnabled).assertEqual(false); - expect(data.lightColor).assertEqual(0); - console.debug("====>getSlot ActsAnsGetSlotTestCallback_0200 finish====>"); - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>removeSlot SERVICE_INFORMATION enter====>"); - expect(err.code).assertEqual(0); - done(); - }) - } - console.debug("====>addSlot SlotType.SERVICE_INFORMATION start====>"); - notification.addSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>addSlot ActsAnsGetSlotTestCallback_0200 enter====>"); - console.debug("====>addSlot ActsAnsGetSlotTestCallback_0200 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlot SlotType.SERVICE_INFORMATION start====>"); - notification.getSlot(notification.SlotType.SERVICE_INFORMATION, getSlotCallbackSecond); - }); - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotTestCallback_0200====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsGetSlotTestCallback_0300 - * @tc.name : Verify getSlot CONTENT_INFORMATION - * @tc.desc : Get the CONTENT_INFORMATION type slot after adding - */ - it('ActsAnsGetSlotTestCallback_0300', 0, async function (done) { - console.debug("====>ActsAnsGetSlotTestCallback_0300 start====>"); - function getSlotCallbackThird(err, data) { - console.debug("====>getSlot ActsAnsGetSlotTestCallback_0300 enter====>"); - console.debug("====>getSlot ActsAnsGetSlotTestCallback_0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlot ActsAnsGetSlotTestCallback_0300 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.CONTENT_INFORMATION); - expect(data.level).assertEqual(2); - expect(data.desc).assertEqual(""); - expect(data.badgeFlag).assertEqual(true); - expect(data.bypassDnd).assertEqual(false); - expect(data.lockscreenVisibility).assertEqual(3); - expect(data.vibrationEnabled).assertEqual(false); - expect(data.sound).assertEqual(""); - expect(data.lightEnabled).assertEqual(false); - expect(data.lightColor).assertEqual(0); - console.debug("====>getSlot ActsAnsGetSlotTestCallback_0300 finish====>"); - notification.removeSlot(notification.SlotType.CONTENT_INFORMATION, (err)=>{ - console.debug("====>removeSlot CONTENT_INFORMATION enter====>"); - expect(err.code).assertEqual(0); - done(); - }) - } - console.debug("====>addSlot SlotType.CONTENT_INFORMATION start====>"); - notification.addSlot(notification.SlotType.CONTENT_INFORMATION, (err)=>{ - console.debug("====>addSlotActsAnsGetSlotTestCallback_0300 enter====>"); - console.debug("====>addSlotActsAnsGetSlotTestCallback_0300 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlot SlotType.CONTENT_INFORMATION start====>"); - notification.getSlot(notification.SlotType.CONTENT_INFORMATION, getSlotCallbackThird); - }); - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotTestCallback_0300====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsGetSlotTestCallback_0400 - * @tc.name : Verify getSlot OTHER_TYPES - * @tc.desc : Get the OTHER_TYPES type slot after adding - */ - it('ActsAnsGetSlotTestCallback_0400', 0, async function (done) { - console.debug("====>ActsAnsGetSlotTestCallback_0400 start====>"); - function getSlotCallbackFourth(err, data) { - console.debug("====>getSlot ActsAnsGetSlotTestCallback_0400 enter====>"); - console.debug("====>getSlot ActsAnsGetSlotTestCallback_0400 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlot ActsAnsGetSlotTestCallback_0400 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.OTHER_TYPES); - expect(data.level).assertEqual(1); - expect(data.desc).assertEqual(""); - expect(data.badgeFlag).assertEqual(true); - expect(data.bypassDnd).assertEqual(false); - expect(data.lockscreenVisibility).assertEqual(3); - expect(data.vibrationEnabled).assertEqual(false); - expect(data.sound).assertEqual(""); - expect(data.lightEnabled).assertEqual(false); - expect(data.lightColor).assertEqual(0); - console.debug("====>getSlotActsAnsGetSlotTestCallback_0400 finish====>"); - notification.removeSlot(notification.SlotType.OTHER_TYPES, (err)=>{ - console.debug("====>removeSlot OTHER_TYPES enter====>"); - expect(err.code).assertEqual(0); - done(); - }) - } - console.debug("====>addSlot SlotType.OTHER_TYPES start====>"); - notification.addSlot(notification.SlotType.OTHER_TYPES, (err)=>{ - console.debug("====>addSlotActsAnsGetSlotTestCallback_0400 enter====>"); - console.debug("====>addSlotActsAnsGetSlotTestCallback_0400 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlot SlotType.OTHER_TYPES start====>"); - notification.getSlot(notification.SlotType.OTHER_TYPES, getSlotCallbackFourth); - }); - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotTestCallback_0400====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsGetSlotTestCallback_0500 - * @tc.name : Verify getSlot UNKNOWN_TYPE - * @tc.desc : Get the UNKNOWN_TYPE type slot after adding - */ - it('ActsAnsGetSlotTestCallback_0500', 0, async function (done) { - console.debug("====>ActsAnsGetSlotTestCallback_0500 start====>"); - function getSlotCallbackFifth(err, data) { - console.debug("====>getSlot ActsAnsGetSlotTestCallback_0500 enter====>"); - console.debug("====>getSlot ActsAnsGetSlotTestCallback_0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlot ActsAnsGetSlotTestCallback_0500 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.OTHER_TYPES); - expect(data.level).assertEqual(1); - expect(data.desc).assertEqual(""); - expect(data.badgeFlag).assertEqual(true); - expect(data.bypassDnd).assertEqual(false); - expect(data.lockscreenVisibility).assertEqual(3); - expect(data.vibrationEnabled).assertEqual(false); - expect(data.sound).assertEqual(""); - expect(data.lightEnabled).assertEqual(false); - expect(data.lightColor).assertEqual(0); - console.debug("====>getSlot ActsAnsGetSlotTestCallback_0500 finish====>"); - notification.removeSlot(notification.SlotType.OTHER_TYPES, (err)=>{ - console.debug("====>removeSlot OTHER_TYPES enter====>"); - expect(err.code).assertEqual(0); - done(); - }) - } - console.debug("====>addSlot SlotType.UNKNOWN_TYPE start====>"); - notification.addSlot(notification.SlotType.UNKNOWN_TYPE, (err)=>{ - console.debug("====>addSlotActsAnsGetSlotTestCallback_0500 enter====>"); - console.debug("====>addSlotActsAnsGetSlotTestCallback_0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlot SlotType.UNKNOWN_TYPE start====>"); - notification.getSlot(notification.SlotType.UNKNOWN_TYPE, getSlotCallbackFifth); - }); - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotTestCallback_0500====>"); - }, TIMEOUT); - }) -})} diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/test/List.test.js b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/test/List.test.js deleted file mode 100644 index b9bda7c6538393260d74e300991864e7fd818dba..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsGetSlotTestCallback from './ExampleJsunit.test.js' -export default function testsuite() { -ActsAnsGetSlotTestCallback() -} diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/resources/base/element/string.json b/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/resources/base/element/string.json deleted file mode 100644 index e91cd0bd494f3b8587a3c812848da90b42e96e64..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestcallback/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ActsAnsGetSlotTestCallback" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/BUILD.gn b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/BUILD.gn deleted file mode 100644 index c5163654f81cd9bb958f309f742c6b1c1bc5be77..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsGetSlotTestPromiseTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsGetSlotTestPromiseTest" - 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/actsansslottest/actsansgetslottestpromise/Test.json b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/Test.json deleted file mode 100644 index 0fa940ddfeaf12a379cf1beb588358a63e069627..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "shell-timeout": "180000", - "bundle-name": "com.example.actsansgetslottestpromise", - "package-name": "com.example.actsansgetslottestpromise" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsGetSlotTestPromiseTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/signature/openharmony_sx.p7b b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/config.json b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/config.json deleted file mode 100644 index fd2948e32662f32c55a070b4e7e360bf4f9165bf..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansgetslottestpromise", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansgetslottestpromise", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/MainAbility/app.js b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/actsansslottest/actsansgetslottestpromise/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 09696c297ee9837d996bd113bf8d41b67f236f7b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 95b3afa04dd4bba8c34ad3086534adb6c28cfa3c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - {{title}} - -
diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index a1f99ecd22a2e35e0242cda542b029f2abcb94d2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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: "测试GetSlot接口:promise形式" - }, - onInit() { - this.title = "测试GetSlot接口:promise形式"; - }, - onShow() { - console.info('onShow finish') - }, - onReady() { - }, -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestAbility/app.js b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/actsansslottest/actsansgetslottestpromise/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/actsansslottest/actsansgetslottestpromise/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/actsansslottest/actsansgetslottestpromise/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index 03faf91e7e71d57cdb663cfd961eb8878b4f523a..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,237 +0,0 @@ -/* - * 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' - -const TIMEOUT = 2000; -const SOUNDURL = "file://system/etc/Light.ogg"; -export default function ActsAnsGetSlotTestPromise() { -describe('ActsAnsGetSlotTestPromise', function () { - - /* - * @tc.number : ActsAnsGetSlotTestPromise_0100 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : Get the SOCIAL_COMMUNICATION type slot after adding - */ - it('ActsAnsGetSlotTestPromise_0100', 0, async function (done) { - console.debug("====>ActsAnsGetSlotTestPromise_0100 start====>"); - console.debug("====>addSlot SlotType.SOCIAL_COMMUNICATION start====>"); - try{ - await notification.addSlot(notification.SlotType.SOCIAL_COMMUNICATION); - } - catch(err){ - console.error("====>addSlotActsAnsGetSlotTestPromise_0100 err:" + JSON.stringify(err)); - expect().assertFail(); - done(); - } - console.debug("====>getSlot SlotType.SOCIAL_COMMUNICATION start====>"); - notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION).then((data) => { - console.debug("====>getSlot ActsAnsGetSlotTestPromise_0100 enter====>"); - console.debug("====>getSlot ActsAnsGetSlotTestPromise_0100 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION); - expect(data.level).assertEqual(4); - expect(data.desc).assertEqual(""); - expect(data.badgeFlag).assertEqual(true); - expect(data.bypassDnd).assertEqual(false); - expect(data.lockscreenVisibility).assertEqual(2); - expect(data.vibrationEnabled).assertEqual(true); - expect(data.sound).assertEqual(SOUNDURL); - expect(data.lightEnabled).assertEqual(false); - expect(data.lightColor).assertEqual(0); - console.debug("====>getSlot ActsAnsGetSlotTestPromise_0100 finish====>"); - notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{ - console.debug("====>removeSlot SOCIAL_COMMUNICATION err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>ActsAnsGetSlotTestPromise_0100 end====>"); - done(); - }) - }) - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotTestPromise_0100====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsGetSlotTestPromise_0200 - * @tc.name : Verify getSlot SERVICE_INFORMATION - * @tc.desc : Get the SERVICE_INFORMATION type slot after adding - */ - it('ActsAnsGetSlotTestPromise_0200', 0, async function (done) { - console.debug("====>ActsAnsGetSlotTestPromise_0200 start====>"); - console.debug("====>addSlot SlotType.SERVICE_INFORMATION start====>"); - try{ - await notification.addSlot(notification.SlotType.SERVICE_INFORMATION); - } - catch(err){ - console.error("====>addSlot ActsAnsGetSlotTestPromise_0200 err:" + JSON.stringify(err)); - expect().assertFail(); - done(); - } - console.debug("====>getSlot SlotType.SERVICE_INFORMATION start====>"); - notification.getSlot(notification.SlotType.SERVICE_INFORMATION).then((data) => { - console.debug("====>getSlot Promise SERVICE_INFORMATION ActsAnsGetSlotTestPromise_0200 enter====>"); - console.debug("====>getSlot Promise ActsAnsGetSlotTestPromise_0200 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.SERVICE_INFORMATION); - expect(data.level).assertEqual(3); - expect(data.desc).assertEqual(""); - expect(data.badgeFlag).assertEqual(true); - expect(data.bypassDnd).assertEqual(false); - expect(data.lockscreenVisibility).assertEqual(2); - expect(data.vibrationEnabled).assertEqual(true); - expect(data.sound).assertEqual(SOUNDURL); - expect(data.lightEnabled).assertEqual(false); - expect(data.lightColor).assertEqual(0); - console.debug("====>getSlot Promise SERVICE_INFORMATION ActsAnsGetSlotTestPromise_0200 finish====>"); - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>removeSlot SERVICE_INFORMATION err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>ActsAnsGetSlotTestPromise_0200 end====>"); - done(); - }) - }) - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotTestPromise_0200====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsGetSlotTestPromise_0300 - * @tc.name : Verify getSlot CONTENT_INFORMATION - * @tc.desc : Get the CONTENT_INFORMATION type slot after adding - */ - it('ActsAnsGetSlotTestPromise_0300', 0, async function (done) { - console.debug("====>ActsAnsGetSlotTestPromise_0300 Promise start====>"); - console.debug("====>addSlot SlotType.CONTENT_INFORMATION start====>"); - try{ - await notification.addSlot(notification.SlotType.CONTENT_INFORMATION); - } - catch(err){ - console.error("====>addSlot ActsAnsGetSlotTestPromise_0300 err:" + JSON.stringify(err)); - expect().assertFail(); - done(); - } - console.debug("====>getSlot SlotType.CONTENT_INFORMATION start====>"); - notification.getSlot(notification.SlotType.CONTENT_INFORMATION).then((data) => { - console.debug("====>getSlot Promise CONTENT_INFORMATION ActsAnsGetSlotTestPromise_0300 enter====>"); - console.debug("====>getSlot Promise ActsAnsGetSlotTestPromise_0300 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.CONTENT_INFORMATION); - expect(data.level).assertEqual(2); - expect(data.desc).assertEqual(""); - expect(data.badgeFlag).assertEqual(true); - expect(data.bypassDnd).assertEqual(false); - expect(data.lockscreenVisibility).assertEqual(3); - expect(data.vibrationEnabled).assertEqual(false); - expect(data.sound).assertEqual(""); - expect(data.lightEnabled).assertEqual(false); - expect(data.lightColor).assertEqual(0); - console.debug("====>getSlot Promise CONTENT_INFORMATION ActsAnsGetSlotTestPromise_0300 finish====>"); - notification.removeSlot(notification.SlotType.CONTENT_INFORMATION, (err)=>{ - console.debug("====>removeSlot CONTENT_INFORMATION err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - done(); - }) - }) - console.info("====>ActsAnsGetSlotTestPromise_0300 end====>"); - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotTestPromise_0300====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsGetSlotTestPromise_0400 - * @tc.name : Verify getSlot OTHER_TYPES - * @tc.desc : Get the OTHER_TYPES type slot after adding - */ - it('ActsAnsGetSlotTestPromise_0400', 0, async function (done) { - console.debug("====>ActsAnsGetSlotTestPromise_0400 start====>"); - console.debug("====>addSlot SlotType.OTHER_TYPES start====>"); - try{ - await notification.addSlot(notification.SlotType.OTHER_TYPES); - } - catch(err){ - console.error("====>addSlot ActsAnsGetSlotTestPromise_0400 err:" + JSON.stringify(err)); - expect().assertFail(); - done(); - } - console.debug("====>getSlot SlotType.OTHER_TYPES start====>"); - notification.getSlot(notification.SlotType.OTHER_TYPES).then((data) => { - console.debug("====>getSlot Promise OTHER_TYPES ActsAnsGetSlotTestPromise_0400 enter====>"); - console.debug("====>getSlot Promise ActsAnsGetSlotTestPromise_0400 data====>" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.OTHER_TYPES); - expect(data.level).assertEqual(1); - expect(data.desc).assertEqual(""); - expect(data.badgeFlag).assertEqual(true); - expect(data.bypassDnd).assertEqual(false); - expect(data.lockscreenVisibility).assertEqual(3); - expect(data.vibrationEnabled).assertEqual(false); - expect(data.sound).assertEqual(""); - expect(data.lightEnabled).assertEqual(false); - expect(data.lightColor).assertEqual(0); - console.debug("====>getSlot Promise OTHER_TYPES ActsAnsGetSlotTestPromise_0400 finish====>"); - notification.removeSlot(notification.SlotType.OTHER_TYPES, (err)=>{ - console.debug("====>removeSlot OTHER_TYPES err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - done(); - }) - }) - console.debug("====>ActsAnsGetSlotTestPromise_0400 end====>"); - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotTestPromise_0400====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsGetSlotTestPromise_0500 - * @tc.name : Verify getSlot UNKNOWN_TYPE - * @tc.desc : Get the UNKNOWN_TYPE type slot after adding - */ - it('ActsAnsGetSlotTestPromise_0500', 0, async function (done) { - console.debug("====>ActsAnsGetSlotTestPromise_0500 start====>"); - console.debug("====>addSlot SlotType.UNKNOWN_TYPE start====>"); - try{ - await notification.addSlot(notification.SlotType.UNKNOWN_TYPE); - } - catch(err){ - console.error("====>addSlot ActsAnsGetSlotTestPromise_0500 err:" + JSON.stringify(err)); - expect().assertFail(); - done(); - } - console.debug("====>getSlot SlotType.UNKNOWN_TYPE start====>"); - notification.getSlot(notification.SlotType.UNKNOWN_TYPE).then((data) => { - console.debug("====>getSlot Promise UNKNOWN_TYPE ActsAnsGetSlotTestPromise_0500 enter====>"); - console.debug("====>getSlot Promise ActsAnsGetSlotTestPromise_0500 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.OTHER_TYPES); - expect(data.level).assertEqual(1); - expect(data.desc).assertEqual(""); - expect(data.badgeFlag).assertEqual(true); - expect(data.bypassDnd).assertEqual(false); - expect(data.lockscreenVisibility).assertEqual(3); - expect(data.vibrationEnabled).assertEqual(false); - expect(data.sound).assertEqual(""); - expect(data.lightEnabled).assertEqual(false); - expect(data.lightColor).assertEqual(0); - console.debug("====>getSlotPromise UNKNOWN_TYPE ActsAnsGetSlotTestPromise_0500 finish====>"); - notification.removeSlot(notification.SlotType.OTHER_TYPES, (err)=>{ - console.debug("====>removeSlot OTHER_TYPES err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - done(); - }) - }) - console.debug("====>ActsAnsGetSlotTestPromise_0500 end====>"); - setTimeout(function(){ - console.debug("====>time out ActsAnsGetSlotTestPromise_0500====>"); - }, TIMEOUT); - }) -}) } diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/test/List.test.js b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/test/List.test.js deleted file mode 100644 index f1f001b0d5ca40dd8ff09ad8fb9bcfa36a6c8bef..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsGetSlotTestPromise from './ExampleJsunit.test.js' -export default function testsuite() { -ActsAnsGetSlotTestPromise() -} diff --git a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/resources/base/element/string.json b/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/resources/base/element/string.json deleted file mode 100644 index a9069003e1fe170dbfa2fb6fdedbb7d4a61b820d..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansgetslottestpromise/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ActsAnsGetSlotTestPromise" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/actsansslottest/actsansremoveslottest/BUILD.gn b/notification/ans_standard/actsansslottest/actsansremoveslottest/BUILD.gn deleted file mode 100644 index 4a73eeb8c6776b82fc66d5577e8e30c80ba9d1af..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsRemoveSlotTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsRemoveSlotTest" - 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/actsansslottest/actsansremoveslottest/Test.json b/notification/ans_standard/actsansslottest/actsansremoveslottest/Test.json deleted file mode 100644 index be2a99652b400634c28425a2f3ddae2ad413bff2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "com.example.actsansremoveslottest", - "package-name": "com.example.actsansremoveslottest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsRemoveSlotTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansremoveslottest/signature/openharmony_sx.p7b b/notification/ans_standard/actsansslottest/actsansremoveslottest/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/actsansslottest/actsansremoveslottest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/config.json b/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/config.json deleted file mode 100644 index d0f7eada95f169933a1484b9ee31214868858c4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansremoveslottest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansremoveslottest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/MainAbility/app.js b/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/actsansslottest/actsansremoveslottest/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index cc183ba6f171c0a02e11f8a2eecdf4247d8c8bc2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - {{title}} - -
diff --git a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index b6c029140a36fe25eb602dbaeb1fe15b9077e84b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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: "测试RemoveSlot接口" - }, - onInit() { - this.title = "测试RemoveSlot接口"; - }, - onShow() { - console.info('onShow finish') - }, - onReady() { - }, -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestAbility/app.js b/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/actsansslottest/actsansremoveslottest/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/actsansslottest/actsansremoveslottest/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/actsansslottest/actsansremoveslottest/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index 0d25d651159055fc06ec66ca00d89a40fea41884..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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' - -const TIMEOUT = 3000; -const SOUNDURL = "file://system/etc/Light.ogg"; -export default function ActsAnsRemoveSlotTest() { -describe('ActsAnsRemoveSlotTest', function () { - - /* - * @tc.number : ActsAnsRemoveSlotTest_0100 - * @tc.name : Verify that the slot is removed twice callback - * @tc.desc : Remove the added SOCIAL_COMMUNICATION slot and then remove it again - */ - it('ActsAnsRemoveSlotTest_0100', 0, async function (done) { - console.debug("====>ActsAnsRemoveSlotTest_0100 start====>"); - console.debug("====>addSlot ActsAnsRemoveSlotTest_0100 start====>"); - await notification.addSlot(notification.SlotType.SOCIAL_COMMUNICATION); - console.debug("====>getSlot SlotType.SOCIAL_COMMUNICATION start====>"); - var data = await notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION); - console.debug("====>getSlot ActsAnsRemoveSlotTest_0100 enter====>"); - console.debug("====>getSlot ActsAnsRemoveSlotTest_0100 data====>" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION); - expect(data.level).assertEqual(4); - expect(data.desc).assertEqual(""); - expect(data.badgeFlag).assertEqual(true); - expect(data.bypassDnd).assertEqual(false); - expect(data.lockscreenVisibility).assertEqual(2); - expect(data.vibrationEnabled).assertEqual(true); - expect(data.sound).assertEqual(SOUNDURL); - expect(data.lightEnabled).assertEqual(false); - expect(data.lightColor).assertEqual(0); - console.debug("====>getSlot ActsAnsRemoveSlotTest_0100 finish====>"); - notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{ - console.debug("====>removeSlot first time callback err====>" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err, data)=>{ - console.debug("====>getSlot second time enter====>"); - console.debug("====>getSlot second time err:" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.debug("====>getSlot second data:" + JSON.stringify(data)); - notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{ - console.debug("====>removeSlot second time callback err:" + JSON.stringify(err)); - console.debug("====>ActsAnsRemoveSlotTest_0100 end====>"); - expect(err.code != 0).assertEqual(true); - done(); - }) - }) - }) - setTimeout(function(){ - console.debug("====>time out ActsAnsRemoveSlotTest_0100====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsRemoveSlotTest_0200 - * @tc.name : Verify that the slot is removed twice - * @tc.desc : Remove the added SERVICE_INFORMATION slot and then remove it again - */ - it('ActsAnsRemoveSlotTest_0200', 0, async function (done) { - console.debug("====>ActsAnsRemoveSlotTest_0200 start====>"); - console.debug("====>addSlot ActsAnsRemoveSlotTest_0200 start====>"); - await notification.addSlot(notification.SlotType.SERVICE_INFORMATION); - console.debug("====>getSlot SlotType.SERVICE_INFORMATION start====>"); - var data = await notification.getSlot(notification.SlotType.SERVICE_INFORMATION); - console.debug("====>getSlot ActsAnsRemoveSlotTest_0200 enter====>"); - console.debug("====>getSlot ActsAnsRemoveSlotTest_0200 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.SERVICE_INFORMATION); - expect(data.level).assertEqual(3); - expect(data.desc).assertEqual(""); - expect(data.badgeFlag).assertEqual(true); - expect(data.bypassDnd).assertEqual(false); - expect(data.lockscreenVisibility).assertEqual(2); - expect(data.vibrationEnabled).assertEqual(true); - expect(data.sound).assertEqual(SOUNDURL); - expect(data.lightEnabled).assertEqual(false); - expect(data.lightColor).assertEqual(0); - console.debug("====>getSlot ActsAnsRemoveSlotTest_0200 finish====>"); - console.debug("====>removeSlot first time promise start====>"); - await notification.removeSlot(notification.SlotType.SERVICE_INFORMATION); - notification.getSlot(notification.SlotType.SERVICE_INFORMATION, (err, data)=>{ - console.debug("====>getSlot second time enter====>"); - console.debug("====>getSlot second time err:" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.debug("====>second getSlot data====>" + JSON.stringify(data)); - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>removeSlot second time err:" + JSON.stringify(err)); - console.debug("====>ActsAnsRemoveSlotTest_0200 end====>"); - expect(err.code != 0).assertEqual(true); - done(); - }) - }) - setTimeout(function(){ - console.debug("====>time out ActsAnsRemoveSlotTest_0200====>"); - }, TIMEOUT); - }) -})} diff --git a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/test/List.test.js b/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/test/List.test.js deleted file mode 100644 index b19c7e3563978d65328c65f7508181feae09b7c1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsRemoveSlotTest from './ExampleJsunit.test.js' -export default function testsuite() { -ActsAnsRemoveSlotTest() -} diff --git a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/resources/base/element/string.json b/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/resources/base/element/string.json deleted file mode 100644 index cd64bca195c122d85c94da46de6691b345f03095..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslottest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ActsAnsRemoveSlotTest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/BUILD.gn b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/BUILD.gn deleted file mode 100644 index 06dc5c14868e9025c2e8d963452e9f2f259dfc35..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsRemoveSlotWithoutAddTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsRemoveSlotWithoutAddTest" - 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/actsansslottest/actsansremoveslotwithoutadd/Test.json b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/Test.json deleted file mode 100644 index f9118d424c2e5881e91dbb9e3e1b932bc864e3bc..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "com.example.actsansremoveslotwithoutadd", - "package-name": "com.example.actsansremoveslotwithoutadd" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsRemoveSlotWithoutAddTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/signature/openharmony_sx.p7b b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/config.json b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/config.json deleted file mode 100644 index bf905910d6444cddbc8e561a18e2b7ebbf20b393..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansremoveslotwithoutadd", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansremoveslotwithoutadd", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/MainAbility/app.js b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/actsansslottest/actsansremoveslotwithoutadd/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 09696c297ee9837d996bd113bf8d41b67f236f7b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index cc183ba6f171c0a02e11f8a2eecdf4247d8c8bc2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - {{title}} - -
diff --git a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index b2c0901c29a28b09d6fe437258c2b81bc78ed34c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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: "测试removeSlot接口" - }, - onInit() { - this.title = "测试removeSlot接口"; - }, - onShow() { - console.info('onShow finish') - }, - onReady() { - }, -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestAbility/app.js b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/actsansslottest/actsansremoveslotwithoutadd/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index e7b59ac23a947c5ad00b5fba7ee716786e137488..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,236 +0,0 @@ -/* - * 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' - -const TIMEOUT = 2000; -export default function ActsAnsRemoveSlotWithoutAdd() { -describe('ActsAnsRemoveSlotWithoutAdd', function () { - - /* - * @tc.number : ActsAnsRemoveSlotWithoutAdd_0100 - * @tc.name : removeSlot callback - * @tc.desc : remove the SOCIAL_COMMUNICATION type slot without adding - */ - it('ActsAnsRemoveSlotWithoutAdd_0100', 0, async function (done) { - console.debug("====>ActsAnsRemoveSlotWithoutAdd_0100 start====>"); - function removeSlotCallbck(err) { - console.debug("====>removeSlotActsAnsGetSlotWithoutAdd_0100 enter====>"); - console.debug("====>removeSlot ActsAnsRemoveSlotWithoutAdd_0100 err:" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - done(); - } - console.debug("====>removeSlot callback SlotType.SOCIAL_COMMUNICATION====>"); - await notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, removeSlotCallbck); - setTimeout(function(){ - console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_0100====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsRemoveSlotWithoutAdd_0200 - * @tc.name : removeSlot callback - * @tc.desc : remove the SERVICE_INFORMATION type slot without adding - */ - it('ActsAnsRemoveSlotWithoutAdd_0200', 0, async function (done) { - console.debug("====>ActsAnsRemoveSlotWithoutAdd_0200 start====>"); - function removeSlotCallbck(err) { - console.debug("====>ActsAnsRemoveSlotWithoutAdd_0200 enter====>"); - console.debug("====>removeSlot ActsAnsRemoveSlotWithoutAdd_0200 err:" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - done(); - } - console.debug("====>removeSlot callback SlotType.SERVICE_INFORMATION====>"); - await notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, removeSlotCallbck); - setTimeout(function(){ - console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_0200====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsRemoveSlotWithoutAdd_0300 - * @tc.name : removeSlot callback - * @tc.desc : remove the CONTENT_INFORMATION type slot without adding - */ - it('ActsAnsRemoveSlotWithoutAdd_0300', 0, async function (done) { - console.debug("====>ActsAnsRemoveSlotWithoutAdd_0300 start====>"); - function removeSlotCallbck(err) { - console.debug("====>ActsAnsRemoveSlotWithoutAdd_0300 enter====>"); - console.debug("====>removeSlot ActsAnsRemoveSlotWithoutAdd_0300 err:" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - done(); - } - console.debug("====>removeSlot callback SlotType.CONTENT_INFORMATION====>"); - await notification.removeSlot(notification.SlotType.CONTENT_INFORMATION, removeSlotCallbck); - setTimeout(function(){ - console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_0300====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsRemoveSlotWithoutAdd_0400 - * @tc.name : removeSlot callback - * @tc.desc : remove the OTHER_TYPES type slot without adding - */ - it('ActsAnsRemoveSlotWithoutAdd_0400', 0, async function (done) { - console.debug("====>ActsAnsRemoveSlotWithoutAdd_0400 start====>"); - function removeSlotCallbck(err) { - console.debug("====>ActsAnsRemoveSlotWithoutAdd_0400 enter====>"); - console.debug("====>removeSlot ActsAnsRemoveSlotWithoutAdd_0400 err:" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - done(); - } - console.debug("====>removeSlot callback SlotType.OTHER_TYPES====>"); - await notification.removeSlot(notification.SlotType.OTHER_TYPES, removeSlotCallbck); - setTimeout(function(){ - console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_0400====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsRemoveSlotWithoutAdd_0500 - * @tc.name : removeSlot callback - * @tc.desc : remove the UNKNOWN_TYPE type slot without adding - */ - it('ActsAnsRemoveSlotWithoutAdd_0500', 0, async function (done) { - console.debug("====>ActsAnsRemoveSlotWithoutAdd_0500 start====>"); - function removeSlotCallbck(err) { - console.debug("====>ActsAnsRemoveSlotWithoutAdd_0500 enter====>"); - console.debug("====>removeSlot ActsAnsRemoveSlotWithoutAdd_0500 err:" + JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - done(); - } - console.debug("====>removeSlot callback SlotType.UNKNOWN_TYPE====>"); - await notification.removeSlot(notification.SlotType.UNKNOWN_TYPE, removeSlotCallbck); - setTimeout(function(){ - console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_0500====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsRemoveSlotWithoutAdd_0600 - * @tc.name : removeSlot promise - * @tc.desc : remove the SOCIAL_COMMUNICATION type slot without adding - */ - it('ActsAnsRemoveSlotWithoutAdd_0600', 0, async function (done) { - console.debug("====>ActsAnsRemoveSlotWithoutAdd_0600 start====>"); - console.debug("====>removeSlot SlotType.SOCIAL_COMMUNICATION====>"); - notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION).then(()=>{ - console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0600 enter====>"); - expect().assertFail(); - done(); - }).catch((err)=>{ - console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0600 err:" + JSON.stringify(err)); - console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0600 end====>"); - expect(err.code != 0).assertEqual(true); - done(); - }) - setTimeout(function(){ - console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_0600====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsRemoveSlotWithoutAdd_0700 - * @tc.name : removeSlot promise - * @tc.desc : remove the SERVICE_INFORMATION type slot without adding - */ - it('ActsAnsRemoveSlotWithoutAdd_0700', 0, async function (done) { - console.debug("====>ActsAnsRemoveSlotWithoutAdd_0700 start====>"); - console.debug("====>removeSlot SlotType.SERVICE_INFORMATION====>"); - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION).then(()=>{ - console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0700 enter====>"); - expect().assertFail(); - done(); - }).catch((err)=>{ - console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0700 err:" + JSON.stringify(err)); - console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0700 end====>"); - expect(err.code != 0).assertEqual(true); - done(); - }) - setTimeout(function(){ - console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_0700====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsRemoveSlotWithoutAdd_0800 - * @tc.name : removeSlot promise - * @tc.desc : remove the CONTENT_INFORMATION type slot without adding - */ - it('ActsAnsRemoveSlotWithoutAdd_0800', 0, async function (done) { - console.debug("====>ActsAnsRemoveSlotWithoutAdd_0800 start====>"); - console.debug("====>removeSlot SlotType.CONTENT_INFORMATION====>"); - notification.removeSlot(notification.SlotType.CONTENT_INFORMATION).then(()=>{ - console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0800 enter====>"); - expect().assertFail(); - done(); - }).catch((err)=>{ - console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0800 err:" + JSON.stringify(err)); - console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0800 end====>"); - expect(err.code != 0).assertEqual(true); - done(); - }) - setTimeout(function(){ - console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_0800====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsRemoveSlotWithoutAdd_0900 - * @tc.name : removeSlot promise - * @tc.desc : remove the OTHER_TYPES type slot without adding - */ - it('ActsAnsRemoveSlotWithoutAdd_0900', 0, async function (done) { - console.debug("====>ActsAnsRemoveSlotWithoutAdd_0900 start====>"); - console.debug("====>removeSlot SlotType.OTHER_TYPES====>"); - notification.removeSlot(notification.SlotType.OTHER_TYPES).then(()=>{ - console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0900 enter====>"); - expect().assertFail(); - done(); - }).catch((err)=>{ - console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0900 err:" + JSON.stringify(err)); - console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_0900 end====>"); - expect(err.code != 0).assertEqual(true); - done(); - }) - setTimeout(function(){ - console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_0900====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsRemoveSlotWithoutAdd_1000 - * @tc.name : removeSlot promise - * @tc.desc : remove the UNKNOWN_TYPE type slot without adding - */ - it('ActsAnsRemoveSlotWithoutAdd_1000', 0, async function (done) { - console.debug("====>ActsAnsRemoveSlotWithoutAdd_1000 start====>"); - console.debug("====>removeSlot SlotType.UNKNOWN_TYPE====>"); - notification.removeSlot(notification.SlotType.UNKNOWN_TYPE).then(()=>{ - console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_1000 enter====>"); - expect().assertFail(); - done(); - }).catch((err)=>{ - console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_1000 err:" + JSON.stringify(err)); - console.debug("====>getSlot ActsAnsRemoveSlotWithoutAdd_1000 end====>"); - expect(err.code != 0).assertEqual(true); - done(); - }) - setTimeout(function(){ - console.debug("====>time out ActsAnsRemoveSlotWithoutAdd_1000====>"); - }, TIMEOUT); - }) -}) } diff --git a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/test/List.test.js b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/test/List.test.js deleted file mode 100644 index 003a73483db256fd8883bddda9a418ca0bda7c55..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsRemoveSlotWithoutAdd from './ExampleJsunit.test.js' -export default function testsuite() { -ActsAnsRemoveSlotWithoutAdd() -} diff --git a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/resources/base/element/string.json b/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/resources/base/element/string.json deleted file mode 100644 index 63151edc575cbac002b4a8febea73d6541548cc6..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansremoveslotwithoutadd/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ActsAnsSlotSystemPromise" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/actsansslottest/actsansslotbybundle/BUILD.gn b/notification/ans_standard/actsansslottest/actsansslotbybundle/BUILD.gn deleted file mode 100644 index 9a1bf18a9bce480b29d1aa7ac17ba70b9519eca9..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsSlotByBundleTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsSlotByBundleTest" - 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/actsansslottest/actsansslotbybundle/Test.json b/notification/ans_standard/actsansslottest/actsansslotbybundle/Test.json deleted file mode 100644 index 888a96d1bf48288f3cfb5a37fb3f9e0a3d660dc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "shell-timeout": "180000", - "bundle-name": "com.example.actsansslotbybundle", - "package-name": "com.example.actsansslotbybundle" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsSlotByBundleTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotbybundle/signature/openharmony_sx.p7b b/notification/ans_standard/actsansslottest/actsansslotbybundle/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/actsansslottest/actsansslotbybundle/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/config.json b/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/config.json deleted file mode 100644 index 2c992ab8fb2f17f28b3625aa73809f2416714ccd..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansslotbybundle", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansslotbybundle", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/MainAbility/app.js b/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/actsansslottest/actsansslotbybundle/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 406641d81b4fb36d0b97c49b722528391c7a56a0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 44f4bc0a213133ced33d70b9220c26b66a088726..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - activeButton - -
diff --git a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 47f392922bd1864186356d16f91053223b84b8a3..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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: "测试slotbybundle接口" - }, - onInit() { - this.title = "测试slotbybundle接口"; - }, - onShow() { - console.info('onShow finish') - }, - onReady() { - }, -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestAbility/app.js b/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/actsansslottest/actsansslotbybundle/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/actsansslottest/actsansslotbybundle/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/actsansslottest/actsansslotbybundle/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index f7bf48478d018aa0845c5d7aeaa78a37ebb9ffce..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,1861 +0,0 @@ -/* - * 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 ActsAnsSlotByBundle() { -describe('ActsAnsSlotByBundle', function () { - /* - * @tc.number : ActsAnsGetSlotsByBundle_0100 - * @tc.name : Verify getSlot SERVICE_INFORMATION - * @tc.desc : After adding slottype to SERVICE_INFORMATION's slot, - * call getsbybundle for information.(promise) - */ - it('ActsAnsGetSlotsByBundle_0100', 0, async function (done) { - console.debug("====>ActsAnsGetSlotsByBundle_0100 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - console.debug("====>addSlotByTypePromise SERVICE_INFORMATION enter====>"); - await notification.addSlot(notification.SlotType.SERVICE_INFORMATION); - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsGetSlotsByBundle_0100====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(2) - expect(data[0].level).assertEqual(3) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(2) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>removeSlot SERVICE_INFORMATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsGetSlotsByBundle_0200 - * @tc.name : Verify getSlot UNKNOWN_TYPE - * @tc.desc : After adding slottype to UNKNOWN_TYPE's slot, - * call getsbybundle for information.(promise) - */ - it('ActsAnsGetSlotsByBundle_0200', 0, async function (done) { - console.debug("====>ActsAnsGetSlotsByBundle_0200 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - console.debug("====>addSlotByTypePromise UNKNOWN_TYPE enter====>"); - await notification.addSlot(notification.SlotType.UNKNOWN_TYPE); - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsGetSlotsByBundle_0200====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(1) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.removeSlot(notification.SlotType.UNKNOWN_TYPE, (err)=>{ - console.debug("====>removeSlot UNKNOWN_TYPE====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsGetSlotsByBundle_0300 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : After adding slottype to SOCIAL_COMMUNICATION's slot, - * call getsbybundle for information.(promise) - */ - it('ActsAnsGetSlotsByBundle_0300', 0, async function (done) { - console.debug("====>ActsAnsGetSlotsByBundle_0300 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - console.debug("====>addSlotByTypePromise SOCIAL_COMMUNICATION enter====>"); - await notification.addSlot(notification.SlotType.SOCIAL_COMMUNICATION); - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsGetSlotsByBundle_0300====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(1) - expect(data[0].level).assertEqual(4) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(2) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{ - console.debug("====>removeSlot SOCIAL_COMMUNICATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - - }) - - /* - * @tc.number : ActsAnsGetSlotsByBundle_0400 - * @tc.name : Verify getSlot CONTENT_INFORMATION - * @tc.desc : After adding slottype to CONTENT_INFORMATION's slot, - * call getsbybundle for information.(promise) - */ - it('ActsAnsGetSlotsByBundle_0400', 0, async function (done) { - console.debug("====>ActsAnsGetSlotsByBundle_0400 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - console.debug("====>addSlotByTypePromise CONTENT_INFORMATION enter====>"); - await notification.addSlot(notification.SlotType.CONTENT_INFORMATION); - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsGetSlotsByBundle_0400====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(3) - expect(data[0].level).assertEqual(2) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>ActsAnsGetSlotsByBundle_0400 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.removeSlot(notification.SlotType.CONTENT_INFORMATION, (err)=>{ - console.debug("====>removeSlot CONTENT_INFORMATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - - }) - - /* - * @tc.number : ActsAnsGetSlotsByBundle_0500 - * @tc.name : Verify getSlot OTHER_TYPES - * @tc.desc : After adding slottype to OTHER_TYPES's slot, - * call getsbybundle for information.(promise) - */ - it('ActsAnsGetSlotsByBundle_0500', 0, async function (done) { - console.debug("====>ActsAnsGetSlotsByBundle_0500 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - console.debug("====>addSlotByTypePromise OTHER_TYPES enter====>"); - await notification.addSlot(notification.SlotType.OTHER_TYPES); - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsGetSlotsByBundle_0500====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(1) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.removeSlot(notification.SlotType.OTHER_TYPES, (err)=>{ - console.debug("====>removeSlot OTHER_TYPES====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - - }) - - /* - * @tc.number : ActsAnsGetSlotsByBundle_0600 - * @tc.name : Verify getSlot SERVICE_INFORMATION - * @tc.desc : After adding slottype to SERVICE_INFORMATION's slot, - * call getsbybundle for information.(callback) - */ - it('ActsAnsGetSlotsByBundle_0600', 0, async function (done) { - console.debug("====>ActsAnsGetSlotsByBundle_0600 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - console.debug("====>addSlotByTypePromise SERVICE_INFORMATION enter====>"); - await notification.addSlot(notification.SlotType.SERVICE_INFORMATION); - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption, (err, data) => { - console.debug("====>ActsAnsGetSlotsByBundle_0600====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(2) - expect(data[0].level).assertEqual(3) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(2) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>removeSlot SERVICE_INFORMATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsGetSlotsByBundle_0700 - * @tc.name : Verify getSlot UNKNOWN_TYPE - * @tc.desc : After adding slottype to UNKNOWN_TYPE's slot, - * call getsbybundle for information.(callback) - */ - it('ActsAnsGetSlotsByBundle_0700', 0, async function (done) { - console.debug("====>ActsAnsGetSlotsByBundle_0700 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - console.debug("====>addSlotByTypePromise UNKNOWN_TYPE enter====>"); - await notification.addSlot(notification.SlotType.UNKNOWN_TYPE); - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption, (err, data) => { - console.debug("====>ActsAnsGetSlotsByBundle_0700====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(1) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.removeSlot(notification.SlotType.UNKNOWN_TYPE, (err)=>{ - console.debug("====>removeSlot UNKNOWN_TYPE====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsGetSlotsByBundle_0800 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : After adding slottype to SOCIAL_COMMUNICATION's slot, - * call getsbybundle for information.(callback) - */ - it('ActsAnsGetSlotsByBundle_0800', 0, async function (done) { - console.debug("====>ActsAnsGetSlotsByBundle_0800 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - console.debug("====>addSlotByTypePromise SOCIAL_COMMUNICATION enter====>"); - await notification.addSlot(notification.SlotType.SOCIAL_COMMUNICATION); - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption, (err, data) => { - console.debug("====>ActsAnsGetSlotsByBundle_0800====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(1) - expect(data[0].level).assertEqual(4) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(2) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{ - console.debug("====>removeSlot SOCIAL_COMMUNICATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsGetSlotsByBundle_0900 - * @tc.name : Verify getSlot CONTENT_INFORMATION - * @tc.desc : After adding slottype to CONTENT_INFORMATION's slot, - * call getsbybundle for information.(callback) - */ - it('ActsAnsGetSlotsByBundle_0900', 0, async function (done) { - console.debug("====>ActsAnsGetSlotsByBundle_0900 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - console.debug("====>addSlotByTypePromise CONTENT_INFORMATION enter====>"); - await notification.addSlot(notification.SlotType.CONTENT_INFORMATION); - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption, (err, data) => { - console.debug("====>ActsAnsGetSlotsByBundle_0900====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(3) - expect(data[0].level).assertEqual(2) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.removeSlot(notification.SlotType.CONTENT_INFORMATION, (err)=>{ - console.debug("====>removeSlot CONTENT_INFORMATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsGetSlotsByBundle_1000 - * @tc.name : Verify getSlot OTHER_TYPES - * @tc.desc : After adding slottype to OTHER_TYPES's slot, - * call getsbybundle for information.(callback) - */ - it('ActsAnsGetSlotsByBundle_1000', 0, async function (done) { - console.debug("====>ActsAnsGetSlotsByBundle_1000 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - console.debug("====>addSlotByTypePromise OTHER_TYPES enter====>"); - await notification.addSlot(notification.SlotType.OTHER_TYPES); - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption, (err, data) => { - console.debug("====>ActsAnsGetSlotsByBundle_1000====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(1) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.removeSlot(notification.SlotType.OTHER_TYPES, (err)=>{ - console.debug("====>removeSlot OTHER_TYPES====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsGetSlotsByBundle_1100 - * @tc.name : Verify getSlot OTHER_TYPES - * @tc.desc : After adding slottype to OTHER_TYPES's slot, - * call getsbybundle for information.(callback) - */ - it('ActsAnsGetSlotsByBundle_1100', 0, async function (done) { - console.debug("====>ActsAnsGetSlotsByBundle_1100 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - console.debug("====>addSlotByTypePromise OTHER_TYPES enter====>"); - await notification.addSlot(notification.SlotType.OTHER_TYPES); - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption, (err, data) => { - console.debug("====>ActsAnsGetSlotsByBundle_1100====>" + JSON.stringify(data) ); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(1) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].enabled).assertEqual(true) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.removeSlot(notification.SlotType.OTHER_TYPES, (err)=>{ - console.debug("====>removeSlot OTHER_TYPES====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_0100 - * @tc.name : Verify getSlot SERVICE_INFORMATION - * @tc.desc : After adding slottype to SERVICE_INFORMATION's slot, - * call getsbybundle for information, and then call setSlotByBundle - * to update the information.(promise) - */ - it('ActsAnsSetSlotByBundle_0100', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_0100 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot = { - type: notification.SlotType.SERVICE_INFORMATION, - level: 4 - } - console.debug("====>addSlotByTypePromise SERVICE_INFORMATION enter====>"); - await notification.addSlot(notification.SlotType.SERVICE_INFORMATION); - console.debug("====>getSlotsByBundle1 start====>"); - var data = await notification.getSlotsByBundle(bundleoption) - console.debug("====>ActsAnsSetSlotByBundle_0100====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(2) - expect(data[0].level).assertEqual(3) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(2) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - console.debug("====>setSlotsByBundle====>") - await notification.setSlotByBundle(bundleoption, notificationslot); - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsSetSlotByBundle_0100.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(2) - expect(data[0].level).assertEqual(4) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(2) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>removeSlot SERVICE_INFORMATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_0200 - * @tc.name : Verify getSlot UNKNOWN_TYPE - * @tc.desc : After adding slottype to UNKNOWN_TYPE's slot, - * call getsbybundle for information, and then call setSlotByBundle - * to update the information.(promise) - */ - it('ActsAnsSetSlotByBundle_0200', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_0200 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot = { - type: notification.SlotType.UNKNOWN_TYPE, - level: 4 - } - console.debug("====>addSlotByTypePromise UNKNOWN_TYPE enter====>"); - await notification.addSlot(notification.SlotType.UNKNOWN_TYPE); - console.debug("====>getSlotsByBundle1 start====>"); - var data = await notification.getSlotsByBundle(bundleoption) - console.debug("====>ActsAnsSetSlotByBundle_0200====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(1) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - console.debug("====>setSlotsByBundle====>") - await notification.setSlotByBundle(bundleoption, notificationslot); - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsSetSlotByBundle_0200.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(4) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.UNKNOWN_TYPE, (err)=>{ - console.debug("====>removeSlot UNKNOWN_TYPE====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_0300 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : After adding slottype to SOCIAL_COMMUNICATION's slot, - * call getsbybundle for information, and then call setSlotByBundle - * to update the information.(promise) - */ - it('ActsAnsSetSlotByBundle_0300', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_0300 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot = { - type: notification.SlotType.SOCIAL_COMMUNICATION, - level: 3 - } - console.debug("====>addSlotByTypePromise SOCIAL_COMMUNICATION enter====>"); - await notification.addSlot(notification.SlotType.SOCIAL_COMMUNICATION); - console.debug("====>getSlotsByBundle1 start====>"); - var data = await notification.getSlotsByBundle(bundleoption) - console.debug("====>ActsAnsSetSlotByBundle_0300====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(1) - expect(data[0].level).assertEqual(4) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(2) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - await notification.setSlotByBundle(bundleoption, notificationslot); - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsSetSlotByBundle_0300.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(1) - expect(data[0].level).assertEqual(3) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(2) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{ - console.debug("====>removeSlot SOCIAL_COMMUNICATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_0400 - * @tc.name : Verify getSlot CONTENT_INFORMATION - * @tc.desc : After adding slottype to CONTENT_INFORMATION's slot, - * call getsbybundle for information, and then call setSlotByBundle - * to update the information.(promise) - */ - it('ActsAnsSetSlotByBundle_0400', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_0400 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot = { - type: notification.SlotType.CONTENT_INFORMATION, - level: 4 - } - console.debug("====>addSlotByTypePromise CONTENT_INFORMATION enter====>"); - await notification.addSlot(notification.SlotType.CONTENT_INFORMATION); - console.debug("====>getSlotsByBundle1 start====>"); - var data = await notification.getSlotsByBundle(bundleoption) - console.debug("====>ActsAnsSetSlotByBundle_0400====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(3) - expect(data[0].level).assertEqual(2) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - console.debug("====>setSlotsByBundle====>") - await notification.setSlotByBundle(bundleoption, notificationslot); - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsSetSlotByBundle_0400.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(3) - expect(data[0].level).assertEqual(4) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.CONTENT_INFORMATION, (err)=>{ - console.debug("====>removeSlot CONTENT_INFORMATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_0500 - * @tc.name : Verify getSlot OTHER_TYPES - * @tc.desc : After adding slottype to OTHER_TYPES's slot, - * call getsbybundle for information, and then call setSlotByBundle - * to update the information.(promise) - */ - it('ActsAnsSetSlotByBundle_0500', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_0500 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot = { - type: notification.SlotType.OTHER_TYPES, - level: 4 - } - console.debug("====>addSlotByTypePromise OTHER_TYPES enter====>"); - await notification.addSlot(notification.SlotType.OTHER_TYPES); - console.debug("====>getSlotsByBundle1 start====>"); - var data = await notification.getSlotsByBundle(bundleoption) - console.debug("====>ActsAnsSetSlotByBundle_0500====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(1) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - console.debug("====>setSlotsByBundle====>") - await notification.setSlotByBundle(bundleoption, notificationslot); - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsSetSlotByBundle_0500.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(4) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.OTHER_TYPES, (err)=>{ - console.debug("====>removeSlot OTHER_TYPES====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_0600 - * @tc.name : Verify getSlot SERVICE_INFORMATION - * @tc.desc : After adding slottype to SERVICE_INFORMATION's slot, - * call getsbybundle for information, and then call setSlotByBundle - * to update the information.(callback) - */ - it('ActsAnsSetSlotByBundle_0600', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_0600 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot = { - type: notification.SlotType.SERVICE_INFORMATION, - level: 4 - } - console.debug("====>addSlotByTypePromise SERVICE_INFORMATION enter====>"); - notification.addSlot(notification.SlotType.SERVICE_INFORMATION,()=>{ - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_0600====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(2) - expect(data[0].level).assertEqual(3) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(2) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.setSlotByBundle(bundleoption, notificationslot, () => { - console.debug("====>setSlotsByBundle====>") - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_0600.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(2) - expect(data[0].level).assertEqual(4) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(2) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>removeSlot SERVICE_INFORMATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_0700 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : After adding slottype to UNKNOWN_TYPE's slot, - * call getsbybundle for information, and then call setSlotByBundle - * to update the information.(callback) - */ - it('ActsAnsSetSlotByBundle_0700', 0, async function (done) { - console.debug("====>ActsAnsSlotByBundle_0100 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot = { - type: notification.SlotType.UNKNOWN_TYPE, - level: 4 - } - console.debug("====>addSlotByTypePromise UNKNOWN_TYPE enter====>"); - notification.addSlot(notification.SlotType.UNKNOWN_TYPE,() => { - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_0700====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(1) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.setSlotByBundle(bundleoption, notificationslot, () => { - console.debug("====>setSlotsByBundle====>") - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_0700.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(4) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.UNKNOWN_TYPE, (err)=>{ - console.debug("====>removeSlot UNKNOWN_TYPE====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_0800 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : After adding slottype to SOCIAL_COMMUNICATION's slot, - * call getsbybundle for information, and then call setSlotByBundle - * to update the information.(callback) - */ - it('ActsAnsSetSlotByBundle_0800', 0, async function (done) { - console.debug("====>ActsAnsSlotByBundle_0100 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot = { - type: notification.SlotType.SOCIAL_COMMUNICATION, - level: 3 - } - console.debug("====>addSlotByTypePromise SOCIAL_COMMUNICATION enter====>"); - notification.addSlot(notification.SlotType.SOCIAL_COMMUNICATION,() => { - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_0800====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(1) - expect(data[0].level).assertEqual(4) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(2) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.setSlotByBundle(bundleoption, notificationslot, () => { - console.debug("====>setSlotsByBundle====>") - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_0800.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(1) - expect(data[0].level).assertEqual(3) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(2) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{ - console.debug("====>removeSlot SOCIAL_COMMUNICATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_0900 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : After adding slottype to CONTENT_INFORMATION's slot, - * call getsbybundle for information, and then call setSlotByBundle - * to update the information.(callback) - */ - it('ActsAnsSetSlotByBundle_0900', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_0900 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot = { - type: notification.SlotType.CONTENT_INFORMATION, - level: 4 - } - console.debug("====>addSlotByTypePromise CONTENT_INFORMATION enter====>"); - notification.addSlot(notification.SlotType.CONTENT_INFORMATION,() => { - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_0900====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(3) - expect(data[0].level).assertEqual(2) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - - notification.setSlotByBundle(bundleoption, notificationslot, () => { - console.debug("====>setSlotsByBundle====>") - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_0900.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(3) - expect(data[0].level).assertEqual(4) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.CONTENT_INFORMATION, (err)=>{ - console.debug("====>removeSlot CONTENT_INFORMATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_1000 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : After adding slottype to OTHER_TYPES's slot, - * call getsbybundle for information, and then call setSlotByBundle - * to update the information.(callback) - */ - it('ActsAnsSetSlotByBundle_1000', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_1000 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot = { - type: notification.SlotType.OTHER_TYPES, - level: 4 - } - console.debug("====>addSlotByTypePromise OTHER_TYPES enter====>"); - await notification.addSlot(notification.SlotType.OTHER_TYPES,() => { - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_1000====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(1) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.setSlotByBundle(bundleoption, notificationslot, () => { - console.debug("====>setSlotsByBundle====>") - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_1000.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(4) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.OTHER_TYPES, (err)=>{ - console.debug("====>removeSlot OTHER_TYPES====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_1100 - * @tc.name : Verify getSlot SERVICE_INFORMATION - * @tc.desc : After adding slottype to SERVICE_INFORMATION's slot, - * call getsbybundle for information, and then call setSlotByBundle - * twice to update the information.(promise) - */ - it('ActsAnsSetSlotByBundle_1100', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_1100 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot1 = { - type: notification.SlotType.SERVICE_INFORMATION, - level: 4 - } - var notificationslot2 = { - type: notification.SlotType.SERVICE_INFORMATION, - lockscreenVisibility: 1 - } - console.debug("====>addSlotByTypePromise SERVICE_INFORMATION enter====>"); - await notification.addSlot(notification.SlotType.SERVICE_INFORMATION); - console.debug("====>getSlotsByBundle1 start====>"); - var data = await notification.getSlotsByBundle(bundleoption) - console.debug("====>ActsAnsSetSlotByBundle_1100====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(2) - expect(data[0].level).assertEqual(3) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(2) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - console.debug("====>setSlotsByBundle1====>") - await notification.setSlotByBundle(bundleoption, notificationslot1); - console.debug("====>setSlotsByBundle2====>") - await notification.setSlotByBundle(bundleoption, notificationslot2); - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsSetSlotByBundle_1100.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(2) - expect(data[0].level).assertEqual(3) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(1) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>removeSlot SERVICE_INFORMATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_1200 - * @tc.name : Verify getSlot UNKNOWN_TYPE - * @tc.desc : After adding slottype to UNKNOWN_TYPE's slot, - * call getsbybundle for information, and then call setSlotByBundle - * twice to update the information.(promise) - */ - it('ActsAnsSetSlotByBundle_1200', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_1200 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot1 = { - type: notification.SlotType.UNKNOWN_TYPE, - level: 4 - } - var notificationslot2 = { - type: notification.SlotType.UNKNOWN_TYPE, - lockscreenVisibility: 1 - } - console.debug("====>addSlotByTypePromise UNKNOWN_TYPE enter====>"); - await notification.addSlot(notification.SlotType.UNKNOWN_TYPE); - console.debug("====>getSlotsByBundle1 start====>"); - var data = await notification.getSlotsByBundle(bundleoption) - console.debug("====>ActsAnsSetSlotByBundle_1200====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(1) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - console.debug("====>setSlotsByBundle1====>") - await notification.setSlotByBundle(bundleoption, notificationslot1); - console.debug("====>setSlotsByBundle2====>") - await notification.setSlotByBundle(bundleoption, notificationslot2); - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsSetSlotByBundle_1200.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(1) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(1) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.UNKNOWN_TYPE, (err)=>{ - console.debug("====>removeSlot UNKNOWN_TYPE====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_1300 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : After adding slottype to SOCIAL_COMMUNICATION's slot, - * call getsbybundle for information, and then call setSlotByBundle - * twice to update the information.(promise) - */ - it('ActsAnsSetSlotByBundle_1300', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_1300 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot1 = { - type: notification.SlotType.SOCIAL_COMMUNICATION, - level: 4 - } - var notificationslot2 = { - type: notification.SlotType.SOCIAL_COMMUNICATION, - lockscreenVisibility: 1 - } - console.debug("====>addSlotByTypePromise SOCIAL_COMMUNICATION enter====>"); - await notification.addSlot(notification.SlotType.SOCIAL_COMMUNICATION); - console.debug("====>getSlotsByBundle1 start====>"); - var data = await notification.getSlotsByBundle(bundleoption) - console.debug("====>ActsAnsSetSlotByBundle_1300====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(1) - expect(data[0].level).assertEqual(4) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(2) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - console.debug("====>setSlotsByBundle1====>") - await notification.setSlotByBundle(bundleoption, notificationslot1); - console.debug("====>setSlotsByBundle2====>") - await notification.setSlotByBundle(bundleoption, notificationslot2); - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsSetSlotByBundle_1300.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(1) - expect(data[0].level).assertEqual(4) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(1) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{ - console.debug("====>removeSlot SOCIAL_COMMUNICATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_1400 - * @tc.name : Verify getSlot CONTENT_INFORMATION - * @tc.desc : After adding slottype to CONTENT_INFORMATION's slot, - * call getsbybundle for information, and then call setSlotByBundle - * twice to update the information.(promise) - */ - it('ActsAnsSetSlotByBundle_1400', 0, async function (done) { - console.debug("====>ActsAnsSlotByBundle_0100 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot1 = { - type: notification.SlotType.CONTENT_INFORMATION, - level: 4 - } - var notificationslot2 = { - type: notification.SlotType.CONTENT_INFORMATION, - lockscreenVisibility: 1 - } - console.debug("====>addSlotByTypePromise CONTENT_INFORMATION enter====>"); - await notification.addSlot(notification.SlotType.CONTENT_INFORMATION); - console.debug("====>getSlotsByBundle1 start====>"); - var data = await notification.getSlotsByBundle(bundleoption) - console.debug("====>ActsAnsSetSlotByBundle_1400====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(3) - expect(data[0].level).assertEqual(2) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - console.debug("====>setSlotsByBundle1====>") - await notification.setSlotByBundle(bundleoption, notificationslot1); - console.debug("====>setSlotsByBundle2====>") - await notification.setSlotByBundle(bundleoption, notificationslot2); - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsSetSlotByBundle_1400.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(3) - expect(data[0].level).assertEqual(2) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(1) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.CONTENT_INFORMATION, (err)=>{ - console.debug("====>removeSlot CONTENT_INFORMATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_1500 - * @tc.name : Verify getSlot OTHER_TYPES - * @tc.desc : After adding slottype to OTHER_TYPES's slot, - * call getsbybundle for information, and then call setSlotByBundle - * twice to update the information.(promise) - */ - it('ActsAnsSetSlotByBundle_1500', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_1500 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot1 = { - type: notification.SlotType.OTHER_TYPES, - level: 4 - } - var notificationslot2 = { - type: notification.SlotType.OTHER_TYPES, - lockscreenVisibility: 1 - } - console.debug("====>addSlotByTypePromise OTHER_TYPES enter====>"); - await notification.addSlot(notification.SlotType.OTHER_TYPES); - console.debug("====>getSlotsByBundle1 start====>"); - var data = await notification.getSlotsByBundle(bundleoption) - console.debug("====>ActsAnsSetSlotByBundle_1500====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(1) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - console.debug("====>setSlotsByBundle1====>") - await notification.setSlotByBundle(bundleoption, notificationslot1); - console.debug("====>setSlotsByBundle2====>") - await notification.setSlotByBundle(bundleoption, notificationslot2); - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsSetSlotByBundle_1500.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(1) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(1) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.OTHER_TYPES, (err)=>{ - console.debug("====>removeSlot OTHER_TYPES====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_1600 - * @tc.name : Verify getSlot SERVICE_INFORMATION - * @tc.desc : After adding slottype to SERVICE_INFORMATION's slot, - * call getsbybundle for information, and then call setSlotByBundle - * twice to update the information.(callback) - */ - it('ActsAnsSetSlotByBundle_1600', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_1600 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot1 = { - type: notification.SlotType.SERVICE_INFORMATION, - level: 4 - } - var notificationslot2 = { - type: notification.SlotType.SERVICE_INFORMATION, - lockscreenVisibility: 1 - } - console.debug("====>addSlotByTypePromise SERVICE_INFORMATION enter====>"); - notification.addSlot(notification.SlotType.SERVICE_INFORMATION,() => { - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_1600====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(2) - expect(data[0].level).assertEqual(3) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(2) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.setSlotByBundle(bundleoption, notificationslot1, () => { - console.debug("====>setSlotsByBundle1====>") - notification.setSlotByBundle(bundleoption, notificationslot2, () => { - console.debug("====>setSlotsByBundle2====>") - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_1600.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(2) - expect(data[0].level).assertEqual(3) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(1) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>removeSlot SERVICE_INFORMATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - }) - }) - }) - }) - - - /* - * @tc.number : ActsAnsSetSlotByBundle_1700 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : After adding slottype to UNKNOWN_TYPE's slot, - * call getsbybundle for information, and then call setSlotByBundle - * twice to update the information.(callback) - */ - it('ActsAnsSetSlotByBundle_1700', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_1700 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot1 = { - type: notification.SlotType.UNKNOWN_TYPE, - level: 4 - } - var notificationslot2 = { - type: notification.SlotType.UNKNOWN_TYPE, - lockscreenVisibility: 1 - } - console.debug("====>addSlotByTypePromise UNKNOWN_TYPE enter====>"); - notification.addSlot(notification.SlotType.UNKNOWN_TYPE,() => { - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_1700====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(1) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.setSlotByBundle(bundleoption, notificationslot1, () => { - console.debug("====>setSlotsByBundle1====>") - notification.setSlotByBundle(bundleoption, notificationslot2, () => { - console.debug("====>setSlotsByBundle2====>") - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_1700.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(1) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(1) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.UNKNOWN_TYPE, (err)=>{ - console.debug("====>removeSlot UNKNOWN_TYPE====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - }) - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_1800 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : After adding slottype to SOCIAL_COMMUNICATION's slot, - * call getsbybundle for information, and then call setSlotByBundle - * twice to update the information.(callback) - */ - it('ActsAnsSetSlotByBundle_1800', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_1800 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot1 = { - type: notification.SlotType.SOCIAL_COMMUNICATION, - level: 4 - } - var notificationslot2 = { - type: notification.SlotType.SOCIAL_COMMUNICATION, - lockscreenVisibility: 1 - } - console.debug("====>addSlotByTypePromise SOCIAL_COMMUNICATION enter====>"); - notification.addSlot(notification.SlotType.SOCIAL_COMMUNICATION,() => { - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_1800====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(1) - expect(data[0].level).assertEqual(4) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(2) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.setSlotByBundle(bundleoption, notificationslot1, () => { - console.debug("====>setSlotsByBundle1====>") - notification.setSlotByBundle(bundleoption, notificationslot2, () => { - console.debug("====>setSlotsByBundle2====>") - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_1800.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(1) - expect(data[0].level).assertEqual(4) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(1) - expect(data[0].vibrationEnabled).assertEqual(true) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{ - console.debug("====>removeSlot SOCIAL_COMMUNICATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - }) - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_1900 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : After adding slottype to CONTENT_INFORMATION's slot, - * call getsbybundle for information, and then call setSlotByBundle - * twice to update the information.(callback) - */ - it('ActsAnsSetSlotByBundle_1900', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_1900 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot1 = { - type: notification.SlotType.CONTENT_INFORMATION, - level: 4 - } - var notificationslot2 = { - type: notification.SlotType.CONTENT_INFORMATION, - lockscreenVisibility: 1 - } - console.debug("====>addSlotByTypePromise CONTENT_INFORMATION enter====>"); - notification.addSlot(notification.SlotType.CONTENT_INFORMATION,() => { - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_1900====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(3) - expect(data[0].level).assertEqual(2) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.setSlotByBundle(bundleoption, notificationslot1, () => { - console.debug("====>setSlotsByBundle1====>") - notification.setSlotByBundle(bundleoption, notificationslot2, () => { - console.debug("====>setSlotsByBundle2====>") - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_1900.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(3) - expect(data[0].level).assertEqual(2) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(1) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.CONTENT_INFORMATION, (err)=>{ - console.debug("====>removeSlot CONTENT_INFORMATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - }) - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_2000 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : After adding slottype to OTHER_TYPES's slot, - * call getsbybundle for information, and then call setSlotByBundle - * twice to update the information.(callback) - */ - it('ActsAnsSetSlotByBundle_2000', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_2000 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot1 = { - type: notification.SlotType.OTHER_TYPES, - level: 4 - } - var notificationslot2 = { - type: notification.SlotType.OTHER_TYPES, - lockscreenVisibility: 1 - } - console.debug("====>addSlotByTypePromise OTHER_TYPES enter====>"); - notification.addSlot(notification.SlotType.OTHER_TYPES,() => { - console.debug("====>getSlotsByBundle1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_2000====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(1) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(3) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1 finish====>"); - console.debug("====>setSlotByBundle start====>"); - notification.setSlotByBundle(bundleoption, notificationslot1, () => { - console.debug("====>setSlotsByBundle1====>") - notification.setSlotByBundle(bundleoption, notificationslot2, () => { - console.debug("====>setSlotsByBundle2====>") - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_2000.1====>" + JSON.stringify(data)); - expect(data[0].type).assertEqual(65535) - expect(data[0].level).assertEqual(1) - expect(data[0].badgeFlag).assertEqual(true) - expect(data[0].bypassDnd).assertEqual(false) - expect(data[0].lockscreenVisibility).assertEqual(1) - expect(data[0].vibrationEnabled).assertEqual(false) - expect(data[0].lightEnabled).assertEqual(false) - expect(data[0].lightColor).assertEqual(0) - console.debug("====>getSlotsByBundle1.1 finish====>"); - notification.removeSlot(notification.SlotType.OTHER_TYPES, (err)=>{ - console.debug("====>removeSlot OTHER_TYPES====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - }) - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_2100 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : Do not call addSlot, call setSlotByBundle directly, - * and then call getSlotsByBundle query results.(callback) - */ - it('ActsAnsSetSlotByBundle_2100', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_2100 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot = { - type: notification.SlotType.OTHER_TYPES, - level: 4 - } - notification.setSlotByBundle(bundleoption, notificationslot, (err) => { - console.debug("====>setSlotsByBundle1====>") - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption,(err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_2100====>" + JSON.stringify(data)); - expect(typeof(data)).assertEqual("object") - console.debug("====>getSlotsByBundle1.1 finish====>"); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsSetSlotByBundle_2200 - * @tc.name : Verify getSlot OTHER_TYPES - * @tc.desc : Do not call addSlot, call setSlotByBundle directly, - * and then call getSlotsByBundle query results.(promise) - */ - it('ActsAnsSetSlotByBundle_2200', 0, async function (done) { - console.debug("====>ActsAnsSetSlotByBundle_2200 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - var notificationslot = { - type: notification.SlotType.OTHER_TYPES, - level: 4, - - } - notification.setSlotByBundle(bundleoption, notificationslot).then(() => { - }).catch((err)=>{ - console.debug("====>setSlotsByBundle1====>") - console.debug("====>getSlotsByBundle1.1 start====>"); - notification.getSlotsByBundle(bundleoption, (err,data) => { - console.debug("====>ActsAnsSetSlotByBundle_2200====>" + JSON.stringify(data)); - expect(typeof(data)).assertEqual("object") - console.debug("====>getSlotsByBundle1.1 finish====>"); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsGetSlotNumByBundle_0100 - * @tc.name : Verify getSlot SERVICE_INFORMATION - * @tc.desc : After adding slot, call getSlotNumByBundle for information.(callback) - */ - it('ActsAnsGetSlotNumByBundle_0100', 0, async function (done) { - console.debug("====>ActsAnsGetSlotNumByBundle_0600 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - console.debug("====>addSlotByTypePromise SERVICE_INFORMATION enter====>"); - notification.addSlot(notification.SlotType.SERVICE_INFORMATION,() => { - notification.getSlotNumByBundle(bundleoption, (err, data) => { - console.debug("====>ActsAnsGetSlotNumByBundle_0100====>" + JSON.stringify(data)); - expect(data).assertEqual(1) - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>removeSlot SERVICE_INFORMATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - }) - - /* - * @tc.number : ActsAnsGetSlotNumByBundle_0200 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : After adding slot, call getSlotNumByBundle for information.(promise) - */ - it('ActsAnsGetSlotNumByBundle_0200', 0, async function (done) { - console.debug("====>ActsAnsGetSlotNumByBundle_0200 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - console.debug("====>addSlotByTypePromise SERVICE_INFORMATION enter====>"); - await notification.addSlot(notification.SlotType.SERVICE_INFORMATION); - notification.getSlotNumByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsGetSlotNumByBundle_0200====>" + JSON.stringify(data)); - expect(data).assertEqual(1) - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>removeSlot SERVICE_INFORMATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - - - - /* - * @tc.number : ActsAnsGetSlotNumByBundle_0300 - * @tc.name : Verify getSlot SERVICE_INFORMATION - * @tc.desc : After adding twice different type slot, - * call getSlotNumByBundle for information.(callback) - */ - it('ActsAnsGetSlotNumByBundle_0300', 0, async function (done) { - console.debug("====>ActsAnsGetSlotNumByBundle_0300 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - console.debug("====>addSlotByTypePromise SERVICE_INFORMATION enter====>"); - notification.addSlot(notification.SlotType.SERVICE_INFORMATION, () => { - console.debug("====>addSlotByTypePromise CONTENT_INFORMATION enter====>"); - notification.addSlot(notification.SlotType.CONTENT_INFORMATION, () => { - notification.getSlotNumByBundle(bundleoption, (err, data) => { - console.debug("====>ActsAnsGetSlotNumByBundle_0300====>" + JSON.stringify(data)); - expect(data).assertEqual(2) - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>removeSlot SERVICE_INFORMATION====>"); - console.debug("====>SERVICE_INFORMATION err.code====>" + JSON.stringify(err.code)); - expect(err.code).assertEqual(0); - notification.removeSlot(notification.SlotType.CONTENT_INFORMATION, (err)=>{ - console.debug("====>removeSlot CONTENT_INFORMATION====>"); - console.debug("====>CONTENT_INFORMATION err.code====>" + JSON.stringify(err.code)); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - }) - }) - }) - - /* - * @tc.number : ActsAnsGetSlotNumByBundle_0400 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : After adding twice different type slot, - * call getSlotNumByBundle for information.(promise) - */ - it('ActsAnsGetSlotNumByBundle_0400', 0, async function (done) { - console.debug("====>ActsAnsGetSlotNumByBundle_0400 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - console.debug("====>addSlotByTypePromise SERVICE_INFORMATION enter====>"); - await notification.addSlot(notification.SlotType.SERVICE_INFORMATION); - console.debug("====>addSlotByTypePromise CONTENT_INFORMATION enter====>"); - await notification.addSlot(notification.SlotType.CONTENT_INFORMATION); - notification.getSlotNumByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsGetSlotNumByBundle_0400====>" + JSON.stringify(data)); - expect(data).assertEqual(2) - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>removeSlot SERVICE_INFORMATION====>"); - expect(err.code).assertEqual(0); - notification.removeSlot(notification.SlotType.CONTENT_INFORMATION, (err)=>{ - console.debug("====>removeSlot CONTENT_INFORMATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - }) - - /* - * @tc.number : ActsAnsGetSlotNumByBundle_0500 - * @tc.name : Verify getSlot null - * @tc.desc : Call getSlotNumByBundle for information.(callback) - */ - it('ActsAnsGetSlotNumByBundle_0500', 0, async function (done) { - console.debug("====>ActsAnsGetSlotNumByBundle_0700 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - notification.getSlotNumByBundle(bundleoption, (err, data) => { - console.debug("====>ActsAnsGetSlotNumByBundle_0500====>" + JSON.stringify(data)); - expect(data).assertEqual(0) - done(); - }) - }) - - /* - * @tc.number : ActsAnsGetSlotNumByBundle_0600 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : Call getSlotNumByBundle for information.(promise) - */ - it('ActsAnsGetSlotNumByBundle_0600', 0, async function (done) { - console.debug("====>ActsAnsGetSlotNumByBundle_0600 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - notification.getSlotNumByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsGetSlotNumByBundle_0600====>" + JSON.stringify(data)); - expect(data).assertEqual(0) - done(); - }) - }) - - /* - * @tc.number : ActsAnsGetSlotNumByBundle_0700 - * @tc.name : Verify getSlot SERVICE_INFORMATION - * @tc.desc : After adding twice same type slot, - * call getSlotNumByBundle for information.(callback) - */ - it('ActsAnsGetSlotNumByBundle_0700', 0, async function (done) { - console.debug("====>ActsAnsGetSlotNumByBundle_0700 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - console.debug("====>addSlotByTypePromise SERVICE_INFORMATION enter====>"); - notification.addSlot(notification.SlotType.SERVICE_INFORMATION, ()=>{ - console.debug("====>addSlotByTypePromise SERVICE_INFORMATION enter====>"); - notification.addSlot(notification.SlotType.SERVICE_INFORMATION, ()=>{ - notification.getSlotNumByBundle(bundleoption, (err, data) => { - console.debug("====>ActsAnsGetSlotNumByBundle_0700====>" + JSON.stringify(data)); - expect(data).assertEqual(1) - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>removeSlot SERVICE_INFORMATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - }) - }) - - /* - * @tc.number : ActsAnsGetSlotNumByBundle_0800 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : After adding twice same type slot, - * call getSlotNumByBundle for information.(promise) - */ - it('ActsAnsGetSlotNumByBundle_0800', 0, async function (done) { - console.debug("====>ActsAnsGetSlotNumByBundle_0800 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundle" - } - console.debug("====>addSlotByTypePromise SERVICE_INFORMATION enter====>"); - await notification.addSlot(notification.SlotType.SERVICE_INFORMATION); - console.debug("====>addSlotByTypePromise SERVICE_INFORMATION enter====>"); - await notification.addSlot(notification.SlotType.SERVICE_INFORMATION); - notification.getSlotNumByBundle(bundleoption).then((data) => { - console.debug("====>ActsAnsGetSlotNumByBundle_0800====>" + JSON.stringify(data)); - expect(data).assertEqual(1) - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>removeSlot SERVICE_INFORMATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - - /* - * @tc.number : ActsAnsGetSlotNumByBundle_0900 - * @tc.name : Verify getSlot SERVICE_INFORMATION - * @tc.desc : Bundlename incorrectly adds slot after calling - * getSlotNumByBundle to get information.(callback) - */ - it('ActsAnsGetSlotNumByBundle_0900', 0, async function (done) { - console.debug("====>ActsAnsGetSlotNumByBundle_0900 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundleerr" - } - console.debug("====>addSlotByTypePromise SERVICE_INFORMATION enter====>"); - notification.addSlot(notification.SlotType.SERVICE_INFORMATION, ()=>{ - notification.getSlotNumByBundle(bundleoption, (err, data) => { - console.debug("====>ActsAnsGetSlotNumByBundle_0900====>" + JSON.stringify(data)); - expect(data).assertEqual(0) - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>removeSlot SERVICE_INFORMATION====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - }) - }) - - /* - * @tc.number : ActsAnsGetSlotNumByBundle_1000 - * @tc.name : Verify getSlot SOCIAL_COMMUNICATION - * @tc.desc : Bundlename incorrectly adds slot after calling - * getSlotNumByBundle to get information.(promise) - */ - it('ActsAnsGetSlotNumByBundle_1000', 0, async function (done) { - console.debug("====>ActsAnsGetSlotNumByBundle_1000 start====>"); - var bundleoption = { - bundle: "com.example.actsansslotbybundleerr" - } - console.debug("====>addSlotByTypePromise SERVICE_INFORMATION enter====>"); - await notification.addSlot(notification.SlotType.SERVICE_INFORMATION); - notification.getSlotNumByBundle(bundleoption).then((data) => { - }).catch((err)=>{ - expect(err!=0).assertEqual(true) - notification.removeSlot(notification.SlotType.SERVICE_INFORMATION, (err)=>{ - console.debug("====>removeSlot SERVICE_INFORMATION err:" + JSON.stringify(err)); - }) - done(); - }) - }) -}) - -} diff --git a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/test/List.test.js b/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/test/List.test.js deleted file mode 100644 index 7df6e8699aa467a2c42250c03235f6d901ab8b4e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsSlotByBundle from './ExampleJsunit.test.js' -export default function testsuite() { -ActsAnsSlotByBundle() -} diff --git a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/resources/base/element/string.json b/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/resources/base/element/string.json deleted file mode 100644 index 34cd948c6caff510223ec8ff37d30f3e01160abb..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotbybundle/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ActsAnsSlotByBundle" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - }, - { - "name": "MainAbility_desc", - "value": "description" - }, - { - "name": "MainAbility_label", - "value": "label" - }, - { - "name": "TestAbility_desc", - "value": "description" - }, - { - "name": "TestAbility_label", - "value": "label" - } - ] -} diff --git a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/BUILD.gn b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/BUILD.gn deleted file mode 100644 index 87226e0c68aacbde0b7107d6fb023c57ebc5cbba..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsSlotSystemCallbackTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsSlotSystemCallbackTest" - 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/actsansslottest/actsansslotsystemcallback/Test.json b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/Test.json deleted file mode 100644 index c7d2d5b5c88760051db03c7fdf8c9798871a93d4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "com.example.actsansslotsystemcallback", - "package-name": "com.example.actsansslotsystemcallback" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsSlotSystemCallbackTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/signature/openharmony_sx.p7b b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/config.json b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/config.json deleted file mode 100644 index 200c5bee3de086687cf2afcc86aafa6f5993cb3e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansslotsystemcallback", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansslotsystemcallback", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/MainAbility/app.js b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/actsansslottest/actsansslotsystemcallback/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index cc183ba6f171c0a02e11f8a2eecdf4247d8c8bc2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - {{title}} - -
diff --git a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 36aff80e2009819826c8e0ad1792fc9f7c91e0f1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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: "测试slot接口callback形式:系统应用" - }, - onInit() { - this.title = "测试slot接口callback形式:系统应用"; - }, - onShow() { - console.info('onShow finish') - }, - onReady() { - }, -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestAbility/app.js b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/actsansslottest/actsansslotsystemcallback/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/actsansslottest/actsansslotsystemcallback/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/actsansslottest/actsansslotsystemcallback/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index 50954a8be0133fb742ea572513c2f29848c50f58..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,217 +0,0 @@ -/* - * 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' - -const TIMEOUT = 2000; -export default function ActsAnsSlotSystemCallback() { -describe('ActsAnsSlotSystemCallback', function () { - - /* - * @tc.number : ActsAnsSlotSystemCallback_0100 - * @tc.name : Verify getSlots after adding slots and removeAllSlots - * @tc.desc : getSlots after adding all type slots and remove all slots - */ - it('ActsAnsSlotSystemCallback_0100', 0, async function (done) { - console.debug("====>ActsAnsSlotSystemCallback_0100 start====>"); - function timeOut(){ - console.debug("====>time out enter ActsAnsSlotSystemCallback_0100====>"); - } - console.debug("====>addSlot SOCIAL_COMMUNICATION====>"); - await notification.addSlot( - { - type: notification.SlotType.SOCIAL_COMMUNICATION, - level: notification.SlotLevel.LEVEL_NONE, - desc: "slot_SOCIAL_COMMUNICATION_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_SOCIAL_COMMUNICATION_sound", - lightEnabled: true, - lightColor: 1 - }); - console.debug("====>addSlot SERVICE_INFORMATION====>"); - await notification.addSlot( - { - type: notification.SlotType.SERVICE_INFORMATION, - level: notification.SlotLevel.LEVEL_MIN, - desc: "slot_SERVICE_INFORMATION_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_SERVICE_INFORMATION_sound", - lightEnabled: true, - lightColor: 2 - }); - await notification.addSlot( - { - type: notification.SlotType.CONTENT_INFORMATION, - level: notification.SlotLevel.LEVEL_LOW, - desc: "slot_CONTENT_INFORMATION_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_CONTENT_INFORMATION_sound", - lightEnabled: true, - lightColor: 3 - }); - console.debug("====>addSlot OTHER_TYPES====>"); - await notification.addSlot( - { - type: notification.SlotType.OTHER_TYPES, - level: notification.SlotLevel.LEVEL_DEFAULT, - desc: "slot_OTHER_TYPES_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_OTHER_TYPES_sound", - lightEnabled: true, - lightColor: 4 - }); - console.debug("====>addSlot UNKNOWN_TYPE====>"); - await notification.addSlot( - { - type: notification.SlotType.UNKNOWN_TYPE, - level: notification.SlotLevel.LEVEL_HIGH, - desc: "slot_UNKNOWN_TYPE_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_UNKNOWN_TYPE_sound", - lightEnabled: true, - lightColor: 5 - }); - notification.getSlots((err, data)=>{ - console.debug("====>getSlots enter====>"); - console.debug("====>getSlots data====>" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlots data====>" + JSON.stringify(data)); - try{ - expect(data[0].type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION); - expect(data[0].level).assertEqual(notification.SlotLevel.LEVEL_NONE); - expect(data[0].desc).assertEqual("slot_SOCIAL_COMMUNICATION_desc"); - expect(data[0].badgeFlag).assertEqual(false); - expect(data[0].bypassDnd).assertEqual(true); - expect(data[0].vibrationEnabled).assertEqual(true); - expect(data[0].sound).assertEqual("slot_SOCIAL_COMMUNICATION_sound"); - expect(data[0].lightEnabled).assertEqual(true); - expect(data[0].lightColor).assertEqual(1); - - expect(data[1].type).assertEqual(notification.SlotType.SERVICE_INFORMATION); - expect(data[1].level).assertEqual(notification.SlotLevel.LEVEL_MIN); - expect(data[1].desc).assertEqual("slot_SERVICE_INFORMATION_desc"); - expect(data[1].badgeFlag).assertEqual(false); - expect(data[1].bypassDnd).assertEqual(true); - expect(data[1].vibrationEnabled).assertEqual(true); - expect(data[1].sound).assertEqual("slot_SERVICE_INFORMATION_sound"); - expect(data[1].lightEnabled).assertEqual(true); - expect(data[1].lightColor).assertEqual(2); - - expect(data[2].type).assertEqual(notification.SlotType.CONTENT_INFORMATION); - expect(data[2].level).assertEqual(notification.SlotLevel.LEVEL_LOW); - expect(data[2].desc).assertEqual("slot_CONTENT_INFORMATION_desc"); - expect(data[2].badgeFlag).assertEqual(false); - expect(data[2].bypassDnd).assertEqual(true); - expect(data[2].vibrationEnabled).assertEqual(true); - expect(data[2].sound).assertEqual("slot_CONTENT_INFORMATION_sound"); - expect(data[2].lightEnabled).assertEqual(true); - expect(data[2].lightColor).assertEqual(3); - - expect(data[3].type).assertEqual(notification.SlotType.OTHER_TYPES); - expect(data[3].level).assertEqual(notification.SlotLevel.LEVEL_DEFAULT); - expect(data[3].desc).assertEqual("slot_OTHER_TYPES_desc"); - expect(data[3].badgeFlag).assertEqual(false); - expect(data[3].bypassDnd).assertEqual(true); - expect(data[3].vibrationEnabled).assertEqual(true); - expect(data[3].sound).assertEqual("slot_OTHER_TYPES_sound"); - expect(data[3].lightEnabled).assertEqual(true); - expect(data[3].lightColor).assertEqual(4); - console.debug("====>getSlots end====>"); - notification.removeAllSlots((err)=>{ - console.debug("====>removeAllSlots ActsAnsSlotSystemCallback_0100 err====>" + JSON.stringify(err)); - console.debug("====>ActsAnsSlotSystemCallback_0100 end====>"); - expect(err.code).assertEqual(0); - done(); - }) - }catch(err){ - console.error("====>getSlots catch err====>" + JSON.stringify(err)); - expect().assertFail(); - done(); - } - }) - setTimeout(timeOut, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsSlotSystemPromise_0200 - * @tc.name : Verify that the same type of slot is added repeatedly - * @tc.desc : the same type of slot is added repeatedly, and the obtained slot is added for the first time - */ - it('ActsAnsSlotSystemCallback_0200', 0, async function (done) { - console.debug("====>ActsAnsSlotSystemCallback_0200 start====>"); - async function timeOutTwo(){ - console.debug("====>time out enter ActsAnsSlotSystemCallback_0200====>"); - } - console.debug("====>addSlot SOCIAL_COMMUNICATION====>"); - await notification.addSlot( - { - type: notification.SlotType.SOCIAL_COMMUNICATION, - level: notification.SlotLevel.LEVEL_NONE, - desc: "slot_SOCIAL_COMMUNICATION_Desc_First", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_SOCIAL_COMMUNICATION_Sound_First", - lightEnabled: true, - lightColor: 1 - }); - await notification.addSlot( - { - type: notification.SlotType.SOCIAL_COMMUNICATION, - level: notification.SlotLevel.LEVEL_DEFAULT, - desc: "slot_SOCIAL_COMMUNICATION_Desc_Second", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_SOCIAL_COMMUNICATION_Sound_Second", - lightEnabled: true, - lightColor: 1 - }); - console.debug("====>getSlot SlotType.SOCIAL_COMMUNICATION: ====>"); - notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err, data) => { - console.debug("====>getSlotActsAnsSlotSystemCallback_0200 enter====>"); - console.debug("====>getSlotActsAnsSlotSystemCallback_0200 err====>" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlotActsAnsSlotSystemCallback_0200 data====>" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION); - expect(data.level).assertEqual(notification.SlotLevel.LEVEL_NONE); - expect(data.desc).assertEqual("slot_SOCIAL_COMMUNICATION_Desc_First"); - expect(data.badgeFlag).assertEqual(false); - expect(data.bypassDnd).assertEqual(true); - expect(data.vibrationEnabled).assertEqual(true); - expect(data.sound).assertEqual("slot_SOCIAL_COMMUNICATION_Sound_First"); - expect(data.lightEnabled).assertEqual(true); - expect(data.lightColor).assertEqual(1); - console.debug("====>getSlotActsAnsSlotSystemCallback_0200 finish====>"); - notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION, (err)=>{ - console.debug("====>removeSlot SOCIAL_COMMUNICATION err====>" + JSON.stringify(err)); - console.debug("====>ActsAnsSlotSystemCallback_0200 end====>"); - expect(err.code).assertEqual(0); - done(); - }) - }) - setTimeout(timeOutTwo, TIMEOUT); - }) -}) } diff --git a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/test/List.test.js b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/test/List.test.js deleted file mode 100644 index 6fdb97f114ffa38efae43dde3e07ea7f76cb9aea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsSlotSystemCallback from './ExampleJsunit.test.js' -export default function testsuite() { -ActsAnsSlotSystemCallback() -} diff --git a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/resources/base/element/string.json b/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/resources/base/element/string.json deleted file mode 100644 index 2dcfb5308faba77d2fb41377affca465e5ae746b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystemcallback/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ActsAnsSlotSystemCallback" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/actsansslottest/actsansslotsystempromise/BUILD.gn b/notification/ans_standard/actsansslottest/actsansslotsystempromise/BUILD.gn deleted file mode 100644 index f7ad59aadb88b15167e13996a91ccfdc01f8345e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsSlotSystemPromiseTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsSlotSystemPromiseTest" - 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/actsansslottest/actsansslotsystempromise/Test.json b/notification/ans_standard/actsansslottest/actsansslotsystempromise/Test.json deleted file mode 100644 index 3db51ee188271b91d2509a848cc24710a5a54042..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "com.example.actsansslotsystempromise", - "package-name": "com.example.actsansslotsystempromise" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsSlotSystemPromiseTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotsystempromise/signature/openharmony_sx.p7b b/notification/ans_standard/actsansslottest/actsansslotsystempromise/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/actsansslottest/actsansslotsystempromise/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/config.json b/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/config.json deleted file mode 100644 index bdf6bfd80ee70e13900d99c47cce0bed5d84b22e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansslotsystempromise", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansslotsystempromise", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/MainAbility/app.js b/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/actsansslottest/actsansslotsystempromise/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index cc183ba6f171c0a02e11f8a2eecdf4247d8c8bc2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - {{title}} - -
diff --git a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index d864012434b7258ed298e29412f9df376e4fa88f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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: "测试slot接口promise形式:系统应用" - }, - onInit() { - this.title = "测试slot接口promise形式:系统应用"; - }, - onShow() { - console.info('onShow finish') - }, - onReady() { - }, -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestAbility/app.js b/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/actsansslottest/actsansslotsystempromise/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/actsansslottest/actsansslotsystempromise/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/actsansslottest/actsansslotsystempromise/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index 1d98f9bd001e9f4ff02a9b8e0449d56234ff0f70..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,236 +0,0 @@ -/* - * 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' - -const TIMEOUT = 2000; -export default function ActsAnsSlotSystemPromise() { -describe('ActsAnsSlotSystemPromise', function () { - - /* - * @tc.number : ActsAnsSlotSystemPromise_0100 - * @tc.name : Verify getSlots after adding slots and removeSlot - * @tc.desc : getSlots after adding all type slots and adding again after removing slot - */ - it('ActsAnsSlotSystemPromise_0100', 0, async function (done) { - console.debug("====>ActsAnsSlotTestSystem_0100 start====>"); - console.debug("====>addSlot SOCIAL_COMMUNICATION====>"); - await notification.addSlot( - { - type: notification.SlotType.SOCIAL_COMMUNICATION, - level: notification.SlotLevel.LEVEL_NONE, - desc: "slot_SOCIAL_COMMUNICATION_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_SOCIAL_COMMUNICATION_sound", - lightEnabled: true, - lightColor: 1 - }); - console.debug("====>addSlot SERVICE_INFORMATION====>"); - await notification.addSlot( - { - type: notification.SlotType.SERVICE_INFORMATION, - level: notification.SlotLevel.LEVEL_MIN, - desc: "slot_SERVICE_INFORMATION_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_SERVICE_INFORMATION_sound", - lightEnabled: true, - lightColor: 2 - }); - console.debug("====>addSlot CONTENT_INFORMATION====>"); - await notification.addSlot( - { - type: notification.SlotType.CONTENT_INFORMATION, - level: notification.SlotLevel.LEVEL_LOW, - desc: "slot_CONTENT_INFORMATION_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_CONTENT_INFORMATION_sound", - lightEnabled: true, - lightColor: 3 - }); - console.debug("====>addSlot OTHER_TYPES====>"); - await notification.addSlot( - { - type: notification.SlotType.OTHER_TYPES, - level: notification.SlotLevel.LEVEL_DEFAULT, - desc: "slot_OTHER_TYPES_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_OTHER_TYPES_sound", - lightEnabled: true, - lightColor: 4 - }); - console.debug("====>addSlot UNKNOWN_TYPE====>"); - await notification.addSlot( - { - type: notification.SlotType.UNKNOWN_TYPE, - level: notification.SlotLevel.LEVEL_HIGH, - desc: "slot_UNKNOWN_TYPE_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_UNKNOWN_TYPE_sound", - lightEnabled: true, - lightColor: 5 - }); - var data = await notification.getSlots(); - console.debug("====>getSlots enter====>"); - console.debug("====>getSlots data====>" + JSON.stringify(data)); - try{ - expect(data[0].type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION); - expect(data[0].level).assertEqual(notification.SlotLevel.LEVEL_NONE); - expect(data[0].desc).assertEqual("slot_SOCIAL_COMMUNICATION_desc"); - expect(data[0].badgeFlag).assertEqual(false); - expect(data[0].bypassDnd).assertEqual(true); - expect(data[0].vibrationEnabled).assertEqual(true); - expect(data[0].sound).assertEqual("slot_SOCIAL_COMMUNICATION_sound"); - expect(data[0].lightEnabled).assertEqual(true); - expect(data[0].lightColor).assertEqual(1); - - expect(data[1].type).assertEqual(notification.SlotType.SERVICE_INFORMATION); - expect(data[1].level).assertEqual(notification.SlotLevel.LEVEL_MIN); - expect(data[1].desc).assertEqual("slot_SERVICE_INFORMATION_desc"); - expect(data[1].badgeFlag).assertEqual(false); - expect(data[1].bypassDnd).assertEqual(true); - expect(data[1].vibrationEnabled).assertEqual(true); - expect(data[1].sound).assertEqual("slot_SERVICE_INFORMATION_sound"); - expect(data[1].lightEnabled).assertEqual(true); - expect(data[1].lightColor).assertEqual(2); - - expect(data[2].type).assertEqual(notification.SlotType.CONTENT_INFORMATION); - expect(data[2].level).assertEqual(notification.SlotLevel.LEVEL_LOW); - expect(data[2].desc).assertEqual("slot_CONTENT_INFORMATION_desc"); - expect(data[2].badgeFlag).assertEqual(false); - expect(data[2].bypassDnd).assertEqual(true); - expect(data[2].vibrationEnabled).assertEqual(true); - expect(data[2].sound).assertEqual("slot_CONTENT_INFORMATION_sound"); - expect(data[2].lightEnabled).assertEqual(true); - expect(data[2].lightColor).assertEqual(3); - - expect(data[3].type).assertEqual(notification.SlotType.OTHER_TYPES); - expect(data[3].level).assertEqual(notification.SlotLevel.LEVEL_DEFAULT); - expect(data[3].desc).assertEqual("slot_OTHER_TYPES_desc"); - expect(data[3].badgeFlag).assertEqual(false); - expect(data[3].bypassDnd).assertEqual(true); - expect(data[3].vibrationEnabled).assertEqual(true); - expect(data[3].sound).assertEqual("slot_OTHER_TYPES_sound"); - expect(data[3].lightEnabled).assertEqual(true); - expect(data[3].lightColor).assertEqual(4); - console.debug("====>getSlots end====>"); - }catch(err){ - console.error("====>getSlots catch err====>" + JSON.stringify(err)); - expect().assertFail(); - done(); - } - console.debug("====>removeAllSlots ActsAnsSlotSystemPromise_0100====>"); - await notification.removeAllSlots(); - console.debug("====>getSlots after remove all slots====>"); - var dataTwo = notification.getSlots(); - console.debug("====>getSlots dataTwo:" + JSON.stringify(dataTwo)); - console.debug("====>addSlot SERVICE_INFORMATION second====>"); - await notification.addSlot( - { - type: notification.SlotType.SERVICE_INFORMATION, - level: notification.SlotLevel.LEVEL_DEFAULT, - desc: "slot_SERVICE_INFORMATION_Desc_Second", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_SERVICE_INFORMATION_Sound_Second", - lightEnabled: true, - lightColor: 2 - }); - var dataThree = await notification.getSlot(notification.SlotType.SERVICE_INFORMATION); - console.debug("====>getSlotPromise SERVICE_INFORMATION ActsAnsSlotSystemPromise_0100 enter====>"); - console.debug("====>getSlotPromise ActsAnsSlotSystemPromise_0100 dataThree:" + JSON.stringify(dataThree)); - expect(dataThree.type).assertEqual(notification.SlotType.SERVICE_INFORMATION); - expect(dataThree.level).assertEqual(notification.SlotLevel.LEVEL_DEFAULT); - expect(dataThree.desc).assertEqual("slot_SERVICE_INFORMATION_Desc_Second"); - expect(dataThree.badgeFlag).assertEqual(false); - expect(dataThree.bypassDnd).assertEqual(true); - expect(dataThree.vibrationEnabled).assertEqual(true); - expect(dataThree.sound).assertEqual("slot_SERVICE_INFORMATION_Sound_Second"); - expect(dataThree.lightEnabled).assertEqual(true); - expect(dataThree.lightColor).assertEqual(2); - console.debug("====>getSlotPromise SERVICE_INFORMATION ActsAnsSlotSystemPromise_0100 finish====>"); - console.debug("====>removeSlot SERVICE_INFORMATION====>"); - await notification.removeSlot(notification.SlotType.SERVICE_INFORMATION); - done(); - setTimeout(function (){ - console.debug("====>time out ActsAnsSlotTestSystem_0100====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsSlotSystemPromise_0200 - * @tc.name : Verify that the same type of slot is added repeatedly - * @tc.desc : the same type of slot is added repeatedly, and the obtained slot is added for the first time - */ - it('ActsAnsSlotSystemPromise_0200', 0, async function (done) { - console.debug("====>ActsAnsSlotSystemPromise_0200 start====>"); - console.debug("====>addSlot SOCIAL_COMMUNICATION====>"); - await notification.addSlot( - { - type: notification.SlotType.SOCIAL_COMMUNICATION, - level: notification.SlotLevel.LEVEL_NONE, - desc: "slot_SOCIAL_COMMUNICATION_Desc_First", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_SOCIAL_COMMUNICATION_Sound_First", - lightEnabled: true, - lightColor: 1 - }); - await notification.addSlot( - { - type: notification.SlotType.SOCIAL_COMMUNICATION, - level: notification.SlotLevel.LEVEL_DEFAULT, - desc: "slot_SOCIAL_COMMUNICATION_Desc_Second", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_SOCIAL_COMMUNICATION_Sound_Second", - lightEnabled: true, - lightColor: 1 - }); - console.debug("====>getSlot SlotType.SOCIAL_COMMUNICATION====>"); - var data = await notification.getSlot(notification.SlotType.SOCIAL_COMMUNICATION); - console.debug("====>getSlot ActsAnsSlotSystemPromise_0200 enter====>"); - console.debug("====>getSlot ActsAnsSlotSystemPromise_0200 data:" + JSON.stringify(data)); - expect(data.type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION); - expect(data.level).assertEqual(notification.SlotLevel.LEVEL_NONE); - expect(data.desc).assertEqual("slot_SOCIAL_COMMUNICATION_Desc_First"); - expect(data.badgeFlag).assertEqual(false); - expect(data.bypassDnd).assertEqual(true); - expect(data.vibrationEnabled).assertEqual(true); - expect(data.sound).assertEqual("slot_SOCIAL_COMMUNICATION_Sound_First"); - expect(data.lightEnabled).assertEqual(true); - expect(data.lightColor).assertEqual(1); - console.debug("====>getSlot ActsAnsSlotSystemPromise_0200 finish====>"); - console.debug("====>removeSlot SOCIAL_COMMUNICATION start====>"); - await notification.removeSlot(notification.SlotType.SOCIAL_COMMUNICATION); - console.debug("====>ActsAnsSlotSystemPromise_0200 end====>"); - done(); - setTimeout(function (){ - console.debug("====>time out ActsAnsSlotSystemPromise_0200====>"); - }, TIMEOUT); - }) -}) } diff --git a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/test/List.test.js b/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/test/List.test.js deleted file mode 100644 index 186aa8e4f1a4b69e4bb3fc4b11f70e10b792c1dd..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsSlotSystemPromise from './ExampleJsunit.test.js' -export default function testsuite() { -ActsAnsSlotSystemPromise() -} diff --git a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/resources/base/element/string.json b/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/resources/base/element/string.json deleted file mode 100644 index 63151edc575cbac002b4a8febea73d6541548cc6..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslotsystempromise/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ActsAnsSlotSystemPromise" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/BUILD.gn b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/BUILD.gn deleted file mode 100644 index 646f8b018480b8cfd66454d6206e133b2e7fa9f9..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsSlotAddRemoveAllTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsSlotAddRemoveAllTest" - 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/actsansslottest/actsansslottaddremoveall/Test.json b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/Test.json deleted file mode 100644 index 612d084efce23c2dc4bbda00eafe1cbf98016449..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "com.example.actsansslotaddremoveall", - "package-name": "com.example.actsansslotaddremoveall" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsSlotAddRemoveAllTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/signature/openharmony_sx.p7b b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/config.json b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/config.json deleted file mode 100644 index d7d7d6ba7f0e38790164276df11aaf4c869986ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansslotaddremoveall", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansslotaddremoveall", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/MainAbility/app.js b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/actsansslottest/actsansslottaddremoveall/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index cc183ba6f171c0a02e11f8a2eecdf4247d8c8bc2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - {{title}} - -
diff --git a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index fe12a15c7f28b47fa2ceec1d7ad6f0bc9527bb59..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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: "测试addSlots接口和removeAllSlots接口" - }, - onInit() { - this.title = "测试addSlots接口和removeAllSlots接口"; - }, - onShow() { - console.info('onShow finish') - }, - onReady() { - }, -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestAbility/app.js b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/actsansslottest/actsansslottaddremoveall/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/actsansslottest/actsansslottaddremoveall/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/actsansslottest/actsansslottaddremoveall/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index efe46f776b15c71ef635123f7a49f2bafd5666d6..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,725 +0,0 @@ -/* - * 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' - -const TIMEOUT = 2000; -export default function ActsAnsSlotAddRemoveAll() { -describe('ActsAnsSlotAddRemoveAll', function () { - - /* - * @tc.number : ActsAnsSlotAddRemoveAll_0100 - * @tc.name : removeAllSlots after addSlots callback - * @tc.desc : Verify that removeAllSlots after addSlots - */ - it('ActsAnsSlotAddRemoveAll_0100', 0, async function (done) { - console.debug("====>ActsAnsSlotAddRemoveAll_0100 start====>"); - console.debug("====>addSlots start ActsAnsSlotAddRemoveAll_0100====>"); - notification.addSlots([ - { - type: notification.SlotType.SOCIAL_COMMUNICATION, - level: notification.SlotLevel.LEVEL_NONE, - desc: "slot_SOCIAL_COMMUNICATION_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_SOCIAL_COMMUNICATION_sound", - lightEnabled: true, - lightColor: 1 - }, - { - type: notification.SlotType.SERVICE_INFORMATION, - level: notification.SlotLevel.LEVEL_MIN, - desc: "slot_SERVICE_INFORMATION_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_SERVICE_INFORMATION_sound", - lightEnabled: true, - lightColor: 2 - }, - { - type: notification.SlotType.CONTENT_INFORMATION, - level: notification.SlotLevel.LEVEL_LOW, - desc: "slot_CONTENT_INFORMATION_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_CONTENT_INFORMATION_sound", - lightEnabled: true, - lightColor: 3 - }, - { - type: notification.SlotType.OTHER_TYPES, - level: notification.SlotLevel.LEVEL_DEFAULT, - desc: "slot_OTHER_TYPES_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_OTHER_TYPES_sound", - lightEnabled: true, - lightColor: 4 - } - ], (err)=>{ - console.debug("====>addSlots callback ActsAnsSlotAddRemoveAll_0100====>"); - expect(err.code).assertEqual(0); - console.debug("====>getSlots start ActsAnsSlotAddRemoveAll_0100====>"); - notification.getSlots((err, data)=>{ - console.debug("====>getSlots callback ActsAnsSlotAddRemoveAll_0100====>"); - console.debug("====>getSlots err ActsAnsSlotAddRemoveAll_0100====>" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlots data ActsAnsSlotAddRemoveAll_0100====>" + JSON.stringify(data)); - try{ - expect(data[0].type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION); - expect(data[0].level).assertEqual(notification.SlotLevel.LEVEL_NONE); - expect(data[0].desc).assertEqual("slot_SOCIAL_COMMUNICATION_desc"); - expect(data[0].badgeFlag).assertEqual(false); - expect(data[0].bypassDnd).assertEqual(true); - expect(data[0].vibrationEnabled).assertEqual(true); - expect(data[0].sound).assertEqual("slot_SOCIAL_COMMUNICATION_sound"); - expect(data[0].lightEnabled).assertEqual(true); - expect(data[0].lightColor).assertEqual(1); - - expect(data[1].type).assertEqual(notification.SlotType.SERVICE_INFORMATION); - expect(data[1].level).assertEqual(notification.SlotLevel.LEVEL_MIN); - expect(data[1].desc).assertEqual("slot_SERVICE_INFORMATION_desc"); - expect(data[1].badgeFlag).assertEqual(false); - expect(data[1].bypassDnd).assertEqual(true); - expect(data[1].vibrationEnabled).assertEqual(true); - expect(data[1].sound).assertEqual("slot_SERVICE_INFORMATION_sound"); - expect(data[1].lightEnabled).assertEqual(true); - expect(data[1].lightColor).assertEqual(2); - - expect(data[2].type).assertEqual(notification.SlotType.CONTENT_INFORMATION); - expect(data[2].level).assertEqual(notification.SlotLevel.LEVEL_LOW); - expect(data[2].desc).assertEqual("slot_CONTENT_INFORMATION_desc"); - expect(data[2].badgeFlag).assertEqual(false); - expect(data[2].bypassDnd).assertEqual(true); - expect(data[2].vibrationEnabled).assertEqual(true); - expect(data[2].sound).assertEqual("slot_CONTENT_INFORMATION_sound"); - expect(data[2].lightEnabled).assertEqual(true); - expect(data[2].lightColor).assertEqual(3); - - expect(data[3].type).assertEqual(notification.SlotType.OTHER_TYPES); - expect(data[3].level).assertEqual(notification.SlotLevel.LEVEL_DEFAULT); - expect(data[3].desc).assertEqual("slot_OTHER_TYPES_desc"); - expect(data[3].badgeFlag).assertEqual(false); - expect(data[3].bypassDnd).assertEqual(true); - expect(data[3].vibrationEnabled).assertEqual(true); - expect(data[3].sound).assertEqual("slot_OTHER_TYPES_sound"); - expect(data[3].lightEnabled).assertEqual(true); - expect(data[3].lightColor).assertEqual(4); - console.debug("====>getSlots end ActsAnsSlotAddRemoveAll_0100====>"); - console.debug("====>removeAllSlots start ActsAnsSlotAddRemoveAll_0100====>"); - notification.removeAllSlots((err)=>{ - console.debug("====>removeAllSlots ActsAnsSlotAddRemoveAll_0100 callback====>"); - expect(err.code).assertEqual(0); - console.debug("====>getSlots start second ActsAnsSlotAddRemoveAll_0100====>"); - notification.getSlots((err, data)=>{ - console.debug("====>getSlots second 0100 err====>" + JSON.stringify(err)); - console.debug("====>getSlots second 0100 data====>" + JSON.stringify(data)); - console.debug("====>getSlots second 0100 data.length====>"+ data.length); - expect(data.length).assertEqual(0); - console.debug("====>ActsAnsSlotAddRemoveAll_0100 end====>"); - done(); - }) - }) - }catch(err){ - console.error("====>getSlots catch err ActsAnsSlotAddRemoveAll_0100====>" + JSON.stringify(err)); - expect().assertFail(); - done(); - } - }) - - }) - setTimeout(function (){ - console.debug("====>time out ActsAnsSlotAddRemoveAll_0100====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsSlotAddRemoveAll_0200 - * @tc.name : removeAllSlots after addSlots promise - * @tc.desc : Verify that removeAllSlots after addSlots - */ - it('ActsAnsSlotAddRemoveAll_0200', 0, async function (done) { - console.debug("====>ActsAnsSlotAddRemoveAll_0200 start====>"); - console.debug("====>addSlots start ActsAnsSlotAddRemoveAll_0200====>"); - await notification.addSlots([ - { - type: notification.SlotType.SOCIAL_COMMUNICATION, - level: notification.SlotLevel.LEVEL_NONE, - desc: "slot_SOCIAL_COMMUNICATION_desc_second", - badgeFlag: true, - bypassDnd: false, - vibrationEnabled: false, - sound: "slot_SOCIAL_COMMUNICATION_sound_second", - lightEnabled: false, - lightColor: 1 - }, - { - type: notification.SlotType.SERVICE_INFORMATION, - level: notification.SlotLevel.LEVEL_MIN, - desc: "slot_SERVICE_INFORMATION_desc_second", - badgeFlag: true, - bypassDnd: false, - vibrationEnabled: false, - sound: "slot_SERVICE_INFORMATION_sound_second", - lightEnabled: false, - lightColor: 2 - }, - { - type: notification.SlotType.CONTENT_INFORMATION, - level: notification.SlotLevel.LEVEL_LOW, - desc: "slot_CONTENT_INFORMATION_desc_second", - badgeFlag: true, - bypassDnd: false, - vibrationEnabled: false, - sound: "slot_CONTENT_INFORMATION_sound_second", - lightEnabled: false, - lightColor: 3 - }, - { - type: notification.SlotType.OTHER_TYPES, - level: notification.SlotLevel.LEVEL_DEFAULT, - desc: "slot_OTHER_TYPES_desc_second", - badgeFlag: true, - bypassDnd: false, - vibrationEnabled: false, - sound: "slot_OTHER_TYPES_sound_second", - lightColor: 4 - } - ]); - console.debug("====>getSlots start ActsAnsSlotAddRemoveAll_0200====>"); - var data = await notification.getSlots(); - console.debug("====>getSlots ActsAnsSlotAddRemoveAll_0200 data:" + JSON.stringify(data)); - try{ - expect(data[0].type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION); - expect(data[0].level).assertEqual(notification.SlotLevel.LEVEL_NONE); - expect(data[0].desc).assertEqual("slot_SOCIAL_COMMUNICATION_desc_second"); - expect(data[0].badgeFlag).assertEqual(true); - expect(data[0].bypassDnd).assertEqual(false); - expect(data[0].vibrationEnabled).assertEqual(false); - expect(data[0].sound).assertEqual("slot_SOCIAL_COMMUNICATION_sound_second"); - expect(data[0].lightEnabled).assertEqual(false); - expect(data[0].lightColor).assertEqual(1); - - expect(data[1].type).assertEqual(notification.SlotType.SERVICE_INFORMATION); - expect(data[1].level).assertEqual(notification.SlotLevel.LEVEL_MIN); - expect(data[1].desc).assertEqual("slot_SERVICE_INFORMATION_desc_second"); - expect(data[1].badgeFlag).assertEqual(true); - expect(data[1].bypassDnd).assertEqual(false); - expect(data[1].vibrationEnabled).assertEqual(false); - expect(data[1].sound).assertEqual("slot_SERVICE_INFORMATION_sound_second"); - expect(data[1].lightEnabled).assertEqual(false); - expect(data[1].lightColor).assertEqual(2); - - expect(data[2].type).assertEqual(notification.SlotType.CONTENT_INFORMATION); - expect(data[2].level).assertEqual(notification.SlotLevel.LEVEL_LOW); - expect(data[2].desc).assertEqual("slot_CONTENT_INFORMATION_desc_second"); - expect(data[2].badgeFlag).assertEqual(true); - expect(data[2].bypassDnd).assertEqual(false); - expect(data[2].vibrationEnabled).assertEqual(false); - expect(data[2].sound).assertEqual("slot_CONTENT_INFORMATION_sound_second"); - expect(data[2].lightEnabled).assertEqual(false); - expect(data[2].lightColor).assertEqual(3); - - expect(data[3].type).assertEqual(notification.SlotType.OTHER_TYPES); - expect(data[3].level).assertEqual(notification.SlotLevel.LEVEL_DEFAULT); - expect(data[3].desc).assertEqual("slot_OTHER_TYPES_desc_second"); - expect(data[3].badgeFlag).assertEqual(true); - expect(data[3].bypassDnd).assertEqual(false); - expect(data[3].vibrationEnabled).assertEqual(false); - expect(data[3].sound).assertEqual("slot_OTHER_TYPES_sound_second"); - expect(data[3].lightColor).assertEqual(4); - console.debug("====>getSlots end ActsAnsSlotAddRemoveAll_0200====>"); - }catch(err){ - console.error("====>getSlots catch err ActsAnsSlotAddRemoveAll_0200====>" + JSON.stringify(err)); - expect().assertFail(); - done(); - } - console.debug("====>removeAllSlots start ActsAnsSlotAddRemoveAll_0200====>"); - await notification.removeAllSlots(); - console.debug("====>ActsAnsSlotAddRemoveAll_0200 end====>"); - done(); - setTimeout(function (){ - console.debug("====>time out ActsAnsSlotAddRemoveAll_0200====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsSlotAddRemoveAll_0300 - * @tc.name : removeAllSlots after addSlots repeatedly callback - * @tc.desc : Verify that removeAllSlots after addSlots repeatedly - */ - it('ActsAnsSlotAddRemoveAll_0300', 0, async function (done) { - console.debug("====>ActsAnsSlotAddRemoveAll_0300 start====>"); - console.debug("====>addSlots start ActsAnsSlotAddRemoveAll_0300====>"); - notification.addSlots([ - { - type: notification.SlotType.SOCIAL_COMMUNICATION, - level: notification.SlotLevel.LEVEL_NONE, - desc: "slot_SOCIAL_COMMUNICATION_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_SOCIAL_COMMUNICATION_sound", - lightEnabled: true, - lightColor: 1 - }, - { - type: notification.SlotType.SERVICE_INFORMATION, - level: notification.SlotLevel.LEVEL_MIN, - desc: "slot_SERVICE_INFORMATION_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_SERVICE_INFORMATION_sound", - lightEnabled: true, - lightColor: 2 - }, - { - type: notification.SlotType.CONTENT_INFORMATION, - level: notification.SlotLevel.LEVEL_LOW, - desc: "slot_CONTENT_INFORMATION_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_CONTENT_INFORMATION_sound", - lightEnabled: true, - lightColor: 3 - }, - { - type: notification.SlotType.OTHER_TYPES, - level: notification.SlotLevel.LEVEL_DEFAULT, - desc: "slot_OTHER_TYPES_desc", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_OTHER_TYPES_sound", - lightEnabled: true, - lightColor: 4 - } - ], (err)=>{ - console.debug("====>addSlots callback ActsAnsSlotAddRemoveAll_0300====>"); - expect(err.code).assertEqual(0); - console.debug("====>addSlots second time ActsAnsSlotAddRemoveAll_0300====>"); - notification.addSlots([ - { - type: notification.SlotType.SOCIAL_COMMUNICATION, - level: notification.SlotLevel.LEVEL_NONE, - desc: "slot_SOCIAL_COMMUNICATION_desc_twice", - badgeFlag: true, - bypassDnd: true, - vibrationEnabled: false, - sound: "slot_SOCIAL_COMMUNICATION_sound_twice", - lightEnabled: true, - lightColor: 5 - }, - { - type: notification.SlotType.SERVICE_INFORMATION, - level: notification.SlotLevel.LEVEL_MIN, - desc: "slot_SERVICE_INFORMATION_desc", - badgeFlag: false, - bypassDnd: false, - vibrationEnabled: true, - sound: "slot_SERVICE_INFORMATION_sound_twice", - lightEnabled: true, - lightColor: 6 - }, - { - type: notification.SlotType.CONTENT_INFORMATION, - level: notification.SlotLevel.LEVEL_LOW, - desc: "slot_CONTENT_INFORMATION_desc_twice", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_CONTENT_INFORMATION_sound_twice", - lightEnabled: false, - lightColor: 7 - }, - { - type: notification.SlotType.OTHER_TYPES, - level: notification.SlotLevel.LEVEL_DEFAULT, - desc: "slot_OTHER_TYPES_desc_twice", - badgeFlag: true, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_OTHER_TYPES_sound_twice", - lightEnabled: true, - lightColor: 8 - } - ], (err)=>{ - console.debug("====>addSlots twice callback ActsAnsSlotAddRemoveAll_0300====>"); - expect(err.code).assertEqual(0); - console.debug("====>getSlots start ActsAnsSlotAddRemoveAll_0300====>"); - notification.getSlots((err, data)=>{ - console.debug("====>getSlots callback ActsAnsSlotAddRemoveAll_0300====>"); - console.debug("====>getSlots err ActsAnsSlotAddRemoveAll_0300====>" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlots data ActsAnsSlotAddRemoveAll_0300====>" + JSON.stringify(data)); - try{ - expect(data[0].type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION); - expect(data[0].level).assertEqual(notification.SlotLevel.LEVEL_NONE); - expect(data[0].desc).assertEqual("slot_SOCIAL_COMMUNICATION_desc"); - expect(data[0].badgeFlag).assertEqual(false); - expect(data[0].bypassDnd).assertEqual(true); - expect(data[0].vibrationEnabled).assertEqual(true); - expect(data[0].sound).assertEqual("slot_SOCIAL_COMMUNICATION_sound"); - expect(data[0].lightEnabled).assertEqual(true); - expect(data[0].lightColor).assertEqual(1); - - expect(data[1].type).assertEqual(notification.SlotType.SERVICE_INFORMATION); - expect(data[1].level).assertEqual(notification.SlotLevel.LEVEL_MIN); - expect(data[1].desc).assertEqual("slot_SERVICE_INFORMATION_desc"); - expect(data[1].badgeFlag).assertEqual(false); - expect(data[1].bypassDnd).assertEqual(true); - expect(data[1].vibrationEnabled).assertEqual(true); - expect(data[1].sound).assertEqual("slot_SERVICE_INFORMATION_sound"); - expect(data[1].lightEnabled).assertEqual(true); - expect(data[1].lightColor).assertEqual(2); - - expect(data[2].type).assertEqual(notification.SlotType.CONTENT_INFORMATION); - expect(data[2].level).assertEqual(notification.SlotLevel.LEVEL_LOW); - expect(data[2].desc).assertEqual("slot_CONTENT_INFORMATION_desc"); - expect(data[2].badgeFlag).assertEqual(false); - expect(data[2].bypassDnd).assertEqual(true); - expect(data[2].vibrationEnabled).assertEqual(true); - expect(data[2].sound).assertEqual("slot_CONTENT_INFORMATION_sound"); - expect(data[2].lightEnabled).assertEqual(true); - expect(data[2].lightColor).assertEqual(3); - - expect(data[3].type).assertEqual(notification.SlotType.OTHER_TYPES); - expect(data[3].level).assertEqual(notification.SlotLevel.LEVEL_DEFAULT); - expect(data[3].desc).assertEqual("slot_OTHER_TYPES_desc"); - expect(data[3].badgeFlag).assertEqual(false); - expect(data[3].bypassDnd).assertEqual(true); - expect(data[3].vibrationEnabled).assertEqual(true); - expect(data[3].sound).assertEqual("slot_OTHER_TYPES_sound"); - expect(data[3].lightEnabled).assertEqual(true); - expect(data[3].lightColor).assertEqual(4); - console.debug("====>getSlots end ActsAnsSlotAddRemoveAll_0300====>"); - console.debug("====>removeAllSlots start ActsAnsSlotAddRemoveAll_0300====>"); - notification.removeAllSlots((err)=>{ - console.debug("====>removeAllSlots ActsAnsSlotAddRemoveAll_0300 callback====>"); - expect(err.code).assertEqual(0); - console.debug("====>getSlots start second ActsAnsSlotAddRemoveAll_0300====>"); - notification.getSlots((err, data)=>{ - console.debug("====>getSlots second 0300 err====>" + JSON.stringify(err)); - console.debug("====>getSlots second 0300 data====>" + JSON.stringify(data)); - console.debug("====>getSlots second 0300 data.length====>"+ data.length); - expect(data.length).assertEqual(0); - console.debug("====>ActsAnsSlotAddRemoveAll_0300 end====>"); - done(); - }) - }) - }catch(err){ - console.error("====>getSlots catch err 0300====>" + JSON.stringify(err)); - expect().assertFail(); - done(); - } - }) - }) - - }) - setTimeout(function (){ - console.debug("====>time out ActsAnsSlotAddRemoveAll_0300====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsSlotAddRemoveAll_0400 - * @tc.name : removeAllSlots after addSlots repeatedly promise - * @tc.desc : Verify that removeAllSlots after addSlots repeatedly - */ - it('ActsAnsSlotAddRemoveAll_0400', 0, async function (done) { - console.debug("====>ActsAnsSlotAddRemoveAll_0400 start====>"); - console.debug("====>addSlots start ActsAnsSlotAddRemoveAll_0400====>"); - await notification.addSlots([ - { - type: notification.SlotType.SOCIAL_COMMUNICATION, - level: notification.SlotLevel.LEVEL_NONE, - desc: "slot_SOCIAL_COMMUNICATION_desc_second", - badgeFlag: true, - bypassDnd: false, - vibrationEnabled: false, - sound: "slot_SOCIAL_COMMUNICATION_sound_second", - lightEnabled: false, - lightColor: 1 - }, - { - type: notification.SlotType.SERVICE_INFORMATION, - level: notification.SlotLevel.LEVEL_MIN, - desc: "slot_SERVICE_INFORMATION_desc_second", - badgeFlag: true, - bypassDnd: false, - vibrationEnabled: false, - sound: "slot_SERVICE_INFORMATION_sound_second", - lightEnabled: false, - lightColor: 2 - }, - { - type: notification.SlotType.CONTENT_INFORMATION, - level: notification.SlotLevel.LEVEL_LOW, - desc: "slot_CONTENT_INFORMATION_desc_second", - badgeFlag: true, - bypassDnd: false, - vibrationEnabled: false, - sound: "slot_CONTENT_INFORMATION_sound_second", - lightEnabled: false, - lightColor: 3 - }, - { - type: notification.SlotType.OTHER_TYPES, - level: notification.SlotLevel.LEVEL_DEFAULT, - desc: "slot_OTHER_TYPES_desc_second", - badgeFlag: true, - bypassDnd: false, - vibrationEnabled: false, - sound: "slot_OTHER_TYPES_sound_second", - lightColor: 4 - } - ]); - console.debug("====>addSlots twice start ActsAnsSlotAddRemoveAll_0400====>"); - await notification.addSlots([ - { - type: notification.SlotType.SOCIAL_COMMUNICATION, - level: notification.SlotLevel.LEVEL_NONE, - desc: "slot_SOCIAL_COMMUNICATION_desc_second_twice", - badgeFlag: false, - bypassDnd: false, - vibrationEnabled: false, - sound: "slot_SOCIAL_COMMUNICATION_sound_second_twice", - lightEnabled: true, - lightColor: 1 - }, - { - type: notification.SlotType.SERVICE_INFORMATION, - level: notification.SlotLevel.LEVEL_MIN, - desc: "slot_SERVICE_INFORMATION_desc_second_twice", - badgeFlag: true, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_SERVICE_INFORMATION_sound_second_twice", - lightEnabled: true, - lightColor: 2 - }, - { - type: notification.SlotType.CONTENT_INFORMATION, - level: notification.SlotLevel.LEVEL_LOW, - desc: "slot_CONTENT_INFORMATION_desc_second_twice", - badgeFlag: true, - bypassDnd: false, - vibrationEnabled: true, - sound: "slot_CONTENT_INFORMATION_sound_second_twice", - lightEnabled: false, - lightColor: 3 - }, - { - type: notification.SlotType.OTHER_TYPES, - level: notification.SlotLevel.LEVEL_DEFAULT, - desc: "slot_OTHER_TYPES_desc_second_twice", - badgeFlag: false, - bypassDnd: true, - vibrationEnabled: true, - sound: "slot_OTHER_TYPES_sound_second_twice", - lightColor: 4 - } - ]); - console.debug("====>getSlots start ActsAnsSlotAddRemoveAll_0400====>"); - var data = await notification.getSlots(); - console.debug("====>getSlots enter ActsAnsSlotAddRemoveAll_0400====>"); - console.debug("====>getSlots data ActsAnsSlotAddRemoveAll_0400====>" + JSON.stringify(data)); - try{ - expect(data[0].type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION); - expect(data[0].level).assertEqual(notification.SlotLevel.LEVEL_NONE); - expect(data[0].desc).assertEqual("slot_SOCIAL_COMMUNICATION_desc_second"); - expect(data[0].badgeFlag).assertEqual(true); - expect(data[0].bypassDnd).assertEqual(false); - expect(data[0].vibrationEnabled).assertEqual(false); - expect(data[0].sound).assertEqual("slot_SOCIAL_COMMUNICATION_sound_second"); - expect(data[0].lightEnabled).assertEqual(false); - expect(data[0].lightColor).assertEqual(1); - - expect(data[1].type).assertEqual(notification.SlotType.SERVICE_INFORMATION); - expect(data[1].level).assertEqual(notification.SlotLevel.LEVEL_MIN); - expect(data[1].desc).assertEqual("slot_SERVICE_INFORMATION_desc_second"); - expect(data[1].badgeFlag).assertEqual(true); - expect(data[1].bypassDnd).assertEqual(false); - expect(data[1].vibrationEnabled).assertEqual(false); - expect(data[1].sound).assertEqual("slot_SERVICE_INFORMATION_sound_second"); - expect(data[1].lightEnabled).assertEqual(false); - expect(data[1].lightColor).assertEqual(2); - - expect(data[2].type).assertEqual(notification.SlotType.CONTENT_INFORMATION); - expect(data[2].level).assertEqual(notification.SlotLevel.LEVEL_LOW); - expect(data[2].desc).assertEqual("slot_CONTENT_INFORMATION_desc_second"); - expect(data[2].badgeFlag).assertEqual(true); - expect(data[2].bypassDnd).assertEqual(false); - expect(data[2].vibrationEnabled).assertEqual(false); - expect(data[2].sound).assertEqual("slot_CONTENT_INFORMATION_sound_second"); - expect(data[2].lightEnabled).assertEqual(false); - expect(data[2].lightColor).assertEqual(3); - - expect(data[3].type).assertEqual(notification.SlotType.OTHER_TYPES); - expect(data[3].level).assertEqual(notification.SlotLevel.LEVEL_DEFAULT); - expect(data[3].desc).assertEqual("slot_OTHER_TYPES_desc_second"); - expect(data[3].badgeFlag).assertEqual(true); - expect(data[3].bypassDnd).assertEqual(false); - expect(data[3].vibrationEnabled).assertEqual(false); - expect(data[3].sound).assertEqual("slot_OTHER_TYPES_sound_second"); - expect(data[3].lightColor).assertEqual(4); - console.debug("====>getSlots end ActsAnsSlotAddRemoveAll_0400====>"); - }catch(err){ - console.error("====>getSlots catch err ActsAnsSlotAddRemoveAll_0400====>" + JSON.stringify(err)); - expect().assertFail(); - done(); - } - console.debug("====>removeAllSlots start ActsAnsSlotAddRemoveAll_0400====>"); - await notification.removeAllSlots(); - console.debug("====>ActsAnsSlotAddRemoveAll_0400 end====>"); - done(); - setTimeout(function (){ - console.debug("====>time out ActsAnsSlotAddRemoveAll_0400====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsSlotAddRemoveAll_0500 - * @tc.name : removeAllSlots callback - * @tc.desc : Verify that removeAllSlots without adding slots - */ - it('ActsAnsSlotAddRemoveAll_0500', 0, async function (done) { - console.debug("====>removeAllSlots start ActsAnsSlotAddRemoveAll_0500====>"); - notification.removeAllSlots((err)=>{ - console.debug("====>removeAllSlots ActsAnsSlotAddRemoveAll_0500 err:" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - done(); - }) - console.debug("====>removeAllSlots ActsAnsSlotAddRemoveAll_0500====>"); - setTimeout(function (){ - console.debug("====>time out ActsAnsSlotAddRemoveAll_0500====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsSlotAddRemoveAll_0600 - * @tc.name : removeAllSlots promise - * @tc.desc : Verify that removeAllSlots without adding slots - */ - it('ActsAnsSlotAddRemoveAll_0600', 0, async function (done) { - console.debug("====>removeAllSlots start ActsAnsSlotAddRemoveAll_0600====>"); - notification.removeAllSlots().then(()=>{ - console.debug("====>removeAllSlots ActsAnsSlotAddRemoveAll_0600====>"); - done(); - }).catch((err)=>{ - console.debug("====>removeAllSlots ActsAnsSlotAddRemoveAll_0600 err:" + JSON.stringify(err)); - expect().assertFail(); - done(); - }) - console.debug("====>removeAllSlots ActsAnsSlotAddRemoveAll_0600====>"); - setTimeout(function (){ - console.debug("====>time out ActsAnsSlotAddRemoveAll_0600====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsSlotAddRemoveAll_0700 - * @tc.name : addSlots callback - * @tc.desc : Verify that addSlots with same type of slot - */ - it('ActsAnsSlotAddRemoveAll_0700', 0, async function (done) { - console.debug("====>start ActsAnsSlotAddRemoveAll_0700====>"); - await notification.addSlots([ - { - type: notification.SlotType.SOCIAL_COMMUNICATION, - desc: "slot_SOCIAL_COMMUNICATION_desc_first" - }, - { - type: notification.SlotType.SOCIAL_COMMUNICATION, - desc: "slot_SERVICE_INFORMATION_desc_second" - } - ], (err)=>{ - console.debug("====>addSlots callback ActsAnsSlotAddRemoveAll_0700====>"); - expect(err.code).assertEqual(0); - console.debug("====>getSlots ActsAnsSlotAddRemoveAll_0700====>"); - notification.getSlots((err, data)=>{ - console.debug("====>getSlots enter ActsAnsSlotAddRemoveAll_0700====>"); - console.debug("====>getSlots err ActsAnsSlotAddRemoveAll_0700====>" + JSON.stringify(err)); - expect(err.code).assertEqual(0); - console.debug("====>getSlots data ActsAnsSlotAddRemoveAll_0700====>" + JSON.stringify(data)); - try{ - console.debug("====>getSlots ActsAnsSlotAddRemoveAll_0700 data.length:====>" + data.length); - expect(data.length).assertEqual(1); - expect(data[0].type).assertEqual(notification.SlotType.SOCIAL_COMMUNICATION); - expect(data[0].desc).assertEqual("slot_SERVICE_INFORMATION_desc_second"); - console.debug("====>getSlots end ActsAnsSlotAddRemoveAll_0700====>"); - notification.removeAllSlots((err)=>{ - console.debug("====>removeAllSlots ActsAnsSlotAddRemoveAll_0700 err:" + JSON.stringify(err)); - console.debug("====>ActsAnsSlotAddRemoveAll_0700 end====>"); - expect(err.code).assertEqual(0); - done(); - }) - }catch(err){ - console.error("====>getSlots catch err ActsAnsSlotAddRemoveAll_0700====>" + JSON.stringify(err)); - expect().assertFail(); - done(); - } - }) - }) - setTimeout(function (){ - console.debug("====>time out ActsAnsSlotAddRemoveAll_0700====>"); - }, TIMEOUT); - }) - - /* - * @tc.number : ActsAnsSlotAddRemoveAll_0800 - * @tc.name : addSlots promise - * @tc.desc : Verify that addSlots with same type of slot - */ - it('ActsAnsSlotAddRemoveAll_0800', 0, async function (done) { - console.debug("====>start ActsAnsSlotAddRemoveAll_0800====>"); - await notification.addSlots([ - { - type: notification.SlotType.OTHER_TYPES, - desc: "slot_SOCIAL_COMMUNICATION_desc_first" - }, - { - type: notification.SlotType.OTHER_TYPES, - desc: "slot_SERVICE_INFORMATION_desc_second" - } - ]); - console.debug("====>getSlots ActsAnsSlotAddRemoveAll_0800====>"); - var data = await notification.getSlots(); - console.debug("====>getSlots ActsAnsSlotAddRemoveAll_0800 data:" + JSON.stringify(data)); - try{ - console.debug("====>getSlots ActsAnsSlotAddRemoveAll_0800 data.length:====>" + data.length); - expect(data.length).assertEqual(1); - expect(data[0].type).assertEqual(notification.SlotType.OTHER_TYPES); - expect(data[0].desc).assertEqual("slot_SERVICE_INFORMATION_desc_second"); - console.debug("====>getSlots end ActsAnsSlotAddRemoveAll_0800====>"); - await notification.removeAllSlots(); - console.debug("====>ActsAnsSlotAddRemoveAll_0800 end====>"); - done(); - }catch(err){ - console.error("====>getSlots err ActsAnsSlotAddRemoveAll_0800====>" + JSON.stringify(err)); - expect().assertFail(); - done(); - } - setTimeout(function (){ - console.debug("====>time out ActsAnsSlotAddRemoveAll_0800====>"); - }, TIMEOUT); - }) -})} diff --git a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/test/List.test.js b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/test/List.test.js deleted file mode 100644 index 0907b31fe15246980550b9db63094862ec22bfab..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsSlotAddRemoveAll from './ExampleJsunit.test.js' -export default function testsuite() { -ActsAnsSlotAddRemoveAll() -} diff --git a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/resources/base/element/string.json b/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/resources/base/element/string.json deleted file mode 100644 index dff94616b22458248f6370896f7ff633e1ba787f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/actsansslottest/actsansslottaddremoveall/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string":[ - { - "name":"app_name", - "value":"ActsAnsSlotAddRemoveAll" - }, - { - "name":"mainability_description", - "value":"JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/actsnotificationshow/src/main/config.json b/notification/ans_standard/actsnotificationshow/src/main/config.json index f86da50f9d886653c43d3cf864a27830532dcfb4..f16722cab9fea2a2796e27665ffa3292e566c301 100644 --- a/notification/ans_standard/actsnotificationshow/src/main/config.json +++ b/notification/ans_standard/actsnotificationshow/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actsnotificationshow", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/notification/ans_standard/actsnotificationshow/src/main/js/test/ActsNotificationShowTest.js b/notification/ans_standard/actsnotificationshow/src/main/js/test/ActsNotificationShowTest.js index 5a4016ec54a3e723298a269ccff71513bf7df069..325c22f59da4bfdc795b8b5510548a4885f716d1 100644 --- a/notification/ans_standard/actsnotificationshow/src/main/js/test/ActsNotificationShowTest.js +++ b/notification/ans_standard/actsnotificationshow/src/main/js/test/ActsNotificationShowTest.js @@ -16,17 +16,17 @@ import notification from '@system.notification' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' export default function ActsNotificationShowTest() { - describe('ActsNotificationShowTest', function () { - const TAG = 'ActsNotificationShowTest ===> ' - console.info(TAG + "ActsNotificationShowTest START") + describe('SUB_NOTIFICATION_ANS_SHOW_TEST', function () { + const TAG = 'SUB_NOTIFICATION_ANS_SHOW_TEST ===> ' + console.info(TAG + "SUB_NOTIFICATION_ANS_SHOW_TEST START") /* - * @tc.number: ActsNotificationShowTest_0100 + * @tc.number: SUB_NOTIFICATION_ANS_SHOW_TEST_0100 * @tc.name: show() * @tc.desc: verify the function of show */ - it('ActsNotificationShowTest_0100', 0, async function (done) { - console.info(TAG + 'ActsNotificationShowTest_0100 START ') + it('SUB_NOTIFICATION_ANS_SHOW_TEST_0100', 0, async function (done) { + console.info(TAG + 'SUB_NOTIFICATION_ANS_SHOW_TEST_0100 START ') let ShowNotificationOptions = { contentTitle: 'Title1', contentText: 'This is a notification 001' @@ -40,12 +40,12 @@ export default function ActsNotificationShowTest() { }) /* - * @tc.number: ActsNotificationShowTest_0200 + * @tc.number: SUB_NOTIFICATION_ANS_SHOW_TEST_0200 * @tc.name: show() * @tc.desc: verify the function of show */ - it('ActsNotificationShowTest_0200', 0, async function (done) { - console.info(TAG + 'ActsNotificationShowTest_0200 START ') + it('SUB_NOTIFICATION_ANS_SHOW_TEST_0200', 0, async function (done) { + console.info(TAG + 'SUB_NOTIFICATION_ANS_SHOW_TEST_0200 START ') let ShowNotificationOptions = { contentTitle: 123, contentText: 'This is a notification 002' @@ -58,12 +58,12 @@ export default function ActsNotificationShowTest() { }) /* - * @tc.number: ActsNotificationShowTest_0300 + * @tc.number: SUB_NOTIFICATION_ANS_SHOW_TEST_0300 * @tc.name: show() * @tc.desc: verify the function of show */ - it('ActsNotificationShowTest_0300', 0, async function (done) { - console.info(TAG + 'ActsNotificationShowTest_0300 START ') + it('SUB_NOTIFICATION_ANS_SHOW_TEST_0300', 0, async function (done) { + console.info(TAG + 'SUB_NOTIFICATION_ANS_SHOW_TEST_0300 START ') let ShowNotificationOptions = {} notification.show(ShowNotificationOptions) expect(ShowNotificationOptions.contentTitle).assertEqual(undefined) @@ -71,207 +71,214 @@ export default function ActsNotificationShowTest() { }) /* - * @tc.number: ActsNotificationShowTest_0400 + * @tc.number: SUB_NOTIFICATION_ANS_SHOW_TEST_0400 * @tc.name: show() * @tc.desc: verify the function of show */ - it('ActsNotificationShowTest_0400', 0, async function (done) { - console.info(TAG + 'ActsNotificationShowTest_0400 START ') + it('SUB_NOTIFICATION_ANS_SHOW_TEST_0400', 0, async function (done) { + console.info(TAG + 'SUB_NOTIFICATION_ANS_SHOW_TEST_0400 START ') + let ActionResult = { + bundleName: 'com.example.actsnotificationshow', + abilityName: 'com.example.actsnotificationshow.MainAbility', + uri: '/' + } let ShowNotificationOptions = { contentTitle: 'Title4', contentText: 'This is a notification 004', - ActionResult: { - bundleName: 'com.example.notification', - abilityName: 'com.example.notification.MainAbility', - uri: '/', - } + clickAction: ActionResult } notification.show(ShowNotificationOptions) console.info(TAG + ' conteneTitle:' + ShowNotificationOptions.contentTitle) console.info(TAG + ' contentText:' + ShowNotificationOptions.contentText) - console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.ActionResult.bundleName) - console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.ActionResult.abilityName) - console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.ActionResult.uri) + console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.clickAction.bundleName) + console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.clickAction.abilityName) + console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.clickAction.uri) expect(ShowNotificationOptions.contentTitle).assertEqual('Title4') expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 004') - expect(ShowNotificationOptions.ActionResult.bundleName).assertEqual('com.example.notification') - expect(ShowNotificationOptions.ActionResult.abilityName).assertEqual('com.example.notification.MainAbility') - expect(ShowNotificationOptions.ActionResult.uri).assertEqual('/') + expect(ShowNotificationOptions.clickAction.bundleName).assertEqual('com.example.actsnotificationshow') + expect(ShowNotificationOptions.clickAction.abilityName).assertEqual('com.example.actsnotificationshow.MainAbility') + expect(ShowNotificationOptions.clickAction.uri).assertEqual('/') done() }) /* - * @tc.number: ActsNotificationShowTest_0500 + * @tc.number: SUB_NOTIFICATION_ANS_SHOW_TEST_0500 * @tc.name: show() * @tc.desc: verify the function of show */ - it('ActsNotificationShowTest_0500', 0, async function (done) { - console.info(TAG + 'ActsNotificationShowTest_0500 START ') + it('SUB_NOTIFICATION_ANS_SHOW_TEST_0500', 0, async function (done) { + console.info(TAG + 'SUB_NOTIFICATION_ANS_SHOW_TEST_0500 START ') + let ActionResult = { + bundleName: 'com.example.actsnotificationshow', + abilityName: 'com.example.actsnotificationshow.MainAbility', + uri: 'pages/index/index' + } let ShowNotificationOptions = { contentTitle: 'Title5', contentText: 'This is a notification 005', - ActionResult: { - bundleName: 'com.example.notification', - abilityName: 'com.example.notification.MainAbility', - uri: 'pages/index/index', - } + clickAction: ActionResult } notification.show(ShowNotificationOptions) console.info(TAG + ' conteneTitle:' + ShowNotificationOptions.contentTitle) console.info(TAG + ' contentText:' + ShowNotificationOptions.contentText) - console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.ActionResult.bundleName) - console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.ActionResult.abilityName) - console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.ActionResult.uri) + console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.clickAction.bundleName) + console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.clickAction.abilityName) + console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.clickAction.uri) expect(ShowNotificationOptions.contentTitle).assertEqual('Title5') expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 005') - expect(ShowNotificationOptions.ActionResult.bundleName).assertEqual('com.example.notification') - expect(ShowNotificationOptions.ActionResult.abilityName).assertEqual('com.example.notification.MainAbility') - expect(ShowNotificationOptions.ActionResult.uri).assertEqual('pages/index/index') + expect(ShowNotificationOptions.clickAction.bundleName).assertEqual('com.example.actsnotificationshow') + expect(ShowNotificationOptions.clickAction.abilityName).assertEqual('com.example.actsnotificationshow.MainAbility') + expect(ShowNotificationOptions.clickAction.uri).assertEqual('pages/index/index') done() }) /* - * @tc.number: ActsNotificationShowTest_0600 + * @tc.number: SUB_NOTIFICATION_ANS_SHOW_TEST_0600 * @tc.name: show() * @tc.desc: verify the function of show */ - it('ActsNotificationShowTest_0600', 0, async function (done) { - console.info(TAG + 'ActsNotificationShowTest_0600 START ') + it('SUB_NOTIFICATION_ANS_SHOW_TEST_0600', 0, async function (done) { + console.info(TAG + 'SUB_NOTIFICATION_ANS_SHOW_TEST_0600 START ') + let ActionResult = { + bundleName: '', + abilityName: 'com.example.actsnotificationshow.MainAbility', + uri: '/', + } let ShowNotificationOptions = { contentTitle: 'Title6', contentText: 'This is a notification 006', - ActionResult: { - bundleName: '', - abilityName: 'com.example.notification.MainAbility', - uri: '/', - } + clickAction: ActionResult } notification.show(ShowNotificationOptions) console.info(TAG + ' conteneTitle:' + ShowNotificationOptions.contentTitle) console.info(TAG + ' contentText:' + ShowNotificationOptions.contentText) - console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.ActionResult.bundleName) - console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.ActionResult.abilityName) - console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.ActionResult.uri) + console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.clickAction.bundleName) + console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.clickAction.abilityName) + console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.clickAction.uri) expect(ShowNotificationOptions.contentTitle).assertEqual('Title6') expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 006') - expect(ShowNotificationOptions.ActionResult.abilityName).assertEqual('com.example.notification.MainAbility') - expect(ShowNotificationOptions.ActionResult.uri).assertEqual('/') + expect(ShowNotificationOptions.clickAction.abilityName).assertEqual('com.example.actsnotificationshow.MainAbility') + expect(ShowNotificationOptions.clickAction.uri).assertEqual('/') done() }) /* - * @tc.number: ActsNotificationShowTest_0700 + * @tc.number: SUB_NOTIFICATION_ANS_SHOW_TEST_0700 * @tc.name: show() * @tc.desc: verify the function of show */ - it('ActsNotificationShowTest_0700', 0, async function (done) { - console.info(TAG + 'ActsNotificationShowTest_0700 START ') + it('SUB_NOTIFICATION_ANS_SHOW_TEST_0700', 0, async function (done) { + console.info(TAG + 'SUB_NOTIFICATION_ANS_SHOW_TEST_0700 START ') + let ActionResult = { + bundleName: 'com.example.actsnotificationshow', + abilityName: '', + uri: '/', + } let ShowNotificationOptions = { contentTitle: 'Title7', contentText: 'This is a notification 007', - ActionResult: { - bundleName: 'com.example.notification', - abilityName: '', - uri: '/', - } + clickAction: ActionResult } notification.show(ShowNotificationOptions) console.info(TAG + ' conteneTitle:' + ShowNotificationOptions.contentTitle) console.info(TAG + ' contentText:' + ShowNotificationOptions.contentText) - console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.ActionResult.bundleName) - console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.ActionResult.abilityName) - console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.ActionResult.uri) + console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.clickAction.bundleName) + console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.clickAction.abilityName) + console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.clickAction.uri) expect(ShowNotificationOptions.contentTitle).assertEqual('Title7') expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 007') - expect(ShowNotificationOptions.ActionResult.bundleName).assertEqual('com.example.notification') - expect(ShowNotificationOptions.ActionResult.uri).assertEqual('/') + expect(ShowNotificationOptions.clickAction.bundleName).assertEqual('com.example.actsnotificationshow') + expect(ShowNotificationOptions.clickAction.uri).assertEqual('/') done() }) /* - * @tc.number: ActsNotificationShowTest_0800 + * @tc.number: SUB_NOTIFICATION_ANS_SHOW_TEST_0800 * @tc.name: show() * @tc.desc: verify the function of show */ - it('ActsNotificationShowTest_0800', 0, async function (done) { - console.info(TAG + 'ActsNotificationShowTest_0800 START ') + it('SUB_NOTIFICATION_ANS_SHOW_TEST_0800', 0, async function (done) { + console.info(TAG + 'SUB_NOTIFICATION_ANS_SHOW_TEST_0800 START ') + let ActionResult = { + bundleName: 'com.example.actsnotificationshow', + abilityName: 'com.example.actsnotificationshow.MainAbility', + uri: '', + } let ShowNotificationOptions = { contentTitle: 'Title8', contentText: 'This is a notification 008', - ActionResult: { - bundleName: 'com.example.notification', - abilityName: 'com.example.notification.MainAbility', - uri: '', - } + clickAction: ActionResult } notification.show(ShowNotificationOptions) console.info(TAG + ' conteneTitle:' + ShowNotificationOptions.contentTitle) console.info(TAG + ' contentText:' + ShowNotificationOptions.contentText) - console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.ActionResult.bundleName) - console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.ActionResult.abilityName) - console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.ActionResult.uri) + console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.clickAction.bundleName) + console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.clickAction.abilityName) + console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.clickAction.uri) expect(ShowNotificationOptions.contentTitle).assertEqual('Title8') expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 008') - expect(ShowNotificationOptions.ActionResult.bundleName).assertEqual('com.example.notification') - expect(ShowNotificationOptions.ActionResult.abilityName).assertEqual('com.example.notification.MainAbility') + expect(ShowNotificationOptions.clickAction.bundleName).assertEqual('com.example.actsnotificationshow') + expect(ShowNotificationOptions.clickAction.abilityName).assertEqual('com.example.actsnotificationshow.MainAbility') done() }) /* - * @tc.number: ActsNotificationShowTest_0900 + * @tc.number: SUB_NOTIFICATION_ANS_SHOW_TEST_0900 * @tc.name: show() * @tc.desc: verify the function of show */ - it('ActsNotificationShowTest_0900', 0, async function (done) { - console.info(TAG + 'ActsNotificationShowTest_0900 START ') + it('SUB_NOTIFICATION_ANS_SHOW_TEST_0900', 0, async function (done) { + console.info(TAG + 'SUB_NOTIFICATION_ANS_SHOW_TEST_0900 START ') + let ActionResult = { + bundleName: 'com.example.actsnotificationshow', + abilityName: 'com.example.actsnotificationshow.MainAbility', + uri: '/', + } let ShowNotificationOptions = { contentText: 'This is a notification 009', - ActionResult: { - bundleName: 'com.example.notification', - abilityName: 'com.example.notification.MainAbility', - uri: '/', - } + clickAction: ActionResult } notification.show(ShowNotificationOptions) console.info(TAG + ' contentText:' + ShowNotificationOptions.contentText) - console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.ActionResult.bundleName) - console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.ActionResult.abilityName) - console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.ActionResult.uri) + console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.clickAction.bundleName) + console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.clickAction.abilityName) + console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.clickAction.uri) expect(ShowNotificationOptions.contentText).assertEqual('This is a notification 009') - expect(ShowNotificationOptions.ActionResult.bundleName).assertEqual('com.example.notification') - expect(ShowNotificationOptions.ActionResult.abilityName).assertEqual('com.example.notification.MainAbility') - expect(ShowNotificationOptions.ActionResult.uri).assertEqual('/') + expect(ShowNotificationOptions.clickAction.bundleName).assertEqual('com.example.actsnotificationshow') + expect(ShowNotificationOptions.clickAction.abilityName).assertEqual('com.example.actsnotificationshow.MainAbility') + expect(ShowNotificationOptions.clickAction.uri).assertEqual('/') done() }) /* - * @tc.number: ActsNotificationShowTest_1000 + * @tc.number: SUB_NOTIFICATION_ANS_SHOW_TEST_1000 * @tc.name: show() * @tc.desc: verify the function of show */ - it('ActsNotificationShowTest_1000', 0, async function (done) { - console.info(TAG + 'ActsNotificationShowTest_1000 START ') + it('SUB_NOTIFICATION_ANS_SHOW_TEST_1000', 0, async function (done) { + console.info(TAG + 'SUB_NOTIFICATION_ANS_SHOW_TEST_1000 START ') + let ActionResult = { + bundleName: 'com.example.actsnotificationshow', + abilityName: 'com.example.actsnotificationshow.MainAbility', + uri: '/', + } let ShowNotificationOptions = { contentTitle: 'Title10', - ActionResult: { - bundleName: 'com.example.notification', - abilityName: 'com.example.notification.MainAbility', - uri: '/', - } + clickAction: ActionResult } notification.show(ShowNotificationOptions) console.info(TAG + ' conteneTitle:' + ShowNotificationOptions.contentTitle) - console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.ActionResult.bundleName) - console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.ActionResult.abilityName) - console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.ActionResult.uri) + console.info(TAG + ' ActionResult bundleName:' + ShowNotificationOptions.clickAction.bundleName) + console.info(TAG + ' ActionResult abilityName:' + ShowNotificationOptions.clickAction.abilityName) + console.info(TAG + ' ActionResult uri:' + ShowNotificationOptions.clickAction.uri) expect(ShowNotificationOptions.contentTitle).assertEqual('Title10') - expect(ShowNotificationOptions.ActionResult.bundleName).assertEqual('com.example.notification') - expect(ShowNotificationOptions.ActionResult.abilityName).assertEqual('com.example.notification.MainAbility') - expect(ShowNotificationOptions.ActionResult.uri).assertEqual('/') + expect(ShowNotificationOptions.clickAction.bundleName).assertEqual('com.example.actsnotificationshow') + expect(ShowNotificationOptions.clickAction.abilityName).assertEqual('com.example.actsnotificationshow.MainAbility') + expect(ShowNotificationOptions.clickAction.uri).assertEqual('/') done() }) - console.info(TAG + "ActsNotificationShowTest END"); + console.info(TAG + "SUB_NOTIFICATION_ANS_SHOW_TEST END"); }) diff --git a/notification/ans_standard/publish_test/BUILD.gn b/notification/ans_standard/publish_test/BUILD.gn deleted file mode 100644 index 158e3f777c217dcdb7f3a311b2fe0825dabeb121..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/BUILD.gn +++ /dev/null @@ -1,47 +0,0 @@ -# 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") - -group("publish_test") { - testonly = true - if (is_standard_system) { - deps = [ - #"actsanspublishcontroltest:ActsAnsPublishControlTest", - #"actsanspublishconversation:ActsAnsConversationTest", - "badgedisplayed:badgedisplayed", - "enablenotification:enablenotification", - "getactive:getactive", - "getwantagentinfo:ActsAnsGetWantAgentInfoTest", - - #"publishcontentype:publishcontentype", - #"subscribe:subscribe", - "activebtn:activebtn", - - #"actsansdistributedtest:ActsAnsDistributeTest", - "actsansgetallactive:ActsAnsGetAllActiveTestXts", - "ansactscancelgroup:ActsAnsCancelGroupTest", - "ansactsremovegroup:ActsAnsRemoveGroupTest", - - #"donotdisturbmode:ActsAnsDoNotDisturbTest", - - #"publish:ActsAnsNotificationPublishXts", - "publishsound:ActsAnsPublishSoundTest", - - #"publishvibra:ActsAnsPublishVibraTest", - #"sub:ActsAnsSubTestXts", - "unsubscribe:ActsAnsUnSubscriberTest", - "publishremovalwantagent:ActsAnsPublishRemovalWantAgentTest", - "wantagent:wantagent", - ] - } -} diff --git a/notification/ans_standard/publish_test/activebtn/BUILD.gn b/notification/ans_standard/publish_test/activebtn/BUILD.gn deleted file mode 100644 index f3b78549dd161ccdc8371c135623c1cb7cd459d6..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/BUILD.gn +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//test/xts/tools/build/suite.gni") - -group("activebtn") { - testonly = true - if (is_standard_system) { - deps = [ - "activebutton:ActsAnsActionButtonTest", - "testa:testA", - "testb:testB", - "testc:testC", - ] - } -} diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/BUILD.gn b/notification/ans_standard/publish_test/activebtn/activebutton/BUILD.gn deleted file mode 100644 index 0c8a2299399ed74dbdfded23a028f0582c32c11e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsActionButtonTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsActionButtonTest" - 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/publish_test/activebtn/activebutton/Test.json b/notification/ans_standard/publish_test/activebtn/activebutton/Test.json deleted file mode 100644 index 4439dcde1992e2253ff070d3eb8c3ec786d05177..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/Test.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "shell-timeout": "180000", - "bundle-name": "com.example.actsansactionbuttontest", - "package-name": "com.example.actsansactionbuttontest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsActionButtonTest.hap", - "testA.hap", - "testB.hap", - "testC.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/activebtn/activebutton/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/activebtn/activebutton/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/config.json b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/config.json deleted file mode 100644 index 1cb2c45cfafed37fdd0737ab71f1b861ddea2cb8..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansactionbuttontest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansactionbuttontest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/activebtn/activebutton/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 44f4bc0a213133ced33d70b9220c26b66a088726..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - activeButton - -
diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/activebtn/activebutton/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/activebtn/activebutton/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/activebtn/activebutton/src/main/js/test/ActiveButton.js b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/test/ActiveButton.js deleted file mode 100644 index a68143f3627e28fb7c4b9b4cdec03e7270985595..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/test/ActiveButton.js +++ /dev/null @@ -1,239 +0,0 @@ -/* - * 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 notify from '@ohos.notification' -import WantAgent from '@ohos.wantAgent' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' - -export default function ActsAnsActionButtonTest() { -describe('ActsAnsActionButtonTest', function () { - console.info("===ActsDoNotSubscriberTest start===>"); - function publishCallbacka(err){ - console.debug("===>publishCallbacka===>"+err.code); - expect(err.code).assertEqual(0) - } - function publishCallbackb(err){ - console.debug("===>publishCallbackb===>"+err.code); - expect(err.code).assertEqual(0) - } - function publishCallbackc(err){ - console.debug("===>publishCallbackc===>"+err.code); - expect(err.code).assertEqual(0) - } - - function consumeCallbackA(data) { - console.debug("===>consumeCallbackA data : ===>" +JSON.stringify(data)); - var triggerInfo = { - code:0 - } - expect(data.request.actionButtons[0].title).assertEqual("buttonA") - var wantAgenta = data.request.actionButtons[0].wantAgent - console.debug("===>titleA: ===>" + JSON.stringify(data.request.actionButtons[0].title)) - console.debug("===>wantAgentA: ===>" + JSON.stringify(wantAgenta)) - WantAgent.trigger(wantAgenta, triggerInfo, - (err, data) => { - if (err.code == 0) { - console.info('==== triggerA success' + err.code+JSON.stringify(data) ); - } else { - console.info('----triggerA failed!----'+err.code); - } - } - ); - } - - /* - * @tc.number: ActsActiveButton_test_0100 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsActiveButton_test_0100', 0, async function (done) { - console.debug("===ActsActiveButton_test_0100===begin===>"); - var subInfo ={ - onConsume:consumeCallbackA - } - notify.subscribe(subInfo); - - var agentInfoA = { - wants: [ - { - bundleName: "com.example.wantAgentTest", - abilityName: "com.example.wantAgentTest.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - } - ], - operationType: WantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - }; - var wantAgentData = await WantAgent.getWantAgent(agentInfoA); - - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, - longText : { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText", - longText: "long_text", - briefText: "long_briefText", - expandedTitle: "long_expandedTitle" - }, - }, - id: 1, - slotType : notify.SlotType.SERVICE_INFORMATION, - actionButtons: [{title:"buttonA", wantAgent:wantAgentData}] - } - await notify.publish(notificationRequest, publishCallbacka); - console.info("===ActsActiveButton_test_0100===end===>"); - setTimeout((async function(){ - notify.unsubscribe(subInfo); - console.info("======ActsActiveButton_test_0100 setTimeout unsubscribe===>"); - done(); - }),300); - }) - - //consume - function consumeCallbackB(data) { - console.debug("===>consumeCallbackB data : ===>" +JSON.stringify(data)); - var triggerInfo = { - code:1 - } - expect(data.request.actionButtons[0].title).assertEqual("buttonB") - var wantAgentB = data.request.actionButtons[0].wantAgent - console.debug("===>titleB: ===>" + JSON.stringify(data.request.actionButtons[0].title)) - console.debug("===>wantAgentB: ===>" + JSON.stringify(wantAgentB)) - WantAgent.trigger(wantAgentB, triggerInfo, - (err, data) => { - if (err.code == 0) { - console.info('==== triggerB success' + err.code+JSON.stringify(data) ); - } else { - console.info('----triggerB failed!----'+err.code); - } - } - ); - } - - /* - * @tc.number: ActsActiveButton_test_0200 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsActiveButton_test_0200', 0, async function (done) { - console.debug("===ActsActiveButton_test_0200===begin===>"); - var subInfo ={ - onConsume:consumeCallbackB - } - notify.subscribe(subInfo); - - var agentInfoB = { - wants: [ - { - bundleName: "com.example.wantAgentTest", - abilityName: "com.example.wantAgentTest.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - } - ], - operationType: WantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - }; - var wantAgentDataB = await WantAgent.getWantAgent(agentInfoB); - - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, - longText : { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText", - longText: "long_text", - briefText: "long_briefText", - expandedTitle: "long_expandedTitle" - }, - }, - id: 2, - slotType : notify.SlotType.SERVICE_INFORMATION, - actionButtons: [{title:"buttonB", wantAgent:wantAgentDataB}] - } - await notify.publish(notificationRequest).then(()=>{ - console.info("===ActsActiveButton_test_0200===promise===>"); - }); - setTimeout((async function(){ - notify.unsubscribe(subInfo); - console.info("======ActsActiveButton_test_0200 setTimeout unsubscribe===>"); - done(); - }),300); - }) - - - function consumeCallbackC(data) { - console.debug("===>consumeCallbackC data : ===>" +JSON.stringify(data)); - var triggerInfoC = { - code:2 - } - var triggerInfoD = { - code:3 - } - expect(data.request.actionButtons[0].title).assertEqual("buttonC") - expect(data.request.actionButtons[1].title).assertEqual("buttonD") - var wantAgentC = data.request.actionButtons[0].wantAgent - var wantAgentD = data.request.actionButtons[1].wantAgent - console.debug("===>wantAgentC: ===>" + JSON.stringify(wantAgentC)) - console.debug("===>wantAgentD: ===>" + JSON.stringify(wantAgentD)) - WantAgent.trigger(wantAgentC, triggerInfoC, - (err, data) => { - if (err.code == 0) { - console.info('==== triggerC success' + err.code+JSON.stringify(data) ); - } else { - console.info('----triggerC failed!----'+err.code); - } - }); - WantAgent.trigger(wantAgentD, triggerInfoD, - (err, data) => { - if (err.code == 0) { - console.info('==== triggered success' + err.code + JSON.stringify(data) ); - } else { - console.info('----triggered failed!----'+ err.code); - } - }); - } -}) - -} diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/test/List.test.js deleted file mode 100644 index 813c446f58760c01585ade795f85fb44ad176ffb..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/test/List.test.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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 ActsAnsActionButtonTest from './ActiveButton.js' -import ActsAnsPublishIconTest from './publishIcon.js' -import ActsAnsPublishImageTest from './publishImage.js' -export default function testsuite() { -ActsAnsActionButtonTest() -ActsAnsPublishIconTest() -ActsAnsPublishImageTest() -} diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/test/publishIcon.js b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/test/publishIcon.js deleted file mode 100644 index 9359f3dcf944d7ce0f6d497d9d393778feb67ef7..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/test/publishIcon.js +++ /dev/null @@ -1,191 +0,0 @@ -/* - * 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 image from '@ohos.multimedia.image' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -var largeIconA -var smallIconA -var largeBufferA -var smallBufferA -var largeOptsA -var smallOptsA - -var largeIconB -var smallIconB -var largeBufferB -var smallBufferB -var largeOptsB -var smallOptsB - -var largeIconC -var smallIconC -var largeBufferC -var smallBufferC -var largeOptsC -var smallOptsC - -var largeIconD -var smallIconD -var largeBufferD -var smallBufferD -var largeOptsD -var smallOptsD - -export default function ActsAnsPublishIconTest() { -describe('ActsAnsPublishIconTest', function () { - function publishCallbackA(err){ - console.log('ActsAnsPublishIconTest publishCallbackA asyncCallback'+err.code) - expect(err.code).assertEqual(0) - } - function publishCallbackB(err){ - console.log('ActsAnsPublishIconTest publishCallbackB asyncCallback'+err.code) - expect(err.code != 0).assertEqual(true); - } - function consumeCallbackA(data) { - console.debug("===consumeCallbackA data : ===>" + JSON.stringify(data)); - expect(data.request.id).assertEqual(1) - } - function consumeCallbackB(data) { - console.debug("===consumeCallbackB data : ===>" + JSON.stringify(data)); - expect(data.request.id).assertEqual(2) - } - - function subscribeCallbackA(err) { - console.info("===subscribeCallbackA err : ===>" + JSON.stringify(err)); - expect(err.code).assertEqual(0) - } - function subscribeCallbackB(err) { - console.info("===subscribeCallbackB err : ===>" + JSON.stringify(err)); - expect(err.code).assertEqual(0) - } - - - /* - * @tc.number: ACTS_PublishIconTest_0300 - * @tc.name: publish() - * @tc.desc: verify the function of publish - */ - it('ACTS_PublishIconTest_0300', 0,async function (done) { - largeBufferC = new ArrayBuffer(4*1024*50); - smallBufferC = new ArrayBuffer(4*2*25); - largeOptsC = {alphaType: 0, editable: true, pixelFormat: 0, scaleMode: 1, size: {height: 50, width: 1024}} - smallOptsC = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 25, width: 2}} - const promise_Large = image.createPixelMap(largeBufferC, largeOptsC); - promise_Large.then((data) => { - largeIconC = data; - console.debug("===createPixelMapC largeIcon===>"+JSON.stringify(largeIconC)); - const promise_Small = image.createPixelMap(smallBufferC, smallOptsC); - promise_Small.then((data) => { - smallIconC = data; - console.debug("===createPixelMapC smallIcon===>"+JSON.stringify(smallIconC)); - - notification.publish({ - content:{ - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_titleC", - text: "test_textC", - additionalText: "test_additionalTextC" - }, - }, - id: 3, - slotType : notification.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0100_1", - badgeIconStyle: 1, - showDeliveryTime: true, - smallIcon:smallIconC, - largeIcon:largeIconC, - },publishCallbackB); - done(); - }) - }); - }); - - /* - * @tc.number: ACTS_PublishTest_0400 - * @tc.name: publish() - * @tc.desc: verify the function of publish - */ - it('ACTS_PublishIconTest_0400', 0,async function (done) { - largeBufferD = new ArrayBuffer(4*1024*50); - smallBufferD = new ArrayBuffer(4*2*25); - largeOptsD = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 50, width: 1024}} - smallOptsD = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 25, width: 2}} - const promise_Large = image.createPixelMap(largeBufferD, largeOptsD); - promise_Large.then((data) => { - largeIconD = data; - console.debug("===createPixelMapD largeIcon===>"+JSON.stringify(largeIconD)); - const promise_Small = image.createPixelMap(smallBufferD, smallOptsD); - promise_Small.then((data) => { - smallIconD = data; - console.debug("===createPixelMapD smallIcon===>"+JSON.stringify(smallIconD)); - - notification.publish({ - content:{ - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test1_title", - text: "test1_text", - additionalText: "test1_additionalText" - }, - }, - id: 4, - slotType : notification.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0100_1", - badgeIconStyle: 1, - showDeliveryTime: true, - smallIcon:smallIconD, - largeIcon:largeIconD, - }).then().catch((err)=>{ - console.debug("===ACTS_PublishIconTest_0400 promise===>"+err.code); - expect(err.code != 0).assertEqual(true); - done() - }); - }) - }); - }); -}) -} diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/test/publishImage.js b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/test/publishImage.js deleted file mode 100644 index 839e0fde58da99851090a9846e5dac605403d60d..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/js/test/publishImage.js +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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 notify from '@ohos.notification' -import image from '@ohos.multimedia.image' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -var BufferA -var BufferB -var BufferC -var BufferD -var optsA -var optsB -var optsC -var optsD -var pubimageA -var pubimageB -var pubimageC -var pubimageD -export default function ActsAnsPublishImageTest() { -describe('ActsAnsPublishImageTest', function () { - console.info("===ActsAnsPublishImageTest start===>"); - - //consume - function consumeCallbackA(data) { - console.debug("===>consumeDoNotCallback1 data : ===>" + JSON.stringify(data)); - expect(data.request.id).assertEqual(1) - } - function consumeCallbackB(data) { - console.debug("===>consumeDoNotCallback2 data : ===>" +JSON.stringify(data)); - expect(data.request.id).assertEqual(2) - } - //subscribe - function subscribeCallbackA(err) { - console.debug("===>subscribeCallbackA===>"+err.code); - expect(err.code).assertEqual(0) - } - function subscribeCallbackB(err) { - console.debug("===>subscribeCallbackB===>"+err.code); - expect(err.code).assertEqual(0) - } - function publishCallbackA(err){ - console.log('ActsAnsPublishImageTest publishCallbackA asyncCallback'+err.code) - expect(err.code).assertEqual(0) - } - function publishCallbackB(err){ - console.log('ActsAnsPublishImageTest publishCallbackB asyncCallback'+err.code) - expect(err.code != 0).assertEqual(true); - } - - - /* - * @tc.number: ActsPublishImage_test_0300 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsPublishImage_test_0300', 0, async function (done) { - console.debug("===ActsPublishImage_test_0300===begin===>"); - BufferC = new ArrayBuffer( 4*1024* 2048); - optsC = {alphaType: 0, editable: true, pixelFormat: 0, scaleMode: 1, size: {height: 1024, width: 2048}} - - const promise_Large = image.createPixelMap(BufferC, optsC); - promise_Large.then((data) => { - pubimageC = data; - console.debug("====createPixelMapC image===>"+pubimageC); - - notify.publish({ - id: 3, - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_PICTURE, - picture: { - title: "image_titleC", - text: "image_textC", - additionalText: "image_additionalTextC", - briefText:"image_briefC", - expandedTitle:"expandedTitleC", - picture:pubimageC - }, - }, - slotType:notify.SlotType.SOCIAL_COMMUNICATION, - classification:"classificationC", - sortingKey:"sortingKeyC", - },publishCallbackB); - done(); - }) - }) - - /* - * @tc.number: ActsPublishImage_test_0400 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsPublishImage_test_0400', 0, async function (done) { - console.debug("===ActsPublishImage_test_0400===begin===>"); - BufferD = new ArrayBuffer( 4*1024* 2048); - optsD = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 1024, width: 2048}} - - const promise_Large = image.createPixelMap(BufferD, optsD); - promise_Large.then((data) => { - pubimageD = data; - console.debug("===createPixelMapD image===>"+pubimageD); - - notify.publish({ - id: 4, - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_PICTURE, - picture: { - title: "image_titleD", - text: "image_textD", - additionalText: "image_additionalTextD", - briefText:"image_briefD", - expandedTitle:"expandedTitleD", - picture:pubimageD - }, - }, - slotType:notify.SlotType.SOCIAL_COMMUNICATION, - classification:"classificationD", - sortingKey:"sortingKeyD", - }).then().catch((err)=>{ - console.debug("===ActsPublishImage_test_0400 err===>"+err.code); - expect(err.code != 0).assertEqual(true); - done(); - }); - }) - }) - }) - - -} diff --git a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/activebtn/activebutton/src/main/resources/base/element/string.json deleted file mode 100644 index d9400769ce6a7a3180283a9c39a17262a9538031..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/activebutton/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ActiveBtn" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/activebtn/testa/BUILD.gn b/notification/ans_standard/publish_test/activebtn/testa/BUILD.gn deleted file mode 100644 index 207e9b317fd9fe7326bf26bd1e43ec2547093616..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testa/BUILD.gn +++ /dev/null @@ -1,34 +0,0 @@ -# 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_hap_assist_suite("testA") { - hap_profile = "./entry/src/main/config.json" - hap_name = "testA" - subsystem_name = "notification" - part_name = "distributed_notification_service" - testonly = true - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/config.json b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/config.json deleted file mode 100644 index 1bbe141d2ebe0f7a884651fc81b08bbde38931cd..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/config.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "app": { - "bundleName": "com.example.wantAgentTestA", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.wantAgentTestA", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "com.example.wantAgentTestA.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/activebtn/testa/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/pages/index/index.hml deleted file mode 100644 index aa13e19ea206c08a562754f7cef3572726e96941..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Page 1 - -
diff --git a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index 6e1cc7770a86a2b0add36fa1bdeaa1e0673ef31e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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' -import {Core, ExpectExtend} from 'deccjsunit/index' - -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') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - core.execute() - }, - onReady() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index f65b394eb7a98a4058d726bacda53fe1221d909d..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testa/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "test1" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testa/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/activebtn/testa/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/activebtn/testa/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/activebtn/testb/BUILD.gn b/notification/ans_standard/publish_test/activebtn/testb/BUILD.gn deleted file mode 100644 index cd6e8eceeac2067dbdeb008d614c6b1b8654e6a3..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testb/BUILD.gn +++ /dev/null @@ -1,34 +0,0 @@ -# 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_hap_assist_suite("testB") { - hap_profile = "./entry/src/main/config.json" - hap_name = "testB" - subsystem_name = "notification" - part_name = "distributed_notification_service" - testonly = true - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/config.json b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/config.json deleted file mode 100644 index d9917cc1f971d46a3e5d18a09ae9fbd367272ba9..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/config.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "app": { - "bundleName": "com.example.wantAgentTestB", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.wantAgentTestB", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "com.example.wantAgentTestB.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/activebtn/testb/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/pages/index/index.hml deleted file mode 100644 index 5f0dc11c72dd500785428632bfbba9d776ab70ac..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Page 2 - -
diff --git a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index 6e1cc7770a86a2b0add36fa1bdeaa1e0673ef31e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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' -import {Core, ExpectExtend} from 'deccjsunit/index' - -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') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - core.execute() - }, - onReady() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index ef239e584f5a0fbfa932d1ec4897291ba92b9765..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testb/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "test2" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testb/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/activebtn/testb/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/activebtn/testb/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/activebtn/testc/BUILD.gn b/notification/ans_standard/publish_test/activebtn/testc/BUILD.gn deleted file mode 100644 index a84fb16aba7fddfce6890854fe8f58897b11034b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testc/BUILD.gn +++ /dev/null @@ -1,34 +0,0 @@ -# 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_hap_assist_suite("testC") { - hap_profile = "./entry/src/main/config.json" - hap_name = "testC" - subsystem_name = "notification" - part_name = "distributed_notification_service" - testonly = true - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/config.json b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/config.json deleted file mode 100644 index 98673af19ce97ddb259377c2efbb21bf13586386..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/config.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "app": { - "bundleName": "com.example.wantAgentTestC", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.wantAgentTestC", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "com.example.wantAgentTestC.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/activebtn/testc/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index 09696c297ee9837d996bd113bf8d41b67f236f7b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/pages/index/index.hml deleted file mode 100644 index 68e58158a1ab2820a5aac524a6b3edafc09ed52b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - 页面3 - -
diff --git a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index 6e1cc7770a86a2b0add36fa1bdeaa1e0673ef31e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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' -import {Core, ExpectExtend} from 'deccjsunit/index' - -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') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - core.execute() - }, - onReady() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index b3bd2eb154f549353d38d9d76af8d80bfccc14cb..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/activebtn/testc/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "test3" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/activebtn/testc/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/activebtn/testc/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/activebtn/testc/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/actsansdistributedtest/BUILD.gn b/notification/ans_standard/publish_test/actsansdistributedtest/BUILD.gn deleted file mode 100644 index df875f936b0a7e840e00c25358020aa511fcc922..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsDistributeTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsDistributeTest" - 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/publish_test/actsansdistributedtest/Test.json b/notification/ans_standard/publish_test/actsansdistributedtest/Test.json deleted file mode 100644 index 265bd964be8f74a7c636bd68ba3e16bd6ae26f7e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "com.example.actsansdistributetest", - "package-name": "com.example.actsansdistributetest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsDistributeTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsansdistributedtest/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/actsansdistributedtest/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/actsansdistributedtest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/config.json b/notification/ans_standard/publish_test/actsansdistributedtest/src/main/config.json deleted file mode 100644 index 7d7ea2ecc7494348fc41a82b893ec0afe283183e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansdistributetest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansdistributetest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/actsansdistributedtest/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 5c52a87a04f583e9d5f4db1dd40d4eafdb9b6aeb..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,9 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index a84867b3cf7fd2e4164591ca4a1f2bdc3ef80ffc..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - 分布式自动化 - -
diff --git a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/actsansdistributedtest/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/actsansdistributedtest/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/actsansdistributedtest/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/test/List.test.js deleted file mode 100644 index fd711d154cc98dc99c26140909332f85117dcfa3..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsDistributeTest from './actsansdistributedtest.js' -export default function testsuite() { -ActsAnsDistributeTest() -} diff --git a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/test/actsansdistributedtest.js b/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/test/actsansdistributedtest.js deleted file mode 100644 index a930faba0fe135a3b2f2b5cd5b48eaa766fe6d52..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/js/test/actsansdistributedtest.js +++ /dev/null @@ -1,205 +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 notify from '@ohos.notification' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -var timeout = 1800; - -export default function ActsAnsDistributeTest() { -describe('ActsAnsDistributeTest', function () { - - /* - * @tc.number: ActsDistribute_test_0100 - * @tc.name: enableDistributed() - * @tc.desc: verify the function of enableDistributed,isDistributedEnabled - */ - it('ActsDistribute_test_0100', 0, async function (done) { - await notify.enableDistributed(false,async() => { - await notify.isDistributedEnabled((err,data) => { - console.log("===>ActsDistribute_test_0100 success===>"+err+data) - expect(data).assertEqual(false) - done(); - }) - }) - }) - - /* - * @tc.number: ActsDistribute_test_0200 - * @tc.name: enableDistributedByBundle() - * @tc.desc: verify the function of enableDistributedByBundle,isDistributedEnableByBundle - */ - it('ActsDistribute_test_0200', 0, async function (done) { - await notify.enableDistributedByBundle({ - bundle:"com.example.actsansdistributetest" - },true,async() => { - await notify.isDistributedEnableByBundle({ - bundle:"com.example.actsansdistributetest", - },(err,data) => { - console.log("===>ActsDistribute_test_0200 success===>"+err+data) - expect(data).assertEqual(true) - done(); - }) - }) - }) - - /* - * @tc.number: ActsDistribute_test_0300 - * @tc.name: getDeviceRemindType() - * @tc.desc: verify the function of getDeviceRemindType - */ - it('ActsDistribute_test_0300', 0, async function (done) { - await notify.getDeviceRemindType((err,data) => { - console.debug("===>ActsDistribute_test_0300===>"+ JSON.stringify(data)) - if (data != notify.DeviceRemindType.IDLE_DONOT_REMIND - && data != notify.DeviceRemindType.IDLE_REMIND - && data != notify.DeviceRemindType.ACTIVE_DONOT_REMIND - && data != notify.DeviceRemindType.ACTIVE_REMIND ) - { - expect().assertFail(); - } - done(); - }); - }) - - /* - * @tc.number: ActsDistribute_test_0400 - * @tc.name: publish() - * @tc.desc: verify the function of publish - */ - it('ActsDistribute_test_0400', 0, async function (done) { - function onConsume0100(data) { - console.info("========ActsDistribute_test_0400 onConsume data:=======>" + JSON.stringify(data)); - if (data.request.distributedOptions.remindType != notify.DeviceRemindType.IDLE_DONOT_REMIND - && data.request.distributedOptions.remindType != notify.DeviceRemindType.IDLE_REMIND - && data.request.distributedOptions.remindType != notify.DeviceRemindType.ACTIVE_DONOT_REMIND - && data.request.distributedOptions.remindType != notify.DeviceRemindType.ACTIVE_REMIND ) - { - expect().assertFail(); - } - expect(data.request.deviceId).assertEqual(""); - console.info("ActsDistribute_test_0400 onConsume data"+JSON.stringify(data.request.notificationFlags)); - expect(JSON.stringify(data.request.notificationFlags)).assertEqual(undefined); - } - await notify.enableDistributed(true); - await notify.enableDistributedSelf(true); - console.info("==================ActsDistribute_test_0400 start==================>"); - var subscriber ={ - onConsume:onConsume0100, - } - await notify.subscribe(subscriber); - var notificationRequest = { - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test13_title", - text: "test13_text", - additionalText: "test13_additionalText" - } - }, - id: 4, - label: "ANS_PublishBasicText_0100", - slotType : notify.SlotType.CONTENT_INFORMATION, - distributedOptions:{isDistributed: true, supportDisplayDevices: ["0"], supportOperateDevices: ["0"]} - } - await notify.publish(notificationRequest); - console.info("===========ActsDistribute_test_0400 publish promise========>"); - setTimeout((async function(){ - console.info("======ActsDistribute_test_0400 setTimeout==============>"); - await notify.unsubscribe(subscriber); - console.info("======ActsDistribute_test_0400 setTimeout unsubscribe==>"); - done(); - }),timeout); - }) - - /* - * @tc.number: ActsDistribute_test_0500 - * @tc.name: onEnabledNotificationChanged() - * @tc.desc: verify the function of onEnabledNotificationChanged - */ - it('ActsDistribute_test_0500', 0, async function (done) { - function onEnabledNotificationChanged001(data){ - console.log("===>onEnabledNotificationChanged001 success===>"+JSON.stringify(data)) - console.log("===>onEnabledNotificationChanged001 bundle===>"+JSON.stringify(data.bundle)) - console.log("===>onEnabledNotificationChanged001 uid===>"+JSON.stringify(data.uid)) - console.log("===>onEnabledNotificationChanged001 enable===>"+JSON.stringify(data.enable)) - expect(JSON.stringify(data.bundle)).assertEqual("com.example.actsansdistributetest"); - expect(JSON.stringify(data.uid)).assertEqual("454231"); - expect(JSON.stringify(data.enable)).assertEqual(true); - } - function connectCallbacka() { - console.debug("==>connectCallbacka code==>"); - } - var subscriber ={ - onConnect:connectCallbacka, - onEnabledNotificationChanged:onEnabledNotificationChanged001, - } - await notify.subscribe(subscriber,async(err)=>{ - console.debug("==>subscribeCallback code==>" +err.code); - expect(err.code).assertEqual(0); - await notify.requestEnableNotification((err) => { - console.log("===>ActsDistribute_test_0500 success===>"+err.code) - }) - }); - setTimeout((async function(){ - console.info("======ActsDistribute_test_0500 setTimeout==============>"); - await notify.unsubscribe(subscriber); - console.info("======ActsDistribute_test_0500 setTimeout unsubscribe==>"); - done(); - }),timeout); - }) - - /* - * @tc.number: ActsDistribute_test_0600 - * @tc.name: Query whether the template exists - * @tc.desc: isSupportTemplate(templateName: string, callback: AsyncCallback): void - */ - it('ActsDistribute_test_0600', 0, async function (done) { - console.info("==>ActsDistribute_test_0600 start==>"); - var templateName = '/system/etc/notification_template/assets/js/downloadTemplate.js'; - function isSupportTemplateCallback(err, data) { - if(err) { - console.error("isSupportTemplateCallback" + err.code); - } else { - expect(true).assertTrue(); - console.info("isSupportTemplateCallback" + JSON.stringify(data)); - done(); - } - } - notify.isSupportTemplate(templateName, isSupportTemplateCallback); - done(); - }) - - /* - * @tc.number: ActsDistribute_test_0700 - * @tc.name: Query whether the template exists - * @tc.desc: isSupportTemplate(templateName: string): Promise - */ - it('ActsDistribute_test_0700', 0, async function (done) { - console.info("==>ActsDistribute_test_0700 start==>"); - var templateName = '/system/etc/notification_template/assets/js/downloadTemplate.js'; - notify.isSupportTemplate(templateName).then ((data) => { - expect(data).assertEqual(false); - console.info("isSupportTemplatePromise"); - console.info("==>ActsDistribute_test_0700 success==>" + JSON.stringify(data)); - done(); - }) - done(); - }) - - - }) - - -} diff --git a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/actsansdistributedtest/src/main/resources/base/element/string.json deleted file mode 100644 index 5581f06dd5a57ff7bdd0e1314a98dba0f30a027c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansdistributedtest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "distribute" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/actsansgetallactive/BUILD.gn b/notification/ans_standard/publish_test/actsansgetallactive/BUILD.gn deleted file mode 100644 index 8117c33920823c4f1bda68bc1a5df4118ca8ca6e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsGetAllActiveTestXts") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsGetAllActiveTest" - 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/publish_test/actsansgetallactive/Test.json b/notification/ans_standard/publish_test/actsansgetallactive/Test.json deleted file mode 100644 index 590894bf8618bcd078a514c9576d4dfaea9d048f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "shell-timeout": "180000", - "bundle-name": "com.example.actsansgetallactivetest", - "package-name": "com.example.actsansgetallactivetest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsGetAllActiveTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsansgetallactive/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/actsansgetallactive/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/actsansgetallactive/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/actsansgetallactive/src/main/config.json b/notification/ans_standard/publish_test/actsansgetallactive/src/main/config.json deleted file mode 100644 index f3f54ddde18c4a57853262a16546291c6c1afcf7..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansgetallactivetest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansgetallactivetest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/actsansgetallactive/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 50933d90e341bfd1da4cb62c7db8e07b6de2a643..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,23 +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. - */ - -
- - currentApp - - - ForGetAllActive - -
diff --git a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/actsansgetallactive/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/actsansgetallactive/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/actsansgetallactive/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/test/List.test.js deleted file mode 100644 index 8566dc428e332d4d1535a048b5541ea71da2a799..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsGetAllActiveTestXts from './getAllActive.js' -export default function testsuite() { -ActsAnsGetAllActiveTestXts() -} diff --git a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/test/getAllActive.js b/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/test/getAllActive.js deleted file mode 100644 index d03ac954f313ea7a36e9bf9beb97ef204260c390..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/src/main/js/test/getAllActive.js +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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 notify from '@ohos.notification' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -var time = 500 -export default function ActsAnsGetAllActiveTestXts() { -describe('ActsAnsGetAllActiveTestXts', function () { - console.info("===========ActsAnsGetAllActiveTest start====================>"); - function getAllCallback(err, data){ - console.log("Ans_GetAllActive_0100 getAllCallback ============>"); - var i; - console.log("Ans_GetAllActive_0100 getAllCallback data.length============>"+data.length); - expect(data.length).assertEqual(2); - console.log("Ans_GetAllActive_0100 getAllCallback data============>"+JSON.stringify(data)); - for (i = 0; i < data.length; i++) { - if (i == 0){ - expect(data[i].content.normal.title).assertEqual("test_title_otherApp"); - console.log("=======Ans_GetAllActive_0100 getCallback title=====>"+data[i].content.normal.title) - expect(data[i].content.normal.text).assertEqual("test_text_otherApp"); - console.log("=======Ans_GetAllActive_0100 getCallback text========>"+data[i].content.normal.text) - expect(data[i].content.normal.additionalText).assertEqual("test_additionalText_otherApp"); - console.log("===Ans_GetAllActive_0100 getCallback text====>"+data[i].content.normal.additionalText) - expect(data[i].id).assertEqual(2); - console.log("============Ans_GetAllActive_0100 getCallback id============>"+data[i].id) - expect(data[i].label).assertEqual("otherApp"); - console.log("============Ans_GetAllActive_0100 getCallback label=====>"+data[i].label) - }else if(i == 1){ - expect(data[i].content.normal.title).assertEqual("test_title_currentApp"); - console.log("======Ans_GetAllActive_0100 getCallback title=========>"+data[i].content.normal.title) - expect(data[i].content.normal.text).assertEqual("test_text_currentApp"); - console.log("==========Ans_GetAllActive_0100 getCallback text=======>"+data[i].content.normal.text) - expect(data[i].content.normal.additionalText).assertEqual("test_additionalText_currentApp"); - console.log("===Ans_GetAllActive_0100 getCallback text=====>"+data[i].content.normal.additionalText) - expect(data[i].id).assertEqual(1); - console.log("============Ans_GetAllActive_0100 getCallback id============>"+data[i].id) - expect(data[i].label).assertEqual("currentApp_0100"); - console.log("============Ans_GetAllActive_0100 getCallback label=====>"+data[i].label) - } - } - } - - /* - * @tc.number: Ans_GetAllActive_xts_0100 - * @tc.name: getAllActiveNotifications(callback: AsyncCallback>): void; - * @tc.desc: Verify: After the current app and other apps publish two notifications, - get all active notifications in the system(callback) - */ - it('Ans_GetAllActive_xts_0100', 0, async function (done) { - console.debug("===============Ans_GetAllActive_0100 start==================>"); - await notify.cancelAll(); - var notificationRequestOfOtherApp = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_otherApp", - text: "test_text_otherApp", - additionalText: "test_additionalText_otherApp" - }, - }, - id: 2, - label: "otherApp", - } - await notify.publish(notificationRequestOfOtherApp); - console.debug("===============Ans_GetAllActive_0100 publish OtherApp notify end==================>"); - var notificationRequestOfCurrentApp = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_currentApp", - text: "test_text_currentApp", - additionalText: "test_additionalText_currentApp" - }, - }, - id: 1, - label: "currentApp_0100", - } - await notify.publish(notificationRequestOfCurrentApp); - console.debug("===============Ans_GetAllActive_0100 publish CurrentApp notify end==================>"); - notify.getAllActiveNotifications(getAllCallback); - console.debug("===============Ans_GetAllActive_0100 getAllActiveNotifications end==================>"); - setTimeout(function(){ - console.debug("===============Ans_GetAllActive_0100 setTimeout==================>"); - done(); - }, time); - }) -}) - -} diff --git a/notification/ans_standard/publish_test/actsansgetallactive/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/actsansgetallactive/src/main/resources/base/element/string.json deleted file mode 100644 index 7f71c81573e31b291ddd76d3c37c7eba4a6da7dc..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsansgetallactive/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "getAllActive" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/actsanspublishcontroltest/BUILD.gn b/notification/ans_standard/publish_test/actsanspublishcontroltest/BUILD.gn deleted file mode 100644 index 1251e230a6154c746b6a1f1c01b025a42f7a8906..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsPublishControlTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsPublishControlTest" - 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/publish_test/actsanspublishcontroltest/Test.json b/notification/ans_standard/publish_test/actsanspublishcontroltest/Test.json deleted file mode 100644 index d81b03b75f91b9a4b78d536d3d930a820eb5e87b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "shell-timeout": "180000", - "bundle-name": "com.example.actsanspublishcontroltest", - "package-name": "com.example.actsanspublishcontroltest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsPublishControlTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsanspublishcontroltest/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/actsanspublishcontroltest/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/actsanspublishcontroltest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/config.json b/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/config.json deleted file mode 100644 index 387ab7474f3a539ba6bf2e13d78866f86d842910..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanspublishcontroltest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanspublishcontroltest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/actsanspublishcontroltest/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index cc183ba6f171c0a02e11f8a2eecdf4247d8c8bc2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - {{title}} - -
diff --git a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 0cdcd00e876ddacdc80de31771450fe24f2ad3b6..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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 = "测试发布流控"; - }, - onShow() { - console.info('onShow finish') - }, - onReady() { - }, -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/actsanspublishcontroltest/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/actsanspublishcontroltest/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/actsanspublishcontroltest/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index 6a597ed39a579d2de7000ba9731eeb31a28018ce..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,452 +0,0 @@ -/* - * 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' - -var notificationSubscriberInfo ={ - bundleNames: ["com.example.actsanspublishcontroltest"] -} - -var notificationSubscriber = { - onConsume: consumeCallback, - onConnect: subscribeOnCallback -} - -var idRecord = new Array(20).fill(0); -const publishFrequence = 10; -const TIMEOUT = 3000; - -function consumeCallback(data) { - console.debug("====>consumeCallback data: ====>" + JSON.stringify(data)); - console.debug("====>consumeCallback id: ====>" + data.request.id); - switch(data.request.id){ - case 1: - idRecord[0] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 2: - idRecord[1] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 3: - idRecord[2] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 4: - idRecord[3] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 5: - idRecord[4] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 6: - idRecord[5] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 7: - idRecord[6] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 8: - idRecord[7] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 9: - idRecord[8] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 10: - idRecord[9] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 11: - idRecord[10] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 12: - idRecord[11] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 13: - idRecord[12] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 14: - idRecord[13] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 15: - idRecord[14] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 16: - idRecord[15] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 17: - idRecord[16] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 18: - idRecord[17] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 19: - idRecord[18] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - case 20: - idRecord[19] = 1; - console.debug("====>id is recorded: " + data.request.id); - break; - - default: - console.debug("====>fail enter default====>"); - expect().assertFail(); - break; - } -} - -function subscribeOnCallback() { - console.debug("====>subscribeOnCallback enter====>"); -} - -function subscribeCallback(err) { - console.debug("====>subscribeCallback err: ====>" + JSON.stringify(err)); - expect(err.code).assertEqual(0); -} - -function publish_the_first_notification(err){ - console.debug("====>publish the first notification 11111 err: ====>" + JSON.stringify(err)); -} -function publish_the_second_notification(err){ - console.debug("====>publish the second notification 22222 err: ====>" + JSON.stringify(err)); -} -function publish_the_third_notification(err){ - console.debug("====>publish the third notification 33333 err: ====>" + JSON.stringify(err)); -} -function publish_the_fourth_notification(err){ - console.debug("====>publish the fourth notification 44444 err: ====>" + JSON.stringify(err)); -} -function publish_the_fifth_notification(err){ - console.debug("====>publish the fifth notification 55555 err: ====>" + JSON.stringify(err)); -} -function publish_the_sixth_notification(err){ - console.debug("====>publish the sixth notification 66666 err: ====>" + JSON.stringify(err)); -} -function publish_the_seventh_notification(err){ - console.debug("====>publish the seventh notification 77777 err: ====>" + JSON.stringify(err)); -} -function publish_the_eighth_notification(err){ - console.debug("====>publish the eighth notification 88888 err: ====>" + JSON.stringify(err)); -} -function publish_the_ninth_notification(err){ - console.debug("====>publish the ninth notification 99999 err: ====>" + JSON.stringify(err)); -} -function publish_the_tenth_notification(err){ - console.debug("====>publish the tenth notification 10 10 err: ====>" + JSON.stringify(err)); -} -function publish_the_eleventh_notification(err){ - console.debug("====>publish the eleventh notification 11 11 err: ====>" + JSON.stringify(err)); -} -function publish_the_twelfth_notification(err){ - console.debug("====>publish the twelfth notification 12 12 err: ====>" + JSON.stringify(err)); -} -function publish_the_thirteenth_notification(err){ - console.debug("====>publish the thirteenth notification 13 13 err: ====>" + JSON.stringify(err)); -} -function publish_the_fourteenth_notification(err){ - console.debug("====>publish the fourteenth notification 14 14 err: ====>" + JSON.stringify(err)); -} -function publish_the_fifteenth_notification(err){ - console.debug("====>publish the fifteenth notification 15 15 err: ====>" + JSON.stringify(err)); -} -function publish_the_sixteenth_notification(err){ - console.debug("====>publish the sixteenth notification 16 16 err: ====>" + JSON.stringify(err)); -} -function publish_the_seventeenth_notification(err){ - console.debug("====>publish the seventeenth notification 17 17 err: ====>" + JSON.stringify(err)); -} -function publish_the_eighteenth_notification(err){ - console.debug("====>publish the eighteenth notification 18 18 err: ====>" + JSON.stringify(err)); -} -function publish_the_nineteenth_notification(err){ - console.debug("====>publish the nineteenth notification 19 19 err: ====>" + JSON.stringify(err)); -} - -export default function ActsAnsPublishControlTest() { -describe('ActsAnsPublishControlTest', function () { - - /* - * @tc.number : ActsAnsPublishControlTest_0100 - * @tc.name : Verify rejection of publishing notifications that exceed the threshold - * @tc.desc : Twenty notifications are published continuously within one second, and the first - * ten notifications can be received, the last ten notifications cannot be received - */ - it('ActsAnsPublishControlTest_0100', 0, async function (done) { - console.debug("====>ActsAnsPublishControlTest_0100 start====>"); - try{ - await notification.subscribe(notificationSubscriber, notificationSubscriberInfo, subscribeCallback); - }catch(err) { - console.error("====>ActsAnsPublishControlTest_0100 subscribe fail err:" + JSON.stringify(err)); - } - - function timeOut(){ - console.debug("====>time out enter====>"); - var sumOne = 0; - var sumTwo = 0; - for (let i = 0; i <= publishFrequence - 1; i++) { - sumOne += idRecord[i]; - } - for (let i = publishFrequence; i < 20; i++) { - sumTwo += idRecord[i]; - } - console.debug("====>sumOne====>" + sumOne); - console.debug("====>sumTwo====>" + sumTwo); - expect(sumOne).assertEqual(10); - expect(sumTwo).assertEqual(0); - console.debug("====>ActsAnsPublishControlTest_0100 end====>"); - done(); - } - - function publish_the_twentieth_notification(err){ - console.debug("====>publish the twentieth notification 20 20 err: ====>" + JSON.stringify(err)); - console.debug("====>time out start====>"); - setTimeout(timeOut, TIMEOUT); - } - - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test1_title", - text: "test1_text", - additionalText: "test1_additionalText" - }, - }, - id: 1 - }, publish_the_first_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test2_title", - text: "test2_text", - additionalText: "test2_additionalText" - }, - }, - id: 2 - }, publish_the_second_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test3_title", - text: "test3_text", - additionalText: "test3_additionalText" - }, - }, - id: 3 - }, publish_the_third_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test4_title", - text: "test4_text", - additionalText: "test4_additionalText" - }, - }, - id: 4 - }, publish_the_fourth_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test5_title", - text: "test5_text", - additionalText: "test5_additionalText" - }, - }, - id: 5 - }, publish_the_fifth_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test6_title", - text: "test6_text", - additionalText: "test6_additionalText" - }, - }, - id: 6 - }, publish_the_sixth_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test7_title", - text: "test7_text", - additionalText: "test7_additionalText" - }, - }, - id: 7 - }, publish_the_seventh_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test8_title", - text: "test8_text", - additionalText: "test8_additionalText" - }, - }, - id: 8 - }, publish_the_eighth_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test9_title", - text: "test9_text", - additionalText: "test9_additionalText" - }, - }, - id: 9 - }, publish_the_ninth_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test10_title", - text: "test10_text", - additionalText: "test10_additionalText" - }, - }, - id: 10 - }, publish_the_tenth_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test11_title", - text: "test11_text", - additionalText: "test11_additionalText" - }, - }, - id: 11 - }, publish_the_eleventh_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test12_title", - text: "test12_text", - additionalText: "test12_additionalText" - }, - }, - id: 12 - }, publish_the_twelfth_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test13_title", - text: "test13_text", - additionalText: "test13_additionalText" - }, - }, - id: 13 - }, publish_the_thirteenth_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test14_title", - text: "test14_text", - additionalText: "test14_additionalText" - }, - }, - id: 14 - }, publish_the_fourteenth_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test15_title", - text: "test15_text", - additionalText: "test15_additionalText" - }, - }, - id: 15 - }, publish_the_fifteenth_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test16_title", - text: "test16_text", - additionalText: "test11_additionalText" - }, - }, - id: 16 - }, publish_the_sixteenth_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test17_title", - text: "test17_text", - additionalText: "test17_additionalText" - }, - }, - id: 17 - }, publish_the_seventeenth_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test18_title", - text: "test18_text", - additionalText: "test18_additionalText" - }, - }, - id: 18 - }, publish_the_eighteenth_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test19_title", - text: "test19_text", - additionalText: "test19_additionalText" - }, - }, - id: 19 - }, publish_the_nineteenth_notification); - notification.publish({ - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test20_title", - text: "test20_text", - additionalText: "test20_additionalText" - }, - }, - id: 20 - }, publish_the_twentieth_notification); - }) -})} diff --git a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/test/List.test.js deleted file mode 100644 index afa53d7a7d184a93e05ca1ac54a20afc4be15cc8..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsPublishControlTest from './ExampleJsunit.test.js' -export default function testsuite() { -ActsAnsPublishControlTest() -} diff --git a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/resources/base/element/string.json deleted file mode 100644 index e1c6e8e9957436acd4c64e0d2429b2129d0593c9..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishcontroltest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ActsAnsPublishControlTest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/actsanspublishconversation/BUILD.gn b/notification/ans_standard/publish_test/actsanspublishconversation/BUILD.gn deleted file mode 100644 index e2e6e55841f9d00bd11cf93344a4e70e277cd425..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsConversationTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsConversationTest" - 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/publish_test/actsanspublishconversation/Test.json b/notification/ans_standard/publish_test/actsanspublishconversation/Test.json deleted file mode 100644 index f2c7c0cf967a2e0e7c20335467f435f54a4bc7f2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "shell-timeout": "180000", - "bundle-name": "com.example.actsansconversationtest", - "package-name": "com.example.actsansconversationtest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsConversationTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsanspublishconversation/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/actsanspublishconversation/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/actsanspublishconversation/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/config.json b/notification/ans_standard/publish_test/actsanspublishconversation/src/main/config.json deleted file mode 100644 index b22fb97a708eac406027c38661df0c0af74efaab..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/config.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansconversationtest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansconversationtest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER", - "reason": "install bundle", - "usedScene": { - "ability": [ - "KitFramework" - ], - "when": "always" - } - } - ], - "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/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/MainAbility/app.js deleted file mode 100644 index 4f1747a95c4acbb66db5351e826c31584356e11c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* -* 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/publish_test/actsanspublishconversation/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 9711158cbba71a8c9200a68e928535e4f5e6bda5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - publishConversation - -
diff --git a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index cedc552d2c6861b286c9c08bdaafb93be8964e16..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,31 +0,0 @@ - -/* -* 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' -import app from '@system.app' -import device from '@system.device' -import router from '@system.router' - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - } -} diff --git a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/actsanspublishconversation/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/actsanspublishconversation/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/actsanspublishconversation/src/main/js/test/ActsAnsPublishConversation.js b/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/test/ActsAnsPublishConversation.js deleted file mode 100644 index c10ab0c71a3f5b30b9ffa93b939ec84017ccdad4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/test/ActsAnsPublishConversation.js +++ /dev/null @@ -1,140 +0,0 @@ -/* -* 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 notify from '@ohos.notification'; -import image from '@ohos.multimedia.image' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -var timeout = 500; -export default function ActsAnsConversationTest() { -describe('ActsAnsConversationTest', function () { - console.info("===========ActsAnsConversationTest start====================>"); - - function onConsumeOne(data) { - console.info("=========Ans_Conversation_0100 onConsume start==============>"); - console.info("=========Ans_Conversation_0100 onConsume data:==============>" + JSON.stringify(data)); - - expect(data.request.content.contentType).assertEqual(notify.ContentType.NOTIFICATION_CONTENT_CONVERSATION); - expect(data.request.content.conversation.title).assertEqual("test_title"); - expect(data.request.content.conversation.text).assertEqual("test_text"); - expect(data.request.content.conversation.additionalText).assertEqual("test_additionalText"); - expect(data.request.content.conversation.conversationTitle).assertEqual("conversationTitle_0100"); - expect(data.request.content.conversation.conversationGroup).assertEqual(true); - - expect(data.request.content.conversation.messages[0].text).assertEqual("conversation_text_1"); - expect(data.request.content.conversation.messages[0].timestamp).assertEqual(1); - expect(data.request.content.conversation.messages[0].sender.name).assertEqual("sender_name_1"); - expect(data.request.content.conversation.messages[0].sender.key).assertEqual("sender_key_1"); - expect(data.request.content.conversation.messages[0].sender.uri).assertEqual("sender_uri_1"); - expect(data.request.content.conversation.messages[0].sender.isMachine).assertEqual(true); - expect(data.request.content.conversation.messages[0].sender.isUserImportant).assertEqual(true); - expect(data.request.content.conversation.messages[0].mimeType).assertEqual("conversation_mimeType_1"); - expect(data.request.content.conversation.messages[0].uri).assertEqual("conversation_uri_1"); - - expect(data.request.content.conversation.messages[1].text).assertEqual("conversation_text_2"); - expect(data.request.content.conversation.messages[1].timestamp).assertEqual(1); - expect(data.request.content.conversation.messages[1].sender.name).assertEqual("sender_name_2"); - expect(data.request.content.conversation.messages[1].sender.key).assertEqual("sender_key_2"); - expect(data.request.content.conversation.messages[1].sender.uri).assertEqual("sender_uri_2"); - expect(data.request.content.conversation.messages[1].sender.isMachine).assertEqual(true); - expect(data.request.content.conversation.messages[1].sender.isUserImportant).assertEqual(true); - expect(data.request.content.conversation.messages[1].mimeType).assertEqual("conversation_mimeType_2"); - expect(data.request.content.conversation.messages[1].uri).assertEqual("conversation_uri_2"); - - console.info("=========Ans_Conversation_0100 onConsume end================>"); - } - - /* - * @tc.number: Ans_Conversation_0100 - * @tc.name: publish(request: NotificationRequest): Promise; - * @tc.desc: Verify that the conversation information can be received in the received notification. - */ - it('Ans_Conversation_0100', 0, async function (done) { - console.info("==================Ans_Conversation_0100 start==================>"); - var bufferA = new ArrayBuffer(4*2*25); - var optionA = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 25, width: 2}} - var conversationIconA = await image.createPixelMap(bufferA, optionA); - console.info("===========Ans_Conversation_0100 createPixelMap A promise======>"); - var bufferB = new ArrayBuffer(4*2*24); - var optionB = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 24, width: 2}} - var conversationIconB = await image.createPixelMap(bufferB, optionB); - console.info("===========Ans_Conversation_0100 createPixelMap B promise======>"); - var bufferC = new ArrayBuffer(4*2*23); - var optionC = {alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: {height: 23, width: 2}} - var conversationIconC = await image.createPixelMap(bufferC, optionC); - console.info("===========Ans_Conversation_0100 createPixelMap C promise======>"); - var subscriber = { - onConsume:onConsumeOne, - } - await notify.subscribe(subscriber); - console.info("==================Ans_Conversation_0100 subscribe promise==================>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_CONVERSATION, - conversation: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText", - user:{ - name:"user_name", - key: "user_key", - uri: "user_uri", - isMachine:true, - isUserImportant:true, - icon:conversationIconA - }, - messages:[ - { - text:"conversation_text_1", - timestamp:1, - sender:{ - name:"sender_name_1", - key: "sender_key_1", - uri: "sender_uri_1", - isMachine:true, - isUserImportant:true, - icon:conversationIconB - }, - mimeType:"conversation_mimeType_1", - uri:"conversation_uri_1", - }, - { - text:"conversation_text_2", - timestamp:1, - sender:{ - name:"sender_name_2", - key: "sender_key_2", - uri: "sender_uri_2", - isMachine:true, - isUserImportant:true, - icon:conversationIconC - }, - mimeType:"conversation_mimeType_2", - uri:"conversation_uri_2", - },], - conversationGroup:true, - conversationTitle:"conversationTitle_0100", - }, - }, - } - await notify.publish(notificationRequest); - console.info("===========Ans_Conversation_0100 publish promise========>"); - setTimeout((async function(){ - console.info("======Ans_Conversation_0100 setTimeout==============>"); - notify.unsubscribe(subscriber); - console.info("======Ans_Conversation_0100 setTimeout unsubscribe==>"); - done(); - }),timeout); - }) -})} diff --git a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/test/List.test.js deleted file mode 100644 index c824b7c59e2f503f719bf035f8b06efa027359b0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* -* 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 ActsAnsConversationTest from './ActsAnsPublishConversation.js' -export default function testsuite() { -ActsAnsConversationTest() -} diff --git a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/actsanspublishconversation/src/main/resources/base/element/string.json deleted file mode 100644 index f0d6fd0078e752a685ecb690e7e01cb805fdd329..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/actsanspublishconversation/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "conversation" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/ansactscancelgroup/BUILD.gn b/notification/ans_standard/publish_test/ansactscancelgroup/BUILD.gn deleted file mode 100644 index 30d8aaaa2d30d14f444b3102637adfe65cfe126c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsCancelGroupTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsCancelGroupTest" - 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/publish_test/ansactscancelgroup/Test.json b/notification/ans_standard/publish_test/ansactscancelgroup/Test.json deleted file mode 100644 index 5d799d0353e361a210f9d7f0c6b7f0ae40cec94b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "com.example.actsansrcancelgroup", - "package-name": "com.example.actsansrcancelgroup" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsCancelGroupTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/ansactscancelgroup/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/ansactscancelgroup/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/ansactscancelgroup/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/config.json b/notification/ans_standard/publish_test/ansactscancelgroup/src/main/config.json deleted file mode 100644 index 8af39c0bbcbfc349417d3144a84e236b57cc940d..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/config.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansrcancelgroup", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansrcancelgroup", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER", - "reason": "install bundle", - "usedScene": { - "ability": [ - "KitFramework" - ], - "when": "always" - } - } - ], - "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/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/MainAbility/app.js deleted file mode 100644 index 4f1747a95c4acbb66db5351e826c31584356e11c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* -* 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/publish_test/ansactscancelgroup/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 09696c297ee9837d996bd113bf8d41b67f236f7b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 16b4255db8e27c65d400a19e183a3ff6a3bcb1b4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - ActsAnsNotificationCancel - -
diff --git a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index cedc552d2c6861b286c9c08bdaafb93be8964e16..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,31 +0,0 @@ - -/* -* 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' -import app from '@system.app' -import device from '@system.device' -import router from '@system.router' - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - } -} diff --git a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/ansactscancelgroup/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/ansactscancelgroup/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/ansactscancelgroup/src/main/js/test/ActsAnsCancelGroup.js b/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/test/ActsAnsCancelGroup.js deleted file mode 100644 index 3523eb201e183401ec7d8766770fdc5cfc06b007..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/test/ActsAnsCancelGroup.js +++ /dev/null @@ -1,777 +0,0 @@ -/* -* 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 notify from '@ohos.notification' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -var timeout = 500; -export default function ActsAnsCancelGroup() { -describe('ActsAnsCancelGroup', function () { - console.info("===========ActsAnsCancelGroup start====================>"); - - var bundleOption = { - bundle:"com.example.actsanscancelgroup", - }; - - function onConsumeCancelGroup(data) { - console.info("=========ANS_CancelGroup_0100 onConsume start==============>"); - console.info("=========ANS_CancelGroup_0100 onConsume data:==============>" + JSON.stringify(data)); - notify.cancelGroup("group_0100", CancelGroupCallbackOne); - console.info("=========ANS_CancelGroup_0100 onConsume cancelGroup======>"); - console.info("=========ANS_CancelGroup_0100 onConsume end================>"); - } - - function onCancelCancelGroup(data) { - console.info("========ANS_CancelGroup_0100 onCancel start===========>"); - console.info("========ANS_CancelGroup_0100 onCancel data:===========>" + JSON.stringify(data)); - expect(data.request.id).assertEqual(1); - console.info("========ANS_CancelGroup_0100 onCancel id:=============>" + data.request.id); - expect(data.request.label).assertEqual("0100"); - console.info("========ANS_CancelGroup_0100 onCancel label:==========>" + data.request.label); - expect(data.request.groupName).assertEqual("group_0100"); - console.info("========ANS_CancelGroup_0100 onCancel groupName:======>" + data.request.groupName); - console.info("========ANS_CancelGroup_0100 onCancel end=============>"); - } - - function CancelGroupCallbackOne(err){ - console.info("========ANS_CancelGroup_0100 CancelGroupCallbackOne start==>"); - console.info("========ANS_CancelGroup_0100 CancelGroupCallbackOne err====>"+JSON.stringify(err)); - console.info("========ANS_CancelGroup_0100 CancelGroupCallbackOne end====>"); - } - - /* - * @tc.number: ANS_CancelGroup_0100 - * @tc.name: cancelGroup(groupName: string, callback: AsyncCallback): void; - * @tc.desc: Verify : one notification of the specified group can be successfully canceled(callback) - */ - it('ANS_CancelGroup_0100', 0, async function (done) { - console.info("==================ANS_CancelGroup_0100 start==================>"); - var subscriber = { - onConsume:onConsumeCancelGroup, - onCancel:onCancelCancelGroup - } - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_0100", - id: 1, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0100", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.subscribe(subscriber); - console.info("===========ANS_CancelGroup_0100 subscribe promise======>"); - notify.publish(notificationRequest); - console.info("===========ANS_CancelGroup_0100 publish promise========>"); - setTimeout((async function(){ - console.info("======ANS_CancelGroup_0100 setTimeout==============>"); - notify.unsubscribe(subscriber); - console.info("======ANS_CancelGroup_0100 setTimeout unsubscribe==>"); - done(); - }),timeout); - }) - - function onConsumeCancelGroupPromise(data) { - console.info("=========ANS_CancelGroup_0200 onConsume start==============>"); - console.info("=========ANS_CancelGroup_0200 onConsume data:==============>" + JSON.stringify(data)); - notify.cancelGroup("group_0200"); - console.info("=========ANS_CancelGroup_0200 onConsume cancelGroup======>"); - console.info("=========ANS_CancelGroup_0200 onConsume end================>"); - } - - function onCancelCancelGroupPromise(data) { - console.info("========ANS_CancelGroup_0200 onCancel start===========>"); - console.info("========ANS_CancelGroup_0200 onCancel data:===========>" + JSON.stringify(data)); - expect(data.request.id).assertEqual(2); - console.info("========ANS_CancelGroup_0200 onCancel id:=============>" + data.request.id); - expect(data.request.label).assertEqual("0200"); - console.info("========ANS_CancelGroup_0200 onCancel label:==========>" + data.request.label); - expect(data.request.groupName).assertEqual("group_0200"); - console.info("========ANS_CancelGroup_0200 onCancel groupName:======>" + data.request.groupName); - console.info("========ANS_CancelGroup_0200 onCancel end=============>"); - } - - /* - * @tc.number: ANS_CancelGroup_0200 - * @tc.name: cancelGroup(groupName: string): Promise; - * @tc.desc: Verify : one notification of the specified group can be successfully cancel(promise) - */ - it('ANS_CancelGroup_0200', 0, async function (done) { - console.info("==================ANS_CancelGroup_0200 start==================>"); - var subscriber ={ - onConsume:onConsumeCancelGroupPromise, - onCancel:onCancelCancelGroupPromise - } - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_0200", - id: 2, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0200", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.subscribe(subscriber); - console.info("===========ANS_CancelGroup_0200 subscribe promise======>"); - notify.publish(notificationRequest); - console.info("===========ANS_CancelGroup_0200 publish promise========>"); - setTimeout((async function(){ - console.info("======ANS_CancelGroup_0200 setTimeout==============>"); - notify.unsubscribe(subscriber); - console.info("======ANS_CancelGroup_0200 setTimeout unsubscribe==>"); - done(); - }),timeout); - }) - - var timesOfOnConsume - - function onConsumeCancelGroupTwo(data) { - console.info("=========ANS_CancelGroup_0300 onConsume start==============>"); - console.info("=========ANS_CancelGroup_0300 onConsume data:==============>" + JSON.stringify(data)); - timesOfOnConsume = timesOfOnConsume + 1 - if (timesOfOnConsume == 2){ - notify.cancelGroup("group_0300", cancelGroupCallbackTwo); - console.info("=========ANS_CancelGroup_0300 onConsume cancelGroup======>"); - } - console.info("=========ANS_CancelGroup_0300 onConsume end================>"); - } - - var timesOfOnCancel - - function onCancelCancelGroupTwo(data) { - console.info("========ANS_CancelGroup_0300 onCancel start===========>"); - console.info("========ANS_CancelGroup_0300 onCancel data:===========>" + JSON.stringify(data)); - timesOfOnCancel = timesOfOnCancel + 1 - if (timesOfOnCancel == 1){ - expect(data.request.id).assertEqual(1); - } else if (timesOfOnCancel == 2){ - expect(data.request.id).assertEqual(2); - } - console.info("========ANS_CancelGroup_0300 onCancel end===========>"); - } - - function cancelGroupCallbackTwo(err){ - console.info("========ANS_CancelGroup_0300 cancelGroupCallbackTwo start====>"); - console.info("========ANS_CancelGroup_0300 cancelGroupCallbackTwo err======>" + JSON.stringify(err)); - console.info("========ANS_CancelGroup_0300 cancelGroupCallbackTwo end======>"); - } - - /* - * @tc.number: ANS_CancelGroup_0300 - * @tc.name: cancelGroup(groupName: string, callback: AsyncCallback): void; - * @tc.desc: Verify : 2 notifications of the specified group can be successfully canceled(callback) - */ - it('ANS_CancelGroup_0300', 0, async function (done) { - console.info("==================ANS_CancelGroup_0300 start==================>"); - timesOfOnConsume = 0 - timesOfOnCancel = 0 - var subscriber ={ - onConsume:onConsumeCancelGroupTwo, - onCancel:onCancelCancelGroupTwo, - } - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_0300", - id: 1, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0300_1", - badgeIconStyle: 1, - showDeliveryTime: true, - } - var notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_0300", - id: 2, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0300_2", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.subscribe(subscriber); - console.info("===========ANS_CancelGroup_0300 subscribe promise======>"); - notify.publish(notificationRequest); - console.info("===========ANS_CancelGroup_0300 publish1 promise=======>"); - notify.publish(notificationRequest1); - console.info("===========ANS_CancelGroup_0300 publish2 promise=======>"); - setTimeout((async function(){ - console.info("======ANS_CancelGroup_0300 setTimeout==============>"); - notify.unsubscribe(subscriber); - console.info("======ANS_CancelGroup_0300 setTimeout unsubscribe==>"); - done(); - }),timeout); - }) - - function onConsumeCancelGroupPromiseTwo(data) { - console.info("=========ANS_CancelGroup_0400 onConsume start==============>"); - console.info("=========ANS_CancelGroup_0400 onConsume data:==============>" + JSON.stringify(data)); - timesOfOnConsume = timesOfOnConsume + 1 - if (timesOfOnConsume == 2){ - notify.cancelGroup("group_0400"); - console.info("=========ANS_CancelGroup_0400 onConsume cancelGroup Promise======>"); - } - console.info("=========ANS_CancelGroup_0400 onConsume end================>"); - } - - function onCancelCancelGroupPromiseTwo(data) { - console.info("========ANS_CancelGroup_0400 onCancel start===========>"); - console.info("========ANS_CancelGroup_0400 onCancel data:===========>" + JSON.stringify(data)); - timesOfOnCancel = timesOfOnCancel + 1 - if (timesOfOnCancel == 1){ - expect(data.request.id).assertEqual(1); - } else if (timesOfOnCancel == 2){ - expect(data.request.id).assertEqual(2); - } - console.info("========ANS_CancelGroup_0400 onCancel end===========>"); - } - - /* - * @tc.number: ANS_CancelGroup_0400 - * @tc.name: cancelGroup(groupName: string): Promise; - * @tc.desc: Verify : 2 notifications of the specified group can be successfully canceled(promise) - */ - it('ANS_CancelGroup_0400', 0, async function (done) { - console.info("===============ANS_CancelGroup_0400 start==================>"); - timesOfOnConsume = 0 - timesOfOnCancel = 0 - var subscriber ={ - onConsume:onConsumeCancelGroupPromiseTwo, - onCancel:onCancelCancelGroupPromiseTwo, - } - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_0400", - id: 1, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0400_1", - badgeIconStyle: 1, - showDeliveryTime: true, - } - var notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_0400", - id: 2, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0400_2", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.subscribe(subscriber); - console.info("===========ANS_CancelGroup_0400 subscribe promise======>"); - notify.publish(notificationRequest); - console.info("===========ANS_CancelGroup_0400 publish1 promise=======>"); - notify.publish(notificationRequest1); - console.info("===========ANS_CancelGroup_0400 publish2 promise=======>"); - setTimeout((async function(){ - console.info("======ANS_CancelGroup_0400 setTimeout==============>"); - notify.unsubscribe(subscriber); - console.info("======ANS_CancelGroup_0400 setTimeout unsubscribe==>"); - done(); - }),timeout); - }); - - function onConsumeCancelGroupThree(data) { - console.info("=========ANS_CancelGroup_0500 onConsume start==============>"); - console.info("=========ANS_CancelGroup_0500 onConsume data:==============>" + JSON.stringify(data)); - notify.cancelGroup("group_0500", cancelGroupByBundleCallbackThree); - console.info("=========ANS_CancelGroup_0500 onConsume cancelGroup======>"); - console.info("=========ANS_CancelGroup_0500 onConsume end================>"); - } - - function onCancelCancelGroupThree(data) { - timesOfOnCancel = timesOfOnCancel + 1; - console.info("========ANS_CancelGroup_0500 onCancel start===========>"); - console.info("========ANS_CancelGroup_0500 onCancel data:===========>" + JSON.stringify(data)); - if (timesOfOnCancel == 1){ - expect(data.request.id).assertEqual(5); - console.info("========ANS_CancelGroup_0500 onCancel id:=============>" + data.request.id); - expect(data.request.label).assertEqual("0500"); - console.info("========ANS_CancelGroup_0500 onCancel label:==========>" + data.request.label); - expect(data.request.groupName).assertEqual("group_0500"); - console.info("========ANS_CancelGroup_0500 onCancel groupName:======>" + data.request.groupName); - notify.cancelGroup("group_0500", cancelGroupByBundleCallbackThree2); - console.info("========ANS_CancelGroup_0500 onCancel cancelGroup:======>"); - } else if (timesOfOnCancel == 2){ - expect.assertFail(); - } - console.info("========ANS_CancelGroup_0500 onCancel end=============>"); - } - - function cancelGroupByBundleCallbackThree(err){ - console.info("========ANS_CancelGroup_0500 cancelGroupByBundleCallbackThree start==>"); - console.info("========ANS_CancelGroup_0500 cancelGroupByBundleCallbackThree err====>"+JSON.stringify(err)); - console.info("========ANS_CancelGroup_0500 cancelGroupByBundleCallbackThree end====>"); - } - - function cancelGroupByBundleCallbackThree2(err){ - console.info("========ANS_CancelGroup_0500 cancelGroupByBundleCallbackThree2 start==>"); - console.info("========ANS_CancelGroup_0500 cancelGroupByBundleCallbackThree2 err====>"+JSON.stringify(err)); - console.info("========ANS_CancelGroup_0500 cancelGroupByBundleCallbackThree2 end====>"); - } - - /* - * @tc.number: ANS_CancelGroup_0500 - * @tc.name: cancelGroup(groupName: string, callback: AsyncCallback): void; - * @tc.desc: Verify : After the notification of a specific group is successfully canceled, - cancel the notification of this group again(callback) - */ - it('ANS_CancelGroup_0500', 0, async function (done) { - console.info("==================ANS_CancelGroup_0500 start==================>"); - timesOfOnCancel = 0; - var subscriber ={ - onConsume:onConsumeCancelGroupThree, - onCancel:onCancelCancelGroupThree - } - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_0500", - id: 5, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0500", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.subscribe(subscriber); - console.info("===========ANS_CancelGroup_0500 subscribe promise======>"); - notify.publish(notificationRequest); - console.info("===========ANS_CancelGroup_0500 publish promise========>"); - setTimeout((async function(){ - console.info("======ANS_CancelGroup_0500 setTimeout==============>"); - notify.unsubscribe(subscriber); - console.info("======ANS_CancelGroup_0500 setTimeout unsubscribe==>"); - done(); - }),timeout); - }) - - function onConsumeCancelGroupPromiseThree(data) { - console.info("=========ANS_CancelGroup_0600 onConsume start==============>"); - console.info("=========ANS_CancelGroup_0600 onConsume data:==============>" + JSON.stringify(data)); - notify.cancelGroup("group_0600"); - console.info("=========ANS_CancelGroup_0600 onConsume cancelGroup======>"); - console.info("=========ANS_CancelGroup_0600 onConsume end================>"); - } - - function onCancelCancelGroupPromiseThree(data) { - timesOfOnCancel = timesOfOnCancel + 1; - console.info("========ANS_CancelGroup_0600 onCancel start===========>"); - console.info("========ANS_CancelGroup_0600 onCancel data:===========>" + JSON.stringify(data)); - if (timesOfOnCancel == 1) { - expect(data.request.id).assertEqual(6); - console.info("========ANS_CancelGroup_0600 onCancel id:=============>" + data.request.id); - expect(data.request.label).assertEqual("0600"); - console.info("========ANS_CancelGroup_0600 onCancel label:==========>" + data.request.label); - expect(data.request.groupName).assertEqual("group_0600"); - console.info("========ANS_CancelGroup_0600 onCancel groupName:======>" + data.request.groupName); - notify.cancelGroup("group_0600"); - console.info("========ANS_CancelGroup_0600 onCancel cancelGroup:==========>"); - }else if(timesOfOnCancel == 2){ - expect.assertFail(); - } - console.info("========ANS_CancelGroup_0600 onCancel end=============>"); - } - - /* - * @tc.number: ANS_CancelGroup_0600 - * @tc.name: cancelGroup(groupName: string, callback: AsyncCallback): void; - * @tc.desc: Verify : After the notification of a specific group is successfully canceled, - cancel the notification of this group again(promise) - */ - it('ANS_CancelGroup_0600', 0, async function (done) { - console.info("==================ANS_CancelGroup_0700 start==================>"); - timesOfOnCancel = 0; - var subscriber ={ - onConsume:onConsumeCancelGroupPromiseThree, - onCancel:onCancelCancelGroupPromiseThree - } - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_0600", - id: 6, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0600", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.subscribe(subscriber); - console.info("===========ANS_CancelGroup_0600 subscribe promise======>"); - notify.publish(notificationRequest); - console.info("===========ANS_CancelGroup_0600 publish promise========>"); - setTimeout((async function(){ - console.info("======ANS_CancelGroup_0600 setTimeout==============>"); - notify.unsubscribe(subscriber); - console.info("======ANS_CancelGroup_0600 setTimeout unsubscribe==>"); - done(); - }),timeout); - }) - - function cancelGroupCallbackFour(err){ - console.info("========ANS_CancelGroup_0700 cancelGroupCallbackFour start==>"); - console.info("========ANS_CancelGroup_0700 cancelGroupCallbackFour err====>"+JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info("========ANS_CancelGroup_0700 cancelGroupCallbackFour end====>"); - } - - /* - * @tc.number: ANS_CancelGroup_0700 - * @tc.name: cancelGroup(groupName: string, callback: AsyncCallback): void; - * @tc.desc: Verify : Call the interface with an empty groupName parameter(callback) - */ - it('ANS_CancelGroup_0700', 0, async function (done) { - console.info("==================ANS_CancelGroup_0700 start==================>"); - notify.cancelGroup("", cancelGroupCallbackFour); - setTimeout((async function(){ - console.info("======ANS_CancelGroup_0700 setTimeout==============>"); - done(); - }),timeout); - }) - - /* - * @tc.number: ANS_CancelGroup_0800 - * @tc.name: cancelGroup(groupName: string): Promise; - * @tc.desc: Verify : Call the interface with an empty groupName parameter(promise) - */ - it('ANS_CancelGroup_0800', 0, async function (done) { - console.info("==================ANS_CancelGroup_0800 start==================>"); - notify.cancelGroup("").then(()=>{ - console.info("==================ANS_CancelGroup_0800 cancelGroup then==================>"); - }).catch((err)=>{ - console.info("==================ANS_CancelGroup_0800 cancelGroup catch==================>"); - console.info("==================ANS_CancelGroup_0800 cancelGroup err==================>"+err.code); - expect(err.code != 0).assertEqual(true); - }); - setTimeout((async function(){ - console.info("======ANS_CancelGroup_0800 setTimeout==============>"); - done(); - }),timeout); - }) - - function onConsumCancelGroupFour(data) { - console.info("=========ANS_CancelGroup_0900 onConsume start==============>"); - console.info("=========ANS_CancelGroup_0900 onConsume data:==============>" + JSON.stringify(data)); - notify.cancelGroup("group_wrong", cancelGroupCallbackFive); - console.info("=========ANS_CancelGroup_0900 onConsume cancelGroup======>"); - console.info("=========ANS_CancelGroup_0900 onConsume end================>"); - } - - function onCancelCancelGroupFour(data) { - expect().assertFail(); - console.info("========ANS_CancelGroup_0900 onCancel start===========>"); - console.info("========ANS_CancelGroup_0900 onCancel data:===========>" + JSON.stringify(data)); - console.info("========ANS_CancelGroup_0900 onCancel end=============>"); - } - - function cancelGroupCallbackFive(err){ - console.info("========ANS_CancelGroup_0900 cancelGroupCallbackFive start==>"); - console.info("========ANS_CancelGroup_0900 cancelGroupCallbackFive err====>"+JSON.stringify(err)); - console.info("========ANS_CancelGroup_0900 cancelGroupCallbackFive end====>"); - } - - /* - * @tc.number: ANS_CancelGroup_0900 - * @tc.name: cancelGroup(groupName: string, callback: AsyncCallback): void; - * @tc.desc: Verify : Call the interface with an wrong groupName parameter(callback) - */ - it('ANS_CancelGroup_0900', 0, async function (done) { - console.info("==================ANS_CancelGroup_0900 start==================>"); - var subscriber ={ - onConsume:onConsumCancelGroupFour, - onCancel:onCancelCancelGroupFour - } - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_0900", - id: 9, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0900", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.subscribe(subscriber); - console.info("===========ANS_CancelGroup_0900 subscribe promise======>"); - notify.publish(notificationRequest); - console.info("===========ANS_CancelGroup_0900 publish promise========>"); - setTimeout((async function(){ - console.info("======ANS_CancelGroup_0900 setTimeout==============>"); - notify.unsubscribe(subscriber); - console.info("======ANS_CancelGroup_0900 setTimeout unsubscribe==>"); - done(); - }),timeout); - }) - - function onConsumeCancelGroupPromiseFour(data) { - console.info("=========ANS_CancelGroup_1000 onConsume start==============>"); - console.info("=========ANS_CancelGroup_1000 onConsume data:==============>" + JSON.stringify(data)); - notify.cancelGroup("group_wrong"); - console.info("=========ANS_CancelGroup_1000 onConsume cancelGroup======>"); - console.info("=========ANS_CancelGroup_1000 onConsume end================>"); - } - - function onCancelCancelGroupPromiseFour(data) { - expect().assertFail(); - console.info("========ANS_CancelGroup_1000 onCancel start===========>"); - console.info("========ANS_CancelGroup_1000 onCancel data:===========>" + JSON.stringify(data)); - console.info("========ANS_CancelGroup_1000 onCancel end=============>"); - } - - /* - * @tc.number: ANS_CancelGroup_1000 - * @tc.name: cancelGroup(groupName: string, callback: AsyncCallback): void; - * @tc.desc: Verify : Verify : Call the interface with an wrong groupName parameter(promise) - */ - it('ANS_CancelGroup_1000', 0, async function (done) { - console.info("==================ANS_CancelGroup_1000 start==================>"); - var subscriber ={ - onConsume:onConsumeCancelGroupPromiseFour, - onCancel:onCancelCancelGroupPromiseFour - } - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_1000", - id: 10, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1000", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.subscribe(subscriber); - console.info("===========ANS_CancelGroup_1000 subscribe promise======>"); - notify.publish(notificationRequest); - console.info("===========ANS_CancelGroup_1000 publish promise========>"); - setTimeout((async function(){ - console.info("======ANS_CancelGroup_1000 setTimeout==============>"); - notify.unsubscribe(subscriber); - console.info("======ANS_CancelGroup_1000 setTimeout unsubscribe==>"); - done(); - }),timeout); - }) -})} diff --git a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/test/List.test.js deleted file mode 100644 index bc14a1f940d402665df3cea98b6b70b25c96ab43..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* -* 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 ActsAnsCancelGroup from './ActsAnsCancelGroup.js' -export default function testsuite() { -ActsAnsCancelGroup() -} diff --git a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/ansactscancelgroup/src/main/resources/base/element/string.json deleted file mode 100644 index d3627136a08eb2e660c8c2799a533aed2bda7684..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactscancelgroup/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "actsansremovegroup" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/ansactsremovegroup/BUILD.gn b/notification/ans_standard/publish_test/ansactsremovegroup/BUILD.gn deleted file mode 100644 index e661a26c6f5bc8636e3a95bcf38bce8e26c9daf2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsRemoveGroupTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsRemoveGroupTest" - 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/publish_test/ansactsremovegroup/Test.json b/notification/ans_standard/publish_test/ansactsremovegroup/Test.json deleted file mode 100644 index a86a91f86f5abb773b14f22ae69c6fc9b10eda79..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "com.example.actsansremovegroup", - "package-name": "com.example.actsansremovegroup" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsRemoveGroupTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/ansactsremovegroup/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/ansactsremovegroup/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/ansactsremovegroup/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/config.json b/notification/ans_standard/publish_test/ansactsremovegroup/src/main/config.json deleted file mode 100644 index 1b1fed87778c837882f9dc4e6809c3fe5ad82467..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/config.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansremovegroup", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansremovegroup", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER", - "reason": "install bundle", - "usedScene": { - "ability": [ - "KitFramework" - ], - "when": "always" - } - } - ], - "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/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/MainAbility/app.js deleted file mode 100644 index 4f1747a95c4acbb66db5351e826c31584356e11c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* -* 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/publish_test/ansactsremovegroup/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 2fec145914fbd933f8b5c0278439a4855ec3083b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - AnsRemoveGroup - -
diff --git a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index ea04be4dfb189497d14d2e3cf69041742d6dee6e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,44 +0,0 @@ - -/* -* 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' -import app from '@system.app' -import device from '@system.device' -import router from '@system.router' - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - const reportExtend = new ReportExtend(file) - core.addService('expect', expectExtend) - core.addService('report', reportExtend) - core.init() - const configService = core.getDefaultService('config') - configService.setConfig(this) - - require('../../../test/List.test') - core.execute() - } -} diff --git a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/ansactsremovegroup/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/ansactsremovegroup/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/ansactsremovegroup/src/main/js/test/ActsAnsRemoveGroup.js b/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/test/ActsAnsRemoveGroup.js deleted file mode 100644 index fe97064c2f880c056282d3b7ff3ec0415162ef7b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/test/ActsAnsRemoveGroup.js +++ /dev/null @@ -1,777 +0,0 @@ -/* -* 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 notify from '@ohos.notification' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -var timeout = 500; -export default function ActsAnsRemoveGroup() { -describe('ActsAnsRemoveGroup', function () { - console.info("===========ActsAnsRemoveGroup start====================>"); - - var bundleOption = { - bundle:"com.example.actsansremovegroup", - }; - - function onConsumeRemoveGroup(data) { - console.info("=========ANS_RemoveGroup_0100 onConsume start==============>"); - console.info("=========ANS_RemoveGroup_0100 onConsume data:==============>" + JSON.stringify(data)); - notify.removeGroupByBundle(bundleOption, "group_0100", removeGroupByBundleCallbackOne); - console.info("=========ANS_RemoveGroup_0100 onConsume removeGroupByBundle======>"); - console.info("=========ANS_RemoveGroup_0100 onConsume end================>"); - } - - function onCancelRemoveGroup(data) { - console.info("========ANS_RemoveGroup_0100 onCancel start===========>"); - console.info("========ANS_RemoveGroup_0100 onCancel data:===========>" + JSON.stringify(data)); - expect(data.request.id).assertEqual(1); - console.info("========ANS_RemoveGroup_0100 onCancel id:=============>" + data.request.id); - expect(data.request.label).assertEqual("0100"); - console.info("========ANS_RemoveGroup_0100 onCancel label:==========>" + data.request.label); - expect(data.request.groupName).assertEqual("group_0100"); - console.info("========ANS_RemoveGroup_0100 onCancel groupName:======>" + data.request.groupName); - console.info("========ANS_RemoveGroup_0100 onCancel end=============>"); - } - - function removeGroupByBundleCallbackOne(err){ - console.info("========ANS_RemoveGroup_0100 removeGroupByBundleCallbackOne start==>"); - console.info("========ANS_RemoveGroup_0100 removeGroupByBundleCallbackOne err====>"+JSON.stringify(err)); - console.info("========ANS_RemoveGroup_0100 removeGroupByBundleCallbackOne end====>"); - } - - /* - * @tc.number: ANS_RemoveGroup_0100 - * @tc.name: removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback): void; - * @tc.desc: Verify : one notification of the specified group can be successfully removed(callback) - */ - it('ANS_RemoveGroup_0100', 0, async function (done) { - console.info("==================ANS_RemoveGroup_0100 start==================>"); - var subscriber ={ - onConsume:onConsumeRemoveGroup, - onCancel:onCancelRemoveGroup - } - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_0100", - id: 1, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0100", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.subscribe(subscriber); - console.info("===========ANS_RemoveGroup_0100 subscribe promise======>"); - notify.publish(notificationRequest); - console.info("===========ANS_RemoveGroup_0100 publish promise========>"); - setTimeout((async function(){ - console.info("======ANS_RemoveGroup_0100 setTimeout==============>"); - notify.unsubscribe(subscriber); - console.info("======ANS_RemoveGroup_0100 setTimeout unsubscribe==>"); - done(); - }),timeout); - }) - - function onConsumeRemoveGroupPromise(data) { - console.info("=========ANS_RemoveGroup_0200 onConsume start==============>"); - console.info("=========ANS_RemoveGroup_0200 onConsume data:==============>" + JSON.stringify(data)); - notify.removeGroupByBundle(bundleOption, "group_0200"); - console.info("=========ANS_RemoveGroup_0200 onConsume removeGroupByBundle======>"); - console.info("=========ANS_RemoveGroup_0200 onConsume end================>"); - } - - function onCancelRemoveGroupPromise(data) { - console.info("========ANS_RemoveGroup_0200 onCancel start===========>"); - console.info("========ANS_RemoveGroup_0200 onCancel data:===========>" + JSON.stringify(data)); - expect(data.request.id).assertEqual(2); - console.info("========ANS_RemoveGroup_0200 onCancel id:=============>" + data.request.id); - expect(data.request.label).assertEqual("0200"); - console.info("========ANS_RemoveGroup_0200 onCancel label:==========>" + data.request.label); - expect(data.request.groupName).assertEqual("group_0200"); - console.info("========ANS_RemoveGroup_0200 onCancel groupName:======>" + data.request.groupName); - console.info("========ANS_RemoveGroup_0200 onCancel end=============>"); - } - - /* - * @tc.number: ANS_RemoveGroup_0200 - * @tc.name: removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback): void; - * @tc.desc: Verify : one notification of the specified group can be successfully removed(promise) - */ - it('ANS_RemoveGroup_0200', 0, async function (done) { - console.info("==================ANS_RemoveGroup_0200 start==================>"); - var subscriber ={ - onConsume:onConsumeRemoveGroupPromise, - onCancel:onCancelRemoveGroupPromise - } - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_0200", - id: 2, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0200", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.subscribe(subscriber); - console.info("===========ANS_RemoveGroup_0200 subscribe promise======>"); - notify.publish(notificationRequest); - console.info("===========ANS_RemoveGroup_0200 publish promise========>"); - setTimeout((async function(){ - console.info("======ANS_RemoveGroup_0200 setTimeout==============>"); - notify.unsubscribe(subscriber); - console.info("======ANS_RemoveGroup_0200 setTimeout unsubscribe==>"); - done(); - }),timeout); - }) - - var timesOfOnConsume - - function onConsumeRemoveGroupTwo(data) { - console.info("=========ANS_RemoveGroup_0300 onConsume start==============>"); - console.info("=========ANS_RemoveGroup_0300 onConsume data:==============>" + JSON.stringify(data)); - timesOfOnConsume = timesOfOnConsume + 1 - if (timesOfOnConsume == 2){ - notify.removeGroupByBundle(bundleOption, "group_0300", removeGroupByBundleCallback); - console.info("=========ANS_RemoveGroup_0300 onConsume removeGroupByBundle======>"); - } - console.info("=========ANS_RemoveGroup_0300 onConsume end================>"); - } - - var timesOfOnCancel - - function onCancelRemoveGroupTwo(data) { - console.info("========ANS_RemoveGroup_0300 onCancel start===========>"); - console.info("========ANS_RemoveGroup_0300 onCancel data:===========>" + JSON.stringify(data)); - timesOfOnCancel = timesOfOnCancel + 1 - if (timesOfOnCancel == 1){ - expect(data.request.id).assertEqual(1); - } else if (timesOfOnCancel == 2){ - expect(data.request.id).assertEqual(2); - } - console.info("========ANS_RemoveGroup_0300 onCancel end===========>"); - } - - function removeGroupByBundleCallback(err){ - console.info("========ANS_RemoveGroup_0300 removeGroupByBundleCallback start====>"); - console.info("========ANS_RemoveGroup_0300 removeGroupByBundleCallback err======>" + JSON.stringify(err)); - console.info("========ANS_RemoveGroup_0300 removeGroupByBundleCallback end======>"); - } - - /* - * @tc.number: ANS_RemoveGroup_0300 - * @tc.name: removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback): void; - * @tc.desc: Verify : 2 notifications of the specified group can be successfully removed(callback) - */ - it('ANS_RemoveGroup_0300', 0, async function (done) { - console.info("==================ANS_RemoveGroup_0300 start==================>"); - timesOfOnConsume = 0 - timesOfOnCancel = 0 - var subscriber ={ - onConsume:onConsumeRemoveGroupTwo, - onCancel:onCancelRemoveGroupTwo, - } - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_0300", - id: 1, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0300_1", - badgeIconStyle: 1, - showDeliveryTime: true, - } - var notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_0300", - id: 2, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0300_2", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.subscribe(subscriber); - console.info("===========ANS_RemoveGroup_0300 subscribe promise======>"); - notify.publish(notificationRequest); - console.info("===========ANS_RemoveGroup_0300 publish1 promise=======>"); - notify.publish(notificationRequest1); - console.info("===========ANS_RemoveGroup_0300 publish2 promise=======>"); - setTimeout((async function(){ - console.info("======ANS_RemoveGroup_0300 setTimeout==============>"); - notify.unsubscribe(subscriber); - console.info("======ANS_RemoveGroup_0300 setTimeout unsubscribe==>"); - done(); - }),timeout); - }) - - function onConsumeRemoveGroupPromiseTwo(data) { - console.info("=========ANS_RemoveGroup_0400 onConsume start==============>"); - console.info("=========ANS_RemoveGroup_0400 onConsume data:==============>" + JSON.stringify(data)); - timesOfOnConsume = timesOfOnConsume + 1 - if (timesOfOnConsume == 2){ - notify.removeGroupByBundle(bundleOption, "group_0400"); - console.info("=========ANS_RemoveGroup_0400 onConsume removeGroupByBundle Promise======>"); - } - console.info("=========ANS_RemoveGroup_0400 onConsume end================>"); - } - - function onCancelRemoveGroupPromiseTwo(data) { - console.info("========ANS_RemoveGroup_0400 onCancel start===========>"); - console.info("========ANS_RemoveGroup_0400 onCancel data:===========>" + JSON.stringify(data)); - timesOfOnCancel = timesOfOnCancel + 1 - if (timesOfOnCancel == 1){ - expect(data.request.id).assertEqual(1); - } else if (timesOfOnCancel == 2){ - expect(data.request.id).assertEqual(2); - } - console.info("========ANS_RemoveGroup_0400 onCancel end===========>"); - } - - /* - * @tc.number: ANS_RemoveGroup_0400 - * @tc.name: removeGroupByBundle(bundle: BundleOption, groupName: string): Promise; - * @tc.desc: Verify : 2 notifications of the specified group can be successfully removed(promise) - */ - it('ANS_RemoveGroup_0400', 0, async function (done) { - console.info("===============ANS_RemoveGroup_0400 start==================>"); - timesOfOnConsume = 0 - timesOfOnCancel = 0 - var subscriber ={ - onConsume:onConsumeRemoveGroupPromiseTwo, - onCancel:onCancelRemoveGroupPromiseTwo, - } - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_0400", - id: 1, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0400_1", - badgeIconStyle: 1, - showDeliveryTime: true, - } - var notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_0400", - id: 2, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0400_2", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.subscribe(subscriber); - console.info("===========ANS_RemoveGroup_0400 subscribe promise======>"); - notify.publish(notificationRequest); - console.info("===========ANS_RemoveGroup_0400 publish1 promise=======>"); - notify.publish(notificationRequest1); - console.info("===========ANS_RemoveGroup_0400 publish2 promise=======>"); - setTimeout((async function(){ - console.info("======ANS_RemoveGroup_0400 setTimeout==============>"); - notify.unsubscribe(subscriber); - console.info("======ANS_RemoveGroup_0400 setTimeout unsubscribe==>"); - done(); - }),timeout); - }); - - function onConsumeRemoveGroupThree(data) { - console.info("=========ANS_RemoveGroup_0500 onConsume start==============>"); - console.info("=========ANS_RemoveGroup_0500 onConsume data:==============>" + JSON.stringify(data)); - notify.removeGroupByBundle(bundleOption, "group_0500", removeGroupByBundleCallbackThree); - console.info("=========ANS_RemoveGroup_0500 onConsume removeGroupByBundle======>"); - console.info("=========ANS_RemoveGroup_0500 onConsume end================>"); - } - - function onCancelRemoveGroupThree(data) { - timesOfOnCancel = timesOfOnCancel + 1; - console.info("========ANS_RemoveGroup_0500 onCancel start===========>"); - console.info("========ANS_RemoveGroup_0500 onCancel data:===========>" + JSON.stringify(data)); - if (timesOfOnCancel == 1){ - expect(data.request.id).assertEqual(5); - console.info("========ANS_RemoveGroup_0500 onCancel id:=============>" + data.request.id); - expect(data.request.label).assertEqual("0500"); - console.info("========ANS_RemoveGroup_0500 onCancel label:==========>" + data.request.label); - expect(data.request.groupName).assertEqual("group_0500"); - console.info("========ANS_RemoveGroup_0500 onCancel groupName:======>" + data.request.groupName); - notify.removeGroupByBundle(bundleOption, "group_0500", removeGroupByBundleCallbackThree2); - console.info("========ANS_RemoveGroup_0500 onCancel removeGroupByBundle:======>"); - } else if (timesOfOnCancel == 2){ - expect.assertFail(); - } - console.info("========ANS_RemoveGroup_0500 onCancel end=============>"); - } - - function removeGroupByBundleCallbackThree(err){ - console.info("========ANS_RemoveGroup_0500 removeGroupByBundleCallbackThree start==>"); - console.info("========ANS_RemoveGroup_0500 removeGroupByBundleCallbackThree err====>"+JSON.stringify(err)); - console.info("========ANS_RemoveGroup_0500 removeGroupByBundleCallbackThree end====>"); - } - - function removeGroupByBundleCallbackThree2(err){ - console.info("========ANS_RemoveGroup_0500 removeGroupByBundleCallbackThree2 start==>"); - console.info("========ANS_RemoveGroup_0500 removeGroupByBundleCallbackThree2 err====>"+JSON.stringify(err)); - console.info("========ANS_RemoveGroup_0500 removeGroupByBundleCallbackThree2 end====>"); - } - - /* - * @tc.number: ANS_RemoveGroup_0500 - * @tc.name: removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback): void; - * @tc.desc: Verify : After the notification of a specific group is successfully removed, - remove the notification of this group again(callback) - */ - it('ANS_RemoveGroup_0500', 0, async function (done) { - console.info("==================ANS_RemoveGroup_0500 start==================>"); - timesOfOnCancel = 0; - var subscriber ={ - onConsume:onConsumeRemoveGroupThree, - onCancel:onCancelRemoveGroupThree - } - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_0500", - id: 5, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0500", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.subscribe(subscriber); - console.info("===========ANS_RemoveGroup_0500 subscribe promise======>"); - notify.publish(notificationRequest); - console.info("===========ANS_RemoveGroup_0500 publish promise========>"); - setTimeout((async function(){ - console.info("======ANS_RemoveGroup_0500 setTimeout==============>"); - notify.unsubscribe(subscriber); - console.info("======ANS_RemoveGroup_0500 setTimeout unsubscribe==>"); - done(); - }),timeout); - }) - - function onConsumeRemoveGroupPromiseThree(data) { - console.info("=========ANS_RemoveGroup_0600 onConsume start==============>"); - console.info("=========ANS_RemoveGroup_0600 onConsume data:==============>" + JSON.stringify(data)); - notify.removeGroupByBundle(bundleOption, "group_0600"); - console.info("=========ANS_RemoveGroup_0600 onConsume removeGroupByBundle======>"); - console.info("=========ANS_RemoveGroup_0600 onConsume end================>"); - } - - function onCancelRemoveGroupPromiseThree(data) { - timesOfOnCancel = timesOfOnCancel + 1; - console.info("========ANS_RemoveGroup_0600 onCancel start===========>"); - console.info("========ANS_RemoveGroup_0600 onCancel data:===========>" + JSON.stringify(data)); - if (timesOfOnCancel == 1) { - expect(data.request.id).assertEqual(6); - console.info("========ANS_RemoveGroup_0600 onCancel id:=============>" + data.request.id); - expect(data.request.label).assertEqual("0600"); - console.info("========ANS_RemoveGroup_0600 onCancel label:==========>" + data.request.label); - expect(data.request.groupName).assertEqual("group_0600"); - console.info("========ANS_RemoveGroup_0600 onCancel groupName:======>" + data.request.groupName); - notify.removeGroupByBundle(bundleOption, "group_0600"); - console.info("========ANS_RemoveGroup_0600 onCancel removeGroupByBundle:==========>"); - }else if(timesOfOnCancel == 2){ - expect.assertFail(); - } - console.info("========ANS_RemoveGroup_0600 onCancel end=============>"); - } - - /* - * @tc.number: ANS_RemoveGroup_0600 - * @tc.name: removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback): void; - * @tc.desc: Verify : After the notification of a specific group is successfully removed, - remove the notification of this group again(promise) - */ - it('ANS_RemoveGroup_0600', 0, async function (done) { - console.info("==================ANS_RemoveGroup_0600 start==================>"); - timesOfOnCancel = 0; - var subscriber ={ - onConsume:onConsumeRemoveGroupPromiseThree, - onCancel:onCancelRemoveGroupPromiseThree - } - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_0600", - id: 6, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0600", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.subscribe(subscriber); - console.info("===========ANS_RemoveGroup_0600 subscribe promise======>"); - notify.publish(notificationRequest); - console.info("===========ANS_RemoveGroup_0600 publish promise========>"); - setTimeout((async function(){ - console.info("======ANS_RemoveGroup_0600 setTimeout==============>"); - notify.unsubscribe(subscriber); - console.info("======ANS_RemoveGroup_0600 setTimeout unsubscribe==>"); - done(); - }),timeout); - }) - - function removeGroupByBundleCallbackFour(err){ - console.info("========ANS_RemoveGroup_0700 removeGroupByBundleCallbackFour start==>"); - console.info("========ANS_RemoveGroup_0700 removeGroupByBundleCallbackFour err====>"+JSON.stringify(err)); - expect(err.code != 0).assertEqual(true); - console.info("========ANS_RemoveGroup_0700 removeGroupByBundleCallbackFour end====>"); - } - - /* - * @tc.number: ANS_RemoveGroup_0700 - * @tc.name: removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback): void; - * @tc.desc: Verify : Call the interface with an empty groupName parameter(callback) - */ - it('ANS_RemoveGroup_0700', 0, async function (done) { - console.info("==================ANS_RemoveGroup_0700 start==================>"); - notify.removeGroupByBundle(bundleOption, "", removeGroupByBundleCallbackFour); - setTimeout((async function(){ - console.info("======ANS_RemoveGroup_0700 setTimeout==============>"); - done(); - }),timeout); - }) - - /* - * @tc.number: ANS_RemoveGroup_0800 - * @tc.name: removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback): void; - * @tc.desc: Verify : Call the interface with an empty groupName parameter(promise) - */ - it('ANS_RemoveGroup_0800', 0, async function (done) { - console.info("==================ANS_RemoveGroup_0800 start==================>"); - notify.removeGroupByBundle(bundleOption, "").then(()=>{ - console.info("==================ANS_RemoveGroup_0800 removeGroupByBundle then==================>"); - }).catch((err)=>{ - console.info("==================ANS_RemoveGroup_0800 removeGroupByBundle catch==================>"); - console.info("==================ANS_RemoveGroup_0800 removeGroupByBundle err==================>"+err.code); - expect(err.code != 0).assertEqual(true); - }); - setTimeout((async function(){ - console.info("======ANS_RemoveGroup_0800 setTimeout==============>"); - done(); - }),timeout); - }) - - function onConsumeRemoveGroupFour(data) { - console.info("=========ANS_RemoveGroup_0900 onConsume start==============>"); - console.info("=========ANS_RemoveGroup_0900 onConsume data:==============>" + JSON.stringify(data)); - notify.removeGroupByBundle(bundleOption, "group_wrong", removeGroupByBundleCallbackFive); - console.info("=========ANS_RemoveGroup_0900 onConsume removeGroupByBundle======>"); - console.info("=========ANS_RemoveGroup_0900 onConsume end================>"); - } - - function onCancelRemoveGroupFour(data) { - expect().assertFail(); - console.info("========ANS_RemoveGroup_0900 onCancel start===========>"); - console.info("========ANS_RemoveGroup_0900 onCancel data:===========>" + JSON.stringify(data)); - console.info("========ANS_RemoveGroup_0900 onCancel end=============>"); - } - - function removeGroupByBundleCallbackFive(err){ - console.info("========ANS_RemoveGroup_0900 removeGroupByBundleCallbackOne start==>"); - console.info("========ANS_RemoveGroup_0900 removeGroupByBundleCallbackOne err====>"+JSON.stringify(err)); - console.info("========ANS_RemoveGroup_0900 removeGroupByBundleCallbackOne end====>"); - } - - /* - * @tc.number: ANS_RemoveGroup_0900 - * @tc.name: removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback): void; - * @tc.desc: Verify : Verify : Call the interface with an wrong groupName parameter(callback) - */ - it('ANS_RemoveGroup_0900', 0, async function (done) { - console.info("==================ANS_RemoveGroup_0900 start==================>"); - var subscriber ={ - onConsume:onConsumeRemoveGroupFour, - onCancel:onCancelRemoveGroupFour - } - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_0900", - id: 9, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0900", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.subscribe(subscriber); - console.info("===========ANS_RemoveGroup_0900 subscribe promise======>"); - notify.publish(notificationRequest); - console.info("===========ANS_RemoveGroup_0900 publish promise========>"); - setTimeout((async function(){ - console.info("======ANS_RemoveGroup_0900 setTimeout==============>"); - notify.unsubscribe(subscriber); - console.info("======ANS_RemoveGroup_0900 setTimeout unsubscribe==>"); - done(); - }),timeout); - }) - - function onConsumeRemoveGroupPromiseFour(data) { - console.info("=========ANS_RemoveGroup_1000 onConsume start==============>"); - console.info("=========ANS_RemoveGroup_1000 onConsume data:==============>" + JSON.stringify(data)); - notify.removeGroupByBundle(bundleOption, "group_wrong"); - console.info("=========ANS_RemoveGroup_1000 onConsume removeGroupByBundle======>"); - console.info("=========ANS_RemoveGroup_1000 onConsume end================>"); - } - - function onCancelRemoveGroupPromiseFour(data) { - expect().assertFail(); - console.info("========ANS_RemoveGroup_1000 onCancel start===========>"); - console.info("========ANS_RemoveGroup_1000 onCancel data:===========>" + JSON.stringify(data)); - console.info("========ANS_RemoveGroup_1000 onCancel end=============>"); - } - - /* - * @tc.number: ANS_RemoveGroup_1000 - * @tc.name: removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback): void; - * @tc.desc: Verify : Verify : Call the interface with an wrong groupName parameter(promise) - */ - it('ANS_RemoveGroup_1000', 0, async function (done) { - console.info("==================ANS_RemoveGroup_1000 start==================>"); - var subscriber ={ - onConsume:onConsumeRemoveGroupPromiseFour, - onCancel:onCancelRemoveGroupPromiseFour - } - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - groupName:"group_1000", - id: 10, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1000", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.subscribe(subscriber); - console.info("===========ANS_RemoveGroup_1000 subscribe promise======>"); - notify.publish(notificationRequest); - console.info("===========ANS_RemoveGroup_1000 publish promise========>"); - setTimeout((async function(){ - console.info("======ANS_RemoveGroup_1000 setTimeout==============>"); - notify.unsubscribe(subscriber); - console.info("======ANS_RemoveGroup_1000 setTimeout unsubscribe==>"); - done(); - }),timeout); - }) -})} diff --git a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/test/List.test.js deleted file mode 100644 index 5f130a08232899565f737c766d2b80193d69bff8..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* -* 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 ActsAnsRemoveGroup from './ActsAnsRemoveGroup.js' -export default function testsuite() { -ActsAnsRemoveGroup() -} diff --git a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/ansactsremovegroup/src/main/resources/base/element/string.json deleted file mode 100644 index d3627136a08eb2e660c8c2799a533aed2bda7684..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/ansactsremovegroup/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "actsansremovegroup" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/badgedisplayed/BUILD.gn b/notification/ans_standard/publish_test/badgedisplayed/BUILD.gn deleted file mode 100644 index 1d35dab11a531dc8c5c02a6304c09d68cbc6f195..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/BUILD.gn +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//test/xts/tools/build/suite.gni") - -group("badgedisplayed") { - testonly = true - if (is_standard_system) { - deps = [ - #"badgedisplay:ActsAnsBadgeDisplayTest", - "localcandisplay:localcandisplay", - ] - } -} diff --git a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/BUILD.gn b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/BUILD.gn deleted file mode 100644 index eb0e2e6e80d7fba6e8bd3fb2c9275bfe1bc36151..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsBadgeDisplayTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsBadgeDisplayTest" - 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/publish_test/badgedisplayed/badgedisplay/Test.json b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/Test.json deleted file mode 100644 index cdb79c958db01c4ce0da3330ab757d374bc2b1db..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/Test.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "shell-timeout": "60000", - "bundle-name": "com.example.actsansbadgedisplaytest", - "package-name": "com.example.actsansbadgedisplaytest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsBadgeDisplayTest.hap", - "localcandisplay.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/signature/openharmony_sx.p7b deleted file mode 100644 index 9cc5575a271908c8f1c59091cd694d93012866da..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/config.json b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/config.json deleted file mode 100644 index ffa9d606db3c98b3c54f2024223af64dc962fd71..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/config.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansbadgedisplaytest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansbadgedisplaytest", - "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" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO", - "reason": "need use ohos.permission.GET_BUNDLE_INFO" - }, - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER", - "reason": "need use ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/publish_test/badgedisplayed/badgedisplay/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/badgedisplayed/badgedisplay/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index c2fb3e020fdd1ea6cbee7583c300833ba0936ae2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Test hiding of badge - -
diff --git a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/badgedisplayed/badgedisplay/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/badgedisplayed/badgedisplay/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/badgedisplayed/badgedisplay/src/main/js/test/BadgeDisplay.js b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/test/BadgeDisplay.js deleted file mode 100644 index c8835589dbdcc82761e4a683b6e204f63b3a039c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/test/BadgeDisplay.js +++ /dev/null @@ -1,188 +0,0 @@ -/* - * 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 notify from '@ohos.notification' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -var time = 1000 -export default function ActsAnsBadgeDisplayTest() { -describe('ActsAnsBadgeDisplayTest', function () { - console.info("===ActsAnsBadgeDisplayTest start===>"); - /* - * @tc.number: ActsGetDisplay_test_0100 - * @tc.name: isBadgeDisplayed() - * @tc.desc: verify the function of isBadgeDisplayed - */ - it('ActsGetDisplay_test_0100', 0, async function (done) { - await notify.isBadgeDisplayed({ - bundle:"com.example.actsanslocalcandisplaytest", - },(err,data) => { - console.log("===>ActsGetDisplay_test_0100 success===>"+JSON.stringify(err)+data) - expect(typeof(data)).assertEqual('boolean') - done(); - }) - }) - - /* - * @tc.number: ActsGetDisplay_test_0300 - * @tc.name: isBadgeDisplayed() - * @tc.desc: verify the function of isBadgeDisplayed - */ - it('ActsGetDisplay_test_0300', 0, async function (done) { - await notify.isBadgeDisplayed({ - bundle:"wrong BundleName", - },(err,data) => { - console.log("===>ActsGetDisplay_test_0300 success===>"+err+data) - expect(typeof(data)).assertEqual('boolean') - expect(data).assertEqual(false) - done(); - }) - }) - /* - * @tc.number: ActsGetDisplay_test_0400 - * @tc.name: isBadgeDisplayed() - * @tc.desc: verify the function of isBadgeDisplayed - */ - it('ActsGetDisplay_test_0400', 0, async function (done) { - notify.isBadgeDisplayed({ - bundle:"wrong BundleName", - }).then().catch((err)=>{ - console.log("===>ActsGetDisplay_test_0400 success===>"+err.code) - expect(err.code != 0).assertEqual(true); - done(); - }) - - }) - /* - * @tc.number: ActsGetDisplay_test_0500 - * @tc.name: displayBadge() - * @tc.desc: verify the function of displayBadge - */ - it('ActsGetDisplay_test_0500', 0, async function (done) { - await notify.isBadgeDisplayed("#$#$%$%^",(err,data) => { - console.log("===>ActsGetDisplay_test_0500 success===>"+err+data) - expect(typeof(data)).assertEqual('boolean') - }) - done(); - }) - /* - * @tc.number: ActsGetDisplay_test_0600 - * @tc.name: isBadgeDisplayed() - * @tc.desc: verify the function of isBadgeDisplayed - */ - it('ActsGetDisplay_test_0600', 0, async function (done) { - var promise = await notify.isBadgeDisplayed("#$#$%$%^") - expect(promise).assertEqual(undefined) - done(); - }) - /* - * @tc.number: ActsGetDisplay_test_0700 - * @tc.name: isBadgeDisplayed() - * @tc.desc: verify the function of isBadgeDisplayed - */ - it('ActsGetDisplay_test_0700', 0, async function (done) { - await notify.isBadgeDisplayed({},(err,data) => { - console.log("===>ActsGetDisplay_test_0700 success===>"+err+data) - expect(typeof(data)).assertEqual('boolean') - }) - done(); - }) - /* - * @tc.number: ActsGetDisplay_test_0800 - * @tc.name: isBadgeDisplayed() - * @tc.desc: verify the function of isBadgeDisplayed - */ - it('ActsGetDisplay_test_0800', 0, async function (done) { - var promise = await notify.isBadgeDisplayed({}) - expect(promise).assertEqual(undefined) - done(); - }) - - /* - * @tc.number: ActsSetDisplay_test_0100 - * @tc.name: displayBadge() - * @tc.desc: verify the function of displayBadge - */ - it('ActsSetDisplay_test_0100', 0, async function (done) { - await notify.displayBadge({ - bundle:"com.example.actsanslocalcandisplaytest" - },100,(err) => { - console.log("===>ActsSetDisplay_test_0100 success===>"+err) - }) - done(); - }) - /* - * @tc.number: ActsSetDisplay_test_0200 - * @tc.name: displayBadge() - * @tc.desc: verify the function of displayBadge - */ - it('ActsSetDisplay_test_0200', 0, async function (done) { - var promise = await notify.displayBadge({ - bundle:"com.example.actsanslocalcandisplaytest" - },100) - expect(promise).assertEqual(undefined) - done(); - }) - /* - * @tc.number: ActsSetDisplay_test_0300 - * @tc.name: displayBadge() - * @tc.desc: verify the function of displayBadge - */ - it('ActsSetDisplay_test_0300', 0, async function (done) { - await notify.displayBadge({ - bundle:"Wrong BundleName" - },true,(err) => { - console.log("===>ActsSetDisplay_test_0300 success===>"+err.code) - expect(err.code).assertEqual(ERR_ANS_INVALID_BUNDLE) - }) - done(); - }) - /* - * @tc.number: ActsSetDisplay_test_0400 - * @tc.name: displayBadge() - * @tc.desc: verify the function of displayBadge - */ - it('ActsSetDisplay_test_0400', 0, async function (done) { - notify.displayBadge({ - bundle:"Wrong BundleName" - },true).then().catch((err)=>{ - console.log("===>ActsSetDisplay_test_0400 err===>"+err.code) - expect(err.code != 0).assertEqual(true); - done(); - }) - }) - - /* - * @tc.number: ActsSetDisplay_test_0700 - * @tc.name: displayBadge() - * @tc.desc: verify the function of displayBadge - */ - it('ActsSetDisplay_test_0700', 0, async function (done) { - await notify.displayBadge({ - bundle:"com.example.actsanslocalcandisplaytest" - },false,async(err) => { - await notify.isBadgeDisplayed({ - bundle:"com.example.actsanslocalcandisplaytest", - },(err,data) => { - console.log("===>ActsSetDisplay_test_0700 success===>"+err+data) - expect(typeof(data)).assertEqual('boolean') - expect(data).assertEqual(false) - done(); - }) - }) - }) -}) - - -} diff --git a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/test/List.test.js deleted file mode 100644 index 7441e7f27f71cc7fc3707d602c23605dc5060511..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsBadgeDisplayTest from './BadgeDisplay.js' -export default function testsuite() { -ActsAnsBadgeDisplayTest() -} diff --git a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/resources/base/element/string.json deleted file mode 100644 index ee22c2daff2ea7528f6db8867da3a723dd314caf..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/badgedisplay/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "Badge" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/BUILD.gn b/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/BUILD.gn deleted file mode 100644 index 4112820811c5619f08a75f1be1050b19fb7b539f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/BUILD.gn +++ /dev/null @@ -1,34 +0,0 @@ -# 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_hap_assist_suite("localcandisplay") { - hap_profile = "./entry/src/main/config.json" - hap_name = "localcandisplay" - subsystem_name = "notification" - part_name = "distributed_notification_service" - testonly = true - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/config.json b/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/config.json deleted file mode 100644 index 2579047fb45aea283d3c497a548eb0039e55de6e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/config.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanslocalcandisplaytest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanslocalcandisplaytest", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "com.example.actsanslocalcandisplaytest.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/default/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/default/pages/index/index.hml deleted file mode 100644 index 57949f4fab858ee082bd93b0c29b45af60c56054..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Badge display setting-Dependency - -
diff --git a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index 6e1cc7770a86a2b0add36fa1bdeaa1e0673ef31e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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' -import {Core, ExpectExtend} from 'deccjsunit/index' - -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') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - core.execute() - }, - onReady() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 6ea0fda516299f695326dd17795c04b3e779b040..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "BadgeTest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/badgedisplayed/localcandisplay/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/donotdisturbmode/BUILD.gn b/notification/ans_standard/publish_test/donotdisturbmode/BUILD.gn deleted file mode 100644 index b2bb747b6537d7fb176ecf7b0c094692f94892f1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsDoNotDisturbTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsDoNotDisturbTest" - 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/publish_test/donotdisturbmode/Test.json b/notification/ans_standard/publish_test/donotdisturbmode/Test.json deleted file mode 100644 index 37d9ecb73c4792e81fb58018f2b7f15bc9db9c02..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "shell-timeout": "180000", - "bundle-name": "com.example.actsansdonotdisturbtest", - "package-name": "com.example.actsansdonotdisturbtest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsDoNotDisturbTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/donotdisturbmode/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/donotdisturbmode/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/donotdisturbmode/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/donotdisturbmode/src/main/config.json b/notification/ans_standard/publish_test/donotdisturbmode/src/main/config.json deleted file mode 100644 index 96d0627932959f8df9e7f1cd2630ab1860255a22..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansdonotdisturbtest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansdonotdisturbtest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/donotdisturbmode/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 850cce43f9e1a838c52c541213689b0679d713e1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Do Not Disturb - -
diff --git a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/donotdisturbmode/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/donotdisturbmode/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/donotdisturbmode/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/test/List.test.js deleted file mode 100644 index 063d950aa5ba33612666a7a9b3a7365d9ff9d1de..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsDoNotDisturbTest from './doNotDisturbTest.js' -export default function testsuite() { -ActsAnsDoNotDisturbTest() -} diff --git a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/test/doNotDisturbTest.js b/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/test/doNotDisturbTest.js deleted file mode 100644 index db68c83f5b14a554891ea6b9a16a3e5ad2bad282..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/src/main/js/test/doNotDisturbTest.js +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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 notify from '@ohos.notification' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -var ERR_ANS_INVALID_PARAM = 67108867 -export default function ActsAnsDoNotDisturbTest() { -describe('ActsAnsDoNotDisturbTest', function () { - console.info("===ActsAnsDoNotDisturbTest start===>"); - function connectCallbacka() { - console.debug("==>connectCallbacka code==>"); - } - function subscribeCallbacka(err) { - console.debug("==>subscribeCallbacka code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbacka(err){ - console.debug("==>unSubscribeCallbacka code==>" +err.code); - expect(err.code).assertEqual(0); - } - function connectCallbackb() { - console.debug("==>connectCallbackb code==>"); - } - function subscribeCallbackb(err) { - console.debug("==>subscribeCallbackb code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbackb(err){ - console.debug("==>unSubscribeCallbackb code==>" +err.code); - expect(err.code).assertEqual(0); - } - - /* - * @tc.number: ActsSetDoNotDisturbTest_test_1900 - * @tc.name: setDoNotDisturbDate() - * @tc.desc: verify the function of setDoNotDisturbDate - */ - it('ActsSetDoNotDisturbTest_test_1900', 0, async function (done) { - await notify.setDoNotDisturbDate({ - type:notify.DoNotDisturbType.TYPE_CLEARLY, - begin:100, - end:100 - },async(err) => { - console.log("===>test_1900 success===>"+err.code); - await notify.getDoNotDisturbDate((err,data)=>{ - console.log("===>test_1900 getDoNotDisturbDate success===>"+err.code+JSON.stringify(data)); - }) - }) - done(); - }) - - /* - * @tc.number: ActsSetDoNotDisturbTest_test_2000 - * @tc.name: displayBadge() - * @tc.desc: verify the function of displayBadge - */ - it('ActsSetDoNotDisturbTest_test_2000', 0, async function (done) { - var promise = notify.setDoNotDisturbDate({ - type:notify.DoNotDisturbType.TYPE_CLEARLY, - begin:100, - end:100 - }) - console.log("===>ActsSetDoNotDisturbTest_test_2000 promise===>"+promise); - expect(promise).assertEqual(undefined); - done(); - }) -}) - - -} diff --git a/notification/ans_standard/publish_test/donotdisturbmode/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/donotdisturbmode/src/main/resources/base/element/string.json deleted file mode 100644 index bf89efd1bde4349a63c1390da6d92b76d855336f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/donotdisturbmode/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "DoNot" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/enablenotification/BUILD.gn b/notification/ans_standard/publish_test/enablenotification/BUILD.gn deleted file mode 100644 index 640f83ecaa8679e6ac8fef398106baf9a9cd6286..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/BUILD.gn +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//test/xts/tools/build/suite.gni") - -group("enablenotification") { - testonly = true - if (is_standard_system) { - deps = [ - #"enablenotification:ActsAnsEnableNotificationTest", - "localnotificationenable:ActsAnsLocalNotificationTest", - ] - } -} diff --git a/notification/ans_standard/publish_test/enablenotification/enablenotification/BUILD.gn b/notification/ans_standard/publish_test/enablenotification/enablenotification/BUILD.gn deleted file mode 100644 index ee7bec12c81026c0852df67672365b19044da76f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsEnableNotificationTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsEnableNotificationTest" - 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/publish_test/enablenotification/enablenotification/Test.json b/notification/ans_standard/publish_test/enablenotification/enablenotification/Test.json deleted file mode 100644 index 147f09c51c6eaf67870c890186830f410ea881ca..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/Test.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "shell-timeout": "180000", - "bundle-name": "com.example.actsansenablenotificationtest", - "package-name": "com.example.actsansenablenotificationtest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsEnableNotificationTest.hap", - "ActsAnsLocalNotificationTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/enablenotification/enablenotification/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/enablenotification/enablenotification/signature/openharmony_sx.p7b deleted file mode 100644 index 9cc5575a271908c8f1c59091cd694d93012866da..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/enablenotification/enablenotification/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/config.json b/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/config.json deleted file mode 100644 index a82a568e805065f1d6a2e502014d4f9297f15889..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/config.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansenablenotificationtest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansenablenotificationtest", - "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" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason": "need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO", - "reason": "need use ohos.permission.GET_BUNDLE_INFO" - }, - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER", - "reason": "need use ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/publish_test/enablenotification/enablenotification/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/enablenotification/enablenotification/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 9eb8c44b381f93e9585573ef15292da395d24ca0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Test Enabling of Notification - -
diff --git a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/enablenotification/enablenotification/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/enablenotification/enablenotification/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/enablenotification/enablenotification/src/main/js/test/EnableNotification.js b/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/test/EnableNotification.js deleted file mode 100644 index 860da1f0a6f68ac631af2183f7a7ff0611316593..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/test/EnableNotification.js +++ /dev/null @@ -1,191 +0,0 @@ -/* - * 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 notify from '@ohos.notification' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -var time = 1000 -export default function ActsAnsEnableNotificationTest() { -describe('ActsAnsEnableNotificationTest', function () { - console.info("===========ActsAnsEnableNotificationTest start====================>"); - - /* - * @tc.number: ActsGetEnable_test_0300 - * @tc.name: isNotificationEnabled() - * @tc.desc: verify the function of isNotificationEnabled - */ - it('ActsGetEnable_test_0300', 0, async function (done) { - await notify.isNotificationEnabled({ - bundle:"wrong BundleName", - },(err,data) => { - console.log("===>ActsGetEnable_test_0300 success===>"+err+data) - expect(typeof(data)).assertEqual('boolean') - expect(data).assertEqual(false) - done(); - }) - setTimeout(function(){ - console.debug("====>time out ActsGetEnable_test_0300====>"); - }, time); - }) - /* - * @tc.number: ActsGetEnable_test_0400 - * @tc.name: isNotificationEnabled() - * @tc.desc: verify the function of isNotificationEnabled - */ - it('ActsGetEnable_test_0400', 0, async function (done) { - notify.isNotificationEnabled({ - bundle:"wrong BundleName", - }).then().catch((err)=>{ - console.debug("====>ActsGetEnable_test_0400 promsie====>"+err.code); - expect(err.code != 0).assertEqual(true); - done(); - }) - }) - /* - * @tc.number: ActsGetEnable_test_0500 - * @tc.name: isNotificationEnabled() - * @tc.desc: verify the function of isNotificationEnabled - */ - it('ActsGetEnable_test_0500', 0, async function (done) { - await notify.isNotificationEnabled("#$#$%$%^",(err,data) => { - console.log("===>ActsGetEnable_test_0500 success===>"+err+data) - expect(typeof(data)).assertEqual('boolean') - }) - done(); - }) - /* - * @tc.number: ActsGetEnable_test_0600 - * @tc.name: isNotificationEnabled() - * @tc.desc: verify the function of isNotificationEnabled - */ - it('ActsGetEnable_test_0600', 0, async function (done) { - var promise = await notify.isNotificationEnabled("#$#$%$%^") - expect(promise).assertEqual(undefined) - done(); - }) - /* - * @tc.number: ActsGetDisplay_test_0700 - * @tc.name: isNotificationEnabled() - * @tc.desc: verify the function of isNotificationEnabled - */ - it('ActsGetEnable_test_0700', 0, async function (done) { - await notify.isNotificationEnabled({},(err,data) => { - console.log("===>ActsGetEnable_test_0700 success===>"+err+data) - expect(typeof(data)).assertEqual('boolean') - }) - done(); - }) - /* - * @tc.number: ActsGetEnable_test_0800 - * @tc.name: isNotificationEnabled() - * @tc.desc: verify the function of isNotificationEnabled - */ - it('ActsGetEnable_test_0800', 0, async function (done) { - var promise = await notify.isNotificationEnabled({}) - expect(promise).assertEqual(undefined) - done(); - }) - - /* - * @tc.number: ActsGetEnable_test_1100 - * @tc.name: isNotificationEnabled() - * @tc.desc: verify the function of isNotificationEnabled - */ - it('ActsGetEnable_test_1100', 0, async function (done) { - await notify.isNotificationEnabled((err,data) => { - console.log("==========================>ActsGetEnable_test_1100 success=======================>"+err+data) - expect(typeof(data)).assertEqual('boolean') - }) - done(); - }) - - /* - * @tc.number: ActsSetEnable_test_0100 - * @tc.name: enableNotification() - * @tc.desc: verify the function of enableNotification - */ - it('ActsSetEnable_test_0100', 0, async function (done) { - await notify.enableNotification({ - bundle:"com.example.actsanslocalnotificationtest" - },100,(err) => { - console.log("===>ActsSetEnable_test_0100 success===>"+err) - }) - done(); - }) - /* - * @tc.number: ActsSetEnable_test_0200 - * @tc.name: enableNotification() - * @tc.desc: verify the function of enableNotification - */ - it('ActsSetEnable_test_0200', 0, async function (done) { - var promise = await notify.enableNotification({ - bundle:"com.example.actsanslocalnotificationtest" - },100) - expect(promise).assertEqual(undefined) - done(); - }) - /* - * @tc.number: ActsSetEnable_test_0300 - * @tc.name: enableNotification() - * @tc.desc: verify the function of enableNotification - */ - it('ActsSetEnable_test_0300', 0, async function (done) { - await notify.enableNotification({ - bundle:"Wrong BundleName" - },true,(err) => { - console.log("===>ActsSetEnable_test_0300 success===>"+err.code) - expect(err.code).assertEqual(ERR_ANS_INVALID_BUNDLE) - }) - done(); - }) - /* - * @tc.number: ActsSetEnable_test_0400 - * @tc.name: enableNotification() - * @tc.desc: verify the function of enableNotification - */ - it('ActsSetEnable_test_0400', 0, async function (done) { - notify.enableNotification({ - bundle:"Wrong BundleName" - },true).then().catch((err)=>{ - console.log("===>ActsSetEnable_test_0400 err===>"+err.code) - expect(err.code != 0).assertEqual(true); - done(); - }) - }) - - /* - * @tc.number: ActsSetEnable_test_0700 - * @tc.name: enableNotification() - * @tc.desc: verify the function of enableNotification - */ - it('ActsSetEnable_test_0700', 0, async function (done) { - await notify.enableNotification({ - bundle:"com.example.actsanslocalnotificationtest" - },false,async(err) => { - await notify.isNotificationEnabled({ - bundle:"com.example.actsanslocalnotificationtest", - },(err,data) => { - console.log("===>ActsSetEnable_test_0700 success===>"+err+data) - expect(typeof(data)).assertEqual('boolean') - expect(data).assertEqual(false) - done(); - }) - }) - setTimeout(function(){ - console.debug("====>time out ActsSetEnable_test_0700====>"); - }, time); - }) -}) - -} diff --git a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/test/List.test.js deleted file mode 100644 index af9b34a25bc8a7d7b4c20b91edd14823d2df7948..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsEnableNotificationTest from './EnableNotification.js' -export default function testsuite() { -ActsAnsEnableNotificationTest() -} diff --git a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/resources/base/element/string.json deleted file mode 100644 index 8731524ba446c908d20b89f621f92e0cccfd4422..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/enablenotification/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "EnNoti" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/BUILD.gn b/notification/ans_standard/publish_test/enablenotification/localnotificationenable/BUILD.gn deleted file mode 100644 index 0f7a8752336fb155503df26364ab1511ce33f0d3..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/BUILD.gn +++ /dev/null @@ -1,34 +0,0 @@ -# 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_hap_assist_suite("ActsAnsLocalNotificationTest") { - hap_profile = "./entry/src/main/config.json" - hap_name = "ActsAnsLocalNotificationTest" - subsystem_name = "notification" - part_name = "distributed_notification_service" - testonly = true - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/config.json b/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/config.json deleted file mode 100644 index c755e60e839bbc614402d9f4c698210bfe3ea657..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/config.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanslocalnotificationtest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanslocalnotificationtest", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "com.example.actsanslocalnotificationtest.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/enablenotification/localnotificationenable/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/default/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/default/pages/index/index.hml deleted file mode 100644 index ebe2633f2d5b202e78ea431d3464b6323cbb43df..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Test Enabling of Local Notification - -
diff --git a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index 6e1cc7770a86a2b0add36fa1bdeaa1e0673ef31e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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' -import {Core, ExpectExtend} from 'deccjsunit/index' - -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') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - core.execute() - }, - onReady() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 2a3c6ad694f9de382ca3663a50c4caccdfafa42a..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "LocNotiEn" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/enablenotification/localnotificationenable/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/enablenotification/localnotificationenable/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/getactive/BUILD.gn b/notification/ans_standard/publish_test/getactive/BUILD.gn deleted file mode 100644 index 720bd35c5c1f2c6bfacec0211a42ad9cc6ea6b78..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/BUILD.gn +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//test/xts/tools/build/suite.gni") - -group("getactive") { - testonly = true - if (is_standard_system) { - deps = [ - "actsansgetactive:ActsAnsActiveTest", - #"actsansgetallactive:ActsAnsAllActiveTestOne", - #"getactiveotherapp:ActsAnsGetActiveOtherApp" - ] - } -} diff --git a/notification/ans_standard/publish_test/getactive/actsansgetactive/BUILD.gn b/notification/ans_standard/publish_test/getactive/actsansgetactive/BUILD.gn deleted file mode 100644 index 35a3b2d7d6b68d8a9004ce2323eef0f72e979290..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsActiveTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsActiveTest" - 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/publish_test/getactive/actsansgetactive/Test.json b/notification/ans_standard/publish_test/getactive/actsansgetactive/Test.json deleted file mode 100644 index bbaa35d5da3f1df4d3324508ee605d08b15491f9..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "shell-timeout": "180000", - "bundle-name": "com.example.actsansgetactivetest", - "package-name": "com.example.actsansgetactivetest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsActiveTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/actsansgetactive/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/getactive/actsansgetactive/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/getactive/actsansgetactive/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/config.json b/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/config.json deleted file mode 100644 index f0251327ed960ef20e6efd3e96fdd4a0daeba812..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansgetactivetest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansgetactivetest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/getactive/actsansgetactive/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 89445cdd2b10712aa18502331d603a48d938f012..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - active - -
diff --git a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/getactive/actsansgetactive/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/getactive/actsansgetactive/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/getactive/actsansgetactive/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/test/List.test.js deleted file mode 100644 index bc49a557754e3b61201e34636c8eb0d95e6767b6..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsActiveTest from './getActive.js' -export default function testsuite() { -ActsAnsActiveTest() -} diff --git a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/test/getActive.js b/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/test/getActive.js deleted file mode 100644 index d2a1fb5bcab23230006294ea9e27c99eea99149e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/js/test/getActive.js +++ /dev/null @@ -1,1087 +0,0 @@ -/* - * 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 notify from '@ohos.notification' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -var time = 300 -var ERR_ANS_NON_SYSTEM_APP = 67108877 -var cancalAllFlag = false -export default function ActsAnsActiveTest() { -describe('ActsAnsActiveTest', function () { - console.info("===========ActsAnsActiveTest start====================>"); - function getCallback(err, data){ - console.log("Ans_GetActive_0100 getCallback ============>"); - var i; - console.log("Ans_GetActive_0100 getCallback data.length============>"+data.length); - console.log("Ans_GetActive_0100 getCallback data============>"+JSON.stringify(data)); - for (i = 0; i < data.length; i++) { - expect(data[i].content.contentType).assertEqual(notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT); - console.log("Ans_GetActive_0100 getCallback contentType============>"+data[i].content.contentType) - expect(data[i].content.normal.title).assertEqual("test_title"); - console.log("=========Ans_GetActive_0100 getCallback title============>"+data[i].content.normal.title) - expect(data[i].content.normal.text).assertEqual("test_text"); - console.log("==========Ans_GetActive_0100 getCallback text============>"+data[i].content.normal.text) - expect(data[i].content.normal.additionalText).assertEqual("test_additionalText"); - console.log("========Ans_GetActive_0100 getCallback text========>"+data[i].content.normal.additionalText) - expect(data[i].id).assertEqual(1); - console.log("============Ans_GetActive_0100 getCallback id============>"+data[i].id) - expect(data[i].slotType).assertEqual(notify.SlotType.OTHER_TYPES); - console.log("============Ans_GetActive_0100 getCallback slotType============>"+data[i].slotType) - expect(data[i].deliveryTime).assertEqual(1624950453); - console.log("============Ans_GetActive_0100 getCallback deliveryTime========>"+data[i].deliveryTime) - expect(data[i].autoDeletedTime).assertEqual(1625036817); - console.log("===========Ans_GetActive_0100 getCallback autoDeletedTime=====>"+data[i].autoDeletedTime) - expect(data[i].statusBarText).assertEqual("statusBarText"); - console.log("============Ans_GetActive_0100 getCallback statusBarText=====>"+data[i].statusBarText) - expect(data[i].label).assertEqual("0100"); - console.log("============Ans_GetActive_0100 getCallback label=====>"+data[i].label) - expect(data[i].badgeIconStyle).assertEqual(1); - console.log("============Ans_GetActive_0100 getCallback badgeIconStyle=====>"+data[i].badgeIconStyle) - } - } - - function cancelAllCallback(err) { - cancalAllFlag = true - console.info("===>cancelAllCallback===>"); - } - - /* - * @tc.number: Ans_GetActive_0100 - * @tc.name: getActiveNotifications(callback: AsyncCallback>): void; - * @tc.desc: Verify: after publishing a notification, get all active notification info(callback) - */ - it('Ans_GetActive_0100', 0, async function (done) { - console.debug("===============Ans_GetActive_0100 start==================>"); - await notify.cancelAll(); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 1, - slotType : notify.SlotType.OTHER_TYPES, - deliveryTime : 1624950453, - autoDeletedTime: 1625036817, - statusBarText: "statusBarText", - label: "0100", - badgeIconStyle: 1, - } - await notify.publish(notificationRequest); - console.debug("===============Ans_GetActive_0100 publish end==================>"); - notify.getActiveNotifications(getCallback); - console.debug("===============Ans_GetActive_0100 getActiveNotifications end==================>"); - setTimeout(async function(){ - console.debug("===============Ans_GetActive_0100 done==================>"); - done(); - }, time); - }) - - /* - * @tc.number: Ans_GetActive_0200 - * @tc.name: getActiveNotifications(): Promise>; - * @tc.desc: Verify: after publishing a notification, get all active notification info(promise) - */ - it('Ans_GetActive_0200', 0, async function (done) { - console.debug("===============Ans_GetActive_0200 start==================>"); - await notify.cancelAll(); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 2, - slotType : notify.SlotType.OTHER_TYPES, - deliveryTime : 1624950453, - autoDeletedTime: 1625036817, - color: 2, - statusBarText: "statusBarText", - label: "0200", - badgeIconStyle: 1, - } - await notify.publish(notificationRequest); - console.debug("===============Ans_GetActive_0200 publish end==================>"); - var promiseData = await notify.getActiveNotifications(); - var i; - for (i = 0; i < promiseData.length; i++) { - expect(promiseData[i].content.contentType).assertEqual(notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT); - console.log("Ans_GetActive_0200 getCallback contentType============>"+promiseData[i].content.contentType) - expect(promiseData[i].content.normal.title).assertEqual("test_title"); - console.log("====Ans_GetActive_0200 getCallback title============>"+promiseData[i].content.normal.title) - expect(promiseData[i].content.normal.text).assertEqual("test_text"); - console.log("=====Ans_GetActive_0200 getCallback text============>"+promiseData[i].content.normal.text) - expect(promiseData[i].content.normal.additionalText).assertEqual("test_additionalText"); - console.log("==Ans_GetActive_0200 getCallback text========>"+promiseData[i].content.normal.additionalText) - expect(promiseData[i].id).assertEqual(2); - console.log("============Ans_GetActive_0200 getCallback id============>"+promiseData[i].id) - expect(promiseData[i].slotType).assertEqual(notify.SlotType.OTHER_TYPES); - console.log("============Ans_GetActive_0200 getCallback slotType============>"+promiseData[i].slotType) - expect(promiseData[i].deliveryTime).assertEqual(1624950453); - console.log("=======Ans_GetActive_0200 getCallback deliveryTime========>"+promiseData[i].deliveryTime) - expect(promiseData[i].autoDeletedTime).assertEqual(1625036817); - console.log("=======Ans_GetActive_0200 getCallback autoDeletedTime=====>"+promiseData[i].autoDeletedTime) - // expect(data[i].color).assertEqual(2); - console.log("============Ans_GetActive_0200 getCallback color=====>"+promiseData[i].color) - expect(promiseData[i].statusBarText).assertEqual("statusBarText"); - console.log("=======Ans_GetActive_0200 getCallback statusBarText=====>"+promiseData[i].statusBarText) - expect(promiseData[i].label).assertEqual("0200"); - console.log("============Ans_GetActive_0200 getCallback label=====>"+promiseData[i].label) - expect(promiseData[i].badgeIconStyle).assertEqual(1); - console.log("=======Ans_GetActive_0200 getCallback badgeIconStyle=====>"+promiseData[i].badgeIconStyle) - } - console.debug("===============Ans_GetActive_0200 getActiveNotifications end==================>"); - setTimeout(async function(){ - console.debug("===============Ans_GetActive_0200 done==================>"); - done(); - }, time); - }) - - function getCallbackTwo(err, data){ - console.log("Ans_GetActive_0300 getCallback data.length============>"+data.length); - expect(data.length).assertEqual(2); - console.log("Ans_GetActive_0300 getCallback data============>"+JSON.stringify(data)); - var i; - for (i = 0; i < data.length; i++) { - if (i == 0){ - expect(data[i].content.normal.title).assertEqual("test_title_1"); - console.log("==========Ans_GetActive_0300 getCallback title=========>"+data[i].content.normal.title) - expect(data[i].content.normal.text).assertEqual("test_text_1"); - console.log("==========Ans_GetActive_0300 getCallback text============>"+data[i].content.normal.text) - expect(data[i].content.normal.additionalText).assertEqual("test_additionalText_1"); - console.log("======Ans_GetActive_0300 getCallback text=======>"+data[i].content.normal.additionalText) - expect(data[i].id).assertEqual(1); - console.log("============Ans_GetActive_0300 getCallback id============>"+data[i].id) - expect(data[i].label).assertEqual("0300_1"); - console.log("============Ans_GetActive_0300 getCallback label=====>"+data[i].label) - }else if(i == 1){ - expect(data[i].content.normal.title).assertEqual("test_title_2"); - console.log("==========Ans_GetActive_0300 getCallback title=========>"+data[i].content.normal.title) - expect(data[i].content.normal.text).assertEqual("test_text_2"); - console.log("==========Ans_GetActive_0300 getCallback text============>"+data[i].content.normal.text) - expect(data[i].content.normal.additionalText).assertEqual("test_additionalText_2"); - console.log("======Ans_GetActive_0300 getCallback text=======>"+data[i].content.normal.additionalText) - expect(data[i].id).assertEqual(2); - console.log("============Ans_GetActive_0300 getCallback id============>"+data[i].id) - expect(data[i].label).assertEqual("0300_2"); - console.log("============Ans_GetActive_0300 getCallback label=====>"+data[i].label) - } - } - } - - /* - * @tc.number: Ans_GetActive_0300 - * @tc.name: getActiveNotifications(callback: AsyncCallback>): void; - * @tc.desc: Verify: after publishing two notifications, get all active notifications info(callback) - */ - it('Ans_GetActive_0300', 0, async function (done) { - console.debug("===============Ans_GetActive_0300 start==================>"); - await notify.cancelAll(); - var notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_1", - text: "test_text_1", - additionalText: "test_additionalText_1" - }, - }, - id: 1, - label: "0300_1", - } - var notificationRequest2 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_2", - text: "test_text_2", - additionalText: "test_additionalText_2" - }, - }, - id: 2, - label: "0300_2", - } - await notify.publish(notificationRequest1); - console.debug("===============Ans_GetActive_0300 publish1 end==================>"); - await notify.publish(notificationRequest2); - console.debug("===============Ans_GetActive_0300 publish2 end==================>"); - notify.getActiveNotifications(getCallbackTwo); - console.debug("===============Ans_GetActive_0300 getActiveNotifications end==================>"); - setTimeout(async function(){ - console.debug("===============Ans_GetActive_0300 done==================>"); - done(); - }, time); - }) - - /* - * @tc.number: Ans_GetActive_0400 - * @tc.name: getActiveNotifications(): Promise>; - * @tc.desc: Verify: after publishing two notifications, get all active notifications info(promise) - */ - it('Ans_GetActive_0400', 0, async function (done) { - console.debug("===============Ans_GetActive_0400 start==================>"); - await notify.cancelAll(); - var notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_1", - text: "test_text_1", - additionalText: "test_additionalText_1" - }, - }, - id: 1, - label: "0400_1", - } - var notificationRequest2 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_2", - text: "test_text_2", - additionalText: "test_additionalText_2" - }, - }, - id: 2, - label: "0400_2", - } - await notify.publish(notificationRequest1); - console.debug("===============Ans_GetActive_0400 publish1 end==================>"); - await notify.publish(notificationRequest2); - console.debug("===============Ans_GetActive_0400 publish2 end==================>"); - var promiseData = await notify.getActiveNotifications(); - expect(promiseData.length).assertEqual(2); - var i; - for (i = 0; i < promiseData.length; i++) { - if (i == 0){ - expect(promiseData[i].content.normal.title).assertEqual("test_title_1"); - console.log("====Ans_GetActive_0400 getCallback title=====>"+promiseData[i].content.normal.title) - expect(promiseData[i].content.normal.text).assertEqual("test_text_1"); - console.log("===Ans_GetActive_0400 getCallback text========>"+promiseData[i].content.normal.text) - expect(promiseData[i].content.normal.additionalText).assertEqual("test_additionalText_1"); - console.log("Ans_GetActive_0400 getCallback text=====>"+promiseData[i].content.normal.additionalText) - expect(promiseData[i].id).assertEqual(1); - console.log("============Ans_GetActive_0400 getCallback id============>"+promiseData[i].id) - expect(promiseData[i].label).assertEqual("0400_1"); - console.log("============Ans_GetActive_0400 getCallback label=====>"+promiseData[i].label) - }else if(i == 1){ - expect(promiseData[i].content.normal.title).assertEqual("test_title_2"); - console.log("===Ans_GetActive_0400 getCallback title=========>"+promiseData[i].content.normal.title) - expect(promiseData[i].content.normal.text).assertEqual("test_text_2"); - console.log("====Ans_GetActive_0400 getCallback text============>"+promiseData[i].content.normal.text) - expect(promiseData[i].content.normal.additionalText).assertEqual("test_additionalText_2"); - console.log("Ans_GetActive_0400 getCallback text=====>"+promiseData[i].content.normal.additionalText) - expect(promiseData[i].id).assertEqual(2); - console.log("============Ans_GetActive_0400 getCallback id============>"+promiseData[i].id) - expect(promiseData[i].label).assertEqual("0400_2"); - console.log("============Ans_GetActive_0400 getCallback label=====>"+promiseData[i].label) - } - } - console.debug("===============Ans_GetActive_0400 getActiveNotifications end==================>"); - setTimeout(async function(){ - console.debug("===============Ans_GetActive_0400 done==================>"); - done(); - }, time); - }) - - /* - * @tc.number: Ans_GetActive_0500 - * @tc.name: getActiveNotifications(callback: AsyncCallback>): void; - * @tc.desc: Verify: before publishing any notifications, no active notifications can be get(callback) - */ - it('Ans_GetActive_0500', 0, async function (done) { - console.debug("===============Ans_GetActive_0500 start==================>"); - await notify.cancelAll(); - notify.getActiveNotifications((err, data)=>{ - console.log("Ans_GetActive_0500 getCallback data.length============>" + data.length); - console.log("Ans_GetActive_0500 getCallback JSON.stringify(data)============>" + JSON.stringify(data)); - expect(data.length).assertEqual(0); - setTimeout(function(){ - console.debug("===============Ans_GetActive_0500 done==================>"); - done(); - }, time); - }); - }) - - /* - * @tc.number: Ans_GetActive_0600 - * @tc.name: getActiveNotifications(): Promise>; - * @tc.desc: Verify: before publishing any notifications, no active notifications can be get(promise) - */ - it('Ans_GetActive_0600', 0, async function (done) { - console.debug("===============Ans_GetActive_0600 start==================>"); - await notify.cancelAll(); - var promiseData = await notify.getActiveNotifications(); - console.debug("===============Ans_GetActive_0600 getActiveNotifications end==================>"); - expect(promiseData.length).assertEqual(0); - console.debug("=========Ans_GetActive_0600 promiseData.length=============>"+promiseData.length); - console.debug("==Ans_GetActivcae_0600 JSON.stringify(promiseData)========>"+JSON.stringify(promiseData)); - setTimeout(function(){ - console.debug("===============Ans_GetActive_0600 done==================>"); - done(); - }, time); - }) - - function getCallbackFour(err, data){ - console.log("Ans_GetActive_0700 getCallback ============>"); - console.log("Ans_GetActive_0700 getCallback data.length============>"+data.length); - console.log("Ans_GetActive_0700 getCallback data============>"+JSON.stringify(data)); - expect(data.length).assertEqual(1); - var i; - for (i = 0; i < data.length; i++) { - expect(data[i].content.normal.title).assertEqual("test_title_2"); - console.log("==========Ans_GetActive_0700 getCallback title=========>"+data[i].content.normal.title) - expect(data[i].content.normal.text).assertEqual("test_text_2"); - console.log("==========Ans_GetActive_0700 getCallback text============>"+data[i].content.normal.text) - expect(data[i].content.normal.additionalText).assertEqual("test_additionalText_2"); - console.log("======Ans_GetActive_0700 getCallback text=======>"+data[i].content.normal.additionalText) - expect(data[i].id).assertEqual(2); - console.log("============Ans_GetActive_0700 getCallback id============>"+data[i].id) - expect(data[i].label).assertEqual("0700_2"); - console.log("============Ans_GetActive_0700 getCallback label=====>"+data[i].label) - } - } - - /* - * @tc.number: Ans_GetActive_0700 - * @tc.name: getActiveNotifications(callback: AsyncCallback>): void; - * @tc.desc: Verify: after publishing two notifications, - cancel one of the notifications, get all active notifications info(callback) - */ - it('Ans_GetActive_0700', 0, async function (done) { - console.debug("===============Ans_GetActive_0700 start==================>"); - await notify.cancelAll(); - var notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_1", - text: "test_text_1", - additionalText: "test_additionalText_1" - }, - }, - id: 1, - label: "0700_1", - } - var notificationRequest2 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_2", - text: "test_text_2", - additionalText: "test_additionalText_2" - }, - }, - id: 2, - label: "0700_2", - } - await notify.publish(notificationRequest1); - console.debug("===============Ans_GetActive_0700 publish1 end==================>"); - await notify.publish(notificationRequest2); - console.debug("===============Ans_GetActive_0700 publish2 end==================>"); - await notify.cancel(1, "0700_1"); - console.debug("===============Ans_GetActive_0700 cancel end==================>"); - notify.getActiveNotifications(getCallbackFour); - console.debug("===============Ans_GetActive_0700 getActiveNotifications end==================>"); - setTimeout(async function(){ - console.debug("===============Ans_GetActive_0700 done==================>"); - done(); - }, time); - }) - - /* - * @tc.number: Ans_GetActive_0800 - * @tc.name: getActiveNotifications(): Promise>; - * @tc.desc: Verify: after publishing two notifications, - cancel one of the notifications, get all active notifications info(promise) - */ - it('Ans_GetActive_0800', 0, async function (done) { - console.debug("===============Ans_GetActive_0800 start==================>"); - await notify.cancelAll(); - var notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_1", - text: "test_text_1", - additionalText: "test_additionalText_1" - }, - }, - id: 1, - label: "0800_1", - } - var notificationRequest2 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_2", - text: "test_text_2", - additionalText: "test_additionalText_2" - }, - }, - id: 2, - label: "0800_2", - } - await notify.publish(notificationRequest1); - console.debug("===============Ans_GetActive_0800 publish1 end==================>"); - await notify.publish(notificationRequest2); - console.debug("===============Ans_GetActive_0800 publish2 end==================>"); - await notify.cancel(1, "0800_1"); - console.debug("===============Ans_GetActive_0700 cancel end==================>"); - var promiseData = await notify.getActiveNotifications(); - var i; - for (i = 0; i < promiseData.length; i++) { - expect(promiseData[i].content.normal.title).assertEqual("test_title_2"); - console.log("======Ans_GetActive_0800 getCallback title=========>"+promiseData[i].content.normal.title) - expect(promiseData[i].content.normal.text).assertEqual("test_text_2"); - console.log("======Ans_GetActive_0800 getCallback text============>"+promiseData[i].content.normal.text) - expect(promiseData[i].content.normal.additionalText).assertEqual("test_additionalText_2"); - console.log("==Ans_GetActive_0800 getCallback text=======>"+promiseData[i].content.normal.additionalText) - expect(promiseData[i].id).assertEqual(2); - console.log("============Ans_GetActive_0800 getCallback id============>"+promiseData[i].id) - expect(promiseData[i].label).assertEqual("0800_2"); - console.log("============Ans_GetActive_0800 getCallback label=====>"+promiseData[i].label) - } - console.debug("===============Ans_GetActive_0800 getActiveNotifications end==================>"); - setTimeout(function(){ - console.debug("===============Ans_GetActive_0800 done==================>"); - done(); - }, time); - }) - - function getCallbackFive(err, data){ - console.log("Ans_GetActive_0900 getCallback ============>"); - console.log("Ans_GetActive_0900 getCallback data.length============>"+data.length); - console.log("Ans_GetActive_0900 getCallback data============>"+JSON.stringify(data)); - expect(data.length).assertEqual(0); - } - - /* - * @tc.number: Ans_GetActive_0900 - * @tc.name: getActiveNotifications(callback: AsyncCallback>): void; - * @tc.desc: Verify: after publishing two notifications, - cancel all the notifications, get all active notifications info(callback) - */ - it('Ans_GetActive_0900', 0, async function (done) { - console.debug("===============Ans_GetActive_0900 start==================>"); - await notify.cancelAll(); - var notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_1", - text: "test_text_1", - additionalText: "test_additionalText_1" - }, - }, - id: 1, - label: "0900_1", - } - var notificationRequest2 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_2", - text: "test_text_2", - additionalText: "test_additionalText_2" - }, - }, - id: 2, - label: "0900_2", - } - await notify.publish(notificationRequest1); - console.debug("===============Ans_GetActive_0900 publish1 end==================>"); - await notify.publish(notificationRequest2); - console.debug("===============Ans_GetActive_0900 publish2 end==================>"); - await notify.cancelAll(); - console.debug("===============Ans_GetActive_0900 cancelAll end==================>"); - notify.getActiveNotifications(getCallbackFive); - console.debug("===============Ans_GetActive_0900 getActiveNotifications end==================>"); - setTimeout(function(){ - console.debug("===============Ans_GetActive_0900 done==================>"); - done(); - }, time); - }) - - /* - * @tc.number: Ans_GetActive_1000 - * @tc.name: getActiveNotifications(): Promise>; - * @tc.desc: Verify: after publishing two notifications, - cancel all the notifications, get all active notifications info(promise) - */ - it('Ans_GetActive_1000', 0, async function (done) { - console.debug("===============Ans_GetActive_1000 start==================>"); - await notify.cancelAll(); - var notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_1", - text: "test_text_1", - additionalText: "test_additionalText_1" - }, - }, - id: 1, - label: "1000_1", - } - var notificationRequest2 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_2", - text: "test_text_2", - additionalText: "test_additionalText_2" - }, - }, - id: 2, - label: "1000_2", - } - await notify.publish(notificationRequest1); - console.debug("===============Ans_GetActive_1000 publish1 end==================>"); - await notify.publish(notificationRequest2); - console.debug("===============Ans_GetActive_1000 publish2 end==================>"); - await notify.cancelAll(); - console.debug("===============Ans_GetActive_1000 cancelAll end==================>"); - var promiseData = await notify.getActiveNotifications(); - console.log("Ans_GetActive_1000 getCallback data.length============>"+promiseData.length); - console.log("Ans_GetActive_1000 getCallback data============>"+JSON.stringify(promiseData)); - expect(promiseData.length).assertEqual(0); - console.debug("===============Ans_GetActive_1000 getActiveNotifications end==================>"); - setTimeout(function(){ - console.debug("===============Ans_GetActive_1000 done==================>"); - done(); - }, time); - }) - - function getCountCallback(err, count){ - console.debug("===============Ans_GetActive_1100 getNumCallback count==================>"+count); - expect(count).assertEqual(1); - } - - /* - * @tc.number: Ans_GetActive_1100 - * @tc.name: getActiveNotificationCount(callback: AsyncCallback): void; - * @tc.desc: Verify: after publishing a notification, get active notification count(callback) - */ - it('Ans_GetActive_1100', 0, async function (done) { - console.debug("===============Ans_GetActive_1100 start==================>"); - await notify.cancelAll(); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 1, - slotType : notify.SlotType.OTHER_TYPES, - deliveryTime : 1624950453, - autoDeletedTime: 1625036817, - color: 2, - statusBarText: "statusBarText", - label: "1100", - badgeIconStyle: 1, - } - await notify.publish(notificationRequest); - console.debug("===============Ans_GetActive_1100 publish end==================>"); - notify.getActiveNotificationCount(getCountCallback); - console.debug("===============Ans_GetActive_1100 getActiveNotificationCount end==================>"); - setTimeout(function(){ - console.debug("===============Ans_GetActive_1100 done==================>"); - done(); - }, time); - }) - - /* - * @tc.number: Ans_GetActive_1200 - * @tc.name: getActiveNotificationCount(): Promise; - * @tc.desc: Verify: after publishing a notification, get active notification number(promise) - */ - it('Ans_GetActive_1200', 0, async function (done) { - console.debug("===============Ans_GetActive_1200 start==================>"); - await notify.cancelAll(); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 1, - slotType : notify.SlotType.OTHER_TYPES, - deliveryTime : 1624950453, - autoDeletedTime: 1625036817, - color: 2, - statusBarText: "statusBarText", - label: "1200", - badgeIconStyle: 1, - } - await notify.publish(notificationRequest); - console.debug("===============Ans_GetActive_1200 publish end==================>"); - var promiseCount = await notify.getActiveNotificationCount(); - expect(promiseCount).assertEqual(1); - console.debug("===============Ans_GetActive_1200 promiseCount==================>"+promiseCount); - setTimeout(function(){ - console.debug("===============Ans_GetActive_1200 done==================>"); - done(); - }, time); - }) - - - function getCountCallbackTwo(err, count){ - console.debug("===============Ans_GetActive_1300 getCountCallbackTwo count==================>"+count); - expect(count).assertEqual(2); - } - - /* - * @tc.number: Ans_GetActive_1300 - * @tc.name: getActiveNotificationCount(callback: AsyncCallback): void; - * @tc.desc: Verify: after publishing two notifications, get active notification count(callback) - */ - it('Ans_GetActive_1300', 0, async function (done) { - console.debug("===============Ans_GetActive_1300 start==================>"); - await notify.cancelAll(); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 1, - slotType : notify.SlotType.OTHER_TYPES, - deliveryTime : 1624950453, - autoDeletedTime: 1625036817, - color: 2, - statusBarText: "statusBarText", - label: "1300_1", - badgeIconStyle: 1, - } - var notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 2, - slotType : notify.SlotType.OTHER_TYPES, - deliveryTime : 1624950453, - autoDeletedTime: 1625036817, - color: 2, - statusBarText: "statusBarText", - label: "1300_2", - badgeIconStyle: 1, - } - await notify.publish(notificationRequest); - console.debug("===============Ans_GetActive_1300 publish end==================>"); - await notify.publish(notificationRequest1); - console.debug("===============Ans_GetActive_1300 publish end==================>"); - notify.getActiveNotificationCount(getCountCallbackTwo); - console.debug("===============Ans_GetActive_1300 getActiveNotificationCount end==================>"); - setTimeout(function(){ - console.debug("===============Ans_GetActive_1300 done==================>"); - done(); - }, time); - }) - - /* - * @tc.number: Ans_GetActive_1400 - * @tc.name: getActiveNotificationCount(): Promise; - * @tc.desc: Verify: after publishing two notifications, get active notification number(promise) - */ - it('Ans_GetActive_1400', 0, async function (done) { - console.debug("===============Ans_GetActive_1400 start==================>"); - await notify.cancelAll(); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 1, - slotType : notify.SlotType.OTHER_TYPES, - deliveryTime : 1624950453, - autoDeletedTime: 1625036817, - color: 2, - statusBarText: "statusBarText", - label: "1400_1", - badgeIconStyle: 1, - } - var notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 2, - slotType : notify.SlotType.OTHER_TYPES, - deliveryTime : 1624950453, - autoDeletedTime: 1625036817, - color: 2, - statusBarText: "statusBarText", - label: "1400_2", - badgeIconStyle: 1, - } - await notify.publish(notificationRequest); - console.debug("===============Ans_GetActive_1400 publish1 end==================>"); - await notify.publish(notificationRequest1); - console.debug("===============Ans_GetActive_1400 publish2 end==================>"); - var promiseCount = await notify.getActiveNotificationCount(); - expect(promiseCount).assertEqual(2); - console.debug("===============Ans_GetActive_1400 promiseCount==================>"+promiseCount); - setTimeout(function(){ - console.debug("===============Ans_GetActive_1400 done==================>"); - done(); - }, time); - }) - - function getCountCallbackThree(err, count){ - console.debug("===============Ans_GetActive_1500 getCountCallbackThree count==================>"+count); - expect(count).assertEqual(0); - } - - /* - * @tc.number: Ans_GetActive_1500 - * @tc.name: getActiveNotificationCount(callback: AsyncCallback): void; - * @tc.desc: Verify: before publishing any notifications, no active notifications count can be get(callback) - */ - it('Ans_GetActive_1500', 0, async function (done) { - console.debug("===============Ans_GetActive_1500 start==================>"); - await notify.cancelAll(); - notify.getActiveNotificationCount(getCountCallbackThree); - console.debug("===============Ans_GetActive_1500 getActiveNotificationCount end==================>"); - setTimeout(function(){ - console.debug("===============Ans_GetActive_1500 done==================>"); - done(); - }, time); - }) - - /* - * @tc.number: Ans_GetActive_1600 - * @tc.name: getActiveNotificationCount(): Promise; - * @tc.desc: Verify: before publishing any notifications, no active notifications count can be get(promise) - */ - it('Ans_GetActive_1600', 0, async function (done) { - console.debug("===============Ans_GetActive_1600 start==================>"); - await notify.cancelAll(); - var promiseCount = await notify.getActiveNotificationCount(); - expect(promiseCount).assertEqual(0); - console.debug("===============Ans_GetActive_1600 promiseCount==================>"+promiseCount); - setTimeout(function(){ - console.debug("===============Ans_GetActive_1600 done==================>"); - done(); - }, time); - }) - - - function getCountCallbackFour(err, count){ - console.debug("===============Ans_GetActive_1700 getCountCallbackFour count==================>"+count); - expect(count).assertEqual(1); - } - - /* - * @tc.number: Ans_GetActive_1700 - * @tc.name: getActiveNotificationCount(callback: AsyncCallback): void; - * @tc.desc: Verify: after publishing two notifications, - cancel one of the notifications, get all active notifications count(callback) - */ - it('Ans_GetActive_1700', 0, async function (done) { - console.debug("===============Ans_GetActive_1700 start==================>"); - await notify.cancelAll(); - var notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_1", - text: "test_text_1", - additionalText: "test_additionalText_1" - }, - }, - id: 1, - label: "1700_1", - } - var notificationRequest2 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_2", - text: "test_text_2", - additionalText: "test_additionalText_2" - }, - }, - id: 2, - label: "1700_2", - } - await notify.publish(notificationRequest1); - console.debug("===============Ans_GetActive_1700 publish1 end==================>"); - await notify.publish(notificationRequest2); - console.debug("===============Ans_GetActive_1700 publish2 end==================>"); - await notify.cancel(1, "1700_1"); - console.debug("===============Ans_GetActive_1700 cancel end==================>"); - notify.getActiveNotificationCount(getCountCallbackFour); - console.debug("===============Ans_GetActive_1700 getActiveNotifications end==================>"); - setTimeout(function(){ - console.debug("===============Ans_GetActive_1700 done==================>"); - done(); - }, time); - }) - - /* - * @tc.number: Ans_GetActive_1800 - * @tc.name: getActiveNotificationCount(): Promise; - * @tc.desc: Verify: after publishing two notifications, - cancel one of the notifications, get all active notifications count(promise) - */ - it('Ans_GetActive_1800', 0, async function (done) { - console.debug("===============Ans_GetActive_1800 start==================>"); - await notify.cancelAll(); - var notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_1", - text: "test_text_1", - additionalText: "test_additionalText_1" - }, - }, - id: 1, - label: "1800_1", - } - var notificationRequest2 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_2", - text: "test_text_2", - additionalText: "test_additionalText_2" - }, - }, - id: 2, - label: "1800_2", - } - await notify.publish(notificationRequest1); - console.debug("===============Ans_GetActive_1800 publish1 end==================>"); - await notify.publish(notificationRequest2); - console.debug("===============Ans_GetActive_1800 publish2 end==================>"); - await notify.cancel(1, "1800_1"); - console.debug("===============Ans_GetActive_1800 cancel end==================>"); - var promiseCount = await notify.getActiveNotificationCount(); - expect(promiseCount).assertEqual(1); - console.debug("===============Ans_GetActive_1800 promiseCount===========>"+promiseCount); - setTimeout(function(){ - console.debug("===============Ans_GetActive_1800 done==================>"); - done(); - }, time); - }) - - function getCountCallbackFive(err, count){ - console.debug("===============Ans_GetActive_1900 getCountCallbackFour count==================>"+count); - expect(count).assertEqual(0); - } - - /* - * @tc.number: Ans_GetActive_1900 - * @tc.name: getActiveNotificationCount(callback: AsyncCallback): void; - * @tc.desc: Verify: after publishing two notifications, - cancel one of the notifications, get all active notifications count(callback) - */ - it('Ans_GetActive_1900', 0, async function (done) { - console.debug("===============Ans_GetActive_1900 start==================>"); - await notify.cancelAll(); - var notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_1", - text: "test_text_1", - additionalText: "test_additionalText_1" - }, - }, - id: 1, - label: "1900_1", - } - var notificationRequest2 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_2", - text: "test_text_2", - additionalText: "test_additionalText_2" - }, - }, - id: 2, - label: "1900_2", - } - await notify.publish(notificationRequest1); - console.debug("===============Ans_GetActive_1900 publish1 end==================>"); - await notify.publish(notificationRequest2); - console.debug("===============Ans_GetActive_1900 publish2 end==================>"); - await notify.cancelAll(cancelAllCallback); - expect(cancalAllFlag).assertEqual(false); - console.debug("===============Ans_GetActive_1900 cancel end==================>"); - await notify.getActiveNotificationCount(getCountCallbackFive); - console.debug("===============Ans_GetActive_1900 getActiveNotifications end==================>"); - setTimeout(function(){ - console.debug("===============Ans_GetActive_1900 done==================>"); - done(); - }, time); - - - }) - - /* - * @tc.number: Ans_GetActive_2000 - * @tc.name: getActiveNotificationCount(): Promise; - * @tc.desc: Verify: after publishing two notifications, - cancel one of the notifications, get all active notifications count(promise) - */ - it('Ans_GetActive_2000', 0, async function (done) { - console.debug("===============Ans_GetActive_2000 start==================>"); - await notify.cancelAll(); - var notificationRequest1 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_1", - text: "test_text_1", - additionalText: "test_additionalText_1" - }, - }, - id: 1, - label: "2000_1", - } - var notificationRequest2 = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_2", - text: "test_text_2", - additionalText: "test_additionalText_2" - }, - }, - id: 2, - label: "2000_2", - } - await notify.publish(notificationRequest1); - console.debug("===============Ans_GetActive_2000 publish1 end==================>"); - await notify.publish(notificationRequest2); - console.debug("===============Ans_GetActive_2000 publish2 end==================>"); - await notify.cancelAll(cancelAllCallback); - expect(cancalAllFlag).assertEqual(true); - console.debug("===============Ans_GetActive_2000 cancelAll end==================>"); - var promiseCount = await notify.getActiveNotificationCount(); - expect(promiseCount).assertEqual(0); - console.debug("===============Ans_GetActive_2000 promiseCount===========>"+promiseCount); - setTimeout(function(){ - console.debug("===============Ans_GetActive_2000 done==================>"); - done(); - }, time); - }) - - function getAllCallbackNine(err,data){ - console.debug("===========Ans_GetAllActive_0900 getAllCallbackNine data.length============>"+data.length); - console.debug("===========Ans_GetAllActive_0900 getAllCallbackNine err.code============>"+err.code); - expect(err.code).assertEqual(0); - } - - /* - * @tc.number: Ans_GetAllActive_0900 - * @tc.name: getAllActiveNotifications(callback: AsyncCallback>): void; - * @tc.desc: Verify: Under non system permission, after the current app publish a notification, - get all active notifications in the system(callback) - */ - it('Ans_GetAllActive_0900', 0, async function (done) { - console.debug("===============Ans_GetAllActive_0900 start==================>"); - await notify.cancelAll(); - var notificationRequestOfCurrentApp = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_currentApp", - text: "test_text_currentApp", - additionalText: "test_additionalText_currentApp" - }, - }, - id: 1, - label: "currentApp_0900", - } - await notify.publish(notificationRequestOfCurrentApp); - console.debug("===============Ans_GetAllActive_0900 publish CurrentApp notify end==================>"); - notify.getAllActiveNotifications(getAllCallbackNine); - console.debug("===============Ans_GetAllActive_0900 getAllActiveNotifications end==================>"); - setTimeout(function(){ - console.debug("===============Ans_GetAllActive_0900 done==================>"); - done(); - }, time); - }) - - /* - * @tc.number: Ans_GetAllActive_1000 - * @tc.name: getAllActiveNotifications(): Promise>; - * @tc.desc: Verify: Under non system permission, after the current app publish a notification, - get all active notifications in the system(promise) - */ - it('Ans_GetAllActive_1000', 0, async function (done) { - console.debug("===============Ans_GetAllActive_1000 start==================>"); - await notify.cancelAll(); - var notificationRequestOfCurrentApp = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_currentApp", - text: "test_text_currentApp", - additionalText: "test_additionalText_currentApp" - }, - }, - id: 1, - label: "currentApp_1000", - } - await notify.publish(notificationRequestOfCurrentApp); - console.debug("===============Ans_GetAllActive_1000 publish CurrentApp notify end==================>"); - await notify.getAllActiveNotifications().then(()=>{ - console.debug("=======Ans_GetAllActive_1000 then========>"); - expect(err.code).assertEqual(0); - }).catch((err)=>{ - console.debug("=======Ans_GetAllActive_1000 err==========>"+err.code); - }); - setTimeout(function(){ - console.debug("===============Ans_GetAllActive_1000 done==================>"); - done(); - }, time); - }) -}) - -} diff --git a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/resources/base/element/string.json deleted file mode 100644 index e1be3afb18f88c0d67a8b711abaeb8a59bc4d6a7..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetactive/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "getActive" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/getactive/actsansgetallactive/BUILD.gn b/notification/ans_standard/publish_test/getactive/actsansgetallactive/BUILD.gn deleted file mode 100644 index ba274c48ffa652a42800bc2aedb8892812f0abd8..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsAllActiveTestOne") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsAllActiveTestOne" - 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/publish_test/getactive/actsansgetallactive/Test.json b/notification/ans_standard/publish_test/getactive/actsansgetallactive/Test.json deleted file mode 100644 index 4d9b39f9da8ac867dda1c5fd8f3b23bd97b2b360..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "shell-timeout": "180000", - "bundle-name": "com.example.actsansgetallactivetest", - "package-name": "com.example.actsansgetallactivetest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsAllActiveTestOne.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/actsansgetallactive/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/getactive/actsansgetallactive/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/getactive/actsansgetallactive/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/config.json b/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/config.json deleted file mode 100644 index f3f54ddde18c4a57853262a16546291c6c1afcf7..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansgetallactivetest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansgetallactivetest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/getactive/actsansgetallactive/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 50933d90e341bfd1da4cb62c7db8e07b6de2a643..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,23 +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. - */ - -
- - currentApp - - - ForGetAllActive - -
diff --git a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/getactive/actsansgetallactive/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/getactive/actsansgetallactive/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/getactive/actsansgetallactive/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/test/List.test.js deleted file mode 100644 index 8047919c7b38ba56d9b774e0f89de871b16158b3..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsAllActiveTestOne from './getAllActive.js' -export default function testsuite() { -ActsAnsAllActiveTestOne() -} diff --git a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/test/getAllActive.js b/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/test/getAllActive.js deleted file mode 100644 index 6222636a5c0c5c7f6a23b182889327df1aacc056..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/js/test/getAllActive.js +++ /dev/null @@ -1,352 +0,0 @@ -/* - * 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 notify from '@ohos.notification' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -var time = 500 -export default function ActsAnsAllActiveTestOne() { -describe('ActsAnsAllActiveTestOne', function () { - console.info("===========ActsAnsAllActiveTestOne start====================>"); - function getAllCallback(err, data){ - console.log("Ans_GetAllActive_0100 getAllCallback ============>"); - var i; - console.log("Ans_GetAllActive_0100 getAllCallback data.length============>"+data.length); - expect(data.length).assertEqual(2); - console.log("Ans_GetAllActive_0100 getAllCallback data============>"+JSON.stringify(data)); - for (i = 0; i < data.length; i++) { - if (i == 0){ - expect(data[i].content.normal.title).assertEqual("test_title_otherApp"); - console.log("=======Ans_GetAllActive_0100 getCallback title=====>"+data[i].content.normal.title) - expect(data[i].content.normal.text).assertEqual("test_text_otherApp"); - console.log("=======Ans_GetAllActive_0100 getCallback text========>"+data[i].content.normal.text) - expect(data[i].content.normal.additionalText).assertEqual("test_additionalText_otherApp"); - console.log("===Ans_GetAllActive_0100 getCallback text====>"+data[i].content.normal.additionalText) - expect(data[i].id).assertEqual(2); - console.log("============Ans_GetAllActive_0100 getCallback id============>"+data[i].id) - expect(data[i].label).assertEqual("otherApp"); - console.log("============Ans_GetAllActive_0100 getCallback label=====>"+data[i].label) - }else if(i == 1){ - expect(data[i].content.normal.title).assertEqual("test_title_currentApp"); - console.log("======Ans_GetAllActive_0100 getCallback title=========>"+data[i].content.normal.title) - expect(data[i].content.normal.text).assertEqual("test_text_currentApp"); - console.log("==========Ans_GetAllActive_0100 getCallback text=======>"+data[i].content.normal.text) - expect(data[i].content.normal.additionalText).assertEqual("test_additionalText_currentApp"); - console.log("===Ans_GetAllActive_0100 getCallback text=====>"+data[i].content.normal.additionalText) - expect(data[i].id).assertEqual(1); - console.log("============Ans_GetAllActive_0100 getCallback id============>"+data[i].id) - expect(data[i].label).assertEqual("currentApp_0100"); - console.log("============Ans_GetAllActive_0100 getCallback label=====>"+data[i].label) - } - } - } - - /* - * @tc.number: Ans_GetAllActive_0100 - * @tc.name: getAllActiveNotifications(callback: AsyncCallback>): void; - * @tc.desc: Verify: After the current app and other apps publish two notifications, - get all active notifications in the system(callback) - */ - it('Ans_GetAllActive_0100', 0, async function (done) { - console.debug("===============Ans_GetAllActive_0100 start==================>"); - await notify.cancelAll(); - var notificationRequestOfCurrentApp = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_currentApp", - text: "test_text_currentApp", - additionalText: "test_additionalText_currentApp" - }, - }, - id: 1, - label: "currentApp_0100", - } - await notify.publish(notificationRequestOfCurrentApp); - console.debug("===============Ans_GetAllActive_0100 publish CurrentApp notify end==================>"); - notify.getAllActiveNotifications(getAllCallback); - console.debug("===============Ans_GetAllActive_0100 getAllActiveNotifications end==================>"); - setTimeout(function(){ - console.debug("===============Ans_GetAllActive_0100 setTimeout==================>"); - done(); - }, time); - }) - - /* - * @tc.number: Ans_GetAllActive_0200 - * @tc.name: getAllActiveNotifications(): Promise> - * @tc.desc: Verify: After the current app and other apps publish two notifications, - get all active notifications in the system(promise) - */ - it('Ans_GetAllActive_0200', 0, async function (done) { - console.debug("===============Ans_GetAllActive_0200 start==================>"); - await notify.cancelAll(); - var notificationRequestOfCurrentApp = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_currentApp", - text: "test_text_currentApp", - additionalText: "test_additionalText_currentApp" - }, - }, - id: 1, - label: "currentApp_0200", - } - await notify.publish(notificationRequestOfCurrentApp); - console.debug("===============Ans_GetAllActive_0200 publish CurrentApp notify end==================>"); - var promiseData = await notify.getAllActiveNotifications(); - console.debug("===============Ans_GetAllActive_0200 getActiveNotifications end==================>"); - expect(promiseData.length).assertEqual(2); - var i; - for (i = 0; i < promiseData.length; i++) { - if (i == 0){ - expect(promiseData[i].content.normal.title).assertEqual("test_title_otherApp"); - console.log("=======Ans_GetAllActive_0200 title=====>"+promiseData[i].content.normal.title) - expect(promiseData[i].content.normal.text).assertEqual("test_text_otherApp"); - console.log("=======Ans_GetAllActive_0200 text========>"+promiseData[i].content.normal.text) - expect(promiseData[i].content.normal.additionalText).assertEqual("test_additionalText_otherApp"); - console.log("===Ans_GetAllActive_0200 text====>"+promiseData[i].content.normal.additionalText) - expect(promiseData[i].id).assertEqual(2); - console.log("============Ans_GetAllActive_0200 id============>"+promiseData[i].id) - expect(promiseData[i].label).assertEqual("otherApp"); - console.log("============Ans_GetAllActive_0200 label=====>"+promiseData[i].label) - }else if(i == 1){ - expect(promiseData[i].content.normal.title).assertEqual("test_title_currentApp"); - console.log("====Ans_GetAllActive_0200 title=====>"+promiseData[i].content.normal.title) - expect(promiseData[i].content.normal.text).assertEqual("test_text_currentApp"); - console.log("======Ans_GetAllActive_0200 text=====>"+promiseData[i].content.normal.text) - expect(promiseData[i].content.normal.additionalText).assertEqual("test_additionalText_currentApp"); - console.log("Ans_GetAllActive_0200 text===>"+promiseData[i].content.normal.additionalText) - expect(promiseData[i].id).assertEqual(1); - console.log("============Ans_GetAllActive_0200 id============>"+promiseData[i].id) - expect(promiseData[i].label).assertEqual("currentApp_0200"); - console.log("============Ans_GetAllActive_0200 label=====>"+promiseData[i].label) - } - } - setTimeout(function(){ - console.debug("===============Ans_GetAllActive_0200 setTimeout==================>"); - done(); - }, time); - }) - - function getAllCallbackThree(err, data){ - console.log("Ans_GetAllActive_0300 getAllCallbackThree ============>"); - console.log("Ans_GetAllActive_0300 getAllCallbackThree data.length============>"+data.length); - console.log("Ans_GetAllActive_0300 getAllCallbackThree data============>"+JSON.stringify(data)); - expect(data.length).assertEqual(1); - var i; - for (i = 0; i < data.length; i++) { - expect(data[i].content.normal.title).assertEqual("test_title_otherApp"); - console.log("==========Ans_GetAllActive_0300 getCallback title=========>"+data[i].content.normal.title) - expect(data[i].content.normal.text).assertEqual("test_text_otherApp"); - console.log("==========Ans_GetAllActive_0300 getCallback text============>"+data[i].content.normal.text) - expect(data[i].content.normal.additionalText).assertEqual("test_additionalText_otherApp"); - console.log("======Ans_GetAllActive_0300 getCallback text=======>"+data[i].content.normal.additionalText) - expect(data[i].id).assertEqual(2); - console.log("============Ans_GetAllActive_0300 getCallback id============>"+data[i].id) - expect(data[i].label).assertEqual("otherApp"); - console.log("============Ans_GetAllActive_0300 getCallback label=====>"+data[i].label) - } - } - - /* - * @tc.number: Ans_GetAllActive_0300 - * @tc.name: getAllActiveNotifications(callback: AsyncCallback>): void; - * @tc.desc: Verify: After the current app and other apps publish two notifications, cancel the notifications - of the current app, get all active notifications in the system(callback) - */ - it('Ans_GetAllActive_0300', 0, async function (done) { - console.debug("===============Ans_GetAllActive_0300 start==================>"); - await notify.cancelAll(); - var notificationRequestOfCurrentApp = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_currentApp", - text: "test_text_currentApp", - additionalText: "test_additionalText_currentApp" - }, - }, - id: 1, - label: "currentApp_0300", - } - await notify.publish(notificationRequestOfCurrentApp); - console.debug("===============Ans_GetAllActive_0300 publish CurrentApp notify end==================>"); - await notify.cancel(1, "currentApp_0300"); - notify.getAllActiveNotifications(getAllCallbackThree); - console.debug("===============Ans_GetAllActive_0300 getAllActiveNotifications end==================>"); - setTimeout(function(){ - console.debug("===============Ans_GetAllActive_0300 setTimeout==================>"); - done(); - }, time); - }) - - /* - * @tc.number: Ans_GetAllActive_0400 - * @tc.name: getAllActiveNotifications(): Promise>; - * @tc.desc: Verify: after publishing two notifications, - cancel one of the notifications, get all active notifications info(promise) - */ - it('Ans_GetAllActive_0400', 0, async function (done) { - console.debug("===============Ans_GetAllActive_0400 start==================>"); - await notify.cancelAll(); - var notificationRequestOfCurrentApp = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_currentApp", - text: "test_text_currentApp", - additionalText: "test_additionalText_currentApp" - }, - }, - id: 1, - label: "currentApp_0400", - } - await notify.publish(notificationRequestOfCurrentApp); - console.debug("===============Ans_GetAllActive_0400 publish CurrentApp notify end==================>"); - await notify.cancel(1, "currentApp_0400"); - console.debug("===============Ans_GetAllActive_0400 cancel end==================>"); - var promiseData = await notify.getAllActiveNotifications(); - var i; - for (i = 0; i < promiseData.length; i++) { - expect(promiseData[i].content.normal.title).assertEqual("test_title_otherApp"); - console.log("=======Ans_GetAllActive_0400 title=====>"+promiseData[i].content.normal.title) - expect(promiseData[i].content.normal.text).assertEqual("test_text_otherApp"); - console.log("=======Ans_GetAllActive_0400 text========>"+promiseData[i].content.normal.text) - expect(promiseData[i].content.normal.additionalText).assertEqual("test_additionalText_otherApp"); - console.log("===Ans_GetAllActive_0400 text====>"+promiseData[i].content.normal.additionalText) - expect(promiseData[i].id).assertEqual(2); - console.log("============Ans_GetAllActive_0400 id============>"+promiseData[i].id) - expect(promiseData[i].label).assertEqual("otherApp"); - console.log("============Ans_GetAllActive_0400 label=====>"+promiseData[i].label) - } - console.debug("===============Ans_GetAllActive_0400 getAllActiveNotifications end==================>"); - setTimeout(function(){ - console.debug("===============Ans_GetAllActive_0400 setTimeout==================>"); - done(); - }, time); - }) - - function getAllCallbackFive(err, data){ - console.log("Ans_GetAllActive_0500 getAllCallbackFive data.length============>"+data.length); - console.log("Ans_GetAllActive_0500 getAllCallbackFive data============>"+JSON.stringify(data)); - expect(data.length).assertEqual(0); - } - /* - * @tc.number: Ans_GetAllActive_0500 - * @tc.name: getAllActiveNotifications(callback: AsyncCallback>): void; - * @tc.desc: Verify: After the current app and other apps publish two notifications, remove all the notifications - of the system, get all active notifications in the system(callback) - */ - it('Ans_GetAllActive_0500', 0, async function (done) { - console.debug("===============Ans_GetAllActive_0500 start==================>"); - await notify.cancelAll(); - var notificationRequestOfCurrentApp = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_currentApp", - text: "test_text_currentApp", - additionalText: "test_additionalText_currentApp" - }, - }, - id: 1, - label: "currentApp_0500", - } - await notify.publish(notificationRequestOfCurrentApp); - console.debug("===============Ans_GetAllActive_0500 publish CurrentApp notify end==================>"); - await notify.removeAll(); - notify.getAllActiveNotifications(getAllCallbackFive); - console.debug("===============Ans_GetAllActive_0500 getAllActiveNotifications end==================>"); - setTimeout(function(){ - console.debug("===============Ans_GetAllActive_0500 setTimeout==================>"); - done(); - }, time); - }) - - /* - * @tc.number: Ans_GetAllActive_0600 - * @tc.name: getAllActiveNotifications(): Promise>; - * @tc.desc: Verify: After the current app and other apps publish two notifications, remove all the notifications - of the system, get all active notifications in the system(promise) - */ - it('Ans_GetAllActive_0600', 0, async function (done) { - console.debug("===============Ans_GetAllActive_0600 start==================>"); - await notify.cancelAll(); - var notificationRequestOfCurrentApp = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_currentApp", - text: "test_text_currentApp", - additionalText: "test_additionalText_currentApp" - }, - }, - id: 1, - label: "currentApp_0600", - } - await notify.publish(notificationRequestOfCurrentApp); - console.debug("==========Ans_GetAllActive_0600 publish CurrentApp notify end==================>"); - await notify.removeAll(); - var promiseData = await notify.getAllActiveNotifications(); - expect(promiseData.length).assertEqual(0); - console.debug("=======Ans_GetAllActive_0600 promiseData.length==========>"+promiseData.length); - console.debug("=======Ans_GetAllActive_0600 promiseData==========>"+JSON.stringify(promiseData)); - setTimeout(function(){ - console.debug("===============Ans_GetAllActive_0600 setTimeout==================>"); - done(); - }, time); - }) - - function getAllCallbackSeven(err, data){ - console.log("Ans_GetAllActive_0700 getAllCallbackSeven data.length============>"+data.length); - console.log("Ans_GetAllActive_0700 getAllCallbackSeven data============>"+JSON.stringify(data)); - expect(data.length).assertEqual(0); - } - /* - * @tc.number: Ans_GetAllActive_0700 - * @tc.name: getAllActiveNotifications(callback: AsyncCallback>): void; - * @tc.desc: Verify:No active notifications in the system, get all active notifications in the system(callback) - */ - it('Ans_GetAllActive_0700', 0, async function (done) { - console.debug("===============Ans_GetAllActive_0700 start==================>"); - await notify.removeAll(); - notify.getAllActiveNotifications(getAllCallbackSeven); - console.debug("===============Ans_GetAllActive_0700 getAllActiveNotifications end==================>"); - setTimeout(function(){ - console.debug("===============Ans_GetAllActive_0700 setTimeout==================>"); - done(); - }, time); - }) - - /* - * @tc.number: Ans_GetAllActive_0800 - * @tc.name: getAllActiveNotifications(): Promise>; - * @tc.desc: Verify: No active notifications in the system, get all active notifications in the system(promise) - */ - it('Ans_GetAllActive_0800', 0, async function (done) { - console.debug("==========Ans_GetAllActive_0800 start==================>"); - await notify.removeAll(); - var promiseData = await notify.getAllActiveNotifications(); - console.debug("=========Ans_GetAllActive_0800 promiseData.length=============>"+promiseData.length); - expect(promiseData.length).assertEqual(0); - setTimeout(function(){ - console.debug("===============Ans_GetAllActive_0800 setTimeout==================>"); - done(); - }, time); - }) -}) - -} diff --git a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/resources/base/element/string.json deleted file mode 100644 index 7f71c81573e31b291ddd76d3c37c7eba4a6da7dc..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/actsansgetallactive/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "getAllActive" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/getactive/getactiveotherapp/BUILD.gn b/notification/ans_standard/publish_test/getactive/getactiveotherapp/BUILD.gn deleted file mode 100644 index d502d56eac49ced3ebda4a6bf1510898ff5276c2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactiveotherapp/BUILD.gn +++ /dev/null @@ -1,34 +0,0 @@ -# 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_hap_assist_suite("ActsAnsGetActiveOtherApp") { - hap_profile = "./entry/src/main/config.json" - hap_name = "ActsAnsGetActiveOtherApp" - subsystem_name = "notification" - part_name = "distributed_notification_service" - testonly = true - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/config.json b/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/config.json deleted file mode 100644 index efe01039421a4468084276e5747367d052de0300..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/config.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansgetactiveotherapp", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansgetactiveotherapp", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "com.example.actsansgetactiveotherapp.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/getactive/getactiveotherapp/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/default/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/default/pages/index/index.hml deleted file mode 100644 index 3195e9aa737cc1fbf99beb25548635d4508bc9be..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - otherAppForPublish - -
diff --git a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index e32f166fc6b1c4b9db2f1199b306e154d837b997..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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' -import {Core, ExpectExtend} from 'deccjsunit/index' - -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') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - this.timeout = 120000 - configService.setConfig(this) - - require('../../../test/List.test') - core.execute() - }, - onReady() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index b416327547106048167f800df4b1b79f1804376d..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "activeotherapp" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/test/List.test.js deleted file mode 100644 index 8f93037489a3bfbef3415aab8b9ff3f88501e87d..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/test/List.test.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * 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. - */ -require('./activeotherapp.js') \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/test/activeotherapp.js b/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/test/activeotherapp.js deleted file mode 100644 index ee1320ad52914d08f8784e2ba7c3c7215fdedb4d..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getactive/getactiveotherapp/entry/src/main/js/test/activeotherapp.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 notify from '@ohos.notification' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -var time = 1000 -describe('ActsAnsGetActiveOtherApp', function () { - console.info("===========ActsAnsAllActiveTestOne start====================>"); - - /* - * @tc.number: Ans_GetAllActive_0100(publish) - * @tc.name: getAllActiveNotifications(callback: AsyncCallback>): void; - * @tc.desc: Send notification as other apps. - */ - it('ActPublish_0100', 0, async function (done) { - console.debug("===============ActPublish_0100 start==================>"); - await notify.removeAll(); - var notificationRequestOfOtherApp = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title_otherApp", - text: "test_text_otherApp", - additionalText: "test_additionalText_otherApp" - }, - }, - id: 2, - label: "otherApp", - } - await notify.publish(notificationRequestOfOtherApp); - console.debug("===============ActPublish_0100 publish CurrentApp notify end==================>"); - done(); - setTimeout(async function(){ - console.debug("===============ActPublish_0100 done==================>"); - }, time); - }) - -}) - diff --git a/notification/ans_standard/publish_test/getactive/getactiveotherapp/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/getactive/getactiveotherapp/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/getactive/getactiveotherapp/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/getwantagentinfo/BUILD.gn b/notification/ans_standard/publish_test/getwantagentinfo/BUILD.gn deleted file mode 100644 index 715ab1e02b4eda746ce0498436ed9fddc2f2c2a2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsGetWantAgentInfoTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsGetWantAgentInfoTest" - 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/publish_test/getwantagentinfo/Test.json b/notification/ans_standard/publish_test/getwantagentinfo/Test.json deleted file mode 100644 index b2ebc55f8c441821abf69d693bd486d0afb53574..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "com.example.actsansgetwantagentinfotest", - "package-name": "com.example.actsansgetwantagentinfotest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsGetWantAgentInfoTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getwantagentinfo/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/getwantagentinfo/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/getwantagentinfo/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/getwantagentinfo/src/main/config.json b/notification/ans_standard/publish_test/getwantagentinfo/src/main/config.json deleted file mode 100644 index 3c669e73321dca8ad40821c514e174d8afb96694..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansgetwantagentinfotest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansgetwantagentinfotest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/getwantagentinfo/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 95d57c848c7e3460a862eefe96bd1c2381563842..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Test of Getting AgentInfo - -
diff --git a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/getwantagentinfo/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/getwantagentinfo/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/getwantagentinfo/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/test/List.test.js deleted file mode 100644 index 7f72f8983a95bd2377d7afdb0c186149a64466de..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsGetWantAgentInfoTest from './WantAgent.test.js' -export default function testsuite() { -ActsAnsGetWantAgentInfoTest() -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/test/WantAgent.test.js deleted file mode 100644 index 7f9923fb5cb89d9cd8caffba8502bb0a948ae0e1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/js/test/WantAgent.test.js +++ /dev/null @@ -1,1063 +0,0 @@ -/* - * 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 wantAgent from '@ohos.wantAgent'; - -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'; - -var WantAgenta; -var WantAgentb; -var WantAgentc; -var WantAgentd; -var WantAgente; -var time = 1000 -export default function ActsAnsGetWantAgentInfoTest() { -describe('ActsAnsGetWantAgentInfoTest', function () { - console.info('----ActsGetWantAgentInfoTest----'); - - /* - * @tc.number: ACTS_SetWantInfo_0100 - * @tc.name: getWantAgent(),getBundleName(),getUid(),getWant(),cancel() - * @tc.desc: verify the function of getWantAgent(),getBundleName(),getUid(),getWant(),cancel() - */ - it('ACTS_SetWantInfo_0100', 0, async function (done) { - console.info('----ACTS_SetWantInfo_0100----'); - var agentInfoa = { - wants: [ - { - bundleName: "com.example.WantAgentTest", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - } - wantAgent.getWantAgent(agentInfoa, - (err, data) => { - if (err.code == 0) { - WantAgenta = data; - console.info('----getWantAgenta success!----'+data); - expect(typeof(data)).assertEqual("object"); - - wantAgent.getBundleName(data, - (err1, data1) => { - if (err1.code == 0) { - console.info('----getBundleNameA success!----'+err.code+data1); - expect(typeof(data1)).assertEqual('string') - } else { - console.info('----getBundleNameA failed!----'); - } - } - ); - wantAgent.getUid(data, - (err2, data2) => { - if (err2.code == 0) { - console.info('----getUidA success!----'+err.code+data2); - expect(typeof(data2)).assertEqual('number') - } else { - console.info('----getUidA failed!----'); - } - } - ); - wantAgent.getWant(data,(err3, data3) => { - if (err3.code == 0) { - console.info('----getWantA success!----'+err.code+data3); - expect(typeof(data3)).assertEqual('object') - } else { - console.info('----getWantA failed!----'); - } - }); - wantAgent.cancel(data,(err)=>{ - console.info("========cancelA========"+err.code) - }); - } else { - console.info('----getWantAgenta failed!----'+err.code+data); - expect(typeof(data)).assertEqual("object"); - } - done(); - }), - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_0100====>"); - }, time); - console.info('----getWantAgenta after----'); - }) - - /* - * @tc.number: ACTS_SetWantInfo_0200 - * @tc.name: getWantAgent(),getBundleName(),getUid(),getWant(),cancel() - * @tc.desc: verify the function of getWantAgent(),getBundleName(),getUid(),getWant(),cancel() promise - */ - it('ACTS_SetWantInfo_0200', 0, async function (done) { - var agentInfod = { - wants: [ - { - bundleName: "com.example.WantAgentTest", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - } - wantAgent.getWantAgent(agentInfod).then( - (data) => { - console.info('----getWantAgent Promise success!----'+data); - expect(typeof(data)).assertEqual("object"); - wantAgent.getBundleName(data).then( - (data1) => { - console.info('----getBcanundleName Promise success!----'+data1); - expect(typeof(data1)).assertEqual('string') - } - ); - wantAgent.getUid(data).then( - (data2) => { - console.info('----getUid Promise success!----'+data2); - expect(typeof(data2)).assertEqual('number') - } - ); - wantAgent.getWant(data).then( - (data3) => { - console.info('----getWant Promise success!----'+data3); - console.info('Want = ' + data3); - expect(typeof(data3)).assertEqual('object') - } - ); - wantAgent.cancel(data).then( - console.info("========cancelPromise========") - ); - }) - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_0200====>"); - }, time) - }) - - /* - * @tc.number: ACTS_SetWantInfo_0300 - * @tc.name: equal(normal) - * @tc.desc: verify the function of equal(normal)Callback - */ - it('ACTS_SetWantInfo_0300', 0, async function (done) { - var agentInfob = { - wants: [ - { - bundleName: "bundleName", - abilityName: "abilityName", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - } - wantAgent.getWantAgent(agentInfob,(err,data)=>{ - WantAgentb = data - }) - - var agentInfoc = { - wants: [ - { - bundleName: "com.example.WantAgentTest", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - } - setTimeout(function(){ - wantAgent.getWantAgent(agentInfoc, - (err, data) => { - if (err.code == 0) { - WantAgentc = data; - console.log("=======WantAgentb======="+JSON.stringify(WantAgentb)) - console.log("=======WantAgentc======="+JSON.stringify(WantAgentc)) - expect(typeof(data)).assertEqual("object"); - wantAgent.equal(WantAgentb,WantAgentc, - (error,data) => { - if(error.code == 0) { - console.info('----equala success!----'+data) - expect(typeof(data)).assertEqual("boolean"); - expect(data).assertEqual(false); - } - else{ - console.info('----equala failed!----') - } - } - ) - wantAgent.equal(WantAgentb,WantAgentb, - (error,data) => { - if(error.code == 0) { - console.info('----equalb success!----'+data) - expect(typeof(data)).assertEqual("boolean"); - expect(data).assertEqual(true); - } - else{ - console.info('----equalb failed!----') - } - } - ) - } - else{ - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_0300====>"); - done(); - }, time); - }); - }, 1000); - - }) - - /* - * @tc.number: ACTS_SetWantInfo_0400 - * @tc.name: equal(normal) - * @tc.desc: verify the function of equal(normal) promise - */ - it('ACTS_SetWantInfo_0400', 0, async function (done) { - var agentInfoe = { - wants: [ - { - bundleName: "bundleName", - abilityName: "abilityName", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - } - wantAgent.getWantAgent(agentInfoe,(err,data)=>{ - console.log("=======agentInfoe======="+err.code+JSON.stringify(data)) - WantAgentd = data - }) - - var agentInfof = { - wants: [ - { - bundleName: "com.example.WantAgentTest", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - } - setTimeout(function(){ - wantAgent.getWantAgent(agentInfof, - (err, data) => { - console.log("=======agentInfof======="+err.code+JSON.stringify(data)) - if (err.code == 0) { - WantAgente = data; - console.log("=======WantAgente======="+JSON.stringify(WantAgentd)) - console.log("=======WantAgentf======="+JSON.stringify(WantAgente)) - wantAgent.equal(WantAgentd,WantAgente).then( - (data) => { - console.info('----equalc success!----'+data) - expect(typeof(data)).assertEqual("boolean"); - expect(data).assertEqual(false); - } - ) - wantAgent.equal(WantAgentd,WantAgentd).then( - (data) => { - console.info('----equald success!----'+data) - expect(typeof(data)).assertEqual("boolean"); - expect(data).assertEqual(true); - } - ) - } - else{ - console.info('----getWantAgent failed!----'+err.code+data); - } - - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_0400====>"); - done(); - }, time); - }); - }, 1000); - }) - - /* - * @tc.number: ACTS_SetWantInfo_0500 - * @tc.name: equal(),cancel() - * @tc.desc: verify the function of equal(),cancel() promise - */ - it('ACTS_SetWantInfo_0500', 0, async function (done) { - var agentInfoe = { - wants: [ - { - bundleName: "$%^%^%&^%&", - abilityName: "$%^&%&*^&*^", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - } - wantAgent.getWantAgent(agentInfoe,(err,data)=>{ - WantAgentd = data - }) - - var agentInfof = { - wants: [ - { - bundleName: "com.neu.WantAgentTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - } - setTimeout(function(){ - wantAgent.getWantAgent(agentInfof, - (err, data) => { - if (err.code == 0) { - WantAgente = data; - console.log("=======WantAgente======="+JSON.stringify(WantAgentd)) - console.log("=======WantAgentf======="+JSON.stringify(WantAgente)) - expect(typeof(data)).assertEqual("object"); - wantAgent.equal(WantAgentd,WantAgente).then( - (data) => { - console.info('----equale success!----'+data) - expect(typeof(data)).assertEqual("boolean"); - } - ) - wantAgent.cancel(WantAgentd).then( - console.info("========cancelPromise========") - ); - wantAgent.equal(WantAgentd,WantAgente).then( - (data) => { - console.info('----equalf success!----'+data) - expect(typeof(data)).assertEqual("boolean"); - } - ) - wantAgent.equal(WantAgentd,WantAgentd).then( - (data) => { - console.info('----equalg success!----'+data) - expect(typeof(data)).assertEqual("boolean"); - } - ) - } - else{ - console.info('----getWantAgent failed!----'+err.code); - } - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_0500====>"); - }, time); - }); - }, 1000); - }) - - /* - * @tc.number: ACTS_SetWantInfo_0600 - * @tc.name: equal() - * @tc.desc: verify the function of equal("$%$%^$%^","$%$%^$%^")callback - */ - it('ACTS_SetWantInfo_0600', 0, async function (done) { - wantAgent.equal("$%$%^$%^","$%$%^$%^", - (error,data) => { - if(error.code == 0) { - console.info('----equalh success!----'+data) - expect(typeof(data)).assertEqual("boolean"); - } - else{ - console.info('----equalh failed!----') - } - } - ) - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_0600====>"); - }, time); - }); - - /* - * @tc.number: ACTS_SetWantInfo_0700 - * @tc.name: equal() - * @tc.desc: verify the function of equal("$%$%^$%^","$%$%^$%^")promise - */ - it('ACTS_SetWantInfo_0700', 0, async function (done) { - wantAgent.equal("$%$%^$%^","$%$%^$%^").then((error, data)=>{ - if(error.code) { - expect(error.code).assertEqual(-1) - } - }) - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_0700====>"); - }, time); - }); - - /* - * @tc.number: ACTS_SetWantInfo_0800 - * @tc.name: equal() - * @tc.desc: verify the function of equal({},{})callback - */ - it('ACTS_SetWantInfo_0800', 0, async function (done) { - wantAgent.equal({},{}, - (err,data) => { - console.info('----equalj success!----'+err.code+data) - expect(typeof(data)).assertEqual("boolean"); - } - ) - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_0800====>"); - }, time); - }); - - /* - * @tc.number: ACTS_SetWantInfo_0900 - * @tc.name: equal() - * @tc.desc: verify the function of equal({},{})promise - */ - it('ACTS_SetWantInfo_0900', 0, async function (done) { - wantAgent.equal({},{}).then((error, data)=>{ - if(error.code) { - expect(error.code).assertEqual(-1) - } - }) - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_0900====>"); - }, time); - }); - - /* - * @tc.number: ACTS_SetWantInfo_1000 - * @tc.name: equal() - * @tc.desc: verify the function of equal(100,100)callback - */ - it('ACTS_SetWantInfo_1000', 0, async function (done) { - wantAgent.equal(100,100, - (err,data) => { - console.info('----equalm success!----'+err.code+data) - expect(typeof(data)).assertEqual("boolean"); - } - ) - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_1000====>"); - }, time); - }); - - /* - * @tc.number: ACTS_SetWantInfo_1100 - * @tc.name: equal() - * @tc.desc: verify the function of equal(100,100)promise - */ - it('ACTS_SetWantInfo_1100', 0, async function (done) { - wantAgent.equal(100,100).then((error, data)=>{ - if(error.code) { - expect(error.code).assertEqual(-1) - } - }) - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_1100====>"); - }, time); - }); - - /* - * @tc.number: ACTS_SetWantInfo_1200 - * @tc.name: getWantAgent() - * @tc.desc: verify the function of getWantAgent("")callback - */ - it('ACTS_SetWantInfo_1200', 0, async function (done) { - console.info('----ACTS_SetWantInfo_0300 begin----'); - wantAgent.getWantAgent("",(err,data) => { - console.log("===getWantAgenta==="+err.code+data)}) - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_1200====>"); - }, time); - }) - - /* - * @tc.number: ACTS_SetWantInfo_1300 - * @tc.name: getWantAgent() - * @tc.desc: verify the function of getWantAgent("")promise - */ - it('ACTS_SetWantInfo_1300', 0, async function (done) { - console.info('----ACTS_SetWantInfo_0300 begin----'); - wantAgent.getWantAgent("").then((error, data)=>{ - if(error.code) { - expect(error.code).assertEqual(-1) - } - }) - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_1300====>"); - }, time); - }) - - /* - * @tc.number: ACTS_SetWantInfo_1400 - * @tc.name: getBundleName() - * @tc.desc: verify the function of getBundleName("")callback - */ - it('ACTS_SetWantInfo_1400', 0, async function (done) { - wantAgent.getBundleName("",(err,data) => { - console.info('----getBundleNamea success!----'+err.code+data); - expect(typeof(data)).assertEqual('string')}); - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_1400====>"); - }, time); - }) - - /* - * @tc.number: ACTS_SetWantInfo_1500 - * @tc.name: getBundleName() - * @tc.desc: verify the function of getBundleName("")promise - */ - it('ACTS_SetWantInfo_1500', 0, async function (done) { - wantAgent.getBundleName("").then((error, data)=>{ - if(error.code) { - expect(error.code).assertEqual(-1) - } - }) - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_1500====>"); - }, time); - }) - - /* - * @tc.number: ACTS_SetWantInfo_1600 - * @tc.name: getUid() - * @tc.desc: verify the function of getUid("")callback - */ - it('ACTS_SetWantInfo_1600', 0, async function (done) { - wantAgent.getUid("",(err,data) => { - console.info('----getUida success!----'+err.code+data); - expect(typeof(data)).assertEqual('number')}); - done() - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_1600====>"); - }, time); - }) - - /* - * @tc.number: ACTS_SetWantInfo_1700 - * @tc.name: getUid() - * @tc.desc: verify the function of getUid("")promise - */ - it('ACTS_SetWantInfo_1700', 0, async function (done) { - wantAgent.getUid("").then((error, data)=>{ - if(error.code) { - expect(error.code).assertEqual(-1) - } - }) - done() - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_1700====>"); - }, time); - }) - - /* - * @tc.number: ACTS_SetWantInfo_1800 - * @tc.name: getWant() - * @tc.desc: verify the function of getWant("")callback - */ - it('ACTS_SetWantInfo_1800', 0, async function (done) { - wantAgent.getWant("",(err,data) => { - console.info('----getWanta success!----'+err.code+data); - expect(typeof(data)).assertEqual('object') - }); - done() - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_1800====>"); - }, time); - }) - - /* - * @tc.number: ACTS_SetWantInfo_1900 - * @tc.name: getWant() - * @tc.desc: verify the function of getWant("")promise - */ - it('ACTS_SetWantInfo_1900', 0, async function (done) { - wantAgent.getWant("").then((error, data)=>{ - if(error.code) { - expect(error.code).assertEqual(-1) - } - }) - done() - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_1900====>"); - }, time); - }) - - /* - * @tc.number: ACTS_SetWantInfo_2000 - * @tc.name: getWantAgent() - * @tc.desc: verify the function of getWantAgent(100)callback - */ - it('ACTS_SetWantInfo_2000', 0, async function (done) { - console.info('----ACTS_SetWantInfo_1000 begin----'); - wantAgent.getWantAgent(100,(err,data) => { - console.log('----getWantAgenta success!----'+err.code+data) - }) - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_2000====>"); - }, time); - }) - - /* - * @tc.number: ACTS_SetWantInfo_2100 - * @tc.name: getWantAgent() - * @tc.desc: verify the function of getWantAgent(100)promises - */ - it('ACTS_SetWantInfo_2100', 0, async function (done) { - wantAgent.getWantAgent(100).then((error, data)=>{ - if(error.code) { - expect(error.code).assertEqual(-1) - } - }) - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_2100====>"); - }, time); - }) - - /* - * @tc.number: ACTS_SetWantInfo_2200 - * @tc.name: getBundleName() - * @tc.desc: verify the function of getBundleName(100)callback - */ - it('ACTS_SetWantInfo_2200', 0, async function (done) { - wantAgent.getBundleName(100,(err,data) => { - console.info('----getBundleNamec success!----'+err.code+data); - expect(typeof(data)).assertEqual('string') - }); - done() - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_2200====>"); - }, time); - }) - - /* - * @tc.number: ACTS_SetWantInfo_2300 - * @tc.name: getBundleName() - * @tc.desc: verify the function of getBundleName(100)promise - */ - it('ACTS_SetWantInfo_2300', 0, async function (done) { - wantAgent.getBundleName(100).then((error, data)=>{ - if(error.code) { - expect(error.code).assertEqual(-1) - } - }) - done() - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_2300====>"); - }, time); - }) - - /* - * @tc.number: ACTS_SetWantInfo_2400 - * @tc.name: getUid() - * @tc.desc: verify the function of getUid(100)callback - */ - it('ACTS_SetWantInfo_2400', 0, async function (done) { - wantAgent.getUid(100,(err,data) => { - console.info('----getUidc success!----'+err.code+data); - }); - done() - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_2400====>"); - }, time); - }) - - /* - * @tc.number: ACTS_SetWantInfo_2500 - * @tc.name: getUid() - * @tc.desc: verify the function of getUid(100)promise - */ - it('ACTS_SetWantInfo_2500', 0, async function (done) { - wantAgent.getUid(100).then((error, data)=>{ - if(error.code) { - expect(error.code).assertEqual(-1) - } - }) - done() - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_2500====>"); - }, time); - }) - - /* - * @tc.number: ACTS_SetWantInfo_2600 - * @tc.name: getWant() - * @tc.desc: verify the function of getWant(100)callback - */ - it('ACTS_SetWantInfo_2600', 0, async function (done) { - wantAgent.getWant(100,(err,data) => { - console.info('----getWantc success!----'+err.code+data); - expect(typeof(data)).assertEqual('object') - }); - done() - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_2600====>"); - }, time); - }) - - /* - * @tc.number: ACTS_SetWantInfo_2700 - * @tc.name: getWant() - * @tc.desc: verify the function of getWant(100)promise - */ - it('ACTS_SetWantInfo_2700', 0, async function (done) { - wantAgent.getWant(100).then((error, data)=>{ - if(error.code) { - expect(error.code).assertEqual(-1) - } - }) - done() - setTimeout(function(){ - console.debug("====>time out ACTS_SetWantInfo_2700====>"); - }, time); - }) - - /* - * @tc.number: ACTS_SetWantInfo_2800 - * @tc.name: getWantAgent() - * @tc.desc: verify the function of getWantAgent({})callback - */ - it('ACTS_SetWantInfo_2800', 0, async function (done) { - console.info('----ACTS_SetWantInfo_2800 begin----'); - wantAgent.getWantAgent({},(err,data) => { - console.log("----getWantAgentc success!----"+err.code+data) - }) - done(); - }) - - /* - * @tc.number: ACTS_SetWantInfo_2900 - * @tc.name: getWantAgent() - * @tc.desc: verify the function of getWantAgent({})promise - */ - it('ACTS_SetWantInfo_2900', 0, async function (done) { - console.info('----ACTS_SetWantInfo_2900 begin----'); - wantAgent.getWantAgent({}).then((data)=>{ - console.log("----getWantAgentd success!----"+data) - expect(data).assertEqual("object") - }) - done(); - }) - - /* - * @tc.number: ACTS_SetWantInfo_3000 - * @tc.name: getBundleName() - * @tc.desc: verify the function of getBundleName({})callback - */ - it('ACTS_SetWantInfo_3000', 0, async function (done) { - wantAgent.getBundleName({},(err,data) => { - console.info('----getBundleNamee success!----'+err.code+data); - expect(typeof(data)).assertEqual('string') - }); - done() - }) - - /* - * @tc.number: ACTS_SetWantInfo_3100 - * @tc.name: getBundleName() - * @tc.desc: verify the function of getBundleName({})promise - */ - it('ACTS_SetWantInfo_3100', 0, async function (done) { - wantAgent.getBundleName({}).then((error, data)=>{ - if(error.code) { - expect(error.code).assertEqual(-1) - } - }) - done() - }) - - /* - * @tc.number: ACTS_SetWantInfo_3200 - * @tc.name: getUid() - * @tc.desc: verify the function of getUid({})callback - */ - it('ACTS_SetWantInfo_3200', 0, async function (done) { - wantAgent.getUid({},(err,data) => { - console.info('----getUide success!----'+err.code+data); - }); - done() - }) - - /* - * @tc.number: ACTS_SetWantInfo_3300 - * @tc.name: getUid() - * @tc.desc: verify the function of getUid({})promise - */ - it('ACTS_SetWantInfo_3300', 0, async function (done) { - wantAgent.getUid({}).then((error, data)=>{ - if(error.code) { - expect(error.code).assertEqual(-1) - } - }) - done() - }) - - /* - * @tc.number: ACTS_SetWantInfo_3400 - * @tc.name: getWant() - * @tc.desc: verify the function of getWant({})callback - */ - it('ACTS_SetWantInfo_3400', 0, async function (done) { - wantAgent.getWant({},(err,data) => { - console.info('----getWante success!----'+err.code+data); - }); - done() - }) - - /* - * @tc.number: ACTS_SetWantInfo_3500 - * @tc.name: getWant() - * @tc.desc: verify the function of getWant({})promise - */ - it('ACTS_SetWantInfo_3500', 0, async function (done) { - wantAgent.getWant({}).then((error, data)=>{ - if(error.code) { - expect(error.code).assertEqual(-1) - } - }) - done() - }) - - /* - * @tc.number: ACTS_SetWantInfo_3600 - * @tc.name: cancel() - * @tc.desc: verify the function of cancel({})callback - */ - it('ACTS_SetWantInfo_3600', 0, async function (done) { - wantAgent.cancel({},(err,data) => { - console.info('----cancela success!----'+err.code+data); - }); - done() - }) - - /* - * @tc.number: ACTS_SetWantInfo_3700 - * @tc.name: cancel() - * @tc.desc: verify the function of cancel({})promise - */ - it('ACTS_SetWantInfo_3700', 0, async function (done) { - wantAgent.cancel({}).then((error, data)=>{ - if(error.code) { - expect(error.code).assertEqual(-1) - } - }) - done() - }) - - /* - * @tc.number: ACTS_SetWantInfo_3800 - * @tc.name: cancel() - * @tc.desc: verify the function of cancel(100)callback - */ - it('ACTS_SetWantInfo_3800', 0, async function (done) { - wantAgent.cancel(100,(err) => { - console.info('----cancelc success!----'+err.code); - }); - done() - }) - - /* - * @tc.number: ACTS_SetWantInfo_3900 - * @tc.name: cancel() - * @tc.desc: verify the function of cancel(100)promise - */ - it('ACTS_SetWantInfo_3900', 0, async function (done) { - wantAgent.cancel(100).then((error, data)=>{ - if(error.code) { - expect(error.code).assertEqual(-1) - } - }) - done() - }) - - /* - * @tc.number: ACTS_SetWantInfo_4000 - * @tc.name: getWant() - * @tc.desc: verify the function of cancel("")callback - */ - it('ACTS_SetWantInfo_4000', 0, async function (done) { - wantAgent.cancel("",(err) => { - console.info('----cancele success!----'+err.code); - }); - done() - }) - - /* - * @tc.number: ACTS_SetWantInfo_4100 - * @tc.name: cancel() - * @tc.desc: verify the function of cancel("")promise - */ - it('ACTS_SetWantInfo_4100', 0, async function (done) { - wantAgent.cancel("").then((error, data)=>{ - if(error.code) { - expect(error.code).assertEqual(-1) - } - }) - done() - }) - - /* - * @tc.number: ACTS_SetWantInfo_4200 - * @tc.name: cancel() - * @tc.desc: verify the function of cancel("%^%^%^")callback - */ - it('ACTS_SetWantInfo_4200', 0, async function (done) { - wantAgent.cancel("%^%^%^",(err) => { - console.info('----cancelg success!----'+err.code); - }); - done() - }) - - /* - * @tc.number: ACTS_SetWantInfo_4300 - * @tc.name: cancel() - * @tc.desc: verify the function of cancel("%^%^%^")promise - */ - it('ACTS_SetWantInfo_4300', 0, async function (done) { - wantAgent.cancel("%^%^%^").then((error, data)=>{ - if(error.code) { - expect(error.code).assertEqual(-1) - } - }) - done() - }) -}) - - -} diff --git a/notification/ans_standard/publish_test/getwantagentinfo/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/getwantagentinfo/src/main/resources/base/element/string.json deleted file mode 100644 index a39207ead4b88047d694c44847f2476d27c358d4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/getwantagentinfo/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "AgentInfo" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/publish/BUILD.gn b/notification/ans_standard/publish_test/publish/BUILD.gn deleted file mode 100644 index 8efa587562507a09d7949e1ef0a85354dd4dd3bb..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsNotificationPublishXts") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsNotificationPublishTest" - 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/publish_test/publish/Test.json b/notification/ans_standard/publish_test/publish/Test.json deleted file mode 100644 index a1121d5e661637c27ce941a2f1f206083c1615bf..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "shell-timeout": "180000", - "bundle-name": "com.example.actsanspublishtest", - "package-name": "com.example.actsanspublishtest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsNotificationPublishTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publish/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/publish/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/publish/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/publish/src/main/config.json b/notification/ans_standard/publish_test/publish/src/main/config.json deleted file mode 100644 index 8d951bae417945e2888194944a269dd43a863f0a..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanspublishtest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanspublishtest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/publish/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/publish/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/publish/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/publish/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publish/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/publish/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publish/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/publish/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/publish/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/publish/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 6d94c7966669bab00cdd140fe2a72e0a0c2c4be8..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Publishing ICON Notifiction - -
diff --git a/notification/ans_standard/publish_test/publish/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/publish/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/publish/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/publish/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/publish/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/publish/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publish/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/publish/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publish/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/publish/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/publish/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/publish/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/publish/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/publish/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/publish/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/publish/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/publish/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/publish/src/main/js/test/List.test.js deleted file mode 100644 index 39c51da6d6061193e1c019823eed8f7fd956f22a..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsNotificationPublishXts from './publish.js' -export default function testsuite() { -ActsAnsNotificationPublishXts() -} diff --git a/notification/ans_standard/publish_test/publish/src/main/js/test/publish.js b/notification/ans_standard/publish_test/publish/src/main/js/test/publish.js deleted file mode 100644 index ecb31758c4c2d685ce3b45032cd632b349c1dc57..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/src/main/js/test/publish.js +++ /dev/null @@ -1,2394 +0,0 @@ -/* -* 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 notify from '@ohos.notification' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -var timeout = 1000; -export default function ActsAnsNotificationPublishXts() { -describe('ActsAnsNotificationPublishXts', function () { - console.info("===========ActsAnsNotificationPublish start====================>"); - function onConsumeA(data) { - console.info("===ACTS_PublishMULTILINEContent_0100 onConsume start===>"); - console.info("===ACTS_PublishMULTILINEContent_0100 onConsume data:===>" + JSON.stringify(data)); - expect(data.request.label).assertEqual("ACTS_PublishMULTILINEContent_0100"); - expect(data.request.creatorUserId).assertEqual(100); - console.info("===ACTS_PublishMULTILINEContent_0100 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishMULTILINEContent_xts_0100 - * @tc.name: function publish(request: NotificationRequest, callback: AsyncCallback): void; - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_MULTILINE) - */ - it('ACTS_PublishMULTILINEContent_xts_0100', 0, async function (done) { - console.info("===ACTS_PublishMULTILINEContent_0100 start===>"); - var subscriber ={ - onConsume:onConsumeA - } - await notify.subscribe(subscriber); - console.info("===========ACTS_PublishMULTILINEContent_0100 subscribe promise=======>"); - var notificationRequest = { - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_MULTILINE, - multiLine: { - title: "test1_title", - text: "test1_text", - additionalText: "test1_additionalText", - briefText: "briefText1", - longTitle: "longTitle1", - lines: ["thrive", "democracy", "civilization", "harmonious"] - }, - }, - id: 1, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishMULTILINEContent_0100", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest,(err)=>{ - console.info("===ACTS_PublishMULTILINEContent_0100 err===>"+err.code); - }); - setTimeout((async function(){ - console.info("===ACTS_PublishMULTILINEContent_0100 setTimeout===>"); - await notify.unsubscribe(subscriber); - console.info("===ACTS_PublishMULTILINEContent_0100 setTimeout unsubscribe===>"); - done(); - }),timeout); - }) - - function onConsumeB(data) { - console.info("===ACTS_PublishMULTILINEContent_0200 onConsume start===>"); - console.info("===ACTS_PublishMULTILINEContent_0200 onConsume data:===>" + JSON.stringify(data)); - console.info("===ACTS_PublishMULTILINEContent_0200 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishMULTILINEContent_xts_0200 - * @tc.name: function publish(request: NotificationRequest, callback: AsyncCallback): void; - * @tc.desc: verify the function of publish() - */ - it('ACTS_PublishMULTILINEContent_xts_0200', 0, async function (done) { - console.info("===ACTS_PublishMULTILINEContent_0200 start===>"); - var subscriber ={ - onConsume:onConsumeB - } - await notify.subscribe(subscriber); - console.info("===ACTS_PublishMULTILINEContent_0200 subscribe promise===>"); - var notificationRequest = { - content:{ -// contentType: notify.ContentType.NOTIFICATION_CONTENT_MULTILINE, - multiLine: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText", - briefText: "briefText", - longTitle: "longTitle", - lines: ["thrive", "democracy", "civilization", "harmonious"] - }, - }, - id: 2, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishMULTILINEContent_0200", - badgeIconStyle: 1, - showDeliveryTime: true, - } - try { - await notify.publish(notificationRequest, (err) => { - console.info("===ACTS_PublishMULTILINEContent_0200 err===>" + err.code); - }); - }catch(err){ - console.info("===ACTS_PublishMULTILINEContent_0200 err===>" + err.code); - } - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("===ACTS_PublishMULTILINEContent_0200 setTimeout unsubscribe end===>"); - done(); - }),timeout); - }) - - function onConsumeC(data) { - console.info("===ANS_Publish_0300 onConsume start===>"); - console.info("===ANS_Publish_0300 onConsume data:===>" + JSON.stringify(data)); - console.info("===ANS_Publish_0300 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishMULTILINEContent_xts_0300 - * @tc.name: function publish(request: NotificationRequest, callback: AsyncCallback): void; - * @tc.desc: verify the function of publish() - */ - it('ACTS_PublishMULTILINEContent_xts_0300', 0, async function (done) { - console.info("===============ACTS_PublishMULTILINEContent_0300 start==========================>"); - var subscriber ={ - onConsume:onConsumeC - } - await notify.subscribe(subscriber); - console.info("===============ACTS_PublishMULTILINEContent_0300 subscribe promise===============>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_PICTURE, - multiLine: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText", - briefText: "briefText", - longTitle: "longTitle", - lines: ["thrive", "democracy", "civilization", "harmonious"] - }, - }, - id: 3, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishMULTILINEContent_0300", - badgeIconStyle: 1, - showDeliveryTime: true, - } - try { - await notify.publish(notificationRequest, (err) => { - console.info("==========ACTS_PublishMULTILINEContent_0300 err==================>" + err.code); - }); - }catch(err){ - console.info("==========ACTS_PublishMULTILINEContent_0300 err==================>" + err.code); - } - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishMULTILINEContent_0300 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - }) - - function onConsumeD(data) { - console.info("===ACTS_PublishMULTILINEContent_0400 onConsume===>"); - console.info("===ACTS_PublishMULTILINEContent_0400 onConsume data:===>" + JSON.stringify(data)); - expect(data.request.label).assertEqual("ACTS_PublishMULTILINEContent_0400"); - console.info("===ACTS_PublishMULTILINEContent_0400 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishMULTILINEContent_xts_0400 - * @tc.name: function publish(request: NotificationRequest): Promise; - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_MULTILINE) promise - */ - it('ACTS_PublishMULTILINEContent_xts_0400', 0, async function (done) { - console.info("===============ACTS_PublishMULTILINEContent_0400 start==========================>"); - var subscriber ={ - onConsume:onConsumeD - } - await notify.subscribe(subscriber); - console.info("================ACTS_PublishMULTILINEContent_0400 subscribe promise=============>"); - var notificationRequest = { - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_MULTILINE, - multiLine: { - title: "test4_title", - text: "test4_text", - additionalText: "test4_additionalText", - briefText: "briefText4", - longTitle: "longTitle4", - lines: ["thrive", "democracy", "civilization", "harmonious"] - }, - }, - id: 4, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishMULTILINEContent_0400", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(console.info("======ACTS_PublishMULTILINEContent_0400 promise==================>")); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishMULTILINEContent_0400 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - - }) - - function onConsumeE(data) { - console.info("===ACTS_PublishMULTILINEContent_0500 onConsume start===>"); - console.info("===ACTS_PublishMULTILINEContent_0500 onConsume data:===>" + JSON.stringify(data)); - console.info("===ACTS_PublishMULTILINEContent_0500 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishMULTILINEContent_xts_0500 - * @tc.name: function publish(request: NotificationRequest): Promise; - * @tc.desc: function publish(request: NotificationRequest): Promise; - */ - it('ACTS_PublishMULTILINEContent_xts_0500', 0, async function (done) { - console.info("============ACTS_PublishMULTILINEContent_0500 start==================>"); - var subscriber ={ - onConsume:onConsumeE - } - await notify.subscribe(subscriber); - console.info("============ACTS_PublishMULTILINEContent_0500 subscribe promise======>"); - var notificationRequest = { - content: { -// contentType: notify.ContentType.NOTIFICATION_CONTENT_MULTILINE, - multiLine: { - title: "test5_title", - text: "test5_text", - additionalText: "test5_additionalText", - briefText: "briefText5", - longTitle: "longTitle5", - lines: ["thrive", "democracy", "civilization", "harmonious"] - }, - }, - id: 5, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishMULTILINEContent_0500", - badgeIconStyle: 1, - showDeliveryTime: true, - } - try{ - await notify.publish(notificationRequest) - }catch(err){ - console.info("======ACTS_PublishMULTILINEContent_0500 err==================>"+err.code); - } - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishMULTILINEContent_0500 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - }) - - function onConsumeF(data) { - console.info("===ACTS_PublishMULTILINEContent_0600 onConsume start===>"); - console.info("===ACTS_PublishMULTILINEContent_0600 onConsume data===>" + JSON.stringify(data)); - console.info("===ACTS_PublishMULTILINEContent_0600 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishMULTILINEContent_xts_0600 - * @tc.name: cancelAll(): Promise; - * @tc.desc: Verify that all notifications are cancelled successfully by calling the - cancelAll(): Promise interface, and then cancel the notification again - */ - it('ACTS_PublishMULTILINEContent_xts_0600', 0, async function (done) { - console.info("===============ACTS_PublishMULTILINEContent_0600 start==========================>"); - var subscriber ={ - onConsume:onConsumeF - } - await notify.subscribe(subscriber); - console.info("==================ACTS_PublishMULTILINEContent_0600 subscribe promise==================>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_PICTURE, - multiLine: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText", - briefText: "briefText", - longTitle: "longTitle", - lines: ["thrive", "democracy", "civilization", "harmonious"] - }, - }, - id: 6, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishMULTILINEContent_0600", - badgeIconStyle: 1, - showDeliveryTime: true, - } - try { - await notify.publish(notificationRequest); - }catch(err){ - console.info("==================ACTS_PublishMULTILINEContent_0600 err==================>"+err.code); - } - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishMULTILINEContent_0600 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - }) - - function onConsumeG(data) { - console.info("===ACTS_PublishLONGContent_0100 onConsume start===>"); - console.info("===ACTS_PublishLONGContent_0100 onConsume data: ===>" + JSON.stringify(data)); - expect(data.request.label).assertEqual("ACTS_PublishLONGContent_0100"); - console.info("===ACTS_PublishLONGContent_0100 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishLONGContent_xts_0100 - * @tc.name: function publish(request: NotificationRequest, callback: AsyncCallback): void; - * @tc.desc: function publish(request: NotificationRequest, callback: AsyncCallback): void; - */ - it('ACTS_PublishLONGContent_xts_0100', 0, async function (done) { - console.info("===============ACTS_PublishLONGContent_0100 start==========================>"); - var subscriber ={ - onConsume:onConsumeG - } - await notify.subscribe(subscriber); - console.info("========ACTS_PublishLONGContent_0100 subscribe promise==================>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, - longText: { - title: "test7_title", - text: "test7_text", - additionalText: "test7_additionalText", - longText:"longText7", - briefText:"briefText7", - expandedTitle:"expandedTitle7" - }, - }, - id: 7, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishLONGContent_0100", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest,(err)=>{ - console.info("===========ACTS_PublishLONGContent_0100 err==================>"+err.code); - }); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishLONGContent_0100 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - }) - - function onConsumeH(data) { - console.info("===ACTS_PublishLONGContent_0200 onConsume start===>"); - console.info("===ACTS_PublishLONGContent_0200 onConsume data:===>" + JSON.stringify(data)); - console.info("===ACTS_PublishLONGContent_0200 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishLONGContent_xts_0200 - * @tc.name: function publish(request: NotificationRequest, callback: AsyncCallback): void; - * @tc.desc: function publish(request: NotificationRequest, callback: AsyncCallback): void; - */ - it('ACTS_PublishLONGContent_xts_0200', 0, async function (done) { - console.info("===============ACTS_PublishLONGContent_0200 start==========================>"); - var subscriber ={ - onConsume:onConsumeH - } - await notify.subscribe(subscriber); - console.info("==================ACTS_PublishLONGContent_0200 subscribe promise==================>"); - var notificationRequest = { - content:{ -// contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, - longText: { - title: "test8_title", - text: "test8_text", - additionalText: "test8_additionalText", - longText:"longText8", - briefText:"briefText8", - expandedTitle:"expandedTitle8" - }, - }, - id: 8, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishLONGContent_0200", - badgeIconStyle: 1, - showDeliveryTime: true, - } - try{ - await notify.publish(notificationRequest,(err)=>{ - console.info("=========ACTS_PublishLONGContent_0200 err==================>"+err.code); - }); - }catch(err){ - console.info("=========ACTS_PublishLONGContent_0200 err==================>"+err.code); - } - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishLONGContent_0200 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - }) - - function onConsumeI(data) { - console.info("===ACTS_PublishLONGContent_0300 onConsume start===>"); - console.info("===ACTS_PublishLONGContent_0300 onConsume data:===>" + JSON.stringify(data)); - console.info("===ACTS_PublishLONGContent_0300 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishLONGContent_xts_0300 - * @tc.name: function publish(request: NotificationRequest, callback: AsyncCallback): void; - * @tc.desc: function publish(request: NotificationRequest, callback: AsyncCallback): void; - */ - it('ACTS_PublishLONGContent_xts_0300', 0, async function (done) { - console.info("===============ACTS_PublishLONGContent_0300 start==========================>"); - var subscriber ={ - onConsume:onConsumeI - } - await notify.subscribe(subscriber); - console.info("==================ACTS_PublishLONGContent_0300 subscribe promise==================>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_MEDIA, - longText: { - title: "test9_title", - text: "test9_text", - additionalText: "test9_additionalText", - longText:"longText9", - briefText:"briefText9", - expandedTitle:"expandedTitle9" - }, - }, - id: 9, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishLONGContent_0300", - badgeIconStyle: 1, - showDeliveryTime: true, - } - try { - await notify.publish(notificationRequest,(err)=>{ - console.info("==================ACTS_PublishLONGContent_0300 err==================>"+err.code); - }); - }catch(err){ - console.info("==================ACTS_PublishLONGContent_0300 err==================>"+err.code); - } - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishLONGContent_0300 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - }) - - function onConsumeJ(data) { - console.info("===ACTS_PublishLONGContent_0400 onConsume start===>"); - console.info("===ACTS_PublishLONGContent_0400 onConsume data:===>" + JSON.stringify(data)); - expect(data.request.label).assertEqual("ACTS_PublishLONGContent_0400"); - console.info("===ACTS_PublishLONGContent_0400 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishLONGContent_xts_0400 - * @tc.name: cancel(id: number, callback: AsyncCallback): void; - * @tc.desc: Verify that when the cancel(id: number, callback: AsyncCallback): void - interface is called, when the id is wrong, no notification information is cancelled at this time - */ - it('ACTS_PublishLONGContent_xts_0400', 0, async function (done) { - console.info("===============ACTS_PublishLONGContent_0400 start==========================>"); - var subscriber ={ - onConsume:onConsumeJ - } - await notify.subscribe(subscriber); - console.info("================ACTS_PublishLONGContent_0400 subscribe promise==================>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, - longText: { - title: "test10_title", - text: "test10_text", - additionalText: "test10_additionalText", - longText:"longText10", - briefText:"briefText10", - expandedTitle:"expandedTitle10" - }, - }, - id: 10, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishLONGContent_0400", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("===========ACTS_PublishLONGContent_0400 publish promise==================>"); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishLONGContent_0400 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - }) - - function onConsumeK(data) { - console.info("===ACTS_PublishLONGContent_0500 onConsume start===>"); - console.info("===ACTS_PublishLONGContent_0500 onConsume data:===>" + JSON.stringify(data)); - console.info("===ACTS_PublishLONGContent_0500 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishLONGContent_xts_0500 - * @tc.name: cancel(id: number, callback: AsyncCallback): void; - * @tc.desc: Verify the success of canceling the notification with the notification attribute isUnremovable - being true by calling the cancel(id: number, callback: AsyncCallback): void interface - */ - it('ACTS_PublishLONGContent_xts_0500', 0, async function (done) { - console.info("===============ACTS_PublishLONGContent_0500 start==========================>"); - var subscriber ={ - onConsume:onConsumeK - } - await notify.subscribe(subscriber); - console.info("===============ACTS_PublishLONGContent_0500 subscribe promise=============>"); - var notificationRequest = { - content:{ -// contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, - longText: { - title: "test11_title", - text: "test11_text", - additionalText: "test11_additionalText", - longText:"longText11", - briefText:"briefText11", - expandedTitle:"expandedTitle11" - }, - }, - id: 11, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishLONGContent_0500", - badgeIconStyle: 1, - showDeliveryTime: true, - } - try { - await notify.publish(notificationRequest); - }catch(err){ - console.info("============ACTS_PublishLONGContent_0500 err===========>"+err.code); - } - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishLONGContent_0500 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - }) - - function onConsumeL(data) { - console.info("===ACTS_PublishLONGContent_0600 onConsume start===>"); - console.info("===ACTS_PublishLONGContent_0600 onConsume data:===>" + JSON.stringify(data)); - console.info("===ACTS_PublishLONGContent_0600 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishLONGContent_xts_0600 - * @tc.name: cancel(id: number, callback: AsyncCallback): void; - * @tc.desc: Verify that the cancel(id: number, callback: AsyncCallback): void - interface is called twice in a row to cancel the notification - */ - it('ACTS_PublishLONGContent_xts_0600', 0, async function (done) { - console.info("=============ACTS_PublishLONGContent_0600 start==========================>"); - var subscriber ={ - onConsume:onConsumeL - } - await notify.subscribe(subscriber); - console.info("=============ACTS_PublishLONGContent_0600 subscribe promise==================>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_MEDIA, - longText: { - title: "test12_title", - text: "test12_text", - additionalText: "test12_additionalText", - longText:"longText12", - briefText:"briefText12", - expandedTitle:"expandedTitle12" - }, - }, - id: 12, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishLONGContent_0600", - badgeIconStyle: 1, - showDeliveryTime: true, - } - try { - await notify.publish(notificationRequest); - }catch(err){ - console.info("========ACTS_PublishLONGContent_0600 err=================>"+err.code); - } - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishLONGContent_0600 setTimeout unsubscribe end==================>"); - done(); - }),1500); - }) - - function onConsumeM(data) { - console.info("===ANS_Cancel_1300 onConsume start===>"); - console.info("===ANS_Cancel_1300 onConsume data:===>" + JSON.stringify(data)); - expect(data.request.label).assertEqual("ACTS_Publish_SlotTypeContent_0100"); - console.info("===ANS_Cancel_1300 onConsume end===>"); - } - - /* - * @tc.number: ACTS_Publish_SlotTypeContent_xts_0100 - * @tc.name: cancel(id: number, label: string, callback: AsyncCallback): void; - * @tc.desc: Verify that the cancel notification is successful by calling the - cancel(id: number, label: string, callback: AsyncCallback): void; interface - */ - it('ACTS_Publish_SlotTypeContent_xts_0100', 0, async function (done) { - console.info("===ACTS_Publish_SlotTypeContent_0100 start===>"); - var subscriber ={ - onConsume:onConsumeM - } - await notify.subscribe(subscriber); - console.info("===ACTS_Publish_SlotTypeContent_0100 subscribe promise===>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 13, - slotType : notify.SlotType.CONTENT_INFORMATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_Publish_SlotTypeContent_0100", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest,(err)=>{ - console.info("===ACTS_Publish_SlotTypeContent_0100 err===>"+err.code); - }); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("===ACTS_Publish_SlotTypeContent_0100 setTimeout unsubscribe end===>"); - done(); - }),timeout); - }) - - function onConsumeN(data) { - console.info("===ACTS_Publish_SlotTypeContent_0200 onConsume start===>"); - console.info("===ACTS_Publish_SlotTypeContent_0200 onConsume data:===>" + JSON.stringify(data)); - console.info("===ACTS_Publish_SlotTypeContent_0200 onConsume end===>"); - } - - /* - * @tc.number: ACTS_Publish_SlotTypeContent_xts_0200 - * @tc.name: cancel(id: number, label?: string): Promise - * @tc.desc: Verify that the cancel notification is successful by calling the - cancel(id: number, label?: string): Promise interface - */ - it('ACTS_Publish_SlotTypeContent_xts_0200', 0, async function (done) { - console.info("===============ACTS_Publish_SlotTypeContent_0200 start==========================>"); - var subscriber ={ - onConsume:onConsumeN - } - await notify.subscribe(subscriber); - console.info("==========ACTS_Publish_SlotTypeContent_0200 subscribe promise==================>"); - var notificationRequest = { - content:{ -// contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 14, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_Publish_SlotTypeContent_0200", - badgeIconStyle: 1, - showDeliveryTime: true, - } - try { - await notify.publish(notificationRequest,(err)=>{ - console.info("===============ACTS_Publish_SlotTypeContent_0200 err==============>"+err.code); - }); - }catch(err){ - console.info("===============ACTS_Publish_SlotTypeContent_0200 err==============>"+err.code); - } - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_Publish_SlotTypeContent_0200 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - }) - - function onConsumeO(data) { - console.info("===ACTS_Publish_SlotTypeContent_0300 onConsume start===>"); - console.info("===ACTS_Publish_SlotTypeContent_0300 onConsume data:===>" + JSON.stringify(data)); - console.info("===ACTS_Publish_SlotTypeContent_0300 onConsume end===>"); - } - - /* - * @tc.number: ACTS_Publish_SlotTypeContent_xts_0300 - * @tc.name: cancel(id: number, label: string, callback: AsyncCallback): void - * @tc.desc: Verify that the notification whose notification property isUnremovable is true is canceled - successfully by calling the cancel(id: number, label: string, callback: AsyncCallback): void interface - */ - it('ACTS_Publish_SlotTypeContent_xts_0300', 0, async function (done) { - console.info("===============ACTS_Publish_SlotTypeContent_0300 start==========================>"); - var subscriber ={ - onConsume:onConsumeO - } - await notify.subscribe(subscriber); - console.info("=======ACTS_Publish_SlotTypeContent_0300 subscribe promise==================>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 15, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_Publish_SlotTypeContent_0300", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest,(err)=>{ - console.info("===========ACTS_Publish_SlotTypeContent_0300 publish promise=============>"+err.code); - }); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_Publish_SlotTypeContent_0300 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - }) - - function onConsumeP(data) { - console.info("===ACTS_Publish_SlotTypeContent_0400 onConsume start===>"); - console.info("===ACTS_Publish_SlotTypeContent_0400 onConsume data:===>" + JSON.stringify(data)); - expect(data.request.label).assertEqual("ACTS_Publish_SlotTypeContent_0400"); - console.info("===ACTS_Publish_SlotTypeContent_0400 onConsume end===>"); - } - - /* - * @tc.number: ACTS_Publish_SlotTypeContent_xts_0400 - * @tc.name: cancel(id: number, label?: string): Promise - * @tc.desc: Verify that the notification whose notification property isUnremovable is true - is canceled successfully by calling the cancel(id: number, label?: string): Promise interface - */ - it('ACTS_Publish_SlotTypeContent_xts_0400', 0, async function (done) { - console.info("===ACTS_Publish_SlotTypeContent_0400 start===>"); - var subscriber ={ - onConsume:onConsumeP - } - await notify.subscribe(subscriber); - console.info("===ACTS_Publish_SlotTypeContent_0400 subscribe promise===>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 16, - slotType : notify.SlotType.SERVICE_INFORMATION, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_Publish_SlotTypeContent_0400", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest,(err)=>{ - console.info("===ACTS_Publish_SlotTypeContent_0400 err===>"+err.code); - }); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("===ACTS_Publish_SlotTypeContent_0400 setTimeout unsubscribe end===>"); - done(); - }),timeout); - }) - - function onConsumeQ(data) { - console.info("===ACTS_Publish_SlotTypeContent_0500 onConsume start===>"); - console.info("===ACTS_Publish_SlotTypeContent_0500 onConsume data:===>" + JSON.stringify(data)); - expect(data.request.label).assertEqual("ACTS_Publish_SlotTypeContent_0500"); - console.info("===ACTS_Publish_SlotTypeContent_0500 onConsume end===>"); - } - - /* - * @tc.number: ACTS_Publish_SlotTypeContent_xts_0500 - * @tc.name: cancel(id: number, label: string, callback: AsyncCallback): void; - * @tc.desc: Verify that the cancel(id: number, label: string, callback: AsyncCallback): void - interface is called, the label is wrong and the ID is correct. - */ - it('ACTS_Publish_SlotTypeContent_xts_0500', 0, async function (done) { - console.info("===============ACTS_Publish_SlotTypeContent_0500 start==========================>"); - var subscriber ={ - onConsume:onConsumeQ - } - await notify.subscribe(subscriber); - console.info("==============ACTS_Publish_SlotTypeContent_0500 subscribe promise==================>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 17, - slotType : notify.SlotType.CONTENT_INFORMATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_Publish_SlotTypeContent_0500", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("==============ACTS_Publish_SlotTypeContent_0500 publish promise==================>"); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_Publish_SlotTypeContent_0500 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - }) - - function onConsumeR(data) { - console.info("===ACTS_Publish_SlotTypeContent_0600 onConsume start===>"); - console.info("===ACTS_Publish_SlotTypeContent_0600 onConsume data:===>" + JSON.stringify(data)); - console.info("===ACTS_Publish_SlotTypeContent_0600 onConsume end===>"); - } - - /* - * @tc.number: ACTS_Publish_SlotTypeContent_xts_0600 - * @tc.name: cancel(id: number, label?: string): Promise - * @tc.desc: Verify that the cancel(id: number, label?: string): Promise interface is called, - the label is wrong and the ID is correct. - */ - it('ACTS_Publish_SlotTypeContent_xts_0600', 0, async function (done) { - console.info("===============ACTS_Publish_SlotTypeContent_0600 start==========================>"); - var subscriber ={ - onConsume:onConsumeR - } - await notify.subscribe(subscriber); - console.info("==============ACTS_Publish_SlotTypeContent_0600 subscribe promise==================>"); - var notificationRequest = { - content:{ -// contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 18, - slotType : notify.SlotType.CONTENT_INFORMATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_Publish_SlotTypeContent_0600", - badgeIconStyle: 1, - showDeliveryTime: true, - } - try { - await notify.publish(notificationRequest); - }catch(err){ - console.info("===ACTS_Publish_SlotTypeContent_0600 publish promise===>"+err.code); - } - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_Publish_SlotTypeContent_0600 setTimeout unsubscribe end===>"); - done(); - }),timeout); - }) - - function onConsumeS(data) { - console.info("===ACTS_Publish_SlotTypeContent_0700 onConsume start===>"); - console.info("===ACTS_Publish_SlotTypeContent_0700 onConsume data:===>" + JSON.stringify(data)); - expect(data.request.label).assertEqual("ACTS_Publish_SlotTypeContent_0700"); - console.info("===ACTS_Publish_SlotTypeContent_0700 onConsume end===>"); - } - - /* - * @tc.number: ACTS_Publish_SlotTypeContent_xts_0700 - * @tc.name: cancel(id: number, label: string, callback: AsyncCallback): void; - * @tc.desc: Verify that the cancel(id: number, label: string, callback: AsyncCallback): void - interface is called, and the label uses empty characters - */ - it('ACTS_Publish_SlotTypeContent_xts_0700', 0, async function (done) { - console.info("===============ACTS_Publish_SlotTypeContent_0700 start==========================>"); - var subscriber ={ - onConsume:onConsumeS - } - await notify.subscribe(subscriber); - console.info("=============ACTS_Publish_SlotTypeContent_0700 subscribe promise==================>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 19, -// slotType : notify.SlotType.CONTENT_INFORMATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_Publish_SlotTypeContent_0700", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("==========ACTS_Publish_SlotTypeContent_0700 publish promise==============>"); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_Publish_SlotTypeContent_0700 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - }) - - function onConsumeT(data) { - console.info("===ACTS_Publish_SlotTypeContent_0800 onConsume start===>"); - console.info("===ACTS_Publish_SlotTypeContent_0800 onConsume data:===>" + JSON.stringify(data)); - expect(data.request.label).assertEqual("ACTS_Publish_SlotTypeContent_0800"); - console.info("===ACTS_Publish_SlotTypeContent_0800 onConsume end===>"); - } - - /* - * @tc.number: ACTS_Publish_SlotTypeContent_xts_0800 - * @tc.name: cancel(id: number, label?: string): Promise; - * @tc.desc: Verify that the cancel(id: number, label?: string): Promise interface is called, - and the label uses empty characters - */ - it('ACTS_Publish_SlotTypeContent_xts_0800', 0, async function (done) { - console.info("===============ACTS_Publish_SlotTypeContent_0800 start==========================>"); - var subscriber ={ - onConsume:onConsumeT - } - await notify.subscribe(subscriber); - console.info("=========ACTS_Publish_SlotTypeContent_0800 subscribe promise==================>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 20, - slotType : notify.SlotType.SERVICE_INFORMATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_Publish_SlotTypeContent_0800", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("============ACTS_Publish_SlotTypeContent_0800 publish promise===============>"); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_Publish_SlotTypeContent_0800 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - }) - - function onConsumeU(data) { - console.info("===ACTS_PublishSlotTypeOther_0100 onConsume start===>"); - console.info("===ACTS_PublishSlotTypeOther_0100 onConsume data:===>" + JSON.stringify(data)); - expect(data.request.label).assertEqual("ACTS_PublishSlotTypeOther_0100"); - console.info("===ACTS_PublishSlotTypeOther_0100 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeOther_xts_0100 - * @tc.name: cancel(id: number, label: string, callback: AsyncCallback): void; - * @tc.desc: Verify that the cancel notification is successful by calling the - cancel(id: number, label: string, callback: AsyncCallback): void; interface - */ - it('ACTS_PublishSlotTypeOther_xts_0100', 0, async function (done) { - console.info("===ACTS_PublishSlotTypeOther_0100 start===>"); - var subscriber ={ - onConsume:onConsumeU - } - await notify.subscribe(subscriber); - console.info("===ACTS_PublishSlotTypeOther_0100 subscribe promise===>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 13, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishSlotTypeOther_0100", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest,(err)=>{ - console.info("===ACTS_PublishSlotTypeOther_0100 err===>"+err.code); - }); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("===ACTS_PublishSlotTypeOther_0100 setTimeout unsubscribe end===>"); - done(); - }),timeout); - }) - - function onConsumeV(data) { - console.info("===ACTS_PublishSlotTypeOther_0200 onConsume start===>"); - console.info("===ACTS_PublishSlotTypeOther_0200 onConsume data:===>" + JSON.stringify(data)); - console.info("===ACTS_PublishSlotTypeOther_0200 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeOther_xts_0200 - * @tc.name: cancel(id: number, label?: string): Promise - * @tc.desc: Verify that the cancel notification is successful by calling the - cancel(id: number, label?: string): Promise interface - */ - it('ACTS_PublishSlotTypeOther_xts_0200', 0, async function (done) { - console.info("===============ACTS_PublishSlotTypeOther_0200 start==========================>"); - var subscriber ={ - onConsume:onConsumeV - } - await notify.subscribe(subscriber); - console.info("==========ACTS_PublishSlotTypeOther_0200 subscribe promise==================>"); - var notificationRequest = { - content:{ - // contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 14, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishSlotTypeOther_0200", - badgeIconStyle: 1, - showDeliveryTime: true, - } - try { - await notify.publish(notificationRequest,(err)=>{ - console.info("===============ACTS_PublishSlotTypeOther_0200 err==============>"+err.code); - }); - }catch(err){ - console.info("===============ACTS_PublishSlotTypeOther_0200 err==============>"+err.code); - } - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeOther_0200 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - }) - - function onConsumeW(data) { - console.info("===ACTS_PublishSlotTypeOther_0300 onConsume start===>"); - console.info("===ACTS_PublishSlotTypeOther_0300 onConsume data:===>" + JSON.stringify(data)); - console.info("===ACTS_PublishSlotTypeOther_0300 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeOther_xts_0300 - * @tc.name: cancel(id: number, label: string, callback: AsyncCallback): void - * @tc.desc: Verify that the notification whose notification property isUnremovable is true is canceled - successfully by calling the cancel(id: number, label: string, callback: AsyncCallback): void interface - */ - it('ACTS_PublishSlotTypeOther_xts_0300', 0, async function (done) { - console.info("===============ACTS_PublishSlotTypeOther_0300 start==========================>"); - var subscriber ={ - onConsume:onConsumeW - } - await notify.subscribe(subscriber); - console.info("=======ACTS_PublishSlotTypeOther_0300 subscribe promise==================>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 15, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishSlotTypeOther_0300", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest,(err)=>{ - console.info("===========ACTS_PublishSlotTypeOther_0300 err=============>"+err.code); - }); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeOther_0300 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - }) - - function onConsumeX(data) { - console.info("===ACTS_PublishSlotTypeOther_0400 onConsume start===>"); - console.info("===ACTS_PublishSlotTypeOther_0400 onConsume data:===>" + JSON.stringify(data)); - expect(data.request.label).assertEqual("ACTS_PublishSlotTypeOther_0400"); - console.info("===ACTS_PublishSlotTypeOther_0400 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeOther_xts_0400 - * @tc.name: cancel(id: number, label?: string): Promise - * @tc.desc: Verify that the notification whose notification property isUnremovable is true - is canceled successfully by calling the cancel(id: number, label?: string): Promise interface - */ - it('ACTS_PublishSlotTypeOther_xts_0400', 0, async function (done) { - console.info("===ACTS_PublishSlotTypeOther_0400 start===>"); - var subscriber ={ - onConsume:onConsumeX - } - await notify.subscribe(subscriber); - console.info("===ACTS_PublishSlotTypeOther_0400 subscribe promise===>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 16, - slotType : notify.SlotType.SERVICE_INFORMATION, - isOngoing : true, - isUnremovable : true, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishSlotTypeOther_0400", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest,(err)=>{ - console.info("===ACTS_PublishSlotTypeOther_0400 err===>"+err.code); - }); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("===ACTS_PublishSlotTypeOther_0400 setTimeout unsubscribe end===>"); - done(); - }),timeout); - }) - - function onConsumeY(data) { - console.info("===ACTS_PublishSlotTypeOther_0500 onConsume start===>"); - console.info("===ACTS_PublishSlotTypeOther_0500 onConsume data:===>" + JSON.stringify(data)); - expect(data.request.label).assertEqual("ACTS_PublishSlotTypeOther_0500"); - console.info("===ACTS_PublishSlotTypeOther_0500 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeOther_xts_0500 - * @tc.name: cancel(id: number, label: string, callback: AsyncCallback): void; - * @tc.desc: Verify that the cancel(id: number, label: string, callback: AsyncCallback): void - interface is called, the label is wrong and the ID is correct. - */ - it('ACTS_PublishSlotTypeOther_xts_0500', 0, async function (done) { - console.info("===============ACTS_PublishSlotTypeOther_0500 start==========================>"); - var subscriber ={ - onConsume:onConsumeY - } - await notify.subscribe(subscriber); - console.info("==============ACTS_PublishSlotTypeOther_0500 subscribe promise==================>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 17, - slotType : notify.SlotType.CONTENT_INFORMATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishSlotTypeOther_0500", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("==============ACTS_PublishSlotTypeOther_0500 publish promise==================>"); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeOther_0500 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - }) - - function onConsumeZ(data) { - console.info("===ACTS_PublishSlotTypeOther_0600 onConsume start===>"); - console.info("===ACTS_PublishSlotTypeOther_0600 onConsume data:===>" + JSON.stringify(data)); - console.info("===ACTS_PublishSlotTypeOther_0600 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeOther_xts_0600 - * @tc.name: cancel(id: number, label?: string): Promise - * @tc.desc: Verify that the cancel(id: number, label?: string): Promise interface is called, - the label is wrong and the ID is correct. - */ - it('ACTS_PublishSlotTypeOther_xts_0600', 0, async function (done) { - console.info("===============ACTS_PublishSlotTypeOther_0600 start==========================>"); - var subscriber ={ - onConsume:onConsumeZ - } - await notify.subscribe(subscriber); - console.info("==============ACTS_PublishSlotTypeOther_0600 subscribe promise==================>"); - var notificationRequest = { - content:{ - // contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 18, - slotType : notify.SlotType.CONTENT_INFORMATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishSlotTypeOther_0600", - badgeIconStyle: 1, - showDeliveryTime: true, - } - try { - await notify.publish(notificationRequest); - }catch(err){ - console.info("===ACTS_PublishSlotTypeOther_0600 publish promise===>"+err.code); - } - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeOther_0600 setTimeout unsubscribe end===>"); - done(); - }),timeout); - }) - - function onConsumea(data) { - console.info("===ACTS_PublishSlotTypeOther_0700 onConsume start===>"); - console.info("===ACTS_PublishSlotTypeOther_0700 onConsume data:===>" + JSON.stringify(data)); - expect(data.request.label).assertEqual("ACTS_PublishSlotTypeOther_0700"); - console.info("===ACTS_PublishSlotTypeOther_0700 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeOther_xts_0700 - * @tc.name: cancel(id: number, label: string, callback: AsyncCallback): void; - * @tc.desc: Verify that the cancel(id: number, label: string, callback: AsyncCallback): void - interface is called, and the label uses empty characters - */ - it('ACTS_PublishSlotTypeOther_xts_0700', 0, async function (done) { - console.info("===============ACTS_PublishSlotTypeOther_0700 start==========================>"); - var subscriber ={ - onConsume:onConsumea - } - await notify.subscribe(subscriber); - console.info("=============ACTS_PublishSlotTypeOther_0700 subscribe promise==================>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 19, - // slotType : notify.SlotType.CONTENT_INFORMATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishSlotTypeOther_0700", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("==========ACTS_PublishSlotTypeOther_0700 publish promise==============>"); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeOther_0700 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - }) - - function onConsumeb(data) { - console.info("===ACTS_PublishSlotTypeOther_0800 onConsume start===>"); - console.info("===ACTS_PublishSlotTypeOther_0800 onConsume data:===>" + JSON.stringify(data)); - expect(data.request.label).assertEqual("ACTS_PublishSlotTypeOther_0800"); - console.info("===ACTS_PublishSlotTypeOther_0800 onConsume end===>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeOther_xts_0800 - * @tc.name: cancel(id: number, label?: string): Promise; - * @tc.desc: Verify that the cancel(id: number, label?: string): Promise interface is called, - and the label uses empty characters - */ - it('ACTS_PublishSlotTypeOther_xts_0800', 0, async function (done) { - console.info("===============ACTS_PublishSlotTypeOther_0800 start==========================>"); - var subscriber ={ - onConsume:onConsumeb - } - await notify.subscribe(subscriber); - console.info("=========ACTS_PublishSlotTypeOther_0800 subscribe promise==================>"); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 20, - slotType : notify.SlotType.SERVICE_INFORMATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "ACTS_PublishSlotTypeOther_0800", - badgeIconStyle: 1, - showDeliveryTime: true, - } - await notify.publish(notificationRequest); - console.info("============ACTS_PublishSlotTypeOther_0800 publish promise===============>"); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeOther_0800 setTimeout unsubscribe end==================>"); - done(); - }),timeout); - }) - function publishSlotSocialCallback001(error){ - console.log('=========ACTS_PublishSlotTypeSocial_0100 publish callback==========>'+JSON.stringify(error.code)); - } - function onConsume0100(data){ - console.info("===========ACTS_PublishSlotTypeSocial_0100 onConsume start===========>"); - console.info("===========ACTS_PublishSlotTypeSocial_0100 onConsume data:===========>" + JSON.stringify(data)); - expect(data.request.content.normal.title).assertEqual("test37_title"); - console.info("===========ACTS_PublishSlotTypeSocial_0100 onConsume end=============>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeSocial_xts_0100 - * @tc.name: publish() - * @tc.desc: verify publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:SOCIAL_COMMUNICATION) - */ - it('ACTS_PublishSlotTypeSocial_xts_0100', 0,async function (done) { - console.info("===============ACTS_PublishSlotTypeSocial_0100================>"); - var subscriber ={ - onConsume:onConsume0100 - } - await notify.subscribe(subscriber); - console.info("===============ACTS_PublishSlotTypeSocial_0100 subscribe======>"); - await notify.publish({ - id: 37, - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test37_title", - text: "test37_text", - additionalText: "test37_additionalText" - }, - slotType:notify.SlotType.SOCIAL_COMMUNICATION - } - },publishSlotSocialCallback001); - console.info("==========ACTS_PublishSlotTypeSocial_0100 publish======>"); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeSocial_0100 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function publishSlotSocialCallback002(error){ - console.log('=========ACTS_PublishSlotTypeSocial_0200 publish callback==========>'+JSON.stringify(error.code)); - } - - function onConsume0200(data){ - console.info("===========ACTS_PublishSlotTypeSocial_0200 onConsume start===========>"); - console.info("===========ACTS_PublishSlotTypeSocial_0200 onConsume data:===========>" + JSON.stringify(data)); - expect().assertFail(); - console.info("===========ACTS_PublishSlotTypeSocial_0200 onConsume end=============>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeSocial_xts_0200 - * @tc.name: publish() - * @tc.desc: verify the function of publish(slotType:SOCIAL_COMMUNICATION) - */ - it('ACTS_PublishSlotTypeSocial_xts_0200', 0,async function (done) { - console.info("===============ACTS_PublishSlotTypeSocial_0200================>"); - var subscriber ={ - onConsume:onConsume0200 - } - await notify.subscribe(subscriber); - try { - await notify.publish({ - id: 38, - content: { - // contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - slotType: notify.SlotType.SOCIAL_COMMUNICATION - } - }, publishSlotSocialCallback002); - }catch(err){ - console.info("==========ACTS_PublishSlotTypeSocial_0200 publish======>"+err.code); - } - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeSocial_0200 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function publishSlotSocialCallback003(error){ - console.log('=========ACTS_PublishSlotTypeSocial_0300 publish callback==========>'+JSON.stringify(error.code)); - } - - function onConsume0300(data){ - console.info("===========ACTS_PublishSlotTypeSocial_0300 onConsume start===========>"); - console.info("===========ACTS_PublishSlotTypeSocial_0300 onConsume data:===========>" + JSON.stringify(data)); - expect(data.request.content.normal.title).assertEqual("test39_title"); - console.info("===========ACTS_PublishSlotTypeSocial_0300 onConsume end=============>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeSocial_xts_0300 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT) - */ - it('ACTS_PublishSlotTypeSocial_xts_0300', 0,async function (done) { - console.info("===============ACTS_PublishSlotTypeSocial_0300================>"); - var subscriber ={ - onConsume:onConsume0300 - } - await notify.subscribe(subscriber); - await notify.publish({ - id: 39, - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test39_title", - text: "test39_text", - additionalText: "test39_additionalText" - }, - // slotType:notification.SlotType.SOCIAL_COMMUNICATION - } - },publishSlotSocialCallback003); - console.info("==========ACTS_PublishSlotTypeSocial_0300 publish======>"); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeSocial_0300 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function publishSlotSocialCallback004(error){ - console.log('=========ACTS_PublishSlotTypeSocial_0400 publish callback==========>'+JSON.stringify(error.code)); - } - - function onConsume0400(data){ - console.info("===========ACTS_PublishSlotTypeSocial_0400 onConsume start===========>"); - console.info("===========ACTS_PublishSlotTypeSocial_0400 onConsume data:===========>" + JSON.stringify(data)); - expect(data.request.content.normal.title).assertEqual("test40_title"); - console.info("===========ACTS_PublishSlotTypeSocial_0400 onConsume end=============>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeSocial_xts_0400 - * @tc.name: publish() - * @tc.desc: verify the publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:CONTENT_INFORMATION) - */ - it('ACTS_PublishSlotTypeSocial_xts_0400', 0,async function (done) { - console.info("===============ACTS_PublishSlotTypeSocial_0400================>"); - var subscriber ={ - onConsume:onConsume0400 - } - await notify.subscribe(subscriber); - await notify.publish({ - id: 40, - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test40_title", - text: "test40_text", - additionalText: "test40_additionalText" - }, - slotType:notify.SlotType.CONTENT_INFORMATION - } - },publishSlotSocialCallback004); - console.info("==========ACTS_PublishSlotTypeSocial_0400 publish======>"); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeSocial_0400 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0500(data){ - console.info("===========ACTS_PublishSlotTypeSocial_0500 onConsume start===========>"); - console.info("===========ACTS_PublishSlotTypeSocial_0500 onConsume data:===========>" + JSON.stringify(data)); - expect(data.request.content.normal.title).assertEqual("test41_title"); - console.info("===========ACTS_PublishSlotTypeSocial_0500 onConsume end=============>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeSocial_xts_0500 - * @tc.name: publish() - * @tc.desc: verify publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:SOCIAL_COMMUNICATION) promise - */ - it('ACTS_PublishSlotTypeSocial_xts_0500', 0,async function (done) { - console.info("===============ACTS_PublishSlotTypeSocial_0500================>"); - var subscriber ={ - onConsume:onConsume0500 - } - await notify.subscribe(subscriber); - notify.publish({ - id: 41, - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test41_title", - text: "test41_text", - additionalText: "test41_additionalText" - }, - slotType:notify.SlotType.SOCIAL_COMMUNICATION - } - }).then(console.info("==========ACTS_PublishSlotTypeSocial_0500 publish then======>")); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeSocial_0500 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0600(data){ - console.info("===========ACTS_PublishSlotTypeSocial_0600 onConsume start===========>"); - console.info("===========ACTS_PublishSlotTypeSocial_0600 onConsume data:===========>" + JSON.stringify(data)); - expect().assertFail(); - console.info("===========ACTS_PublishSlotTypeSocial_0600 onConsume end=============>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeSocial_xts_0600 - * @tc.name: publish() - * @tc.desc: verify the function of publish(slotType:SOCIAL_COMMUNICATION) promise - */ - it('ACTS_PublishSlotTypeSocial_xts_0600', 0,async function (done) { - console.info("===============ACTS_PublishSlotTypeSocial_0600================>"); - var subscriber ={ - onConsume:onConsume0600 - } - await notify.subscribe(subscriber); - try { - var promise = notify.publish({ - id: 42, - content: { - // contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - slotType: notify.SlotType.SOCIAL_COMMUNICATION - } - }) - }catch(err){ - console.info("======ACTS_PublishSlotTypeSocial_0600 err===>"+err.code); - } - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeSocial_0600 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0700(data){ - console.info("===========ACTS_PublishSlotTypeSocial_0700 onConsume start===========>"); - console.info("===========ACTS_PublishSlotTypeSocial_0700 onConsume data:===========>" + JSON.stringify(data)); - expect(data.request.content.normal.title).assertEqual("test43_title"); - console.info("===========ACTS_PublishSlotTypeSocial_0700 onConsume end=============>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeSocial_xts_0700 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT) promise - */ - it('ACTS_PublishSlotTypeSocial_xts_0700', 0,async function (done) { - console.info("===============ACTS_PublishSlotTypeSocial_0700================>"); - var subscriber ={ - onConsume:onConsume0700 - } - await notify.subscribe(subscriber); - var notificationRequest = { - id: 43, - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test43_title", - text: "test43_text", - additionalText: "test43_additionalText" - }, - //slotType:notification.SlotType.SOCIAL_COMMUNICATION - } - } - await notify.publish(notificationRequest); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeSocial_0700 setTimeout unsubscribe===>"); - done(); - }),timeout) - }); - - function onConsume0800(data){ - console.info("===========ACTS_PublishSlotTypeSocial_0800 onConsume start===========>"); - console.info("===========ACTS_PublishSlotTypeSocial_0800 onConsume data:===========>" + JSON.stringify(data)); - expect(data.request.content.normal.title).assertEqual("test44_title"); - console.info("===========ACTS_PublishSlotTypeSocial_0800 onConsume end=============>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeSocial_xts_0800 - * @tc.name: publish() - * @tc.desc: verify the publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:CONTENT_INFORMATION) promise - */ - it('ACTS_PublishSlotTypeSocial_xts_0800', 0,async function (done) { - console.info("===============ACTS_PublishSlotTypeSocial_0800================>"); - var subscriber ={ - onConsume:onConsume0800 - } - await notify.subscribe(subscriber); - await notify.publish({ - id: 44, - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test44_title", - text: "test44_text", - additionalText: "test44_additionalText" - }, - slotType:notify.SlotType.CONTENT_INFORMATION - } - }) - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("===============ACTS_PublishSlotTypeSocial_0800 setTimeout unsubscribe================>"); - done(); - }),timeout) - }); - - function publishSlotServiceCallback001(error){ - console.log('=========ACTS_PublishSlotTypeSocial_0100 publish callback==========>'+JSON.stringify(error.code)); - } - function onConsume0900(data){ - console.info("===========ACTS_PublishSlotTypeSocial_0100 onConsume start===========>"); - console.info("===========ACTS_PublishSlotTypeSocial_0100 onConsume data:===========>" + JSON.stringify(data)); - expect(data.request.content.normal.title).assertEqual("test29_title"); - console.info("===========ACTS_PublishSlotTypeSocial_0100 onConsume end=============>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeService_xts_0100 - * @tc.name: publish() - * @tc.desc: verify the publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:SERVICE_INFORMATION) - */ - it('ACTS_PublishSlotTypeService_xts_0100', 0,async function (done) { - console.info("===============ACTS_PublishSlotTypeService_0100================>"); - var subscriber ={ - onConsume:onConsume0900 - } - await notify.subscribe(subscriber); - console.info("===============ACTS_PublishSlotTypeService_0100 subscribe======>"); - await notify.publish({ - id:29, - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test29_title", - text: "test29_text", - additionalText: "test29_additionalText" - }, - }, - slotType:notify.SlotType.SERVICE_INFORMATION - },publishSlotServiceCallback001); - console.info("==========ACTS_PublishSlotTypeService_0100 publish======>"); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeService_0100 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function publishSlotServiceCallback002(error){ - console.log('========ACTS_PublishSlotTypeService_0200 publish callback========>'+JSON.stringify(error.code)); - } - function onConsume1000(data){ - console.info("=======ACTS_PublishSlotTypeService_0200 onConsume start=========>"); - console.info("===========ACTS_PublishSlotTypeService_0200 onConsume data:=========>" + JSON.stringify(data)); - expect().assertFail(); - console.info("===========ACTS_PublishSlotTypeService_0200 onConsume end===========>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeService_xts_0200 - * @tc.name: publish() - * @tc.desc: verify the function of publish(slotType:SERVICE_INFORMATION) - */ - it('ACTS_PublishSlotTypeService_xts_0200', 0,async function (done) { - console.info("===============ACTS_PublishSlotTypeService_0200================>"); - var subscriber ={ - onConsume:onConsume1000 - } - await notify.subscribe(subscriber); - console.info("===============ACTS_PublishSlotTypeService_0200 subscribe======>"); - try { - await notify.publish({ - id: 30, - content: { - // contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - slotType: notify.SlotType.SERVICE_INFORMATION - }, publishSlotServiceCallback002); - }catch(err){ - console.info("==========ACTS_PublishSlotTypeService_0200 err======>"+err.code); - } - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeService_0200 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function publishSlotServiceCallback003(error){ - console.log('========ACTS_PublishSlotTypeService_0300 publish callback========>'+JSON.stringify(error.code)); - } - function onConsume1100(data){ - console.info("=======ACTS_PublishSlotTypeService_0300 onConsume start=========>"); - console.info("=======ACTS_PublishSlotTypeService_0300 onConsume data:=========>" + JSON.stringify(data)); - expect(data.request.content.normal.title).assertEqual("test31_title"); - console.info("=======ACTS_PublishSlotTypeService_0300 onConsume end===========>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeService_xts_0300 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT) - */ - it('ACTS_PublishSlotTypeService_xts_0300', 0,async function (done) { - console.info("===============ACTS_PublishSlotTypeService_0300================>"); - var subscriber ={ - onConsume:onConsume1100 - } - await notify.subscribe(subscriber); - console.info("===============ACTS_PublishSlotTypeService_0300 subscribe======>"); - await notify.publish({ - id: 31, - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test31_title", - text: "test31_text", - additionalText: "test31_additionalText" - }, - }, - // slotType:notification.SlotType.SERVICE_INFORMATION - },publishSlotServiceCallback003); - console.info("==========ACTS_PublishSlotTypeService_0300 publish======>"); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeService_0300 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function publishSlotServiceCallback004(error){ - console.log('========ACTS_PublishSlotTypeService_0400 publish callback========>'+JSON.stringify(error.code)); - } - function onConsume1200(data){ - console.info("=======ACTS_PublishSlotTypeService_0400 onConsume start=========>"); - console.info("=======ACTS_PublishSlotTypeService_0400 onConsume data:=========>" + JSON.stringify(data)); - expect(data.request.content.normal.title).assertEqual("test32_title"); - console.info("=======ACTS_PublishSlotTypeService_0400 onConsume end===========>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeService_xts_0400 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:UNKNOWN_TYPE) - */ - it('ACTS_PublishSlotTypeService_xts_0400', 0,async function (done) { - console.info("===============ACTS_PublishSlotTypeService_0400================>"); - var subscriber ={ - onConsume:onConsume1200 - } - await notify.subscribe(subscriber); - console.info("===============ACTS_PublishSlotTypeService_0400 subscribe======>"); - await notify.publish({ - id: 32, - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test32_title", - text: "test32_text", - additionalText: "test32_additionalText" - }, - }, - slotType:notify.SlotType.UNKNOWN_TYPE - },publishSlotServiceCallback004); - console.info("==========ACTS_PublishSlotTypeService_0400 publish======>"); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeService_0400 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume1300(data){ - console.info("=======ACTS_PublishSlotTypeService_0500 onConsume start=========>"); - console.info("=======ACTS_PublishSlotTypeService_0500 onConsume data:=========>" + JSON.stringify(data)); - expect(data.request.content.normal.title).assertEqual("test33_title"); - console.info("=======ACTS_PublishSlotTypeService_0500 onConsume end===========>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeService_xts_0500 - * @tc.name: publish() - * @tc.desc: verify the publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:SERVICE_INFORMATION) promise - */ - it('ACTS_PublishSlotTypeService_xts_0500', 0,async function (done) { - console.info("===============ACTS_PublishSlotTypeService_0500================>"); - var subscriber ={ - onConsume:onConsume1300 - } - await notify.subscribe(subscriber); - console.info("===============ACTS_PublishSlotTypeService_0500 subscribe======>"); - notify.publish({ - id: 33, - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test33_title", - text: "test33_text", - additionalText: "test33_additionalText" - }, - }, - slotType:notify.SlotType.SERVICE_INFORMATION - }).then(console.log("==========ACTS_PublishSlotTypeService_0500 publish then======>")) - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeService_0500 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume1400(data){ - console.info("=======ACTS_PublishSlotTypeService_0600 onConsume start=========>"); - console.info("=======ACTS_PublishSlotTypeService_0600 onConsume data:=========>" + JSON.stringify(data)); - expect().assertFail(); - console.info("=======ACTS_PublishSlotTypeService_0600 onConsume end===========>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeService_xts_0600 - * @tc.name: publish() - * @tc.desc: verify the function of publish(slotType:SERVICE_INFORMATION) promise - */ - it('ACTS_PublishSlotTypeService_xts_0600', 0,async function (done) { - console.info("===============ACTS_PublishSlotTypeService_0600================>"); - var subscriber ={ - onConsume:onConsume1400 - } - await notify.subscribe(subscriber); - console.info("===============ACTS_PublishSlotTypeService_0600 subscribe======>"); - try { - var promise = notify.publish({ - id: 34, - content: { - // contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - slotType: notify.SlotType.SERVICE_INFORMATION - }) - }catch(err){ - console.info("======ACTS_PublishSlotTypeService_0600 err===>"+err.code); - } - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeService_0600 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume1500(data){ - console.info("=======ACTS_PublishSlotTypeService_0700 onConsume start=========>"); - console.info("=======ACTS_PublishSlotTypeService_0700 onConsume data:=========>" + JSON.stringify(data)); - expect(data.request.content.normal.title).assertEqual("test35_title"); - console.info("=======ACTS_PublishSlotTypeService_0700 onConsume end===========>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeService_xts_0700 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT) promise - */ - it('ACTS_PublishSlotTypeService_xts_0700', 0,async function (done) { - console.info("===============ACTS_PublishSlotTypeService_0700================>"); - var subscriber ={ - onConsume:onConsume1500 - } - await notify.subscribe(subscriber); - console.info("===============ACTS_PublishSlotTypeService_0700 subscribe======>"); - notify.publish({ - id: 35, - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test35_title", - text: "test35_text", - additionalText: "test35_additionalText" - }, - }, - // slotType:notification.SlotType.SERVICE_INFORMATION - }).then(console.log("===ACTS_PublishSlotTypeService_0700 finished===")); - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeService_0700 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume1600(data){ - console.info("=======ACTS_PublishSlotTypeService_0800 onConsume start=========>"); - console.info("=======ACTS_PublishSlotTypeService_0800 onConsume data:=========>" + JSON.stringify(data)); - expect(data.request.content.normal.title).assertEqual("test36_title"); - console.info("=======ACTS_PublishSlotTypeService_0800 onConsume end===========>"); - } - - /* - * @tc.number: ACTS_PublishSlotTypeService_xts_0800 - * @tc.name: publish() - * @tc.desc: verify publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:UNKNOWN_TYPE) promise - */ - it('ACTS_PublishSlotTypeService_xts_0800', 0,async function (done) { - console.info("===============ACTS_PublishSlotTypeService_0800================>"); - var subscriber ={ - onConsume:onConsume1600 - } - await notify.subscribe(subscriber); - console.info("===============ACTS_PublishSlotTypeService_0800 subscribe======>"); - notify.publish({ - id: 36, - content: { - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test36_title", - text: "test36_text", - additionalText: "test36_additionalText" - }, - }, - slotType:notify.SlotType.UNKNOWN_TYPE - }).then(console.log("===ACTS_PublishSlotTypeService_0800 finished===")) - setTimeout((async function(){ - await notify.unsubscribe(subscriber); - console.info("======ACTS_PublishSlotTypeService_0800 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); -}) -} diff --git a/notification/ans_standard/publish_test/publish/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/publish/src/main/resources/base/element/string.json deleted file mode 100644 index ce7be5db08a9d272860338c518d13159dbdf5867..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publish/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "pubIcon" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/publishcontentype/BUILD.gn b/notification/ans_standard/publish_test/publishcontentype/BUILD.gn deleted file mode 100644 index fa77d654c499bfb6c4daf1496d4c9f31a185f7ce..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/BUILD.gn +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//test/xts/tools/build/suite.gni") - -group("publishcontentype") { - testonly = true - if (is_standard_system) { - deps = [ - #"publishtype:ActsAnsNotificationTest", - #"sub:ActsAnsCommonEventTest", - ] - } -} diff --git a/notification/ans_standard/publish_test/publishcontentype/publishtype/BUILD.gn b/notification/ans_standard/publish_test/publishcontentype/publishtype/BUILD.gn deleted file mode 100644 index 7ce46a2a2583c5d516146367e0864c282f27caa2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/BUILD.gn +++ /dev/null @@ -1,34 +0,0 @@ -# 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("ActsAnsNotificationTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsNotificationTest" - 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/publish_test/publishcontentype/publishtype/Test.json b/notification/ans_standard/publish_test/publishcontentype/publishtype/Test.json deleted file mode 100644 index e0779b0acdc7c4eb1b439e4db98464c83fea3c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "com.example.actsansnotificationtest", - "package-name": "com.example.actsansnotificationtest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsNotificationTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishcontentype/publishtype/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/publishcontentype/publishtype/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/publishcontentype/publishtype/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/config.json b/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/config.json deleted file mode 100644 index 59c783a295865fe86cb57a9b0ec5afd2e4f947cf..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansnotificationtest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansnotificationtest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/publishcontentype/publishtype/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index ec1c48a9cded2bbba6877686fae33ec14be32b8e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Test of ANS Publishing - -
diff --git a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/publishcontentype/publishtype/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/publishcontentype/publishtype/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/publishcontentype/publishtype/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index 6f716addd0061eec41aeb45510c421c7c0c553ce..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,1872 +0,0 @@ -/* - * 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 Subscriber from '@ohos.commonEvent' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -var time = 5000 -var multiLineDataOne -var multiLineDataTwo -var LongContentDataOne -var LongContentDataTwo -var SlotTypeDataOne -var SlotTypeDataTwo -var SlotTypeDataThree -var SlotTypeDataFour -var SlotTypeDataFive -var SlotTypeDataSix -var OtherDataOne -var OtherDataTwo -var OtherDataThree -var OtherDataFour -var OtherDataFive -var OtherDataSix -var ServiceDataOne -var ServiceDataTwo -var ServiceDataThree -var ServiceDataFour -var ServiceDataFive -var ServiceDataSix -var SocialDataOne -var SocialDataTwo -var SocialDataThree -var SocialDataFour -var SocialDataFive -var SocialDataSix -export default function ActsAnsNotificationTest() { -describe('ActsAnsNotificationTest', function () { - function publishMULTILINEContentCallback001(error){ - console.log('ActsNotificationTest ACTS_PublishMULTILINEContent_0100 asyncCallback'+JSON.stringify(error.code)) - } - function publishMULTILINEContentCallback002(error){ - console.log('ActsNotificationTest ACTS_PublishMULTILINEContent_0200 asyncCallback'+JSON.stringify(error.code)) - } - function publishMULTILINEContentCallback003(error){ - console.log('ActsNotificationTest ACTS_PublishMULTILINEContent_0300 asyncCallback'+JSON.stringify(error.code)) - } - function publishLONGContentCallback001(error){ - console.log('ActsNotificationTest ACTS_PublishLONGContent_0100 asyncCallback'+JSON.stringify(error.code)) - } - function publishLONGContentCallback002(error){ - console.log('ActsNotificationTest ACTS_PublishLONGContent_0200 asyncCallback'+JSON.stringify(error.code)) - } - function publishLONGContentCallback003(error){ - console.log('ActsNotificationTest ACTS_PublishLONGContent_0300 asyncCallback'+JSON.stringify(error.code)) - } - function publishSlotTypeContentCallback001(error){ - console.log('ActsNotificationTest ACTS_Publish_SlotTypeContent_0100 asyncCallback'+JSON.stringify(error.code)) - } - function publishSlotTypeContentCallback002(error){ - console.log('ActsNotificationTest ACTS_Publish_SlotTypeContent_0200 asyncCallback'+JSON.stringify(error.code)) - } - function publishSlotTypeContentCallback003(error){ - console.log('ActsNotificationTest ACTS_Publish_SlotTypeContent_0300 asyncCallback'+JSON.stringify(error.code)) - } - function publishSlotTypeContentCallback004(error){ - console.log('ActsNotificationTest ACTS_Publish_SlotTypeContent_0400 asyncCallback'+JSON.stringify(error.code)) - } - function publishSlotOtherCallback001(error){ - console.log('ActsNotificationTest ACTS_Publish_SlotTypeOther_0100 asyncCallback'+JSON.stringify(error.code)) - } - function publishSlotOtherCallback002(error){ - console.log('ActsNotificationTest ACTS_Publish_SlotTypeOther_0200 asyncCallback'+JSON.stringify(error.code)) - } - function publishSlotOtherCallback003(error){ - console.log('ActsNotificationTest ACTS_Publish_SlotTypeOther_0300 asyncCallback'+JSON.stringify(error.code)) - } - function publishSlotOtherCallback004(error){ - console.log('ActsNotificationTest ACTS_Publish_SlotTypeOther_0400 asyncCallback'+JSON.stringify(error.code)) - } - function publishSlotServiceCallback001(error){ - console.log('ActsNotificationTest ACTS_Publish_SlotTypeService_0100 asyncCallback'+JSON.stringify(error.code)) - } - function publishSlotServiceCallback002(error){ - console.log('ActsNotificationTest ACTS_Publish_SlotTypeService_0200 asyncCallback'+JSON.stringify(error.code)) - } - function publishSlotServiceCallback003(error){ - console.log('ActsNotificationTest ACTS_Publish_SlotTypeService_0300 asyncCallback'+JSON.stringify(error.code)) - } - function publishSlotServiceCallback004(error){ - console.log('ActsNotificationTest ACTS_Publish_SlotTypeService_0400 asyncCallback'+JSON.stringify(error.code)) - } - function publishSlotSocialCallback001(error){ - console.log('ActsNotificationTest ACTS_Publish_SlotTypeService_0400 asyncCallback'+JSON.stringify(error.code)) - } - function publishSlotSocialCallback002(error){ - console.log('ActsNotificationTest ACTS_Publish_SlotTypeService_0400 asyncCallback'+JSON.stringify(error.code)) - } - function publishSlotSocialCallback003(error){ - console.log('ActsNotificationTest ACTS_Publish_SlotTypeService_0400 asyncCallback'+JSON.stringify(error.code)) - } - function publishSlotSocialCallback004(error){ - console.log('ActsNotificationTest ACTS_Publish_SlotTypeService_0400 asyncCallback'+JSON.stringify(error.code)) - } - function UnSubscribeCallBacka(err){ - console.log('===UnSubscribeCallBacka==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackb(err){ - console.log('===UnSubscribeCallBackb==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackc(err){ - console.log('===UnSubscribeCallBackc==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackd(err){ - console.log('===UnSubscribeCallBackd==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBacke(err){ - console.log('===UnSubscribeCallBacke==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackf(err){ - console.log('===UnSubscribeCallBackf==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackg(err){ - console.log('===UnSubscribeCallBackg==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackh(err){ - console.log('===UnSubscribeCallBackh==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBacki(err){ - console.log('===UnSubscribeCallBacki==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackj(err){ - console.log('===UnSubscribeCallBackj==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackl(err){ - console.log('===UnSubscribeCallBackl==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackm(err){ - console.log('===UnSubscribeCallBackm==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackn(err){ - console.log('===UnSubscribeCallBackn==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBacko(err){ - console.log('===UnSubscribeCallBacko==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackp(err){ - console.log('===UnSubscribeCallBackp==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackq(err){ - console.log('===UnSubscribeCallBackq==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackr(err){ - console.log('===UnSubscribeCallBackr==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBacks(err){ - console.log('===UnSubscribeCallBacks==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackt(err){ - console.log('===UnSubscribeCallBackt==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBacku(err){ - console.log('===UnSubscribeCallBacku==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackv(err){ - console.log('===UnSubscribeCallBackv==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackw(err){ - console.log('===UnSubscribeCallBackw==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackx(err){ - console.log('===UnSubscribeCallBackx==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBacky(err){ - console.log('===UnSubscribeCallBacky==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackz(err){ - console.log('===UnSubscribeCallBackz==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackA(err){ - console.log('===UnSubscribeCallBackA==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackB(err){ - console.log('===UnSubscribeCallBackB==='+err.code) - expect(err.code).assertEqual(0) - } - function UnSubscribeCallBackC(err){ - console.log('===UnSubscribeCallBackC==='+err.code) - expect(err.code).assertEqual(0) - } - /* - * @tc.number: ACTS_PublishMULTILINEContent_0100 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_MULTILINE) - */ - it('ACTS_PublishMULTILINEContent_0100', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishMULTILINEContent_0100"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo - , async (err,data) =>{ - console.info("===ACTS_PublishMULTILINEContent_0100===createSubscriber"+JSON.stringify(data)); - multiLineDataOne = data - await Subscriber.subscribe(data, subMultilineOneCallBack) - }) - function subMultilineOneCallBack(err,data){ - console.log('===subMultilineOneCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(multiLineDataOne,UnSubscribeCallBacka) - if(data.code == 1) { - expect(data.code).assertEqual(1); - done(); - } - else{ - expect().assertFail(); - done(); - } - } - await notification.publish({ - id: 1, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_MULTILINE, - multiLine: { - title: "test1_title", - text: "test1_text", - additionalText: "test1_additionalText", - briefText: "briefText1", - longTitle: "longTitle1", - lines: ["thrive", "democracy", "civilization", "harmonious"] - }, - } - }, async (err)=>{ - console.debug("====ACTS_PublishMULTILINEContent_0100===Callback==>") - }); - - }) - - /* - * @tc.number: ACTS_PublishMULTILINEContent_0200 - * @tc.name: publish() - * @tc.desc: verify the function of publish() - */ - it('ACTS_PublishMULTILINEContent_0200', 0,async function (done) { - var notificationInfo = { - id: 2, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_MULTILINE, - multiLine: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText", - briefText: "briefText", - longTitle: "longTitle", - lines: ["thrive", "democracy", "civilization", "harmonious"] - }, - } - } - await notification.publish(notificationInfo,publishMULTILINEContentCallback002) - done(); - }) - /* - * @tc.number: ACTS_PublishMULTILINEContent_0300 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_PICTURE) - */ - it('ACTS_PublishMULTILINEContent_0300', 0,async function (done) { - try { - await notification.publish({ - id: 3, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_PICTURE, - multiLine: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText", - briefText: "briefText", - longTitle: "longTitle", - lines: ["thrive", "democracy", "civilization", "harmonious"] - }, - } - }, publishMULTILINEContentCallback003); - }catch(error){ - console.log('ActsNotificationTest ACTS_PublishMULTILINEContent_0300 asyncCallback'+JSON.stringify(error.code)) - } - done(); - }) - - /* - * @tc.number: ACTS_PublishMULTILINEContent_0400 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_MULTILINE) promise - */ - it('ACTS_PublishMULTILINEContent_0400', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishMULTILINEContent_0400"] - }; - await Subscriber.createSubscriber(commonEventSubscribeInfo).then(async(data)=> { - console.info("===ACTS_PublishMULTILINEContent_0400===createSubscriber" + JSON.stringify(data)); - multiLineDataTwo = data - await Subscriber.subscribe(data, subMultilineTwoCallBack) - }) - console.info("===ACTS_PublishMULTILINEContent_0400===subMultilineTwoCallBack"); - async function subMultilineTwoCallBack(err,data){ - console.log('===subMultilineTwoCallBack==='+err.code+JSON.stringify(data)) - await Subscriber.unsubscribe(multiLineDataTwo,UnSubscribeCallBackb) - if(data.code == 4) { - done(); - } - else{ - expect().assertFail(); - done(); - } - } - notification.publish({ - id: 4, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_MULTILINE, - multiLine: { - title: "test4_title", - text: "test4_text", - additionalText: "test4_additionalText", - briefText:"briefText4", - longTitle:"longTitle4", - lines: ["thrive", "democracy", "civilization", "harmonious"] - }, - } - }).then(console.debug("===ACTS_PublishMULTILINEContent_0400===Promise===>")) - setTimeout(function(){ - console.debug("====>time out ACTS_PublishMULTILINEContent_0400====>"); - }, time); - }) - /* - * @tc.number: ACTS_PublishMULTILINEContent_0500 - * @tc.name: publish() - * @tc.desc: verify the function of publish() promise - */ - it('ACTS_PublishMULTILINEContent_0500', 0,async function (done) { - var promise = notification.publish({ - id: 5, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_MULTILINE, - multiLine: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText", - briefText:"briefText", - longTitle:"longTitle", - lines: ["thrive", "democracy", "civilization", "harmonious"] - }, - } - }) - expect(typeof(promise)).assertEqual("object") - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_PublishMULTILINEContent_0500====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishMULTILINEContent_0600 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_PICTURE) promise - */ - it('ACTS_PublishMULTILINEContent_0600', 0,async function (done) { - var promise = notification.publish({ - id: 6, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_MULTILINE, - multiLine: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText", - briefText:"briefText", - longTitle:"longTitle", - lines: ["thrive", "civilization", "harmonious"] - }, - } - }) - expect(typeof(promise)).assertEqual("object") - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_PublishMULTILINEContent_0600====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishLONGContent_0100 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_LONG_TEXT) - */ - it('ACTS_PublishLONGContent_0100', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishLONGContent_0100"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async(data) =>{ - console.info("===ACTS_PublishLONGContent_0100===createSubscriber"+JSON.stringify(data)); - LongContentDataOne = data - await Subscriber.subscribe(data, subLoneOneCallBack) - }) - function subLoneOneCallBack(err,data){ - console.log('===subLoneOneCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(LongContentDataOne,UnSubscribeCallBackc) - if(data.code == 7) { - done(); - } - else{ - expect().assertFail(); - done(); - } - } - await notification.publish({ - id: 7, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, - longText: { - title: "test7_title", - text: "test7_text", - additionalText: "test7_additionalText", - longText:"longText7", - briefText:"briefText7", - expandedTitle:"expandedTitle7" - }} - },(err)=>{ - console.debug("===ACTS_PublishLONGContent_0100===Callback===>"); - }); - }) - - /* - * @tc.number: ACTS_PublishLONGContent_0200 - * @tc.name: publish() - * @tc.desc: verify the function of publish() - */ - it('ACTS_PublishLONGContent_0200', 0,async function (done) { - await notification.publish({ - id: 8, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, - longText: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText", - longText:"longText", - briefText:"briefText", - expandedTitle:"expandedTitle" - }} - },publishLONGContentCallback002); - console.log("===ACTS_PublishLONGContent_0200 finished===") - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_PublishLONGContent_0200====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishLONGContent_0300 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_LONG_TEXT) - */ - it('ACTS_PublishLONGContent_0300', 0,async function (done) { - await notification.publish({ - id: 9, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, - longText: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText", - longText:"longText", - briefText:"briefText", - expandedTitle:"expandedTitle" - }} - },publishLONGContentCallback003); - console.log("===ACTS_PublishLONGContent_0300 finished===") - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_PublishLONGContent_0300====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishLONGContent_0400 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_LONG_TEXT) promise - */ - it('ACTS_PublishLONGContent_0400', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishLONGContent_0400"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async (data) =>{ - console.info("===ACTS_PublishLONGContent_0400===createSubscriber"+JSON.stringify(data)); - LongContentDataTwo = data - await Subscriber.subscribe(data, subLoneTwoCallBack) - }) - function subLoneTwoCallBack(err,data){ - console.log('===subLoneTwoCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(LongContentDataTwo,UnSubscribeCallBackd) - if(data.code == 10) { - done(); - } - else{ - expect().assertFail(); - done(); - } - } - notification.publish({ - id: 10, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, - longText: { - title: "test10_title", - text: "test10_text", - additionalText: "test10_additionalText", - longText:"longText10", - briefText:"briefText10", - expandedTitle:"expandedTitle10" - }} - }).then(console.log("===ACTS_PublishLONGContent_0400 finished===")) - setTimeout(function(){ - console.debug("====>time out ACTS_PublishLONGContent_0400====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishLONGContent_0500 - * @tc.name: publish() - * @tc.desc: verify the function of publish() promise - */ - it('ACTS_PublishLONGContent_0500', 0,async function (done) { - var promise = await notification.publish({ - id: 11, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, - longText: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText", - longText:"longText", - briefText:"briefText", - expandedTitle:"expandedTitle" - }} - }) - expect(typeof(promise)).assertEqual("object") - done(); - }) - - /* - * @tc.number: ACTS_PublishLONGContent_0600 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_LONG_TEXT) promise - */ - it('ACTS_PublishLONGContent_0600', 0,async function (done) { - var promise = notification.publish({ - id: 12, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, - longText: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText", - longText:"longText", - briefText:"briefText", - expandedTitle:"expandedTitleing" - }} - }) - expect(typeof(promise)).assertEqual("object") - done(); - }) - - /* - * @tc.number: ACTS_Publish_SlotTypeContent_0100 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:CONTENT_INFORMATION) - */ - it('ACTS_Publish_SlotTypeContent_0100', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_Publish_SlotTypeContent_0100"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async(data) =>{ - console.info("===ACTS_Publish_SlotTypeContent_0100===createSubscriber"+JSON.stringify(data)); - SlotTypeDataOne = data - await Subscriber.subscribe(data, subSlotTypeOneCallBack) - }) - function subSlotTypeOneCallBack(err,data){ - console.log('===subSlotTypeOneCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(SlotTypeDataOne,UnSubscribeCallBacke) - if(data.code == 13) { - expect(data.code).assertEqual(13) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - await notification.publish({ - id: 13, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test13_title", - text: "test13_text", - additionalText: "test13_additionalText" - } - }, - slotType:notification.SlotType.CONTENT_INFORMATION - },publishSlotTypeContentCallback001); - console.log("===ACTS_Publish_SlotTypeContent_0100 finished===") - setTimeout(function(){ - console.debug("====>time out ACTS_Publish_SlotTypeContent_0100====>"); - }, time); - }) - - /* - * @tc.number: ACTS_Publish_SlotTypeContent_0200 - * @tc.name: publish() - * @tc.desc: verify the function of publish(slotType:CONTENT_INFORMATION) - */ - it('ACTS_Publish_SlotTypeContent_0200', 0,async function (done) { - await notification.publish({ - id: 14, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - } - }, - slotType:notification.SlotType.CONTENT_INFORMATION - },publishSlotTypeContentCallback002); - console.log("===ACTS_Publish_SlotTypeContent_0200 finished===") - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_Publish_SlotTypeContent_0200====>"); - }, time); - }) - - /* - * @tc.number: ACTS_Publish_SlotTypeContent_0300 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT) - */ - it('ACTS_Publish_SlotTypeContent_0300', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_Publish_SlotTypeContent_0300"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async(data) =>{ - console.info("===ACTS_Publish_SlotTypeContent_0300===createSubscriber"+JSON.stringify(data)); - SlotTypeDataTwo = data - await Subscriber.subscribe(data, subSlotTypeTwoCallBack) - }) - function subSlotTypeTwoCallBack(err,data){ - console.log('===subSlotTypeTwoCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(SlotTypeDataTwo,UnSubscribeCallBackf) - if(data.code == 15) { - expect(data.code).assertEqual(15) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - await notification.publish({ - id: 15, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test15_title", - text: "test15_text", - additionalText: "test_additionalText" - } - }, - //slotType:notification.SlotType.CONTENT_INFORMATION - },publishSlotTypeContentCallback003); - console.log("===ACTS_Publish_SlotTypeContent_0300 finished===") - setTimeout(function(){ - console.debug("====>time out ACTS_Publish_SlotTypeContent_0300====>"); - }, time); - }) - - /* - * @tc.number: ACTS_Publish_SlotTypeContent_0400 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:SERVICE_INFORMATION) - */ - it('ACTS_Publish_SlotTypeContent_0400', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_Publish_SlotTypeContent_0400"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async (data) =>{ - console.info("===ACTS_Publish_SlotTypeContent_0400===createSubscriber"+JSON.stringify(data)); - SlotTypeDataThree = data - await Subscriber.subscribe(data, subSlotTypeThreeCallBack) - }) - function subSlotTypeThreeCallBack(err,data){ - console.log('===subSlotTypeThreeCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(SlotTypeDataThree,UnSubscribeCallBackg) - if(data.code == 16) { - expect(data.code).assertEqual(16) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - await notification.publish({ - id: 16, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test16_title", - text: "test16_text", - additionalText: "test16_additionalText" - } - }, - slotType:notification.SlotType.SERVICE_INFORMATION - },publishSlotTypeContentCallback004); - console.log("===ACTS_Publish_SlotTypeContent_0400 finished===") - setTimeout(function(){ - console.debug("====>time out ACTS_Publish_SlotTypeContent_0400====>"); - }, time); - }) - - /* - * @tc.number: ACTS_Publish_SlotTypeContent_0500 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:CONTENT_INFORMATION) promise - */ - it('ACTS_Publish_SlotTypeContent_0500', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_Publish_SlotTypeContent_0500"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async(data) =>{ - console.info("===ACTS_Publish_SlotTypeContent_0500===createSubscriber"+JSON.stringify(data)); - SlotTypeDataFour = data - await Subscriber.subscribe(data, subSlotTypeFourCallBack) - }) - function subSlotTypeFourCallBack(err,data){ - console.log('===subSlotTypeFourCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(SlotTypeDataFour,UnSubscribeCallBackh) - if(data.code == 17) { - expect(data.code).assertEqual(17) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - notification.publish({ - id: 17, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test17_title", - text: "test17_text", - additionalText: "test17_additionalText" - } - }, - slotType:notification.SlotType.CONTENT_INFORMATION - }).then( console.log("===ACTS_Publish_SlotTypeContent_0500 finished===")) - setTimeout(function(){ - console.debug("====>time out ACTS_Publish_SlotTypeContent_0500====>"); - }, time); - }) - - /* - * @tc.number: ACTS_Publish_SlotTypeContent_0600 - * @tc.name: publish() - * @tc.desc: verify the function of publish(slotType:CONTENT_INFORMATION) promise - */ - it('ACTS_Publish_SlotTypeContent_0600', 0,async function (done) { - var promise = notification.publish({ - id: 18, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - } - }, - slotType:notification.SlotType.CONTENT_INFORMATION - }) - expect(typeof(promise)).assertEqual("object") - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_Publish_SlotTypeContent_0600====>"); - }, time); - }) - - /* - * @tc.number: ACTS_Publish_SlotTypeContent_0700 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT) promise - */ - it('ACTS_Publish_SlotTypeContent_0700', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_Publish_SlotTypeContent_0700"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async(data) =>{ - console.info("===ACTS_Publish_SlotTypeContent_0700===createSubscriber"+JSON.stringify(data)); - SlotTypeDataFive = data - await Subscriber.subscribe(data, subSlotTypeFiveCallBack) - }) - function subSlotTypeFiveCallBack(err,data){ - console.log('===subSlotTypeFiveCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(SlotTypeDataFive,UnSubscribeCallBacki) - if(data.code == 19) { - expect(data.code).assertEqual(19) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - notification.publish({ - id: 19, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test19_title", - text: "test19_text", - additionalText: "test19_additionalText" - } - }, - //slotType:notification.SlotType.CONTENT_INFORMATION - }).then(console.log("===ACTS_Publish_SlotTypeContent_0700 finished===")) - setTimeout(function(){ - console.debug("====>time out ACTS_Publish_SlotTypeContent_0700====>"); - }, time); - }) - - /* - * @tc.number: ACTS_Publish_SlotTypeContent_0800 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:SERVICE_INFORMATION) promise - */ - it('ACTS_Publish_SlotTypeContent_0800', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_Publish_SlotTypeContent_0800"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async(data) =>{ - console.info("===ACTS_Publish_SlotTypeContent_0800===createSubscriber"+JSON.stringify(data)); - SlotTypeDataSix = data - await Subscriber.subscribe(data, subSlotTypeSixCallBack) - }) - function subSlotTypeSixCallBack(err,data){ - console.log('===subSlotTypeSixCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(SlotTypeDataSix,UnSubscribeCallBackj) - if(data.code == 20) { - expect(data.code).assertEqual(20) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - notification.publish({ - id: 20, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test20_title", - text: "test20_text", - additionalText: "test20_additionalText" - } - }, - slotType:notification.SlotType.SERVICE_INFORMATION - }).then(console.log("===ACTS_Publish_SlotTypeContent_0800 finished===")) - setTimeout(function(){ - console.debug("====>time out ACTS_Publish_SlotTypeContent_0800====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeOther_0100 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:OTHER_TYPES) - */ - it('ACTS_PublishSlotTypeOther_0100', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishSlotTypeOther_0100"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async (data) =>{ - console.info("===ACTS_PublishSlotTypeOther_0100===createSubscriber"+JSON.stringify(data)); - OtherDataOne = data - await Subscriber.subscribe(data, subOtherOneCallBack) - }) - function subOtherOneCallBack(err,data){ - console.log('===subOtherOneCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(OtherDataOne,UnSubscribeCallBackl) - if(data.code == 21) { - expect(data.code).assertEqual(21) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - await notification.publish({ - id:21, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test21_title", - text: "test21_text", - additionalText: "test21_additionalText" - }, - slotType:notification.SlotType.OTHER_TYPES - } - },publishSlotOtherCallback001); - console.log("===ACTS_PublishSlotTypeOther_0100 finished===") - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeOther_0100====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeOther_0200 - * @tc.name: publish() - * @tc.desc: verify the function of publish(slotType:OTHER_TYPES) - */ - it('ACTS_PublishSlotTypeOther_0200', 0,async function (done) { - await notification.publish({ - id:22, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - slotType:notification.SlotType.OTHER_TYPES - } - },publishSlotOtherCallback002); - console.log("===ACTS_PublishSlotTypeOther_0200 finished===") - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeOther_0200====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeOther_0300 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT) - */ - it('ACTS_PublishSlotTypeOther_0300', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishSlotTypeOther_0300"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async (data) =>{ - console.info("===ACTS_PublishSlotTypeOther_0300===createSubscriber"+JSON.stringify(data)); - OtherDataTwo = data - await Subscriber.subscribe(data, subOtherTwoCallBack) - }) - function subOtherTwoCallBack(err,data){ - console.log('===subOtherTwoCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(OtherDataTwo,UnSubscribeCallBackm) - if(data.code == 23) { - expect(data.code).assertEqual(23) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - await notification.publish({ - id:23, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test23_title", - text: "test23_text", - additionalText: "test23_additionalText" - }, - //slotType:notification.SlotType.OTHER_TYPES - } - },publishSlotOtherCallback003); - console.log("===ACTS_PublishSlotTypeOther_0300 finished===") - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeOther_0300====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeOther_0400 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:SOCIAL_COMMUNICATION) - */ - it('ACTS_PublishSlotTypeOther_0400', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishSlotTypeOther_0400"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async (data) =>{ - console.info("===ACTS_PublishSlotTypeOther_0400===createSubscriber"+JSON.stringify(data)); - OtherDataThree = data - await Subscriber.subscribe(data, subOtherThreeCallBack) - }) - function subOtherThreeCallBack(err,data){ - console.log('===subOtherThreeCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(OtherDataThree,UnSubscribeCallBackn) - if(data.code == 24) { - expect(data.code).assertEqual(24) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - await notification.publish({ - id:24, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test24_title", - text: "test24_text", - additionalText: "test24_additionalText" - }, - slotType:notification.SlotType.SOCIAL_COMMUNICATION - } - },publishSlotOtherCallback004); - console.log("===ACTS_PublishSlotTypeOther_0400 finished===") - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeOther_0400====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeOther_0500 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:OTHER_TYPES) promise - */ - it('ACTS_PublishSlotTypeOther_0500', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishSlotTypeOther_0500"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async (data) =>{ - console.info("===ACTS_PublishSlotTypeOther_0500===createSubscriber"+JSON.stringify(data)); - OtherDataFour = data - await Subscriber.subscribe(data, subOtherFourCallBack) - }) - function subOtherFourCallBack(err,data){ - console.log('===subOtherFourCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(OtherDataFour,UnSubscribeCallBacko) - if(data.code == 25) { - expect(data.code).assertEqual(25) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - notification.publish({ - id:25, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test25_title", - text: "test25_text", - additionalText: "test25_additionalText" - }, - slotType:notification.SlotType.OTHER_TYPES - } - }).then(console.log("===ACTS_PublishSlotTypeOther_0500 finished===")) - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeOther_0500====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeOther_0600 - * @tc.name: publish() - * @tc.desc: verify the function of publish(slotType:OTHER_TYPES) promise - */ - it('ACTS_PublishSlotTypeOther_0600', 0,async function (done) { - var promise = notification.publish({ - id:26, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - slotType:notification.SlotType.OTHER_TYPES - } - }) - expect(typeof(promise)).assertEqual("object") - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeOther_0600====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeOther_0700 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT) promise - */ - it('ACTS_PublishSlotTypeOther_0700', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishSlotTypeOther_0700"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async(data) =>{ - console.info("===ACTS_PublishSlotTypeOther_0700===createSubscriber"+JSON.stringify(data)); - OtherDataFive = data - await Subscriber.subscribe(data, subOtherFiveCallBack) - }) - function subOtherFiveCallBack(err,data){ - console.log('===subOtherFiveCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(OtherDataFive,UnSubscribeCallBackp) - if(data.code == 27) { - expect(data.code).assertEqual(27) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - notification.publish({ - id:27, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test27_title", - text: "test27_text", - additionalText: "test27_additionalText" - }, - //slotType:notification.SlotType.OTHER_TYPES - } - }).then(console.log("===ACTS_PublishSlotTypeOther_0700 finished===")) - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeOther_0700====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeOther_0500 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:SOCIAL_COMMUNICATION) promise - */ - it('ACTS_PublishSlotTypeOther_0800', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishSlotTypeOther_0800"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async(data) =>{ - console.info("===ACTS_PublishSlotTypeOther_0800===createSubscriber"+JSON.stringify(data)); - OtherDataSix = data - await Subscriber.subscribe(data, subOtherSixCallBack) - }) - function subOtherSixCallBack(err,data){ - console.log('===subOtherSixCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(OtherDataSix,UnSubscribeCallBackq) - if(data.code == 28) { - expect(data.code).assertEqual(28) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - notification.publish({ - id:28, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test28_title", - text: "test28_text", - additionalText: "test28_additionalText" - }, - slotType:notification.SlotType.SOCIAL_COMMUNICATION - } - }).then(console.log("===ACTS_PublishSlotTypeOther_0800 finished===")) - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeOther_0800====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeService_0100 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:SERVICE_INFORMATION) - */ - it('ACTS_PublishSlotTypeService_0100', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishSlotTypeService_0100"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async (data) =>{ - console.info("===ACTS_PublishSlotTypeService_0100===createSubscriber"+JSON.stringify(data)); - ServiceDataOne = data - await Subscriber.subscribe(data, subServiceOneCallBack) - }) - function subServiceOneCallBack(err,data){ - console.log('===subServiceOneCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(ServiceDataOne,UnSubscribeCallBackr) - if(data.code == 29) { - expect(data.code).assertEqual(29) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - await notification.publish({ - id:29, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test29_title", - text: "test29_text", - additionalText: "test29_additionalText" - }, - }, - slotType:notification.SlotType.SERVICE_INFORMATION - },publishSlotServiceCallback001); - console.log("===ACTS_PublishSlotTypeService_0100 finished===") - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeService_0100====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeService_0200 - * @tc.name: publish() - * @tc.desc: verify the function of publish(slotType:SERVICE_INFORMATION) - */ - it('ACTS_PublishSlotTypeService_0200', 0,async function (done) { - await notification.publish({ - id: 30, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - slotType:notification.SlotType.SERVICE_INFORMATION - },publishSlotServiceCallback002); - console.log("===ACTS_PublishSlotTypeService_0200 finished===") - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeService_0200====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeService_0300 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT) - */ - it('ACTS_PublishSlotTypeService_0300', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishSlotTypeService_0300"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async(data) =>{ - console.info("===ACTS_PublishSlotTypeService_0300===createSubscriber"+JSON.stringify(data)); - ServiceDataTwo = data - await Subscriber.subscribe(data, subServiceTwoCallBack) - }) - function subServiceTwoCallBack(err,data){ - console.log('===subServiceTwoCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(ServiceDataTwo,UnSubscribeCallBacks) - if(data.code == 31) { - expect(data.code).assertEqual(31) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - await notification.publish({ - id: 31, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test31_title", - text: "test31_text", - additionalText: "test31_additionalText" - }, - }, - // slotType:notification.SlotType.SERVICE_INFORMATION - },publishSlotServiceCallback003); - console.log("===ACTS_PublishSlotTypeService_0300 finished===") - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeService_0300====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeService_0400 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:UNKNOWN_TYPE) - */ - it('ACTS_PublishSlotTypeService_0400', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishSlotTypeService_0400"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async(data) =>{ - console.info("===ACTS_PublishSlotTypeService_0400===createSubscriber"+JSON.stringify(data)); - ServiceDataThree = data - await Subscriber.subscribe(data, subServiceThreeCallBack) - }) - function subServiceThreeCallBack(err,data){ - console.log('===subServiceThreeCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(ServiceDataThree,UnSubscribeCallBackt) - if(data.code == 32) { - expect(data.code).assertEqual(32) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - await notification.publish({ - id: 32, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test32_title", - text: "test32_text", - additionalText: "test32_additionalText" - }, - }, - slotType:notification.SlotType.UNKNOWN_TYPE - },publishSlotServiceCallback004); - console.log("===ACTS_PublishSlotTypeService_0400 finished===") - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeService_0400====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeService_0500 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:SERVICE_INFORMATION) promise - */ - it('ACTS_PublishSlotTypeService_0500', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishSlotTypeService_0500"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async (data) =>{ - console.info("===ACTS_PublishSlotTypeService_0500===createSubscriber"+JSON.stringify(data)); - ServiceDataFour = data - await Subscriber.subscribe(data, subServiceFourCallBack) - }) - function subServiceFourCallBack(err,data){ - console.log('===subServiceFourCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(ServiceDataFour,UnSubscribeCallBacku) - if(data.code == 33) { - expect(data.code).assertEqual(33) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - notification.publish({ - id: 33, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test33_title", - text: "test33_text", - additionalText: "test33_additionalText" - }, - }, - slotType:notification.SlotType.SERVICE_INFORMATION - }).then(console.log("===ACTS_PublishSlotTypeService_0500 finished===")) - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeService_0500====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeService_0600 - * @tc.name: publish() - * @tc.desc: verify the function of publish(slotType:SERVICE_INFORMATION) promise - */ - it('ACTS_PublishSlotTypeService_0600', 0,async function (done) { - var promise = notification.publish({ - id: 34, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - slotType:notification.SlotType.SERVICE_INFORMATION - }) - expect(typeof(promise)).assertEqual("object") - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeService_0600====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeService_0700 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT) promise - */ - it('ACTS_PublishSlotTypeService_0700', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishSlotTypeService_0700"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async (data) =>{ - console.info("===ACTS_PublishSlotTypeService_0700===createSubscriber"+JSON.stringify(data)); - ServiceDataFive = data - await Subscriber.subscribe(data, subServiceFiveCallBack) - }) - function subServiceFiveCallBack(err,data){ - console.log('===subServiceFourCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(ServiceDataFive,UnSubscribeCallBackv) - if(data.code == 35) { - expect(data.code).assertEqual(35) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - notification.publish({ - id: 35, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test35_title", - text: "test35_text", - additionalText: "test35_additionalText" - }, - }, - // slotType:notification.SlotType.SERVICE_INFORMATION - }).then(console.log("===ACTS_PublishSlotTypeService_0700 finished===")) - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeService_0700====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeService_0800 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:UNKNOWN_TYPE) promise - */ - it('ACTS_PublishSlotTypeService_0800', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishSlotTypeService_0800"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async (data) =>{ - console.info("===ACTS_PublishSlotTypeService_0800===createSubscriber"+JSON.stringify(data)); - ServiceDataSix = data - await Subscriber.subscribe(data, subServiceSixCallBack) - }) - function subServiceSixCallBack(err,data){ - console.log('===subServiceSixCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(ServiceDataSix,UnSubscribeCallBackw) - if(data.code == 36) { - expect(data.code).assertEqual(36) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - notification.publish({ - id: 36, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test36_title", - text: "test36_text", - additionalText: "test36_additionalText" - }, - }, - slotType:notification.SlotType.UNKNOWN_TYPE - }).then(console.log("===ACTS_PublishSlotTypeService_0800 finished===")) - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeService_0800====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeSocial_0100 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:SOCIAL_COMMUNICATION) - */ - it('ACTS_PublishSlotTypeSocial_0100', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishSlotTypeSocial_0100"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async (data) =>{ - console.info("===ACTS_PublishSlotTypeSocial_0100===createSubscriber"+JSON.stringify(data)); - SocialDataOne = data - await Subscriber.subscribe(data, subSocialOneCallBack) - }) - function subSocialOneCallBack(err,data){ - console.log('===subSocialOneCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(SocialDataOne,UnSubscribeCallBackx) - if(data.code == 37) { - expect(data.code).assertEqual(37) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - await notification.publish({ - id: 37, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test37_title", - text: "test37_text", - additionalText: "test37_additionalText" - }, - slotType:notification.SlotType.SOCIAL_COMMUNICATION - } - },publishSlotSocialCallback001); - console.log("===ACTS_PublishSlotTypeSocial_0600 finished===") - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeSocial_0100====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeSocial_0200 - * @tc.name: publish() - * @tc.desc: verify the function of publish(slotType:SOCIAL_COMMUNICATION) - */ - it('ACTS_PublishSlotTypeSocial_0200', 0,async function (done) { - await notification.publish({ - id: 38, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - slotType:notification.SlotType.SOCIAL_COMMUNICATION - } - },publishSlotSocialCallback002); - console.log("===ACTS_PublishSlotTypeSocial_0600 finished===") - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeSocial_0200====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeSocial_0300 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT) - */ - it('ACTS_PublishSlotTypeSocial_0300', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishSlotTypeSocial_0300"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async (data) =>{ - console.info("===ACTS_PublishSlotTypeSocial_0300===createSubscriber"+JSON.stringify(data)); - SocialDataTwo = data - await Subscriber.subscribe(data, subSocialTwoCallBack) - }) - function subSocialTwoCallBack(err,data){ - console.log('===subSocialTwoCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(SocialDataTwo,UnSubscribeCallBacky) - if(data.code == 39) { - expect(data.code).assertEqual(39) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - await notification.publish({ - id: 39, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test39_title", - text: "test39_text", - additionalText: "test39_additionalText" - }, - // slotType:notification.SlotType.SOCIAL_COMMUNICATION - } - },publishSlotSocialCallback003); - console.log("===ACTS_PublishSlotTypeSocial_0300 finished===") - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeSocial_0300====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeSocial_0400 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:CONTENT_INFORMATION) - */ - it('ACTS_PublishSlotTypeSocial_0400', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishSlotTypeSocial_0400"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async (data) =>{ - console.info("===ACTS_PublishSlotTypeSocial_0400===createSubscriber"+JSON.stringify(data)); - SocialDataThree = data - await Subscriber.subscribe(data, subSocialThreeCallBack) - }) - function subSocialThreeCallBack(err,data){ - console.log('===subSocialThreeCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(SocialDataThree,UnSubscribeCallBackz) - if(data.code == 40) { - expect(data.code).assertEqual(40) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - await notification.publish({ - id: 40, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test40_title", - text: "test40_text", - additionalText: "test40_additionalText" - }, - slotType:notification.SlotType.CONTENT_INFORMATION - } - },publishSlotSocialCallback004); - console.log("===ACTS_PublishSlotTypeSocial_0400 finished===") - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeSocial_0400====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeSocial_0500 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:SOCIAL_COMMUNICATION) promise - */ - it('ACTS_PublishSlotTypeSocial_0500', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishSlotTypeSocial_0500"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async (data) =>{ - console.info("===ACTS_PublishSlotTypeSocial_0500===createSubscriber"+JSON.stringify(data)); - SocialDataFour = data - await Subscriber.subscribe(data, subSocialFourCallBack) - }) - function subSocialFourCallBack(err,data){ - console.log('===subSocialFourCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(SocialDataFour,UnSubscribeCallBackA) - if(data.code == 41) { - expect(data.code).assertEqual(41) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - notification.publish({ - id: 41, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test41_title", - text: "test41_text", - additionalText: "test41_additionalText" - }, - slotType:notification.SlotType.SOCIAL_COMMUNICATION - } - }).then(console.log("===ACTS_PublishSlotTypeSocial_0500 finished===")) - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeSocial_0500====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeSocial_0600 - * @tc.name: publish() - * @tc.desc: verify the function of publish(slotType:SOCIAL_COMMUNICATION) promise - */ - it('ACTS_PublishSlotTypeSocial_0600', 0,async function (done) { - var promise = notification.publish({ - id: 42, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - slotType:notification.SlotType.SOCIAL_COMMUNICATION - } - }) - expect(typeof(promise)).assertEqual("object") - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeSocial_0600====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeSocial_0700 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT) promise - */ - it('ACTS_PublishSlotTypeSocial_0700', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishSlotTypeSocial_0700"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async (data) =>{ - console.info("===ACTS_PublishSlotTypeSocial_0700===createSubscriber"+JSON.stringify(data)); - SocialDataFive = data - await Subscriber.subscribe(data, subSocialFiveCallBack) - }) - function subSocialFiveCallBack(err,data){ - console.log('===subSocialFiveCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(SocialDataFive,UnSubscribeCallBackB) - if(data.code == 43) { - expect(data.code).assertEqual(43) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - notification.publish({ - id: 43, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test43_title", - text: "test43_text", - additionalText: "test43_additionalText" - }, - //slotType:notification.SlotType.SOCIAL_COMMUNICATION - } - }).then(console.log("===ACTS_PublishSlotTypeSocial_0700 finished==="), - ) - setTimeout(function(){ - console.debug("====>time out ACTS_PublishSlotTypeSocial_0700====>"); - }, time); - }) - - /* - * @tc.number: ACTS_PublishSlotTypeSocial_0800 - * @tc.name: publish() - * @tc.desc: verify the function of publish(contentType:NOTIFICATION_CONTENT_BASIC_TEXT,slotType:CONTENT_INFORMATION) promise - */ - it('ACTS_PublishSlotTypeSocial_0800', 0,async function (done) { - var commonEventSubscribeInfo = { - events: ["ACTS_PublishSlotTypeSocial_0800"] - }; - await Subscriber.createSubscriber( - commonEventSubscribeInfo).then(async (data) =>{ - console.info("===ACTS_PublishSlotTypeSocial_0800===createSubscriber"+JSON.stringify(data)); - SocialDataSix = data - await Subscriber.subscribe(data, subSocialSixCallBack) - }) - function subSocialSixCallBack(err,data){ - console.log('===subSocialSixCallBack==='+err.code+JSON.stringify(data)) - Subscriber.unsubscribe(SocialDataSix,UnSubscribeCallBackC) - if(data.code == 44) { - expect(data.code).assertEqual(44) - done(); - } - else{ - expect().assertFail(); - done(); - } - } - notification.publish({ - id: 44, - content: { - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test44_title", - text: "test44_text", - additionalText: "test44_additionalText" - }, - slotType:notification.SlotType.CONTENT_INFORMATION - } - }).then(console.log("===ACTS_PublishSlotTypeSocial_0800 finished===")) - }) -})} diff --git a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/test/List.test.js deleted file mode 100644 index 8fc55ae2459c3f5b8a754e4d9fe991619eb36df7..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsNotificationTest from './ExampleJsunit.test.js' -export default function testsuite() { -ActsAnsNotificationTest() -} diff --git a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/resources/base/element/string.json deleted file mode 100644 index 502a089b01103c8b92804386164218e61745e4bd..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/publishtype/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ContentType" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/publishcontentype/sub/BUILD.gn b/notification/ans_standard/publish_test/publishcontentype/sub/BUILD.gn deleted file mode 100644 index f11800a1d5bcceaf55b65719593d1df5ff4159d2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/sub/BUILD.gn +++ /dev/null @@ -1,33 +0,0 @@ -# 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_hap_assist_suite("ActsAnsCommonEventTest") { - hap_profile = "./entry/src/main/config.json" - hap_name = "ActsAnsCommonEventTest" - subsystem_name = "notification" - part_name = "distributed_notification_service" - testonly = true - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/config.json b/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/config.json deleted file mode 100644 index 7318b0735593cd5ab0af6b9281729c67f3694c91..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/config.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanscommoneventtest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanscommoneventtest", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "com.example.actsanscommoneventtest.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/publishcontentype/sub/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/default/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/default/pages/index/index.hml deleted file mode 100644 index 7f367d751c4d70d4adc241e94d92613b74bbc8be..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Publishing CommonEvent - -
diff --git a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index 03d35a7573e3b6d8269ded8d41341a17e812391c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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' -import {Core, ExpectExtend} from 'deccjsunit/index' - -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') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - - require('../../../test/List.test') - core.execute() - }, - onReady() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 6d530caefcdbe79f49db0b49fb864ed4daaeaac0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "Sub1" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/test/List.test.js deleted file mode 100644 index 41999288d49304127387014dc88894130a148ab4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/test/List.test.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * 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. - */ -require('./Subscriber.js') \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/test/Subscriber.js b/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/test/Subscriber.js deleted file mode 100644 index c423113605fa3a8555673587ea9574b119a353c1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishcontentype/sub/entry/src/main/js/test/Subscriber.js +++ /dev/null @@ -1,578 +0,0 @@ -/* - * 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 Subscriber from '@ohos.commonEvent' -import notification from '@ohos.notification' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -var multiLineDataOne -var multiLineDataTwo -var LongContentDataOne -var LongContentDataTwo -var SlotTypeDataOne -var SlotTypeDataTwo -var SlotTypeDataThree -var SlotTypeDataFour -var SlotTypeDataFive -var SlotTypeDataSix -var OtherDataOne -var OtherDataTwo -var OtherDataThree -var OtherDataFour -var OtherDataFive -var OtherDataSix -var ServiceDataOne -var ServiceDataTwo -var ServiceDataThree -var ServiceDataFour -var ServiceDataFive -var ServiceDataSix -var SocialDataOne -var SocialDataTwo -var SocialDataThree -var SocialDataFour -var SocialDataFive -var SocialDataSix -var time = 1000 -function publishCallbacka(err) { - console.info("===>publishCallbacka"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackb(err) { - console.info("===>publishCallbackb"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackc(err) { - console.info("===>publishCallbackc"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackd(err) { - console.info("===>publishCallbackd"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbacke(err) { - console.info("===>publishCallbacke"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackf(err) { - console.info("===>publishCallbackf"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackg(err) { - console.info("===>publishCallbackg"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackh(err) { - console.info("===>publishCallbackh"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbacki(err) { - console.info("===>publishCallbacki"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackj(err) { - console.info("===>publishCallbackj"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackl(err) { - console.info("===>publishCallbackl"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackm(err) { - console.info("===>publishCallbackm"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackn(err) { - console.info("===>publishCallbackn"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbacko(err) { - console.info("===>publishCallbacko"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackp(err) { - console.info("===>publishCallbackp"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackq(err) { - console.info("===>publishCallbackq"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackr(err) { - console.info("===>publishCallbackr"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbacks(err) { - console.info("===>publishCallbacks"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackt(err) { - console.info("===>publishCallbackt"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbacku(err) { - console.info("===>publishCallbacku"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackv(err) { - console.info("===>publishCallbackv"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackw(err) { - console.info("===>publishCallbackw"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackx(err) { - console.info("===>publishCallbackx"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbacky(err) { - console.info("===>publishCallbacky"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackz(err) { - console.info("===>publishCallbackz"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackA(err) { - console.info("===>publishCallbackA"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackB(err) { - console.info("===>publishCallbackB"+err.code); - expect(err.code).assertEqual(0); -} -function publishCallbackC(err) { - console.info("===>publishCallbackC"+err.code); - expect(err.code).assertEqual(0); -} -describe('ActsAnsCommonEventTest', function () { - console.info("==ActsAnsCommonEventTest start==>"); - //consume - function consumeCallback(data) { - console.debug("===>consumeCallback data===>" + JSON.stringify(data)); - if(data.request.id == 1) { - if(data.request.content.multiLine.title === "test1_title") - { - multiLineDataOne = { - code: 1 - } - } - else{ - multiLineDataOne = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishMULTILINEContent_0100", multiLineDataOne, publishCallbacka); - } - else if(data.request.id == 4){ - if(data.request.content.multiLine.title == "test4_title") - { - multiLineDataTwo = { - code: 4 - } - } - else{ - multiLineDataTwo = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishMULTILINEContent_0400", multiLineDataTwo, publishCallbackb); - }else if(data.request.id == 7){ - if(data.request.content.longText.title == "test7_title") - { - LongContentDataOne = { - code: 7 - } - } - else{ - LongContentDataOne = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishLONGContent_0100", LongContentDataOne, publishCallbackc); - } - else if(data.request.id == 10){ - if(data.request.content.longText.title == "test10_title") - { - LongContentDataTwo = { - code: 10 - } - } - else{ - LongContentDataTwo = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishLONGContent_0400", LongContentDataTwo, publishCallbackd); - } - else if(data.request.id == 13){ - if(data.request.content.normal.title == "test13_title") - { - SlotTypeDataOne = { - code: 13 - } - } - else{ - SlotTypeDataOne = { - code: 0 - } - } - Subscriber.publish("ACTS_Publish_SlotTypeContent_0100", SlotTypeDataOne, publishCallbacke); - } - else if(data.request.id == 15){ - if(data.request.content.normal.title == "test15_title") - { - SlotTypeDataTwo = { - code: 15 - } - } - else{ - SlotTypeDataTwo = { - code: 0 - } - } - Subscriber.publish("ACTS_Publish_SlotTypeContent_0300", SlotTypeDataTwo, publishCallbackf); - } - else if(data.request.id == 16){ - if(data.request.content.normal.title == "test16_title") - { - SlotTypeDataThree = { - code: 16 - } - } - else{ - SlotTypeDataThree = { - code: 0 - } - } - Subscriber.publish("ACTS_Publish_SlotTypeContent_0400", SlotTypeDataThree, publishCallbackg); - } - else if(data.request.id == 17){ - if(data.request.content.normal.title == "test17_title") - { - SlotTypeDataFour = { - code: 17 - } - } - else{ - SlotTypeDataFour = { - code: 0 - } - } - Subscriber.publish("ACTS_Publish_SlotTypeContent_0500", SlotTypeDataFour, publishCallbackh); - } - else if(data.request.id == 19){ - if(data.request.content.normal.title == "test19_title") - { - SlotTypeDataFive = { - code: 19 - } - } - else{ - SlotTypeDataFive = { - code: 0 - } - } - Subscriber.publish("ACTS_Publish_SlotTypeContent_0700", SlotTypeDataFive, publishCallbacki); - } - else if(data.request.id == 20){ - if(data.request.content.normal.title == "test20_title") - { - SlotTypeDataSix = { - code: 20 - } - } - else{ - SlotTypeDataSix = { - code: 0 - } - } - Subscriber.publish("ACTS_Publish_SlotTypeContent_0800", SlotTypeDataSix, publishCallbackj); - } - else if(data.request.id == 21){ - if(data.request.content.normal.title == "test21_title") - { - OtherDataOne = { - code: 21 - } - } - else{ - OtherDataOne = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishSlotTypeOther_0100", OtherDataOne, publishCallbackl); - } - else if(data.request.id == 23){ - if(data.request.content.normal.title == "test23_title") - { - OtherDataTwo = { - code: 23 - } - } - else{ - OtherDataTwo = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishSlotTypeOther_0300", OtherDataTwo, publishCallbackm); - } - else if(data.request.id == 24){ - if(data.request.content.normal.title == "test24_title") - { - OtherDataThree = { - code: 24 - } - } - else{ - OtherDataThree = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishSlotTypeOther_0400", OtherDataThree, publishCallbackn); - } - else if(data.request.id == 25){ - if(data.request.content.normal.title == "test25_title") - { - OtherDataFour = { - code: 25 - } - } - else{ - OtherDataFour = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishSlotTypeOther_0500", OtherDataFour, publishCallbacko); - } - else if(data.request.id == 27){ - if(data.request.content.normal.title == "test27_title") - { - OtherDataFive = { - code: 27 - } - } - else{ - OtherDataFive= { - code: 0 - } - } - Subscriber.publish("ACTS_PublishSlotTypeOther_0700", OtherDataFive, publishCallbackp); - } - else if(data.request.id == 28){ - if(data.request.content.normal.title == "test28_title") - { - OtherDataSix = { - code: 28 - } - } - else{ - OtherDataSix = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishSlotTypeOther_0800", OtherDataSix, publishCallbackq); - } - else if(data.request.id == 29){ - if(data.request.content.normal.title == "test29_title") - { - ServiceDataOne = { - code: 29 - } - } - else{ - ServiceDataOne = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishSlotTypeService_0100", ServiceDataOne, publishCallbackr); - } - else if(data.request.id == 31){ - if(data.request.content.normal.title == "test31_title") - { - ServiceDataTwo = { - code: 31 - } - } - else{ - ServiceDataTwo = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishSlotTypeService_0300", ServiceDataTwo, publishCallbacks); - } - else if(data.request.id == 32){ - if(data.request.content.normal.title == "test32_title") - { - ServiceDataThree = { - code: 32 - } - } - else{ - ServiceDataThree = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishSlotTypeService_0400", ServiceDataThree, publishCallbackt); - } - else if(data.request.id == 33){ - if(data.request.content.normal.title == "test33_title") - { - ServiceDataFour = { - code: 33 - } - } - else{ - ServiceDataFour = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishSlotTypeService_0500", ServiceDataFour, publishCallbacku); - } - else if(data.request.id == 35){ - if(data.request.content.normal.title == "test35_title") - { - ServiceDataFive = { - code: 35 - } - } - else{ - ServiceDataFive = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishSlotTypeService_0700", ServiceDataFive, publishCallbackv); - } - else if(data.request.id == 36){ - if(data.request.content.normal.title == "test36_title") - { - ServiceDataSix = { - code: 36 - } - } - else{ - ServiceDataSix = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishSlotTypeService_0800", ServiceDataSix, publishCallbackw); - } - else if(data.request.id == 37){ - if(data.request.content.normal.title == "test37_title") - { - SocialDataOne = { - code: 37 - } - } - else{ - SocialDataOne = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishSlotTypeSocial_0100", SocialDataOne, publishCallbackx); - } - else if(data.request.id == 39){ - if(data.request.content.normal.title == "test39_title") - { - SocialDataTwo= { - code: 39 - } - } - else{ - SocialDataTwo = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishSlotTypeSocial_0300", SocialDataTwo, publishCallbacky); - } - else if(data.request.id == 40){ - if(data.request.content.normal.title == "test40_title") - { - SocialDataThree = { - code: 40 - } - } - else{ - SocialDataThree = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishSlotTypeSocial_0400", SocialDataThree, publishCallbackz); - } - else if(data.request.id == 41){ - if(data.request.content.normal.title == "test41_title") - { - SocialDataFour = { - code: 41 - } - } - else{ - SocialDataFour = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishSlotTypeSocial_0500", SocialDataFour, publishCallbackA); - } - else if(data.request.id == 43){ - if(data.request.content.normal.title == "test43_title") - { - SocialDataFive = { - code: 43 - } - } - else{ - SocialDataFive = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishSlotTypeSocial_0700", SocialDataFive, publishCallbackB); - } - else if(data.request.id == 44){ - if(data.request.content.normal.title == "test44_title") - { - SocialDataSix = { - code: 44 - } - } - else{ - SocialDataSix = { - code: 0 - } - } - Subscriber.publish("ACTS_PublishSlotTypeSocial_0800", SocialDataSix, publishCallbackC); - } - } - //subscribeOn - function subscribeOnCallback() { - console.debug("===>onConnectCallback===>"); - } - /* - * @tc.number: ActsDoNotSubscriber_test_0100 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsCommonSubscriber_test_0100', 0, async function (done) { - console.debug("===ActsCommonSubscriber_test_0100====begin===>"); - var subInfo ={ - onConsume:consumeCallback, - onConnect:subscribeOnCallback, - } - await notification.subscribe(subInfo,(err) => { - console.debug("===>subscribeCallback===>"+err.code) - expect(err.code).assertEqual(0); - done() - }); - }) -}) - diff --git a/notification/ans_standard/publish_test/publishcontentype/sub/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/publishcontentype/sub/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/publishcontentype/sub/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/publishremovalwantagent/BUILD.gn b/notification/ans_standard/publish_test/publishremovalwantagent/BUILD.gn deleted file mode 100644 index 1aa720db1793af0319606ef65bc0fc96f3da69ee..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsPublishRemovalWantAgentTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsPublishRemovalWantAgentTest" - 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/publish_test/publishremovalwantagent/Test.json b/notification/ans_standard/publish_test/publishremovalwantagent/Test.json deleted file mode 100644 index 84d03e29275efa706d473bea7e13365719f1d72d..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "shell-timeout": "180000", - "bundle-name": "com.example.actsanspublishremovalwantagenttest", - "package-name": "com.example.actsanspublishremovalwantagenttest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsPublishRemovalWantAgentTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishremovalwantagent/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/publishremovalwantagent/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/publishremovalwantagent/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/config.json b/notification/ans_standard/publish_test/publishremovalwantagent/src/main/config.json deleted file mode 100644 index 30bc87892a1430a0b675a026b2907d60984eb971..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanspublishremovalwantagenttest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanspublishremovalwantagenttest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/MainAbility/app.js deleted file mode 100644 index 4f1747a95c4acbb66db5351e826c31584356e11c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* -* 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/publish_test/publishremovalwantagent/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index ce4e6b40edd7eb62ef3fc4d380c8bc597e79fae5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Test of Publishing vibrating Notification - -
diff --git a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index ea04be4dfb189497d14d2e3cf69041742d6dee6e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,44 +0,0 @@ - -/* -* 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' -import app from '@system.app' -import device from '@system.device' -import router from '@system.router' - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - const reportExtend = new ReportExtend(file) - core.addService('expect', expectExtend) - core.addService('report', reportExtend) - core.init() - const configService = core.getDefaultService('config') - configService.setConfig(this) - - require('../../../test/List.test') - core.execute() - } -} diff --git a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/publishremovalwantagent/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/publishremovalwantagent/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/publishremovalwantagent/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index 4a4b1862233c3197d1fc50ec2f8f4df3a07ce9a2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,141 +0,0 @@ -/* - * 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 notify from '@ohos.notification' -import WantAgent from '@ohos.wantAgent' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -var timeout = 1000; -export default function ActsAnsPublishRemovalWantAgentTest() { -describe('ActsAnsPublishRemovalWantAgentTest', function () { - console.info("===========ActsAnsPublishRemovalWantAgentTest start====================>"); - - /* - * @tc.number: ACTS_PublishRemovalWantAgent_xts_0100 - * @tc.name: removalWantAgent - * @tc.desc: publish removalWantAgent notification - */ - function consumeCallback(data) { - console.info("===>consumeCallback data : ===>" +JSON.stringify(data)); - var wantAgentObj = data.removalWantAgent - console.info("===>wantAgent: ===>" + JSON.stringify(wantAgentObj)) - WantAgent.getWant(wantAgentObj).then((data) => { - expect(data[0].action).assertEqual("usual.event.REMOVAL_WANTAGENT"); - }); - } - - it('ACTS_PublishRemovalWantAgent_xts_0100', 0, async function (done) { - console.info("===ACTS_PublishRemovalWantAgent_xts_0100===begin===>"); - var subInfo ={ - onConsume:consumeCallback - } - notify.subscribe(subInfo); - - var agentInfo = { - wants: [ - { - bundleName: 'com.example.actsanspublishremovalwantagenttest', - abilityName: 'com.example.actsanspublishremovalwantagenttest.MainAbility', - action: "usual.event.REMOVAL_WANTAGENT" - } - ], - operationType: WantAgent.OperationType.SEND_COMMON_EVENT, - requestCode: 0, - wantAgentFlags:[WantAgent.WantAgentFlags.ONE_TIME_FLAG] - }; - - var wantAgentData = await WantAgent.getWantAgent(agentInfo); - - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_LONG_TEXT, - longText : { - title: "test_title", - text: "test_text", - additionalText: "test_PublishRemovalWantAgent", - longText: "longText123456", - briefText: "briefText123456", - expandedTitle: "expandedTitle123456" - }, - }, - id: 1, - slotType : notify.SlotType.SERVICE_INFORMATION, - removalWantAgent : wantAgentData - } - console.info("===ACTS_PublishRemovalWantAgent_xts_0100===publish===>"); - await notify.publish(notificationRequest, (err) => { - console.info("===>publish callback===>"+err.code); - expect(err.code).assertEqual(0) - }); - console.info("===ACTS_PublishRemovalWantAgent_xts_0100===end===>"); - - setTimeout((async function(){ - notify.unsubscribe(subInfo); - console.info("======ACTS_PublishRemovalWantAgent_xts_0100 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - /* - * @tc.number: SetEnabledForUninstallApp_test_0100 - * @tc.name: set and get enabled when distributed device without app - * @tc.desc: set true and get true - */ - it('SetEnabledForUninstallApp_test_0100', 0, async function (done) { - await notify.setSyncNotificationEnabledWithoutApp( - 100,true,async() => { - await notify.getSyncNotificationEnabledWithoutApp(100, (err,data) => { - console.log("===>getSyncNotificationEnabledWithoutApp===>"+err+data) - expect(data).assertEqual(true) - done(); - }) - }) - }) - - /* - * @tc.number: SetEnabledForUninstallApp_test_0200 - * @tc.name: set and get enabled when distributed device without app - * @tc.desc: set false and get false - */ - it('SetEnabledForUninstallApp_test_0200', 0, async function (done) { - await notify.setSyncNotificationEnabledWithoutApp( - 100,false,async() => { - await notify.getSyncNotificationEnabledWithoutApp(100, (err,data) => { - console.log("===>getSyncNotificationEnabledWithoutApp===>"+err+data) - expect(data).assertEqual(false) - done(); - }) - }) - }) - - /* - * @tc.number: SetEnabledForUninstallApp_test_0300 - * @tc.name: set and get enabled when distributed device without app (promise) - * @tc.desc: set true and get true - */ - it('SetEnabledForUninstallApp_test_0300', 0, async function (done) { - notify.setSyncNotificationEnabledWithoutApp(100, true).then(() => { - notify.getSyncNotificationEnabledWithoutApp(100).then((data) => { - console.log("===>getSyncNotificationEnabledWithoutApp===>"+data) - expect(data).assertEqual(true) - done(); - }).catch((err) => { - Logger.error(TAG, - `===>getSyncNotificationEnabledWithoutApp failed because ${JSON.stringify(err)}`); - }); - }).catch((err) => { - Logger.error(TAG, `===>setSyncNotificationEnabledWithoutApp failed because ${JSON.stringify(err)}`); - }); - }) -}) } diff --git a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/test/List.test.js deleted file mode 100644 index ae0f3613bf4343baf62b394c2e261c30ec81d1cb..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* -* 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 ActsAnsPublishRemovalWantAgentTest from './ExampleJsunit.test.js' -export default function testsuite() { -ActsAnsPublishRemovalWantAgentTest() -} diff --git a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/publishremovalwantagent/src/main/resources/base/element/string.json deleted file mode 100644 index 37434ea7ff0abc3a132e85b7f7727c1429e84cf2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishremovalwantagent/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "PubVibra" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/publishsound/BUILD.gn b/notification/ans_standard/publish_test/publishsound/BUILD.gn deleted file mode 100644 index 0dce2f6e17e12513a70ef28f72acb99d9e9442ca..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsPublishSoundTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsPublishSoundTest" - 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/publish_test/publishsound/Test.json b/notification/ans_standard/publish_test/publishsound/Test.json deleted file mode 100644 index 69ab6d567cbe3bddbdd0d066dd7fe2be276a7669..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "com.example.actsanspublishsoundtest", - "package-name": "com.example.actsanspublishsoundtest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsPublishSoundTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishsound/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/publishsound/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/publishsound/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/publishsound/src/main/config.json b/notification/ans_standard/publish_test/publishsound/src/main/config.json deleted file mode 100644 index 4492820516c8c3fd9bfbc33353677fb86f171fe5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanspublishsoundtest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanspublishsoundtest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/publishsound/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/publishsound/src/main/js/MainAbility/app.js deleted file mode 100644 index 4f1747a95c4acbb66db5351e826c31584356e11c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* -* 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/publish_test/publishsound/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/publishsound/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishsound/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/publishsound/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishsound/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/publishsound/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/publishsound/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/publishsound/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 517b7c3527ee9850013beab7d3432d086229ec19..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Test of Publishing Voice Notification - -
diff --git a/notification/ans_standard/publish_test/publishsound/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/publishsound/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 09b901119e09e1943c64d1ea0d855188fbe203a3..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,32 +0,0 @@ - -/* -* 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' -import app from '@system.app' -import device from '@system.device' -import router from '@system.router' - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - - } -} diff --git a/notification/ans_standard/publish_test/publishsound/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/publishsound/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/publishsound/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/publishsound/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishsound/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/publishsound/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishsound/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/publishsound/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/publishsound/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/publishsound/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/publishsound/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/publishsound/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/publishsound/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/publishsound/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/publishsound/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/publish_test/publishsound/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index 7edb397f3667d73d40259bc7230f385ce5094358..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,1028 +0,0 @@ -/* - * 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 notify from '@ohos.notification' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -export default function ActsAnsPublishSoundTest() { -describe('ActsAnsPublishSoundTest', function () { - console.info("===========ActsAnsPublishSoundTest start====================>"); - var timeout = 1000 - var bundleoption = { - bundle: "com.example.actsanspublishsoundtest" - } - var timesOfOnConsume - function onConsume0100(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishSound_0100 onConsume start============>"); - console.info("=============Ans_PublishSound_0100 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var sound = data.sortingMap.sortings[hashCode].slot.sound - console.info("=============Ans_PublishSound_0100 onConsume sound============>" + sound); - if (timesOfOnConsume == 1){ - expect(sound != undefined).assertTrue(); - console.info("=============Ans_PublishSound_0100 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(sound).assertEqual("sound_0100"); - console.info("=============Ans_PublishSound_0100 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishSound_0100 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishSound_0100 - * @tc.name: addSlot(type: SlotType): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a SOCIAL_COMMUNICATION type slot, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishSound_0100', 0,async function (done) { - console.info("===============Ans_PublishSound_0100================>"); - timesOfOnConsume = 0; - var subscriber ={ - onConsume:onConsume0100 - } - notify.subscribe(subscriber); - console.info("===============Ans_PublishSound_0100 subscribe======>"); - notify.addSlot(notify.SlotType.SOCIAL_COMMUNICATION); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 1, - slotType : notify.SlotType.SOCIAL_COMMUNICATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0100", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishSound_0100 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.SOCIAL_COMMUNICATION, - sound:"sound_0100", - }).then(()=>{ - console.info("=======Ans_PublishSound_0100 setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishSound_0100 setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishSound_0100 setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishSound_0100 publish1 then catch err======>"+err); - }) - setTimeout((async function(){ - console.info("======Ans_PublishSound_0100 setTimeout========>"); - notify.removeSlot(notify.SlotType.SOCIAL_COMMUNICATION); - notify.unsubscribe(subscriber); - console.info("======Ans_PublishSound_0100 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0200(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishSound_0200 onConsume start============>"); - console.info("=============Ans_PublishSound_0200 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var sound = data.sortingMap.sortings[hashCode].slot.sound - console.info("=============Ans_PublishSound_0200 onConsume sound============>" + sound); - if (timesOfOnConsume == 1){ - expect(sound != undefined).assertTrue(); - console.info("=============Ans_PublishSound_0200 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(sound).assertEqual("sound_0200"); - console.info("=============Ans_PublishSound_0200 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishSound_0200 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishSound_0200 - * @tc.name: addSlot(type: SlotType): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a SERVICE_INFORMATION type slot, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishSound_0200', 0,async function (done) { - console.info("===============Ans_PublishSound_0200================>"); - timesOfOnConsume = 0; - var subscriber ={ - onConsume:onConsume0200 - } - notify.subscribe(subscriber); - console.info("===============Ans_PublishSound_0200 subscribe======>"); - notify.addSlot(notify.SlotType.SERVICE_INFORMATION); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 2, - slotType : notify.SlotType.SERVICE_INFORMATION , - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0200", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishSound_0200 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.SERVICE_INFORMATION , - sound:"sound_0200", - }).then(()=>{ - console.info("=======Ans_PublishSound_0200 setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishSound_0200 setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishSound_0200 setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishSound_0200 publish1 then catch err======>"+err); - }) - setTimeout((async function(){ - console.info("======Ans_PublishSound_0200 setTimeout========>"); - notify.removeSlot(notify.SlotType.SERVICE_INFORMATION); - notify.unsubscribe(subscriber); - console.info("======Ans_PublishSound_0200 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0300(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishSound_0300 onConsume start============>"); - console.info("=============Ans_PublishSound_0300 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var sound = data.sortingMap.sortings[hashCode].slot.sound - console.info("=============Ans_PublishSound_0300 onConsume sound============>" + sound); - if (timesOfOnConsume == 1){ - expect(sound).assertEqual(""); - console.info("=========Ans_PublishSound_0300 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(sound).assertEqual("sound_0300"); - console.info("=========Ans_PublishSound_0300 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishSound_0300 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishSound_0300 - * @tc.name: addSlot(type: SlotType): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a CONTENT_INFORMATION type slot, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishSound_0300', 0,async function (done) { - console.info("===============Ans_PublishSound_0300================>"); - timesOfOnConsume = 0; - var subscriber ={ - onConsume:onConsume0300 - } - notify.subscribe(subscriber); - console.info("===============Ans_PublishSound_0300 subscribe======>"); - notify.addSlot(notify.SlotType.CONTENT_INFORMATION); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 3, - slotType : notify.SlotType.CONTENT_INFORMATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0300", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishSound_0300 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.CONTENT_INFORMATION, - sound:"sound_0300", - }).then(()=>{ - console.info("=======Ans_PublishSound_0300 setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishSound_0300 setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishSound_0300 setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishSound_0300 publish1 then catch err======>"+err); - }) - - setTimeout((async function(){ - console.info("======Ans_PublishSound_0300 setTimeout========>"); - notify.removeSlot(notify.SlotType.CONTENT_INFORMATION); - notify.unsubscribe(subscriber); - console.info("======Ans_PublishSound_0300 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0400(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishSound_0400 onConsume start============>"); - console.info("=============Ans_PublishSound_0400 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var sound = data.sortingMap.sortings[hashCode].slot.sound - console.info("=============Ans_PublishSound_0400 onConsume sound============>" + sound); - if (timesOfOnConsume == 1){ - expect(sound).assertEqual(""); - console.info("=========Ans_PublishSound_0400 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(sound).assertEqual("sound_0400"); - console.info("=========Ans_PublishSound_0400 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishSound_0400 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishSound_0400 - * @tc.name: addSlot(type: SlotType): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a OTHER_TYPES type slot, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishSound_0400', 0,async function (done) { - console.info("===============Ans_PublishSound_0400================>"); - timesOfOnConsume = 0; - var subscriber = { - onConsume:onConsume0400 - } - notify.subscribe(subscriber); - console.info("===============Ans_PublishSound_0400 subscribe======>"); - notify.addSlot(notify.SlotType.OTHER_TYPES); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 4, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0400", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishSound_0400 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.OTHER_TYPES, - sound:"sound_0400", - }).then(()=>{ - console.info("=======Ans_PublishSound_0400 setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishSound_0400 setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishSound_0400 setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishSound_0400 publish1 then catch err======>"+err); - }) - setTimeout((async function(){ - console.info("======Ans_PublishSound_0400 setTimeout========>"); - notify.removeSlot(notify.SlotType.OTHER_TYPES); - notify.unsubscribe(subscriber); - console.info("======Ans_PublishSound_0400 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0500(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishSound_0500 onConsume start============>"); - console.info("=============Ans_PublishSound_0500 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var sound = data.sortingMap.sortings[hashCode].slot.sound - console.info("=============Ans_PublishSound_0500 onConsume sound============>" + sound); - if (timesOfOnConsume == 1){ - expect(sound).assertEqual(""); - console.info("=========Ans_PublishSound_0500 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(sound).assertEqual("sound_0500"); - console.info("=========Ans_PublishSound_0500 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishSound_0500 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishSound_0500 - * @tc.name: addSlot(type: SlotType): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a UNKNOWN_TYPE type slot, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishSound_0500', 0,async function (done) { - console.info("===============Ans_PublishSound_0500================>"); - timesOfOnConsume = 0; - var subscriber = { - onConsume:onConsume0500 - } - notify.subscribe(subscriber); - console.info("===============Ans_PublishSound_0500 subscribe======>"); - notify.addSlot(notify.SlotType.UNKNOWN_TYPE); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 5, - slotType : notify.SlotType.UNKNOWN_TYPE, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0500", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishSound_0500 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.OTHER_TYPES, - sound:"sound_0500", - }).then(()=>{ - console.info("=======Ans_PublishSound_0500 setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishSound_0500 setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishSound_0500 setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishSound_0500 publish1 then catch err======>"+err); - }) - setTimeout((async function(){ - console.info("======Ans_PublishSound_0500 setTimeout========>"); - notify.removeSlot(notify.SlotType.UNKNOWN_TYPE); - notify.unsubscribe(subscriber); - console.info("======Ans_PublishSound_0500 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0600(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishSound_0600 onConsume start============>"); - console.info("=============Ans_PublishSound_0600 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var sound = data.sortingMap.sortings[hashCode].slot.sound - console.info("=============Ans_PublishSound_0600 onConsume sound============>" + sound); - if (timesOfOnConsume == 1){ - expect(sound).assertEqual("sound_0600"); - console.info("=============Ans_PublishSound_0600 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(sound).assertEqual("sound_0600_set"); - console.info("=============Ans_PublishSound_0600 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishSound_0600 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishSound_0600 - * @tc.name: addSlot(slot: NotificationSlot): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a SOCIAL_COMMUNICATION type slot, set sound information, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishSound_0600', 0,async function (done) { - console.info("===============Ans_PublishSound_0600================>"); - timesOfOnConsume = 0; - var subscriber ={ - onConsume:onConsume0600 - } - notify.subscribe(subscriber); - console.info("===============Ans_PublishSound_0600 subscribe======>"); - notify.addSlot({ - type:notify.SlotType.SOCIAL_COMMUNICATION, - sound:"sound_0600", - }); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 6, - slotType : notify.SlotType.SOCIAL_COMMUNICATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0600", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishSound_0600 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.SOCIAL_COMMUNICATION, - sound:"sound_0600_set", - }).then(()=>{ - console.info("=======Ans_PublishSound_0600 setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishSound_0600 setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishSound_0600 setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishSound_0600 publish1 then catch err======>"+err); - }) - setTimeout((async function(){ - console.info("======Ans_PublishSound_0600 setTimeout========>"); - notify.removeSlot(notify.SlotType.SOCIAL_COMMUNICATION); - notify.unsubscribe(subscriber); - console.info("======Ans_PublishSound_0600 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0700(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishSound_0700 onConsume start============>"); - console.info("=============Ans_PublishSound_0700 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var sound = data.sortingMap.sortings[hashCode].slot.sound - console.info("=============Ans_PublishSound_0700 onConsume sound============>" + sound); - if (timesOfOnConsume == 1){ - expect(sound).assertEqual("sound_0700"); - console.info("=============Ans_PublishSound_0700 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(sound).assertEqual("sound_0700_set"); - console.info("=============Ans_PublishSound_0700 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishSound_0700 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishSound_0700 - * @tc.name: addSlot(slot: NotificationSlot): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a SERVICE_INFORMATION type slot, set sound information, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishSound_0700', 0,async function (done) { - console.info("===============Ans_PublishSound_0700================>"); - timesOfOnConsume = 0; - var subscriber ={ - onConsume:onConsume0700 - } - notify.subscribe(subscriber); - console.info("===============Ans_PublishSound_0700v subscribe======>"); - notify.addSlot({ - type:notify.SlotType.SERVICE_INFORMATION, - sound:"sound_0700", - }); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 7, - slotType : notify.SlotType.SERVICE_INFORMATION , - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0700", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishSound_0700 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.SERVICE_INFORMATION , - sound:"sound_0700_set", - }).then(()=>{ - console.info("=======Ans_PublishSound_0700 setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishSound_0700 setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishSound_0700 setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishSound_0700 publish1 then catch err======>"+err); - }) - setTimeout((async function(){ - console.info("======Ans_PublishSound_0700 setTimeout========>"); - notify.removeSlot(notify.SlotType.SERVICE_INFORMATION); - notify.unsubscribe(subscriber); - console.info("======Ans_PublishSound_0700 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0800(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishSound_0800 onConsume start============>"); - console.info("=============Ans_PublishSound_0800 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var sound = data.sortingMap.sortings[hashCode].slot.sound - console.info("=============Ans_PublishSound_0800 onConsume sound============>" + sound); - if (timesOfOnConsume == 1){ - expect(sound).assertEqual("sound_0800"); - console.info("=========Ans_PublishSound_0800 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(sound).assertEqual("sound_0800_set"); - console.info("=========Ans_PublishSound_0800 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishSound_0800 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishSound_0800 - * @tc.name: addSlot(slot: NotificationSlot): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a CONTENT_INFORMATION type slot, set sound information, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishSound_0800', 0,async function (done) { - console.info("===============Ans_PublishSound_0800================>"); - timesOfOnConsume = 0; - var subscriber ={ - onConsume:onConsume0800 - } - notify.subscribe(subscriber); - console.info("===============Ans_PublishSound_0800 subscribe======>"); - notify.addSlot({ - type:notify.SlotType.CONTENT_INFORMATION, - sound:"sound_0800", - }); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 8, - slotType : notify.SlotType.CONTENT_INFORMATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0800", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishSound_0800 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.CONTENT_INFORMATION, - sound:"sound_0800_set", - }).then(()=>{ - console.info("=======Ans_PublishSound_0800 setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishSound_0800 setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishSound_0800 setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishSound_0800 publish1 then catch err======>"+err); - }) - setTimeout((async function(){ - console.info("======Ans_PublishSound_0800 setTimeout========>"); - notify.removeSlot(notify.SlotType.CONTENT_INFORMATION); - notify.unsubscribe(subscriber); - console.info("======Ans_PublishSound_0800 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0900(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishSound_0900 onConsume start============>"); - console.info("=============Ans_PublishSound_0900 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var sound = data.sortingMap.sortings[hashCode].slot.sound - console.info("=============Ans_PublishSound_0900 onConsume sound============>" + sound); - if (timesOfOnConsume == 1){ - expect(sound).assertEqual("sound_0900"); - console.info("=========Ans_PublishSound_0900 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(sound).assertEqual("sound_0900_set"); - console.info("=========Ans_PublishSound_0900 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishSound_0900 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishSound_0900 - * @tc.name: addSlot(slot: NotificationSlot): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a OTHER_TYPES type slot, set sound information, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishSound_0900', 0,async function (done) { - console.info("===============Ans_PublishSound_0900================>"); - timesOfOnConsume = 0; - var subscriber = { - onConsume:onConsume0900 - } - notify.subscribe(subscriber); - console.info("===============Ans_PublishSound_0900 subscribe======>"); - notify.addSlot({ - type:notify.SlotType.OTHER_TYPES, - sound:"sound_0900", - }); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 3, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0300", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishSound_0900 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.OTHER_TYPES, - sound:"sound_0900_set", - }).then(()=>{ - console.info("=======Ans_PublishSound_0900 setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishSound_0900 setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishSound_0900 setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishSound_0900 publish1 then catch err======>"+err); - }) - - setTimeout((async function(){ - console.info("======Ans_PublishSound_0900 setTimeout========>"); - notify.removeSlot(notify.SlotType.OTHER_TYPES); - notify.unsubscribe(subscriber); - console.info("======Ans_PublishSound_0900 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume1000(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishSound_1000 onConsume start============>"); - console.info("=============Ans_PublishSound_1000 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var sound = data.sortingMap.sortings[hashCode].slot.sound - console.info("=============Ans_PublishSound_1000 onConsume sound============>" + sound); - if (timesOfOnConsume == 1){ - expect(sound).assertEqual("sound_1000"); - console.info("=========Ans_PublishSound_1000 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(sound).assertEqual("sound_1000_set"); - console.info("=========Ans_PublishSound_1000 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishSound_1000 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishSound_1000 - * @tc.name: addSlot(slot: NotificationSlot): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a UNKNOWN_TYPE type slot, set sound information, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishSound_1000', 0,async function (done) { - console.info("===============Ans_PublishSound_1000================>"); - timesOfOnConsume = 0; - var subscriber = { - onConsume:onConsume1000 - } - notify.subscribe(subscriber); - console.info("===============Ans_PublishSound_1000 subscribe======>"); - notify.addSlot({ - type:notify.SlotType.UNKNOWN_TYPE, - sound:"sound_1000", - }); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 10, - slotType : notify.SlotType.UNKNOWN_TYPE, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1000", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishSound_1000 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.UNKNOWN_TYPE, - sound:"sound_1000_set", - }).then(()=>{ - console.info("=======Ans_PublishSound_1000 publish1 then setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishSound_1000 publish1 then setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishSound_1000 publish1 then setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishSound_1000 publish1 then catch err======>"+err); - }) - - setTimeout((async function(){ - console.info("======Ans_PublishSound_1000 setTimeout========>"); - notify.removeSlot(notify.SlotType.UNKNOWN_TYPE); - notify.unsubscribe(subscriber); - console.info("======Ans_PublishSound_1000 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume1100(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishSound_1100 onConsume start============>"); - console.info("=============Ans_PublishSound_1100 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var sound = data.sortingMap.sortings[hashCode].slot.sound - var vibrationValues = data.sortingMap.sortings[hashCode].slot.vibrationValues - var vibrationEnabled = data.sortingMap.sortings[hashCode].slot.vibrationEnabled - console.info("=============Ans_PublishSound_1100 onConsume vibrationValues============>" + vibrationValues); - console.info("=============Ans_PublishSound_1100 onConsume vibrationEnabled============>" + vibrationEnabled); - console.info("=============Ans_PublishSound_1100 onConsume sound============>" + sound); - if (timesOfOnConsume == 1){ - expect(sound).assertEqual("sound_1100"); - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([11,0,11,0])); - expect(vibrationEnabled).assertEqual(true); - console.info("=========Ans_PublishSound_1100 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(sound).assertEqual("sound_1100_set"); - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([11,11,11,11])); - expect(vibrationEnabled).assertEqual(true); - console.info("=========Ans_PublishSound_1100 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishSound_1100 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishSound_1100 - * @tc.name: addSlot(slot: NotificationSlot): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a UNKNOWN_TYPE type slot, set sound and vibra information, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishSound_1100', 0,async function (done) { - console.info("===============Ans_PublishSound_1100================>"); - timesOfOnConsume = 0; - var subscriber = { - onConsume:onConsume1100 - } - notify.subscribe(subscriber); - console.info("===============Ans_PublishSound_1100 subscribe======>"); - notify.addSlot({ - type:notify.SlotType.UNKNOWN_TYPE, - sound:"sound_1100", - vibrationEnabled:true, - vibrationValues:[11,0,11,0], - }); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 10, - slotType : notify.SlotType.UNKNOWN_TYPE, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1000", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishSound_1100 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.UNKNOWN_TYPE, - sound:"sound_1100_set", - vibrationEnabled:true, - vibrationValues:[11,11,11,11], - }).then(()=>{ - console.info("=======Ans_PublishSound_1100 publish1 then setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishSound_1100 publish1 then setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishSound_1100 publish1 then setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishSound_1100 publish1 then catch err======>"+err); - }) - - setTimeout((async function(){ - console.info("======Ans_PublishSound_1100 setTimeout========>"); - notify.removeSlot(notify.SlotType.UNKNOWN_TYPE); - notify.unsubscribe(subscriber); - console.info("======Ans_PublishSound_1100 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); -}) -} diff --git a/notification/ans_standard/publish_test/publishsound/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/publishsound/src/main/js/test/List.test.js deleted file mode 100644 index fc1a8c026ff465bad889cb3a33562e2d3fe12990..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/src/main/js/test/List.test.js +++ /dev/null @@ -1,19 +0,0 @@ -/* -* 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. -*/ -require('./ExampleJsunit.test.js') -import ActsAnsPublishSoundTest from './ExampleJsunit.test.js' -export default function testsuite() { -ActsAnsPublishSoundTest() -} diff --git a/notification/ans_standard/publish_test/publishsound/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/publishsound/src/main/resources/base/element/string.json deleted file mode 100644 index 69e46fab201e47448fca1c14d769b4b19f54a1c4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishsound/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "pubSound" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/publishvibra/BUILD.gn b/notification/ans_standard/publish_test/publishvibra/BUILD.gn deleted file mode 100644 index 1d83f83054a3a00f37bbbb444cf45e2130ceb703..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsPublishVibraTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsPublishVibraTest" - 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/publish_test/publishvibra/Test.json b/notification/ans_standard/publish_test/publishvibra/Test.json deleted file mode 100644 index 7a299046fbb38e232c041620fa13d6a22c426839..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "shell-timeout": "180000", - "bundle-name": "com.example.actsanspublishvibratest", - "package-name": "com.example.actsanspublishvibratest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsPublishVibraTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishvibra/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/publishvibra/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/publishvibra/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/publishvibra/src/main/config.json b/notification/ans_standard/publish_test/publishvibra/src/main/config.json deleted file mode 100644 index ae4d4a614355c23df83ce1f8eec33baafe566e4f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanspublishvibratest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanspublishvibratest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/publishvibra/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/publishvibra/src/main/js/MainAbility/app.js deleted file mode 100644 index 4f1747a95c4acbb66db5351e826c31584356e11c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* -* 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/publish_test/publishvibra/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/publishvibra/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishvibra/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/publishvibra/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishvibra/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/publishvibra/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/publishvibra/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/publishvibra/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index ce4e6b40edd7eb62ef3fc4d380c8bc597e79fae5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Test of Publishing vibrating Notification - -
diff --git a/notification/ans_standard/publish_test/publishvibra/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/publishvibra/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index cedc552d2c6861b286c9c08bdaafb93be8964e16..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,31 +0,0 @@ - -/* -* 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' -import app from '@system.app' -import device from '@system.device' -import router from '@system.router' - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - } -} diff --git a/notification/ans_standard/publish_test/publishvibra/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/publishvibra/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/publishvibra/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/publishvibra/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishvibra/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/publishvibra/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/publishvibra/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/publishvibra/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/publishvibra/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/publishvibra/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/publishvibra/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/publishvibra/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/publishvibra/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/publishvibra/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/publishvibra/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/publish_test/publishvibra/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index 2d7dfe78c8425d51a3e951573f912a1be4e910e8..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,1122 +0,0 @@ -/* - * 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 notify from '@ohos.notification' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -export default function ActsAnsPublishVibraTest() { -describe('ActsAnsPublishVibraTest', function () { - console.info("===========ActsAnsPublishVibraTest start====================>"); - var timeout = 200 - var bundleoption = { - bundle: "com.example.actsanspublishvibratest" - } - var timesOfOnConsume - function onConsume0100(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishVibra_0100 onConsume start============>"); - console.info("=============Ans_PublishVibra_0100 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var vibrationValues = data.sortingMap.sortings[hashCode].slot.vibrationValues - var vibrationEnabled = data.sortingMap.sortings[hashCode].slot.vibrationEnabled - console.info("=============Ans_PublishVibra_0100 onConsume vibrationValues============>" + vibrationValues); - console.info("=============Ans_PublishVibra_0200 onConsume vibrationEnabled============>" + vibrationEnabled); - if (timesOfOnConsume == 1){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([200])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_0100 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([1,0,1,0])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_0100 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishVibra_0100 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishVibra_0100 - * @tc.name: addSlot(type: SlotType): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a SOCIAL_COMMUNICATION type slot, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishVibra_0100', 0,async function (done) { - console.info("===============Ans_PublishVibra_0100================>"); - timesOfOnConsume = 0; - var subscriber ={ - onConsume:onConsume0100 - } - await notify.subscribe(subscriber); - console.info("===============Ans_PublishVibra_0100 subscribe======>"); - await notify.addSlot(notify.SlotType.SOCIAL_COMMUNICATION); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 1, - slotType : notify.SlotType.SOCIAL_COMMUNICATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0100", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishVibra_0100 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.SOCIAL_COMMUNICATION, - vibrationValues:[1,0,1,0], - }).then(()=>{ - console.info("=======Ans_PublishVibra_0100 setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishVibra_0100 setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_0100 setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_0100 publish1 then catch err======>"+err); - }) - setTimeout((async function(){ - console.info("======Ans_PublishVibra_0100 setTimeout========>"); - await notify.removeSlot(notify.SlotType.SOCIAL_COMMUNICATION); - await notify.unsubscribe(subscriber); - console.info("======Ans_PublishVibra_0100 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0200(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishVibra_0200 onConsume start============>"); - console.info("=============Ans_PublishVibra_0200 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var vibrationValues = data.sortingMap.sortings[hashCode].slot.vibrationValues - var vibrationEnabled = data.sortingMap.sortings[hashCode].slot.vibrationEnabled - console.info("=============Ans_PublishVibra_0200 onConsume vibrationValues============>" + vibrationValues); - console.info("=============Ans_PublishVibra_0200 onConsume vibrationEnabled============>" + vibrationEnabled); - if (timesOfOnConsume == 1){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([200])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_0200 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([2,0,2,0])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_0200 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishVibra_0200 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishVibra_0200 - * @tc.name: addSlot(type: SlotType): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a SERVICE_INFORMATION type slot, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishVibra_0200', 0,async function (done) { - console.info("===============Ans_PublishVibra_0200================>"); - timesOfOnConsume = 0; - var subscriber ={ - onConsume:onConsume0200 - } - await notify.subscribe(subscriber); - console.info("===============Ans_PublishVibra_0200 subscribe======>"); - await notify.addSlot(notify.SlotType.SERVICE_INFORMATION); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 2, - slotType : notify.SlotType.SERVICE_INFORMATION , - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0200", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishVibra_0200 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.SERVICE_INFORMATION , - vibrationValues:[2,0,2,0], - }).then(()=>{ - console.info("=======Ans_PublishVibra_0200 setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishVibra_0200 setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_0200 setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_0200 publish1 then catch err======>"+err); - }) - setTimeout((async function(){ - console.info("======Ans_PublishVibra_0200 setTimeout========>"); - await notify.removeSlot(notify.SlotType.SERVICE_INFORMATION); - await notify.unsubscribe(subscriber); - console.info("======Ans_PublishVibra_0200 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0300(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishVibra_0300 onConsume start============>"); - console.info("=============Ans_PublishVibra_0300 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var vibrationValues = data.sortingMap.sortings[hashCode].slot.vibrationValues - var vibrationEnabled = data.sortingMap.sortings[hashCode].slot.vibrationEnabled - console.info("=============Ans_PublishVibra_0300 onConsume vibrationValues============>" + vibrationValues); - console.info("=============Ans_PublishVibra_0300 onConsume vibrationEnabled============>" + vibrationEnabled); - if (timesOfOnConsume == 1){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([])); - expect(vibrationEnabled).assertEqual(false); - console.info("=============Ans_PublishVibra_0300 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([3,0,3,0])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_0300 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishVibra_0300 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishVibra_0300 - * @tc.name: addSlot(type: SlotType): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a CONTENT_INFORMATION type slot, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishVibra_0300', 0,async function (done) { - console.info("===============Ans_PublishVibra_0300================>"); - timesOfOnConsume = 0; - var subscriber ={ - onConsume:onConsume0300 - } - await notify.subscribe(subscriber); - console.info("===============Ans_PublishVibra_0300 subscribe======>"); - await notify.addSlot(notify.SlotType.CONTENT_INFORMATION); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 3, - slotType : notify.SlotType.CONTENT_INFORMATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0300", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishVibra_0300 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.CONTENT_INFORMATION, - vibrationValues:[3,0,3,0], - }).then(()=>{ - console.info("=======Ans_PublishVibra_0300 setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishVibra_0300 setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_0300 setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_0300 publish1 then catch err======>"+err); - }) - - setTimeout((async function(){ - console.info("======Ans_PublishVibra_0300 setTimeout========>"); - await notify.removeSlot(notify.SlotType.CONTENT_INFORMATION); - await notify.unsubscribe(subscriber); - console.info("======Ans_PublishVibra_0300 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0400(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishVibra_0400 onConsume start============>"); - console.info("=============Ans_PublishVibra_0400 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var vibrationValues = data.sortingMap.sortings[hashCode].slot.vibrationValues - var vibrationEnabled = data.sortingMap.sortings[hashCode].slot.vibrationEnabled - console.info("=============Ans_PublishVibra_0400 onConsume vibrationValues============>" + vibrationValues); - console.info("=============Ans_PublishVibra_0400 onConsume vibrationEnabled============>" + vibrationEnabled); - if (timesOfOnConsume == 1){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([])); - expect(vibrationEnabled).assertEqual(false); - console.info("=============Ans_PublishVibra_0400 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([4,0,4,0])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_0400 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishVibra_0400 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishVibra_0400 - * @tc.name: addSlot(type: SlotType): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a OTHER_TYPES type slot, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishVibra_0400', 0,async function (done) { - console.info("===============Ans_PublishVibra_0400================>"); - timesOfOnConsume = 0; - var subscriber = { - onConsume:onConsume0400 - } - await notify.subscribe(subscriber); - console.info("===============Ans_PublishVibra_0400 subscribe======>"); - await notify.addSlot(notify.SlotType.OTHER_TYPES); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 4, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0400", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishVibra_0400 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.OTHER_TYPES, - vibrationValues:[4,0,4,0], - }).then(()=>{ - console.info("=======Ans_PublishVibra_0400 setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishVibra_0400 setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_0400 setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_0400 publish1 then catch err======>"+err); - }) - setTimeout((async function(){ - console.info("======Ans_PublishVibra_0400 setTimeout========>"); - await notify.removeSlot(notify.SlotType.OTHER_TYPES); - await notify.unsubscribe(subscriber); - console.info("======Ans_PublishVibra_0400 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0500(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishVibra_0500 onConsume start============>"); - console.info("=============Ans_PublishVibra_0500 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var vibrationValues = data.sortingMap.sortings[hashCode].slot.vibrationValues - var vibrationEnabled = data.sortingMap.sortings[hashCode].slot.vibrationEnabled - console.info("=============Ans_PublishVibra_0500 onConsume vibrationValues============>" + vibrationValues); - console.info("=============Ans_PublishVibra_0500 onConsume vibrationEnabled============>" + vibrationEnabled); - if (timesOfOnConsume == 1){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([])); - expect(vibrationEnabled).assertEqual(false); - console.info("=============Ans_PublishVibra_0500 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([5,0,5,0])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_0500 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishVibra_0500 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishVibra_0500 - * @tc.name: addSlot(type: SlotType): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a UNKNOWN_TYPE type slot, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishVibra_0500', 0,async function (done) { - console.info("===============Ans_PublishVibra_0500================>"); - timesOfOnConsume = 0; - var subscriber = { - onConsume:onConsume0500 - } - await notify.subscribe(subscriber); - console.info("===============Ans_PublishVibra_0500 subscribe======>"); - await notify.addSlot(notify.SlotType.UNKNOWN_TYPE); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 5, - slotType : notify.SlotType.UNKNOWN_TYPE, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0500", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishVibra_0500 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.OTHER_TYPES, - vibrationValues:[5,0,5,0], - }).then(()=>{ - console.info("=======Ans_PublishVibra_0500 setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishVibra_0500 setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_0500 setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_0500 publish1 then catch err======>"+err); - }) - setTimeout((async function(){ - console.info("======Ans_PublishVibra_0500 setTimeout========>"); - await notify.removeSlot(notify.SlotType.UNKNOWN_TYPE); - await notify.unsubscribe(subscriber); - console.info("======Ans_PublishVibra_0500 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0600(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishVibra_0600 onConsume start============>"); - console.info("=============Ans_PublishVibra_0600 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var vibrationValues = data.sortingMap.sortings[hashCode].slot.vibrationValues - var vibrationEnabled = data.sortingMap.sortings[hashCode].slot.vibrationEnabled - console.info("=============Ans_PublishVibra_0600 onConsume vibrationValues============>" + vibrationValues); - console.info("=============Ans_PublishVibra_0600 onConsume vibrationEnabled============>" + vibrationEnabled); - if (timesOfOnConsume == 1){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([6,0,6,0])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_0600 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([6,6,6,6])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_0600 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishVibra_0600 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishVibra_0600 - * @tc.name: addSlot(slot: NotificationSlot): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a SOCIAL_COMMUNICATION type slot, set vibra information, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishVibra_0600', 0,async function (done) { - console.info("===============Ans_PublishVibra_0600================>"); - timesOfOnConsume = 0; - var subscriber ={ - onConsume:onConsume0600 - } - await notify.subscribe(subscriber); - console.info("===============Ans_PublishVibra_0600 subscribe======>"); - await notify.addSlot({ - type:notify.SlotType.SOCIAL_COMMUNICATION, - vibrationValues:[6,0,6,0], - }); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 6, - slotType : notify.SlotType.SOCIAL_COMMUNICATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0600", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishVibra_0600 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.SOCIAL_COMMUNICATION, - vibrationValues:[6,6,6,6], - }).then(()=>{ - console.info("=======Ans_PublishVibra_0600 setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishVibra_0600 setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_0600 setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_0600 publish1 then catch err======>"+err); - }) - setTimeout((async function(){ - console.info("======Ans_PublishVibra_0600 setTimeout========>"); - await notify.removeSlot(notify.SlotType.SOCIAL_COMMUNICATION); - await notify.unsubscribe(subscriber); - console.info("======Ans_PublishVibra_0600 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0700(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishVibra_0700 onConsume start============>"); - console.info("=============Ans_PublishVibra_0700 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var vibrationValues = data.sortingMap.sortings[hashCode].slot.vibrationValues - var vibrationEnabled = data.sortingMap.sortings[hashCode].slot.vibrationEnabled - console.info("=============Ans_PublishVibra_0700 onConsume vibrationValues============>" + vibrationValues); - console.info("=============Ans_PublishVibra_0700 onConsume vibrationEnabled============>" + vibrationEnabled); - if (timesOfOnConsume == 1){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([7,0,7,0])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_0700 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([7,7,7,7])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_0700 onConsume timesOfOnConsume2============>"); - } - - console.info("=============Ans_PublishVibra_0700 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishVibra_0700 - * @tc.name: addSlot(slot: NotificationSlot): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a SERVICE_INFORMATION type slot, set vibra information, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishVibra_0700', 0,async function (done) { - console.info("===============Ans_PublishVibra_0700================>"); - timesOfOnConsume = 0; - var subscriber ={ - onConsume:onConsume0700 - } - await notify.subscribe(subscriber); - console.info("===============Ans_PublishVibra_0700 subscribe======>"); - await notify.addSlot({ - type:notify.SlotType.SERVICE_INFORMATION, - vibrationValues:[7,0,7,0], - }); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 7, - slotType : notify.SlotType.SERVICE_INFORMATION , - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0700", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishVibra_0700 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.SERVICE_INFORMATION , - vibrationValues:[7,7,7,7], - }).then(()=>{ - console.info("=======Ans_PublishVibra_0700 setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishVibra_0700 setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_0700 setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_0700 publish1 then catch err======>"+err); - }) - setTimeout((async function(){ - console.info("======Ans_PublishVibra_0700 setTimeout========>"); - await notify.removeSlot(notify.SlotType.SERVICE_INFORMATION); - await notify.unsubscribe(subscriber); - console.info("======Ans_PublishVibra_0700 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0800(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishVibra_0800 onConsume start============>"); - console.info("=============Ans_PublishVibra_0800 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var vibrationValues = data.sortingMap.sortings[hashCode].slot.vibrationValues - var vibrationEnabled = data.sortingMap.sortings[hashCode].slot.vibrationEnabled - console.info("=============Ans_PublishVibra_0800 onConsume vibrationValues============>" + vibrationValues); - console.info("=============Ans_PublishVibra_0800 onConsume vibrationEnabled============>" + vibrationEnabled); - if (timesOfOnConsume == 1){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([8,0,8,0])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_0800 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([8,8,8,8])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_0800 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishVibra_0800 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishVibra_0800 - * @tc.name: addSlot(slot: NotificationSlot): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a CONTENT_INFORMATION type slot, set vibra information, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishVibra_0800', 0,async function (done) { - console.info("===============Ans_PublishVibra_0800================>"); - timesOfOnConsume = 0; - var subscriber ={ - onConsume:onConsume0800 - } - await notify.subscribe(subscriber); - console.info("===============Ans_PublishVibra_0800 subscribe======>"); - await notify.addSlot({ - type:notify.SlotType.CONTENT_INFORMATION, - vibrationValues:[8,0,8,0], - }); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 8, - slotType : notify.SlotType.CONTENT_INFORMATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0800", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishVibra_0800 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.CONTENT_INFORMATION, - vibrationValues:[8,8,8,8], - }).then(()=>{ - console.info("=======Ans_PublishVibra_0800 setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishVibra_0800 setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_0800 setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_0800 publish1 then catch err======>"+err); - }) - setTimeout((async function(){ - console.info("======Ans_PublishVibra_0800 setTimeout========>"); - await notify.removeSlot(notify.SlotType.CONTENT_INFORMATION); - await notify.unsubscribe(subscriber); - console.info("======Ans_PublishVibra_0800 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume0900(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishVibra_0900 onConsume start============>"); - console.info("=============Ans_PublishVibra_0900 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var vibrationValues = data.sortingMap.sortings[hashCode].slot.vibrationValues - var vibrationEnabled = data.sortingMap.sortings[hashCode].slot.vibrationEnabled - console.info("=============Ans_PublishVibra_0900 onConsume vibrationValues============>" + vibrationValues); - console.info("=============Ans_PublishVibra_0900 onConsume vibrationEnabled============>" + vibrationEnabled); - if (timesOfOnConsume == 1){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([9,0,9,0])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_0900 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([9,9,9,9])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_0900 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishVibra_0900 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishVibra_0900 - * @tc.name: addSlot(slot: NotificationSlot): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a OTHER_TYPES type slot, set vibra information, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishVibra_0900', 0,async function (done) { - console.info("===============Ans_PublishVibra_0900================>"); - timesOfOnConsume = 0; - var subscriber = { - onConsume:onConsume0900 - } - await notify.subscribe(subscriber); - console.info("===============Ans_PublishVibra_0900 subscribe======>"); - await notify.addSlot({ - type:notify.SlotType.OTHER_TYPES, - vibrationValues:[9,0,9,0], - }); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 9, - slotType : notify.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0900", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishVibra_0900 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.OTHER_TYPES, - vibrationValues:[9,9,9,9], - }).then(()=>{ - console.info("=======Ans_PublishVibra_0900 setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishVibra_0900 setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_0900 setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_0900 publish1 then catch err======>"+err); - }) - - setTimeout((async function(){ - console.info("======Ans_PublishVibra_0900 setTimeout========>"); - await notify.removeSlot(notify.SlotType.OTHER_TYPES); - await notify.unsubscribe(subscriber); - console.info("======Ans_PublishVibra_0900 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume1000(data){ - timesOfOnConsume ++; - console.info("=============Ans_PublishVibra_1000 onConsume start============>"); - console.info("=============Ans_PublishVibra_1000 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var vibrationValues = data.sortingMap.sortings[hashCode].slot.vibrationValues - var vibrationEnabled = data.sortingMap.sortings[hashCode].slot.vibrationEnabled - console.info("=============Ans_PublishVibra_1000 onConsume vibrationValues============>" + vibrationValues); - console.info("=============Ans_PublishVibra_1000 onConsume vibrationEnabled============>" + vibrationEnabled); - if (timesOfOnConsume == 1){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([10,0,10,0])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_1000 onConsume timesOfOnConsume1============>"); - } else if (timesOfOnConsume == 2){ - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([10,10,10,10])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_1000 onConsume timesOfOnConsume2============>"); - } - console.info("=============Ans_PublishVibra_1000 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishVibra_1000 - * @tc.name: addSlot(slot: NotificationSlot): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a UNKNOWN_TYPE type slot, set vibra information, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishVibra_1000', 0,async function (done) { - console.info("===============Ans_PublishVibra_1000================>"); - timesOfOnConsume = 0; - var subscriber = { - onConsume:onConsume1000 - } - await notify.subscribe(subscriber); - console.info("===============Ans_PublishVibra_1000 subscribe======>"); - await notify.addSlot({ - type:notify.SlotType.UNKNOWN_TYPE, - vibrationValues:[10,0,10,0], - }); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 10, - slotType : notify.SlotType.UNKNOWN_TYPE, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1000", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishVibra_1000 publish1 then======>"); - notify.setSlotByBundle(bundleoption, - { - type:notify.SlotType.UNKNOWN_TYPE, - vibrationValues:[10,10,10,10], - }).then(()=>{ - console.info("=======Ans_PublishVibra_1000 publish1 then setSlotByBundle then======>"); - notify.publish(notificationRequest); - console.info("=======Ans_PublishVibra_1000 publish1 then setSlotByBundle then publish2======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_1000 publish1 then setSlotByBundle catch err======>"+err); - }) - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_1000 publish1 then catch err======>"+err); - }) - - setTimeout((async function(){ - console.info("======Ans_PublishVibra_1000 setTimeout========>"); - await notify.removeSlot(notify.SlotType.UNKNOWN_TYPE); - await notify.unsubscribe(subscriber); - console.info("======Ans_PublishVibra_1000 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume1100(data){ - console.info("=============Ans_PublishVibra_1100 onConsume start============>"); - console.info("=============Ans_PublishVibra_1100 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var vibrationValues = data.sortingMap.sortings[hashCode].slot.vibrationValues - var vibrationEnabled = data.sortingMap.sortings[hashCode].slot.vibrationEnabled - console.info("=============Ans_PublishVibra_1100 onConsume vibrationValues============>" + vibrationValues); - console.info("=============Ans_PublishVibra_1100 onConsume vibrationEnabled============>" + vibrationEnabled); - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([200])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_1100 onConsume timesOfOnConsume1============>"); - console.info("=============Ans_PublishVibra_1100 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishVibra_1100 - * @tc.name: addSlot(slot: NotificationSlot): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a SOCIAL_COMMUNICATION type slot, set vibra flag, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishVibra_1100', 0,async function (done) { - console.info("===============Ans_PublishVibra_1100================>"); - timesOfOnConsume = 0; - var subscriber ={ - onConsume:onConsume1100 - } - notify.subscribe(subscriber); - console.info("===============Ans_PublishVibra_1100 subscribe======>"); - notify.addSlot({ - type:notify.SlotType.SOCIAL_COMMUNICATION, - vibrationEnabled:true, - }).then(()=>{ - console.info("===============Ans_PublishVibra_1100 addSlot then======>"); - }).catch((err)=>{ - console.info("===============Ans_PublishVibra_1100 addSlot catch err======>"+err); - }); - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 11, - slotType : notify.SlotType.SOCIAL_COMMUNICATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1100", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishVibra_1100 publish then======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_1100 publish then catch err======>"+err); - }) - setTimeout((async function(){ - console.info("======Ans_PublishVibra_1100 setTimeout========>"); - await notify.removeSlot(notify.SlotType.SOCIAL_COMMUNICATION); - await notify.unsubscribe(subscriber); - console.info("======Ans_PublishVibra_1100 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); - - function onConsume1200(data){ - console.info("=============Ans_PublishVibra_1200 onConsume start============>"); - console.info("=============Ans_PublishVibra_1200 onConsume data:============>" + JSON.stringify(data)); - var hashCode = data.request.hashCode - var vibrationValues = data.sortingMap.sortings[hashCode].slot.vibrationValues - var vibrationEnabled = data.sortingMap.sortings[hashCode].slot.vibrationEnabled - console.info("=============Ans_PublishVibra_1200 onConsume vibrationValues============>" + vibrationValues); - console.info("=============Ans_PublishVibra_1200 onConsume vibrationEnabled============>" + vibrationEnabled); - expect(JSON.stringify(vibrationValues)).assertEqual(JSON.stringify([])); - expect(vibrationEnabled).assertEqual(true); - console.info("=============Ans_PublishVibra_1200 onConsume end==============>"); - } - - /* - * @tc.number: Ans_PublishVibra_1200 - * @tc.name: addSlot(slot: NotificationSlot): Promise; - setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise; - * @tc.desc: Create a CONTENT_INFORMATION type slot, set vibra flag, publish a notification and verify. - After changing the slot information, publish a notification again and verify. - */ - it('Ans_PublishVibra_1200', 0,async function (done) { - console.info("===============Ans_PublishVibra_1200================>"); - timesOfOnConsume = 0; - var subscriber ={ - onConsume:onConsume1200 - } - await notify.subscribe(subscriber); - console.info("===============Ans_PublishVibra_1200 subscribe======>"); - await notify.addSlot({ - type:notify.SlotType.CONTENT_INFORMATION, - vibrationEnabled:true, - }) - - var notificationRequest = { - content:{ - contentType: notify.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test_title", - text: "test_text", - additionalText: "test_additionalText" - }, - }, - id: 12, - slotType : notify.SlotType.CONTENT_INFORMATION, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "1200", - badgeIconStyle: 1, - showDeliveryTime: true, - } - notify.publish(notificationRequest).then(()=>{ - console.info("=======Ans_PublishVibra_1200 publish then======>"); - }).catch((err)=>{ - console.info("=======Ans_PublishVibra_1200 publish then catch err======>"+err); - }) - setTimeout((async function(){ - console.info("======Ans_PublishVibra_1200 setTimeout========>"); - await notify.removeSlot(notify.SlotType.CONTENT_INFORMATION); - await notify.unsubscribe(subscriber); - console.info("======Ans_PublishVibra_1200 setTimeout unsubscribe===>"); - done(); - }),timeout); - }); -}) } diff --git a/notification/ans_standard/publish_test/publishvibra/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/publishvibra/src/main/js/test/List.test.js deleted file mode 100644 index 9aeee8dc1f34cb70d5f344a638edd195e111ef0d..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* -* 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 ActsAnsPublishVibraTest from './ExampleJsunit.test.js' -export default function testsuite() { -ActsAnsPublishVibraTest() -} diff --git a/notification/ans_standard/publish_test/publishvibra/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/publishvibra/src/main/resources/base/element/string.json deleted file mode 100644 index 37434ea7ff0abc3a132e85b7f7727c1429e84cf2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/publishvibra/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "PubVibra" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/sub/BUILD.gn b/notification/ans_standard/publish_test/sub/BUILD.gn deleted file mode 100644 index 161984da29cd21fb7c0e8615009abfcd164a3da4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsSubTestXts") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsSubTest" - 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/publish_test/sub/Test.json b/notification/ans_standard/publish_test/sub/Test.json deleted file mode 100644 index f4bc409ed557429d23e371fa9165fc29ef74be8a..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "shell-timeout": "180000", - "bundle-name": "com.example.actsanssubtest", - "package-name": "com.example.actsanssubtest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsSubTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/sub/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/sub/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/sub/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/sub/src/main/config.json b/notification/ans_standard/publish_test/sub/src/main/config.json deleted file mode 100644 index 41cf0002e2c80608384165d5008c3cd66d29916e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanssubtest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanssubtest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/sub/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/sub/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/sub/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/sub/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/sub/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/sub/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/sub/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/sub/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/sub/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/sub/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index f9fd90b8fceb53ec2b550e03e7145d7fd0290a65..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Text of Publishing Common Events - -
diff --git a/notification/ans_standard/publish_test/sub/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/sub/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/sub/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/sub/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/sub/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/sub/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/sub/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/sub/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/sub/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/sub/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/sub/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/sub/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/sub/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/sub/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/sub/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/sub/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/sub/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/sub/src/main/js/test/List.test.js deleted file mode 100644 index 3f0d496ece8f06c7a767bdf8771bcbffeb603a7f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsSubTestXts from './Subscriber.js' -export default function testsuite() { -ActsAnsSubTestXts() -} diff --git a/notification/ans_standard/publish_test/sub/src/main/js/test/Subscriber.js b/notification/ans_standard/publish_test/sub/src/main/js/test/Subscriber.js deleted file mode 100644 index cb449fc418535bafcef1051e4649cf56dee608fc..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/src/main/js/test/Subscriber.js +++ /dev/null @@ -1,307 +0,0 @@ -/* - * 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 notify from '@ohos.notification'; -var timeout = 2000; -export default function ActsAnsSubTestXts() { -describe('ActsAnsSubTestXts', function () { - console.info("==ActsAnsSubscriberTest start==>"); - //ActsSubscriber_test_0100 - var subInfoa ={ - onConnect:connectCallbacka, - onDisconnect:disconnectCallbacka, - } - function connectCallbacka() { - console.debug("==>connectCallbacka code==>"); - } - function subscribeCallbacka(err) { - console.debug("==>subscribeCallbacka code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbacka(err){ - console.debug("==>ActsSubscriber_test_xts_0100 unSubscribeCallbacka code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbacka(){ - console.debug("==>disconnectCallbacka code==>"); - } - //ActsSubscriber_test_0200 - function connectCallbackb() { - console.debug("==>connectCallbackb code==>"); - } - function subscribeCallbackb(err) { - console.debug("==>ActsSubscriber_test_xts_0200 subscribeCallbackb code==>" +err.code); - expect(err.code).assertEqual(0); - } - function subscribeCallbackc(err) { - console.debug("==>subscribeCallbackc code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbackb(err){ - console.debug("==>ActsSubscriber_test_xts_0200 unSubscribeCallbackb code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbackb(){ - console.debug("==>disconnectCallbackb code==>"); - } - //ActsSubscriber_test_0300 - function connectCallbackc() { - console.debug("==>connectCallbackc code==>"); - } - function connectCallbackd() { - console.debug("==>connectCallbackd code==>"); - } - function subscribeCallbackd(err) { - console.debug("==>ActsSubscriber_test_xts_0300 subscribeCallbackd code==>" +err.code); - expect(err.code).assertEqual(0); - } - function subscribeCallbacke(err) { - console.debug("==>ActsSubscriber_test_xts_0300 subscribeCallbacke code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbackc(err){ - console.debug("==>ActsSubscriber_test_xts_0300 unSubscribeCallbackc code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbackd(err){ - console.debug("==>ActsSubscriber_test_xts_0300 unSubscribeCallbackd code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbackc(){ - console.debug("==>disconnectCallbackc code==>"); - } - function disconnectCallbackd(){ - console.debug("==>disconnectCallbackd code==>"); - } - //ActsSubscriber_test_0400 - function connectCallbackf() { - console.debug("==>connectCallbackf code==>"); - } - function connectCallbackg() { - console.debug("==>connectCallbackg code==>"); - } - function subscribeCallbackg(err) { - console.debug("==>ActsSubscriber_test_xts_0400 subscribeCallbackg code==>" +err.code); - expect(err.code).assertEqual(0); - } - function subscribeCallbackh(err) { - console.debug("==>ActsSubscriber_test_xts_0400 subscribeCallbackh code==>" +err.code); - expect(err.code).assertEqual(0); - } - function subscribeCallbacki(err) { - console.debug("==>ActsSubscriber_test_xts_0400 subscribeCallbacki code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbackf(err){ - console.debug("==>ActsSubscriber_test_xts_0400 unSubscribeCallbackf code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbackg(err){ - console.debug("==>ActsSubscriber_test_xts_0400 unSubscribeCallbackg code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbackf(){ - console.debug("==>disconnectCallbackf code==>"); - } - function disconnectCallbackg(){ - console.debug("==>disconnectCallbackg code==>"); - } - //ActsSubscriber_test_0500 - var subInfob = { - onConnect:connectCallbacki, - onDisconnect:disconnectCallbacki, - } - function connectCallbacki() { - console.debug("==>connectCallbacki code==>"); - } - function subscribeCallbackl(err) { - console.debug("==>ActsSubscriber_test_xts_0500 subscribeCallbackl code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbacki(err){ - console.debug("==>ActsSubscriber_test_xts_0500 unSubscribeCallbacki code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbacki(){ - console.debug("==>disconnectCallbacki code==>"); - } - //ActsSubscriber_test_0600 - var subInfoc ={ - onConnecte:connectCallbackj, - onDisconnect:disconnectCallbackj, - } - function connectCallbackj() { - console.debug("==>connectCallbackj code==>"); - } - function unSubscribeCallbackj(err){ - console.debug("==>ActsSubscriber_test_xts_0600 unSubscribeCallbackj code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbackj(){ - console.debug("==>disconnectCallbackj code==>"); - } - //ActsSubscriber_test_0700 - var subInfod ={ - onConnect:connectCallbackm, - onDisconnect:disconnectCallbackl, - } - function connectCallbackm() { - console.debug("==>connectCallbackm code==>"); - } - function subscribeCallbackn(err) { - console.debug("==>ActsSubscriber_test_xts_0700 subscribeCallbackn code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbackl(err){ - console.debug("==>ActsSubscriber_test_xts_0700 unSubscribeCallbackl code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbackl(){ - console.debug("==>disconnectCallbackl code==>"); - } - //ActsSubscriber_test_0800 - var subInfoe ={ - onConnect:connectCallbackn, - onDisconnect:disconnectCallbackm, - } - function connectCallbackn() { - console.debug("==>connectCallbackn code==>"); - } - function unSubscribeCallbackm(err){ - console.debug("==>ActsSubscriber_test_xts_0800 unSubscribeCallbackm code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbackm(){ - console.debug("==>disconnectCallbackm code==>"); - } - //ActsSubscriber_test_1300 - function connectCallbackl(){ - console.debug("==>connectCallbackl code==>"); - } - function subscribeCallbacko(err){ - console.debug("==>ActsSubscriber_test_xts_1300 subscribeCallbacko code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbackn(err){ - console.debug("==>ActsSubscriber_test_xts_1300 unSubscribeCallbackn code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbackn(){ - console.debug("==>disconnectCallbackn code==>"); - } - //ActsSubscriber_test_1400 - function connectCallbacko(){ - console.debug("==>connectCallbacko code==>"); - } - function subscribeCallbackp(err){ - console.debug("==>ActsSubscriber_test_xts_1400 subscribeCallbackp code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbacko(err){ - console.debug("==>unSubscribeCallbacko code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbacko(){ - console.debug("==>disconnectCallbacko code==>"); - } - - /* - * @tc.number: ActsSubscriber_test_xts_0900 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_xts_0900', 0, async function (done) { - console.debug("==ActsSubscriber_test_xts_0900==begin==>"); - var promise = notify.subscribe(100,{bundleNames:["com.example.actsanspublishtest"]}); - expect(promise).assertEqual(undefined); - setTimeout((async function(){ - console.debug("==ActsSubscriber_test_xts_0900==end==>"); - done(); - }),timeout); - }) - - /* - * @tc.number: ActsSubscriber_test_xts_1000 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_xts_1000', 0, async function (done) { - console.debug("==ActsSubscriber_test_xts_1000==begin==>"); - var subInfo = null - var promise = await notify.subscribe(subInfo,{bundleNames:["com.example.actsanspublishtest"]}); - expect(promise).assertEqual(undefined); - setTimeout((async function(){ - console.debug("==ActsSubscriber_test_xts_1000==end==>"); - done(); - }),timeout); - }) - - /* - * @tc.number: ActsSubscriber_test_xts_1100 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_xts_1100', 0, async function (done) { - console.debug("==ActsSubscriber_test_xts_1100==begin==>"); - var subInfo = "#$#%$%$^&%^%" - var promise = notify.subscribe(subInfo,{bundleNames:["com.example.actsanspublishtest"]}); - expect(promise).assertEqual(undefined); - setTimeout((async function(){ - console.debug("==ActsSubscriber_test_xts_1100==end==>"); - done(); - }),timeout); - }) - - /* - * @tc.number: ActsSubscriber_test_xts_1200 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_xts_1200', 0, async function (done) { - console.debug("==ActsSubscriber_test_xts_1200==begin==>"); - var subInfo = "" - var promise = await notify.subscribe(subInfo,{bundleNames:["com.example.actsanspublishtest"]}); - expect(promise).assertEqual(undefined); - setTimeout((async function(){ - console.debug("==ActsSubscriber_test_xts_1200==end==>"); - done(); - }),timeout); - }) - - /* - * @tc.number: ActsSubscriber_test_xts_1400 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_xts_1400', 0, async function (done) { - console.debug("==ActsSubscriber_test_xts_1400==begin==>"); - var subInfo ={ - onConnect:connectCallbacko, - onDisconnect:disconnectCallbacko, - } - try{ - await notify.subscribe(subInfo, {bundleNames: []}, subscribeCallbackp); - }catch(err){ - console.debug("==ActsSubscriber_test_xts_1400==err==>"+err); - } - setTimeout((async function(){ - console.debug("==ActsSubscriber_test_xts_1400==end==>"); - done(); - }),timeout); - }) -}) - -} diff --git a/notification/ans_standard/publish_test/sub/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/sub/src/main/resources/base/element/string.json deleted file mode 100644 index 7ef7c952d1da88e39dcc608988f047e9f94a9d29..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/sub/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "Subscriber" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/subscribe/BUILD.gn b/notification/ans_standard/publish_test/subscribe/BUILD.gn deleted file mode 100644 index fa9d9248cb36468126fc253a2b4a94d7e10b6ba2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/BUILD.gn +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//test/xts/tools/build/suite.gni") - -group("subscribe") { - testonly = true - if (is_standard_system) { - deps = [ - "publish:ActsAnsPublishTest", - #"subscribe:ActsAnsSubscriberTest", - ] - } -} diff --git a/notification/ans_standard/publish_test/subscribe/publish/BUILD.gn b/notification/ans_standard/publish_test/subscribe/publish/BUILD.gn deleted file mode 100644 index cf83cf4d0689295d4aefc99ca6beb18c98d8b576..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publish/BUILD.gn +++ /dev/null @@ -1,33 +0,0 @@ -# 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_hap_assist_suite("ActsAnsPublishTest") { - hap_profile = "./entry/src/main/config.json" - hap_name = "ActsAnsPublishTest" - subsystem_name = "notification" - part_name = "distributed_notification_service" - testonly = true - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/config.json b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/config.json deleted file mode 100644 index c3c1dde92c9ded92def374dcf1bf3d2529260861..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/config.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanspublishtest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanspublishtest", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "com.example.actsanspublishtest.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/subscribe/publish/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/pages/index/index.hml deleted file mode 100644 index 11ca9571ffc132923e8842850b911a4b2d1f7575..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Test of Calling the Publish Interface - -
diff --git a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index 03d35a7573e3b6d8269ded8d41341a17e812391c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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' -import {Core, ExpectExtend} from 'deccjsunit/index' - -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') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - - const configService = core.getDefaultService('config') - configService.setConfig(this) - - require('../../../test/List.test') - core.execute() - }, - onReady() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 1e896cb97197887cb4e2ffe9fa7acf74be61160f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "publish" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/test/ExampleJsunit.test.js b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/test/ExampleJsunit.test.js deleted file mode 100644 index aa74a290e094da0a4d5588b72f18d066d91d9e40..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/test/ExampleJsunit.test.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 'deccjsunit/index' -var time = 1000 -describe('ActsAnsPublishTest', function () { - function publishCallback001(){ - console.log('ActsAnsPublishTest ACTS_PublishTest_0100 asyncCallback') - } - - /* - * @tc.number: ACTS_PublishTest_0100 - * @tc.name: publish() - * @tc.desc: verify the function of publish - */ - it('ACTS_PublishTest_0100', 0,async function (done) { - await notification.publish({ - content:{ - contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, - normal: { - title: "test1_title", - text: "test1_text", - additionalText: "test1_additionalText" - }, - }, - id: 1, - slotType : notification.SlotType.OTHER_TYPES, - isOngoing : true, - isUnremovable : false, - deliveryTime : 1624950453, - tapDismissed : true, - autoDeletedTime: 1625036817, - color: 2, - colorEnabled: true, - isAlertOnce: true, - isStopwatch: true, - isCountDown: true, - progressValue: 12, - progressMaxValue: 100, - isIndeterminate: true, - statusBarText: "statusBarText", - isFloatingIcon : true, - label: "0100_1", - badgeIconStyle: 1, - showDeliveryTime: true, - },publishCallback001); - done(); - setTimeout(function(){ - console.debug("====>time out ACTS_PublishTest_0100====>"); - }, time); - }) -}) \ No newline at end of file diff --git a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/test/List.test.js deleted file mode 100644 index c0b876e81cf0a75db974ee932d8fc06a1d5a6e66..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/publish/entry/src/main/js/test/List.test.js +++ /dev/null @@ -1,15 +0,0 @@ -/* - * 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. - */ -require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/notification/ans_standard/publish_test/subscribe/publish/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/subscribe/publish/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/subscribe/publish/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/subscribe/subscribe/BUILD.gn b/notification/ans_standard/publish_test/subscribe/subscribe/BUILD.gn deleted file mode 100644 index f3b880f50e2d9d476162edc501c2b9f01dd6c57d..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsSubscriberTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsSubscriberTest" - 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/publish_test/subscribe/subscribe/Test.json b/notification/ans_standard/publish_test/subscribe/subscribe/Test.json deleted file mode 100644 index b152d8247de58f4fe31e581ab6e5ccc9879670dd..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "com.example.actsanssubscribertest", - "package-name": "com.example.actsanssubscribertest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsSubscriberTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/subscribe/subscribe/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/subscribe/subscribe/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/subscribe/subscribe/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/config.json b/notification/ans_standard/publish_test/subscribe/subscribe/src/main/config.json deleted file mode 100644 index f8d766f107ba3640a63944cdfb63fcd57031caa2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanssubscribertest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanssubscribertest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/subscribe/subscribe/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index a3115d45e213cb593a62b8098cc9c5902505c4b1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Test of Subscription Publish - -
diff --git a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/subscribe/subscribe/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/subscribe/subscribe/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/subscribe/subscribe/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/test/List.test.js deleted file mode 100644 index dc65da88558eaa1f192adf4f4040590b2f13f35a..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsSubscriberTest from './Subscriber.js' -export default function testsuite() { -ActsAnsSubscriberTest() -} diff --git a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/test/Subscriber.js b/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/test/Subscriber.js deleted file mode 100644 index d1483e36fdd222ea813a39ab3ef7c3a1bcc55d5f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/js/test/Subscriber.js +++ /dev/null @@ -1,491 +0,0 @@ -/* - * 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 notify from '@ohos.notification' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -var time = 1000 -export default function ActsAnsSubscriberTest() { -describe('ActsAnsSubscriberTest', function () { - console.info("==ActsAnsSubscriberTest start==>"); - //ActsSubscriber_test_0100 - var subInfoa ={ - onConsume:consumeCallbackc, - onConnect:connectCallbacka, - onDisconnect:disconnectCallbacka, - } - function consumeCallbackc(data) { - console.debug("==>consumeCallbackc data : ==>" + JSON.stringify(data)); - checkConsumeData(data) - notify.unsubscribe(subInfoa, unSubscribeCallbacka); - } - function connectCallbacka() { - console.debug("==>connectCallbacka code==>"); - } - function subscribeCallbacka(err) { - console.debug("==>subscribeCallbacka code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbacka(err){ - console.debug("==>unSubscribeCallbacka code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbacka(){ - console.debug("==>disconnectCallbacka code==>"); - } - //ActsSubscriber_test_0200 - function connectCallbackb() { - console.debug("==>connectCallbackb code==>"); - } - function subscribeCallbackb(err) { - console.debug("==>subscribeCallbackb code==>" +err.code); - expect(err.code).assertEqual(0); - } - function subscribeCallbackc(err) { - console.debug("==>subscribeCallbackc code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbackb(err){ - console.debug("==>unSubscribeCallbackb code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbackb(){ - console.debug("==>disconnectCallbackb code==>"); - } - //ActsSubscriber_test_0300 - function connectCallbackc() { - console.debug("==>connectCallbackc code==>"); - } - function connectCallbackd() { - console.debug("==>connectCallbackd code==>"); - } - function subscribeCallbackd(err) { - console.debug("==>subscribeCallbackd code==>" +err.code); - expect(err.code).assertEqual(0); - } - function subscribeCallbacke(err) { - console.debug("==>subscribeCallbacke code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbackc(err){ - console.debug("==>unSubscribeCallbackc code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbackd(err){ - console.debug("==>unSubscribeCallbackd code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbackc(){ - console.debug("==>disconnectCallbackc code==>"); - } - function disconnectCallbackd(){ - console.debug("==>disconnectCallbackd code==>"); - } - //ActsSubscriber_test_0500 - function connectCallbackf() { - console.debug("==>connectCallbackf code==>"); - } - function connectCallbackg() { - console.debug("==>connectCallbackg code==>"); - } - function subscribeCallbackg(err) { - console.debug("==>subscribeCallbackg code==>" +err.code); - expect(err.code).assertEqual(0); - } - function subscribeCallbackh(err) { - console.debug("==>subscribeCallbackh code==>" +err.code); - expect(err.code).assertEqual(0); - } - function subscribeCallbacki(err) { - console.debug("==>subscribeCallbacki code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbackf(err){ - console.debug("==>unSubscribeCallbackf code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbackg(err){ - console.debug("==>unSubscribeCallbackg code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbackf(){ - console.debug("==>disconnectCallbackf code==>"); - } - function disconnectCallbackg(){ - console.debug("==>disconnectCallbackg code==>"); - } - //ActsSubscriber_test_0600 - var subInfob = { - onConsume:consumeCallbacka, - onConnect:connectCallbacki, - onDisconnect:disconnectCallbacki, - } - function consumeCallbacka(data) { - console.debug("==>consumeCallbacka data : ==>" + JSON.stringify(data)); - checkConsumeData(data) - notify.unsubscribe(subInfob, unSubscribeCallbacki); - } - function connectCallbacki() { - console.debug("==>connectCallbacki code==>"); - } - function subscribeCallbackl(err) { - console.debug("==>subscribeCallbackl code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbacki(err){ - console.debug("==>unSubscribeCallbacki code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbacki(){ - console.debug("==>disconnectCallbacki code==>"); - } - //ActsSubscriber_test_0700 - var subInfoc ={ - onConsume:consumeCallbackb, - onConnecte:connectCallbackj, - onDisconnect:disconnectCallbackj, - } - function consumeCallbackb(data) { - console.debug("==>consumeCallbackb data : ==>" + JSON.stringify(data)); - checkConsumeData(data) - notify.unsubscribe(subInfoc, unSubscribeCallbackj); - } - function connectCallbackj() { - console.debug("==>connectCallbackj code==>"); - } - function unSubscribeCallbackj(err){ - console.debug("==>unSubscribeCallbackj code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbackj(){ - console.debug("==>disconnectCallbackj code==>"); - } - //ActsSubscriber_test_0800 - var subInfod ={ - onConsume:consumeCallbackd, - onConnect:connectCallbackm, - onDisconnect:disconnectCallbackl, - } - function consumeCallbackd(data) { - console.debug("==>consumeCallbackd data : ==>" + JSON.stringify(data)); - checkConsumeData(data) - notify.unsubscribe(subInfod, unSubscribeCallbackl); - } - function connectCallbackm() { - console.debug("==>connectCallbackm code==>"); - } - function subscribeCallbackn(err) { - console.debug("==>subscribeCallbackn code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbackl(err){ - console.debug("==>unSubscribeCallbackl code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbackl(){ - console.debug("==>disconnectCallbackl code==>"); - } - //ActsSubscriber_test_0900 - var subInfoe ={ - onConsume:consumeCallbacke, - onConnect:connectCallbackn, - onDisconnect:disconnectCallbackm, - } - function consumeCallbacke(data) { - console.debug("==>consumeCallbacke data : ==>" + JSON.stringify(data)); - checkConsumeData(data) - notify.unsubscribe(subInfoe, unSubscribeCallbackm); - } - function connectCallbackn() { - console.debug("==>connectCallbackn code==>"); - } - function unSubscribeCallbackm(err){ - console.debug("==>unSubscribeCallbackm code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbackm(){ - console.debug("==>disconnectCallbackm code==>"); - } - //ActsSubscriber_test_1400 - function connectCallbackl(){ - console.debug("==>connectCallbackl code==>"); - } - function subscribeCallbacko(err){ - console.debug("==>subscribeCallbacko code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbackn(err){ - console.debug("==>unSubscribeCallbackn code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbackn(){ - console.debug("==>disconnectCallbackn code==>"); - } - //ActsSubscriber_test_1500 - function connectCallbacko(){ - console.debug("==>connectCallbacko code==>"); - } - function subscribeCallbackp(err){ - console.debug("==>subscribeCallbackp code==>" +err.code); - expect(err.code).assertEqual(0); - } - function unSubscribeCallbacko(err){ - console.debug("==>unSubscribeCallbacko code==>" +err.code); - expect(err.code).assertEqual(0); - } - function disconnectCallbacko(){ - console.debug("==>disconnectCallbacko code==>"); - } - function checkConsumeData(data){ - expect(data.request.id).assertEqual(1); - expect(data.request.content.contentType).assertEqual(0); - expect(data.request.content.normal.title).assertEqual("test1_title"); - expect(data.request.content.normal.text).assertEqual("test1_text"); - expect(data.request.content.normal.additionalText).assertEqual("test1_additionalText"); - expect(data.request.slotType).assertEqual(65535); - expect(data.request.isOngoing).assertEqual(true); - expect(data.request.isUnremovable).assertEqual(false); - expect(data.request.deliveryTime).assertEqual(1624950453); - expect(data.request.tapDismissed).assertEqual(true); - expect(data.request.autoDeletedTime).assertEqual(1625036817); - expect(data.request.color).assertEqual(2); - expect(data.request.colorEnabled).assertEqual(true); - expect(data.request.isAlertOnce).assertEqual(true); - expect(data.request.isStopwatch).assertEqual(true); - expect(data.request.isCountDown).assertEqual(true); - expect(data.request.progressValue).assertEqual(12); - expect(data.request.progressMaxValue).assertEqual(100); - expect(data.request.isIndeterminate).assertEqual(true); - expect(data.request.statusBarText).assertEqual("statusBarText"); - expect(data.request.isFloatingIcon).assertEqual(true); - expect(data.request.label).assertEqual("0100_1"); - expect(data.request.badgeIconStyle).assertEqual(1); - expect(data.request.showDeliveryTime).assertEqual(true); - } - - /* - * @tc.number: ActsSubscriber_test_0100 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_0100', 0, async function (done) { - console.debug("==ActsSubscriber_test_0100==begin==>"); - await notify.subscribe(subInfoa, subscribeCallbacka); - console.debug("==ActsSubscriber_test_0100==end==>"); - done(); - }) - - /* - * @tc.number: ActsSubscriber_test_0200 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_0200', 0, async function (done) { - console.debug("==ActsSubscriber_test_0200==begin==>"); - var subInfo ={ - onConnect:connectCallbackb, - onDisconnect:disconnectCallbackb, - } - await notify.subscribe(subInfo,subscribeCallbackb); - await notify.subscribe(subInfo,subscribeCallbackc); - await notify.unsubscribe(subInfo, unSubscribeCallbackb); - console.debug("==ActsSubscriber_test_0200==end==>"); - done(); - }) - - /* - * @tc.number: ActsSubscriber_test_0300 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_0300', 0, async function (done) { - console.debug("==ActsSubscriber_test_0300==begin==>"); - - var subInfo ={ - onConnect:connectCallbackc, - onDisconnect:disconnectCallbackc, - } - var subInfo2 ={ - onConnect:connectCallbackd, - onDisconnect:disconnectCallbackd, - } - await notify.subscribe(subInfo,subscribeCallbackd); - await notify.subscribe(subInfo2,subscribeCallbacke); - await notify.unsubscribe(subInfo, unSubscribeCallbackc); - await notify.unsubscribe(subInfo2, unSubscribeCallbackd); - console.debug("==ActsSubscriber_test_0300==end==>"); - done(); - }) - /* - * @tc.number: ActsSubscriber_test_0400 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_0400', 0, async function (done) { - console.debug("==ActsSubscriber_test_0500==begin==>"); - - var subInfo ={ - onConnect:connectCallbackf, - onDisconnect:disconnectCallbackf, - } - var subInfo2 ={ - onConnect:connectCallbackg, - onDisconnect:disconnectCallbackg, - } - await notify.subscribe(subInfo,subscribeCallbackg); - await notify.subscribe(subInfo,subscribeCallbackh); - await notify.subscribe(subInfo2,subscribeCallbacki); - - await notify.unsubscribe(subInfo, unSubscribeCallbackf); - await notify.unsubscribe(subInfo2, unSubscribeCallbackg); - console.debug("==ActsSubscriber_test_0500==end==>"); - done(); - }) - - /* - * @tc.number: ActsSubscriber_test_0500 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_0500', 0, async function (done) { - console.debug("==ActsSubscriber_test_0500==begin==>"); - await notify.subscribe(subInfob, {bundleNames:["com.example.actsanspublishtest"]},subscribeCallbackl); - console.debug("==ActsSubscriber_test_0500==end3==>"); - done(); - }) - - /* - * @tc.number: ActsSubscriber_test_0600 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_0600', 0, async function (done) { - console.debug("==ActsSubscriber_test_0600==begin==>"); - await notify.subscribe(subInfoc, {bundleNames:["com.example.actsanspublishtest"]}).then( - console.log("ActsSubscriber_test_0600=======promise") - ); - console.debug("==ActsSubscriber_test_0600==end==>"); - done(); - }) - - /* - * @tc.number: ActsSubscriber_test_0700 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_0700', 0, async function (done) { - console.debug("==ActsSubscriber_test_0700==begin==>"); - await notify.subscribe(subInfod, {bundleNames:["com.example.actsanspublishtest","com.example.actsanspublishtest"]},subscribeCallbackn); - console.debug("==ActsSubscriber_test_0700==end==>"); - done(); - }) - - /* - * @tc.number: ActsSubscriber_test_0800 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_0800', 0, async function (done) { - console.debug("==ActsSubscriber_test_0900==begin==>"); - await notify.subscribe(subInfoe, {bundleNames:["com.example.actsanspublishtest","com.example.actsanspublishtest"]}).then( - console.log("ActsSubscriber_test_0900=======promise") - ); - console.debug("==ActsSubscriber_test_0900==end==>"); - done(); - }) - /* - * @tc.number: ActsSubscriber_test_0900 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_0900', 0, async function (done) { - console.debug("==ActsSubscriber_test_1000==begin==>"); - var promise = notify.subscribe(100,{bundleNames:["com.example.actsanspublishtest"]}); - expect(promise).assertEqual(undefined); - console.debug("==ActsSubscriber_test_1000==end==>"); - done(); - }) - /* - * @tc.number: ActsSubscriber_test_1000 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_1000', 0, async function (done) { - console.debug("==ActsSubscriber_test_1000==begin==>"); - var subInfo = null - var promise = await notify.subscribe(subInfo,{bundleNames:["com.example.actsanspublishtest"]}); - expect(promise).assertEqual(undefined); - console.debug("==ActsSubscriber_test_1000==end==>"); - done(); - }) - /* - * @tc.number: ActsSubscriber_test_1200 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_1100', 0, async function (done) { - console.debug("==ActsSubscriber_test_1200==begin==>"); - var subInfo = "#$#%$%$^&%^%" - var promise = notify.subscribe(subInfo,{bundleNames:["com.example.actsanspublishtest"]}); - expect(promise).assertEqual(undefined); - console.debug("==ActsSubscriber_test_1200==end==>"); - done(); - }) - /* - * @tc.number: ActsSubscriber_test_1200 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_1200', 0, async function (done) { - console.debug("==ActsSubscriber_test_1200==begin==>"); - var subInfo = "" - var promise = await notify.subscribe(subInfo,{bundleNames:["com.example.actsanspublishtest"]}); - expect(promise).assertEqual(undefined); - console.debug("==ActsSubscriber_test_1200==end==>"); - done(); - }) - /* - * @tc.number: ActsSubscriber_test_1300 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_1300', 0, async function (done) { - console.debug("==ActsSubscriber_test_1300==begin==>"); - var subInfo ={ - onConnect:connectCallbackl, - onDisconnect:disconnectCallbackn, - } - await notify.subscribe(subInfo,{bundleNames:["wrongBudleName"]},subscribeCallbacko); - await notify.unsubscribe(subInfo, unSubscribeCallbackn); - console.debug("==ActsSubscriber_test_1300==end==>"); - done(); - }) - /* - * @tc.number: ActsSubscriber_test_1500 - * @tc.name: subscribe() - * @tc.desc: verify the function of subscribe - */ - it('ActsSubscriber_test_1400', 0, async function (done) { - console.debug("==ActsSubscriber_test_1400==begin==>"); - var subInfo ={ - onConnect:connectCallbacko, - onDisconnect:disconnectCallbacko, - } - await notify.subscribe(subInfo,{bundleNames:[""]},subscribeCallbackp); - await notify.unsubscribe(subInfo, unSubscribeCallbacko); - console.debug("==ActsSubscriber_test_1400==end==>"); - done(); - }) -}) - -} diff --git a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/subscribe/subscribe/src/main/resources/base/element/string.json deleted file mode 100644 index 7ef7c952d1da88e39dcc608988f047e9f94a9d29..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/subscribe/subscribe/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "Subscriber" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/unsubscribe/BUILD.gn b/notification/ans_standard/publish_test/unsubscribe/BUILD.gn deleted file mode 100644 index 020abc3939439c35da0868539618cea193b23d47..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsUnSubscriberTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsUnSubscriberTest" - 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/publish_test/unsubscribe/Test.json b/notification/ans_standard/publish_test/unsubscribe/Test.json deleted file mode 100644 index d33d0c14585a6a48055288a41fc42fa5140491b5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "80000", - "shell-timeout": "80000", - "bundle-name": "com.example.actsansunsubscribertest", - "package-name": "com.example.actsansunsubscribertest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsUnSubscriberTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/unsubscribe/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/unsubscribe/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/unsubscribe/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/unsubscribe/src/main/config.json b/notification/ans_standard/publish_test/unsubscribe/src/main/config.json deleted file mode 100644 index 796c13923303532f1514a7d87ca21c5d7ef88f01..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsansunsubscribertest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsansunsubscribertest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/unsubscribe/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/unsubscribe/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/unsubscribe/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/unsubscribe/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/unsubscribe/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/unsubscribe/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/unsubscribe/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/unsubscribe/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/unsubscribe/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/unsubscribe/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index b14a8615c4e92ae987860b6feee5f6924bb77fe6..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Test of Unsubscription - -
diff --git a/notification/ans_standard/publish_test/unsubscribe/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/unsubscribe/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/unsubscribe/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/unsubscribe/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/unsubscribe/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/unsubscribe/src/main/js/test/List.test.js deleted file mode 100644 index 23748bc7d432649b0d9610dd200e37f6e1a53de4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsUnSubscriberTest from './UnSubscriber.js' -export default function testsuite() { -ActsAnsUnSubscriberTest() -} diff --git a/notification/ans_standard/publish_test/unsubscribe/src/main/js/test/UnSubscriber.js b/notification/ans_standard/publish_test/unsubscribe/src/main/js/test/UnSubscriber.js deleted file mode 100644 index 861c84ded702f8ce04125a1d894903d3ed1befd0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/src/main/js/test/UnSubscriber.js +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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 notify from '@ohos.notification' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -var time = 500 -export default function ActsAnsUnSubscriberTest() { -describe('ActsAnsUnSubscriberTest', function () { - console.debug("===============ActsAnsUnSubscriberTest start=================>"); - function onConnecteOne() { - console.debug("===============Ans_UnSubscriber_0100 onConnecte=================>"); - } - function onDisconnectOne() { - console.debug("===============Ans_UnSubscriber_0100 onDisconnect=================>"); - } - - function onDisconnectTestNine() { - console.debug("=======Ans_UnSubscriber_0900 onDisconnectTestNine =================>"); - expect().assertFail(); - } - - /* - * @tc.number: Ans_UnSubscriber_0900 - * @tc.name: unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback): void; - * @tc.desc: Verify that after the subscribe fails, the unsubscribe fails(callback) - */ - it('Ans_UnSubscriber_0900', 0, async function (done) { - console.info("===========Ans_UnSubscriber_0900 start=============>"); - var subscriber ={ - onConnect:"", - onDisconnect:onDisconnectTestNine - } - notify.subscribe(subscriber, (err)=>{ - console.debug("Ans_UnSubscriber_0900 subscribeCallbackNine err.code=================>"+err.code); - expect(err.code != 0).assertEqual(true); - notify.unsubscribe(subscriber, (err)=>{ - console.debug("Ans_UnSubscriber_0900 unsubscribe err.code=================>"+err.code); - expect(err.code != 0).assertEqual(true); - }); - }); - setTimeout(function(){ - console.debug("===========Ans_UnSubscriber_0900 setTimeout=============>"); - done(); - }, time); - }) - - function onDisconnectTestTen() { - console.debug("=======Ans_UnSubscriber_1000 onDisconnectTestTen =================>"); - expect().assertFail(); - } - - /* - * @tc.number: Ans_UnSubscriber_1000 - * @tc.name: unsubscribe(subscriber: NotificationSubscriber): Promise; - * @tc.desc: Verify that after the subscribe fails, the unsubscribe fails(promise) - */ - it('Ans_UnSubscriber_1000', 0, async function (done) { - console.info("===========Ans_UnSubscriber_1000 start=============>"); - var subscriber = { - onConnect:"", - onDisconnect:onDisconnectTestTen - } - notify.subscribe(subscriber, (err)=>{ - notify.unsubscribe(subscriber).then((err)=>{ - console.debug("=======Ans_UnSubscriber_1000 subscribe then err=================>"+err.code); - }).catch((err)=>{ - console.debug("=======Ans_UnSubscriber_1000 subscribe catch err=================>"+err.code); - expect(err.code != 0).assertEqual(true); - }); - }); - setTimeout(function(){ - console.debug("===========Ans_UnSubscriber_1000 setTimeout=============>"); - done(); - }, time); - }) -}) - -} diff --git a/notification/ans_standard/publish_test/unsubscribe/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/unsubscribe/src/main/resources/base/element/string.json deleted file mode 100644 index 9c4ce1d062536941d7bfb26b90b684f36d8016de..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/unsubscribe/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "UnSub" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - }, - { - "name": "MainAbility_desc", - "value": "description" - }, - { - "name": "MainAbility_label", - "value": "label" - }, - { - "name": "TestAbility_desc", - "value": "description" - }, - { - "name": "TestAbility_label", - "value": "label" - } - ] -} diff --git a/notification/ans_standard/publish_test/wantagent/BUILD.gn b/notification/ans_standard/publish_test/wantagent/BUILD.gn deleted file mode 100644 index 27c08d026b82390d1018b8d89ba0c2e87e17f8a3..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/BUILD.gn +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//test/xts/tools/build/suite.gni") - -group("wantagent") { - testonly = true - if (is_standard_system) { - deps = [ - "test1:test1", - "test2:test2", - "wantagent1:ActsAnsWantAgentOneTest", - "wantagent1promise:ActsAnsWantAgentOneProTest", - "wantagent2:ActsAnsWantAgentTwoTest", - "wantagent2promise:ActsAnsWantAgentTwoProTest", - "wantagent3:ActsAnsWantAgentTreeTest", - "wantagent3promise:ActsAnsWantAgentTreeProTest", - "wantagent4:ActsAnsWantAgentFourTest", - "wantagent4promise:ActsAnsWantAgentFourProTest", - "wantagent5:ActsAnsWantAgentFiveTest", - "wantagent5promise:ActsAnsWantAgentFiveProTest", - ] - } -} diff --git a/notification/ans_standard/publish_test/wantagent/test1/BUILD.gn b/notification/ans_standard/publish_test/wantagent/test1/BUILD.gn deleted file mode 100644 index fd47b8dc08b95fcdf97c3de98accc5ab43d290e4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/test1/BUILD.gn +++ /dev/null @@ -1,33 +0,0 @@ -# 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_hap_assist_suite("test1") { - hap_profile = "./entry/src/main/config.json" - hap_name = "test1" - subsystem_name = "notification" - part_name = "distributed_notification_service" - testonly = true - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/config.json b/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/config.json deleted file mode 100644 index 7cd98f72e355621ec42c6252d336f58174dbb27c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/config.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "app": { - "bundleName": "com.example.WantAgentTest1", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.WantAgentTest1", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "com.example.WantAgentTest1.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/wantagent/test1/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/default/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/default/pages/index/index.hml deleted file mode 100644 index aa13e19ea206c08a562754f7cef3572726e96941..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Page 1 - -
diff --git a/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index 219ee80b4bb4d98a444acad561ef660c6c7ad153..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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' -import {Core, ExpectExtend} from 'deccjsunit/index' - -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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index f65b394eb7a98a4058d726bacda53fe1221d909d..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/test1/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "test1" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/test1/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/wantagent/test1/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/wantagent/test1/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/wantagent/test2/BUILD.gn b/notification/ans_standard/publish_test/wantagent/test2/BUILD.gn deleted file mode 100644 index 28abbb7dd04dc6dd997a85cec86c622a3fe0e01d..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/test2/BUILD.gn +++ /dev/null @@ -1,33 +0,0 @@ -# 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_hap_assist_suite("test2") { - hap_profile = "./entry/src/main/config.json" - hap_name = "test2" - subsystem_name = "notification" - part_name = "distributed_notification_service" - testonly = true - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/config.json b/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/config.json deleted file mode 100644 index 2596b3cc53bf2cbdf24dde7a38594a80e4f1ec44..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/config.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "app": { - "bundleName": "com.example.WantAgenTest2", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.WantAgenTest2", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "com.example.WantAgenTest2.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "isVisible": "true", - "launchType": "standard", - "visible": true - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/default/app.js b/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/default/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/default/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/wantagent/test2/entry/src/main/js/default/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/default/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/default/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/default/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/default/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/default/pages/index/index.hml deleted file mode 100644 index 5f0dc11c72dd500785428632bfbba9d776ab70ac..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - Page 2 - -
diff --git a/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/default/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index 219ee80b4bb4d98a444acad561ef660c6c7ad153..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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' -import {Core, ExpectExtend} from 'deccjsunit/index' - -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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/resources/base/element/string.json b/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index dd75de46505148f70190b878f16fe858628fcfda..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/test2/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "Test2" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/test2/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/wantagent/test2/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/wantagent/test2/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1/BUILD.gn b/notification/ans_standard/publish_test/wantagent/wantagent1/BUILD.gn deleted file mode 100644 index 963342d45481e0199e13b958ad13bf35403ea21e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsWantAgentOneTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsWantAgentOneTest" - 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/publish_test/wantagent/wantagent1/Test.json b/notification/ans_standard/publish_test/wantagent/wantagent1/Test.json deleted file mode 100644 index 4ec83e0a14ca2cd0b7f4f020d3f6880738f65482..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/Test.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "160000", - "shell-timeout": "160000", - "bundle-name": "com.example.actsanswantagentonetest", - "package-name": "com.example.actsanswantagentonetest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsWantAgentOneTest.hap", - "test1.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/wantagent/wantagent1/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/wantagent/wantagent1/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/config.json b/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/config.json deleted file mode 100644 index 540131f638a5cd8b0dd08394abb15303d8613ea6..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanswantagentonetest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanswantagentonetest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/wantagent/wantagent1/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index a5e37ac290b36e20543922493f7a31971181209f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - WantAgent1 Startup - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/wantagent/wantagent1/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/wantagent/wantagent1/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/wantagent/wantagent1/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/test/List.test.js deleted file mode 100644 index f1e05b3417cb97fc9c09fdc8e765ef4829925b06..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsWantAgentOneTest from './WantAgent.test.js' -export default function testsuite() { -ActsAnsWantAgentOneTest() -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/test/WantAgent.test.js deleted file mode 100644 index fc4199e32b5f1e64c45bd72c28624cd53394f5ec..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/js/test/WantAgent.test.js +++ /dev/null @@ -1,666 +0,0 @@ -/* - * 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 wantAgent from '@ohos.wantAgent'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'; -var time = 1000 -var WantAgent; -export default function ActsAnsWantAgentOneTest() { -describe('ActsAnsWantAgentOneTest', function () { - console.info('----ActsWantAgentTest----'); - - /* - * @tc.number: ACTS_SetWant_0100 - * @tc.name: getWantAgent(OperationType.START_ABILITY) - * @tc.desc: verify the function of getWantAgent(OperationType.START_ABILITY) - */ - it('ACTS_SetWant_0100', 0, async function (done) { - console.info('----ACTS_SetWant_0100 start----'); - var agentInfo = { - wants: [ - { - deviceId: "", - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.WantAgentTest1.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - } - console.info('----getWantAgent before----'); - await wantAgent.getWantAgent(agentInfo, - (err, data) => { - if (err.code == 0) { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - var triggerInfo = { - code:0 - } - wantAgent.trigger(WantAgent, triggerInfo, - (err, data) => { - if (err.code == 0) { - console.info('----trigger success!----'); - console.info('== trigger data ' + JSON.stringify(data) ); - expect(data.finalCode).assertEqual(0); - expect(data.finalData).assertEqual(""); - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.WantAgentTest1"); - expect(data.want.abilityName).assertEqual("com.example.WantAgentTest1.MainAbility"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(JSON.stringify(data.want.entities)).assertEqual(JSON.stringify(["entity1"])); - expect(data.want.action).assertEqual("action1"); - } else { - console.info('----trigger failed!----'); - console.info('== trigger data ' + JSON.stringify(data) ); - } - done(); - } - ); - } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - } - - ); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWant_0100====>"); - }, time); - - console.info('----getWantAgent after----'); - }) - - /* - * @tc.number: ACTS_SetWant_0200 - * @tc.name: getWantAgent(OperationType.START_ABILITY) - * @tc.desc: verify the function of getWantAgent(OperationType.START_ABILITY)[ONE_TIME_FLAG] - */ - it('ACTS_SetWant_0200', 0, async function (done) { - console.info('----ACTS_SetWant_0200 start----'); - var agentInfo = { - wants: [ - { - deviceId: "", - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.ONE_TIME_FLAG] - } - console.info('----getWantAgent before----'); - await wantAgent.getWantAgent(agentInfo, - (err, data) => { - if (err.code == 0) { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - } - - ); - console.info('----getWantAgent after----'); - }) - - /* - * @tc.number: ACTS_SetWant_0300 - * @tc.name: getWantAgent(OperationType.START_ABILITY) - * @tc.desc: verify the function of getWantAgent(OperationType.START_ABILITY)[NO_BUILD_FLAG] - */ - it('ACTS_SetWant_0300', 0, async function (done) { - console.info('----ACTS_SetWant_0300 start----'); - var agentInfo = { - wants: [ - { - deviceId: "", - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.NO_BUILD_FLAG] - } - console.info('----getWantAgent before----'); - await wantAgent.getWantAgent(agentInfo, - (err, data) => { - if (err.code == 0) { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - } - - ); - console.info('----getWantAgent after----'); - }) - - /* - * @tc.number: ACTS_SetWant_0400 - * @tc.name: getWantAgent(OperationType.START_ABILITY) - * @tc.desc: verify the function of getWantAgent(OperationType.START_ABILITY)[CANCEL_PRESENT_FLAG] - */ - it('ACTS_SetWant_0400', 0, async function (done) { - console.info('----ACTS_SetWant_0400 start----'); - var agentInfo = { - wants: [ - { - deviceId: "", - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.CANCEL_PRESENT_FLAG] - } - console.info('----getWantAgent before----'); - await wantAgent.getWantAgent(agentInfo, - (err, data) => { - if (err.code == 0) { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - } - - ); - console.info('----getWantAgent after----'); - }) - - /* - * @tc.number: ACTS_SetWant_0500 - * @tc.name: getWantAgent(OperationType.START_ABILITY) - * @tc.desc: verify the function of getWantAgent(OperationType.START_ABILITY)[CONSTANT_FLAG] - */ - it('ACTS_SetWant_0500', 0, async function (done) { - console.info('----ACTS_SetWant_0500 start----'); - var agentInfo = { - wants: [ - { - deviceId: "", - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.CONSTANT_FLAG] - } - console.info('----getWantAgent before----'); - await wantAgent.getWantAgent(agentInfo, - (err, data) => { - if (err.code == 0) { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - } - - ); - console.info('----getWantAgent after----'); - }) - - /* - * @tc.number: ACTS_SetWant_0600 - * @tc.name: getWantAgent(OperationType.START_ABILITY) - * @tc.desc: verify the function of getWantAgent(OperationType.START_ABILITY)[REPLACE_ELEMENT] - */ - it('ACTS_SetWant_0600', 0, async function (done) { - console.info('----ACTS_SetWant_0600 start----'); - var agentInfo = { - wants: [ - { - deviceId: "", - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.REPLACE_ELEMENT] - } - console.info('----getWantAgent before----'); - await wantAgent.getWantAgent(agentInfo, - (err, data) => { - if (err.code == 0) { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - } - - ); - console.info('----getWantAgent after----'); - }) - - /* - * @tc.number: ACTS_SetWant_0700 - * @tc.name: getWantAgent(OperationType.START_ABILITY) - * @tc.desc: verify the function of getWantAgent(OperationType.START_ABILITY)[REPLACE_ACTION] - */ - it('ACTS_SetWant_0700', 0, async function (done) { - console.info('----ACTS_SetWant_0700 start----'); - var agentInfo = { - wants: [ - { - deviceId: "", - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.REPLACE_ACTION] - } - console.info('----getWantAgent before----'); - await wantAgent.getWantAgent(agentInfo, - (err, data) => { - if (err.code == 0) { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - } - - ); - console.info('----getWantAgent after----'); - }) - - - /* - * @tc.number: ACTS_SetWant_0800 - * @tc.name: getWantAgent(OperationType.START_ABILITY) - * @tc.desc: verify the function of getWantAgent(OperationType.START_ABILITY)[REPLACE_URI] - */ - it('ACTS_SetWant_0800', 0, async function (done) { - console.info('----ACTS_SetWant_0800 start----'); - var agentInfo = { - wants: [ - { - deviceId: "", - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.REPLACE_URI] - } - console.info('----getWantAgent before----'); - await wantAgent.getWantAgent(agentInfo, - (err, data) => { - if (err.code == 0) { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - } - - ); - console.info('----getWantAgent after----'); - }) - - /* - * @tc.number: ACTS_SetWant_0900 - * @tc.name: getWantAgent(OperationType.START_ABILITY) - * @tc.desc: verify the function of getWantAgent(OperationType.START_ABILITY)[REPLACE_ENTITIES] - */ - it('ACTS_SetWant_0900', 0, async function (done) { - console.info('----ACTS_SetWant_0900 start----'); - var agentInfo = { - wants: [ - { - deviceId: "", - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.REPLACE_ENTITIES] - } - console.info('----getWantAgent before----'); - await wantAgent.getWantAgent(agentInfo, - (err, data) => { - if (err.code == 0) { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - } - - ); - console.info('----getWantAgent after----'); - }) - - /* - * @tc.number: ACTS_SetWant_1000 - * @tc.name: getWantAgent(OperationType.START_ABILITY) - * @tc.desc: verify the function of getWantAgent(OperationType.START_ABILITY)[REPLACE_BUNDLE] - */ - it('ACTS_SetWant_1000', 0, async function (done) { - console.info('----ACTS_SetWant_1000 start----'); - var agentInfo = { - wants: [ - { - deviceId: "", - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.test.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.REPLACE_BUNDLE] - } - console.info('----getWantAgent before----'); - await wantAgent.getWantAgent(agentInfo, - (err, data) => { - if (err.code == 0) { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - } - - ); - console.info('----getWantAgent after----'); - }) - - /* - * @tc.number: ACTS_SetWant_1100 - * @tc.name: getWantAgent(OperationType.START_ABILITY) - * @tc.desc: verify the function of getWantAgent(OperationType.START_ABILITY) - */ - it('ACTS_SetWant_1100', 0, async function (done) { - console.info('----ACTS_SetWant_1100 start----'); - var agentInfo = { - wants: [ - { - deviceId: "", - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.WantAgentTest1.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - } - console.info('----getWantAgent before----'); - await wantAgent.getWantAgent(agentInfo, - (err, data) => { - if (err.code == 0) { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - var triggerInfo = { - code:0 - } - wantAgent.trigger(WantAgent, triggerInfo, - (err, data) => { - if (err.code == 0) { - console.info('----trigger success!----'); - console.info('== trigger data ' + JSON.stringify(data) ); - expect(data.info).assertEqual(WantAgent); - expect(data.want).assertEqual(Want); - expect(typeof(data.extraInfo)).assertEqual("object"); - expect(data.finalCode).assertEqual(0); - expect(data.finalData).assertEqual(""); - expect(data.want.deviceId).assertEqual(""); - expect(data.want.bundleName).assertEqual("com.example.WantAgentTest1"); - expect(data.want.abilityName).assertEqual("com.example.WantAgentTest1.MainAbility"); - expect(data.want.uri).assertEqual("key={true,true,false}"); - expect(JSON.stringify(data.want.entities)).assertEqual(JSON.stringify(["entity1"])); - expect(data.want.action).assertEqual("action1"); - } else { - console.info('----trigger failed!----'); - console.info('== trigger data ' + JSON.stringify(data) ); - } - done(); - } - ); - } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - } - - ); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWant_0700====>"); - }, 100); - - console.info('----getWantAgent after----'); - }) -}) - -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/resources/base/element/string.json deleted file mode 100644 index 4cd7230f8a5c83242c798030808db2b02b7a14d0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "Want1" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1promise/BUILD.gn b/notification/ans_standard/publish_test/wantagent/wantagent1promise/BUILD.gn deleted file mode 100644 index 11f94c4e8a383148c062f845e91523130c844842..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsWantAgentOneProTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsWantAgentOneProTest" - 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/publish_test/wantagent/wantagent1promise/Test.json b/notification/ans_standard/publish_test/wantagent/wantagent1promise/Test.json deleted file mode 100644 index 6685e836736b31cab047044f8c9ab55596631e29..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/Test.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "160000", - "shell-timeout": "160000", - "bundle-name": "com.example.actsanswantagentoneprotest", - "package-name": "com.example.actsanswantagentoneprotest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsWantAgentOneProTest.hap", - "test1.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1promise/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/wantagent/wantagent1promise/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/wantagent/wantagent1promise/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/config.json b/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/config.json deleted file mode 100644 index d545d71bbc793337e1a3bd6c6645ec013eee44c9..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanswantagentoneprotest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanswantagentoneprotest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/wantagent/wantagent1promise/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 32862e858b08ed0f1d6654f22252612c2772939a..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - WantAgent1Promise Startup - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/wantagent/wantagent1promise/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/wantagent/wantagent1promise/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/wantagent/wantagent1promise/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/test/List.test.js deleted file mode 100644 index 546de5d578fa94aa41450f553e812558b4284acb..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsWantAgentOneProTest from './WantAgent.test.js' -export default function testsuite() { -ActsAnsWantAgentOneProTest() -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/test/WantAgent.test.js deleted file mode 100644 index e7a343eb37cd9781486eb687a4fde5c22cd6f70d..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/js/test/WantAgent.test.js +++ /dev/null @@ -1,147 +0,0 @@ -/* - * 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 wantAgent from '@ohos.wantAgent'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'; -var time = 1000 -var WantAgent; -export default function ActsAnsWantAgentOneProTest() { -describe('ActsAnsWantAgentOneProTest', function () { - console.info("----ActsWantAgentTest----"); - - /* - * @tc.number: ACTS_SetWant_0200 - * @tc.name: getWantAgent(OperationType.START_ABILITY) - * @tc.desc: verify the function of getWantAgent(OperationType.START_ABILITY) - */ - it("ACTS_SetWant_0200", 0, async function (done) { - var agentInfo = { - wants: [ - { - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.WantAgentTest1.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - }, - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG], - }; - console.info("----getWantAgent before----"); - wantAgent.getWantAgent(agentInfo).then((data) => { - WantAgent = data; - console.info("----getWantAgent success!----"); - console.info(JSON.stringify(data)); - expect(typeof data).assertEqual("object"); - var triggerInfo = { - code: 0, - }; - wantAgent.trigger(WantAgent, triggerInfo, (err, data) => { - if (err.code == 0) { - console.info("----trigger success!----"); - console.info("== trigger data " + JSON.stringify(data)); - } else { - console.info("----trigger failed!----"); - console.info("== trigger data " + JSON.stringify(data)); - } - done(); - }); - done(); - }); - setTimeout(function () { - console.debug("====>time out ACTS_SetWant_0200====>"); - }, time); - console.info("----getWantAgent after----"); - }); - - /* - * @tc.number: ACTS_SetWant_0300 - * @tc.name: getWantAgent(OperationType.START_ABILITY) - * @tc.desc: verify the function of getWantAgent(OperationType.START_ABILITY) - */ - it("ACTS_SetWant_0300", 0, async function (done) { - var agentInfo = { - wants: [ - { - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.WantAgentTest1.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - }, - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG], - extraInfo: { - key1:'test_extraInfo' - } - }; - console.info("----getWantAgent before----"); - wantAgent.getWantAgent(agentInfo).then((data) => { - WantAgent = data; - console.info("----getWantAgent success!----"); - console.info(JSON.stringify(data)); - expect(typeof data).assertEqual("object"); - var triggerInfo = { - code: 0, - want:WantAgent, - permission:'', - extraInfo: { - key1:'test_triggerInfo' - } - }; - wantAgent.trigger(WantAgent, triggerInfo, (err, data) => { - if (err.code == 0) { - console.info("----trigger success!----"); - console.info("== trigger data " + JSON.stringify(data)); - } else { - console.info("----trigger failed!----"); - console.info("== trigger data " + JSON.stringify(data)); - } - done(); - }); - done(); - }); - setTimeout(function () { - console.debug("====>time out ACTS_SetWant_0200====>"); - }, time); - console.info("----getWantAgent after----"); - }); -}) - -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/resources/base/element/string.json deleted file mode 100644 index 55ba0c1ffd626ad7f68515bd08ce82d940aaf4dd..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent1promise/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "WantPro1" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2/BUILD.gn b/notification/ans_standard/publish_test/wantagent/wantagent2/BUILD.gn deleted file mode 100644 index 14f13162f620938d49a7b082a14f4e7db97517a2..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsWantAgentTwoTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsWantAgentTwoTest" - 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/publish_test/wantagent/wantagent2/Test.json b/notification/ans_standard/publish_test/wantagent/wantagent2/Test.json deleted file mode 100644 index 3ecbd73c290e811308c451fec3d8908c9cd2c290..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/Test.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "shell-timeout": "180000", - "bundle-name": "com.example.actsanswantagenttwotest", - "package-name": "com.example.actsanswantagenttwotest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsWantAgentTwoTest.hap", - "test1.hap", - "test2.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/wantagent/wantagent2/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/wantagent/wantagent2/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/config.json b/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/config.json deleted file mode 100644 index 5b64fd07d9408926f059f3d03dc77eb364db8092..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanswantagenttwotest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanswantagenttwotest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/wantagent/wantagent2/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index d51626a268e8bcd6e7f4411094e0bf97b3c66284..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - WantAgent2 Startup - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/wantagent/wantagent2/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/wantagent/wantagent2/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/wantagent/wantagent2/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/test/List.test.js deleted file mode 100644 index 95877f49bb8fd24715eb172515695f8580fc7d62..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsWantAgentTwoTest from './WantAgent.test.js' -export default function testsuite() { -ActsAnsWantAgentTwoTest() -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/test/WantAgent.test.js deleted file mode 100644 index 6baa403c5446526cbec35f82e697013138005fdd..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/js/test/WantAgent.test.js +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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 wantAgent from '@ohos.wantAgent'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'; -var time = 1000 -var WantAgent; -export default function ActsAnsWantAgentTwoTest() { -describe('ActsAnsWantAgentTwoTest', function () { - - /* - * @tc.number: ACTS_SetWant_0300 - * @tc.name: getWantAgent(OperationType.START_ABILITIES) - * @tc.desc: verify the function of getWantAgent(OperationType.START_ABILITIES) - */ - it('ACTS_SetWant_0300', 0, async function (done) { - var agentInfo = { - wants: [ - { - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.WantAgentTest1.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - { - bundleName: "com.example.WantAgenTest2", - abilityName: "com.example.WantAgenTest2.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - } - ], - operationType: wantAgent.OperationType.START_ABILITIES, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - } - console.info('----getWantAgent before----'); - wantAgent.getWantAgent(agentInfo, - (err, data) => { - if (err.code == 0) { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - var triggerInfo = { - code:0 - } - wantAgent.trigger(WantAgent, triggerInfo, - (err, data) => { - if (err.code == 0) { - console.info('----trigger success!----'); - console.info('== trigger data ' + JSON.stringify(data) ); - } else { - console.info('----trigger failed!----'); - console.info('== trigger data ' + JSON.stringify(data) ); - } - done(); - } - ); - } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - } - - ); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWant_0300====>"); - }, time); - console.info('----getWantAgent after----'); - }) -}) - -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/resources/base/element/string.json deleted file mode 100644 index 846d9fdd82700705e036c79145bb86b516bdcc6c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "Want2" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2promise/BUILD.gn b/notification/ans_standard/publish_test/wantagent/wantagent2promise/BUILD.gn deleted file mode 100644 index ae27f07b7507822aabdc9f250753006238d53aea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsWantAgentTwoProTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsWantAgentTwoProTest" - 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/publish_test/wantagent/wantagent2promise/Test.json b/notification/ans_standard/publish_test/wantagent/wantagent2promise/Test.json deleted file mode 100644 index 799286c17b69147ebcea54ce8734f58b809f584d..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/Test.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "260000", - "shell-timeout": "260000", - "bundle-name": "com.example.actsanswantagenttwoprotest", - "package-name": "com.example.actsanswantagenttwoprotest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsWantAgentTwoProTest.hap", - "test1.hap", - "test2.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2promise/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/wantagent/wantagent2promise/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/wantagent/wantagent2promise/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/config.json b/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/config.json deleted file mode 100644 index 294cd3bdf94ec90a57d0a59906b536a9c9b0ef30..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanswantagenttwoprotest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanswantagenttwoprotest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/wantagent/wantagent2promise/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 12c2d27a6c7aaaa591a8c4328bff257090617674..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - WantAgentPromise2 Startup - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/wantagent/wantagent2promise/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/wantagent/wantagent2promise/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/wantagent/wantagent2promise/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/test/List.test.js deleted file mode 100644 index e8c8613e236aff9f38d1560dc84d91b7bd3c2a4a..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsWantAgentTwoProTest from './WantAgent.test.js' -export default function testsuite() { -ActsAnsWantAgentTwoProTest() -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/test/WantAgent.test.js deleted file mode 100644 index 78e1e6e0c0d786a8f0638e9a11a67d5048e6de1e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/js/test/WantAgent.test.js +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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 wantAgent from '@ohos.wantAgent'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'; -var time = 1000 -var WantAgent; -export default function ActsAnsWantAgentTwoProTest() { -describe('ActsAnsWantAgentTwoProTest', function () { - - /* - * @tc.number: ACTS_SetWant_0400 - * @tc.name: getWantAgent(OperationType.START_ABILITIES) - * @tc.desc: verify the function of getWantAgent(OperationType.START_ABILITIES) - */ - it('ACTS_SetWant_0400', 0, async function (done) { - expect(3).assertEqual(wantAgent.OperationType.START_SERVICE) - var agentInfo = { - wants: [ - { - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.WantAgentTest1.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - { - bundleName: "com.example.WantAgenTest2", - abilityName: "com.example.WantAgenTest2.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - } - ], - operationType: wantAgent.OperationType.START_ABILITIES, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - } - console.info('----getWantAgent before----'); - wantAgent.getWantAgent(agentInfo).then( - (data) => { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - var triggerInfo = { - code:0 - } - wantAgent.trigger(WantAgent, triggerInfo, - (err, data) => { - if (err.code == 0) { - console.info('----trigger success!----'); - console.info('== trigger data ' + JSON.stringify(data) ); - } else { - console.info('----trigger failed!----'); - console.info('== trigger data ' + JSON.stringify(data) ); - } - done(); - } - ); - done(); - } - ); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWant_0400====>"); - }, time); - console.info('----getWantAgent after----'); - }) - -}) - -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/resources/base/element/string.json deleted file mode 100644 index 661e71b9907187b19de930d219ea402e0817c49c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent2promise/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "WantPro2" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3/BUILD.gn b/notification/ans_standard/publish_test/wantagent/wantagent3/BUILD.gn deleted file mode 100644 index 611c86320e90da8b2d62239534547c970f803d0b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsWantAgentTreeTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsWantAgentTreeTest" - 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/publish_test/wantagent/wantagent3/Test.json b/notification/ans_standard/publish_test/wantagent/wantagent3/Test.json deleted file mode 100644 index d06015403e944cae8383ff95390c04a994ad0aeb..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "160000", - "shell-timeout": "160000", - "bundle-name": "com.example.actsanswantagenttreetest", - "package-name": "com.example.actsanswantagenttreetest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsWantAgentTreeTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/wantagent/wantagent3/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/wantagent/wantagent3/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/config.json b/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/config.json deleted file mode 100644 index 6167871a5add6e46856bd85c04032af99ef702fe..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanswantagenttreetest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanswantagenttreetest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/wantagent/wantagent3/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 971ddbcb1dedd03243021514d4f3495f8f169f9e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - WantAgent3 Startup - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/wantagent/wantagent3/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/wantagent/wantagent3/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/wantagent/wantagent3/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/test/List.test.js deleted file mode 100644 index e5b1a401d0ef065d95fba51961318d7d571eb4ec..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsWantAgentTreeTest from './WantAgent.test.js' -export default function testsuite() { -ActsAnsWantAgentTreeTest() -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/test/WantAgent.test.js deleted file mode 100644 index a87b9563fe082c081be4f989806a3324b6b20dea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/js/test/WantAgent.test.js +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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 wantAgent from '@ohos.wantAgent'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'; -var time = 1000 -var WantAgent; -export default function ActsAnsWantAgentTreeTest() { -describe('ActsAnsWantAgentTreeTest', function () { - - /* - * @tc.number: ACTS_SetWant_0500 - * @tc.name: getWantAgent(OperationType.SEND_COMMON_EVENT) - * @tc.desc: verify the function of getWantAgent(OperationType.SEND_COMMON_EVENT) - */ - it('ACTS_SetWant_0500', 0, async function (done) { - var agentInfo = { - wants: [ - { - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.WantAgentTest1.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.SEND_COMMON_EVENT, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - } - console.info('----getWantAgent before----'); - wantAgent.getWantAgent(agentInfo, - (err, data) => { - if (err.code == 0) { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - var triggerInfo = { - code:0 - } - wantAgent.trigger(WantAgent, triggerInfo, - (err, data) => { - if (err.code == 0) { - console.info('----trigger success!----'); - console.info('== trigger data ' + JSON.stringify(data) ); - } else { - console.info('----trigger failed!----'); - console.info('== trigger data ' + JSON.stringify(data) ); - } - done(); - } - ); - } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - - } - ); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWant_0500====>"); - }, time) - console.info('----getWantAgent after----'); - }) -}) - -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/resources/base/element/string.json deleted file mode 100644 index 8968aafcbcd2a2958efbb92689196243c376ae51..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "WantAgent3" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3promise/BUILD.gn b/notification/ans_standard/publish_test/wantagent/wantagent3promise/BUILD.gn deleted file mode 100644 index a203275fe629529a2d7fa5e82c0ce90ac79bbfcf..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsWantAgentTreeProTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsWantAgentTreeProTest" - 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/publish_test/wantagent/wantagent3promise/Test.json b/notification/ans_standard/publish_test/wantagent/wantagent3promise/Test.json deleted file mode 100644 index fe00a782869d03153460acdf597cebca70d235fa..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "160000", - "shell-timeout": "160000", - "bundle-name": "com.example.actsanswantagenttreeprotest", - "package-name": "com.example.actsanswantagenttreeprotest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsWantAgentTreeProTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3promise/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/wantagent/wantagent3promise/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/wantagent/wantagent3promise/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/config.json b/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/config.json deleted file mode 100644 index 0ea0b0805db57a216068aa0b39b6cc2baaf7e126..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanswantagenttreeprotest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanswantagenttreeprotest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/wantagent/wantagent3promise/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index b20dcf3a783abb4605b7b3866e22faaac0e0b7fb..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - WantAgentPromise3 Startup - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/wantagent/wantagent3promise/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/wantagent/wantagent3promise/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/wantagent/wantagent3promise/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/test/List.test.js deleted file mode 100644 index 6934c4f416f62e40aac9a4326c91f124f2df9dbb..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsWantAgentTreeProTest from './WantAgent.test.js' -export default function testsuite() { -ActsAnsWantAgentTreeProTest() -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/test/WantAgent.test.js deleted file mode 100644 index 7f9a2ad9bf4c703dfb68a82e100a42e36f0ccb7a..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/js/test/WantAgent.test.js +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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 wantAgent from '@ohos.wantAgent'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'; -var time = 1000 -var WantAgent; -export default function ActsAnsWantAgentTreeProTest() { -describe('ActsAnsWantAgentTreeProTest', function () { - - /* - * @tc.number: ACTS_SetWant_0600 - * @tc.name: getWantAgent(OperationType.SEND_COMMON_EVENT) - * @tc.desc: verify the function of getWantAgent(OperationType.SEND_COMMON_EVENT) - */ - it('ACTS_SetWant_0600', 0, async function (done) { - var agentInfo = { - wants: [ - { - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.WantAgentTest1.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.SEND_COMMON_EVENT, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - } - console.info('----getWantAgent before----'); - wantAgent.getWantAgent(agentInfo).then( - (data) => { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - var triggerInfo = { - code:0 - } - wantAgent.trigger(WantAgent, triggerInfo, - (err, data) => { - if (err.code == 0) { - console.info('----trigger success!----'); - console.info('==================== trigger data ' + JSON.stringify(data) ); - } else { - console.info('----trigger failed!----'); - console.info('==================== trigger data ' + JSON.stringify(data) ); - } - done(); - } - ); - done(); - - } - ); -setTimeout(function(){ - console.debug("====>time out ACTS_SetWant_0600====>"); - }, time); - console.info('----getWantAgent after----'); - }) -}) - -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/resources/base/element/string.json deleted file mode 100644 index 9d1c23f24266b0ea889593418881801cfac3ea04..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent3promise/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "WantAgentPromise3" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4/BUILD.gn b/notification/ans_standard/publish_test/wantagent/wantagent4/BUILD.gn deleted file mode 100644 index 0f52b70d8535a4975543ec526fc43512dc66452b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsWantAgentFourTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsWantAgentFourTest" - 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/publish_test/wantagent/wantagent4/Test.json b/notification/ans_standard/publish_test/wantagent/wantagent4/Test.json deleted file mode 100644 index 380a091dadaf9862ce5e75aed054f6b33b8c4b01..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "160000", - "shell-timeout": "160000", - "bundle-name": "com.example.actsanswantagentfourtest", - "package-name": "com.example.actsanswantagentfourtest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsWantAgentFourTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/wantagent/wantagent4/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/wantagent/wantagent4/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/config.json b/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/config.json deleted file mode 100644 index 2ac792e1b28e6d6f05f4ad7e902058e43ac57493..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanswantagentfourtest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanswantagentfourtest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/wantagent/wantagent4/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 4b7693140c3d87aa107bc57ed196e4c7f094f279..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - WantAgent4 Startup - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/wantagent/wantagent4/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/wantagent/wantagent4/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/wantagent/wantagent4/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/test/List.test.js deleted file mode 100644 index 94104ad7aa5db20f03b80edb9524dfef0df973ce..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsWantAgentFourTest from './WantAgent.test.js' -export default function testsuite() { -ActsAnsWantAgentFourTest() -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/test/WantAgent.test.js deleted file mode 100644 index ca40d80b64aa9f9d96ed4f7a460acb7c477d4037..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/js/test/WantAgent.test.js +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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 wantAgent from '@ohos.wantAgent'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'; -var time = 1000 -var WantAgent; -export default function ActsAnsWantAgentFourTest() { -describe('ActsAnsWantAgentFourTest', function () { - - /* - * @tc.number: ACTS_SetWant_0700 - * @tc.name: getWantAgent(OperationType.UNKNOWN_TYPE) - * @tc.desc: verify the function of getWantAgent(OperationType.UNKNOWN_TYPE) - */ - it('ACTS_SetWant_0700', 0, async function (done) { - var agentInfo = { - wants: [ - { - deviceId: "", - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.WantAgentTest1.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.UNKNOWN_TYPE, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - } - console.info('----getWantAgent before----'); - wantAgent.getWantAgent(agentInfo, - (err, data) => { - if (err.code == 0) { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - var triggerInfo = { - code:0 - } - wantAgent.trigger(WantAgent, triggerInfo, - (err, data) => { - if (err.code == 0) { - console.info('----trigger success!----'); - console.info('== trigger data ' + JSON.stringify(data) ); - } else { - console.info('----trigger failed!----'); - console.info('== trigger data ' + JSON.stringify(data) ); - } - done(); - } - ); - expect(typeof(data)).assertEqual("object"); - } else { - console.info('----getWantAgent failed!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - } - done(); - - } - ); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWant_0700====>"); - }, time); - console.info('----getWantAgent after----'); - }) -}) - -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/resources/base/element/string.json deleted file mode 100644 index 9204f315020e8dc2cac72f52a82e2d34ce72204a..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "WantAgent4" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4promise/BUILD.gn b/notification/ans_standard/publish_test/wantagent/wantagent4promise/BUILD.gn deleted file mode 100644 index 81b468e57c8f19ae2ee26dde4c11e3fbd6f78be8..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsWantAgentFourProTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsWantAgentFourProTest" - 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/publish_test/wantagent/wantagent4promise/Test.json b/notification/ans_standard/publish_test/wantagent/wantagent4promise/Test.json deleted file mode 100644 index e5beb1779b67fd3760c283be6f8a1bd63a4f7a9d..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "160000", - "shell-timeout": "160000", - "bundle-name": "com.example.actsanswantagentfourprotest", - "package-name": "com.example.actsanswantagentfourprotest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsWantAgentFourProTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4promise/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/wantagent/wantagent4promise/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/wantagent/wantagent4promise/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/config.json b/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/config.json deleted file mode 100644 index 3aa3d8730ca932f43c064e17bb4c6dd2eb2422d0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanswantagentfourprotest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanswantagentfourprotest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/wantagent/wantagent4promise/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 9bfc9832c3df70756a7177650470926f6798c34e..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - WantAgentPromise4 Startup - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/wantagent/wantagent4promise/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/wantagent/wantagent4promise/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/wantagent/wantagent4promise/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/test/List.test.js deleted file mode 100644 index 066be22c504cc25f2924089667243638ab790e4f..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsWantAgentFourProTest from './WantAgent.test.js' -export default function testsuite() { -ActsAnsWantAgentFourProTest() -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/test/WantAgent.test.js deleted file mode 100644 index 03f00b299cb83ee429a69d13dd8724011be59eb0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/js/test/WantAgent.test.js +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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 wantAgent from '@ohos.wantAgent'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'; -var time = 1000 -var WantAgent; -export default function ActsAnsWantAgentFourProTest() { -describe('ActsAnsWantAgentFourProTest', function () { - - /* - * @tc.number: ACTS_SetWant_0800 - * @tc.name: getWantAgent(OperationType.UNKNOWN_TYPE) - * @tc.desc: verify the function of getWantAgent(OperationType.UNKNOWN_TYPE) - */ - it('ACTS_SetWant_0800', 0, async function (done) { - var agentInfo = { - wants: [ - { - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.WantAgentTest1.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.UNKNOWN_TYPE, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - } - console.info('----getWantAgent before----'); - wantAgent.getWantAgent(agentInfo).then( - (data) => { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - var triggerInfo = { - code:0 - } - wantAgent.trigger(WantAgent, triggerInfo, - (err, data) => { - if (err.code == 0) { - console.info('----trigger success!----'); - console.info('== trigger data ' + JSON.stringify(data) ); - } else { - console.info('----trigger failed!----'); - console.info('== trigger data ' + JSON.stringify(data) ); - } - done(); - } - ); - done(); - - } - ); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWant_0800====>"); - }, time); - console.info('----getWantAgent after----'); - }) -}) - -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/resources/base/element/string.json deleted file mode 100644 index eb647a68fa49a6dc49f4348b6069867f2c4424c6..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent4promise/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "WantAgentPromise4" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5/BUILD.gn b/notification/ans_standard/publish_test/wantagent/wantagent5/BUILD.gn deleted file mode 100644 index b08386e777cdf5781e1649afef7023b99d88c97b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsWantAgentFiveTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsWantAgentFiveTest" - 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/publish_test/wantagent/wantagent5/Test.json b/notification/ans_standard/publish_test/wantagent/wantagent5/Test.json deleted file mode 100644 index ede0aa3e6ed02d20d99ceaa8bd60a2e337852187..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "160000", - "shell-timeout": "160000", - "bundle-name": "com.example.actsanswantagentfivetest", - "package-name": "com.example.actsanswantagentfivetest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsWantAgentFiveTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/wantagent/wantagent5/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/wantagent/wantagent5/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/config.json b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/config.json deleted file mode 100644 index 178d2497117e5da9dff86e72e03e4d22da27fc53..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanswantagentfivetest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanswantagentfivetest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/wantagent/wantagent5/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index 7718fb6f94083d56dca32bacb70aecb1f6b6b921..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - WantAgent5 Startup - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/wantagent/wantagent5/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/wantagent/wantagent5/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/wantagent/wantagent5/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/test/List.test.js deleted file mode 100644 index ddeda185b0282a63c393e9b9768f0d076ea62fd7..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsWantAgentFiveTest from './WantAgent.test.js' -export default function testsuite() { -ActsAnsWantAgentFiveTest() -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/test/WantAgent.test.js deleted file mode 100644 index 81edb327766c9cb77e987aa0ac578d2247855d9d..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/js/test/WantAgent.test.js +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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 wantAgent from '@ohos.wantAgent'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'; -var time = 1000 -var WantAgent; -export default function ActsAnsWantAgentFiveTest() { -describe('ActsAnsWantAgentFiveTest', function () { - - /* - * @tc.number: ACTS_SetWant_0900 - * @tc.name: getWantAgent() - * @tc.desc: verify the function of getWantAgent() - */ - it('ACTS_SetWant_0900', 0, async function (done) { - var agentInfo = { - wants: [ - { - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.WantAgentTest1.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], - operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - } - console.info('----getWantAgent before----'); - wantAgent.getWantAgent(agentInfo, - (err, data) => { - if (err.code == 0) { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - var triggerInfo = { - code:0 - } - wantAgent.trigger(WantAgent, triggerInfo, - (err, data) => { - if (err.code == 0) { - console.info('----trigger success!----'); - console.info('== trigger data ' + JSON.stringify(data) ); - } else { - console.info('----trigger failed!----'); - console.info('== trigger data ' + JSON.stringify(data) ); - } - done(); - } - ); - } else { - expect(err.code).assertEqual(-1) - } - done(); - - } - ); - setTimeout(function(){ - console.debug("====>time out ACTS_SetWant_0900====>"); - }, time); - console.info('----getWantAgent after----'); - }) -}) - -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/resources/base/element/string.json deleted file mode 100644 index 24b412805b3e4f6f0684154245306f08c178945c..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "WantAgent5" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5promise/BUILD.gn b/notification/ans_standard/publish_test/wantagent/wantagent5promise/BUILD.gn deleted file mode 100644 index 05cf376971cfcdd0a8ecfa2a462658ec52d1eb93..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("ActsAnsWantAgentFiveProTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsAnsWantAgentFiveProTest" - 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/publish_test/wantagent/wantagent5promise/Test.json b/notification/ans_standard/publish_test/wantagent/wantagent5promise/Test.json deleted file mode 100644 index c154a6da7c477211e1ff799f721e2372ca2cabeb..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "160000", - "shell-timeout": "160000", - "bundle-name": "com.example.actsanswantagentfiveprotest", - "package-name": "com.example.actsanswantagentfiveprotest" - }, - "kits": [ - { - "test-file-name": [ - "ActsAnsWantAgentFiveProTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5promise/signature/openharmony_sx.p7b b/notification/ans_standard/publish_test/wantagent/wantagent5promise/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/notification/ans_standard/publish_test/wantagent/wantagent5promise/signature/openharmony_sx.p7b and /dev/null differ diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/config.json b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/config.json deleted file mode 100644 index d295f22d084a9e6fa2ea44e1daa908611e9aa4a5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actsanswantagentfiveprotest", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actsanswantagentfiveprotest", - "name": ".entry", - "deviceType": [ - "phone" - ], - "reqPermissions": [ - { - "name": "ohos.permission.NOTIFICATION_CONTROLLER" - } - ], - "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/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/MainAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/MainAbility/app.js deleted file mode 100644 index 2a68c1992145a976957d7dcdd69a7e9c2e8e9877..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/publish_test/wantagent/wantagent5promise/src/main/js/MainAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/MainAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 09696c297ee9837d996bd113bf8d41b67f236f7b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/MainAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index aa9838e1751c13147f1cdabe4540036d0d051738..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,20 +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. - */ - -
- - WantAgentPromise5 Startup - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/MainAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 8caa334075fc3e3c0273e48f472a44dc9b3b38f0..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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() { - console.info('onReady'); - }, -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestAbility/app.js b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/publish_test/wantagent/wantagent5promise/src/main/js/TestAbility/i18n/en-US.json b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestAbility/pages/index/index.css b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/publish_test/wantagent/wantagent5promise/src/main/js/TestAbility/pages/index/index.hml b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestAbility/pages/index/index.js b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/publish_test/wantagent/wantagent5promise/src/main/js/test/List.test.js b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/test/List.test.js deleted file mode 100644 index e29b37c222e8204bc9cdcd036eb9672811e980e3..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsAnsWantAgentFiveProTest from './WantAgent.test.js' -export default function testsuite() { -ActsAnsWantAgentFiveProTest() -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/test/WantAgent.test.js b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/test/WantAgent.test.js deleted file mode 100644 index be7898790bac53eaaeeb927fc149b8cce4900754..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/js/test/WantAgent.test.js +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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 wantAgent from '@ohos.wantAgent'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'; -var time = 1000 -var WantAgent; -export default function ActsAnsWantAgentFiveProTest() { -describe('ActsAnsWantAgentFiveProTest', function () { - - /* - * @tc.number: ACTS_SetWant_1000 - * @tc.name: getWantAgent() - * @tc.desc: verify the function of getWantAgent() - */ - it('ACTS_SetWant_1000', 0, async function (done) { - var agentInfo = { - wants: [ - { - bundleName: "com.example.WantAgentTest1", - abilityName: "com.example.WantAgentTest1.MainAbility", - action: "action1", - entities: ["entity1"], - type: "MIMETYPE", - uri: "key={true,true,false}", - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: "[1, 2, 3]", - mykey3: "ssssssssssssssssssssssssss", - mykey4: [false, true, false], - mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], - mykey6: true, - } - }, - ], -// operationType: wantAgent.OperationType.START_ABILITY, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] - } - console.info('----getWantAgent before----'); - wantAgent.getWantAgent(agentInfo).then( - (data) => { - WantAgent = data; - console.info('----getWantAgent success!----'); - console.info(data); - expect(typeof(data)).assertEqual("object"); - var triggerInfo = { - code:0 - } - wantAgent.trigger(WantAgent, triggerInfo, - (err, data) => { - if (err.code == 0) { - console.info('----trigger success!----'); - console.info('== trigger data ' + JSON.stringify(data) ); - } else { - expect(err.code).assertEqual(-1) - } - done(); - } - ); - done(); - } - ).catch((err)=>{ - expect(err.code).assertEqual(-1) - done() - }) - setTimeout(function(){ - console.debug("====>time out ACTS_SetWant_1000====>"); - }, time); - console.info('----getWantAgent after----'); - }) -}) - -} diff --git a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/resources/base/element/string.json b/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/resources/base/element/string.json deleted file mode 100644 index 5507036d4d1541beb8223b9ca80f6331c296e50b..0000000000000000000000000000000000000000 --- a/notification/ans_standard/publish_test/wantagent/wantagent5promise/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "WantAgentPromise5" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/notification/ces_standard/BUILD.gn b/notification/ces_standard/BUILD.gn index 2f6509791211055e2da44fdd08a960700f4d0afb..1aa73116d4e2b5e235a9551687875e5b4b4ec1ec 100644 --- a/notification/ces_standard/BUILD.gn +++ b/notification/ces_standard/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//build/ohos_var.gni") diff --git a/notification/ces_standard/subscribeandpublish/BUILD.gn b/notification/ces_standard/subscribeandpublish/BUILD.gn index c74cb5d737cbc8f8f57acb9b887dc7ab6578bce3..cfae167346ad93bb7dace1388a32072fde30fff7 100644 --- a/notification/ces_standard/subscribeandpublish/BUILD.gn +++ b/notification/ces_standard/subscribeandpublish/BUILD.gn @@ -18,7 +18,6 @@ group("SubscribeAndPublish") { if (is_standard_system) { deps = [ "actssubscriberorderedtest:ActsSubscriberOrderTest", - "actssubscriberunordersystemtest:ActsSubscriberTestUnorderSystemTest", "actssubscriberunordertest:ActsSubscriberUnorderTest", "emittertest:EmitterTest", ] diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/src/main/config.json b/notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/src/main/config.json index 48d9aae94784abade55612b75ed3436a6cc5900b..c65dd598b10b9916baae4f2812368cc45d70e979 100644 --- a/notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/src/main/config.json +++ b/notification/ces_standard/subscribeandpublish/actssubscriberorderedtest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actssubscribertestorder", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { 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 ffdd1180ec644f4be201fac3143d49173e983676..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,12 +12,13 @@ * 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() { -describe('ActsSubscriberTestOrder', function () { - console.info('===========ActsSubscriberTestOrder start====================>'); + describe('SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST', function () { + let TAG = 'SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST ===>' + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST START`) let num2 = 0; let order = false; let commonEventSubscriber0100; @@ -40,12 +41,12 @@ describe('ActsSubscriberTestOrder', function () { } /* - * @tc.number : ActsSubscriberTestOrder_0100 + * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0100 * @tc.name : verify subscribe and publish : Check subscribe same event and publish common ordered event * @tc.desc : Check the subscriber can receive event "publish_event0100" type of the interface (by Promise) */ - it('ActsSubscriberTestOrder_0100', 0, async function (done) { - console.info('===============ActsSubscriberTestOrder_0100===============>'); + it('SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0100', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0100 START`) let commonEventSubscribeInfo1 = { events: ['publish_event0100'], @@ -123,41 +124,42 @@ describe('ActsSubscriberTestOrder', function () { }) } - 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); }); }) + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0100 END`) }) /* - * @tc.number : ActsSubscriberTestOrder_0200 + * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0200 * @tc.name : verify subscribe and publish : Check subscribe different event * and twice publish common ordered event and check unsubscribe event * @tc.desc : Check the subscriber can receive event "publish_event0200" type of the interface (by Promise) */ - it ('ActsSubscriberTestOrder_0200', 0, async function (done) { - console.info('===============ActsSubscriberTestOrder_0200===============>'); + it ('SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0200', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0200 START`) let commonEventSubscribeInfo1 = { events: ['publish_event0200', @@ -220,49 +222,50 @@ describe('ActsSubscriberTestOrder', function () { }) } - 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); }); }) + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0200 END`) }) /* - * @tc.number : ActsSubscriberTestOrder_0300 + * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0300 * @tc.name : verify subscribe and publish : Check subscribe different events * and some publish common ordered events * @tc.desc : Check the subscriber can receive event "publish_event0301" type of the interface (by Promise) */ - it ('ActsSubscriberTestOrder_0300', 0, async function (done) { - console.info('===============ActsSubscriberTestOrder_0300===============>'); + it ('SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0300', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0300 START`) let commonEventSubscribeInfo1 = { events: ['publish_event0301'], @@ -333,44 +336,45 @@ describe('ActsSubscriberTestOrder', function () { }) } - 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); } }); }) + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0300 END`) }) /* - * @tc.number : ActsSubscriberTestOrder_0400 + * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0400 * @tc.name : verify subscribe and publish : Check subscribe same events * and publish common ordered events and check abort event * @tc.desc : Check the subscriber can receive event "publish_eventOrder0400" type of the interface by promise */ - it ('ActsSubscriberTestOrder_0400', 0, async function (done) { - console.info('===============ActsSubscriberTestOrder_0400===============>'); + it ('SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0400', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0400 START`) let commonEventSubscribeInfo1 = { events: ['publish_eventOrder0400'], @@ -417,7 +421,7 @@ describe('ActsSubscriberTestOrder', function () { expect().assertFail(); } - Subscriber.createSubscriber( + commonEvent.createSubscriber( commonEventSubscribeInfo1 ).then((data)=>{ console.info('===============ActsSubscriberTestOrder_0400==========createSubscriber promise1'); @@ -425,11 +429,11 @@ describe('ActsSubscriberTestOrder', function () { 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'); @@ -437,22 +441,23 @@ describe('ActsSubscriberTestOrder', function () { 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); }) }) + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0400 END`) }) /* - * @tc.number : ActsSubscriberTestOrder_0500 + * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0500 * @tc.name : verify subscribe and publish : Check subscriber same events * @tc.desc : Check the subscriber can receive event "publish_event0500" type of the interface (by promise) */ - it ('ActsSubscriberTestOrder_0500', 0, async function (done) { - console.info('===============ActsSubscriberTestOrder_0500===============>'); + it ('SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0500', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0500 START`) let commonEventSubscribeInfo1 = { events: ['publish_event0500'], @@ -504,7 +509,7 @@ describe('ActsSubscriberTestOrder', function () { }) } - Subscriber.createSubscriber( + commonEvent.createSubscriber( commonEventSubscribeInfo1 ).then((data)=>{ console.info('===============ActsSubscriberTestOrder_0500==========createSubscriber promise1'); @@ -512,11 +517,11 @@ describe('ActsSubscriberTestOrder', function () { 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'); @@ -524,13 +529,15 @@ describe('ActsSubscriberTestOrder', function () { 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); }) }) + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST_0400 END`) }) + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_ORDER_TEST END`) }) } diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/BUILD.gn b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/BUILD.gn deleted file mode 100644 index 2e839a6ead9fbd0d22f85857552b7df15a0dce72..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/BUILD.gn +++ /dev/null @@ -1,34 +0,0 @@ -# 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("ActsSubscriberTestUnorderSystemTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsSubscriberTestUnorderSystemTest" - subsystem_name = "notification" - part_name = "common_event_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/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/Test.json b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/Test.json deleted file mode 100644 index 24101da8de1ea77b32bc5d55f8bdcca71e84fdc7..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "260000", - "shell-timeout": "260000", - "bundle-name": "com.example.actssubscribertestunordersystem", - "package-name": "com.example.actssubscribertestunordersystem" - }, - "kits": [ - { - "test-file-name": [ - "ActsSubscriberTestUnorderSystemTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/config.json b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/config.json deleted file mode 100644 index 46aef521683dd508fd044c3cc690002e58f3d651..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/config.json +++ /dev/null @@ -1,94 +0,0 @@ -{ - "app": { - "bundleName": "com.example.actssubscribertestunordersystem", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.actssubscribertestunordersystem", - "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/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/MainAbility/app.js b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/MainAbility/app.js deleted file mode 100644 index bdbaaf37cd23be7a759b6d491a6311331d0d17be..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/MainAbility/app.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/MainAbility/i18n/en-US.json b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index a4c13dcbdc39c537073f638393d7726ac9a5cdc4..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/MainAbility/i18n/zh-CN.json b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b1c02368f72f929e4375a43170444de95dcc5984..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/MainAbility/pages/index/index.css b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/MainAbility/pages/index/index.css deleted file mode 100644 index 4bc7e63ea5e31c4348c35c119629b7e5967e1cc1..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/MainAbility/pages/index/index.css +++ /dev/null @@ -1,24 +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; -} - -.title { - font-size: 100px; -} diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/MainAbility/pages/index/index.hml b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/MainAbility/pages/index/index.hml deleted file mode 100644 index afca658bee9d47e07498db6cc108d24c0b28f849..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/MainAbility/pages/index/index.hml +++ /dev/null @@ -1,21 +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. - */ - -
- - Hello, World! - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/MainAbility/pages/index/index.js b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index 35f7f922ae6c5efd45268304e460b3cf734f6a3c..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestAbility/app.js b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestAbility/i18n/en-US.json b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestAbility/i18n/zh-CN.json b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestAbility/pages/index/index.css b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestAbility/pages/index/index.hml b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestAbility/pages/index/index.js b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/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 deleted file mode 100644 index 924cb384646ed2913cabd751fb9ee249cc501aef..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/test/ActsSubscriber_test_unorder.js +++ /dev/null @@ -1,218 +0,0 @@ -/* - * 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 commonEvent from '@ohos.commonEvent' -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' - -export default function ActsSubscriberTestUnorderSystem() { - describe('ActsSubscriberTestUnorderSystem', async function (done) { - let TAG = 'Subscriber_Unorder_System ===>' - it('Subscriber_Unorder_System_001', 0, async function (done) { - console.info(TAG + 'Subscriber_Unorder_System_001 START') - const CommonEventSubscriberInfo = { - events: [ - commonEvent.Support.COMMON_EVENT_SHUTDOWN, - commonEvent.Support.COMMON_EVENT_BATTERY_CHANGED, - commonEvent.Support.COMMON_EVENT_BATTERY_LOW, - commonEvent.Support.COMMON_EVENT_BATTERY_OKAY, - commonEvent.Support.COMMON_EVENT_POWER_CONNECTED, - commonEvent.Support.COMMON_EVENT_POWER_DISCONNECTED, - commonEvent.Support.COMMON_EVENT_SCREEN_OFF, - commonEvent.Support.COMMON_EVENT_SCREEN_ON, - commonEvent.Support.COMMON_EVENT_USER_PRESENT, - commonEvent.Support.COMMON_EVENT_TIME_TICK, - commonEvent.Support.COMMON_EVENT_TIME_CHANGED, - commonEvent.Support.COMMON_EVENT_DATE_CHANGED, - commonEvent.Support.COMMON_EVENT_TIMEZONE_CHANGED, - commonEvent.Support.COMMON_EVENT_CLOSE_SYSTEM_DIALOGS, - commonEvent.Support.COMMON_EVENT_PACKAGE_ADDED, - commonEvent.Support.COMMON_EVENT_PACKAGE_REPLACED, - commonEvent.Support.COMMON_EVENT_MY_PACKAGE_REPLACED, - commonEvent.Support.COMMON_EVENT_PACKAGE_REMOVED, - commonEvent.Support.COMMON_EVENT_BUNDLE_REMOVED, - commonEvent.Support.COMMON_EVENT_PACKAGE_FULLY_REMOVED, - commonEvent.Support.COMMON_EVENT_PACKAGE_CHANGED, - commonEvent.Support.COMMON_EVENT_PACKAGE_RESTARTED, - commonEvent.Support.COMMON_EVENT_PACKAGE_DATA_CLEARED, - commonEvent.Support.COMMON_EVENT_PACKAGES_SUSPENDED, - commonEvent.Support.COMMON_EVENT_PACKAGES_UNSUSPENDED, - commonEvent.Support.COMMON_EVENT_MY_PACKAGE_SUSPENDED, - commonEvent.Support.COMMON_EVENT_MY_PACKAGE_UNSUSPENDED, - commonEvent.Support.COMMON_EVENT_UID_REMOVED, - commonEvent.Support.COMMON_EVENT_PACKAGE_FIRST_LAUNCH, - commonEvent.Support.COMMON_EVENT_PACKAGE_NEEDS_VERIFICATION, - commonEvent.Support.COMMON_EVENT_PACKAGE_VERIFIED, - commonEvent.Support.COMMON_EVENT_EXTERNAL_APPLICATIONS_AVAILABLE, - commonEvent.Support.COMMON_EVENT_EXTERNAL_APPLICATIONS_UNAVAILABLE, - commonEvent.Support.COMMON_EVENT_CONFIGURATION_CHANGED, - commonEvent.Support.COMMON_EVENT_LOCALE_CHANGED, - commonEvent.Support.COMMON_EVENT_MANAGE_PACKAGE_STORAGE, - commonEvent.Support.COMMON_EVENT_DRIVE_MODE, - commonEvent.Support.COMMON_EVENT_HOME_MODE, - commonEvent.Support.COMMON_EVENT_OFFICE_MODE, - commonEvent.Support.COMMON_EVENT_USER_STARTED, - commonEvent.Support.COMMON_EVENT_USER_BACKGROUND, - commonEvent.Support.COMMON_EVENT_USER_FOREGROUND, - commonEvent.Support.COMMON_EVENT_USER_UNLOCKED, - commonEvent.Support.COMMON_EVENT_USER_STOPPED, - commonEvent.Support.COMMON_EVENT_HWID_LOGIN, - commonEvent.Support.COMMON_EVENT_HWID_LOGOUT, - commonEvent.Support.COMMON_EVENT_HWID_TOKEN_INVALID, - commonEvent.Support.COMMON_EVENT_HWID_LOGOFF, - commonEvent.Support.COMMON_EVENT_WIFI_POWER_STATE, - commonEvent.Support.COMMON_EVENT_WIFI_CONN_STATE, - commonEvent.Support.COMMON_EVENT_WIFI_HOTSPOT_STATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_A2DPSOURCE_AVRCP_CONNECT_STATE_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_SDP_RESULT, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_CANCEL, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REQ, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REPLY, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_CANCEL, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_CONNECT_STATE_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AUDIO_STATE_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_COMMON_EVENT, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_CALL_STATE_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_HOST_REQ_DISCOVERABLE, - commonEvent.Support.COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED, - commonEvent.Support.COMMON_EVENT_DISCHARGING, - commonEvent.Support.COMMON_EVENT_CHARGING, - commonEvent.Support.COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED, - commonEvent.Support.COMMON_EVENT_POWER_SAVE_MODE_CHANGED, - commonEvent.Support.COMMON_EVENT_LOCATION_MODE_STATE_CHANGED, - commonEvent.Support.COMMON_EVENT_IVI_SLEEP, - commonEvent.Support.COMMON_EVENT_IVI_PAUSE, - commonEvent.Support.COMMON_EVENT_IVI_STANDBY, - commonEvent.Support.COMMON_EVENT_IVI_LASTMODE_SAVE, - commonEvent.Support.COMMON_EVENT_IVI_VOLTAGE_ABNORMAL, - commonEvent.Support.COMMON_EVENT_IVI_HIGH_TEMPERATURE, - commonEvent.Support.COMMON_EVENT_IVI_EXTREME_TEMPERATURE, - commonEvent.Support.COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL, - commonEvent.Support.COMMON_EVENT_IVI_VOLTAGE_RECOVERY, - commonEvent.Support.COMMON_EVENT_IVI_TEMPERATURE_RECOVERY, - commonEvent.Support.COMMON_EVENT_IVI_ACTIVE, - commonEvent.Support.COMMON_EVENT_USB_DEVICE_ATTACHED, - commonEvent.Support.COMMON_EVENT_USB_DEVICE_DETACHED, - commonEvent.Support.COMMON_EVENT_USB_ACCESSORY_ATTACHED, - commonEvent.Support.COMMON_EVENT_USB_ACCESSORY_DETACHED, - commonEvent.Support.COMMON_EVENT_AIRPLANE_MODE_CHANGED, - commonEvent.Support.COMMON_EVENT_BOOT_COMPLETED, - commonEvent.Support.COMMON_EVENT_SPLIT_SCREEN, - commonEvent.Support.COMMON_EVENT_WIFI_P2P_CONN_STATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_DISCOVERED, - commonEvent.Support.COMMON_EVENT_DISK_REMOVED, - commonEvent.Support.COMMON_EVENT_DISK_UNMOUNTED, - commonEvent.Support.COMMON_EVENT_DISK_MOUNTED, - commonEvent.Support.COMMON_EVENT_DISK_BAD_REMOVAL, - commonEvent.Support.COMMON_EVENT_DISK_UNMOUNTABLE, - commonEvent.Support.COMMON_EVENT_DISK_EJECT, - commonEvent.Support.COMMON_EVENT_LOCKED_BOOT_COMPLETED, - commonEvent.Support.COMMON_EVENT_USER_SWITCHED, - commonEvent.Support.COMMON_EVENT_USER_STARTING, - commonEvent.Support.COMMON_EVENT_USER_STOPPING, - commonEvent.Support.COMMON_EVENT_WIFI_SCAN_FINISHED, - commonEvent.Support.COMMON_EVENT_WIFI_RSSI_VALUE, - commonEvent.Support.COMMON_EVENT_WIFI_AP_STA_JOIN, - commonEvent.Support.COMMON_EVENT_WIFI_AP_STA_LEAVE, - commonEvent.Support.COMMON_EVENT_WIFI_MPLINK_STATE_CHANGE, - commonEvent.Support.COMMON_EVENT_WIFI_P2P_STATE_CHANGED, - commonEvent.Support.COMMON_EVENT_WIFI_P2P_PEERS_STATE_CHANGED, - commonEvent.Support.COMMON_EVENT_WIFI_P2P_PEERS_DISCOVERY_STATE_CHANGED, - commonEvent.Support.COMMON_EVENT_WIFI_P2P_CURRENT_DEVICE_STATE_CHANGED, - commonEvent.Support.COMMON_EVENT_WIFI_P2P_GROUP_STATE_CHANGED, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CONNECT_STATE_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CURRENT_DEVICE_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_AUDIO_STATE_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CONNECT_STATE_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CURRENT_DEVICE_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_A2DPSOURCE_PLAYING_STATE_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CODEC_VALUE_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CLASS_VALUE_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_CONNECTED, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_DISCONNECTED, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_NAME_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIR_STATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_BATTERY_VALUE_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_UUID_VALUE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_REQ, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_HOST_STATE_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_HOST_REQ_ENABLE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_HOST_REQ_DISABLE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_HOST_SCAN_MODE_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_STARTED, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_FINISHED, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_HOST_NAME_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_A2DPSINK_CONNECT_STATE_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_A2DPSINK_PLAYING_STATE_UPDATE, - commonEvent.Support.COMMON_EVENT_BLUETOOTH_A2DPSINK_AUDIO_STATE_UPDATE, - 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_ABILITY_ADDED, - commonEvent.Support.COMMON_EVENT_ABILITY_REMOVED, - commonEvent.Support.COMMON_EVENT_ABILITY_UPDATED, - commonEvent.Support.COMMON_EVENT_VISIBLE_ACCOUNTS_UPDATED, - commonEvent.Support.COMMON_EVENT_ACCOUNT_DELETED, - commonEvent.Support.COMMON_EVENT_FOUNDATION_READY, - commonEvent.Support.COMMON_EVENT_THERMAL_LEVEL_CHANGED, - commonEvent.Support.COMMON_EVENT_PACKAGE_CACHE_CLEARED, - commonEvent.Support.COMMON_EVENT_USB_STATE, - commonEvent.Support.COMMON_EVENT_USB_PORT_CHANGED, - commonEvent.Support.COMMON_EVENT_VOLUME_REMOVED, - commonEvent.Support.COMMON_EVENT_VOLUME_UNMOUNTED, - commonEvent.Support.COMMON_EVENT_VOLUME_MOUNTED, - 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 - ] - } - - let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) - if (CommonEventSubscriber == undefined) { - console.info(TAG + ': createSubscriber failed! Err.Info ===> ' + JSON.stringify(CommonEventSubscriber)) - expect(false).assertTrue() - done() - } else { - console.info(TAG + ': createSubscriber successed! Subscriber.Info ===> ' + JSON.stringify(CommonEventSubscriber)) - expect(true).assertTrue() - } - - await commonEvent.subscribe(CommonEventSubscriber, (err, CommonEventData) => { - if (err.code) { - console.info(TAG + ': subscribe failed! Err.Info ===> ' + JSON.stringify(err.code)) - expect(false).assertTrue() - done() - } else { - console.info(TAG + ': subscribe successed! CommonEventData.Info ===> ' + JSON.stringify(CommonEventData)) - expect(true).assertTrue() - } - }) - - for (let i = 0; i < CommonEventSubscriberInfo.events.length; i++) { - await commonEvent.publish(CommonEventSubscriberInfo.events[i], (err) => { - if (err.code) { - console.info(TAG + ': publish failed! event.Info ===> ' + JSON.stringify(CommonEventSubscriberInfo.events[i])) - expect(false).assertTrue() - done() - } else { - console.info(TAG + ': publish successed! event.Info ===> ' + JSON.stringify(CommonEventSubscriberInfo.events[i])) - expect(true).assertTrue() - done() - } - }) - } - }) - }) -} diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/test/List.test.js b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/test/List.test.js deleted file mode 100644 index 9eb9b46991dcf211da9b21abe8966fcbb00f3811..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 ActsSubscriberTestUnorderSystem from './ActsSubscriber_test_unorder.js' -export default function testsuite() { -ActsSubscriberTestUnorderSystem() -} diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/resources/base/element/string.json b/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/resources/base/element/string.json deleted file mode 100644 index 1146fadd9a00a02e00facd501cf3f48a1db1c254..0000000000000000000000000000000000000000 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordersystemtest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "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/ces_standard/subscribeandpublish/actssubscriberunordertest/src/main/config.json b/notification/ces_standard/subscribeandpublish/actssubscriberunordertest/src/main/config.json index 7a1a41af111390b38c70a75e1edf8a9d08d52af0..eb04b9afba4212074a26f8f15cbbd4fa48860ea3 100644 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordertest/src/main/config.json +++ b/notification/ces_standard/subscribeandpublish/actssubscriberunordertest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.actssubscribertestunorder", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/notification/ces_standard/subscribeandpublish/actssubscriberunordertest/src/main/js/test/ActsSubscriber_test_unorder.js b/notification/ces_standard/subscribeandpublish/actssubscriberunordertest/src/main/js/test/ActsSubscriber_test_unorder.js index b842606ad5d4f6d054bda508023d9df2a0247f8f..162c032d26a64c88ca3df92029cc98bb36c7c32a 100644 --- a/notification/ces_standard/subscribeandpublish/actssubscriberunordertest/src/main/js/test/ActsSubscriber_test_unorder.js +++ b/notification/ces_standard/subscribeandpublish/actssubscriberunordertest/src/main/js/test/ActsSubscriber_test_unorder.js @@ -16,9 +16,9 @@ import commonEvent from '@ohos.commonEvent'; import {describe,beforeAll,beforeEach,afterEach,afterAll,it,expect,} from "@ohos/hypium"; export default function ActsSubscriberTestUnorder() { - describe('ActsSubscriberTestUnorder', function () { - - let TAG = 'ActsSubscriberTestUnorder ===>'; + describe('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST', function () { + let TAG = 'SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST ===>'; + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST START`) let CommonEventSubscriberInfo = { events: ['event'], @@ -32,12 +32,12 @@ export default function ActsSubscriberTestUnorder() { return new Promise(resolve => setTimeout(resolve, ms)); } /* - * @tc.number : ActsSubscriberTestUnorder_0100 + * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0100 * @tc.name : check * @tc.desc : getSubscribeInfo(callback: AsyncCallback): void */ - it('ActsSubscriberTestUnorder_0100', 0, async function (done) { - console.info(TAG + 'ActsSubscriberTestUnorder_0100 START ') + it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0100', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0100 START`) let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) if (CommonEventSubscriber == undefined) { console.info(TAG + ': createSubscriber failed! Err.Info ===> ' + JSON.stringify(CommonEventSubscriber)) @@ -64,15 +64,16 @@ export default function ActsSubscriberTestUnorder() { done() } }) + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0100 END`) }) /* - * @tc.number : ActsSubscriberTestUnorder_0200 + * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0200 * @tc.name : check * @tc.desc : getSubscribeInfo(): Promise */ - it('ActsSubscriberTestUnorder_0200', 0, async function (done) { - console.info(TAG + 'ActsSubscriberTestUnorder_0200 START ') + it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0200', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0200 START`) let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) if (CommonEventSubscriber == undefined) { console.info(TAG + ': createSubscriber failed! Err.Info ===> ' + JSON.stringify(CommonEventSubscriber)) @@ -96,16 +97,16 @@ export default function ActsSubscriberTestUnorder() { console.info(TAG + ': getSubscribeInfo promise failed! event.Info ===> ' + JSON.stringify(err.code)) expect(false).assertTrue() }) - + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0200 END`) }) /* - * @tc.number : ActsgetSubscribeInfoTest_0300 + * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0300 * @tc.name : Check the subscriber can receive event "@#¥#3243adsafdf_" type of the interface * @tc.desc : getSubscribeInfo(callback: AsyncCallback): void */ - it('ActsgetSubscribeInfoTest_0300', 0, async function (done) { - console.info(TAG + 'ActsgetSubscribeInfoTest_0100 START ') + it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0300', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0300 START`) CommonEventSubscriberInfo.events[0] = '@#¥#3243adsafdf_' let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) if (CommonEventSubscriber == undefined) { @@ -133,15 +134,16 @@ export default function ActsSubscriberTestUnorder() { done() } }) + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0300 END`) }) /* - * @tc.number : ActsgetSubscribeInfoTest_0400 + * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0400 * @tc.name : Check the subscriber can receive event "@#¥#3243adsafdf_" type of the interface (by Promise) * @tc.desc : getSubscribeInfo(callback: AsyncCallback): void */ - it('ActsSubscriberTestUnorder_0400', 0, async function (done) { - console.info(TAG + 'ActsSubscriberTestUnorder_0400 START ') + it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0400', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0400 START`) CommonEventSubscriberInfo.events[0] = '@#¥#3243adsafdf_' let CommonEventSubscriber = await commonEvent.createSubscriber(CommonEventSubscriberInfo) if (CommonEventSubscriber == undefined) { @@ -166,16 +168,16 @@ export default function ActsSubscriberTestUnorder() { console.info(TAG + ': getSubscribeInfo promise failed! event.Info ===> ' + JSON.stringify(err.code)) expect(false).assertTrue() }) - + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0400 END`) }) /* - * @tc.number : ActsSubscriberTestUnorder_0500 + * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0500 * @tc.name : check * @tc.desc : isOrderedCommonEvent(callback: AsyncCallback): void */ - it('ActsSubscriberTestUnorder_0500', 0, async function (done) { - console.info(TAG + 'ActsSubscriberTestUnorder_0500 START ') + it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0500', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0500 START`) CommonEventSubscriberInfo.events[0] = 'publish_event_0500' CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0500' CommonEventSubscriberInfo.priority = 10 @@ -238,16 +240,17 @@ export default function ActsSubscriberTestUnorder() { } }) - await sleep(5000); + await sleep(5000) + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0500 END`) }) /* - * @tc.number : ActsSubscriberTestUnorder_0600 + * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0600 * @tc.name : check * @tc.desc : isOrderedCommonEvent(): Promise */ - it('ActsSubscriberTestUnorder_0600', 0, async function (done) { - console.info(TAG + 'ActsSubscriberTestUnorder_0600 START ') + it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0600', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0600 START`) CommonEventSubscriberInfo.events[0] = 'publish_event_0600' CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0600' CommonEventSubscriberInfo.priority = 10 @@ -310,17 +313,17 @@ export default function ActsSubscriberTestUnorder() { } }) - await sleep(500) - + await sleep(5000) + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0600 END`) }) /* - * @tc.number : ActsSubscriberTestUnorder_0700 + * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0700 * @tc.name : check * @tc.desc : iisStickyCommonEvent(callback: AsyncCallback): void */ - it('ActsSubscriberTestUnorder_0700', 0, async function (done) { - console.info(TAG + 'ActsSubscriberTestUnorder_0700 START ') + it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0700', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0700 START`) CommonEventSubscriberInfo.events[0] = 'publish_event_0700' CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0700' CommonEventSubscriberInfo.priority = 10 @@ -383,16 +386,17 @@ export default function ActsSubscriberTestUnorder() { } }) - await sleep(5000); + await sleep(5000) + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0700 END`) }) /* - * @tc.number : ActsSubscriberTestUnorder_0800 + * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0800 * @tc.name : check * @tc.desc : isStickyCommonEvent(): Promise */ - it('ActsSubscriberTestUnorder_0800', 0, async function (done) { - console.info(TAG + 'ActsSubscriberTestUnorder_0800 START ') + it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0800', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0800 START`) CommonEventSubscriberInfo.events[0] = 'publish_event_0800' CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0800' CommonEventSubscriberInfo.priority = 10 @@ -452,17 +456,17 @@ export default function ActsSubscriberTestUnorder() { done() } }) - - await sleep(500) + await sleep(5000) + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0800 END`) }) /* - * @tc.number : ActsSubscriberTestUnorder_0900 + * @tc.number : SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0900 * @tc.name : check properties * @tc.desc : CommonEventPublishData */ - it('ActsSubscriberTestUnorder_0900', 0, async function (done) { - console.info(TAG + 'ActsSubscriberTestUnorder_0900 START ') + it('SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0900', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0900 START`) CommonEventSubscriberInfo.events[0] = 'publish_event_0900' CommonEventSubscriberInfo.publisherDeviceId = 'PublishDeviceId_0900' CommonEventSubscriberInfo.priority = 10 @@ -511,6 +515,8 @@ export default function ActsSubscriberTestUnorder() { }) await sleep(5000) + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST_0900 END`) }) + console.info(`${TAG} SUB_NOTIFICATION_CES_SUBSCRIBER_UNORDER_TEST END`) }) } diff --git a/notification/ces_standard/subscribeandpublish/emittertest/src/main/config.json b/notification/ces_standard/subscribeandpublish/emittertest/src/main/config.json index 390306ed5b85a6b4a59d1ab9eac8562f57420896..620b777f3c2896d8f23c3bbed35bd5a2349b3383 100644 --- a/notification/ces_standard/subscribeandpublish/emittertest/src/main/config.json +++ b/notification/ces_standard/subscribeandpublish/emittertest/src/main/config.json @@ -17,6 +17,7 @@ "package": "com.example.emittertest", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/notification/ces_standard/subscribeandpublish/emittertest/src/main/js/test/EmitterTest.js b/notification/ces_standard/subscribeandpublish/emittertest/src/main/js/test/EmitterTest.js index 3002015ceeeb789e0e5ec2696f5f394dd9c3b357..afcd80d49499ff19a89e97630bffae50a58cc417 100644 --- a/notification/ces_standard/subscribeandpublish/emittertest/src/main/js/test/EmitterTest.js +++ b/notification/ces_standard/subscribeandpublish/emittertest/src/main/js/test/EmitterTest.js @@ -16,139 +16,139 @@ import emitter from '@ohos.events.emitter' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' export default function EmitterTest() { - describe('EmitterTest', function () { - const TAG = 'EmitterTest ===> ' - console.info(TAG + 'EmitterTest START') - - let innerEvent = { - eventId: undefined, - priority: undefined - } - - let eventData = { - data: { - 'id': undefined, - 'content': undefined - } - } - - function EmitterCallback(eventData) { - console.info(TAG + 'eventData.id: ' + JSON.stringify(eventData.data.id)); - console.info(TAG + 'eventData.content: ' + JSON.stringify(eventData.data.content)); - if (eventData.data.id == 0) { - expect(eventData.data.content).assertEqual('message_0'); - } else if (eventData.data.id == 1) { - expect(eventData.data.content).assertEqual('message_1'); - } else if (eventData.data.id == 2) { - expect(eventData.data.content).assertEqual('message_2'); - } else if (eventData.data.id == 3) { - expect(eventData.data.content).assertEqual('message_3'); - } else if (eventData.data.id == 4) { - expect(eventData.data.content).assertEqual('message_4'); - } else if (eventData.data.id == 5) { - expect(eventData.data.content).assertEqual('message_5'); - } - } - - /* - * @tc.number : EmitterTest_0100 - * @tc.name : verify on : on(event: InnerEvent, callback: Callback): void - * @tc.desc : emitter.EventPriority.IDLE - */ - it('EmitterTest_0100', 0, async function (done) { - console.info(TAG + 'EmitterTest_0100 START') - innerEvent.eventId = 1 - innerEvent.priority = emitter.EventPriority.IDLE - - eventData.data.id = 0 - eventData.data.content = 'message_0' - - emitter.on(innerEvent, EmitterCallback) - emitter.emit(innerEvent, eventData) - eventData.data.id = 1 - eventData.data.content = 'message_1' - emitter.emit(innerEvent, eventData) - console.info(TAG + 'EmitterTest_0100 END') - done() - }) - - /* - * @tc.number : EmitterTest_0200 - * @tc.name : verify on : once(event: InnerEvent, callback: Callback): void - * @tc.desc : emitter.EventPriority.LOW - */ - it('EmitterTest_0200', 0, async function (done) { - console.info(TAG + 'EmitterTest_0200 START') - innerEvent.eventId = 2 - innerEvent.priority = emitter.EventPriority.LOW - - eventData.data.id = 2 - eventData.data.content = 'message_2' - - emitter.once(innerEvent, EmitterCallback) - emitter.emit(innerEvent, eventData) - console.info(TAG + 'EmitterTest_0200 END') - done() - }) - - /* - * @tc.number : EmitterTest_0300 - * @tc.name : verify on : emit(event: InnerEvent, data?: EventData): void - * @tc.desc : emitter.EventPriority.HIGH - */ - it('EmitterTest_0300', 0, async function (done) { - console.info(TAG + 'EmitterTest_0300 START') - innerEvent.eventId = 3 - innerEvent.priority = emitter.EventPriority.HIGH - - eventData.data.id = 3 - eventData.data.content = 'message_3' - - emitter.once(innerEvent, EmitterCallback) - emitter.emit(innerEvent, eventData) - console.info(TAG + 'EmitterTest_0300 END') - done() - }) - - /* - * @tc.number : EmitterTest_0400 - * @tc.name : verify on : emit(event: InnerEvent, data?: EventData): void - * @tc.desc : emitter.EventPriority.IMMEDIATE - */ - it('EmitterTest_0400', 0, async function (done) { - console.info(TAG + 'EmitterTest_0400 START') - innerEvent.eventId = 4 - innerEvent.priority = emitter.EventPriority.IMMEDIATE - - eventData.data.id = 4 - eventData.data.content = 'message_4' - - emitter.once(innerEvent, EmitterCallback) - emitter.emit(innerEvent, eventData) - console.info(TAG + 'EmitterTest_0400 END') - done() - }) - - /* - * @tc.number : EmitterTest_0500 - * @tc.name : verify on : off(eventId: number): void - * @tc.desc : emitter.EventPriority.IMMEDIATE - */ - it('EmitterTest_0500', 0, async function (done) { - console.info(TAG + 'EmitterTest_0500 START') - innerEvent.eventId = 5 - innerEvent.priority = emitter.EventPriority.IMMEDIATE - - eventData.data.id = 5 - eventData.data.content = 'message_5' - - emitter.once(innerEvent, EmitterCallback) - emitter.emit(innerEvent, eventData) - emitter.off(5) - console.info(TAG + 'EmitterTest_0500 END') - done() - }) - - console.info(TAG + 'EmitterTest END') - }) + describe('SUB_NOTIFICATION_CES_EMITTER_TEST', function () { + const TAG = 'SUB_NOTIFICATION_CES_EMITTER_TEST ===> ' + console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST START`) + + let innerEvent = { + eventId: undefined, + priority: undefined + } + + let eventData = { + data: { + 'id': undefined, + 'content': undefined + } + } + + function EmitterCallback(eventData) { + console.info(TAG + 'eventData.id: ' + JSON.stringify(eventData.data.id)); + console.info(TAG + 'eventData.content: ' + JSON.stringify(eventData.data.content)); + if (eventData.data.id == 0) { + expect(eventData.data.content).assertEqual('message_0'); + } else if (eventData.data.id == 1) { + expect(eventData.data.content).assertEqual('message_1'); + } else if (eventData.data.id == 2) { + expect(eventData.data.content).assertEqual('message_2'); + } else if (eventData.data.id == 3) { + expect(eventData.data.content).assertEqual('message_3'); + } else if (eventData.data.id == 4) { + expect(eventData.data.content).assertEqual('message_4'); + } else if (eventData.data.id == 5) { + expect(eventData.data.content).assertEqual('message_5'); + } + } + + /* + * @tc.number : SUB_NOTIFICATION_CES_EMITTER_TEST_0100 + * @tc.name : verify on : on(event: InnerEvent, callback: Callback): void + * @tc.desc : emitter.EventPriority.IDLE + */ + it('SUB_NOTIFICATION_CES_EMITTER_TEST_0100', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0100 START`) + innerEvent.eventId = 1 + innerEvent.priority = emitter.EventPriority.IDLE + + eventData.data.id = 0 + eventData.data.content = 'message_0' + + emitter.on(innerEvent, EmitterCallback) + emitter.emit(innerEvent, eventData) + eventData.data.id = 1 + eventData.data.content = 'message_1' + emitter.emit(innerEvent, eventData) + console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0100 END`) + done() + }) + + /* + * @tc.number : SUB_NOTIFICATION_CES_EMITTER_TEST_0200 + * @tc.name : verify on : once(event: InnerEvent, callback: Callback): void + * @tc.desc : emitter.EventPriority.LOW + */ + it('SUB_NOTIFICATION_CES_EMITTER_TEST_0200', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0200 START`) + innerEvent.eventId = 2 + innerEvent.priority = emitter.EventPriority.LOW + + eventData.data.id = 2 + eventData.data.content = 'message_2' + + emitter.once(innerEvent, EmitterCallback) + emitter.emit(innerEvent, eventData) + console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0200 END`) + done() + }) + + /* + * @tc.number : SUB_NOTIFICATION_CES_EMITTER_TEST_0300 + * @tc.name : verify on : emit(event: InnerEvent, data?: EventData): void + * @tc.desc : emitter.EventPriority.HIGH + */ + it('SUB_NOTIFICATION_CES_EMITTER_TEST_0300', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0300 START`) + innerEvent.eventId = 3 + innerEvent.priority = emitter.EventPriority.HIGH + + eventData.data.id = 3 + eventData.data.content = 'message_3' + + emitter.once(innerEvent, EmitterCallback) + emitter.emit(innerEvent, eventData) + console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0300 END`) + done() + }) + + /* + * @tc.number : SUB_NOTIFICATION_CES_EMITTER_TEST_0400 + * @tc.name : verify on : emit(event: InnerEvent, data?: EventData): void + * @tc.desc : emitter.EventPriority.IMMEDIATE + */ + it('SUB_NOTIFICATION_CES_EMITTER_TEST_0400', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0400 START`) + innerEvent.eventId = 4 + innerEvent.priority = emitter.EventPriority.IMMEDIATE + + eventData.data.id = 4 + eventData.data.content = 'message_4' + + emitter.once(innerEvent, EmitterCallback) + emitter.emit(innerEvent, eventData) + console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0400 END`) + done() + }) + + /* + * @tc.number : SUB_NOTIFICATION_CES_EMITTER_TEST_0500 + * @tc.name : verify on : off(eventId: number): void + * @tc.desc : emitter.EventPriority.IMMEDIATE + */ + it('SUB_NOTIFICATION_CES_EMITTER_TEST_0500', 0, async function (done) { + console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0500 START`) + innerEvent.eventId = 5 + innerEvent.priority = emitter.EventPriority.IMMEDIATE + + eventData.data.id = 5 + eventData.data.content = 'message_5' + + emitter.once(innerEvent, EmitterCallback) + emitter.emit(innerEvent, eventData) + emitter.off(5) + console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST_0500 END`) + done() + }) + + console.info(`${TAG} SUB_NOTIFICATION_CES_EMITTER_TEST END`) + }) } diff --git a/powermgr/battery_manager/src/main/config.json b/powermgr/battery_manager/src/main/config.json index 9407d1cb4d0f0f2ceaa9ba05b9af4513130029a4..777db16c3512c9b166821d55c59d006f355d7c40 100644 --- a/powermgr/battery_manager/src/main/config.json +++ b/powermgr/battery_manager/src/main/config.json @@ -16,6 +16,7 @@ "package": "com.example.mybatteryapp", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/powermgr/display_manager/src/main/config.json b/powermgr/display_manager/src/main/config.json index 056634c8273fdb38cd78a39d77b7810defc2c381..c5a6b66d23de05b5135ce7ebafaae1cf4b72ffa5 100644 --- a/powermgr/display_manager/src/main/config.json +++ b/powermgr/display_manager/src/main/config.json @@ -16,6 +16,7 @@ "package": "com.example.mypowerdisplayapp", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/powermgr/power_manager/src/main/config.json b/powermgr/power_manager/src/main/config.json index 4e349dbc5ebfe42916428a7d6a9f46c84ba189ad..7c773ae3209740f6ad3b952fe35968517ef7943e 100644 --- a/powermgr/power_manager/src/main/config.json +++ b/powermgr/power_manager/src/main/config.json @@ -16,6 +16,7 @@ "package": "com.example.mypowerapp", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/powermgr/thermal_manager/src/main/config.json b/powermgr/thermal_manager/src/main/config.json index 118479d8c847f09f4e232af18a3bc49b23ef7396..774344dc28ca9cdb95668ff8fdf3b089b9b717c6 100644 --- a/powermgr/thermal_manager/src/main/config.json +++ b/powermgr/thermal_manager/src/main/config.json @@ -16,6 +16,7 @@ "package": "com.example.mythermalapp", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/powermgr/thermal_manager/src/main/js/test/thermal_uint.test.js b/powermgr/thermal_manager/src/main/js/test/thermal_uint.test.js index c53b6045a66e714fd640437653bf44ad3874aa6d..c0c0c46ca2844987c8bcfd77918de55495ba2cf1 100644 --- a/powermgr/thermal_manager/src/main/js/test/thermal_uint.test.js +++ b/powermgr/thermal_manager/src/main/js/test/thermal_uint.test.js @@ -170,7 +170,6 @@ function test7() { thermal.subscribeThermalLevel((cool) => { console.info("warm level is: " + cool); expect(cool >= thermal.ThermalLevel.COOL && cool <= thermal.ThermalLevel.EMERGENCY).assertTrue(); - done(); }) await new Promise((resolve, reject) => { setTimeout(() => { @@ -180,6 +179,7 @@ function test7() { resolve(); }, MSEC_1000 * 4); }) + done(); }) } @@ -194,7 +194,6 @@ function test8() { thermal.subscribeThermalLevel((warm) => { console.info("warm level is: " + warm); expect(warm >= thermal.ThermalLevel.COOL && warm <= thermal.ThermalLevel.EMERGENCY).assertTrue(); - done(); }) await new Promise((resolve, reject) => { setTimeout(() => { @@ -204,6 +203,7 @@ function test8() { resolve(); }, MSEC_1000 * 4); }) + done(); }) } @@ -218,7 +218,6 @@ function test9() { thermal.subscribeThermalLevel((hot) => { console.info("hot level is: " + hot); expect(hot >= thermal.ThermalLevel.COOL && hot <= thermal.ThermalLevel.EMERGENCY).assertTrue(); - done(); }) await new Promise((resolve, reject) => { setTimeout(() => { @@ -228,6 +227,7 @@ function test9() { resolve(); }, MSEC_1000 * 2); }) + done(); }) } @@ -244,7 +244,6 @@ function test10() { console.info("overheated level is: " + overheated); expect(overheated >= thermal.ThermalLevel.COOL && overheated <= thermal.ThermalLevel.EMERGENCY).assertTrue(); - done(); }) await new Promise((resolve, reject) => { setTimeout(() => { @@ -254,6 +253,7 @@ function test10() { resolve(); }, MSEC_1000 * 2); }) + done(); }) } @@ -268,7 +268,6 @@ function test11() { thermal.subscribeThermalLevel((warning) => { console.info("warning level is: " + warning); expect(warning >= thermal.ThermalLevel.COOL && warning <= thermal.ThermalLevel.EMERGENCY).assertTrue(); - done(); }) await new Promise((resolve, reject) => { setTimeout(() => { @@ -278,6 +277,7 @@ function test11() { resolve(); }, MSEC_1000 * 4); }) + done(); }) } @@ -292,7 +292,6 @@ function test12() { thermal.subscribeThermalLevel((emergency) => { console.info("emergency level is: " + emergency); expect(emergency >= thermal.ThermalLevel.COOL && emergency <= thermal.ThermalLevel.EMERGENCY).assertTrue(); - done(); }) await new Promise((resolve, reject) => { setTimeout(() => { @@ -302,6 +301,7 @@ function test12() { resolve(); }, MSEC_1000 * 4); }) + done(); }) } @@ -316,7 +316,6 @@ function test13() { thermal.subscribeThermalLevel((cool) => { console.info("cool level is: " + cool); expect(cool >= thermal.ThermalLevel.COOL && cool <= thermal.ThermalLevel.EMERGENCY).assertTrue(); - done(); }) await new Promise((resolve, reject) => { setTimeout(() => { @@ -326,5 +325,6 @@ function test13() { resolve(); }, MSEC_1000 * 4); }) + done(); }) }} diff --git a/request/BUILD.gn b/request/BUILD.gn old mode 100755 new mode 100644 index d366567d078a8fbb2357d1faff7ae84f46bf7964..49c17cc8d89c1f0c19af744e30569fa008d3e4fb --- a/request/BUILD.gn +++ b/request/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# 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 @@ -14,5 +14,8 @@ import("//build/ohos_var.gni") group("request") { testonly = true - deps = [ "RequestTest_ets:ActsRequestETSApiTest" ] + deps = [ + "RequestTest_Stage:ActsRequestStageTest", + "RequestTest_ets:ActsRequestETSApiTest", + ] } diff --git a/request/RequestTest_Stage/AppScope/app.json b/request/RequestTest_Stage/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..403c65552d49f91d873b308f6c2b4deec59744e4 --- /dev/null +++ b/request/RequestTest_Stage/AppScope/app.json @@ -0,0 +1,15 @@ +{ + "app": { + "bundleName": "com.acts.request.test", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive":true, + "singleUser":true, + "minAPIVersion":9, + "targetAPIVersion":9 + } +} diff --git a/request/RequestTest_Stage/AppScope/resources/base/element/string.json b/request/RequestTest_Stage/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..066e1ff18115359423b0e6d99014273b2408bdee --- /dev/null +++ b/request/RequestTest_Stage/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ActsTimeAPITest" + } + ] +} diff --git a/request/RequestTest_Stage/AppScope/resources/base/media/app_icon.png b/request/RequestTest_Stage/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/request/RequestTest_Stage/AppScope/resources/base/media/app_icon.png differ diff --git a/request/RequestTest_Stage/BUILD.gn b/request/RequestTest_Stage/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..2f161101b40861f0b9ad79b01a858dc3bd0637bf --- /dev/null +++ b/request/RequestTest_Stage/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsRequestStageTest") { + deps = [ + ":requestStage_ets_assets", + ":requestStage_resources", + ] + ets2abc = true + js_build_mode = "debug" + part_name = "request" + subsystem_name = "request" + hap_name = "ActsRequestStageTest" + hap_profile = "entry/src/main/module.json" + certificate_profile = "signature/actsRequestStageTest.p7b" +} + +ohos_app_scope("requestStage_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("requestStage_ets_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("requestStage_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":requestStage_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/request/RequestTest_Stage/Test.json b/request/RequestTest_Stage/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..0f199b048b463f8d0eabfc7fe7c9a81db57b9e82 --- /dev/null +++ b/request/RequestTest_Stage/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "180000", + "bundle-name": "com.acts.request.test", + "module-name": "entry_test", + "shell-timeout": "180000", + "testcase-timeout": 600000 + }, + "kits": [{ + "test-file-name": [ + "ActsRequestStageTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }] +} diff --git a/request/RequestTest_Stage/entry/src/main/ets/Application/MyAbilityStage.ts b/request/RequestTest_Stage/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..4bea34b35db86d55f1a555e4bfb97778968567d6 --- /dev/null +++ b/request/RequestTest_Stage/entry/src/main/ets/Application/MyAbilityStage.ts @@ -0,0 +1,9 @@ +import hilog from '@ohos.hilog'; +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'AbilityStage onCreate'); + } +} \ No newline at end of file diff --git a/request/RequestTest_Stage/entry/src/main/ets/MainAbility/MainAbility.ts b/request/RequestTest_Stage/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..9dc331bc8149d36521ac746384d6606c85bd7ee0 --- /dev/null +++ b/request/RequestTest_Stage/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +import hilog from '@ohos.hilog'; +import Window from '@ohos.window'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../test/List.test'; +import Ability from '@ohos.application.Ability'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability 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.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + if (abilityDelegator != undefined && abilityDelegatorArguments != undefined) { + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite); + } else { + hilog.info(0x0000, 'testTag', '%{public}s', 'abilityDelegator or abilityDelegatorArguments is undefined!!!'); + } + } + + onDestroy() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: Window.WindowStage) { + // Main window is created, set main page for this ability + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/index', (err, data) => { + if (err.code) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR); + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/request/RequestTest_Stage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/request/RequestTest_Stage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..1b7461ea56b950b1cb879f9269f67e4a441f8ef1 --- /dev/null +++ b/request/RequestTest_Stage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,71 @@ +import hilog from '@ohos.hilog'; +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() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', '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 MainAbility ' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters['-D'] + if (debug == 'true') + { + cmd += ' -D' + } + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + 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/request/RequestTest_Stage/entry/src/main/ets/pages/index.ets b/request/RequestTest_Stage/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..e79e73a090b5eee999cdb4a58182cc5d4c391d8c --- /dev/null +++ b/request/RequestTest_Stage/entry/src/main/ets/pages/index.ets @@ -0,0 +1,38 @@ +/** + * 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 hilog from '@ohos.hilog'; + +@Entry +@Component +struct Index { + aboutToAppear() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); + } + + @State message: string = 'REQUEST TEST' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/request/RequestTest_Stage/entry/src/main/ets/test/List.test.ets b/request/RequestTest_Stage/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7011a1bda3671b6fcda2f473215d74e6d761db2e --- /dev/null +++ b/request/RequestTest_Stage/entry/src/main/ets/test/List.test.ets @@ -0,0 +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. + */ + +import requestUploadJSUnit from './requestUpload.test'; +import requestDownloadJSUnit from './requestDownload.test'; + +export default function testsuite() { + requestUploadJSUnit() + requestDownloadJSUnit() +} \ No newline at end of file diff --git a/request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets b/request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..66b23f0d8705853faaf75e2ec37d2fc07cfa5184 --- /dev/null +++ b/request/RequestTest_Stage/entry/src/main/ets/test/requestDownload.test.ets @@ -0,0 +1,115 @@ +/* + * 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 request from "@ohos.request"; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function requestDownloadJSUnit() { + describe('requestDownloadJSUnit', function () { + console.info('################################request download Test start'); + + /** + * beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed. + */ + beforeAll(function () { + console.info('beforeAll: Prerequisites are executed.'); + }); + + /** + * beforeEach: Prerequisites at the test case level, which are executed before each test case is executed. + */ + beforeEach(function () { + console.info('beforeEach: Prerequisites is executed.'); + }); + + /** + * afterEach: Test case-level clearance conditions, which are executed after each test case is executed. + */ + afterEach(function () { + console.info('afterEach: Test case-level clearance conditions is executed.'); + }); + + /** + * afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed. + */ + afterAll(function () { + console.info('afterAll: Test suite-level cleanup condition is executed'); + }); + + let downloadTask; + let downloadConfig = { + url: 'http://download.ci.openharmony.cn/version/Daily_Version/', + header: { + headers: 'http' + }, + enableMetered: false, + enableRoaming: false, + description: 'XTS download test!', + networkType: request.NETWORK_WIFI, + filePath: 'internal://cache/test.txt', + title: 'XTS download test!', + background: true + } + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 + * @tc.desc Starts a download session. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 is starting-----------------------"); + let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + let context = abilityDelegator.getAppContext(); + try { + request.download(context, downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 downloadTask: " + downloadTask); + expect(true).assertEqual(downloadTask != undefined); + }); + } catch (err) { + console.error("SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 error: " + err); + expect().assertFail(); + } + console.info("-----------------------SUB_REQUEST_DOWNLOAD_STAGE_API_CALLBACK_0001 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 + * @tc.desc Starts a download session. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 is starting-----------------------"); + let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + let context = abilityDelegator.getAppContext(); + request.download(context, downloadConfig).then(data => { + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 downloadTask: " + downloadTask); + expect(true).assertEqual(downloadTask != undefined); + }).catch(err => { + console.error("SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 error: " + err); + expect().assertFail(); + }) + console.info("-----------------------SUB_REQUEST_DOWNLOAD_STAGE_API_PROMISE_0001 end-----------------------"); + done(); + }); + }); +} \ No newline at end of file diff --git a/request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets b/request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..f131dec47387723f0cc0e7bde0680722ff4689e1 --- /dev/null +++ b/request/RequestTest_Stage/entry/src/main/ets/test/requestUpload.test.ets @@ -0,0 +1,167 @@ +/* + * 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 request from "@ohos.request"; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function requestUploadJSUnit() { + describe('requestUploadJSUnit', function () { + console.info('################################request upload Test start'); + + /** + * beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed. + */ + beforeAll(function () { + console.info('beforeAll: Prerequisites are executed.'); + }); + + /** + * beforeEach: Prerequisites at the test case level, which are executed before each test case is executed. + */ + beforeEach(function () { + console.info('beforeEach: Prerequisites is executed.'); + }); + + /** + * afterEach: Test case-level clearance conditions, which are executed after each test case is executed. + */ + afterEach(function () { + console.info('afterEach: Test case-level clearance conditions is executed.'); + }); + + /** + * afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed. + */ + afterAll(function () { + console.info('afterAll: Test suite-level cleanup condition is executed'); + }); + + /** + * sleep function. + */ + function sleep(date, time){ + while(Date.now() - date <= time); + } + + let uploadTask; + let RequestData = { + name: 'name', + value: '123' + } + + let File = { + filename: 'test', + name: 'test', + uri: 'internal://cache/test.txt', + type: 'txt' + } + + let uploadConfig = { + url: 'http://127.0.0.1', + header: { + headers: 'http' + }, + method: 'POST', + files: [File], + data: [RequestData] + }; + + /** + * @tc.number SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 + * @tc.name Test requestUploadTest type = TIMER_TYPE_REALTIME + * @tc.desc Test requestUploadTest API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 is starting-----------------------"); + try { + console.info("SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 uploadConfig = " + JSON.stringify(uploadConfig)); + let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + let appContext = abilityDelegator.getAppContext(); + console.info("SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 context = " + appContext); + request.upload(appContext, uploadConfig, (data) => { + uploadTask = data; + console.info("SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 progress uploadTask =" + JSON.stringify(uploadTask)); + expect(true).assertEqual(uploadTask != undefined); + + uploadTask.on('progress', function (data1, data2) { + console.info("SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 on data1 =" + data1); + console.info("SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 on data2 =" + data2); + }); + + uploadTask.off('progress', function (data1, data2) { + console.info("SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 off data1 =" + data1); + console.info("SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 off data2 =" + data2); + }); + + uploadTask.remove((err, data) => { + console.info("SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 remove =" + data); + }); + }); + } catch (err) { + console.error("SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 error: " + err); + expect().assertFail(); + } + console.info("-----------------------SUB_REQUEST_UPLOAD_STAGE_API_CALLBACK_0001 end-----------------------"); + done(); + }); + + /* + * @tc.number : SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 is starting-----------------------"); + try { + console.info("SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 UploadConfig = " + JSON.stringify(uploadConfig)); + let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + let appContext = abilityDelegator.getAppContext(); + console.info("SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 context = " + appContext); + request.upload(appContext, uploadConfig).then((data) => { + uploadTask = data; + console.info("SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 uploadTask = " + uploadTask); + expect(true).assertEqual(uploadTask != undefined); + + uploadTask.on('headerReceive', (header) => { + console.info("SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 header = " + header); + expect(true).assertEqual((header != undefined) || (header != "") || (header != {})); + }); + + uploadTask.off('headerReceive', (header) => { + console.info("SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 header = " + header); + expect(true).assertEqual((header != undefined) || (header != "") || (header != {})); + }); + + uploadTask.remove().then((result)=>{ + console.info("SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 remove result = " + result); + expect(result).assertEqual(true); + }); + }); + } catch (e) { + console.error("SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 error: " + JSON.stringify(e)); + expect(e).assertFail(); + } + console.info("-----------------------SUB_REQUEST_UPLOAD_STAGE_API_PROMISE_0001 end-----------------------"); + done(); + }); + }) +} diff --git a/request/RequestTest_Stage/entry/src/main/module.json b/request/RequestTest_Stage/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..5fe48dfc3037b97f895b8a4b626461bd6392e00a --- /dev/null +++ b/request/RequestTest_Stage/entry/src/main/module.json @@ -0,0 +1,44 @@ +{ + "module": { + "name": "entry_test", + "type": "entry", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:white", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + { + "name":"ohos.permission.INTERNET", + "reason":"need use ohos.permission.INTERNET." + } + ] + } +} \ No newline at end of file diff --git a/request/RequestTest_Stage/entry/src/main/resources/base/element/color.json b/request/RequestTest_Stage/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..62a137a61b90c14f109ed8c81d9d551ea0a5888a --- /dev/null +++ b/request/RequestTest_Stage/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/request/RequestTest_Stage/entry/src/main/resources/base/element/string.json b/request/RequestTest_Stage/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..03bb7d00f7c5bd5750f08b254e645f0d3f960804 --- /dev/null +++ b/request/RequestTest_Stage/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "ActsTimeAPITest" + } + ] +} \ No newline at end of file diff --git a/request/RequestTest_Stage/entry/src/main/resources/base/media/icon.png b/request/RequestTest_Stage/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/request/RequestTest_Stage/entry/src/main/resources/base/media/icon.png differ diff --git a/request/RequestTest_Stage/entry/src/main/resources/base/profile/main_pages.json b/request/RequestTest_Stage/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..feec276e105eeb8d621c20aaf838f318b0a94150 --- /dev/null +++ b/request/RequestTest_Stage/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} diff --git a/request/RequestTest_Stage/signature/actsRequestStageTest.p7b b/request/RequestTest_Stage/signature/actsRequestStageTest.p7b new file mode 100644 index 0000000000000000000000000000000000000000..ace47eb1405f4a1f3c7c2622371a48c345568f9b Binary files /dev/null and b/request/RequestTest_Stage/signature/actsRequestStageTest.p7b differ diff --git a/request/RequestTest_ets/BUILD.gn b/request/RequestTest_ets/BUILD.gn old mode 100755 new mode 100644 index ef14e8bc878e0c669cf2b4371c5bda37307a259f..fe28b739c45939b9b6a65555b26ed5e7548e4a24 --- a/request/RequestTest_ets/BUILD.gn +++ b/request/RequestTest_ets/BUILD.gn @@ -23,7 +23,7 @@ ohos_js_hap_suite("ActsRequestETSApiTest") { ets2abc = true subsystem_name = "request" part_name = "request" - certificate_profile = "./signature/openharmony_sx.p7b" + certificate_profile = "./signature/ActsRequestETSApiTest.p7b" hap_name = "ActsRequestETSApiTest" } diff --git a/request/RequestTest_ets/Test.json b/request/RequestTest_ets/Test.json old mode 100755 new mode 100644 index 2ea5f5cbe3c5470a9a53b66cf223298d3641667e..d987eb48cad9d4281dea0ced1d8a7387d19f5b06 --- a/request/RequestTest_ets/Test.json +++ b/request/RequestTest_ets/Test.json @@ -5,7 +5,7 @@ "test-timeout": "600000", "bundle-name": "com.acts.requesttest", "package-name": "com.acts.requesttest", - "shell-timeout": "60000" + "shell-timeout": "600000" }, "kits": [ { diff --git a/request/RequestTest_ets/entry/src/main/config.json b/request/RequestTest_ets/entry/src/main/config.json old mode 100755 new mode 100644 index c69658fa4ef8c91fd18ca06c46831abd310010c1..09b552c3d5e3c4882222649a20b76c397dad9871 --- a/request/RequestTest_ets/entry/src/main/config.json +++ b/request/RequestTest_ets/entry/src/main/config.json @@ -17,7 +17,10 @@ "package": "com.acts.requesttest", "name": ".MyApplication", "mainAbility": "com.acts.requesttest.MainAbility", - "deviceType": ["phone"], + "deviceType": [ + "default", + "phone" + ], "distro": { "deliveryWithInstall": true, "moduleName": "entry", @@ -62,6 +65,18 @@ "launchType": "standard" } ], + "reqPermissions": [ + { + "name": "ohos.permission.INTERNET", + "reason": "need use ohos.permission.INTERNET", + "usedScene": { + "ability": [ + "com.acts.request.test.MainAbility" + ], + "when": "inuse" + } + } + ], "js": [ { "mode": { diff --git a/request/RequestTest_ets/entry/src/main/ets/MainAbility/app.ets b/request/RequestTest_ets/entry/src/main/ets/MainAbility/app.ets old mode 100755 new mode 100644 diff --git a/request/RequestTest_ets/entry/src/main/ets/MainAbility/pages/index.ets b/request/RequestTest_ets/entry/src/main/ets/MainAbility/pages/index.ets old mode 100755 new mode 100644 index 464d327c26ff4367e151c3246c2fc2aa707adb06..bb88bb3274a5bf7fdc8eb92cd80f809599e694da --- a/request/RequestTest_ets/entry/src/main/ets/MainAbility/pages/index.ets +++ b/request/RequestTest_ets/entry/src/main/ets/MainAbility/pages/index.ets @@ -26,7 +26,7 @@ struct MyComponent { alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('REQUEST ETS TEST') + Text('REQUEST TEST') .fontSize(50) .fontWeight(FontWeight.Bold) } diff --git a/request/RequestTest_ets/entry/src/main/ets/TestAbility/app.ets b/request/RequestTest_ets/entry/src/main/ets/TestAbility/app.ets old mode 100755 new mode 100644 diff --git a/request/RequestTest_ets/entry/src/main/ets/TestAbility/pages/index.ets b/request/RequestTest_ets/entry/src/main/ets/TestAbility/pages/index.ets old mode 100755 new mode 100644 diff --git a/request/RequestTest_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/request/RequestTest_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts old mode 100755 new mode 100644 diff --git a/request/RequestTest_ets/entry/src/main/ets/test/List.test.ets b/request/RequestTest_ets/entry/src/main/ets/test/List.test.ets old mode 100755 new mode 100644 index 9c76ad53cd2e607764e80c468047b612cbfa1370..de2cdf52c35115f16e5f736852bed16b77a3923b --- a/request/RequestTest_ets/entry/src/main/ets/test/List.test.ets +++ b/request/RequestTest_ets/entry/src/main/ets/test/List.test.ets @@ -13,8 +13,12 @@ * limitations under the License. */ -import uploadRequestJSUnitTest from './uploadCallbackXTSJSUnitTest'; +import requestUploadJSUnit from './requestUpload.test'; +import requestDownloadJSUnit from './requestDownload.test'; +import requestSystemJSUnit from './requestSystem.test'; export default function testsuite() { - uploadRequestJSUnitTest() + requestUploadJSUnit() + requestDownloadJSUnit() + requestSystemJSUnit() } \ No newline at end of file diff --git a/request/RequestTest_ets/entry/src/main/ets/test/publicFunction.ets b/request/RequestTest_ets/entry/src/main/ets/test/publicFunction.ets deleted file mode 100755 index bbc478800f888cfc632961a775f759608f9f6ac1..0000000000000000000000000000000000000000 --- a/request/RequestTest_ets/entry/src/main/ets/test/publicFunction.ets +++ /dev/null @@ -1,125 +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 {describe, it, expect} from 'deccjsunit/index' -import request from '@ohos.request' - -let RequestData = [{ - name: '', // Represents the name of the form element. - value: '' // Represents the value of the form element. -}] - -let RequestDataArray=new Array(); - -function sleep(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); -} - -function getUploadConfig(fileURL){ - let File = { - filename: 'test', // When multipart is submitted, the file name in the request header. - name: 'test', // When multipart is submitted, the name of the form item. The default is file. - uri: 'internal://cache/test.txt', - //The local storage path of the file - // (please refer to the storage directory definition for path usage). - type: 'txt' - //The content type of the file is obtained by default - // according to the suffix of the file name or path. - } - let FileArray=new Array(); - FileArray[0] = File; - let headerHttp = { headers: 'http' } - let UploadConfig = { - url: 'http://192.168.112.124/upload_test/',// Resource address. - header: headerHttp, // Adds an HTTP or HTTPS header to be included with the upload request. - method: 'POST', // Request method: POST, PUT. The default POST. - files: FileArray, // A list of files to be uploaded. Please use multipart/form-data to submit. - data: RequestData // The requested form data. - } - return UploadConfig -} - -//upload公共方法 -function publicUpload(UploadConfig){ - console.info(`TestUpdate UploadConfig ${JSON.stringify(UploadConfig)}`) - return new Promise(function(resolve, reject) { - request.upload(UploadConfig, (err, data) => { - console.info("TestUpdate publicOnProgress UpdateTask =" + JSON.stringify(data)); - resolve(data); - }) - }) -} - -//OnProgress公共方法 -function publicOnProgress(UpdateTask, Type){ - return new Promise(function(resolve, reject) { - UpdateTask.on(Type, function(data1 ,data2){ - let progress = { - uploadedSize : data1, - totalSize : data2 - } - console.info("TestUpdate publicOnProgress uploadedSize =" + data1); - console.info("TestUpdate publicOnProgress totalSize =" + data2); - resolve(progress); - }) - }) -} - -//OffProgress公共方法 -function publicOffProgress(UpdateTask, Type){ - return new Promise(function(resolve, reject) { - UpdateTask.off(Type, function(data1 ,data2){ - let progress = { - uploadedSize : data1, - totalSize : data2 - } - console.info("TestUpdate publicOffProgress uploadedSize =" + data1); - console.info("TestUpdate publicOffProgress totalSize =" + data2); - resolve(progress); - }) - }) -} - -//其他on公共方法 -function publicOn(UpdateTask, Type){ - return new Promise(function(resolve, reject) { - UpdateTask.on(Type, function(data){ - console.info("TestUpdate publicOn =" + data); - resolve(data); - }) - }) -} - -//其他off公共方法 -function publicOff(UpdateTask, Type){ - return new Promise(function(resolve, reject) { - UpdateTask.off(Type, function(data){ - console.info("TestUpdate publicOff =" + data); - resolve(data); - }) - }) -} - -//remove公共方法 -function publicRemove(UpdateTask){ - return new Promise(function(resolve, reject) { - UpdateTask.remove((err,data) => { - console.info("TestUpdate publicRemove =" + data); - resolve(data); - }) - }) -} - -export{publicUpload,publicOn,publicOff,publicRemove,publicOnProgress,publicOffProgress,getUploadConfig,sleep} \ No newline at end of file diff --git a/request/RequestTest_ets/entry/src/main/ets/test/requestDownload.test.ets b/request/RequestTest_ets/entry/src/main/ets/test/requestDownload.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7ac28e4a12aed389ae90aa4467bcb0c8f52c7905 --- /dev/null +++ b/request/RequestTest_ets/entry/src/main/ets/test/requestDownload.test.ets @@ -0,0 +1,677 @@ +/* + * 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 request from "@ohos.request"; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; + +export default function requestDownloadJSUnit() { + describe('requestDownloadTest', function () { + console.info('################################request download Test start'); + + /** + * beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed. + */ + beforeAll(function () { + console.info('beforeAll: Prerequisites are executed.'); + }); + + /** + * beforeEach: Prerequisites at the test case level, which are executed before each test case is executed. + */ + beforeEach(function () { + console.info('beforeEach: Prerequisites is executed.'); + }); + + /** + * afterEach: Test case-level clearance conditions, which are executed after each test case is executed. + */ + afterEach(function () { + console.info('afterEach: Test case-level clearance conditions is executed.'); + }); + + /** + * afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed. + */ + afterAll(function () { + console.info('afterAll: Test suite-level cleanup condition is executed'); + }); + + let downloadTask; + let downloadConfig = { + url: 'http://127.0.0.1', + header: { + headers: 'http' + }, + enableMetered: false, + enableRoaming: false, + description: 'XTS download test!', + networkType: request.NETWORK_WIFI, + filePath: 'test.txt', + title: 'XTS download test!', + background: true + } + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_CALLBACK_0001 + * @tc.desc Starts a download session. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_CALLBACK_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_CALLBACK_0001 is starting-----------------------"); + try { + request.download(downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_CALLBACK_0001 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + }); + } catch (err) { + console.error("SUB_REQUEST_DOWNLOAD_API_CALLBACK_0001 error: " + err); + expect().assertFail(); + } + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_CALLBACK_0001 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_PROMISE_0001 + * @tc.desc Starts a download session. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_PROMISE_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_PROMISE_0001 is starting-----------------------"); + request.download(downloadConfig).then(data => { + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_PROMISE_0001 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + }).catch(err => { + console.error("SUB_REQUEST_DOWNLOAD_API_PROMISE_0001 error: " + err); + expect().assertFail(); + }) + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_PROMISE_0001 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 + * @tc.desc alled when the current download session is in process. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 is starting-----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 downloadTask: " + downloadTask); + expect(true).assertEqual(downloadTask != undefined); + downloadTask.on('progress', (data1, data2) => { + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 on data1 =" + data1); + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 on data2 =" + data2); + expect(true).assertEqual(data1 != undefined); + expect(true).assertEqual(data2 != undefined); + }); + }); + + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0002 + * @tc.desc Called when the current download session complete、pause or remove. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0002', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0002 is starting-----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0002 downloadTask: " + downloadTask); + expect(true).assertEqual(downloadTask != undefined); + try{ + downloadTask.on('complete', () => { + console.info('SUB_REQUEST_DOWNLOAD_API_CALLBACK_0002 task completed.') + }); + }catch(err){ + console.error("SUB_REQUEST_DOWNLOAD_API_CALLBACK_0002 error: " + err); + expect().assertFail(); + } + }); + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0002 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003 + * @tc.desc Called when the current download session complete、pause or remove. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003 is starting-----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003 downloadTask: " + downloadTask); + expect(true).assertEqual(downloadTask != undefined); + try{ + downloadTask.on('pause', () => { + console.info('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003 task pause.') + }); + }catch(err){ + console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003 error: " + err); + expect().assertFail(); + } + }); + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004 + * @tc.desc Called when the current download session complete、pause or remove. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004 is starting-----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + try{ + downloadTask.on('remove', () => { + console.info('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004 task remove.') + }); + }catch(err){ + console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004 error: " + err); + expect().assertFail(); + } + }); + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005 + * @tc.desc Called when the current download session fails. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005 is starting-----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + try{ + downloadTask.on('remove', () => { + console.info('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005 task remove.') + }); + }catch(err){ + console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005 error: " + err); + expect().assertFail(); + } + }); + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 + * @tc.desc alled when the current download session is in process. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 is starting-----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + downloadTask.off('progress', (data1, data2) => { + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 on data1 =" + data1); + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 on data2 =" + data2); + expect(data1 != undefined).assertEqual(true); + expect(data2 != undefined).assertEqual(true); + }); + }); + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 + * @tc.desc alled when the current download session complete、pause or remove. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 is starting-----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + try{ + downloadTask.off('complete', () => { + console.info('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 task complete.') + }); + }catch(err){ + console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 error: " + err); + expect().assertFail(); + } + }); + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003 + * @tc.desc alled when the current download session complete、pause or remove. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003 is starting-----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + try{ + downloadTask.off('pause', () => { + console.info('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003 task pause.') + }); + }catch(err){ + console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003 error: " + err); + expect().assertFail(); + } + }); + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004 + * @tc.desc alled when the current download session complete、pause or remove. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004 is starting-----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + try{ + downloadTask.off('remove', () => { + console.info('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004 task remove.') + }); + }catch(err){ + console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004 error: " + err); + expect().assertFail(); + } + }); + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 + * @tc.desc Called when the current download session fails. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 is starting-----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + try{ + downloadTask.off('pause', () => { + console.info('SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 task complete.') + }); + }catch(err){ + console.error("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 error: " + err); + expect().assertFail(); + } + }); + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_REMOVE_0001 + * @tc.desc Deletes a download session and the downloaded files. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_REMOVE_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_REMOVE_0001 is starting-----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + downloadTask.remove((err, data)=>{ + if(err) { + console.error('SUB_REQUEST_DOWNLOAD_API_REMOVE_0001 Failed to remove the download task.'); + expect().assertFail(); + } + if (data) { + console.info('SUB_REQUEST_DOWNLOAD_API_REMOVE_0001 Download task removed.'); + expect(data == true).assertTrue(); + } else { + console.error('SUB_REQUEST_DOWNLOAD_API_REMOVE_0001 Failed to remove the download task.'); + expect().assertFail(); + } + }); + }) + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_REMOVE_0001 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_REMOVE_0002 + * @tc.desc Deletes a download session and the downloaded files. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_REMOVE_0002', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_REMOVE_0002 is starting-----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + downloadTask.remove().then(data => { + if (data) { + console.info('SUB_REQUEST_DOWNLOAD_API_REMOVE_0002 Download task removed.'); + expect(data == true).assertTrue(); + } else { + console.error('SUB_REQUEST_DOWNLOAD_API_REMOVE_0002 Failed to remove the download task.'); + expect().assertFail(); + } + }).catch((err) => { + console.error('SUB_REQUEST_DOWNLOAD_API_REMOVE_0002 Failed to remove the download task.'); + expect().assertFail(); + }) + }) + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_REMOVE_0002 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_PAUSE_0001 + * @tc.desc Pause a download session. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_PAUSE_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_PAUSE_0001 is starting-----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + try{ + downloadTask.pause(()=>{ + console.info('SUB_REQUEST_DOWNLOAD_API_PAUSE_0001 Download task pause success.'); + expect(true).assertTrue(); + }) + }catch(err){ + console.error('Failed to pause the download task pause. because: ' + JSON.stringify(err)); + expect().assertFail(); + } + }) + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_PAUSE_0001 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_PAUSE_0002 + * @tc.desc Pause a download session. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_PAUSE_0002', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_PAUSE_0002 is starting-----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + downloadTask.pause().then(() => { + console.info('SUB_REQUEST_DOWNLOAD_API_PAUSE_0002 Download task pause success.'); + expect(true).assertTrue(); + }).catch((err) => { + console.error('Failed to pause the download task pause. because: ' + JSON.stringify(err)); + expect().assertFail(); + }) + }) + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_PAUSE_0002 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_REMUSE_0001 + * @tc.desc Resume a paused download session. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_REMUSE_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_REMUSE_0001 is starting-----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + try{ + downloadTask.resume(()=>{ + console.info('SUB_REQUEST_DOWNLOAD_API_REMUSE_0001 Download task resume success.'); + expect(true).assertTrue(); + }) + }catch(err){ + console.error('Failed to pause the download task resume. because: ' + JSON.stringify(err)); + expect().assertFail(); + } + }) + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_REMUSE_0001 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_REMUSE_0002 + * @tc.desc Resume a paused download session. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_REMUSE_0002', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_REMUSE_0002 is starting-----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + downloadTask.resume().then(() => { + console.info('SUB_REQUEST_DOWNLOAD_API_REMUSE_0002 Download task resume success.'); + expect(true).assertTrue(); + }).catch((err) => { + console.error('Failed to pause the download task resume. because: ' + JSON.stringify(err)); + expect().assertFail(); + }) + }) + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_REMUSE_0002 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_QUERY_0001 + * @tc.desc Queries download information of a session, which is defined in DownloadSession.DownloadInfo. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_QUERY_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_QUERY_0001 is starting-----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + try{ + downloadTask.query((err, downloadInfo)=>{ + if(err) { + console.error('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 Failed to query: ' + JSON.stringify(err)); + expect().assertFail(); + } else { + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.description); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadedBytes); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadId); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.failedReason); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.fileName); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.filePath); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.pausedReason); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.status); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.targetURI); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadTitle); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadTotalBytes); + expect(true).assertTrue(); + } + }) + }catch(err){ + console.error('Failed to pause the download task query. because: ' + JSON.stringify(err)); + expect().assertFail(); + } + }) + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_QUERY_0001 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_QUERY_0002 + * @tc.desc Queries download information of a session, which is defined in DownloadSession.DownloadInfo. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_QUERY_0002', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_QUERY_0002 is starting-----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + downloadTask.query().then((err, downloadInfo)=>{ + if(err) { + console.error('SUB_REQUEST_DOWNLOAD_API_QUERY_0002 Failed to query: ' + JSON.stringify(err)); + expect().assertFail(); + } else { + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.description); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadedBytes); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadId); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.failedReason); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.fileName); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.filePath); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.pausedReason); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.status); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.targetURI); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadTitle); + console.info('SUB_REQUEST_DOWNLOAD_API_QUERY_0001 query info: '+ downloadInfo.downloadTotalBytes); + expect(true).assertTrue(); + } + }).catch(err => { + console.error('Failed to pause the download task query. because: ' + JSON.stringify(err)); + expect().assertFail(); + }) + }) + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_QUERY_0002 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 + * @tc.desc Queries the MIME type of the download file. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001', 0, async function (done) { + console.info("---------------------SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 is starting---------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + downloadTask.queryMimeType((err, data)=>{ + if(err) { + console.error('SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 Failed to queryMimeType the download task.'); + expect().assertFail(); + } + if (data) { + console.info('SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 Download task queryMimeType.'); + expect(typeof data == "string").assertTrue(); + } else { + console.error('SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 Failed to queryMimeType the download task.'); + expect().assertFail(); + } + }); + }) + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0001 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002 + * @tc.desc Queries the MIME type of the download file. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 2 + */ + it('SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002', 0, async function (done) { + console.info("-------------------SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002 is starting----------------------"); + request.download( downloadConfig, (data)=>{ + downloadTask = data; + console.info("SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0005 downloadTask: " + downloadTask); + expect(downloadTask != undefined).assertEqual(true); + downloadTask.queryMimeType().then(data => { + if (data) { + console.info('SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002 Download task queryMimeType.'); + expect(data == true).assertTrue(); + } else { + console.error('SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002 Failed to queryMimeType the download task.'); + expect().assertFail(); + } + }).catch((err) => { + console.error('SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002 Failed to queryMimeType the download task.'); + expect().assertFail(); + }) + }) + console.info("-----------------------SUB_REQUEST_DOWNLOAD_API_QUERYMINETYPE_0002 end-----------------------"); + done(); + }); + + }) +} diff --git a/request/RequestTest_ets/entry/src/main/ets/test/requestSystem.test.ets b/request/RequestTest_ets/entry/src/main/ets/test/requestSystem.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c1810e3bd1e0ecae44854d4f7f4ca041a464d5de --- /dev/null +++ b/request/RequestTest_ets/entry/src/main/ets/test/requestSystem.test.ets @@ -0,0 +1,146 @@ +/** + * 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 request from '@system.request'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; + +export default function requestSystemJSUnit() { + describe('requestSystemJSUnit', function () { + console.info('****************start requestSystemTest*****************') + + /** + * @tc.name: ohos.SUB_REQUESTSYSTEM_UPLOAD_API_0001 + * @tc.desc: Upload files. + * @tc.size: MediumTest + * @tc.type: Function + * @tc.level: Level 1 + */ + it('SUB_REQUESTSYSTEM_UPLOAD_API_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUESTSYSTEM_UPLOAD_API_0001 start-----------------------"); + let UploadResponse = { + code: 200, + data: '', + headers: {RequestMethod: 'POST', + StatusCode: 200 } + } + let UploadRequestOptions = { + url: 'http://www.path.com', + method: 'POST', + files: [ + { + uri: 'internal://cache/path/to/file.txt', + name: 'file', + filename: 'file.txt', + }, + ], + data:[ + { + name: 'name1', + value: 'value', + }, + ], + success: function(UploadResponse) { + console.info('SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload success, code:' + UploadResponse.code); + }, + fail: function(data, code) { + console.info('SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload fail'); + }, + complete: function (){ + console.info('SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload complete'); + } + } + try{ + let result = request.upload(UploadRequestOptions); + console.info('SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload err:' + result); + expect(true).assertEqual(true); + }catch(err){ + console.info('SUB_REQUESTSYSTEM_UPLOAD_API_0001 upload err:' + err); + } + console.info("-----------------------SUB_REQUESTSYSTEM_UPLOAD_API_0001 end-----------------------"); + done(); + }); + + /** + * @tc.name: ohos.SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 + * @tc.desc: This API is used to download files. + * @tc.size: MediumTest + * @tc.type: Function + * @tc.level: Level 1 + */ + it('SUB_REQUESTSYSTEM_DOWNLOAD_API_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 start-----------------------"); + let DownloadResponse = { + token: "Hm_lpvt_1d6c34c1bc067f5746a5fca18d1c24ab" + } + + let DownloadRequestOptions = { + url: 'http://www.path.com', + filename: 'requestSystenTest', + header: '', + description: 'this is requeSystem download response', + success: function(DownloadResponse) { + console.info('SUB_REQUESTSYSTEM_DOWNLOAD_API_0001call success callback success: ' + DownloadResponse.token); + }, + fail: function(data, code) { + console.info('SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 handling fail'); + }, + complete: function (){ + console.info('SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 download complete'); + } + } + try{ + let result = request.download(DownloadRequestOptions); + console.info('SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 upload err:' + result); + expect(result == null).assertEqual(true); + }catch(err){ + console.info('SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 download complete' + err); + } + console.info("-----------------------SUB_REQUESTSYSTEM_DOWNLOAD_API_0001 end-----------------------"); + done(); + }); + + /** + * @tc.name: ohos.SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 + * @tc.desc: Listens to download task status. + * @tc.size: MediumTest + * @tc.type: Function + * @tc.level: Level 1 + */ + it('SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 start-----------------------"); + let OnDownloadCompleteResponse = { + uri: "http://www.path.com" + } + let OnDownloadCompleteOptions = { + token: 'token-index', + success: function(OnDownloadCompleteResponse) { + console.info('SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 download success,uri:' + + OnDownloadCompleteResponse.uri); + }, + fail: function(data, code) { + console.info('SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 download fail'); + }, + complete: function (){ + console.info('SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 download complete'); + } + } + let result = request.onDownloadComplete(OnDownloadCompleteOptions); + console.info('SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 upload err:' + result); + expect(result == null).assertEqual(true); + console.info("-----------------------SUB_REQUESTSYSTEM_DOWNLOADCOMPLETE_API_0001 end-----------------------"); + done(); + }); + }) +} diff --git a/request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets b/request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..0371cc1af26ffb0496173c2e79a404af3c5f4a90 --- /dev/null +++ b/request/RequestTest_ets/entry/src/main/ets/test/requestUpload.test.ets @@ -0,0 +1,380 @@ +/* + * 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 request from "@ohos.request"; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index"; + +export default function requestUploadJSUnit() { + describe('requestUploadTest', function () { + console.info('################################request upload Test start'); + + /** + * beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed. + */ + beforeAll(function () { + console.info('beforeAll: Prerequisites are executed.'); + }); + + /** + * beforeEach: Prerequisites at the test case level, which are executed before each test case is executed. + */ + beforeEach(function () { + console.info('beforeEach: Prerequisites is executed.'); + }); + + /** + * afterEach: Test case-level clearance conditions, which are executed after each test case is executed. + */ + afterEach(function () { + console.info('afterEach: Test case-level clearance conditions is executed.'); + }); + + /** + * afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed. + */ + afterAll(function () { + console.info('afterAll: Test suite-level cleanup condition is executed'); + }); + + /** + * sleep function. + */ + function sleep(date, time){ + while(Date.now() - date <= time); + } + + let uploadTask; + let RequestData = { + name: 'name', + value: '123' + } + + let File = { + filename: 'test', + name: 'test', + uri: 'internal://cache/test.txt', + type: 'txt' + } + + let uploadConfig = { + url: 'http://127.0.0.1', + header: { + headers: 'http' + }, + method: 'POST', + files: [File], + data: [RequestData] + }; + + /** + * @tc.number SUB_REQUEST_UPLOAD_API_0001 + * @tc.name Test requestUploadTest type = TIMER_TYPE_REALTIME + * @tc.desc Test requestUploadTest API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_REQUEST_UPLOAD_API_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_UPLOAD_API_0001 is starting-----------------------"); + try { + console.info("SUB_REQUEST_UPLOAD_API_0001 request.NETWORK_MOBILE:" + request.NETWORK_MOBILE); + expect(request.NETWORK_MOBILE).assertEqual(1); + console.info("SUB_REQUEST_UPLOAD_API_0001 request.NETWORK_WIFI:" + request.NETWORK_WIFI); + expect(request.NETWORK_WIFI).assertEqual(65536); + console.info("SUB_REQUEST_UPLOAD_API_0001 request.ERROR_CANNOT_RESUME:" + request.ERROR_CANNOT_RESUME); + expect(request.ERROR_CANNOT_RESUME).assertEqual(0); + console.info("SUB_REQUEST_UPLOAD_API_0001 request.ERROR_DEVICE_NOT_FOUND:" + request.ERROR_DEVICE_NOT_FOUND); + expect(request.ERROR_DEVICE_NOT_FOUND).assertEqual(1); + } catch (err) { + expect(true).assertEqual(true); + console.error("SUB_REQUEST_UPLOAD_API_0001 error: " + err); + } + console.info("-----------------------SUB_REQUEST_UPLOAD_API_0001 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_UPLOAD_API_0002 + * @tc.name Test requestUploadTest type = TIMER_TYPE_REALTIME + * @tc.desc Test requestUploadTest API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_REQUEST_UPLOAD_API_0002', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_UPLOAD_API_0002 is starting-----------------------"); + try { + console.info("SUB_REQUEST_UPLOAD_API_0002 request.ERROR_FILE_ALREADY_EXISTS:" + request.ERROR_FILE_ALREADY_EXISTS); + expect(request.ERROR_FILE_ALREADY_EXISTS).assertEqual(2); + console.info("SUB_REQUEST_UPLOAD_API_0002 request.ERROR_FILE_ERROR:" + request.ERROR_FILE_ERROR); + expect(request.ERROR_FILE_ERROR).assertEqual(3); + console.info("SUB_REQUEST_UPLOAD_API_0002 request.ERROR_HTTP_DATA_ERROR:" + request.ERROR_HTTP_DATA_ERROR); + expect(request.ERROR_HTTP_DATA_ERROR).assertEqual(4); + console.info("SUB_REQUEST_UPLOAD_API_0002 request.ERROR_INSUFFICIENT_SPACE:" + request.ERROR_INSUFFICIENT_SPACE); + expect(request.ERROR_INSUFFICIENT_SPACE).assertEqual(5); + } catch (err) { + expect(true).assertEqual(true); + console.error("SUB_REQUEST_UPLOAD_API_0002 error: " + err); + } + console.info("-----------------------SUB_REQUEST_UPLOAD_API_0002 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_UPLOAD_API_0003 + * @tc.name Test requestUploadTest type = TIMER_TYPE_REALTIME + * @tc.desc Test requestUploadTest API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_REQUEST_UPLOAD_API_0003', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_UPLOAD_API_0003 is starting-----------------------"); + try { + console.info("SUB_REQUEST_UPLOAD_API_0003 request.ERROR_TOO_MANY_REDIRECTS:" + request.ERROR_TOO_MANY_REDIRECTS); + expect(request.ERROR_TOO_MANY_REDIRECTS).assertEqual(6); + console.info("SUB_REQUEST_UPLOAD_API_0003 request.ERROR_UNHANDLED_HTTP_CODE:" + request.ERROR_UNHANDLED_HTTP_CODE); + expect(request.ERROR_UNHANDLED_HTTP_CODE).assertEqual(7); + console.info("SUB_REQUEST_UPLOAD_API_0003 request.ERROR_UNKNOWN:" + request.ERROR_UNKNOWN); + expect(request.ERROR_UNKNOWN).assertEqual(8); + console.info("SUB_REQUEST_UPLOAD_API_0003 request.PAUSED_QUEUED_FOR_WIFI:" + request.PAUSED_QUEUED_FOR_WIFI); + expect(request.PAUSED_QUEUED_FOR_WIFI).assertEqual(0); + } catch (err) { + expect(true).assertEqual(true); + console.error("SUB_REQUEST_UPLOAD_API_0003 error: " + err); + } + console.info("-----------------------SUB_REQUEST_UPLOAD_API_0003 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_UPLOAD_API_0004 + * @tc.name Test requestUploadTest type = TIMER_TYPE_REALTIME + * @tc.desc Test requestUploadTest API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_REQUEST_UPLOAD_API_0004', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_UPLOAD_API_0004 is starting-----------------------"); + try { + console.info("SUB_REQUEST_UPLOAD_API_0004 request.PAUSED_UNKNOWN:" + request.PAUSED_UNKNOWN); + expect(request.PAUSED_UNKNOWN).assertEqual(4); + console.info("SUB_REQUEST_UPLOAD_API_0004 request.PAUSED_WAITING_FOR_NETWORK:" + request.PAUSED_WAITING_FOR_NETWORK); + expect(request.PAUSED_WAITING_FOR_NETWORK).assertEqual(1); + console.info("SUB_REQUEST_UPLOAD_API_0004 request.PAUSED_WAITING_TO_RETRY:" + request.PAUSED_WAITING_TO_RETRY); + expect(request.PAUSED_WAITING_TO_RETRY).assertEqual(2); + console.info("SUB_REQUEST_UPLOAD_API_0004 request.SESSION_FAILED:" + request.SESSION_FAILED); + expect(request.SESSION_FAILED).assertEqual(4); + } catch (err) { + expect(true).assertEqual(true); + console.error("SUB_REQUEST_UPLOAD_API_0004 error: " + err); + } + console.info("-----------------------SUB_REQUEST_UPLOAD_API_0004 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_UPLOAD_API_0005 + * @tc.name Test requestUploadTest type = TIMER_TYPE_REALTIME + * @tc.desc Test requestUploadTest API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_REQUEST_UPLOAD_API_0005', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_UPLOAD_API_0005 is starting-----------------------"); + try { + console.info("SUB_REQUEST_UPLOAD_API_0004 request.SESSION_PAUSED:" + request.SESSION_PAUSED); + expect(request.SESSION_PAUSED).assertEqual(3); + console.info("SUB_REQUEST_UPLOAD_API_0004 request.SESSION_PENDING:" + request.SESSION_PENDING); + expect(request.SESSION_PENDING).assertEqual(2); + console.info("SUB_REQUEST_UPLOAD_API_0004 request.SESSION_RUNNING:" + request.SESSION_RUNNING); + expect(request.SESSION_RUNNING).assertEqual(1); + console.info("SUB_REQUEST_UPLOAD_API_0004 request.SESSION_SUCCESSFUL:" + request.SESSION_SUCCESSFUL); + expect(request.SESSION_SUCCESSFUL).assertEqual(0); + } catch (err) { + expect(true).assertEqual(true); + console.error("SUB_REQUEST_UPLOAD_API_0005 error: " + err); + } + console.info("-----------------------SUB_REQUEST_UPLOAD_API_0005 end-----------------------"); + done(); + }); + + /** + * @tc.number SUB_REQUEST_UPLOAD_API_CALLBACK_0001 + * @tc.name Test requestUploadTest type = TIMER_TYPE_REALTIME + * @tc.desc Test requestUploadTest API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it('SUB_REQUEST_UPLOAD_API_CALLBACK_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_UPLOAD_API_CALLBACK_0001 is starting-----------------------"); + try { + console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0001 uploadConfig = " + JSON.stringify(uploadConfig)); + request.upload(uploadConfig, (data) => { + uploadTask = data; + console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0001 progress uploadTask =" + JSON.stringify(uploadTask)); + expect(uploadTask != undefined).assertEqual(true); + + uploadTask.on('progress', function (data1, data2) { + console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0001 on data1 =" + data1); + console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0001 on data2 =" + data2); + }); + + uploadTask.off('progress', function (data1, data2) { + console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0001 off data1 =" + data1); + console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0001 off data2 =" + data2); + }); + + uploadTask.remove((err, data) => { + console.info("SUB_REQUEST_UPLOAD_API_CALLBACK_0001 remove =" + data); + }); + }); + } catch (err) { + console.error("SUB_REQUEST_UPLOAD_API_CALLBACK_0001 error: " + err); + expect().assertFail(); + } + sleep(Date.now(), 20000); + console.info("-----------------------SUB_REQUEST_UPLOAD_API_CALLBACK_0001 end-----------------------"); + done(); + }); + + /** + * @tc.number : SUB_REQUEST_UPLOAD_API_PROMISE_0001 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('SUB_REQUEST_UPLOAD_API_PROMISE_0001', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 is starting-----------------------"); + try { + console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0001 UploadConfig = " + JSON.stringify(uploadConfig)); + request.upload(uploadConfig).then((data) => { + uploadTask = data; + console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0001 uploadTask = " + uploadTask); + expect(true).assertEqual((uploadTask != undefined) || (uploadTask != "") || (uploadTask != {})); + + uploadTask.on('headerReceive', (header) => { + console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0001 header = " + header); + expect(true).assertEqual((header != undefined) || (header != "") || (header != {})); + }); + + uploadTask.off('headerReceive', (header) => { + console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0001 header = " + header); + expect(true).assertEqual((header != undefined) || (header != "") || (header != {})); + }); + + uploadTask.remove().then((result)=>{ + console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0001 remove result = " + result); + expect(result).assertEqual(true); + }); + }); + } catch (e) { + console.error("SUB_REQUEST_UPLOAD_API_PROMISE_0001 error: " + JSON.stringify(e)); + expect(true).assertFail(true); + } + sleep(Date.now(), 20000); + console.info("-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 end-----------------------"); + done(); + }); + + /** + * @tc.number : SUB_REQUEST_UPLOAD_API_PROMISE_0002 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Called when the current upload session complete or fail. + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('SUB_REQUEST_UPLOAD_API_PROMISE_0002', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0002 is starting-----------------------"); + try { + console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 UploadConfig = " + JSON.stringify(uploadConfig)); + request.upload(uploadConfig).then((data) => { + uploadTask = data; + console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 uploadTask = " + uploadTask); + expect(true).assertEqual((uploadTask != undefined) || (uploadTask != "") || (uploadTask != {})); + + uploadTask.on('complete', (TaskState) => { + console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 TaskState.path = " + TaskState.path); + console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 TaskState.responseCode" + TaskState.responseCode); + console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 TaskState.TaskState.message" + TaskState.message); + expect(typeof(TaskState.path) == "string").assertEqual(true); + expect(typeof(TaskState.responseCode) == "number").assertEqual(true); + expect(typeof(TaskState.message) == "string").assertEqual(true); + }); + + uploadTask.on('fail', (TaskState) => { + console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 TaskState.path = " + TaskState.path); + console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 TaskState.responseCode" + TaskState.responseCode); + console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0002 TaskState.TaskState.message" + TaskState.message); + expect(typeof(TaskState.path) == "string").assertEqual(true); + expect(typeof(TaskState.responseCode) == "number").assertEqual(true); + expect(typeof(TaskState.message) == "string").assertEqual(true); + expect(true).assertEqual(true); + }); + }); + } catch (e) { + console.error("SUB_REQUEST_UPLOAD_API_PROMISE_0001 error: " + JSON.stringify(e)); + expect(true).assertFail(true); + } + sleep(Date.now(), 20000); + console.info("-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0001 end-----------------------"); + done(); + }); + + /** + * @tc.number : SUB_REQUEST_UPLOAD_API_PROMISE_0003 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Called when the current upload session complete or fail. + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('SUB_REQUEST_UPLOAD_API_PROMISE_0003', 0, async function (done) { + console.info("-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0003 is starting-----------------------"); + try { + console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0003 UploadConfig = " + JSON.stringify(uploadConfig)); + request.upload(uploadConfig).then((data) => { + uploadTask = data; + console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0003 uploadTask = " + uploadTask); + expect(true).assertEqual((uploadTask != undefined) || (uploadTask != "") || (uploadTask != {})); + + uploadTask.off('complete', () => { + console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0003 TaskState success"); + expect(true).assertEqual(true); + }); + + uploadTask.off('fail', () => { + console.info("SUB_REQUEST_UPLOAD_API_PROMISE_0003 TaskState success"); + expect(true).assertEqual(true); + }); + }); + } catch (e) { + console.error("SUB_REQUEST_UPLOAD_API_PROMISE_0003 error: " + JSON.stringify(e)); + expect(true).assertFail(true); + } + sleep(Date.now(), 20000); + console.info("-----------------------SUB_REQUEST_UPLOAD_API_PROMISE_0003 end-----------------------"); + done(); + }); + + }) +} diff --git a/request/RequestTest_ets/entry/src/main/ets/test/uploadCallbackXTSJSUnitTest.ets b/request/RequestTest_ets/entry/src/main/ets/test/uploadCallbackXTSJSUnitTest.ets deleted file mode 100755 index bf8d883473216d1bb5e95aeddb268229db30360c..0000000000000000000000000000000000000000 --- a/request/RequestTest_ets/entry/src/main/ets/test/uploadCallbackXTSJSUnitTest.ets +++ /dev/null @@ -1,204 +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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -import request from '@ohos.request'; -import * as pubFun from './publicFunction.ets' - -var typeProgress = 'progress'; -var typeHeaderReceive = 'headerReceive'; -var typeFail = 'fail'; -let uploadTask; -let file7url = 'internal://cache/test.txt'; - -export default function uploadRequestJSUnitTest() { - describe('UploadTest', function () { - beforeAll(function () { - console.info('beforeAll: Prerequisites at the test suite level, ' + - 'which are executed before the test suite is executed.'); - }) - beforeEach(function () { - console.info('beforeEach: Prerequisites at the test case level,' + - ' which are executed before each test case is executed.'); - }) - afterEach(function () { - console.info('afterEach: Test case-level clearance conditions, ' + - 'which are executed after each test case is executed.'); - }) - afterAll(function () { - console.info('afterAll: Test suite-level cleanup condition, ' + - 'which is executed after the test suite is executed'); - }) - - /* - * @tc.number : SUB_MISC_REQUEST_API_UploadTask_0001 - * @tc.name : Use getEntries get the value by mixing the string key - * @tc.desc : Mixed strings value can be obtained correctly - * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 1 - */ - it('SUB_MISC_REQUEST_API_UploadTask_0001', 0, async function (done) { - try { - console.info("TestUpdate before getUploadConfig"); - let UploadConfig = pubFun.getUploadConfig(file7url) - console.info("TestUpdate before upload UploadConfig = " + JSON.stringify(UploadConfig)); - console.info("TestUpdate before upload"); - await pubFun.publicUpload(UploadConfig).then((data) => { - console.info("TestUpdate going upload uploadTask = " + data); - uploadTask = data; - expect(true).assertEqual((data != undefined) || (data != "") || (data != {})); - done(); - }).catch((err) => { - console.info("SUB_MISC_REQUEST_API_UploadTask_0001 fail 1" + JSON.stringify(err)); - expect(err).assertFail(); - done(); - }) - } catch (e) { - console.info("SUB_MISC_REQUEST_API_UploadTask_0001 fail 2" + JSON.stringify(e)); - expect(e).assertFail(); - done(); - } - }) - - /* - * @tc.number : SUB_MISC_REQUEST_API_OnProgress_0001 - * @tc.name : Use getEntries get the value by mixing the string key - * @tc.desc : Mixed strings value can be obtained correctly - * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 1 - */ - it('SUB_MISC_REQUEST_API_OnProgress_0001', 0, async function (done) { - try { - pubFun.publicOnProgress(uploadTask, typeProgress); - expect(true).assertEqual(0 == 0); - done(); - } catch (err) { - console.info("TestUpdate SUB_MISC_REQUEST_API_OnProgress_0001 catch err " + JSON.stringify(err)); - expect(err).assertFail(); - done(); - } - }); - - /* - * @tc.number : SUB_MISC_REQUEST__OffProgress_0001 - * @tc.name : Use getEntries get the value by mixing the string key - * @tc.desc : Mixed strings value can be obtained correctly - * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 1 - */ - it('SUB_MISC_REQUEST_OffProgress_0001', 0, async function (done) { - try { - pubFun.publicOnProgress(uploadTask, typeProgress); - expect(true).assertEqual(0 == 0); - - await pubFun.publicOffProgress(uploadTask, typeProgress).then((data) => { - console.info("SUB_MISC_REQUEST_OffProgress_0001 data" + JSON.stringify(data)); - expect(7).assertEqual(data["totalSize"]); - done(); - }).catch((err) => { - console.info("SUB_MISC_REQUEST_OffProgress_0001 fail 2" + JSON.stringify(err)); - expect(err).assertFail(); - done(); - }) - } catch (e) { - console.info("SUB_MISC_REQUEST_OffProgress_0001 fail 3" + JSON.stringify(e)); - expect(e).assertFail(); - done(); - } - }) - - /* - * @tc.number : SUB_MISC_REQUEST_OnFail_0001 - * @tc.name : Use getEntries get the value by mixing the string key - * @tc.desc : Mixed strings value can be obtained correctly - * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 1 - */ - it('SUB_MISC_REQUEST_OnFail_0001', 0, async function (done) { - try { - await pubFun.publicOn(uploadTask, typeFail).then((data) => { - console.info("SUB_MISC_REQUEST_OnFail_0001 data " + data); - expect(5).assertEqual(data); - done(); - }).catch((err) => { - console.info("SUB_MISC_REQUEST_OnFail_0001 fail 2" + JSON.stringify(err)); - expect(err).assertFail(); - done(); - }) - } catch (e) { - console.info("SUB_MISC_REQUEST_OnFail_0001 fail 3" + JSON.stringify(e)); - expect(e).assertFail(); - done(); - } - }) - - /* - * @tc.number : SUB_MISC_REQUEST_OffFail_0001 - * @tc.name : Use getEntries get the value by mixing the string key - * @tc.desc : Mixed strings value can be obtained correctly - * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 1 - */ - it('SUB_MISC_REQUEST_OffFail_0001', 0, async function (done) { - try { - await pubFun.publicOn(uploadTask, typeFail) - await pubFun.publicOff(uploadTask, typeFail).then((data) => { - console.info("SUB_MISC_REQUEST_OffFail_0001 data " + data); - expect(5).assertEqual(data); - done(); - }).catch((err) => { - console.info("SUB_MISC_REQUEST_OffFail_0001 fail 2" + JSON.stringify(err)); - done(); - expect(err).assertFail(); - }) - } catch (e) { - console.info("SUB_MISC_REQUEST_OffFail_0001 fail 3" + JSON.stringify(e)); - expect(e).assertFail(); - done(); - } - }) - - /* - * @tc.number : SUB_MISC_REQUEST_RmvCB_0001 - * @tc.name : Use getEntries get the value by mixing the string key - * @tc.desc : Mixed strings value can be obtained correctly - * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 1 - */ - it('SUB_MISC_REQUEST_RmvCB_0001', 0, async function (done) { - try { - await pubFun.publicRemove(uploadTask).then((data) => { - console.info("SUB_MISC_REQUEST_RmvCB_0001 data " + data); - expect(true).assertEqual(data); - done(); - }).catch((err) => { - console.info("SUB_MISC_REQUEST_RmvCB_0001 fail 2" + JSON.stringify(err)); - expect(err).assertFail(); - done(); - }) - } catch (e) { - console.info("SUB_MISC_REQUEST_RmvCB_0001 fail 3" + JSON.stringify(e)); - expect(e).assertFail(); - done(); - } - }) - }) -} diff --git a/request/RequestTest_ets/entry/src/main/resources/base/element/string.json b/request/RequestTest_ets/entry/src/main/resources/base/element/string.json old mode 100755 new mode 100644 diff --git a/request/RequestTest_ets/entry/src/main/resources/base/media/icon.png b/request/RequestTest_ets/entry/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 diff --git a/request/RequestTest_ets/signature/ActsRequestETSApiTest.p7b b/request/RequestTest_ets/signature/ActsRequestETSApiTest.p7b new file mode 100644 index 0000000000000000000000000000000000000000..57f4a2edec6549dfa915e017b9a994b1d9b39c0a Binary files /dev/null and b/request/RequestTest_ets/signature/ActsRequestETSApiTest.p7b differ diff --git a/resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/config.json b/resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/config.json index e9f395938e3ed7079857a1e12555024a54369bdc..06072548726945fad8101101b7fb6c54f2ca40a7 100644 --- a/resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/config.json +++ b/resourceschedule/resourceschedule_standard/backgroundtaskmanager/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.resourceschedule.taskmgr.js.function", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/resourceschedule/resourceschedule_standard/continuoustaskrelyhap/entry/src/main/config.json b/resourceschedule/resourceschedule_standard/continuoustaskrelyhap/entry/src/main/config.json index eb91b3a99af77622425f1fad6012940c10814f59..a5ad4e7cdc14abfbe61be43372d0a0a9aa700bc6 100644 --- a/resourceschedule/resourceschedule_standard/continuoustaskrelyhap/entry/src/main/config.json +++ b/resourceschedule/resourceschedule_standard/continuoustaskrelyhap/entry/src/main/config.json @@ -16,6 +16,7 @@ "package": "com.example.continuoustaskserver", "name": ".MyApplication", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/resourceschedule/resourceschedule_standard/deviceusagestatisticsjsunit/src/main/config.json b/resourceschedule/resourceschedule_standard/deviceusagestatisticsjsunit/src/main/config.json index 106a4a68dd27b95400c4d668aa04d76e82d550b5..336027d6f79888d5720f9915068c7d1a7f1e1909 100644 --- a/resourceschedule/resourceschedule_standard/deviceusagestatisticsjsunit/src/main/config.json +++ b/resourceschedule/resourceschedule_standard/deviceusagestatisticsjsunit/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.resourceschedule.deviceusagestatisticsjsunit.js.function", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/resourceschedule/resourceschedule_standard/reminderagent/src/main/config.json b/resourceschedule/resourceschedule_standard/reminderagent/src/main/config.json index 8e6dd8a961bf7631abb5fb17a7448116024b2aee..2367061f5c2a14ebf03f72e7a76c5b23754e7711 100644 --- a/resourceschedule/resourceschedule_standard/reminderagent/src/main/config.json +++ b/resourceschedule/resourceschedule_standard/reminderagent/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.resourceschedule.reminderagent.js.function", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/resourceschedule/resourceschedule_standard/workscheduler/src/main/config.json b/resourceschedule/resourceschedule_standard/workscheduler/src/main/config.json index cf6b0a196ee6f3c5c3e6ebb6ae1d7bb7166193a2..2d7a522f1914b0bbb197e7e5f90df60d08520325 100644 --- a/resourceschedule/resourceschedule_standard/workscheduler/src/main/config.json +++ b/resourceschedule/resourceschedule_standard/workscheduler/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.resourceschedule.workscheduler.js.function", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/WorkScheduler.test.js b/resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/WorkScheduler.test.js index 483408782165df81489fb57d215f2df01e8dfd76..8b1198adefd0baaff90306d7c64b5007c5b785d2 100644 --- a/resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/WorkScheduler.test.js +++ b/resourceschedule/resourceschedule_standard/workscheduler/src/main/js/test/WorkScheduler.test.js @@ -13,13 +13,44 @@ * limitations under the License. */ import workScheduler from '@ohos.workScheduler' +import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' export default function WorkSchedulerJsTest() { describe("WorkSchedulerJsTest", function () { + let workInfo = { + workId: 0, + bundleName: "ohos.acts.resourceschedule.workscheduler.js.function", + abilityName: "com.mytest.abilityName" + } + + function workStart(workInfo, callback) { + let result = null + try{ + WorkSchedulerExtensionAbility.onWorkStart(workInfo) + result = true + } catch(err) { + result = err + } + callback(result) + } + + function workStop(workInfo, callback) { + let result = null + try{ + WorkSchedulerExtensionAbility.onWorkStop(workInfo) + result = true + } catch(err) { + result = err + } + callback(result) + } beforeAll(function() { - + + workStart(workInfo,function(data) { + console.info("onWorkStart finish,result: " + data) + }) /* * @tc.setup: setup invoked before all testcases */ @@ -28,6 +59,9 @@ describe("WorkSchedulerJsTest", function () { afterAll(function() { + workStop(workInfo, function(data) { + console.info("onWorkStop finish,result: " + data) + }) /* * @tc.teardown: teardown invoked after all testcases */ diff --git a/security/access_token/AccessTokenTest_Normal_js/BUILD.gn b/security/access_token/AccessTokenTest_Normal_js/BUILD.gn index 07ff1ae83778a1799373070cba8cb201ca5a4f12..051b118db249a99cb7b311e01cbe44bb57c40a96 100644 --- a/security/access_token/AccessTokenTest_Normal_js/BUILD.gn +++ b/security/access_token/AccessTokenTest_Normal_js/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# 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 @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/security/access_token/AccessTokenTest_Normal_js/src/main/config.json b/security/access_token/AccessTokenTest_Normal_js/src/main/config.json index 80e22be59815a5dcf41fe8f7f36fb16a32e12080..90fda7fd6d58bb404e6a15389f4f2245ee19c979 100644 --- a/security/access_token/AccessTokenTest_Normal_js/src/main/config.json +++ b/security/access_token/AccessTokenTest_Normal_js/src/main/config.json @@ -17,6 +17,7 @@ "package": "ohos.acts.security.access_token.normal", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/security/access_token/AccessTokenTest_Normal_js/src/main/js/MainAbility/app.js b/security/access_token/AccessTokenTest_Normal_js/src/main/js/MainAbility/app.js index 37aa79e4519ba957fcb84d27a32c566c86ae7844..b23d7086246b5e3e9b2ac759ca3c8216ecadcf43 100644 --- a/security/access_token/AccessTokenTest_Normal_js/src/main/js/MainAbility/app.js +++ b/security/access_token/AccessTokenTest_Normal_js/src/main/js/MainAbility/app.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * 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 diff --git a/security/access_token/AccessTokenTest_Normal_js/src/main/js/MainAbility/pages/index/index.js b/security/access_token/AccessTokenTest_Normal_js/src/main/js/MainAbility/pages/index/index.js index d99bc8194920ccf3d2557a8e44988ed47a1ef21f..884cc20854791620ba6797627eeea4a25bdf7072 100644 --- a/security/access_token/AccessTokenTest_Normal_js/src/main/js/MainAbility/pages/index/index.js +++ b/security/access_token/AccessTokenTest_Normal_js/src/main/js/MainAbility/pages/index/index.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * 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 diff --git a/security/access_token/AccessTokenTest_Normal_js/src/main/js/test/AccessToken.test.js b/security/access_token/AccessTokenTest_Normal_js/src/main/js/test/AccessToken.test.js index 2abf6196f6cdd7262c7c22f84d69089fe1a91ea2..f4b67f08023ac6a5ea21182df4e812105cdd6998 100644 --- a/security/access_token/AccessTokenTest_Normal_js/src/main/js/test/AccessToken.test.js +++ b/security/access_token/AccessTokenTest_Normal_js/src/main/js/test/AccessToken.test.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except compliance with the License. * You may obtain a copy of the License at @@ -29,14 +29,14 @@ var GrantStatus = { PERMISSION_DENIED: -1, PERMISSION_GRANTED: 0, }; -const RESULT_SUCCESS = 0 -const RESULT_FAIL = -1 +const RESULT_SUCCESS = 0; +const RESULT_FAIL = -1; const TIMEOUT = 5000; -const DEFAULT_PERMISSION_FALG = 0 +const DEFAULT_PERMISSION_FALG = 0; var permissionNameUser = "ohos.permission.ALPHA"; var permissionNameSystem = "ohos.permission.BETA"; -var tokenID = undefined +var tokenID = undefined; export default function AccessTokenTest() { describe('AccessTokenTest', function () { console.info('##########start AccessTokenTest'); @@ -47,7 +47,6 @@ describe('AccessTokenTest', function () { tokenID = appInfo.accessTokenId; console.info("AccessTokenTest accessTokenId:" + appInfo.accessTokenId + ", name:" + appInfo.name + ", bundleName:" + appInfo.bundleName) - // setTimeout(done(),TIMEOUT); console.info("sleep begin"); sleep(TIMEOUT); diff --git a/security/access_token/AccessTokenTest_Normal_js/src/main/js/test/List.test.js b/security/access_token/AccessTokenTest_Normal_js/src/main/js/test/List.test.js index 0de75af6e3d630f0292140c5f41a49ca07f68d06..7309bdcb055cfc43d8ddf73a33971bb32cffa8bc 100644 --- a/security/access_token/AccessTokenTest_Normal_js/src/main/js/test/List.test.js +++ b/security/access_token/AccessTokenTest_Normal_js/src/main/js/test/List.test.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except compliance with the License. * You may obtain a copy of the License at diff --git a/security/cipher/datacipher/cipher/src/main/config.json b/security/cipher/datacipher/cipher/src/main/config.json index 119fa0f319131f25f75b5880cbe518b0359fb568..96b43e5f51803517341fab2acf286ed8ac057d04 100644 --- a/security/cipher/datacipher/cipher/src/main/config.json +++ b/security/cipher/datacipher/cipher/src/main/config.json @@ -18,6 +18,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/config.json b/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/config.json index 1d5db7affbc33f5a876f9cf653cbccdff177e4af..52ef938ac8adae4b1f050b4468c74129fff8081d 100644 --- a/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/config.json +++ b/security/security_huks_basic/huks_agree_callback_BasicTest/src/main/config.json @@ -18,6 +18,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/config.json b/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/config.json index bd46b02c0cadc767dc58d5d9087e0b86c996fde0..89bda994666e5b7fc26361f898433d9a9d64af54 100644 --- a/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/config.json +++ b/security/security_huks_basic/huks_agree_promise_BasicTest/src/main/config.json @@ -18,6 +18,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/security/security_huks_basic/huks_cipher_callback_BasicTest/src/main/config.json b/security/security_huks_basic/huks_cipher_callback_BasicTest/src/main/config.json index 3483d64a26fc8df89b28fabf9697f576c68ec638..9830146e002f739bd072bed42c5c5f4f86d0d626 100644 --- a/security/security_huks_basic/huks_cipher_callback_BasicTest/src/main/config.json +++ b/security/security_huks_basic/huks_cipher_callback_BasicTest/src/main/config.json @@ -18,6 +18,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/security/security_huks_basic/huks_cipher_promise_BasicTest/src/main/config.json b/security/security_huks_basic/huks_cipher_promise_BasicTest/src/main/config.json index 5d80cb31d5df841d769f2bd6ddeccd52d22010cf..c3111d2ebb94ec277b3fadfacea2bf7362d40441 100644 --- a/security/security_huks_basic/huks_cipher_promise_BasicTest/src/main/config.json +++ b/security/security_huks_basic/huks_cipher_promise_BasicTest/src/main/config.json @@ -18,6 +18,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/security/security_huks_basic/huks_cipher_promise_BasicTest/src/main/js/test/Cipher/SecurityHuksCipherAESBasicPromiseJsunit.test.js b/security/security_huks_basic/huks_cipher_promise_BasicTest/src/main/js/test/Cipher/SecurityHuksCipherAESBasicPromiseJsunit.test.js index bdcc47c5530af055894a2f2b1146734b861581de..195ee9ceef3cdb337ada61f3b1a94c0d4163b862 100644 --- a/security/security_huks_basic/huks_cipher_promise_BasicTest/src/main/js/test/Cipher/SecurityHuksCipherAESBasicPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_cipher_promise_BasicTest/src/main/js/test/Cipher/SecurityHuksCipherAESBasicPromiseJsunit.test.js @@ -51,6 +51,7 @@ async function publicInitFunc(srcKeyAlies, HuksOptions) { console.log(`test init data: ${JSON.stringify(data)}`); handle = data.handle; expect(data.errorCode == 0).assertTrue(); + expect(data.token == null).assertTrue(); }) .catch((err) => { console.log('test init err information: ' + JSON.stringify(err)); diff --git a/security/security_huks_basic/huks_derive_callback_BasicTest/src/main/config.json b/security/security_huks_basic/huks_derive_callback_BasicTest/src/main/config.json index 9892c059e5868d8b8e8e5c6a7037f2c4f5c7ca02..1e85795efdc1722ab8cc57535d782ab42a5b5428 100644 --- a/security/security_huks_basic/huks_derive_callback_BasicTest/src/main/config.json +++ b/security/security_huks_basic/huks_derive_callback_BasicTest/src/main/config.json @@ -18,6 +18,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/security/security_huks_basic/huks_derive_promise_BasicTest/src/main/config.json b/security/security_huks_basic/huks_derive_promise_BasicTest/src/main/config.json index 04e122e9ab159682ac605e211b29fc188c08ade0..a7a07a627e3c138ae3f6a926350aac6f548361a3 100644 --- a/security/security_huks_basic/huks_derive_promise_BasicTest/src/main/config.json +++ b/security/security_huks_basic/huks_derive_promise_BasicTest/src/main/config.json @@ -18,6 +18,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/config.json b/security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/config.json index 1a21c971b8ab396928026978e0c0fc97a883c38a..2363e7fa3a3ebf4264f44c943357f8dbff18a67e 100644 --- a/security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/config.json +++ b/security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/config.json @@ -18,6 +18,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/HMAC/SecurityHuksAccessControlJsunit.test.js b/security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/HMAC/SecurityHuksAccessControlJsunit.test.js index 99fbb6582befa6a1942e6637f689c1da8e5a22ee..2af62f0a98014e76f74269c777fee4cf45fcc60b 100644 --- a/security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/HMAC/SecurityHuksAccessControlJsunit.test.js +++ b/security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/HMAC/SecurityHuksAccessControlJsunit.test.js @@ -854,6 +854,8 @@ export function SecurityHuksAccessControlJsunit() { expect(1342197283).assertEqual( huks.HuksTag.HUKS_TAG_ASYMMETRIC_PRIVATE_KEY_DATA ); + expect(0).assertEqual(huks.HuksKeyStorageType.HUKS_STORAGE_TEMP ); + expect(1).assertEqual(huks.HuksKeyStorageType.HUKS_STORAGE_PERSISTENT); done(); }); }); diff --git a/security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/HMAC/SecurityHuksHmacBasicCallbackJsunit.test.js b/security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/HMAC/SecurityHuksHmacBasicCallbackJsunit.test.js index 161c85e4931a723176938147a327a720c31f3929..dd41dea0a0a019a63366273f70716f7445625358 100644 --- a/security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/HMAC/SecurityHuksHmacBasicCallbackJsunit.test.js +++ b/security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/HMAC/SecurityHuksHmacBasicCallbackJsunit.test.js @@ -13,11 +13,11 @@ * limitations under the License. */ -import { describe, it, expect } from '@ohos/hypium'; -import huks from '@ohos.security.huks'; -import Data from '../../../../../../utils/data.json'; -import { HuksHmac } from '../../../../../../utils/param/hmac/publicHmacParam.js'; -import { stringToArray } from '../../../../../../utils/param/publicFunc.js'; +import { describe, it, expect } from "@ohos/hypium"; +import huks from "@ohos.security.huks"; +import Data from "../../../../../../utils/data.json"; +import { HuksHmac } from "../../../../../../utils/param/hmac/publicHmacParam.js"; +import { stringToArray } from "../../../../../../utils/param/publicFunc.js"; var handle; let srcData63Kb = Data.Date63KB; @@ -28,13 +28,15 @@ function generateKey(srcKeyAlies, HuksOptions) { huks.generateKey(srcKeyAlies, HuksOptions, function (err, data) { try { if (err.code !== 0) { - console.log('test generateKey err information: ' + JSON.stringify(err)); + console.log( + "test generateKey err information: " + JSON.stringify(err) + ); reject(err); } else { resolve(data); } } catch (e) { - console.log('test generateKey err information: ' + JSON.stringify(e)); + console.log("test generateKey err information: " + JSON.stringify(e)); reject(e); } }); @@ -46,14 +48,14 @@ function init(srcKeyAlies, HuksOptions) { huks.init(srcKeyAlies, HuksOptions, function (err, data) { try { if (err.code !== 0) { - console.log('test init err information: ' + JSON.stringify(err)); + console.log("test init err information: " + JSON.stringify(err)); reject(err); } else { handle = data.handle; resolve(data); } } catch (e) { - console.log('test init err information: ' + JSON.stringify(e)); + console.log("test init err information: " + JSON.stringify(e)); reject(e); } }); @@ -65,13 +67,13 @@ function update(handle, HuksOptions) { huks.update(handle, HuksOptions, function (err, data) { try { if (err.code !== 0) { - console.log('test update err information: ' + JSON.stringify(err)); + console.log("test update err information: " + JSON.stringify(err)); reject(err); } else { resolve(data); } } catch (e) { - console.log('test update err information: ' + JSON.stringify(e)); + console.log("test update err information: " + JSON.stringify(e)); reject(e); } }); @@ -83,13 +85,13 @@ function finish(handle, HuksOptions) { huks.finish(handle, HuksOptions, function (err, data) { try { if (err.code !== 0) { - console.log('test finish err information: ' + JSON.stringify(err)); + console.log("test finish err information: " + JSON.stringify(err)); reject(err); } else { resolve(data); } } catch (e) { - console.log('test finish err information: ' + JSON.stringify(e)); + console.log("test finish err information: " + JSON.stringify(e)); reject(e); } }); @@ -101,13 +103,13 @@ function abort(handle, HuksOptions) { huks.abort(handle, HuksOptions, function (err, data) { try { if (err.code !== 0) { - console.log('test abort err information: ' + JSON.stringify(err)); + console.log("test abort err information: " + JSON.stringify(err)); reject(err); } else { resolve(data); } } catch (e) { - console.log('test abort err information: ' + JSON.stringify(e)); + console.log("test abort err information: " + JSON.stringify(e)); reject(e); } }); @@ -119,13 +121,13 @@ function deleteKey(srcKeyAlies, HuksOptions) { huks.deleteKey(srcKeyAlies, HuksOptions, function (err, data) { try { if (err.code !== 0) { - console.log('test deleteKey err information: ' + JSON.stringify(err)); + console.log("test deleteKey err information: " + JSON.stringify(err)); reject(err); } else { resolve(data); } } catch (e) { - console.log('test deleteKey err information: ' + JSON.stringify(e)); + console.log("test deleteKey err information: " + JSON.stringify(e)); reject(e); } }); @@ -144,7 +146,7 @@ async function publicHmacUpdate(HuksOptions) { console.log(`test update data: ${data}`); }) .catch((err) => { - console.log('test update err information: ' + JSON.stringify(err)); + console.log("test update err information: " + JSON.stringify(err)); expect(null).assertFail(); }); HuksOptions.inData = huksOptionsInData; @@ -152,25 +154,32 @@ async function publicHmacUpdate(HuksOptions) { let count = Math.floor(inDataArray.length / dateSize); let remainder = inDataArray.length % dateSize; for (let i = 0; i < count; i++) { - HuksOptions.inData = new Uint8Array(stringToArray(huksOptionsInData).slice(dateSize * i, dateSize * (i + 1))); + HuksOptions.inData = new Uint8Array( + stringToArray(huksOptionsInData).slice(dateSize * i, dateSize * (i + 1)) + ); await update(handle, HuksOptions) .then((data) => { console.log(`test update data: ${data}`); }) .catch((err) => { - console.log('test update err information: ' + JSON.stringify(err)); + console.log("test update err information: " + JSON.stringify(err)); expect(null).assertFail(); }); } if (remainder !== 0) { - HuksOptions.inData = new Uint8Array(stringToArray(huksOptionsInData).slice(dateSize * count, inDataArray.length)); + HuksOptions.inData = new Uint8Array( + stringToArray(huksOptionsInData).slice( + dateSize * count, + inDataArray.length + ) + ); console.log(`test update HuksOptions.inData ${HuksOptions.inData}`); await update(handle, HuksOptions) .then((data) => { console.log(`test update data: ${data}`); }) .catch((err) => { - console.log('test update err information: ' + JSON.stringify(err)); + console.log("test update err information: " + JSON.stringify(err)); expect(null).assertFail(); }); } @@ -181,7 +190,7 @@ async function publicHmacGenFunc(srcKeyAlies, HuksOptions, thirdInderfaceName) { HuksOptions.properties.splice(1, 0, HuksHmac.HuksKeySIZE); await generateKey(srcKeyAlies, HuksOptions) .then((data) => { - console.log('test generateKey data = ' + JSON.stringify(data)); + console.log("test generateKey data = " + JSON.stringify(data)); }) .catch((err) => { console.log(`test init err: " + ${JSON.stringify(err)}`); @@ -199,14 +208,14 @@ async function publicHmacGenFunc(srcKeyAlies, HuksOptions, thirdInderfaceName) { }); await publicHmacUpdate(HuksOptions); - if (thirdInderfaceName == 'finish') { - HuksOptions.inData = new Uint8Array(stringToArray('0')); + if (thirdInderfaceName == "finish") { + HuksOptions.inData = new Uint8Array(stringToArray("0")); await finish(handle, HuksOptions) .then((data) => { console.log(`test update data: ${data}`); }) .catch((err) => { - console.log('test update err information: ' + JSON.stringify(err)); + console.log("test update err information: " + JSON.stringify(err)); expect(null).assertFail(); }); } else { @@ -215,7 +224,7 @@ async function publicHmacGenFunc(srcKeyAlies, HuksOptions, thirdInderfaceName) { console.log(`test abort data: ${data}`); }) .catch((err) => { - console.log('test abort err information: ' + JSON.stringify(err)); + console.log("test abort err information: " + JSON.stringify(err)); expect(null).assertFail(); }); } @@ -226,161 +235,120 @@ async function publicHmacGenFunc(srcKeyAlies, HuksOptions, thirdInderfaceName) { expect(data.errorCode == 0).assertTrue(); }) .catch((err) => { - console.log('test deleteKey err information: ' + JSON.stringify(err)); + console.log("test deleteKey err information: " + JSON.stringify(err)); expect(null).assertFail(); }); } -export function SecurityHuksHmacBasicCallbackJsunit_test() { -describe('SecurityHuksHmacBasicCallbackJsunit_test', function () { - it('testHmacSHA1001', 0, async function (done) { - let srcKeyAlies = 'testHmacDigestSHA1KeyAlias001'; - let HuksOptions = { - properties: new Array(HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyPurpose, HuksHmac.HuksTagDigestSHA1), - inData: srcData63Kb, - }; - await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'finish'); - done(); - }); - - it('testHmacSHA1002', 0, async function (done) { - let srcKeyAlies = 'testHmacDigestSHA1KeyAlias002'; - let HuksOptions = { - properties: new Array(HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyPurpose, HuksHmac.HuksTagDigestSHA1), - inData: srcData63Kb, - }; - await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'abort'); - done(); - }); - it('testHmacSHA1003', 0, async function (done) { - let srcKeyAlies = 'testHmacDigestSHA1KeyAlias003'; - let HuksOptions = { - properties: new Array(HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyPurpose, HuksHmac.HuksTagDigestSHA1), - inData: srcData65Kb, - }; - await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'finish'); - done(); - }); - it('testHmacSHA1004', 0, async function (done) { - let srcKeyAlies = 'testHmacDigestSHA1KeyAlias004'; - let HuksOptions = { - properties: new Array(HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyPurpose, HuksHmac.HuksTagDigestSHA1), - inData: srcData65Kb, - }; - await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'abort'); - done(); - }); -}); -} export function SecurityHuksHmacCallbackJsunit() { -describe('SecurityHuksHmacCallbackJsunit', function () { - it('testHmacSHA1001', 0, async function (done) { - let srcKeyAlies = 'testHmacDigestSHA1KeyAlias001'; - let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSHA1 - ), - inData: srcData63Kb, - }; + describe("SecurityHuksHmacCallbackJsunit", function () { + it("testHmacSHA1001", 0, async function (done) { + let srcKeyAlies = "testHmacDigestSHA1KeyAlias001"; + let HuksOptions = { + properties: new Array( + HuksHmac.HuksKeyAlg, + HuksHmac.HuksKeyPurpose, + HuksHmac.HuksTagDigestSHA1 + ), + inData: srcData63Kb, + }; - await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'finish'); - done(); - }); + await publicHmacGenFunc(srcKeyAlies, HuksOptions, "finish"); + done(); + }); - it('testHmacSHA1002', 0, async function (done) { - let srcKeyAlies = 'testHmacDigestSHA1KeyAlias002'; - let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSHA1 - ), - inData: srcData63Kb, - }; - await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'abort'); - done(); - }); - it('testHmacSHA1003', 0, async function (done) { - let srcKeyAlies = 'testHmacDigestSHA1KeyAlias003'; - let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSHA1 - ), - inData: srcData65Kb, - }; - await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'finish'); - done(); - }); - it('testHmacSHA1004', 0, async function (done) { - let srcKeyAlies = 'testHmacDigestSHA1KeyAlias004'; - let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSHA1 - ), - inData: srcData65Kb, - }; - await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'abort'); - done(); - }); - it('testHmacSM3001', 0, async function (done) { - let srcKeyAlies = 'testHmacDigestSM3KeyAlias001'; - let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSM3 - ), - inData: srcData63Kb, - }; + it("testHmacSHA1002", 0, async function (done) { + let srcKeyAlies = "testHmacDigestSHA1KeyAlias002"; + let HuksOptions = { + properties: new Array( + HuksHmac.HuksKeyAlg, + HuksHmac.HuksKeyPurpose, + HuksHmac.HuksTagDigestSHA1 + ), + inData: srcData63Kb, + }; + await publicHmacGenFunc(srcKeyAlies, HuksOptions, "abort"); + done(); + }); + it("testHmacSHA1003", 0, async function (done) { + let srcKeyAlies = "testHmacDigestSHA1KeyAlias003"; + let HuksOptions = { + properties: new Array( + HuksHmac.HuksKeyAlg, + HuksHmac.HuksKeyPurpose, + HuksHmac.HuksTagDigestSHA1 + ), + inData: srcData65Kb, + }; + await publicHmacGenFunc(srcKeyAlies, HuksOptions, "finish"); + done(); + }); + it("testHmacSHA1004", 0, async function (done) { + let srcKeyAlies = "testHmacDigestSHA1KeyAlias004"; + let HuksOptions = { + properties: new Array( + HuksHmac.HuksKeyAlg, + HuksHmac.HuksKeyPurpose, + HuksHmac.HuksTagDigestSHA1 + ), + inData: srcData65Kb, + }; + await publicHmacGenFunc(srcKeyAlies, HuksOptions, "abort"); + done(); + }); + it("testHmacSM3001", 0, async function (done) { + let srcKeyAlies = "testHmacDigestSM3KeyAlias001"; + let HuksOptions = { + properties: new Array( + HuksHmac.HuksKeyAlg, + HuksHmac.HuksKeyPurpose, + HuksHmac.HuksTagDigestSM3 + ), + inData: srcData63Kb, + }; - await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'finish'); - done(); - }); + await publicHmacGenFunc(srcKeyAlies, HuksOptions, "finish"); + done(); + }); - it('testHmacSM3002', 0, async function (done) { - let srcKeyAlies = 'testHmacDigestSM3KeyAlias002'; - let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSM3 - ), - inData: srcData63Kb, - }; - await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'abort'); - done(); - }); - it('testHmacSM3003', 0, async function (done) { - let srcKeyAlies = 'testHmacDigestSM3KeyAlias003'; - let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSM3 - ), - inData: srcData65Kb, - }; - await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'finish'); - done(); - }); - it('testHmacSM3004', 0, async function (done) { - let srcKeyAlies = 'testHmacDigestSM3KeyAlias004'; - let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSM3 - ), - inData: srcData65Kb, - }; - await publicHmacGenFunc(srcKeyAlies, HuksOptions, 'abort'); - done(); + it("testHmacSM3002", 0, async function (done) { + let srcKeyAlies = "testHmacDigestSM3KeyAlias002"; + let HuksOptions = { + properties: new Array( + HuksHmac.HuksKeyAlg, + HuksHmac.HuksKeyPurpose, + HuksHmac.HuksTagDigestSM3 + ), + inData: srcData63Kb, + }; + await publicHmacGenFunc(srcKeyAlies, HuksOptions, "abort"); + done(); + }); + it("testHmacSM3003", 0, async function (done) { + let srcKeyAlies = "testHmacDigestSM3KeyAlias003"; + let HuksOptions = { + properties: new Array( + HuksHmac.HuksKeyAlg, + HuksHmac.HuksKeyPurpose, + HuksHmac.HuksTagDigestSM3 + ), + inData: srcData65Kb, + }; + await publicHmacGenFunc(srcKeyAlies, HuksOptions, "finish"); + done(); + }); + it("testHmacSM3004", 0, async function (done) { + let srcKeyAlies = "testHmacDigestSM3KeyAlias004"; + let HuksOptions = { + properties: new Array( + HuksHmac.HuksKeyAlg, + HuksHmac.HuksKeyPurpose, + HuksHmac.HuksTagDigestSM3 + ), + inData: srcData65Kb, + }; + await publicHmacGenFunc(srcKeyAlies, HuksOptions, "abort"); + done(); + }); }); -}); } diff --git a/security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/List.test.js b/security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/List.test.js index aa748dc86bd3d51db8bf9bf6190badf3fcf52c5f..e205faef187abb9337e6e9b89878c4d2ee1e12ff 100644 --- a/security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/List.test.js +++ b/security/security_huks_basic/huks_hmac_callback_BasicTest/src/main/js/test/List.test.js @@ -13,12 +13,11 @@ * limitations under the License. */ -import {SecurityHuksAccessControlJsunit} from './HMAC/SecurityHuksAccessControlJsunit.test.js' -import {SecurityHuksHmacBasicCallbackJsunit_test, SecurityHuksHmacCallbackJsunit} from './HMAC/SecurityHuksHmacBasicCallbackJsunit.test.js' -import {SecurityHuksImportJsunit} from './HMAC/SecurityHuksImportJsunit.test.js' +import { SecurityHuksAccessControlJsunit } from "./HMAC/SecurityHuksAccessControlJsunit.test.js"; +import { SecurityHuksHmacCallbackJsunit } from "./HMAC/SecurityHuksHmacBasicCallbackJsunit.test.js"; +import { SecurityHuksImportJsunit } from "./HMAC/SecurityHuksImportJsunit.test.js"; export default function testsuite() { -SecurityHuksAccessControlJsunit() -SecurityHuksHmacBasicCallbackJsunit_test() -SecurityHuksHmacCallbackJsunit() -SecurityHuksImportJsunit() + SecurityHuksAccessControlJsunit(); + SecurityHuksHmacCallbackJsunit(); + SecurityHuksImportJsunit(); } diff --git a/security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/config.json b/security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/config.json index 923e166ad282fad9fca4984d5200a15530a690f8..75464378b35933d75b1dc23a0a431d5a27316fac 100644 --- a/security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/config.json +++ b/security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/config.json @@ -18,6 +18,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/js/test/HMAC/SecurityHuksFaceFingerNormalJsunit.test.js b/security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/js/test/HMAC/SecurityHuksFaceFingerNormalJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b8918dd754bcf019dc86bff49c9bcecdd21ae141 --- /dev/null +++ b/security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/js/test/HMAC/SecurityHuksFaceFingerNormalJsunit.test.js @@ -0,0 +1,931 @@ +/*software + * 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 huks from "@ohos.security.huks"; +import systemTime from "@ohos.systemTime"; +import { describe, it, expect } from "@ohos/hypium"; + +let securityLevel = stringToUint8Array("sec_level"); +let challenge = stringToUint8Array("challenge_data"); +let versionInfo = stringToUint8Array("version_info"); +let keyAliasString = "key attest"; + +function attestKey(srcKeyAlies, HuksOptions) { + return new Promise((resolve, reject) => { + huks.attestKey(srcKeyAlies, HuksOptions, function (err, data) { + try { + if (err.code !== 0) { + console.log( + "test generateKey err information: " + JSON.stringify(err) + ); + reject(err); + } else { + resolve(data); + } + } catch (e) { + console.log("test generateKey err information: " + JSON.stringify(e)); + reject(e); + } + }); + }); +} + +function stringToUint8Array(str) { + let arr = []; + for (let i = 0, j = str.length; i < j; ++i) { + arr.push(str.charCodeAt(i)); + } + let tmpUint8Array = new Uint8Array(arr); + return tmpUint8Array; +} + +function usePinNormal(inData) { + let propertiesWithPin = new Array(); + propertiesWithPin[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_AES, + }; + propertiesWithPin[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256, + }; + propertiesWithPin[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT, + }; + propertiesWithPin[3] = { + tag: huks.HuksTag.HUKS_TAG_PADDING, + value: huks.HuksKeyPadding.HUKS_PADDING_NONE, + }; + propertiesWithPin[4] = { + tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, + value: huks.HuksCipherMode.HUKS_MODE_CBC, + }; + propertiesWithPin[5] = { + tag: huks.HuksTag.HUKS_TAG_USER_AUTH_TYPE, + value: huks.HuksUserAuthType.HUKS_USER_AUTH_TYPE_PIN, + }; + propertiesWithPin[6] = { + tag: huks.HuksTag.HUKS_TAG_KEY_AUTH_ACCESS_TYPE, + value: huks.HuksAuthAccessType.HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD, + }; + propertiesWithPin[7] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_TYPE, + value: huks.HuksChallengeType.HUKS_CHALLENGE_TYPE_NORMAL, + }; + propertiesWithPin[8] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_POS, + value: 0, + }; + let aes256 = { + properties: propertiesWithPin, + inData: inData, + }; + return aes256; +} + +function useFaceNormal(inData) { + let propertiesWithPin = new Array(); + propertiesWithPin[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_AES, + }; + propertiesWithPin[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256, + }; + propertiesWithPin[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT, + }; + propertiesWithPin[3] = { + tag: huks.HuksTag.HUKS_TAG_PADDING, + value: huks.HuksKeyPadding.HUKS_PADDING_NONE, + }; + propertiesWithPin[4] = { + tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, + value: huks.HuksCipherMode.HUKS_MODE_CBC, + }; + propertiesWithPin[5] = { + tag: huks.HuksTag.HUKS_TAG_USER_AUTH_TYPE, + value: huks.HuksUserAuthType.HUKS_USER_AUTH_TYPE_FACE, + }; + propertiesWithPin[6] = { + tag: huks.HuksTag.HUKS_TAG_KEY_AUTH_ACCESS_TYPE, + value: huks.HuksAuthAccessType.HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL, + }; + propertiesWithPin[7] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_TYPE, + value: huks.HuksChallengeType.HUKS_CHALLENGE_TYPE_NORMAL, + }; + propertiesWithPin[8] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_POS, + value: 0, + }; + let aes256 = { + properties: propertiesWithPin, + inData: inData, + }; + return aes256; +} + +function useFingerNormal(inData) { + var propertiesWithPin = new Array(); + propertiesWithPin[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_AES, + }; + propertiesWithPin[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256, + }; + propertiesWithPin[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT, + }; + propertiesWithPin[3] = { + tag: huks.HuksTag.HUKS_TAG_PADDING, + value: huks.HuksKeyPadding.HUKS_PADDING_NONE, + }; + propertiesWithPin[4] = { + tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, + value: huks.HuksCipherMode.HUKS_MODE_CBC, + }; + propertiesWithPin[5] = { + tag: huks.HuksTag.HUKS_TAG_USER_AUTH_TYPE, + value: huks.HuksUserAuthType.HUKS_USER_AUTH_TYPE_FINGERPRINT, + }; + propertiesWithPin[6] = { + tag: huks.HuksTag.HUKS_TAG_KEY_AUTH_ACCESS_TYPE, + value: huks.HuksAuthAccessType.HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL, + }; + propertiesWithPin[7] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_TYPE, + value: huks.HuksChallengeType.HUKS_CHALLENGE_TYPE_NORMAL, + }; + propertiesWithPin[8] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_POS, + value: 0, + }; + var aes256 = { + properties: propertiesWithPin, + inData: inData, + }; + return aes256; +} + +function usePinAndFaceNormal(inData) { + let propertiesWithPin = new Array(); + propertiesWithPin[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_AES, + }; + propertiesWithPin[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256, + }; + propertiesWithPin[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT, + }; + propertiesWithPin[3] = { + tag: huks.HuksTag.HUKS_TAG_PADDING, + value: huks.HuksKeyPadding.HUKS_PADDING_NONE, + }; + propertiesWithPin[4] = { + tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, + value: huks.HuksCipherMode.HUKS_MODE_CBC, + }; + propertiesWithPin[5] = { + tag: huks.HuksTag.HUKS_TAG_USER_AUTH_TYPE, + value: + huks.HuksUserAuthType.HUKS_USER_AUTH_TYPE_PIN | + huks.HuksUserAuthType.HUKS_USER_AUTH_TYPE_FACE, + }; + propertiesWithPin[6] = { + tag: huks.HuksTag.HUKS_TAG_KEY_AUTH_ACCESS_TYPE, + value: huks.HuksAuthAccessType.HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD, + }; + propertiesWithPin[7] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_TYPE, + value: huks.HuksChallengeType.HUKS_CHALLENGE_TYPE_NORMAL, + }; + propertiesWithPin[8] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_POS, + value: 0, + }; + let aes256 = { + properties: propertiesWithPin, + inData: inData, + }; + return aes256; +} + +function usePinAndFingerNormal(inData) { + let propertiesWithPin = new Array(); + propertiesWithPin[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_AES, + }; + propertiesWithPin[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256, + }; + propertiesWithPin[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT, + }; + propertiesWithPin[3] = { + tag: huks.HuksTag.HUKS_TAG_PADDING, + value: huks.HuksKeyPadding.HUKS_PADDING_NONE, + }; + propertiesWithPin[4] = { + tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, + value: huks.HuksCipherMode.HUKS_MODE_CBC, + }; + propertiesWithPin[5] = { + tag: huks.HuksTag.HUKS_TAG_USER_AUTH_TYPE, + value: + huks.HuksUserAuthType.HUKS_USER_AUTH_TYPE_PIN | + huks.HuksUserAuthType.HUKS_USER_AUTH_TYPE_FINGERPRINT, + }; + propertiesWithPin[6] = { + tag: huks.HuksTag.HUKS_TAG_KEY_AUTH_ACCESS_TYPE, + value: huks.HuksAuthAccessType.HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD, + }; + propertiesWithPin[7] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_TYPE, + value: huks.HuksChallengeType.HUKS_CHALLENGE_TYPE_NORMAL, + }; + propertiesWithPin[8] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_POS, + value: 0, + }; + let aes256 = { + properties: propertiesWithPin, + inData: inData, + }; + return aes256; +} + +function useFaceAndFingerNormal(inData) { + let propertiesWithPin = new Array(); + propertiesWithPin[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_AES, + }; + propertiesWithPin[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256, + }; + propertiesWithPin[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT, + }; + propertiesWithPin[3] = { + tag: huks.HuksTag.HUKS_TAG_PADDING, + value: huks.HuksKeyPadding.HUKS_PADDING_NONE, + }; + propertiesWithPin[4] = { + tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, + value: huks.HuksCipherMode.HUKS_MODE_CBC, + }; + propertiesWithPin[5] = { + tag: huks.HuksTag.HUKS_TAG_USER_AUTH_TYPE, + value: + huks.HuksUserAuthType.HUKS_USER_AUTH_TYPE_FACE | + huks.HuksUserAuthType.HUKS_USER_AUTH_TYPE_FINGERPRINT, + }; + propertiesWithPin[6] = { + tag: huks.HuksTag.HUKS_TAG_KEY_AUTH_ACCESS_TYPE, + value: huks.HuksAuthAccessType.HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL, + }; + propertiesWithPin[7] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_TYPE, + value: huks.HuksChallengeType.HUKS_CHALLENGE_TYPE_NORMAL, + }; + propertiesWithPin[8] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_POS, + value: 0, + }; + let aes256 = { + properties: propertiesWithPin, + inData: inData, + }; + return aes256; +} + +function usePinFaceFingerNormal(inData) { + let propertiesWithPin = new Array(); + propertiesWithPin[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_AES, + }; + propertiesWithPin[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256, + }; + propertiesWithPin[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT, + }; + propertiesWithPin[3] = { + tag: huks.HuksTag.HUKS_TAG_PADDING, + value: huks.HuksKeyPadding.HUKS_PADDING_NONE, + }; + propertiesWithPin[4] = { + tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, + value: huks.HuksCipherMode.HUKS_MODE_CBC, + }; + propertiesWithPin[5] = { + tag: huks.HuksTag.HUKS_TAG_USER_AUTH_TYPE, + value: + huks.HuksUserAuthType.HUKS_USER_AUTH_TYPE_PIN | + huks.HuksUserAuthType.HUKS_USER_AUTH_TYPE_FACE | + huks.HuksUserAuthType.HUKS_USER_AUTH_TYPE_FINGERPRINT, + }; + propertiesWithPin[6] = { + tag: huks.HuksTag.HUKS_TAG_KEY_AUTH_ACCESS_TYPE, + value: huks.HuksAuthAccessType.HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD, + }; + propertiesWithPin[7] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_TYPE, + value: huks.HuksChallengeType.HUKS_CHALLENGE_TYPE_NORMAL, + }; + propertiesWithPin[8] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_POS, + value: 0, + }; + let aes256 = { + properties: propertiesWithPin, + inData: inData, + }; + return aes256; +} + +function usePinMulti(inData) { + let propertiesWithPin = new Array(); + propertiesWithPin[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_AES, + }; + propertiesWithPin[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256, + }; + propertiesWithPin[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT, + }; + propertiesWithPin[3] = { + tag: huks.HuksTag.HUKS_TAG_PADDING, + value: huks.HuksKeyPadding.HUKS_PADDING_NONE, + }; + propertiesWithPin[4] = { + tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, + value: huks.HuksCipherMode.HUKS_MODE_CBC, + }; + propertiesWithPin[5] = { + tag: huks.HuksTag.HUKS_TAG_USER_AUTH_TYPE, + value: huks.HuksUserAuthType.HUKS_USER_AUTH_TYPE_PIN, + }; + propertiesWithPin[6] = { + tag: huks.HuksTag.HUKS_TAG_KEY_AUTH_ACCESS_TYPE, + value: huks.HuksAuthAccessType.HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD, + }; + propertiesWithPin[7] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_TYPE, + value: huks.HuksChallengeType.HUKS_CHALLENGE_TYPE_CUSTOM, + }; + propertiesWithPin[8] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_POS, + value: 0, + }; + let aes256 = { + properties: propertiesWithPin, + inData: inData, + }; + return aes256; +} + +function useFaceMulti(inData) { + let propertiesWithPin = new Array(); + propertiesWithPin[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_AES, + }; + propertiesWithPin[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256, + }; + propertiesWithPin[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT, + }; + propertiesWithPin[3] = { + tag: huks.HuksTag.HUKS_TAG_PADDING, + value: huks.HuksKeyPadding.HUKS_PADDING_NONE, + }; + propertiesWithPin[4] = { + tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, + value: huks.HuksCipherMode.HUKS_MODE_CBC, + }; + propertiesWithPin[5] = { + tag: huks.HuksTag.HUKS_TAG_USER_AUTH_TYPE, + value: huks.HuksUserAuthType.HUKS_USER_AUTH_TYPE_FACE, + }; + propertiesWithPin[6] = { + tag: huks.HuksTag.HUKS_TAG_KEY_AUTH_ACCESS_TYPE, + value: huks.HuksAuthAccessType.HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL, + }; + propertiesWithPin[7] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_TYPE, + value: huks.HuksChallengeType.HUKS_CHALLENGE_TYPE_CUSTOM, + }; + propertiesWithPin[8] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_POS, + value: 0, + }; + let aes256 = { + properties: propertiesWithPin, + inData: inData, + }; + return aes256; +} + +function useFingerMulti(inData) { + var propertiesWithPin = new Array(); + propertiesWithPin[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_AES, + }; + propertiesWithPin[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256, + }; + propertiesWithPin[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT, + }; + propertiesWithPin[3] = { + tag: huks.HuksTag.HUKS_TAG_PADDING, + value: huks.HuksKeyPadding.HUKS_PADDING_NONE, + }; + propertiesWithPin[4] = { + tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, + value: huks.HuksCipherMode.HUKS_MODE_CBC, + }; + propertiesWithPin[5] = { + tag: huks.HuksTag.HUKS_TAG_USER_AUTH_TYPE, + value: huks.HuksUserAuthType.HUKS_USER_AUTH_TYPE_FINGERPRINT, + }; + propertiesWithPin[6] = { + tag: huks.HuksTag.HUKS_TAG_KEY_AUTH_ACCESS_TYPE, + value: huks.HuksAuthAccessType.HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL, + }; + propertiesWithPin[7] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_TYPE, + value: huks.HuksChallengeType.HUKS_CHALLENGE_TYPE_CUSTOM, + }; + propertiesWithPin[8] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_POS, + value: 0, + }; + var aes256 = { + properties: propertiesWithPin, + inData: inData, + }; + return aes256; +} + +function usePinTime(inData) { + let propertiesWithPin = new Array(); + propertiesWithPin[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_AES, + }; + propertiesWithPin[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256, + }; + propertiesWithPin[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT, + }; + propertiesWithPin[3] = { + tag: huks.HuksTag.HUKS_TAG_PADDING, + value: huks.HuksKeyPadding.HUKS_PADDING_NONE, + }; + propertiesWithPin[4] = { + tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, + value: huks.HuksCipherMode.HUKS_MODE_CBC, + }; + propertiesWithPin[5] = { + tag: huks.HuksTag.HUKS_TAG_USER_AUTH_TYPE, + value: huks.HuksUserAuthType.HUKS_USER_AUTH_TYPE_PIN, + }; + propertiesWithPin[6] = { + tag: huks.HuksTag.HUKS_TAG_KEY_AUTH_ACCESS_TYPE, + value: huks.HuksAuthAccessType.HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD, + }; + propertiesWithPin[7] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_TYPE, + value: huks.HuksChallengeType.HUKS_CHALLENGE_TYPE_NONE, + }; + propertiesWithPin[8] = { + tag: huks.HuksTag.HUKS_TAG_AUTH_TIMEOUT, + value: 10, + }; + let aes256 = { + properties: propertiesWithPin, + inData: inData, + }; + return aes256; +} + +function useFaceTime(inData) { + let propertiesWithPin = new Array(); + propertiesWithPin[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_AES, + }; + propertiesWithPin[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256, + }; + propertiesWithPin[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT, + }; + propertiesWithPin[3] = { + tag: huks.HuksTag.HUKS_TAG_PADDING, + value: huks.HuksKeyPadding.HUKS_PADDING_NONE, + }; + propertiesWithPin[4] = { + tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, + value: huks.HuksCipherMode.HUKS_MODE_CBC, + }; + propertiesWithPin[5] = { + tag: huks.HuksTag.HUKS_TAG_USER_AUTH_TYPE, + value: huks.HuksUserAuthType.HUKS_USER_AUTH_TYPE_FACE, + }; + propertiesWithPin[6] = { + tag: huks.HuksTag.HUKS_TAG_KEY_AUTH_ACCESS_TYPE, + value: huks.HuksAuthAccessType.HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL, + }; + propertiesWithPin[7] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_TYPE, + value: huks.HuksChallengeType.HUKS_CHALLENGE_TYPE_NONE, + }; + propertiesWithPin[8] = { + tag: huks.HuksTag.HUKS_TAG_AUTH_TIMEOUT, + value: 10, + }; + let aes256 = { + properties: propertiesWithPin, + inData: inData, + }; + return aes256; +} + +function useFingerTime(inData) { + var propertiesWithPin = new Array(); + propertiesWithPin[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_AES, + }; + propertiesWithPin[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256, + }; + propertiesWithPin[2] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT, + }; + propertiesWithPin[3] = { + tag: huks.HuksTag.HUKS_TAG_PADDING, + value: huks.HuksKeyPadding.HUKS_PADDING_NONE, + }; + propertiesWithPin[4] = { + tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, + value: huks.HuksCipherMode.HUKS_MODE_CBC, + }; + propertiesWithPin[5] = { + tag: huks.HuksTag.HUKS_TAG_USER_AUTH_TYPE, + value: huks.HuksUserAuthType.HUKS_USER_AUTH_TYPE_FINGERPRINT, + }; + propertiesWithPin[6] = { + tag: huks.HuksTag.HUKS_TAG_KEY_AUTH_ACCESS_TYPE, + value: huks.HuksAuthAccessType.HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL, + }; + propertiesWithPin[7] = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_TYPE, + value: huks.HuksChallengeType.HUKS_CHALLENGE_TYPE_NONE, + }; + propertiesWithPin[8] = { + tag: huks.HuksTag.HUKS_TAG_AUTH_TIMEOUT, + value: 10, + }; + var aes256 = { + properties: propertiesWithPin, + inData: inData, + }; + return aes256; +} + +async function generateKeyAttest(alias) { + let properties = new Array(); + properties[0] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_RSA, + }; + properties[1] = { + tag: huks.HuksTag.HUKS_TAG_KEY_STORAGE_FLAG, + value: huks.HuksKeyStorageType.HUKS_STORAGE_PERSISTENT, + }; + properties[2] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_RSA_KEY_SIZE_2048, + }; + properties[3] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY, + }; + properties[4] = { + tag: huks.HuksTag.HUKS_TAG_DIGEST, + value: huks.HuksKeyDigest.HUKS_DIGEST_SHA256, + }; + properties[5] = { + tag: huks.HuksTag.HUKS_TAG_PADDING, + value: huks.HuksKeyPadding.HUKS_PADDING_PSS, + }; + properties[6] = { + tag: huks.HuksTag.HUKS_TAG_KEY_GENERATE_TYPE, + value: huks.HuksKeyGenerateType.HUKS_KEY_GENERATE_TYPE_DEFAULT, + }; + properties[7] = { + tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, + value: huks.HuksCipherMode.HUKS_MODE_ECB, + }; + let options = { + properties: properties, + }; + await huks.generateKey(alias, options); +} + +export default function SecurityHuksFaceFingerNormalJsunit() { + describe("SecurityHuksFaceFingerNormalJsunit", function () { + /** + * @tc.number HUKS_Cipher_AuthToken_2900 + * @tc.name HUKS_Cipher_AuthToken_2900. + * @tc.desc HUKS_TAG_USER_AUTH_TYPE invalid and generate. + */ + it("HUKS_Cipher_AuthToken_2900", 0, async function (done) { + let alias = "HUKS_Cipher_AuthToken_2900"; + let inData = new Uint8Array(new Array()); + let option = usePinNormal(inData); + let err = { + tag: huks.HuksTag.HUKS_TAG_USER_AUTH_TYPE, + value: -1, + }; + option.properties.splice(5, 1, err); + await huks + .generateKey(alias, option) + .then(async (data) => { + console.error(`generateKey success ${JSON.stringify(data)}`); + expect(data.errorCode == -3).assertTrue(); + }) + .catch((err) => { + console.error(`generateKey err: " + ${JSON.stringify(err)}`); + expect(null).assertFail(); + }); + done(); + }); + + /** + * @tc.number HUKS_Cipher_AuthToken_3000 + * @tc.name HUKS_Cipher_AuthToken_3000. + * @tc.desc HUKS_TAG_KEY_AUTH_ACCESS_TYPE invalid and generate. + */ + it("HUKS_Cipher_AuthToken_3000", 0, async function (done) { + let alias = "HUKS_Cipher_AuthToken_3000"; + let inData = new Uint8Array(new Array()); + let option = usePinNormal(inData); + let err = { + tag: huks.HuksTag.HUKS_TAG_KEY_AUTH_ACCESS_TYPE, + value: -1, + }; + option.properties.splice(6, 1, err); + await huks + .generateKey(alias, option) + .then(async (data) => { + console.error(`generateKey success ${JSON.stringify(data)}`); + expect(data.errorCode == -4).assertTrue(); + }) + .catch((err) => { + console.error(`generateKey err: " + ${JSON.stringify(err)}`); + expect(null).assertFail(); + }); + done(); + }); + + /** + * @tc.number HUKS_Cipher_AuthToken_3100 + * @tc.name HUKS_Cipher_AuthToken_3100. + * @tc.desc HUKS_TAG_CHALLENGE_TYPE invalid and generate. + */ + it("HUKS_Cipher_AuthToken_3100", 0, async function (done) { + let alias = "HUKS_Cipher_AuthToken_3100"; + let inData = new Uint8Array(new Array()); + let option = usePinNormal(inData); + let err = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_TYPE, + value: -1, + }; + option.properties.splice(7, 1, err); + await huks + .generateKey(alias, option) + .then(async (data) => { + console.error(`generateKey success ${JSON.stringify(data)}`); + expect(data.errorCode == -3).assertTrue(); + }) + .catch((err) => { + console.error(`generateKey err: " + ${JSON.stringify(err)}`); + expect(null).assertFail(); + }); + done(); + }); + + /** + * @tc.number HUKS_Cipher_AuthToken_3200 + * @tc.name HUKS_Cipher_AuthToken_3200. + * @tc.desc HUKS_TAG_CHALLENGE_POS invalid and generate. + */ + it("HUKS_Cipher_AuthToken_3200", 0, async function (done) { + let alias = "HUKS_Cipher_AuthToken_3200"; + let inData = new Uint8Array(new Array()); + let option = usePinNormal(inData); + let err = { + tag: huks.HuksTag.HUKS_TAG_CHALLENGE_POS, + value: -1, + }; + option.properties.splice(8, 1, err); + await huks + .generateKey(alias, option) + .then(async (data) => { + console.error(`generateKey success ${JSON.stringify(data)}`); + expect(data.errorCode == -4).assertTrue(); + }) + .catch((err) => { + console.error(`generateKey err: " + ${JSON.stringify(err)}`); + expect(null).assertFail(); + }); + done(); + }); + + /** + * @tc.number HUKS_Cipher_AuthToken_3300 + * @tc.name HUKS_Cipher_AuthToken_3300. + * @tc.desc HUKS_TAG_AUTH_TIMEOUT invalid and generate. + */ + it("HUKS_Cipher_AuthToken_3300", 0, async function (done) { + let alias = "HUKS_Cipher_AuthToken_3300"; + let inData = new Uint8Array(new Array()); + let option = usePinTime(inData); + let err = { + tag: huks.HuksTag.HUKS_TAG_AUTH_TIMEOUT, + value: -1, + }; + option.properties.splice(8, 1, err); + await huks + .generateKey(alias, option) + .then(async (data) => { + console.error(`generateKey success ${JSON.stringify(data)}`); + expect(data.errorCode == -3).assertTrue(); + }) + .catch((err) => { + console.error(`generateKey err: " + ${JSON.stringify(err)}`); + expect(null).assertFail(); + }); + done(); + }); + + /** + * @tc.number HUKS_Cipher_AuthToken_5500 + * @tc.name HUKS_Cipher_AuthToken_5500. + * @tc.desc use pin access type is HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL. + */ + it("HUKS_Cipher_AuthToken_5500", 0, async function (done) { + let alias = "HUKS_Cipher_AuthToken_5500"; + let inData = new Uint8Array(new Array()); + let option = usePinNormal(inData); + let err = { + tag: huks.HuksTag.HUKS_TAG_KEY_AUTH_ACCESS_TYPE, + value: huks.HuksAuthAccessType.HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL, + }; + option.properties.splice(6, 1, err); + await huks + .generateKey(alias, option) + .then(async (data) => { + console.error(`generateKey success ${JSON.stringify(data)}`); + expect(data.errorCode == -3).assertTrue(); + }) + .catch((err) => { + console.error(`generateKey err: " + ${JSON.stringify(err)}`); + expect(null).assertFail(); + }); + done(); + }); + + /** + * @tc.number HUKS_Cipher_Attestation_0300 + * @tc.name HUKS_Cipher_Attestation_0300. + * @tc.desc attest key support. + */ + it("HUKS_Cipher_Attestation_0300", 0, async function (done) { + let aliasString = keyAliasString; + let aliasUint8 = stringToUint8Array(aliasString); + let properties = new Array(); + properties[0] = { + tag: huks.HuksTag.HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO, + value: securityLevel, + }; + properties[1] = { + tag: huks.HuksTag.HUKS_TAG_ATTESTATION_CHALLENGE, + value: challenge, + }; + properties[2] = { + tag: huks.HuksTag.HUKS_TAG_ATTESTATION_ID_VERSION_INFO, + value: versionInfo, + }; + properties[3] = { + tag: huks.HuksTag.HUKS_TAG_ATTESTATION_ID_ALIAS, + value: aliasUint8, + }; + let options = { + properties: properties, + }; + await generateKeyAttest(aliasString); + await huks + .attestKey(aliasString, options) + .then((data) => { + console.log(`attest key data: ${JSON.stringify(data)}`); + expect(data.certChains.length > 0).assertTrue(); + expect(data.errorCode == 0).assertTrue(); + }) + .catch((err) => { + console.error(`attest key data: ${JSON.stringify(err)}`); + expect(null).assertFail(); + }); + + await attestKey(aliasString, options) + .then((data) => { + console.log("test generateKey data: " + JSON.stringify(data)); + expect(data.errorCode == 0).assertTrue(); + }) + .catch((err) => { + console.error(`test init err: ${JSON.stringify(err)}`); + expect(null).assertFail(); + }); + + done(); + }); + }); +} diff --git a/security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/js/test/HMAC/SecurityHuksHmacBasicPromiseJsunit.test.js b/security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/js/test/HMAC/SecurityHuksHmacBasicPromiseJsunit.test.js index c48d14cf10e417fd5e1ee23a0169e205d523ca25..a87a9b535a978c4f31359439e8969417c69c9059 100644 --- a/security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/js/test/HMAC/SecurityHuksHmacBasicPromiseJsunit.test.js +++ b/security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/js/test/HMAC/SecurityHuksHmacBasicPromiseJsunit.test.js @@ -13,15 +13,16 @@ * limitations under the License. */ -import { describe, it, expect } from '@ohos/hypium'; -import huks from '@ohos.security.huks'; -import Data from '../../../../../../utils/data.json'; -import { HuksHmac } from '../../../../../../utils/param/hmac/publicHmacParam.js'; -import { stringToArray } from '../../../../../../utils/param/publicFunc.js'; +import { describe, it, expect } from "@ohos/hypium"; +import huks from "@ohos.security.huks"; +import Data from "../../../../../../utils/data.json"; +import { HuksHmac } from "../../../../../../utils/param/hmac/publicHmacParam.js"; +import { stringToArray } from "../../../../../../utils/param/publicFunc.js"; var handle; let srcData63Kb = Data.Date63KB; let srcData65Kb = Data.Date65KB; +let emptyOptions = { properties: [] }; async function publicHmacGenFunc(srcKeyAlies, HuksOptions) { HuksOptions.properties.splice(1, 0, HuksHmac.HuksKeySIZE); @@ -32,12 +33,96 @@ async function publicHmacGenFunc(srcKeyAlies, HuksOptions) { expect(data.errorCode == 0).assertTrue(); }) .catch((err) => { - console.log('test generateKey err information: ' + JSON.stringify(err)); + console.error("test generateKey err information: " + JSON.stringify(err)); + expect(null).assertFail(); + }); + + await huks + .getKeyProperties(srcKeyAlies, HuksOptions) + .then(async (data) => { + console.log(`test finish data ${JSON.stringify(data)}`); + expect(data.errorCode == 0).assertTrue(); + }) + .catch((err) => { + console.error("test init err: " + JSON.stringify(err)); + expect(null).assertFail(); + }); + + await getKeyProperties(srcKeyAlies, HuksOptions) + .then((data) => { + console.log("test generateKey data: " + JSON.stringify(data)); + expect(data.errorCode == 0).assertTrue(); + }) + .catch((err) => { + console.error("test init err: " + JSON.stringify(err)); + expect(null).assertFail(); + }); + + await huks + .isKeyExist(srcKeyAlies, emptyOptions) + .then(async (data) => { + console.log("isKeyExist data: " + JSON.stringify(data)); + expect(data == true).assertTrue(); + }) + .catch((err) => { + console.error("isKeyExist err: " + JSON.stringify(err)); + expect(null).assertFail(); + }); + + await isKeyExist(srcKeyAlies, emptyOptions) + .then((data) => { + console.log("isKeyExist data: " + JSON.stringify(data)); + expect(data == true).assertTrue(); + }) + .catch((err) => { + console.error("isKeyExist err: " + JSON.stringify(err)); expect(null).assertFail(); }); HuksOptions.properties.splice(1, 1); } +function getKeyProperties(srcKeyAlies, HuksOptions) { + return new Promise((resolve, reject) => { + huks.getKeyProperties(srcKeyAlies, HuksOptions, function (err, data) { + try { + if (err.code != 0) { + console.error( + "test generateKey err information: " + JSON.stringify(err) + ); + reject(err); + } else { + resolve(data); + } + } catch (e) { + console.error( + "test generateKey err information:: " + JSON.stringify(e) + ); + reject(e); + } + }); + }); +} + +function isKeyExist(srcKeyAlies, emptyOptions) { + return new Promise((resolve, reject) => { + huks.isKeyExist(srcKeyAlies, emptyOptions, function (err, data) { + try { + if (err.code != 0) { + console.error( + "test isKeyExist err information: " + JSON.stringify(err) + ); + reject(err); + } else { + resolve(data); + } + } catch (e) { + console.error("test isKeyExist err information: " + JSON.stringify(e)); + reject(e); + } + }); + }); +} + async function publicHmacInitFunc(srcKeyAlies, HuksOptions) { await huks .init(srcKeyAlies, HuksOptions) @@ -63,19 +148,26 @@ async function publicHmacUpdateFunc(HuksOptions) { let count = Math.floor(inDataArray.length / dateSize); let remainder = inDataArray.length % dateSize; for (let i = 0; i < count; i++) { - HuksOptions.inData = new Uint8Array(stringToArray(huksOptionsInData).slice(dateSize * i, dateSize * (i + 1))); + HuksOptions.inData = new Uint8Array( + stringToArray(huksOptionsInData).slice(dateSize * i, dateSize * (i + 1)) + ); await update(handle, HuksOptions); } if (remainder !== 0) { - HuksOptions.inData = new Uint8Array(stringToArray(huksOptionsInData).slice(dateSize * count, inDataArray.length)); + HuksOptions.inData = new Uint8Array( + stringToArray(huksOptionsInData).slice( + dateSize * count, + inDataArray.length + ) + ); await update(handle, HuksOptions); } } } async function publicHmacFinish(HuksOptions, thirdInderfaceName) { - if (thirdInderfaceName == 'finish') { - HuksOptions.inData = new Uint8Array(stringToArray('0')); + if (thirdInderfaceName == "finish") { + HuksOptions.inData = new Uint8Array(stringToArray("0")); await huks .finish(handle, HuksOptions) .then((data) => { @@ -83,10 +175,10 @@ async function publicHmacFinish(HuksOptions, thirdInderfaceName) { expect(data.errorCode == 0).assertTrue(); }) .catch((err) => { - console.log('test finish err information: ' + err); + console.log("test finish err information: " + err); expect(null).assertFail(); }); - } else if (thirdInderfaceName == 'abort') { + } else if (thirdInderfaceName == "abort") { await huks .abort(handle, HuksOptions) .then((data) => { @@ -94,7 +186,7 @@ async function publicHmacFinish(HuksOptions, thirdInderfaceName) { expect(data.errorCode == 0).assertTrue(); }) .catch((err) => { - console.log('test abort err information: ' + err); + console.log("test abort err information: " + err); expect(null).assertFail(); }); } @@ -109,7 +201,7 @@ async function publicHmacDelete(srcKeyAlies, HuksOptions) { expect(data.errorCode == 0).assertTrue(); }) .catch((err) => { - console.log('test deleteKey err information: ' + JSON.stringify(err)); + console.log("test deleteKey err information: " + JSON.stringify(err)); expect(null).assertFail(); }); } @@ -134,105 +226,124 @@ async function update(handle, HuksOptions) { expect(data.errorCode == 0).assertTrue(); }) .catch((err) => { - console.log('test update err information: ' + err); + console.log("test update err information: " + err); expect(null).assertFail(); }); } export default function SecurityHuksHmacBasicPromiseJsunit() { -describe('SecurityHuksHmacBasicPromiseJsunit', function () { - it('testHmac101', 0, async function (done) { - const srcKeyAlies = 'testHmacDigestSHA1KeyAlias101'; - let HuksOptions = { - properties: new Array(HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyPurpose, HuksHmac.HuksTagDigestSHA1), - inData: srcData63Kb, - }; - await publicHmacFunc(srcKeyAlies, HuksOptions, 'finish'); - done(); - }); + describe("SecurityHuksHmacBasicPromiseJsunit", function () { + it("testHmac101", 0, async function (done) { + const srcKeyAlies = "testHmacDigestSHA1KeyAlias101"; + let HuksOptions = { + properties: new Array( + HuksHmac.HuksKeyAlg, + HuksHmac.HuksKeyPurpose, + HuksHmac.HuksTagDigestSHA1 + ), + inData: srcData63Kb, + }; + await publicHmacFunc(srcKeyAlies, HuksOptions, "finish"); + done(); + }); - it('testHmac102', 0, async function (done) { - const srcKeyAlies = 'testHmacDigestSHA1KeyAlias102'; - let HuksOptions = { - properties: new Array(HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyPurpose, HuksHmac.HuksTagDigestSHA1), - inData: srcData63Kb, - }; - await publicHmacFunc(srcKeyAlies, HuksOptions, 'abort'); - done(); - }); + it("testHmac102", 0, async function (done) { + const srcKeyAlies = "testHmacDigestSHA1KeyAlias102"; + let HuksOptions = { + properties: new Array( + HuksHmac.HuksKeyAlg, + HuksHmac.HuksKeyPurpose, + HuksHmac.HuksTagDigestSHA1 + ), + inData: srcData63Kb, + }; + await publicHmacFunc(srcKeyAlies, HuksOptions, "abort"); + done(); + }); - it('testHmac103', 0, async function (done) { - const srcKeyAlies = 'testHmacDigestSHA1KeyAlias103'; - let HuksOptions = { - properties: new Array(HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyPurpose, HuksHmac.HuksTagDigestSHA1), - inData: srcData65Kb, - }; - await publicHmacFunc(srcKeyAlies, HuksOptions, 'finish'); - done(); - }); + it("testHmac103", 0, async function (done) { + const srcKeyAlies = "testHmacDigestSHA1KeyAlias103"; + let HuksOptions = { + properties: new Array( + HuksHmac.HuksKeyAlg, + HuksHmac.HuksKeyPurpose, + HuksHmac.HuksTagDigestSHA1 + ), + inData: srcData65Kb, + }; + await publicHmacFunc(srcKeyAlies, HuksOptions, "finish"); + done(); + }); - it('testHmac104', 0, async function (done) { - const srcKeyAlies = 'testHmacDigestSHA1KeyAlias104'; - let HuksOptions = { - properties: new Array(HuksHmac.HuksKeyAlg, HuksHmac.HuksKeyPurpose, HuksHmac.HuksTagDigestSHA1), - inData: srcData65Kb, - }; - await publicHmacFunc(srcKeyAlies, HuksOptions, 'abort'); - done(); - }); - it('testHmacSM3001', 0, async function (done) { - let srcKeyAlies = 'testHmacDigestSM3KeyAlias001'; - let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSM3 - ), - inData: srcData63Kb, - }; - - await publicHmacFunc(srcKeyAlies, HuksOptions, 'finish'); - done(); - }); + it("testHmac104", 0, async function (done) { + const srcKeyAlies = "testHmacDigestSHA1KeyAlias104"; + let HuksOptions = { + properties: new Array( + HuksHmac.HuksKeyAlg, + HuksHmac.HuksKeyPurpose, + HuksHmac.HuksTagDigestSHA1 + ), + inData: srcData65Kb, + }; + await publicHmacFunc(srcKeyAlies, HuksOptions, "abort"); + done(); + }); - it('testHmacSM3002', 0, async function (done) { - let srcKeyAlies = 'testHmacDigestSM3KeyAlias002'; - let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSM3 - ), - inData: srcData63Kb, - }; - await publicHmacFunc(srcKeyAlies, HuksOptions, 'abort'); - done(); - }); - it('testHmacSM3003', 0, async function (done) { - let srcKeyAlies = 'testHmacDigestSM3KeyAlias003'; - let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSM3 - ), - inData: srcData65Kb, - }; - await publicHmacFunc(srcKeyAlies, HuksOptions, 'finish'); - done(); - }); - it('testHmacSM3004', 0, async function (done) { - let srcKeyAlies = 'testHmacDigestSM3KeyAlias004'; - let HuksOptions = { - properties: new Array( - HuksHmac.HuksKeyAlg, - HuksHmac.HuksKeyPurpose, - HuksHmac.HuksTagDigestSM3 - ), - inData: srcData65Kb, - }; - await publicHmacFunc(srcKeyAlies, HuksOptions, 'abort'); - done(); + it("testHmacSM3101", 0, async function (done) { + let srcKeyAlies = "testHmacDigestSM3KeyAlias001"; + let HuksOptions = { + properties: new Array( + HuksHmac.HuksKeyAlg, + HuksHmac.HuksKeyPurpose, + HuksHmac.HuksTagDigestSM3 + ), + inData: srcData63Kb, + }; + + await publicHmacFunc(srcKeyAlies, HuksOptions, "finish"); + done(); + }); + + it("testHmacSM3102", 0, async function (done) { + let srcKeyAlies = "testHmacDigestSM3KeyAlias002"; + let HuksOptions = { + properties: new Array( + HuksHmac.HuksKeyAlg, + HuksHmac.HuksKeyPurpose, + HuksHmac.HuksTagDigestSM3 + ), + inData: srcData63Kb, + }; + await publicHmacFunc(srcKeyAlies, HuksOptions, "abort"); + done(); + }); + + it("testHmacSM3103", 0, async function (done) { + let srcKeyAlies = "testHmacDigestSM3KeyAlias003"; + let HuksOptions = { + properties: new Array( + HuksHmac.HuksKeyAlg, + HuksHmac.HuksKeyPurpose, + HuksHmac.HuksTagDigestSM3 + ), + inData: srcData65Kb, + }; + await publicHmacFunc(srcKeyAlies, HuksOptions, "finish"); + done(); + }); + + it("testHmacSM3104", 0, async function (done) { + let srcKeyAlies = "testHmacDigestSM3KeyAlias004"; + let HuksOptions = { + properties: new Array( + HuksHmac.HuksKeyAlg, + HuksHmac.HuksKeyPurpose, + HuksHmac.HuksTagDigestSM3 + ), + inData: srcData65Kb, + }; + await publicHmacFunc(srcKeyAlies, HuksOptions, "abort"); + done(); + }); }); -}); } diff --git a/security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/js/test/List.test.js b/security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/js/test/List.test.js index fca2eeabca9e3957e7ccc86fe4171ce630cb1671..11afedb70673a5ea5dca25046869e38a2b629f47 100644 --- a/security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/js/test/List.test.js +++ b/security/security_huks_basic/huks_hmac_promise_BasicTest/src/main/js/test/List.test.js @@ -14,6 +14,8 @@ */ import SecurityHuksHmacBasicPromiseJsunit from './HMAC/SecurityHuksHmacBasicPromiseJsunit.test.js' +import SecurityHuksFaceFingerNormalJsunit from './HMAC/SecurityHuksFaceFingerNormalJsunit.test.js' export default function testsuite() { SecurityHuksHmacBasicPromiseJsunit() +SecurityHuksFaceFingerNormalJsunit() } diff --git a/security/security_huks_basic/huks_signverify_callback_BasicTest/src/main/config.json b/security/security_huks_basic/huks_signverify_callback_BasicTest/src/main/config.json index d5754f70bb8b35146edd98e93991c8aaf63c8dca..94f9ac6f183d3cdea0824e942e6082b23e6081e9 100644 --- a/security/security_huks_basic/huks_signverify_callback_BasicTest/src/main/config.json +++ b/security/security_huks_basic/huks_signverify_callback_BasicTest/src/main/config.json @@ -18,6 +18,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/security/security_huks_basic/huks_signverify_promise_BasicTest/src/main/config.json b/security/security_huks_basic/huks_signverify_promise_BasicTest/src/main/config.json index da9ce1d9ff88c8d7e193fa6be91a9bd720c9e7cb..a25be69eb1d2943b6686d5d727d93453df2d55f3 100644 --- a/security/security_huks_basic/huks_signverify_promise_BasicTest/src/main/config.json +++ b/security/security_huks_basic/huks_signverify_promise_BasicTest/src/main/config.json @@ -18,6 +18,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/security_lite/deviceauth_basic_deps/BUILD.gn b/security_lite/deviceauth_basic_deps/BUILD.gn index 74b10c4ea41ecb7bd664768057d60248c17e3f19..cabff98997b8a0e17133098dc42651eafbbbae54 100644 --- a/security_lite/deviceauth_basic_deps/BUILD.gn +++ b/security_lite/deviceauth_basic_deps/BUILD.gn @@ -23,7 +23,7 @@ hctest_suite("ActsSecurityHichainBasicDeps") { include_dirs = [ "//commonlibrary/c_utils/base/include", - "//utils/native/lite/include", + "//commonlibrary/utils_lite/include", "//test/xts/tools/lite/hctest/include", "//third_party/unity/src", "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/samgr", diff --git a/security_lite/deviceauth_basic_deps/deviceauth.gni b/security_lite/deviceauth_basic_deps/deviceauth.gni index fc07ac837dce969e6934b3b311bb88041f89eeb7..22019e93143f3f2e89e6669f4d774d277004ab6f 100644 --- a/security_lite/deviceauth_basic_deps/deviceauth.gni +++ b/security_lite/deviceauth_basic_deps/deviceauth.gni @@ -32,7 +32,7 @@ DEVICEAUTH_BASIC_DEPS_SOURCE = [ DEVICEAUTH_BASIC_DEPS_INC = [ "//base/iothardware/peripheral/interfaces/inner_api", - "//utils/native/lite/include", # utils_file.h ohos_types.h + "//commonlibrary/utils_lite/include", # utils_file.h ohos_types.h # alg test "//base/security/device_auth/deps_adapter/key_management_adapter/interfaces", diff --git a/security_lite/permission_posix/pms/BUILD.gn b/security_lite/permission_posix/pms/BUILD.gn index bbdc286526ae54c26f032043078c600be500f181..82d806f9cbd56be9f3f8b21737968bf27483910b 100644 --- a/security_lite/permission_posix/pms/BUILD.gn +++ b/security_lite/permission_posix/pms/BUILD.gn @@ -31,7 +31,7 @@ hcpptest_suite("ActsPMSTest") { include_dirs = [ "src", "include", - "//utils/native/lite/include", + "//commonlibrary/utils_lite/include", "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/samgr", "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/communication/broadcast", "//base/security/permission_lite/interfaces/innerkits", diff --git a/security_lite/permission_posix/pms/src/ActsPMSRevokeRuntimeTest.cpp b/security_lite/permission_posix/pms/src/ActsPMSRevokeRuntimeTest.cpp index 4c6a8119ef092d10107bd034c5a28bf33b0241ae..471d96d2b9f52345352ccd2bcf94362a797bd397 100755 --- a/security_lite/permission_posix/pms/src/ActsPMSRevokeRuntimeTest.cpp +++ b/security_lite/permission_posix/pms/src/ActsPMSRevokeRuntimeTest.cpp @@ -89,12 +89,12 @@ protected: }; /* - * @tc.name: testSecPMPMS_126 + * @tc.name: SUB_SEC_AppSEC_PermissionMgmt_PMS_5000 * @tc.desc: revoke permissions to large and small PIDs * @tc.type: FUNC * @tc.require: AR000E07N7 */ -HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_126, Function | MediumTest | Level3) +HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_5000, Function | MediumTest | Level3) { SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, SYS_PERM_NUM, FIRST_INSTALL); LoadPermissions(TEST_APP_ID, MAX_PID); @@ -113,12 +113,12 @@ HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_126, Function | MediumTest | Lev } /* - * @tc.name: testSecPMPMS_127 + * @tc.name: SUB_SEC_AppSEC_PermissionMgmt_PMS_5100 * @tc.desc: revoke permissions while not load permiossion * @tc.type: FUNC * @tc.require: AR000F4FSI */ -HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_127, Function | MediumTest | Level2) +HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_5100, Function | MediumTest | Level2) { SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, SYS_PERM_NUM, FIRST_INSTALL); int ret = g_interface->RevokeRuntimePermission(TEST_TASKID, g_systemPers[0].name); @@ -129,12 +129,12 @@ HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_127, Function | MediumTest | Lev } /* - * @tc.name: testSecPMPMS_128 + * @tc.name: SUB_SEC_AppSEC_PermissionMgmt_PMS_5200 * @tc.desc: revoke runtime app permissions * @tc.type: FUNC * @tc.require: AR000F4FSI */ -HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_128, Function | MediumTest | Level0) +HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_5200, Function | MediumTest | Level0) { SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, SYS_PERM_NUM, FIRST_INSTALL); LoadPermissions(TEST_APP_ID, TEST_TASKID); @@ -147,12 +147,12 @@ HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_128, Function | MediumTest | Lev } /* - * @tc.name: testSecPMPMS_129 + * @tc.name: SUB_SEC_AppSEC_PermissionMgmt_PMS_5300 * @tc.desc: revoke permissions without request * @tc.type: FUNC * @tc.require: AR000F4FSI */ -HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_129, Function | MediumTest | Level2) +HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_5300, Function | MediumTest | Level2) { SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, 1, FIRST_INSTALL); LoadPermissions(TEST_APP_ID, TEST_TASKID); @@ -165,12 +165,12 @@ HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_129, Function | MediumTest | Lev } /* - * @tc.name: testSecPMPMS_130 + * @tc.name: SUB_SEC_AppSEC_PermissionMgmt_PMS_5400 * @tc.desc: revoke system_grant permissions * @tc.type: FUNC * @tc.require: AR000F4FSI */ -HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_130, Function | MediumTest | Level2) +HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_5400, Function | MediumTest | Level2) { SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, SYS_PERM_NUM, FIRST_INSTALL); LoadPermissions(TEST_APP_ID, TEST_TASKID); @@ -183,12 +183,12 @@ HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_130, Function | MediumTest | Lev } /* - * @tc.name: testSecPMPMS_131 + * @tc.name: SUB_SEC_AppSEC_PermissionMgmt_PMS_5500 * @tc.desc: revoke user_grant permissions * @tc.type: FUNC * @tc.require: AR000F4FSI */ -HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_131, Function | MediumTest | Level1) +HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_5500, Function | MediumTest | Level1) { SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, SYS_PERM_NUM, FIRST_INSTALL); LoadPermissions(TEST_APP_ID, TEST_TASKID); @@ -204,12 +204,12 @@ HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_131, Function | MediumTest | Lev } /* - * @tc.name: testSecPMPMS_132 + * @tc.name: SUB_SEC_AppSEC_PermissionMgmt_PMS_5600 * @tc.desc: revoke unknown permissions * @tc.type: FUNC * @tc.require: AR000F4FSI */ -HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_132, Function | MediumTest | Level3) +HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_5600, Function | MediumTest | Level3) { SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, SYS_PERM_NUM, FIRST_INSTALL); LoadPermissions(TEST_APP_ID, TEST_TASKID); @@ -222,12 +222,12 @@ HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_132, Function | MediumTest | Lev } /* - * @tc.name: testSecPMPMS_133 + * @tc.name: SUB_SEC_AppSEC_PermissionMgmt_PMS_5700 * @tc.desc: revoke runtime permissions after revoke permission * @tc.type: FUNC * @tc.require: AR000F4FSI */ -HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_133, Function | MediumTest | Level3) +HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_5700, Function | MediumTest | Level3) { SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, SYS_PERM_NUM, FIRST_INSTALL); g_interface->GrantPermission(TEST_APP_ID, g_systemPers[0].name); @@ -242,12 +242,12 @@ HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_133, Function | MediumTest | Lev } /* - * @tc.name: testSecPMPMS_134 + * @tc.name: SUB_SEC_AppSEC_PermissionMgmt_PMS_5800 * @tc.desc: revoke runtime permissions after grant permission * @tc.type: FUNC * @tc.require: AR000F4FSI */ -HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_134, Function | MediumTest | Level2) +HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_5800, Function | MediumTest | Level2) { SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, SYS_PERM_NUM, FIRST_INSTALL); g_interface->GrantPermission(TEST_APP_ID, g_systemPers[0].name); @@ -261,12 +261,12 @@ HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_134, Function | MediumTest | Lev } /* - * @tc.name: testSecPMPMS_135 + * @tc.name: SUB_SEC_AppSEC_PermissionMgmt_PMS_5900 * @tc.desc: revoke runtime permissions continuously * @tc.type: FUNC * @tc.require: AR000F4FSI */ -HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_135, Function | MediumTest | Level2) +HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_5900, Function | MediumTest | Level2) { SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, SYS_PERM_NUM, FIRST_INSTALL); LoadPermissions(TEST_APP_ID, TEST_TASKID); @@ -285,24 +285,24 @@ HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_135, Function | MediumTest | Lev } /* - * @tc.name: testSecPMPMS_136 + * @tc.name: SUB_SEC_AppSEC_PermissionMgmt_PMS_6000 * @tc.desc: revoke permissions of unnormal task * @tc.type: FUNC * @tc.require: AR000F4FSI */ -HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_136, Function | MediumTest | Level3) +HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_6000, Function | MediumTest | Level3) { int ret = g_interface->RevokeRuntimePermission(ABNORMAL_TASKID, g_systemPers[0].name); EXPECT_EQ(ret, PERM_ERRORCODE_TASKID_NOT_EXIST) << "revoke ret = " << ret << endl; } /* - * @tc.name: testSecPMPMS_137 + * @tc.name: SUB_SEC_AppSEC_PermissionMgmt_PMS_6100 * @tc.desc: revoke permissions of unnormal permission * @tc.type: FUNC * @tc.require: AR000F4FSI */ -HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_137, Function | MediumTest | Level4) +HWTEST_F(ActsPMSRevokeRuntimeTest, testSecPMPMS_6100, Function | MediumTest | Level4) { SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, SYS_PERM_NUM, FIRST_INSTALL); LoadPermissions(TEST_APP_ID, TEST_TASKID); diff --git a/security_lite/permission_posix/pms/src/ActsPMSUpdatePermissionTest.cpp b/security_lite/permission_posix/pms/src/ActsPMSUpdatePermissionTest.cpp index 143970fd20c9ba28c4869ff4c7cfd01f8f863f50..fbd170bf347f6fd2e8f8475d165930a1626d7ee8 100644 --- a/security_lite/permission_posix/pms/src/ActsPMSUpdatePermissionTest.cpp +++ b/security_lite/permission_posix/pms/src/ActsPMSUpdatePermissionTest.cpp @@ -98,11 +98,11 @@ long GetCurrentTimeMillis() } /** - * @tc.number Security_AppSecurity_PermissionManager_L1_UpdatePermissionFlags_001 + * @tc.number SUB_SEC_AppSEC_PermissionMgmt_PMS_6200 * @tc.name Update permission flags * @tc.desc [C- SECURITY -1000] */ -HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_001, Function | MediumTest | Level2) +HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_6200, Function | MediumTest | Level2) { SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, SYS_PERM_NUM, FIRST_INSTALL); @@ -130,11 +130,11 @@ HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_001, Function | Med } /** - * @tc.number Security_AppSecurity_PermissionManager_L1_UpdatePermissionFlags_002 + * @tc.number SUB_SEC_AppSEC_PermissionMgmt_PMS_6300 * @tc.name Update permission flags (No reminds after rejection) * @tc.desc [C- SECURITY -1000] */ -HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_002, Function | MediumTest | Level2) +HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_6300, Function | MediumTest | Level2) { SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, SYS_PERM_NUM, FIRST_INSTALL); @@ -162,11 +162,11 @@ HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_002, Function | Med } /** - * @tc.number Security_AppSecurity_PermissionManager_L1_UpdatePermissionFlags_003 + * @tc.number SUB_SEC_AppSEC_PermissionMgmt_PMS_6400 * @tc.name Update permission flags (Name does not exist) * @tc.desc [C- SECURITY -1000] */ -HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_003, Function | MediumTest | Level2) +HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_6400, Function | MediumTest | Level2) { SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, SYS_PERM_NUM, FIRST_INSTALL); @@ -199,11 +199,11 @@ HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_003, Function | Med } /** - * @tc.number Security_AppSecurity_PermissionManager_L1_UpdatePermissionFlags_004 + * @tc.number SUB_SEC_AppSEC_PermissionMgmt_PMS_6500 * @tc.name Update permission flags (Name empty) * @tc.desc [C- SECURITY -1000] */ -HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_004, Function | MediumTest | Level2) +HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_6500, Function | MediumTest | Level2) { SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, SYS_PERM_NUM, FIRST_INSTALL); @@ -236,11 +236,11 @@ HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_004, Function | Med } /** - * @tc.number Security_AppSecurity_PermissionManager_L1_UpdatePermissionFlags_005 + * @tc.number SUB_SEC_AppSEC_PermissionMgmt_PMS_6600 * @tc.name Update permission flags (Name invalid) * @tc.desc [C- SECURITY -1000] */ -HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_005, Function | MediumTest | Level2) +HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_6600, Function | MediumTest | Level2) { SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, SYS_PERM_NUM, FIRST_INSTALL); @@ -269,11 +269,11 @@ HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_005, Function | Med } /** - * @tc.number Security_AppSecurity_PermissionManager_L1_UpdatePermissionFlags_006 + * @tc.number SUB_SEC_AppSEC_PermissionMgmt_PMS_6700 * @tc.name Updatepermissionflags interface stability test * @tc.desc [C- SECURITY -1000] */ -HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_006, Function | MediumTest | Level2) +HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_6700, Function | MediumTest | Level2) { SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, SYS_PERM_NUM, FIRST_INSTALL); @@ -302,11 +302,11 @@ HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_006, Function | Med } /** - * @tc.number Security_AppSecurity_PermissionManager_L1_UpdatePermissionFlags_007 + * @tc.number SUB_SEC_AppSEC_PermissionMgmt_PMS_6800 * @tc.name Updatepermissionflags interface performace test * @tc.desc [C- SECURITY -1000] */ -HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_007, Function | MediumTest | Level2) +HWTEST_F(ActsPMSUpdatePermissionTest, testSecPMUpdatePMFlags_6800, Function | MediumTest | Level2) { SaveOrUpdatePermissions(TEST_APP_ID, g_systemPers, SYS_PERM_NUM, FIRST_INSTALL); diff --git a/sensors/miscdevice_standard/BUILD.gn b/sensors/miscdevice_standard/BUILD.gn index 380553eae31005ced23769f0e0e7a777d86bf771..501116046cdab9603a7587da830eb0c79ab66794 100644 --- a/sensors/miscdevice_standard/BUILD.gn +++ b/sensors/miscdevice_standard/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/sensors/miscdevice_standard/src/main/config.json b/sensors/miscdevice_standard/src/main/config.json index 4cf12423e5db61b8b000222120399f9d1b1f1fc3..820d4df5125457ee414593f9890610d6b46f5026 100644 --- a/sensors/miscdevice_standard/src/main/config.json +++ b/sensors/miscdevice_standard/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.sensors.sensor.function", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/sensors/miscdevice_standard/src/main/js/test/List.test.js b/sensors/miscdevice_standard/src/main/js/test/List.test.js index 9357dee4851f9fe39e739889a31a94d1fc75cb91..b50f4c61a7dbce6ef5daea2c591e61ca4fc39cbd 100644 --- a/sensors/miscdevice_standard/src/main/js/test/List.test.js +++ b/sensors/miscdevice_standard/src/main/js/test/List.test.js @@ -14,7 +14,9 @@ */ import VibratorJsTest_misc_1 from './Vibrator_old.test.js' import VibratorJsTest_misc_2 from './Vibrator_new.test.js' +import VibratorJsTest_misc_3 from './Vibrator_newSupplement.test.js' export default function testsuite() { VibratorJsTest_misc_1() VibratorJsTest_misc_2() + VibratorJsTest_misc_3() } diff --git a/sensors/miscdevice_standard/src/main/js/test/Vibrator_new.test.js b/sensors/miscdevice_standard/src/main/js/test/Vibrator_new.test.js index aabb6596342d7e31d55435269aa6fa81b4f854ab..917d2f03551a3b74dfc27e12ef0799f02a1e62ab 100644 --- a/sensors/miscdevice_standard/src/main/js/test/Vibrator_new.test.js +++ b/sensors/miscdevice_standard/src/main/js/test/Vibrator_new.test.js @@ -50,6 +50,14 @@ describe("VibratorJsTest_misc_2", function () { console.info('afterEach caled') }) + const OPERATION_FAIL_CODE = 14600101; + const PERMISSION_ERROR_CODE = 201; + const PARAMETER_ERROR_CODE = 401; + + const OPERATION_FAIL_MSG = 'Device operation failed.' + const PERMISSION_ERROR_MSG = 'Permission denied.' + const PARAMETER_ERROR_MSG = 'The parameter invalid.' + /* * @tc.name:VibratorJsTest001 * @tc.desc:Verification results of the incorrect parameters of the test interface. @@ -277,19 +285,26 @@ describe("VibratorJsTest_misc_2", function () { * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0100 */ it("VibratorJsTest010", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { - function vibrateCallback(error) { - if (error) { - console.info('VibratorJsTest010 stop success'); - expect(true).assertTrue(); - } else { - console.info('VibratorJsTest010 stop off'); - expect(false).assertTrue(); + try { + function vibrateCallback(error) { + if (error) { + console.info('VibratorJsTest010 stop success'); + expect(true).assertTrue(); + } else { + console.info('VibratorJsTest010 stop off'); + expect(false).assertTrue(); + } + setTimeout(() => { + done(); + }, 500); } - setTimeout(() => { - done(); - }, 500); + vibrator.stop("", vibrateCallback); + } catch (error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); } - vibrator.stop("", vibrateCallback); }) /* @@ -381,16 +396,16 @@ describe("VibratorJsTest_misc_2", function () { * @tc.desc:Verification results of the incorrect parameters of the test interface. * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0150 */ - it("VibratorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { - vibrator.vibrate("").then(() => { - console.log("VibratorJsTest015 vibrate error"); - expect(false).assertTrue(); + it("VibratorJsTest015", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + vibrator.stop("preset").then(() => { + console.log("VibratorJsTest015 off success"); + expect(true).assertTrue(); setTimeout(() => { done(); }, 500); }, (error) => { - expect(true).assertTrue(); - console.log("VibratorJsTest015 vibrate success"); + expect(false).assertTrue(); + console.log("VibratorJsTest015 off error"); setTimeout(() => { done(); }, 500); @@ -403,19 +418,26 @@ describe("VibratorJsTest_misc_2", function () { * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0160 */ it("VibratorJsTest016", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { - vibrator.stop("").then(() => { - console.log("VibratorJsTest016 stop error"); - expect(false).assertTrue(); - setTimeout(() => { - done(); - }, 500); - }, (error) => { - expect(true).assertTrue(); - console.log("VibratorJsTest016 stop success"); - setTimeout(() => { - done(); - }, 500); - }); + try { + vibrator.stop("").then(() => { + console.log("VibratorJsTest016 stop error"); + expect(false).assertTrue(); + setTimeout(() => { + done(); + }, 500); + }, (error) => { + expect(true).assertTrue(); + console.log("VibratorJsTest016 stop success"); + setTimeout(() => { + done(); + }, 500); + }); + } catch (error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } }) /* @@ -424,15 +446,15 @@ describe("VibratorJsTest_misc_2", function () { * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0170 */ it("VibratorJsTest017", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { - vibrator.stop("preset").then(() => { - console.log("VibratorJsTest017 off success"); - expect(true).assertTrue(); + vibrator.vibrate("").then(() => { + console.log("VibratorJsTest017 vibrate error"); + expect(false).assertTrue(); setTimeout(() => { done(); }, 500); }, (error) => { - expect(false).assertTrue(); - console.log("VibratorJsTest017 off error"); + expect(true).assertTrue(); + console.log("VibratorJsTest017 vibrate success"); setTimeout(() => { done(); }, 500); 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 new file mode 100644 index 0000000000000000000000000000000000000000..3518811a949529c3f5a238df4d333a6ab7e002ab --- /dev/null +++ b/sensors/miscdevice_standard/src/main/js/test/Vibrator_newSupplement.test.js @@ -0,0 +1,952 @@ +/* + * 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 vibrator from '@ohos.vibrator' + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium' + +export default function VibratorJsTest_misc_3() { +describe("VibratorJsTest_misc_3", function () { + beforeAll(function () { + + /* + * @tc.setup: setup invoked before all testcases + */ + console.info('beforeAll caled') + }) + + afterAll(function () { + + /* + * @tc.teardown: teardown invoked after all testcases + */ + console.info('afterAll caled') + }) + + beforeEach(function () { + + /* + * @tc.setup: setup invoked before each testcases + */ + console.info('beforeEach caled') + }) + + afterEach(function () { + + /* + * @tc.teardown: teardown invoked after each testcases + */ + console.info('afterEach caled') + vibrator.stop("preset"); + vibrator.stop("time"); + console.info('afterEach called') + }) + + const OPERATION_FAIL_CODE = 14600101; + const PERMISSION_ERROR_CODE = 201; + const PARAMETER_ERROR_CODE = 401; + + const OPERATION_FAIL_MSG = 'Device operation failed.' + const PERMISSION_ERROR_MSG = 'Permission denied.' + const PARAMETER_ERROR_MSG = 'The parameter invalid.' + + /* + * @tc.name:VibratorJsTest019 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0290 + */ + it("VibratorJsTest019", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { + vibrator.vibrate({ + type: "time", + duration: 1000 + }, { + usage: "unknown" + }, (error)=>{ + if (error) { + console.info('VibratorJsTest019 vibrator error'); + expect(false).assertTrue(); + } else { + console.info('VibratorJsTest019 vibrator success'); + expect(true).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + }) + + /* + * @tc.name:VibratorJsTest020 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0300 + */ + it("VibratorJsTest020", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + try { + vibrator.vibrate({ + type: "", + duration: 1000 + }, { + usage: "unknown" + }, (error)=>{ + if (error) { + expect(true).assertTrue(); + } else { + expect(false).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + } catch (error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + }) + + /* + * @tc.name:VibratorJsTest021 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0310 + */ + it("VibratorJsTest021", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + vibrator.vibrate({ + type: "preset", + effectId: "haptic.clock.timer", + count: 1, + }, { + usage: "unknown" + }, (error)=>{ + if (error) { + console.info('VibratorJsTest021 vibrator error'); + expect(false).assertTrue(); + } else { + console.info('VibratorJsTest021 vibrator success'); + expect(true).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + }) + + /* + * @tc.name:VibratorJsTest022 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0320 + */ + it("VibratorJsTest022", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + try { + vibrator.vibrate({ + type: "preset", + effectId: "", + count: 3, + }, { + usage: "unknown" + }, (error)=>{ + if (error) { + expect(true).assertTrue(); + } else { + expect(false).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + } catch (error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + + }) + + /* + * @tc.name:VibratorJsTest023 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0330 + */ + it("VibratorJsTest023", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + try { + vibrator.vibrate({ + type: "preset", + effectId: "haptic.clock.timer", + count: 3, + }, { + usage: "" + }, (error)=>{ + if (error) { + expect(true).assertTrue(); + } else { + expect(false).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + } catch (error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + + }) + + /* + * @tc.name:VibratorJsTest024 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0340 + */ + it("VibratorJsTest024", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + try { + vibrator.vibrate(null, null); + } catch (error) { + console.info(error); + expect(true).assertTrue(); + done(); + } + }) + + /* + * @tc.name:VibratorJsTest025 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0350 + */ + it("VibratorJsTest025", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + await vibrator.vibrate({ + type: "time", + duration: 1000, + }, { + usage: "unknown" + }).then(()=>{ + expect(true).assertTrue(); + }).catch((error)=>{ + expect(false).assertTrue(); + }); + done(); + }) + + /* + * @tc.name:VibratorJsTest026 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0360 + */ + it("VibratorJsTest026", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + try { + await vibrator.vibrate({ + type: "", + duration: 1000 + }, { + usage: "unknown" + }).then(()=>{ + expect(false).assertTrue(); + }).catch((error)=>{ + expect(true).assertTrue(); + }); + done(); + } catch (error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + }) + + /* + * @tc.name:VibratorJsTest027 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0370 + */ + it("VibratorJsTest027", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + await vibrator.vibrate({ + type: "preset", + effectId: "haptic.clock.timer", + count: 1, + }, { + usage: "unknown" + }).then(()=>{ + expect(true).assertTrue(); + }).catch((error)=>{ + expect(false).assertTrue(); + }); + done(); + }) + + /* + * @tc.name:VibratorJsTest028 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0380 + */ + it("VibratorJsTest028", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + try { + vibrator.vibrate({ + type: "preset", + effectId: "", + count: 3, + }, { + usage: "unknown" + }).then(()=>{ + expect(false).assertTrue(); + done(); + }).catch((error)=>{ + expect(true).assertTrue(); + done(); + }); + } catch (error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + }) + + /* + * @tc.name:VibratorJsTest029 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0390 + */ + it("VibratorJsTest029", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + try { + vibrator.vibrate({ + type: "preset", + effectId: "haptic.clock.timer", + count: 3, + }, { + usage: "" + }).then(()=>{ + expect(false).assertTrue(); + done(); + }).catch((error)=>{ + expect(true).assertTrue(); + done(); + }); + } catch (error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + }) + + /* + * @tc.name:VibratorJsTest030 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0400 + */ + it("VibratorJsTest030", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + try { + vibrator.vibrate({ + type: 1, + count: 3, + }, { + usage: "" + }) + } catch (error) { + console.info(error); + expect(true).assertTrue(); + done(); + } + }) + + /* + * @tc.name:VibratorJsTest031 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0410 + */ + it("VibratorJsTest031", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + function vibratePromise() { + return new Promise((resolve, reject) => { + vibrator.vibrate({ + type: "time", + duration: 100 + }, { + usage: "unknown" + }, (error)=>{ + if (error) { + expect(false).assertTrue(); + } else { + expect(true).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + }) + } + + let promise = new Promise((resolve, reject) => { + vibrator.vibrate({ + type: "time", + duration: 100 + }, { + usage: "unknown" + }, (error)=>{ + if (error) { + expect(false).assertTrue(); + reject(); + } else { + expect(true).assertTrue(); + resolve(); + } + }); + }) + + await promise.then(() =>{ + return vibratePromise(); + }, ()=>{ + console.info("VibratorJsTest031 reject"); + }) + done(); + }) + + /* + * @tc.name:VibratorJsTest032 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0420 + */ + it("VibratorJsTest032", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + function vibratePromise() { + return new Promise((resolve, reject) => { + vibrator.vibrate({ + type: "preset", + effectId: "haptic.clock.timer", + count: 1, + }, { + usage: "unknown" + }, (error)=>{ + if (error) { + expect(true).assertTrue(); + } else { + expect(false).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + }) + } + + let promise = new Promise((resolve, reject) => { + vibrator.vibrate({ + type: "time", + duration: 100 + }, { + usage: "alarm" + }, (error)=>{ + if (error) { + expect(false).assertTrue(); + reject(); + } else { + expect(true).assertTrue(); + resolve(); + } + }); + }) + + await promise.then(() =>{ + return vibratePromise(); + }, ()=>{ + console.info("VibratorJsTest032 reject"); + }) + done(); + }) + + /* + * @tc.name:VibratorJsTest033 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0430 + */ + it("VibratorJsTest033", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + function vibratePromise() { + return new Promise((resolve, reject) => { + vibrator.vibrate({ + type: "preset", + effectId: "haptic.clock.timer", + count: 3, + }, { + usage: "unknown", + }, (error)=>{ + if (error) { + console.info("VibratorJsTest033 success"); + expect(false).assertTrue(); + } else { + expect(true).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + }) + } + + let promise = new Promise((resolve, reject) => { + vibrator.vibrate({ + type: "time", + duration: 10000 + }, { + usage: "alarm" + }, (error)=>{ + if (error) { + expect(false).assertTrue(); + reject(); + } else { + expect(true).assertTrue(); + resolve(); + } + }); + }) + await promise.then(() =>{ + return vibratePromise(); + }, ()=>{ + console.info("VibratorJsTest033 reject"); + }) + done(); + }) + + /* + * @tc.name:VibratorJsTest034 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0440 + */ + it("VibratorJsTest034", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + function vibratePromise() { + return new Promise((resolve, reject) => { + vibrator.vibrate({ + type: "preset", + effectId: "haptic.clock.timer", + count: 1, + }, { + usage: "unknown", + }, (error)=>{ + if (error) { + expect(true).assertTrue(); + } else { + expect(false).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + }) + } + + let promise = new Promise((resolve, reject) => { + vibrator.vibrate({ + type: "preset", + effectId: "haptic.clock.timer", + count: 3, + }, { + usage: "unknown", + }, (error)=>{ + if (error) { + expect(false).assertTrue(); + reject(); + } else { + expect(true).assertTrue(); + resolve(); + } + }); + }) + + await promise.then(() =>{ + return vibratePromise(); + }, ()=>{ + console.info("VibratorJsTest034 reject"); + }) + done(); + }) + + /* + * @tc.name:VibratorJsTest035 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0450 + */ + it("VibratorJsTest035", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + function vibratePromise() { + return new Promise((resolve, reject) => { + vibrator.vibrate({ + type: "time", + duration: 3000, + }, { + usage: "alarm" + }, (error)=>{ + if (error) { + expect(true).assertTrue(); + } else { + expect(false).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + }) + } + + let promise = new Promise((resolve, reject) => { + vibrator.vibrate({ + type: "preset", + effectId: "haptic.clock.timer", + count: 3, + }, { + usage: "unknown" + }, (error)=>{ + if (error) { + expect(false).assertTrue(); + reject(); + } else { + expect(true).assertTrue(); + resolve(); + } + }); + }) + + await promise.then(() =>{ + return vibratePromise(); + }, ()=>{ + console.info("VibratorJsTest035 reject"); + }) + done(); + }) + + /* + * @tc.name:VibratorJsTest036 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0460 + */ + it("VibratorJsTest036", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + function vibratePromise() { + return new Promise((resolve, reject) => { + vibrator.vibrate({ + type: "time", + duration: 3000, + }, { + usage: "alarm" + }, (error)=>{ + if (error) { + expect(false).assertTrue(); + } else { + expect(true).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + }) + } + + let promise = new Promise((resolve, reject) => { + vibrator.vibrate({ + type: "preset", + effectId: "haptic.clock.timer", + count: 1, + }, { + usage: "unknown" + }, (error)=>{ + if (error) { + expect(false).assertTrue(); + reject(); + } else { + expect(true).assertTrue(); + resolve(); + } + }); + }) + + await promise.then(() =>{ + return vibratePromise(); + }, ()=>{ + console.info("VibratorJsTest036 reject"); + }) + done(); + }) + + /* + * @tc.name:VibratorJsTest037 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0470 + */ + it("VibratorJsTest037", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + function vibratePromise() { + return new Promise((resolve, reject) => { + vibrator.vibrate({ + type: "preset", + effectId: "haptic.clock.timer", + count: 3, + }, { + usage: "unknown" + }, (error)=>{ + if (error) { + expect(false).assertTrue(); + } else { + expect(true).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + }) + } + + let promise = new Promise((resolve, reject) => { + vibrator.vibrate({ + type: "preset", + effectId: "haptic.clock.timer", + count: 3, + }, { + usage: "unknown" + }, (error)=>{ + if (error) { + expect(false).assertTrue(); + reject(); + } else { + expect(true).assertTrue(); + resolve(); + } + }); + }) + + await promise.then(() =>{ + return vibratePromise(); + }, ()=>{ + console.info("VibratorJsTest037 reject"); + }) + done(); + }) + + /* + * @tc.name:VibratorJsTest038 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0480 + */ + it("VibratorJsTest038", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + function vibratePromise() { + return new Promise((resolve, reject) => { + vibrator.vibrate({ + type: "preset", + effectId: "haptic.clock.timer", + count: 1, + }, { + usage: "ring" + }, (error)=>{ + if (error) { + expect(false).assertTrue(); + } else { + expect(true).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + }) + } + + let promise = new Promise((resolve, reject) => { + vibrator.vibrate({ + type: "preset", + effectId: "haptic.clock.timer", + count: 1, + }, { + usage: "notification" + }, (error)=>{ + if (error) { + expect(false).assertTrue(); + reject(); + } else { + expect(true).assertTrue(); + resolve(); + } + }); + }) + + await promise.then(() =>{ + return vibratePromise(); + }, ()=>{ + console.info("VibratorJsTest038 reject"); + }) + done(); + }) + + /* + * @tc.name:VibratorJsTest039 + * @tc.desc:Verification results of the incorrect parameters of the test interface. + * @tc.number:SUB_SensorSystem_Vibrator_JsTest_0490 + */ + it("VibratorJsTest039", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + function vibratePromise() { + return new Promise((resolve, reject) => { + vibrator.vibrate({ + type: "preset", + effectId: "haptic.clock.timer", + count: 1, + }, { + usage: "unknown" + }, (error)=>{ + if (error) { + expect(true).assertTrue(); + } else { + expect(false).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + }) + } + + let promise = new Promise((resolve, reject) => { + vibrator.vibrate({ + type: "preset", + effectId: "haptic.clock.timer", + count: 1, + }, { + usage: "notification" + }, (error)=>{ + if (error) { + expect(false).assertTrue(); + reject(); + } else { + expect(true).assertTrue(); + resolve(); + } + }); + }) + + await promise.then(() =>{ + return vibratePromise(); + }, ()=>{ + 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) { + try { + vibrator.vibrate({ + type: "", + duration: 1000 + }, { + id:1, + usage: "unknown" + }, (error)=>{ + if (error) { + expect(true).assertTrue(); + } else { + expect(false).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + } catch (error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + }) + + /* + * @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) { + try { + vibrator.vibrate({ + type: "preset", + effectId: "", + count: 3, + }, { + id:null, + usage: "unknown" + }, (error)=>{ + if (error) { + expect(true).assertTrue(); + } else { + expect(false).assertTrue(); + } + setTimeout(()=>{ + done(); + }, 500); + }); + } catch (error) { + console.info(error); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); + done(); + } + + }) + }) + } diff --git a/sensors/miscdevice_standard/src/main/js/test/Vibrator_old.test.js b/sensors/miscdevice_standard/src/main/js/test/Vibrator_old.test.js index 85308bd477fe3362169e138642bf53e231bf1732..5b9ccedda00cc2d945f3f01c43ee5384ad8f7190 100644 --- a/sensors/miscdevice_standard/src/main/js/test/Vibrator_old.test.js +++ b/sensors/miscdevice_standard/src/main/js/test/Vibrator_old.test.js @@ -50,10 +50,13 @@ describe("VibratorJsTest_misc_1", function () { console.info('afterEach caled') }) - let errMessages = ['Param number is invalid', 'Wrong argument type. function expected', - 'Wrong argument type', 'Wrong argument number'] - - let errMessage; + const OPERATION_FAIL_CODE = 14600101; + const PERMISSION_ERROR_CODE = 201; + const PARAMETER_ERROR_CODE = 401; + + const OPERATION_FAIL_MSG = 'Device operation failed.' + const PERMISSION_ERROR_MSG = 'Permission denied.' + const PARAMETER_ERROR_MSG = 'The parameter invalid.' /* * @tc.name:SubVibratorJsTest0001 @@ -194,9 +197,9 @@ describe("VibratorJsTest_misc_1", function () { }, }, 25); } catch (error) { - errMessage = error.toString().slice(39); console.info('SubVibratorJsTest0007 error:' + error); - expect(errMessage).assertEqual(errMessages[0]); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); done(); } }) @@ -243,9 +246,9 @@ describe("VibratorJsTest_misc_1", function () { try { vibrator.vibrate(); } catch (error) { - errMessage = error.toString().slice(7); console.info('SubVibratorJsTest0009 error:' + error); - expect(errMessage).assertEqual(errMessages[2]); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); done(); } }) @@ -268,9 +271,9 @@ describe("VibratorJsTest_misc_1", function () { }, function () { }, 25); } catch (error) { - errMessage = error.toString().slice(39); console.info('SubVibratorJsTest0010 error:' + error); - expect(errMessage).assertEqual(errMessages[3]); + expect(error.code).assertEqual(PARAMETER_ERROR_CODE); + expect(error.message).assertEqual(PARAMETER_ERROR_MSG); done(); } }) diff --git a/sensors/sensor_standard/BUILD.gn b/sensors/sensor_standard/BUILD.gn index 3b384bacb1ee653264457bd962a2165c6f5800eb..9e9afe4c24fd9099aadd91b6a6e9f8c1b3389663 100644 --- a/sensors/sensor_standard/BUILD.gn +++ b/sensors/sensor_standard/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/sensors/sensor_standard/src/main/config.json b/sensors/sensor_standard/src/main/config.json index 5462d04483d0b8c1f87858c044d46a05743a6417..089e07bdb7137637338c396d37f187ec93fbf23d 100644 --- a/sensors/sensor_standard/src/main/config.json +++ b/sensors/sensor_standard/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.sensors.sensor.function", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/sensors/sensor_standard/src/main/js/test/SensorGeneralalgorithm.test.js b/sensors/sensor_standard/src/main/js/test/SensorGeneralalgorithm.test.js index 95328f2163c027f3c4e5311d330b2a90c0096c09..4a687c86afac41d1bc0170b630e93556563d80ed 100644 --- a/sensors/sensor_standard/src/main/js/test/SensorGeneralalgorithm.test.js +++ b/sensors/sensor_standard/src/main/js/test/SensorGeneralalgorithm.test.js @@ -50,6 +50,9 @@ describe("SensorJsTest_sensor_1", function () { console.info('afterEach caled') }) + let PARAMETER_ERROR_CODE = 401 + let PARAMETER_ERROR_MSG = 'The parameter invalid.' + let SENSOR_DATA_MATRIX = [ { "rotation": [-0.7980074882507324, 0.5486301183700562, 0.24937734007835388, -0.17277367413043976, @@ -282,17 +285,24 @@ describe("SensorJsTest_sensor_1", function () { * @tc.number:SUB_SensorsSystem_GeneralAlgorithm_JsTest_0100 */ it('SensorJsTest_077', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { - sensor.getDirection([1, 2, 3, 1, 2, 3, 1, 2, 3, 0]).then((data) => { - for (let i = 0; i < data.length; i++) { - console.info("SensorJsTest_077 failed") + try { + sensor.getDirection([1, 2, 3, 1, 2, 3, 1, 2, 3, 0]).then((data) => { + for (let i = 0; i < data.length; i++) { + console.info("SensorJsTest_077 failed") + expect(false).assertTrue(); + } + done() + }, (error) => { expect(false).assertTrue(); - } - done() - }, (error) => { - expect(true).assertTrue(); - console.info("SensorJsTest_077 success") + console.info("SensorJsTest_077 success") + done() + }) + } catch (err) { + console.info('exception ' + JSON.stringify(err)) + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) done() - }) + } }) let ANGLECHANGE_9_RESULT = [ @@ -652,15 +662,22 @@ describe("SensorJsTest_sensor_1", function () { */ it('SensorJsTest_092', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { console.info('SensorJsTest_092 start') - sensor.createQuaternion([0.25, 0.14], (error, data) => { - if (error) { - console.info('SensorJsTest_092 failed'); - expect(true).assertTrue(); - } else { - expect(false).assertTrue(); - } + try { + sensor.createQuaternion([0.25, 0.14], (error, data) => { + if (error) { + console.info('SensorJsTest_092 failed'); + expect(false).assertTrue(); + } else { + expect(false).assertTrue(); + } + done() + }) + } catch (err) { + console.info('exception ' + JSON.stringify(err)) + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) done() - }) + } console.info("SensorJsTest_092 end") }) @@ -693,15 +710,22 @@ describe("SensorJsTest_sensor_1", function () { */ it('SensorJsTest_094', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { console.info('SensorJsTest_094 start') - sensor.createQuaternion([0, 0]).then((data) => { - console.info('SensorJsTest_094'); - expect(false).assertTrue(); - done() - }, (error) => { - expect(true).assertTrue(); - console.info('promise failed') + try { + sensor.createQuaternion([0, 0]).then((data) => { + console.info('SensorJsTest_094'); + expect(false).assertTrue(); + done() + }, (error) => { + expect(false).assertTrue(); + console.info('promise failed') + done() + }) + } catch (err) { + console.info('exception ' + JSON.stringify(err)) + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) done() - }) + } console.info("SensorJsTest_094 end") }) @@ -755,15 +779,22 @@ describe("SensorJsTest_sensor_1", function () { */ it('SensorJsTest_097', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { console.info('SensorJsTest_097 start') - sensor.createQuaternion([0.25, 0.14]).then((data) => { - console.info('SensorJsTest_097'); - expect(false).assertTrue(); - done() - }, (error) => { - expect(true).assertTrue(); - console.info('promise failed') + try { + sensor.createQuaternion([0.25, 0.14]).then((data) => { + console.info('SensorJsTest_097'); + expect(false).assertTrue(); + done() + }, (error) => { + expect(false).assertTrue(); + console.info('promise failed') + done() + }) + } catch (err) { + console.info('exception ' + JSON.stringify(err)) + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) done() - }) + } }) let createRotationMatrixResult = [ @@ -866,16 +897,23 @@ describe("SensorJsTest_sensor_1", function () { */ it('SensorJsTest_102', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { console.info('SensorJsTest_102 start') - sensor.getGeomagneticDip([1, 2, 3, 4], (error, data) => { - if (error) { - console.info('SensorJsTest_102 success'); - expect(true).assertTrue(); - } else { - console.info("SensorJsTest_102 failed") - expect(false).assertTrue(); - } + try { + sensor.getGeomagneticDip([1, 2, 3, 4], (error, data) => { + if (error) { + console.info('SensorJsTest_102 success'); + expect(true).assertTrue(); + } else { + console.info("SensorJsTest_102 failed") + expect(false).assertTrue(); + } + done() + }) + } catch (err) { + console.info('exception ' + JSON.stringify(err)) + expect(err.code).assertEqual(PARAMETER_ERROR_CODE) + expect(err.message).assertEqual(PARAMETER_ERROR_MSG) done() - }) + } console.info("SensorJsTest_102 end") }) diff --git a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test.js b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test.js index 41d0b8a1afc822116ab1bb2ab847b220edc9bbec..e95426f8895ca4744df73ec6fa5fb4654b8429b0 100644 --- a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test.js +++ b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test.js @@ -18,17 +18,6 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect, TestType, Size, Level } from '@ohos/hypium' import sensor from '@ohos.sensor' -function sleep(NumberMillis) { - let now = new Date() - let exitTime = now.getTime() + NumberMillis - while (true) { - now = new Date() - if (now.getTime > exitTime) { - return - } - } -} - export default function SystemParameterTest() { describe('SystemParameterTest', function () { beforeAll(function () { @@ -47,19 +36,21 @@ describe('SystemParameterTest', function () { console.info('afterEach caled') }) - let testSensorId = 0; let testNullSensorId = -1; + let errCode = 401 + let errMessage = 'The parameter invalid.' + /** * @tc.number SUB_SENSORS_Sensor_JSTest_0020 - * @tc.name testRegisterSensortest002 + * @tc.name testRegisterSensortest001 * @tc.desc test get sensor data by wrong sensor id. */ - it('SUB_SENSORS_Sensor_JSTest_0020', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { - console.info('SUB_SENSORS_Sensor_JSTest_0020 start'); + it('testRegisterSensortest001', TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL3, async function (done) { + console.info('testRegisterSensortest001 start'); function onSensorCallback(data) { - console.info('SensorJsTest002 on error'); + console.info('testRegisterSensortest001 callback in'); expect(false).assertTrue(); done(); } @@ -67,10 +58,11 @@ describe('SystemParameterTest', function () { try { sensor.on(testNullSensorId, onSensorCallback); } catch (error) { - console.info(error); - expect(true).assertTrue(); + console.info('testRegisterSensortest001 error: ' + error.code + ' ,msg: ' + error.message); + expect(error.code).assertEqual(errCode) + expect(error.message).assertEqual(errMessage) done(); } - console.info('SUB_SENSORS_Sensor_JSTest_0020 end'); + console.info('testRegisterSensortest001 end'); }) })} diff --git a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_GetSensorLists.js b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_GetSensorLists.js index b5d2cf67a3064d43801a3d184eb4e2c66d0c650b..12011d8f86a7e00b2b65a137be095f19a41af332 100644 --- a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_GetSensorLists.js +++ b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_GetSensorLists.js @@ -65,7 +65,6 @@ describe("SensorJsTest_sensor_35", function () { it("getSensorLists_SensorJsTest001", TestType.FUNCTION | Size.MEDIUMTEST | Level.LEVEL0, async function (done) { console.info("---------------------------getSensorLists_SensorJsTest001----------------------------------"); sensor.getSensorList().then((data) => { - console.info("---------------------------getSensorLists_SensorJsTest001 in-----------" + data.length); for (let i = 0; i < data.length; i++) { console.info("getSensorLists_SensorJsTest001 " + JSON.stringify(data[i])); } @@ -88,7 +87,6 @@ it("getSensorLists_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level console.info('getSensorLists_SensorJsTest002 error'); expect(false).assertTrue(); } else { - console.info("---------------------------getSensorLists_SensorJsTest002 in-----------" + data.length); for (let i = 0; i < data.length; i++) { console.info("getSensorLists_SensorJsTest002 " + JSON.stringify(data[i])); } @@ -164,7 +162,6 @@ it("getSensorLists_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level expect(true).assertTrue(); done() } else { - console.info("---------------------------getSensorLists_SensorJsTest006 in-----------" + data.length); for (let i = 0; i < data.length; i++) { console.info("getSensorLists_SensorJsTest006 " + JSON.stringify(data[i])); } @@ -177,7 +174,6 @@ it("getSensorLists_SensorJsTest002", TestType.FUNCTION | Size.MEDIUMTEST | Level expect(true).assertTrue(); done() } else { - console.info("---------------------------getSensorLists_SensorJsTest006 in-----------" + data.length); for (let i = 0; i < data.length; i++) { console.info("getSensorLists_SensorJsTest006 " + JSON.stringify(data[i])); } diff --git a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_Gravity.js b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_Gravity.js index 032c40bca4059bf8fd8172c21d06890c15b44960..d70bd73b8789b3a64e40600011121ba81ef36cb4 100644 --- a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_Gravity.js +++ b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_Gravity.js @@ -23,6 +23,7 @@ describe("SensorJsTest_sensor_9", function () { expect(typeof(data.x)).assertEqual("number"); expect(typeof(data.y)).assertEqual("number"); expect(typeof(data.z)).assertEqual("number"); + expect(typeof (data.timestamp)).assertEqual("number"); } function callback2(data) { @@ -30,6 +31,7 @@ describe("SensorJsTest_sensor_9", function () { expect(typeof(data.x)).assertEqual("number"); expect(typeof(data.y)).assertEqual("number"); expect(typeof(data.z)).assertEqual("number"); + expect(typeof (data.timestamp)).assertEqual("number"); } beforeAll(function () { @@ -237,7 +239,11 @@ describe("SensorJsTest_sensor_9", function () { sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback2); setTimeout(()=>{ console.info('----------------------gravity_SensorJsTest010 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback); + try { + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback); + } catch (error) { + console.info("gravity_SensorJsTest010 error:" + error); + } console.info('----------------------gravity_SensorJsTest010 off end---------------------------'); }, 500); setTimeout(()=>{ @@ -276,7 +282,11 @@ describe("SensorJsTest_sensor_9", function () { sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback2, {'interval': 100000000}); setTimeout(()=>{ console.info('----------------------gravity_SensorJsTest012 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback); + try { + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY, callback); + } catch (error) { + console.info("gravity_SensorJsTest012 error:" + error); + } console.info('----------------------gravity_SensorJsTest012 off end---------------------------'); }, 500); setTimeout(()=>{ diff --git a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_MagneticField.js b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_MagneticField.js index 02c92b451cfc73f9ee1a07386af12bb4f6be46cb..df64e9da46a48e7dc97df1002bcc15ddeb2ca548 100644 --- a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_MagneticField.js +++ b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_MagneticField.js @@ -23,6 +23,7 @@ describe("SensorJsTest_sensor_15", function () { expect(typeof(data.x)).assertEqual("number"); expect(typeof(data.y)).assertEqual("number"); expect(typeof(data.z)).assertEqual("number"); + expect(typeof (data.timestamp)).assertEqual("number"); } function callback2(data) { @@ -30,6 +31,7 @@ describe("SensorJsTest_sensor_15", function () { expect(typeof(data.x)).assertEqual("number"); expect(typeof(data.y)).assertEqual("number"); expect(typeof(data.z)).assertEqual("number"); + expect(typeof (data.timestamp)).assertEqual("number"); } beforeAll(function() { @@ -145,7 +147,7 @@ describe("SensorJsTest_sensor_15", function () { expect(false).assertTrue(); done(); } - try{ + try { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, onceSensorCallback, 5); } catch (error) { console.info('magnetic_SensorJsTest005 error' +error); @@ -237,7 +239,11 @@ describe("SensorJsTest_sensor_15", function () { sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback2); setTimeout(()=>{ console.info('----------------------magnetic_SensorJsTest010 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback); + try{ + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback); + } catch (error) { + console.info("magnetic_SensorJsTest010 error:" + error); + } console.info('----------------------magnetic_SensorJsTest010 off end---------------------------'); }, 500); setTimeout(()=>{ @@ -276,7 +282,11 @@ describe("SensorJsTest_sensor_15", function () { sensor.on(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback2, {'interval': 100000000}); setTimeout(()=>{ console.info('----------------------magnetic_SensorJsTest012 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback); + try { + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback); + } catch (error) { + console.info("magnetic_SensorJsTest012 error:" + error); + } console.info('----------------------magnetic_SensorJsTest012 off end---------------------------'); }, 500); setTimeout(()=>{ diff --git a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_Orientating.js b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_Orientating.js index 37a4fb9aabce747d9b6533bacd398e74098f3206..5f3a77ca750120cd58d512ef50db411dc72a54f2 100644 --- a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_Orientating.js +++ b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_Orientating.js @@ -23,6 +23,7 @@ describe("SensorJsTest_sensor_16", function () { expect(typeof(data.beta)).assertEqual("number"); expect(typeof(data.gamma)).assertEqual("number"); expect(typeof(data.alpha)).assertEqual("number"); + expect(typeof (data.timestamp)).assertEqual("number"); } function callback2(data) { @@ -30,6 +31,7 @@ describe("SensorJsTest_sensor_16", function () { expect(typeof(data.beta)).assertEqual("number"); expect(typeof(data.gamma)).assertEqual("number"); expect(typeof(data.alpha)).assertEqual("number"); + expect(typeof (data.timestamp)).assertEqual("number"); } beforeAll(function () { @@ -145,7 +147,7 @@ describe("SensorJsTest_sensor_16", function () { expect(false).assertTrue(); done(); } - try{ + try { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, onceSensorCallback, 5); } catch (error) { console.info('orientating_SensorJsTest005 error' + error); @@ -237,7 +239,11 @@ describe("SensorJsTest_sensor_16", function () { sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback2); setTimeout(()=>{ console.info('----------------------orientating_SensorJsTest010 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback); + try { + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback); + } catch (error) { + console.info("orientating_SensorJsTest010 error:" + error); + } console.info('----------------------orientating_SensorJsTest010 off end---------------------------'); }, 500); setTimeout(()=>{ @@ -276,7 +282,11 @@ describe("SensorJsTest_sensor_16", function () { sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback2, {'interval': 100000000}); setTimeout(()=>{ console.info('----------------------orientating_SensorJsTest012 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback); + try { + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ORIENTATION, callback); + } catch (error) { + console.info("orientating_SensorJsTest012 error:" + error); + } console.info('----------------------orientating_SensorJsTest012 off end---------------------------'); }, 500); setTimeout(()=>{ diff --git a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_RotatingVector.js b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_RotatingVector.js index 436fee7f0956d597bae3dece9a55cf2317bd9897..6947a3528358db928a57eb73e0f9b6e7e3e583d3 100644 --- a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_RotatingVector.js +++ b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest.test_RotatingVector.js @@ -24,6 +24,7 @@ describe("SensorJsTest_sensor_20", function () { expect(typeof(data.y)).assertEqual("number"); expect(typeof(data.z)).assertEqual("number"); expect(typeof(data.w)).assertEqual("number"); + expect(typeof (data.timestamp)).assertEqual("number"); } function callback2(data) { @@ -32,6 +33,7 @@ describe("SensorJsTest_sensor_20", function () { expect(typeof(data.y)).assertEqual("number"); expect(typeof(data.z)).assertEqual("number"); expect(typeof(data.w)).assertEqual("number"); + expect(typeof (data.timestamp)).assertEqual("number"); } beforeAll(function() { @@ -147,7 +149,7 @@ describe("SensorJsTest_sensor_20", function () { expect(false).assertTrue(); done(); } - try{ + try { sensor.once(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, onceSensorCallback, 5); } catch (error) { console.info('rotatingvector_SensorJsTest005 error' +error); @@ -239,7 +241,11 @@ describe("SensorJsTest_sensor_20", function () { sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback2); setTimeout(()=>{ console.info('----------------------rotatingvector_SensorJsTest010 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback); + try { + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback); + } catch (error) { + console.info("rotatingvector_SensorJsTest010 error:" + error); + } console.info('----------------------rotatingvector_SensorJsTest010 off end---------------------------'); }, 500); setTimeout(()=>{ @@ -278,7 +284,11 @@ describe("SensorJsTest_sensor_20", function () { sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback2, {'interval': 100000000}); setTimeout(()=>{ console.info('----------------------rotatingvector_SensorJsTest012 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback); + try { + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback); + } catch (error) { + console.info("rotatingvector_SensorJsTest012 error:" + error); + } console.info('----------------------rotatingvector_SensorJsTest012 off end---------------------------'); }, 500); setTimeout(()=>{ diff --git a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Accelerometer.js b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Accelerometer.js index b00b7f2ac53ac307eba096d10a5a4246023e99fc..21b71bdd18d3ccfea1e2f806ae612a54fa5c415b 100644 --- a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Accelerometer.js +++ b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Accelerometer.js @@ -22,6 +22,7 @@ describe("SensorJsTest_sensor_3", function () { expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number"); + expect(typeof (data.timestamp)).assertEqual("number"); } function callback2(data) { @@ -29,6 +30,7 @@ describe("SensorJsTest_sensor_3", function () { expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number"); + expect(typeof (data.timestamp)).assertEqual("number"); } beforeAll(function () { @@ -243,7 +245,11 @@ describe("SensorJsTest_sensor_3", function () { sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback2); setTimeout(() => { console.info('----------------------Accelerometer_SensorJsTest010 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback); + try { + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback); + } catch (error) { + console.info("Accelerometer_SensorJsTest010 error:" + error); + } console.info('----------------------Accelerometer_SensorJsTest010 off end---------------------------'); }, 500); setTimeout(() => { @@ -282,7 +288,12 @@ describe("SensorJsTest_sensor_3", function () { sensor.on(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback2, { 'interval': 100000000 }); setTimeout(() => { console.info('----------------------Accelerometer_SensorJsTest012 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback); + try { + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback); + } catch (error) { + console.info("Accelerometer_SensorJsTest012 error:" + error); + } + console console.info('----------------------Accelerometer_SensorJsTest012 off end---------------------------'); }, 500); setTimeout(() => { diff --git a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Ambient_light.js b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Ambient_light.js index 91dae503e89f42485e9810a0da660da4e7332e6e..c9d6c151db621b74323b132beb3134062712e1c5 100644 --- a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Ambient_light.js +++ b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Ambient_light.js @@ -21,11 +21,13 @@ describe("SensorJsTest_sensor_4", function () { function callback(data) { console.info("callback" + JSON.stringify(data)); expect(typeof (data.intensity)).assertEqual("number"); + expect(typeof (data.timestamp)).assertEqual("number"); } function callback2(data) { console.info("callback2" + JSON.stringify(data)); expect(typeof (data.intensity)).assertEqual("number"); + expect(typeof (data.timestamp)).assertEqual("number"); } beforeAll(function () { @@ -244,7 +246,11 @@ describe("SensorJsTest_sensor_4", function () { sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback2); setTimeout(() => { console.info('----------------------Ambient_Light_SensorJsTest010 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback); + try { + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback); + } catch (error) { + console.info("Ambient_Light_SensorJsTest010 error:" + error); + } console.info('----------------------Ambient_Light_SensorJsTest010 off end---------------------------'); }, 1000); setTimeout(() => { @@ -283,7 +289,11 @@ describe("SensorJsTest_sensor_4", function () { sensor.on(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback2, { 'interval': 100000000 }); setTimeout(() => { console.info('----------------------Ambient_Light_SensorJsTest012 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback); + try { + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback); + } catch (error) { + console.info("Ambient_Light_SensorJsTest012 error:" + error); + } console.info('----------------------Ambient_Light_SensorJsTest012 off end---------------------------'); }, 500); setTimeout(() => { diff --git a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_GyroScope.js b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_GyroScope.js index b65424581b0af824a092b62f0cc701cd5011809a..7d132333904fea208fc3293b4f79c878a53ad8df 100644 --- a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_GyroScope.js +++ b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_GyroScope.js @@ -22,6 +22,7 @@ describe("SensorJsTest_sensor_5", function () { expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number"); + expect(typeof (data.timestamp)).assertEqual("number"); } function callback2(data) { @@ -29,6 +30,7 @@ describe("SensorJsTest_sensor_5", function () { expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number"); + expect(typeof (data.timestamp)).assertEqual("number"); } beforeAll(function () { @@ -243,7 +245,11 @@ describe("SensorJsTest_sensor_5", function () { sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback2); setTimeout(() => { console.info('----------------------GYROSCOPE_SensorJsTest010 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback); + try { + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback); + } catch (error) { + console.info("GYROSCOPE_SensorJsTest010 error:" + error); + } console.info('----------------------GYROSCOPE_SensorJsTest010 off end---------------------------'); }, 500); setTimeout(() => { @@ -282,7 +288,11 @@ describe("SensorJsTest_sensor_5", function () { sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback2, { 'interval': 100000000 }); setTimeout(() => { console.info('----------------------GYROSCOPE_SensorJsTest012 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback); + try { + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback); + } catch (error) { + console.info("GYROSCOPE_SensorJsTest012 error:" + error); + } console.info('----------------------GYROSCOPE_SensorJsTest012 off end---------------------------'); }, 500); setTimeout(() => { diff --git a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Hall.js b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Hall.js index 11bf463c879d12c44041de02b489302521e80128..654b12782d6be9dc45fc3f0b22210a71bf778dce 100644 --- a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Hall.js +++ b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Hall.js @@ -20,11 +20,13 @@ describe("SensorJsTest_sensor_7", function () { function callback(data) { console.info("callback" + JSON.stringify(data)); expect(typeof (data.status)).assertEqual("number"); + expect(typeof (data.timestamp)).assertEqual("number"); } function callback2(data) { console.info("callback2" + JSON.stringify(data)); expect(typeof (data.status)).assertEqual("number"); + expect(typeof (data.timestamp)).assertEqual("number"); } beforeAll(function () { @@ -232,7 +234,11 @@ describe("SensorJsTest_sensor_7", function () { sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback2); setTimeout(() => { console.info('----------------------Hall_SensorJsTest010 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback); + try { + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback); + } catch (error) { + console.info("Hall_SensorJsTest010 error:" + error); + } console.info('----------------------Hall_SensorJsTest010 off end---------------------------'); }, 500); setTimeout(() => { @@ -271,7 +277,11 @@ describe("SensorJsTest_sensor_7", function () { sensor.on(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback2, { 'interval': 100000000 }); setTimeout(() => { console.info('----------------------Hall_SensorJsTest012 off in---------------------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback); + try { + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_HALL, callback); + } catch (error) { + console.info("Hall_SensorJsTest012 error:" + error); + } console.info('----------------------Hall_SensorJsTest012 off end---------------------------'); }, 500); setTimeout(() => { diff --git a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Linear_Accelerometer_test.js b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Linear_Accelerometer_test.js index 042a2d9218b35d7a92296716f1e1899d7622b72e..d25f44df62b4a71ab8b895bd2800022cac34e141 100644 --- a/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Linear_Accelerometer_test.js +++ b/sensors/sensor_standard/src/main/js/test/SensorOnOffTest_Linear_Accelerometer_test.js @@ -22,6 +22,7 @@ describe("SensorJsTest_sensor_37", function () { expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number"); + expect(typeof (data.timestamp)).assertEqual("number"); } function callback2(data) { @@ -29,6 +30,7 @@ describe("SensorJsTest_sensor_37", function () { expect(typeof (data.x)).assertEqual("number"); expect(typeof (data.y)).assertEqual("number"); expect(typeof (data.z)).assertEqual("number"); + expect(typeof (data.timestamp)).assertEqual("number"); } beforeAll(function () { @@ -244,7 +246,11 @@ describe("SensorJsTest_sensor_37", function () { sensor.on(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, callback2); setTimeout(() => { console.info('-----------SensorLinearAccelerometerJSTest010 off in----------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, callback); + try { + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, callback); + } catch (error) { + console.info("SensorLinearAccelerometerJSTest010 error:" + error); + } console.info('-----------SensorLinearAccelerometerJSTest010 off end----------------'); }, 500); setTimeout(() => { @@ -283,7 +289,11 @@ describe("SensorJsTest_sensor_37", function () { sensor.on(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, callback2, { 'interval': 100000000 }); setTimeout(() => { console.info('-----------SensorLinearAccelerometerJSTest012 off in----------------'); - sensor.off(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, callback); + try { + sensor.off(sensor.SensorType.SENSOR_TYPE_ID_LINEAR_ACCELEROMETER, callback); + } catch (error) { + console.info("SensorLinearAccelerometerJSTest012 error:" + error); + } console.info('-----------SensorLinearAccelerometerJSTest012 off end----------------'); }, 500); setTimeout(() => { diff --git a/settingsdata/BUILD.gn b/settingsdata/BUILD.gn deleted file mode 100755 index 8c1858d8f006f03d18153b39ea64193bc6dadffa..0000000000000000000000000000000000000000 --- a/settingsdata/BUILD.gn +++ /dev/null @@ -1,17 +0,0 @@ -# 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. - -group("settingsdata") { - testonly = true - deps = [ "settings_ets:SettingsEtsTest" ] -} diff --git a/settingsdata/settings_ets/BUILD.gn b/settingsdata/settings_ets/BUILD.gn deleted file mode 100644 index 2c084b8783cda2015189dcefc61b8db07fb01a71..0000000000000000000000000000000000000000 --- a/settingsdata/settings_ets/BUILD.gn +++ /dev/null @@ -1,36 +0,0 @@ -# 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("SettingsEtsTest") { - hap_profile = "./entry/src/main/config.json" - deps = [ - ":settings_ets_assets", - ":settings_ets_resources", - ":settings_ets_test_assets", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsSettingsEtsTest" -} -ohos_js_assets("settings_ets_assets") { - source_dir = "./entry/src/main/ets/MainAbility" -} -ohos_js_assets("settings_ets_test_assets") { - source_dir = "./entry/src/main/ets/TestAbility" -} -ohos_resources("settings_ets_resources") { - sources = [ "./entry/src/main/resources" ] - hap_profile = "./entry/src/main/config.json" -} diff --git a/settingsdata/settings_ets/Test.json b/settingsdata/settings_ets/Test.json deleted file mode 100644 index 4ed73b90766f1abfa7df48aa5888b24b63504b00..0000000000000000000000000000000000000000 --- a/settingsdata/settings_ets/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for settings Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "600000", - "bundle-name": "com.open.harmony.settings", - "package-name": "com.open.harmony.settings", - "shell-timeout": "600000" - }, - "kits": [ - { - "test-file-name": [ - "ActsSettingsEtsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/settingsdata/settings_ets/entry/src/main/config.json b/settingsdata/settings_ets/entry/src/main/config.json deleted file mode 100644 index 1a283dce21995af7e23b477e73652138c3a67ce1..0000000000000000000000000000000000000000 --- a/settingsdata/settings_ets/entry/src/main/config.json +++ /dev/null @@ -1,99 +0,0 @@ -{ - "app": { - "bundleName": "com.open.harmony.settings", - "vendor": "open", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.open.harmony.settings", - "name": ".MyApplication", - "mainAbility": "com.open.harmony.settings.MainAbility", - "srcPath": "", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "orientation": "unspecified", - "visible": true, - "srcPath": "MainAbility", - "name": ".MainAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:description_mainability", - "formsEnabled": false, - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - }, - { - "orientation": "unspecified", - "visible": true, - "srcPath": "TestAbility", - "name": ".TestAbility", - "srcLanguage": "ets", - "icon": "$media:icon", - "description": "$string:TestAbility_desc", - "formsEnabled": false, - "label": "$string:TestAbility_label", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".MainAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - }, - { - "mode": { - "syntax": "ets", - "type": "pageAbility" - }, - "pages": [ - "pages/index" - ], - "name": ".TestAbility", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/settingsdata/settings_ets/entry/src/main/ets/MainAbility/app.ets b/settingsdata/settings_ets/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 5d603333c7bf5167e7d1d3ead6c9daa9c4b2862d..0000000000000000000000000000000000000000 --- a/settingsdata/settings_ets/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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('Application onCreate') - }, - onDestroy() { - console.info('Application onDestroy') - }, -} \ No newline at end of file diff --git a/settingsdata/settings_ets/entry/src/main/ets/MainAbility/pages/index.ets b/settingsdata/settings_ets/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 54b28ac3d51b64561f43cec5d4d9dc6fd2e56bda..0000000000000000000000000000000000000000 --- a/settingsdata/settings_ets/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,37 +0,0 @@ -// @ts-nocheck -/** - * 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. - */ - -@Entry -@Component -struct MyComponent { - aboutToAppear() { - } - - build() { - Flex({ - direction: FlexDirection.Column, - alignItems: ItemAlign.Center, - justifyContent: FlexAlign.Center - }) { - Text('Settings ETS TEST') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} - diff --git a/settingsdata/settings_ets/entry/src/main/ets/TestAbility/app.ets b/settingsdata/settings_ets/entry/src/main/ets/TestAbility/app.ets deleted file mode 100644 index 9511bef9a9463a9b72db92a826b1d58313ddfe78..0000000000000000000000000000000000000000 --- a/settingsdata/settings_ets/entry/src/main/ets/TestAbility/app.ets +++ /dev/null @@ -1,32 +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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from 'hypium/index' -import testsuite from '../test/List.test' - -export default { - onCreate() { - console.info('Application onCreate') - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - }, - onDestroy() { - console.info('Application onDestroy') - }, -} \ No newline at end of file diff --git a/settingsdata/settings_ets/entry/src/main/ets/TestAbility/pages/index.ets b/settingsdata/settings_ets/entry/src/main/ets/TestAbility/pages/index.ets deleted file mode 100644 index 011878f2b989ed0798baafed2b6c14e241fad57e..0000000000000000000000000000000000000000 --- a/settingsdata/settings_ets/entry/src/main/ets/TestAbility/pages/index.ets +++ /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. - */ -import router from '@system.router'; - -@Entry -@Component -struct Index { - aboutToAppear() { - console.info('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/settingsdata/settings_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/settingsdata/settings_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index 143e3ae5ce3c4181c0034fa6aa3c75191a6c49e6..0000000000000000000000000000000000000000 --- a/settingsdata/settings_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,77 +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 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 itName', - '-s level', '-s testType', '-s size', '-s timeout', - '-s package' - ]) - let targetParams = ''; - for (const key in parameters) { - if (keySet.has(key)) { - 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') - } - - onRun() { - console.log('OpenHarmonyTestRunner onRun run') - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName - cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) - 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 call abilityDelegator.getAppContext') - var context = abilityDelegator.getAppContext() - console.info('getAppContext : ' + JSON.stringify(context)) - console.info('OpenHarmonyTestRunner onRun end') - } -}; \ No newline at end of file diff --git a/settingsdata/settings_ets/entry/src/main/ets/test/List.test.ets b/settingsdata/settings_ets/entry/src/main/ets/test/List.test.ets deleted file mode 100644 index 1b296eaececa9b867473d634dea841f84722e231..0000000000000000000000000000000000000000 --- a/settingsdata/settings_ets/entry/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/** - * 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 settingUiJsunit from './SettingUiJsunit.test.ets'; - -export default function testsuite() { - settingUiJsunit(); -} \ No newline at end of file diff --git a/settingsdata/settings_ets/entry/src/main/ets/test/SettingUiJsunit.test.ets b/settingsdata/settings_ets/entry/src/main/ets/test/SettingUiJsunit.test.ets deleted file mode 100644 index fda8237db20aae013b2c5dfa1f356a0cdbe3183a..0000000000000000000000000000000000000000 --- a/settingsdata/settings_ets/entry/src/main/ets/test/SettingUiJsunit.test.ets +++ /dev/null @@ -1,1187 +0,0 @@ -// @ts-nocheck -/** - * 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 "hypium/index"; -import settings from '@ohos.settings' -import featureAbility from '@ohos.ability.featureAbility'; - -export default function settingUiJsunit() { - describe('appInfoTest', function () { - console.log("************* settings Test start*************"); - it('settings_uri_test_001', 0,async function (done) { - var name = 'settings.screen.test'; - var uri = settings.getUriSync(name); - console.info("[settings_uri_test_001] uri is: " + uri); - var uri2 = settings.getUriSync(name); - console.info("[settings_uri_test_001] uri2 is: " + uri2); - expect(uri).assertEqual(uri2); - done(); - }); - - it('settings_uri_test_002', 0, async function (done) { - var name = ''; - var uri = settings.getUriSync(name); - console.info("[settings_uri_test_002] uri is: " + uri); - expect(uri).assertEqual('dataability:///com.ohos.settingsdata.DataAbility') - done(); - }); - - it('settings_uri_test_003', 0, async function (done) { - var name = 122.00; - try { - var uri = settings.getUriSync(name); - console.info("[settings_uri_test_003] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_uri_test_003] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - done(); - }); - - it('settings_uri_test_004', 0, async function (done) { - var name = 'settings.screen.brightness'; - var uri = settings.getUriSync(name); - console.info("[settings_uri_test_004] uri is: " + uri); - expect(uri).assertEqual('dataability:///com.ohos.settingsdata.DataAbility/settings.screen.brightness') - done(); - }); - - it('settings_get_value_005', 0, async function (done) { - var name = 'settings.screen.brightness20'; - var uri = settings.getUriSync(name); - var helper = featureAbility.acquireDataAbilityHelper(uri); - let value = settings.getValueSync(helper, name, "test getValueSync"); - console.info("[settings_get_value_005] value is: " + value); - expect(value).assertEqual("test getValueSync"); - done(); - }); - - it('settings_get_value_006', 0, async function (done) { - var name = 'settings.screen.brightness2'; - var uri = settings.getUriSync(name); - console.info("[settings_get_value_006] uri is: " + uri); - var helper = featureAbility.acquireDataAbilityHelper(uri); - let obj = { - aa: "aa" - } - try { - let value = settings.getValueSync(helper, name, obj); - console.info("[settings_get_value_006] value is: " + value); - expect(value).assertEqual("test getValueSync"); - } catch (err) { - console.error("[settings_get_value_006] error = " + err); - expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument[2] type. String expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_007', 0, async function (done) { - var name = 'settings.screen.brightness3'; - var uri = settings.getUriSync(name); - console.info("[settings_get_value_007] uri is: " + uri); - var helper = featureAbility.acquireDataAbilityHelper(uri); - let obj = ''; - try { - let value = settings.getValueSync(helper, name, obj); - console.info("[settings_get_value_007] value is: " + value); - expect(value).assertEqual(''); - } catch (err) { - console.error("[settings_get_value_007] error = " + err); - expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_008', 0, async function (done) { - var name = 'settings.screen.brightness4'; - var uri = settings.getUriSync(name); - console.info("[settings_get_value_008] uri is: " + uri); - var helper = featureAbility.acquireDataAbilityHelper(uri); - let obj = null; - try { - let value = settings.getValueSync(helper, name, obj); - console.info("[settings_get_value_008] value is: " + value); - } catch (err) { - console.error("[settings_get_value_008] error = " + err); - expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument[2] type. String expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_009', 0, async function (done) { - var name = 'settings.screen.brightness5'; - var uri = settings.getUriSync(name); - console.info("[settings_get_value_009] uri is: " + uri); - var helper = "helper"; - try { - let value = settings.getValueSync(helper, name, "test getValueSync"); - console.info("[settings_get_value_009] value is: " + value); - } catch (err) { - console.error("[settings_get_value_009] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_010', 0, async function (done) { - var name = 'settings.screen.brightness6'; - var uri = settings.getUriSync(name); - console.info("[settings_get_value_010] uri is: " + uri); - var helper = null; - try { - let value = settings.getValueSync(helper, name, "test getValueSync"); - console.info("[settings_get_value_010] value is: " + value); - } catch (err) { - console.error("[settings_get_value_010] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_0011', 0, async function (done) { - var name = 'settings.screen.brightness7'; - var uri = settings.getUriSync(name); - console.info("[settings_get_value_0011] uri is: " + uri); - var helper = "helper"; - let obj = 121; - try { - let value = settings.getValueSync(helper, name, obj); - console.info("[settings_get_value_0011] value is: " + value); - } catch (err) { - console.error("[settings_get_value_0011] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_0012', 0, async function (done) { - var name = 'settings.screen.brightness8'; - var uri = settings.getUriSync(name); - console.info("[settings_get_value_0012] uri is: " + uri); - var helper = null; - let obj = null; - try { - let value = settings.getValueSync(helper, name, obj); - console.info("[settings_get_value_0012] value is: " + value); - } catch (err) { - console.error("[settings_get_value_0012] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_013', 0, async function (done) { - var name = 1322.00; - try { - var uri = settings.getUriSync(name); - console.info("[settings_get_value_013] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_get_value_013] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = featureAbility.acquireDataAbilityHelper(uri); - try { - let value = settings.getValueSync(helper, name, "test getValueSync"); - console.info("[settings_get_value_013] value is: " + value); - } catch (err) { - console.error("[settings_get_value_013] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_014', 0, async function (done) { - let name = null; - try { - var uri = settings.getUriSync(name); - console.info("[settings_get_value_014] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_get_value_014] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = featureAbility.acquireDataAbilityHelper(uri); - try { - let value = settings.getValueSync(helper, name, "test getValueSync"); - console.info("[settings_get_value_014] value is: " + value); - } catch (err) { - console.error("[settings_get_value_014] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_0015', 0, async function (done) { - let name = 1332; - try { - var uri = settings.getUriSync(name); - console.info("[settings_get_value_0015] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_get_value_0015] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = featureAbility.acquireDataAbilityHelper(uri); - let obj = 22223; - try { - let value = settings.getValueSync(helper, name, obj); - console.info("[settings_get_value_0015] value is: " + value); - } catch (err) { - console.error("[settings_get_value_0015] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_0016', 0, async function (done) { - let name = 1332; - try { - var uri = settings.getUriSync(name); - console.info("[settings_get_value_0016] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_get_value_0016] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = "helper"; - try { - let value = settings.getValueSync(helper, name, "test getValueSync"); - console.info("[settings_get_value_0016] value is: " + value); - } catch (err) { - console.error("[settings_get_value_0016] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_0017', 0, async function (done) { - let name = 1332; - try { - var uri = settings.getUriSync(name); - console.info("[settings_get_value_0017] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_get_value_0017] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = "helper"; - let obj = 221323; - try { - let value = settings.getValueSync(helper, name, obj); - console.info("[settings_get_value_0017] value is: " + value); - } catch (err) { - console.error("[settings_get_value_0017] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_018', 0, async function (done) { - let name = 'settings.screen.brightness10'; - var uri = settings.getUriSync(name); - var helper = featureAbility.acquireDataAbilityHelper(uri); - let value = settings.setValueSync(helper, name, "test getValueSync"); - expect(value).assertEqual(true); - done(); - }); - - it('settings_set_value_019', 0, async function (done) { - let name = 'settings.screen.brightness11'; - var uri = settings.getUriSync(name); - var helper = featureAbility.acquireDataAbilityHelper(uri); - let obj = 32344.00; - try { - let value = settings.setValueSync(helper, name, obj); - console.info("[settings_set_value_019] value is: " + value); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_019] error = " + err); - expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument[2] type. String expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_020', 0, async function (done) { - let name = 'settings.screen.brightness12'; - var uri = settings.getUriSync(name); - var helper = featureAbility.acquireDataAbilityHelper(uri); - let obj = null; - try { - let value = settings.setValueSync(helper, name, obj); - console.info("[settings_set_value_020] value is: " + value); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_020] error = " + err); - expect(err == "Error: assertion (valueType == napi_string) failed: Wrong argument[2] type. String expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_021', 0, async function (done) { - let name = 'settings.screen.brightness13'; - var helper = "helper"; - try { - let value = settings.setValueSync(helper, name, "test getValueSync"); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_021] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_022', 0, async function (done) { - let name = 'settings.screen.brightness13'; - var helper = null; - try { - let value = settings.setValueSync(helper, name, "test getValueSync"); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_022] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_023', 0, async function (done) { - let name = 'settings.screen.brightness14'; - var helper = "helper"; - let obj = 343434.00; - try { - let value = settings.setValueSync(helper, name, obj); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_023] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_024', 0, async function (done) { - let name = 'settings.screen.brightness14'; - var helper = "helper"; - let obj = null; - try { - let value = settings.setValueSync(helper, name, obj); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_024] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_025', 0, async function (done) { - let name = 'settings.screen.brightness14'; - var helper = null; - let obj = 2323.00; - try { - let value = settings.setValueSync(helper, name, obj); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_025] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_026', 0, async function (done) { - let name = 1332; - try { - var uri = settings.getUriSync(name); - console.info("[settings_set_value_026] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_set_value_026] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = featureAbility.acquireDataAbilityHelper(uri); - try { - let value = settings.setValueSync(helper, name, "test getValueSync"); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_026] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_027', 0, async function (done) { - let name = null; - try { - var uri = settings.getUriSync(name); - console.info("[settings_set_value_027] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_set_value_027] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = featureAbility.acquireDataAbilityHelper(uri); - try { - let value = settings.setValueSync(helper, name, "test getValueSync"); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_027] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_028', 0, async function (done) { - let name = 2323; - try { - var uri = settings.getUriSync(name); - console.info("[settings_set_value_028] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_set_value_028] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = featureAbility.acquireDataAbilityHelper(uri); - let obj = 232.00; - try { - let value = settings.setValueSync(helper, name, obj); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_028] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_029', 0, async function (done) { - let name = 2323; - try { - var uri = settings.getUriSync(name); - console.info("[settings_set_value_029] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_set_value_029] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = featureAbility.acquireDataAbilityHelper(uri); - let obj = null; - try { - let value = settings.setValueSync(helper, name, obj); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_029] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_030', 0, async function (done) { - let name = 2323; - try { - var uri = settings.getUriSync(name); - console.info("[settings_set_value_030] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_set_value_030] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = "helper"; - try { - let value = settings.setValueSync(helper, name, "text value"); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_030] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_031', 0, async function (done) { - let name = 2323; - try { - var uri = settings.getUriSync(name); - console.info("[settings_set_value_031] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_set_value_031] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = null; - try { - let value = settings.setValueSync(helper, name, "text value"); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_031] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_set_value_032', 0, async function (done) { - let name = 2323; - try { - var uri = settings.getUriSync(name); - console.info("[settings_set_value_032] uri is: " + uri); - } catch (err) { - let errMsg = err; - console.error("[settings_set_value_032] error = " + errMsg); - expect(errMsg == "Error: assertion (valueType == napi_string) failed: Wrong argument type. String expected.") - .assertTrue(); - } - var helper = "helper"; - let obj = 2323; - try { - let value = settings.setValueSync(helper, name, obj); - expect(value).assertEqual(true); - } catch (err) { - console.error("[settings_set_value_032] error = " + err); - expect(err == "Error: assertion (valueType == napi_object) failed: Wrong argument[0] type. Object expected.") - .assertTrue(); - } - done(); - }); - - it('settings_get_value_033', 0, async function (done){ - let uri = 'dataability:///com.ohos.settingsdata.DataAbility'; - let helper = featureAbility.acquireDataAbilityHelper(uri); - - let name = 'settings.screen.brightness33'; - let value = 'brightness33' - try{ - settings.setValueSync(helper, name, value); - settings.getValue(helper, name, ret =>{ - console.info("[settings_get_value_033] value is: " + ret); - expect(ret).assertEqual(value); - done(); - }) - } catch(err){ - console.info("[settings_get_value_033] error is: " + toString(error)); - expect(true).assertTrue(); - done(); - return; - } - }); - - it('settings_get_value_034', 0, async function (done){ - let uri = 'dataability:///com.ohos.settingsdata.DataAbility'; - let helper = featureAbility.acquireDataAbilityHelper(uri); - - let name = 'settings.screen.brightness34'; - let value = 'brightness34' - - try{ - settings.setValueSync(helper, name, value); - settings.getValue(helper, name).then(ret =>{ - console.info("[settings_get_value_034] value is: " + ret); - expect(ret).assertEqual(value); - done(); - }) - } catch(err){ - console.info("[settings_get_value_034] error is: " + toString(error)); - expect(true).assertTrue(); - done(); - return; - } - }); - - it('settings_get_value_035', 0, async function (done){ - var name = 'settings.screen.brightness35'; - let uriPrefix = 'dataability:///com.ohos.settingsdata.DataAbility' - let expectValue = uriPrefix + '/' + name; - try{ - settings.getURI(name).then(data => { - console.info("[settings_get_uri_035] uri is: " + data); - expect(data).assertEqual(expectValue); - done(); - }) - } catch(err){ - console.info("[settings_get_uri_035] error is: " + toString(error)); - expect(true).assertTrue(); - done(); - return; - } - }); - - it('settings_get_value_036', 0, async function (done){ - var name = 'settings.screen.brightness36'; - let uriPrefix = 'dataability:///com.ohos.settingsdata.DataAbility' - let expectValue = uriPrefix + '/' + name; - try{ - settings.getURI(name, (data) =>{ - console.info("[settings_get_uri_036] uri is: " + data); - expect(data).assertEqual(expectValue); - done(); - }) - }catch(err){ - console.info("[settings_get_uri_036] error is: " + toString(error)); - expect(true).assertTrue(); - done(); - return; - } - }); - - it('settings_get_value_037',0,async function (done) { - var str ="settings.date.date_format" - expect(str).assertEqual(settings.date.DATE_FORMAT); - done(); - }); - - it('settings_get_value_038',0,async function (done) { - var str ="settings.date.time_format" - expect(str).assertEqual(settings.date.TIME_FORMAT); - done(); - }); - - it('settings_get_value_039',0,async function (done) { - var str ="settings.date.auto_gain_time" - expect(str).assertEqual(settings.date.AUTO_GAIN_TIME); - done(); - }); - - it('settings_get_value_040',0,async function (done) { - var str ="settings.date.auto_gain_time_zone" - expect(str).assertEqual(settings.date.AUTO_GAIN_TIME_ZONE); - done(); - }); - - it('settings_get_value_041',0,async function (done) { - var str ="settings.display.font_scale" - expect(str).assertEqual(settings.display.FONT_SCALE); - done(); - }); - - it('settings_get_value_042',0,async function (done) { - var str ="settings.display.screen_brightness_status" - expect(str).assertEqual(settings.display.SCREEN_BRIGHTNESS_STATUS); - done(); - }); - - it('settings_get_value_043',0,async function (done) { - var str ="settings.display.auto_screen_brightness" - expect(str).assertEqual(settings.display.AUTO_SCREEN_BRIGHTNESS); - done(); - }); - - it('settings_get_value_044',0,async function (done) { - var int = 1 - expect(int).assertEqual(settings.display.AUTO_SCREEN_BRIGHTNESS_MODE); - done(); - }); - - it('settings_get_value_045',0,async function (done) { - var int = 0 - expect(int).assertEqual(settings.display.MANUAL_SCREEN_BRIGHTNESS_MODE); - done(); - }); - - it('settings_get_value_046',0,async function (done) { - var str ="settings.display.screen_off_timeout" - expect(str).assertEqual(settings.display.SCREEN_OFF_TIMEOUT); - done(); - }); - - it('settings_get_value_047',0,async function (done) { - var str ="settings.display.default_screen_rotation" - expect(str).assertEqual(settings.display.DEFAULT_SCREEN_ROTATION); - done(); - }); - - it('settings_get_value_048',0,async function (done) { - var str ="settings.display.animator_duration_scale" - expect(str).assertEqual(settings.display.ANIMATOR_DURATION_SCALE); - done(); - }); - - it('settings_get_value_049',0,async function (done) { - var str ="settings.display.transition_animation_scale" - expect(str).assertEqual(settings.display.TRANSITION_ANIMATION_SCALE); - done(); - }); - - it('settings_get_value_050',0,async function (done) { - var str ="settings.display.window_animation_scale" - expect(str).assertEqual(settings.display.WINDOW_ANIMATION_SCALE); - done(); - }); - - it('settings_get_value_051',0,async function (done) { - var str = "settings.display.display_inversion_status" - expect(str).assertEqual(settings.display.DISPLAY_INVERSION_STATUS); - done(); - }); - - it('settings_get_value_052',0,async function (done) { - var str = "settings.general.setup_wizard_finished" - expect(str).assertEqual(settings.general.SETUP_WIZARD_FINISHED); - done(); - }); - - it('settings_get_value_053',0,async function (done) { - var str = "settings.general.end_button_action" - expect(str).assertEqual(settings.general.END_BUTTON_ACTION); - done(); - }); - - it('settings_get_value_054',0,async function (done) { - var str = "settings.general.airplane_mode_status" - expect(str).assertEqual(settings.general.AIRPLANE_MODE_STATUS); - done(); - }); - - it('settings_get_value_055',0,async function (done) { - var str = "settings.general.accelerometer_rotation_status" - expect(str).assertEqual(settings.general.ACCELEROMETER_ROTATION_STATUS); - done(); - }); - - it('settings_get_value_056',0,async function (done) { - var str = "settings.general.device_provision_status" - expect(str).assertEqual(settings.general.DEVICE_PROVISION_STATUS); - done(); - }); - - it('settings_get_value_057',0,async function (done) { - var str = "settings.general.hdc_status" - expect(str).assertEqual(settings.general.HDC_STATUS); - done(); - }); - - - - it('settings_get_value_058',0,async function (done) { - var str = "settings.general.boot_counting" - expect(str).assertEqual(settings.general.BOOT_COUNTING); - done(); - }); - - it('settings_get_value_059',0,async function (done) { - var str = "settings.general.contact_metadata_sync_status" - expect(str).assertEqual(settings.general.CONTACT_METADATA_SYNC_STATUS); - done(); - }); - - it('settings_get_value_060',0,async function (done) { - var str = "settings.general.development_settings_status" - expect(str).assertEqual(settings.general.DEVELOPMENT_SETTINGS_STATUS); - done(); - }); - - it('settings_get_value_061',0,async function (done) { - var str = "settings.general.device_name" - expect(str).assertEqual(settings.general.DEVICE_NAME); - done(); - }); - - it('settings_get_value_062',0,async function (done) { - var str = "settings.general.usb_storage_status" - expect(str).assertEqual(settings.general.USB_STORAGE_STATUS); - done(); - }); - - it('settings_get_value_063',0,async function (done) { - var str = "settings.general.debugger_waiting" - expect(str).assertEqual(settings.general.DEBUGGER_WAITING); - done(); - }); - - it('settings_get_value_064',0,async function (done) { - var str = "settings.general.debug_app_package" - expect(str).assertEqual(settings.general.DEBUG_APP_PACKAGE); - done(); - }); - - it('settings_get_value_065',0,async function (done) { - var str = "settings.general.accessibility_status" - expect(str).assertEqual(settings.general.ACCESSIBILITY_STATUS); - done(); - }); - - it('settings_get_value_066',0,async function (done) { - var str = "settings.general.activated_accessibility_services" - expect(str).assertEqual(settings.general.ACTIVATED_ACCESSIBILITY_SERVICES); - done(); - }); - - it('settings_get_value_067',0,async function (done) { - var str = "settings.general.geolocation_origins_allowed" - expect(str).assertEqual(settings.general.GEOLOCATION_ORIGINS_ALLOWED); - done(); - }); - - it('settings_get_value_068',0,async function (done) { - var str = "settings.general.skip_use_hints" - expect(str).assertEqual(settings.general.SKIP_USE_HINTS); - done(); - }); - - it('settings_get_value_069',0,async function (done) { - var str = "settings.general.touch_exploration_status" - expect(str).assertEqual(settings.general.TOUCH_EXPLORATION_STATUS); - done(); - }); - - it('settings_get_value_070',0,async function (done) { - var str = "settings.input.default_input_method" - expect(str).assertEqual(settings.input.DEFAULT_INPUT_METHOD); - done(); - }); - - it('settings_get_value_071',0,async function (done){ - var str = "settings.input.activated_input_method_submode" - let expectValue:string=settings.input.ACTIVATED_INPUT_METHOD_SUB_MODE; - expect(str).assertEqual(expectValue); - done(); - }); - - - it('settings_get_value_072',0,async function (done){ - var str = "settings.input.activated_input_methods" - expect(str).assertEqual(settings.input.ACTIVATED_INPUT_METHODS); - done(); - }); - - - it('settings_get_value_073',0,async function (done){ - var str = "settings.input.selector_visibility_for_input_method" - expect(str).assertEqual(settings.input.SELECTOR_VISIBILITY_FOR_INPUT_METHOD); - done(); - }); - - - it('settings_get_value_074',0,async function (done){ - var str = "settings.input.auto_caps_text_input" - expect(str).assertEqual(settings.input.AUTO_CAPS_TEXT_INPUT); - done(); - }); - - - it('settings_get_value_075',0,async function (done){ - var str = "settings.input.auto_punctuate_text_input" - expect(str).assertEqual(settings.input.AUTO_PUNCTUATE_TEXT_INPUT); - done(); - }); - - - it('settings_get_value_076',0,async function (done){ - var str = "settings.input.auto_replace_text_input" - expect(str).assertEqual(settings.input.AUTO_REPLACE_TEXT_INPUT); - done(); - }); - - - it('settings_get_value_077',0,async function (done){ - var str = "settings.input.show_password_text_input" - expect(str).assertEqual(settings.input.SHOW_PASSWORD_TEXT_INPUT); - done(); - }); - - - it('settings_get_value_078',0,async function (done){ - var str = "settings.network.data_roaming_status" - expect(str).assertEqual(settings.network.DATA_ROAMING_STATUS); - done(); - }); - - - it('settings_get_value_079',0,async function (done){ - var str = "settings.network.http_proxy_cfg" - expect(str).assertEqual(settings.network.HTTP_PROXY_CFG); - done(); - }); - - - it('settings_get_value_080',0,async function (done){ - var str = "settings.network.network_preference_usage" - expect(str).assertEqual(settings.network.NETWORK_PREFERENCE_USAGE); - done(); - }); - - - it('settings_get_value_081',0,async function (done){ - var str = "settings.phone.rtt_calling_status" - expect(str).assertEqual(settings.phone.RTT_CALLING_STATUS); - done(); - }); - - - it('settings_get_value_082',0,async function (done){ - var str = "settings.sound.vibrate_while_ringing" - expect(str).assertEqual(settings.sound.VIBRATE_WHILE_RINGING); - done(); - }); - - - it('settings_get_value_083',0,async function (done){ - var str = "settings.sound.default_alarm_alert" - expect(str).assertEqual(settings.sound.DEFAULT_ALARM_ALERT); - done(); - }); - - - it('settings_get_value_084',0,async function (done){ - var str = "settings.sound.dtmf_tone_type_while_dialing" - expect(str).assertEqual(settings.sound.DTMF_TONE_TYPE_WHILE_DIALING); - done(); - }); - - - it('settings_get_value_085',0,async function (done){ - var str = "settings.sound.dtmf_tone_while_dialing" - expect(str).assertEqual(settings.sound.DTMF_TONE_WHILE_DIALING); - done(); - }); - - - it('settings_get_value_086',0,async function (done){ - var str = "settings.sound.haptic_feedback_status" - expect(str).assertEqual(settings.sound.HAPTIC_FEEDBACK_STATUS); - done(); - }); - - - it('settings_get_value_087',0,async function (done){ - var str = "settings.sound.affected_mode_ringer_streams" - expect(str).assertEqual(settings.sound.AFFECTED_MODE_RINGER_STREAMS); - done(); - }); - - - it('settings_get_value_088',0,async function (done){ - var str = "settings.sound.affected_mute_streams" - expect(str).assertEqual(settings.sound.AFFECTED_MUTE_STREAMS); - done(); - }); - - - it('settings_get_value_089',0,async function (done){ - var str = "settings.sound.default_notification_sound" - expect(str).assertEqual(settings.sound.DEFAULT_NOTIFICATION_SOUND); - done(); - }); - - - it('settings_get_value_090',0,async function (done){ - var str = "settings.sound.default_ringtone" - expect(str).assertEqual(settings.sound.DEFAULT_RINGTONE); - done(); - }); - - it('settings_get_value_091',0,async function (done) { - var str ="settings.sound.sound_effects_status" - expect(str).assertEqual(settings.sound.SOUND_EFFECTS_STATUS); - done(); - }); - - it('settings_get_value_092',0,async function (done) { - var str ="settings.sound.vibrate_status" - expect(str).assertEqual(settings.sound.VIBRATE_STATUS); - done(); - }); - - it('settings_get_value_093',0,async function (done) { - var str ="settings.tts.default_tts_pitch" - expect(str).assertEqual(settings.tts.DEFAULT_TTS_PITCH); - done(); - }); - - it('settings_get_value_094',0,async function (done) { - var str ="settings.tts.default_tts_rate" - expect(str).assertEqual(settings.tts.DEFAULT_TTS_RATE); - done(); - }); - - it('settings_get_value_095',0,async function (done) { - var str ="settings.tts.default_tts_synth" - expect(str).assertEqual(settings.tts.DEFAULT_TTS_SYNTH); - done(); - }); - - it('settings_get_value_096',0,async function (done) { - var str ="settings.tts.enabled_tts_plugins" - expect(str).assertEqual(settings.tts.ENABLED_TTS_PLUGINS); - done(); - }); - - it('settings_get_value_097',0,async function (done) { - var str ="settings.wireless.bluetooth_radio" - expect(str).assertEqual(settings.wireless.BLUETOOTH_RADIO); - done(); - }); - - it('settings_get_value_098',0,async function (done) { - var str ="settings.wireless.cell_radio" - expect(str).assertEqual(settings.wireless.CELL_RADIO); - done(); - }); - - it('settings_get_value_099',0,async function (done) { - var str ="settings.wireless.nfc_radio" - expect(str).assertEqual(settings.wireless.NFC_RADIO); - done(); - }); - - it('settings_get_value_100',0,async function (done) { - var str ="settings.wireless.airplane_mode_radios" - expect(str).assertEqual(settings.wireless.AIRPLANE_MODE_RADIOS); - done(); - }); - - it('settings_get_value_101',0,async function (done) { - var str ="settings.wireless.bluetooth_status" - expect(str).assertEqual(settings.wireless.BLUETOOTH_STATUS); - done(); - }); - - it('settings_get_value_102',0,async function (done) { - var str ="settings.wireless.bluetooth_discoverability_status" - expect(str).assertEqual(settings.wireless.BLUETOOTH_DISCOVER_ABILITY_STATUS); - done(); - }); - - it('settings_get_value_103',0,async function (done) { - var str ="settings.wireless.bluetooth_discover_timeout" - expect(str).assertEqual(settings.wireless.BLUETOOTH_DISCOVER_TIMEOUT); - done(); - }); - - it('settings_get_value_104',0,async function (done) { - var str ="settings.wireless.wifi_dhcp_max_retry_count" - expect(str).assertEqual(settings.wireless.WIFI_DHCP_MAX_RETRY_COUNT); - done(); - }); - - it('settings_get_value_105',0,async function (done) { - var str ="settings.wireless.wifi_to_mobile_data_awake_timeout" - expect(str).assertEqual(settings.wireless.WIFI_TO_MOBILE_DATA_AWAKE_TIMEOUT); - done(); - }); - - it('settings_get_value_106',0,async function (done) { - var str ="settings.wireless.wifi_status" - expect(str).assertEqual(settings.wireless.WIFI_STATUS); - done(); - }); - - it('settings_get_value_107',0,async function (done) { - var str ="settings.wireless.wifi_watchdog_status" - expect(str).assertEqual(settings.wireless.WIFI_WATCHDOG_STATUS); - done(); - }); - - it('settings_get_value_108',0,async function (done) { - var str ="settings.wireless.wifi_radio" - expect(str).assertEqual(settings.wireless.WIFI_RADIO); - done(); - }); - - it('settings_get_value_109',0,async function (done) { - var str ="settings.wireless.owner_lockdown_wifi_cfg" - expect(str).assertEqual(settings.wireless.OWNER_LOCKDOWN_WIFI_CFG); - done(); - }); - - it('settings_get_value_110',0,async function (done) { - var str ="settings.wireless.owner_lockdown_wifi_cfg" - expect(str).assertEqual(settings.wireless.OWNER_LOCKDOWN_WIFI_CFG); - done(); - }); - - it('settings_get_value_111',0,async function (done) { - let uri = 'dataability:///com.ohos.settingsdata.DataAbility'; - let helper = featureAbility.acquireDataAbilityHelper(uri); - let name = 'settings.screen.brightness111';//关键字 - let value = 'brightness111'//值 - try{ - settings.setValue(helper, name, value,(data)=>{ - console.info("[settings_get_value_111] value is:" + data); - settings.getValue(helper, name).then(ret => { - console.info("[settings_get_value_111] value is:" + ret); - expect(ret).assertEqual(value); - done(); - }) - }); - }catch(err){ - console.info("[settings_get_value_111] error is:" + toString(error)); - expect(true).assertTrue(); - done(); - return; - } - }); - - it('settings_get_value_112',0,async function (done) { - let uri = 'dataability:///com.ohos.settingsdata.DataAbility'; - let helper = featureAbility.acquireDataAbilityHelper(uri); - let name = 'settings.screen.brightness112';//关键字 - let value = 'brightness112'//值 - try{ - settings.setValue(helper, name, value) - .then((data)=>{ - console.info("[settings_get_value_112] value is:" + data); - settings.getValue(helper, name).then(ret => { - console.info("[settings_get_value_112] value is:" + ret); - expect(ret).assertEqual(value); - done(); - }) - }) - .catch((err)=>{ - console.info("[settings_get_value_112] error is:" + toString(error)); - expect(true).assertTrue(); - done(); - return; - }) - }catch(err){ - console.info("[settings_get_value_112] error is:" + toString(error)); - expect(true).assertTrue(); - done(); - return; - } - }); - }) -} diff --git a/settingsdata/settings_ets/entry/src/main/resources/base/element/string.json b/settingsdata/settings_ets/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 281be466542bc7ba4027486f9d44ccb32e6279ff..0000000000000000000000000000000000000000 --- a/settingsdata/settings_ets/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - }, - { - "name": "TestAbility_desc", - "value": "description" - }, - { - "name": "TestAbility_label", - "value": "label" - } - ] -} \ No newline at end of file diff --git a/startup/startup_standard/BUILD.gn b/startup/startup_standard/BUILD.gn index fbcac9e27c5c1bd643f13abf6b1c07a14eeac652..218da1bf6fdf5979c2c4e758ae9647a9ce84f224 100644 --- a/startup/startup_standard/BUILD.gn +++ b/startup/startup_standard/BUILD.gn @@ -19,7 +19,6 @@ group("startup_standard") { deps = [ "deviceinfo:startup_deviceinfo_js_test", "syscap_ndk:startup_syscapability_js_test", - "systemparamter:startup_sysparam_js_test", ] } } diff --git a/startup/startup_standard/deviceinfo/src/main/config.json b/startup/startup_standard/deviceinfo/src/main/config.json index 5fff4c2101ee7487529b7fc3fc49f355cbe24714..0370e6580db790fad42e27d03f33bd2482560382 100644 --- a/startup/startup_standard/deviceinfo/src/main/config.json +++ b/startup/startup_standard/deviceinfo/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.startup.js.function", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/startup/startup_standard/syscap_ndk/src/main/config.json b/startup/startup_standard/syscap_ndk/src/main/config.json index 4a75c9650edeef76fda2e3054c233698df6f7a5d..c074aa665e8aad25b5429232122b04d01f8ca54e 100644 --- a/startup/startup_standard/syscap_ndk/src/main/config.json +++ b/startup/startup_standard/syscap_ndk/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.startup.syscap.function", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/startup/startup_standard/systemparamter/BUILD.gn b/startup/startup_standard/systemparamter/BUILD.gn deleted file mode 100644 index 83deab45833398143acbcc7c8d5fac8ccd1af696..0000000000000000000000000000000000000000 --- a/startup/startup_standard/systemparamter/BUILD.gn +++ /dev/null @@ -1,35 +0,0 @@ -# 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("startup_sysparam_js_test") { - hap_profile = "./src/main/config.json" - deps = [ - ":startup_js_assets", - ":startup_js_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsStartupSysParamTest" - subsystem_name = "startup" - part_name = "startup_l2" -} -ohos_js_assets("startup_js_assets") { - js2abc = true - hap_profile = "./src/main/config.json" - source_dir = "./src/main/js" -} -ohos_resources("startup_js_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/startup/startup_standard/systemparamter/Test.json b/startup/startup_standard/systemparamter/Test.json deleted file mode 100644 index 094a5254f989940ffdb4b13682b715a7ccf36bdb..0000000000000000000000000000000000000000 --- a/startup/startup_standard/systemparamter/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for startup sysparam js api Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "300000", - "shell-timeout": "300000", - "bundle-name": "ohos.acts.startup.sysparam.function", - "package-name": "ohos.acts.startup.sysparam.function" - }, - "kits": [ - { - "test-file-name": [ - "ActsStartupSysParamTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/startup/startup_standard/systemparamter/src/main/config.json b/startup/startup_standard/systemparamter/src/main/config.json deleted file mode 100644 index 2de5efb76b1cec056fcf000b037a816c62625289..0000000000000000000000000000000000000000 --- a/startup/startup_standard/systemparamter/src/main/config.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.startup.sysparam.function", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0" - }, - "apiVersion": { - "compatible": 4, - "target": 5 - } - }, - "deviceConfig": {}, - "module": { - "package": "ohos.acts.startup.sysparam.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/startup/startup_standard/systemparamter/src/main/js/MainAbility/i18n/en-US.json b/startup/startup_standard/systemparamter/src/main/js/MainAbility/i18n/en-US.json deleted file mode 100644 index 25b4997e50df3af032339fe395b293b95a44c275..0000000000000000000000000000000000000000 --- a/startup/startup_standard/systemparamter/src/main/js/MainAbility/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "OpenHarmony" - } -} \ No newline at end of file diff --git a/startup/startup_standard/systemparamter/src/main/js/MainAbility/i18n/zh-CN.json b/startup/startup_standard/systemparamter/src/main/js/MainAbility/i18n/zh-CN.json deleted file mode 100644 index b9543e1912f72ea9075609981bf64496330cbb41..0000000000000000000000000000000000000000 --- a/startup/startup_standard/systemparamter/src/main/js/MainAbility/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "鸿蒙OS" - } -} \ No newline at end of file diff --git a/startup/startup_standard/systemparamter/src/main/js/MainAbility/pages/index/index.js b/startup/startup_standard/systemparamter/src/main/js/MainAbility/pages/index/index.js deleted file mode 100644 index af4eb3e36a12da5f06a27d61d5fd178a846dc866..0000000000000000000000000000000000000000 --- a/startup/startup_standard/systemparamter/src/main/js/MainAbility/pages/index/index.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ - - -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/startup/startup_standard/systemparamter/src/main/js/TestAbility/app.js b/startup/startup_standard/systemparamter/src/main/js/TestAbility/app.js deleted file mode 100644 index cdc31f3dcf031e2f6a7665d9653e53bb649e21c5..0000000000000000000000000000000000000000 --- a/startup/startup_standard/systemparamter/src/main/js/TestAbility/app.js +++ /dev/null @@ -1,31 +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 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/startup/startup_standard/systemparamter/src/main/js/TestAbility/i18n/en-US.json b/startup/startup_standard/systemparamter/src/main/js/TestAbility/i18n/en-US.json deleted file mode 100644 index 3cb24b374b1d919ca8eac0638f361692b603a900..0000000000000000000000000000000000000000 --- a/startup/startup_standard/systemparamter/src/main/js/TestAbility/i18n/en-US.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - }, - "Files": { - } -} \ No newline at end of file diff --git a/startup/startup_standard/systemparamter/src/main/js/TestAbility/i18n/zh-CN.json b/startup/startup_standard/systemparamter/src/main/js/TestAbility/i18n/zh-CN.json deleted file mode 100644 index c804e32c0c3103929baca5617cdac70be11fdba1..0000000000000000000000000000000000000000 --- a/startup/startup_standard/systemparamter/src/main/js/TestAbility/i18n/zh-CN.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - }, - "Files": { - } -} \ No newline at end of file diff --git a/startup/startup_standard/systemparamter/src/main/js/TestAbility/pages/index/index.css b/startup/startup_standard/systemparamter/src/main/js/TestAbility/pages/index/index.css deleted file mode 100644 index b1bcd43387ba131cc1d30975ff7508a6f8084a4b..0000000000000000000000000000000000000000 --- a/startup/startup_standard/systemparamter/src/main/js/TestAbility/pages/index/index.css +++ /dev/null @@ -1,30 +0,0 @@ -.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/startup/startup_standard/systemparamter/src/main/js/TestAbility/pages/index/index.hml b/startup/startup_standard/systemparamter/src/main/js/TestAbility/pages/index/index.hml deleted file mode 100644 index f629c71a9be857db6cdf94149652a191b9b272ea..0000000000000000000000000000000000000000 --- a/startup/startup_standard/systemparamter/src/main/js/TestAbility/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/startup/startup_standard/systemparamter/src/main/js/TestAbility/pages/index/index.js b/startup/startup_standard/systemparamter/src/main/js/TestAbility/pages/index/index.js deleted file mode 100644 index 88b083a7f6b979019d6a2c5ad20b19c5fd43286b..0000000000000000000000000000000000000000 --- a/startup/startup_standard/systemparamter/src/main/js/TestAbility/pages/index/index.js +++ /dev/null @@ -1,26 +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. - */ - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - } -} - - - diff --git a/startup/startup_standard/systemparamter/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/startup/startup_standard/systemparamter/src/main/js/TestRunner/OpenHarmonyTestRunner.js deleted file mode 100644 index c5fa8620ca77d381f20b65a903b833e6e3378c97..0000000000000000000000000000000000000000 --- a/startup/startup_standard/systemparamter/src/main/js/TestRunner/OpenHarmonyTestRunner.js +++ /dev/null @@ -1,59 +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 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/startup/startup_standard/systemparamter/src/main/js/test/List.test.js b/startup/startup_standard/systemparamter/src/main/js/test/List.test.js deleted file mode 100644 index 469bc5f5dab086d26182f13efa328f2a87ea7667..0000000000000000000000000000000000000000 --- a/startup/startup_standard/systemparamter/src/main/js/test/List.test.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * 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 SystemParameterTest from './SysParametersJs.test.js' -export default function testsuite() { -SystemParameterTest() -} diff --git a/startup/startup_standard/systemparamter/src/main/js/test/SysParametersJs.test.js b/startup/startup_standard/systemparamter/src/main/js/test/SysParametersJs.test.js deleted file mode 100644 index fc884ddb12efb6a26f7da4e5e7fff524e8df4b73..0000000000000000000000000000000000000000 --- a/startup/startup_standard/systemparamter/src/main/js/test/SysParametersJs.test.js +++ /dev/null @@ -1,325 +0,0 @@ -/* - * 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. - */ - -// @ts-nocheck - -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -import systemparameter from '@ohos.systemparameter' - -export default function SystemParameterTest() { -describe('SystemParameterTest', function () { - - console.info('SystemParameterTest start################################start'); - - function SetParameter(key, value) { - let tmp = value; - if (value === "" || value === undefined) { - let myDate = new Date(); - tmp = myDate.toLocaleString(); - } - - console.info('SetParameter key ' + key); - console.info('SetParameter value ' + tmp); - try { - systemparameter.setSync(key, tmp); - } catch (err) { - expect(ret).assertTrue(); - console.info('SetParameter error: ' + err); - } - console.info('SetParameter key' + key + " end"); - } - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0801 - * @tc.name testWaitPromise01 - * @tc.desc Waits the value of the attribute with the specified key. - */ - it('testWaitPromise01', 0, async function (done) { - console.info('testWaitPromise01 start'); - let ret = false; - try { - var parameterInfo = systemparameter.wait("test.wait_param.101", "100", 1); - parameterInfo.then(function (result) { // timeout - console.info("testWaitPromise01 test.wait_param.101 success: " + result); - expect(ret).assertTrue(); - }).catch(function (err) { - ret = true; - console.info("testWaitPromise01 test.wait_param.101 error: " + err.code); - expect(ret).assertTrue(); - done(); - }); - } catch (e) { - expect(ret).assertTrue(); - console.info("promise get input error: " + e); - } - console.info('testWaitPromise01 end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0802 - * @tc.name testWaitPromise02 - * @tc.desc Waits the value of the attribute with the specified key. - */ - it('testWaitPromise02', 0, async function (done) { - console.info('testWaitPromise02 start'); - let ret = false; - try { - var parameterInfo = systemparameter.wait("test.wait_param.102", "", 1); - parameterInfo.then(function (result) { // timeout - console.info("testWaitPromise02 test.wait_param.102 success: "); - expect(ret).assertTrue(); - done(); - }).catch(function (err) { - ret = true; - console.info("testWaitPromise02 test.wait_param.102 error: " + err.code); - expect(ret).assertTrue(); - done(); - }); - } catch (e) { - expect(ret).assertTrue(); - console.info("promise get input error: " + e); - } - console.info('testWaitPromise02 end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0803 - * @tc.name testWaitPromise03 - * @tc.desc Waits the value of the attribute with the specified key. - */ - it('testWaitPromise03', 0, async function (done) { - console.info('testWaitPromise03 start'); - let ret = false; - SetParameter("test.wait_param.103", "103"); - try { - var parameterInfo = systemparameter.wait("test.wait_param.103", "103", 1); - parameterInfo.then(function (result) { // ok - ret = true; - console.info("testWaitPromise03 test.wait_param.103 success: "); - expect(ret).assertTrue(); - done(); - }).catch(function (err) { - expect(ret).assertTrue(); - console.info("testWaitPromise03 test.wait_param.103 error: " + err.code); - }); - } catch (e) { - expect(ret).assertTrue(); - console.info("promise get input error: " + e); - } - console.info('testWaitPromise03 end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0804 - * @tc.name testWaitPromise04 - * @tc.desc Waits the value of the attribute with the specified key. - */ - it('testWaitPromise04', 0, async function (done) { - console.info('testWaitPromise04 start'); - let ret = false; - SetParameter("test.wait_param.104", "104"); - try { - var parameterInfo = systemparameter.wait("test.wait_param.104", "*", 1); - parameterInfo.then(function (result) { // ok - ret = true; - console.info("testWaitPromise04 test.wait_param.104 success"); - expect(ret).assertTrue(); - done(); - }).catch(function (err) { - console.info("testWaitPromise04 test.wait_param.104 error: " + err.code); - expect(ret).assertTrue(); - }); - } catch (e) { - expect(ret).assertTrue(); - console.info("promise get input error: " + e); - } - console.info('testWaitPromise04 end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0805 - * @tc.name testWaitPromise05 - * @tc.desc Waits the value of the attribute with the specified key. - */ - it('testWaitPromise05', 0, async function (done) { - console.info('testWaitPromise05 start'); - let ret = false; - SetParameter("test.wait_param.105", "105"); - try { - var parameterInfo = systemparameter.wait("test.wait_param.105", "*", -1); - parameterInfo.then(function (result) { - ret = true; - console.info("testWaitPromise05 test.wait_param.105 success"); - expect(ret).assertTrue(); - done(); - }).catch(function (err) { - console.info("testWaitPromise05 test.wait_param.105 error: " + err.code); - expect(ret).assertTrue(); - }); - } catch (e) { - expect(ret).assertTrue(); - console.info("promise get input error: " + e); - } - console.info('testWaitPromise05 end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0806 - * @tc.name testWait01 - * @tc.desc Waits the value of the attribute with the specified key. - */ - it('testWait01', 0, async function (done) { - console.info('testWait01 start'); - let ret = false; - try { - systemparameter.wait("test.wait_param.201", "100", 1, function (err, data) { - if (err == undefined || err.code === 0) { - console.info("testWait01 test.wait_param.201 success") - } else { - ret = true; // wait timeout - console.info("testWait01 test.wait_param.201 err:" + err.code); - expect(ret).assertTrue(); - } - }); - } catch (e) { - expect(ret).assertTrue(); - console.info("testWait01 get input error: " + e); - } - setTimeout(function () { - expect(ret).assertTrue(); - done(); - }, '2000'); - console.info('testWait01 end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0807 - * @tc.name testWait02 - * @tc.desc Waits the value of the attribute with the specified key. - */ - it('testWait02', 0, async function (done) { - console.info('testWait02 start'); - let ret = false; - try { - ret = true; - systemparameter.wait("test.wait_param.202", "", 1, function (err, data) { - if (err == undefined || err.code === 0) { // timeout - ret = false; - console.info("testWait02 test.wait_param.202 success"); - } else { - console.info("testWait02 callback test.wait_param.202 err:" + err.code); - } - expect(ret).assertTrue(); - done(); - }); - } catch (e) { - ret = true; - console.info("get input error: " + e); - } - expect(ret).assertTrue(); - console.info('testWait02 end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0808 - * @tc.name testWait03 - * @tc.desc Waits the value of the attribute with the specified key. - */ - it('testWait03', 0, async function (done) { - console.info('testWait03 start'); - let ret = false; - SetParameter("test.wait_param.203", "103"); - try { - systemparameter.wait("test.wait_param.203", "103", 1, function (err, data) { - if (err == undefined || err.code === 0) { - ret = true; - console.info("testWait03 test.wait_param.203 success") - } else { - console.info("testWait03 test.wait_param.203 err:" + err.code) - } - expect(ret).assertTrue(); - }); - } catch (e) { - expect(ret).assertTrue(); - console.info("get input error: " + e); - } - setTimeout(function () { - expect(ret).assertTrue(); - done(); - }, '1000'); - console.info('testWait03 end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0809 - * @tc.name testWait04 - * @tc.desc Waits the value of the attribute with the specified key. - */ - it('testWait04', 0, async function (done) { - console.info('testWait04 start'); - let ret = false; - SetParameter("test.wait_param.204", "104"); - try { - systemparameter.wait("test.wait_param.204", "*", 1, function (err, data) { - if (err == undefined || err.code === 0) { - ret = true; - console.info("testWait04 test.wait_param.204 success") - } else { - ret = false; - console.info("testWait04 callback test.wait_param.204 err:" + err.code) - } - expect(ret).assertTrue(); - }); - } catch (e) { - expect(ret).assertTrue(); - console.info("promise get input error: " + e); - } - setTimeout(function () { - expect(ret).assertTrue(); - done(); - }, '1000'); - console.info('testWait04 end'); - }) - - /** - * @tc.number SUB_STARTUP_JS_SYSTEM_PARAMETER_0810 - * @tc.name testWait05 - * @tc.desc Waits the value of the attribute with the specified key. - */ - it('testWait05', 0, async function (done) { - console.info('testWait05 start'); - let ret = false; - SetParameter("test.wait_param.205", "105"); - try { - systemparameter.wait("test.wait_param.205", "*", 1, function (err, data) { - if (err == undefined || err.code === 0) { - ret = true; - console.info("testWait05 test.wait_param.205 success:" + data) - } else { - console.info("testWait05 test.wait_param.205 err:" + err.code) - } - expect(ret).assertTrue(); - }); - } catch (e) { - ret = false; - console.info("promise get input error: " + e); - } - setTimeout(function () { - expect(ret).assertTrue(); - done(); - }, '1000'); - console.info('testWait05 end'); - }) -})} diff --git a/startup/startup_standard/systemparamter/src/main/resources/base/element/string.json b/startup/startup_standard/systemparamter/src/main/resources/base/element/string.json deleted file mode 100644 index e9b5810c2494e0272493b11c24e7293124d12267..0000000000000000000000000000000000000000 --- a/startup/startup_standard/systemparamter/src/main/resources/base/element/string.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "StartupJSApiTest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature 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 diff --git a/startup_lite/bootstrap_hal/BUILD.gn b/startup_lite/bootstrap_hal/BUILD.gn index 08d2099e80ac69d519a58b7ddd7f6068f36076b2..9c19070bbc258312291a1dbbeb33bb505d105847 100644 --- a/startup_lite/bootstrap_hal/BUILD.gn +++ b/startup_lite/bootstrap_hal/BUILD.gn @@ -19,7 +19,7 @@ hctest_suite("ActsBootstrapTest") { include_dirs = [ "src", - "//utils/native/native_lite/include", + "//commonlibrary/utils_lite/include", ] cflags = [ "-Wno-error" ] } diff --git a/startup_lite/bootstrap_posix/BUILD.gn b/startup_lite/bootstrap_posix/BUILD.gn index 612c22bf77dd540672ae6d188d9ccd6eca0ffd05..47724527b6843af7b9fecfa4330c8e9cf9f33baf 100755 --- a/startup_lite/bootstrap_posix/BUILD.gn +++ b/startup_lite/bootstrap_posix/BUILD.gn @@ -22,7 +22,7 @@ hcpptest_suite("ActsBootstrapTest") { include_dirs = [ "src", - "//utils/native/native_lite/include", + "//commonlibrary/utils_lite/include", "//third_party/bounds_checking_function/include/", "//foundation/systemabilitymgr/samgr_lite/interfaces/kits/samgr", ] diff --git a/startup_lite/syspara_hal/BUILD.gn b/startup_lite/syspara_hal/BUILD.gn index b9f1f6356a6dd90fbe71357056663a51f5092641..95257013cdb1c0b5aadf113b528cb06b88de82ac 100755 --- a/startup_lite/syspara_hal/BUILD.gn +++ b/startup_lite/syspara_hal/BUILD.gn @@ -16,6 +16,7 @@ import("//test/xts/tools/lite/build/suite_lite.gni") hctest_suite("ActsParameterTest") { suite_name = "acts" sources = [ + "src/deviceinfo_func_test.c", "src/parameter_func_test.c", "src/parameter_reli_test.c", "src/parameter_utils.c", diff --git a/startup_lite/syspara_hal/src/deviceinfo_func_test.c b/startup_lite/syspara_hal/src/deviceinfo_func_test.c new file mode 100644 index 0000000000000000000000000000000000000000..7622e290ae0c76f3a9904408cb87eb16bc5bae27 --- /dev/null +++ b/startup_lite/syspara_hal/src/deviceinfo_func_test.c @@ -0,0 +1,718 @@ +/* + * 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. + */ + +#include +#include "hctest.h" +#include "ohos_types.h" +#include "parameter.h" +#include "parameter_utils.h" + +#define MAX_LEN 128 +#define INVALID_LEN 2 +#define COMMON_ERROR (-1) +#define INVALID_PARAMETER (-9) + +static const char* g_defSysParam = "data of sys param ***..."; + +/** + * @tc.desc : register a test suite, this suite is used to test basic flow + * and interface dependency + * @param : subsystem name is utils + * @param : module name is parameter + * @param : test suit name is DeviceInfoFuncTestSuite + */ +LITE_TEST_SUIT(startup, deviceinfo, DeviceInfoFuncTestSuite); + +/** + * @tc.setup : setup for all testcases + * @return : setup result, TRUE is success, FALSE is fail + */ +static BOOL DeviceInfoFuncTestSuiteSetUp(void) +{ + return TRUE; +} + +/** + * @tc.teardown : teardown for all testcases + * @return : teardown result, TRUE is success, FALSE is fail + */ +static BOOL DeviceInfoFuncTestSuiteTearDown(void) +{ + printf("+--------------------------------------------+\n"); + return TRUE; +} + +/** + * @tc.name : testGetDeviceTypeFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_0100 + * @tc.desc : test obtaining device info DeviceType is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetDeviceTypeFun001, + Function | MediumTest | Level1) { + const char* value = GetDeviceType(); + printf("Device Type=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetDeviceTypeFun002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_0200 + * @tc.desc : test obtaining device info DeviceType that less than 32 + * characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetDeviceTypeFun002, + Function | MediumTest | Level1) { + const char* value = GetDeviceType(); + printf("Device Type=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 32); + } +}; + +/** + * @tc.name : testGetManufactureFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_0300 + * @tc.desc : test obtaining device info Manufacture is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetManufactureFun001, + Function | MediumTest | Level1) { + const char* value = GetManufacture(); + printf("Manufacture=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetManufactureFun002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_0400 + * @tc.desc : test obtaining device info Manufacture that less than 32 + * characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetManufactureFun002, + Function | MediumTest | Level1) { + const char* value = GetManufacture(); + printf("Manufacture=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 32); + } +}; + +/** + * @tc.name : testGetBrandFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_0500 + * @tc.desc : test obtaining device info Brand is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetBrandFun001, + Function | MediumTest | Level1) { + const char* value = GetBrand(); + printf("Brand=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetBrandFun002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_0600 + * @tc.desc : test obtaining device info Brand that less than 32 + * characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetBrandFun002, + Function | MediumTest | Level1) { + const char* value = GetBrand(); + printf("Brand=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 32); + } +}; + +/** + * @tc.name : testGetMarketNameFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_0700 + * @tc.desc : test obtaining device info MarketName is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetMarketNameFun001, + Function | MediumTest | Level1) { + const char* value = GetMarketName(); + printf("Market Name=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetMarketNameFun002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_0800 + * @tc.desc : test obtaining device info MarketName that less than 32 + * characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetMarketNameFun002, + Function | MediumTest | Level1) { + const char* value = GetMarketName(); + printf("Market Name=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 32); + } +}; + +/** + * @tc.name : testGetProductSeriesFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_0900 + * @tc.desc : test obtaining device info ProductSeries is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetProductSeriesFun001, + Function | MediumTest | Level1) { + const char* value = GetProductSeries(); + printf("Product Series=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetProductSeriesFun002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1000 + * @tc.desc : test obtaining device info ProductSeries that less than 32 + * characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetProductSeriesFun002, + Function | MediumTest | Level1) { + const char* value = GetProductSeries(); + printf("Product Series=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 32); + } +}; + +/** + * @tc.name : testGetProductModelFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1100 + * @tc.desc : test obtaining device info ProductModel is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetProductModelFun001, + Function | MediumTest | Level1) { + const char* value = GetProductModel(); + printf("Product Model=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetProductModelFun002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1200 + * @tc.desc : test obtaining device info ProductModel that less than 32 + * characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetProductModelFun002, + Function | MediumTest | Level1) { + const char* value = GetProductModel(); + printf("Product Model=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 32); + } +}; + +/** + * @tc.name : testGetHardwareModel001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1300 + * @tc.desc : test obtaining device info HardwareModel is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetHardwareModel001, + Function | MediumTest | Level1) { + const char* value = GetHardwareModel(); + printf("Hardware Model=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetHardwareModel002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1400 + * @tc.desc : test obtaining device info HardwareModel that less than 32 + * characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetHardwareModel002, + Function | MediumTest | Level1) { + const char* value = GetHardwareModel(); + printf("Hardware Model=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 32); + } +}; + +/** + * @tc.name : testGetSerialFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1500 + * @tc.desc : test obtaining device info Serial is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetSerialFun001, + Function | MediumTest | Level1) { + const char* value = GetSerial(); + printf("Serial=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetSerialFun002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1600 + * @tc.desc : test obtaining device info Serial that less than 64 + * characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetSerialFun002, + Function | MediumTest | Level1) { + const char* value = GetSerial(); + printf("Serial=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 64); + } +}; + +/** + * @tc.name : testGetOSFullNameFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1700 + * @tc.desc : test obtaining device info OSFullName is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetOSFullNameFun001, + Function | MediumTest | Level1) { + const char* value = GetOSFullName(); + printf("Os Name=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetOSFullNameFun002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1800 + * @tc.desc : test obtaining device info OSFullName that less than 64 + * characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetOSFullNameFun002, + Function | MediumTest | Level1) { + const char* value = GetOSFullName(); + printf("Os Name=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 64); + } +}; + +/** + * @tc.name : testGetDisplayVersionFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_1900 + * @tc.desc : test obtaining device info DisplayVersion is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetDisplayVersionFun001, + Function | MediumTest | Level1) { + const char* value = GetDisplayVersion(); + printf("Display Version=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetDisplayVersionFun002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2000 + * @tc.desc : test obtaining device info DisplayVersion that less than 64 + * characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetDisplayVersionFun002, + Function | MediumTest | Level1) { + const char* value = GetDisplayVersion(); + printf("Display Version=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 64); + } +}; + +/** + * @tc.name : testGetBootloaderVersionFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2100 + * @tc.desc : test obtaining device info BootloaderVersion is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetBootloaderVersionFun001, + Function | MediumTest | Level1) { + const char* value = GetBootloaderVersion(); + printf("Bootloader Version=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetBootloaderVersionFun002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2200 + * @tc.desc : test obtaining device info BootloaderVersion that less + * than 64 characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetBootloaderVersionFun002, + Function | MediumTest | Level1) { + const char* value = GetBootloaderVersion(); + printf("Bootloader Version=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 64); + } +}; + +/** + * @tc.name : testGetSecurityPatchTagFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2300 + * @tc.desc : test obtaining device info SecurityPatchTag is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetSecurityPatchTagFun001, + Function | MediumTest | Level1) { + const char* value = GetSecurityPatchTag(); + printf("Secure Patch Level=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetSecurityPatchTagFun002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2400 + * @tc.desc : test obtaining device info SecurityPatchTag that less + * than 64 characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetSecurityPatchTagFun002, + Function | MediumTest | Level1) { + const char* value = GetSecurityPatchTag(); + printf("Secure Patch Level=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 64); + } +}; + +/** + * @tc.name : testGetSecurityPatchTagFun003 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2500 + * @tc.desc : test obtaining device info SecurityPatchTag which format is + * yy-mm-dd + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetSecurityPatchTagFun003, + Function | MediumTest | Level1) { + const char* value = GetSecurityPatchTag(); + printf("Secure Patch Level=%s\n", value); + + int year, month, day; + sscanf(value, "%04d-%02d-%02d", &year, &month, &day); + printf("%04d-%02d-%02d\n", year, month, day); + + TEST_ASSERT_TRUE(year > 1900 && year < 2056); + TEST_ASSERT_TRUE(month <= 12 && month > 0); + TEST_ASSERT_TRUE(day <= 31 && day > 0); + + char str[10] = {0}; + sprintf(str, "%d-%02d-%02d", year, month, day); + printf("str=%s\n", str); + TEST_ASSERT_EQUAL_STRING(str, value); +}; + +/** + * @tc.name : testGetAbiListFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2600 + * @tc.desc : test obtaining device info AbiList is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetAbiListFun001, + Function | MediumTest | Level1) { + const char* value = GetAbiList(); + printf("Abi List=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetAbiListFun002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2700 + * @tc.desc : test obtaining device info AbiList that less than 64 + * characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetAbiListFun002, + Function | MediumTest | Level1) { + const char* value = GetAbiList(); + printf("Abi List=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 64); + } +}; + +/** + * @tc.name : testGetSdkApiVersionFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2800 + * @tc.desc : test obtaining device info SdkApiVersion is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetSdkApiVersionFun001, + Function | MediumTest | Level1) { + int value = GetSdkApiVersion(); + printf("Sdk Api Level=%d\n", value); + TEST_ASSERT_TRUE(value > 0); +}; + +/** + * @tc.name : testGetFirstApiVersionFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_2900 + * @tc.desc : test obtaining device info FirstApiVersion is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetFirstApiVersionFun001, + Function | MediumTest | Level1) { + int value = GetFirstApiVersion(); + printf("First Api Level=%d\n", value); + TEST_ASSERT_TRUE(value > 0); +}; + +/** + * @tc.name : testGetIncrementalVersionFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3000 + * @tc.desc : test obtaining device info IncrementalVersion is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetIncrementalVersionFun001, + Function | MediumTest | Level1) { + const char* value = GetIncrementalVersion(); + printf("Incremental Version=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetVersionIdFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3100 + * @tc.desc : test obtaining device info VersionId is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetVersionIdFun001, + Function | MediumTest | Level1) { + const char* value = GetVersionId(); + printf("Version Id=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetVersionIdFun002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3200 + * @tc.desc : test obtaining device info VersionId that less than 127 + * characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetVersionIdFun002, + Function | MediumTest | Level1) { + const char* value = GetVersionId(); + printf("Version Id=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 127); + } +}; + +/** + * @tc.name : testGetBuildTypeFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3300 + * @tc.desc : test obtaining device info BuildType is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetBuildTypeFun001, + Function | MediumTest | Level1) { + const char* value = GetBuildType(); + printf("Build Type=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetBuildTypeFun002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3400 + * @tc.desc : test obtaining device info BuildType that less than 32 + * characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetBuildTypeFun002, + Function | MediumTest | Level1) { + const char* value = GetBuildType(); + printf("Build Type=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 32); + } +}; + +/** + * @tc.name : testGetBuildUserFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3500 + * @tc.desc : test obtaining device info BuildUser is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetBuildUserFun001, + Function | MediumTest | Level1) { + const char* value = GetBuildUser(); + printf("Build User=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetBuildUserFun002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3600 + * @tc.desc : test obtaining device info BuildUser that less than 32 + * characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetBuildUserFun002, + Function | MediumTest | Level1) { + const char* value = GetBuildUser(); + printf("Build User=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 32); + } +}; + +/** + * @tc.name : testGetBuildHostFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3700 + * @tc.desc : test obtaining device info BuildHost is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetBuildHostFun001, + Function | MediumTest | Level1) { + const char* value = GetBuildHost(); + printf("Build Host=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetBuildHostFun002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3800 + * @tc.desc : test obtaining device info BuildHost that less than 32 + * characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetBuildHostFun002, + Function | MediumTest | Level1) { + const char* value = GetBuildHost(); + printf("Build Host=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 32); + } +}; + +/** + * @tc.name : testGetBuildTimeFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_3900 + * @tc.desc : test obtaining device info BuildTime is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetBuildTimeFun001, + Function | MediumTest | Level1) { + const char* value = GetBuildTime(); + printf("Build Time=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetBuildTimeFun002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_4000 + * @tc.desc : test obtaining device info BuildTime that less than 32 + * characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetBuildTimeFun002, + Function | MediumTest | Level1) { + const char* value = GetBuildTime(); + printf("Build Time=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 32); + } +}; + +/** + * @tc.name : testGetSoftwareModelFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_4100 + * @tc.desc : test obtaining device info SoftwareModel is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetSoftwareModelFun001, + Function | MediumTest | Level1) { + const char* value = GetSoftwareModel(); + printf("Software Model=%s\n", value); + AssertNotEmpty(value); +}; + +/** + * @tc.name : testGetSoftwareModelFun002 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_4200 + * @tc.desc : test obtaining device info SoftwareModel that less than 32 + * characters. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetSoftwareModelFun002, + Function | MediumTest | Level1) { + const char* value = GetSoftwareModel(); + printf("Software Model=%s\n", value); + TEST_ASSERT_NOT_NULL(value); + if (value != NULL) { + TEST_ASSERT_TRUE(strlen(value) <= 32); + } +}; + +/** + * @tc.name : testGetBuildRootHashFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_4500 + * @tc.desc : test obtaining device info BuildRootHash is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetBuildRootHashFun001, + Function | MediumTest | Level1) { + const char* value = GetBuildRootHash(); + printf("Build Root Hash=%s\n", value); + TEST_ASSERT_NOT_NULL(value); +}; + +/** + * @tc.name : testGetHardwareProfileFun001 + * @tc.number : SUB_STARTUP_MINI_DEVICEINFO_FUN_4600 + * @tc.desc : test obtaining device info HardwareProfile is not null. + */ +LITE_TEST_CASE(DeviceInfoFuncTestSuite, + testGetHardwareProfileFun001, + Function | MediumTest | Level1) { + const char* value = GetHardwareProfile(); + printf("Hardware Profile=%s\n", value); + AssertNotEmpty(value); +}; + +RUN_TEST_SUITE(DeviceInfoFuncTestSuite); diff --git a/startup_lite/syspara_hal/src/parameter_func_test.c b/startup_lite/syspara_hal/src/parameter_func_test.c index d9c6b5e24bb57b471e1d2832fb0b5282e06d2ffd..0fd08e31fec3132270aeca72cc3820383e55b63c 100755 --- a/startup_lite/syspara_hal/src/parameter_func_test.c +++ b/startup_lite/syspara_hal/src/parameter_func_test.c @@ -13,21 +13,22 @@ * limitations under the License. */ -#include "ohos_types.h" #include #include "hctest.h" +#include "ohos_types.h" #include "parameter.h" #include "parameter_utils.h" -#define MAX_LEN 128 -#define INVALID_LEN 2 +#define MAX_LEN 128 +#define INVALID_LEN 2 #define COMMON_ERROR (-1) #define INVALID_PARAMETER (-9) static const char* g_defSysParam = "data of sys param ***..."; /** - * @tc.desc : register a test suite, this suite is used to test basic flow and interface dependency + * @tc.desc : register a test suite, this suite is used to test basic flow + * and interface dependency * @param : subsystem name is utils * @param : module name is parameter * @param : test suit name is ParameterFuncTestSuite @@ -53,318 +54,14 @@ static BOOL ParameterFuncTestSuiteTearDown(void) return TRUE; } -/** - * @tc.number : SUB_UTILS_PARAMETER_0100 - * @tc.name : Obtaining system parameter DeviceType - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara001, Function | MediumTest | Level1) -{ - const char* value = GetDeviceType(); - printf("Device Type=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_0200 - * @tc.name : Obtaining system parameter Manufacture - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara002, Function | MediumTest | Level1) -{ - const char* value = GetManufacture(); - printf("Manufacture=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_0300 - * @tc.name : Obtaining system parameter Brand - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara003, Function | MediumTest | Level1) -{ - const char* value = GetBrand(); - printf("Brand=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_0400 - * @tc.name : Obtaining system parameter MarketName - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara004, Function | MediumTest | Level1) -{ - const char* value = GetMarketName(); - printf("Market Name=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_0500 - * @tc.name : Obtaining system parameter ProductSeries - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara005, Function | MediumTest | Level1) -{ - const char* value = GetProductSeries(); - printf("Product Series=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_0600 - * @tc.name : Obtaining system parameter ProductModel - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara006, Function | MediumTest | Level1) -{ - const char* value = GetProductModel(); - printf("Product Model=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_0700 - * @tc.name : Obtaining system parameter HardwareModel - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara007, Function | MediumTest | Level1) -{ - const char* value = GetHardwareModel(); - printf("Hardware Model=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_0800 - * @tc.name : Obtaining system parameter HardwareProfile - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara008, Function | MediumTest | Level1) -{ - const char* value = GetHardwareProfile(); - printf("Hardware Profile=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_0900 - * @tc.name : Obtaining system parameter Serial - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara009, Function | MediumTest | Level1) -{ - const char* value = GetSerial(); - printf("Serial=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_1000 - * @tc.name : Obtaining system parameter OsName - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara010, Function | MediumTest | Level1) -{ - const char* value = GetOSFullName(); - printf("Os Name=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_1100 - * @tc.name : Obtaining system parameter DisplayVersion - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara011, Function | MediumTest | Level1) -{ - const char* value = GetDisplayVersion(); - printf("Display Version=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_1200 - * @tc.name : Obtaining system parameter BootloaderVersion - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara012, Function | MediumTest | Level1) -{ - const char* value = GetBootloaderVersion(); - printf("Bootloader Version=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_1300 - * @tc.name : Obtaining system parameter SecurityPatchTag - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara013, Function | MediumTest | Level1) -{ - const char* value = GetSecurityPatchTag(); - printf("Secure Patch Level=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_8200 - * @tc.name : Obtaining system parameter SecurityPatchTag which format is yy--mm--dd - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetSecurityPatchTag02, Function | MediumTest | Level1) -{ - const char *value = GetSecurityPatchTag(); - printf("Secure Patch Level=%s\n", value); - int year, month, day; - - sscanf(value, "%04d-%02d-%02d", &year, &month, &day); - printf("%d-%02d-%02d\n", year, month, day); - char *str = ("%d-%02d-%02d\n", year, month, day); - TEST_ONLY(); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_1400 - * @tc.name : Obtaining system parameter AbiList - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara014, Function | MediumTest | Level1) -{ - const char* value = GetAbiList(); - printf("Abi List=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_1500 - * @tc.name : Obtaining system parameter FirstApiLevel - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara015, Function | MediumTest | Level1) -{ - int value = GetFirstApiVersion(); - printf("First Api Level=%d\n", value); - TEST_ASSERT_TRUE(value > 0); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_1600 - * @tc.name : Obtaining system parameter IncrementalVersion - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara016, Function | MediumTest | Level1) -{ - const char* value = GetIncrementalVersion(); - printf("Incremental Version=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_1700 - * @tc.name : Obtaining system parameter VersionId - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara017, Function | MediumTest | Level1) -{ - const char* value = GetVersionId(); - printf("Version Id=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_1800 - * @tc.name : Obtaining system parameter BuildType - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara018, Function | MediumTest | Level1) -{ - const char* value = GetBuildType(); - printf("Build Type=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_1900 - * @tc.name : Obtaining system parameter BuildUser - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara019, Function | MediumTest | Level1) -{ - const char* value = GetBuildUser(); - printf("Build User=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_2000 - * @tc.name : Obtaining system parameter BuildHost - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara020, Function | MediumTest | Level1) -{ - const char* value = GetBuildHost(); - printf("Build Host=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_2100 - * @tc.name : Obtaining system parameter BuildTime - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara021, Function | MediumTest | Level1) -{ - const char* value = GetBuildTime(); - printf("Build Time=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_2200 - * @tc.name : Obtaining system parameter BuildRootHash - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara022, Function | MediumTest | Level1) -{ - const char* value = GetBuildRootHash(); - printf("Build Root Hash=%s\n", value); - TEST_ASSERT_NOT_NULL(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_2300 - * @tc.name : Obtaining system parameter SoftwareModel - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara023, Function | MediumTest | Level1) -{ - const char* value = GetSoftwareModel(); - printf("Software Model=%s\n", value); - AssertNotEmpty(value); -}; - -/** - * @tc.number : SUB_UTILS_PARAMETER_2400 - * @tc.name : Obtaining system parameter SdkApiLevel - * @tc.desc : [C- SOFTWARE -0200] - */ -LITE_TEST_CASE(ParameterFuncTestSuite, testObtainSysPara024, Function | MediumTest | Level1) -{ - int value = GetSdkApiVersion(); - printf("Sdk Api Level=%d\n", value); - TEST_ASSERT_TRUE(value > 0); -}; - /** * @tc.number : SUB_UTILS_PARAMETER_2500 * @tc.name : SetParameter parameter legal test * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter001, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testSetParameter001, + Function | MediumTest | Level1) { int ret; char key[] = "rw.sys.version_606"; @@ -378,8 +75,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter001, Function | MediumTes * @tc.name : SetParameter parameter legal test with Special characters * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter002, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testSetParameter002, + Function | MediumTest | Level1) { int ret; char key[] = "_._..__...___"; @@ -390,11 +88,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter002, Function | MediumTes /** * @tc.number : SUB_UTILS_PARAMETER_2700 - * @tc.name : SetParameter parameter legal test using key with only lowercase + * @tc.name : SetParameter parameter legal test using key with only + * lowercase * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter003, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testSetParameter003, + Function | MediumTest | Level1) { int ret; char key[] = "keywithonlylowercase"; @@ -408,8 +108,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter003, Function | MediumTes * @tc.name : SetParameter parameter legal test using key with only number * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter004, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testSetParameter004, + Function | MediumTest | Level1) { int ret; char key[] = "202006060602"; @@ -420,11 +121,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter004, Function | MediumTes /** * @tc.number : SUB_UTILS_PARAMETER_2900 - * @tc.name : SetParameter parameter legal test using key and value with maximum length + * @tc.name : SetParameter parameter legal test using key and value with + * maximum length * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter005, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testSetParameter005, + Function | MediumTest | Level1) { int ret; char key1[] = "rw.sys.version.version.version"; @@ -433,7 +136,8 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter005, Function | MediumTes TEST_ASSERT_EQUAL_INT(0, ret); char key2[] = "rw.sys.version.version"; - char value2[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklm\ + char value2[] = + "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklm\ nopqrstuvwxyz1234567890abcdefghijklmnopqrstuvw"; ret = SetParameter(key2, value2); TEST_ASSERT_EQUAL_INT(0, ret); @@ -441,74 +145,74 @@ nopqrstuvwxyz1234567890abcdefghijklmnopqrstuvw"; /** * @tc.number : SUB_UTILS_PARAMETER_3000 - * @tc.name : SetParameter parameter illegal test when key is nullptr and value is nullptr + * @tc.name : SetParameter parameter illegal test when key is nullptr and + * value is nullptr * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter006, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testSetParameter006, + Function | MediumTest | Level1) { int ret; char value[] = "test with null"; ret = SetParameter(NULL, value); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } char key[] = "rw.sys.version"; ret = SetParameter(key, NULL); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } }; /** * @tc.number : SUB_UTILS_PARAMETER_3100 - * @tc.name : SetParameter parameter illegal test when key is NULL and value is NULL + * @tc.name : SetParameter parameter illegal test when key is NULL and + * value is NULL * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter007, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testSetParameter007, + Function | MediumTest | Level1) { int ret; char value[] = "test with null"; ret = SetParameter("\0", value); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } char key[] = "rw.sys.version"; ret = SetParameter(key, "\0"); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } }; /** * @tc.number : SUB_UTILS_PARAMETER_3200 - * @tc.name : SetParameter parameter illegal test when key len is 32 or more than 32 bytes + * @tc.name : SetParameter parameter illegal test when key len is 32 or + * more than 32 bytes * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter008, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testSetParameter008, + Function | MediumTest | Level1) { int ret; char key1[] = "rw.sys.version.version.version.v"; char value1[] = "set with key = 32"; ret = SetParameter(key1, value1); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } char key2[] = "rw.sys.version.version.version.version"; char value2[] = "set with key > 32"; ret = SetParameter(key2, value2); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } }; @@ -518,15 +222,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter008, Function | MediumTes * @tc.name : SetParameter parameter illegal test using key with uppercase * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter009, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testSetParameter009, + Function | MediumTest | Level1) { int ret; char key[] = "Rw.Sys.Version.Version"; char value[] = "set value with uppercase"; ret = SetParameter(key, value); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } }; @@ -536,72 +240,77 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter009, Function | MediumTes * @tc.name : SetParameter parameter illegal test using key with blank * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter010, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testSetParameter010, + Function | MediumTest | Level1) { int ret; char key[] = "rw sys version version"; char value[] = "set value with blank"; ret = SetParameter(key, value); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } }; /** * @tc.number : SUB_UTILS_PARAMETER_3500 - * @tc.name : SetParameter parameter illegal test using key with invalid special characters + * @tc.name : SetParameter parameter illegal test using key with invalid + * special characters * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter011, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testSetParameter011, + Function | MediumTest | Level1) { int ret; char key[] = "rw+sys&version%version*"; char value[] = "set value with special characters"; ret = SetParameter(key, value); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } }; /** * @tc.number : SUB_UTILS_PARAMETER_3600 - * @tc.name : SetParameter parameter illegal test when value length is 128 or more than 128 bytes + * @tc.name : SetParameter parameter illegal test when value length is 128 + * or more than 128 bytes * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter012, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testSetParameter012, + Function | MediumTest | Level1) { int ret; char key1[] = "rw.sys.version.version1"; - char value1[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\ + char value1[] = + "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\ abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrst"; ret = SetParameter(key1, value1); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } char key2[] = "rw.sys.version.version2"; - char value2[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\ + char value2[] = + "abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890\ abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvwxyz1234567890"; ret = SetParameter(key2, value2); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } }; /** * @tc.number : SUB_UTILS_PARAMETER_3700 - * @tc.name : SetParameter parameter legal test when value contains only blanks + * @tc.name : SetParameter parameter legal test when value contains only + * blanks * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter013, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testSetParameter013, + Function | MediumTest | Level1) { int ret; char key[] = "key_for_blank_value"; @@ -615,8 +324,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testSetParameter013, Function | MediumTes * @tc.name : GetParameter parameter legal test * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter001, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter001, + Function | MediumTest | Level1) { int ret; char key[] = "rw.sys.version_606"; @@ -633,8 +343,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter001, Function | MediumTes * @tc.name : GetParameter parameter legal test with Special characters * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter002, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter002, + Function | MediumTest | Level1) { int ret; char key[] = "_._..__...___"; @@ -648,11 +359,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter002, Function | MediumTes /** * @tc.number : SUB_UTILS_PARAMETER_4000 - * @tc.name : GetParameter parameter legal test using key with only lowercase + * @tc.name : GetParameter parameter legal test using key with only + * lowercase * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter003, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter003, + Function | MediumTest | Level1) { int ret; char key[] = "keywithonlylowercase"; @@ -669,8 +382,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter003, Function | MediumTes * @tc.name : GetParameter parameter legal test using key with only number * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter004, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter004, + Function | MediumTest | Level1) { int ret; char key[] = "202006060602"; @@ -684,11 +398,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter004, Function | MediumTes /** * @tc.number : SUB_UTILS_PARAMETER_4200 - * @tc.name : GetParameter parameter legal test when defaut value point is nullptr + * @tc.name : GetParameter parameter legal test when defaut value point is + * nullptr * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter005, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter005, + Function | MediumTest | Level1) { int ret; char key[] = "rw.sys.version_606"; @@ -705,8 +421,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter005, Function | MediumTes * @tc.name : GetParameter parameter legal test when the key is not exist * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter006, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter006, + Function | MediumTest | Level1) { int ret; char key[] = "none.exist.key"; @@ -718,11 +435,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter006, Function | MediumTes /** * @tc.number : SUB_UTILS_PARAMETER_4400 - * @tc.name : GetParameter parameter legal test using key and value with maximum length + * @tc.name : GetParameter parameter legal test using key and value with + * maximum length * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter007, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter007, + Function | MediumTest | Level1) { int ret; char key1[] = "rw.sys.version.version.version"; @@ -734,7 +453,8 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter007, Function | MediumTes TEST_ASSERT_EQUAL_STRING(rightVal1, value1); char key2[] = "rw.sys.version.version"; - char rightVal2[] = "abcdefghijklmnopqrstuvwxyz1234567890abcdefgh\ + char rightVal2[] = + "abcdefghijklmnopqrstuvwxyz1234567890abcdefgh\ ijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvw"; char value2[MAX_LEN] = {0}; SetParameter(key2, rightVal2); @@ -748,8 +468,9 @@ ijklmnopqrstuvwxyz1234567890abcdefghijklmnopqrstuvw"; * @tc.name : GetParameter parameter illegal test with invalid value length * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter008, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter008, + Function | MediumTest | Level1) { int ret; char key[] = "rw.sys.version_606"; @@ -757,38 +478,40 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter008, Function | MediumTes char value[INVALID_LEN] = {0}; SetParameter(key, rightVal); ret = GetParameter(key, g_defSysParam, value, INVALID_LEN); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } }; /** * @tc.number : SUB_UTILS_PARAMETER_4600 - * @tc.name : GetParameter parameter illegal test when value point is nullptr + * @tc.name : GetParameter parameter illegal test when value point is + * nullptr * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter009, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter009, + Function | MediumTest | Level1) { int ret; char key[] = "rw.sys.version_606"; char rightVal[] = "OEM-10.1.0"; SetParameter(key, rightVal); ret = GetParameter(key, g_defSysParam, NULL, MAX_LEN); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } }; /** * @tc.number : SUB_UTILS_PARAMETER_4700 - * @tc.name : GetParameter parameter illegal test when key is not exist and value len is invalid + * @tc.name : GetParameter parameter illegal test when key is not exist and + * value len is invalid * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter010, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter010, + Function | MediumTest | Level1) { int ret; char key[] = "none.exist.key"; @@ -799,11 +522,13 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter010, Function | MediumTes /** * @tc.number : SUB_UTILS_PARAMETER_4800 - * @tc.name : GetParameter parameter illegal test when key is not exist and defaut value point is nullptr + * @tc.name : GetParameter parameter illegal test when key is not exist and + * defaut value point is nullptr * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter011, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter011, + Function | MediumTest | Level1) { int ret; char key[] = "none.exist.key"; @@ -817,33 +542,34 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter011, Function | MediumTes * @tc.name : GetParameter parameter illegal test when key len is 32 bytes * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter012, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter012, + Function | MediumTest | Level1) { int ret; char key[] = "rw.sys.version.version.version.v"; char value[MAX_LEN] = {0}; ret = GetParameter(key, g_defSysParam, value, MAX_LEN); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } }; /** * @tc.number : SUB_UTILS_PARAMETER_5000 - * @tc.name : GetParameter parameter illegal test when key len is more than 32 bytes + * @tc.name : GetParameter parameter illegal test when key len is more than + * 32 bytes * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter013, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter013, + Function | MediumTest | Level1) { int ret; char key[] = "rw.sys.version.version.version.version"; char value[MAX_LEN] = {0}; ret = GetParameter(key, g_defSysParam, value, MAX_LEN); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } }; @@ -853,14 +579,14 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter013, Function | MediumTes * @tc.name : GetParameter parameter illegal test when key is nullptr * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter014, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter014, + Function | MediumTest | Level1) { int ret; char value[MAX_LEN] = {0}; ret = GetParameter(NULL, g_defSysParam, value, MAX_LEN); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } }; @@ -870,15 +596,15 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter014, Function | MediumTes * @tc.name : GetParameter parameter illegal test using key with uppercase * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter015, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter015, + Function | MediumTest | Level1) { int ret; char key[] = "Rw.Sys.Version.Version"; char value[MAX_LEN] = {0}; ret = GetParameter(key, g_defSysParam, value, MAX_LEN); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } }; @@ -888,33 +614,34 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter015, Function | MediumTes * @tc.name : GetParameter parameter illegal test using key with blank * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter016, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter016, + Function | MediumTest | Level1) { int ret; char key[] = "rw sys version version"; char value[MAX_LEN] = {0}; ret = GetParameter(key, g_defSysParam, value, MAX_LEN); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } }; /** * @tc.number : SUB_UTILS_PARAMETER_5400 - * @tc.name : GetParameter parameter illegal test using key with invalid special characters + * @tc.name : GetParameter parameter illegal test using key with invalid + * special characters * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter017, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter017, + Function | MediumTest | Level1) { int ret; char key[] = "rw+sys&version%version*"; char value[MAX_LEN] = {0}; ret = GetParameter(key, g_defSysParam, value, MAX_LEN); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } }; @@ -924,25 +651,27 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter017, Function | MediumTes * @tc.name : GetParameter parameter illegal test when key is NULL * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter018, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter018, + Function | MediumTest | Level1) { int ret; char value[MAX_LEN] = {0}; ret = GetParameter("\0", g_defSysParam, value, MAX_LEN); - if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) - { + if ((ret == COMMON_ERROR) || (ret == INVALID_PARAMETER)) { TEST_ASSERT_EQUAL_INT(1, 1); } }; /** * @tc.number : SUB_UTILS_PARAMETER_5600 - * @tc.name : GetParameter parameter legal test when value contains only blanks + * @tc.name : GetParameter parameter legal test when value contains only + * blanks * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter019, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter019, + Function | MediumTest | Level1) { int ret; char key[] = "key_for_blank_value"; @@ -959,8 +688,9 @@ LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter019, Function | MediumTes * @tc.name : Update value of parameter legal test * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterFuncTestSuite, testGetParameter020, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterFuncTestSuite, + testGetParameter020, + Function | MediumTest | Level1) { int ret; char key[] = "rw.sys.version_606"; diff --git a/startup_lite/syspara_hal/src/parameter_reli_test.c b/startup_lite/syspara_hal/src/parameter_reli_test.c index 7dbaf43a0138a06fedf223793fc390d82cb67110..05d2ac96df01808fdffc44bfbc0276b9de36600c 100755 --- a/startup_lite/syspara_hal/src/parameter_reli_test.c +++ b/startup_lite/syspara_hal/src/parameter_reli_test.c @@ -13,16 +13,17 @@ * limitations under the License. */ -#include "ohos_types.h" #include #include "hctest.h" +#include "ohos_types.h" #include "parameter.h" #include "parameter_utils.h" -#define QUERY_TIMES 50 +#define QUERY_TIMES 50 /** - * @tc.desc : register a test suite, this suite is used to test basic flow and interface dependency + * @tc.desc : register a test suite, this suite is used to test basic flow + * and interface dependency * @param : subsystem name is utils * @param : module name is parameter * @param : test suit name is ParameterReliTestSuite @@ -53,13 +54,13 @@ static BOOL ParameterReliTestSuiteTearDown(void) * @tc.name : Obtaining ProductType for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli001, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli001, + Function | MediumTest | Level1) { const char* value1 = GetDeviceType(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetDeviceType(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetDeviceType(); } const char* value2 = GetDeviceType(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -70,13 +71,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli001, Function | Medi * @tc.name : Obtaining Manufacture for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli002, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli002, + Function | MediumTest | Level1) { const char* value1 = GetManufacture(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetManufacture(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetManufacture(); } const char* value2 = GetManufacture(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -87,13 +88,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli002, Function | Medi * @tc.name : Obtaining Brand for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli003, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli003, + Function | MediumTest | Level1) { const char* value1 = GetBrand(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetBrand(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetBrand(); } const char* value2 = GetBrand(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -104,13 +105,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli003, Function | Medi * @tc.name : Obtaining MarketName for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli004, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli004, + Function | MediumTest | Level1) { const char* value1 = GetMarketName(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetMarketName(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetMarketName(); } const char* value2 = GetMarketName(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -121,13 +122,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli004, Function | Medi * @tc.name : Obtaining ProductSeries for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli005, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli005, + Function | MediumTest | Level1) { const char* value1 = GetProductSeries(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetProductSeries(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetProductSeries(); } const char* value2 = GetProductSeries(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -138,13 +139,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli005, Function | Medi * @tc.name : Obtaining ProductModel for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli006, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli006, + Function | MediumTest | Level1) { const char* value1 = GetProductModel(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetProductModel(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetProductModel(); } const char* value2 = GetProductModel(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -155,13 +156,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli006, Function | Medi * @tc.name : Obtaining HardwareModel for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli007, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli007, + Function | MediumTest | Level1) { const char* value1 = GetHardwareModel(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetHardwareModel(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetHardwareModel(); } const char* value2 = GetHardwareModel(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -172,13 +173,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli007, Function | Medi * @tc.name : Obtaining HardwareProfile for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli008, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli008, + Function | MediumTest | Level1) { const char* value1 = GetHardwareProfile(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetHardwareProfile(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetHardwareProfile(); } const char* value2 = GetHardwareProfile(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -189,16 +190,16 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli008, Function | Medi * @tc.name : Obtaining Serial for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli009, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli009, + Function | MediumTest | Level1) { const char* value1 = GetSerial(); if (value1 == NULL) { printf("The serial number needs to be written\n"); TEST_IGNORE(); } - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetSerial(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetSerial(); } const char* value2 = GetSerial(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -209,13 +210,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli009, Function | Medi * @tc.name : Obtaining OsName for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli010, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli010, + Function | MediumTest | Level1) { const char* value1 = GetOSFullName(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetOSFullName(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetOSFullName(); } const char* value2 = GetOSFullName(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -226,13 +227,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli010, Function | Medi * @tc.name : Obtaining DisplayVersion for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli011, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli011, + Function | MediumTest | Level1) { const char* value1 = GetDisplayVersion(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetDisplayVersion(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetDisplayVersion(); } const char* value2 = GetDisplayVersion(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -243,13 +244,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli011, Function | Medi * @tc.name : Obtaining BootloaderVersion for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli012, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli012, + Function | MediumTest | Level1) { const char* value1 = GetBootloaderVersion(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetBootloaderVersion(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetBootloaderVersion(); } const char* value2 = GetBootloaderVersion(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -260,13 +261,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli012, Function | Medi * @tc.name : Obtaining SecurityPatchTag for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli013, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli013, + Function | MediumTest | Level1) { const char* value1 = GetSecurityPatchTag(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetSecurityPatchTag(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetSecurityPatchTag(); } const char* value2 = GetSecurityPatchTag(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -277,13 +278,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli013, Function | Medi * @tc.name : Obtaining AbiList for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli014, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli014, + Function | MediumTest | Level1) { const char* value1 = GetAbiList(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetAbiList(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetAbiList(); } const char* value2 = GetAbiList(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -294,14 +295,14 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli014, Function | Medi * @tc.name : Obtaining FirstApiLevel for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli015, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli015, + Function | MediumTest | Level1) { int value1 = GetFirstApiVersion(); TEST_ASSERT_NOT_NULL(value1); TEST_ASSERT_TRUE((int)value1 == value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - int value = GetFirstApiVersion(); + for (int i = 0; i < QUERY_TIMES; i++) { + int value = GetFirstApiVersion(); } int value2 = GetFirstApiVersion(); TEST_ASSERT_EQUAL_INT(value1, value2); @@ -312,13 +313,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli015, Function | Medi * @tc.name : Obtaining IncrementalVersion for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli016, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli016, + Function | MediumTest | Level1) { const char* value1 = GetIncrementalVersion(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetIncrementalVersion(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetIncrementalVersion(); } const char* value2 = GetIncrementalVersion(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -329,13 +330,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli016, Function | Medi * @tc.name : Obtaining VersionId for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli017, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli017, + Function | MediumTest | Level1) { const char* value1 = GetVersionId(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetVersionId(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetVersionId(); } const char* value2 = GetVersionId(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -346,13 +347,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli017, Function | Medi * @tc.name : Obtaining BuildType for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli018, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli018, + Function | MediumTest | Level1) { const char* value1 = GetBuildType(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetBuildType(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetBuildType(); } const char* value2 = GetBuildType(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -363,13 +364,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli018, Function | Medi * @tc.name : Obtaining BuildUser for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli019, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli019, + Function | MediumTest | Level1) { const char* value1 = GetBuildUser(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetBuildUser(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetBuildUser(); } const char* value2 = GetBuildUser(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -380,13 +381,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli019, Function | Medi * @tc.name : Obtaining BuildHost for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli020, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli020, + Function | MediumTest | Level1) { const char* value1 = GetBuildHost(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetBuildHost(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetBuildHost(); } const char* value2 = GetBuildHost(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -397,13 +398,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli020, Function | Medi * @tc.name : Obtaining BuildTime for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli021, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli021, + Function | MediumTest | Level1) { const char* value1 = GetBuildTime(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetBuildTime(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetBuildTime(); } const char* value2 = GetBuildTime(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -414,13 +415,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli021, Function | Medi * @tc.name : Obtaining BuildRootHash for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli022, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli022, + Function | MediumTest | Level1) { const char* value1 = GetBuildRootHash(); TEST_ASSERT_NOT_NULL(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetBuildRootHash(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetBuildRootHash(); } const char* value2 = GetBuildRootHash(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -431,13 +432,13 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli022, Function | Medi * @tc.name : Obtaining SoftwareModel for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli023, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli023, + Function | MediumTest | Level1) { const char* value1 = GetSoftwareModel(); AssertNotEmpty(value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - const char* value = GetSoftwareModel(); + for (int i = 0; i < QUERY_TIMES; i++) { + const char* value = GetSoftwareModel(); } const char* value2 = GetSoftwareModel(); TEST_ASSERT_EQUAL_STRING(value1, value2); @@ -448,14 +449,14 @@ LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli023, Function | Medi * @tc.name : Obtaining SdkApiLevel for multiple times * @tc.desc : [C- SOFTWARE -0200] */ -LITE_TEST_CASE(ParameterReliTestSuite, testObtainSysParaReli024, Function | MediumTest | Level1) -{ +LITE_TEST_CASE(ParameterReliTestSuite, + testObtainSysParaReli024, + Function | MediumTest | Level1) { int value1 = GetSdkApiVersion(); TEST_ASSERT_NOT_NULL(value1); TEST_ASSERT_TRUE((int)value1 == value1); - for (int i = 0; i < QUERY_TIMES; i++) - { - int value = GetSdkApiVersion(); + for (int i = 0; i < QUERY_TIMES; i++) { + int value = GetSdkApiVersion(); } int value2 = GetSdkApiVersion(); TEST_ASSERT_EQUAL_INT(value1, value2); diff --git a/storage/storagefileioerrorjstest/BUILD.gn b/storage/storagefileioerrorjstest/BUILD.gn index 292dd8ebc37c3bac8f2ea62caca34fbf05332bae..33b0f324f974b62cff614045b0a1054722c37801 100644 --- a/storage/storagefileioerrorjstest/BUILD.gn +++ b/storage/storagefileioerrorjstest/BUILD.gn @@ -21,8 +21,8 @@ ohos_js_hap_suite("storagefileioerror_js_test") { ] certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsStorageFileIoErrorJsTest" - subsystem_name = "distributeddatamgr" - part_name = "distributedfilejs" + subsystem_name = "filemanagement" + part_name = "file_api" } ohos_js_assets("storagefileioerror_js_assets") { js2abc = true diff --git a/storage/storagefileioerrorjstest/src/main/config.json b/storage/storagefileioerrorjstest/src/main/config.json index db6a5c04e54641ca30d3f80192c3b0a4156599a9..22ce7284698ff8ab8ee25c1b555f7eed70961f67 100644 --- a/storage/storagefileioerrorjstest/src/main/config.json +++ b/storage/storagefileioerrorjstest/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.storage.fileioerror", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/storage/storagefileiojstest/BUILD.gn b/storage/storagefileiojstest/BUILD.gn index 9562908b475596a674b0fc3f314dd664eae29fb5..5202a26dc379e57679edefb3c38c25e88883dd7e 100644 --- a/storage/storagefileiojstest/BUILD.gn +++ b/storage/storagefileiojstest/BUILD.gn @@ -21,8 +21,8 @@ ohos_js_hap_suite("storagefileio_js_test") { ] certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsStorageFileIoJSTest" - subsystem_name = "distributeddatamgr" - part_name = "distributedfilejs" + subsystem_name = "filemanagement" + part_name = "file_api" } ohos_js_assets("storagefileio_js_assets") { js2abc = true diff --git a/storage/storagefileiojstest/src/main/config.json b/storage/storagefileiojstest/src/main/config.json index 14b48f21c781ae8521f6691421621094bf232ab0..c426eb120c9ee351d6a65d9c072ed7f4bf49e3c7 100644 --- a/storage/storagefileiojstest/src/main/config.json +++ b/storage/storagefileiojstest/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.storage.fileio", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/storage/storagefileiojstest/src/main/js/test/FileIO.test.js b/storage/storagefileiojstest/src/main/js/test/FileIO.test.js index 2fd0eace9c4a2f2ffb2f2e5682f862e14f6a9f52..2edd2c2efdac7015fa79f6e627cf6fa354e62221 100644 --- a/storage/storagefileiojstest/src/main/js/test/FileIO.test.js +++ b/storage/storagefileiojstest/src/main/js/test/FileIO.test.js @@ -3682,7 +3682,7 @@ export default function fileIOTest() { catch (err) { fileio.unlinkSync(fpath); console.info('fileio_test_fchown_sync_002 has failed for ' + err); - expect(err.message == "Operation not permitted").assertTrue(); + expect(err.message == "Invalid owner").assertTrue(); } }); @@ -3752,7 +3752,7 @@ export default function fileIOTest() { fileio.closeSync(fd); fileio.unlinkSync(fpath); console.info('fileio_test_fchown_sync_005 has failed for ' + err); - expect(err.message == "Operation not permitted").assertTrue(); + expect(err.message == "Invalid owner").assertTrue(); } }); diff --git a/storage/storagefileiojstest/src/main/js/test/List.test.js b/storage/storagefileiojstest/src/main/js/test/List.test.js index cb7cf190c77fc05ab7651bc0530e46c98c473c4c..c4ede6bac1151be8da1dcb622b746f2d473f207a 100644 --- a/storage/storagefileiojstest/src/main/js/test/List.test.js +++ b/storage/storagefileiojstest/src/main/js/test/List.test.js @@ -23,6 +23,10 @@ import fileioDirListfile from './module_fileio/class_dir/listfile.test.js' import fileioDirRead from './module_fileio/class_dir/read.test.js' import fileioDirent from './module_fileio/class_dirent/all.test.js' import fileioStream from './module_fileio/class_stream/all.test.js' +import fileioRandomAccessFileClose from './module_fileio/class_randomAccessFile/close.test.js' +import fileioRandomAccessFileRead from './module_fileio/class_randomAccessFile/read.test.js' +import fileioRandomAccessFileSetFilePointer from './module_fileio/class_randomAccessFile/setFilePointer.test.js' +import fileioRandomAccessFileWrite from './module_fileio/class_randomAccessFile/write.test.js' import fileioStreamClose from './module_fileio/class_stream/close.test.js' import fileioStreamFlush from './module_fileio/class_stream/flush.test.js' import fileioStreamRead from './module_fileio/class_stream/read.test.js' @@ -33,6 +37,7 @@ import fileioChmod from './module_fileio/members/chmod.test.js' import fileioChown from './module_fileio/members/chown.test.js' import fileioClose from './module_fileio/members/close.test.js' import fileioCopyfile from './module_fileio/members/copyFile.test.js' +import fileioCreateRandomAccessFile from './module_fileio/members/createRandomAccessFile.test.js' import fileioCreateStream from './module_fileio/members/createStream.test.js' import fileioFchmod from './module_fileio/members/fchmod.test.js' import fileioFchown from './module_fileio/members/fchown.test.js' @@ -71,6 +76,10 @@ export default function testsuite() { fileioDirRead() fileioDirent() fileioStream() + fileioRandomAccessFileClose() + fileioRandomAccessFileRead() + fileioRandomAccessFileSetFilePointer() + fileioRandomAccessFileWrite() fileioStreamClose() fileioStreamFlush() fileioStreamRead() @@ -81,6 +90,7 @@ export default function testsuite() { fileioChown() fileioClose() fileioCopyfile() + fileioCreateRandomAccessFile() fileioCreateStream() fileioFchmod() fileioFchown() diff --git a/storage/storagefileiojstest/src/main/js/test/module_fileio/class_randomAccessFile/close.test.js b/storage/storagefileiojstest/src/main/js/test/module_fileio/class_randomAccessFile/close.test.js new file mode 100644 index 0000000000000000000000000000000000000000..b3d8a5fb5a029b816fe52611543c4db594c5c9b7 --- /dev/null +++ b/storage/storagefileiojstest/src/main/js/test/module_fileio/class_randomAccessFile/close.test.js @@ -0,0 +1,70 @@ +/* + * 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 { + fileio, nextFileName, + describe, it, expect +} from '../../Common'; + +export default function fileioRandomAccessFileClose() { +describe('fileio_randomAccessFile_close', function () { + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_CLOSE_SYNC_0000 + * @tc.name fileio_randomaccessfile_close_sync_000 + * @tc.desc Test closeSync() interface. Close the RandomAccessFile object. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_close_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_close_sync_000'); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch(err) { + console.info('fileio_randomaccessfile_close_sync_000 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_CLOSE_SYNC_0100 + * @tc.name fileio_randomaccessfile_close_sync_001 + * @tc.desc Test closeSync() interface. Parameter mismatch. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_close_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_close_sync_001'); + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + + try { + randomaccessfile.closeSync(1); + expect(false).assertTrue(); + } catch(err) { + console.info('fileio_randomaccessfile_close_sync_001 has failed for ' + err); + expect(err.message == "Number of arguments unmatched").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } + }); +}) +} \ No newline at end of file diff --git a/storage/storagefileiojstest/src/main/js/test/module_fileio/class_randomAccessFile/read.test.js b/storage/storagefileiojstest/src/main/js/test/module_fileio/class_randomAccessFile/read.test.js new file mode 100644 index 0000000000000000000000000000000000000000..f0c41cc7cdef2b07841eb81c50fd189724671023 --- /dev/null +++ b/storage/storagefileiojstest/src/main/js/test/module_fileio/class_randomAccessFile/read.test.js @@ -0,0 +1,775 @@ +/* + * 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 { + fileio, FILE_CONTENT, prepareFile, nextFileName, + describe, it, expect, +} from '../../Common'; + +export default function fileioRandomAccessFileRead() { +describe('fileio_randomAccessFile_read', function () { + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_SYNC_0000 + * @tc.name fileio_randomaccessfile_read_sync_000 + * @tc.desc Test readSync() interface. Test to read data synchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_read_sync_000'); + + try { + let fd = fileio.openSync(fpath, 0o102, 0o666); + let randomaccessfile = fileio.createRandomAccessFileSync(fd, 0); + let length = 4096; + let num = randomaccessfile.writeSync(new ArrayBuffer(length)); + expect(num == length).assertTrue(); + randomaccessfile.setFilePointerSync(0); + let number = randomaccessfile.readSync(new ArrayBuffer(length)); + expect(number == length).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch (err) { + console.info('fileio_randomaccessfile_read_sync_000 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_SYNC_0100 + * @tc.name fileio_randomaccessfile_read_sync_001 + * @tc.desc Test readSync() interface. When the position is 1. Test to read data synchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_read_sync_001'); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + let length = 20; + let num = randomaccessfile.writeSync(new ArrayBuffer(length)); + expect(num == length).assertTrue(); + randomaccessfile.setFilePointerSync(0); + let number = randomaccessfile.readSync(new ArrayBuffer(length), { position: 1 }); + expect(number == length - 1).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch (err) { + console.info('fileio_randomaccessfile_read_sync_001 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_SYNC_0200 + * @tc.name fileio_randomaccessfile_read_sync_002 + * @tc.desc Test readSync() interface. When the offset is 1. Test to read data synchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_read_sync_002'); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + let length = 20; + let num = randomaccessfile.writeSync(new ArrayBuffer(length)); + expect(num == length).assertTrue(); + randomaccessfile.setFilePointerSync(0); + let number = randomaccessfile.readSync(new ArrayBuffer(length), { offset: 1 }); + expect(number == length - 1).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch (err) { + console.info('fileio_randomaccessfile_read_sync_002 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_SYNC_0300 + * @tc.name fileio_randomaccessfile_read_sync_003 + * @tc.desc Test readSync() interface. When the offset is 1 and the length is 5. Test to read data synchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_read_sync_003'); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + let length = 20; + let num = randomaccessfile.writeSync(new ArrayBuffer(length)); + expect(num == length).assertTrue(); + randomaccessfile.setFilePointerSync(0); + let number = randomaccessfile.readSync(new ArrayBuffer(length), { offset: 1, length: 5 }); + expect(number == 5).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch (err) { + console.info('fileio_randomaccessfile_read_sync_003 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_SYNC_0400 + * @tc.name fileio_randomaccessfile_read_sync_004 + * @tc.desc Test readSync() interface. When offset equals buffer length. Test to read data synchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_sync_004', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_read_sync_004'); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + let length = 4096; + let num = randomaccessfile.writeSync(new ArrayBuffer(length)); + expect(num == length).assertTrue(); + randomaccessfile.setFilePointerSync(0); + let number = randomaccessfile.readSync(new ArrayBuffer(length), { offset: length }); + expect(number == 0).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch (err) { + console.info('fileio_randomaccessfile_read_sync_004 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_SYNC_0500 + * @tc.name fileio_randomaccessfile_read_sync_005 + * @tc.desc Test readSync() interface. When the offset is 1 and the position is 6. Test to read data synchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_sync_005', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_read_sync_005'); + expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + let length = 20; + let number = randomaccessfile.readSync(new ArrayBuffer(length), { offset: 1, position: 6 }); + expect(number == FILE_CONTENT.length - 6).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch (err) { + console.info('fileio_randomaccessfile_read_sync_005 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_SYNC_0600 + * @tc.name fileio_randomaccessfile_read_sync_006 + * @tc.desc Test readSync() interface. When the offset is negative. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_sync_006', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_read_sync_006'); + let fd = fileio.openSync(fpath, 0o102, 0o666); + let randomaccessfile = fileio.createRandomAccessFileSync(fd, 0); + + try { + randomaccessfile.readSync(new ArrayBuffer(4096), { offset: -1 }); + expect(false).assertTrue(); + } catch (err) { + console.info('fileio_randomaccessfile_read_sync_006 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_SYNC_0700 + * @tc.name fileio_randomaccessfile_read_sync_007 + * @tc.desc Test readSync() interface. When offset+length>buffer.size. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_sync_007', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_read_sync_007'); + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + + try { + randomaccessfile.readSync(new ArrayBuffer(4096), { offset: 1, length: 4096 }); + expect(false).assertTrue(); + } catch (err) { + console.info('fileio_randomaccessfile_read_sync_007 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_SYNC_0800 + * @tc.name fileio_randomaccessfile_read_sync_008 + * @tc.desc Test readSync() interface. When the offset is greater than the buffer length. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_sync_008', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_read_sync_008'); + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + + try { + let length = 4096; + randomaccessfile.readSync(new ArrayBuffer(length), { offset: length + 1 }); + expect(false).assertTrue(); + } catch (err) { + console.info('fileio_randomaccessfile_read_sync_008 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_SYNC_0900 + * @tc.name fileio_randomaccessfile_read_sync_009 + * @tc.desc Test readSync() interface. When the length is greater than the buffer length. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_sync_009', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_read_sync_009'); + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + + try { + let length = 4096; + randomaccessfile.readSync(new ArrayBuffer(length), { length: length + 1 }); + expect(false).assertTrue(); + } catch (err) { + console.info('fileio_randomaccessfile_read_sync_009 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_SYNC_1000 + * @tc.name fileio_randomaccessfile_read_sync_010 + * @tc.desc Test readSync() interface. When the length is negative,equivalent to omitting the parameter. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_sync_010', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_read_sync_010'); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + let length = 4096; + let num = randomaccessfile.writeSync(new ArrayBuffer(length)); + expect(num == length).assertTrue(); + randomaccessfile.setFilePointerSync(0); + let number = randomaccessfile.readSync(new ArrayBuffer(16), { offset: 13, length: -1 }); + expect(number == 3).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch (err) { + console.info('fileio_randomaccessfile_read_sync_010 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_SYNC_1100 + * @tc.name fileio_randomaccessfile_read_sync_011 + * @tc.desc Test readSync() interface. When there are no parameters. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_sync_011', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_read_sync_011'); + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + + try { + randomaccessfile.readSync(); + expect(false).assertTrue(); + } catch (err) { + console.info('fileio_randomaccessfile_read_sync_011 has failed for ' + err); + expect(err.message == "Number of arguments unmatched").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_SYNC_1200 + * @tc.name fileio_randomaccessfile_read_sync_012 + * @tc.desc Test readSync() interface. When the position is negative. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_sync_012', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_read_sync_012'); + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + + try { + randomaccessfile.readSync(new ArrayBuffer(4096), { position: -1 }); + expect(false).assertTrue(); + } catch (err) { + console.info('fileio_randomaccessfile_read_sync_012 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_SYNC_1300 + * @tc.name fileio_randomaccessfile_read_sync_013 + * @tc.desc Test readSync() interface. When the parameter type is wrong. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_sync_013', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_read_sync_013'); + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + + try { + randomaccessfile.readSync(''); + expect(false).assertTrue(); + } catch (err) { + console.info('fileio_randomaccessfile_read_sync_013 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_ASYNC_0000 + * @tc.name fileio_randomaccessfile_read_async_000 + * @tc.desc Test read() interface. return in callback mode. Test to read data asynchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_async_000', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_read_async_000'); + + try { + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + let length = 4096; + let num = await randomaccessfile.write(new ArrayBuffer(length)); + expect(num == length).assertTrue(); + randomaccessfile.setFilePointerSync(0); + randomaccessfile.read(new ArrayBuffer(length), function (err, readOut) { + expect(readOut.bytesRead == length).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + }); + } catch (err) { + console.info('fileio_randomaccessfile_read_async_000 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_ASYNC_0100 + * @tc.name fileio_randomaccessfile_read_async_001 + * @tc.desc Test read() interface. When the position is 1. Test to read data asynchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_async_001', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_read_async_001'); + + try { + fileio.createRandomAccessFile(fpath, 0, 0o102, async function (err, randomaccessfile) { + let length = 20; + let num = await randomaccessfile.write(new ArrayBuffer(length)); + expect(num == length).assertTrue(); + randomaccessfile.setFilePointerSync(0); + let readOut = await randomaccessfile.read(new ArrayBuffer(length), { position: 1 }); + expect(readOut.bytesRead == length - 1).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + }); + } catch (err) { + console.info('fileio_randomaccessfile_read_async_001 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_ASYNC_0200 + * @tc.name fileio_randomaccessfile_read_async_002 + * @tc.desc Test read() interface. When the offset is 1. Test to read data asynchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_async_002', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_read_async_002'); + + try { + let fd = fileio.openSync(fpath, 0o102, 0o666); + let randomaccessfile = await fileio.createRandomAccessFile(fd, 0); + let length = 20; + let num = await randomaccessfile.write(new ArrayBuffer(length)); + expect(num == length).assertTrue(); + randomaccessfile.setFilePointerSync(0); + let readOut = await randomaccessfile.read(new ArrayBuffer(length), { offset: 1 }); + expect(readOut.bytesRead == length - 1).assertTrue(); + expect(readOut.offset == 1).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } catch (err) { + console.info('fileio_randomaccessfile_read_async_002 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_ASYNC_0300 + * @tc.name fileio_randomaccessfile_read_async_003 + * @tc.desc Test read() interface. When the offset is 1 and the length is 5. Test to read data asynchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_async_003', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_read_async_003'); + + try { + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + let length = 20; + let num = await randomaccessfile.write(new ArrayBuffer(length)); + expect(num == length).assertTrue(); + randomaccessfile.setFilePointerSync(0); + randomaccessfile.read(new ArrayBuffer(length), { offset: 1, length: 5 }, function (err, readOut) { + expect(readOut.bytesRead == 5).assertTrue(); + expect(readOut.offset == 1).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + }); + } catch (err) { + console.info('fileio_randomaccessfile_read_async_003 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_ASYNC_0400 + * @tc.name fileio_randomaccessfile_read_async_004 + * @tc.desc Test read() interface. When offset equals buffer length. Test to read data asynchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_async_004', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_read_async_004'); + + try { + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + let length = 4096; + let num = await randomaccessfile.write(new ArrayBuffer(length)); + expect(num == length).assertTrue(); + randomaccessfile.setFilePointerSync(0); + let readOut = await randomaccessfile.read(new ArrayBuffer(length), { offset: length }); + expect(readOut.bytesRead == 0).assertTrue(); + expect(readOut.offset == 4096).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } catch (err) { + console.info('fileio_randomaccessfile_read_async_004 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_ASYNC_0500 + * @tc.name fileio_randomaccessfile_read_async_005 + * @tc.desc Test read() interface. When the offset is 1 and the position is 6. Test to read data asynchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_async_005', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_read_async_005'); + expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); + + try { + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + let length = 20; + let readOut = await randomaccessfile.read(new ArrayBuffer(length), { offset: 1, position: 6 }); + expect(readOut.bytesRead == FILE_CONTENT.length - 6).assertTrue(); + expect(readOut.offset == 1).assertTrue(); + let start = readOut.offset; + let end = readOut.offset + readOut.bytesRead; + let result = String.fromCharCode.apply(null, new Uint8Array(readOut.buffer.slice(start, end))); + expect(result == "world").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } catch (err) { + console.info('fileio_randomaccessfile_read_async_005 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_ASYNC_0600 + * @tc.name fileio_randomaccessfile_read_async_006 + * @tc.desc Test read() interface. When the offset is negative. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_async_006', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_read_async_006'); + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + + try { + await randomaccessfile.read(new ArrayBuffer(4096), { offset: -1 }); + } catch (err) { + console.info('fileio_randomaccessfile_read_async_006 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_ASYNC_0700 + * @tc.name fileio_randomaccessfile_read_async_007 + * @tc.desc Test read() interface. When offset+length>buffer.size. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_async_007', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_read_async_007'); + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + + try { + await randomaccessfile.read(new ArrayBuffer(4096), { offset: 1, length: 4096 }); + } catch (err) { + console.info('fileio_randomaccessfile_read_async_007 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_ASYNC_0800 + * @tc.name fileio_randomaccessfile_read_async_008 + * @tc.desc Test read() interface. When the offset is greater than the buffer length. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_async_008', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_read_async_008'); + let fd = fileio.openSync(fpath, 0o102, 0o666); + let randomaccessfile = await fileio.createRandomAccessFile(fd, 0); + + try { + let length = 4096; + randomaccessfile.read(new ArrayBuffer(length), { offset: length + 1 }, function (err) { + }); + } catch (err) { + console.info('fileio_randomaccessfile_read_async_008 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_ASYNC_0900 + * @tc.name fileio_randomaccessfile_read_async_009 + * @tc.desc Test read() interface. When the length is greater than the buffer length. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_async_009', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_read_async_009'); + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + + try { + let length = 4096; + await randomaccessfile.read(new ArrayBuffer(length), { length: length + 1 }); + } catch (err) { + console.info('fileio_randomaccessfile_read_async_009 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_ASYNC_1000 + * @tc.name fileio_randomaccessfile_read_async_010 + * @tc.desc Test read() interface. When the length is negative,equivalent to omitting the parameter. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_async_010', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_read_async_010'); + + try { + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + let length = 4096; + let num = randomaccessfile.writeSync(new ArrayBuffer(length)); + expect(num == length).assertTrue(); + randomaccessfile.setFilePointerSync(0); + let readOut = await randomaccessfile.read(new ArrayBuffer(16), { offset: 13, length: -1 }); + expect(readOut.bytesRead == 3).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } catch (err) { + console.info('fileio_randomaccessfile_read_async_010 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_ASYNC_1100 + * @tc.name fileio_randomaccessfile_read_async_011 + * @tc.desc Test read() interface. When there are no parameters. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_async_011', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_read_async_011'); + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + + try { + await randomaccessfile.read(); + } catch (err) { + console.info('fileio_randomaccessfile_read_async_011 has failed for ' + err); + expect(err.message == "Number of arguments unmatched").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_ASYNC_1200 + * @tc.name fileio_randomaccessfile_read_async_012 + * @tc.desc Test read() interface. When the position is negative. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_async_012', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_read_async_012'); + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + + try { + await randomaccessfile.read(new ArrayBuffer(4096), { position: -1 }); + } catch (err) { + console.info('fileio_randomaccessfile_read_async_012 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_READ_ASYNC_1300 + * @tc.name fileio_randomaccessfile_read_async_013 + * @tc.desc Test read() interface. When the parameter type is wrong. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_read_async_013', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_read_async_013'); + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + + try { + await randomaccessfile.read(''); + } catch (err) { + console.info('fileio_randomaccessfile_read_async_013 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done() + } + }); +}) +} \ No newline at end of file diff --git a/storage/storagefileiojstest/src/main/js/test/module_fileio/class_randomAccessFile/setFilePointer.test.js b/storage/storagefileiojstest/src/main/js/test/module_fileio/class_randomAccessFile/setFilePointer.test.js new file mode 100644 index 0000000000000000000000000000000000000000..9de6f6f0f332241c3c078acf11755d436ef18ba9 --- /dev/null +++ b/storage/storagefileiojstest/src/main/js/test/module_fileio/class_randomAccessFile/setFilePointer.test.js @@ -0,0 +1,96 @@ +/* + * 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 { + fileio, nextFileName, describe, it, expect +} from '../../Common'; + +export default function fileioRandomAccessFileSetFilePointer() { +describe('fileio_randomAccessFile_setFilePointer', function () { + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_SET_FILE_POINTER_SYNC_0000 + * @tc.name fileio_randomaccessfile_set_file_pointer_sync_000 + * @tc.desc Test setFilePointerSync() interface. Set file offset pointer position. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_set_file_pointer_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_set_file_pointer_sync_000'); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + expect(randomaccessfile.fpointer == 0).assertTrue(); + randomaccessfile.setFilePointerSync(5); + expect(randomaccessfile.fpointer == 5).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch(err) { + console.info('fileio_randomaccessfile_set_file_pointer_sync_000 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_SET_FILE_POINTER_SYNC_0100 + * @tc.name fileio_randomaccessfile_set_file_pointer_sync_001 + * @tc.desc Test setFilePointerSync() interface. Invalid fpointer. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_set_file_pointer_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_set_file_pointer_sync_001'); + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + + try { + randomaccessfile.setFilePointerSync('5'); + expect(false).assertTrue(); + } catch(err) { + console.info('fileio_randomaccessfile_set_file_pointer_sync_001 has failed for ' + err); + expect(err.message == "Invalid fpointer").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_SET_FILE_POINTER_SYNC_0200 + * @tc.name fileio_randomaccessfile_set_file_pointer_sync_002 + * @tc.desc Test setFilePointerSync() interface. Missing Parameter. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_set_file_pointer_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_set_file_pointer_sync_002'); + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + + try { + randomaccessfile.setFilePointerSync(); + expect(false).assertTrue(); + } catch(err) { + console.info('fileio_randomaccessfile_set_file_pointer_sync_002 has failed for ' + err); + expect(err.message == "Number of arguments unmatched").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } + }); +}) +} \ No newline at end of file diff --git a/storage/storagefileiojstest/src/main/js/test/module_fileio/class_randomAccessFile/write.test.js b/storage/storagefileiojstest/src/main/js/test/module_fileio/class_randomAccessFile/write.test.js new file mode 100644 index 0000000000000000000000000000000000000000..96f97263bb7e9f06fbf73f107430063fdc0aa76f --- /dev/null +++ b/storage/storagefileiojstest/src/main/js/test/module_fileio/class_randomAccessFile/write.test.js @@ -0,0 +1,747 @@ +/* + * 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 { + fileio, prepareFile, FILE_CONTENT, nextFileName, + describe, it, expect +} from '../../Common'; + +export default function fileioRandomAccessFileWrite() { +describe('fileio_randomAccessFile_write', function () { + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_SYNC_0000 + * @tc.name fileio_randomaccessfile_write_sync_000 + * @tc.desc Test writeSync() interface. Test write data synchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_write_sync_000'); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + let length = 4096; + let num = randomaccessfile.writeSync(new ArrayBuffer(length)); + expect(num == length).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch(err) { + console.info('fileio_randomaccessfile_write_sync_000 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_SYNC_0100 + * @tc.name fileio_randomaccessfile_write_sync_001 + * @tc.desc Test writeSync() interface. When the offset is 1. Test write data synchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_write_sync_001'); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + let length = 20; + let num = randomaccessfile.writeSync(new ArrayBuffer(length), { offset: 1 }); + expect(num == length - 1).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch(err) { + console.info('fileio_randomaccessfile_write_sync_001 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_SYNC_0200 + * @tc.name fileio_randomaccessfile_write_sync_002 + * @tc.desc Test writeSync() interface. When the position is 1. Test write data synchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_write_sync_002'); + + try { + let fd = fileio.openSync(fpath, 0o102, 0o666); + let randomaccessfile = fileio.createRandomAccessFileSync(fd, 0); + let length = 20; + let num = randomaccessfile.writeSync(new ArrayBuffer(length), { position: 1 }); + expect(num == length).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch(err) { + console.info('fileio_randomaccessfile_write_sync_002 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_SYNC_0300 + * @tc.name fileio_randomaccessfile_write_sync_003 + * @tc.desc Test writeSync() interface. When the offset is 1 and length is 10. Test write data synchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_write_sync_003'); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + let length = 20; + let num = randomaccessfile.writeSync(new ArrayBuffer(length), { offset: 1, length: 10 }); + expect(num == 10).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch(err) { + console.info('fileio_randomaccessfile_write_sync_003 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_SYNC_0400 + * @tc.name fileio_randomaccessfile_write_sync_004 + * @tc.desc Test writeSync() interface. When the offset is 1 and position is 5. Test write data synchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_sync_004', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_write_sync_004'); + expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + let length = 20; + let options = { + offset: 1, + position:5 + } + let num = randomaccessfile.writeSync(new ArrayBuffer(length), options); + expect(num == length - 1).assertTrue(); + randomaccessfile.setFilePointerSync(0); + let number = randomaccessfile.readSync(new ArrayBuffer(4096)); + expect(number == (length - options.offset + options.position)).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch(err) { + console.info('fileio_randomaccessfile_write_sync_004 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_SYNC_0500 + * @tc.name fileio_randomaccessfile_write_sync_005 + * @tc.desc Test writeSync() interface. When offset equals buffer length. Test write data synchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_sync_005', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_write_sync_005'); + expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + let length = 4096; + let num = randomaccessfile.writeSync(new ArrayBuffer(length), { offset: length }); + expect(num == 0).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch(err) { + console.info('fileio_randomaccessfile_write_sync_005 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_SYNC_0600 + * @tc.name fileio_randomaccessfile_write_sync_006 + * @tc.desc Test writeSync() interface. When offset+length>buffer.size. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_sync_006', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_write_sync_006'); + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + + try { + randomaccessfile.writeSync(new ArrayBuffer(4096), { offset: 5, length: 4095 }); + expect(false).assertTrue(); + } catch(err) { + console.info('fileio_randomaccessfile_write_sync_006 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_SYNC_0700 + * @tc.name fileio_randomaccessfile_write_sync_007 + * @tc.desc Test writeSync() interface. When the offset is greater than the buffer length. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_sync_007', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_write_sync_007'); + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + + try { + let length = 4096; + randomaccessfile.writeSync(new ArrayBuffer(length), { offset: length + 1 }); + expect(false).assertTrue(); + } catch(err) { + console.info('fileio_randomaccessfile_write_sync_007 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_SYNC_0800 + * @tc.name fileio_randomaccessfile_write_sync_008 + * @tc.desc Test writeSync() interface. When there are no parameters. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_sync_008', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_write_sync_008'); + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + + try { + randomaccessfile.writeSync(); + expect(false).assertTrue(); + } catch(err) { + console.info('fileio_randomaccessfile_write_sync_008 has failed for ' + err); + expect(err.message == "Number of arguments unmatched").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_SYNC_0900 + * @tc.name fileio_randomaccessfile_write_sync_009 + * @tc.desc Test writeSync() interface. When the offset is negative. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_sync_009', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_write_sync_009'); + let fd = fileio.openSync(fpath, 0o102, 0o666); + let randomaccessfile = fileio.createRandomAccessFileSync(fd, 0); + + try { + randomaccessfile.writeSync(new ArrayBuffer(4096), { offset: -1 }); + expect(false).assertTrue(); + } catch(err) { + console.info('fileio_randomaccessfile_write_sync_009 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_SYNC_1000 + * @tc.name fileio_randomaccessfile_write_sync_010 + * @tc.desc Test writeSync() interface. When the length is negative,equivalent to omitting the parameter. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_sync_010', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_write_sync_010'); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + let length = 100; + let num = randomaccessfile.writeSync(new ArrayBuffer(length), { offset: 1, length: -1 }); + expect(num == length - 1).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch(err) { + console.info('fileio_randomaccessfile_write_sync_010 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_SYNC_1100 + * @tc.name fileio_randomaccessfile_write_sync_011 + * @tc.desc Test writeSync() interface. When the buffer parameter type is wrong. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_sync_011', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_write_sync_011'); + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + + try { + randomaccessfile.writeSync(10, { length: -1 }); + expect(false).assertTrue(); + } catch(err) { + console.info('fileio_randomaccessfile_write_sync_011 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_SYNC_1200 + * @tc.name fileio_randomaccessfile_write_sync_012 + * @tc.desc Test writeSync() interface. When the length is greater than the buffer length. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_sync_012', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_write_sync_012'); + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + + try { + let length = 4096; + randomaccessfile.writeSync(new ArrayBuffer(length), { length: length + 1 }); + expect(false).assertTrue(); + } catch(err) { + console.info('fileio_randomaccessfile_write_sync_012 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_SYNC_1300 + * @tc.name fileio_randomaccessfile_write_sync_013 + * @tc.desc Test writeSync() interface. When the position is negative. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_sync_013', 0, async function () { + let fpath = await nextFileName('fileio_randomaccessfile_write_sync_013'); + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o102); + + try { + randomaccessfile.writeSync(new ArrayBuffer(4096), { position: -1 }); + expect(false).assertTrue(); + } catch(err) { + console.info('fileio_randomaccessfile_write_sync_013 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_ASYNC_0000 + * @tc.name fileio_randomaccessfile_write_async_000 + * @tc.desc Test write() interface. return in promise mode. Test write data asynchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_async_000', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_write_async_000'); + + try { + fileio.createRandomAccessFile(fpath, 0, 0o102, async function(err, randomaccessfile) { + let length = 4096; + let num = await randomaccessfile.write(new ArrayBuffer(length)); + expect(num == length).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + }); + } catch(err) { + console.info('fileio_randomaccessfile_write_async_000 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_ASYNC_0100 + * @tc.name fileio_randomaccessfile_write_async_001 + * @tc.desc Test write() interface. When the offset is 1. return in callback mode. Test write data asynchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_async_001', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_write_async_001'); + + try { + let fd = fileio.openSync(fpath, 0o102, 0o666); + let randomaccessfile = await fileio.createRandomAccessFile(fd, 0); + let length = 20; + randomaccessfile.write(new ArrayBuffer(length), { offset: 1 }, function(err, bytesWritten) { + expect(bytesWritten == length - 1).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + }); + } catch(err) { + console.info('fileio_randomaccessfile_write_async_001 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_ASYNC_0200 + * @tc.name fileio_randomaccessfile_write_async_002 + * @tc.desc Test write() interface. When the position is 1. Test write data asynchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_async_002', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_write_async_002'); + + try { + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + let length = 20; + let num = await randomaccessfile.write(new ArrayBuffer(length), { position: 1 }); + expect(num == length).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } catch(err) { + console.info('fileio_randomaccessfile_write_async_002 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_ASYNC_0300 + * @tc.name fileio_randomaccessfile_write_async_003 + * @tc.desc Test write() interface. When the offset is 1 and length is 10. Test write data asynchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_async_003', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_write_async_003'); + + try { + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + let length = 20; + let num = await randomaccessfile.write(new ArrayBuffer(length), { offset: 1, length: 10 }); + expect(num == 10).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } catch(err) { + console.info('fileio_randomaccessfile_write_async_003 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_ASYNC_0400 + * @tc.name fileio_randomaccessfile_write_async_004 + * @tc.desc Test write() interface. When the offset is 1 and position is 5. Test write data asynchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_async_004', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_write_async_004'); + expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); + + try { + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + let length = 20; + let options = { + offset: 1, + position:5 + } + let num = await randomaccessfile.write(new ArrayBuffer(length), options); + expect(num == length - 1).assertTrue(); + randomaccessfile.setFilePointerSync(0); + let readOut = await randomaccessfile.read(new ArrayBuffer(4096)); + expect(readOut.bytesRead == (length - options.offset + options.position)).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } catch(err) { + console.info('fileio_randomaccessfile_write_async_004 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_ASYNC_0500 + * @tc.name fileio_randomaccessfile_write_async_005 + * @tc.desc Test write() interface. When offset equals buffer length. Test write data asynchronously. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_async_005', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_write_async_005'); + expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); + + try { + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + let length = 4096; + let num = await randomaccessfile.write(new ArrayBuffer(length), { offset: length }); + expect(num == 0).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } catch(err) { + console.info('fileio_randomaccessfile_write_async_005 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_ASYNC_0600 + * @tc.name fileio_randomaccessfile_write_async_006 + * @tc.desc Test write() interface. When offset+length>buffer.size. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_async_006', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_write_async_006'); + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + + try { + let length = 4096; + await randomaccessfile.write(new ArrayBuffer(length), { offset: 5, length: 4095 }); + } catch(err) { + console.info('fileio_randomaccessfile_write_async_006 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_ASYNC_0700 + * @tc.name fileio_randomaccessfile_write_async_007 + * @tc.desc Test write() interface. When the offset is greater than the buffer length. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_async_007', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_write_async_007'); + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + + try { + let length = 4096; + randomaccessfile.write(new ArrayBuffer(length), { offset: length + 1 }, function(err) { + }); + } catch(err) { + console.info('fileio_randomaccessfile_write_async_007 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_ASYNC_0800 + * @tc.name fileio_randomaccessfile_write_async_008 + * @tc.desc Test write() interface. When there are no parameters. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_async_008', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_write_async_008'); + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + + try { + await randomaccessfile.write(); + } catch(err) { + console.info('fileio_randomaccessfile_write_async_008 has failed for ' + err); + expect(err.message == "Number of arguments unmatched").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_ASYNC_0900 + * @tc.name fileio_randomaccessfile_write_async_009 + * @tc.desc Test write() interface. When the offset is negative. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_async_009', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_write_async_009'); + let fd = fileio.openSync(fpath, 0o102, 0o666); + let randomaccessfile = await fileio.createRandomAccessFile(fd, 0); + + try { + await randomaccessfile.write(new ArrayBuffer(4096), { offset: -1 }); + } catch(err) { + console.info('fileio_randomaccessfile_write_async_009 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_ASYNC_1000 + * @tc.name fileio_randomaccessfile_write_async_010 + * @tc.desc Test write() interface. When the length is negative,equivalent to omitting the parameter. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_async_010', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_write_async_010'); + + try { + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + let length = 100; + let num = await randomaccessfile.write(new ArrayBuffer(length), { offset: 1, length: -1 }); + expect(num == length - 1).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } catch(err) { + console.info('fileio_randomaccessfile_write_async_010 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_ASYNC_1100 + * @tc.name fileio_randomaccessfile_write_async_011 + * @tc.desc Test write() interface. When the buffer parameter type is wrong. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_async_011', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_write_async_011'); + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + + try { + await randomaccessfile.write(10, { length: -1 }); + } catch(err) { + console.info('fileio_randomaccessfile_write_async_011 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_ASYNC_1200 + * @tc.name fileio_randomaccessfile_write_async_012 + * @tc.desc Test write() interface. When the length is greater than the buffer length. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_async_012', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_write_async_012'); + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + + try { + let length = 4096; + await randomaccessfile.write(new ArrayBuffer(length), { length: length + 1 }); + } catch(err) { + console.info('fileio_randomaccessfile_write_async_012 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_WRITE_ASYNC_1300 + * @tc.name fileio_randomaccessfile_write_async_013 + * @tc.desc Test write() interface. When the position is negative. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_write_async_013', 0, async function (done) { + let fpath = await nextFileName('fileio_randomaccessfile_write_async_013'); + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o102); + + try { + await randomaccessfile.write(new ArrayBuffer(4096), { position: -1 }); + } catch(err) { + console.info('fileio_randomaccessfile_write_async_013 has failed for ' + err); + expect(err.message == "Invalid buffer/options").assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } + }); +}) +} \ No newline at end of file diff --git a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/createRandomAccessFile.test.js b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/createRandomAccessFile.test.js new file mode 100644 index 0000000000000000000000000000000000000000..f08dd145551066430dffd383223246b1056380d1 --- /dev/null +++ b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/createRandomAccessFile.test.js @@ -0,0 +1,920 @@ +/* + * 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 { + fileio, prepareFile, nextFileName, isIntNum, FILE_CONTENT, + describe, it, expect +} from '../../Common'; + +export default function fileioCreateRandomAccessFile() { +describe('fileio_create_randomAccessFile', function () { + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_SYNC_0000 + * @tc.name fileio_create_randomaccessfile_sync_000 + * @tc.desc Test createRandomAccessFileSync() interface. + * Create RandomAccessFile object to access file based on file path. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_sync_000', 0, async function () { + let fpath = await nextFileName('fileio_create_randomaccessfile_sync_000'); + expect(prepareFile(fpath, '')).assertTrue(); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o2); + expect(isIntNum(randomaccessfile.fd)).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch(err) { + console.info('fileio_create_randomaccessfile_sync_000 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_SYNC_0100 + * @tc.name fileio_create_randomaccessfile_sync_001 + * @tc.desc Test createRandomAccessFileSync() interface. fpointer = 5. + * Create RandomAccessFile object to access file from fpointer location. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_sync_001', 0, async function () { + let fpath = await nextFileName('fileio_create_randomaccessfile_sync_001'); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 5, 0o102); + expect(isIntNum(randomaccessfile.fd)).assertTrue(); + expect(randomaccessfile.fpointer == 5).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch(err) { + console.info('fileio_create_randomaccessfile_sync_001 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_SYNC_0200 + * @tc.name fileio_create_randomaccessfile_sync_002 + * @tc.desc Test createRandomAccessFileSync() interface. + * Create RandomAccessFile object based on file descriptor to access file. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_sync_002', 0, async function () { + let fpath = await nextFileName('fileio_create_randomaccessfile_sync_002'); + + try { + let fd = fileio.openSync(fpath, 0o102, 0o666); + let randomaccessfile = fileio.createRandomAccessFileSync(fd, 0); + expect(isIntNum(randomaccessfile.fd)).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch(err) { + console.info('fileio_create_randomaccessfile_sync_002 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_SYNC_0300 + * @tc.name fileio_create_randomaccessfile_sync_003 + * @tc.desc Test createRandomAccessFileSync() interface. fpointer = 1. + * Create RandomAccessFile object based on file descriptor to access file. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_sync_003', 0, async function () { + let fpath = await nextFileName('fileio_create_randomaccessfile_sync_003'); + + try { + let fd = fileio.openSync(fpath, 0o102, 0o666); + let randomaccessfile = fileio.createRandomAccessFileSync(fd, 1); + expect(isIntNum(randomaccessfile.fd)).assertTrue(); + expect(randomaccessfile.fpointer == 1).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch(err) { + console.info('fileio_create_randomaccessfile_sync_003 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_SYNC_0400 + * @tc.name fileio_create_randomaccessfile_sync_004 + * @tc.desc Test createRandomAccessFileSync() interface. No such file or directory. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_sync_004', 0, async function () { + let fpath = await nextFileName('fileio_create_randomaccessfile_sync_004'); + + try { + fileio.createRandomAccessFileSync(fpath, 0, 0o2); + expect(false).assertTrue(); + } catch(err) { + console.info('fileio_create_randomaccessfile_sync_004 has failed for ' + err); + expect(err.message == "No such file or directory").assertTrue(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_SYNC_0500 + * @tc.name fileio_create_randomaccessfile_sync_005 + * @tc.desc Test createRandomAccessFileSync() interface. Invalid fd. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_sync_005', 0, async function () { + try { + fileio.createRandomAccessFileSync(-1, 0); + expect(false).assertTrue(); + } catch(err) { + console.info('fileio_create_randomaccessfile_sync_005 has failed for ' + err); + expect(err.message == "Invalid fd").assertTrue(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_SYNC_0600 + * @tc.name fileio_create_randomaccessfile_sync_006 + * @tc.desc Test createRandomAccessFileSync() interface. Invalid fp. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_sync_006', 0, async function () { + let fpath = await nextFileName('fileio_create_randomaccessfile_sync_006'); + let fd = fileio.openSync(fpath, 0o102, 0o666); + + try { + fileio.createRandomAccessFileSync(fd, '1'); + expect(false).assertTrue(); + } catch(err) { + console.info('fileio_create_randomaccessfile_sync_006 has failed for ' + err); + expect(err.message == "Invalid fp").assertTrue(); + fileio.closeSync(fd); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_SYNC_0700 + * @tc.name fileio_create_randomaccessfile_sync_007 + * @tc.desc Test createRandomAccessFileSync() interface. Missing Parameter. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_sync_007', 0, async function () { + let fpath = await nextFileName('fileio_create_randomaccessfile_sync_007'); + let fd = fileio.openSync(fpath, 0o102, 0o666); + + try { + fileio.createRandomAccessFileSync(fd); + expect(false).assertTrue(); + } catch(err) { + console.info('fileio_create_randomaccessfile_sync_007 has failed for ' + err); + expect(err.message == "Number of arguments unmatched").assertTrue(); + fileio.closeSync(fd); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_SYNC_0800 + * @tc.name fileio_create_randomaccessfile_sync_008 + * @tc.desc Test createRandomAccessFileSync() interface. flags=0o202. + * Create RandomAccessFile object to access file based on file path. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_sync_008', 0, async function () { + let fpath = await nextFileName('fileio_create_randomaccessfile_sync_008'); + expect(prepareFile(fpath, '')).assertTrue(); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o202); + expect(isIntNum(randomaccessfile.fd)).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch(err) { + console.info('fileio_create_randomaccessfile_sync_008 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_SYNC_0900 + * @tc.name fileio_create_randomaccessfile_sync_009 + * @tc.desc Test createRandomAccessFileSync() interface. flags=0o302. File exists. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_sync_009', 0, async function () { + let fpath = await nextFileName('fileio_create_randomaccessfile_sync_009'); + expect(prepareFile(fpath, '')).assertTrue(); + + try { + fileio.createRandomAccessFileSync(fpath, 0, 0o302); + expect(false).assertTrue(); + } catch(err) { + console.info('fileio_create_randomaccessfile_sync_009 has failed for ' + err); + expect(err.message == "File exists").assertTrue(); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_SYNC_1000 + * @tc.name fileio_create_randomaccessfile_sync_010 + * @tc.desc Test createRandomAccessFileSync() interface. flags=0o1002. + * If the file exists and the file is opened for write-only or read-write, trim its length to zero. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_sync_010', 0, async function () { + let fpath = await nextFileName('fileio_create_randomaccessfile_sync_010'); + expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o1002); + let number = randomaccessfile.readSync(new ArrayBuffer(4096)); + expect(number == 0).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch(err) { + console.info('fileio_create_randomaccessfile_sync_010 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_SYNC_1100 + * @tc.name fileio_create_randomaccessfile_sync_011 + * @tc.desc Test createRandomAccessFileSync() interface. flags=0o2002. + * Open as append, subsequent writes will append to the end of the file. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_sync_011', 0, async function () { + let fpath = await nextFileName('fileio_create_randomaccessfile_sync_011'); + expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o2002); + let length = 100; + let num = randomaccessfile.writeSync(new ArrayBuffer(length)); + expect(num == length).assertTrue(); + randomaccessfile.setFilePointerSync(0); + let number = randomaccessfile.readSync(new ArrayBuffer(4096), { position: 0 }); + expect(number == length + FILE_CONTENT.length).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch(err) { + console.info('fileio_create_randomaccessfile_sync_011 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_SYNC_1200 + * @tc.name fileio_create_randomaccessfile_sync_012 + * @tc.desc Test createRandomAccessFileSync() interface. flags=0o200002. Not a directory. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_sync_012', 0, async function () { + let fpath = await nextFileName('fileio_create_randomaccessfile_sync_012'); + expect(prepareFile(fpath, '')).assertTrue(); + + try { + fileio.createRandomAccessFileSync(fpath, 0, 0o200002); + expect(false).assertTrue(); + } catch(err) { + console.info('fileio_create_randomaccessfile_sync_012 has failed for ' + err); + expect(err.message == "Not a directory").assertTrue(); + fileio.unlinkSync(fpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_SYNC_1300 + * @tc.name fileio_create_randomaccessfile_sync_013 + * @tc.desc Test createRandomAccessFileSync() interface. flags=0o400002. + * Create RandomAccessFile object to access file based on file path. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_sync_013', 0, async function () { + let fpath = await nextFileName('fileio_create_randomaccessfile_sync_013'); + expect(prepareFile(fpath, '')).assertTrue(); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o400002); + expect(isIntNum(randomaccessfile.fd)).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch(err) { + console.info('fileio_create_randomaccessfile_sync_013 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_SYNC_1400 + * @tc.name fileio_create_randomaccessfile_sync_014 + * @tc.desc Test createRandomAccessFileSync() interface. flags=0o4010002. + * Create RandomAccessFile object to access file based on file path. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_sync_014', 0, async function () { + let fpath = await nextFileName('fileio_create_randomaccessfile_sync_014'); + expect(prepareFile(fpath, '')).assertTrue(); + + try { + let randomaccessfile = fileio.createRandomAccessFileSync(fpath, 0, 0o4010002); + expect(isIntNum(randomaccessfile.fd)).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + } catch(err) { + console.info('fileio_create_randomaccessfile_sync_014 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_SYNC_1500 + * @tc.name fileio_create_randomaccessfile_sync_015 + * @tc.desc Test createRandomAccessFileSync() interface. flags=0o200002. Invalid filepath. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_sync_015', 0, async function () { + let dpath = await nextFileName('fileio_create_randomaccessfile_sync_015') + 'd'; + fileio.mkdirSync(dpath); + + try { + fileio.createRandomAccessFileSync(dpath, 0, 0o200002); + expect(false).assertTrue(); + } catch(err) { + console.info('fileio_create_randomaccessfile_sync_015 has failed for ' + err); + expect(err.message == "Invalid filepath").assertTrue(); + fileio.rmdirSync(dpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_SYNC_1600 + * @tc.name fileio_create_randomaccessfile_sync_016 + * @tc.desc Test createRandomAccessFileSync() interface. flags=0o400002. Symbolic link loop. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_sync_016', 0, async function () { + let fpath = await nextFileName('fileio_create_randomaccessfile_sync_016'); + let ffpath = fpath + 'aaaa'; + expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); + + try { + fileio.symlinkSync(fpath, ffpath); + fileio.createRandomAccessFileSync(ffpath, 0, 0o400002); + expect(false).assertTrue(); + } catch(err) { + console.info('fileio_create_randomaccessfile_sync_016 has failed for ' + err); + expect(err.message == 'Symbolic link loop' || + err.message == 'Too many symbolic links encountered').assertTrue(); + fileio.unlinkSync(fpath); + fileio.unlinkSync(ffpath); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_ASYNC_0000 + * @tc.name fileio_create_randomaccessfile_async_000 + * @tc.desc Test createRandomAccessFile() interface. return in promise mode. + * Create RandomAccessFile object to access file based on file path. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_async_000', 0, async function (done) { + let fpath = await nextFileName('fileio_create_randomaccessfile_async_000'); + expect(prepareFile(fpath, '')).assertTrue(); + + try { + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o2); + expect(isIntNum(randomaccessfile.fd)).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } catch(err) { + console.info('fileio_create_randomaccessfile_async_000 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_ASYNC_0100 + * @tc.name fileio_create_randomaccessfile_async_001 + * @tc.desc Test createRandomAccessFile() interface. fpointer = 10. return in callback mode. + * Create RandomAccessFile object to access file based on file path. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_async_001', 0, async function (done) { + let fpath = await nextFileName('fileio_create_randomaccessfile_async_001'); + + try { + fileio.createRandomAccessFile(fpath, 10, 0o102, function(err, randomaccessfile) { + expect(isIntNum(randomaccessfile.fd)).assertTrue(); + expect(randomaccessfile.fpointer == 10).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + }); + } catch(err) { + console.info('fileio_create_randomaccessfile_async_001 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_ASYNC_0200 + * @tc.name fileio_create_randomaccessfile_async_002 + * @tc.desc Test createRandomAccessFile() interface. + * Create RandomAccessFile object based on file descriptor to access file. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_async_002', 0, async function (done) { + let fpath = await nextFileName('fileio_create_randomaccessfile_async_002'); + + try { + let fd = fileio.openSync(fpath, 0o102, 0o666); + fileio.createRandomAccessFile(fd, 0, function(err, randomaccessfile) { + expect(isIntNum(randomaccessfile.fd)).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + }); + } catch(err) { + console.info('fileio_create_randomaccessfile_async_002 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_ASYNC_0300 + * @tc.name fileio_create_randomaccessfile_async_003 + * @tc.desc Test createRandomAccessFile() interface. fpointer = 1. + * Create RandomAccessFile object based on file descriptor to access file. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_async_003', 0, async function (done) { + let fpath = await nextFileName('fileio_create_randomaccessfile_async_003'); + + try { + let fd = fileio.openSync(fpath, 0o102, 0o666); + let randomaccessfile = await fileio.createRandomAccessFile(fd, 1); + expect(isIntNum(randomaccessfile.fd)).assertTrue(); + expect(randomaccessfile.fpointer == 1).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } catch(err) { + console.info('fileio_create_randomaccessfile_async_003 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_ASYNC_0400 + * @tc.name fileio_create_randomaccessfile_async_004 + * @tc.desc Test createRandomAccessFile() interface. No such file or directory. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_async_004', 0, async function (done) { + let fpath = await nextFileName('fileio_create_randomaccessfile_async_004'); + + try { + await fileio.createRandomAccessFile(fpath, 0, 0o2); + } catch(err) { + console.info('fileio_create_randomaccessfile_async_004 has failed for ' + err); + expect(err.message == "No such file or directory").assertTrue(); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_ASYNC_0500 + * @tc.name fileio_create_randomaccessfile_async_005 + * @tc.desc Test createRandomAccessFile() interface. Invalid fd. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_async_005', 0, async function (done) { + try { + fileio.createRandomAccessFile(-1, 0, function(err) { + }); + } catch(err) { + console.info('fileio_create_randomaccessfile_async_005 has failed for ' + err); + expect(err.message == "Invalid fd").assertTrue(); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_ASYNC_0600 + * @tc.name fileio_create_randomaccessfile_async_006 + * @tc.desc Test createRandomAccessFile() interface. Invalid fp. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_async_006', 0, async function (done) { + let fpath = await nextFileName('fileio_create_randomaccessfile_async_006'); + let fd = fileio.openSync(fpath, 0o102, 0o666); + + try { + await fileio.createRandomAccessFile(fd, '1'); + } catch(err) { + console.info('fileio_create_randomaccessfile_async_006 has failed for ' + err); + expect(err.message == "Invalid fp").assertTrue(); + fileio.closeSync(fd); + fileio.unlinkSync(fpath); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_ASYNC_0700 + * @tc.name fileio_create_randomaccessfile_async_007 + * @tc.desc Test createRandomAccessFile() interface. Missing Parameter. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_async_007', 0, async function (done) { + let fpath = await nextFileName('fileio_create_randomaccessfile_async_007'); + let fd = fileio.openSync(fpath, 0o102, 0o666); + + try { + await fileio.createRandomAccessFile(fd); + } catch(err) { + console.info('fileio_create_randomaccessfile_async_007 has failed for ' + err); + expect(err.message == "Number of arguments unmatched").assertTrue(); + fileio.closeSync(fd); + fileio.unlinkSync(fpath); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_ASYNC_0800 + * @tc.name fileio_create_randomaccessfile_async_008 + * @tc.desc Test createRandomAccessFile() interface. flags=0o202. + * Create RandomAccessFile object to access file based on file path. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_async_008', 0, async function (done) { + let fpath = await nextFileName('fileio_create_randomaccessfile_async_008'); + expect(prepareFile(fpath, '')).assertTrue(); + + try { + fileio.createRandomAccessFile(fpath, 0, 0o202, function(err, randomaccessfile) { + expect(isIntNum(randomaccessfile.fd)).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + }); + } catch(err) { + console.info('fileio_create_randomaccessfile_async_008 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_SYNC_0900 + * @tc.name fileio_create_randomaccessfile_sync_009 + * @tc.desc Test createRandomAccessFile() interface. flags=0o302. File exists. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_async_009', 0, async function (done) { + let fpath = await nextFileName('fileio_create_randomaccessfile_async_009'); + expect(prepareFile(fpath, '')).assertTrue(); + + try { + await fileio.createRandomAccessFile(fpath, 0, 0o302); + } catch(err) { + console.info('fileio_create_randomaccessfile_async_009 has failed for ' + err); + expect(err.message == "File exists").assertTrue(); + fileio.unlinkSync(fpath); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_ASYNC_1000 + * @tc.name fileio_create_randomaccessfile_async_010 + * @tc.desc Test createRandomAccessFile() interface. flags=0o1002. + * If the file exists and the file is opened for write-only or read-write, trim its length to zero. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_async_010', 0, async function (done) { + let fpath = await nextFileName('fileio_create_randomaccessfile_async_010'); + expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); + + try { + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o1002); + let number = randomaccessfile.readSync(new ArrayBuffer(4096)); + expect(number == 0).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } catch(err) { + console.info('fileio_create_randomaccessfile_async_010 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_ASYNC_1100 + * @tc.name fileio_create_randomaccessfile_async_011 + * @tc.desc Test createRandomAccessFile() interface. flags=0o2002. + * Open as append, subsequent writes will append to the end of the file. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_async_011', 0, async function (done) { + let fpath = await nextFileName('fileio_create_randomaccessfile_async_011'); + expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); + + try { + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o2002); + let length = 100; + let num = randomaccessfile.writeSync(new ArrayBuffer(length)); + expect(num == length).assertTrue(); + randomaccessfile.setFilePointerSync(0); + let number = randomaccessfile.readSync(new ArrayBuffer(4096), { position: 0 }); + expect(number == length + FILE_CONTENT.length).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } catch(err) { + console.info('fileio_create_randomaccessfile_async_011 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_ASYNC_1200 + * @tc.name fileio_create_randomaccessfile_async_012 + * @tc.desc Test createRandomAccessFile() interface. flags=0o200002. Not a directory. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_async_012', 0, async function (done) { + let fpath = await nextFileName('fileio_create_randomaccessfile_async_012'); + expect(prepareFile(fpath, '')).assertTrue(); + + try { + await fileio.createRandomAccessFile(fpath, 0, 0o200002); + } catch(err) { + console.info('fileio_create_randomaccessfile_async_012 has failed for ' + err); + expect(err.message == "Not a directory").assertTrue(); + fileio.unlinkSync(fpath); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_ASYNC_1300 + * @tc.name fileio_create_randomaccessfile_async_013 + * @tc.desc Test createRandomAccessFile() interface. flags=0o400002. + * Create RandomAccessFile object to access file based on file path. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_async_013', 0, async function (done) { + let fpath = await nextFileName('fileio_create_randomaccessfile_async_013'); + expect(prepareFile(fpath, '')).assertTrue(); + + try { + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o400002); + expect(isIntNum(randomaccessfile.fd)).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } catch(err) { + console.info('fileio_create_randomaccessfile_async_013 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_ASYNC_1400 + * @tc.name fileio_create_randomaccessfile_async_014 + * @tc.desc Test createRandomAccessFile() interface. flags=0o4010002. + * Create RandomAccessFile object to access file based on file path. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_async_014', 0, async function (done) { + let fpath = await nextFileName('fileio_create_randomaccessfile_async_014'); + expect(prepareFile(fpath, '')).assertTrue(); + + try { + let randomaccessfile = await fileio.createRandomAccessFile(fpath, 0, 0o4010002); + expect(isIntNum(randomaccessfile.fd)).assertTrue(); + randomaccessfile.closeSync(); + fileio.unlinkSync(fpath); + done(); + } catch(err) { + console.info('fileio_create_randomaccessfile_async_014 has failed for ' + err); + expect(null).assertFail(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_ASYNC_1500 + * @tc.name fileio_create_randomaccessfile_async_015 + * @tc.desc Test createRandomAccessFile() interface. flags=0o200002. Invalid filepath. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_async_015', 0, async function (done) { + let dpath = await nextFileName('fileio_create_randomaccessfile_async_015') + 'd'; + fileio.mkdirSync(dpath); + + try { + await fileio.createRandomAccessFile(dpath, 0, 0o200002); + } catch(err) { + console.info('fileio_create_randomaccessfile_async_015 has failed for ' + err); + expect(err.message == "Invalid filepath").assertTrue(); + fileio.rmdirSync(dpath); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_CREATE_RANDOMACCESSFILE_ASYNC_1600 + * @tc.name fileio_create_randomaccessfile_async_016 + * @tc.desc Test createRandomAccessFile() interface. flags=0o400002. Symbolic link loop. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_create_randomaccessfile_async_016', 0, async function (done) { + let fpath = await nextFileName('fileio_create_randomaccessfile_async_016'); + let ffpath = fpath + 'aaaa'; + expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); + + try { + fileio.symlinkSync(fpath, ffpath); + await fileio.createRandomAccessFile(ffpath, 0, 0o400002); + } catch(err) { + console.info('fileio_create_randomaccessfile_async_016 has failed for ' + err); + expect(err.message == 'Symbolic link loop' || + err.message == 'Too many symbolic links encountered').assertTrue(); + fileio.unlinkSync(fpath); + fileio.unlinkSync(ffpath); + done(); + } + }); + + /** + * @tc.number SUB_STORAGE_FILEIO_RANDOMACCESSFILE_MULTITHREADED_REPLICATION_0000 + * @tc.name fileio_randomaccessfile_multithreaded_replication_000 + * @tc.desc Test createRandomAccessFileSync() interface. Test multi-threaded replication. + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + * @tc.require + */ + it('fileio_randomaccessfile_multithreaded_replication_000', 0, async function (done) { + let srcpath = await nextFileName('fileio_randomaccessfile_multithreaded_replication_000'); + let dstpath = await nextFileName('fileio_randomaccessfile_multithreaded_replication_000_1'); + let length = 4096; + let buffer = new ArrayBuffer(length); + expect(prepareFile(srcpath, buffer)).assertTrue(); + + try { + let fileSize = fileio.statSync(srcpath).size; + // init randomaccessfiles + let threadNums = 4; + let srcfiles = new Array(); + let dstfiles = new Array(); + for (let i = 0; i < threadNums; i++) { + srcfiles[i] = fileio.createRandomAccessFileSync(srcpath, fileSize / threadNums * i, 0o2); + dstfiles[i] = fileio.createRandomAccessFileSync(dstpath, fileSize / threadNums * i, 0o102); + } + // copy in every thread i from multi-thread + let bufs = new Array(threadNums); + let len = length / threadNums; + for(let i = 0; i < threadNums; i++) { + bufs[i] = new ArrayBuffer(len); + srcfiles[i].read(bufs[i]).then(async function(readOut) { + let writeLen = await dstfiles[i].write(readOut.buffer); + expect(writeLen == len).assertTrue(); + dstfiles[i].closeSync(); + srcfiles[i].closeSync(); + if (i == threadNums - 1) { + let size = fileio.statSync(dstpath).size; + expect(size == fileSize).assertTrue(); + fileio.unlinkSync(srcpath); + fileio.unlinkSync(dstpath); + done(); + } + }); + } + } catch (err) { + console.info('fileio_randomaccessfile_multithreaded_replication_000 has failed for ' + err); + expect(null).assertFail(); + } + }); +}) +} diff --git a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/fchown.test.js b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/fchown.test.js index fe1d618292c1e69d61b5fd65bf3e8762203659b9..268fd1cf05d7e0c008c4f60a020b56aa59970671 100644 --- a/storage/storagefileiojstest/src/main/js/test/module_fileio/members/fchown.test.js +++ b/storage/storagefileiojstest/src/main/js/test/module_fileio/members/fchown.test.js @@ -122,54 +122,6 @@ describe('fileio_fchown', async function () { } }); - /** - * @tc.number SUB_DF_FILEIO_FCHOWN_ASYNC_0400 - * @tc.name fileio_test_fchown_async_004 - * @tc.desc Test the fchownAsync() interface with promise, wrong owner. Test file modification failed. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 0 - * @tc.require - */ - it('fileio_test_fchown_async_004', 0, async function (done) { - let fpath = await nextFileName('fileio_test_fchown_async_004'); - expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); - try { - let fd = fileio.openSync(fpath); - let stat = fileio.statSync(fpath); - await fileio.fchown(fd, null, stat.gid); - } catch (e) { - console.info('fileio_test_fchown_async_004 has failed for ' + e); - expect(e.message == "Operation not permitted" || e.message == "Invalid owner").assertTrue(); - fileio.unlinkSync(fpath); - done(); - } - }); - - /** - * @tc.number SUB_DF_FILEIO_FCHOWN_ASYNC_0500 - * @tc.name fileio_test_fchown_async_005 - * @tc.desc Test the fchownAsync() interface with promise, wrong group. Test file modification failed. - * @tc.size MEDIUM - * @tc.type Function - * @tc.level Level 0 - * @tc.require - */ - it('fileio_test_fchown_async_005', 0, async function (done) { - let fpath = await nextFileName('fileio_test_fchown_async_005'); - expect(prepareFile(fpath, FILE_CONTENT)).assertTrue(); - try { - let fd = fileio.openSync(fpath); - let stat = fileio.statSync(fpath); - await fileio.fchown(fd, stat.uid, null); - } catch (e) { - console.info('fileio_test_fchown_async_005 has failed for ' + e); - expect(e.message == "Invalid group").assertTrue(); - fileio.unlinkSync(fpath); - done(); - } - }); - /** * @tc.number SUB_DF_FILEIO_FCHOWN_SYNC_0000 * @tc.name fileio_test_fchown_sync_000 @@ -258,7 +210,7 @@ describe('fileio_fchown', async function () { fileio.fchownSync(fd, null, stat.gid); } catch (e) { console.info('fileio_test_fchown_sync_003 has failed for ' + e); - expect(e.message == "Operation not permitted").assertTrue(); + expect(e.message == "Invalid owner").assertTrue(); fileio.unlinkSync(fpath); } }); diff --git a/storage/storagefilejstest/BUILD.gn b/storage/storagefilejstest/BUILD.gn index 1b7c7ad1c98da5374747bc0ae0eb9b744186a41f..253ddbe5aff7efddc7f8dbe7a6c1849365ff8da1 100644 --- a/storage/storagefilejstest/BUILD.gn +++ b/storage/storagefilejstest/BUILD.gn @@ -21,8 +21,8 @@ ohos_js_hap_suite("storagefile_js_test") { ] certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsStorageFileJSTest" - subsystem_name = "distributeddatamgr" - part_name = "distributedfilejs" + subsystem_name = "filemanagement" + part_name = "file_api" } ohos_js_assets("storagefile_js_assets") { js2abc = true diff --git a/storage/storagefilejstest/src/main/config.json b/storage/storagefilejstest/src/main/config.json index 7c1aca40928e0a126c376df08427fe570088a63f..f97b4d4eb2bb7f62a32417731099407f238eb1fb 100644 --- a/storage/storagefilejstest/src/main/config.json +++ b/storage/storagefilejstest/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.storage.file", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/storage/storagefilejstest/src/main/js/test/File.test.js b/storage/storagefilejstest/src/main/js/test/File.test.js index 46d045cee79578b0f157ac9cf8e99155dd39093a..7ddc82eba3717ae246ab96daf7fbaa5f893b3d14 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, @@ -2725,8 +2726,8 @@ describe('fileTest', function () { dstUri: 'internal://cache/../files/cache/File_Copy_002' + typeArray[i], success: function () { console.info('File_Copy_002 call copy success.'); - fileio.unlinkSync(srcFpath); - fileio.unlinkSync(dstFpath); + file.delete('internal://cache/../files/File_Copy_002' + typeArray[i]); + file.delete('internal://cache/../files/cache/File_Copy_002' + typeArray[i]); done(); }, fail: function (data, code) { @@ -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/storage/storagesecuritylabeljstest/BUILD.gn b/storage/storagesecuritylabeljstest/BUILD.gn index 4871f90438c97560bf29caabf051c3812798c8d9..1797f065f80224aa4589c975d170a22700758b12 100644 --- a/storage/storagesecuritylabeljstest/BUILD.gn +++ b/storage/storagesecuritylabeljstest/BUILD.gn @@ -21,8 +21,8 @@ ohos_js_hap_suite("storagesecuritylabel_js_test") { ] certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsStorageSecurityLabelJSTest" - subsystem_name = "distributeddatamgr" - part_name = "distributedfilejs" + subsystem_name = "filemanagement" + part_name = "file_api" } ohos_js_assets("storagesecuritylabel_js_assets") { js2abc = true diff --git a/storage/storagesecuritylabeljstest/src/main/config.json b/storage/storagesecuritylabeljstest/src/main/config.json index 59d3307bbfd03d3fcb95e1148e7efda7330cadab..596430d262387617c5a8b081f5c7b1b0642797dd 100644 --- a/storage/storagesecuritylabeljstest/src/main/config.json +++ b/storage/storagesecuritylabeljstest/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.storage.securitylabel", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/storage/storagestatfsjstest/BUILD.gn b/storage/storagestatfsjstest/BUILD.gn index adb0223ebcc07aefa5b943598e112c94581a7cc4..755fc9208b185a080cf8ca0a39c6b07d61d00e4b 100644 --- a/storage/storagestatfsjstest/BUILD.gn +++ b/storage/storagestatfsjstest/BUILD.gn @@ -21,8 +21,8 @@ ohos_js_hap_suite("storagestatfs_js_test") { ] certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsStorageStatfsJsTest" - subsystem_name = "distributeddatamgr" - part_name = "distributedfilejs" + subsystem_name = "filemanagement" + part_name = "file_api" } ohos_js_assets("storagestatfs_js_assets") { js2abc = true diff --git a/storage/storagestatfsjstest/src/main/config.json b/storage/storagestatfsjstest/src/main/config.json index 2730c936978b582669de22cab78a1fabdfb10c89..a503282c89cc4732ee360cae3883da5d286e4949 100644 --- a/storage/storagestatfsjstest/src/main/config.json +++ b/storage/storagestatfsjstest/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.storage.statfs", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/storage/storagestatisticsjstest/entry/src/main/module.json b/storage/storagestatisticsjstest/entry/src/main/module.json index 3d0ff25f8d39b3c59147086cd5925ad4b041cb4f..d9054c1ba900137e401763403036ae77577cf468 100644 --- a/storage/storagestatisticsjstest/entry/src/main/module.json +++ b/storage/storagestatisticsjstest/entry/src/main/module.json @@ -8,6 +8,7 @@ "description": "$string:entry_desc", "mainElement": "MainAbility", "deviceTypes": [ + "default", "phone" ], "deliveryWithInstall": true, diff --git a/telephony/telephonyjstest/BUILD.gn b/telephony/telephonyjstest/BUILD.gn index 05e4514069e113b165c52f6efdb5507d8e2d7e16..5fcf47d4f8a3984c1835470403170f37490da8ec 100644 --- a/telephony/telephonyjstest/BUILD.gn +++ b/telephony/telephonyjstest/BUILD.gn @@ -24,5 +24,6 @@ group("telephonyjstest") { "radiostatistic:ActsRadiostatisticEtsTest", "sim:sim", "sms_mms:sms_mms", + "telephony_base:telephony_base", ] } diff --git a/telephony/telephonyjstest/call_manager/BUILD.gn b/telephony/telephonyjstest/call_manager/BUILD.gn index 81582258dd8e412c4874db5560f6d19e5126237a..afa53e6cee41b46e5081cd34f2bbac05e4451715 100644 --- a/telephony/telephonyjstest/call_manager/BUILD.gn +++ b/telephony/telephonyjstest/call_manager/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//test/xts/tools/build/suite.gni") diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/config.json b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/config.json index 51e031a98508f38930953245f06600a405b3b334..f8a2a575f62fa8b196e329427b9f8f25c7274f54 100644 --- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/config.json +++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { @@ -108,6 +109,10 @@ { "name":"ohos.permission.INTERNET", "reason":"need use ohos.permission.INTERNET" + }, + { + "name":"ohos.permission.GRANT_SENSITIVE_PERMISSIONS", + "reason":"need use ohos.permission.GRANT_SENSITIVE_PERMISSIONS" } ], "js": [ diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/CallManageAll.test.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/CallManageAll.test.js index 53bec43e9e4f478f3d24e6a32732878ed88810bf..8397dc53280678ef3ff5999db4fe45092b557ca4 100644 --- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/CallManageAll.test.js +++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/CallManageAll.test.js @@ -131,16 +131,6 @@ var timing = 0; var endTime = 0; export default function CallManageImsCall() { describe('CallManageImsCall', function () { - beforeAll(async function (done) { - try { - console.log('Telephony_CallManager enableImsSwitch success'); - await call.setCallPreferenceMode(DEFAULT_SLOT_ID, CALL_MODE_IMS); - console.log('Telephony_CallManager setCallPreferenceMode success'); - } catch (error) { - console.log(`Telephony_CallManager setCallPreferenceMode or enableImsSwitch error,error:${toString(error)}`); - } - done(); - }); afterEach(async function () { try { @@ -186,451 +176,6 @@ describe('CallManageImsCall', function () { console.log('Telephony_CallManager all 54 case is over for callmanager CallManageImsCall'); }); - /** - * @tc.number Telephony_CallManager_IMS_startRTT_Async_0200 - * @tc.name Run function startRTT by args callId CALL_ID_NOT_EXIST,msg RTT_MSG by callback, - * the function return error - * @tc.desc Function test - */ - it('Telephony_CallManager_IMS_startRTT_Async_0200', 0, function (done) { - let caseName = 'Telephony_CallManager_IMS_startRTT_Async_0200'; - call.startRTT(CALL_ID_NOT_EXIST, RTT_MSG, (error, data) => { - if (error) { - console.log(`${caseName} startRTT ${callId} error,case success,error:${toString(error)}`); - done(); - return; - } - expect().assertFail(); - console.log(`${caseName} startRTT success,case failed,data:${toString(data)}`); - done(); - }); - }); - - /** - * @tc.number Telephony_CallManager_IMS_startRTT_Promise_0200 - * @tc.name Run function startRTT by args callId CALL_ID_NOT_EXIST,msg RTT_MSG by callback, - * the function return error - * @tc.desc Function test - */ - it('Telephony_CallManager_IMS_startRTT_Promise_0200', 0, function (done) { - let caseName = 'Telephony_CallManager_IMS_startRTT_Promise_0200'; - call.startRTT(CALL_ID_NOT_EXIST, RTT_MSG).then(data => { - expect().assertFail(); - console.log(`${caseName} startRTT success,case failed,data:${toString(data)}`); - done(); - }).catch(error => { - console.log(`${caseName} startRTT ${callId} error,case success,error:${toString(error)}`); - done(); - }); - }); - - /** - * @tc.number Telephony_CallManager_IMS_stopRTT_Async_0200 - * @tc.name Run function stopRTT by args callId CALL_ID_NOT_EXIST by callback,the function return error - * @tc.desc Function test - */ - it('Telephony_CallManager_IMS_stopRTT_Async_0200', 0, function (done) { - let caseName = 'Telephony_CallManager_IMS_stopRTT_Async_0200'; - call.stopRTT(CALL_ID_NOT_EXIST, (error, data) => { - if (error) { - console.log(`${caseName} stopRTT ${callId} error,case success,error:${toString(error)}`); - done(); - return; - } - expect().assertFail(); - console.log(`${caseName} stopRTT success,case failed,data:${toString(data)}`); - done(); - }); - }); - - /** - * @tc.number Telephony_CallManager_IMS_stopRTT_Promise_0200 - * @tc.name Run function stopRTT by args callId CALL_ID_NOT_EXIST by callback,the function return error - * @tc.desc Function test - */ - it('Telephony_CallManager_IMS_stopRTT_Promise_0200', 0, function (done) { - let caseName = 'Telephony_CallManager_IMS_stopRTT_Promise_0200'; - call.stopRTT(CALL_ID_NOT_EXIST).then(data => { - expect().assertFail(); - console.log(`${caseName} stopRTT success,case failed,data:${toString(data)}`); - done(); - }).catch(error => { - console.log(`${caseName} stopRTT ${callId} error,case success,error:${toString(error)}`); - done(); - }); - }); - - - /** - * @tc.number Telephony_CallManager_controlCamera_Async_0200 - * @tc.name Dial a call and after answering the call,run function controlCamera by - * args cameraId CARMER_ID_NOT_EXIT by callback, - * the callback function return error - * @tc.desc Function test - */ - it('Telephony_CallManager_controlCamera_Async_0200', 0, function (done) { - let caseName = 'Telephony_CallManager_controlCamera_Async_0200'; - scenceInCalling({ - caseName:caseName, - phoneNumber:AUTO_ACCEPT_NUMBER2, - checkState:CALL_STATUS_DIALING - }).then(data => { - callId = data.callId; - let cameraId = CARMER_ID_NOT_EXIT; - call.controlCamera(cameraId, (error) => { - if (error) { - console.log(`${caseName} error,case success,error:${toString(error)}`); - hangupCall2(caseName, done, callId); - return; - } - console.log(`${caseName} case failed`); - expect().assertFail(); - hangupCall2(caseName, done, callId); - }); - }).catch(error => { - console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`); - done(); - }); - }); - - /** - * @tc.number Telephony_CallManager_controlCamera_Promise_0200 - * @tc.name Dial a call and after answering the call,run function controlCamera by args cameraId - * CARMER_ID_NOT_EXIT by promise,the function return error - * @tc.desc Function test - */ - it('Telephony_CallManager_controlCamera_Promise_0200', 0, async function (done) { - let caseName = 'Telephony_CallManager_controlCamera_Promise_0200'; - let cameraId = CARMER_ID_NOT_EXIT; - try { - let data = await scenceInCalling({ - caseName:caseName, - phoneNumber:AUTO_ACCEPT_NUMBER2, - checkState:CALL_STATUS_DIALING - }); - callId = data.callId; - } catch (error) { - console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`); - done(); - return; - } - try { - await call.controlCamera(cameraId); - console.log(`${caseName} case failed`); - expect().assertFail(); - } catch (err) { - console.log(`${caseName} case success. error:${toString(err)}`); - } - hangupCall2(caseName, done, callId); - }); - - /** - * @tc.number Telephony_CallManager_setPreviewWindow_Async_0300 - * @tc.name Dial a call and after answering the call,run function setPreviewWindow by args - * x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by callback, - * the callback function return error - * @tc.desc Function test - */ - it('Telephony_CallManager_setPreviewWindow_Async_0300', 0, function (done) { - let caseName = 'Telephony_CallManager_setPreviewWindow_Async_0300'; - scenceInCalling({ - caseName:caseName, - phoneNumber:AUTO_ACCEPT_NUMBER, - checkState:CALL_STATUS_DIALING - }).then(data => { - callId = data.callId; - let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600}; - call.setPreviewWindow(info, (error) => { - if (error) { - console.log(`${caseName} error,case success,error:${toString(error)}`); - hangupCall2(caseName, done, callId); - return; - } - console.log(`${caseName} case faild`); - expect().assertFail(); - hangupCall2(caseName, done, callId); - }); - }).catch(error => { - console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`); - done(); - }); - }); - - /** - * @tc.number Telephony_CallManager_setPreviewWindow_Promise_0300 - * @tc.name Dial a call and after answering the call,run function setPreviewWindow by args - * x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by promise, - * the function return error - * @tc.desc Function test - */ - it('Telephony_CallManager_setPreviewWindow_Promise_0300', 0, async function (done) { - let caseName = 'Telephony_CallManager_setPreviewWindow_Promise_0300'; - try { - let data = await scenceInCalling({ - caseName:caseName, - phoneNumber:AUTO_ACCEPT_NUMBER, - checkState:CALL_STATUS_DIALING - }); - callId = data.callId; - } catch (error) { - console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`); - done(); - return; - } - try { - let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600}; - await call.setPreviewWindow(info); - console.log(`${caseName} case faild`); - expect().assertFail(); - } catch (error) { - console.log(`${caseName} error,case success,error:${toString(error)}`); - } - hangupCall2(caseName, done, callId); - }); - - /** - * @tc.number Telephony_CallManager_setDisplayWindow_Async_0300 - * @tc.name Dial a call and after answering the call,run function setDisplayWindow by args - * x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by callback, - * the callback function return error - * @tc.desc Function test - */ - it('Telephony_CallManager_setDisplayWindow_Async_0300', 0, async function (done) { - let caseName = 'Telephony_CallManager_setDisplayWindow_Async_0300'; - try { - let data = await scenceInCalling({ - caseName:caseName, - phoneNumber:AUTO_ACCEPT_NUMBER, - checkState:CALL_STATUS_DIALING - }); - callId = data.callId; - } catch (error) { - console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`); - done(); - return; - } - try { - let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600}; - await call.setDisplayWindow(info); - console.log(`${caseName} case faild`); - expect().assertFail(); - } catch (error) { - console.log(`${caseName} error,case success,error:${toString(error)}`); - } - hangupCall2(caseName, done, callId); - }); - - /** - * @tc.number Telephony_CallManager_setDisplayWindow_Promise_0300 - * @tc.name Dial a call and after answering the call,run function setDisplayWindow by args - * x POS_700,y POS_10,z POS_Z_ERROR,width POS_LENGTH_300,height POS_LENGTH_600 by promise, - * the function return error - * @tc.desc Function test - */ - it('Telephony_CallManager_setDisplayWindow_Promise_0300', 0, async function (done) { - let caseName = 'Telephony_CallManager_setDisplayWindow_Promise_0300'; - try { - let data = await scenceInCalling({ - caseName:caseName, - phoneNumber:AUTO_ACCEPT_NUMBER, - checkState:CALL_STATUS_DIALING - }); - callId = data.callId; - } catch (error) { - console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`); - done(); - return; - } - try { - let info = {x: POS_700, y: POS_10, z: POS_Z_ERROR, width: POS_LENGTH_300, height: POS_LENGTH_600}; - await call.setDisplayWindow(info); - console.log(`${caseName} case faild`); - expect().assertFail(); - } catch (error) { - console.log(`${caseName} error,case success,error:${toString(error)}`); - } - hangupCall2(caseName, done, callId); - }); - - /** - * @tc.number Telephony_CallManager_setCameraZoom_Async_0400 - * @tc.name Dial a call and after answering the call,run function setCameraZoom by args - * zoomRatio ZOOM_RATIO_MINUS_1_0 by callback,the callback function return error - * @tc.desc Function test - */ - it('Telephony_CallManager_setCameraZoom_Async_0400', 0, function (done) { - let caseName = 'Telephony_CallManager_setCameraZoom_Async_0400'; - scenceInCalling({ - caseName:caseName, - phoneNumber:AUTO_ACCEPT_NUMBER2, - checkState:CALL_STATUS_DIALING - }).then(data => { - callId = data.callId; - call.setCameraZoom(ZOOM_RATIO_MINUS_1_0, (error) => { - if (error) { - console.log(`${caseName} error,case success,error:${toString(error)}`); - hangupCall2(caseName, done, callId); - return; - } - console.log(`${caseName} case failed`); - expect().assertFail(); - hangupCall2(caseName, done, callId); - }); - }).catch(error => { - console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`); - done(); - }); - }); - - /** - * @tc.number Telephony_CallManager_setCameraZoom_Promise_0400 - * @tc.name Dial a call and after answering the call,run function setCameraZoom by args - * zoomRatio ZOOM_RATIO_MINUS_1_0 by promise,the function return error - * @tc.desc Function test - */ - it('Telephony_CallManager_setCameraZoom_Promise_0400', 0, async function (done) { - let caseName = 'Telephony_CallManager_setCameraZoom_Promise_0400'; - try { - let data = await scenceInCalling({ - caseName:caseName, - phoneNumber:AUTO_ACCEPT_NUMBER, - checkState:CALL_STATUS_DIALING - }); - callId = data.callId; - } catch (error) { - console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`); - done(); - return; - } - try { - await call.setCameraZoom(ZOOM_RATIO_MINUS_1_0); - console.log(`${caseName} case failed`); - expect().assertFail(); - } catch (error) { - console.log(`${caseName} error,case success,error:${toString(error)}`); - } - hangupCall2(caseName, done, callId); - }); - - /** - * @tc.number Telephony_CallManager_setPausePicture_Async_0500 - * @tc.name Dial a call and after answering the call,run function setPausePicture by args - * path IMAGE_LOCAL_ERROR_PATH by callback,the callback function return error - * @tc.desc Function test - */ - it('Telephony_CallManager_setPausePicture_Async_0500', 0, function (done) { - let caseName = 'Telephony_CallManager_setPausePicture_Async_0500'; - scenceInCalling({ - caseName:caseName, - phoneNumber:AUTO_ACCEPT_NUMBER, - checkState:CALL_STATUS_DIALING - }).then(data => { - callId = data.callId; - call.setPausePicture(IMAGE_LOCAL_ERROR_PATH, (error) => { - if (error) { - console.log(`${caseName} case success,error:${toString(error)}`); - hangupCall2(caseName, done, callId); - return; - } - console.log(`${caseName} success,case failed`); - hangupCall2(caseName, done, callId); - }); - }).catch(error => { - console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`); - done(); - }); - }); - - /** - * @tc.number Telephony_CallManager_setPausePicture_Promise_0500 - * @tc.name Dial a call and after answering the call,run function setPausePicture - * by args path IMAGE_LOCAL_ERROR_PATH by promise, - * the callback function return error - * @tc.desc Function test - */ - it('Telephony_CallManager_setPausePicture_Promise_0500', 0, async function (done) { - let caseName = 'Telephony_CallManager_setPausePicture_Promise_0500'; - try { - let data = await scenceInCalling({ - caseName:caseName, - phoneNumber:AUTO_ACCEPT_NUMBER, - checkState:CALL_STATUS_DIALING - }); - callId = data.callId; - } catch (error) { - console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`); - done(); - return; - } - try { - await call.setPausePicture(IMAGE_LOCAL_ERROR_PATH); - console.log(`${caseName} success,case failed`); - } catch (error) { - console.log(`${caseName} case success,error:${toString(error)}`); - } - hangupCall2(caseName, done, callId); - }); - - /** - * @tc.number Telephony_CallManager_setDeviceDirection_Async_0500 - * @tc.name Dial a call and after answering the call,run function setDeviceDirection - * by args rotation ROTATION_MINUS_1 by callback,the callback function return error - * @tc.desc Function test - */ - it('Telephony_CallManager_setDeviceDirection_Async_0500', 0, function (done) { - let caseName = 'Telephony_CallManager_setDeviceDirection_Async_0500'; - scenceInCalling({ - caseName:caseName, - phoneNumber:AUTO_ACCEPT_NUMBER, - checkState:CALL_STATUS_DIALING - }).then(data => { - callId = data.callId; - call.setDeviceDirection(ROTATION_MINUS_1, (error) => { - if (error) { - console.log(`${caseName} success, case success`); - hangupCall2(caseName, done, callId); - return; - } - console.log(`${caseName} error,case failed,error:${toString(error)}`); - expect().assertFail(); - hangupCall2(caseName, done, callId); - }); - }).catch(error => { - console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`); - done(); - }); - }); - - /** - * @tc.number Telephony_CallManager_setDeviceDirection_Promise_0500 - * @tc.name Dial a call and after answering the call,run function setDeviceDirection - * by args rotation ROTATION_MINUS_1 by promise,the callback function return error - * @tc.desc Function test - */ - it('Telephony_CallManager_setDeviceDirection_Promise_0500', 0, async function (done) { - let caseName = 'Telephony_CallManager_setDeviceDirection_Promise_0500'; - try { - let data = await scenceInCalling({ - caseName:caseName, - phoneNumber:AUTO_ACCEPT_NUMBER2, - checkState:CALL_STATUS_DIALING - }); - callId = data.callId; - } catch (error) { - console.log(`${caseName} scenceInCalling error ,case failed,error:${toString(error)}`); - done(); - return; - } - try { - await call.setDeviceDirection(ROTATION_MINUS_1); - console.log(`${caseName} success,case error`); - expect().assertFail(); - } catch (error) { - console.log(`${caseName} case success,error:${toString(error)}`); - } - hangupCall2(caseName, done, callId); - }); - /** * @tc.number Telephony_CallManager_getCallState_Async_0100 * @tc.name To get the idle call status, call getCallState() to get the current call status. diff --git a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/ObjectInterface_test.js b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/ObjectInterface_test.js index 938bbd11e95f0f45768aab61f042d861c565cbdc..66a5f20f4028422de2ccadf0ed980e9619d5e327 100644 --- a/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/ObjectInterface_test.js +++ b/telephony/telephonyjstest/call_manager/call_manager_ims2_call/src/main/js/test/ObjectInterface_test.js @@ -14,301 +14,2007 @@ */ import contactsapi from "@ohos.contact"; -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from '@ohos/hypium' +import sms from '@ohos.telephony.sms'; +import bundle from '@ohos.bundle' +import abilityAccessCtrl from '@ohos.abilityAccessCtrl' +import account from '@ohos.account.osAccount'; +import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, it } from '@ohos/hypium' export default function ObjectInterfaceTest() { - describe('ObjectInterfaceTest', function () { - function sleep(numberMillis) { - var now = new Date(); - var exitTime = now.getTime() + numberMillis; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - return; - } - } - var contactData = { - id: 0, - key: "0", - contactAttributes: { - attributes: [contactsapi.Attribute.ATTR_CONTACT_EVENT, contactsapi.Attribute.ATTR_EMAIL, - contactsapi.Attribute.ATTR_GROUP_MEMBERSHIP, - contactsapi.Attribute.ATTR_IM, contactsapi.Attribute.ATTR_NAME, contactsapi.Attribute.ATTR_NICKNAME, - contactsapi.Attribute.ATTR_NOTE, contactsapi.Attribute.ATTR_ORGANIZATION, contactsapi.Attribute.ATTR_PHONE, - contactsapi.Attribute.ATTR_PORTRAIT, contactsapi.Attribute.ATTR_POSTAL_ADDRESS, - contactsapi.Attribute.ATTR_RELATION, - contactsapi.Attribute.ATTR_SIP_ADDRESS, contactsapi.Attribute.ATTR_WEBSITE] - }, - emails: [{ - email: "email", labelName: "自定义邮箱", labelId: 1, displayName: "emailDisplayName" - }], - events: [{ - eventDate: "event", labelName: "自定义event", labelId: 2 - }], - groups: [{ - groupId: 1, title: "群组" + + describe('ObjectInterfaceTest', function () { + + function sleep(numberMillis) { + var now = new Date(); + var exitTime = now.getTime() + numberMillis; + while (true) { + now = new Date(); + if (now.getTime() > exitTime) + return; + } + } + + var contactData = { + id: 0, + key: "0", + contactAttributes: { + attributes: [contactsapi.Attribute.ATTR_CONTACT_EVENT, contactsapi.Attribute.ATTR_EMAIL, + contactsapi.Attribute.ATTR_GROUP_MEMBERSHIP, + contactsapi.Attribute.ATTR_IM, contactsapi.Attribute.ATTR_NAME, contactsapi.Attribute.ATTR_NICKNAME, + contactsapi.Attribute.ATTR_NOTE, contactsapi.Attribute.ATTR_ORGANIZATION, contactsapi.Attribute.ATTR_PHONE, + contactsapi.Attribute.ATTR_PORTRAIT, contactsapi.Attribute.ATTR_POSTAL_ADDRESS, + contactsapi.Attribute.ATTR_RELATION, + contactsapi.Attribute.ATTR_SIP_ADDRESS, contactsapi.Attribute.ATTR_WEBSITE] + }, + emails: [{ + email: "email", labelName: "自定义邮箱", labelId: 1, displayName: "emailDisplayName" + }], + events: [{ + eventDate: "event", labelName: "自定义event", labelId: 2 + }], + groups: [{ + groupId: 1, title: "群组" + }], + imAddresses: [{ + imAddress: "imAddress", labelName: "自定义", labelId: 3 + }], + phoneNumbers: [{ + phoneNumber: "183", labelName: "自定义phoneNumbers", labelId: 4 }], - imAddresses: [{ - imAddress: "imAddress", labelName: "自定义", labelId: 3 - }], - phoneNumbers: [{ - phoneNumber: "183", labelName: "自定义phoneNumbers", labelId: 4 - }], - portrait: { - uri: "content://head/0" - }, - postalAddresses: [{ - city: "南京", - country: "中国", - labelName: "labelName", - neighborhood: "neighborhood", - pobox: "pobox", - postalAddress: "postalAddress", - postcode: "postcode", - region: "region", - street: "street", - labelId: 5 - }], - relations: [{ - relationName: "relationName", labelName: "自定义relationName", labelId: 6 + portrait: { + uri: "content://head/0" + }, + postalAddresses: [{ + city: "南京", + country: "中国", + labelName: "labelName", + neighborhood: "neighborhood", + pobox: "pobox", + postalAddress: "postalAddress", + postcode: "postcode", + region: "region", + street: "street", + labelId: 5 }], - sipAddresses: [{ - sipAddress: "sipAddress", labelName: "自定义sipAddress", labelId: 6 - }], - websites: [{ - website: "website" - }], - name: { - familyName: "familyName", - familyNamePhonetic: "familyNamePhonetic", - fullName: "小李", - givenName: "givenName", - givenNamePhonetic: "givenNamePhonetic", - middleName: "middleName", - middleNamePhonetic: "middleNamePhonetic", - namePrefix: "namePrefix", - nameSuffix: "nameSuffix" - }, - nickName: { - nickName: "nickName" - }, - note: { - noteContent: "note" - }, - organization: { - name: "TT", title: "开发" - } - }; - - var gRawContactId; - var gGroup; - - - it("contactsApi_contactdata_test_100", 0, async function (done) { - console.info("contactData.id" + contactData.id); - console.info("contactData.id" + (contactData.id == 0)); - expect(contactData.id == 0).assertTrue(); - console.info("contactData.key" + contactData.key); - console.info("contactData.key" + (contactData.key=="0")); - expect(contactData.key).assertEqual("0"); - console.info("contactData.contactAttributes" + contactData.contactAttributes); - console.info("contactData.contactAttributes" + (contactData.contactAttributes != null)); - expect(contactData.contactAttributes != null).assertTrue(); - console.info("contactData.emails" + contactData.emails); - expect(contactData.emails != null).assertTrue(); - expect(contactData.events != null).assertTrue(); - expect(contactData.groups != null).assertTrue(); - expect(contactData.imAddresses != null).assertTrue(); - done(); - }); - - it("contactsApi_contactdata_test_200", 0, async function (done) { - expect(contactData.phoneNumbers != null).assertTrue(); - expect(contactData.portrait != null).assertTrue(); - expect(contactData.postalAddresses != null).assertTrue(); - expect(contactData.relations != null).assertTrue(); - expect(contactData.sipAddresses != null).assertTrue(); - expect(contactData.websites != null).assertTrue(); - expect(contactData.name != null).assertTrue(); - expect(contactData.nickName != null).assertTrue(); - expect(contactData.note != null).assertTrue(); - expect(contactData.organization != null).assertTrue(); - expect(contactData.contactAttributes.attributes != null).assertTrue(); - done(); - }); - - it("contactsApi_contactdata_test_300", 0, async function (done) { - expect(contactData.emails.email === null).assertFalse(); - expect(contactData.emails.labelName === null).assertFalse(); - console.info("contactData.emails.labelId == 1" + contactData.emails.labelId); - expect(contactData.emails.labelId != 0).assertTrue(); - expect(contactData.emails.displayName === null).assertFalse(); - expect(contactData.events.eventDate === null).assertFalse(); - expect(contactData.events.labelName === null).assertFalse(); - expect(contactData.events.labelId != 0).assertTrue(); - expect(contactData.groups.groupId != 0).assertTrue(); - expect(contactData.groups.title === null).assertFalse(); - done(); - }); - it("contactsApi_contactdata_test_400", 0, async function (done) { - expect(contactData.imAddresses.imAddress === null).assertFalse(); - expect(contactData.imAddresses.labelName === null).assertFalse(); - expect(contactData.imAddresses.labelId != 0).assertTrue(); - expect(contactData.name.familyName === null).assertFalse(); - expect(contactData.name.familyNamePhonetic === null).assertFalse(); - expect(contactData.name.fullName === null).assertFalse(); - expect(contactData.name.givenName === null).assertFalse(); - expect(contactData.name.givenNamePhonetic === null).assertFalse(); - expect(contactData.name.middleName === null).assertFalse(); - expect(contactData.name.middleNamePhonetic === null).assertFalse(); - expect(contactData.name.namePrefix === null).assertFalse(); - expect(contactData.name.nameSuffix === null).assertFalse(); - done(); - }); - - it("contactsApi_contactdata_test_500", 0, async function (done) { - expect(contactData.nickName.nickName === null).assertFalse(); - expect(contactData.note.noteContent === null).assertFalse(); - expect(contactData.organization.name === null).assertFalse(); - expect(contactData.organization.title === null).assertFalse(); - expect(contactData.phoneNumbers.labelId != 0).assertTrue(); - expect(contactData.phoneNumbers.labelName === null).assertFalse(); - expect(contactData.phoneNumbers.phoneNumber === null).assertFalse(); - expect(contactData.portrait.uri === null).assertFalse(); - done(); - }); - - it("contactsApi_contactdata_test_600", 0, async function (done) { - console.info("contactData.postalAddresses.city != null" - + contactData.postalAddresses.city - +(contactData.postalAddresses.city != null)); - expect(contactData.postalAddresses.city === null).assertFalse(); - expect(contactData.postalAddresses.country === null).assertFalse(); - expect(contactData.postalAddresses.labelName === null).assertFalse(); - expect(contactData.postalAddresses.neighborhood === null).assertFalse(); - expect(contactData.postalAddresses.pobox === null).assertFalse(); - expect(contactData.postalAddresses.postalAddress === null).assertFalse(); - expect(contactData.postalAddresses.postcode === null).assertFalse(); - expect(contactData.postalAddresses.region === null).assertFalse(); - expect(contactData.postalAddresses.street === null).assertFalse(); - expect(contactData.postalAddresses.labelId != 0).assertTrue(); - done(); - }); - - it("contactsApi_contactdata_test_700", 0, async function (done) { - console.info("contactData.relations.labelName != null" - + contactData.relations.labelName +(contactData.relations.labelName === null)); - expect(contactData.relations.labelId != 0).assertTrue(); - expect(contactData.relations.labelName === null).assertFalse(); - expect(contactData.relations.relationName === null).assertFalse(); - expect(contactData.sipAddresses.labelId != 0).assertTrue(); - expect(contactData.sipAddresses.labelName === null).assertFalse(); - expect(contactData.sipAddresses.sipAddress === null).assertFalse(); - expect(contactData.websites.website === null).assertFalse(); - done(); - }); - - - it("contactsApi_contactdata_test_800", 0, async function (done) { - expect(contactsapi.Contact.INVALID_CONTACT_ID == -1).assertTrue(); - expect(contactsapi.Attribute.ATTR_CONTACT_EVENT == - contactData.contactAttributes.attributes[0]).assertTrue(); - expect(contactsapi.Attribute.ATTR_EMAIL == contactData.contactAttributes.attributes[1]).assertTrue(); - expect(contactsapi.Attribute.ATTR_GROUP_MEMBERSHIP == - contactData.contactAttributes.attributes[2]).assertTrue(); - expect(contactsapi.Attribute.ATTR_IM == contactData.contactAttributes.attributes[3]).assertTrue(); - expect(contactsapi.Attribute.ATTR_NAME == contactData.contactAttributes.attributes[4]).assertTrue(); - expect(contactsapi.Attribute.ATTR_NICKNAME == contactData.contactAttributes.attributes[5]).assertTrue(); - expect(contactsapi.Attribute.ATTR_NOTE == contactData.contactAttributes.attributes[6]).assertTrue(); - expect(contactsapi.Attribute.ATTR_ORGANIZATION == contactData.contactAttributes.attributes[7]).assertTrue(); - expect(contactsapi.Attribute.ATTR_PHONE == contactData.contactAttributes.attributes[8]).assertTrue(); - expect(contactsapi.Attribute.ATTR_PORTRAIT == contactData.contactAttributes.attributes[9]).assertTrue(); - expect(contactsapi.Attribute.ATTR_POSTAL_ADDRESS == - contactData.contactAttributes.attributes[10]).assertTrue(); - expect(contactsapi.Attribute.ATTR_RELATION == contactData.contactAttributes.attributes[11]).assertTrue(); - expect(contactsapi.Attribute.ATTR_SIP_ADDRESS == contactData.contactAttributes.attributes[12]).assertTrue(); - expect(contactsapi.Attribute.ATTR_WEBSITE == contactData.contactAttributes.attributes[13]).assertTrue(); - done(); - }); - - it("contactsApi_contactdata_test_900", 0, async function (done) { - expect(contactsapi.Email.CUSTOM_LABEL == 0).assertTrue(); - expect(contactsapi.Email.EMAIL_HOME == 1).assertTrue(); - expect(contactsapi.Email.EMAIL_WORK == 2).assertTrue(); - expect(contactsapi.Email.EMAIL_OTHER == 3).assertTrue(); - expect(contactsapi.Email.INVALID_LABEL_ID == -1).assertTrue(); - expect(contactsapi.Event.CUSTOM_LABEL == 0).assertTrue(); - expect(contactsapi.Event.EVENT_ANNIVERSARY == 1).assertTrue(); - expect(contactsapi.Event.EVENT_OTHER == 2).assertTrue(); - expect(contactsapi.Event.EVENT_BIRTHDAY == 3).assertTrue(); - expect(contactsapi.Email.INVALID_LABEL_ID == -1).assertTrue(); - expect(contactsapi.ImAddress.CUSTOM_LABEL == -1).assertTrue(); - expect(contactsapi.ImAddress.IM_AIM == 0).assertTrue(); - expect(contactsapi.ImAddress.IM_MSN == 1).assertTrue(); - expect(contactsapi.ImAddress.IM_YAHOO == 2).assertTrue(); - expect(contactsapi.ImAddress.IM_SKYPE == 3).assertTrue(); - expect(contactsapi.ImAddress.IM_QQ == 4).assertTrue(); - expect(contactsapi.ImAddress.IM_ICQ == 6).assertTrue(); - expect(contactsapi.ImAddress.IM_JABBER == 7).assertTrue(); - expect(contactsapi.ImAddress.INVALID_LABEL_ID == -2).assertTrue(); - done(); - }); - - it("contactsApi_contactdata_test_1000", 0, async function (done) { - expect(contactsapi.PhoneNumber.CUSTOM_LABEL == 0).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_HOME == 1).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_MOBILE == 2).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_WORK == 3).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_FAX_WORK == 4).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_FAX_HOME == 5).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_PAGER == 6).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_OTHER == 7).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_CALLBACK == 8).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_CAR == 9).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_COMPANY_MAIN == 10).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_ISDN == 11).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_MAIN == 12).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_OTHER_FAX == 13).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_RADIO == 14).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_TELEX == 15).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_TTY_TDD == 16).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_WORK_MOBILE == 17).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_WORK_PAGER == 18).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_ASSISTANT == 19).assertTrue(); - expect(contactsapi.PhoneNumber.NUM_MMS == 20).assertTrue(); - expect(contactsapi.PhoneNumber.INVALID_LABEL_ID == -1).assertTrue(); - expect(contactsapi.PostalAddress.CUSTOM_LABEL == 0).assertTrue(); - expect(contactsapi.PostalAddress.ADDR_HOME == 1).assertTrue(); - expect(contactsapi.PostalAddress.ADDR_WORK == 2).assertTrue(); - expect(contactsapi.PostalAddress.ADDR_OTHER == 3).assertTrue(); - expect(contactsapi.PostalAddress.INVALID_LABEL_ID == -1).assertTrue(); - done(); - }); - - it("contactsApi_contactdata_test_1100", 0, async function (done) { - expect(contactsapi.Relation.CUSTOM_LABEL == 0).assertTrue(); - expect(contactsapi.Relation.RELATION_ASSISTANT == 1).assertTrue(); - expect(contactsapi.Relation.RELATION_BROTHER == 2).assertTrue(); - expect(contactsapi.Relation.RELATION_CHILD == 3).assertTrue(); - expect(contactsapi.Relation.RELATION_DOMESTIC_PARTNER == 4).assertTrue(); - expect(contactsapi.Relation.RELATION_FATHER == 5).assertTrue(); - expect(contactsapi.Relation.RELATION_FRIEND == 6).assertTrue(); - expect(contactsapi.Relation.RELATION_MANAGER == 7).assertTrue(); - expect(contactsapi.Relation.RELATION_MOTHER == 8).assertTrue(); - expect(contactsapi.Relation.RELATION_PARENT == 9).assertTrue(); - expect(contactsapi.Relation.RELATION_PARTNER == 10).assertTrue(); - expect(contactsapi.Relation.RELATION_REFERRED_BY == 11).assertTrue(); - expect(contactsapi.Relation.RELATION_RELATIVE == 12).assertTrue(); - expect(contactsapi.Relation.RELATION_SISTER == 13).assertTrue(); - expect(contactsapi.Relation.RELATION_SPOUSE == 14).assertTrue(); - expect(contactsapi.Relation.INVALID_LABEL_ID == -1).assertTrue(); - expect(contactsapi.SipAddress.CUSTOM_LABEL == 0).assertTrue(); - expect(contactsapi.SipAddress.SIP_HOME == 1).assertTrue(); - expect(contactsapi.SipAddress.SIP_WORK == 2).assertTrue(); - expect(contactsapi.SipAddress.SIP_OTHER == 3).assertTrue(); - expect(contactsapi.SipAddress.INVALID_LABEL_ID == -1).assertTrue(); - done(); - }); + relations: [{ + relationName: "relationName", labelName: "自定义relationName", labelId: 6 + }], + sipAddresses: [{ + sipAddress: "sipAddress", labelName: "自定义sipAddress", labelId: 6 + }], + websites: [{ + website: "website" + }], + name: { + familyName: "familyName", + familyNamePhonetic: "familyNamePhonetic", + fullName: "小李", + givenName: "givenName", + givenNamePhonetic: "givenNamePhonetic", + middleName: "middleName", + middleNamePhonetic: "middleNamePhonetic", + namePrefix: "namePrefix", + nameSuffix: "nameSuffix" + }, + nickName: { + nickName: "nickName" + }, + note: { + noteContent: "note" + }, + organization: { + name: "TT", title: "开发" + } + }; + + var gRawContactId; + var gGroup; + + + it("contactsApi_contactdata_test_100", 0, async function (done) { + console.info("contactData.id" + contactData.id); + console.info("contactData.id" + (contactData.id == 0)); + expect(contactData.id == 0).assertTrue(); + console.info("contactData.key" + contactData.key); + console.info("contactData.key" + (contactData.key == "0")); + expect(contactData.key).assertEqual("0"); + console.info("contactData.contactAttributes" + contactData.contactAttributes); + console.info("contactData.contactAttributes" + (contactData.contactAttributes != null)); + expect(contactData.contactAttributes != null).assertTrue(); + console.info("contactData.emails" + contactData.emails); + expect(contactData.emails != null).assertTrue(); + expect(contactData.events != null).assertTrue(); + expect(contactData.groups != null).assertTrue(); + expect(contactData.imAddresses != null).assertTrue(); + done(); + }); + + it("contactsApi_contactdata_test_200", 0, async function (done) { + expect(contactData.phoneNumbers != null).assertTrue(); + expect(contactData.portrait != null).assertTrue(); + expect(contactData.postalAddresses != null).assertTrue(); + expect(contactData.relations != null).assertTrue(); + expect(contactData.sipAddresses != null).assertTrue(); + expect(contactData.websites != null).assertTrue(); + expect(contactData.name != null).assertTrue(); + expect(contactData.nickName != null).assertTrue(); + expect(contactData.note != null).assertTrue(); + expect(contactData.organization != null).assertTrue(); + expect(contactData.contactAttributes.attributes != null).assertTrue(); + done(); + }); + + it("contactsApi_contactdata_test_300", 0, async function (done) { + expect(contactData.emails.email === null).assertFalse(); + expect(contactData.emails.labelName === null).assertFalse(); + console.info("contactData.emails.labelId == 1" + contactData.emails.labelId); + expect(contactData.emails.labelId != 0).assertTrue(); + expect(contactData.emails.displayName === null).assertFalse(); + expect(contactData.events.eventDate === null).assertFalse(); + expect(contactData.events.labelName === null).assertFalse(); + expect(contactData.events.labelId != 0).assertTrue(); + expect(contactData.groups.groupId != 0).assertTrue(); + expect(contactData.groups.title === null).assertFalse(); + done(); + }); + it("contactsApi_contactdata_test_400", 0, async function (done) { + expect(contactData.imAddresses.imAddress === null).assertFalse(); + expect(contactData.imAddresses.labelName === null).assertFalse(); + expect(contactData.imAddresses.labelId != 0).assertTrue(); + expect(contactData.name.familyName === null).assertFalse(); + expect(contactData.name.familyNamePhonetic === null).assertFalse(); + expect(contactData.name.fullName === null).assertFalse(); + expect(contactData.name.givenName === null).assertFalse(); + expect(contactData.name.givenNamePhonetic === null).assertFalse(); + expect(contactData.name.middleName === null).assertFalse(); + expect(contactData.name.middleNamePhonetic === null).assertFalse(); + expect(contactData.name.namePrefix === null).assertFalse(); + expect(contactData.name.nameSuffix === null).assertFalse(); + done(); + }); + + it("contactsApi_contactdata_test_500", 0, async function (done) { + expect(contactData.nickName.nickName === null).assertFalse(); + expect(contactData.note.noteContent === null).assertFalse(); + expect(contactData.organization.name === null).assertFalse(); + expect(contactData.organization.title === null).assertFalse(); + expect(contactData.phoneNumbers.labelId != 0).assertTrue(); + expect(contactData.phoneNumbers.labelName === null).assertFalse(); + expect(contactData.phoneNumbers.phoneNumber === null).assertFalse(); + expect(contactData.portrait.uri === null).assertFalse(); + done(); + }); + + it("contactsApi_contactdata_test_600", 0, async function (done) { + console.info("contactData.postalAddresses.city != null" + + contactData.postalAddresses.city + + (contactData.postalAddresses.city != null)); + expect(contactData.postalAddresses.city === null).assertFalse(); + expect(contactData.postalAddresses.country === null).assertFalse(); + expect(contactData.postalAddresses.labelName === null).assertFalse(); + expect(contactData.postalAddresses.neighborhood === null).assertFalse(); + expect(contactData.postalAddresses.pobox === null).assertFalse(); + expect(contactData.postalAddresses.postalAddress === null).assertFalse(); + expect(contactData.postalAddresses.postcode === null).assertFalse(); + expect(contactData.postalAddresses.region === null).assertFalse(); + expect(contactData.postalAddresses.street === null).assertFalse(); + expect(contactData.postalAddresses.labelId != 0).assertTrue(); + done(); + }); + + it("contactsApi_contactdata_test_700", 0, async function (done) { + console.info("contactData.relations.labelName != null" + + contactData.relations.labelName + (contactData.relations.labelName === null)); + expect(contactData.relations.labelId != 0).assertTrue(); + expect(contactData.relations.labelName === null).assertFalse(); + expect(contactData.relations.relationName === null).assertFalse(); + expect(contactData.sipAddresses.labelId != 0).assertTrue(); + expect(contactData.sipAddresses.labelName === null).assertFalse(); + expect(contactData.sipAddresses.sipAddress === null).assertFalse(); + expect(contactData.websites.website === null).assertFalse(); + done(); + }); + + + it("contactsApi_contactdata_test_800", 0, async function (done) { + expect(contactsapi.Contact.INVALID_CONTACT_ID == -1).assertTrue(); + expect(contactsapi.Attribute.ATTR_CONTACT_EVENT == + contactData.contactAttributes.attributes[0]).assertTrue(); + expect(contactsapi.Attribute.ATTR_EMAIL == contactData.contactAttributes.attributes[1]).assertTrue(); + expect(contactsapi.Attribute.ATTR_GROUP_MEMBERSHIP == + contactData.contactAttributes.attributes[2]).assertTrue(); + expect(contactsapi.Attribute.ATTR_IM == contactData.contactAttributes.attributes[3]).assertTrue(); + expect(contactsapi.Attribute.ATTR_NAME == contactData.contactAttributes.attributes[4]).assertTrue(); + expect(contactsapi.Attribute.ATTR_NICKNAME == contactData.contactAttributes.attributes[5]).assertTrue(); + expect(contactsapi.Attribute.ATTR_NOTE == contactData.contactAttributes.attributes[6]).assertTrue(); + expect(contactsapi.Attribute.ATTR_ORGANIZATION == contactData.contactAttributes.attributes[7]).assertTrue(); + expect(contactsapi.Attribute.ATTR_PHONE == contactData.contactAttributes.attributes[8]).assertTrue(); + expect(contactsapi.Attribute.ATTR_PORTRAIT == contactData.contactAttributes.attributes[9]).assertTrue(); + expect(contactsapi.Attribute.ATTR_POSTAL_ADDRESS == + contactData.contactAttributes.attributes[10]).assertTrue(); + expect(contactsapi.Attribute.ATTR_RELATION == contactData.contactAttributes.attributes[11]).assertTrue(); + expect(contactsapi.Attribute.ATTR_SIP_ADDRESS == contactData.contactAttributes.attributes[12]).assertTrue(); + expect(contactsapi.Attribute.ATTR_WEBSITE == contactData.contactAttributes.attributes[13]).assertTrue(); + done(); + }); + + it("contactsApi_contactdata_test_900", 0, async function (done) { + expect(contactsapi.Email.CUSTOM_LABEL == 0).assertTrue(); + expect(contactsapi.Email.EMAIL_HOME == 1).assertTrue(); + expect(contactsapi.Email.EMAIL_WORK == 2).assertTrue(); + expect(contactsapi.Email.EMAIL_OTHER == 3).assertTrue(); + expect(contactsapi.Email.INVALID_LABEL_ID == -1).assertTrue(); + expect(contactsapi.Event.CUSTOM_LABEL == 0).assertTrue(); + expect(contactsapi.Event.EVENT_ANNIVERSARY == 1).assertTrue(); + expect(contactsapi.Event.EVENT_OTHER == 2).assertTrue(); + expect(contactsapi.Event.EVENT_BIRTHDAY == 3).assertTrue(); + expect(contactsapi.Email.INVALID_LABEL_ID == -1).assertTrue(); + expect(contactsapi.ImAddress.CUSTOM_LABEL == -1).assertTrue(); + expect(contactsapi.ImAddress.IM_AIM == 0).assertTrue(); + expect(contactsapi.ImAddress.IM_MSN == 1).assertTrue(); + expect(contactsapi.ImAddress.IM_YAHOO == 2).assertTrue(); + expect(contactsapi.ImAddress.IM_SKYPE == 3).assertTrue(); + expect(contactsapi.ImAddress.IM_QQ == 4).assertTrue(); + expect(contactsapi.ImAddress.IM_ICQ == 6).assertTrue(); + expect(contactsapi.ImAddress.IM_JABBER == 7).assertTrue(); + expect(contactsapi.ImAddress.INVALID_LABEL_ID == -2).assertTrue(); + done(); + }); + + it("contactsApi_contactdata_test_1000", 0, async function (done) { + expect(contactsapi.PhoneNumber.CUSTOM_LABEL == 0).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_HOME == 1).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_MOBILE == 2).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_WORK == 3).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_FAX_WORK == 4).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_FAX_HOME == 5).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_PAGER == 6).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_OTHER == 7).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_CALLBACK == 8).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_CAR == 9).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_COMPANY_MAIN == 10).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_ISDN == 11).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_MAIN == 12).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_OTHER_FAX == 13).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_RADIO == 14).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_TELEX == 15).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_TTY_TDD == 16).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_WORK_MOBILE == 17).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_WORK_PAGER == 18).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_ASSISTANT == 19).assertTrue(); + expect(contactsapi.PhoneNumber.NUM_MMS == 20).assertTrue(); + expect(contactsapi.PhoneNumber.INVALID_LABEL_ID == -1).assertTrue(); + expect(contactsapi.PostalAddress.CUSTOM_LABEL == 0).assertTrue(); + expect(contactsapi.PostalAddress.ADDR_HOME == 1).assertTrue(); + expect(contactsapi.PostalAddress.ADDR_WORK == 2).assertTrue(); + expect(contactsapi.PostalAddress.ADDR_OTHER == 3).assertTrue(); + expect(contactsapi.PostalAddress.INVALID_LABEL_ID == -1).assertTrue(); + done(); + }); + + it("contactsApi_contactdata_test_1100", 0, async function (done) { + expect(contactsapi.Relation.CUSTOM_LABEL == 0).assertTrue(); + expect(contactsapi.Relation.RELATION_ASSISTANT == 1).assertTrue(); + expect(contactsapi.Relation.RELATION_BROTHER == 2).assertTrue(); + expect(contactsapi.Relation.RELATION_CHILD == 3).assertTrue(); + expect(contactsapi.Relation.RELATION_DOMESTIC_PARTNER == 4).assertTrue(); + expect(contactsapi.Relation.RELATION_FATHER == 5).assertTrue(); + expect(contactsapi.Relation.RELATION_FRIEND == 6).assertTrue(); + expect(contactsapi.Relation.RELATION_MANAGER == 7).assertTrue(); + expect(contactsapi.Relation.RELATION_MOTHER == 8).assertTrue(); + expect(contactsapi.Relation.RELATION_PARENT == 9).assertTrue(); + expect(contactsapi.Relation.RELATION_PARTNER == 10).assertTrue(); + expect(contactsapi.Relation.RELATION_REFERRED_BY == 11).assertTrue(); + expect(contactsapi.Relation.RELATION_RELATIVE == 12).assertTrue(); + expect(contactsapi.Relation.RELATION_SISTER == 13).assertTrue(); + expect(contactsapi.Relation.RELATION_SPOUSE == 14).assertTrue(); + expect(contactsapi.Relation.INVALID_LABEL_ID == -1).assertTrue(); + expect(contactsapi.SipAddress.CUSTOM_LABEL == 0).assertTrue(); + expect(contactsapi.SipAddress.SIP_HOME == 1).assertTrue(); + expect(contactsapi.SipAddress.SIP_WORK == 2).assertTrue(); + expect(contactsapi.SipAddress.SIP_OTHER == 3).assertTrue(); + expect(contactsapi.SipAddress.INVALID_LABEL_ID == -1).assertTrue(); + done(); + }); + + /** + * @tc.number + * @tc.name Insert contact information + * @tc.desc Function test + */ + it("contactsApi_insert_test_100", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + try { + var rawContactId = await contactsapi.addContact(contactData); + console.info("contactsApi_insert_test_100 : rawContactId = " + rawContactId); + gRawContactId = rawContactId; + expect(gRawContactId > 0).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_insert_test_100 : raw_contact insert error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_delete_test_200 + * @tc.name Delete contact information + * @tc.desc Function test + */ + it("contactsApi_delete_test_200", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var deleteId = gRawContactId; + try { + var deleteCode = await contactsapi.deleteContact(deleteId); + var gDelete = deleteCode; + console.info("contactsApi_delete_test_200 : deleteCode = " + deleteCode); + expect(gDelete == 0 || gDelete == -1).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_delete_test_200 : delete error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_update_test_300 + * @tc.name Update contact information + * @tc.desc Function test + */ + it("contactsApi_update_test_300", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var rawContactId = await contactsapi.addContact(contactData); + console.info("contactsApi_insert_test_300 : rawContactId = " + rawContactId); + gRawContactId = rawContactId; + expect(rawContactId > 0).assertTrue(); + + var updateValues = { + id: gRawContactId, name: { + fullName: "小红" + } + }; + var condition = { + attributes: [6] + } + try { + var updateCode = await contactsapi.updateContact(updateValues, condition); + console.info("contactsApi_update_test_300 : updateCode = " + updateCode); + expect(updateCode == 0).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_update_test_300 : update error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_contact_test_400 + * @tc.name Query contacts information + * @tc.desc Function test + */ + it("contactsApi_query_contact_test_400", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var queryId = gRawContactId; + try { + var resultSet = await contactsapi.queryContact(queryId); + console.info("contactsApi_query_contact_test_400 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet != null).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_query_contact_test_400 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_contact_test_500 + * @tc.name Query contacts information + * @tc.desc Function test + */ + it("contactsApi_query_contact_test_500", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var queryId = gRawContactId.toString(); + var holder = { + bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 + } + expect(holder.bundleName === null).assertFalse(); + expect(holder.displayName === null).assertFalse(); + expect(holder.holderId != 0).assertTrue(); + try { + var resultSet = await contactsapi.queryContact(queryId, holder); + console.info("contactsApi_query_contact_test_500 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet === null).assertFalse(); + done(); + } catch (error) { + console.info("contactsApi_query_contact_test_500 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_contact_test_600 + * @tc.name Query contacts information + * @tc.desc Function test + */ + it("contactsApi_query_contact_test_600", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var queryId = gRawContactId.toString(); + var holder = { + bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 + }; + var ContactAttributes = { + attributes: [1, 5, 6] + } + try { + var resultSet = await contactsapi.queryContact(queryId, holder, ContactAttributes); + console.info("contactsApi_query_contact_test_600 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet === null).assertFalse(); + done(); + } catch (error) { + console.info("contactsApi_query_contact_test_600 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_contacts_test_700 + * @tc.name Query contacts information + * @tc.desc Function test + */ + it("contactsApi_query_contacts_test_700", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + try { + var resultSet = await contactsapi.queryContacts(); + console.info("contactsApi_query_contacts_test_700 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet != null).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_query_contacts_test_700 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_contacts_test_800 + * @tc.name Query contacts information + * @tc.desc Function test + */ + it("contactsApi_query_contacts_test_800", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var holder = { + bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 + } + try { + var resultSet = await contactsapi.queryContacts(holder); + console.info("contactsApi_query_contacts_test_800 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet != null).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_query_contacts_test_800 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_contacts_test_900 + * @tc.name Query contacts information + * @tc.desc Function test + */ + it("contactsApi_query_contacts_test_900", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var ContactAttributes = { + attributes: [1, 5, 6] + } + try { + var resultSet = await contactsapi.queryContacts(ContactAttributes); + console.info("contactsApi_query_contacts_test_900 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet != null).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_query_contacts_test_900 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_contacts_test_1000 + * @tc.name Query contacts information + * @tc.desc Function test + */ + it("contactsApi_query_contacts_test_1000", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var holder = { + bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 + }; + var ContactAttributes = { + attributes: [1, 5, 6] + } + try { + var resultSet = await contactsapi.queryContacts(holder, ContactAttributes); + console.info("contactsApi_query_contacts_test_1000 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet != null).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_query_contacts_test_1000 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_email_test_1100 + * @tc.name Query email information + * @tc.desc Function test + */ + it("contactsApi_query_email_test_1100", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var email = "email"; + var holder = { + bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 + } + try { + var resultSet = await contactsapi.queryContactsByEmail(email, holder); + console.info("contactsApi_query_email_test_1100 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet != null).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_query_email_test_1100 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_email_test_1200 + * @tc.name Query email information + * @tc.desc Function test + */ + it("contactsApi_query_email_test_1200", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var email = "email"; + try { + var resultSet = await contactsapi.queryContactsByEmail(email); + console.info("contactsApi_query_email_test_1200 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet != null).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_query_email_test_1200 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_email_test_1300 + * @tc.name Query email information + * @tc.desc Function test + */ + it("contactsApi_query_email_test_1300", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var email = "email"; + var holder = { + bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 + }; + var ContactAttributes = { + attributes: [1, 5, 6] + } + try { + var resultSet = await contactsapi.queryContactsByEmail(email, holder, ContactAttributes); + console.info("contactsApi_query_email_test_1300 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet != null).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_query_email_test_1300 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_email_test_1400 + * @tc.name Query email information + * @tc.desc Function test + */ + it("contactsApi_query_email_test_1400", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var email = "email"; + var ContactAttributes = { + attributes: [1, 5, 6] + } + try { + var resultSet = await contactsapi.queryContactsByEmail(email, ContactAttributes); + console.info("contactsApi_query_email_test_1400 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet != null).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_query_email_test_1400 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_phoneNumber_test_1500 + * @tc.name Query phoneNumber information + * @tc.desc Function test + */ + it("contactsApi_query_phoneNumber_test_1500", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var phoneNumber = "183"; + var holder = { + bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 + } + try { + var resultSet = await contactsapi.queryContactsByPhoneNumber(phoneNumber, holder); + console.info("contactsApi_query_phoneNumber_test_1500 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet != null).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_query_phoneNumber_test_1500 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_phoneNumber_test_1600 + * @tc.name Query phoneNumber information + * @tc.desc Function test + */ + it("contactsApi_query_phoneNumber_test_1600", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var phoneNumber = "183"; + var holder = { + bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 + }; + var ContactAttributes = { + attributes: [1, 5, 6] + } + try { + var resultSet = await contactsapi.queryContactsByPhoneNumber(phoneNumber, holder, ContactAttributes); + console.info("contactsApi_query_phoneNumber_test_1600 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet != null).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_query_phoneNumber_test_1600 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_phoneNumber_test_1700 + * @tc.name Query phoneNumber information + * @tc.desc Function test + */ + it("contactsApi_query_phoneNumber_test_1700", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var phoneNumber = "183"; + try { + var resultSet = await contactsapi.queryContactsByPhoneNumber(phoneNumber); + console.info("contactsApi_query_phoneNumber_test_1700 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet != null).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_query_phoneNumber_test_1700 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_phoneNumber_test_1800 + * @tc.name Query phoneNumber information + * @tc.desc Function test + */ + it("contactsApi_query_phoneNumber_test_1800", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var phoneNumber = "183"; + var ContactAttributes = { + attributes: [1, 5, 6] + } + try { + var resultSet = await contactsapi.queryContactsByPhoneNumber(phoneNumber, ContactAttributes); + console.info("contactsApi_query_phoneNumber_test_1800 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet != null).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_query_phoneNumber_test_1800 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_group_test_1900 + * @tc.name Query group + * @tc.desc Function test + */ + it("contactsApi_query_group_test_1900", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + try { + var resultSet = await contactsapi.queryGroups(); + console.info("contactsApi_query_group_test_1900 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet.length == 0).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_query_group_test_1900 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_group_test_2000 + * @tc.name Query group + * @tc.desc Function test + */ + it("contactsApi_query_group_test_2000", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var holder = { + bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 + } + try { + var resultSet = await contactsapi.queryGroups(holder); + console.info("contactsApi_query_group_test_2000 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet.length == 0).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_query_group_test_2000 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_holders_test_2200 + * @tc.name Query holders information + * @tc.desc Function test + */ + it("contactsApi_query_holders_test_2200", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + try { + var resultSet = await contactsapi.queryHolders(); + console.info("contactsApi_query_holders_test_2200 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet != null).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_query_holders_test_2200 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_key_test_2300 + * @tc.name Query key information + * @tc.desc Function test + */ + it("contactsApi_query_key_test_2300", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var idtest = gRawContactId; + var holder = { + bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 + } + try { + var resultSet = await contactsapi.queryKey(idtest, holder); + console.info("contactsApi_query_key_test_2300 : query resultSet = " + JSON.stringify(resultSet)); + expect(JSON.stringify(resultSet) === null).assertFalse(); + done(); + } catch (error) { + console.info("contactsApi_query_key_test_2300 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_key_test_2400 + * @tc.name Query key information + * @tc.desc Function test + */ + it("contactsApi_query_key_test_2400", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var idtest = gRawContactId; + console.info("contactsApi_query_key_test_2400 : query gRawContactId = " + idtest); + try { + var resultSet = await contactsapi.queryKey(idtest); + console.info("contactsApi_query_key_test_2400 : query resultSet = " + JSON.stringify(resultSet)); + expect(JSON.stringify(resultSet) === null).assertFalse(); + done(); + } catch (error) { + console.info("contactsApi_query_key_test_2400 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_query_mycard_test_2500 + * @tc.name Query mycard information + * @tc.desc Function test + */ + it("contactsApi_query_mycard_test_2500", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var holder = { + bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 + } + try { + var resultSet = await contactsapi.queryMyCard(holder); + console.info("contactsApi_query_mycard_test_2500 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet.length == 0).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_query_mycard_test_2500 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_isMyCard_test_2600 + * @tc.name Query mycard exist + * @tc.desc Function test + */ + it("contactsApi_isMyCard_test_2600", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var id = 1; + try { + var isExist = await contactsapi.isMyCard(id); + console.info("contactsApi_isMyCard_test_2600 : query isExist = " + isExist); + expect(isExist == 0).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_isMyCard_test_2600 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number contactsApi_isLocalContact_test_2700 + * @tc.name Query isLocalContact exist + * @tc.desc Function test + */ + it("contactsApi_isLocalContact_test_2700", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var id = gRawContactId; + try { + var isExist = await contactsapi.isLocalContact(id); + console.info("logMessage contactsApi_isLocalContact_test_2700 isExist = " + isExist); + expect(isExist != -1).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_isLocalContact_test_2700 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number abnormal_contactsApi_insert_test_2800 + * @tc.name contactsApi_insert error + * @tc.desc Function test + */ + it("abnormal_contactsApi_insert_test_2800", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var contactDataError = {}; + try { + var rawContactId = await contactsapi.addContact(contactDataError); + console.info("abnormal_contactsApi_insert_test_2800 : rawContactId = " + rawContactId); + expect(rawContactId == -1).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_insert_test_100 : raw_contact insert error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number abnormal_contactsApi_update_test_3000 + * @tc.name contactsApi_update error + * @tc.desc Function test + */ + it("abnormal_contactsApi_update_test_3000", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var rawContactId = -1; + var updateValues = { + id: rawContactId, name: { + fullName: "小红" + } + }; + var condition = { + attributes: [6] + } + try { + var updateCode = await contactsapi.updateContact(updateValues, condition); + console.info("abnormal_contactsApi_update_test_3000 : updateCode = " + updateCode); + expect(updateCode === -1).assertFalse(); + done(); + } catch (error) { + console.info("abnormal_contactsApi_update_test_3000 : update error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number abnormal_contactsApi_query_contact_test_3100 + * @tc.name contactsApi_query_contact error + * @tc.desc Function test + */ + it("abnormal_contactsApi_query_contact_test_3100", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var queryId = "-1"; + try { + var resultSet = await contactsapi.queryContact(queryId); + if (resultSet == null) { + console.info("abnormal_contactsApi_query_contact_test_3100 is null"); + } + if (resultSet == undefined) { + console.info("abnormal_contactsApi_query_contact_test_3100 is undefined"); + } + console.info("abnormal_contactsApi_query_contact_test_3100 : updateCode = " + JSON.stringify(resultSet)); + expect(resultSet == undefined).assertTrue(); + done(); + } catch (error) { + console.info("abnormal_contactsApi_query_contact_test_3100 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number abnormal_contactsApi_query_contacts_test_3200 + * @tc.name contactsApi_query_contacts error + * @tc.desc Function test + */ + it("abnormal_contactsApi_query_contacts_test_3200", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var ContactAttributes = { + attributes: [100] + } + try { + var resultSet = await contactsapi.queryContacts(ContactAttributes); + if (resultSet == null) { + console.info("abnormal_contactsApi_query_contacts_test_3200 is null"); + } + if (resultSet == undefined) { + console.info("abnormal_contactsApi_query_contacts_test_3200 is undefined"); + } + console.info( + "abnormal_contactsApi_query_contacts_test_3200 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet.length == 0).assertTrue(); + done(); + } catch (error) { + console.info("abnormal_contactsApi_query_contacts_test_3200 query error = " + error); + done(); + } + sleep(500) + }); + /** + * @tc.number abnormal_contactsApi_query_email_test_3300 + * @tc.name contactsApi_query_email error + * @tc.desc Function test + */ + it("abnormal_contactsApi_query_email_test_3300", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var email = "email2222"; + try { + var resultSet = await contactsapi.queryContactsByEmail(email); + console.info("abnormal_contactsApi_query_email_test_3300 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet.length == 0).assertTrue(); + done(); + } catch (error) { + console.info("abnormal_contactsApi_query_email_test_3300 query error = " + error); + done(); + } + sleep(500) }); + + /** + * @tc.number abnormal_contactsApi_query_phoneNumber_test_3400 + * @tc.name contactsApi_query_phoneNumber error + * @tc.desc Function test + */ + it("abnormal_contactsApi_query_phoneNumber_test_3400", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var phoneNumber = "19999999"; + try { + var resultSet = await contactsapi.queryContactsByPhoneNumber(phoneNumber); + console.info( + "abnormal_contactsApi_query_phoneNumber_test_3400 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet.length == 0).assertTrue(); + done(); + } catch (error) { + console.info("abnormal_contactsApi_query_phoneNumber_test_3400 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number abnormal_contactsApi_query_group_test_3500 + * @tc.name contactsApi_query_group error + * @tc.desc Function test + */ + it("abnormal_contactsApi_query_group_test_3500", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var holder = { + bundleName: "com.ohos.contacts2", displayName: "phone2", holderId: 2 + } + try { + var resultSet = await contactsapi.queryGroups(holder); + console.info("abnormal_contactsApi_query_group_test_3500 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet.length == 0).assertTrue(); + done(); + } catch (error) { + console.info("contactsApi_query_group_test_2000 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number abnormal_contactsApi_query_key_test_3600 + * @tc.name contactsApi_query_key error + * @tc.desc Function test + */ + it("abnormal_contactsApi_query_key_test_3600", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var idtest = -1; + try { + var resultSet = await contactsapi.queryKey(idtest); + console.info("abnormal_contactsApi_query_key_test_3600 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet.length == 0).assertTrue(); + done(); + } catch (error) { + console.info("abnormal_contactsApi_query_key_test_3600 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number abnormal_contactsApi_query_mycard_test_3700 + * @tc.name contactsApi_query_mycard error + * @tc.desc Function test + */ + it("abnormal_contactsApi_query_mycard_test_3700", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var ContactAttributes = { + attributes: [100] + }; + try { + var resultSet = await contactsapi.queryMyCard(ContactAttributes); + console.info( + "abnormal_contactsApi_query_mycard_test_3700 : query resultSet = " + JSON.stringify(resultSet)); + expect(resultSet.length == 0).assertTrue(); + done(); + } catch (error) { + console.info("abnormal_contactsApi_query_mycard_test_3700 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number abnormal_contactsApi_isMyCard_test_3800 + * @tc.name isMyCard is not exist + * @tc.desc Function test + */ + it("abnormal_contactsApi_isMyCard_test_3800", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var id = 999; + try { + var isExist = await contactsapi.isMyCard(id); + console.info("abnormal_contactsApi_isMyCard_test_3800 : query isExist = " + isExist); + expect(isExist == 0).assertTrue(); + done(); + } catch (error) { + console.info("abnormal_contactsApi_isMyCard_test_3800 query error = " + error); + done(); + } + sleep(500) + }); + + /** + * @tc.number abnormal_contactsApi_isLocalContact_test_3900 + * @tc.name contactsApi_isLocalContact is not exist + * @tc.desc Function test + */ + it("abnormal_contactsApi_isLocalContact_test_3900", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + var id = 999; + try { + var isExist = await contactsapi.isLocalContact(id); + console.info("abnormal_contactsApi_isLocalContact_test_3900 : query isExist = " + isExist); + expect(isExist == 0).assertTrue(); + done(); + } catch (error) { + console.info("abnormal_contactsApi_isLocalContact_test_3900 query error = " + error); + done(); + } + sleep(500) + }); + + it("contactsApi_addContact_test_100", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.addContact(contactData, (err, data) => { + if (err) { + done(); + return; + } + expect(JSON.stringify(data) != -1).assertTrue(); + done(); + }); + sleep(500) + }); + + it("contactsApi_deleteContact_test_100", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.deleteContact('xxx', (err) => { + if (err) { + expect(JSON.stringify(err) == -1).assertTrue(); + done(); + return; + } + expect(false).assertTrue(); + done(); + }); + + sleep(500) + }); + + + it("contactsApi_queryContact_test_100", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryContact('xxx', (err, data) => { + if (err) { + expect(false).assertTrue(); + done(); + return; + } + expect(JSON.stringify(data) == undefined).assertTrue(); + done(); + }); + sleep(500) + }); + + it("contactsApi_queryContact_test_200", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryContact('xxx', { + holderId: 0 + }, (err, data) => { + if (err) { + expect(false).assertTrue(); + done(); + return; + } + expect(JSON.stringify(data) == undefined).assertTrue(); + done(); + }); + sleep(500) + }); + + it("contactsApi_queryContact_test_300", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryContact('xxx', { + attributes: ["ATTR_EMAIL", "ATTR_NAME"] + }, (err, data) => { + if (err) { + expect(false).assertTrue(); + done(); + return; + } + expect(JSON.stringify(data) == undefined).assertTrue(); + done(); + }); + sleep(500) + }); + + it("contactsApi_queryContact_test_400", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryContact('xxx', { + holderId: 0 + }, { + attributes: ["ATTR_EMAIL", "ATTR_NAME"] + }, (err, data) => { + if (err) { + expect(false).assertTrue(); + done(); + return; + } + expect(JSON.stringify(data) == undefined).assertTrue(); + done(); + }); + sleep(500) + }); + + it("contactsApi_queryContact_test_500", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + let promise = contactsapi.queryContact('xxx', { + holderId: 0 + }, { + attributes: ["ATTR_EMAIL", "ATTR_NAME"] + }); + promise.then((data) => { + expect(JSON.stringify(data) == undefined).assertTrue(); + done(); + }).catch((err) => { + expect(false).assertTrue(); + done(); + }); + sleep(500) + }); + + it("contactsApi_queryContacts_test_100", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryContacts((err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + it("contactsApi_queryContacts_test_200", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryContacts({ + holderId: 0 + }, (err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + it("contactsApi_queryContacts_test_300", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryContacts({ + attributes: ["ATTR_EMAIL", "ATTR_NAME"] + }, (err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + + it("contactsApi_queryContacts_test_400", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryContacts({ + holderId: 0 + }, { + attributes: ["ATTR_EMAIL", "ATTR_NAME"] + }, (err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + + it("contactsApi_queryContacts_test_500", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + let promise = contactsapi.queryContacts({ + holderId: 0 + }, { + attributes: ["ATTR_EMAIL", "ATTR_NAME"] + }); + promise.then((data) => { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }).catch((err) => { + expect(false).assertTrue(); + done(); + }); + sleep(500) + }); + + it("contactsApi_queryContactsByPhoneNumber_test_000", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryContactsByPhoneNumber('138xxxxxxxx', (err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + it("contactsApi_queryContactsByPhoneNumber_test_100", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryContactsByPhoneNumber('138xxxxxxxx', { + holderId: 0 + }, (err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + it("contactsApi_queryContactsByPhoneNumber_test_200", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryContactsByPhoneNumber('138xxxxxxxx', { + attributes: ["ATTR_EMAIL", "ATTR_NAME"] + }, (err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + it("contactsApi_queryContactsByPhoneNumber_test_300", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryContactsByPhoneNumber('138xxxxxxxx', { + holderId: 0 + }, { + attributes: ["ATTR_EMAIL", "ATTR_NAME"] + }, (err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + + it("contactsApi_queryContactsByEmail_test_100", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryContactsByEmail('xxx@email.com', (err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + it("contactsApi_queryContactsByEmail_test_200", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryContactsByEmail('xxx@email.com', { + holderId: 0 + }, (err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + + it("contactsApi_queryContactsByEmail_test_300", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryContactsByEmail('xxx@email.com', { + attributes: ["ATTR_EMAIL", "ATTR_NAME"] + }, (err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + + it("contactsApi_queryContactsByEmail_test_400", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryContactsByEmail('xxx@email.com', { + holderId: 0 + }, { + attributes: ["ATTR_EMAIL", "ATTR_NAME"] + }, (err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + it("contactsApi_queryGroups_test_100", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryGroups((err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + it("contactsApi_queryGroups_test_200", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryGroups({ + holderId: 0 + }, (err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + + it("contactsApi_queryHolders_test_100", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryHolders((err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + it("contactsApi_queryKey_test_100", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryKey( /*id*/ + 1, (err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + it("contactsApi_queryKey_test_200", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryKey( /*id*/ + 1, { + holderId: 1 + }, (err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + + it("contactsApi_queryMyCard_test_100", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryMyCard((err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + + it("contactsApi_queryMyCard_test_200", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.queryMyCard({ + attributes: ['ATTR_EMAIL', 'ATTR_NAME'] + }, (err, data) => { + if (err) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + return; + } + expect(JSON.stringify(data) === null).assertFalse(); + done(); + }); + sleep(500) + }); + + it("contactsApi_updateContact_test_100", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.updateContact({ + name: { + fullName: 'xxx' + }, + phoneNumbers: [{ + phoneNumber: '138xxxxxxxx' + }] + }, (err) => { + if (err) { + expect(true).assertTrue(); + done(); + return; + } + console.info('updateContact success'); + done(); + }); + sleep(500) + }); + + it("contactsApi_updateContact_test_200", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.updateContact({ + fullName: { + fullName: 'xxx' + }, + phoneNumbers: [{ + phoneNumber: '138xxxxxxxx' + }] + }, { + attributes: ['ATTR_EMAIL', 'ATTR_NAME'] + }, (err) => { + if (err) { + expect(true).assertTrue(); + done(); + return; + } + console.info('updateContact success'); + done(); + }); + sleep(500) + }); + + it("contactsApi_isLocalContact_test_100", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.isLocalContact( /*id*/ + 1, (err, data) => { + if (err) { + expect(false).assertTrue(); + done(); + return; + } + done(); + }); + sleep(500) + }); + + it("contactsApi_isMyCard_test_100", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.isMyCard( /*id*/ + 1, (err, data) => { + if (err) { + expect(false).assertTrue(); + done(); + return; + } + done(); + }); + sleep(500) + }); + + it("contactsApi_sendMessage_test_100", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + let sendCallback = function (err, data) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + } + let deliveryCallback = function (err, data) { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + } + let slotId = 0; + let content = '短信内容'; + let destinationHost = '+861xxxxxxxxxx'; + let serviceCenter = '+861xxxxxxxxxx'; + let destinationPort = 1000; + let options = { + slotId, + content, + destinationHost, + serviceCenter, + destinationPort, + sendCallback, + deliveryCallback + }; + sms.sendMessage(options); + done(); + sleep(500) + }); + + it("contactsApi_selectContact_test_100", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + contactsapi.selectContact((err, data) => { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + sleep(500) + }); + }); + + it("contactsApi_selectContact_test_200", 0, async function (done) { + checkContactPermission(); + if (!contactPermission) { + done(); + return; + } + let promise = contactsapi.selectContact(); + promise.then((data) => { + expect(JSON.stringify(data) === null).assertFalse(); + done(); + sleep(500) + }).catch((err) => { + done(); + }); + }); + + let contactPermission; + let userId; + async function getUserId() { + await account.getAccountManager().getOsAccountLocalIdFromProcess().then(account => { + console.info("getOsAccountLocalIdFromProcess userid ==========" + account); + userId = account; + }).catch(err => { + console.info("getOsAccountLocalIdFromProcess err ==========" + JSON.stringify(err)); + }) + } + + async function checkContactPermission() { + await getUserId(); + let appInfo = await bundle.getApplicationInfo('com.ohos.actscallmanagerims2calltest', 0, userId); + console.info("getOsAccountLocalIdFromProcess appInfo ==========" + JSON.stringify(appInfo) + "userId:" + userId); + let tokenID = appInfo.accessTokenId; + let atManager = abilityAccessCtrl.createAtManager(); + let result1 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.READ_CONTACTS", 1); + let result2 = await atManager.grantUserGrantedPermission(tokenID, "ohos.permission.WRITE_CONTACTS", 1); + console.info("checkContactPermission Log: Perm1:" + result1); + console.info("checkContactPermission Log: Perm2:" + result2); + if (result1 == -1 || result2 == -1) { + contactPermission = false; + done(); + } + contactPermission = true; + done(); + } + }); } \ No newline at end of file diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/config.json b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/config.json index 32eb239cfca62f312714ba626538081b0291d4ef..ed50b9138766cfe8e7ae2282ffbaf3b9b82cf61b 100644 --- a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/config.json +++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/test/CellularDataAbnorma.test.js b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/test/CellularDataAbnorma.test.js index 019dd98b049bbca1e2501fce6f3625f8ba94e1a0..a4d56caa43a715b9ea6322ff5b5a8faf0beb66f2 100644 --- a/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/test/CellularDataAbnorma.test.js +++ b/telephony/telephonyjstest/cellular_data/cellular_data_abnormal/src/main/js/test/CellularDataAbnorma.test.js @@ -202,5 +202,14 @@ describe("ActsCellularDataAbnormalTest", function () { done(); } }) + + it("Telephony_CellularData_getDefaultCellularDataSlotIdSync_0100", 0, async function (done) { + let data = cellular.getDefaultCellularDataSlotIdSync(); + console.info("Telephony_CellularData_getDefaultCellularDataSlotIdSync_0100 " + JSON.stringify(data)); + expect(data == 0 || data == 1).assertTrue; + done(); + }); + + }) } diff --git a/telephony/telephonyjstest/netmanager_base/dns/signature/openharmony_sx.p7b b/telephony/telephonyjstest/netmanager_base/dns/signature/openharmony_sx.p7b index 66b4457a8a81fb8d3356cf46d67226c850944858..36610716a064376bedf0d6d75ab4dc88519db020 100644 Binary files a/telephony/telephonyjstest/netmanager_base/dns/signature/openharmony_sx.p7b and b/telephony/telephonyjstest/netmanager_base/dns/signature/openharmony_sx.p7b differ diff --git a/telephony/telephonyjstest/netmanager_base/dns/src/main/config.json b/telephony/telephonyjstest/netmanager_base/dns/src/main/config.json index 3b3b3f2540f343355597244be089b3c9faaae73f..7f6d96a1a57ed8a36ce5472818fcfb2192825707 100644 --- a/telephony/telephonyjstest/netmanager_base/dns/src/main/config.json +++ b/telephony/telephonyjstest/netmanager_base/dns/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { @@ -65,42 +66,6 @@ } ], "reqPermissions": [ - { - "name": "ohos.permission.LOCATION", - "reason": "need use ohos.permission.LOCATION" - }, - { - "name":"ohos.permission.SET_TELEPHONY_STATE", - "reason":"need use ohos.permission.SET_TELEPHONY_STATE" - }, - { - "name":"ohos.permission.GET_TELEPHONY_STATE", - "reason":"need use ohos.permission.GET_TELEPHONY_STATE" - }, - { - "name":"ohos.permission.PLACE_CALL", - "reason":"need use ohos.permission.PLACE_CALL" - }, - { - "name":"ohos.permission.READ_CONTACTS", - "reason":"need use ohos.permission.READ_CONTACTS" - }, - { - "name":"ohos.permission.WRITE_CONTACTS", - "reason":"need use ohos.permission.WRITE_CONTACTS" - }, - { - "name":"ohos.permission.SEND_MESSAGES", - "reason":"need use ohos.permission.SEND_MESSAGES" - }, - { - "name":"ohos.permission.RECEIVE_SMS", - "reason":"need use ohos.permission.RECEIVE_SMS" - }, - { - "name":"ohos.permission.READ_CALL_LOG", - "reason":"need use ohos.permission.READ_CALL_LOG" - }, { "name":"ohos.permission.GET_NETWORK_INFO", "reason":"need use ohos.permission.GET_NETWORK_INFO" diff --git a/telephony/telephonyjstest/netmanager_base/dns/src/main/js/test/NetworkManagerDNS.test.js b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/test/NetworkManagerDNS.test.js index 4f4c11aad964691b6f5faa671a363768afd8d59a..145bb50712f6be5994d51c8de6de4d5fe36113e5 100644 --- a/telephony/telephonyjstest/netmanager_base/dns/src/main/js/test/NetworkManagerDNS.test.js +++ b/telephony/telephonyjstest/netmanager_base/dns/src/main/js/test/NetworkManagerDNS.test.js @@ -157,6 +157,12 @@ export default function Telephony_NETMANAGER_TestDNSTest() { }) }) }); - + + it('Telephony_NETMANAGER_TestDNS_Test0900', 0, function(done){ + let netHandle = netConnection.getDefaultNetSync(); + console.info("Telephony_NETMANAGER_TestDNS_Test0900 " + JSON.stringify(netHandle)); + expect(netHandle.netId).assertEqual(100); + done(); + }); }); } \ No newline at end of file diff --git a/telephony/telephonyjstest/netmanager_base/jshttp/signature/openharmony_sx.p7b b/telephony/telephonyjstest/netmanager_base/jshttp/signature/openharmony_sx.p7b index 66b4457a8a81fb8d3356cf46d67226c850944858..36610716a064376bedf0d6d75ab4dc88519db020 100644 Binary files a/telephony/telephonyjstest/netmanager_base/jshttp/signature/openharmony_sx.p7b and b/telephony/telephonyjstest/netmanager_base/jshttp/signature/openharmony_sx.p7b differ diff --git a/telephony/telephonyjstest/netmanager_base/jshttp/src/main/config.json b/telephony/telephonyjstest/netmanager_base/jshttp/src/main/config.json index d33c63f026fc9acce905558319ad79b49d077373..6b201bbe74e0525a95721c7d689b952e27a6f9c6 100644 --- a/telephony/telephonyjstest/netmanager_base/jshttp/src/main/config.json +++ b/telephony/telephonyjstest/netmanager_base/jshttp/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { @@ -65,42 +66,6 @@ } ], "reqPermissions": [ - { - "name": "ohos.permission.LOCATION", - "reason": "need use ohos.permission.LOCATION" - }, - { - "name":"ohos.permission.SET_TELEPHONY_STATE", - "reason":"need use ohos.permission.SET_TELEPHONY_STATE" - }, - { - "name":"ohos.permission.GET_TELEPHONY_STATE", - "reason":"need use ohos.permission.GET_TELEPHONY_STATE" - }, - { - "name":"ohos.permission.PLACE_CALL", - "reason":"need use ohos.permission.PLACE_CALL" - }, - { - "name":"ohos.permission.READ_CONTACTS", - "reason":"need use ohos.permission.READ_CONTACTS" - }, - { - "name":"ohos.permission.WRITE_CONTACTS", - "reason":"need use ohos.permission.WRITE_CONTACTS" - }, - { - "name":"ohos.permission.SEND_MESSAGES", - "reason":"need use ohos.permission.SEND_MESSAGES" - }, - { - "name":"ohos.permission.RECEIVE_SMS", - "reason":"need use ohos.permission.RECEIVE_SMS" - }, - { - "name":"ohos.permission.READ_CALL_LOG", - "reason":"need use ohos.permission.READ_CALL_LOG" - }, { "name":"ohos.permission.GET_NETWORK_INFO", "reason":"need use ohos.permission.GET_NETWORK_INFO" diff --git a/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/config.json b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/config.json index 304bf8a9529d4277404150e7d4c79c8e44fdbced..03c30c38bf599ae502c6474277a60c2302639355 100644 --- a/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/config.json +++ b/telephony/telephonyjstest/netmanager_base/network_nopermission/src/main/config.json @@ -16,6 +16,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "abilities": [ diff --git a/telephony/telephonyjstest/netmanager_base/network_nowifi/src/main/config.json b/telephony/telephonyjstest/netmanager_base/network_nowifi/src/main/config.json index d71b86f308f20952244eb5e673ce2c6b2eec757f..743ec39b037dcfd40dae27be2ff802b50ddca051 100644 --- a/telephony/telephonyjstest/netmanager_base/network_nowifi/src/main/config.json +++ b/telephony/telephonyjstest/netmanager_base/network_nowifi/src/main/config.json @@ -16,6 +16,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "abilities": [ diff --git a/telephony/telephonyjstest/netmanager_base/network_wifi/src/main/config.json b/telephony/telephonyjstest/netmanager_base/network_wifi/src/main/config.json index 4b0e1e4e55714d43e2b7e0bcd42ebd336c1012ec..45c1eb7f8668d6ac56b2476c82270bcf29dac469 100644 --- a/telephony/telephonyjstest/netmanager_base/network_wifi/src/main/config.json +++ b/telephony/telephonyjstest/netmanager_base/network_wifi/src/main/config.json @@ -16,6 +16,7 @@ "module": { "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone" ], "abilities": [ diff --git a/telephony/telephonyjstest/netmanager_base/register/src/main/config.json b/telephony/telephonyjstest/netmanager_base/register/src/main/config.json index b3f3b4a6f30213e4d36cc086e75f4c86d3a2b6ab..a89ed3c73ac3bd149f4cb054f61b88862ddf2a33 100644 --- a/telephony/telephonyjstest/netmanager_base/register/src/main/config.json +++ b/telephony/telephonyjstest/netmanager_base/register/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { 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..71a93a73d65e1a9b2ac8c55e570b0341274a9c4a 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,84 @@ 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; } }); + console.info("netAvailable end"); 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(); + } }); + console.info("netCapabilitiesChange end"); 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); } }); + console.info("netConnectionPropertiesChange end"); 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); } }); + console.info("netLost end"); 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); } }); + console.info("netUnavailable end"); 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); } }); + console.info("netBlockStatuschange end"); netConn.register((error) => { if (error) { - console.info(`${caseName} register fail: ${error}`); + console.info("${caseName} register fail: ${error}"); } }); + console.info("register end"); 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(); } }); + console.info("unregister end"); done(); }); - + /* *@tc.number Telephony_NetworkManager_register_Async_0300 *@tc.name Enter bearerTypes and networkCap as empty, set class NetConnection, @@ -214,75 +223,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 +312,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 +400,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 +489,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 +578,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 +667,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 +756,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 +848,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 +941,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 +1032,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 +1124,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 +1217,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 +1306,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); + expect(VALUE >= 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); + 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 +1397,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 +1487,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 +1577,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 +1647,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 +1736,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 +1842,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 +1874,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 +1951,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 +2040,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 +2117,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 +2198,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 +2270,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 +2357,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 +2443,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/netmanager_base/socket/src/main/config.json b/telephony/telephonyjstest/netmanager_base/socket/src/main/config.json index bea9780669523b28a0d1d9c11498bb87c1b927c8..7d5b4c18ab03e138b6d7709efa7aa1ef94a5122d 100644 --- a/telephony/telephonyjstest/netmanager_base/socket/src/main/config.json +++ b/telephony/telephonyjstest/netmanager_base/socket/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/telephony/telephonyjstest/netmanager_base/system_fetch/signature/openharmony_sx.p7b b/telephony/telephonyjstest/netmanager_base/system_fetch/signature/openharmony_sx.p7b index 66b4457a8a81fb8d3356cf46d67226c850944858..36610716a064376bedf0d6d75ab4dc88519db020 100644 Binary files a/telephony/telephonyjstest/netmanager_base/system_fetch/signature/openharmony_sx.p7b and b/telephony/telephonyjstest/netmanager_base/system_fetch/signature/openharmony_sx.p7b differ diff --git a/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/config.json b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/config.json index 7a77242e1a24cc4316e03debd9e0d4b7a59cb9ad..d941ea40ae5560dc6e3ca0682ec2b789d5954c84 100644 --- a/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/config.json +++ b/telephony/telephonyjstest/netmanager_base/system_fetch/src/main/config.json @@ -18,6 +18,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone", "tablet" ], diff --git a/telephony/telephonyjstest/netmanager_http/entry/src/main/config.json b/telephony/telephonyjstest/netmanager_http/entry/src/main/config.json index 32569a7aa354cc2dea57d57edc64c4a2c011e4ac..49231d79e0370b291e6fa5194ee87a9ee7f8a044 100644 --- a/telephony/telephonyjstest/netmanager_http/entry/src/main/config.json +++ b/telephony/telephonyjstest/netmanager_http/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/telephony/telephonyjstest/netmanager_socket/entry/src/main/config.json b/telephony/telephonyjstest/netmanager_socket/entry/src/main/config.json index d61b646adc1d3c53201acb8ce7b2fc33d95a9772..ce31431cee9673528713e751ad237d2c110b29e0 100644 --- a/telephony/telephonyjstest/netmanager_socket/entry/src/main/config.json +++ b/telephony/telephonyjstest/netmanager_socket/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/ConnectionJsunit.test.ets b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/ConnectionJsunit.test.ets index 465a0512d2adabd022a5c61409d7fc29d368e01f..6276e18a597ca3188a0dd52360cf3259ad0ae89d 100644 --- a/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/ConnectionJsunit.test.ets +++ b/telephony/telephonyjstest/netmanager_socket/entry/src/main/ets/test/ConnectionJsunit.test.ets @@ -15,6 +15,8 @@ */ import {describe, it, expect} from 'hypium/index'; import connection from '@ohos.net.connection' +import http from "@ohos.net.http"; +import socket from "@ohos.net.socket"; import utils from './Utils.ets' export default function connectionJsunit() { @@ -25,6 +27,19 @@ export default function connectionJsunit() { const NETID_IVVALID2 = 0; console.log("************* connection Test start*************"); + it('Telephony_Connection_Request_Socket_0100', 0, function (done) { + type HttpRequest = http.HttpRequest + ; + type TCPSocket = socket.TCPSocket + ; + type UDPSocket = socket.UDPSocket + ; + expect(typeof HttpRequest == typeof connection.HttpRequest).assertTrue(); + expect(typeof TCPSocket == typeof connection.TCPSocket).assertTrue(); + expect(typeof UDPSocket == typeof connection.UDPSocket).assertTrue(); + done(); + }); + /* * @tc.number : Telephony_Connection_Connection_createNetConnection_0100 * @tc.name : createNetConnection diff --git a/telephony/telephonyjstest/network_search/network_search_errors/src/main/config.json b/telephony/telephonyjstest/network_search/network_search_errors/src/main/config.json index 9f3a6f46765fc3dcaae61be444544bd6078a8fa2..59bcc40a18071b2bbbbb744b071002c3869f2097 100644 --- a/telephony/telephonyjstest/network_search/network_search_errors/src/main/config.json +++ b/telephony/telephonyjstest/network_search/network_search_errors/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/telephony/telephonyjstest/network_search/network_search_errors/src/main/js/test/NetworkSearchErrors.test.js b/telephony/telephonyjstest/network_search/network_search_errors/src/main/js/test/NetworkSearchErrors.test.js index bb48795e0764f1d9f38523aa078401b786cc1ef8..8bf3d3ae7dc6f299f6ec3ee37b2f23f0535bfba5 100644 --- a/telephony/telephonyjstest/network_search/network_search_errors/src/main/js/test/NetworkSearchErrors.test.js +++ b/telephony/telephonyjstest/network_search/network_search_errors/src/main/js/test/NetworkSearchErrors.test.js @@ -54,45 +54,45 @@ describe('ActsNetworkSearchTest', function () { afterEach(async function () { try { - expect(radio.RADIO_TECHNOLOGY_UNKNOWN === 0).assertTrue(); - expect(radio.RADIO_TECHNOLOGY_1XRTT === 2).assertTrue(); - expect(radio.RADIO_TECHNOLOGY_WCDMA === 3).assertTrue(); - expect(radio.RADIO_TECHNOLOGY_HSPA === 4).assertTrue(); - expect(radio.RADIO_TECHNOLOGY_HSPAP === 5).assertTrue(); - expect(radio.RADIO_TECHNOLOGY_TD_SCDMA === 6).assertTrue(); - expect(radio.RADIO_TECHNOLOGY_EVDO === 7).assertTrue(); - expect(radio.RADIO_TECHNOLOGY_EHRPD === 8).assertTrue(); - expect(radio.RADIO_TECHNOLOGY_LTE === 9).assertTrue(); - expect(radio.RADIO_TECHNOLOGY_LTE_CA === 10).assertTrue(); - expect(radio.RADIO_TECHNOLOGY_IWLAN === 11).assertTrue(); - expect(radio.RADIO_TECHNOLOGY_NR === 12).assertTrue(); - - expect(radio.NETWORK_TYPE_UNKNOWN === 0).assertTrue(); - expect(radio.NETWORK_TYPE_GSM === 1).assertTrue(); - expect(radio.NETWORK_TYPE_CDMA === 2).assertTrue(); - expect(radio.NETWORK_TYPE_WCDMA === 3).assertTrue(); - expect(radio.NETWORK_TYPE_TDSCDMA === 4).assertTrue(); - expect(radio.NETWORK_TYPE_LTE === 5).assertTrue(); - expect(radio.NETWORK_TYPE_NR === 6).assertTrue(); - - expect(radio.REG_STATE_NO_SERVICE === 0).assertTrue(); - expect(radio.REG_STATE_IN_SERVICE === 1).assertTrue(); - expect(radio.REG_STATE_EMERGENCY_CALL_ONLY === 2).assertTrue(); - expect(radio.REG_STATE_POWER_OFF === 3).assertTrue(); - - expect(radio.NSA_STATE_NOT_SUPPORT === 1).assertTrue(); - expect(radio.NSA_STATE_NO_DETECT === 2).assertTrue(); - expect(radio.NSA_STATE_CONNECTED_DETECT === 3).assertTrue(); - expect(radio.NSA_STATE_IDLE_DETECT === 4).assertTrue(); - expect(radio.NSA_STATE_DUAL_CONNECTED === 5).assertTrue(); - expect(radio.NSA_STATE_SA_ATTACHED === 6).assertTrue(); - - expect(radio.NETWORK_UNKNOWN === 0).assertTrue(); - expect(radio.NETWORK_CURRENT === 2).assertTrue(); - expect(radio.NETWORK_FORBIDDEN === 3).assertTrue(); - - expect(radio.NETWORK_SELECTION_UNKNOWN === 0).assertTrue(); - expect(radio.NETWORK_SELECTION_MANUAL === 2).assertTrue(); + expect(radio.RadioTechnology.RADIO_TECHNOLOGY_UNKNOWN === 0).assertTrue(); + expect(radio.RadioTechnology.RADIO_TECHNOLOGY_1XRTT === 2).assertTrue(); + expect(radio.RadioTechnology.RADIO_TECHNOLOGY_WCDMA === 3).assertTrue(); + expect(radio.RadioTechnology.RADIO_TECHNOLOGY_HSPA === 4).assertTrue(); + expect(radio.RadioTechnology.RADIO_TECHNOLOGY_HSPAP === 5).assertTrue(); + expect(radio.RadioTechnology.RADIO_TECHNOLOGY_TD_SCDMA === 6).assertTrue(); + expect(radio.RadioTechnology.RADIO_TECHNOLOGY_EVDO === 7).assertTrue(); + expect(radio.RadioTechnology.RADIO_TECHNOLOGY_EHRPD === 8).assertTrue(); + expect(radio.RadioTechnology.RADIO_TECHNOLOGY_LTE === 9).assertTrue(); + expect(radio.RadioTechnology.RADIO_TECHNOLOGY_LTE_CA === 10).assertTrue(); + expect(radio.RadioTechnology.RADIO_TECHNOLOGY_IWLAN === 11).assertTrue(); + expect(radio.RadioTechnology.RADIO_TECHNOLOGY_NR === 12).assertTrue(); + + expect(radio.NetworkType.NETWORK_TYPE_UNKNOWN === 0).assertTrue(); + expect(radio.NetworkType.NETWORK_TYPE_GSM === 1).assertTrue(); + expect(radio.NetworkType.NETWORK_TYPE_CDMA === 2).assertTrue(); + expect(radio.NetworkType.NETWORK_TYPE_WCDMA === 3).assertTrue(); + expect(radio.NetworkType.NETWORK_TYPE_TDSCDMA === 4).assertTrue(); + expect(radio.NetworkType.NETWORK_TYPE_LTE === 5).assertTrue(); + expect(radio.NetworkType.NETWORK_TYPE_NR === 6).assertTrue(); + + expect(radio.RegState.REG_STATE_NO_SERVICE === 0).assertTrue(); + expect(radio.RegState.REG_STATE_IN_SERVICE === 1).assertTrue(); + expect(radio.RegState.REG_STATE_EMERGENCY_CALL_ONLY === 2).assertTrue(); + expect(radio.RegState.REG_STATE_POWER_OFF === 3).assertTrue(); + + expect(radio.NsaState.NSA_STATE_NOT_SUPPORT === 1).assertTrue(); + expect(radio.NsaState.NSA_STATE_NO_DETECT === 2).assertTrue(); + expect(radio.NsaState.NSA_STATE_CONNECTED_DETECT === 3).assertTrue(); + expect(radio.NsaState.NSA_STATE_IDLE_DETECT === 4).assertTrue(); + expect(radio.NsaState.NSA_STATE_DUAL_CONNECTED === 5).assertTrue(); + expect(radio.NsaState.NSA_STATE_SA_ATTACHED === 6).assertTrue(); + + expect(radio.NetworkInformationState.NETWORK_UNKNOWN === 0).assertTrue(); + expect(radio.NetworkInformationState.NETWORK_CURRENT === 2).assertTrue(); + expect(radio.NetworkInformationState.NETWORK_FORBIDDEN === 3).assertTrue(); + + expect(radio.NetworkSelectionMode.NETWORK_SELECTION_UNKNOWN === 0).assertTrue(); + expect(radio.NetworkSelectionMode.NETWORK_SELECTION_MANUAL === 2).assertTrue(); } catch (error) { console.info(`Telephony_NetworkSearch error`); } @@ -150,7 +150,7 @@ describe('ActsNetworkSearchTest', function () { radio.getSignalInformation(SLOT_2, (err, data) => { if (err) { console.info(`Telephony_NetworkSearch_getSignalInformation_Async_0400 fail err: ${err}`); - expect(err.code).assertEqual("202"); + expect(err.code).assertEqual(202); done(); return; } @@ -173,7 +173,7 @@ describe('ActsNetworkSearchTest', function () { radio.getISOCountryCodeForNetwork(SLOT_2, (err, data) => { if (err) { console.info(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Async_0400 fail err: ${err}`); - expect(err.code).assertEqual("202"); + expect(err.code).assertEqual(202); done(); return; } @@ -197,7 +197,7 @@ describe('ActsNetworkSearchTest', function () { expect(data.length === 0).assertTrue(); } catch (err) { console.info(`Telephony_NetworkSearch_getISOCountryCodeForNetwork_Promise_0400 fail err: ${err}`); - expect(err.code).assertEqual("202"); + expect(err.code).assertEqual(202); done(); return; } @@ -294,7 +294,7 @@ describe('ActsNetworkSearchTest', function () { expect(data.length === 0).assertTrue(); } catch (err) { console.info(`Telephony_NetworkSearch_getSignalInformation_Promise_0400 fail err: ${err}`); - expect(err.code).assertEqual("202"); + expect(err.code).assertEqual(202); done(); return; } @@ -310,7 +310,7 @@ describe('ActsNetworkSearchTest', function () { radio.getOperatorName(SLOT_2, (err, data) => { if (err) { console.info(`Telephony_NetworkSearch_getOperatorName_Async_0400 fail err: ${err}`); - expect(err.code).assertEqual("202"); + expect(err.code).assertEqual(202); done(); return; } @@ -333,7 +333,7 @@ describe('ActsNetworkSearchTest', function () { done(); } catch (err) { console.info(`Telephony_NetworkSearch_getOperatorName_Promise_0400 fail err: ${err}`); - expect(err.code).assertEqual("202"); + expect(err.code).assertEqual(202); done(); } }) diff --git a/telephony/telephonyjstest/observer/BUILD.gn b/telephony/telephonyjstest/observer/BUILD.gn index 33e77410581d710a965e377abc146279c9d043ac..baaf67c06fbda879f51061a2d787f22de36d0689 100644 --- a/telephony/telephonyjstest/observer/BUILD.gn +++ b/telephony/telephonyjstest/observer/BUILD.gn @@ -18,16 +18,20 @@ ohos_js_hap_suite("ActsObserverEtsTest") { deps = [ ":ace_demo_ets_assets", ":ace_demo_ets_resources", + ":ace_demo_ets_test_assets", ] ets2abc = true certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsObserverEtsTest" - part_name = "netstack" - subsystem_name = "communication" + part_name = "ril_adapter" + subsystem_name = "telephony" } ohos_js_assets("ace_demo_ets_assets") { source_dir = "./entry/src/main/ets/MainAbility" } +ohos_js_assets("ace_demo_ets_test_assets") { + source_dir = "./entry/src/main/ets/TestAbility" +} ohos_resources("ace_demo_ets_resources") { sources = [ "./entry/src/main/resources" ] hap_profile = "./entry/src/main/config.json" diff --git a/telephony/telephonyjstest/observer/Test.json b/telephony/telephonyjstest/observer/Test.json index 1e5f519576f040a40ecc4bc8aa0f7e4f48957361..1af9adb89f1ba913a3f98a7362898346dfc2028d 100644 --- a/telephony/telephonyjstest/observer/Test.json +++ b/telephony/telephonyjstest/observer/Test.json @@ -1,10 +1,11 @@ { "description": "Configuration for hjunit demo Tests", "driver": { - "type": "JSUnitTest", - "test-timeout": "1500000", - "package": "com.ohos.observer", - "shell-timeout": "60000" + "type": "OHJSUnitTest", + "test-timeout": "2000000", + "bundle-name": "com.ohos.observer", + "package-name": "com.ohos.observer", + "shell-timeout": "2000000" }, "kits": [ { diff --git a/telephony/telephonyjstest/observer/entry/src/main/config.json b/telephony/telephonyjstest/observer/entry/src/main/config.json index c725d37861ca00572963c008682a58983af6c24e..5460ebc9b7d7f24d460a089eb59fcb67dad0e920 100644 --- a/telephony/telephonyjstest/observer/entry/src/main/config.json +++ b/telephony/telephonyjstest/observer/entry/src/main/config.json @@ -17,8 +17,9 @@ "package": "com.ohos.observer", "name": ".MyApplication", "mainAbility": ".MainAbility", - "srcPath": "MainAbility", + "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { @@ -50,6 +51,19 @@ "label": "$string:entry_MainAbility", "type": "page", "launchType": "standard" + }, + { + "orientation": "unspecified", + "visible": true, + "srcPath": "TestAbility", + "name": ".TestAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "formsEnabled": false, + "label": "$string:TestAbility_label", + "type": "page", + "launchType": "standard" } ], "reqPermissions": [ @@ -130,6 +144,20 @@ "designWidth": 720, "autoDesignWidth": false } + }, + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } } ] } diff --git a/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/index.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/index.ets index 10359134da915c9b44b0836ba4881bca71f43f33..987f3a954fdecfaede4540d18cb97a080cb2a826 100644 --- a/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/index.ets +++ b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/pages/index.ets @@ -13,39 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import file from '@system.file'; - -import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"; -import testsuite from "../test/List.test.ets"; -import featureAbility from "@ohos.ability.featureAbility"; @Entry @Component struct MyComponent { aboutToAppear() { - console.info("start run testcase!!!!") - featureAbility.getWant() - .then((Want) => { - const core = Core.getInstance(); - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }); - core.addService('expect', expectExtend); - const reportExtend = new ReportExtend(file); - core.addService('report', reportExtend); - core.init(); - core.subscribeEvent('task', reportExtend); - const configService = core.getDefaultService('config'); - Want.parameters['timeout'] = 100000 - console.info('parameters---->' + JSON.stringify(Want.parameters)); - configService.setConfig(Want.parameters); - testsuite(); - core.execute(); - console.info('Operation successful. Data: ' + JSON.stringify(Want)); - }) - .catch((error) => { - console.error('Operation failed. Cause: ' + JSON.stringify(error)); - }) } build() { diff --git a/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/ObserverJsunit.test.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/ObserverJsunit.test.ets deleted file mode 100644 index 22c8e5566e0c8a375b0da7af707fafe619522a7f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/ObserverJsunit.test.ets +++ /dev/null @@ -1,788 +0,0 @@ -// @ts-nocheck -/** - * 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 'deccjsunit/index' -import observer from '@ohos.telephony.observer' -import cellular from '@ohos.telephony.data' -import radio from '@ohos.telephony.radio' -import call from '@ohos.telephony.call' -import utils from './Utils.ets' -import {SimStateData} from '@ohos.telephony.observer' -import {LockReason} from '@ohos.telephony.observer' -import sim from "@ohos.telephony.sim" - - -export default function observerJsunit() { - describe('ObserverTest', function () { - console.log("************* Observer Test start *************") - - const SLOT_0 = 0; - const SLOT_2 = -1; - - /* - * @tc.number : Telephony_observer_observer_DataConnectState_0100 - * @tc.name : DataConnectState - * @tc.desc : check the getCellularDataState callback to verify the call back data - */ - it('Telephony_observer_observer_DataConnectState_0100', 0, function (done) { - expect(observer.NetworkState == radio.NetworkState).assertTrue(); - expect(observer.SignalInformation == radio.SignalInformation).assertTrue(); - expect(observer.CellInformation == radio.CellInformation ).assertTrue(); - expect(observer.RatType == radio.RadioTechnology).assertTrue(); - expect(observer.CallState == call.CallState).assertTrue(); - console.log("************* Telephony_observer_observer_DataConnectState_0100 Test start *************") - cellular.getCellularDataState((err, data) => { - if (!err) { - var dataConnectStateList = [cellular.DataConnectState.DATA_STATE_UNKNOWN, - cellular.DataConnectState.DATA_STATE_DISCONNECTED, - cellular.DataConnectState.DATA_STATE_CONNECTING, - cellular.DataConnectState.DATA_STATE_CONNECTED, - cellular.DataConnectState.DATA_STATE_SUSPENDED] - expect(dataConnectStateList.indexOf(data) >= 0).assertTrue() - done(); - return; - } - console.log("Telephony_CellularData_getCellularDataState_0100 end"); - done() - }) - console.log("************* Telephony_observer_observer_DataConnectState_0100 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_observer_DataConnectState_0200 - * @tc.name : DataConnectState - * @tc.desc : check the getCellularDataState callback to verify the call back data - */ - it('Telephony_observer_observer_DataConnectState_0200', 0, function (done) { - console.log("************* Telephony_observer_observer_DataConnectState_0200 Test start *************") - if (utils.notCheck) { - expect(true).assertTrue() - done() - } - // console.log(observer.DataConnectState) - console.log("************* Telephony_observer_observer_DataConnectState_0200 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_observer_RatType_0100 - * @tc.name : RatType - * @tc.desc : Obtains the data connect state - */ - it('Telephony_observer_observer_RatType_0100', 0, async function (done) { - console.log("************* Telephony_observer_observer_RatType_0100 Test start *************") - if (utils.notCheck) { - expect(true).assertTrue() - done() - } - // console.log(observer.RatType) - console.log("************* Telephony_observer_observer_RatType_0100 Test end *************") - done() - }) - - /* - * @tc.number : Telephony_observer_observer_on_networkStateChange_0100 - * @tc.name : on_networkStateChange - * @tc.desc : call the on method of networkStateChange - */ - it('Telephony_observer_observer_on_networkStateChange_0100', 0, async function (done) { - console.log("************* Telephony_observer_observer_on_networkStateChange_0100 Test start *************") - observer.on('networkStateChange', (networkState) => { - expect().assertFail() - done() - return - }) - setTimeout(timeout, 3000) - console.log("************* Telephony_observer_observer_on_networkStateChange_0100 Test end *************") - done() - }) - - /* - * @tc.number : Telephony_observer_observer_on_networkStateChange_0200 - * @tc.name : on_networkStateChange - * @tc.desc : call the on method of networkStateChange - */ - it('Telephony_observer_observer_on_networkStateChange_0200', 0, async function (done) { - console.log("************* Telephony_observer_observer_on_networkStateChange_0200 Test start *************") - observer.on('networkStateChange', { - slotId: SLOT_0 - }, (networkState) => { - expect().assertFail() - done() - return - }) - setTimeout(timeout, 3000) - console.log("************* Telephony_observer_observer_on_networkStateChange_0200 Test end *************") - done() - }) - - /* - * @tc.number : Telephony_observer_observer_off_networkStateChange_0100 - * @tc.name : off_networkStateChange - * @tc.desc : call the off method of networkStateChange - */ - it('Telephony_observer_observer_off_networkStateChange_0100', 0, async function (done) { - console.log("************* Telephony_observer_observer_off_networkStateChange_0100 Test start *************") - observer.off('networkStateChange', (networkState) => { - expect().assertFail() - done() - return - }) - setTimeout(timeout, 3000) - console.log("************* Telephony_observer_observer_off_networkStateChange_0100 Test end *************") - done() - }) - - /* - * @tc.number : Telephony_observer_observer_on_signalInfoChange_0100 - * @tc.name : on_signalInfoChange - * @tc.desc : call the on method of signalInfoChange - */ - it('Telephony_observer_observer_on_signalInfoChange_0100', 0, async function (done) { - console.log("************* Telephony_observer_observer_on_signalInfoChange_0100 Test start *************") - observer.on('signalInfoChange', (signalInformation) => { - expect().assertFail() - done() - return - }) - setTimeout(timeout, 3000) - console.log("************* Telephony_observer_observer_on_signalInfoChange_0100 Test end *************") - done() - }) - - /* - * @tc.number : Telephony_observer_observer_on_signalInfoChange_0200 - * @tc.name : on_signalInfoChange - * @tc.desc : call the on method of signalInfoChange - */ - it('Telephony_observer_observer_on_signalInfoChange_0200', 0, async function (done) { - console.log("************* Telephony_observer_observer_on_signalInfoChange_0200 Test start *************") - observer.on('signalInfoChange', { - slotId: SLOT_0 - }, (signalInformation) => { - expect().assertFail() - done() - return - }) - setTimeout(timeout, 3000) - console.log("************* Telephony_observer_observer_on_signalInfoChange_0200 Test end *************") - done() - }) - - /* - * @tc.number : Telephony_observer_observer_off_signalInfoChange_0100 - * @tc.name : off_signalInfoChange - * @tc.desc : call the off method of signalInfoChange - */ - it('Telephony_observer_observer_off_signalInfoChange_0100', 0, async function (done) { - console.log("************* Telephony_observer_observer_off_signalInfoChange_0100 Test start *************") - observer.off('signalInfoChange', (networkState) => { - expect().assertFail() - done() - return - }) - setTimeout(timeout, 3000) - console.log("************* Telephony_observer_observer_off_signalInfoChange_0100 Test end *************") - done() - }) - - - - /* - * @tc.number : Telephony_observer_observer_on_cellularDataConnectionStateChange_0100 - * @tc.name : on_cellularDataConnectionStateChange - * @tc.desc : call the on method of cellularDataConnectionStateChange - */ - it('Telephony_observer_observer_on_cellularDataConnectionStateChange_0100', 0, async function (done) { - console.log("************* Telephony_observer_observer_on_cellularDataConnectionStateChange_0100 Test start *************") - observer.on('cellularDataConnectionStateChange', (data) => { - expect().assertFail() - done() - return - }) - setTimeout(timeout, 3000) - console.log("************* Telephony_observer_observer_on_cellularDataConnectionStateChange_0100 Test end *************") - done() - }) - - /* - * @tc.number : Telephony_observer_observer_on_cellularDataConnectionStateChange_0200 - * @tc.name : on_cellularDataConnectionStateChange - * @tc.desc : call the on method of cellularDataConnectionStateChange - */ - it('Telephony_observer_observer_on_cellularDataConnectionStateChange_0200', 0, async function (done) { - console.log("************* Telephony_observer_observer_on_cellularDataConnectionStateChange_0200 Test start *************") - observer.on('cellularDataConnectionStateChange', { - slotId: SLOT_0 - }, (data) => { - expect().assertFail() - done() - return - }) - setTimeout(timeout, 3000) - console.log("************* Telephony_observer_observer_on_cellularDataConnectionStateChange_0200 Test end *************") - done() - }) - - /* - * @tc.number : Telephony_observer_observer_off_cellularDataConnectionStateChange_0100 - * @tc.name : off_cellularDataConnectionStateChange - * @tc.desc : call the off method of cellularDataConnectionStateChange - */ - it('Telephony_observer_observer_off_cellularDataConnectionStateChange_0100', 0, async function (done) { - console.log("************* Telephony_observer_observer_off_cellularDataConnectionStateChange_0100 Test start *************") - observer.off('cellularDataConnectionStateChange', (data) => { - expect().assertFail() - done() - return - }) - setTimeout(timeout, 3000) - console.log("************* Telephony_observer_observer_off_cellularDataConnectionStateChange_0100 Test end *************") - done() - }) - - /* - * @tc.number : Telephony_observer_observer_on_cellularDataFlowChange_0100 - * @tc.name : on_cellularDataFlowChange - * @tc.desc : call the on method of cellularDataFlowChange - */ - it('Telephony_observer_observer_on_cellularDataFlowChange_0100', 0, async function (done) { - console.log("************* Telephony_observer_observer_on_cellularDataFlowChange_0100 Test start *************") - observer.on('cellularDataFlowChange', (data) => { - expect().assertFail() - done() - return - }) - setTimeout(timeout, 3000) - console.log("************* Telephony_observer_observer_on_cellularDataFlowChange_0100 Test end *************") - done() - }) - - /* - * @tc.number : Telephony_observer_observer_on_cellularDataFlowChange_0200 - * @tc.name : on_cellularDataFlowChange - * @tc.desc : call the on method of cellularDataFlowChange - */ - it('Telephony_observer_observer_on_cellularDataFlowChange_0200', 0, async function (done) { - console.log("************* Telephony_observer_observer_on_cellularDataFlowChange_0200 Test start *************") - observer.on('cellularDataFlowChange', { - slotId: SLOT_0 - }, (data) => { - expect().assertFail() - done() - return - }) - setTimeout(timeout, 3000) - console.log("************* Telephony_observer_observer_on_cellularDataFlowChange_0200 Test end *************") - done() - }) - - /* - * @tc.number : Telephony_observer_observer_off_cellularDataFlowChange_0100 - * @tc.name : off_cellularDataFlowChange - * @tc.desc : call the off method of cellularDataFlowChange - */ - it('Telephony_observer_observer_off_cellularDataFlowChange_0100', 0, async function (done) { - console.log("************* Telephony_observer_observer_off_cellularDataFlowChange_0100 Test start *************") - observer.off('cellularDataFlowChange', (data) => { - expect().assertFail() - done() - return - }) - setTimeout(timeout, 3000) - console.log("************* Telephony_observer_observer_off_cellularDataFlowChange_0100 Test end *************") - done() - }) - - /* - * @tc.number : Telephony_observer_observer_on_callStateChange_0100 - * @tc.name : on_callStateChange - * @tc.desc : call the on method of callStateChange - */ - it('Telephony_observer_observer_on_callStateChange_0100', 0, async function (done) { - console.log("************* Telephony_observer_observer_on_callStateChange_0100 Test start *************") - observer.on('callStateChange', (data) => { - expect().assertFail() - done() - return - }) - setTimeout(timeout, 3000) - console.log("************* Telephony_observer_observer_on_callStateChange_0100 Test end *************") - done() - }) - - /* - * @tc.number : Telephony_observer_observer_on_callStateChange_0200 - * @tc.name : on_callStateChange - * @tc.desc : call the on method of callStateChange - */ - it('Telephony_observer_observer_on_callStateChange_0200', 0, async function (done) { - console.log("************* Telephony_observer_observer_on_callStateChange_0200 Test start *************") - observer.on('callStateChange', { - slotId: SLOT_0 - }, (data) => { - expect().assertFail() - done() - return - }) - setTimeout(timeout, 3000) - console.log("************* Telephony_observer_observer_on_callStateChange_0200 Test end *************") - done() - }) - - /* - * @tc.number : Telephony_observer_observer_off_callStateChange_0100 - * @tc.name : off_callStateChange - * @tc.desc : call the off method of callStateChange - */ - it('Telephony_observer_observer_off_callStateChange_0100', 0, async function (done) { - console.log("************* Telephony_observer_observer_off_callStateChange_0100 Test start *************") - observer.off('callStateChange', (data) => { - expect().assertFail() - done() - return - }) - setTimeout(timeout, 3000) - console.log("************* Telephony_observer_observer_off_callStateChange_0100 Test end *************") - done() - }) - - /* - * @tc.number : Telephony_observer_observer_on_simStateChange_0100 - * @tc.name : on_simStateChange - * @tc.desc : call the on method of simStateChange - */ - it('Telephony_observer_observer_on_simStateChange_0100', 0, async function (done) { - console.log("************* Telephony_observer_observer_on_simStateChange_0100 Test start *************") - observer.on('simStateChange', (data) => { - expect().assertFail() - done() - return - }) - setTimeout(timeout, 3000) - console.log("************* Telephony_observer_observer_on_simStateChange_0100 Test end *************") - done() - }) - - /* - * @tc.number : Telephony_observer_observer_on_simStateChange_0200 - * @tc.name : on_simStateChange - * @tc.desc : call the on method of simStateChange - */ - it('Telephony_observer_observer_on_simStateChange_0200', 0, async function (done) { - console.log("************* Telephony_observer_observer_on_simStateChange_0200 Test start *************") - observer.on('simStateChange', { - slotId: SLOT_0 - }, (data) => { - expect().assertFail() - done() - return - }) - setTimeout(timeout, 3000) - console.log("************* Telephony_observer_observer_on_simStateChange_0200 Test end *************") - done() - }) - - /* - * @tc.number : Telephony_observer_observer_off_simStateChange_0100 - * @tc.name : off_simStateChange - * @tc.desc : call the off method of simStateChange - */ - it('Telephony_observer_observer_off_simStateChange_0100', 0, async function (done) { - console.log("************* Telephony_observer_observer_off_simStateChange_0100 Test start *************") - observer.off('simStateChange', (data) => { - expect().assertFail() - done() - return - }) - setTimeout(timeout, 3000) - console.log("************* Telephony_observer_observer_off_simStateChange_0100 Test end *************") - done() - }) - - /* - * @tc.number : Telephony_observer_SimStateData_type_0100 - * @tc.name : type - * @tc.desc : check the type value of SimStateData object - */ - it('Telephony_observer_SimStateData_type_0100', 0, function (done) { - console.log("************* Telephony_observer_SimStateData_type_0100 Test start *************") - const unknown: SimStateData = { - type: sim.CardType.UNKNOWN_CARD - } - expect(-1).assertEqual(unknown.type) - - const singleMode: SimStateData = { - type: sim.CardType.SINGLE_MODE_SIM_CARD - } - expect(10).assertEqual(singleMode.type) - - const singleModeUSim: SimStateData = { - type: sim.CardType.SINGLE_MODE_USIM_CARD - } - expect(20).assertEqual(singleModeUSim.type) - done() - console.log("************* Telephony_observer_SimStateData_type_0100 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_SimStateData_type_0200 - * @tc.name : type - * @tc.desc : check the type value of SimStateData object - */ - it('Telephony_observer_SimStateData_type_0200', 0, function (done) { - console.log("************* Telephony_observer_SimStateData_type_0200 Test start *************") - const singleModeRUim: SimStateData = { - type: sim.CardType.SINGLE_MODE_RUIM_CARD - } - expect(30).assertEqual(singleModeRUim.type) - - const dualModeCG: SimStateData = { - type: sim.CardType.DUAL_MODE_CG_CARD - } - expect(40).assertEqual(dualModeCG.type) - - const ctNationalRoaming: SimStateData = { - type: sim.CardType.CT_NATIONAL_ROAMING_CARD - } - expect(41).assertEqual(ctNationalRoaming.type) - done() - console.log("************* Telephony_observer_SimStateData_type_0200 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_SimStateData_type_0300 - * @tc.name : type - * @tc.desc : check the type value of SimStateData object - */ - it('Telephony_observer_SimStateData_type_0300', 0, function (done) { - console.log("************* Telephony_observer_SimStateData_type_0300 Test start *************") - const cuDualMode: SimStateData = { - type: sim.CardType.CU_DUAL_MODE_CARD - } - expect(42).assertEqual(cuDualMode.type) - - const dualModeTelecomLte: SimStateData = { - type: sim.CardType.DUAL_MODE_TELECOM_LTE_CARD - } - expect(43).assertEqual(dualModeTelecomLte.type) - - const dualModeUg: SimStateData = { - type: sim.CardType.DUAL_MODE_UG_CARD - } - expect(50).assertEqual(dualModeUg.type) - - const singleModeIsim: SimStateData = { - type: sim.CardType.SINGLE_MODE_ISIM_CARD - } - expect(60).assertEqual(singleModeIsim.type) - done() - console.log("************* Telephony_observer_SimStateData_type_0300 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_SimStateData_state_0100 - * @tc.name : state - * @tc.desc : check the state value of SimStateData object - */ - it('Telephony_observer_SimStateData_state_0100', 0, function (done) { - console.log("************* Telephony_observer_SimStateData_state_0100 Test start *************") - const unknown: SimStateData = { - state: sim.SimState.SIM_STATE_UNKNOWN - } - expect(0).assertEqual(unknown.state) - const notPresent: SimStateData = { - state: sim.SimState.SIM_STATE_NOT_PRESENT - } - expect(1).assertEqual(notPresent.state) - done() - console.log("************* Telephony_observer_SimStateData_state_0100 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_SimStateData_state_0200 - * @tc.name : state - * @tc.desc : check the state value of SimStateData object - */ - it('Telephony_observer_SimStateData_state_0200', 0, function (done) { - console.log("************* Telephony_observer_SimStateData_state_0200 Test start *************") - const locked: SimStateData = { - state: sim.SimState.SIM_STATE_LOCKED - } - expect(2).assertEqual(locked.state) - const notReady: SimStateData = { - state: sim.SimState.SIM_STATE_NOT_READY - } - expect(3).assertEqual(notReady.state) - done() - console.log("************* Telephony_observer_SimStateData_state_0200 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_SimStateData_state_0300 - * @tc.name : state - * @tc.desc : check the state value of SimStateData object - */ - it('Telephony_observer_SimStateData_state_0300', 0, function (done) { - console.log("************* Telephony_observer_SimStateData_state_0300 Test start *************") - const ready: SimStateData = { - state: sim.SimState.SIM_STATE_READY - } - expect(4).assertEqual(ready.state) - const loaded: SimStateData = { - state: sim.SimState.SIM_STATE_LOADED - } - expect(5).assertEqual(loaded.state) - done() - console.log("************* Telephony_observer_SimStateData_state_0300 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_LockReason_SIM_NONE_0100 - * @tc.name : SIM_NONE - * @tc.desc : check the SIM_NONE property of LockReason - */ - it('Telephony_observer_LockReason_SIM_NONE_0100', 0, function (done) { - console.log("************* Telephony_observer_LockReason_SIM_NONE_0100 Test start *************") - if (utils.notCheck) { - expect(true).assertTrue() - done() - } - expect(0).assertEqual(LockReason.SIM_NONE) - done() - console.log("************* Telephony_observer_LockReason_SIM_NONE_0100 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_LockReason_SIM_PIN_0100 - * @tc.name : SIM_PIN - * @tc.desc : check the SIM_PIN property of LockReason - */ - it('Telephony_observer_LockReason_SIM_PIN_0100', 0, function (done) { - console.log("************* Telephony_observer_LockReason_SIM_PIN_0100 Test start *************") - if (utils.notCheck) { - expect(true).assertTrue() - done() - } - expect(1).assertEqual(LockReason.SIM_PIN) - done() - console.log("************* Telephony_observer_LockReason_SIM_PIN_0100 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_LockReason_SIM_PUK_0100 - * @tc.name : SIM_PUK - * @tc.desc : check the SIM_PUK property of LockReason - */ - it('Telephony_observer_LockReason_SIM_PUK_0100', 0, function (done) { - console.log("************* Telephony_observer_LockReason_SIM_PUK_0100 Test start *************") - if (utils.notCheck) { - expect(true).assertTrue() - done() - } - expect(2).assertEqual(LockReason.SIM_PUK) - done() - console.log("************* Telephony_observer_LockReason_SIM_PUK_0100 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_LockReason_SIM_PN_PIN_0100 - * @tc.name : SIM_PN_PIN - * @tc.desc : check the SIM_PN_PIN property of LockReason - */ - it('Telephony_observer_LockReason_SIM_PN_PIN_0100', 0, function (done) { - console.log("************* Telephony_observer_LockReason_SIM_PN_PIN_0100 Test start *************") - if (utils.notCheck) { - expect(true).assertTrue() - done() - } - expect(3).assertEqual(LockReason.SIM_PN_PIN) - done() - console.log("************* Telephony_observer_LockReason_SIM_PN_PIN_0100 Test end *************") - }) - /* - * @tc.number : Telephony_observer_LockReason_SIM_PN_PUK_0100 - * @tc.name : SIM_PN_PUK - * @tc.desc : check the SIM_PN_PUK property of LockReason - */ - it('Telephony_observer_LockReason_SIM_PN_PUK_0100', 0, function (done) { - console.log("************* Telephony_observer_LockReason_SIM_PN_PUK_0100 Test start *************") - if (utils.notCheck) { - expect(true).assertTrue() - done() - } - expect(4).assertEqual(LockReason.SIM_PN_PUK) - done() - console.log("************* Telephony_observer_LockReason_SIM_PN_PUK_0100 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_LockReason_SIM_PU_PIN_0100 - * @tc.name : SIM_PU_PIN - * @tc.desc : check the SIM_PU_PIN property of LockReason - */ - it('Telephony_observer_LockReason_SIM_PU_PIN_0100', 0, function (done) { - console.log("************* Telephony_observer_LockReason_SIM_PU_PIN_0100 Test start *************") - if (utils.notCheck) { - expect(true).assertTrue() - done() - } - expect(5).assertEqual(LockReason.SIM_PU_PIN) - done() - console.log("************* Telephony_observer_LockReason_SIM_PU_PIN_0100 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_LockReason_SIM_PU_PUK_0100 - * @tc.name : SIM_PU_PUK - * @tc.desc : check the SIM_PU_PUK property of LockReason - */ - it('Telephony_observer_LockReason_SIM_PU_PUK_0100', 0, function (done) { - console.log("************* Telephony_observer_LockReason_SIM_PU_PUK_0100 Test start *************") - if (utils.notCheck) { - expect(true).assertTrue() - done() - } - expect(6).assertEqual(LockReason.SIM_PU_PUK) - done() - console.log("************* Telephony_observer_LockReason_SIM_PU_PUK_0100 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_LockReason_SIM_PP_PIN_0100 - * @tc.name : SIM_PP_PIN - * @tc.desc : check the SIM_PP_PIN property of LockReason - */ - it('Telephony_observer_LockReason_SIM_PP_PIN_0100', 0, function (done) { - console.log("************* Telephony_observer_LockReason_SIM_PP_PIN_0100 Test start *************") - if (utils.notCheck) { - expect(true).assertTrue() - done() - } - expect(7).assertEqual(LockReason.SIM_PP_PIN) - done() - console.log("************* Telephony_observer_LockReason_SIM_PP_PIN_0100 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_LockReason_SIM_PP_PUK_0100 - * @tc.name : SIM_PP_PUK - * @tc.desc : check the SIM_PP_PUK property of LockReason - */ - it('Telephony_observer_LockReason_SIM_PP_PUK_0100', 0, function (done) { - console.log("************* Telephony_observer_LockReason_SIM_PP_PUK_0100 Test start *************") - if (utils.notCheck) { - expect(true).assertTrue() - done() - } - expect(8).assertEqual(LockReason.SIM_PP_PUK) - done() - console.log("************* Telephony_observer_LockReason_SIM_PP_PUK_0100 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_LockReason_SIM_PC_PIN_0100 - * @tc.name : SIM_PC_PIN - * @tc.desc : check the SIM_PC_PIN property of LockReason - */ - it('Telephony_observer_LockReason_SIM_PC_PIN_0100', 0, function (done) { - console.log("************* Telephony_observer_LockReason_SIM_PC_PIN_0100 Test start *************") - if (utils.notCheck) { - expect(true).assertTrue() - done() - } - expect(9).assertEqual(LockReason.SIM_PC_PIN) - done() - console.log("************* Telephony_observer_LockReason_SIM_PC_PIN_0100 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_LockReason_SIM_PC_PUK_0100 - * @tc.name : SIM_PC_PUK - * @tc.desc : check the SIM_PC_PUK property of LockReason - */ - it('Telephony_observer_LockReason_SIM_PC_PUK_0100', 0, function (done) { - console.log("************* Telephony_observer_LockReason_SIM_PC_PUK_0100 Test start *************") - if (utils.notCheck) { - expect(true).assertTrue() - done() - } - expect(10).assertEqual(LockReason.SIM_PC_PUK) - done() - console.log("************* Telephony_observer_LockReason_SIM_PC_PUK_0100 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_LockReason_SIM_SIM_PIN_0100 - * @tc.name : SIM_SIM_PIN - * @tc.desc : check the SIM_SIM_PIN property of LockReason - */ - it('Telephony_observer_LockReason_SIM_SIM_PIN_0100', 0, function (done) { - console.log("************* Telephony_observer_LockReason_SIM_SIM_PIN_0100 Test start *************") - if (utils.notCheck) { - expect(true).assertTrue() - done() - } - expect(11).assertEqual(LockReason.SIM_SIM_PIN) - done() - console.log("************* Telephony_observer_LockReason_SIM_SIM_PIN_0100 Test end *************") - }) - - /* - * @tc.number : Telephony_observer_LockReason_SIM_SIM_PUK_0100 - * @tc.name : SIM_SIM_PUK - * @tc.desc : check the SIM_SIM_PUK property of LockReason - */ - it('Telephony_observer_LockReason_SIM_SIM_PUK_0100', 0, function (done) { - console.log("************* Telephony_observer_LockReason_SIM_SIM_PUK_0100 Test start *************") - if (utils.notCheck) { - expect(true).assertTrue() - done() - } - expect(12).assertEqual(LockReason.SIM_SIM_PUK) - done() - console.log("************* Telephony_observer_LockReason_SIM_SIM_PUK_0100 Test end *************") - }) - - function timeout(done) { - expect(true).assertTrue() - console.debug('Observer Test=========timeout========'); - done() - } - - /* - * @tc.number : Telephony_Observer_SimStateData_Reason - * @tc.name : on_simStateChange - * @tc.desc : call the on method of simStateChange - */ - it('Telephony_Observer_SimStateData_Reason', 0, async function (done) { - console.log("************* Telephony_Observer_SimStateData_Reason Test start *************") - observer.on('simStateChange', (data:SimStateData) => { - if((data === null || data === undefined) - || (data.reason == null || data.reason === undefined)){ - expect(true).assertTrue() - done() - } - return - }) - console.log("************* Telephony_Observer_SimStateData_Reason Test end *************") - done() - }) - - console.log("************* Observer Test end *************") - }) -} - - - diff --git a/telephony/telephonyjstest/observer/entry/src/main/ets/TestAbility/app.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/TestAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..1405dd359f629939894b86e2b285cb2cc1b37aa6 --- /dev/null +++ b/telephony/telephonyjstest/observer/entry/src/main/ets/TestAbility/app.ets @@ -0,0 +1,32 @@ +/* + * 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 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/telephony/telephonyjstest/observer/entry/src/main/ets/TestAbility/pages/index.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..52663437cb619d4598126cf403d3689cb31ba131 --- /dev/null +++ b/telephony/telephonyjstest/observer/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,49 @@ +/* + * 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 router from '@system.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('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/telephony/telephonyjstest/observer/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/telephony/telephonyjstest/observer/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..14e78a653e030645860bcc3e7eb6c600b098127b --- /dev/null +++ b/telephony/telephonyjstest/observer/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,77 @@ +/* + * 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 itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + 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') + } + + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.TestAbility' + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + 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 call abilityDelegator.getAppContext') + var context = abilityDelegator.getAppContext() + console.info('getAppContext : ' + JSON.stringify(context)) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/List.test.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/test/List.test.ets similarity index 100% rename from telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/List.test.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/test/List.test.ets diff --git a/telephony/telephonyjstest/observer/entry/src/main/ets/test/ObserverJsunit.test.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/test/ObserverJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8391cdabf2ca09ad7080b64a96eb748c1e9e5ce1 --- /dev/null +++ b/telephony/telephonyjstest/observer/entry/src/main/ets/test/ObserverJsunit.test.ets @@ -0,0 +1,765 @@ +// @ts-nocheck +/** + * 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 'deccjsunit/index' +import observer from '@ohos.telephony.observer' +import cellular from '@ohos.telephony.data' +import radio from '@ohos.telephony.radio' +import call from '@ohos.telephony.call' +import utils from './Utils.ets' +import {SimStateData} from '@ohos.telephony.observer' +import {LockReason} from '@ohos.telephony.observer' +import sim from "@ohos.telephony.sim" + + +export default function observerJsunit() { + describe('ObserverTest', function () { + console.log("************* Observer Test start *************") + + const SLOT_0 = 0; + const SLOT_2 = -1; + + /* + * @tc.number : Telephony_observer_observer_DataConnectState_0100 + * @tc.name : DataConnectState + * @tc.desc : check the getCellularDataState callback to verify the call back data + */ + it('Telephony_observer_observer_DataConnectState_0100', 0, function (done) { + expect(observer.NetworkState == radio.NetworkState).assertTrue(); + expect(observer.SignalInformation == radio.SignalInformation).assertTrue(); + expect(observer.CellInformation == radio.CellInformation ).assertTrue(); + expect(observer.RatType == radio.RadioTechnology).assertTrue(); + expect(observer.CallState == call.CallState).assertTrue(); + console.log("************* Telephony_observer_observer_DataConnectState_0100 Test start *************") + cellular.getCellularDataState((err, data) => { + if (!err) { + var dataConnectStateList = [cellular.DataConnectState.DATA_STATE_UNKNOWN, + cellular.DataConnectState.DATA_STATE_DISCONNECTED, + cellular.DataConnectState.DATA_STATE_CONNECTING, + cellular.DataConnectState.DATA_STATE_CONNECTED, + cellular.DataConnectState.DATA_STATE_SUSPENDED] + expect(dataConnectStateList.indexOf(data) >= 0).assertTrue() + done(); + return; + } + console.log("Telephony_CellularData_getCellularDataState_0100 end"); + done() + }) + console.log("************* Telephony_observer_observer_DataConnectState_0100 Test end *************") + }) + + /* + * @tc.number : Telephony_observer_observer_DataConnectState_0200 + * @tc.name : DataConnectState + * @tc.desc : check the getCellularDataState callback to verify the call back data + */ + it('Telephony_observer_observer_DataConnectState_0200', 0, function (done) { + console.log("************* Telephony_observer_observer_DataConnectState_0200 Test start *************") + console.log("Telephony_observer_observer_DataConnectState_0200" + observer.DataConnectState) + expect(observer.DataConnectState == undefined).assertTrue(); + console.log("************* Telephony_observer_observer_DataConnectState_0200 Test end *************") + done(); + }) + + /* + * @tc.number : Telephony_observer_observer_RatType_0100 + * @tc.name : RatType + * @tc.desc : Obtains the data connect state + */ + it('Telephony_observer_observer_RatType_0100', 0, async function (done) { + console.log("************* Telephony_observer_observer_RatType_0100 Test start *************") + console.log("Telephony_observer_observer_RatType_0100" +observer.RatType) + expect(observer.RatType == undefined).assertTrue(); + console.log("************* Telephony_observer_observer_RatType_0100 Test end *************") + done() + }) + + /* + * @tc.number : Telephony_observer_observer_on_networkStateChange_0100 + * @tc.name : on_networkStateChange + * @tc.desc : call the on method of networkStateChange + */ + it('Telephony_observer_observer_on_networkStateChange_0100', 0, async function (done) { + console.log("************* Telephony_observer_observer_on_networkStateChange_0100 Test start *************") + observer.on('networkStateChange', (networkState) => { + expect().assertFail() + done() + return + }) + console.log("************* Telephony_observer_observer_on_networkStateChange_0100 Test end *************") + done() + }) + + /* + * @tc.number : Telephony_observer_observer_on_networkStateChange_0200 + * @tc.name : on_networkStateChange + * @tc.desc : call the on method of networkStateChange + */ + it('Telephony_observer_observer_on_networkStateChange_0200', 0, async function (done) { + console.log("************* Telephony_observer_observer_on_networkStateChange_0200 Test start *************") + observer.on('networkStateChange', { + slotId: SLOT_0 + }, (networkState) => { + expect().assertFail() + done() + return + }) + console.log("************* Telephony_observer_observer_on_networkStateChange_0200 Test end *************") + done() + }) + + /* + * @tc.number : Telephony_observer_observer_off_networkStateChange_0100 + * @tc.name : off_networkStateChange + * @tc.desc : call the off method of networkStateChange + */ + it('Telephony_observer_observer_off_networkStateChange_0100', 0, async function (done) { + console.log("************* Telephony_observer_observer_off_networkStateChange_0100 Test start *************") + observer.off('networkStateChange', (networkState) => { + expect().assertFail() + done() + return + }) + console.log("************* Telephony_observer_observer_off_networkStateChange_0100 Test end *************") + done() + }) + + /* + * @tc.number : Telephony_observer_observer_on_signalInfoChange_0100 + * @tc.name : on_signalInfoChange + * @tc.desc : call the on method of signalInfoChange + */ + it('Telephony_observer_observer_on_signalInfoChange_0100', 0, async function (done) { + console.log("************* Telephony_observer_observer_on_signalInfoChange_0100 Test start *************") + observer.on('signalInfoChange', (signalInformation) => { + expect().assertFail() + done() + return + }) + console.log("************* Telephony_observer_observer_on_signalInfoChange_0100 Test end *************") + done() + }) + + /* + * @tc.number : Telephony_observer_observer_on_signalInfoChange_0200 + * @tc.name : on_signalInfoChange + * @tc.desc : call the on method of signalInfoChange + */ + it('Telephony_observer_observer_on_signalInfoChange_0200', 0, async function (done) { + console.log("************* Telephony_observer_observer_on_signalInfoChange_0200 Test start *************") + observer.on('signalInfoChange', { + slotId: SLOT_0 + }, (signalInformation) => { + expect().assertFail() + done() + return + }) + console.log("************* Telephony_observer_observer_on_signalInfoChange_0200 Test end *************") + done() + }) + + /* + * @tc.number : Telephony_observer_observer_off_signalInfoChange_0100 + * @tc.name : off_signalInfoChange + * @tc.desc : call the off method of signalInfoChange + */ + it('Telephony_observer_observer_off_signalInfoChange_0100', 0, async function (done) { + console.log("************* Telephony_observer_observer_off_signalInfoChange_0100 Test start *************") + observer.off('signalInfoChange', (networkState) => { + expect().assertFail() + done() + return + }) + console.log("************* Telephony_observer_observer_off_signalInfoChange_0100 Test end *************") + done() + }) + + + + /* + * @tc.number : Telephony_observer_observer_on_cellularDataConnectionStateChange_0100 + * @tc.name : on_cellularDataConnectionStateChange + * @tc.desc : call the on method of cellularDataConnectionStateChange + */ + it('Telephony_observer_observer_on_cellularDataConnectionStateChange_0100', 0, async function (done) { + console.log("************* Telephony_observer_observer_on_cellularDataConnectionStateChange_0100 Test start *************") + observer.on('cellularDataConnectionStateChange', (data) => { + expect().assertFail() + done() + return + }) + console.log("************* Telephony_observer_observer_on_cellularDataConnectionStateChange_0100 Test end *************") + done() + }) + + /* + * @tc.number : Telephony_observer_observer_on_cellularDataConnectionStateChange_0200 + * @tc.name : on_cellularDataConnectionStateChange + * @tc.desc : call the on method of cellularDataConnectionStateChange + */ + it('Telephony_observer_observer_on_cellularDataConnectionStateChange_0200', 0, async function (done) { + console.log("************* Telephony_observer_observer_on_cellularDataConnectionStateChange_0200 Test start *************") + observer.on('cellularDataConnectionStateChange', { + slotId: SLOT_0 + }, (data) => { + expect().assertFail() + done() + return + }) + console.log("************* Telephony_observer_observer_on_cellularDataConnectionStateChange_0200 Test end *************") + done() + }) + + /* + * @tc.number : Telephony_observer_observer_off_cellularDataConnectionStateChange_0100 + * @tc.name : off_cellularDataConnectionStateChange + * @tc.desc : call the off method of cellularDataConnectionStateChange + */ + it('Telephony_observer_observer_off_cellularDataConnectionStateChange_0100', 0, async function (done) { + console.log("************* Telephony_observer_observer_off_cellularDataConnectionStateChange_0100 Test start *************") + observer.off('cellularDataConnectionStateChange', (data) => { + expect().assertFail() + done() + return + }) + console.log("************* Telephony_observer_observer_off_cellularDataConnectionStateChange_0100 Test end *************") + done() + }) + + /* + * @tc.number : Telephony_observer_observer_on_cellularDataFlowChange_0100 + * @tc.name : on_cellularDataFlowChange + * @tc.desc : call the on method of cellularDataFlowChange + */ + it('Telephony_observer_observer_on_cellularDataFlowChange_0100', 0, async function (done) { + console.log("************* Telephony_observer_observer_on_cellularDataFlowChange_0100 Test start *************") + observer.on('cellularDataFlowChange', (data) => { + expect().assertFail() + done() + return + }) + console.log("************* Telephony_observer_observer_on_cellularDataFlowChange_0100 Test end *************") + done() + }) + + /* + * @tc.number : Telephony_observer_observer_on_cellularDataFlowChange_0200 + * @tc.name : on_cellularDataFlowChange + * @tc.desc : call the on method of cellularDataFlowChange + */ + it('Telephony_observer_observer_on_cellularDataFlowChange_0200', 0, async function (done) { + console.log("************* Telephony_observer_observer_on_cellularDataFlowChange_0200 Test start *************") + observer.on('cellularDataFlowChange', { + slotId: SLOT_0 + }, (data) => { + expect().assertFail() + done() + return + }) + console.log("************* Telephony_observer_observer_on_cellularDataFlowChange_0200 Test end *************") + done() + }) + + /* + * @tc.number : Telephony_observer_observer_off_cellularDataFlowChange_0100 + * @tc.name : off_cellularDataFlowChange + * @tc.desc : call the off method of cellularDataFlowChange + */ + it('Telephony_observer_observer_off_cellularDataFlowChange_0100', 0, async function (done) { + console.log("************* Telephony_observer_observer_off_cellularDataFlowChange_0100 Test start *************") + observer.off('cellularDataFlowChange', (data) => { + expect().assertFail() + done() + return + }) + console.log("************* Telephony_observer_observer_off_cellularDataFlowChange_0100 Test end *************") + done() + }) + + /* + * @tc.number : Telephony_observer_observer_on_callStateChange_0100 + * @tc.name : on_callStateChange + * @tc.desc : call the on method of callStateChange + */ + it('Telephony_observer_observer_on_callStateChange_0100', 0, async function (done) { + console.log("************* Telephony_observer_observer_on_callStateChange_0100 Test start *************") + observer.on('callStateChange', (data) => { + expect().assertFail() + done() + return + }) + console.log("************* Telephony_observer_observer_on_callStateChange_0100 Test end *************") + done() + }) + + /* + * @tc.number : Telephony_observer_observer_on_callStateChange_0200 + * @tc.name : on_callStateChange + * @tc.desc : call the on method of callStateChange + */ + it('Telephony_observer_observer_on_callStateChange_0200', 0, async function (done) { + console.log("************* Telephony_observer_observer_on_callStateChange_0200 Test start *************") + observer.on('callStateChange', { + slotId: SLOT_0 + }, (data) => { + expect().assertFail() + done() + return + }) + console.log("************* Telephony_observer_observer_on_callStateChange_0200 Test end *************") + done() + }) + + /* + * @tc.number : Telephony_observer_observer_off_callStateChange_0100 + * @tc.name : off_callStateChange + * @tc.desc : call the off method of callStateChange + */ + it('Telephony_observer_observer_off_callStateChange_0100', 0, async function (done) { + console.log("************* Telephony_observer_observer_off_callStateChange_0100 Test start *************") + observer.off('callStateChange', (data) => { + expect().assertFail() + done() + return + }) + console.log("************* Telephony_observer_observer_off_callStateChange_0100 Test end *************") + done() + }) + + /* + * @tc.number : Telephony_observer_observer_on_simStateChange_0100 + * @tc.name : on_simStateChange + * @tc.desc : call the on method of simStateChange + */ + it('Telephony_observer_observer_on_simStateChange_0100', 0, async function (done) { + console.log("************* Telephony_observer_observer_on_simStateChange_0100 Test start *************") + observer.on('simStateChange', (data) => { + expect().assertFail() + done() + return + }) + console.log("************* Telephony_observer_observer_on_simStateChange_0100 Test end *************") + done() + }) + + /* + * @tc.number : Telephony_observer_observer_on_simStateChange_0200 + * @tc.name : on_simStateChange + * @tc.desc : call the on method of simStateChange + */ + it('Telephony_observer_observer_on_simStateChange_0200', 0, async function (done) { + console.log("************* Telephony_observer_observer_on_simStateChange_0200 Test start *************") + observer.on('simStateChange', { + slotId: SLOT_0 + }, (data) => { + expect().assertFail() + done() + return + }) + console.log("************* Telephony_observer_observer_on_simStateChange_0200 Test end *************") + done() + }) + + /* + * @tc.number : Telephony_observer_observer_off_simStateChange_0100 + * @tc.name : off_simStateChange + * @tc.desc : call the off method of simStateChange + */ + it('Telephony_observer_observer_off_simStateChange_0100', 0, async function (done) { + console.log("************* Telephony_observer_observer_off_simStateChange_0100 Test start *************") + observer.off('simStateChange', (data) => { + expect().assertFail() + done() + return + }) + console.log("************* Telephony_observer_observer_off_simStateChange_0100 Test end *************") + done() + }) + + /* + * @tc.number : Telephony_observer_SimStateData_type_0100 + * @tc.name : type + * @tc.desc : check the type value of SimStateData object + */ + it('Telephony_observer_SimStateData_type_0100', 0, function (done) { + console.log("************* Telephony_observer_SimStateData_type_0100 Test start *************") + const unknown: SimStateData = { + type: sim.CardType.UNKNOWN_CARD + } + expect(-1).assertEqual(unknown.type) + + const singleMode: SimStateData = { + type: sim.CardType.SINGLE_MODE_SIM_CARD + } + expect(10).assertEqual(singleMode.type) + + const singleModeUSim: SimStateData = { + type: sim.CardType.SINGLE_MODE_USIM_CARD + } + expect(20).assertEqual(singleModeUSim.type) + done() + console.log("************* Telephony_observer_SimStateData_type_0100 Test end *************") + }) + + /* + * @tc.number : Telephony_observer_SimStateData_type_0200 + * @tc.name : type + * @tc.desc : check the type value of SimStateData object + */ + it('Telephony_observer_SimStateData_type_0200', 0, function (done) { + console.log("************* Telephony_observer_SimStateData_type_0200 Test start *************") + const singleModeRUim: SimStateData = { + type: sim.CardType.SINGLE_MODE_RUIM_CARD + } + expect(30).assertEqual(singleModeRUim.type) + + const dualModeCG: SimStateData = { + type: sim.CardType.DUAL_MODE_CG_CARD + } + expect(40).assertEqual(dualModeCG.type) + + const ctNationalRoaming: SimStateData = { + type: sim.CardType.CT_NATIONAL_ROAMING_CARD + } + expect(41).assertEqual(ctNationalRoaming.type) + done() + console.log("************* Telephony_observer_SimStateData_type_0200 Test end *************") + }) + + /* + * @tc.number : Telephony_observer_SimStateData_type_0300 + * @tc.name : type + * @tc.desc : check the type value of SimStateData object + */ + it('Telephony_observer_SimStateData_type_0300', 0, function (done) { + console.log("************* Telephony_observer_SimStateData_type_0300 Test start *************") + const cuDualMode: SimStateData = { + type: sim.CardType.CU_DUAL_MODE_CARD + } + expect(42).assertEqual(cuDualMode.type) + + const dualModeTelecomLte: SimStateData = { + type: sim.CardType.DUAL_MODE_TELECOM_LTE_CARD + } + expect(43).assertEqual(dualModeTelecomLte.type) + + const dualModeUg: SimStateData = { + type: sim.CardType.DUAL_MODE_UG_CARD + } + expect(50).assertEqual(dualModeUg.type) + + const singleModeIsim: SimStateData = { + type: sim.CardType.SINGLE_MODE_ISIM_CARD + } + expect(60).assertEqual(singleModeIsim.type) + done() + console.log("************* Telephony_observer_SimStateData_type_0300 Test end *************") + }) + + /* + * @tc.number : Telephony_observer_SimStateData_state_0100 + * @tc.name : state + * @tc.desc : check the state value of SimStateData object + */ + it('Telephony_observer_SimStateData_state_0100', 0, function (done) { + console.log("************* Telephony_observer_SimStateData_state_0100 Test start *************") + const unknown: SimStateData = { + state: sim.SimState.SIM_STATE_UNKNOWN + } + expect(0).assertEqual(unknown.state) + const notPresent: SimStateData = { + state: sim.SimState.SIM_STATE_NOT_PRESENT + } + expect(1).assertEqual(notPresent.state) + done() + console.log("************* Telephony_observer_SimStateData_state_0100 Test end *************") + }) + + /* + * @tc.number : Telephony_observer_SimStateData_state_0200 + * @tc.name : state + * @tc.desc : check the state value of SimStateData object + */ + it('Telephony_observer_SimStateData_state_0200', 0, function (done) { + console.log("************* Telephony_observer_SimStateData_state_0200 Test start *************") + const locked: SimStateData = { + state: sim.SimState.SIM_STATE_LOCKED + } + expect(2).assertEqual(locked.state) + const notReady: SimStateData = { + state: sim.SimState.SIM_STATE_NOT_READY + } + expect(3).assertEqual(notReady.state) + done() + console.log("************* Telephony_observer_SimStateData_state_0200 Test end *************") + }) + + /* + * @tc.number : Telephony_observer_SimStateData_state_0300 + * @tc.name : state + * @tc.desc : check the state value of SimStateData object + */ + it('Telephony_observer_SimStateData_state_0300', 0, function (done) { + console.log("************* Telephony_observer_SimStateData_state_0300 Test start *************") + const ready: SimStateData = { + state: sim.SimState.SIM_STATE_READY + } + expect(4).assertEqual(ready.state) + const loaded: SimStateData = { + state: sim.SimState.SIM_STATE_LOADED + } + expect(5).assertEqual(loaded.state) + done() + console.log("************* Telephony_observer_SimStateData_state_0300 Test end *************") + }) + + /* + * @tc.number : Telephony_observer_LockReason_SIM_NONE_0100 + * @tc.name : SIM_NONE + * @tc.desc : check the SIM_NONE property of LockReason + */ + it('Telephony_observer_LockReason_SIM_NONE_0100', 0, function (done) { + console.log("************* Telephony_observer_LockReason_SIM_NONE_0100 Test start *************") + if (utils.notCheck) { + expect(true).assertTrue() + done() + } + expect(0).assertEqual(LockReason.SIM_NONE) + done() + console.log("************* Telephony_observer_LockReason_SIM_NONE_0100 Test end *************") + }) + + /* + * @tc.number : Telephony_observer_LockReason_SIM_PIN_0100 + * @tc.name : SIM_PIN + * @tc.desc : check the SIM_PIN property of LockReason + */ + it('Telephony_observer_LockReason_SIM_PIN_0100', 0, function (done) { + console.log("************* Telephony_observer_LockReason_SIM_PIN_0100 Test start *************") + if (utils.notCheck) { + expect(true).assertTrue() + done() + } + expect(1).assertEqual(LockReason.SIM_PIN) + done() + console.log("************* Telephony_observer_LockReason_SIM_PIN_0100 Test end *************") + }) + + /* + * @tc.number : Telephony_observer_LockReason_SIM_PUK_0100 + * @tc.name : SIM_PUK + * @tc.desc : check the SIM_PUK property of LockReason + */ + it('Telephony_observer_LockReason_SIM_PUK_0100', 0, function (done) { + console.log("************* Telephony_observer_LockReason_SIM_PUK_0100 Test start *************") + if (utils.notCheck) { + expect(true).assertTrue() + done() + } + expect(2).assertEqual(LockReason.SIM_PUK) + done() + console.log("************* Telephony_observer_LockReason_SIM_PUK_0100 Test end *************") + }) + + /* + * @tc.number : Telephony_observer_LockReason_SIM_PN_PIN_0100 + * @tc.name : SIM_PN_PIN + * @tc.desc : check the SIM_PN_PIN property of LockReason + */ + it('Telephony_observer_LockReason_SIM_PN_PIN_0100', 0, function (done) { + console.log("************* Telephony_observer_LockReason_SIM_PN_PIN_0100 Test start *************") + if (utils.notCheck) { + expect(true).assertTrue() + done() + } + expect(3).assertEqual(LockReason.SIM_PN_PIN) + done() + console.log("************* Telephony_observer_LockReason_SIM_PN_PIN_0100 Test end *************") + }) + /* + * @tc.number : Telephony_observer_LockReason_SIM_PN_PUK_0100 + * @tc.name : SIM_PN_PUK + * @tc.desc : check the SIM_PN_PUK property of LockReason + */ + it('Telephony_observer_LockReason_SIM_PN_PUK_0100', 0, function (done) { + console.log("************* Telephony_observer_LockReason_SIM_PN_PUK_0100 Test start *************") + if (utils.notCheck) { + expect(true).assertTrue() + done() + } + expect(4).assertEqual(LockReason.SIM_PN_PUK) + done() + console.log("************* Telephony_observer_LockReason_SIM_PN_PUK_0100 Test end *************") + }) + + /* + * @tc.number : Telephony_observer_LockReason_SIM_PU_PIN_0100 + * @tc.name : SIM_PU_PIN + * @tc.desc : check the SIM_PU_PIN property of LockReason + */ + it('Telephony_observer_LockReason_SIM_PU_PIN_0100', 0, function (done) { + console.log("************* Telephony_observer_LockReason_SIM_PU_PIN_0100 Test start *************") + if (utils.notCheck) { + expect(true).assertTrue() + done() + } + expect(5).assertEqual(LockReason.SIM_PU_PIN) + done() + console.log("************* Telephony_observer_LockReason_SIM_PU_PIN_0100 Test end *************") + }) + + /* + * @tc.number : Telephony_observer_LockReason_SIM_PU_PUK_0100 + * @tc.name : SIM_PU_PUK + * @tc.desc : check the SIM_PU_PUK property of LockReason + */ + it('Telephony_observer_LockReason_SIM_PU_PUK_0100', 0, function (done) { + console.log("************* Telephony_observer_LockReason_SIM_PU_PUK_0100 Test start *************") + if (utils.notCheck) { + expect(true).assertTrue() + done() + } + expect(6).assertEqual(LockReason.SIM_PU_PUK) + done() + console.log("************* Telephony_observer_LockReason_SIM_PU_PUK_0100 Test end *************") + }) + + /* + * @tc.number : Telephony_observer_LockReason_SIM_PP_PIN_0100 + * @tc.name : SIM_PP_PIN + * @tc.desc : check the SIM_PP_PIN property of LockReason + */ + it('Telephony_observer_LockReason_SIM_PP_PIN_0100', 0, function (done) { + console.log("************* Telephony_observer_LockReason_SIM_PP_PIN_0100 Test start *************") + if (utils.notCheck) { + expect(true).assertTrue() + done() + } + expect(7).assertEqual(LockReason.SIM_PP_PIN) + done() + console.log("************* Telephony_observer_LockReason_SIM_PP_PIN_0100 Test end *************") + }) + + /* + * @tc.number : Telephony_observer_LockReason_SIM_PP_PUK_0100 + * @tc.name : SIM_PP_PUK + * @tc.desc : check the SIM_PP_PUK property of LockReason + */ + it('Telephony_observer_LockReason_SIM_PP_PUK_0100', 0, function (done) { + console.log("************* Telephony_observer_LockReason_SIM_PP_PUK_0100 Test start *************") + if (utils.notCheck) { + expect(true).assertTrue() + done() + } + expect(8).assertEqual(LockReason.SIM_PP_PUK) + done() + console.log("************* Telephony_observer_LockReason_SIM_PP_PUK_0100 Test end *************") + }) + + /* + * @tc.number : Telephony_observer_LockReason_SIM_PC_PIN_0100 + * @tc.name : SIM_PC_PIN + * @tc.desc : check the SIM_PC_PIN property of LockReason + */ + it('Telephony_observer_LockReason_SIM_PC_PIN_0100', 0, function (done) { + console.log("************* Telephony_observer_LockReason_SIM_PC_PIN_0100 Test start *************") + if (utils.notCheck) { + expect(true).assertTrue() + done() + } + expect(9).assertEqual(LockReason.SIM_PC_PIN) + done() + console.log("************* Telephony_observer_LockReason_SIM_PC_PIN_0100 Test end *************") + }) + + /* + * @tc.number : Telephony_observer_LockReason_SIM_PC_PUK_0100 + * @tc.name : SIM_PC_PUK + * @tc.desc : check the SIM_PC_PUK property of LockReason + */ + it('Telephony_observer_LockReason_SIM_PC_PUK_0100', 0, function (done) { + console.log("************* Telephony_observer_LockReason_SIM_PC_PUK_0100 Test start *************") + if (utils.notCheck) { + expect(true).assertTrue() + done() + } + expect(10).assertEqual(LockReason.SIM_PC_PUK) + done() + console.log("************* Telephony_observer_LockReason_SIM_PC_PUK_0100 Test end *************") + }) + + /* + * @tc.number : Telephony_observer_LockReason_SIM_SIM_PIN_0100 + * @tc.name : SIM_SIM_PIN + * @tc.desc : check the SIM_SIM_PIN property of LockReason + */ + it('Telephony_observer_LockReason_SIM_SIM_PIN_0100', 0, function (done) { + console.log("************* Telephony_observer_LockReason_SIM_SIM_PIN_0100 Test start *************") + if (utils.notCheck) { + expect(true).assertTrue() + done() + } + expect(11).assertEqual(LockReason.SIM_SIM_PIN) + done() + console.log("************* Telephony_observer_LockReason_SIM_SIM_PIN_0100 Test end *************") + }) + + /* + * @tc.number : Telephony_observer_LockReason_SIM_SIM_PUK_0100 + * @tc.name : SIM_SIM_PUK + * @tc.desc : check the SIM_SIM_PUK property of LockReason + */ + it('Telephony_observer_LockReason_SIM_SIM_PUK_0100', 0, function (done) { + console.log("************* Telephony_observer_LockReason_SIM_SIM_PUK_0100 Test start *************") + if (utils.notCheck) { + expect(true).assertTrue() + done() + } + expect(12).assertEqual(LockReason.SIM_SIM_PUK) + done() + console.log("************* Telephony_observer_LockReason_SIM_SIM_PUK_0100 Test end *************") + }) + + function timeout(done) { + expect(true).assertTrue() + console.debug('Observer Test=========timeout========'); + done() + } + + /* + * @tc.number : Telephony_Observer_SimStateData_Reason + * @tc.name : on_simStateChange + * @tc.desc : call the on method of simStateChange + */ + it('Telephony_Observer_SimStateData_Reason', 0, async function (done) { + console.log("************* Telephony_Observer_SimStateData_Reason Test start *************") + observer.on('simStateChange', (data:SimStateData) => { + if((data === null || data === undefined) + || (data.reason == null || data.reason === undefined)){ + expect(true).assertTrue() + done() + } + return + }) + console.log("************* Telephony_Observer_SimStateData_Reason Test end *************") + done() + }) + + console.log("************* Observer Test end *************") + }) +} + + + diff --git a/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/Utils.ets b/telephony/telephonyjstest/observer/entry/src/main/ets/test/Utils.ets similarity index 100% rename from telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/Utils.ets rename to telephony/telephonyjstest/observer/entry/src/main/ets/test/Utils.ets diff --git a/telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/lib/Const.js b/telephony/telephonyjstest/observer/entry/src/main/ets/test/lib/Const.js similarity index 100% rename from telephony/telephonyjstest/observer/entry/src/main/ets/MainAbility/test/lib/Const.js rename to telephony/telephonyjstest/observer/entry/src/main/ets/test/lib/Const.js diff --git a/telephony/telephonyjstest/observer/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/observer/entry/src/main/resources/base/element/string.json index 03b8532c53ca563f8ed6b1e21d20ad3f67a68906..498677efbde065c36668727190d3613cbf278bfc 100644 --- a/telephony/telephonyjstest/observer/entry/src/main/resources/base/element/string.json +++ b/telephony/telephonyjstest/observer/entry/src/main/resources/base/element/string.json @@ -7,6 +7,14 @@ { "name": "description_mainability", "value": "ETS_Empty Ability" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" } ] } \ No newline at end of file diff --git a/telephony/telephonyjstest/radiostatistic/entry/src/main/config.json b/telephony/telephonyjstest/radiostatistic/entry/src/main/config.json index d24aaa70cea167135eb0cab2b714dae832154f22..e01aef3a0cca6c0d92f373668381dc586226d9a8 100644 --- a/telephony/telephonyjstest/radiostatistic/entry/src/main/config.json +++ b/telephony/telephonyjstest/radiostatistic/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath": "", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/telephony/telephonyjstest/sim/BUILD.gn b/telephony/telephonyjstest/sim/BUILD.gn index 5bea32bff631028b7d0d41241286d38bbbe2ed12..0e4d8d5a7b894bf46644cf5dd4f4b50627a152d6 100644 --- a/telephony/telephonyjstest/sim/BUILD.gn +++ b/telephony/telephonyjstest/sim/BUILD.gn @@ -9,7 +9,7 @@ # 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. +# limitations under the License. import("//build/ohos_var.gni") diff --git a/telephony/telephonyjstest/sim/sim_manager_function_test/src/main/config.json b/telephony/telephonyjstest/sim/sim_manager_function_test/src/main/config.json index 0217a2e1088e6c04079dba412f3f8bffe241afb7..6559ddf471371fa26bc5d48680f720bd0d709aed 100644 --- a/telephony/telephonyjstest/sim/sim_manager_function_test/src/main/config.json +++ b/telephony/telephonyjstest/sim/sim_manager_function_test/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { 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 77e8a0fe68fe6a2e5a6e5e502031ffd88e5d7bf1..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 @@ -52,6 +52,24 @@ describe('SimManagerTest', function () { } }); + it('Telephony_Sim_getDefaultVoiceSlotId_0100', 0, async function (done) { + sim.getDefaultVoiceSlotId((err, data) => { + expect(data === null).assertFalse(); + done(); + }); + }); + + it('Telephony_Sim_getDefaultVoiceSlotId_0200', 0, async function (done) { + let promise = sim.getDefaultVoiceSlotId(); + promise.then(data => { + expect(data === null).assertFalse(); + done(); + }).catch(err => { + expect(err === null).assertFalse(); + done(); + }); + }); + /** * @tc.number Telephony_Sim_constantValidate_0100 * @tc.name SIM card constant validation @@ -269,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(); }); }); @@ -289,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(); }); }); @@ -304,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; @@ -324,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; @@ -356,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; } @@ -377,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(); }); @@ -393,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; } @@ -417,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(); + }); + }); }) } diff --git a/telephony/telephonyjstest/sms_mms/sms_mms_error/src/main/config.json b/telephony/telephonyjstest/sms_mms/sms_mms_error/src/main/config.json index 9816c44e11eaf27efa5c496dbb5221cf1b384bf6..066a7d44838432654ee4d8bb793709afb8061007 100644 --- a/telephony/telephonyjstest/sms_mms/sms_mms_error/src/main/config.json +++ b/telephony/telephonyjstest/sms_mms/sms_mms_error/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": ".MainAbility", "srcPath":"", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/telephony/telephonyjstest/telephony_base/BUILD.gn b/telephony/telephonyjstest/telephony_base/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..47fca16a807049ab26e7c801c241474a000a7883 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/BUILD.gn @@ -0,0 +1,24 @@ +# 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") + +group("telephony_base") { + testonly = true + if (is_standard_system) { + deps = [ + "call_manager:ActsBaseCallManagerTest", + "cellular_data:ActsBaseCellularDataTest", + ] + } +} diff --git a/telephony/telephonyjstest/telephony_base/call_manager/BUILD.gn b/telephony/telephonyjstest/telephony_base/call_manager/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..f1e25461f6d8d407513e7bd965731a0415fc246f --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/BUILD.gn @@ -0,0 +1,35 @@ +# 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("ActsBaseCallManagerTest") { + hap_profile = "./src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsBaseCallManagerTest" + part_name = "netstack" + subsystem_name = "communication" +} +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/telephony/telephonyjstest/telephony_base/call_manager/Test.json b/telephony/telephonyjstest/telephony_base/call_manager/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..64833f5b04a31acb96910e1f64d542eda4254563 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Function test of sim manager interface", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "900000", + "bundle-name": "com.ohos.call_manager", + "package-name": "com.ohos.call_manager", + "shell-timeout": "900000" + }, + "kits": [ + { + "test-file-name": [ + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/telephony/telephonyjstest/telephony_base/call_manager/signature/openharmony_sx.p7b b/telephony/telephonyjstest/telephony_base/call_manager/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/telephony/telephonyjstest/telephony_base/call_manager/signature/openharmony_sx.p7b differ diff --git a/telephony/telephonyjstest/telephony_base/call_manager/src/main/config.json b/telephony/telephonyjstest/telephony_base/call_manager/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..2dbea302f35b151e44f20703bed22539b53206e6 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/src/main/config.json @@ -0,0 +1,141 @@ +{ + "app": { + "bundleName": "com.ohos.call_manager", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Release" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.call_manager", + "name": ".entry", + "mainAbility": ".MainAbility", + "srcPath":"", + "deviceType": [ + "default", + "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" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.LOCATION", + "reason": "need use ohos.permission.LOCATION" + }, + { + "name":"ohos.permission.SET_TELEPHONY_STATE", + "reason":"need use ohos.permission.SET_TELEPHONY_STATE" + }, + { + "name":"ohos.permission.GET_TELEPHONY_STATE", + "reason":"need use ohos.permission.GET_TELEPHONY_STATE" + }, + { + "name":"ohos.permission.PLACE_CALL", + "reason":"need use ohos.permission.PLACE_CALL" + }, + { + "name":"ohos.permission.READ_CONTACTS", + "reason":"need use ohos.permission.READ_CONTACTS" + }, + { + "name":"ohos.permission.WRITE_CONTACTS", + "reason":"need use ohos.permission.WRITE_CONTACTS" + }, + { + "name":"ohos.permission.SEND_MESSAGES", + "reason":"need use ohos.permission.SEND_MESSAGES" + }, + { + "name":"ohos.permission.RECEIVE_SMS", + "reason":"need use ohos.permission.RECEIVE_SMS" + }, + { + "name":"ohos.permission.READ_CALL_LOG", + "reason":"need use ohos.permission.READ_CALL_LOG" + }, + { + "name":"ohos.permission.GET_NETWORK_INFO", + "reason":"need use ohos.permission.GET_NETWORK_INFO" + }, + { + "name":"ohos.permission.INTERNET", + "reason":"need use ohos.permission.INTERNET" + } + ], + "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" + } + } +} \ No newline at end of file diff --git a/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/MainAbility/app.js b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/MainAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..7657258ed64c43d52aa1eb6d55d86dea9e812969 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/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('TestApplication onCreate'); + }, + onDestroy () { + console.info('TestApplication onDestroy'); + } +}; diff --git a/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/MainAbility/i18n/en-US.json b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/MainAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/MainAbility/i18n/zh-CN.json b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/MainAbility/pages/index/index.css b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/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/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/MainAbility/pages/index/index.hml b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..1761ec52614d15e232d2e5ba45299eff2b1179f9 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + SIM TEST + +
diff --git a/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/MainAbility/pages/index/index.js b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..51b16517bf634ec6b35c2299f96888242fea71ad --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,43 @@ +/* + * 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'; +import app from '@system.app'; +import device from '@system.device'; +import router from '@system.router'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../../../test/List.test' + +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!'); + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onReady () { + }, +}; \ No newline at end of file diff --git a/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/TestAbility/app.js b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/TestAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..065cded0a5f0da1c4f86460db4bd0b3445816805 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/TestAbility/app.js @@ -0,0 +1,23 @@ +/* + * 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('TestApplication onCreate'); + }, + onDestroy() { + console.info('TestApplication onDestroy'); + } +}; + diff --git a/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/TestAbility/i18n/en-US.json b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/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/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/TestAbility/i18n/zh-CN.json b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/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/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/TestAbility/pages/index/index.css b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b21c92c6290ea747bd891e2ab673721afc5521ed --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/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/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/TestAbility/pages/index/index.hml b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/TestAbility/pages/index/index.js b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d94b75c085fa1c16a0b2721609b18c57a7295476 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/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/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 0000000000000000000000000000000000000000..527be90a1240e77ba994eb71d2868331533bb464 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/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'] + '.MainAbility' + + 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/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/test/CallManagerTest.test.js b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/test/CallManagerTest.test.js new file mode 100644 index 0000000000000000000000000000000000000000..51c7119e5da016c9ff8a9108ce09e97a94b04a96 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/test/CallManagerTest.test.js @@ -0,0 +1,1147 @@ +/** + * 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 netConnection from '@ohos.net.connection'; +import call from '@ohos.telephony.call'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'; +export default function ActsBaseCallManagerTest() { + + + let net = netConnection.createNetConnection() + + class RejectMessageOptions { + constructor(str) { + this.messageContent = str; + } + } + + describe('CallManagerTest', function () { + const ERROR_CALLID_999 = 999; + const GETMAIN_CALLID_ERRO = -1; + const SLOT_0 = 0; + const ERR_SLOT_ID = -1; + const MORE_THAN_30_NUMBERS = ''; + const INVALID_NUMBER = ''; + const ACTIVATE_TRUE = true; + const ACTIVATE_FALSE = false; + const REJECT_MESSAGE_NUM = '1234567890123456789012345678901234567890'; + + /** + * @tc.number Telephony_CallManager_getCallState_Async_0100 + * @tc.name To get the idle call status, call getCallState() to get the current call status. + * call.CALL_STATE_IDLE is returned + * @tc.desc Function test + */ + it('Telephony_CallManager_getCallState_Async_0100', 0, async function (done) { + call.getCallState((err, data) => { + if (err) { + console.log(`Telephony_CallManager_getCallState_Async_0100 : err = ${err.message}`); + expect().assertFail(); + done(); + return; + } + expect(data === call.CALL_STATE_IDLE).assertTrue(); + console.log(`Telephony_CallManager_getCallState_Async_0100 finish data = ${data}`); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_getCallState_Promise_0100 + * @tc.name To get the idle call status, call getCallState() to get the current call status. + * call.CALL_STATE_IDLE is returned + * @tc.desc Function test + */ + it('Telephony_CallManager_getCallState_Promise_0100', 0, async function (done) { + try { + var data = await call.getCallState(); + expect(data === call.CALL_STATE_IDLE).assertTrue(); + console.log(`Telephony_CallManager_getCallState_Promise_0100 finish data = ${data}`); + done(); + } catch (err) { + console.log(`Telephony_CallManager_getCallState_Promise_0100 : err = ${err.message}`); + expect().assertFail(); + done(); + + } + }); + + + /** + * @tc.number Telephony_CallManager_hasCall_Async_0400 + * @tc.name When idle, hasCall() is called to confirm that there is no current call,returning false + * @tc.desc Function test + */ + it('Telephony_CallManager_hasCall_Async_0400', 0, async function (done) { + call.hasCall((err, data) => { + if (err) { + console.log('Telephony_CallManager_hasCall_Async_0400 fail'); + expect().assertFail(); + done(); + return; + } + expect(data === false).assertTrue(); + console.log(`Telephony_CallManager_hasCall_Async_0400 finish data = ${data}`); + done(); + }); + }); + + + /** + * @tc.number Telephony_CallManager_hasCall_Promise_0400 + * @tc.name When idle, hasCall() is called to confirm that there is no current call, returning false + * @tc.desc Function test + */ + it('Telephony_CallManager_hasCall_Promise_0400', 0, async function (done) { + try { + var data = await call.hasCall(); + expect(data === false).assertTrue(); + console.log(`Telephony_CallManager_hasCall_Promise_0400 finish data = ${data}`); + done(); + } catch (err) { + console.log('Telephony_CallManager_hasCall_Promise_0400 fail'); + expect().assertFail(); + done(); + + } + }); + + + /** + * @tc.number Telephony_CallManager_startDTMF_Async_1000 + * @tc.name CallId is 999, character is C, startDTMF() is called as a callback to startDTMF and capture err + * @tc.desc Function test + */ + it('Telephony_CallManager_startDTMF_Async_1000', 0, async function (done) { + call.startDTMF(ERROR_CALLID_999, 'C', (err) => { + if (err) { + console.log(`Telephony_CallManager_startDTMF_Async_1000 finish err = ${err.message}`); + done(); + return; + } + expect().assertFail(); + console.log('Telephony_CallManager_startDTMF_Async_1000 fail'); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumber_Async_0100 + * @tc.name PhoneNumber is 100000000000. Call formatPhoneNumber() to format the number. + * The return value is 10 000 000 0000 + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumber_Async_0100', 0, async function (done) { + call.formatPhoneNumber('100000000000', (err, data) => { + if (err) { + console.log(`Telephony_CallManager_formatPhoneNumber_Async_0100 err = ${err.message}`); + console.log('Telephony_CallManager_formatPhoneNumber_Async_0100 fail'); + expect().assertFail(); + done(); + return; + } + expect(data === '10 000 000 0000').assertTrue(); + console.log(`Telephony_CallManager_formatPhoneNumber_Async_0100 finish data = ${data}`); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumber_Async_0200 + * @tc.name If phoneNumber is 10 000 000 0000, options: CN, call formatPhoneNumber() to format the number, + * and capture err + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumber_Async_0200', 0, async function (done) { + call.formatPhoneNumber('10 000 000 0000', { + countryCode: 'CN' + }, (err, data) => { + if (err) { + console.log(`Telephony_CallManager_formatPhoneNumber_Async_0200 finish = ${err.message}`); + done(); + return; + } + expect().assertFail(); + console.log('Telephony_CallManager_formatPhoneNumber_Async_0200 fail'); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumber_Async_0300 + * @tc.name If phoneNumber is (010)00000000, options: CN, call formatPhoneNumber() to format the number, + * return the value 010 0000 0000 + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumber_Async_0300', 0, async function (done) { + call.formatPhoneNumber('(010)00000000', { + countryCode: 'CN' + }, (err, data) => { + if (err) { + console.log('Telephony_CallManager_formatPhoneNumber_Async_0300 fail'); + expect().assertFail(); + done(); + return; + } + expect(data === '010 0000 0000').assertTrue(); + console.log(`Telephony_CallManager_formatPhoneNumber_Async_0300 finish data : ${data}`); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumber_Async_0400 + * @tc.name PhoneNumber is 010-0000-0000, options: CN, call formatPhoneNumber() to format the number, + * return 010 0000 0000 + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumber_Async_0400', 0, async function (done) { + call.formatPhoneNumber('010-0000-0000', { + countryCode: 'CN' + }, (err, data) => { + if (err) { + console.log('Telephony_CallManager_formatPhoneNumber_Async_0400 fail'); + expect().assertFail(); + done(); + return; + } + expect(data === '010 0000 0000').assertTrue(); + console.log(`Telephony_CallManager_formatPhoneNumber_Async_0400 finish data : ${data}`); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumber_Async_0500 + * @tc.name PhoneNumber 666666999999 is not supported in the current country. Options: CN. Call + * formatPhoneNumber() to format the number and capture err + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumber_Async_0500', 0, async function (done) { + call.formatPhoneNumber('666666999999', { + countryCode: 'CN' + }, (err) => { + if (err) { + console.log(`Telephony_CallManager_formatPhoneNumber_Async_0500 finish err = ${err.message}`); + done(); + return; + } + console.log('Telephony_CallManager_formatPhoneNumber_Async_0500 fail'); + expect().assertFail(); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumber_Async_0600 + * @tc.name If phoneNumber is 2000000000, type non-existent options: abCDFG. Call + * formatPhoneNumber() to format the number and capture err + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumber_Async_0600', 0, async function (done) { + call.formatPhoneNumber('2000000000', { + countryCode: 'abcdefg' + }, (err) => { + if (err) { + console.log(`Telephony_CallManager_formatPhoneNumber_Async_0600 finish err = ${err.message}`); + done(); + return; + } + expect().assertFail(); + console.log('Telephony_CallManager_formatPhoneNumber_Async_0600 fail'); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumber_Async_0700 + * @tc.name If phoneNumber is 2000000000, options: ', call formatPhoneNumber() to + * format the number and catch err + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumber_Async_0700', 0, async function (done) { + call.formatPhoneNumber('2000000000', { + countryCode: '' + }, (err) => { + if (err) { + console.log(`Telephony_CallManager_formatPhoneNumber_Async_0700 finish err = ${err.message}`); + done(); + return; + } + expect().assertFail(); + console.log('Telephony_CallManager_formatPhoneNumber_Async_0700 fail'); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumber_Promise_0100 + * @tc.name PhoneNumber is 2000000. Call formatPhoneNumber() to format the number. + * The return value is 200 0000 + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumber_Promise_0100', 0, async function (done) { + try { + var data = await call.formatPhoneNumber('2000000'); + expect(data === '200 0000').assertTrue(); + console.log(`Telephony_CallManager_formatPhoneNumber_Promise_0100 finish data = ${data}`); + done(); + } catch (err) { + console.log('Telephony_CallManager_formatPhoneNumber_Promise_0100 fail'); + expect().assertFail(); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumber_Promise_0200 + * @tc.name PhoneNumber is 010-100-0000, options: CN, call formatPhoneNumber() to format the number, err + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumber_Promise_0200', 0, async function (done) { + try { + await call.formatPhoneNumber('010-100-0000', { + countryCode: 'CN' + }); + expect().assertFail(); + console.log('Telephony_CallManager_formatPhoneNumber_Promise_0200 fail'); + done(); + } catch (err) { + console.log(`Telephony_CallManager_formatPhoneNumber_Promise_0200 finish err = ${err}`); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumber_Promise_0300 + * @tc.name PhoneNumber: (010)00000000, options: CN, call formatPhoneNumber() to format the number, + * return the value 010 0000 0000 + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumber_Promise_0300', 0, async function (done) { + try { + var data = await call.formatPhoneNumber('(010)00000000', { + countryCode: 'CN' + }); + expect(data === '010 0000 0000').assertTrue(); + console.log(`Telephony_CallManager_formatPhoneNumber_Promise_0300 finish data = ${data}`); + done(); + } catch (err) { + console.log('Telephony_CallManager_formatPhoneNumber_Promise_0300 fail'); + expect().assertFail(); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumber_Promise_0400 + * @tc.name If phoneNumber is 200-0000, options: CN, call formatPhoneNumber() to format the + * number and return 200 0000 + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumber_Promise_0400', 0, async function (done) { + try { + var data = await call.formatPhoneNumber('200-0000', { + countryCode: 'CN' + }); + expect(data === '200 0000').assertTrue(); + console.log(`Telephony_CallManager_formatPhoneNumber_Promise_0400 finish data = ${data}`); + done(); + } catch (err) { + console.log('Telephony_CallManager_formatPhoneNumber_Promise_0400 fail'); + expect().assertFail(); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumber_Promise_0500 + * @tc.name PhoneNumber 666666999999 is not supported in the current country. Options: CN. Call + * formatPhoneNumber() to format the number and capture err + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumber_Promise_0500', 0, async function (done) { + try { + await call.formatPhoneNumber('666666999999', { + countryCode: 'CN' + }); + console.log('Telephony_CallManager_formatPhoneNumber_Promise_0500 fail'); + expect().assertFail(); + done(); + return; + } catch (err) { + console.log(`Telephony_CallManager_formatPhoneNumber_Promise_0500 finish err = ${err.message}`); + done(); + } + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumber_Promise_0600 + * @tc.name If phoneNumber is 20000000, enter non-existent options: abCDFG and call + * formatPhoneNumber() to format the number and capture err + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumber_Promise_0600', 0, async function (done) { + try { + await call.formatPhoneNumber('20000000', { + countryCode: 'abcdefg' + }); + expect().assertFail(); + console.log('Telephony_CallManager_formatPhoneNumber_Promise_0600 fail'); + done(); + return; + } catch (err) { + console.log(`Telephony_CallManager_formatPhoneNumber_Promise_0600 finish err = ${err.message}`); + done(); + } + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumber_Promise_0700 + * @tc.name If phoneNumber is 20000000, options: , call formatPhoneNumber() to format the number and catch err + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumber_Promise_0700', 0, async function (done) { + try { + var data = await call.formatPhoneNumber('20000000', { + countryCode: '' + }); + expect().assertFail(); + console.log('Telephony_CallManager_formatPhoneNumber_Promise_0700 fail'); + done(); + return; + } catch (err) { + console.log(`Telephony_CallManager_formatPhoneNumber_Promise_0700 finish err = ${err.message}`); + done(); + } + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Async_0100 + * @tc.name PhoneNumber is 010-0000-0000, options: CN, call formatPhoneNumberToE164() to format the number, + * and return +861000000000 + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumberToE164_Async_0100', 0, async function (done) { + call.formatPhoneNumberToE164('010-0000-0000', 'CN', (err, data) => { + if (err) { + console.log('Telephony_CallManager_formatPhoneNumberToE164_Async_0100 fail'); + expect().assertFail(); + done(); + return; + } + expect(data === '+861000000000').assertTrue(); + console.log(`Telephony_CallManager_formatPhoneNumberToE164_Async_0100 finish data = ${data}`); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Async_0200 + * @tc.name If phoneNumber is (010)00000000, options: CN, call formatPhoneNumberToE164() to format the number, + * return +861000000000 + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumberToE164_Async_0200', 0, async function (done) { + call.formatPhoneNumberToE164('(010)00000000', 'CN', (err, data) => { + if (err) { + console.log('Telephony_CallManager_formatPhoneNumberToE164_Async_0200 fail'); + expect().assertFail(); + done(); + return; + } + expect(data === '+861000000000').assertTrue(); + console.log(`Telephony_CallManager_formatPhoneNumberToE164_Async_0200 finish data = ${data}`); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Async_0300 + * @tc.name If phoneNumber is 01000000000, options: CN, call formatPhoneNumberToE164() to format the number, + * and return +861000000000 + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumberToE164_Async_0300', 0, async function (done) { + call.formatPhoneNumberToE164('01000000000', 'CN', (err, data) => { + if (err) { + console.log('Telephony_CallManager_formatPhoneNumberToE164_Async_0300 fail'); + expect().assertFail(); + done(); + return; + } + expect(data === '+861000000000').assertTrue(); + console.log(`Telephony_CallManager_formatPhoneNumberToE164_Async_0300 finish data = ${data}`); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Async_0400 + * @tc.name PhoneNumber 666666999999 is not supported in the current country. Options: CN. Call + * formatPhoneNumberToE164() to format the number and capture err + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumberToE164_Async_0400', 0, async function (done) { + call.formatPhoneNumberToE164('666666999999', 'CN', (err) => { + if (err) { + console.log(`Telephony_CallManager_formatPhoneNumberToE164_Async_0400 finish err = ${err.message}`); + done(); + return; + } + console.log('Telephony_CallManager_formatPhoneNumberToE164_Async_0400 fail'); + expect().assertFail(); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Async_0500 + * @tc.name If phoneNumber is 01000000000, type non-existent options: abCDFG. Call formatPhoneNumberToE164() + * to format the number and capture err + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumberToE164_Async_0500', 0, async function (done) { + call.formatPhoneNumberToE164('01000000000', 'abcdfg', (err) => { + if (err) { + console.log(`Telephony_CallManager_formatPhoneNumberToE164_Async_0500 finish err = ${err.message}`); + done(); + return; + } + expect().assertFail(); + console.log('Telephony_CallManager_formatPhoneNumberToE164_Async_0500 fail'); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Async_0600 + * @tc.name If phoneNumber is 01000000000, options: ', call formatPhoneNumberToE164() to + * format the number and catch err + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumberToE164_Async_0600', 0, async function (done) { + call.formatPhoneNumberToE164('01000000000', '', (err) => { + if (err) { + console.log(`Telephony_CallManager_formatPhoneNumberToE164_Async_0600 finish err = ${err.message}`); + done(); + return; + } + expect().assertFail(); + console.log('Telephony_CallManager_formatPhoneNumberToE164_Async_0600 fail'); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Promise_0100 + * @tc.name PhoneNumber is 52300000000, options: CN, call formatPhoneNumberToE164() to format the number, + * return +8652300000000 + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumberToE164_Promise_0100', 0, async function (done) { + try { + var data = await call.formatPhoneNumberToE164('52300000000', 'CN'); + expect(data === '+8652300000000').assertTrue(); + console.log(`Telephony_CallManager_formatPhoneNumberToE164_Promise_0100 finish data = ${data}`); + done(); + } catch (err) { + console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0100 fail'); + expect().assertFail(); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Promise_0200 + * @tc.name If phoneNumber is (523)00000000, options: CN, call formatPhoneNumberToE164() to format the number, + * return +8652300000000 + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumberToE164_Promise_0200', 0, async function (done) { + console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0200 running'); + try { + var data = await call.formatPhoneNumberToE164('(523)00000000', 'CN'); + expect(data === '+8652300000000').assertTrue(); + console.log(`Telephony_CallManager_formatPhoneNumberToE164_Promise_0200 finish data = ${data}`); + done(); + } catch (err) { + console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0200 fail'); + expect().assertFail(); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Promise_0300 + * @tc.name PhoneNumber is 523-0000-0000, options: CN. Call formatPhoneNumberToE164() to format the number. + * +8652300000000 is returned + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumberToE164_Promise_0300', 0, async function (done) { + try { + var data = await call.formatPhoneNumberToE164('523-0000-0000', 'CN'); + expect(data === '+8652300000000').assertTrue(); + console.log(`Telephony_CallManager_formatPhoneNumberToE164_Promise_0300 finish data = ${data}`); + done(); + } catch (err) { + console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0300 fail'); + expect().assertFail(); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Promise_0400 + * @tc.name Currently, phoneNumber is 999999, options: CN. Call formatPhoneNumberToE164() to + * format the number and capture err + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumberToE164_Promise_0400', 0, async function (done) { + try { + await call.formatPhoneNumberToE164('999999', 'CN'); + console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0400 fail'); + expect().assertFail(); + done(); + } catch (err) { + console.log(`Telephony_CallManager_formatPhoneNumberToE164_Promise_0400 finish err = ${err.message}`); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Promise_0500 + * @tc.name PhoneNumber is 52300000000. Type non-existent options: abCDFG. Call formatPhoneNumberToE164() to + * format the number and capture err + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumberToE164_Promise_0500', 0, async function (done) { + try { + await call.formatPhoneNumberToE164('52300000000', 'abcdefg'); + console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0500 fail'); + expect().assertFail(); + done(); + } catch (err) { + console.log(`Telephony_CallManager_formatPhoneNumberToE164_Promise_0500 finish err = ${err.message}`); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_formatPhoneNumberToE164_Promise_0600 + * @tc.name If phoneNumber is 52300000000, options: ', call formatPhoneNumberToE164() + * to format the number and catch err + * @tc.desc Function test + */ + it('Telephony_CallManager_formatPhoneNumberToE164_Promise_0600', 0, async function (done) { + try { + await call.formatPhoneNumberToE164('52300000000', ''); + expect().assertFail(); + console.log('Telephony_CallManager_formatPhoneNumberToE164_Promise_0600 fail'); + done(); + } catch (err) { + console.log(`Telephony_CallManager_formatPhoneNumberToE164_Promise_0600 finish err = ${err.message}`); + done(); + + } + }); + + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_0100 + * @tc.name PhoneNumber: 0+0+0, options is 1. Call isEmergencyPhoneNumber() to check whether it is an + * emergency number. The return value is false + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Async_0100', 0, async function (done) { + call.isEmergencyPhoneNumber('0+0+0', { + slotId: SLOT_0 + }, (err, data) => { + if (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_0100 fail'); + expect().assertFail(); + done(); + return; + } + expect(data === false).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_0100 finish data = ${data}`); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_0200 + * @tc.name PhoneNumber: INVALID_NUMBER, options 1. Call isEmergencyPhoneNumber() to check whether it is an + * emergency number. The return value is false + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Async_0200', 0, async function (done) { + call.isEmergencyPhoneNumber(INVALID_NUMBER, { + slotId: SLOT_0 + }, (err, data) => { + if (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_0200 fail'); + expect().assertFail(); + done(); + return; + } + expect(data === false).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_0200 finish data = ${data}`); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_0300 + * @tc.name PhoneNumber: 000, options 1. Call isEmergencyPhoneNumber() to check whether it is an emergency number + * The return value is true + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Async_0300', 0, async function (done) { + call.isEmergencyPhoneNumber('000', { + slotId: SLOT_0 + }, (err, data) => { + if (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_0300 fail'); + expect().assertFail(); + done(); + return; + } + expect(data).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_0300 finish data = ${data}`); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_0400 + * @tc.name PhoneNumber: 112 with options 1. Call isEmergencyPhoneNumber() to verify whether it is an emergency + * number. The return value is true + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Async_0400', 0, async function (done) { + call.isEmergencyPhoneNumber('112', { + slotId: SLOT_0 + }, (err, data) => { + if (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_0400 fail'); + expect().assertFail(); + done(); + return; + } + expect(data).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_0400 finish data = ${data}`); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_0500 + * @tc.name PhoneNumber: 911, options are 1. Call isEmergencyPhoneNumber() to check whether it is an emergency + * number. The return value is true + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Async_0500', 0, async function (done) { + call.isEmergencyPhoneNumber('911', { + slotId: SLOT_0 + }, (err, data) => { + if (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_0500 fail'); + expect().assertFail(); + done(); + return; + } + expect(data).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_0500 finish data = ${data}`); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_0600 + * @tc.name PhoneNumber: 08 with options 1. Call isEmergencyPhoneNumber() to check whether it is an emergency + * number. The return value is true + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Async_0600', 0, async function (done) { + call.isEmergencyPhoneNumber('08', { + slotId: SLOT_0 + }, (err, data) => { + if (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_0600 fail'); + expect().assertFail(); + done(); + return; + } + expect(data).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_0600 finish data = ${data}`); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_0700 + * @tc.name PhoneNumber: 118, options 1. Call isEmergencyPhoneNumber() to check whether it is an emergency + * number. The return value is true + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Async_0700', 0, async function (done) { + call.isEmergencyPhoneNumber('118', { + slotId: SLOT_0 + }, (err, data) => { + if (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_0700 fail'); + expect().assertFail(); + done(); + return; + } + expect(data).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_0700 finish data = ${data}`); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_0800 + * @tc.name PhoneNumber: 999 with options 1. Call isEmergencyPhoneNumber() to check whether it is an emergency + * number. The return value is true + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Async_0800', 0, async function (done) { + call.isEmergencyPhoneNumber('999', { + slotId: SLOT_0 + }, (err, data) => { + if (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_0800 fail'); + expect().assertFail(); + done(); + return; + } + expect(data).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_0800 finish data = ${data}`); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_0900 + * @tc.name PhoneNumber: 119. Call isEmergencyPhoneNumber() to determine whether it is an emergency number. + * The return value is true + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Async_0900', 0, async function (done) { + call.isEmergencyPhoneNumber('119', { + slotId: SLOT_0 + }, (err, data) => { + if (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_0900 fail'); + expect().assertFail(); + done(); + return; + } + expect(data).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_0900 finish data = ${data}`); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_1000 + * @tc.name PhoneNumber: 110, isEmergencyPhoneNumber() is called back to determine whether it is an emergency + * number, returning true + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Async_1000', 0, async function (done) { + call.isEmergencyPhoneNumber('110', { + slotId: SLOT_0 + }, (err, data) => { + if (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_1000 fail'); + expect().assertFail(); + done(); + return; + } + expect(data).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_1000 finish data = ${data}`); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Async_1300 + * @tc.name PhoneNumber: 110, options -1. Call isEmergencyPhoneNumber() to check whether it is an emergency + * number. The return value is false + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Async_1300', 0, async function (done) { + call.isEmergencyPhoneNumber('110', { + slotId: ERR_SLOT_ID + }, (err) => { + if (err) { + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Async_1300 finish err = ${err}`); + done(); + return; + } + expect().assertFail(); + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Async_1300 fail '); + done(); + }); + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Promise_0100 + * @tc.name PhoneNumber: 0+0+0, options is 1. Call isEmergencyPhoneNumber() to check whether it is an emergency + * number. The return value is false + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0100', 0, async function (done) { + try { + var data = await call.isEmergencyPhoneNumber('0+0+0', { + slotId: SLOT_0 + }); + expect(data === false).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Promise_0100 finish data = ${data}`); + done(); + } catch (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0100 fail'); + expect().assertFail(); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Promise_0200 + * @tc.name PhoneNumber: INVALID_NUMBER, options 1. Call isEmergencyPhoneNumber() to check whether it is an + * emergency number. The return value is false + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0200', 0, async function (done) { + try { + var data = await call.isEmergencyPhoneNumber('INVALID_NUMBER', { + slotId: SLOT_0 + }); + expect(data === false).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Promise_0200 finish data = ${data}`); + done(); + } catch (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0200 fail'); + expect().assertFail(); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Promise_0300 + * @tc.name PhoneNumber: 000 with options 1. Call isEmergencyPhoneNumber() to check whether it is an emergency + * number. The return value is true + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0300', 0, async function (done) { + try { + var data = await call.isEmergencyPhoneNumber('000', { + slotId: SLOT_0 + }); + expect(data).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Promise_0300 finish data = ${data}`); + done(); + } catch (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0300 fail'); + expect().assertFail(); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Promise_0400 + * @tc.name PhoneNumber: 112 with options 1. Call isEmergencyPhoneNumber() to check whether it is an emergency + * number. The return value is true + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0400', 0, async function (done) { + try { + var data = await call.isEmergencyPhoneNumber('112', { + slotId: SLOT_0 + }); + expect(data).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Promise_0400 finish data = ${data}`); + done(); + } catch (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0400 fail'); + expect().assertFail(); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Promise_0500 + * @tc.name PhoneNumber: 911 with options 1. Call isEmergencyPhoneNumber() to check whether it is an emergency + * number. The return value is true + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0500', 0, async function (done) { + try { + var data = await call.isEmergencyPhoneNumber('911', { + slotId: SLOT_0 + }); + expect(data).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Promise_0500 finish data = ${data}`); + done(); + } catch (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0500 fail'); + expect().assertFail(); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Promise_0600 + * @tc.name PhoneNumber: 08. If options are 1, call isEmergencyPhoneNumber() to check whether it is an + * emergency number. The return value is true + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0600', 0, async function (done) { + try { + var data = await call.isEmergencyPhoneNumber('08', { + slotId: SLOT_0 + }); + expect(data).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Promise_0600 finish data = ${data}`); + done(); + } catch (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0600 fail'); + expect().assertFail(); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Promise_0700 + * @tc.name PhoneNumber: 118 with options 1. Call isEmergencyPhoneNumber() to check whether it is an emergency + * number. The return value is true + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0700', 0, async function (done) { + try { + var data = await call.isEmergencyPhoneNumber('118', { + slotId: SLOT_0 + }); + expect(data).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Promise_0700 finish data = ${data}`); + done(); + } catch (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0700 fail'); + expect().assertFail(); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Promise_0800 + * @tc.name PhoneNumber: 999 with options 1. Call isEmergencyPhoneNumber() to check whether it is an emergency + * number. The return value is true + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0800', 0, async function (done) { + try { + var data = await call.isEmergencyPhoneNumber('999', { + slotId: SLOT_0 + }); + expect(data).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Promise_0800 finish data = ${data}`); + done(); + } catch (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_0800 fail'); + expect().assertFail(); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Promise_1100 + * @tc.name PhoneNumber: 119 with options 1. Call isEmergencyPhoneNumber() to check whether it is an emergency + * number. The return value is true + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1100', 0, async function (done) { + try { + var data = await call.isEmergencyPhoneNumber('119'); + expect(data).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Promise_1100 finish data = ${data}`); + done(); + } catch (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1100 fail'); + expect().assertFail(); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Promise_1200 + * @tc.name PhoneNumber: 110 with options 1. Call isEmergencyPhoneNumber() to check whether it is an emergency + * number. The return value is true + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1200', 0, async function (done) { + try { + var data = await call.isEmergencyPhoneNumber('110'); + expect(data).assertTrue(); + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Promise_1200 finish data = ${data}`); + done(); + } catch (err) { + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1200 fail'); + expect().assertFail(); + done(); + + } + }); + + /** + * @tc.number Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300 + * @tc.name PhoneNumber: 120, options -1. Call isEmergencyPhoneNumber() to check whether it is an emergency + * number. The return value is false + * @tc.desc Function test + */ + it('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300', 0, async function (done) { + try { + var data = await call.isEmergencyPhoneNumber('120', { + slotId: ERR_SLOT_ID + }); + expect().assertFail(); + console.log('Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300 fail '); + done(); + } catch (err) { + console.log(`Telephony_CallManager_isEmergencyPhoneNumber_Promise_1300 finish err = ${err}`); + done(); + } + }); + }); +} diff --git a/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/test/List.test.js b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..0066bb05aa44dcee8a8039ab1610a3332736d458 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/src/main/js/test/List.test.js @@ -0,0 +1,20 @@ +/* + * 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 CallManagerTest from './CallManagerTest.test.js' + +export default function testsuite() { + CallManagerTest(); +} \ No newline at end of file diff --git a/telephony/telephonyjstest/telephony_base/call_manager/src/main/resources/base/element/string.json b/telephony/telephonyjstest/telephony_base/call_manager/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d51fd51ba91957ec1c986cfd99d00655c80c65fc --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/call_manager/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Sim Test" + }, + { + "name": "mainability_description", + "value": "Sim Test - sim manager interface test" + }, + { + "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/telephony/telephonyjstest/telephony_base/call_manager/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/telephony_base/call_manager/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/telephony/telephonyjstest/telephony_base/call_manager/src/main/resources/base/media/icon.png differ diff --git a/telephony/telephonyjstest/telephony_base/cellular_data/BUILD.gn b/telephony/telephonyjstest/telephony_base/cellular_data/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..7e056807de7e36795161e3c23d6d18b98283740c --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/BUILD.gn @@ -0,0 +1,35 @@ +# 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("ActsBaseCellularDataTest") { + hap_profile = "./src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsBaseCellularDataTest" + part_name = "netmanager_ext" + subsystem_name = "communication" +} +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/telephony/telephonyjstest/telephony_base/cellular_data/Test.json b/telephony/telephonyjstest/telephony_base/cellular_data/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..4f675dc28ca9435a9fe7a8fa70d2cbab4ffe9314 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/Test.json @@ -0,0 +1,20 @@ +{ + "description": "Function test of sim manager interface", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "900000", + "bundle-name": "com.ohos.cellular_data", + "package-name": "com.ohos.cellular_data", + "shell-timeout": "900000", + "testcase-timeout": "30000" + }, + "kits": [ + { + "test-file-name": [ + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/telephony/telephonyjstest/telephony_base/cellular_data/signature/openharmony_sx.p7b b/telephony/telephonyjstest/telephony_base/cellular_data/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/telephony/telephonyjstest/telephony_base/cellular_data/signature/openharmony_sx.p7b differ diff --git a/telephony/telephonyjstest/telephony_base/cellular_data/src/main/config.json b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..d383686754f70ed93d5fce8b4ced8408be4a9ab5 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/config.json @@ -0,0 +1,141 @@ +{ + "app": { + "bundleName": "com.ohos.cellular_data", + "vendor": "ohos", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Release" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.ohos.cellular_data", + "name": ".entry", + "mainAbility": ".MainAbility", + "srcPath":"", + "deviceType": [ + "default", + "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" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.LOCATION", + "reason": "need use ohos.permission.LOCATION" + }, + { + "name":"ohos.permission.SET_TELEPHONY_STATE", + "reason":"need use ohos.permission.SET_TELEPHONY_STATE" + }, + { + "name":"ohos.permission.GET_TELEPHONY_STATE", + "reason":"need use ohos.permission.GET_TELEPHONY_STATE" + }, + { + "name":"ohos.permission.PLACE_CALL", + "reason":"need use ohos.permission.PLACE_CALL" + }, + { + "name":"ohos.permission.READ_CONTACTS", + "reason":"need use ohos.permission.READ_CONTACTS" + }, + { + "name":"ohos.permission.WRITE_CONTACTS", + "reason":"need use ohos.permission.WRITE_CONTACTS" + }, + { + "name":"ohos.permission.SEND_MESSAGES", + "reason":"need use ohos.permission.SEND_MESSAGES" + }, + { + "name":"ohos.permission.RECEIVE_SMS", + "reason":"need use ohos.permission.RECEIVE_SMS" + }, + { + "name":"ohos.permission.READ_CALL_LOG", + "reason":"need use ohos.permission.READ_CALL_LOG" + }, + { + "name":"ohos.permission.GET_NETWORK_INFO", + "reason":"need use ohos.permission.GET_NETWORK_INFO" + }, + { + "name":"ohos.permission.INTERNET", + "reason":"need use ohos.permission.INTERNET" + } + ], + "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" + } + } +} \ No newline at end of file diff --git a/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/MainAbility/app.js b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/MainAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..a54db6874b44e7914f7245bea8349188b1a8347c --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/MainAbility/app.js @@ -0,0 +1,23 @@ +/* + * 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('TestApplication onCreate') + + }, + onDestroy() { + console.info("TestApplication onDestroy"); + } +}; \ No newline at end of file diff --git a/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/MainAbility/i18n/en-US.json b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/MainAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/MainAbility/i18n/en-US.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + }, + "Files": { + } +} \ No newline at end of file diff --git a/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/MainAbility/i18n/zh-CN.json b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/MainAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/MainAbility/i18n/zh-CN.json @@ -0,0 +1,8 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + }, + "Files": { + } +} \ No newline at end of file diff --git a/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/MainAbility/pages/index/index.css b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/MainAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/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/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/MainAbility/pages/index/index.hml b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/MainAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..1761ec52614d15e232d2e5ba45299eff2b1179f9 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/MainAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + SIM TEST + +
diff --git a/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/MainAbility/pages/index/index.js b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/MainAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..51b16517bf634ec6b35c2299f96888242fea71ad --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/MainAbility/pages/index/index.js @@ -0,0 +1,43 @@ +/* + * 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'; +import app from '@system.app'; +import device from '@system.device'; +import router from '@system.router'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../../../test/List.test' + +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!'); + var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onReady () { + }, +}; \ No newline at end of file diff --git a/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/TestAbility/app.js b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/TestAbility/app.js new file mode 100644 index 0000000000000000000000000000000000000000..065cded0a5f0da1c4f86460db4bd0b3445816805 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/TestAbility/app.js @@ -0,0 +1,23 @@ +/* + * 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('TestApplication onCreate'); + }, + onDestroy() { + console.info('TestApplication onDestroy'); + } +}; + diff --git a/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/TestAbility/i18n/en-US.json b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/TestAbility/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..55561b83737c3c31d082fbfa11e5fc987a351104 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/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/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/TestAbility/i18n/zh-CN.json b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/TestAbility/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..cce1af06761a42add0cac1a0567aa3237eda8cb4 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/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/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/TestAbility/pages/index/index.css b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/TestAbility/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..b21c92c6290ea747bd891e2ab673721afc5521ed --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/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/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/TestAbility/pages/index/index.hml b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/TestAbility/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/TestAbility/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/TestAbility/pages/index/index.js b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/TestAbility/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d94b75c085fa1c16a0b2721609b18c57a7295476 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/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/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/TestRunner/OpenHarmonyTestRunner.js b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/TestRunner/OpenHarmonyTestRunner.js new file mode 100644 index 0000000000000000000000000000000000000000..527be90a1240e77ba994eb71d2868331533bb464 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/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'] + '.MainAbility' + + 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/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/test/List.test.js b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..97c4850a72a674caaea155c61d2995b82c074875 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/test/List.test.js @@ -0,0 +1,20 @@ +/* + * 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 PdpProfileDataStorageFunction from './PdpProfileDataStorageFunction.test.js' + +export default function testsuite() { + PdpProfileDataStorageFunction(); +} \ No newline at end of file diff --git a/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/test/PdpProfileDataStorageFunction.test.js b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/test/PdpProfileDataStorageFunction.test.js new file mode 100644 index 0000000000000000000000000000000000000000..09e9af85f716519dac8e0f1e37f0511cba8b3150 --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/js/test/PdpProfileDataStorageFunction.test.js @@ -0,0 +1,171 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility'; +import ohosDataAbility from '@ohos.data.dataAbility'; +import { describe, beforeAll, beforeEach, afterAll, it, expect } from "@ohos/hypium"; +export default function ActsBaseCellularDataTest() { + + var inItialState = false; + const time = 2000; + + const pdpprofileabilityUrl = "dataability:///com.ohos.pdpprofileability"; + const pdpProfileUri = "net/pdp_profile"; + const pdpProfileFullUri = pdpprofileabilityUrl + '/' + pdpProfileUri; + const dataAbilityHelper = featureAbility.acquireDataAbilityHelper(pdpprofileabilityUrl); + + describe("TelephonyCellularDataFunction", function () { + const sleep = (time) => { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve(); + }, time); + }) + }; + + beforeAll(function () { + let stringValue = { + profile_Name: "test_profile_name", + mcc: "460", + mnc: "91" + }; + dataAbilityHelper.insert(pdpProfileFullUri, stringValue).then(data => { + console.log(`Telephony_DataStorage_beforeAll success, insetId=${data}`); + expect(data > 0).assertTrue(); + }).catch(error => { + expect().assertFail(); + console.log("Telephony_DataStorage_beforeAll failed"); + done(); + }); + }) + + beforeEach(function () { + }) + + afterAll(function () { + var condition = new ohosDataAbility.DataAbilityPredicates(); + condition.equalTo("profile_name", "test_profile_name"); + dataAbilityHelper.delete(pdpProfileFullUri, condition).then(data => { + console.log("Telephony_DataStorage_PdpProfile_afterAll: delete success data: " + JSON.stringify(data)); + expect(data === 0).assertTrue(); + }).catch(error => { + expect().assertFail(); + console.log("Telephony_DataStorage_PdpProfile_afterAll failed"); + done(); + }); + }) + + /* + * @tc.number Telephony_DataStorage_InsetIntoPdpProfile_Async_0100 + * @tc.name Insert into pdpProfile database + * @tc.desc Function test + */ + it("Telephony_DataStorage_PdpProfile_Insert_Async_0100", 0, async function (done) { + let stringValue = { + profile_Name: "test_profile_name", + mcc: "460", + mnc: "91" + }; + dataAbilityHelper.insert(pdpProfileFullUri, stringValue).then(data => { + console.log(`Telephony_DataStorage_InsetIntoPdpProfile_Async_0100 success, insertId=${data}`); + expect(data > 0).assertTrue(); + done(); + }).catch(error => { + expect().assertFail(); + console.log("Telephony_DataStorage_InsetIntoPdpProfile_Async_0100 failed"); + done(); + }); + }) + + /* + * @tc.number Telephony_DataStorage_PdpProfile_Query_Async_0100 + * @tc.name query from pdpProfile database + * @tc.desc Function test + */ + it("Telephony_DataStorage_PdpProfile_Query_Async_0100", 0, async function (done) { + let condition = new ohosDataAbility.DataAbilityPredicates(); + let resultColumns = [ + "profile_name", + "mcc", + "mnc", + ]; + condition.equalTo("profile_name", "test_profile_name"); + dataAbilityHelper.query(pdpProfileFullUri, resultColumns, condition).then(resultSet => { + let pdpProfiles = []; + console.log("Telephony_DataStorage_PdpProfile_Query_Async_0100 resultSet: " + + JSON.stringify(resultSet)); + while (resultSet.goToNextRow()) { + let pdpProfile = {}; + pdpProfile.profile_Name = resultSet.getString(0); + pdpProfile.mcc = resultSet.getString(1); + pdpProfile.mnc = resultSet.getString(2); + pdpProfiles.push(pdpProfile); + } + console.log("Telephony_DataStorage_PdpProfile_Query_Async_0100 pdpProfiles: " + + JSON.stringify(pdpProfiles)); + expect(pdpProfiles.length >= 1).assertTrue(); + done(); + }).catch(error => { + expect().assertFail(); + console.log("Telephony_DataStorage_PdpProfile_Query_Async_0100 failed"); + done(); + }); + }) + + /* + * @tc.number Telephony_DataStorage_PdpProfile_Update_Async_0100 + * @tc.name update test data of pdpProfile database + * @tc.desc Function test + */ + it("Telephony_DataStorage_PdpProfile_Update_Async_0100", 0, async function (done) { + var condition = new ohosDataAbility.DataAbilityPredicates(); + condition.equalTo("profile_name", "test_profile_name"); + var stringValue = { + 'mcc': "461", + 'mnc': "92", + }; + dataAbilityHelper.update(pdpProfileFullUri, stringValue, condition).then(data => { + console.log("Telephony_DataStorage_PdpProfile_Update_Async_0100: update success data: " + + JSON.stringify(data)); + expect(data === 0).assertTrue(); + done(); + }).catch(error => { + expect().assertFail(); + console.log("Telephony_DataStorage_PdpProfile_Update_Async_0100 failed"); + done(); + }); + }) + + /* + * @tc.number Telephony_DataStorage_PdpProfile_Delete_Async_0100 + * @tc.name delete test data from pdpProfile database + * @tc.desc Function test + */ + it("Telephony_DataStorage_PdpProfile_Delete_Async_0100", 0, async function (done) { + var condition = new ohosDataAbility.DataAbilityPredicates(); + condition.equalTo("profile_name", "test_profile_name"); + dataAbilityHelper.delete(pdpProfileFullUri, condition).then(data => { + console.log("Telephony_DataStorage_PdpProfile_Delete_Async_0100: delete success data: " + + JSON.stringify(data)); + expect(data === 0).assertTrue(); + done(); + }).catch(error => { + expect().assertFail(); + console.log("Telephony_DataStorage_PdpProfile_Update_Async_0100 failed"); + done(); + }); + }) + }) +} diff --git a/telephony/telephonyjstest/telephony_base/cellular_data/src/main/resources/base/element/string.json b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d51fd51ba91957ec1c986cfd99d00655c80c65fc --- /dev/null +++ b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/resources/base/element/string.json @@ -0,0 +1,28 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Sim Test" + }, + { + "name": "mainability_description", + "value": "Sim Test - sim manager interface test" + }, + { + "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/telephony/telephonyjstest/telephony_base/cellular_data/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/telephony/telephonyjstest/telephony_base/cellular_data/src/main/resources/base/media/icon.png differ diff --git a/test_packages.gni b/test_packages.gni index 8ecd65e73fd83450752a595fad199a58de7fea83..e2c8be85f5451ae35de23d79e762717b57aa2e5a 100644 --- a/test_packages.gni +++ b/test_packages.gni @@ -46,7 +46,7 @@ _all_test_packages = [ "${ACTS_ROOT}/settingsdata:settingsdata", "${ACTS_ROOT}/barrierfree:barrierfree", "${ACTS_ROOT}/customization:customization", - "${ACTS_ROOT}/distributedschedule:systemabilitymgr", + "${ACTS_ROOT}/applications:applications", ] _all_test_packages_ivi = [ diff --git a/theme/screenlock_ets/entry/src/main/config.json b/theme/screenlock_ets/entry/src/main/config.json index 1ca5bf79cea07db91c1779bb38944dd60e9f9fe8..9dc5fd5724ed2e84186b6a75acde98bbb95170e2 100755 --- a/theme/screenlock_ets/entry/src/main/config.json +++ b/theme/screenlock_ets/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": "com.acts.theme.screenlocktest.MainAbility", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets b/theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets index 10d885321e3042c4c4371781bb151a9b546be61f..acff99f0239584ae8431ffbf5d06b6080c0e8595 100755 --- a/theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets +++ b/theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets @@ -42,7 +42,6 @@ export default function ScreenLockPromiseTest(){ */ it("SUB_MISC_THEME_screenLock_API_Promise_001", 0, async function (done) { console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_001-------------------"); - let isScreenLocked = true; try { screenLock.isScreenLocked().then((data) => { console.info("SUB_MISC_THEME_screenLock_API_Promise_001 isScreenLocked result is " + data); @@ -66,7 +65,6 @@ export default function ScreenLockPromiseTest(){ */ it("SUB_MISC_THEME_screenLock_API_Promise_002", 0, async function (done) { console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_002-------------------"); - let isScreenLocked = false; try { screenLock.isScreenLocked().then((data) => { console.info("SUB_MISC_THEME_screenLock_API_Promise_002 isScreenLocked result is " + data); @@ -173,6 +171,5 @@ export default function ScreenLockPromiseTest(){ console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_005-------------------"); done(); }); - }) } diff --git a/theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets b/theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets index 1aaed1919bff8c30c4ca317122822aceeafa0562..cf95faaa6c90e2b1eb5ff8c155b2085df94f28a6 100755 --- a/theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets +++ b/theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets @@ -14,7 +14,7 @@ * limitations under the License. */ import screenLock from '@ohos.screenLock'; -import {describe, expect, it} from "hypium/index"; +import { describe, expect, it } from "hypium/index"; export default function screenLockJSUnit() { const INTERACTIVE_STATE_END_SLEEP = 0; @@ -35,808 +35,287 @@ export default function screenLockJSUnit() { } } - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0001 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0001", 0, async function (done) { - console.info("------------------start SUB_MISC_THEME_screenLock_API_0001-------------------"); - try { - screenLock.isScreenLocked((err, data) => { - console.info("SUB_MISC_THEME_screenLock_API_0001 screen's status is " + data); - expect(data == true).assertTrue(); - }); - } catch (error) { - console.info("logMessage SUB_MISC_THEME_screenLock_API_0001: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end SUB_MISC_THEME_screenLock_API_0001-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0002 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0002", 0, async function (done) { - console.info("------------------start SUB_MISC_THEME_screenLock_API_0002-------------------"); - try { - screenLock.isScreenLocked((err, data) => { - console.info("SUB_MISC_THEME_screenLock_API_0002 screen's status is " + data); - expect(data == false).assertTrue(); - }); - } catch (error) { - console.info("logMessage SUB_MISC_THEME_screenLock_API_0002: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end SUB_MISC_THEME_screenLock_API_0002-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0003 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0003", 0, async function (done) { - console.info("------------------start SUB_MISC_THEME_screenLock_API_0003-------------------"); - try { - screenLock.isSecureMode((err, data) => { - console.info("SUB_MISC_THEME_screenLock_API_0003 secureMode's result is " + data); - expect(data == false).assertTrue(); - }); - } catch (error) { - console.info("logMessage SUB_MISC_THEME_screenLock_API_0003: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end SUB_MISC_THEME_screenLock_API_0003-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0004 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0004", 0, async function (done) { - console.info("------------------start SUB_MISC_THEME_screenLock_API_0004-------------------"); - try { - screenLock.unlockScreen(() => { - console.info("SUB_MISC_THEME_screenLock_API_0004: send unlockScreen issue success"); - }); - - sleep(SLEEP_TIME); - let unlockScreenResult = 0; - let eventType = 'unlockScreenResult'; - screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { - console.info("SUB_MISC_THEME_screenLock_API_0004: sendScreenLockEvent result is " + data); - expect(data == true).assertTrue(); - }); - - sleep(SLEEP_TIME); - screenLock.isScreenLocked((err, data) => { - console.info("SUB_MISC_THEME_screenLock_API_0004: isScreenLocked result is " + data); - expect(data == false).assertTrue(); - }); - } catch (error) { - console.info("SUB_MISC_THEME_screenLock_API_0004: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end SUB_MISC_THEME_screenLock_API_0004-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0005 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0005", 0, async function (done) { - console.info("------------------start SUB_MISC_THEME_screenLock_API_0005-------------------"); - try { - screenLock.unlockScreen(() => { - console.info("SUB_MISC_THEME_screenLock_API_0005: send unlockScreen issue success"); - }); - - sleep(SLEEP_TIME); - let unlockScreenResult = 1; - let eventType = 'unlockScreenResult'; - screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { - console.info("SUB_MISC_THEME_screenLock_API_0005: sendScreenLockEvent result is " + data); - expect(data == true).assertTrue(); - }); - - sleep(SLEEP_TIME); - screenLock.isScreenLocked((err, data) => { - console.info("SUB_MISC_THEME_screenLock_API_0005: isScreenLocked result is " + data); - expect(data == true).assertTrue(); - }); - } catch (error) { - console.info("logMessage SUB_MISC_THEME_screenLock_API_0005: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end SUB_MISC_THEME_screenLock_API_0005-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0006 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0006", 0, async function (done) { - console.info("------------------start SUB_MISC_THEME_screenLock_API_0006-------------------"); - try { - screenLock.isScreenLocked((err, data) => { - console.info("SUB_MISC_THEME_screenLock_API_0006: isScreenLocked result is " + data); - expect(data == true).assertTrue(); - }); - - sleep(SLEEP_TIME); - screenLock.unlockScreen(() => { - console.info("SUB_MISC_THEME_screenLock_API_0006: send unlockScreen issue success"); - }); - - sleep(SLEEP_TIME); - let unlockScreenResult = 0; - let eventType = 'unlockScreenResult'; - screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { - console.info("SUB_MISC_THEME_screenLock_API_0006: sendScreenLockEvent result is " + data); - expect(data == true).assertTrue(); - }); - - sleep(SLEEP_TIME); - screenLock.isScreenLocked((err, data) => { - console.info("SUB_MISC_THEME_screenLock_API_0006: isScreenLocked result is " + data); - expect(data == false).assertTrue(); - }); - } catch (error) { - console.info("SUB_MISC_THEME_screenLock_API_0006: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end SUB_MISC_THEME_screenLock_API_0006-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0007 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0007", 0, async function (done) { - console.info("------------------start SUB_MISC_THEME_screenLock_API_0007-------------------"); - try { - screenLock.isScreenLocked((err, data) => { - console.info("SUB_MISC_THEME_screenLock_API_0007: isScreenLocked is successful, result is " + data); - expect(data == false).assertTrue(); - }); - } catch (error) { - console.info("logMessage SUB_MISC_THEME_screenLock_API_0007: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end SUB_MISC_THEME_screenLock_API_0007-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0008 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0008", 0, async function (done) { - console.info("------------------start SUB_MISC_THEME_screenLock_API_0008-------------------"); - try { - screenLock.isScreenLocked((err, data) => { - console.log("SUB_MISC_THEME_screenLock_API_0008: isScreenLocked result is " + data); - expect(data == true).assertTrue(); - }); - - sleep(SLEEP_TIME); - screenLock.unlockScreen(() => { - console.log("SUB_MISC_THEME_screenLock_API_0008: send unlockScreen issue success"); - }); - - sleep(SLEEP_TIME); - let unlockScreenResult = 1; - let eventType = 'unlockScreenResult'; - screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { - console.log("SUB_MISC_THEME_screenLock_API_0008: sendScreenLockEvent result is " + data); - expect(data == true).assertTrue(); - }); - - sleep(SLEEP_TIME); - screenLock.isScreenLocked((err, data) => { - console.log("SUB_MISC_THEME_screenLock_API_0008: isScreenLocked result is " + data); - expect(data == true).assertTrue(); - }); - } catch (error) { - console.info("SUB_MISC_THEME_screenLock_API_0008: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end SUB_MISC_THEME_screenLock_API_0008-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0009 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0009", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0009-------------------"); - try { - let eventType = 'beginWakeUp'; - screenLock.off(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0009: test_getRuntimeState beginWakeUp is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0009: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0009-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0010 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0010", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0010-------------------"); - try { - let eventType = 'endWakeUp'; - screenLock.off(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0010: test_getRuntimeState endWakeUp is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0010: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0010-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0011 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0011", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0011-------------------"); - try { - let eventType = 'beginScreenOn'; - screenLock.off(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0011: test_getRuntimeState beginScreenOn is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0011: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0011-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0012 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0012", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0012-------------------"); - try { - let eventType = 'beginScreenOn'; - screenLock.off(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0012: test_getRuntimeState endScreenOn is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0012: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0012-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0013 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0013", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0013-------------------"); - try { - let eventType = 'beginScreenOff'; - screenLock.off(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0013: test_getRuntimeState beginScreenOff is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0013: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0013-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0014 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0014", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0014-------------------"); - try { - let eventType = 'endScreenOff'; - screenLock.off(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0014: test_getRuntimeState endScreenOff is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0014: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0014-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0015 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0015", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0015-------------------"); - try { - let eventType = 'unlockScreen'; - screenLock.off(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0015: test_getRuntimeState unlockScreen is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0015: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0015-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0016 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0016", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0016-------------------"); - try { - let eventType = 'beginExitAnimation'; - screenLock.off(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0016: test_getRuntimeState beginExitAnimation is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0016: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0016-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0017 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0017", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0017-------------------"); - try { - let eventType = 'screenLockEnabled'; - screenLock.off(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0017: test_getRuntimeState screenLockEnabled is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0017: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0017-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0018 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0018", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0018-------------------"); - try { - let eventType = 'beginSleep'; - screenLock.off(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0018: test_getRuntimeState beginSleep is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0018: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0018-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0019 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0019", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0019-------------------"); - try { - let eventType = 'endSleep'; - screenLock.off(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0019: test_getRuntimeState endSleep is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0019: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0019-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0020 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0020", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0020-------------------"); - try { - let eventType = 'changeUser'; - screenLock.off(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0020: test_getRuntimeState changeUser is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0020: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0020-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0021 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0021", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0021-------------------"); - try { - let eventType = 'beginWakeUp'; - screenLock.on(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0021: test_getRuntimeState beginWakeUp is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0021: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0021-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0022 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0022", 0, async function (done) { - console.log("------------------logMessage SUB_MISC_THEME_screenLock_API_0022-------------------"); - try { - let eventType = 'endWakeUp'; - screenLock.on(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0022: test_getRuntimeState endWakeUp is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0022: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0022-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0023 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0023", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0023-------------------"); - try { - let eventType = 'beginScreenOn'; - screenLock.on(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0023: test_getRuntimeState beginScreenOn is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0023: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0023-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0024 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0024", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0024-------------------"); - try { - let eventType = 'endScreenOn'; - screenLock.on(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0024: test_getRuntimeState endScreenOn is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0024: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0024-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0025 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0025", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0025-------------------"); - try { - let eventType = 'beginScreenOff'; - screenLock.on(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0025: test_getRuntimeState beginScreenOff is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0025: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0025-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0026 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0026", 0, async function (done) { - console.log("------------------logMessage SUB_MISC_THEME_screenLock_API_0026-------------------"); - try { - let eventType = 'endScreenOff'; - screenLock.on(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0026: test_getRuntimeState endScreenOff is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0026: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0026-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0027 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0027", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0027-------------------"); - try { - let eventType = 'unlockScreen'; - screenLock.on(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0027: test_getRuntimeState unlockScreen is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0027: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0027-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0028 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0028", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0028-------------------"); - try { - let eventType = 'beginExitAnimation'; - screenLock.on(eventType, () => { - console.log("SUB_MISC_THEME_screenLock_API_0028: test_getRuntimeState beginExitAnimation is successful" ); - }); - } catch (error) { - console.log("end SUB_MISC_THEME_screenLock_API_0028: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0028-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0029 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0029", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0029-------------------"); - try { - let eventType = 'changeUser'; - screenLock.on(eventType, (err, data) => { - console.log("SUB_MISC_THEME_screenLock_API_0029: test_getRuntimeState beginSleep is successful"); - expect(data == INTERACTIVE_STATE_BEGIN_SLEEP).assertTrue(); - }); - } catch (error) { - console.log("logMessage SUB_MISC_THEME_screenLock_API_0029: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0029-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0030 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0030", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0030-------------------"); - try { - let eventType = 'endSleep'; - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("SUB_MISC_THEME_screenLock_API_0030: test_getRuntimeState endSleep is successful"); - expect(data == INTERACTIVE_STATE_END_SLEEP).assertTrue(); - }); - } catch (error) { - console.log("logMessage SUB_MISC_THEME_screenLock_API_0030: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0030-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0031 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0031", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0031-------------------"); - try { - let eventType = 'changeUser'; - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("SUB_MISC_THEME_screenLock_API_0031: test_getRuntimeState changeUser is successful"); - expect(data == INTERACTIVE_STATE_USERID).assertTrue(); - }); - } catch (error) { - console.log("logMessage SUB_MISC_THEME_screenLock_API_0031: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0031-------------------"); - done(); - }); - - /* - * @tc.number SUB_MISC_THEME_screenLock_API_0032 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Test ScreenLock API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("SUB_MISC_THEME_screenLock_API_0032", 0, async function (done) { - console.log("------------------start SUB_MISC_THEME_screenLock_API_0032-------------------"); - try { - let eventType = 'screenLockEnabled'; - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("SUB_MISC_THEME_screenLock_API_0032: test_getRuntimeState screenLockEnabled is successfuls"); - expect(data == true).assertTrue(); - }); - } catch (error) { - console.log("logMessage SUB_MISC_THEME_screenLock_API_0032: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end SUB_MISC_THEME_screenLock_API_0032-------------------"); - done(); - }); - }) + /* + * @tc.number SUB_MISC_THEME_screenLock_API_0001 + * @tc.name Set to locked screen, query the lock screen state is locked state + * @tc.desc Test ScreenLock API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it("SUB_MISC_THEME_screenLock_API_0001", 0, async function (done) { + console.info("------------------start SUB_MISC_THEME_screenLock_API_0001-------------------"); + try { + screenLock.isScreenLocked((err, data) => { + console.info("SUB_MISC_THEME_screenLock_API_0001 screen's status is " + data); + expect(data == true).assertTrue(); + }); + } catch (error) { + console.info("logMessage SUB_MISC_THEME_screenLock_API_0001: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end SUB_MISC_THEME_screenLock_API_0001-------------------"); + done(); + }); + + /* + * @tc.number SUB_MISC_THEME_screenLock_API_0002 + * @tc.name Set to locked screen, query the lock screen state is locked state + * @tc.desc Test ScreenLock API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it("SUB_MISC_THEME_screenLock_API_0002", 0, async function (done) { + console.info("------------------start SUB_MISC_THEME_screenLock_API_0002-------------------"); + try { + screenLock.isScreenLocked((err, data) => { + console.info("SUB_MISC_THEME_screenLock_API_0002 screen's status is " + data); + expect(data == false).assertTrue(); + }); + } catch (error) { + console.info("logMessage SUB_MISC_THEME_screenLock_API_0002: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end SUB_MISC_THEME_screenLock_API_0002-------------------"); + done(); + }); + + /* + * @tc.number SUB_MISC_THEME_screenLock_API_0003 + * @tc.name Set to locked screen, query the lock screen state is locked state + * @tc.desc Test ScreenLock API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it("SUB_MISC_THEME_screenLock_API_0003", 0, async function (done) { + console.info("------------------start SUB_MISC_THEME_screenLock_API_0003-------------------"); + try { + screenLock.isSecureMode((err, data) => { + console.info("SUB_MISC_THEME_screenLock_API_0003 secureMode's result is " + data); + expect(data == false).assertTrue(); + }); + } catch (error) { + console.info("logMessage SUB_MISC_THEME_screenLock_API_0003: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end SUB_MISC_THEME_screenLock_API_0003-------------------"); + done(); + }); + + /* + * @tc.number SUB_MISC_THEME_screenLock_API_0004 + * @tc.name Set to locked screen, query the lock screen state is locked state + * @tc.desc Test ScreenLock API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it("SUB_MISC_THEME_screenLock_API_0004", 0, async function (done) { + console.info("------------------start SUB_MISC_THEME_screenLock_API_0004-------------------"); + try { + screenLock.unlockScreen(() => { + console.info("SUB_MISC_THEME_screenLock_API_0004: send unlockScreen issue success"); + }); + + sleep(SLEEP_TIME); + let unlockScreenResult = 0; + let eventType = 'unlockScreenResult'; + screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { + console.info("SUB_MISC_THEME_screenLock_API_0004: sendScreenLockEvent result is " + data); + expect(data == true).assertTrue(); + }); + + sleep(SLEEP_TIME); + screenLock.isScreenLocked((err, data) => { + console.info("SUB_MISC_THEME_screenLock_API_0004: isScreenLocked result is " + data); + expect(data == false).assertTrue(); + }); + } catch (error) { + console.info("SUB_MISC_THEME_screenLock_API_0004: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end SUB_MISC_THEME_screenLock_API_0004-------------------"); + done(); + }); + + /* + * @tc.number SUB_MISC_THEME_screenLock_API_0005 + * @tc.name Set to locked screen, query the lock screen state is locked state + * @tc.desc Test ScreenLock API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it("SUB_MISC_THEME_screenLock_API_0005", 0, async function (done) { + console.info("------------------start SUB_MISC_THEME_screenLock_API_0005-------------------"); + try { + screenLock.unlockScreen(() => { + console.info("SUB_MISC_THEME_screenLock_API_0005: send unlockScreen issue success"); + }); + + sleep(SLEEP_TIME); + let unlockScreenResult = 1; + let eventType = 'unlockScreenResult'; + screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { + console.info("SUB_MISC_THEME_screenLock_API_0005: sendScreenLockEvent result is " + data); + expect(data == true).assertTrue(); + }); + + sleep(SLEEP_TIME); + screenLock.isScreenLocked((err, data) => { + console.info("SUB_MISC_THEME_screenLock_API_0005: isScreenLocked result is " + data); + expect(data == true).assertTrue(); + }); + } catch (error) { + console.info("logMessage SUB_MISC_THEME_screenLock_API_0005: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end SUB_MISC_THEME_screenLock_API_0005-------------------"); + done(); + }); + + /* + * @tc.number SUB_MISC_THEME_screenLock_API_0006 + * @tc.name Set to locked screen, query the lock screen state is locked state + * @tc.desc Test ScreenLock API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it("SUB_MISC_THEME_screenLock_API_0006", 0, async function (done) { + console.info("------------------start SUB_MISC_THEME_screenLock_API_0006-------------------"); + try { + screenLock.isScreenLocked((err, data) => { + console.info("SUB_MISC_THEME_screenLock_API_0006: isScreenLocked result is " + data); + expect(data == true).assertTrue(); + }); + + sleep(SLEEP_TIME); + screenLock.unlockScreen(() => { + console.info("SUB_MISC_THEME_screenLock_API_0006: send unlockScreen issue success"); + }); + + sleep(SLEEP_TIME); + let unlockScreenResult = 0; + let eventType = 'unlockScreenResult'; + screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { + console.info("SUB_MISC_THEME_screenLock_API_0006: sendScreenLockEvent result is " + data); + expect(data == true).assertTrue(); + }); + + sleep(SLEEP_TIME); + screenLock.isScreenLocked((err, data) => { + console.info("SUB_MISC_THEME_screenLock_API_0006: isScreenLocked result is " + data); + expect(data == false).assertTrue(); + }); + } catch (error) { + console.info("SUB_MISC_THEME_screenLock_API_0006: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end SUB_MISC_THEME_screenLock_API_0006-------------------"); + done(); + }); + + /* + * @tc.number SUB_MISC_THEME_screenLock_API_0007 + * @tc.name Set to locked screen, query the lock screen state is locked state + * @tc.desc Test ScreenLock API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it("SUB_MISC_THEME_screenLock_API_0007", 0, async function (done) { + console.info("------------------start SUB_MISC_THEME_screenLock_API_0007-------------------"); + try { + screenLock.isScreenLocked((err, data) => { + console.info("SUB_MISC_THEME_screenLock_API_0007: isScreenLocked is successful, result is " + data); + expect(data == false).assertTrue(); + }); + } catch (error) { + console.info("logMessage SUB_MISC_THEME_screenLock_API_0007: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end SUB_MISC_THEME_screenLock_API_0007-------------------"); + done(); + }); + + /* + * @tc.number SUB_MISC_THEME_screenLock_API_0008 + * @tc.name Set to locked screen, query the lock screen state is locked state + * @tc.desc Test ScreenLock API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it("SUB_MISC_THEME_screenLock_API_0008", 0, async function (done) { + console.info("------------------start SUB_MISC_THEME_screenLock_API_0008-------------------"); + try { + screenLock.isScreenLocked((err, data) => { + console.log("SUB_MISC_THEME_screenLock_API_0008: isScreenLocked result is " + data); + expect(data == true).assertTrue(); + }); + + sleep(SLEEP_TIME); + screenLock.unlockScreen(() => { + console.log("SUB_MISC_THEME_screenLock_API_0008: send unlockScreen issue success"); + }); + + sleep(SLEEP_TIME); + let unlockScreenResult = 1; + let eventType = 'unlockScreenResult'; + screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { + console.log("SUB_MISC_THEME_screenLock_API_0008: sendScreenLockEvent result is " + data); + expect(data == true).assertTrue(); + }); + + sleep(SLEEP_TIME); + screenLock.isScreenLocked((err, data) => { + console.log("SUB_MISC_THEME_screenLock_API_0008: isScreenLocked result is " + data); + expect(data == true).assertTrue(); + }); + } catch (error) { + console.info("SUB_MISC_THEME_screenLock_API_0008: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end SUB_MISC_THEME_screenLock_API_0008-------------------"); + done(); + }); + + /* + * @tc.number SUB_MISC_THEME_screenLock_API_0009 + * @tc.name Set to locked screen, query the lock screen state is locked state + * @tc.desc Test ScreenLock API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it("SUB_MISC_THEME_screenLock_API_0009", 0, async function (done) { + console.info("------------------start SUB_MISC_THEME_screenLock_API_0009-------------------"); + let flag = null; + try{ + flag = await screenLock.onSystemEvent((err, data) => { + console.info("SUB_MISC_THEME_screenLock_API_0009 screenLock.onSystemEvent start"); + if (err){ + console.info("SUB_MISC_THEME_screenLock_API_0009 screenLock.onSystemEvent err: " + JSON.stringify(err)); + expect().assertFalse(); + done(); + }; + expect( data != null ).assertTrue(); + console.info("SUB_MISC_THEME_screenLock_API_0009 screenLock.onSystemEvent end" + data) + done(); + }); + }catch(err){ + console.info("SUB_MISC_THEME_screenLock_API_0009 failed: " + JSON.stringify(err)); + expect().assertFalse(); + done(); + } + console.info("SUB_MISC_THEME_screenLock_API_0009 data: " + flag); + //这里的业务暂时为false,后续获取权限后为true + expect( flag == false).assertTrue(); + console.info("-----------------end SUB_MISC_THEME_screenLock_API_0009--------------------"); + done() + }); + }); } diff --git a/theme/wallpaper_ets/entry/src/main/config.json b/theme/wallpaper_ets/entry/src/main/config.json index b4f940dc87485ac1f2ef66b37eb08eca5bb883e7..9aa9be57c1095721c01dc2e8d7c1fe06b7b24fd3 100755 --- a/theme/wallpaper_ets/entry/src/main/config.json +++ b/theme/wallpaper_ets/entry/src/main/config.json @@ -19,6 +19,7 @@ "mainAbility": "com.acts.theme.wallpapertest.MainAbility", "deviceType": [ + "default", "phone", "tablet", "tv", @@ -70,10 +71,24 @@ ], "reqPermissions": [ { - "name": "ohos.permission.SET_WALLPAPER" + "name": "ohos.permission.SET_WALLPAPER", + "reason": "need use ohos.permission.SET_WALLPAPER", + "usedScene": { + "ability": [ + "com.acts.theme.wallpapertest.MainAbility" + ], + "when": "inuse" + } }, { - "name": "ohos.permission.GET_WALLPAPER" + "name": "ohos.permission.GET_WALLPAPER", + "reason": "need use ohos.permission.GET_WALLPAPER", + "usedScene": { + "ability": [ + "com.acts.theme.wallpapertest.MainAbility" + ], + "when": "inuse" + } } ], "js": [ diff --git a/time/BUILD.gn b/time/BUILD.gn index 6b834079bf0a5403315d04c8a2bc9537c8690272..9c1a67e0c20a88c2da86f0d9b3717e2ae88e1b32 100644 --- a/time/BUILD.gn +++ b/time/BUILD.gn @@ -14,8 +14,5 @@ import("//build/ohos_var.gni") group("time") { testonly = true - deps = [ - "TimeTest_js:ActsTimeJSApiTest", - "TimerTest_js:ActsTimerJSApiTest", - ] + deps = [ "timeTest:ActsTimeAPITest" ] } diff --git a/time/TimeTest_js/BUILD.gn b/time/TimeTest_js/BUILD.gn deleted file mode 100644 index ba6ee6dd954308dfc0ddf79023bf14f333769d98..0000000000000000000000000000000000000000 --- a/time/TimeTest_js/BUILD.gn +++ /dev/null @@ -1,33 +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("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsTimeJSApiTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - subsystem_name = "time" - part_name = "time_service" - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsTimeJSApiTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./src/main/js/default" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/time/TimeTest_js/Test.json b/time/TimeTest_js/Test.json deleted file mode 100644 index 162af643177b27e2244915014d50dc5d2d171d9a..0000000000000000000000000000000000000000 --- a/time/TimeTest_js/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for time js api Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "600000", - "package": "ohos.acts.time.timetest", - "shell-timeout": "600000" - }, - "kits": [ - { - "test-file-name": [ - "ActsTimeJSApiTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/time/TimeTest_js/src/main/config.json b/time/TimeTest_js/src/main/config.json deleted file mode 100644 index 4774a07e7ae122d7d5fc3b2a46ea79d12f1625cf..0000000000000000000000000000000000000000 --- a/time/TimeTest_js/src/main/config.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.time.timetest", - "vendor": "acts", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "target": 9 - } - }, - "deviceConfig": {}, - "module": { - "package": "ohos.acts.time.timetest", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "reqPermissions": [ - { - "name": "ohos.permission.SET_TIME", - "reason": "use.ohos.permission.SET_TIME" - }, - { - "name": "ohos.permission.SET_TIME_ZONE", - "reason": "use.ohos.permission.SET_TIME_ZONE" - } - ], - "abilities": [ - { - "visible": true, - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "ohos.acts.time.timetest.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/time/TimeTest_js/src/main/js/default/app.js b/time/TimeTest_js/src/main/js/default/app.js deleted file mode 100644 index 3f33c9fae0b3eb6b9a41b5d33a2ffa7e2d0d7d51..0000000000000000000000000000000000000000 --- a/time/TimeTest_js/src/main/js/default/app.js +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/time/TimeTest_js/src/main/js/default/pages/index/index.js b/time/TimeTest_js/src/main/js/default/pages/index/index.js deleted file mode 100644 index eaac6fc987c8174e69676a9ef662ba069931387a..0000000000000000000000000000000000000000 --- a/time/TimeTest_js/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,50 +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 app from '@system.app' - -import {Core, ExpectExtend} from 'deccjsunit/index' - -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') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - // core.addService('report', instrumentLog) - core.init() - // core.subscribeEvent('spec', instrumentLog) - // core.subscribeEvent('suite', instrumentLog) - // core.subscribeEvent('task', instrumentLog) - const configService = core.getDefaultService('config') - this.timeout = 30000 - configService.setConfig(this) - - require('../../test/List.test') - core.execute() - }, - onReady() { - }, -} diff --git a/time/TimeTest_js/src/main/js/default/test/List.test.js b/time/TimeTest_js/src/main/js/default/test/List.test.js deleted file mode 100644 index 5120a0a6a544098739b6250a5fb86d0f4527f055..0000000000000000000000000000000000000000 --- a/time/TimeTest_js/src/main/js/default/test/List.test.js +++ /dev/null @@ -1,16 +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. - */ - -require('./SystemTimeJsunit.test.js') \ No newline at end of file diff --git a/time/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js b/time/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js deleted file mode 100644 index 49f2a4656dbf23ae8bc4b01b72aa4d2dd3c85bea..0000000000000000000000000000000000000000 --- a/time/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js +++ /dev/null @@ -1,69 +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. - */ - -// @ts-nocheck -import { - describe, - beforeAll, - beforeEach, - afterEach, - afterAll, - it, - expect, - } from "deccjsunit/index"; - import systemTime from "@ohos.systemTime"; - - describe("TimeTest", function () { - console.log("start################################start"); - - /** - * @tc.number SUB_systemTime_getRealActiveTime_JS_API_0100 - * @tc.name Test systemTime.getRealActiveTime - * @tc.desc Test systemTime_getRealActiveTime API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("systemTime_getRealActiveTime_test1", 0, async function (done) { - console.log("SUB_systemTime_getRealActiveTime_JS_API_0100 start"); - - systemTime.getRealActiveTime().then((data) => { - console.log("f_ActiveTime1: getRealActiveTime data = " + data); - }); - expect(true).assertTrue(); - console.log("SUB_systemTime_getRealActiveTime_JS_API_0100 end"); - done(); - }); - - /** - * @tc.number SUB_systemTime_getRealTime_JS_API_0100 - * @tc.name Test systemTime.getRealTime - * @tc.desc Test systemTime_getRealTime API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it("systemTime_getRealTime_test1", 0, async function (done) { - console.log("SUB_systemTime_getRealTime_JS_API_0100 start"); - - systemTime.getRealTime().then((data) => { - console.log("f_RealTime1: getRealTime data = " + data); - }); - expect(true).assertTrue(); - console.log("SUB_systemTime_getRealTime_JS_API_0100 end"); - done(); - }); - }); - \ No newline at end of file diff --git a/time/TimeTest_js/src/main/js/default/test/Time.test.js b/time/TimeTest_js/src/main/js/default/test/Time.test.js deleted file mode 100644 index 568653a6ea0a60410ed716b50210e1132a674532..0000000000000000000000000000000000000000 --- a/time/TimeTest_js/src/main/js/default/test/Time.test.js +++ /dev/null @@ -1,225 +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. - */ - -// @ts-nocheck -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -import systemTime from '@ohos.systemTime' - -describe('TimeTest', function(){ - console.log('start################################start'); - - /** - * @tc.number SUB_systemTime_setTime_JS_API_0100 - * @tc.name Test systemTime.setTime - * @tc.desc Test systemTime_setTime API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTime_setTime_test1', 0, async function (done) { - console.log("SUB_systemTime_setTime_JS_API_0100 start") - systemTime.setTime(1526003846000) - .then(data =>{ - console.log("setTime ===data " + data) - execpt(data).assertEqual(true) - }).catch(error => { - console.log("setTime ===error " + error) - console.log("setTime ===data " + data) - execpt(0).assertLarger(1) - - }); - console.log('SUB_systemTime_setTime_JS_API_0100 end'); - done() - }) - - /** - * @tc.number SUB_systemTime_setTime_JS_API_0200 - * @tc.name Test systemTime.setTime Invalid value - * @tc.desc Test systemTime_setTime API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTime_setTime_test2', 0, async function (done) { - console.log("SUB_systemTime_setTime_JS_API_0200 start") - systemTime.setTime(-1) - .then(data => { - console.log("setTime ===data " + data) - - }).catch(error => { - console.log("setTime ===error " + error) - execpt(0).assertLarger(1) - - }); - console.log('SUB_systemTime_setTime_JS_API_0200 end'); - done() - }) - - /** - * @tc.number SUB_systemTime_setTime_JS_API_0300 - * @tc.name Test systemTime.setTime3 - * @tc.desc Test systemTime_setTime API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTime_setTime_test3', 0, async function (done) { - console.log("SUB_systemTime_setTime_JS_API_0300 start") - systemTime.setTime(1597156246000, (error, data) => { - console.log("setTime ===data: " + data); - console.log("setTime ===error: " + error); - }); - console.log('SUB_systemTime_setTime_JS_API_0300 end'); - done() - }) - - /** - * @tc.number SUB_systemTime_setTime_JS_API_0400 - * @tc.name Test systemTime.setTime4 Invalid value - * @tc.desc Test systemTime_setTime API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTime_setTime_test4', 0, async function (done) { - console.log("SUB_systemTime_setTime_JS_API_0400 start") - systemTime.setTime(-1, (error, data) => { - console.log("setTime ===data: " + data); - console.log("setTime ===error: " + error); - }).catch(error=> { - expect(1).assertLarger(0) - }) - console.log('SUB_systemTime_setTime_JS_API_0400 end'); - done() - }) - - /** - * @tc.number SUB_systemTime_setDate_JS_API_0100 - * @tc.name Test systemTime.setDate Invalid value - * @tc.desc Test systemTime_setDate API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTime_setDate_test1', 0, async function (done) { - console.log("SUB_systemTime_setDate_JS_API_0100 start"); - var data = new Date("October 13, 2020 11:13:00"); - systemTime.setDate(-1).then(data => { - console.log("setTime ===data " + data); - done(); - }).catch(error => { - console.log("setTime ===error " + error); - done(); - }); - }); - - /** - * @tc.number SUB_systemTime_setDate_JS_API_0200 - * @tc.name Test systemTime.setDate Invalid value - * @tc.desc Test systemTime_setDate API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTime_setDate_test2', 0, async function (done) { - console.log("SUB_systemTime_setDate_JS_API_0200 start"); - systemTime.setDate(0).then(data => { - console.log("setTime ===data " + data); - done(); - }).catch(error => { - console.log("setTime ===error " + error); - done(); - }); - }); - - /** - * @tc.number SUB_systemTime_setDate_JS_API_0300 - * @tc.name Test systemTime.setDate Invalid value - * @tc.desc Test systemTime_setDate API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTime_setDate_test3', 0, async function (done) { - console.log("SUB_systemTime_setDate_JS_API_0300 start"); - var data = new Date("October 13, 2020 11:13:00"); - systemTime.setDate(data, (error, data) => { - if(error){ - console.log("setTime ===error " + error); - done(); - }else{ - console.log("setTime ===data " + data); - done(); - } - }); - }); - - /** - * @tc.number SUB_systemTime_setTimezone_JS_API_0100 - * @tc.name Test systemTime.setTimezone Invalid value - * @tc.desc Test systemTime_setTimezone API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTime_setTimezone_test1', 0, async function (done) { - console.log("SUB_systemTime_setTimezone_JS_API_0100 start"); - systemTime.setTimezone('Asia, Shanghai').then(data => { - console.log("setTime ===data " + data) - done(); - }).catch(error => { - console.log("setTime ===error " + error) - done(); - }); - }); - - /** - * @tc.number SUB_systemTime_setTimezone_JS_API_0200 - * @tc.name Test systemTime.setTimezone Invalid value - * @tc.desc Test systemTime_setTimezone API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTime_setTimezone_test1', 0, async function (done) { - console.log("SUB_systemTime_setTimezone_JS_API_0100 start"); - systemTime.setTimezone('Beijing,China').then(data => { - console.log("setTime ===data " + data) - done(); - }).catch(error => { - console.log("setTime ===error " + error) - done(); - }); - }); - - /** - * @tc.number SUB_systemTime_setTimezone_JS_API_0300 - * @tc.name Test systemTime.setTimezone Invalid value - * @tc.desc Test systemTime_setTimezone API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTime_setTimezone_test1', 0, async function (done) { - console.log("SUB_systemTime_setTimezone_JS_API_0100 start"); - systemTime.setTimezone('Baker Island, U.S.A.').then(data => { - console.log("setTime ===data " + data) - done(); - }).catch(error => { - console.log("setTime ===error " + error) - done(); - }); - }); -}) diff --git a/time/TimeTest_js/src/main/resources/base/element/string.json b/time/TimeTest_js/src/main/resources/base/element/string.json deleted file mode 100644 index ec03196184773273c7a5af69fc92d81cd0d3889b..0000000000000000000000000000000000000000 --- a/time/TimeTest_js/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JstimeTest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/time/TimerTest_js/BUILD.gn b/time/TimerTest_js/BUILD.gn deleted file mode 100644 index 68ce95cbfb3710bc82c6eec1a65377bd94875373..0000000000000000000000000000000000000000 --- a/time/TimerTest_js/BUILD.gn +++ /dev/null @@ -1,33 +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("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsTimerJSApiTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - subsystem_name = "time" - part_name = "time_service" - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsTimerJSApiTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./src/main/js/default" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/time/TimerTest_js/Test.json b/time/TimerTest_js/Test.json deleted file mode 100644 index 5a5cf5fb5eecb8d35cdb06a8d547925cfffc7197..0000000000000000000000000000000000000000 --- a/time/TimerTest_js/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for time js api Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "600000", - "package": "ohos.acts.time.timertest", - "shell-timeout": "600000" - }, - "kits": [ - { - "test-file-name": [ - "ActsTimerJSApiTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/time/TimerTest_js/src/main/config.json b/time/TimerTest_js/src/main/config.json deleted file mode 100644 index 2c4c85a2e5ed4258c4e136d0d4bbea417a6f079a..0000000000000000000000000000000000000000 --- a/time/TimerTest_js/src/main/config.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.time.timertest", - "vendor": "acts", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "target": 9 - } - }, - "deviceConfig": {}, - "module": { - "package": "ohos.acts.time.timertest", - "name": ".MyApplication", - "deviceType": [ - "phone" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry" - }, - "abilities": [ - { - "visible": true, - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "name": "ohos.acts.time.timertest.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": false - } - } - ] - } -} diff --git a/time/TimerTest_js/src/main/js/default/app.js b/time/TimerTest_js/src/main/js/default/app.js deleted file mode 100644 index 564b7cb972324e0ae905c2597f6e99ab7c6ad951..0000000000000000000000000000000000000000 --- a/time/TimerTest_js/src/main/js/default/app.js +++ /dev/null @@ -1,23 +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. - */ - -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; diff --git a/time/TimerTest_js/src/main/js/default/pages/index/index.js b/time/TimerTest_js/src/main/js/default/pages/index/index.js deleted file mode 100644 index ea4ed5e4d6507dde6112f8501a68d24c6bd5aca4..0000000000000000000000000000000000000000 --- a/time/TimerTest_js/src/main/js/default/pages/index/index.js +++ /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. - */ -import app from '@system.app' - -import {Core, ExpectExtend} from 'deccjsunit/index' - -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') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - // core.addService('report', instrumentLog) - core.init() - // core.subscribeEvent('spec', instrumentLog) - // core.subscribeEvent('suite', instrumentLog) - // core.subscribeEvent('task', instrumentLog) - const configService = core.getDefaultService('config') - configService.setConfig(this) - - require('../../test/List.test') - core.execute() - }, - onReady() { - }, -} diff --git a/time/TimerTest_js/src/main/js/default/test/List.test.js b/time/TimerTest_js/src/main/js/default/test/List.test.js deleted file mode 100644 index 859f6c6d813adc8b8489234477358caf51ece81c..0000000000000000000000000000000000000000 --- a/time/TimerTest_js/src/main/js/default/test/List.test.js +++ /dev/null @@ -1,16 +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. - */ - -require('./SystemTimerJsunit.test.js') \ No newline at end of file diff --git a/time/TimerTest_js/src/main/js/default/test/SystemTimerJsunit.test.js b/time/TimerTest_js/src/main/js/default/test/SystemTimerJsunit.test.js deleted file mode 100644 index 31cb446444ee12728d93083757ab6d037c6c30d3..0000000000000000000000000000000000000000 --- a/time/TimerTest_js/src/main/js/default/test/SystemTimerJsunit.test.js +++ /dev/null @@ -1,918 +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. - */ - -// @ts-nocheck -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -import systemTimer from '@ohos.systemTimer' - -describe('TimerTest', function() { - console.log('start################################start'); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_0100 - * @tc.name Test systemTimer.createTimer type = TIMER_TYPE_REALTIME - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test1',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_0100 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_0100 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_0200 - * @tc.name Test systemTimer.createTimer type = TIMER_TYPE_REALTIME_WAKEUP - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test2',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_0200 start") - var options = { - type:TIMER_TYPE_WAKEUP, - repeat:false, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_0200 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_0300 - * @tc.name Test systemTimer.createTimer type = TIMER_TYPE_EXACT - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test3',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_0300 start") - var options = { - type:TIMER_TYPE_EXACT, - repeat:false, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_0300 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_0400 - * @tc.name Test systemTimer.createTimer type = TIMER_TYPE_REALTIME - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test4',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_0400 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_0400 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_0500 - * @tc.name Test systemTimer.createTimer triggerTime = 0 - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test5',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_0500 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 0) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_0500 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_0600 - * @tc.name Test systemTimer.createTimer triggerTime = 5000 - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test6',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_0600 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 5000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_0600 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_0700 - * @tc.name Test systemTimer.createTimer triggerTime = Number.MAX_VALUE/2 - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test7',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_0700 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, Number.MAX_VALUE/2) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_0700 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_0800 - * @tc.name Test systemTimer.createTimer triggerTime = Number.MAX_VALUE-1 - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test8',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_0800 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, Number.MAX_VALUE-1) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_0800 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_0900 - * @tc.name Test systemTimer.createTimer triggerTime = Number.MAX_VALUE - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test9',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_0900 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, Number.MAX_VALUE) - - console.log("stop timer") - ystemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_0900 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_1000 - * @tc.name Test systemTimer.createTimer repeat = true - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test10',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_1000 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:true, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_1000 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_1100 - * @tc.name Test systemTimer.createTimer persistent = true - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test11',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_1100 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - persistent:true - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_1100 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_1200 - * @tc.name Test systemTimer.createTimer repeat,persistent = true - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test12',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_1200 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:true, - persistent:true - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_1200 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_1300 - * @tc.name Test systemTimer.createTimer create,start,stop,destroy 1000 timers - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test13',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_1300 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - persistent:false - } - for (var index = 0; index < 1000; index++) - { - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_1300 end'); - } - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_1400 - * @tc.name Test systemTimer.createTimer interval = 0 - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test14',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_1400 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - interval:0, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_1400 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_1500 - * @tc.name Test systemTimer.createTimer interval = 5000 - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test15',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_1500 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - interval:5000, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_1500 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_1600 - * @tc.name Test systemTimer.createTimer interval = Number.MAX_VALUE/2 - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test16',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_1600 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - interval:Number.MAX_VALUE/2, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_1600 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_1700 - * @tc.name Test systemTimer.createTimer interval = Number.MAX_VALUE-1 - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test17',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_1700 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - interval:Number.MAX_VALUE-1, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_1700 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_1800 - * @tc.name Test systemTimer.createTimer interval = Number.MAX_VALUE - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test18',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_1800 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - interval:Number.MAX_VALUE, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_1800 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_1900 - * @tc.name Test systemTimer.createTimer WantAgent - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test19',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_1900 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - interval:100000, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_1900 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_2000 - * @tc.name Test systemTimer.createTimer Called back when the timer goes off. - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test20',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_2000 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - interval:100000, - persistent:false, - callback:callbackFunction - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_2000 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_2100 - * @tc.name Test systemTimer.createTimer start a not exist timer - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test21',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_2100 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start a not exist timer") - systemTimer.startTimer(timer + 1, 100000) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_2100 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_2200 - * @tc.name Test systemTimer.createTimer stop a not exist timer - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test22',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_2200 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop a not exist timer") - systemTimer.stopTimer(timer + 1) - - console.log("stop the current timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_2200 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_2300 - * @tc.name Test systemTimer.createTimer destroy a not exist timer - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test23',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_2300 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy a not exist timer") - systemTimer.destroyTimer(timer + 1) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_2300 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_2400 - * @tc.name Test systemTimer.createTimer stop a not started timer - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test24',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_2400 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("stop a not started timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_2400 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_2500 - * @tc.name Test systemTimer.createTimer destroy a started timer - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test25',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_2500 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("destroy a started timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_2500 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_2600 - * @tc.name Test systemTimer.createTimer repeat to start a timer - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test26',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_2600 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("start timer again") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_2600 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_2700 - * @tc.name Test systemTimer.createTimer repeat to stop a timer - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test27',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_2700 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("stop timer again") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_2700 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_2800 - * @tc.name Test systemTimer.createTimer repeat to destroy a timer - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test28',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_2800 start") - var options = { - type:TIMER_TYPE_REALTIME, - repeat:false, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - - console.log("destroy timer again") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_2800 end'); - }); - - /** - * @tc.number SUB_systemTimer_Timer_JS_API_2900 - * @tc.name Test systemTimer.createTTimer type = TIMER_TYPE_IDLE - * @tc.desc Test systemTimer_Timer API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('systemTimer_Timer_test29',0, async () => { - console.log("SUB_systemTimer_Timer_JS_API_2900 start") - var options = { - type:TIMER_TYPE_IDLE, - repeat:false, - persistent:false - } - console.log("create timer") - let timer = systemTimer.createTimer(options) - expect(parseInt(timer) == parseFloat(timer)).assertEqual(true) - - console.log("start timer") - systemTimer.startTimer(timer, 100000) - - console.log("stop timer") - systemTimer.stopTimer(timer) - - console.log("destroy timer") - systemTimer.destroyTimer(timer) - console.log('SUB_systemTimer_Timer_JS_API_2900 end'); - }); - - /** - * @function Used for callback functions - * @tc.name callbackFunction - */ - function callbackFunction() - { - console.log("Start to call the callback function") - } -}) \ No newline at end of file diff --git a/time/TimerTest_js/src/main/resources/base/element/string.json b/time/TimerTest_js/src/main/resources/base/element/string.json deleted file mode 100644 index 7d8cda7795aa2464c77c5bd64e5da3b1a860ea0b..0000000000000000000000000000000000000000 --- a/time/TimerTest_js/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "JstimerTest" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/time/timeTest/AppScope/app.json b/time/timeTest/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..6802f440a9ba4455a2f1b73aac5670dec2216556 --- /dev/null +++ b/time/timeTest/AppScope/app.json @@ -0,0 +1,15 @@ +{ + "app": { + "bundleName": "com.acts.time.test", + "vendor": "huawei", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive":true, + "singleUser":true, + "minAPIVersion":9, + "targetAPIVersion":9 + } +} diff --git a/time/timeTest/AppScope/resources/base/element/string.json b/time/timeTest/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..066e1ff18115359423b0e6d99014273b2408bdee --- /dev/null +++ b/time/timeTest/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "ActsTimeAPITest" + } + ] +} diff --git a/time/timeTest/AppScope/resources/base/media/app_icon.png b/time/timeTest/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/time/timeTest/AppScope/resources/base/media/app_icon.png differ diff --git a/time/timeTest/BUILD.gn b/time/timeTest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..c6637e0fa8c7d76932895b2bb1d5a6968786c609 --- /dev/null +++ b/time/timeTest/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsTimeAPITest") { + deps = [ + ":time_assets", + ":time_resources", + ] + ets2abc = true + js_build_mode = "debug" + subsystem_name = "time" + part_name = "time_service" + hap_name = "ActsTimeAPITest" + hap_profile = "entry/src/main/module.json" + certificate_profile = "signature/ActsTimeAPITest.p7b" +} + +ohos_app_scope("time_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("time_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("time_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":time_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/time/timeTest/Test.json b/time/timeTest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..0e91ba878d1edb68beda4b9ebcc32158bbd561bd --- /dev/null +++ b/time/timeTest/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "180000", + "bundle-name": "com.acts.time.test", + "module-name": "entry_test", + "shell-timeout": "180000", + "testcase-timeout": 600000 + }, + "kits": [{ + "test-file-name": [ + "ActsTimeAPITest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }] +} diff --git a/time/timeTest/entry/src/main/ets/Application/MyAbilityStage.ts b/time/timeTest/entry/src/main/ets/Application/MyAbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..4bea34b35db86d55f1a555e4bfb97778968567d6 --- /dev/null +++ b/time/timeTest/entry/src/main/ets/Application/MyAbilityStage.ts @@ -0,0 +1,9 @@ +import hilog from '@ohos.hilog'; +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'AbilityStage onCreate'); + } +} \ No newline at end of file diff --git a/time/timeTest/entry/src/main/ets/MainAbility/MainAbility.ts b/time/timeTest/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..9dc331bc8149d36521ac746384d6606c85bd7ee0 --- /dev/null +++ b/time/timeTest/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,66 @@ +import hilog from '@ohos.hilog'; +import Window from '@ohos.window'; +import { Hypium } from '@ohos/hypium'; +import testsuite from '../test/List.test'; +import Ability from '@ohos.application.Ability'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'; + +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability 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.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + if (abilityDelegator != undefined && abilityDelegatorArguments != undefined) { + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite); + } else { + hilog.info(0x0000, 'testTag', '%{public}s', 'abilityDelegator or abilityDelegatorArguments is undefined!!!'); + } + } + + onDestroy() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); + } + + onWindowStageCreate(windowStage: Window.WindowStage) { + // Main window is created, set main page for this ability + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate'); + + windowStage.loadContent('pages/index', (err, data) => { + if (err.code) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR); + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', JSON.stringify(data) ?? ''); + }); + } + + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy'); + } + + onForeground() { + // Ability has brought to foreground + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground'); + } + + onBackground() { + // Ability has back to background + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground'); + } +} diff --git a/time/timeTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/time/timeTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..1b7461ea56b950b1cb879f9269f67e4a441f8ef1 --- /dev/null +++ b/time/timeTest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,71 @@ +import hilog from '@ohos.hilog'; +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() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', '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 MainAbility ' + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + var debug = abilityDelegatorArguments.parameters['-D'] + if (debug == 'true') + { + cmd += ' -D' + } + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + 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/time/timeTest/entry/src/main/ets/pages/index.ets b/time/timeTest/entry/src/main/ets/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..6a23c90b5265a129db7c8cda8bb2e4978f38d386 --- /dev/null +++ b/time/timeTest/entry/src/main/ets/pages/index.ets @@ -0,0 +1,40 @@ + +// @ts-nocheck +/** + * 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 hilog from '@ohos.hilog'; + +@Entry +@Component +struct Index { + aboutToAppear() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); + } + + @State message: string = 'TIME ETS TEST' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/time/timeTest/entry/src/main/ets/test/List.test.ets b/time/timeTest/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..547578579527402967edc7d1673159093c4cc743 --- /dev/null +++ b/time/timeTest/entry/src/main/ets/test/List.test.ets @@ -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. + */ +import systemTimeJsunit from './systemTimeTest'; +import systemTimerJsunit from './systemTimer.test'; + +export default function testsuite() { + systemTimerJsunit(); + systemTimeJsunit(); +} \ No newline at end of file diff --git a/time/timeTest/entry/src/main/ets/test/systemTimeTest.ets b/time/timeTest/entry/src/main/ets/test/systemTimeTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..f62cc6d90021bba76be4a80aee0cd1f469dff5f8 --- /dev/null +++ b/time/timeTest/entry/src/main/ets/test/systemTimeTest.ets @@ -0,0 +1,369 @@ +// @ts-nocheck +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; +import systemTime from "@ohos.systemTime"; + +export default function systemTimeJsunit() { + describe('systemTimeTest', function () { + console.info('--------------------systemTimeTest start-----------------------'); + /** + * @tc.number SUB_systemTime_getCurrentTime_JS_API_0001 + * @tc.name Test systemTime.getCurrentTime + * @tc.desc Obtains the number of milliseconds that have elapsed since the Unix epoch. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it("SUB_systemTime_getCurrentTime_JS_API_0001", 0, async function (done) { + console.info("---------------UB_systemTime_getCurrentTime_JS_API_0001 start----------------"); + systemTime.getCurrentTime(true, (error, data) => { + if (error) { + console.error(`failed to systemTime.getCurrentTime because ` + JSON.stringify(error)); + expect().assertFail(); + }; + console.info(`systemTime.getCurrentTime success data : ` + JSON.stringify(data)); + expect(data != null).assertEqual(true); + }); + + console.info("---------------SUB_systemTime_getRealActiveTime_JS_API_0100 end-----------------"); + done(); + }); + + /** + * @tc.number SUB_systemTime_getCurrentTime_JS_API_0002 + * @tc.name Test systemTime.getCurrentTime + * @tc.desc Obtains the number of milliseconds that have elapsed since the Unix epoch. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it("SUB_systemTime_getCurrentTime_JS_API_0002", 0, async function (done) { + console.info("----------SUB_systemTime_getCurrentTime_JS_API_0002 start----------------"); + systemTime.getCurrentTime(true).then((data) => { + console.info(`systemTime.getCurrentTime promise success data : ` + JSON.stringify(data)); + expect(data != null).assertEqual(true); + }).catch(err => { + console.error(`failed to systemTime.getCurrentTime promise because ` + JSON.stringify(error)); + expect().assertFail() + }); + console.info("----------SUB_systemTime_getCurrentTime_JS_API_0002 end------------"); + done(); + }); + + /** + * @tc.number SUB_systemTime_getRealActiveTime_JS_API_0001 + * @tc.name Test systemTime.getCurrentTime + * @tc.desc Obtains the number of milliseconds elapsed since the system was booted, not including deep sleep time. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it("SUB_systemTime_getRealActiveTime_JS_API_0001", 0, async function (done) { + console.info("---------------SUB_systemTime_getRealActiveTime_JS_API_0001 start----------------"); + systemTime.getRealActiveTime(true, (error, data) => { + if (error) { + console.error(`failed to systemTime.getRealActiveTime because ` + JSON.stringify(error)); + expect().assertFail() + }; + console.info(`systemTime.getRealActiveTime success data : ` + JSON.stringify(data)); + expect(data != null).assertEqual(true); + }); + + console.info("---------------SUB_systemTime_getRealActiveTime_JS_API_0001 end-----------------"); + done(); + }); + + /** + * @tc.number SUB_systemTime_getRealActiveTime_JS_API_0002 + * @tc.name Test systemTime.getCurrentTime + * @tc.desc Obtains the number of milliseconds elapsed since the system was booted, not including deep sleep time. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it("SUB_systemTime_getRealActiveTime_JS_API_0002", 0, async function (done) { + console.info("----------SUB_systemTime_getRealActiveTime_JS_API_0002 start----------------"); + systemTime.getRealActiveTime(true).then((data) => { + onsole.log(`systemTime.getRealActiveTime promise success data : ` + JSON.stringify(data)); + expect(data != null).assertEqual(true); + }).catch(err => { + console.error(`failed to systemTime.getRealActiveTime promise because ` + JSON.stringify(error)); + expect().assertFail() + }); + console.info("----------SUB_systemTime_getRealActiveTime_JS_API_0002 end------------"); + done(); + }); + + /** + * @tc.number SUB_systemTime_getRealTime_JS_API_0001 + * @tc.name Test systemTime.getCurrentTime + * @tc.desc Obtains the number of milliseconds elapsed since the system was booted, including deep sleep time. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it("SUB_systemTime_getRealTime_JS_API_0001", 0, async function (done) { + console.info("---------------SUB_systemTime_getRealTime_JS_API_0001 start----------------"); + systemTime.getRealTime(true, (error, data) => { + if (error) { + console.error(`failed to systemTime.getRealTime because ` + JSON.stringify(error)); + expect().assertFail() + }; + console.info(`systemTime.getRealTime success data : ` + JSON.stringify(data)); + expect(data != null).assertEqual(true); + }); + + console.info("---------------SUB_systemTime_getRealTime_JS_API_0001 end-----------------"); + done(); + }); + + /** + * @tc.number SUB_systemTime_getRealTime_JS_API_0002 + * @tc.name Test systemTime.getCurrentTime + * @tc.desc Obtains the number of milliseconds elapsed since the system was booted, not including deep sleep time. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 1 + */ + it("SUB_systemTime_getRealTime_JS_API_0002", 0, async function (done) { + console.info("----------SUB_systemTime_getRealTime_JS_API_0002 start----------------"); + systemTime.getRealTime(true).then((data) => { + console.info(`systemTime.getRealTime promise success data : ` + JSON.stringify(data)); + expect(data != null).assertEqual(true); + }).catch(err => { + console.error(`failed to systemTime.getRealTime promise because ` + JSON.stringify(error)); + expect().assertFail(); + }); + console.info("----------SUB_systemTime_getRealTime_JS_API_0002 end------------"); + done(); + }); + + /** + * @tc.number SUB_systemTime_setTime_JS_API_0100 + * @tc.name Test systemTime.setTime + * @tc.desc Test systemTime_setTime API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_systemTime_setTime_JS_API_0100', 0, async function (done) { + console.info("SUB_systemTime_setTime_JS_API_0100 start"); + systemTime.setTime(1526003846000) + .then(data =>{ + console.info("setTime ===data " + data); + expect(data).assertEqual(true) + }).catch(error => { + console.info("setTime ===error " + error); + expect(0).assertLarger(1) + }); + console.info('SUB_systemTime_setTime_JS_API_0100 end'); + done(); + }); + + /** + * @tc.number SUB_systemTime_setTime_JS_API_0200 + * @tc.name Test systemTime.setTime Invalid value + * @tc.desc Test systemTime_setTime API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_systemTime_setTime_JS_API_0200', 0, async function (done) { + console.info("SUB_systemTime_setTime_JS_API_0200 start"); + systemTime.setTime(15222) + .then(data => { + console.info("setTime ===data " + data); + expect(true).assertTrue(); + }).catch(error => { + console.info("setTime ===error " + error); + expect(0).assertLarger(1) + }); + console.info('SUB_systemTime_setTime_JS_API_0200 end'); + done(); + }); + + /** + * @tc.number SUB_systemTime_setTime_JS_API_0300 + * @tc.name Test systemTime.setTime3 + * @tc.desc Test systemTime_setTime API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_systemTime_setTime_JS_API_0300', 0, async function (done) { + console.info("SUB_systemTime_setTime_JS_API_0300 start"); + systemTime.setTime(1597156246000, (err, data) => { + if (err) { + console.info("setTime ===error: " + err); + expect().assertFail() + }else{ + console.info("setTime ===data: " + data); + expect(true).assertTrue(); + }; + }); + console.info('SUB_systemTime_setTime_JS_API_0300 end'); + done(); + }); + + /** + * @tc.number SUB_systemTime_setTime_JS_API_0400 + * @tc.name Test systemTime.setTime4 Invalid value + * @tc.desc Test systemTime_setTime API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_systemTime_setTime_JS_API_0400', 0, async function (done) { + console.info("SUB_systemTime_setTime_JS_API_0400 start"); + try{ + systemTime.setTime(18, (err, data) => { + console.info("setTime ===data: " + data); + console.info("setTime ===error: " + err); + expect(true).assertTrue(); + })}catch(error) {error => { + expect(1).assertLarger(0); + }; + }; + console.info('SUB_systemTime_setTime_JS_API_0400 end'); + done(); + }); + + /** + * @tc.number SUB_systemTime_setDate_JS_API_0100 + * @tc.name Test systemTime.setDate Invalid value + * @tc.desc Test systemTime_setDate API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_systemTime_setDate_JS_API_0100', 0, async function (done) { + console.info("SUB_systemTime_setDate_JS_API_0100 start"); + var data = new Date("October 13, 2020 11:13:00"); + systemTime.setDate(1).then(data => { + console.info("setTime ===data " + data); + expect(true).assertTrue(); + }).catch(error => { + console.info("setTime ===error " + error); + expect().assertFail(); + }); + done(); + }); + + /** + * @tc.number SUB_systemTime_setDate_JS_API_0200 + * @tc.name Test systemTime.setDate Invalid value + * @tc.desc Test systemTime_setDate API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_systemTime_setDate_JS_API_0200', 0, async function (done) { + console.info("SUB_systemTime_setDate_JS_API_0200 start"); + systemTime.setDate(0).then(data => { + console.info("setTime ===data " + data); + expect(true).assertTrue(); + }).catch(error => { + console.info("setTime ===error " + error); + expect().assertFail(); + }); + done(); + }); + + /** + * @tc.number SUB_systemTime_setDate_JS_API_0300 + * @tc.name Test systemTime.setDate Invalid value + * @tc.desc Test systemTime_setDate API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_systemTime_setDate_JS_API_0300', 0, async function (done) { + console.info("SUB_systemTime_setDate_JS_API_0300 start"); + var data = new Date("October 13, 2020 11:13:00"); + systemTime.setDate(data, (error, data) => { + if(error){ + console.info("setTime ===error " + error); + expect().assertFail(); + }else{ + console.info("setTime ===data " + data); + expect(true).assertTrue(); + }; + }); + done(); + }); + + /** + * @tc.number SUB_systemTime_setTimezone_JS_API_0100 + * @tc.name Test systemTime.setTimezone Invalid value + * @tc.desc Test systemTime_setTimezone API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_systemTime_setTimezone_JS_API_0100', 0, async function (done) { + console.info("SUB_systemTime_setTimezone_JS_API_0100 start"); + systemTime.setTimezone('Asia, Shanghai').then(data => { + console.info("setTime ===data " + data); + expect().assertFail(); + }).catch(error => { + console.info("setTime ===error " + error); + expect(true).assertTrue(); + }); + done(); + }); + + /** + * @tc.number SUB_systemTime_setTimezone_JS_API_0200 + * @tc.name Test systemTime.setTimezone Invalid value + * @tc.desc Test systemTime_setTimezone API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_systemTime_setTimezone_JS_API_0200', 0, async function (done) { + console.info("SUB_systemTime_setTimezone_JS_API_0200 start"); + systemTime.setTimezone('Beijing,China').then(data => { + console.info("setTime ===data " + data); + expect().assertFail(); + }).catch(error => { + console.info("setTime ===error " + error); + expect(true).assertTrue(); + }); + done(); + }); + + /** + * @tc.number SUB_systemTime_setTimezone_JS_API_0300 + * @tc.name Test systemTime.setTimezone Invalid value + * @tc.desc Test systemTime_setTimezone API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_systemTime_setTimezone_JS_API_0300', 0, async function (done) { + console.info("SUB_systemTime_setTimezone_JS_API_0300 start"); + systemTime.setTimezone('Baker Island, U.S.A.').then(data => { + console.info("setTime ===data " + data); + expect().assertFail(); + }).catch(error => { + console.info("setTime ===error " + error); + expect(true).assertTrue(); + }); + done(); + }); + }) +} diff --git a/time/timeTest/entry/src/main/ets/test/systemTimer.test.ets b/time/timeTest/entry/src/main/ets/test/systemTimer.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8cc91d65bf5373ce9757542326a753af6a920f0a --- /dev/null +++ b/time/timeTest/entry/src/main/ets/test/systemTimer.test.ets @@ -0,0 +1,753 @@ +/* + * 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 WantAgent from '@ohos.wantAgent'; +import systemTimer from "@ohos.systemTimer"; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; + +export default function systemTimerTest() { + describe('systemTimerTest', function () { + console.info('systemTimer Test start'); + //wantAgent对象 + var wantAgent; + + //WantAgentInfo对象 + let wantAgentInfo = { + wants: [ + { + bundleName: "com.acts.time.test", + abilityName: "MainAbility" + } + ], + operationType: WantAgent.OperationType.SEND_COMMON_EVENT, + requestCode: 0, + wantAgentFlags:[WantAgent.WantAgentFlags.NO_BUILD_FLAG] + } + + let interval_time = 5000; + let globalTimerID = undefined; + + /** + * beforeAll: Prerequisites at the test suite level, which are executed before the test suite is executed. + */ + beforeAll(function () { + console.info('beforeAll: Prerequisites are executed.'); + WantAgent.getWantAgent(wantAgentInfo) + .then((data) => { + if ( data != undefined || data != null) { + console.info('beforeAll: success to get wantAgent: ' + typeof(data)); + wantAgent = data; + } + }) + .catch(error => { + console.error('beforeAll: failed to get wantAgent!'); + }); + }); + + /** + * beforeEach: Prerequisites at the test case level, which are executed before each test case is executed. + */ + beforeEach(function () { + console.info('beforeEach: Prerequisites is executed.'); + }); + + /** + * afterEach: Test case-level clearance conditions, which are executed after each test case is executed. + */ + afterEach(function () { + console.info('afterEach: Test case-level clearance conditions is executed.'); + }); + + /** + * afterAll: Test suite-level cleanup condition, which is executed after the test suite is executed. + */ + afterAll(function () { + console.info('afterAll: Test suite-level cleanup condition is executed.'); + }); + + /** + * @tc.number SUB_time_systemTimer_createTimer_0000 + * @tc.name SUB_time_systemTimer_createTimer_0000 + * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_REALTIME, repeat = false (Callback) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_time_systemTimer_createTimer_0000', 0, async function (done) { + console.info('SUB_time_systemTimer_createTimer_0000 start.'); + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat: false + }; + try { + console.info('SUB_time_systemTimer_createTimer_0000 create timer.'); + systemTimer.createTimer(options, function (err, timerID) { + if (err) { + // 处理业务逻辑错误 + expect().assertTrue(); + done(); + } + console.info('SUB_time_systemTimer_createTimer_0000 timerID: ' + timerID); + globalTimerID = timerID; + expect(Number.isInteger(timerID)).assertTrue(); + done(); + }); + } catch (err) { + // 捕获参数错误 + console.info('SUB_time_systemTimer_createTimer_0000 has failed for ' + err); + expect().assertTrue(); + done(); + }; + }); + + /** + * @tc.number SUB_time_systemTimer_createTimer_0001 + * @tc.name SUB_time_systemTimer_createTimer_0001 + * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_IDLE, repeat = true (callback) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_time_systemTimer_createTimer_0001', 0, async function (done) { + console.info('SUB_time_systemTimer_createTimer_0001 start.'); + let options = { + type: systemTimer.TIMER_TYPE_IDLE, + repeat: false + }; + try { + systemTimer.createTimer(options, function (err, timerID) { + if (err) { + console.info('SUB_time_systemTimer_createTimer_0001 wrong since ' + err.code); + expect().assertTrue(); + done(); + }; + console.info('SUB_time_systemTimer_createTimer_0001 timerID: ' + timerID); + expect(Number.isInteger(timerID)).assertTrue(); + done(); + }); + } catch (e) { + console.info('SUB_time_systemTimer_createTimer_0001 arv wrong since ' + e.code); + expect().assertTrue(); + done(); + }; + }); + + /** + * @tc.number SUB_time_systemTimer_createTimer_0002 + * @tc.name SUB_time_systemTimer_createTimer_0002 + * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_WAKEUP, repeat = true, interval (Callback) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_time_systemTimer_createTimer_0002', 2, async function (done) { + console.info("SUB_time_systemTimer_createTimer_0002 start"); + WantAgent.getBundleName(wantAgent, (err, data)=>{ + console.info('SUB_time_systemTimer_createTimer_0002 BundleName: ' + data); + }) + let options = { + type: systemTimer.TIMER_TYPE_WAKEUP, + repeat: true, + wantAgent: wantAgent, + interval: interval_time + }; + try { + console.info("SUB_time_systemTimer_createTimer_0002 create timer") + systemTimer.createTimer(options, function (err, timerID) { + if (err) { + console.info('SUB_time_systemTimer_createTimer_0002 wrong since ' + err.code); + expect().assertTrue(); + done(); + } + console.info('SUB_time_systemTimer_createTimer_0002 timerID: ' + timerID); + expect(Number.isInteger(timerID)).assertTrue(); + done(); + }); + } catch (e) { + console.info('SUB_time_systemTimer_createTimer_0002 arv wrong since ' + e); + expect().assertTrue(); + done(); + }; + }); + + /** + * @tc.number SUB_time_systemTimer_createTimer_0003 + * @tc.name SUB_time_systemTimer_createTimer_0003 + * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_EXACT, repeat = false (Callback) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_time_systemTimer_createTimer_0003', 2, async function (done) { + console.info("SUB_time_systemTimer_createTimer_0003 start"); + let options = { + type: systemTimer.TIMER_TYPE_EXACT, + repeat: false + }; + try { + console.info("SUB_time_systemTimer_createTimer_0003 create timer") + systemTimer.createTimer(options, function (err, timerID) { + if (err) { + console.info('SUB_time_systemTimer_createTimer_0003 wrong since ' + err.code); + expect().assertTrue(); + done(); + } + expect(Number.isInteger(timerID)).assertTrue(); + done(); + }); + } catch (e) { + console.info('SUB_time_systemTimer_createTimer_0002 arv wrong since ' + e); + expect().assertTrue(); + done(); + }; + }); + + /** + * @tc.number SUB_time_systemTimer_createTimer_0004 + * @tc.name SUB_time_systemTimer_createTimer_0004 + * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_REALTIME, repeat = false, wantAgent(callback) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_time_systemTimer_createTimer_0004', 2, async function (done) { + console.info("SUB_time_systemTimer_createTimer_0004 start"); + WantAgent.getBundleName(wantAgent, (err, data)=>{ + console.info("SUB_time_systemTimer_createTimer_0004 BundleName: " + data); + }); + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat: true, + wantAgent: wantAgent, + interval: interval_time + }; + try { + console.info("SUB_time_systemTimer_createTimer_0004 create timer") + systemTimer.createTimer(options, function (err, timerID) { + if (err) { + expect().assertTrue(); + done(); + }; + expect(Number.isInteger(timerID)).assertTrue(); + done(); + }); + } catch (e) { + console.info('SUB_time_systemTimer_createTimer_0004 has failed for ' + e); + expect().assertTrue(); + done(); + }; + }); + + + /** + * @tc.number SUB_time_systemTimer_createTimer_0005 + * @tc.name SUB_time_systemTimer_createTimer_0005 + * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_REALTIME, repeat = false (Callback) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_time_systemTimer_createTimer_0005', 0, async function (done) { + console.info('SUB_time_systemTimer_createTimer_0005 start.'); + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat: false + }; + try { + console.info('SUB_time_systemTimer_createTimer_0005 create timer.'); + systemTimer.createTimer(options).then((timerID) =>{ + console.info('SUB_time_systemTimer_createTimer_0005 timerID: ' + timerID); + expect(Number.isInteger(timerID)).assertTrue(); + done(); + }).catch(err => { + console.info('SUB_time_systemTimer_createTimer_0005 promise failed ' + err); + expect().assertTrue(); + done(); + }); + } catch (err) { + console.info('SUB_time_systemTimer_createTimer_0005 has failed for ' + err); + expect().assertTrue(); + done(); + }; + }); + + /** + * @tc.number SUB_time_systemTimer_createTimer_0006 + * @tc.name SUB_time_systemTimer_createTimer_0006 + * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_IDLE, repeat = true (callback) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_time_systemTimer_createTimer_0006', 0, async function (done) { + console.info('SUB_time_systemTimer_createTimer_0006 start.'); + let options = { + type: systemTimer.TIMER_TYPE_IDLE, + repeat: false + }; + try { + systemTimer.createTimer(options).then((timerID) => { + console.info('SUB_time_systemTimer_createTimer_0006 timerID: ' + timerID); + expect(Number.isInteger(timerID)).assertTrue(); + done(); + }).catch(err => { + console.info('SUB_time_systemTimer_createTimer_0006 promise failed ' + err); + expect().assertTrue(); + done(); + }); + } catch (e) { + console.info('SUB_time_systemTimer_createTimer_0006 arv wrong since ' + e.code); + expect().assertTrue(); + done(); + }; + }); + + /** + * @tc.number SUB_time_systemTimer_createTimer_0007 + * @tc.name SUB_time_systemTimer_createTimer_0007 + * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_WAKEUP, repeat = true, interval (Callback) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_time_systemTimer_createTimer_0007', 2, async function (done) { + console.info("SUB_time_systemTimer_createTimer_0007 start"); + WantAgent.getBundleName(wantAgent, (err, data)=>{ + console.info('SUB_time_systemTimer_createTimer_0007 BundleName: ' + data); + }) + let options = { + type: systemTimer.TIMER_TYPE_WAKEUP, + repeat: true, + wantAgent: wantAgent, + interval: interval_time + }; + try { + console.info("SUB_time_systemTimer_createTimer_0007 create timer"); + systemTimer.createTimer(options).then((timerID) => { + console.info('SUB_time_systemTimer_createTimer_0007 timerID: ' + timerID); + expect(Number.isInteger(timerID)).assertTrue(); + done(); + }).catch(err => { + console.info('SUB_time_systemTimer_createTimer_0007 promise failed ' + err); + expect().assertTrue(); + done(); + }); + } catch (e) { + console.info('SUB_time_systemTimer_createTimer_0007 arv wrong since ' + e); + expect().assertTrue(); + done(); + }; + }); + + /** + * @tc.number SUB_time_systemTimer_createTimer_0008 + * @tc.name SUB_time_systemTimer_createTimer_0008 + * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_EXACT, repeat = false (Callback) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_time_systemTimer_createTimer_0008', 2, async function (done) { + console.info("SUB_time_systemTimer_createTimer_0008 start"); + let options = { + type: systemTimer.TIMER_TYPE_EXACT, + repeat: false + }; + try { + console.info("SUB_time_systemTimer_createTimer_0008 create timer") + systemTimer.createTimer(options).then((timerID) => { + expect(Number.isInteger(timerID)).assertTrue(); + done(); + }).catch(err => { + console.info('SUB_time_systemTimer_createTimer_0008 promise failed ' + err); + expect().assertTrue(); + done(); + }); + } catch (e) { + console.info('SUB_time_systemTimer_createTimer_0008 arv wrong since ' + e); + expect().assertTrue(); + done(); + }; + }); + + /** + * @tc.number SUB_time_systemTimer_createTimer_0009 + * @tc.name SUB_time_systemTimer_createTimer_0009 + * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_REALTIME, repeat = false, wantAgent(callback) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 2 + */ + it('SUB_time_systemTimer_createTimer_0009', 2, async function (done) { + console.info("SUB_time_systemTimer_createTimer_0009 start"); + WantAgent.getBundleName(wantAgent, (err, data)=>{ + console.info("SUB_time_systemTimer_createTimer_0009 BundleName: " + data); + }); + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat: true, + wantAgent: wantAgent, + interval: interval_time + }; + try { + console.info("SUB_time_systemTimer_createTimer_0009 create timer") + systemTimer.createTimer(options).then((timerID) => { + expect(Number.isInteger(timerID)).assertTrue(); + done(); + }).catch(err => { + console.info('SUB_time_systemTimer_createTimer_0009 promise failed ' + err); + expect().assertTrue(); + done(); + }); + } catch (e) { + console.info('SUB_time_systemTimer_createTimer_0009 has failed for ' + e); + expect().assertTrue(); + done(); + }; + }); + + /** + * @tc.number SUB_time_systemTimer_startTimer_0001 + * @tc.name SUB_time_systemTimer_startTimer_0001 + * @tc.desc Test startTimer() interfaces, normal call(callback) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_time_systemTimer_startTimer_0001', 0, async function (done) { + console.info("SUB_time_systemTimer_startTimer_0001 start"); + try { + console.info("SUB_time_systemTimer_startTimer_0001 start timer, timerID: " + globalTimerID) + let triggerTime = new Date().getTime() + interval_time * 1.2; + systemTimer.startTimer(globalTimerID, triggerTime, function (err, data) { + if (err) { + console.info('SUB_time_systemTimer_startTimer_0001 wrong since ' + err.code); + expect().assertTrue(); + done(); + } + console.info("SUB_time_systemTimer_startTimer_0001 success to start timerID: " + globalTimerID); + done(); + }); + } catch (e) { + console.info('SUB_time_systemTimer_startTimer_0001 has failed for ' + e); + expect().assertTrue(); + done(); + }; + }); + + /** + * @tc.number SUB_time_systemTimer_stopTimer_0001 + * @tc.name SUB_time_systemTimer_stopTimer_0001 + * @tc.desc Test startTimer() interfaces, normal call(callback) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_time_systemTimer_stopTimer_0001', 0, async function (done) { + console.info("SUB_time_systemTimer_stopTimer_0001 start"); + try { + console.info("SUB_time_systemTimer_stopTimer_0001 stop timer, timerID: " + globalTimerID) + systemTimer.stopTimer(globalTimerID, function (err, data) { + if (err) { + expect().assertTrue(); + done(); + }; + console.info("SUB_time_systemTimer_stopTimer_0001 success to stop timerID: " + globalTimerID); + done(); + }); + } catch (e) { + console.info('SUB_time_systemTimer_stopTimer_0001 has failed for ' + e); + expect().assertTrue(); + done(); + }; + }); + + /** + * @tc.number SUB_time_systemTimer_destroyTimer_0001 + * @tc.name SUB_time_systemTimer_destroyTimer_0001 + * @tc.desc Test startTimer() interfaces, normal call(callback) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_time_systemTimer_destroyTimer_0001', 0, async function (done) { + console.info("SUB_time_systemTimer_destroyTimer_0001 start"); + try { + console.info("SUB_time_systemTimer_destroyTimer_0001 destroy timer, timerID: " + globalTimerID) + systemTimer.destroyTimer(globalTimerID, function (err, data) { + if (err) { + expect().assertTrue(); + done(); + }; + console.info("SUB_time_systemTimer_destroyTimer_0001 success to destroy timerID: " + globalTimerID); + done(); + }); + } catch (e) { + console.info('SUB_time_systemTimer_destroyTimer_0001 has failed for ' + e); + expect().assertTrue(); + done(); + }; + }); + + /** + * @tc.number SUB_time_systemTimer_createTimer_0002 + * @tc.name SUB_time_systemTimer_createTimer_0002 + * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_REALTIME, repeat = false (Promise) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_time_systemTimer_createTimer_0002', 0, async function (done) { + console.info('SUB_time_systemTimer_createTimer_0002 start.'); + let options = { + type: systemTimer.TIMER_TYPE_REALTIME, + repeat: false + }; + try { + console.info('SUB_time_systemTimer_createTimer_0002 create timer.'); + systemTimer.createTimer(options).then((timerID)=>{ + console.info('SUB_time_systemTimer_createTimer_0002 timerID:' + timerID); + expect(Number.isInteger(timerID)).assertTrue(); + globalTimerID = timerID; + done(); + }).catch( error => { + // 捕获业务逻辑错误 + console.info('SUB_time_systemTimer_createTimer_0002 failed to create timer.'); + expect().assertTrue(); + done(); + }); + } catch (err) { + // 捕获参数错误 + console.info('SUB_time_systemTimer_createTimer_0002 has failed for ' + err); + expect().assertTrue(); + done(); + }; + }); + + /** + * @tc.number SUB_time_systemTimer_startTimer_0002 + * @tc.name SUB_time_systemTimer_startTimer_0002 + * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_REALTIME, repeat = true (Promise) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_time_systemTimer_startTimer_0002', 0, async function (done) { + console.info('SUB_time_systemTimer_startTimer_0002 start.'); + try { + console.info('SUB_time_systemTimer_startTimer_0002 start timer, timerID: ' + globalTimerID); + let triggerTime = new Date().getTime() + interval_time * 2; + systemTimer.startTimer(globalTimerID, triggerTime) + .then(()=>{ + console.info('SUB_time_systemTimer_startTimer_0002 timerID:' + globalTimerID); + done(); + }).catch(()=>{ + // 捕获业务逻辑错误 + console.info('SUB_time_systemTimer_startTimer_0002 failed to start timer.'); + expect().assertTrue(); + done(); + }); + } catch (err) { + // 捕获参数错误 + console.info('SUB_time_systemTimer_startTimer_0002 has failed for ' + err); + expect().assertTrue(); + done(); + } + }); + + /** + * @tc.number SUB_time_systemTimer_stopTimer_0002 + * @tc.name SUB_time_systemTimer_stopTimer_0002 + * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_REALTIME, repeat = true (Promise) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_time_systemTimer_stopTimer_0002', 0, async function (done) { + console.info('SUB_time_systemTimer_stopTimer_0002 start.'); + try { + console.info('SUB_time_systemTimer_stopTimer_0002 stop timer, timerID: ' + globalTimerID); + systemTimer.stopTimer(globalTimerID) + .then(()=>{ + console.info('SUB_time_systemTimer_stopTimer_0002 timerID:' + globalTimerID); + done(); + }).catch(()=>{ + // 捕获业务逻辑错误 + console.info('SUB_time_systemTimer_stopTimer_0002 failed to stop timer.'); + expect().assertTrue(); + done(); + }); + } catch (err) { + // 捕获参数错误 + console.info('SUB_time_systemTimer_stopTimer_0002 has failed for ' + err); + expect().assertTrue(); + done(); + }; + }); + + /** + * @tc.number SUB_time_systemTimer_destroyTimer_0002 + * @tc.name SUB_time_systemTimer_destroyTimer_0002 + * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_REALTIME, repeat = true (Promise) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_time_systemTimer_destroyTimer_0002', 0, async function (done) { + console.info('SUB_time_systemTimer_destroyTimer_0002 start.'); + try { + console.info('SUB_time_systemTimer_destroyTimer_0002 destroy timer, timerID: ' + globalTimerID); + systemTimer.destroyTimer(globalTimerID) + .then(()=>{ + console.info('SUB_time_systemTimer_destroyTimer_0002 timerID:' + globalTimerID); + done(); + }).catch(()=>{ + // 捕获业务逻辑错误 + console.info('SUB_time_systemTimer_destroyTimer_0002 failed to destroy timer.'); + expect().assertTrue(); + done(); + }); + } catch (err) { + // 捕获参数错误 + console.info('SUB_time_systemTimer_stopTimer_0002 has failed for ' + err); + expect().assertTrue(); + done(); + }; + }); + + /** + * @tc.number SUB_time_systemTimer_ALL_Promise_0008 + * @tc.name SUB_time_systemTimer_ALL_Promise_0008 + * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_WAKEUP, repeat = false (Promise) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_time_systemTimer_ALL_Promise_0008', 0, async function (done) { + console.info('SUB_time_systemTimer_ALL_Promise_0008 start.'); + let options = { + type: systemTimer.TIMER_TYPE_WAKEUP, + repeat: false + }; + try { + console.info('SUB_time_systemTimer_ALL_Promise_0008 create timer.'); + systemTimer.createTimer(options) + .then((timerID)=>{ + console.info('SUB_time_systemTimer_ALL_Promise_0008 timerID:' + timerID); + expect(Number.isInteger(timerID)).assertTrue(); + try { + let triggerTime = new Date().getTime() + interval_time * 1.2; + systemTimer.startTimer(timerID, triggerTime) + .then(()=>{ + console.info('SUB_time_systemTimer_ALL_Promise_0008 start timerID: ' + timerID); + try { + systemTimer.stopTimer(timerID) + .then(()=>{ + systemTimer.destroyTimer(timerID, function (err, data) { + console.info('SUB_time_systemTimer_ALL_Promise_0008 destroyTimer: ' + timerID); + done(); + }); + }) + .catch(()=>{ + // 捕获stopTimer业务逻辑错误 + console.info('SUB_time_systemTimer_ALL_Promise_0008 failed to stop timer.'); + expect().assertTrue(); + done(); + }) + } catch (err) { + // 捕获stopTimer参数错误 + console.info('SUB_time_systemTimer_ALL_Promise_0008 stopTimer with wrong arg: ' + err); + expect().assertTrue(); + done(); + } + }) + .catch(()=>{ + // 捕获startTimer业务逻辑错误 + console.info('SUB_time_systemTimer_ALL_Promise_0008 failed to stop timer.'); + expect().assertTrue(); + done(); + }); + } catch (err) { + // 捕获参数错误 + console.info('SUB_time_systemTimer_ALL_Promise_0008 startTimer with wrong arg: ' + err); + expect().assertTrue(); + done(); + } + }) + .catch(()=>{ + // 捕获业务逻辑错误 + console.info('SUB_time_systemTimer_ALL_Promise_0008 failed to create timer.'); + expect().assertTrue(); + done(); + }); + } catch (err) { + // 捕获参数错误 + console.info('SUB_time_systemTimer_ALL_Promise_0008 createTimer with wrong arg: ' + err); + expect().assertTrue(); + done(); + } + }); + + /** + * @tc.number SUB_time_systemTimer_ALL_Callback_0009 + * @tc.name SUB_time_systemTimer_ALL_Callback_0009 + * @tc.desc Test createTimer() interfaces, type = TIMER_TYPE_WAKEUP, repeat = false (Promise) + * @tc.size MEDIUM + * @tc.type Function + * @tc.level Level 0 + */ + it('SUB_time_systemTimer_ALL_Callback_0009', 0, async function (done) { + console.info('SUB_time_systemTimer_ALL_Callback_0009 start.'); + let options = { + type: systemTimer.TIMER_TYPE_WAKEUP, + repeat: false + }; + try { + console.info('SUB_time_systemTimer_ALL_Callback_0009 create timer.'); + systemTimer.createTimer(options) + .then((timerID)=>{ + console.info('SUB_time_systemTimer_ALL_Callback_0009 timerID:' + timerID); + expect(Number.isInteger(timerID)).assertTrue(); + try { + let triggerTime = new Date().getTime() + interval_time * 1.2; + systemTimer.startTimer(timerID, triggerTime, ()=>{ + console.info('SUB_time_systemTimer_ALL_Callback_0009 start timerID: ' + timerID); + try { + systemTimer.stopTimer(timerID, ()=>{ + systemTimer.destroyTimer(timerID, function (err, data) { + console.info('SUB_time_systemTimer_ALL_Callback_0009 destroyTimer: ' + timerID); + done(); + }); + }) + } catch (err) { + console.info('SUB_time_systemTimer_ALL_Callback_0009 stopTimer with wrong arg: ' + err); + expect().assertTrue(); + done(); + } + }) + } catch (err) { + console.info('SUB_time_systemTimer_ALL_Callback_0009 startTimer with wrong arg: ' + err); + expect().assertTrue(); + done(); + } + }) + } catch (err) { + console.info('SUB_time_systemTimer_ALL_Callback_0009 createTimer with wrong arg: ' + err); + expect().assertTrue(); + done(); + } + }); + }); +} \ No newline at end of file diff --git a/time/timeTest/entry/src/main/module.json b/time/timeTest/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..bb6b68544d9b4cb04d6c65675e1cda7ea72f6e8c --- /dev/null +++ b/time/timeTest/entry/src/main/module.json @@ -0,0 +1,48 @@ +{ + "module": { + "name": "entry_test", + "type": "entry", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:white", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ], + "requestPermissions": [ + { + "name":"ohos.permission.SET_TIME", + "reason":"need use ohos.permission.SET_TIME." + }, + { + "name":"ohos.permission.SET_TIME_ZONE", + "reason":"need use ohos.permission.SET_TIME_ZONE." + } + ] + } +} \ No newline at end of file diff --git a/time/timeTest/entry/src/main/resources/base/element/color.json b/time/timeTest/entry/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..62a137a61b90c14f109ed8c81d9d551ea0a5888a --- /dev/null +++ b/time/timeTest/entry/src/main/resources/base/element/color.json @@ -0,0 +1,8 @@ +{ + "color": [ + { + "name": "white", + "value": "#FFFFFF" + } + ] +} \ No newline at end of file diff --git a/time/timeTest/entry/src/main/resources/base/element/string.json b/time/timeTest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..03bb7d00f7c5bd5750f08b254e645f0d3f960804 --- /dev/null +++ b/time/timeTest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,16 @@ +{ + "string": [ + { + "name": "entry_desc", + "value": "description" + }, + { + "name": "MainAbility_desc", + "value": "description" + }, + { + "name": "MainAbility_label", + "value": "ActsTimeAPITest" + } + ] +} \ No newline at end of file diff --git a/time/timeTest/entry/src/main/resources/base/media/icon.png b/time/timeTest/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/time/timeTest/entry/src/main/resources/base/media/icon.png differ diff --git a/time/timeTest/entry/src/main/resources/base/profile/main_pages.json b/time/timeTest/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..feec276e105eeb8d621c20aaf838f318b0a94150 --- /dev/null +++ b/time/timeTest/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,5 @@ +{ + "src": [ + "pages/index" + ] +} diff --git a/time/timeTest/signature/ActsTimeAPITest.p7b b/time/timeTest/signature/ActsTimeAPITest.p7b new file mode 100644 index 0000000000000000000000000000000000000000..e1caf6086a82e9791735e52954e2d5cdc0d40624 Binary files /dev/null and b/time/timeTest/signature/ActsTimeAPITest.p7b differ diff --git a/update_lite/dupdate_posix/BUILD.gn b/update_lite/dupdate_posix/BUILD.gn index e993c2dc9e9b7e562b7158e349ae249e1d47cab8..ca93d50eaf88da4e1e075acd4d8e9c7b3b6bda34 100755 --- a/update_lite/dupdate_posix/BUILD.gn +++ b/update_lite/dupdate_posix/BUILD.gn @@ -20,7 +20,7 @@ hcpptest_suite("ActsUpdateTest") { include_dirs = [ "//base/update/ota_lite/interfaces/kits", "//base/update/ota_lite/hals", - "//utils/native/lite/include", + "//commonlibrary/utils_lite/include", ] deps = [ "$ohos_third_party_dir/mbedtls:mbedtls_static", diff --git a/usb/usb_standard/src/main/config.json b/usb/usb_standard/src/main/config.json index ff11f31f9f24f42a924472800ea1b9412171f2d3..426fe97ab4c7ef2911a1da5e4f1f0574dd778c02 100644 --- a/usb/usb_standard/src/main/config.json +++ b/usb/usb_standard/src/main/config.json @@ -16,6 +16,7 @@ "package": "ohos.acts.usb.usb.function", "name": ".entry", "deviceType": [ + "default", "phone" ], "distro": { diff --git a/usb/usb_standard/src/main/js/test/UsbAutoJsunit.test.js b/usb/usb_standard/src/main/js/test/UsbAutoJsunit.test.js index 0543745ef38cea295ef5f9a98bc43646166f816f..fc3dc3b551bc08a614e48472ecf6659dd397249a 100644 --- a/usb/usb_standard/src/main/js/test/UsbAutoJsunit.test.js +++ b/usb/usb_standard/src/main/js/test/UsbAutoJsunit.test.js @@ -132,7 +132,7 @@ describe('UsbAutoJsunit', function () { console.info('usb SUB_USB_JS_0980 begin'); var maskCode = 5 var strMaskCode = usb.usbFunctionsToString(maskCode) - expect(strMaskCode).assertEqual('hdc,acm'); + expect(strMaskCode).assertEqual('acm,hdc'); console.info('usb case maskCode ' + maskCode + ' usbFunctionsToString return int: ' + strMaskCode); console.info('usb SUB_USB_JS_0980 : PASS'); }) @@ -146,7 +146,7 @@ describe('UsbAutoJsunit', function () { console.info('usb SUB_USB_JS_0990 begin'); var maskCode = 6 var strMaskCode = usb.usbFunctionsToString(maskCode) - expect(strMaskCode).assertEqual('hdc,ecm'); + expect(strMaskCode).assertEqual('ecm,hdc'); console.info('usb case maskCode ' + maskCode + ' usbFunctionsToString return int: ' + strMaskCode); console.info('usb SUB_USB_JS_0990 : PASS'); }) diff --git a/usb/usb_standard/src/main/js/test/UsbCoreJsunit.test.js b/usb/usb_standard/src/main/js/test/UsbCoreJsunit.test.js index 708f69cd33b889afcc39e658a8ee0075bb55b40e..9a3b933a29bf3fa3ff817aee6a6512fa3ee87dfa 100644 --- a/usb/usb_standard/src/main/js/test/UsbCoreJsunit.test.js +++ b/usb/usb_standard/src/main/js/test/UsbCoreJsunit.test.js @@ -141,6 +141,7 @@ describe('UsbCoreJsFunctionsTest', function () { console.info('usb case device request right failed : ' + error + ' :' + gDeviceList[i].name); expect(false).assertTrue(); }); + CheckEmptyUtils.sleep(5000); } }) @@ -168,7 +169,7 @@ describe('UsbCoreJsFunctionsTest', function () { }).catch(error => { console.info('usb 01 requestRight error:' + error); }); - CheckEmptyUtils.sleep(3000) + CheckEmptyUtils.sleep(5000) } gPipe = usb.connectDevice(gDeviceList[0]) diff --git a/usb/usb_standard/src/main/js/test/UsbCoreJsunitEx.test.js b/usb/usb_standard/src/main/js/test/UsbCoreJsunitEx.test.js index 1685e45617d21c494314d466d448accdaaf619e1..3eeb5f217ce01a8bbaa367e787c8f26e09135604 100644 --- a/usb/usb_standard/src/main/js/test/UsbCoreJsunitEx.test.js +++ b/usb/usb_standard/src/main/js/test/UsbCoreJsunitEx.test.js @@ -41,6 +41,7 @@ describe('UsbCoreJsFunctionsTestEx', function () { }).catch(error => { console.info('usb case setPortRolesEx error : ' + error); }); + CheckEmptyUtils.sleep(8000) console.log('*************Usb Unit Begin switch to host*************'); } } else { @@ -84,7 +85,7 @@ describe('UsbCoreJsFunctionsTestEx', function () { console.info('usb JS_0100 requestRight error:' + error); }); console.info('usb JS_0100 requestRight end:'); - CheckEmptyUtils.sleep(3000) + CheckEmptyUtils.sleep(5000) } var device = JSON.parse(JSON.stringify(gDeviceList[0])); @@ -126,7 +127,7 @@ describe('UsbCoreJsFunctionsTestEx', function () { console.info('usb JS_0110 requestRight error:' + error); }); console.info('usb JS_0110 requestRight end:'); - CheckEmptyUtils.sleep(3000) + CheckEmptyUtils.sleep(5000) } var device = JSON.parse(JSON.stringify(gDeviceList[0])); @@ -167,7 +168,7 @@ describe('UsbCoreJsFunctionsTestEx', function () { console.info('usb JS_0120 requestRight error:' + error); }); console.info('usb JS_0120 requestRight end:'); - CheckEmptyUtils.sleep(3000) + CheckEmptyUtils.sleep(5000) } var device = JSON.parse(JSON.stringify(gDeviceList[0])); @@ -211,7 +212,7 @@ describe('UsbCoreJsFunctionsTestEx', function () { console.info('usb JS_0130 requestRight error:' + error); }); console.info('usb JS_0130 requestRight end:'); - CheckEmptyUtils.sleep(3000) + CheckEmptyUtils.sleep(5000) } var device = JSON.parse(JSON.stringify(gDeviceList[0])); @@ -223,10 +224,7 @@ describe('UsbCoreJsFunctionsTestEx', function () { console.info('usb connectDevice fail:' + err); } console.info('usb case connectDevice ret: ' + JSON.stringify(usbDevicePipe) + ' name ' + device.name); - expect(CheckEmptyUtils.isEmpty(usbDevicePipe)).assertFalse(); - var isPipClose = usb.closePipe(usbDevicePipe); - console.info('usb case closePipe ret: ' + isPipClose); - expect(isPipClose).assertEqual(0); + expect(CheckEmptyUtils.isEmpty(usbDevicePipe)).assertTrue(); console.info('usb SUB_USB_JS_0130 : PASS'); }) @@ -254,7 +252,7 @@ describe('UsbCoreJsFunctionsTestEx', function () { console.info('usb JS_0140 requestRight error:' + error); }); console.info('usb JS_0140 requestRight end:'); - CheckEmptyUtils.sleep(3000) + CheckEmptyUtils.sleep(5000) } var device = JSON.parse(JSON.stringify(gDeviceList[0])); @@ -267,10 +265,7 @@ describe('UsbCoreJsFunctionsTestEx', function () { } console.info('usb case connectDevice ret: ' + JSON.stringify(usbDevicePipe) + ' manufacturerName ' + device.manufacturerName); - expect(CheckEmptyUtils.isEmpty(usbDevicePipe)).assertFalse(); - var isPipClose = usb.closePipe(usbDevicePipe); - console.info('usb case closePipe ret: ' + isPipClose); - expect(isPipClose).assertEqual(0); + expect(CheckEmptyUtils.isEmpty(usbDevicePipe)).assertTrue(); console.info('usb SUB_USB_JS_0140 : PASS'); }) @@ -298,7 +293,7 @@ describe('UsbCoreJsFunctionsTestEx', function () { console.info('usb SUB_USB_JS_0150 requestRight error:' + error); }); console.info('usb SUB_USB_JS_0150 requestRight end:'); - CheckEmptyUtils.sleep(3000) + CheckEmptyUtils.sleep(5000) } var device = JSON.parse(JSON.stringify(gDeviceList[0])); @@ -342,7 +337,7 @@ describe('UsbCoreJsFunctionsTestEx', function () { console.info('usb SUB_USB_JS_0160 requestRight error:' + error); }); console.info('usb SUB_USB_JS_0160 requestRight end:'); - CheckEmptyUtils.sleep(3000) + CheckEmptyUtils.sleep(5000) } var device = JSON.parse(JSON.stringify(gDeviceList[0])); @@ -386,7 +381,7 @@ describe('UsbCoreJsFunctionsTestEx', function () { console.info('usb SUB_USB_JS_0170 requestRight error:' + error); }); console.info('usb SUB_USB_JS_0170 requestRight end:'); - CheckEmptyUtils.sleep(3000) + CheckEmptyUtils.sleep(5000) } var device = JSON.parse(JSON.stringify(gDeviceList[0])); @@ -430,7 +425,7 @@ describe('UsbCoreJsFunctionsTestEx', function () { console.info('usb SUB_USB_JS_0180 requestRight error:' + error); }); console.info('usb SUB_USB_JS_0180 requestRight end:'); - CheckEmptyUtils.sleep(3000) + CheckEmptyUtils.sleep(5000) } var device = JSON.parse(JSON.stringify(gDeviceList[0])); @@ -474,7 +469,7 @@ describe('UsbCoreJsFunctionsTestEx', function () { console.info('usb SUB_USB_JS_0190 requestRight error:' + error); }); console.info('usb SUB_USB_JS_0190 requestRight end:'); - CheckEmptyUtils.sleep(3000) + CheckEmptyUtils.sleep(5000) } var device = JSON.parse(JSON.stringify(gDeviceList[0])); @@ -517,7 +512,7 @@ describe('UsbCoreJsFunctionsTestEx', function () { console.info('usb SUB_USB_JS_0200 requestRight error:' + error); }); console.info('usb SUB_USB_JS_0200 requestRight end:'); - CheckEmptyUtils.sleep(3000) + CheckEmptyUtils.sleep(5000) } var device = JSON.parse(JSON.stringify(gDeviceList[0])); @@ -560,7 +555,7 @@ describe('UsbCoreJsFunctionsTestEx', function () { console.info('usb SUB_USB_JS_0210 requestRight error:' + error); }); console.info('usb SUB_USB_JS_0210 requestRight end:'); - CheckEmptyUtils.sleep(3000) + CheckEmptyUtils.sleep(5000) } var device = JSON.parse(JSON.stringify(gDeviceList[0])); @@ -668,6 +663,7 @@ describe('UsbCoreJsFunctionsTestEx', function () { expect(error).assertFalse(); console.info('usb SUB_USB_JS_0690 error: ' + error); }); + CheckEmptyUtils.sleep(5000); } }) @@ -700,6 +696,7 @@ describe('UsbCoreJsFunctionsTestEx', function () { expect(error).assertFalse(); console.info('usb SUB_USB_JS_0700 error: ' + error); }); + CheckEmptyUtils.sleep(5000); } }) }) diff --git a/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit.test.js b/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit.test.js index a23cbe461a8034e98059c6fabbb8fe370923e54a..a2ad02d7d28be59836181f2897241c57ab4bc5d4 100644 --- a/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit.test.js +++ b/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit.test.js @@ -43,6 +43,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { }).catch(error => { console.info('usb case setPortRoles error : ' + error); }); + CheckEmptyUtils.sleep(8000) console.log('*************Usb Unit switch to host Begin*************'); } } else { @@ -171,6 +172,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { console.info('usb case readData error : ' + JSON.stringify(error)); expect(false).assertTrue(); }); + CheckEmptyUtils.sleep(3000); }) /** @@ -212,7 +214,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { console.info('usb write error : ' + JSON.stringify(error)); expect(false).assertTrue(); }); - + CheckEmptyUtils.sleep(3000); }) /** @@ -260,14 +262,16 @@ describe('UsbDevicePipeJsFunctionsTest', function () { expect(true).assertTrue(); }) - function getTransferParam(iCmd, iReqType, iValue, iIndex) { + function getTransferParam(iCmd, iReqTarType, iReqType, iValue, iIndex) { var tmpUint8Array = new Uint8Array(512); var requestCmd = iCmd + var requestTargetType = iReqTarType var requestType = iReqType var value = iValue; var index = iIndex; var controlParam = { request: requestCmd, + target: requestTargetType, reqType: requestType, value: value, index: index, @@ -411,6 +415,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { console.info('usb' + caseName + ': PASS'); expect(false).assertTrue(); }); + CheckEmptyUtils.sleep(3000); } /** @@ -432,7 +437,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(6, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(6, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0540 GetDescriptor') }) @@ -456,7 +461,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(0, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(0, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0550 GetStatus') }) @@ -480,7 +485,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(8, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(8, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0560 GetConfiguration') }) @@ -504,7 +509,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(10, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(10, usb.USB_REQUEST_TARGET_INTERFACE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_INTERFACE & 0x1f), 0, 1) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0570 GetInterface') }) @@ -528,7 +533,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(1, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + var controlParam = getTransferParam(1, usb.USB_REQUEST_TARGET_DEVICE, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_DEVICE & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0580 ClearFeature') }) @@ -552,7 +557,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) + var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_INTERFACE, (usb.USB_REQUEST_DIR_FROM_DEVICE << 7) | (usb.USB_REQUEST_TYPE_STANDARD << 5) | (usb.USB_REQUEST_TARGET_INTERFACE & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0590 ClearFeature') }) @@ -576,7 +581,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_ENDPOINT, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) | (usb.USB_REQUEST_TYPE_CLASS << 5) | (usb.USB_REQUEST_TARGET_ENDPOINT & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0600 ClearFeature') }) @@ -584,7 +589,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { /** * @tc.number : SUB_USB_JS_0610 * @tc.name : controlTransfer - * @tc.desc : 控制传输 ClearFeature: ccmd 255 reqType 5 value 512 index 0 + * @tc.desc : 控制传输 ClearFeature: cmd 255 reqType 5 value 512 index 0 */ it('SUB_USB_JS_0610', 0, function () { console.info('usb SUB_USB_JS_0610 begin'); @@ -600,7 +605,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_OTHER, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) | (usb.USB_REQUEST_TYPE_VENDOR << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), (2 << 8), 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0610 ClearFeature') }) @@ -624,7 +629,7 @@ describe('UsbDevicePipeJsFunctionsTest', function () { } var timeout = 5000; - var controlParam = getTransferParam(255, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) + var controlParam = getTransferParam(255, usb.USB_REQUEST_TARGET_OTHER, (usb.USB_REQUEST_DIR_TO_DEVICE << 7) | (usb.USB_REQUEST_TYPE_CLASS << 5) | (usb.USB_REQUEST_TARGET_OTHER & 0x1f), 0, 0) callControlTransfer(testParam.pip, controlParam, timeout, 'SUB_USB_JS_0620 ClearFeature') }) diff --git a/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunitEx.test.js b/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunitEx.test.js index 1e963c6d1ca7992977f066862a85d50762a8287b..c46a737ad3ae084a5012bcac08be45d910976767 100644 --- a/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunitEx.test.js +++ b/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunitEx.test.js @@ -45,7 +45,7 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () { }); console.log('*************Usb Unit switch to host Ex Begin*************'); - CheckEmptyUtils.sleep(3000) + CheckEmptyUtils.sleep(8000) } } else { portCurrentMode = 1 @@ -174,6 +174,7 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () { expect(false).assertFalse(); console.info('usb case SUB_USB_JS_0650 : PASS'); }); + CheckEmptyUtils.sleep(3000); }) /** @@ -210,6 +211,7 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () { expect(false).assertFalse(); console.info('usb case SUB_USB_JS_0660 : PASS'); }); + CheckEmptyUtils.sleep(3000); }) /** @@ -246,6 +248,7 @@ describe('UsbDevicePipeJsFunctionsTestEx', function () { expect(false).assertFalse(); console.info('usb case SUB_USB_JS_0670 : PASS'); }); + CheckEmptyUtils.sleep(3000); }) /** diff --git a/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit_A.test.js b/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit_A.test.js index c5e9776e87e29e7b7c566bbb623636e616f95076..50394c948031523467fe272f22a12364a703b1da 100644 --- a/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit_A.test.js +++ b/usb/usb_standard/src/main/js/test/UsbDevicePipeJsunit_A.test.js @@ -42,6 +42,7 @@ describe('UsbDevicePipeJsFunctionsTestA', function () { }).catch(error => { console.info('usb case setPortRoles error : ' + error); }); + CheckEmptyUtils.sleep(8000) console.log('*************Usb Unit switch to host Begin*************'); } } else { @@ -177,6 +178,7 @@ describe('UsbDevicePipeJsFunctionsTestA', function () { console.info('usb case readData error : ' + JSON.stringify(error)); expect(false).assertTrue(); }); + CheckEmptyUtils.sleep(3000); }) /** @@ -218,7 +220,7 @@ describe('UsbDevicePipeJsFunctionsTestA', function () { console.info('usb write error : ' + JSON.stringify(error)); expect(false).assertTrue(); }); - + CheckEmptyUtils.sleep(3000); }) /** @@ -428,6 +430,7 @@ describe('UsbDevicePipeJsFunctionsTestA', function () { console.info('usb' + caseName + ': PASS'); expect(false).assertTrue(); }); + CheckEmptyUtils.sleep(3000); } /** diff --git a/usb/usb_standard/src/main/js/test/UsbFunctionsJsunit.test.js b/usb/usb_standard/src/main/js/test/UsbFunctionsJsunit.test.js index a436e212c0c5f5f73be77f1d4309af3a222ea923..1a70a6f61cc7e0d6d558cb620f9825399b71f554 100644 --- a/usb/usb_standard/src/main/js/test/UsbFunctionsJsunit.test.js +++ b/usb/usb_standard/src/main/js/test/UsbFunctionsJsunit.test.js @@ -34,6 +34,7 @@ describe('UsbFunctionsJsFunctionsTest', function () { }).catch(error => { console.info('usb case setPortRoles error : ' + error); }); + CheckEmptyUtils.sleep(8000) console.log('*************Usb Unit switch to device Begin*************'); } } @@ -96,5 +97,21 @@ describe('UsbFunctionsJsFunctionsTest', function () { console.info('usb SUB_USB_JS_0340 : PASS'); }) + /** + * @tc.number : SUB_USB_JS_1000 + * @tc.name : getCurrentFunctions + * @tc.desc : 反向测试 获取当前设备模式 + */ + it('SUB_USB_JS_1000', 0, function () { + console.info('usb SUB_USB_JS_1000 begin'); + try { + var maskCode = usb.getCurrentFunctions("invalid"); + console.info('usb case getCurrentFunctions return: ' + maskCode); + } catch (err) { + console.info('catch err code: ' + err.code + ' message: ' + err.message); + expect(err.code).assertEqual(401); + console.info('usb SUB_USB_JS_1000 : PASS'); + } + }) }) } diff --git a/usb/usb_standard/src/main/js/test/UsbFunctionsJsunitEx.test.js b/usb/usb_standard/src/main/js/test/UsbFunctionsJsunitEx.test.js index ab794fe7108aa8f54fd739662c6367b22dd3114e..a0e4895bf06624b4b10c15bc9f4ec10541815088 100644 --- a/usb/usb_standard/src/main/js/test/UsbFunctionsJsunitEx.test.js +++ b/usb/usb_standard/src/main/js/test/UsbFunctionsJsunitEx.test.js @@ -33,7 +33,7 @@ describe('UsbFunctionsJsFunctionsTestEx', function () { }).catch(error => { console.info('usb case setPortRoles error : ' + error); }); - + CheckEmptyUtils.sleep(8000) console.log('*************Usb Unit switch to device Begin*************'); } } @@ -135,7 +135,7 @@ describe('UsbFunctionsJsFunctionsTestEx', function () { var maskCode = usb.ACM | usb.HDC console.info('usb case maskCode : ' + maskCode); var strMaskCode = usb.usbFunctionsToString(maskCode) - expect(strMaskCode).assertEqual('hdc,acm'); + expect(strMaskCode).assertEqual('acm,hdc'); console.info('usb case maskCode ' + maskCode + ' usbFunctionsToString return int: ' + strMaskCode); console.info('usb SUB_USB_JS_0980 : PASS'); }) @@ -150,7 +150,7 @@ describe('UsbFunctionsJsFunctionsTestEx', function () { var maskCode = usb.ECM | usb.HDC console.info('usb case maskCode : ' + maskCode); var strMaskCode = usb.usbFunctionsToString(maskCode) - expect(strMaskCode).assertEqual('hdc,ecm'); + expect(strMaskCode).assertEqual('ecm,hdc'); console.info('usb case maskCode ' + maskCode + ' usbFunctionsToString return int: ' + strMaskCode); console.info('usb SUB_USB_JS_0990 : PASS'); }) diff --git a/usb/usb_standard/src/main/js/test/UsbPortAndFunctionJsunit.test.js b/usb/usb_standard/src/main/js/test/UsbPortAndFunctionJsunit.test.js index bf82bcf6639c76d8f2cea61bf839b9eb8473f491..6272a1b0f9b2cbdea93ad25ee7e290506094acc4 100644 --- a/usb/usb_standard/src/main/js/test/UsbPortAndFunctionJsunit.test.js +++ b/usb/usb_standard/src/main/js/test/UsbPortAndFunctionJsunit.test.js @@ -34,6 +34,7 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () { }).catch(error => { console.info('usb case setPortRoles error : ' + error); }); + CheckEmptyUtils.sleep(8000) console.log('*************Usb Unit switch to device Begin*************'); } } @@ -49,7 +50,6 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () { }) function callSetCurFunction(caseName, iValue) { - CheckEmptyUtils.sleep(3000) console.info('usb case param case name:' + caseName); console.info('usb case param iValue:' + iValue); usb.setCurrentFunctions(iValue).then(data => { @@ -60,6 +60,7 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () { console.info('usb case ' + caseName + ' error : ' + error); expect(false).assertTrue(); }); + CheckEmptyUtils.sleep(6000) } /** @@ -175,6 +176,7 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () { console.info('usb case setPortRoles error : ' + error); expect(false).assertTrue(); }); + CheckEmptyUtils.sleep(8000) } console.info('usb SUB_USB_JS_0010 device 2 2: PASS'); @@ -197,7 +199,6 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () { for (var i = 0; i < usbPortList.length; i++) { console.info('usb case set data role 1, data role 1'); - CheckEmptyUtils.sleep(5000) usb.setPortRoles(usbPortList[i].id, usb.SOURCE, usb.HOST).then(data => { expect(data).assertTrue(); console.info('usb case setPortRoles return: ' + data); @@ -205,6 +206,7 @@ describe('UsbPortAndFunctionsJsFunctionsTest', function () { console.info('usb case setPortRoles error : ' + error); expect(false).assertTrue(); }); + CheckEmptyUtils.sleep(8000) } console.info('usb SUB_USB_JS_0020 host 1 1: PASS'); diff --git a/usb/usb_standard/src/main/js/test/UsbPortJsunitEx.test.js b/usb/usb_standard/src/main/js/test/UsbPortJsunitEx.test.js index 7afbf9d16cd57454f19b9c6a75c616f9c7d01868..38d1c473f009fb81c38432a2df61857129b36cee 100644 --- a/usb/usb_standard/src/main/js/test/UsbPortJsunitEx.test.js +++ b/usb/usb_standard/src/main/js/test/UsbPortJsunitEx.test.js @@ -72,7 +72,6 @@ describe('UsbPortJsFunctionsTestEx', function () { var portId = gPort.id; var powerRole = usb.SINK; var dataRole = usb.NONE - 1; - CheckEmptyUtils.sleep(2000) usb.setPortRoles(portId, powerRole, dataRole).then(data => { console.info('usb case setPortRoles return: ' + data); expect(data).assertTrue(); @@ -81,6 +80,7 @@ describe('UsbPortJsFunctionsTestEx', function () { expect(error).assertFalse(); console.info('usb SUB_USB_JS_0030: PASS'); }) + CheckEmptyUtils.sleep(8000) console.info('usb SUB_USB_JS_0030: PASS'); expect(true).assertTrue(); @@ -95,7 +95,6 @@ describe('UsbPortJsFunctionsTestEx', function () { var portId = gPort.id; var powerRole = usb.NONE - 1; var dataRole = usb.DEVICE; - CheckEmptyUtils.sleep(2000) usb.setPortRoles(portId, powerRole, dataRole).then(data => { console.info('usb case setPortRoles return: ' + data); expect(data).assertTrue(); @@ -104,7 +103,7 @@ describe('UsbPortJsFunctionsTestEx', function () { expect(error).assertFalse(); console.info('usb SUB_USB_JS_0040: PASS'); }) - + CheckEmptyUtils.sleep(8000) console.info('usb SUB_USB_JS_0040: PASS'); expect(true).assertTrue(); }) @@ -118,7 +117,6 @@ describe('UsbPortJsFunctionsTestEx', function () { var portId = gPort.id - 3; var powerRole = usb.SINK; var dataRole = usb.NONE - 1; - CheckEmptyUtils.sleep(2000) usb.setPortRoles(portId, powerRole, dataRole).then(data => { console.info('usb case setPortRoles return: ' + data); expect(data).assertTrue(); @@ -127,7 +125,7 @@ describe('UsbPortJsFunctionsTestEx', function () { expect(error).assertFalse(); console.info('usb SUB_USB_JS_0050: PASS'); }) - + CheckEmptyUtils.sleep(8000) console.info('usb SUB_USB_JS_0050: PASS'); expect(true).assertTrue(); }) @@ -141,7 +139,6 @@ describe('UsbPortJsFunctionsTestEx', function () { var portId = gPort.id; var powerRole = usb.NONE - 1; var dataRole = usb.NONE - 1; - CheckEmptyUtils.sleep(2000) usb.setPortRoles(portId, powerRole, dataRole).then(data => { console.info('usb case setPortRoles return: ' + data); expect(data).assertTrue(); @@ -150,7 +147,7 @@ describe('UsbPortJsFunctionsTestEx', function () { expect(error).assertFalse(); console.info('usb SUB_USB_JS_0060: PASS'); }) - + CheckEmptyUtils.sleep(8000) console.info('usb SUB_USB_JS_0060: PASS'); expect(true).assertTrue(); }) @@ -164,8 +161,6 @@ describe('UsbPortJsFunctionsTestEx', function () { var portId = gPort.id - 1; var dataRole = usb.NONE - 1; var powerRole = usb.NONE - 1; - - CheckEmptyUtils.sleep(2000) usb.setPortRoles(portId, powerRole, dataRole).then(data => { console.info('usb case setPortRoles return: ' + data); expect(data).assertTrue(); @@ -174,7 +169,7 @@ describe('UsbPortJsFunctionsTestEx', function () { expect(error).assertFalse(); console.info('usb SUB_USB_JS_0070: PASS'); }) - + CheckEmptyUtils.sleep(8000) console.info('usb SUB_USB_JS_0070: PASS'); expect(true).assertTrue(); }) @@ -188,7 +183,6 @@ describe('UsbPortJsFunctionsTestEx', function () { var portId = gPort.id - 1; var powerRole = 1; var dataRole = 1; - CheckEmptyUtils.sleep(2000) usb.setPortRoles(portId, powerRole, dataRole).then(data => { console.info('usb case setPortRoles return: ' + data); expect(data).assertTrue(); @@ -197,7 +191,7 @@ describe('UsbPortJsFunctionsTestEx', function () { expect(error).assertFalse(); console.info('usb SUB_USB_JS_0080: PASS'); }) - + CheckEmptyUtils.sleep(8000) console.info('usb SUB_USB_JS_0080: PASS'); expect(true).assertTrue(); }) diff --git a/useriam/face_auth/js_api_test/function_test/userauth/src/main/config.json b/useriam/face_auth/js_api_test/function_test/userauth/src/main/config.json index df5befd4868cf8a9457afa05e0139746ae57297f..12fdd4fa3dc79b20f34b29e4709c85a8851e1834 100644 --- a/useriam/face_auth/js_api_test/function_test/userauth/src/main/config.json +++ b/useriam/face_auth/js_api_test/function_test/userauth/src/main/config.json @@ -18,6 +18,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone", "tablet", "tv", diff --git a/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/config.json b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/config.json index 358611b8678dcebf5d97e5be5f22f9a751812770..be75468c7cd30bdccafbb7121b9664be7919018f 100644 --- a/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/config.json +++ b/useriam/face_auth/js_api_test/function_test/userauthpart2/src/main/config.json @@ -18,6 +18,7 @@ "name": ".entry", "mainAbility": ".MainAbility", "deviceType": [ + "default", "phone", "tablet", "tv",